@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((hints == null) ? 0 : hints.hashCode()); result = prime * result + ((id == null) ? 0 : id.hashCode()); return result; }
/** * Returns the reader hints based on the current WCS configuration * * @param wcs */ public static Hints getReaderHints(WCSInfo wcs) { Hints hints = new Hints(); hints.add(new Hints(Hints.LENIENT_DATUM_SHIFT, Boolean.TRUE)); if (wcs.getOverviewPolicy() == null) { hints.add(new Hints(Hints.OVERVIEW_POLICY, OverviewPolicy.IGNORE)); } else { hints.add(new Hints(Hints.OVERVIEW_POLICY, wcs.getOverviewPolicy())); } hints.put( Hints.DECIMATION_POLICY, wcs.isSubsamplingEnabled() ? DecimationPolicy.ALLOW : DecimationPolicy.DISALLOW); return hints; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; CoverageHintReaderKey other = (CoverageHintReaderKey) obj; if (hints == null) { if (other.hints != null) return false; } else if (!hints.equals(other.hints)) return false; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; return true; } }
final Hints defHints = GeoTools.getDefaultHints(); if (defHints != null && defHints.containsKey(Hints.EXECUTOR_SERVICE)) { executor = (ThreadPoolExecutor) defHints.get(Hints.EXECUTOR_SERVICE);
@Test public void testStartupListener() { Hints hints = GeoTools.getDefaultHints(); final Object factory = hints.get(Hints.GRID_COVERAGE_FACTORY); assertNotNull(factory); assertTrue(factory instanceof GridCoverageFactory); final Object datumShift = hints.get(Hints.LENIENT_DATUM_SHIFT); assertNotNull(datumShift); assertTrue((Boolean) datumShift); final Object tolerance = hints.get(Hints.COMPARISON_TOLERANCE); assertNotNull(tolerance); assertEquals(CUSTOM_TOLERANCE, (Double) tolerance, 1e-12d); final Object filterFactory = hints.get(Hints.FILTER_FACTORY); assertNotNull(filterFactory); assertTrue(filterFactory instanceof FilterFactory); final Object styleFactory = hints.get(Hints.STYLE_FACTORY); assertNotNull(styleFactory); assertTrue(styleFactory instanceof StyleFactory); final Object featureFactory = hints.get(Hints.FEATURE_FACTORY); assertNotNull(featureFactory); assertTrue(featureFactory instanceof FeatureFactory); final Object executorService = hints.get(Hints.EXECUTOR_SERVICE); assertNotNull(executorService); assertTrue(executorService instanceof ExecutorService); }
public GridCoverage getGridCoverage( ProgressListener listener, ReferencedEnvelope envelope, Hints hints) throws IOException { // manage projection policy if (this.projectionPolicy == ProjectionPolicy.FORCE_DECLARED) { final Hints crsHints = new Hints(Hints.DEFAULT_COORDINATE_REFERENCE_SYSTEM, this.getCRS()); if (hints != null) hints.putAll(crsHints); else hints = crsHints; } return catalog.getResourcePool().getGridCoverage(this, envelope, hints); }
/** Builds the default coverage contained in the current store */ public CoverageInfo buildCoverage(String coverageName) throws Exception { if (store == null || !(store instanceof CoverageStoreInfo)) { throw new IllegalStateException("Coverage store not set."); } CoverageStoreInfo csinfo = (CoverageStoreInfo) store; GridCoverage2DReader reader = (GridCoverage2DReader) catalog.getResourcePool() .getGridCoverageReader(csinfo, GeoTools.getDefaultHints()); if (reader == null) throw new Exception( "Unable to acquire a reader for this coverage with format: " + csinfo.getFormat().getName()); return buildCoverage(reader, coverageName, null); }
public int removeGranules(Filter filter) { return removeGranules(filter, new Hints()); }
@BeforeClass public static final void setUpReferencing() throws Exception { // do we need to reset the referencing subsystem and reorient it with lon/lat order? if (System.getProperty("org.geotools.referencing.forceXY") == null || !"http".equals(Hints.getSystemDefault(Hints.FORCE_AXIS_ORDER_HONORING))) { System.setProperty("org.geotools.referencing.forceXY", "true"); Hints.putSystemDefault(Hints.FORCE_AXIS_ORDER_HONORING, "http"); } }
private void addAlphaColorModelHint(Hints localHints, int currentBandCount) { ImageLayout layout = new ImageLayout(); ColorModel alphaModel = getColorModelWithAlpha(currentBandCount); layout.setColorModel(alphaModel); localHints.put(JAI.KEY_IMAGE_LAYOUT, layout); }
} else { Hints mix = userQuery.getHints(); mix.putAll(securityQuery.getHints()); result.setHints(mix);
public GridCoverageReader getGridCoverageReader(ProgressListener listener, Hints hints) throws IOException { // manage projection policy if (this.projectionPolicy == ProjectionPolicy.FORCE_DECLARED) { final Hints crsHints = new Hints(Hints.DEFAULT_COORDINATE_REFERENCE_SYSTEM, this.getCRS()); if (hints != null) hints.putAll(crsHints); else hints = crsHints; } return catalog.getResourcePool().getGridCoverageReader(this, nativeCoverageName, hints); }
/** * Builds the default coverage contained in the current store * * @param nativeCoverageName the native name for the coverage * @param specifiedName the published name for the coverage. If null, the name will be * determined from the coverage store. * @return coverage for the specified name * @throws Exception if the coverage store was not found or could not be read, or if the * coverage could not be created. */ public CoverageInfo buildCoverageByName(String nativeCoverageName, String specifiedName) throws Exception { if (store == null || !(store instanceof CoverageStoreInfo)) { throw new IllegalStateException("Coverage store not set."); } CoverageStoreInfo csinfo = (CoverageStoreInfo) store; GridCoverage2DReader reader = (GridCoverage2DReader) catalog.getResourcePool() .getGridCoverageReader(csinfo, GeoTools.getDefaultHints()); if (reader == null) throw new Exception( "Unable to acquire a reader for this coverage with format: " + csinfo.getFormat().getName()); return buildCoverageInternal(reader, nativeCoverageName, null, specifiedName); }
GridCoverageReader returnedReader2 = pool.getGridCoverageReader( storeInfo, new Hints(Hints.KEY_ANTIALIASING, Hints.VALUE_ANTIALIAS_ON)); assertThat(reader, equalTo(returnedReader2)); final Hints hints2 = capturedHints.getValue();
query.getHints().put(Hints.LINEARIZATION_TOLERANCE, linearizationTolerance);
public GridCoverage getGridCoverage(ProgressListener listener, Hints hints) throws IOException { // manage projection policy if (this.projectionPolicy == ProjectionPolicy.FORCE_DECLARED) { final Hints crsHints = new Hints(Hints.DEFAULT_COORDINATE_REFERENCE_SYSTEM, this.getCRS()); if (hints != null) hints.putAll(crsHints); else hints = crsHints; } return catalog.getResourcePool().getGridCoverage(this, null, hints); }
r = (GridCoverage2DReader) ci.getGridCoverageReader(null, GeoTools.getDefaultHints()); assertTrue( CRS.equalsIgnoreMetadata( r = (GridCoverage2DReader) rpool.getGridCoverageReader(store, GeoTools.getDefaultHints()); assertTrue( CRS.equalsIgnoreMetadata(
query.setMaxFeatures(maxEntries); query.setPropertyNames(new String[] {descriptor.getStartAttribute()}); query.setHints(new Hints(StructuredCoverageViewReader.QUERY_FIRST_BAND, true));
@Test public void testDropCoverageStore() throws Exception { // build the store Catalog cat = getCatalog(); CatalogBuilder cb = new CatalogBuilder(cat); CoverageStoreInfo store = cb.buildCoverageStore("dem"); store.setURL(MockData.class.getResource("tazdem.tiff").toExternalForm()); store.setType("GeoTIFF"); cat.add(store); // build the coverage cb.setStore(store); CoverageInfo ci = cb.buildCoverage(); cat.add(ci); // build the layer LayerInfo layer = cb.buildLayer(ci); cat.add(layer); // grab a reader just to inizialize the code ci.getGridCoverage(null, null); ci.getGridCoverageReader(null, GeoTools.getDefaultHints()); // now drop the store CascadeDeleteVisitor visitor = new CascadeDeleteVisitor(cat); visitor.visit(store); // and reload (GEOS-4782 -> BOOM!) getGeoServer().reload(); }