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 int
Kinds of object created by this factory, as bitmask.private static final int
Kinds of object created by this factory, as bitmask.private static final int
Kinds of object created by this factory, as bitmask.private static final int
Kinds of object created by this factory, as bitmask.private static final int
Kinds of object created by this factory, as bitmask.(package private) static final boolean
Whether to disallowCommonCRS
to useEPSGFactory
(in which caseCommonCRS
will fallback on hard-coded values).private String
URL where users can get more information about the installation process.(package private) static final EPSGFactoryFallback
The singleton instance.private static final int
Kinds of object created by this factory, as bitmask.private static final int
Kinds of object created by this factory, as bitmask. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
Constructor for the singleton instance. -
Method Summary
Modifier and TypeMethodDescriptionprivate static void
Adds the given value to the given set, provided that the value is different than zero.org.opengis.referencing.crs.CoordinateReferenceSystem
Returns a coordinate reference system for the given EPSG code.org.opengis.referencing.cs.CoordinateSystem
createCoordinateSystem
(String code) Returns a coordinate system for the given EPSG code.org.opengis.referencing.cs.CoordinateSystemAxis
Returns a coordinate system axis for the given EPSG code.org.opengis.referencing.datum.Datum
createDatum
(String code) Returns a datum for the given EPSG code.org.opengis.referencing.datum.Ellipsoid
createEllipsoid
(String code) Returns an ellipsoid for the given EPSG code.org.opengis.referencing.IdentifiedObject
createObject
(String code) Returns a coordinate reference system, datum or ellipsoid for the given EPSG code.org.opengis.referencing.datum.PrimeMeridian
createPrimeMeridian
(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.Citation
Returns an authority with "Subset of EPSG" title.getAuthorityCodes
(Class<? extends org.opengis.referencing.IdentifiedObject> type) Returns the list of EPSG codes available.private String
Returns the title of the authority as a string in the default locale.Returns the namespace of EPSG codes.private String
Returns a URL where users can get more information about the installation process.private Object
predefined
(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*_MASK
constant.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, trimNamespace
Methods inherited from class org.apache.sis.util.iso.AbstractFactory
getVendor
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.opengis.referencing.AuthorityFactory
getDescriptionText
Methods inherited from interface org.opengis.referencing.crs.CRSAuthorityFactory
createCompoundCRS, createDerivedCRS, createEngineeringCRS, createGeocentricCRS, createGeographicCRS, createImageCRS, createProjectedCRS, createTemporalCRS, createVerticalCRS
Methods inherited from interface org.opengis.referencing.cs.CSAuthorityFactory
createCartesianCS, createCylindricalCS, createEllipsoidalCS, createPolarCS, createSphericalCS, createTimeCS, createVerticalCS
Methods inherited from interface org.opengis.referencing.datum.DatumAuthorityFactory
createEngineeringDatum, createGeodeticDatum, createImageDatum, createTemporalDatum, createVerticalDatum
Methods inherited from interface org.opengis.util.Factory
getVendor
-
Field Details
-
FORCE_HARDCODED
Whether to disallowCommonCRS
to useEPSGFactory
(in which caseCommonCRS
will 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 forCS
andAXIS
kinds are currently not cached.- See Also:
-
DATUM
private static final int DATUMKinds of object created by this factory, as bitmask. Note that objects created forCS
andAXIS
kinds are currently not cached.- See Also:
-
ELLIPSOID
private static final int ELLIPSOIDKinds of object created by this factory, as bitmask. Note that objects created forCS
andAXIS
kinds 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 forCS
andAXIS
kinds are currently not cached.- See Also:
-
UNIT
private static final int UNITKinds of object created by this factory, as bitmask. Note that objects created forCS
andAXIS
kinds are currently not cached.- See Also:
-
AXIS
private static final int AXISKinds of object created by this factory, as bitmask. Note that objects created forCS
andAXIS
kinds are currently not cached.- See Also:
-
CS
private static final int CSKinds of object created by this factory, as bitmask. Note that objects created forCS
andAXIS
kinds 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:
getAuthority
in interfaceorg.opengis.referencing.AuthorityFactory
- Specified by:
getAuthority
in classGeodeticAuthorityFactory
- Returns:
- the organization responsible for definition of the database, or
null
if 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:
getCodeSpaces
in 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:
getAuthorityCodes
in 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 inCommonCRS
meaning "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:
createPrimeMeridian
in interfaceorg.opengis.referencing.datum.DatumAuthorityFactory
- Overrides:
createPrimeMeridian
in classGeodeticAuthorityFactory
- Parameters:
code
- value allocated by authority.- Returns:
- the prime meridian for the given code.
- Throws:
org.opengis.referencing.NoSuchAuthorityCodeException
- if the specifiedcode
was 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:
createEllipsoid
in interfaceorg.opengis.referencing.datum.DatumAuthorityFactory
- Overrides:
createEllipsoid
in classGeodeticAuthorityFactory
- Parameters:
code
- value allocated by authority.- Returns:
- the ellipsoid for the given code.
- Throws:
org.opengis.referencing.NoSuchAuthorityCodeException
- if the specifiedcode
was 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:
createDatum
in interfaceorg.opengis.referencing.datum.DatumAuthorityFactory
- Overrides:
createDatum
in classGeodeticAuthorityFactory
- Parameters:
code
- value allocated by authority.- Returns:
- the datum for the given code.
- Throws:
org.opengis.referencing.NoSuchAuthorityCodeException
- if the specifiedcode
was 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:
createCoordinateReferenceSystem
in interfaceorg.opengis.referencing.crs.CRSAuthorityFactory
- Overrides:
createCoordinateReferenceSystem
in classGeodeticAuthorityFactory
- Parameters:
code
- value allocated by authority.- Returns:
- the coordinate reference system for the given code.
- Throws:
org.opengis.referencing.NoSuchAuthorityCodeException
- if the specifiedcode
was 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 useCommonCRS
as 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:
createCoordinateSystem
in interfaceorg.opengis.referencing.cs.CSAuthorityFactory
- Overrides:
createCoordinateSystem
in classGeodeticAuthorityFactory
- Parameters:
code
- value allocated by authority.- Returns:
- the coordinate system for the given code.
- Throws:
org.opengis.referencing.NoSuchAuthorityCodeException
- if the specifiedcode
was 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:
createCoordinateSystemAxis
in interfaceorg.opengis.referencing.cs.CSAuthorityFactory
- Overrides:
createCoordinateSystemAxis
in classGeodeticAuthorityFactory
- Parameters:
code
- value allocated by authority.- Returns:
- the axis for the given code.
- Throws:
org.opengis.referencing.NoSuchAuthorityCodeException
- if the specifiedcode
was 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:
createUnit
in interfaceorg.opengis.referencing.cs.CSAuthorityFactory
- Overrides:
createUnit
in classGeodeticAuthorityFactory
- Parameters:
code
- value allocated by authority.- Returns:
- the unit of measurement for the given code.
- Throws:
org.opengis.referencing.NoSuchAuthorityCodeException
- if the specifiedcode
was 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:
createObject
in interfaceorg.opengis.referencing.AuthorityFactory
- Specified by:
createObject
in classGeodeticAuthorityFactory
- Parameters:
code
- value allocated by authority.- Returns:
- the object for the given code.
- Throws:
org.opengis.referencing.NoSuchAuthorityCodeException
- if the specifiedcode
was 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*_MASK
bits.- 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*_MASK
constant. This is used for formatting error message only.
-