boundingBoxOfTiles method
Implementation
@override
BoundingBox boundingBoxOfTiles(Tile upperLeft, Tile lowerRight) {
assert(upperLeft.zoomLevel == lowerRight.zoomLevel);
assert(upperLeft.tileY <= lowerRight.tileY);
assert(upperLeft.tileX <= lowerRight.tileX);
double minLatitude =
max(Projection.LATITUDE_MIN, tileYToLatitude(lowerRight.tileY + 1));
double minLongitude =
max(Projection.LONGITUDE_MIN, tileXToLongitude(upperLeft.tileX));
double maxLatitude =
min(Projection.LATITUDE_MAX, tileYToLatitude(upperLeft.tileY));
double maxLongitude =
min(Projection.LONGITUDE_MAX, tileXToLongitude(lowerRight.tileX + 1));
if (maxLongitude == -180) {
// fix for dateline crossing, where the right tile starts at -180 and causes an invalid bbox
maxLongitude = 180;
}
return BoundingBox(minLatitude, minLongitude, maxLatitude, maxLongitude);
}