org.geotools.referencing.datum
Class DefaultPrimeMeridian

java.lang.Object
  extended byorg.geotools.referencing.wkt.Formattable
      extended byorg.geotools.referencing.AbstractIdentifiedObject
          extended byorg.geotools.referencing.datum.DefaultPrimeMeridian
All Implemented Interfaces:
org.opengis.referencing.IdentifiedObject, org.opengis.referencing.datum.PrimeMeridian, java.io.Serializable

public class DefaultPrimeMeridian
extends AbstractIdentifiedObject
implements org.opengis.referencing.datum.PrimeMeridian

A prime meridian defines the origin from which longitude values are determined. The name initial value is "Greenwich", and that value shall be used when the greenwich longitude value is zero.

Since:
2.1
Version:
$Id: DefaultPrimeMeridian.java 17672 2006-01-19 00:25:55Z desruisseaux $
Author:
Martin Desruisseaux
See Also:
Serialized Form

Field Summary
static DefaultPrimeMeridian GREENWICH
          The Greenwich meridian, with angular measurements in degrees.
 
Fields inherited from class org.geotools.referencing.AbstractIdentifiedObject
EMPTY_ALIAS_ARRAY, EMPTY_IDENTIFIER_ARRAY, IDENTIFIER_COMPARATOR, NAME_COMPARATOR, REMARKS_COMPARATOR
 
Fields inherited from interface org.opengis.referencing.IdentifiedObject
ALIAS_KEY, IDENTIFIERS_KEY, NAME_KEY, REMARKS_KEY
 
Constructor Summary
DefaultPrimeMeridian(java.util.Map properties, double greenwichLongitude, javax.units.Unit angularUnit)
          Constructs a prime meridian from a set of properties.
DefaultPrimeMeridian(org.opengis.referencing.datum.PrimeMeridian meridian)
          Constructs a new prime meridian with the same values than the specified one.
DefaultPrimeMeridian(java.lang.String name, double greenwichLongitude)
          Constructs a prime meridian from a name.
DefaultPrimeMeridian(java.lang.String name, double greenwichLongitude, javax.units.Unit angularUnit)
          Constructs a prime meridian from a name.
 
Method Summary
 boolean equals(AbstractIdentifiedObject object, boolean compareMetadata)
          Compare this prime meridian with the specified object for equality.
protected  java.lang.String formatWKT(Formatter formatter)
          Format the inner part of a Well Known Text (WKT) element.
 javax.units.Unit getAngularUnit()
          Returns the angular unit of the Greenwich longitude.
 double getGreenwichLongitude()
          Longitude of the prime meridian measured from the Greenwich meridian, positive eastward.
 double getGreenwichLongitude(javax.units.Unit targetUnit)
          Returns the longitude value relative to the Greenwich Meridian, expressed in the specified units.
 int hashCode()
          Returns a hash value for this prime meridian.
 
Methods inherited from class org.geotools.referencing.AbstractIdentifiedObject
asSet, ensureAngularUnit, ensureLinearUnit, ensureNonNull, ensureNonNull, ensureTimeUnit, equals, equals, equals, equals, getAlias, getIdentifier, getIdentifier, getIdentifiers, getName, getName, getName, getProperties, getProperties, getRemarks, nameMatches, nameMatches
 
Methods inherited from class org.geotools.referencing.wkt.Formattable
toString, toWKT, toWKT, toWKT
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.opengis.referencing.IdentifiedObject
getAlias, getIdentifiers, getName, getRemarks, toWKT
 

Field Detail

GREENWICH

public static final DefaultPrimeMeridian GREENWICH
The Greenwich meridian, with angular measurements in degrees.

Constructor Detail

DefaultPrimeMeridian

public DefaultPrimeMeridian(org.opengis.referencing.datum.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.

Since:
2.2

DefaultPrimeMeridian

public DefaultPrimeMeridian(java.lang.String name,
                            double greenwichLongitude)
Constructs a prime meridian from a name. The value is assumed in degrees.

Parameters:
name - The datum name.
greenwichLongitude - The longitude value relative to the Greenwich Meridian.

DefaultPrimeMeridian

public DefaultPrimeMeridian(java.lang.String name,
                            double greenwichLongitude,
                            javax.units.Unit 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(java.util.Map properties,
                            double greenwichLongitude,
                            javax.units.Unit 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. The initial value is zero, and that value shall be used when the meridian name value is "Greenwich".

Specified by:
getGreenwichLongitude in interface org.opengis.referencing.datum.PrimeMeridian
Returns:
The prime meridian Greenwich longitude, in angular unit.

getGreenwichLongitude

public double getGreenwichLongitude(javax.units.Unit 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 degrees (), regardless of the underlying angular units of this prime meridian.

Parameters:
targetUnit - The unit in which to express longitude.

getAngularUnit

public javax.units.Unit getAngularUnit()
Returns the angular unit of the Greenwich longitude.

Specified by:
getAngularUnit in interface org.opengis.referencing.datum.PrimeMeridian

equals

public boolean equals(AbstractIdentifiedObject object,
                      boolean compareMetadata)
Compare this prime meridian with the specified object for equality.

Overrides:
equals in class AbstractIdentifiedObject
Parameters:
object - The object to compare to .
compareMetadata - for performing a strict comparaison, or for comparing only properties relevant to transformations.
Returns:
if 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:
hashCode in class AbstractIdentifiedObject
Returns:
The hash code value. This value doesn't need to be the same in past or future versions of this class.

formatWKT

protected java.lang.String formatWKT(Formatter formatter)
Format the inner part of a Well Known Text (WKT) element.

Overrides:
formatWKT in class Formattable
Parameters:
formatter - The formatter to use.
Returns:
The WKT element name, which is "PRIMEM"
See Also:
Formattable.toWKT(), Formattable.toString()


Copyright © GeoTools. All Rights Reserved.