org.geotools.util.factory.Hints.get()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(246)

本文整理了Java中org.geotools.util.factory.Hints.get()方法的一些代码示例,展示了Hints.get()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Hints.get()方法的具体详情如下:
包路径:org.geotools.util.factory.Hints
类名称:Hints
方法名:get

Hints.get介绍

[英]Returns a copy of the system hints. This is for GeoTools#getDefaultHintsimplementation only.
[中]返回系统提示的副本。这仅适用于GeoTools#GetDefaultHints实现。

代码示例

代码示例来源:origin: geoserver/geoserver

@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);
}

代码示例来源:origin: geoserver/geoserver

executor = (ThreadPoolExecutor) defHints.get(Hints.EXECUTOR_SERVICE);

代码示例来源:origin: geotools/geotools

/**
 * 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);
}

代码示例来源:origin: geotools/geotools

public void setHints(Hints hints) {
  if (hints != null) {
    this.simplificationDistance = (Number) hints.get(Hints.GEOMETRY_DISTANCE);
  }
}

代码示例来源:origin: geotools/geotools

/**
 * 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;
}

代码示例来源:origin: geotools/geotools

/** 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);
}

代码示例来源:origin: geotools/geotools

/** 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;
}

代码示例来源:origin: geotools/geotools

/** 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;
}

代码示例来源:origin: geotools/geotools

/** 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);
}

代码示例来源:origin: geotools/geotools

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;
}

代码示例来源:origin: geoserver/geoserver

final Object factory = this.hints.get(Hints.GRID_COVERAGE_FACTORY);
if (factory != null && factory instanceof GridCoverageFactory) {
  this.coverageFactory = (GridCoverageFactory) factory;

代码示例来源:origin: geoserver/geoserver

if (hints.get(REPROJECT) != null) {
  reproject = (Boolean) hints.get(REPROJECT);
  List<Join> joins = (List<Join>) hints.get(JOINS);
  SimpleFeatureTypeBuilder typeBuilder = new SimpleFeatureTypeBuilder();
  typeBuilder.init(schema);

代码示例来源:origin: geotools/geotools

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. */

代码示例来源:origin: geotools/geotools

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));
  }
}

代码示例来源:origin: geotools/geotools

/** 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);
}
/**

代码示例来源:origin: geotools/geotools

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;
}

代码示例来源:origin: geotools/geotools

@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;
}

代码示例来源:origin: geotools/geotools

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;
}

代码示例来源:origin: geotools/geotools

public GeometryBuilder(Hints hints) {
  this.crs = (CoordinateReferenceSystem) hints.get(Hints.CRS);
  this.hints = hints;
  getPositionFactory();
  getPrecision();
  getPrimitiveFactory();
  getAggregateFactory();
  getGeometryFactory();
  getComplexFactory();
}

代码示例来源:origin: geotools/geotools

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));
}

相关文章