/** * 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); }
/** * Creates a new factory using the specified hints. * * @param hints An optional set of hints, or {@code null} if none. */ public AllAuthoritiesFactory(final Hints hints) { super(null); addImplementationHints(hints); }
/** * Returns the factories to be used by {@link ManyAuthoritiesFactory}. If the registered * factories changed since the last time this method has been invoked, then this method recreate * the set. */ @Override Collection<AuthorityFactory> getFactories() { final Collection<String> authorities = ReferencingFactoryFinder.getAuthorityNames(); if (authorities != authorityNames) { authorityNames = authorities; final Hints hints = getHints(); final Set<AuthorityFactory> factories = new LinkedHashSet<AuthorityFactory>(); factories.addAll(ReferencingFactoryFinder.getCRSAuthorityFactories(hints)); factories.addAll(ReferencingFactoryFinder.getCSAuthorityFactories(hints)); factories.addAll(ReferencingFactoryFinder.getDatumAuthorityFactories(hints)); factories.addAll( ReferencingFactoryFinder.getCoordinateOperationAuthorityFactories(hints)); setFactories(factories); } return super.getFactories(); }
/** * 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); }
datum = (GeodeticDatum) (this.allAuthoritiesFactory.createDatum("EPSG:" + datumCode)); } catch (Exception cce) { final GeoTiffException ex =
pm = this.allAuthoritiesFactory.createPrimeMeridian("EPSG:" + pmCode);
try { return (Unit<Q>) this.allAuthoritiesFactory.createUnit("EPSG:" + unitCode); } catch (FactoryException fe) { final IOException io = new GeoTiffException(metadata, fe.getLocalizedMessage(), fe);
return this.allAuthoritiesFactory.createEllipsoid( new StringBuilder("EPSG:").append(ellipsoidKey).toString()); } catch (FactoryException fe) {
allAuthoritiesFactory.createCoordinateReferenceSystem( geogCode.toString()); if (angularUnit != null
this.allAuthoritiesFactory.createCoordinateOperation( new StringBuilder("EPSG:").append(projCode).toString());
/** Returns a factory for the specified authority and type. */ @Override final <T extends AuthorityFactory> T fromFactoryRegistry( final String authority, final Class<T> type) throws FactoryRegistryException { final AuthorityFactory f; if (CRSAuthorityFactory.class.equals(type)) { f = ReferencingFactoryFinder.getCRSAuthorityFactory(authority, getHints()); } else if (CSAuthorityFactory.class.equals(type)) { f = ReferencingFactoryFinder.getCSAuthorityFactory(authority, getHints()); } else if (DatumAuthorityFactory.class.equals(type)) { f = ReferencingFactoryFinder.getDatumAuthorityFactory(authority, getHints()); } else if (CoordinateOperationAuthorityFactory.class.equals(type)) { f = ReferencingFactoryFinder.getCoordinateOperationAuthorityFactory( authority, getHints()); } else { f = super.fromFactoryRegistry(authority, type); } return type.cast(f); }
/** * Creates a new instance of GeoTiffMetadata2CRSAdapter * * @param hints a map of hints to locate the authority and object factories. (can be null) */ public GeoTiffMetadata2CRSAdapter(Hints hints) { this.hints = hints != null ? hints.clone() : GeoTools.getDefaultHints().clone(); // various authority related factories allAuthoritiesFactory = new AllAuthoritiesFactory(this.hints); // various factories datumObjFactory = ReferencingFactoryFinder.getDatumFactory(this.hints); mtFactory = ReferencingFactoryFinder.getMathTransformFactory(this.hints); }
.createDatum(new StringBuffer("EPSG:") .append(datumCode).toString())); } catch (FactoryException fe) {
pm = this.allAuthoritiesFactory.createPrimeMeridian("EPSG:" + pmCode);
.createUnit(new StringBuffer("EPSG:").append(unitCode) .toString()); } catch (FactoryException fe) {
return this.allAuthoritiesFactory.createEllipsoid(new StringBuffer( "EPSG:").append(ellipsoidKey).toString()); } catch (FactoryException fe) {
allAuthoritiesFactory.createCoordinateReferenceSystem( projCode.toString());
parameters = null; projection = (Conversion) this.allAuthoritiesFactory .createCoordinateOperation(new StringBuffer("EPSG:") .append(projCode).toString());
/** * Creates a new instance of GeoTiffMetadata2CRSAdapter * * @param hints * a map of hints to locate the authority and object factories. * (can be null) */ public GeoTiffMetadata2CRSAdapter(Hints hints) { final Hints tempHints = hints != null ? new Hints(hints) : DEFAULT_HINTS; this.hints = (Hints) tempHints.clone(); allAuthoritiesFactory = hints != null ? new AllAuthoritiesFactory(this.hints): DEFAULT_ALLAUTHORITIES_FACTORY; // factory = new ThreadedEpsgFactory(hints); datumObjFactory = ReferencingFactoryFinder.getDatumFactory(this.hints); crsFactory = ReferencingFactoryFinder.getCRSFactory(this.hints); csFactory = ReferencingFactoryFinder.getCSFactory(this.hints); tempHints.put(Hints.DATUM_AUTHORITY_FACTORY, allAuthoritiesFactory); tempHints.put(Hints.CS_FACTORY, csFactory); tempHints.put(Hints.CRS_FACTORY, crsFactory); tempHints.put(Hints.MATH_TRANSFORM_FACTORY, mtFactory); factories = ReferencingFactoryContainer.instance(tempHints); }