@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); }
executor = (ThreadPoolExecutor) defHints.get(Hints.EXECUTOR_SERVICE);
/** * Returns a rendering hint. * * @param key The hint key (e.g. {@link Hints#JAI_INSTANCE}). * @return The hint value for the specified key, or {@code null} if there is no hint for the * specified key. */ public final Object getRenderingHint(final RenderingHints.Key key) { return hints.get(key); }
public void setHints(Hints hints) { if (hints != null) { this.simplificationDistance = (Number) hints.get(Hints.GEOMETRY_DISTANCE); } }
/** * Helper method that return TRUE if the where clause place holder should be keep, otherwise * FALSE if it should be removed. */ private static boolean keepWhereClausePlaceHolder(Hints hints) { if (hints == null) { // no hints provided, we are done return false; } // let's see if the where clause place holder needs to be removed Object value = hints.get(KEEP_WHERE_CLAUSE_PLACE_HOLDER_KEY); return value != null && value instanceof Boolean && (boolean) value; }
/** Stores a value from the specified hints. */ private void put(final Hints userHints, final Hints.Key key) { Object value = null; if (userHints != null) { value = userHints.get(key); } if (value == null) { value = Boolean.FALSE; } hints.put(key, value); }
/** Extracts the SRID from the hints, or returns {@code 0} if none. */ private static int getSRID(final Hints hints) { if (hints != null) { final Integer SRID = (Integer) hints.get(Hints.JTS_SRID); if (SRID != null) { return SRID.intValue(); } } return 0; }
/** Returns the boolean value for the specified hint. */ private static boolean booleanValue(final Hints userHints, final Hints.Key key) { if (userHints != null) { final Boolean value = (Boolean) userHints.get(key); if (value != null) { return value.booleanValue(); } } return false; }
/** Stores a value from the specified hints. */ private void put(final Hints userHints, final Hints.Key key) { Object value = null; if (userHints != null) { value = userHints.get(key); } if (value == null) { value = Boolean.FALSE; } hints.put(key, value); }
private GeometryFactory findGeometryFactory(Hints hints) { GeometryFactory geomFactory = (GeometryFactory) hints.get(Hints.JTS_GEOMETRY_FACTORY); if (geomFactory == null) { CoordinateSequenceFactory seqFac; seqFac = (CoordinateSequenceFactory) hints.get(Hints.JTS_COORDINATE_SEQUENCE_FACTORY); if (seqFac == null) { seqFac = PackedCoordinateSequenceFactory.DOUBLE_FACTORY; } geomFactory = new GeometryFactory(seqFac); } return geomFactory; }
final Object factory = this.hints.get(Hints.GRID_COVERAGE_FACTORY); if (factory != null && factory instanceof GridCoverageFactory) { this.coverageFactory = (GridCoverageFactory) factory;
protected static boolean isGeotoolsLongitudeFirstAxisOrderForced() { return Boolean.getBoolean(GeoTools.FORCE_LONGITUDE_FIRST_AXIS_ORDER) || GeoTools.getDefaultHints().get(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER) == Boolean.TRUE; } /** Sets BBOX and SRS using the provided Envelope. */
private void updateLocalHints(Hints hints, RenderingHints localHints) { if (hints != null && hints.containsKey(JAI.KEY_TILE_CACHE)) { final Object cache = hints.get(JAI.KEY_TILE_CACHE); if (cache != null && cache instanceof TileCache) localHints.add(new RenderingHints(JAI.KEY_TILE_CACHE, (TileCache) cache)); } if (hints != null && hints.containsKey(JAI.KEY_TILE_SCHEDULER)) { final Object scheduler = hints.get(JAI.KEY_TILE_SCHEDULER); if (scheduler != null && scheduler instanceof TileScheduler) localHints.add( new RenderingHints(JAI.KEY_TILE_SCHEDULER, (TileScheduler) scheduler)); } }
/** Utility method used to produce cache based on provide Hint */ public static ObjectCache create(Hints hints) throws FactoryRegistryException { if (hints == null) hints = GeoTools.getDefaultHints(); String policy = (String) hints.get(Hints.CACHE_POLICY); int limit = Hints.CACHE_LIMIT.toValue(hints); return create(policy, limit); } /**
private ImageMosaicReader getImageMosaicReader(Hints hints) { ImageMosaicReader imReader = null; if (hints != null && hints.containsKey(Utils.MOSAIC_READER)) { Object reader = hints.get(Utils.MOSAIC_READER); if (reader instanceof ImageMosaicReader) { if (getParentReader() == null) { setParentReader((ImageMosaicReader) reader); } imReader = (ImageMosaicReader) reader; } } return imReader; }
@Override protected FeatureReader<SimpleFeatureType, SimpleFeature> getReaderInternal(Query query) throws IOException { File file = new File(store.dir, typeName + ".properties"); PropertyFeatureReader reader = new PropertyFeatureReader(store.getNamespaceURI(), file, getGeometryFactory(query)); Double tolerance = (Double) query.getHints().get(Hints.LINEARIZATION_TOLERANCE); if (tolerance != null) { reader.setWKTReader(new WKTReader2(tolerance)); } return reader; }
private Hints updateRepositoryHints(CatalogBuilderConfiguration configuration, Hints hints) { ImageMosaicReader reader = getImageMosaicReader(hints); if (reader != null) { Hints readerHints = reader.getHints(); if (readerHints != null && readerHints.containsKey(Hints.REPOSITORY)) { hints.add(new Hints(Hints.REPOSITORY, readerHints.get(Hints.REPOSITORY))); } } return hints; }
public GeometryBuilder(Hints hints) { this.crs = (CoordinateReferenceSystem) hints.get(Hints.CRS); this.hints = hints; getPositionFactory(); getPrecision(); getPrimitiveFactory(); getAggregateFactory(); getGeometryFactory(); getComplexFactory(); }
public void testMixQueryAll() { // mixing Query.ALL equivalents with extra hints did not work Query firstQuery = new Query(Query.ALL); Query secondQuery = new Query(Query.ALL); firstQuery.setHints(new Hints(Hints.USE_PROVIDED_FID, Boolean.TRUE)); secondQuery.setHints(new Hints(Hints.FEATURE_2D, Boolean.TRUE)); Query mixed = DataUtilities.mixQueries(firstQuery, secondQuery, "mixer"); assertEquals(2, mixed.getHints().size()); assertTrue((Boolean) mixed.getHints().get(Hints.USE_PROVIDED_FID)); assertTrue((Boolean) mixed.getHints().get(Hints.FEATURE_2D)); }