Package org.geotools.referencing.datum
Class DefaultPrimeMeridian
- Object
-
- Formattable
-
- AbstractIdentifiedObject
-
- DefaultPrimeMeridian
-
- All Implemented Interfaces:
Serializable,PrimeMeridian,IdentifiedObject,PROJFormattable
public class DefaultPrimeMeridian extends AbstractIdentifiedObject implements PrimeMeridian, PROJFormattable
A prime meridian defines the origin from which longitude values are determined. Thenameinitial value is "Greenwich", and that value shall be used when the greenwich longitude value is zero.- Since:
- 2.1
- Author:
- Martin Desruisseaux (IRD)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static DefaultPrimeMeridianGREENWICHThe Greenwich meridian, with angular measurements in decimal degrees.-
Fields inherited from class AbstractIdentifiedObject
EMPTY_ALIAS_ARRAY, EMPTY_IDENTIFIER_ARRAY, IDENTIFIER_COMPARATOR, NAME_COMPARATOR, REMARKS_COMPARATOR
-
Fields inherited from class Formattable
SINGLE_LINE
-
Fields inherited from interface IdentifiedObject
ALIAS_KEY, IDENTIFIERS_KEY, NAME_KEY, REMARKS_KEY
-
-
Constructor Summary
Constructors Constructor Description DefaultPrimeMeridian(String name, double greenwichLongitude)Constructs a prime meridian from a name.DefaultPrimeMeridian(String name, double greenwichLongitude, Unit<Angle> angularUnit)Constructs a prime meridian from a name.DefaultPrimeMeridian(Map<String,?> properties, double greenwichLongitude, Unit<Angle> angularUnit)Constructs a prime meridian from a set of properties.DefaultPrimeMeridian(PrimeMeridian meridian)Constructs a new prime meridian with the same values than the specified one.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(AbstractIdentifiedObject object, boolean compareMetadata)Compare this prime meridian with the specified object for equality.StringformatPROJ(PROJFormatter formatter)Format the inner part of a PROJFormattable object.protected StringformatWKT(Formatter formatter)Format the inner part of a Well Known Text (WKT) element.Unit<Angle>getAngularUnit()Returns the angular unit of the Greenwich longitude.doublegetGreenwichLongitude()Longitude of the prime meridian measured from the Greenwich meridian, positive eastward.doublegetGreenwichLongitude(Unit<Angle> targetUnit)Returns the longitude value relative to the Greenwich Meridian, expressed in the specified units.inthashCode()Returns a hash value for this prime meridian.-
Methods inherited from class AbstractIdentifiedObject
asSet, ensureAngularUnit, ensureLinearUnit, ensureNonNull, ensureNonNull, ensureTimeUnit, equals, equals, equals, equals, getAlias, getIdentifier, getIdentifier, getIdentifiers, getName, getName, getName, getProperties, getProperties, getRemarks, nameMatches, nameMatches, nameMatches
-
Methods inherited from class Formattable
cleanupThreadLocals, toString, toWKT, toWKT, toWKT, toWKT
-
Methods inherited from interface IdentifiedObject
getAlias, getIdentifiers, getName, getRemarks, toWKT
-
-
-
-
Field Detail
-
GREENWICH
public static final DefaultPrimeMeridian GREENWICH
The Greenwich meridian, with angular measurements in decimal degrees.
-
-
Constructor Detail
-
DefaultPrimeMeridian
public DefaultPrimeMeridian(PrimeMeridian meridian)
Constructs a new prime meridian with the same values than the specified one. This copy constructor provides a way to wrap an arbitrary implementation into a Geotools 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:
meridian- The prime meridian to copy.- Since:
- 2.2
-
DefaultPrimeMeridian
public DefaultPrimeMeridian(String name, double greenwichLongitude)
Constructs a prime meridian from a name. ThegreenwichLongitudevalue is assumed in decimal degrees.- Parameters:
name- The datum name.greenwichLongitude- The longitude value relative to the Greenwich Meridian.
-
DefaultPrimeMeridian
public DefaultPrimeMeridian(String name, double greenwichLongitude, Unit<Angle> angularUnit)
Constructs a prime meridian from a name.- Parameters:
name- The datum name.greenwichLongitude- The longitude value relative to the Greenwich Meridian.angularUnit- The angular unit of the longitude.
-
DefaultPrimeMeridian
public DefaultPrimeMeridian(Map<String,?> properties, double greenwichLongitude, Unit<Angle> angularUnit)
Constructs a prime meridian from a set of properties. The properties map is given unchanged to the super-class constructor.- Parameters:
properties- Set of properties. Should contains at least"name".greenwichLongitude- The longitude value relative to the Greenwich Meridian.angularUnit- The angular unit of the longitude.
-
-
Method Detail
-
getGreenwichLongitude
public double getGreenwichLongitude()
Longitude of the prime meridian measured from the Greenwich meridian, positive eastward. ThegreenwichLongitudeinitial value is zero, and that value shall be used when the meridian name value is "Greenwich".- Specified by:
getGreenwichLongitudein interfacePrimeMeridian- Returns:
- The prime meridian Greenwich longitude, in angular unit.
-
getGreenwichLongitude
public double getGreenwichLongitude(Unit<Angle> targetUnit)
Returns the longitude value relative to the Greenwich Meridian, expressed in the specified units. This convenience method makes it easier to obtain longitude in decimal degrees (getGreenwichLongitude(NonSI.DEGREE_ANGLE)), regardless of the underlying angular units of this prime meridian.- Parameters:
targetUnit- The unit in which to express longitude.- Returns:
- The Greenwich longitude in the given units.
-
getAngularUnit
public Unit<Angle> getAngularUnit()
Returns the angular unit of the Greenwich longitude.- Specified by:
getAngularUnitin interfacePrimeMeridian- Returns:
- The angular unit of greenwich longitude.
-
equals
public boolean equals(AbstractIdentifiedObject object, boolean compareMetadata)
Compare this prime meridian with the specified object for equality.- Overrides:
equalsin classAbstractIdentifiedObject- Parameters:
object- The object to compare tothis.compareMetadata-truefor performing a strict comparaison, orfalsefor comparing only properties relevant to transformations.- Returns:
trueif both objects are equal.
-
hashCode
public int hashCode()
Returns a hash value for this prime meridian. Name, remarks and the like are not taken in account. In other words, two prime meridians will return the same hash value if they are equal in the sense of.equals(AbstractIdentifiedObject, false)- Overrides:
hashCodein classAbstractIdentifiedObject- Returns:
- The hash code value. This value doesn't need to be the same in past or future versions of this class.
-
formatWKT
protected String formatWKT(Formatter formatter)
Format the inner part of a Well Known Text (WKT) element.- Overrides:
formatWKTin classFormattable- Parameters:
formatter- The formatter to use.- Returns:
- The WKT element name, which is "PRIMEM"
- See Also:
Formattable.toWKT(),Formattable.toString()
-
formatPROJ
public String formatPROJ(PROJFormatter formatter)
Description copied from interface:PROJFormattableFormat the inner part of a PROJFormattable object.This method is automatically invoked by
PROJFormatter.append(PROJFormattable).For example for a element (
DefaultOperationMethod) of type Projection, the formatter will invoke this method to prepend the "+proj=" String for completing the PROJ String before appending the Projection Name (e.g. lcc for a Lambert Conformal Conic)- Specified by:
formatPROJin interfacePROJFormattable- Parameters:
formatter- The PROJFormatter to use.- Returns:
- The proj String of the PROJ element type if any. (e.g. +ellps= for named ellipsoids, +datum= for named datums).
-
-