/** Builds the default coverage contained in the current store */ public CoverageInfo buildCoverage(String coverageName) throws Exception { if (store == null || !(store instanceof CoverageStoreInfo)) { throw new IllegalStateException("Coverage store not set."); } CoverageStoreInfo csinfo = (CoverageStoreInfo) store; GridCoverage2DReader reader = (GridCoverage2DReader) catalog.getResourcePool() .getGridCoverageReader(csinfo, GeoTools.getDefaultHints()); if (reader == null) throw new Exception( "Unable to acquire a reader for this coverage with format: " + csinfo.getFormat().getName()); return buildCoverage(reader, coverageName, null); }
/** * Builds the default coverage contained in the current store * * @param nativeCoverageName the native name for the coverage * @param specifiedName the published name for the coverage. If null, the name will be * determined from the coverage store. * @return coverage for the specified name * @throws Exception if the coverage store was not found or could not be read, or if the * coverage could not be created. */ public CoverageInfo buildCoverageByName(String nativeCoverageName, String specifiedName) throws Exception { if (store == null || !(store instanceof CoverageStoreInfo)) { throw new IllegalStateException("Coverage store not set."); } CoverageStoreInfo csinfo = (CoverageStoreInfo) store; GridCoverage2DReader reader = (GridCoverage2DReader) catalog.getResourcePool() .getGridCoverageReader(csinfo, GeoTools.getDefaultHints()); if (reader == null) throw new Exception( "Unable to acquire a reader for this coverage with format: " + csinfo.getFormat().getName()); return buildCoverageInternal(reader, nativeCoverageName, null, specifiedName); }
final Hints defHints = GeoTools.getDefaultHints();
/** * Returns the GeoTools default hints {@link GeoTools#getDefaultHints()} * * @return {@link GeoTools#getDefaultHints()} * @see Query#getHints() */ public Hints getHints() { return GeoTools.getDefaultHints(); }
final Hints defHints = GeoTools.getDefaultHints();
reader = (GridCoverage2DReader) cinfo.getGridCoverageReader(null, GeoTools.getDefaultHints());
(GridCoverage2DReader) catalog.getResourcePool() .getGridCoverageReader(cinfo, GeoTools.getDefaultHints()); if (coverageName != null) { reader = SingleGridCoverage2DReader.wrap(reader, coverageName);
/** * Create a Stylereader - use if you already have a dom to parse. * * @param factory The StyleFactory to use to build the style */ public SLDParser(StyleFactory factory) { this(factory, CommonFactoryFinder.getFilterFactory(GeoTools.getDefaultHints())); }
/** Make sure a JNDI context is available */ public boolean isAvailable() { try { GeoTools.getInitialContext(GeoTools.getDefaultHints()); return true; } catch (Exception e) { return false; } } }
/** * Constructs an instance wrapping the specified factory with a default cache. * * <p>The provided authority factory must implement {@link DatumAuthorityFactory}, {@link * CSAuthorityFactory}, {@link CRSAuthorityFactory} and {@link * CoordinateOperationAuthorityFactory} . * * @param factory The factory to cache. Can not be {@code null}. */ public CachedAuthorityDecorator(final AuthorityFactory factory) { this(factory, createCache(GeoTools.getDefaultHints())); }
/** * Use the supplied StyleFactory when building styles * * @param styleFactory the StyleFactory to use in building Styles */ public StyleBuilder(StyleFactory styleFactory) { this(styleFactory, CommonFactoryFinder.getFilterFactory(GeoTools.getDefaultHints())); }
/** * 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); }
/** * Returns all the {@link Format}s that can read the supplied {@link Object} o. * * @param o is the object to search a {@link Format} that is able to read * @return an unmodifiable {@link Set} comprising all the {@link Format} that can read the * {@link Object} o. */ public static synchronized Set<AbstractGridFormat> findFormats(Object o) { return findFormats(o, GeoTools.getDefaultHints()); }
/** * Tells me if this {@link Format} can read the provided <code>input</code>. * * @param input The input object to test for suitability. * @return True if this format can read this object, False otherwise. */ public boolean accepts(Object source) { return accepts(source, GeoTools.getDefaultHints()); }
r = (GridCoverage2DReader) ci.getGridCoverageReader(null, GeoTools.getDefaultHints()); assertTrue( CRS.equalsIgnoreMetadata( r = (GridCoverage2DReader) rpool.getGridCoverageReader(store, GeoTools.getDefaultHints()); assertTrue( CRS.equalsIgnoreMetadata(
public MarkImpl(String name) { this(CommonFactoryFinder.getFilterFactory(GeoTools.getDefaultHints()), null); LOGGER.fine("creating " + name + " type mark"); setWellKnownName(name); }
@Test public void testDropCoverageStore() throws Exception { // build the store Catalog cat = getCatalog(); CatalogBuilder cb = new CatalogBuilder(cat); CoverageStoreInfo store = cb.buildCoverageStore("dem"); store.setURL(MockData.class.getResource("tazdem.tiff").toExternalForm()); store.setType("GeoTIFF"); cat.add(store); // build the coverage cb.setStore(store); CoverageInfo ci = cb.buildCoverage(); cat.add(ci); // build the layer LayerInfo layer = cb.buildLayer(ci); cat.add(layer); // grab a reader just to inizialize the code ci.getGridCoverage(null, null); ci.getGridCoverageReader(null, GeoTools.getDefaultHints()); // now drop the store CascadeDeleteVisitor visitor = new CascadeDeleteVisitor(cat); visitor.visit(store); // and reload (GEOS-4782 -> BOOM!) getGeoServer().reload(); }
private static LazySet<ProjectionHandlerFactory> getProjectionHandlerFactories() { Hints hints = GeoTools.getDefaultHints(); return new LazySet<ProjectionHandlerFactory>( registry.getFactories(ProjectionHandlerFactory.class, null, hints)); }
@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); }
protected void setUp() throws Exception { // this is the only thing that actually forces CRS object to give up // its configuration, necessary when tests are run by Maven, one JVM for all // the tests in this module Hints.putSystemDefault(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.TRUE); GeoTools.fireConfigurationChanged(); ft = DataUtilities.createType( "testType", "geom:Point:srid=4326,line:LineString,name:String,id:int"); ff = CommonFactoryFinder.getFilterFactory2(GeoTools.getDefaultHints()); reprojector = new ReprojectingFilterVisitor(ff, ft); }