toSubBounds static method
Splits Bound to smaller bounds equivalent of number of division
^2
Implementation
static List<GMULatLngBounds> toSubBounds(
GMULatLngBounds bounds, {
int division = 2,
}) {
List<GMULatLngBounds> subBounds = [];
final northEast = bounds.northEast;
final southWest = bounds.southWest;
final xDistanceStep = (northEast.x - southWest.x) / division;
final yDistanceStep = (northEast.y - southWest.y) / division;
for (int i = 1; i <= division; i++) {
num currentX = southWest.x;
num currentY = southWest.y;
for (int j = 1; j <= division; j++) {
final newNorthEast = Point(
currentX + xDistanceStep * i,
currentY + yDistanceStep * j,
);
final newSouthWest = Point(
currentX + (xDistanceStep * (i - 1)),
currentY + (yDistanceStep * (j - 1)),
);
subBounds.add(
GMULatLngBounds(northEast: newNorthEast, southWest: newSouthWest),
);
}
}
return subBounds;
}