Class VerticalDatumTypes
java.lang.Object
org.apache.sis.internal.referencing.VerticalDatumTypes
- All Implemented Interfaces:
org.opengis.util.CodeList.Filter
Extensions to the standard set of
VerticalDatumType
.
Those constants are not in public API because they were intentionally omitted from ISO 19111,
and the ISO experts said that they should really not be public.
This class implements CodeList.Filter
for opportunist reasons.
This implementation convenience may change in any future SIS version.
- Since:
- 0.4
- Version:
- 0.7
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final StringBuilder
The name of a datum to compare against the list of datum types, in upper-case and (if possible) using US-ASCII characters.static final org.opengis.referencing.datum.VerticalDatumType
A vertical datum for ellipsoidal heights that are measured along the normal to the ellipsoid used in the definition of horizontal datum.private static final short[]
Mapping fromVerticalDatumType
to the numeric values used in legacy specification (OGC 01-009).static final org.opengis.referencing.datum.VerticalDatumType
A vertical datum for orthometric heights that are measured along the plumb line.private static final org.opengis.referencing.datum.VerticalDatumType[]
Mapping from the numeric values used in legacy specification (OGC 01-009) toVerticalDatumType
. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
VerticalDatumTypes
(String name) Creates a newCodeList.Filter
which will compare the given datum name against the list of datum types. -
Method Summary
Modifier and TypeMethodDescriptionboolean
accept
(org.opengis.util.CodeList<?> code) Returnstrue
if the name of the given code is the prefix of a word in the datum name.codename()
Returnsnull
for disabling the creation of new code list elements.static org.opengis.referencing.datum.VerticalDatumType
fromLegacy
(int code) Returns the vertical datum type from a legacy code.private static org.opengis.referencing.datum.VerticalDatumType
Guesses the type of a datum of the given name.static org.opengis.referencing.datum.VerticalDatumType
guess
(String name, Collection<? extends org.opengis.util.GenericName> aliases, org.opengis.referencing.cs.CoordinateSystemAxis axis) Guesses the type of a datum from its name, aliases or a given vertical axis.static int
toLegacy
(org.opengis.referencing.datum.VerticalDatumType type) Returns the legacy code for the datum type, or 0 if unknown.
-
Field Details
-
ELLIPSOIDAL
public static final org.opengis.referencing.datum.VerticalDatumType ELLIPSOIDALA vertical datum for ellipsoidal heights that are measured along the normal to the ellipsoid used in the definition of horizontal datum.Identifier:
CS_DatumType.CS_VD_Ellipsoidal
-
ORTHOMETRIC
public static final org.opengis.referencing.datum.VerticalDatumType ORTHOMETRICA vertical datum for orthometric heights that are measured along the plumb line.Identifier:
CS_DatumType.CS_VD_Orthometric
-
TYPES
private static final org.opengis.referencing.datum.VerticalDatumType[] TYPESMapping from the numeric values used in legacy specification (OGC 01-009) toVerticalDatumType
. Indices in this array are the legacy codes minus 2000. This array shall not be fill before the above static constants. -
LEGACY_CODES
private static final short[] LEGACY_CODESMapping fromVerticalDatumType
to the numeric values used in legacy specification (OGC 01-009). -
datum
The name of a datum to compare against the list of datum types, in upper-case and (if possible) using US-ASCII characters.
-
-
Constructor Details
-
VerticalDatumTypes
Creates a newCodeList.Filter
which will compare the given datum name against the list of datum types. The comparison is case-insensitive and ignores some non-ASCII characters. The exact algorithm applied here is implementation dependent and may change in any future version.- Parameters:
name
- the datum name.
-
-
Method Details
-
fromLegacy
public static org.opengis.referencing.datum.VerticalDatumType fromLegacy(int code) Returns the vertical datum type from a legacy code. The legacy codes were defined in OGC 01-009 (Coordinate Transformation Services), which also defined the version 1 of Well Known Text format (WKT 1). This method is used for WKT 1 parsing.- Parameters:
code
- the legacy vertical datum code.- Returns:
- the vertical datum type, or
null
if the code is unrecognized.
-
toLegacy
public static int toLegacy(org.opengis.referencing.datum.VerticalDatumType type) Returns the legacy code for the datum type, or 0 if unknown. This method is used for WKT 1 formatting.- Parameters:
type
- the vertical datum type, ornull
if unknown.- Returns:
- the legacy code for the given datum type, or 0 if unknown.
-
guess
public static org.opengis.referencing.datum.VerticalDatumType guess(String name, Collection<? extends org.opengis.util.GenericName> aliases, org.opengis.referencing.cs.CoordinateSystemAxis axis) Guesses the type of a datum from its name, aliases or a given vertical axis. This is sometimes needed after XML unmarshalling or WKT parsing, since GML 3.2 and ISO 19162 do not contain any attribute for the datum type.This method uses heuristic rules and may be changed in any future SIS version. If the type cannot be determined, defaults to
VerticalDatumType.OTHER_SURFACE
.- Parameters:
name
- the name of the datum for which to guess a type, ornull
if unknown.aliases
- the aliases of the datum for which to guess a type, ornull
if unknown.axis
- the vertical axis for which to guess a type, ornull
if unknown.- Returns:
- a datum type, or
VerticalDatumType.OTHER_SURFACE
if none can be guessed.
-
guess
Guesses the type of a datum of the given name. This method attempts to guess only if the given name contains at least one letter. If the type cannot be determined, returnsnull
.- Parameters:
name
- name of the datum for which to guess a type, ornull
.- Returns:
- a datum type, or
null
if none can be guessed.
-
accept
public boolean accept(org.opengis.util.CodeList<?> code) Returnstrue
if the name of the given code is the prefix of a word in the datum name. We do not test the characters following the prefix because the word may be incomplete (e.g."geoid"
versus"geoidal"
).This method is public as an implementation side-effect and should be ignored.
- Specified by:
accept
in interfaceorg.opengis.util.CodeList.Filter
- Parameters:
code
- the code to test.- Returns:
true
if the code matches the criterion.
-
codename
Returnsnull
for disabling the creation of new code list elements. This method is public as an implementation side-effect and should be ignored.- Specified by:
codename
in interfaceorg.opengis.util.CodeList.Filter
- Returns:
null
.
-