* The latitude marking the top edge of the bounding box.
* @param bottom
* The latitude marking the bottom edge of the bounding box.
*/
public BoundingBoxContext(double left, double right, double top, double bottom) {
TileCalculator tileCalculator;
Comparator<Integer> tileOrdering;
int calculatedTile;
int tmpMinimumTile;
int tmpMaximumTile;
// Create utility objects.
tileCalculator = new TileCalculator();
tileOrdering = new UnsignedIntegerComparator();
// Create a rectangle representing the bounding box.
boundingBox = new Rectangle2D.Double(left, bottom, right - left, top - bottom);
// Calculate the maximum and minimum tile values for the bounding box.
calculatedTile = (int) tileCalculator.calculateTile(top, left);
tmpMaximumTile = calculatedTile;
tmpMinimumTile = calculatedTile;
calculatedTile = (int) tileCalculator.calculateTile(top, right);
if (tileOrdering.compare(calculatedTile, tmpMinimumTile) < 0) {
tmpMinimumTile = calculatedTile;
}
if (tileOrdering.compare(calculatedTile, tmpMaximumTile) > 0) {
tmpMaximumTile = calculatedTile;
}
calculatedTile = (int) tileCalculator.calculateTile(bottom, left);
if (tileOrdering.compare(calculatedTile, tmpMinimumTile) < 0) {
tmpMinimumTile = calculatedTile;
}
if (tileOrdering.compare(calculatedTile, tmpMaximumTile) > 0) {
tmpMaximumTile = calculatedTile;
}
calculatedTile = (int) tileCalculator.calculateTile(bottom, right);
if (tileOrdering.compare(calculatedTile, tmpMinimumTile) < 0) {
tmpMinimumTile = calculatedTile;
}
if (tileOrdering.compare(calculatedTile, tmpMaximumTile) > 0) {
tmpMaximumTile = calculatedTile;