/** * Returns the {@linkplain CoordinateOperationAuthorityFactory coordinate operation authority * factory} singleton. * * @throws FactoryNotFoundException if no factory was found for the requested type. * @throws FactoryRegistryException if the factory can't be obtained for an other reason. */ public CoordinateOperationAuthorityFactory getCoordinateOperationAuthorityFactory() throws FactoryRegistryException { return ReferencingFactoryFinder.getCoordinateOperationAuthorityFactory( DEFAULT_AUTHORITY, hints); }
/** Returns the underlying coordinate operation authority factory. */ protected CoordinateOperationAuthorityFactory getAuthorityFactory() { /* * No need to synchronize. This is not a big deal if ReferencingFactoryFinder is invoked * twice since it is already synchronized. Actually, we should not synchronize at all. * Every methods from the super-class are thread-safe without synchronized statements, * and we should preserve this advantage in order to reduce the risk of contention. */ if (authorityFactory == null) { /* * Factory creation at this stage will happen only if null hints were specified at * construction time, which explain why it is correct to use {@link FactoryFinder} * with empty hints here. */ final Hints hints = new Hints(); noForce(hints); authorityFactory = ReferencingFactoryFinder.getCoordinateOperationAuthorityFactory( DEFAULT_AUTHORITY, hints); } return authorityFactory; }
/** 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); }
/** @throws java.lang.Exception */ @Before public void setUp() throws Exception { ReferencingFactoryFinder.addAuthorityFactory( new FactoryUsingWKT(null, AbstractFactory.MAXIMUM_PRIORITY)); factory = (CoordinateOperationFactoryUsingWKT) ReferencingFactoryFinder.getCoordinateOperationAuthorityFactory( "EPSG", new Hints( Hints.COORDINATE_OPERATION_AUTHORITY_FACTORY, CoordinateOperationFactoryUsingWKT.class)); // Read definitions properties = new Properties(); properties.load(this.getClass().getResourceAsStream(DEFINITIONS_FILE_NAME)); }
/** * Creates a new factory backed by an authority factory fetched using the specified hints. This * constructor recognizes the {@link Hints#CRS_FACTORY CRS}, {@link Hints#CS_FACTORY CS}, {@link * Hints#DATUM_FACTORY DATUM} and {@link Hints#MATH_TRANSFORM_FACTORY MATH_TRANSFORM} {@code * FACTORY} hints. * * @param userHints The hints, or {@code null} if none. */ public AuthorityBackedFactory(Hints userHints) { super(userHints, PRIORITY); /* * Removes the hint processed by the super-class. This include hints like * LENIENT_DATUM_SHIFT, which usually don't apply to authority factories. * An other way to see this is to said that this class "consumed" the hints. * By removing them, we increase the chances to get an empty map of remaining hints, * which in turn help to get the default CoordinateOperationAuthorityFactory * (instead of forcing a new instance). */ userHints = new Hints(userHints); userHints.keySet().removeAll(hints.keySet()); userHints.remove(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER); userHints.remove(Hints.FORCE_STANDARD_AXIS_DIRECTIONS); userHints.remove(Hints.FORCE_STANDARD_AXIS_UNITS); if (!userHints.isEmpty()) { noForce(userHints); authorityFactory = ReferencingFactoryFinder.getCoordinateOperationAuthorityFactory( DEFAULT_AUTHORITY, userHints); } }
/** * Creates a wrappers around the default factories for the specified authority. The factories * are fetched using {@link ReferencingFactoryFinder}. * * @param authority The authority to wraps (example: {@code "EPSG"}). If {@code null}, then all * authority factories must be explicitly specified in the set of hints. * @param userHints An optional set of hints, or {@code null} if none. * @throws FactoryRegistryException if at least one factory can not be obtained. * @since 2.4 */ protected AuthorityFactoryAdapter(final String authority, final Hints userHints) throws FactoryRegistryException { this( ReferencingFactoryFinder.getCRSAuthorityFactory( authority, trim(userHints, Hints.CRS_AUTHORITY_FACTORY)), ReferencingFactoryFinder.getCSAuthorityFactory( authority, trim(userHints, Hints.CS_AUTHORITY_FACTORY)), ReferencingFactoryFinder.getDatumAuthorityFactory( authority, trim(userHints, Hints.DATUM_AUTHORITY_FACTORY)), ReferencingFactoryFinder.getCoordinateOperationAuthorityFactory( authority, trim(userHints, Hints.COORDINATE_OPERATION_AUTHORITY_FACTORY))); }
/** * Returns the {@linkplain CoordinateOperationAuthorityFactory coordinate operation authority * factory} singleton. * * @throws FactoryNotFoundException if no factory was found for the requested type. * @throws FactoryRegistryException if the factory can't be obtained for an other reason. */ public CoordinateOperationAuthorityFactory getCoordinateOperationAuthorityFactory() throws FactoryRegistryException { return ReferencingFactoryFinder.getCoordinateOperationAuthorityFactory(DEFAULT_AUTHORITY, hints); }
/** * Returns the {@linkplain CoordinateOperationAuthorityFactory coordinate operation authority * factory} singleton. * * @throws FactoryNotFoundException if no factory was found for the requested type. * @throws FactoryRegistryException if the factory can't be obtained for an other reason. */ public CoordinateOperationAuthorityFactory getCoordinateOperationAuthorityFactory() throws FactoryRegistryException { return ReferencingFactoryFinder.getCoordinateOperationAuthorityFactory(DEFAULT_AUTHORITY, hints); }
ReferencingFactoryFinder.getCoordinateOperationAuthorityFactory( "EPSG", new Hints(