Package org.opengis.test.referencing
Class PseudoEpsgFactory
- Object
-
- PseudoFactory
-
- PseudoEpsgFactory
-
- All Implemented Interfaces:
AuthorityFactory,CRSAuthorityFactory,CSAuthorityFactory,DatumAuthorityFactory,Factory
public class PseudoEpsgFactory extends PseudoFactory implements DatumAuthorityFactory, CSAuthorityFactory, CRSAuthorityFactory
Creates referencing objects for a limited set of hard-coded EPSG codes usingObjectFactoryandMathTransformFactory. This pseudo-factory can be used with implementation that do not support (or don't want to test) a "real"CRSAuthorityFactoryfor the EPSG database.- Since:
- 3.1
-
-
Field Summary
Fields Modifier and Type Field Description protected CoordinateOperationFactorycopFactoryFactory to use for buildingConversioninstances, ornullif none.protected CRSFactorycrsFactoryFactory to use for buildingCoordinateReferenceSysteminstances, ornullif none.protected CSFactorycsFactoryFactory to use for buildingCoordinateSysteminstances, ornullif none.protected DatumFactorydatumFactoryFactory to use for buildingDatuminstances, ornullif none.protected MathTransformFactorymtFactoryFactory to use for buildingMathTransforminstances, ornullif none.protected UnitsunitsProvider of pre-definedUnitinstances (degree, metre, second, etc).protected ValidatorContainervalidatorsThe set of validators to use for verifying objects conformance (nevernull).
-
Constructor Summary
Constructors Constructor Description PseudoEpsgFactory(Units units, DatumFactory datumFactory, CSFactory csFactory, CRSFactory crsFactory, CoordinateOperationFactory copFactory, MathTransformFactory mtFactory, ValidatorContainer validators)Creates a new pseudo-factory which will use the given factories.
-
Method Summary
Modifier and Type Method Description CartesianCScreateCartesianCS(String code)Creates a Cartesian coordinate system from a code.CompoundCRScreateCompoundCRS(String code)The default implementation throwsNoSuchAuthorityCodeExceptionunconditionally.CoordinateReferenceSystemcreateCoordinateReferenceSystem(String code)Returns an arbitrary coordinate reference system from a code.CoordinateSystemcreateCoordinateSystem(String code)Returns an arbitrary coordinate system from a code.CoordinateSystemAxiscreateCoordinateSystemAxis(String code)Returns a coordinate system axis from a code.CylindricalCScreateCylindricalCS(String code)The default implementation throwsNoSuchAuthorityCodeExceptionunconditionally.DatumcreateDatum(String code)Returns an arbitrary datum from a code.DerivedCRScreateDerivedCRS(String code)The default implementation throwsNoSuchAuthorityCodeExceptionunconditionally.EllipsoidcreateEllipsoid(String code)Returns an ellipsoid from a code.EllipsoidalCScreateEllipsoidalCS(String code)Creates an ellipsoidal coordinate system from a code.EngineeringCRScreateEngineeringCRS(String code)The default implementation throwsNoSuchAuthorityCodeExceptionunconditionally.EngineeringDatumcreateEngineeringDatum(String code)The default implementation throwsNoSuchAuthorityCodeExceptionunconditionally.GeocentricCRScreateGeocentricCRS(String code)The default implementation throwsNoSuchAuthorityCodeExceptionunconditionally.GeodeticDatumcreateGeodeticDatum(String code)Returns a geodetic datum from a code.GeographicCRScreateGeographicCRS(String code)Returns a geographic coordinate reference system from a code.ImageCRScreateImageCRS(String code)The default implementation throwsNoSuchAuthorityCodeExceptionunconditionally.ImageDatumcreateImageDatum(String code)The default implementation throwsNoSuchAuthorityCodeExceptionunconditionally.IdentifiedObjectcreateObject(String code)Returns an arbitrary object from a code.protected ParameterValueGroupcreateParameters(int code)Returns the parameters to use for creating the coordinate operation identified by the given EPSG code.ParametricCRScreateParametricCRS(String code)The default implementation throwsNoSuchAuthorityCodeExceptionunconditionally.ParametricCScreateParametricCS(String code)The default implementation throwsNoSuchAuthorityCodeExceptionunconditionally.ParametricDatumcreateParametricDatum(String code)The default implementation throwsNoSuchAuthorityCodeExceptionunconditionally.PolarCScreatePolarCS(String code)The default implementation throwsNoSuchAuthorityCodeExceptionunconditionally.PrimeMeridiancreatePrimeMeridian(String code)Returns a prime meridian from a EPSG code.ProjectedCRScreateProjectedCRS(String code)The default implementation throwsNoSuchAuthorityCodeExceptionunconditionally.protected Map<String,Object>createPropertiesMap(int code, String name)Builds a map of properties for a referencing object to be build.SphericalCScreateSphericalCS(String code)The default implementation throwsNoSuchAuthorityCodeExceptionunconditionally.TemporalCRScreateTemporalCRS(String code)The default implementation throwsNoSuchAuthorityCodeExceptionunconditionally.TemporalDatumcreateTemporalDatum(String code)The default implementation throwsNoSuchAuthorityCodeExceptionunconditionally.TimeCScreateTimeCS(String code)The default implementation throwsNoSuchAuthorityCodeExceptionunconditionally.Unit<?>createUnit(String code)Returns an unit from a code.VerticalCRScreateVerticalCRS(String code)The default implementation throwsNoSuchAuthorityCodeExceptionunconditionally.VerticalCScreateVerticalCS(String code)The default implementation throwsNoSuchAuthorityCodeExceptionunconditionally.VerticalDatumcreateVerticalDatum(String code)The default implementation throwsNoSuchAuthorityCodeExceptionunconditionally.CitationgetAuthority()The default implementation returnsnull.Set<String>getAuthorityCodes(Class<? extends IdentifiedObject> type)The default implementation returns an empty set.InternationalStringgetDescriptionText(String code)The default implementation returnsnull.-
Methods inherited from class PseudoFactory
getVendor
-
-
-
-
Field Detail
-
units
protected final Units units
Provider of pre-definedUnitinstances (degree, metre, second, etc).
-
datumFactory
protected final DatumFactory datumFactory
Factory to use for buildingDatuminstances, ornullif none.
-
csFactory
protected final CSFactory csFactory
Factory to use for buildingCoordinateSysteminstances, ornullif none.
-
crsFactory
protected final CRSFactory crsFactory
Factory to use for buildingCoordinateReferenceSysteminstances, ornullif none.
-
copFactory
protected final CoordinateOperationFactory copFactory
Factory to use for buildingConversioninstances, ornullif none.
-
mtFactory
protected final MathTransformFactory mtFactory
Factory to use for buildingMathTransforminstances, ornullif none.
-
validators
protected final ValidatorContainer validators
The set of validators to use for verifying objects conformance (nevernull).
-
-
Constructor Detail
-
PseudoEpsgFactory
public PseudoEpsgFactory(Units units, DatumFactory datumFactory, CSFactory csFactory, CRSFactory crsFactory, CoordinateOperationFactory copFactory, MathTransformFactory mtFactory, ValidatorContainer validators)
Creates a new pseudo-factory which will use the given factories.- Parameters:
units- provider of pre-definedUnitinstances.datumFactory- factory for creatingDatuminstances.csFactory- factory for creatingCoordinateSysteminstances.crsFactory- factory for creatingCoordinateReferenceSysteminstances.copFactory- factory for creatingConversioninstances.mtFactory- factory for creatingMathTransforminstances.validators- the set of validators to use for verifying objects conformance, Can not benull; if there is no particular validators, useValidators.DEFAULT.
-
-
Method Detail
-
getAuthority
public Citation getAuthority()
The default implementation returnsnull.- Specified by:
getAuthorityin interfaceAuthorityFactory
-
getAuthorityCodes
public Set<String> getAuthorityCodes(Class<? extends IdentifiedObject> type) throws FactoryException
The default implementation returns an empty set.- Specified by:
getAuthorityCodesin interfaceAuthorityFactory- Throws:
FactoryException- if this method can not provide the requested information.- TODO:
- Needs to be implemented.
-
getDescriptionText
public InternationalString getDescriptionText(String code) throws FactoryException
The default implementation returnsnull.- Specified by:
getDescriptionTextin interfaceAuthorityFactory- Throws:
FactoryException- if this method can not provide the requested information.
-
createPropertiesMap
protected Map<String,Object> createPropertiesMap(int code, String name)
Builds a map of properties for a referencing object to be build. The map shall contains at least theIdentifiedObject.NAME_KEYidentifier associated to the given value. Subclasses can override this method in order to provide more information if they wish.- Parameters:
code- The EPSG code of the object being built.name- The name of the object being built.- Returns:
- a map containing the properties for the object to create.
-
createObject
public IdentifiedObject createObject(String code) throws FactoryException
Returns an arbitrary object from a code.Supported codes Code Name 4326 WGS 84 6326 World Geodetic System 1984 6422 Ellipsoidal 2D CS. Axes: latitude, longitude. Orientations: north, east. UoM: degree - Specified by:
createObjectin interfaceAuthorityFactory- Parameters:
code- value allocated by authority.- Returns:
- the datum for the given code.
- Throws:
FactoryException- if the object creation failed.
-
createDatum
public Datum createDatum(String code) throws FactoryException
Returns an arbitrary datum from a code.Supported codes Code Name 6326 World Geodetic System 1984 - Specified by:
createDatumin interfaceDatumAuthorityFactory- Parameters:
code- value allocated by authority.- Returns:
- the datum for the given code.
- Throws:
FactoryException- if the object creation failed.
-
createEngineeringDatum
public EngineeringDatum createEngineeringDatum(String code) throws FactoryException
The default implementation throwsNoSuchAuthorityCodeExceptionunconditionally.- Specified by:
createEngineeringDatumin interfaceDatumAuthorityFactory- Throws:
FactoryException- if this method can not provide the requested information.
-
createImageDatum
public ImageDatum createImageDatum(String code) throws FactoryException
The default implementation throwsNoSuchAuthorityCodeExceptionunconditionally.- Specified by:
createImageDatumin interfaceDatumAuthorityFactory- Throws:
FactoryException- if this method can not provide the requested information.
-
createVerticalDatum
public VerticalDatum createVerticalDatum(String code) throws FactoryException
The default implementation throwsNoSuchAuthorityCodeExceptionunconditionally.- Specified by:
createVerticalDatumin interfaceDatumAuthorityFactory- Throws:
FactoryException- if this method can not provide the requested information.
-
createTemporalDatum
public TemporalDatum createTemporalDatum(String code) throws FactoryException
The default implementation throwsNoSuchAuthorityCodeExceptionunconditionally.- Specified by:
createTemporalDatumin interfaceDatumAuthorityFactory- Throws:
FactoryException- if this method can not provide the requested information.
-
createParametricDatum
public ParametricDatum createParametricDatum(String code) throws FactoryException
The default implementation throwsNoSuchAuthorityCodeExceptionunconditionally.- Specified by:
createParametricDatumin interfaceDatumAuthorityFactory- Throws:
FactoryException- if this method can not provide the requested information.
-
createGeodeticDatum
public GeodeticDatum createGeodeticDatum(String code) throws FactoryException
Returns a geodetic datum from a code.Supported codes Code Name 6326 World Geodetic System 1984 6284 Pulkovo 1942 - Specified by:
createGeodeticDatumin interfaceDatumAuthorityFactory- Parameters:
code- value allocated by authority.- Returns:
- the datum for the given code.
- Throws:
FactoryException- if the object creation failed.
-
createEllipsoid
public Ellipsoid createEllipsoid(String code) throws FactoryException
Returns an ellipsoid from a code.Supported codes Code Name 7001 Airy 1830 7004 Bessel 1841 7011 Clarke 1880 (IGN) 7019 GRS 1980 7022 International 1924 7024 Krassowsky 1940 7030 WGS 84 - Specified by:
createEllipsoidin interfaceDatumAuthorityFactory- Parameters:
code- value allocated by authority.- Returns:
- the ellipsoid for the given code.
- Throws:
FactoryException- if the object creation failed.
-
createPrimeMeridian
public PrimeMeridian createPrimeMeridian(String code) throws FactoryException
Returns a prime meridian from a EPSG code.Supported codes Code Name 8901 Greenwich 8903 Paris 8908 Jakarta - Specified by:
createPrimeMeridianin interfaceDatumAuthorityFactory- Parameters:
code- value allocated by authority.- Returns:
- the prime meridian for the given code.
- Throws:
FactoryException- if the object creation failed.
-
createCoordinateSystem
public CoordinateSystem createCoordinateSystem(String code) throws FactoryException
Returns an arbitrary coordinate system from a code.Supported codes Code Name 6422 Ellipsoidal 2D CS. Axes: latitude, longitude. Orientations: north, east. UoM: degree - Specified by:
createCoordinateSystemin interfaceCSAuthorityFactory- Parameters:
code- value allocated by authority.- Returns:
- the coordinate system for the given code.
- Throws:
FactoryException- if the object creation failed.
-
createCartesianCS
public CartesianCS createCartesianCS(String code) throws FactoryException
Creates a Cartesian coordinate system from a code.Supported codes Code Name 6500 Earth centred, earth fixed, righthanded 3D coordinate system, consisting of 3 orthogonal axes with X and Y axes in the equatorial plane, positive Z-axis parallel to mean earth rotation axis and pointing towards North Pole. UoM: m - Specified by:
createCartesianCSin interfaceCSAuthorityFactory- Parameters:
code- value allocated by authority.- Returns:
- the coordinate system for the given code.
- Throws:
FactoryException- if the object creation failed.
-
createPolarCS
public PolarCS createPolarCS(String code) throws FactoryException
The default implementation throwsNoSuchAuthorityCodeExceptionunconditionally.- Specified by:
createPolarCSin interfaceCSAuthorityFactory- Throws:
FactoryException- if this method can not provide the requested information.
-
createCylindricalCS
public CylindricalCS createCylindricalCS(String code) throws FactoryException
The default implementation throwsNoSuchAuthorityCodeExceptionunconditionally.- Specified by:
createCylindricalCSin interfaceCSAuthorityFactory- Throws:
FactoryException- if this method can not provide the requested information.
-
createSphericalCS
public SphericalCS createSphericalCS(String code) throws FactoryException
The default implementation throwsNoSuchAuthorityCodeExceptionunconditionally.- Specified by:
createSphericalCSin interfaceCSAuthorityFactory- Throws:
FactoryException- if this method can not provide the requested information.
-
createEllipsoidalCS
public EllipsoidalCS createEllipsoidalCS(String code) throws FactoryException
Creates an ellipsoidal coordinate system from a code.Supported codes Code Name 6403 Ellipsoidal 2D CS. Axes: latitude, longitude. Orientations: north, east. UoM: grads. 6422 Ellipsoidal 2D CS. Axes: latitude, longitude. Orientations: north, east. UoM: degree 6423 Ellipsoidal 3D CS. Axes: latitude, longitude, ellipsoidal height. Orientations: north, east, up. UoM: degree, degree, metre. 6424 Ellipsoidal 2D CS. Axes: longitude, latitude. Orientations: east, north. UoM: degree - Specified by:
createEllipsoidalCSin interfaceCSAuthorityFactory- Parameters:
code- value allocated by authority.- Returns:
- the coordinate system for the given code.
- Throws:
FactoryException- if the object creation failed.
-
createVerticalCS
public VerticalCS createVerticalCS(String code) throws FactoryException
The default implementation throwsNoSuchAuthorityCodeExceptionunconditionally.- Specified by:
createVerticalCSin interfaceCSAuthorityFactory- Throws:
FactoryException- if this method can not provide the requested information.
-
createTimeCS
public TimeCS createTimeCS(String code) throws FactoryException
The default implementation throwsNoSuchAuthorityCodeExceptionunconditionally.- Specified by:
createTimeCSin interfaceCSAuthorityFactory- Throws:
FactoryException- if this method can not provide the requested information.
-
createParametricCS
public ParametricCS createParametricCS(String code) throws FactoryException
The default implementation throwsNoSuchAuthorityCodeExceptionunconditionally.- Specified by:
createParametricCSin interfaceCSAuthorityFactory- Throws:
FactoryException- if this method can not provide the requested information.
-
createCoordinateSystemAxis
public CoordinateSystemAxis createCoordinateSystemAxis(String code) throws FactoryException
Returns a coordinate system axis from a code.Supported codes Code Name Unit 58 Geodetic latitude grad 59 Geodetic longitude grad 106, 108, 221 Geodetic latitude degree 107, 109, 220 Geodetic longitude degree 110 Ellipsoidal height metre 115 Geocentric X metre 116 Geocentric Y metre 117 Geocentric Z metre - Specified by:
createCoordinateSystemAxisin interfaceCSAuthorityFactory- Parameters:
code- value allocated by authority.- Returns:
- the axis for the given code.
- Throws:
FactoryException- if the object creation failed.
-
createUnit
public Unit<?> createUnit(String code) throws FactoryException
Returns an unit from a code.Supported codes Code Name 9001 metre 9102 degree 9105 grad 9122 degree (supplier to define representation) - Specified by:
createUnitin interfaceCSAuthorityFactory- Parameters:
code- value allocated by authority.- Returns:
- the unit for the given code.
- Throws:
FactoryException- if the object creation failed.
-
createCoordinateReferenceSystem
public CoordinateReferenceSystem createCoordinateReferenceSystem(String code) throws FactoryException
Returns an arbitrary coordinate reference system from a code.Supported codes Code Name 4326 WGS 84 - Specified by:
createCoordinateReferenceSystemin interfaceCRSAuthorityFactory- Parameters:
code- value allocated by authority.- Returns:
- the coordinate reference system for the given code.
- Throws:
FactoryException- if the object creation failed.
-
createCompoundCRS
public CompoundCRS createCompoundCRS(String code) throws FactoryException
The default implementation throwsNoSuchAuthorityCodeExceptionunconditionally.- Specified by:
createCompoundCRSin interfaceCRSAuthorityFactory- Throws:
FactoryException- if this method can not provide the requested information.
-
createDerivedCRS
public DerivedCRS createDerivedCRS(String code) throws FactoryException
The default implementation throwsNoSuchAuthorityCodeExceptionunconditionally.- Specified by:
createDerivedCRSin interfaceCRSAuthorityFactory- Throws:
FactoryException- if this method can not provide the requested information.
-
createEngineeringCRS
public EngineeringCRS createEngineeringCRS(String code) throws FactoryException
The default implementation throwsNoSuchAuthorityCodeExceptionunconditionally.- Specified by:
createEngineeringCRSin interfaceCRSAuthorityFactory- Throws:
FactoryException- if this method can not provide the requested information.
-
createGeographicCRS
public GeographicCRS createGeographicCRS(String code) throws FactoryException
Returns a geographic coordinate reference system from a code.Supported codes Code Name 4326 WGS 84 4284 Pulkovo 1942 - Specified by:
createGeographicCRSin interfaceCRSAuthorityFactory- Parameters:
code- value allocated by authority.- Returns:
- the coordinate reference system for the given code.
- Throws:
FactoryException- if the object creation failed.
-
createGeocentricCRS
public GeocentricCRS createGeocentricCRS(String code) throws FactoryException
The default implementation throwsNoSuchAuthorityCodeExceptionunconditionally.- Specified by:
createGeocentricCRSin interfaceCRSAuthorityFactory- Throws:
FactoryException- if this method can not provide the requested information.
-
createImageCRS
public ImageCRS createImageCRS(String code) throws FactoryException
The default implementation throwsNoSuchAuthorityCodeExceptionunconditionally.- Specified by:
createImageCRSin interfaceCRSAuthorityFactory- Throws:
FactoryException- if this method can not provide the requested information.
-
createProjectedCRS
public ProjectedCRS createProjectedCRS(String code) throws FactoryException
The default implementation throwsNoSuchAuthorityCodeExceptionunconditionally.- Specified by:
createProjectedCRSin interfaceCRSAuthorityFactory- Throws:
FactoryException- if this method can not provide the requested information.
-
createTemporalCRS
public TemporalCRS createTemporalCRS(String code) throws FactoryException
The default implementation throwsNoSuchAuthorityCodeExceptionunconditionally.- Specified by:
createTemporalCRSin interfaceCRSAuthorityFactory- Throws:
FactoryException- if this method can not provide the requested information.
-
createVerticalCRS
public VerticalCRS createVerticalCRS(String code) throws FactoryException
The default implementation throwsNoSuchAuthorityCodeExceptionunconditionally.- Specified by:
createVerticalCRSin interfaceCRSAuthorityFactory- Throws:
FactoryException- if this method can not provide the requested information.
-
createParametricCRS
public ParametricCRS createParametricCRS(String code) throws FactoryException
The default implementation throwsNoSuchAuthorityCodeExceptionunconditionally.- Specified by:
createParametricCRSin interfaceCRSAuthorityFactory- Throws:
FactoryException- if this method can not provide the requested information.
-
createParameters
protected ParameterValueGroup createParameters(int code) throws FactoryException
Returns the parameters to use for creating the coordinate operation identified by the given EPSG code. The coordinate operation is typically a map projection used by exactly one projected CRS, which is listed in the second column for information purpose.The supported codes are determined from the set of examples published in the EPSG guidance document, augmented with other sources (IGNF). The following table lists the supported codes. Codes in italics are not official EPSG codes.
Supported codes Code Used by CRS CRS or transformation name Operation method 19905 3002 Makassar / NEIEZ Mercator (variant A) 19884 3388 Pulkovo 1942 / Caspian Sea Mercator Mercator (variant B) 3856 3857 WGS 84 / Pseudo-Mercator Popular Visualisation Pseudo Mercator 310642901 310642901 IGNF:MILLER Miller_Cylindrical 19958 29873 Timbalai 1948 / RSO Borneo (m) Hotine Oblique Mercator (variant B) 19916 27700 OSGB 1936 / British National Grid Transverse Mercator 17529 2053 South African Survey Grid zone 29 Transverse Mercator 19975 2314 Trinidad 1903 / Trinidad Grid Cassini-Soldner 19910 24200 JAD69 / Jamaica National Grid Lambert Conic Conformal (1SP) 14204 32040 NAD27 / Texas South Central Lambert Conic Conformal (2SP) 6198 6201 Michigan CS27 Central zone Lambert Conic Conformal (2SP Michigan) 19902 31300 Belge 1972 / Belge Lambert 72 Lambert Conic Conformal (2SP Belgium) 19986 3035 ETRS89 / LAEA Europe Lambert Azimuthal Equal Area 16061 5041 WGS 84 / UPS North (E,N) Polar Stereographic (variant A) 19993 3032 WGS 84 / Australian Antarctic Polar Polar Stereographic (variant B) 19983 2985 Petrels 1972 / Terre Adelie Polar Stereographic Polar Stereographic (variant C) 19914 28992 Amersfoort / RD New Oblique Stereographic 9818 9818 Polyconic Polyconic 19952 2065 CRS S-JTSK (Ferro) / Krovak Krovak 9605 4230 ED50 to WGS 84 Abridged Molodensky - Parameters:
code- the EPSG code of the coordinate operation to create.- Returns:
- the coordinate operation (typically a map projection) parameters.
- Throws:
FactoryException- if the given EPSG code is unknown to this factory.- See Also:
ParameterizedTransformTest,AuthorityFactoryTest
-
-