public BoundingBox getOriginalExtent() { if (this.subSetExtent == null) { return gridSet.getOriginalExtent(); } return this.subSetExtent; }
public static GridSubset createGridSubSet(GridSet gridSet) { GridSubset ret = createGridSubSet( gridSet, gridSet.getOriginalExtent(), 0, gridSet.getGridLevels().length - 1); return ret; }
/** * The base cordinates in x/y order, used to map tile indexes to coordinate bounding boxes. * These can either be top left or bottom left, so must be kept private. * * <p>This is a derived property of {@link #getOriginalExtent()} and {@link * #isTopLeftAligned()}. */ public double[] tileOrigin() { BoundingBox extent = getOriginalExtent(); double[] tileOrigin = {extent.getMinX(), yBaseToggle ? extent.getMaxY() : extent.getMinY()}; return tileOrigin; }
LOGGER.log(Level.WARNING, "Error computing layer bounds, assuming whole GridSet bounds", e); extent = gridSet.getOriginalExtent();
"Error computing layer bounds, assuming whole GridSet bounds", e); extent = gridSet.getOriginalExtent();
gridSetExtent = newGridSet.getOriginalExtent().intersection(gridSetExtent);
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)); }
gridSetExtent = newGridSet.getOriginalExtent().intersection(gridSetExtent);
@Override public boolean equals(Object obj) { if (!(obj instanceof GridSet)) return false; GridSet other = (GridSet) obj; if (this == other) return true; boolean equals = ObjectUtils.equals(getSrs(), other.getSrs()) && ObjectUtils.equals(getName(), other.getName()) && ObjectUtils.equals(getDescription(), other.getDescription()) && ObjectUtils.equals(getTileWidth(), other.getTileWidth()) && ObjectUtils.equals(getTileHeight(), other.getTileHeight()) && ObjectUtils.equals(isTopLeftAligned(), other.isTopLeftAligned()) && ObjectUtils.equals(isyCoordinateFirst(), other.isyCoordinateFirst()) && ObjectUtils.equals(getOriginalExtent(), other.getOriginalExtent()) && Arrays.equals(getGridLevels(), other.getGridLevels()); return equals; }
/** Builds an XMLGridSet from a GridSet */ public XMLGridSet(GridSet gset) { setAlignTopLeft(gset.isTopLeftAligned()); setYCoordinateFirst(gset.isyCoordinateFirst()); setExtent(gset.getOriginalExtent()); setLevels(null); if (gset.isResolutionsPreserved()) { setResolutions(resolutions(gset.getGridLevels())); setScaleDenominators(null); } else { setResolutions(null); setScaleDenominators(scaleDenominators(gset.getGridLevels())); } setMetersPerUnit(gset.getMetersPerUnit()); setName(gset.getName()); setDescription(gset.getDescription()); setPixelSize(gset.getPixelSize()); setScaleNames(scaleNames(gset.getGridLevels())); setSrs(gset.getSrs()); setTileWidth(gset.getTileWidth()); setTileHeight(gset.getTileHeight()); }
public void testLevels2() throws Exception { BoundingBox extent = new BoundingBox(0, 0, 1000, 1000); int levels = 16; int tileW = 300, tileH = 100; Double metersPerUnit = 1D; double pixelSize = GridSetFactory.DEFAULT_PIXEL_SIZE_METER; GridSet gridSet = GridSetFactory.createGridSet( "test", SRS.getSRS(3005), extent, false, levels, metersPerUnit, pixelSize, tileW, tileH, false); assertEquals(extent, gridSet.getOriginalExtent()); Grid[] gridLevels = gridSet.getGridLevels(); assertEquals(16, gridLevels.length); assertEquals(1, gridLevels[0].getNumTilesWide()); assertEquals(3, gridLevels[0].getNumTilesHigh()); for (int i = 1; i < gridLevels.length; i++) { assertEquals(2 * gridLevels[i - 1].getNumTilesWide(), gridLevels[i].getNumTilesWide()); assertEquals(2 * gridLevels[i - 1].getNumTilesHigh(), gridLevels[i].getNumTilesHigh()); } }