/** * Returns the {@linkplain DatumAuthorityFactory datum 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 DatumAuthorityFactory getDatumAuthorityFactory() throws FactoryRegistryException { return ReferencingFactoryFinder.getDatumAuthorityFactory(DEFAULT_AUTHORITY, hints); }
/** 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); }
/** * Returns the {@linkplain DatumAuthorityFactory datum 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 DatumAuthorityFactory getDatumAuthorityFactory() throws FactoryRegistryException { return ReferencingFactoryFinder.getDatumAuthorityFactory(DEFAULT_AUTHORITY, hints); }
/** * 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 DatumAuthorityFactory datum 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 DatumAuthorityFactory getDatumAuthorityFactory() throws FactoryRegistryException { return ReferencingFactoryFinder.getDatumAuthorityFactory(DEFAULT_AUTHORITY, hints); }
/** Make sure that a singleton instance is registered. */ @Test public void testRegistration() { String authority = "http://www.opengis.net/def"; AuthorityFactory factory = ReferencingFactoryFinder.getCRSAuthorityFactory(authority, null); assertSame(factory, ReferencingFactoryFinder.getCRSAuthorityFactory(authority, null)); assertSame(factory, ReferencingFactoryFinder.getCSAuthorityFactory(authority, null)); assertSame(factory, ReferencingFactoryFinder.getDatumAuthorityFactory(authority, null)); }
/** Make sure that a singleton instance is registered. */ @Test public void testRegistration() { String authority = "URN:OGC:DEF"; final AuthorityFactory factory = ReferencingFactoryFinder.getCRSAuthorityFactory(authority, null); assertSame(factory, ReferencingFactoryFinder.getCRSAuthorityFactory(authority, null)); assertSame(factory, ReferencingFactoryFinder.getCSAuthorityFactory(authority, null)); assertSame(factory, ReferencingFactoryFinder.getDatumAuthorityFactory(authority, null)); /* * Tests the X-OGC namespace, which should be synonymous. */ authority = "URN:X-OGC:DEF"; assertSame(factory, ReferencingFactoryFinder.getCRSAuthorityFactory(authority, null)); assertSame(factory, ReferencingFactoryFinder.getCSAuthorityFactory(authority, null)); assertSame(factory, ReferencingFactoryFinder.getDatumAuthorityFactory(authority, null)); }
public static Set<GeodeticDatum> createDatumSet() { DatumAuthorityFactory factory = ReferencingFactoryFinder.getDatumAuthorityFactory("EPSG", null); List<String> datumCodes = retrieveCodes(GeodeticDatum.class, factory); Set<GeodeticDatum> datumSet = new TreeSet<>(AbstractIdentifiedObject.NAME_COMPARATOR); for (String datumCode : datumCodes) { try { DefaultGeodeticDatum geodeticDatum = (DefaultGeodeticDatum) factory.createGeodeticDatum(datumCode); if (geodeticDatum.getBursaWolfParameters().length != 0 || DefaultGeodeticDatum.isWGS84(geodeticDatum)) { datumSet.add(geodeticDatum); } } catch (FactoryException ignored) { } } return datumSet; }
private static Set<GeodeticDatum> createDatumSet() { DatumAuthorityFactory factory = ReferencingFactoryFinder.getDatumAuthorityFactory("EPSG", null); List<String> datumCodes = retrieveCodes(GeodeticDatum.class, factory); Set<GeodeticDatum> datumSet = new TreeSet<>(AbstractIdentifiedObject.NAME_COMPARATOR); for (String datumCode : datumCodes) { try { DefaultGeodeticDatum geodeticDatum = (DefaultGeodeticDatum) factory.createGeodeticDatum(datumCode); if (geodeticDatum.getBursaWolfParameters().length != 0 || DefaultGeodeticDatum.isWGS84(geodeticDatum)) { datumSet.add(geodeticDatum); } } catch (FactoryException ignored) { } } return datumSet; }
public void testEllipsoids() throws FactoryException { final DatumAuthorityFactory factory = ReferencingFactoryFinder.getDatumAuthorityFactory("EPSG", null); assertSame(factory.createEllipsoid("EPSG:7004"), Ellipsoids.BESSEL1841); assertSame(factory.createEllipsoid("EPSG:7019"), Ellipsoids.GRS80); assertSame(factory.createEllipsoid("EPSG:7043"), Ellipsoids.WGS72); assertSame(factory.createEllipsoid("EPSG:7030"), Ellipsoids.WGS84); }
public void testGeodeticDatums() throws FactoryException { final DatumAuthorityFactory factory = ReferencingFactoryFinder.getDatumAuthorityFactory("EPSG", null); assertSame(factory.createGeodeticDatum("EPSG:6655"), GeodeticDatums.ITRF97); assertSame(factory.createGeodeticDatum("EPSG:6322"), GeodeticDatums.WGS72); assertSame(factory.createGeodeticDatum("EPSG:6326"), GeodeticDatums.WGS84); assertSame(GeodeticDatums.ITRF97, GeodeticDatums.getGeodeticDatum(Datum.ITRF_97)); assertSame(GeodeticDatums.WGS72, GeodeticDatums.getGeodeticDatum(Datum.WGS_72)); assertSame(GeodeticDatums.WGS84, GeodeticDatums.getGeodeticDatum(Datum.WGS_84)); }