/** * Return the BoundingBox of a rectangle of tiles defined by upper left and lower right tile. * * @param upperLeft tile in upper left corner. * @param lowerRight tile in lower right corner. * @return BoundingBox defined by the area around upperLeft and lowerRight Tile. */ public static BoundingBox getBoundingBox(Tile upperLeft, Tile lowerRight) { BoundingBox ul = upperLeft.getBoundingBox(); BoundingBox lr = lowerRight.getBoundingBox(); return ul.extendBoundingBox(lr); }
/** * adds another mapDataStore * * @param mapDataStore the mapDataStore to add * @param useStartZoomLevel if true, use the start zoom level of this mapDataStore as the start zoom level * @param useStartPosition if true, use the start position of this mapDataStore as the start position */ public void addMapDataStore(MapDataStore mapDataStore, boolean useStartZoomLevel, boolean useStartPosition) { if (this.mapDatabases.contains(mapDataStore)) { throw new IllegalArgumentException("Duplicate map database"); } this.mapDatabases.add(mapDataStore); if (useStartZoomLevel) { this.startZoomLevel = mapDataStore.startZoomLevel(); } if (useStartPosition) { this.startPosition = mapDataStore.startPosition(); } if (null == this.boundingBox) { this.boundingBox = mapDataStore.boundingBox(); } else { this.boundingBox = this.boundingBox.extendBoundingBox(mapDataStore.boundingBox()); } }
@Test public void extendBoundingBoxTest() { BoundingBox boundingBox1 = new BoundingBox(MIN_LATITUDE, MIN_LONGITUDE, MAX_LATITUDE, MAX_LONGITUDE); BoundingBox boundingBox2 = new BoundingBox(MIN_LATITUDE - 1, MIN_LONGITUDE - 1, MAX_LATITUDE, MAX_LONGITUDE); BoundingBox boundingBox3 = new BoundingBox(MIN_LATITUDE, MIN_LONGITUDE, MAX_LATITUDE + 1, MAX_LONGITUDE + 1); Assert.assertEquals(boundingBox1, boundingBox1.extendBoundingBox(boundingBox1)); Assert.assertEquals(boundingBox2, boundingBox1.extendBoundingBox(boundingBox2)); Assert.assertEquals(boundingBox3, boundingBox1.extendBoundingBox(boundingBox3)); }
/** * Return the BoundingBox of a rectangle of tiles defined by upper left and lower right tile. * * @param upperLeft tile in upper left corner. * @param lowerRight tile in lower right corner. * @return BoundingBox defined by the area around upperLeft and lowerRight Tile. */ public static BoundingBox getBoundingBox(Tile upperLeft, Tile lowerRight) { BoundingBox ul = upperLeft.getBoundingBox(); BoundingBox lr = lowerRight.getBoundingBox(); return ul.extendBoundingBox(lr); }
/** * adds another mapDataStore * * @param mapDataStore the mapDataStore to add * @param useStartZoomLevel if true, use the start zoom level of this mapDataStore as the start zoom level * @param useStartPosition if true, use the start position of this mapDataStore as the start position */ public void addMapDataStore(MapDataStore mapDataStore, boolean useStartZoomLevel, boolean useStartPosition) { if (this.mapDatabases.contains(mapDataStore)) { throw new IllegalArgumentException("Duplicate map database"); } this.mapDatabases.add(mapDataStore); if (useStartZoomLevel) { this.startZoomLevel = mapDataStore.startZoomLevel(); } if (useStartPosition) { this.startPosition = mapDataStore.startPosition(); } if (null == this.boundingBox) { this.boundingBox = mapDataStore.boundingBox(); } else { this.boundingBox = this.boundingBox.extendBoundingBox(mapDataStore.boundingBox()); } }