Package org.apache.sis.referencing.cs
Class DefaultCoordinateSystemAxis
- Object
-
- FormattableObject
-
- AbstractIdentifiedObject
-
- DefaultCoordinateSystemAxis
-
- All Implemented Interfaces:
Serializable,Deprecable,LenientComparable,CoordinateSystemAxis,IdentifiedObject
public class DefaultCoordinateSystemAxis extends AbstractIdentifiedObject implements CoordinateSystemAxis
Coordinate system axis name, direction, unit and range of values.Axis namesIn some case, the axis name is constrained by ISO 19111 depending on the coordinate reference system type. This constraint works in two directions. For example the names "geodetic latitude" and "geodetic longitude" shall be used to designate the coordinate axis names associated with aGeographicCRS. Conversely, these names shall not be used in any other context. See the GeoAPICoordinateSystemAxisjavadoc for more information.Immutability and thread safetyThis class is immutable and thus thread-safe if the property values (not necessarily the map itself) given to the constructor are also immutable. Unless otherwise noted in the javadoc, this condition holds if all components were created using only SIS factories and static constants.- Since:
- 0.4
- See Also:
AbstractCS,Unit, Serialized Form
Defined in the
sis-referencingmodule
-
-
Field Summary
Fields Modifier and Type Field Description static StringMAXIMUM_VALUE_KEYKey for the"maximumValue"property to be given to the constructor.static StringMINIMUM_VALUE_KEYKey for the"minimumValue"property to be given to the constructor.static StringRANGE_MEANING_KEYKey for the"rangeMeaning"property to be given to the constructor.-
Fields inherited from class AbstractIdentifiedObject
DEPRECATED_KEY, LOCALE_KEY
-
Fields inherited from interface IdentifiedObject
ALIAS_KEY, IDENTIFIERS_KEY, NAME_KEY, REMARKS_KEY
-
-
Constructor Summary
Constructors Modifier Constructor Description DefaultCoordinateSystemAxis(Map<String,?> properties, String abbreviation, AxisDirection direction, Unit<?> unit)Constructs an axis from a set of properties.protectedDefaultCoordinateSystemAxis(CoordinateSystemAxis axis)Creates a new coordinate system axis with the same values than the specified one.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static DefaultCoordinateSystemAxiscastOrCopy(CoordinateSystemAxis object)Returns a SIS axis implementation with the same values than the given arbitrary implementation.protected longcomputeHashCode()Invoked byhashCode()for computing the hash code when first needed.booleanequals(Object object, ComparisonMode mode)Compares the specified object with this axis for equality.protected StringformatTo(Formatter formatter)Formats this axis as a Well Known TextAxis[…]element.StringgetAbbreviation()Returns the abbreviation used for this coordinate system axes.AxisDirectiongetDirection()Returns the direction of this coordinate system axis.Class<? extends CoordinateSystemAxis>getInterface()Returns the GeoAPI interface implemented by this class.doublegetMaximumValue()Returns the maximum value normally allowed for this axis, in the unit of measure for the axis.doublegetMinimumValue()Returns the minimum value normally allowed for this axis, in the unit of measure for the axis.RangeMeaninggetRangeMeaning()Unit<?>getUnit()Returns the unit of measure used for this coordinate system axis.booleanisHeuristicMatchForName(String name)Returnstrueif either the primary name or at least one alias matches the given string according heuristic rules.-
Methods inherited from class AbstractIdentifiedObject
castOrCopy, equals, getAlias, getDescription, getIdentifiers, getName, getRemarks, hashCode, isDeprecated
-
Methods inherited from class FormattableObject
print, toString, toString, toWKT
-
Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface IdentifiedObject
getAlias, getIdentifiers, getName, getRemarks, toWKT
-
-
-
-
Field Detail
-
MINIMUM_VALUE_KEY
public static final String MINIMUM_VALUE_KEY
Key for the"minimumValue"property to be given to the constructor. This is used for setting the value to be returned bygetMinimumValue().- See Also:
- Constant Field Values
-
MAXIMUM_VALUE_KEY
public static final String MAXIMUM_VALUE_KEY
Key for the"maximumValue"property to be given to the constructor. This is used for setting the value to be returned bygetMaximumValue().- See Also:
- Constant Field Values
-
RANGE_MEANING_KEY
public static final String RANGE_MEANING_KEY
Key for the"rangeMeaning"property to be given to the constructor. This is used for setting the value to be returned bygetRangeMeaning().- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DefaultCoordinateSystemAxis
public DefaultCoordinateSystemAxis(Map<String,?> properties, String abbreviation, AxisDirection direction, Unit<?> unit)
Constructs an axis from a set of properties. The properties given in argument follow the same rules than for the super-class constructor. Additionally, the following properties are understood by this constructor:
Generally speaking, information provided in theRecognized properties (non exhaustive list) Property name Value type Returned by "minimumValue" NumbergetMinimumValue()"maximumValue" NumbergetMaximumValue()"rangeMeaning" RangeMeaninggetRangeMeaning()Defined in parent class (reminder) "name" ReferenceIdentifierorStringAbstractIdentifiedObject.getName()"alias" GenericNameorCharSequence(optionally as array)AbstractIdentifiedObject.getAlias()"identifiers" ReferenceIdentifier(optionally as array)AbstractIdentifiedObject.getIdentifiers()"remarks" InternationalStringorStringAbstractIdentifiedObject.getRemarks()propertiesmap are considered ignorable metadata (except the axis name) while information provided as explicit arguments may have an impact on coordinate transformation results. Exceptions to this rule are theminimumValueandmaximumValuein the particular case whererangeMeaningisRangeMeaning.WRAPAROUND.If no minimum, maximum and range meaning are specified, then this constructor will infer them from the axis unit and direction.
- Parameters:
properties- the properties to be given to the identified object.abbreviation- the abbreviation used for this coordinate system axis.direction- the direction of this coordinate system axis.unit- the unit of measure used for this coordinate system axis.- See Also:
GeodeticObjectFactory.createCoordinateSystemAxis(Map, String, AxisDirection, Unit)
-
DefaultCoordinateSystemAxis
protected DefaultCoordinateSystemAxis(CoordinateSystemAxis axis)
Creates a new coordinate system axis with the same values than the specified one. This copy constructor provides a way to convert an arbitrary implementation into a SIS one or a user-defined one (as a subclass), usually in order to leverage some implementation-specific API.This constructor performs a shallow copy, i.e. the properties are not cloned.
- Parameters:
axis- the coordinate system axis to copy.- See Also:
castOrCopy(CoordinateSystemAxis)
-
-
Method Detail
-
castOrCopy
public static DefaultCoordinateSystemAxis castOrCopy(CoordinateSystemAxis object)
Returns a SIS axis implementation with the same values than the given arbitrary implementation. If the given object isnull, then this method returnsnull. Otherwise if the given object is already a SIS implementation, then the given object is returned unchanged. Otherwise a new SIS implementation is created and initialized to the values of the given object.- Parameters:
object- the object to get as a SIS implementation, ornullif none.- Returns:
- a SIS implementation containing the values of the given object (may be the
given object itself), or
nullif the argument was null.
-
getInterface
public Class<? extends CoordinateSystemAxis> getInterface()
Returns the GeoAPI interface implemented by this class. The SIS implementation returnsCoordinateSystemAxis.class.Note for implementers: Subclasses usually do not need to override this method since GeoAPI does not defineCoordinateSystemAxissub-interface. Overriding possibility is left mostly for implementers who wish to extend GeoAPI with their own set of interfaces.- Overrides:
getInterfacein classAbstractIdentifiedObject- Returns:
CoordinateSystemAxis.classor a user-defined sub-interface.
-
getDirection
public AxisDirection getDirection()
Returns the direction of this coordinate system axis. This direction is often approximate and intended to provide a human interpretable meaning to the axis. A coordinate system can not contain two axes having the same direction or opposite directions.- Specified by:
getDirectionin interfaceCoordinateSystemAxis- Returns:
- the direction of this coordinate system axis.
-
getAbbreviation
public String getAbbreviation()
Returns the abbreviation used for this coordinate system axes. Examples are "X" and "Y".- Specified by:
getAbbreviationin interfaceCoordinateSystemAxis- Returns:
- the coordinate system axis abbreviation.
-
getUnit
public Unit<?> getUnit()
Returns the unit of measure used for this coordinate system axis. If thisCoordinateSystemAxiswas given by, then all coordinate values at dimension i in a coordinate tuple shall be recorded using this unit of measure.CoordinateSystem.getAxis(i)- Specified by:
getUnitin interfaceCoordinateSystemAxis- Returns:
- the unit of measure used for coordinate values along this coordinate system axis.
-
getMinimumValue
public double getMinimumValue()
Returns the minimum value normally allowed for this axis, in the unit of measure for the axis. If there is no minimum value, then this method returns negative infinity.- Specified by:
getMinimumValuein interfaceCoordinateSystemAxis- Returns:
- the minimum value normally allowed for this axis.
-
getMaximumValue
public double getMaximumValue()
Returns the maximum value normally allowed for this axis, in the unit of measure for the axis. If there is no maximum value, then this method returns negative infinity.- Specified by:
getMaximumValuein interfaceCoordinateSystemAxis- Returns:
- the maximum value normally allowed for this axis.
-
getRangeMeaning
public RangeMeaning getRangeMeaning()
Returns the meaning of axis value range specified by the minimum and maximum values. If there is no minimum and maximum values (i.e. if those values are negative infinity and positive infinity respectively), then this method returnsnull.- Specified by:
getRangeMeaningin interfaceCoordinateSystemAxis- Returns:
- the meaning of axis value range, or
nullif unspecified.
-
isHeuristicMatchForName
public boolean isHeuristicMatchForName(String name)
Returnstrueif either the primary name or at least one alias matches the given string according heuristic rules. This method performs the comparison documented in thesuper-class, with an additional flexibility for latitudes and longitudes:"Lat","Latitude"and"Geodetic latitude"are considered equivalent."Lon","Longitude"and"Geodetic longitude"are considered equivalent.
Future evolutionsThis method implements heuristic rules learned from experience while trying to provide inter-operability with different data producers. Those rules may be adjusted in any future SIS version according experience gained while working with more data producers.- Overrides:
isHeuristicMatchForNamein classAbstractIdentifiedObject- Parameters:
name- the name to compare.- Returns:
trueif the primary name of at least one alias matches the specifiedname.- See Also:
IdentifiedObjects.isHeuristicMatchForName(IdentifiedObject, String),Characters.Filter.LETTERS_AND_DIGITS
-
equals
public boolean equals(Object object, ComparisonMode mode)
Compares the specified object with this axis for equality. The strictness level is controlled by the second argument. This method compares the following properties in every cases: In the particular case wheregetRangeMeaning()isWRAPAROUND, thengetMinimumValue()andgetMaximumValue()are considered non-ignorable metadata and will be compared for every modes. All other properties are compared only for modes stricter thanComparisonMode.IGNORE_METADATA.- Specified by:
equalsin interfaceLenientComparable- Overrides:
equalsin classAbstractIdentifiedObject- Parameters:
object- the object to compare tothis.mode-STRICTfor performing a strict comparison, orIGNORE_METADATAfor comparing only properties relevant to coordinate transformations.- Returns:
trueif both objects are equal.- See Also:
AbstractIdentifiedObject.computeHashCode(),Utilities.deepEquals(Object, Object, ComparisonMode)
-
computeHashCode
protected long computeHashCode()
Invoked byhashCode()for computing the hash code when first needed. SeeAbstractIdentifiedObject.computeHashCode()for more information.- Overrides:
computeHashCodein classAbstractIdentifiedObject- Returns:
- the hash code value. This value may change in any future Apache SIS version.
-
formatTo
protected String formatTo(Formatter formatter)
Formats this axis as a Well Known TextAxis[…]element.Constraints for WKT validityThe ISO 19162 specification puts many constraints on axis names, abbreviations and directions allowed in WKT. Most of those constraints are inherited from ISO 19111 — seeCoordinateSystemAxisjavadoc for some of those. The current Apache SIS implementation does not verify whether this axis name and abbreviation are compliant; we assume that the user created a valid axis. The only actions (derived from ISO 19162 rules) taken by this method (by default) are:- Replace “Geodetic latitude” and “Geodetic longitude” names (case insensitive) by “latitude” and “longitude” respectively.
- For latitude and longitude axes, replace “φ” and “λ” abbreviations by “B” and “L” respectively (from German “Breite” and “Länge”, used in academic texts worldwide). Note that “L” is also the transliteration of Greek letter “lambda” (λ).
- In
SphericalCS, replace “φ” and “θ” abbreviations by “U” and “V” respectively. - In
PolarCS, replace “θ” abbreviation by “U”.
WKTFormat.setTransliterator(Transliterator).- Overrides:
formatToin classAbstractIdentifiedObject- Parameters:
formatter- the formatter where to format the inner content of this WKT element.- Returns:
"Axis".- See Also:
- WKT 2 specification §7.5.3
-
-