本文整理了Java中org.geotools.util.factory.Hints.put()
方法的一些代码示例,展示了Hints.put()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Hints.put()
方法的具体详情如下:
包路径:org.geotools.util.factory.Hints
类名称:Hints
方法名:put
[英]Adds a hint value to the set of GeoTools#getDefaultHints. Default hints can be added by call to this putDefaultHint method, to the GeoTools#init method or by System#getProperties with keys defined by the String constants in the GeoTools class.
[中]将提示值添加到GeoTools#GetDefaultHits集。默认提示可以通过调用此putDefaultHint方法、GeoTools#init方法或System#getProperties添加,键由GeoTools类中的字符串常量定义。
代码示例来源:origin: geoserver/geoserver
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);
}
代码示例来源:origin: geoserver/geoserver
localHints.put(
JAI.KEY_COLOR_MODEL_FACTORY,
new ColorModelFactory() {
代码示例来源:origin: geotools/geotools
/**
* Makes sure that every {@code FORCE_*} hints are set to false. We do that because we want
* {@link CoordinateOperationAuthorityFactory#createFromCoordinateReferenceSystemCodes} to
* returns coordinate operations straight from the EPSG database; we don't want an instance like
* {@link org.geotools.referencing.factory.OrderedAxisAuthorityFactory}. Axis swapping are
* performed by {@link #createFromDatabase} in this class <strong>after</strong> we invoked
* {@link CoordinateOperationAuthorityFactory#createFromCoordinateReferenceSystemCodes}. An
* {@code OrderedAxisAuthorityFactory} instance in this class would be in the way and cause an
* infinite recursivity.
*
* @see http://jira.codehaus.org/browse/GEOT-1161
*/
private static void noForce(final Hints userHints) {
userHints.put(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.FALSE);
userHints.put(Hints.FORCE_STANDARD_AXIS_DIRECTIONS, Boolean.FALSE);
userHints.put(Hints.FORCE_STANDARD_AXIS_UNITS, Boolean.FALSE);
}
代码示例来源:origin: geoserver/geoserver
/**
* 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;
}
代码示例来源:origin: geoserver/geoserver
query.getHints().put(Hints.LINEARIZATION_TOLERANCE, linearizationTolerance);
代码示例来源:origin: geotools/geotools
public GeometryBuilder(CoordinateReferenceSystem crs) {
this.crs = crs;
this.hints = GeoTools.getDefaultHints();
hints.put(Hints.CRS, crs);
hints.put(Hints.GEOMETRY_VALIDATE, true);
}
代码示例来源:origin: geoserver/geoserver
try {
ConfigurationMetadataKey key = ConfigurationMetadataKey.get(e.getKey());
newQuery.getHints().put(key, e.getValue());
} catch (IllegalArgumentException ignore) {
LOGGER.fine("Hint " + e.getKey() + ": " + ignore);
代码示例来源:origin: geotools/geotools
/**
* Will add an entry to query hints specifying if the the where clause place holder should be
* keep or not. If the provided hints is NULL a new one will be instantiated and returned.
*
* @param hints query hints to update, if NULL a new hints map will be created
* @param keepWhereClausePlaceHolder TRUE if the where clause place holder should be keep
* @return a query hints map that will contain an entry specifying if the the where clause place
* holder should be keep or not
*/
public static Hints setKeepWhereClausePlaceHolderHint(
Hints hints, boolean keepWhereClausePlaceHolder) {
if (hints == null) {
// create the hints map
hints = new Hints();
}
// just put the provide value in the hints overriding any existing value
hints.put(KEEP_WHERE_CLAUSE_PLACE_HOLDER_KEY, keepWhereClausePlaceHolder);
return hints;
}
代码示例来源:origin: geotools/geotools
private Hints updateHints(
String filePath,
boolean isAbsolutePath,
String rootMosaicDir,
CatalogBuilderConfiguration configuration,
Hints hints,
Key key) {
String updatedFilePath = null;
if (filePath != null) {
if (isAbsolutePath && !filePath.startsWith(rootMosaicDir)) {
updatedFilePath = rootMosaicDir + File.separatorChar + filePath;
} else {
updatedFilePath = filePath;
}
if (hints != null) {
hints.put(key, updatedFilePath);
} else {
hints = new Hints(key, updatedFilePath);
configuration.setHints(hints);
}
if (!isAbsolutePath) {
hints.put(Utils.PARENT_DIR, rootMosaicDir);
}
}
return hints;
}
代码示例来源:origin: geotools/geotools
public AbstractEpsgMediator(Hints hints, DataSource datasource) {
super(PRIORITY, hints);
if (datasource != null) {
this.datasource = datasource;
} else {
try {
this.datasource = lookupDataSource(hints);
} catch (FactoryException lookupFailed) {
throw (NullPointerException)
new NullPointerException("DataSource not provided:" + lookupFailed)
.initCause(lookupFailed);
}
}
hints.put(Hints.EPSG_DATA_SOURCE, this.datasource);
}
代码示例来源:origin: geotools/geotools
/**
* 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);
}
代码示例来源:origin: geotools/geotools
/**
* Returns a factory from the specified hints. Used by {@link URN_AuthorityFactory} constructor
* as well.
*/
static AllAuthoritiesFactory getFactory(Hints hints, final String authority) {
if (!defaultAxisOrderHints(hints, authority)) {
hints = new Hints(hints);
hints.put(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.FALSE);
}
return new AllAuthoritiesFactory(hints);
}
代码示例来源:origin: geotools/geotools
/**
* Return the first implementation of {@link FeatureFactory} matching the specified hints.
*
* <p>If no implementation matches, a new one is created if possible or an exception is thrown.
*
* @param hints An optional map of hints; or {@code null} if none
* @return Instance of FeatureFactory matching the supplied hints
* @throws FactoryRegistryException if no implementation could be provided
* @see Hints#FEATURE_FACTORY
*/
public static FeatureFactory getFeatureFactory(Hints hints) {
hints = mergeSystemHints(hints);
if (hints.get(Hints.FEATURE_FACTORY) == null) {
try {
Class<?> lenient = Class.forName("org.geotools.feature.LenientFeatureFactoryImpl");
hints.put(Hints.FEATURE_FACTORY, lenient);
} catch (ClassNotFoundException e) {
java.util.logging.Logger.getGlobal().log(java.util.logging.Level.INFO, "", e);
}
}
return (FeatureFactory) lookup(FeatureFactory.class, hints, Hints.FEATURE_FACTORY);
}
代码示例来源:origin: geotools/geotools
/**
* Invoked when a factory is requested for a specific version. This method should create a
* factory for the exact version specified by the argument, or return {@code null} if no such
* factory is available. In the later case, this class will fallback on the factory specified at
* {@linkplain #URI_AuthorityFactory(AuthorityFactory, String, Citation) construction time}.
*
* @param version The version for the factory to create.
* @return The factory, of {@code null} if there is none for the specified version.
* @throws FactoryException if an error occurred while creating the factory.
*/
protected AuthorityFactory createVersionedFactory(final Version version)
throws FactoryException {
final Hints hints = new Hints(factory.getImplementationHints());
hints.put(Hints.VERSION, version);
final List<AuthorityFactory> factories =
Arrays.asList(new AuthorityFactory[] {new AllAuthoritiesFactory(hints), factory});
return FallbackAuthorityFactory.create(factories);
}
代码示例来源:origin: geotools/geotools
/**
* Make sure that a factory can be find in the presence of some global hints.
*
* @see http://jira.codehaus.org/browse/GEOT-1618
*/
@Test
public void testFactoryWithHints() {
final Hints hints = new Hints();
hints.put(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.TRUE);
hints.put(Hints.FORCE_STANDARD_AXIS_DIRECTIONS, Boolean.TRUE);
hints.put(Hints.FORCE_STANDARD_AXIS_UNITS, Boolean.TRUE);
final CoordinateOperationFactory factory =
ReferencingFactoryFinder.getCoordinateOperationFactory(hints);
assertSame(opFactory, factory);
}
代码示例来源:origin: geotools/geotools
/**
* 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;
}
代码示例来源:origin: geotools/geotools
Object convertSafe(Object source, Class<?> target) throws Exception {
Hints hints = new Hints();
hints.put(ConverterFactory.SAFE_CONVERSION, Boolean.valueOf(true));
return factory.createConverter(source.getClass(), target, hints).convert(source, target);
}
代码示例来源:origin: geotools/geotools
/**
* Tests the setting of "CRS authority extra directory" hint.
*
* @throws Exception If a factory or a transform exception occured.
*/
@Test
public void testCrsAuthorityExtraDirectoryHint() throws Exception {
Hints hints = new Hints(Hints.CRS_AUTHORITY_FACTORY, FactoryUsingWKT.class);
try {
hints.put(Hints.CRS_AUTHORITY_EXTRA_DIRECTORY, "invalid");
fail("Should of been tossed out as an invalid hint");
} catch (IllegalArgumentException expected) {
// This is the expected exception.
}
String directory = new File(".").getAbsolutePath();
hints = new Hints(Hints.CRS_AUTHORITY_FACTORY, FactoryUsingWKT.class);
hints.put(Hints.CRS_AUTHORITY_EXTRA_DIRECTORY, directory);
// TODO: test the factory here.
}
代码示例来源:origin: geotools/geotools
public void testDateToTimestamp() throws Exception {
Date date = new Date();
assertNotNull(factory.createConverter(Date.class, Timestamp.class, null));
Timestamp timeStamp =
(Timestamp)
factory.createConverter(Date.class, Timestamp.class, null)
.convert(date, Timestamp.class);
assertNotNull(timeStamp);
assertEquals(new Timestamp(date.getTime()), timeStamp);
// check safe conversion
Hints h = new Hints();
h.put(ConverterFactory.SAFE_CONVERSION, Boolean.valueOf(true));
assertNull(factory.createConverter(Timestamp.class, Calendar.class, h));
h.put(ConverterFactory.SAFE_CONVERSION, Boolean.valueOf(false));
assertNotNull(factory.createConverter(Timestamp.class, Calendar.class, h));
}
代码示例来源:origin: geotools/geotools
/**
* Set the CoordinateReferenceSystem for the geometries that will be produced.
*
* @param crs the CoordinateReferenceSystem to set
*/
public void setCoordinateReferenceSystem(CoordinateReferenceSystem crs) {
if (this.crs != crs) {
hints.remove(Hints.CRS);
hints.put(Hints.CRS, crs);
this.crs = crs;
positionFactory = null;
primitiveFactory = null;
aggregateFactory = null;
complexFactory = null;
geometryFactory = null;
getPositionFactory();
getPrecision();
getPrimitiveFactory();
getAggregateFactory();
getGeometryFactory();
getComplexFactory();
}
}
内容来源于网络,如有侵权,请联系作者删除!