if (defHints != null && defHints.containsKey(Hints.EXECUTOR_SERVICE)) { executor = (ThreadPoolExecutor) defHints.get(Hints.EXECUTOR_SERVICE);
Hints localHints = new Hints(hints); if (dynamicAlphaSource != null && mergedBands.size() == 1 if (coverages.size() > 1) { Hints localHints = new Hints(hints); if (dynamicAlphaSource != null) { int currentBandCount = countBands(coverages); localHints.put( JAI.KEY_COLOR_MODEL_FACTORY, new ColorModelFactory() {
/** * 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; }
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); }
@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 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; }
@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); }
/** * Gets the max amount amount of features to keep in memory from the query and system hints * * @param query * @return */ static int getMaxFeatures(Query query) { Hints hints = null; if (query != null) { hints = query.getHints(); } int maxFeatures = 1000; if (hints != null && hints.get(Hints.MAX_MEMORY_SORT) != null) { maxFeatures = (Integer) hints.get(Hints.MAX_MEMORY_SORT); } else if (Hints.getSystemDefault(Hints.MAX_MEMORY_SORT) != null) { maxFeatures = (Integer) Hints.getSystemDefault(Hints.MAX_MEMORY_SORT); } return maxFeatures; }
public int removeGranules(Filter filter) { return removeGranules(filter, new Hints()); }
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)); }
/** * Merges the wrapper hints with the query ones, making sure not to overwrite the query ones * * @param q * @return */ protected Query mergeHints(Query q) { if (this.hints == null || this.hints.isEmpty()) { return q; } Query clone = new Query(q); Hints hints = clone.getHints(); if (hints == null || hints.isEmpty()) { clone.setHints(this.hints); } else { for (Entry<Object, Object> entry : this.hints.entrySet()) { if (!hints.containsKey(entry.getKey())) { hints.put(entry.getKey(), entry.getValue()); } } } return clone; }
Object o = Hints.getSystemDefault(Hints.EXECUTOR_SERVICE); if (o != null && o instanceof ExecutorService) { final ThreadPoolExecutor executor = (ThreadPoolExecutor) o;
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); }
boolean update = false; if (auxiliaryFilePath != null) { hints.add(new RenderingHints(Utils.AUXILIARY_FILES_PATH, auxiliaryFilePath)); update = true; hints.add( new RenderingHints(Utils.AUXILIARY_DATASTORE_PATH, auxiliaryDatastorePath)); update = true; && !hints.containsKey(Utils.PARENT_DIR)) { String parentDir = null; if (parentReader.parentDirectory != null) { hints.add(new RenderingHints(Utils.PARENT_DIR, parentDir));
/** */ private void setInterpolationHints() { if (interpolation instanceof InterpolationNearest) { this.hints.add(new RenderingHints(JAI.KEY_REPLACE_INDEX_COLOR_MODEL, Boolean.FALSE)); this.hints.add(new RenderingHints(JAI.KEY_TRANSFORM_ON_COLORMAP, Boolean.TRUE)); } else { this.hints.add(new RenderingHints(JAI.KEY_REPLACE_INDEX_COLOR_MODEL, Boolean.TRUE)); this.hints.add(new RenderingHints(JAI.KEY_TRANSFORM_ON_COLORMAP, Boolean.FALSE)); } }
public void testSRSAxisOrder2() throws Exception { try { Hints.putSystemDefault(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.TRUE); CoordinateReferenceSystem crsEN = CRS.decode("EPSG:4326"); assertEquals(AxisOrder.EAST_NORTH, CRS.getAxisOrder(crsEN)); CoordinateReferenceSystem crsNE = CRS.decode("urn:ogc:def:crs:EPSG::4326"); assertEquals(AxisOrder.NORTH_EAST, CRS.getAxisOrder(crsNE)); } finally { Hints.removeSystemDefault(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER); } }
/** Tests the {@link HTTP_AuthorityFactory#defaultAxisOrderHints} method. */ @Test public void testAxisOrderHints() { // The following are required for proper execution of the remaining of this test. assertNull(Hints.getSystemDefault(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER)); assertNull(Hints.getSystemDefault(Hints.FORCE_AXIS_ORDER_HONORING)); // Standard behavior should be to set FORCE_LONGITUDE_FIRST_AXIS_ORDER to false. assertFalse(HTTP_AuthorityFactory.defaultAxisOrderHints(null, "http")); try { // The hints should be ignored. Hints.putSystemDefault(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.TRUE); assertFalse(HTTP_AuthorityFactory.defaultAxisOrderHints(null, "http")); // The hints should be honored. Hints.putSystemDefault(Hints.FORCE_AXIS_ORDER_HONORING, "http"); assertTrue(HTTP_AuthorityFactory.defaultAxisOrderHints(null, "http")); // The hints should be ignored. Hints.putSystemDefault(Hints.FORCE_AXIS_ORDER_HONORING, "urn"); assertFalse(HTTP_AuthorityFactory.defaultAxisOrderHints(null, "http")); // The hints should be honored. Hints.putSystemDefault(Hints.FORCE_AXIS_ORDER_HONORING, "http, urn"); assertTrue(HTTP_AuthorityFactory.defaultAxisOrderHints(null, "http")); // The hints should be honored. Hints.putSystemDefault(Hints.FORCE_AXIS_ORDER_HONORING, "urn, http"); assertTrue(HTTP_AuthorityFactory.defaultAxisOrderHints(null, "http")); } finally { Hints.removeSystemDefault(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER); Hints.removeSystemDefault(Hints.FORCE_AXIS_ORDER_HONORING); } }
/** * Set the main parameters of this coverage request, getting basic information from the reader. * * @param reader a {@link BaseGridCoverage2DReader} from where to get basic coverage properties * as well as basic parameters to be used by the incoming read operations. */ private void setBaseParameters(final BaseGridCoverage2DReader reader) { input = reader.getInputFile(); this.coverageEnvelope = reader.getOriginalEnvelope().clone(); this.coverageRasterArea = ((GridEnvelope2D) reader.getOriginalGridRange()); this.coverageCRS = reader.getCoordinateReferenceSystem(); this.coverageName = reader.getCoverageName(); this.coverageGridToWorld2D = (MathTransform2D) reader.getRaster2Model(); this.coverageFullResolution = reader.getHighestRes(); this.hints = reader.getHints().clone(); this.multiLevelRoi = reader.getMultiLevelRoi(); if (layout != null) { this.hints.add(new RenderingHints(JAI.KEY_IMAGE_LAYOUT, layout)); } }