/** * 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; }
/** */ 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)); } }
/** * Used to combine provided hints with global GeoTools defaults. * * @param hints * @return */ public static Hints addDefaultHints(final Hints hints) { final Hints completed = getDefaultHints(); if (hints != null) { completed.add(hints); } return completed; }
private void setupInterpolationHints(final Interpolation interpolation) { //// // // INTERPOLATION // //// if (interpolation != null) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine("Rendering using interpolation " + interpolation); } this.interpolation = interpolation; hints.add(new RenderingHints(JAI.KEY_INTERPOLATION, this.interpolation)); if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine("Rendering using interpolation " + interpolation); } setInterpolationHints(); } }
public static Hints setupJAIHints(RenderingHints inputHints) { final Hints hints = new Hints(); if (inputHints != null) { // TileCache TileCache tc = Utils.getTileCacheHint(inputHints); if (tc != null) { hints.add(new RenderingHints(JAI.KEY_TILE_CACHE, tc)); } // TileScheduler TileScheduler tileScheduler = Utils.getTileSchedulerHint(inputHints); if (tileScheduler != null) { hints.add(new RenderingHints(JAI.KEY_TILE_SCHEDULER, tileScheduler)); } } return hints; }
/** * Returns new hints that combine user supplied hints with the {@linkplain * GeoTools#getDefaultHints defaults hints}. If a hint is specified in both user and default * hints, then user hints have precedence. * * <p>The returned hints should live only the time needed for invoking {@link FactoryRegistry} * methods. No long-term reference should be held. * * @param hints The user hints, or {@code null} if none. * @return New hints (never {@code null}). */ public static Hints mergeSystemHints(final Hints hints) { if (hints instanceof StrictHints) { /* * The hints have already been merged in a previous call to this method and we don't * want to merge them again. This case happen typically in factory constructor fetching * for dependencies. The constructor may have removed some hints. For example the * "URN:OGC" factory may looks for the "EPSG" factory with FORCE_LONGITUDE_FIRST * forced to FALSE. */ return hints; } final Hints merged = Hints.getDefaults(true); if (hints != null) { merged.add(hints); } return merged; } }
private void setReader(Hints hints, final boolean updateHints) { ImageMosaicReader reader = getImageMosaicReader(hints); if (reader != null && updateHints) { Hints readerHints = reader.getHints(); readerHints.add(hints); } }
if (hints != null) { this.hints.add(hints);
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.add(new RenderingHints(Utils.PARENT_DIR, parentDir));
private void setupTilingHints(final int tileSizeX, final int tileSizeY) { //// // // TILING // //// if (tileSizeX > 0 && tileSizeY > 0) { // Tile Size final ImageLayout layout = new ImageLayout2(); layout.setTileGridXOffset(0) .setTileGridYOffset(0) .setTileHeight(tileSizeY) .setTileWidth(tileSizeX); hints.add(new RenderingHints(JAI.KEY_IMAGE_LAYOUT, layout)); } }
/** * Constructs a default coverage processor. The {@link #scanForPlugins} method will be * automatically invoked the first time an operation is required. Additional operations can be * added by subclasses with the {@link #addOperation} method. Rendering hints will be * initialized with the following hints: * * <p> * * <ul> * <li>{@link JAI#KEY_REPLACE_INDEX_COLOR_MODEL} set to {@link Boolean#FALSE}. * <li>{@link JAI#KEY_TRANSFORM_ON_COLORMAP} set to {@link Boolean#FALSE}. * </ul> * * @param hints A set of additional rendering hints, or {@code null} if none. */ public CoverageProcessor(final RenderingHints hints) { registry = new FactoryRegistry(Arrays.asList(new Class<?>[] {Operation.class})); this.hints = new Hints(); this.hints.put(JAI.KEY_REPLACE_INDEX_COLOR_MODEL, Boolean.FALSE); this.hints.put(JAI.KEY_TRANSFORM_ON_COLORMAP, Boolean.FALSE); // override with user hints if (hints != null) this.hints.add(hints); }
this.hints = new Hints(Hints.LENIENT_DATUM_SHIFT, Boolean.TRUE); this.hints.add(hints);
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; }
/** * Creates an instance from the specified hints. This method recognizes the {@link * Hints#CRS_FACTORY CRS}, {@link Hints#CS_FACTORY CS}, {@link Hints#DATUM_FACTORY DATUM} and * {@link Hints#MATH_TRANSFORM_FACTORY MATH_TRANSFORM} {@code FACTORY} hints. * * @param hints The hints, or {@code null} if none. * @return A factory group created from the specified set of hints. */ public static ReferencingFactoryContainer instance(final Hints hints) { final Hints completed = GeoTools.getDefaultHints(); if (hints != null) { completed.add(hints); } /* * Use the same synchronization lock than ReferencingFactoryFinder (instead of this class) * in order to reduce the risk of dead lock. This is because ReferencingFactoryContainer * creation may queries ReferencingFactoryFinder, and some implementations managed by * ReferencingFactoryFinder may ask for a ReferencingFactoryContainer in turn. */ synchronized (ReferencingFactoryFinder.class) { if (cache == null) { cache = new FactoryCreator( Arrays.asList(new Class<?>[] {ReferencingFactoryContainer.class})); cache.registerFactory( new ReferencingFactoryContainer(null), ReferencingFactoryContainer.class); } return cache.getFactory(ReferencingFactoryContainer.class, null, completed, null); } }
localHints.add(new Hints(Utils.MOSAIC_READER, this));
/** * 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)); } }
final ImageLayout layout = new ImageLayout(); layout.setTileWidth(tileDimension.width).setTileHeight(tileDimension.height); this.hints.add(new RenderingHints(JAI.KEY_IMAGE_LAYOUT, layout));