org.geotools.factory.GeoTools类的使用及代码示例

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

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

GeoTools介绍

[英]Static methods relative to the global GeoTools configuration. GeoTools can be configured in a system-wide basis through System#getProperties, some of them are declared as String constants in this class.

There are many aspects to the configuration of GeoTools:

  • Default Settings: Are handled as the Hints returned by #getDefaultHints(), the default values can be provided in application code, or specified using system properties.
  • Integration JNDI: Telling the GeoTools library about the facilities of an application, or application container takes several forms. This class provides the #init(InitialContext) method allowing to tell GeoTools about the JNDI context to use.
  • Integration Plugins: If hosting GeoTools in a alternate plugin system such as Spring or OSGi, application may needs to hunt down the FactoryFinders and register additional "Factory Iterators" for GeoTools to search using the #addFactoryIteratorProvider method.
    [中]相对于全局GeoTools配置的静态方法。GeoTools可以通过system#getProperties在系统范围内进行配置,其中一些在此类中声明为字符串常量。
    GeoTools的配置有许多方面:
    *默认设置:作为#GetDefaultHitts()返回的提示处理,默认值可以在应用程序代码中提供,也可以使用系统属性指定。
    *集成JNDI:告诉GeoTools库有关应用程序或应用程序容器的功能有多种形式。此类提供了#init(InitialContext)方法,允许GeoTools了解要使用的JNDI上下文。
    *集成插件:如果将GeoTools托管在替代插件系统(如Spring或OSGi)中,应用程序可能需要查找FactoryFinder,并为GeoTools注册额外的“Factory迭代器”,以便使用#AddFactoryInteratorProvider方法进行搜索。

代码示例

代码示例来源:origin: org.geotools/gt-main

/**
 * Creates an instance of a Filter factory.
 *
 * @return An instance of the Filter factory.
 *
 * @throws FactoryRegistryException If the factory is not found.
 */
public static FilterFactory createFilterFactory() throws FactoryRegistryException {
  Hints hints = GeoTools.getDefaultHints();
  return (FilterFactory) CommonFactoryFinder.getFilterFactory( hints );
}

代码示例来源:origin: org.geotools/gt2-jdbc

/**
 * Make sure a JNDI context is available
 */
public boolean isAvailable() {
  try {
    GeoTools.getInitialContext(GeoTools.getDefaultHints());
    return true;
  } catch (Exception e) {
    return false;
  }
}

代码示例来源:origin: org.geotools/gt2-geometry

/** Just the defaults, use GeometryFactoryFinder for the rest */
public ComplexFactoryImpl( Hints hints ) {
  if (hints == null) {
    this.crs = DefaultGeographicCRS.WGS84;
    hints = GeoTools.getDefaultHints();
    hints.put(Hints.CRS, crs );
  }
  else {
    this.crs = (CoordinateReferenceSystem) hints.get( Hints.CRS );
    if( crs == null ){
      throw new NullPointerException("A CRS Hint is required in order to use ComplexFactoryImpl");
    }
  }
  
  hintsWeCareAbout.put(Hints.CRS, crs );
}

代码示例来源:origin: org.geotools/gt2-main

/**
 * Use the supplied FilterFactory when building styles
 *
 * @param filterFactory Use this FilterFactory to build the style
 */
public StyleBuilder(FilterFactory filterFactory ) {
  this( CommonFactoryFinder.getStyleFactory( GeoTools.getDefaultHints() ), filterFactory );
}

代码示例来源:origin: org.geoserver.community/importer-core

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

代码示例来源:origin: org.geotools/gt-wms

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: org.geotools/gt-main

public DuplicatingFilterVisitor() {
  this(CommonFactoryFinder.getFilterFactory2(GeoTools.getDefaultHints()));
  
}

代码示例来源:origin: org.geotools/gt2-main

/**
 * Create a new FeatureTypeFactory with the given typeName.
 *
 * @param name The typeName of the feature to create.
 *
 * @return A new FeatureTypeFactory instance.
 *
 * @throws FactoryConfigurationError If there exists a configuration error.
 */
public static FeatureTypeFactory newInstance(String typeName)
  throws FactoryConfigurationError {
  
  // warning not sure if CommonFactoryFinder is going to cache the instance or not?
  //
  Hints hints = GeoTools.getDefaultHints();
  if( hints == null ){
    hints = new Hints( Hints.FEATURE_TYPE_FACTORY_NAME, typeName );
  }
  else {
    hints.put( Hints.FEATURE_TYPE_FACTORY_NAME, typeName );
  }
  hints.put( Hints.FEATURE_TYPE_FACTORY_NAME, typeName );
  return CommonFactoryFinder.getFeatureTypeFactory( hints );
}

代码示例来源:origin: org.integratedmodelling/klab-server

.equals(Hints.getSystemDefault(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER))) {
  Hints.putSystemDefault(Hints.FORCE_AXIS_ORDER_HONORING, "http");
Hints.putSystemDefault(Hints.LENIENT_DATUM_SHIFT, true);
GeoTools.init((Hints) null);
Hints.putSystemDefault(Hints.FILTER_FACTORY, CommonFactoryFinder
    .getFilterFactory2(null));
Hints.putSystemDefault(Hints.STYLE_FACTORY, CommonFactoryFinder
    .getStyleFactory(null));
Hints.putSystemDefault(Hints.FEATURE_FACTORY, CommonFactoryFinder
    .getFeatureFactory(null));
final Hints defHints = GeoTools.getDefaultHints();

代码示例来源:origin: org.geoserver.community/gs-sldservice

public RulesBuilder() {
  ff = CommonFactoryFinder.getFilterFactory2(GeoTools.getDefaultHints());
  styleFactory = CommonFactoryFinder.getStyleFactory(GeoTools.getDefaultHints());
  sb = new StyleBuilder();
}

代码示例来源:origin: org.geotools/gt-legacy

/**
 * Create a new FeatureTypeFactory with the given typeName.
 *
 * @param name The typeName of the feature to create.
 *
 * @return A new FeatureTypeFactory instance.
 *
 * @throws FactoryRegistryException If there exists a configuration error.
 */
public static FeatureTypeFactory newInstance(String typeName)
  throws FactoryRegistryException {
  
  // warning not sure if CommonFactoryFinder is going to cache the instance or not?
  //
  Hints hints = GeoTools.getDefaultHints();
  if( hints == null ){
    hints = new Hints( Hints.FEATURE_TYPE_FACTORY_NAME, typeName );
  }
  else {
    hints.put( Hints.FEATURE_TYPE_FACTORY_NAME, typeName );
  }
  hints.put( Hints.FEATURE_TYPE_FACTORY_NAME, typeName );
  return new DefaultFeatureTypeFactory();
}

代码示例来源:origin: org.geoserver/wms

FilterFactory2 filterFac = CommonFactoryFinder.getFilterFactory2(GeoTools.getDefaultHints());
              requestedCRS, targetCRS, new Hints(
                  Hints.LENIENT_DATUM_SHIFT,
                  Boolean.TRUE));

代码示例来源:origin: org.geoserver/gs-wms

(GridCoverage2DReader)
      cinfo.getGridCoverageReader(
          new NullProgressListener(), GeoTools.getDefaultHints());
        targetCRS,
        requestedCRS,
        new Hints(Hints.LENIENT_DATUM_SHIFT, Boolean.TRUE));
try {
  coverageMedianPosition.transform(targetCoverageMedianPosition);
        requestedCRS,
        targetCRS,
        new Hints(Hints.LENIENT_DATUM_SHIFT, Boolean.TRUE));
try {
  arbitraryToInternal.transform(position);

代码示例来源:origin: org.geotools/gt-epsg-hsql

/**
 * Creates a new instance of this factory.
 */
public HsqlDialectEpsgMediator() throws FactoryException {
  this( GeoTools.getDefaultHints() );
}

代码示例来源:origin: org.geotools/gt2-main

private static Hints addDefaultHints(final Hints hints) {
  final Hints completed = GeoTools.getDefaultHints();
  if (hints != null) {
    completed.add(hints);
  }
  return completed;
}

代码示例来源:origin: org.geotools/gt2-geometry

/**
 * @param crs
 */
public PrimitiveFactoryImpl(CoordinateReferenceSystem crs, PositionFactory positionFactory) {
  this.crs = crs;
  if( crs == null ){
    throw new NullPointerException("A non null crs is required in order to use PrimitiveFactoryImpl");
  }
  if (positionFactory == null) {
    Hints hints = GeoTools.getDefaultHints();
    hints.put(Hints.CRS, crs );
    this.positionFactory = GeometryFactoryFinder.getPositionFactory(hints);
  }
  else {
    this.positionFactory = positionFactory;
  }
  
  geomValidate = true;
  hintsWeCareAbout.put(Hints.CRS, crs );
  hintsWeCareAbout.put(Hints.POSITION_FACTORY, positionFactory );
  hintsWeCareAbout.put(Hints.GEOMETRY_VALIDATE, geomValidate );
}

代码示例来源:origin: org.geotools/gt2-metadata

/**
   * Reports the GeoTools {@linkplain #getVersion version} number to the
   * {@linkplain System#out standard output stream}.
   */
  public static void main(String[] args) {
    final Arguments arguments = new Arguments(args);
    args = arguments.getRemainingArguments(0);
    arguments.out.print("GeoTools version ");
    arguments.out.println(getVersion());
    final Hints hints = getDefaultHints();
    if (hints!=null && !hints.isEmpty()) {
      arguments.out.println(hints);
    }
  }
}

代码示例来源:origin: org.geotools/gt2-main

private static FeatureCollections instance() {
  // depend on CommonFactoryFinder's FactoryRegistry to hold singleton
  return CommonFactoryFinder.getFeatureCollections( GeoTools.getDefaultHints() );
}

代码示例来源:origin: org.geotools/gt2-main

/**
 * Returns the default attribute factory for the system - constucting a new
 * one if this is first time the method has been called.
 *
 * @return the default instance of AttributeTypeFactory.
 */
public static AttributeTypeFactory defaultInstance() {
  // depend on CommonFactoryFinder to keep singleton cached
  //
  return CommonFactoryFinder.getAttributeTypeFactory( GeoTools.getDefaultHints() );
}

代码示例来源:origin: org.geotools/gt2-main

private static FilterFactory2 findFactory2() {
  Set factories = CommonFactoryFinder.getFilterFactories(GeoTools.getDefaultHints());
  for (Iterator iter = factories.iterator(); iter.hasNext();) {
    FilterFactory factory = (FilterFactory) iter.next();
    if (factory instanceof FilterFactory2) {
      return (FilterFactory2) factory;
    }
  }
  throw new FactoryNotFoundException("There is no FilterFactory2 instance available for the default system hints");
}

相关文章