/** * Comparing whether the differences between the bounding boxes can be ignored. * * @param obj * @return whether the boxes are equal */ @Override public boolean equals(Object obj) { if (obj != null && obj.getClass() == this.getClass()) { BoundingBox other = (BoundingBox) obj; return this.equals(other, EQUALITYTHRESHOLD); } return false; }
public void testGridSubsetBoundsClippedToTargetCrsAreaOfValidity() throws Exception { CoordinateReferenceSystem nativeCrs = CRS.decode("EPSG:4326", true); ReferencedEnvelope nativeBounds = new ReferencedEnvelope(-180, 180, -90, 90, nativeCrs); layerGroup.setBounds(nativeBounds); defaults.getDefaultCachingGridSetIds().clear(); defaults.getDefaultCachingGridSetIds().add("EPSG:900913"); layerGroupInfoTileLayer = new GeoServerTileLayer(layerGroup, defaults, gridSetBroker); // force building and setting the bounds to the saved representation layerGroupInfoTileLayer.getGridSubsets(); XMLGridSubset savedSubset = layerGroupInfoTileLayer.getInfo().getGridSubsets().iterator() .next(); BoundingBox gridSubsetExtent = savedSubset.getExtent(); BoundingBox expected = gridSetBroker.WORLD_EPSG3857.getOriginalExtent(); // don't use equals(), it uses an equality threshold we want to avoid here double threshold = 1E-16; assertTrue("Expected " + expected + ", got " + gridSubsetExtent, expected.equals(gridSubsetExtent, threshold)); }
|| !bbox.equals(gridSubset.boundsFromIndex(tileIndex), 0.02)) { log.debug("Recombinining tiles to respond to WMS request"); ConveyorTile tile = new ConveyorTile(sb, layers, request, response);
|| gridSubset.getTileWidth() != tileWidth || gridSubset.getTileHeight() != tileHeight || !bbox.equals(gridSubset.boundsFromIndex(tileIndex), 0.02)) { log.debug("Recombinining tiles to respond to WMS request"); ConveyorTile tile = new ConveyorTile(sb, layers, request, response);
public void testBBOXScale() throws Exception { BoundingBox bbox = new BoundingBox(-180.0, -90.0, 180.0, 90.0); BoundingBox copy = new BoundingBox(bbox); bbox.scale(1.0); bbox.scale(0.5); bbox.scale(2.0); assert (bbox.isSane()); assert (bbox.equals(copy)); }
public void test6gridLoctoBounds4326() throws Exception { BoundingBox bbox = new BoundingBox(-124.73, 24.96, -66.97, 49.37); GridSubset grid = GridSubsetFactory.createGridSubSet(gridSetBroker.getWorldEpsg4326(), bbox, 0, 10); long[] gridLoc1 = {1, 1, 1}; BoundingBox box1 = grid.boundsFromIndex(gridLoc1); boolean box1_comparison = box1.equals(new BoundingBox(-90.0, 0.0, 0.0, 90.0)); assertTrue(box1_comparison); boolean box1_kml = box1.toKMLLatLonBox() .equals( "<LatLonBox><north>90.0</north><south>0.0</south>" + "<east>0.0</east><west>-90.0</west></LatLonBox>"); assertTrue(box1_kml); long[] gridLoc2 = {5, 1, 2}; BoundingBox box2 = grid.boundsFromIndex(gridLoc2); boolean box2_comparison = box2.equals(new BoundingBox(45.0, -45.0, 90.0, 0.0)); assertTrue(box2_comparison); boolean box2_kml = box2.toKMLLatLonAltBox() .equals( "<LatLonAltBox><north>0.0</north><south>-45.0</south>" + "<east>90.0</east><west>45.0</west></LatLonAltBox>"); assertTrue(box2_kml); }
BoundingBox bboxSolution = new BoundingBox(599484.8750000002, 4912451.9275, 611635.5437500004, 4924602.59625); assertTrue(bboxSolution.equals(gridSubset.boundsFromIndex(gridLoc)));
BoundingBox bboxSolution = new BoundingBox(599484.8750000002, 4912451.9275, 611635.5437500004, 4924602.59625); assertTrue(bboxSolution.equals(gridSubset.boundsFromIndex(gridLoc)));
boolean needsTruncate = !getBounds().equals(another.getBounds()); needsTruncate |= isTopLeftAligned() != another.isTopLeftAligned(); needsTruncate |= getTileWidth() != another.getTileWidth();
assertTrue(epsg4326.getGridSetBounds().equals( new BoundingBox(-180.0, -90.0, 180.0, 90.0))); String mime = tl.getMimeTypes().get(1).getMimeType();