/** * Returns a {@linkplain GeocentricCRS geocentric coordinate reference system} from a code. * * @param code Value allocated by authority. * @return The coordinate reference system for the given code. * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found. * @throws FactoryException if the object creation failed. * @see #createGeodeticDatum */ public GeocentricCRS createGeocentricCRS(final String code) throws NoSuchAuthorityCodeException, FactoryException { final CoordinateReferenceSystem crs = createCoordinateReferenceSystem(code); try { return (GeocentricCRS) crs; } catch (ClassCastException exception) { throw noSuchAuthorityCode(GeocentricCRS.class, code, exception); } }
/** * Creates a derived coordinate reference system from a code. * * @param code Value allocated by authority. * @return The coordinate reference system for the given code. * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found. * @throws FactoryException if the object creation failed for some other reason. */ public DerivedCRS createDerivedCRS(final String code) throws NoSuchAuthorityCodeException, FactoryException { final CoordinateReferenceSystem crs = createCoordinateReferenceSystem(code); try { return (DerivedCRS) crs; } catch (ClassCastException exception) { throw noSuchAuthorityCode(DerivedCRS.class, code, exception); } }
/** * Creates a {@linkplain ImageCRS image coordinate reference system} from a code. * * @param code Value allocated by authority. * @return The coordinate reference system for the given code. * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found. * @throws FactoryException if the object creation failed for some other reason. */ public ImageCRS createImageCRS(final String code) throws NoSuchAuthorityCodeException, FactoryException { final CoordinateReferenceSystem crs = createCoordinateReferenceSystem(code); try { return (ImageCRS) crs; } catch (ClassCastException exception) { throw noSuchAuthorityCode(ImageCRS.class, code, exception); } }
/** * Creates a 3D coordinate reference system from a code. * * @param code Value allocated by authority. * @return The coordinate reference system for the given code. * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found. * @throws FactoryException if the object creation failed for some other reason. */ public CompoundCRS createCompoundCRS(final String code) throws NoSuchAuthorityCodeException, FactoryException { final CoordinateReferenceSystem crs = createCoordinateReferenceSystem(code); try { return (CompoundCRS) crs; } catch (ClassCastException exception) { throw noSuchAuthorityCode(CompoundCRS.class, code, exception); } }
/** * Creates a {@linkplain EngineeringCRS engineering coordinate reference system} from a code. * * @param code Value allocated by authority. * @return The coordinate reference system for the given code. * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found. * @throws FactoryException if the object creation failed for some other reason. */ public EngineeringCRS createEngineeringCRS(final String code) throws NoSuchAuthorityCodeException, FactoryException { final CoordinateReferenceSystem crs = createCoordinateReferenceSystem(code); try { return (EngineeringCRS) crs; } catch (ClassCastException exception) { throw noSuchAuthorityCode(EngineeringCRS.class, code, exception); } }
/** * Creates a {@linkplain TemporalCRS temporal coordinate reference system} from a code. * * @param code Value allocated by authority. * @return The coordinate reference system for the given code. * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found. * @throws FactoryException if the object creation failed for some other reason. * @see #createTemporalDatum */ public TemporalCRS createTemporalCRS(final String code) throws NoSuchAuthorityCodeException, FactoryException { final CoordinateReferenceSystem crs = createCoordinateReferenceSystem(code); try { return (TemporalCRS) crs; } catch (ClassCastException exception) { throw noSuchAuthorityCode(TemporalCRS.class, code, exception); } }
/** * Creates a {@linkplain VerticalCRS vertical coordinate reference system} from a code. * * @param code Value allocated by authority. * @return The coordinate reference system for the given code. * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found. * @throws FactoryException if the object creation failed for some other reason. * @see #createVerticalDatum */ public VerticalCRS createVerticalCRS(final String code) throws NoSuchAuthorityCodeException, FactoryException { final CoordinateReferenceSystem crs = createCoordinateReferenceSystem(code); try { return (VerticalCRS) crs; } catch (ClassCastException exception) { throw noSuchAuthorityCode(VerticalCRS.class, code, exception); } }
/** * Returns a {@linkplain GeographicCRS geographic coordinate reference system} from a code. * * @param code Value allocated by authority. * @return The coordinate reference system for the given code. * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found. * @throws FactoryException if the object creation failed for some other reason. * @see #createGeodeticDatum */ public GeographicCRS createGeographicCRS(final String code) throws NoSuchAuthorityCodeException, FactoryException { final CoordinateReferenceSystem crs = createCoordinateReferenceSystem(code); try { return (GeographicCRS) crs; } catch (ClassCastException exception) { throw noSuchAuthorityCode(GeographicCRS.class, code, exception); } }
/** * Returns a {@linkplain ProjectedCRS projected coordinate reference system} from a code. * * @param code Value allocated by authority. * @return The coordinate reference system for the given code. * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found. * @throws FactoryException if the object creation failed for some other reason. * @see #createGeodeticDatum */ public ProjectedCRS createProjectedCRS(final String code) throws NoSuchAuthorityCodeException, FactoryException { final CoordinateReferenceSystem crs = createCoordinateReferenceSystem(code); try { return (ProjectedCRS) crs; } catch (ClassCastException exception) { throw noSuchAuthorityCode(ProjectedCRS.class, code, exception); } }
/** * Returns an arbitrary {@linkplain CoordinateReferenceSystem coordinate reference system} from * a code. * * @throws FactoryException if the object creation failed for all factories. */ @Override public CoordinateReferenceSystem createCoordinateReferenceSystem(final String code) throws FactoryException { try { return super.createCoordinateReferenceSystem(code); } catch (FactoryException exception) { notifyFailure("createCoordinateReferenceSystem", exception); try { return fallback.createCoordinateReferenceSystem(code); } catch (NoSuchAuthorityCodeException ignore) { throw exception; } } }
/** Returns an arbitrary coordinate reference system from a code. */ @Override public synchronized CoordinateReferenceSystem createCoordinateReferenceSystem(final String code) throws FactoryException { final CoordinateReferenceSystem crs; final String key = trimAuthority(code); final Object cached = objectCache.get(key); if (cached instanceof CoordinateReferenceSystem) { crs = (CoordinateReferenceSystem) cached; } else { crs = getBackingStore().createCoordinateReferenceSystem(code); } objectCache.put(key, crs); return crs; }
/** * Returns an arbitrary coordinate reference system from a code. * * @throws FactoryException if the object creation failed. */ @Override public synchronized CoordinateReferenceSystem createCoordinateReferenceSystem(final String code) throws FactoryException { final CoordinateReferenceSystem crs; final String key = trimAuthority(code); final Object cached = get(key); if (cached instanceof CoordinateReferenceSystem) { crs = (CoordinateReferenceSystem) cached; } else { crs = getBackingStore().createCoordinateReferenceSystem(code); } put(key, crs); return crs; }
switch (index) { case 0: return buffered.createCoordinateReferenceSystem(code); case 1: return buffered.createCoordinateSystem(code);
crs1 = buffered.createCoordinateReferenceSystem(code1); crs2 = buffered.createCoordinateReferenceSystem(code2); } finally { safetyGuard.remove(epsg);
final CoordinateReferenceSystem sourceCRS, targetCRS; if (sourceCode != null) { sourceCRS = buffered.createCoordinateReferenceSystem(sourceCode); sourceDimensions = sourceCRS.getCoordinateSystem().getDimension(); } else { targetCRS = buffered.createCoordinateReferenceSystem(targetCode); targetDimensions = targetCRS.getCoordinateSystem().getDimension(); } else {
/** Tests the {@link IdentifiedObjectFinder#find} method. */ @Test public void testFind() throws FactoryException { final AbstractAuthorityFactory all = AllAuthoritiesFactory.DEFAULT; final IdentifiedObjectFinder finder = all.getIdentifiedObjectFinder(CoordinateReferenceSystem.class); finder.setFullScanAllowed(false); assertNull( "Should not find the CRS without a scan.", finder.find(DefaultGeographicCRS.WGS84)); finder.setFullScanAllowed(true); final IdentifiedObject find = finder.find(DefaultGeographicCRS.WGS84); assertNotNull("With scan allowed, should find the CRS.", find); assertTrue(CRS.equalsIgnoreMetadata(find, DefaultGeographicCRS.WGS84)); assertSame(all.createCoordinateReferenceSystem("CRS:84"), find); assertEquals("CRS:84", finder.findIdentifier(DefaultGeographicCRS.WGS84)); } }