org.deegree_impl.model.cs
Class AxisOrientation

java.lang.Object
  extended byEnumeratedParameter
      extended byorg.deegree_impl.model.cs.AxisOrientation
All Implemented Interfaces:
java.lang.Comparable

public final class AxisOrientation
extends EnumeratedParameter
implements java.lang.Comparable

Orientation of axis. Some coordinate systems use non-standard orientations. For example, the first axis in South African grids usually points West, instead of East. This information is obviously relevant for algorithms converting South African grid coordinates into Lat/Long.

The natural ordering for axis orientations is defined as (EAST-WEST), (NORTH-SOUTH), (UP-DOWN), (FUTURE-PAST) and OTHER, which is the ordering for a (x,y,z,t) coordinate system. This means that when an array of AxisOrientations is sorted using Arrays.sort(Object[]), EAST and WEST orientations will appears first. NORTH and SOUTH will be next, followed by UP and DOWN, etc. Care should be exercised if AxisOrientations are to be used as keys in a sorted map or elements in a sorted set, as AxisOrientation's natural ordering is inconsistent with equals. See Comparable, SortedMap or SortedSet for more information.

Version:
1.00
Author:
OpenGIS (www.opengis.org), Martin Desruisseaux
See Also:
CS_AxisOrientationEnum, Serialized Form

Field Summary
static AxisOrientation DOWN
          Increasing ordinates values go down.
static AxisOrientation EAST
          Increasing ordinates values go East.
private static AxisOrientation[] ENUMS
          Axis orientations by value.
static AxisOrientation FUTURE
          Increasing time go toward future.
private  int key
          Resource key, used for building localized name.
private static int LAST_PAIRED_VALUE
          The last paired value.
static AxisOrientation NORTH
          Increasing ordinates values go North.
private static AxisOrientation[] ORDER
          The axis order.
static AxisOrientation OTHER
          Unknown or unspecified axis orientation.
static AxisOrientation PAST
          Increasing time go toward past.
private static long serialVersionUID
          Serial number for interoperability with different versions.
static AxisOrientation SOUTH
          Increasing ordinates values go South.
static AxisOrientation UP
          Increasing ordinates values go up.
static AxisOrientation WEST
          Increasing ordinates values go West.
 
Constructor Summary
private AxisOrientation(java.lang.String name, int value, int key)
          Construct a new enum with the specified value.
 
Method Summary
 AxisOrientation absolute()
          Returns the "absolute" orientation of this axis.
 int compareTo(java.lang.Object ao)
          Compares this AxisOrientation with the specified orientation.
static AxisOrientation getEnum(int value)
          Return the enum for the specified value.
 java.lang.String getName(java.util.Locale locale)
          Returns this enum's name in the specified locale.
private  int getOrder()
          Returns the order for this axis orientation (i.e. the index in the ORDER table).
 AxisOrientation inverse()
          Returns the opposite orientation of this axis.
private  java.lang.Object readResolve()
          Use a single instance of AxisOrientation after deserialization.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Serial number for interoperability with different versions.

See Also:
Constant Field Values

OTHER

public static final AxisOrientation OTHER
Unknown or unspecified axis orientation. This can be used for local or fitted coordinate systems.

See Also:
CS_AxisOrientationEnum.CS_AO_Other

NORTH

public static final AxisOrientation NORTH
Increasing ordinates values go North. This is usually used for Grid Y coordinates and Latitude.

See Also:
CS_AxisOrientationEnum.CS_AO_North

SOUTH

public static final AxisOrientation SOUTH
Increasing ordinates values go South.

See Also:
CS_AxisOrientationEnum.CS_AO_South

EAST

public static final AxisOrientation EAST
Increasing ordinates values go East. This is usually used for Grid X coordinates and Longitude.

See Also:
CS_AxisOrientationEnum.CS_AO_East

WEST

public static final AxisOrientation WEST
Increasing ordinates values go West.

See Also:
CS_AxisOrientationEnum.CS_AO_West

UP

public static final AxisOrientation UP
Increasing ordinates values go up. This is used for vertical coordinate systems.

See Also:
CS_AxisOrientationEnum.CS_AO_Up

DOWN

public static final AxisOrientation DOWN
Increasing ordinates values go down. This is used for vertical coordinate systems.

See Also:
CS_AxisOrientationEnum.CS_AO_Down

FUTURE

public static final AxisOrientation FUTURE
Increasing time go toward future. This is used for temporal axis.


PAST

public static final AxisOrientation PAST
Increasing time go toward past. This is used for temporal axis.


LAST_PAIRED_VALUE

private static final int LAST_PAIRED_VALUE
The last paired value. Paired value are NORTH-SOUTH, EAST-WEST, UP-DOWN, FUTURE-PAST.

See Also:
Constant Field Values

ENUMS

private static final AxisOrientation[] ENUMS
Axis orientations by value. Used to canonicalize after deserialization.


ORDER

private static final AxisOrientation[] ORDER
The axis order. Used for compareTo(java.lang.Object) implementation.


key

private final transient int key
Resource key, used for building localized name. This key doesn't need to be serialized, since readResolve() canonicalize enums according their #value. Furthermore, its value is implementation-dependent (which is an other raison why it should not be serialized).

Constructor Detail

AxisOrientation

private AxisOrientation(java.lang.String name,
                        int value,
                        int key)
Construct a new enum with the specified value.

Method Detail

getEnum

public static AxisOrientation getEnum(int value)
                               throws java.util.NoSuchElementException
Return the enum for the specified value. This method is provided for compatibility with CS_AxisOrientationEnum.

Parameters:
value - The enum value.
Returns:
The enum for the specified value.
Throws:
java.util.NoSuchElementException - if there is no enum for the specified value.

getName

public java.lang.String getName(java.util.Locale locale)
Returns this enum's name in the specified locale. If no name is available for the specified locale, a default one will be used.

Parameters:
locale - The locale, or null for the default locale.
Returns:
Enum's name in the specified locale.

inverse

public AxisOrientation inverse()
Returns the opposite orientation of this axis. The opposite of North is South, and the opposite of South is North. The same apply to East-West, Up-Down and Future-Past. Other axis orientation are returned inchanged.


absolute

public AxisOrientation absolute()
Returns the "absolute" orientation of this axis. This "absolute" operation is similar to the Math.abs(int) method in that "negative" orientation (SOUTH, WEST, DOWN, PAST) are changed for their positive counterpart (NORTH, EAST, UP, FUTURE). More specifically, the following conversion table is applied.
 
  Orientation     Absolute value  
NORTH NORTH
SOUTH NORTH
EAST EAST
WEST EAST
UP UP
DOWN UP
FUTUREFUTURE
PAST FUTURE
OTHER OTHER


compareTo

public int compareTo(java.lang.Object ao)
Compares this AxisOrientation with the specified orientation. The natural ordering is defined as (EAST-WEST), (NORTH-SOUTH), (UP-DOWN), (FUTURE-PAST) and OTHER, which is the ordering for a (x,y,z,t) coordinate system. Two AxisOrientation that are among the same axis but with an opposite direction (e.g. EAST vs WEST) are considered equal by this method.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
ao - An AxisOrientation object to be compared with.
Throws:
java.lang.ClassCastException - if ao is not an AxisOrientation object.

getOrder

private int getOrder()
Returns the order for this axis orientation (i.e. the index in the ORDER table).


readResolve

private java.lang.Object readResolve()
                              throws java.io.ObjectStreamException
Use a single instance of AxisOrientation after deserialization. It allow client code to test enum1==enum2 instead of enum1.equals(enum2).

Returns:
A single instance of this enum.
Throws:
java.io.ObjectStreamException - is deserialization failed.