Package org.apache.sis.referencing
Class EPSGFactoryFallback
java.lang.Object
org.apache.sis.util.iso.AbstractFactory
org.apache.sis.referencing.factory.GeodeticAuthorityFactory
org.apache.sis.referencing.EPSGFactoryFallback
- All Implemented Interfaces:
org.opengis.referencing.AuthorityFactory,org.opengis.referencing.crs.CRSAuthorityFactory,org.opengis.referencing.cs.CSAuthorityFactory,org.opengis.referencing.datum.DatumAuthorityFactory,org.opengis.util.Factory
final class EPSGFactoryFallback
extends GeodeticAuthorityFactory
implements org.opengis.referencing.crs.CRSAuthorityFactory, org.opengis.referencing.cs.CSAuthorityFactory, org.opengis.referencing.datum.DatumAuthorityFactory
The authority factory to use as a fallback when the real EPSG factory is not available.
We use this factory in order to guarantee that the minimal set of CRS codes documented
in the
CRS.forCode(String) method javadoc is always available.
This fallback uses data available in public sources, with all EPSG metadata omitted except the identifiers.
The EPSG identifiers are provided as references where to find the complete definitions.- Since:
- 0.7
- Version:
- 1.3
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intKinds of object created by this factory, as bitmask.private static final intKinds of object created by this factory, as bitmask.private static final intKinds of object created by this factory, as bitmask.private static final intKinds of object created by this factory, as bitmask.private static final intKinds of object created by this factory, as bitmask.(package private) static final booleanWhether to disallowCommonCRSto useEPSGFactory(in which caseCommonCRSwill fallback on hard-coded values).private StringURL where users can get more information about the installation process.(package private) static final EPSGFactoryFallbackThe singleton instance.private static final intKinds of object created by this factory, as bitmask.private static final intKinds of object created by this factory, as bitmask. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateConstructor for the singleton instance. -
Method Summary
Modifier and TypeMethodDescriptionprivate static voidAdds the given value to the given set, provided that the value is different than zero.org.opengis.referencing.crs.CoordinateReferenceSystemReturns a coordinate reference system for the given EPSG code.org.opengis.referencing.cs.CoordinateSystemcreateCoordinateSystem(String code) Returns a coordinate system for the given EPSG code.org.opengis.referencing.cs.CoordinateSystemAxisReturns a coordinate system axis for the given EPSG code.org.opengis.referencing.datum.DatumcreateDatum(String code) Returns a datum for the given EPSG code.org.opengis.referencing.datum.EllipsoidcreateEllipsoid(String code) Returns an ellipsoid for the given EPSG code.org.opengis.referencing.IdentifiedObjectcreateObject(String code) Returns a coordinate reference system, datum or ellipsoid for the given EPSG code.org.opengis.referencing.datum.PrimeMeridiancreatePrimeMeridian(String code) Returns a prime meridian for the given EPSG code.javax.measure.Unit<?>createUnit(String code) Returns a unit of measurement for the given code.org.opengis.metadata.citation.CitationReturns an authority with "Subset of EPSG" title.getAuthorityCodes(Class<? extends org.opengis.referencing.IdentifiedObject> type) Returns the list of EPSG codes available.private StringReturns the title of the authority as a string in the default locale.Returns the namespace of EPSG codes.private StringReturns a URL where users can get more information about the installation process.private Objectpredefined(String code, int kind) Implementation of allcreateFoo(String)methods in this fallback class.private static Class<?>toClass(int kind) Returns the interface for the given*_MASKconstant.Methods inherited from class org.apache.sis.referencing.factory.GeodeticAuthorityFactory
createCartesianCS, createCompoundCRS, createCoordinateOperation, createCylindricalCS, createDerivedCRS, createEllipsoidalCS, createEngineeringCRS, createEngineeringDatum, createExtent, createFromCoordinateReferenceSystemCodes, createGeocentricCRS, createGeodeticDatum, createGeographicCRS, createImageCRS, createImageDatum, createOperationMethod, createParameterDescriptor, createParametricCRS, createParametricCS, createParametricDatum, createPolarCS, createProjectedCRS, createSphericalCS, createTemporalCRS, createTemporalDatum, createTimeCS, createVerticalCRS, createVerticalCS, createVerticalDatum, getDescriptionText, newIdentifiedObjectFinder, toString, trimNamespaceMethods inherited from class org.apache.sis.util.iso.AbstractFactory
getVendorMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.opengis.referencing.AuthorityFactory
getDescriptionTextMethods inherited from interface org.opengis.referencing.crs.CRSAuthorityFactory
createCompoundCRS, createDerivedCRS, createEngineeringCRS, createGeocentricCRS, createGeographicCRS, createImageCRS, createProjectedCRS, createTemporalCRS, createVerticalCRSMethods inherited from interface org.opengis.referencing.cs.CSAuthorityFactory
createCartesianCS, createCylindricalCS, createEllipsoidalCS, createPolarCS, createSphericalCS, createTimeCS, createVerticalCSMethods inherited from interface org.opengis.referencing.datum.DatumAuthorityFactory
createEngineeringDatum, createGeodeticDatum, createImageDatum, createTemporalDatum, createVerticalDatumMethods inherited from interface org.opengis.util.Factory
getVendor
-
Field Details
-
FORCE_HARDCODED
Whether to disallowCommonCRSto useEPSGFactory(in which caseCommonCRSwill fallback on hard-coded values). This field should always befalse, except for debugging purposes.- See Also:
-
INSTANCE
The singleton instance. -
installationURL
URL where users can get more information about the installation process. Fetched when first needed.- See Also:
-
CRS
private static final int CRSKinds of object created by this factory, as bitmask. Note that objects created forCSandAXISkinds are currently not cached.- See Also:
-
DATUM
private static final int DATUMKinds of object created by this factory, as bitmask. Note that objects created forCSandAXISkinds are currently not cached.- See Also:
-
ELLIPSOID
private static final int ELLIPSOIDKinds of object created by this factory, as bitmask. Note that objects created forCSandAXISkinds are currently not cached.- See Also:
-
PRIME_MERIDIAN
private static final int PRIME_MERIDIANKinds of object created by this factory, as bitmask. Note that objects created forCSandAXISkinds are currently not cached.- See Also:
-
UNIT
private static final int UNITKinds of object created by this factory, as bitmask. Note that objects created forCSandAXISkinds are currently not cached.- See Also:
-
AXIS
private static final int AXISKinds of object created by this factory, as bitmask. Note that objects created forCSandAXISkinds are currently not cached.- See Also:
-
CS
private static final int CSKinds of object created by this factory, as bitmask. Note that objects created forCSandAXISkinds are currently not cached.- See Also:
-
-
Constructor Details
-
EPSGFactoryFallback
private EPSGFactoryFallback()Constructor for the singleton instance.
-
-
Method Details
-
getAuthority
public org.opengis.metadata.citation.Citation getAuthority()Returns an authority with "Subset of EPSG" title.- Specified by:
getAuthorityin interfaceorg.opengis.referencing.AuthorityFactory- Specified by:
getAuthorityin classGeodeticAuthorityFactory- Returns:
- the organization responsible for definition of the database, or
nullif unknown. - See Also:
-
getAuthorityTitle
Returns the title of the authority as a string in the default locale. This is used in exceptions. -
getCodeSpaces
Returns the namespace of EPSG codes.- Overrides:
getCodeSpacesin classGeodeticAuthorityFactory- Returns:
- the
"EPSG"string in a singleton map.
-
getAuthorityCodes
public Set<String> getAuthorityCodes(Class<? extends org.opengis.referencing.IdentifiedObject> type) Returns the list of EPSG codes available.- Specified by:
getAuthorityCodesin interfaceorg.opengis.referencing.AuthorityFactory
-
add
Adds the given value to the given set, provided that the value is different than zero. Zero is used as a sentinel value inCommonCRSmeaning "no EPSG code". -
createPrimeMeridian
public org.opengis.referencing.datum.PrimeMeridian createPrimeMeridian(String code) throws org.opengis.referencing.NoSuchAuthorityCodeException Returns a prime meridian for the given EPSG code.- Specified by:
createPrimeMeridianin interfaceorg.opengis.referencing.datum.DatumAuthorityFactory- Overrides:
createPrimeMeridianin classGeodeticAuthorityFactory- Parameters:
code- value allocated by authority.- Returns:
- the prime meridian for the given code.
- Throws:
org.opengis.referencing.NoSuchAuthorityCodeException- if the specifiedcodewas not found.- See Also:
-
createEllipsoid
public org.opengis.referencing.datum.Ellipsoid createEllipsoid(String code) throws org.opengis.referencing.NoSuchAuthorityCodeException Returns an ellipsoid for the given EPSG code.- Specified by:
createEllipsoidin interfaceorg.opengis.referencing.datum.DatumAuthorityFactory- Overrides:
createEllipsoidin classGeodeticAuthorityFactory- Parameters:
code- value allocated by authority.- Returns:
- the ellipsoid for the given code.
- Throws:
org.opengis.referencing.NoSuchAuthorityCodeException- if the specifiedcodewas not found.- See Also:
-
createDatum
public org.opengis.referencing.datum.Datum createDatum(String code) throws org.opengis.referencing.NoSuchAuthorityCodeException Returns a datum for the given EPSG code.- Specified by:
createDatumin interfaceorg.opengis.referencing.datum.DatumAuthorityFactory- Overrides:
createDatumin classGeodeticAuthorityFactory- Parameters:
code- value allocated by authority.- Returns:
- the datum for the given code.
- Throws:
org.opengis.referencing.NoSuchAuthorityCodeException- if the specifiedcodewas not found.- See Also:
-
createCoordinateReferenceSystem
public org.opengis.referencing.crs.CoordinateReferenceSystem createCoordinateReferenceSystem(String code) throws org.opengis.referencing.NoSuchAuthorityCodeException Returns a coordinate reference system for the given EPSG code. This method is invoked as a fallback whenCRS.forCode(String)cannot create a CRS for a given code.- Specified by:
createCoordinateReferenceSystemin interfaceorg.opengis.referencing.crs.CRSAuthorityFactory- Overrides:
createCoordinateReferenceSystemin classGeodeticAuthorityFactory- Parameters:
code- value allocated by authority.- Returns:
- the coordinate reference system for the given code.
- Throws:
org.opengis.referencing.NoSuchAuthorityCodeException- if the specifiedcodewas not found.- See Also:
-
createCoordinateSystem
public org.opengis.referencing.cs.CoordinateSystem createCoordinateSystem(String code) throws org.opengis.referencing.NoSuchAuthorityCodeException Returns a coordinate system for the given EPSG code. Contrarily to other kinds of objects, coordinate systems are not cached because we cannot useCommonCRSas a store for them (because all enumerated values use the same coordinate systems). The lack of caching should not be an issue since standalone CS objects (without CRS) are rarely be needed.- Specified by:
createCoordinateSystemin interfaceorg.opengis.referencing.cs.CSAuthorityFactory- Overrides:
createCoordinateSystemin classGeodeticAuthorityFactory- Parameters:
code- value allocated by authority.- Returns:
- the coordinate system for the given code.
- Throws:
org.opengis.referencing.NoSuchAuthorityCodeException- if the specifiedcodewas not found.- See Also:
-
createCoordinateSystemAxis
public org.opengis.referencing.cs.CoordinateSystemAxis createCoordinateSystemAxis(String code) throws org.opengis.referencing.NoSuchAuthorityCodeException Returns a coordinate system axis for the given EPSG code. Axes are not cached for the same reasons thancreateCoordinateSystem(String).- Specified by:
createCoordinateSystemAxisin interfaceorg.opengis.referencing.cs.CSAuthorityFactory- Overrides:
createCoordinateSystemAxisin classGeodeticAuthorityFactory- Parameters:
code- value allocated by authority.- Returns:
- the axis for the given code.
- Throws:
org.opengis.referencing.NoSuchAuthorityCodeException- if the specifiedcodewas not found.- See Also:
-
createUnit
public javax.measure.Unit<?> createUnit(String code) throws org.opengis.referencing.NoSuchAuthorityCodeException Returns a unit of measurement for the given code.- Specified by:
createUnitin interfaceorg.opengis.referencing.cs.CSAuthorityFactory- Overrides:
createUnitin classGeodeticAuthorityFactory- Parameters:
code- value allocated by authority.- Returns:
- the unit of measurement for the given code.
- Throws:
org.opengis.referencing.NoSuchAuthorityCodeException- if the specifiedcodewas not found.- See Also:
-
createObject
public org.opengis.referencing.IdentifiedObject createObject(String code) throws org.opengis.referencing.NoSuchAuthorityCodeException Returns a coordinate reference system, datum or ellipsoid for the given EPSG code.- Specified by:
createObjectin interfaceorg.opengis.referencing.AuthorityFactory- Specified by:
createObjectin classGeodeticAuthorityFactory- Parameters:
code- value allocated by authority.- Returns:
- the object for the given code.
- Throws:
org.opengis.referencing.NoSuchAuthorityCodeException- if the specifiedcodewas not found.- See Also:
-
predefined
private Object predefined(String code, int kind) throws org.opengis.referencing.NoSuchAuthorityCodeException Implementation of allcreateFoo(String)methods in this fallback class.- Parameters:
code- the EPSG code.kind- any combination of*_MASKbits.- Returns:
- the requested object.
- Throws:
org.opengis.referencing.NoSuchAuthorityCodeException- if no matching object has been found.
-
getInstallationURL
Returns a URL where users can get more information about the installation process. -
toClass
Returns the interface for the given*_MASKconstant. This is used for formatting error message only.
-