Object
SimpleFactories
Provides simple factories backed by the example implementations.
This class is provided only for illustrative purposes with simple implementations.
This class is not for use in production.
For real applications, use a library implementing GeoAPI or providing GeoAPI wrappers.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic CoordinateSystemAxis
createAxis
(Citation authority, String name, char abbreviation) Creates a new axis for the given authority, name and abbreviation.static Citation
createCitation
(String title) Creates a new citation having the given title.static Envelope
createEnvelope
(DirectPosition lowerCorner, DirectPosition upperCorner) Creates a new envelope defined by two direct positions.static GeographicBoundingBox
Creates a geographic bounding box from the specified rectangular area.static Identifier
createIdentifier
(Citation authority, String code) Creates a new identifier of the given authority and code.<T> T
createMetadataView
(Class<T> type, Map<String, ?> attributes) Creates a new implementation of the given metadata interface which will contains the values in the given map.static DirectPosition
createPosition
(int dimension) Creates a new direct position of the given dimension.static DirectPosition
Creates a new direct position associated to the given coordinate reference system.static CRSAuthorityFactory
Returns a factory for creatingCoordinateReferenceSystem
instances.static MathTransformFactory
Returns a factory for creatingMathTransformFactory
instances.static NameFactory
Returns a factory for creatingGenericName
instances.
-
Method Details
-
createCitation
Creates a new citation having the given title. This citation can be used for defining the authority of a set of identifiers.- Parameters:
title
- the citation title.- Returns:
- a citation with the given title.
-
createIdentifier
Creates a new identifier of the given authority and code.- Parameters:
authority
- the authority, ornull
if none.code
- the identifier code.- Returns:
- identifier of the given code and (optionally) authority.
-
createPosition
Creates a new direct position of the given dimension. The Coordinate Reference System is left unspecified. All coordinate values are initialized to zero.- Parameters:
dimension
- the dimension.- Returns:
- a new direct position of the given number of dimensions.
-
createPosition
Creates a new direct position associated to the given coordinate reference system. The dimension of the new direct position is the dimension of the given CRS. All coordinate values are initialized to zero.- Parameters:
crs
- the coordinate reference system to associate to the new direct position.- Returns:
- a new direct position associated to the given CRS.
-
createEnvelope
Creates a new envelope defined by two direct positions. The CRS of the envelope will be the CRS of the given direct positions, which shall be the equal. The coordinates of the given direct positions are copied.This simple implementation does not support envelopes crossing the anti-meridian. Therefore, lower coordinate values shall not be greater than corresponding upper coordinate values.
- Parameters:
lowerCorner
- the limits in the direction of decreasing coordinate values for each dimension.upperCorner
- the limits in the direction of increasing coordinate values for each dimension.- Returns:
- the envelope defined by the given corners.
- Throws:
MismatchedCoordinateMetadataException
- if the CRS of the two position are not equal.MismatchedDimensionException
- if the two positions do not have the same dimension.IllegalArgumentException
- if an coordinate value in the lower corner is greater than the corresponding coordinate value in the upper corner.
-
createGeographicBoundingBox
Creates a geographic bounding box from the specified rectangular area. The coordinate values are assumed in WGS84 CRS.- Parameters:
bounds
- the rectangle to use for the geographic bounding box.- Returns:
- a geographic bounding box with the coordinates of the given rectangle.
- Throws:
IllegalArgumentException
- if (west bound > east bound) or (south bound > north bound). Note that NaN values are allowed.
-
createMetadataView
Creates a new implementation of the given metadata interface which will contains the values in the given map. The metadata values are specified by aMap
of attributes in which keys are UML identifiers, and values must be assignable to the return value of the corresponding GeoAPI methods.Example: create an
Individual
instance:var attributes = new HashMap<String,Object>(); attributes.put("name", getNameFactory().createInternationalString("Aristotle")); Individual party = createMetadataView(Individual.class, attributes);
- Type Parameters:
T
- the compile-time type of thetype
argument.- Parameters:
type
- the metadata interface for which to get an instance.attributes
- the attribute values to give to the metadata instance.- Returns:
- a metadata object which will fetch the values in the given map.
- Throws:
IllegalArgumentException
- if the given type is not an interface from the GeoAPI metadata package.
-
createAxis
Creates a new axis for the given authority, name and abbreviation. This is a simplified constructor which infers axis direction and units from the abbreviation using the following table.Axis properties inferred from the abbreviation Symbol Common name Axis direction Unit Range λ geodetic longitude east degree ±90° ( RangeMeaning.EXACT
)φ geodetic latitude north degree ±180° ( RangeMeaning.WRAPAROUND
)h ellipsoidal height up metre H gravity-related height up metre d depth down metre r geocentric radius up metre [0…∞] Ω spherical longitude east degree ±90° ( RangeMeaning.EXACT
)Θ spherical latitude north degree ±180° ( RangeMeaning.WRAPAROUND
)X geocentric X geocentric X metre Y geocentric Y geocentric Y metre Z geocentric Z geocentric Z metre E easting east metre W westing west metre N northing north metre S southing south metre t time future second i column column positive unity j row row positive unity - Parameters:
authority
- organization responsible for definition of the name, ornull
.name
- the name of the new axis.abbreviation
- the abbreviation used for this coordinate system axes.- Returns:
- a coordinate system axis of the given name and abbreviation.
- Throws:
IllegalArgumentException
- if the abbreviation is not recognized.
-
getNameFactory
Returns a factory for creatingGenericName
instances. This factory provides methods for constructingInternationalString
,GenericName
,LocalName
,ScopedName
,TypeName
andMemberName
.- Returns:
- a factory for creating instances of
GenericName
.
-
getCRSAuthorityFactory
Returns a factory for creatingCoordinateReferenceSystem
instances. The simple factory provided as an example defines only the following codes:CRS codes defined by "GeoAPI example" pseudo-authority Code Type Name 4326 Geographic WGS 84 4047 Geographic GRS 1980 Authalic Sphere 5714 Vertical Mean Sea Level (MSL) height JulianDate Temporal Julian Date - Returns:
- a factory for creating a few
CoordinateReferenceSystem
instances.
-
getMathTransformFactory
Returns a factory for creatingMathTransformFactory
instances. The simple factory provided as an example can create only linear transforms.- Returns:
- a factory for creating linear instances of
MathTransform
.
-