private static Hints addDefaultHints(final Hints hints) { final Hints completed = GeoTools.getDefaultHints(); if (hints != null) { completed.add(hints); } return completed; }
/** * 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; }
/** * 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; } }
/** * 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; } }
/** * Adds all specified hints to the system hints. This * is for {@link GeoTools#init} implementation only. */ static void putSystemDefault(final RenderingHints hints) { synchronized (GLOBAL) { ensureSystemDefaultLoaded(); GLOBAL.add(hints); } GeoTools.fireConfigurationChanged(); }
public GeoToolsCoverageTransformer(String defaultSRS) { // create basic hints hints = new Hints(GeoTools.getDefaultHints()); if (defaultSRS != null) { try { final CoordinateReferenceSystem crs = CRS.decode(defaultSRS); hints.add(new RenderingHints(Hints.DEFAULT_COORDINATE_REFERENCE_SYSTEM, crs)); } catch (Exception e) { LOGGER.log(Level.FINE, "Cannot parse CRS " + defaultSRS, new Exception()); hints = new Hints(GeoTools.getDefaultHints()); } } }
if (hints != null) { this.hints.add(hints);
/** * Adds all specified hints to the system hints. This * is for {@link GeoTools#init} implementation only. */ static void putSystemDefault(final RenderingHints hints) { synchronized (GLOBAL) { ensureSystemDefaultLoaded(); GLOBAL.add(hints); } GeoTools.fireConfigurationChanged(); }
/** * 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> * <li>{@link JAI#KEY_TRANSFORM_ON_COLORMAP} set to {@link Boolean#FALSE}.</li> * </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(); if (hints != null) { this.hints.add(hints);
/** * 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.getCrs(); this.coverageName = reader.getCoverageName(); this.coverageGridToWorld2D = (MathTransform2D) reader.getRaster2Model(); this.coverageFullResolution = reader.getHighestRes(); this.hints = reader.getHints().clone(); 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));
private void insert(final WorkingTree workTree, final String treePath, @SuppressWarnings("rawtypes") final FeatureSource featureSource, final ProgressListener taskProgress) { final Query query = new Query(); CoordinateSequenceFactory coordSeq = new PackedCoordinateSequenceFactory(); query.getHints().add(new Hints(Hints.JTS_COORDINATE_SEQUENCE_FACTORY, coordSeq)); try (FeatureIterator fit = featureSource.getFeatures(query).features()) { FeatureType schema = featureSource.getSchema(); RevFeatureType featureType = RevFeatureTypeBuilder.build(schema); objectDatabase().put(featureType); ObjectId featureTypeId = featureType.getId(); if (fit.hasNext()) { Iterator<Feature> features = new FeatureIteratorIterator<>(fit); insert(workTree, treePath, features, taskProgress, featureTypeId); } } catch (IOException e) { LOG.warn("Unable to insert into " + treePath, e); throw new GeoToolsOpException(e, StatusCode.UNABLE_TO_INSERT); } }
@Test public void testTryToRunMultipleSpringBatchBackupJobs() throws Exception { Hints hints = new Hints(new HashMap(2)); hints.add( new Hints( new Hints.OptionKey(Backup.PARAM_BEST_EFFORT_MODE),
private void insert(final WorkingTree workTree, final String treePath, @SuppressWarnings("rawtypes") final FeatureSource featureSource, final ProgressListener taskProgress) { final Query query = new Query(); query.setFilter(filter); CoordinateSequenceFactory coordSeq = new PackedCoordinateSequenceFactory(); query.getHints().add(new Hints(Hints.JTS_COORDINATE_SEQUENCE_FACTORY, coordSeq)); try (FeatureIterator fit = featureSource.getFeatures(query).features()) { FeatureType schema = featureSource.getSchema(); RevFeatureType featureType = RevFeatureType.builder().type(schema).build(); objectDatabase().put(featureType); ObjectId featureTypeId = featureType.getId(); if (fit.hasNext()) { Iterator<Feature> features = new FeatureIteratorIterator<>(fit); insert(workTree, treePath, features, taskProgress, featureTypeId); } } catch (IOException e) { LOG.warn("Unable to insert into " + treePath, e); throw new GeoToolsOpException(e, StatusCode.UNABLE_TO_INSERT); } }
@Test public void testRunSpringBatchBackupJob() throws Exception { Hints hints = new Hints(new HashMap(2)); hints.add( new Hints( new Hints.OptionKey(Backup.PARAM_BEST_EFFORT_MODE),
@Test public void testRunSpringBatchFilteredRestoreJob() throws Exception { Hints hints = new Hints(new HashMap(2)); hints.add( new Hints( new Hints.OptionKey(Backup.PARAM_BEST_EFFORT_MODE),