|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectFormattableObject
AbstractIdentifiedObject
AbstractCS
@Immutable public class AbstractCS
The set of coordinate system axes that spans a given coordinate space. A coordinate system (CS) is derived from a set of (mathematical) rules for specifying how coordinates in a given space are to be assigned to points. The coordinate values in a coordinate tuple shall be recorded in the order in which the coordinate system axes are recorded, whenever those coordinates use a coordinate reference system that uses this coordinate system.
This class is conceptually abstract, even if it is technically possible to
instantiate it. Typical applications should create instances of the most specific subclass with
Default prefix instead. An exception to this rule may occurs when it is not possible to
identify the exact type. For example it is not possible to infer the exact coordinate system from
Well
Known Text is some cases (e.g. in a LOCAL_CS element). In such exceptional
situation, a plain AbstractCS object may be instantiated.
DefaultCoordinateSystemAxis,
Unit,
AbstractDatum,
AbstractCRS,
Serialized Form
| referencing/geotk-referencing (download) | View source code for this class |
| Field Summary |
|---|
| Fields inherited from class FormattableObject |
|---|
EPSG, GEOTIFF, INTERNAL, OGC, SINGLE_LINE |
| Fields inherited from interface IdentifiedObject |
|---|
ALIAS_KEY, IDENTIFIERS_KEY, NAME_KEY, REMARKS_KEY |
| Constructor Summary | |
|---|---|
AbstractCS(CoordinateSystem cs)
Constructs a new coordinate system with the same values than the specified one. |
|
AbstractCS(Map<String,?> properties,
CoordinateSystemAxis... axis)
Constructs a coordinate system from a set of properties. |
|
AbstractCS(String name,
CoordinateSystemAxis... axis)
Constructs a coordinate system from a name. |
|
| Method Summary | |
|---|---|
protected int |
computeHashCode()
Computes a hash value for this identified object. |
Measure |
distance(double[] coord1,
double[] coord2)
Computes the distance between two points. |
boolean |
equals(Object object,
ComparisonMode mode)
Compares the specified object with this coordinate system for equality. |
String |
formatWKT(Formatter formatter)
Format the inner part of a Well Known Text (WKT) element. |
CoordinateSystemAxis |
getAxis(int dimension)
Returns the axis for this coordinate system at the specified dimension. |
int |
getDimension()
Returns the dimension of the coordinate system. |
protected boolean |
isCompatibleDirection(AxisDirection direction)
Returns true if the specified axis direction is allowed for this coordinate
system. |
protected boolean |
isCompatibleUnit(AxisDirection direction,
Unit<?> unit)
Returns true is the specified unit is legal for the specified axis direction. |
static CoordinateSystem |
standard(CoordinateSystem cs)
Returns a coordinate system with "standard" axis order and units. |
static Matrix |
swapAndScaleAxis(CoordinateSystem sourceCS,
CoordinateSystem targetCS)
Returns an affine transform between two coordinate systems. |
| Methods inherited from class AbstractIdentifiedObject |
|---|
equals, getAlias, getIdentifier, getIdentifiers, getName, getName, getRemarks, hashCode, nameMatches |
| Methods inherited from class FormattableObject |
|---|
getDefaultIndentation, print, setDefaultIndentation, toString, toWKT, toWKT, toWKT |
| Methods inherited from class Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface IdentifiedObject |
|---|
getAlias, getIdentifiers, getName, getRemarks, toWKT |
| Constructor Detail |
|---|
public AbstractCS(CoordinateSystem cs)
cs - The coordinate system to copy.
public AbstractCS(String name,
CoordinateSystemAxis... axis)
name - The coordinate system name.axis - The set of axis.
public AbstractCS(Map<String,?> properties,
CoordinateSystemAxis... axis)
properties - Set of properties. Should contains at least "name".axis - The set of axis.| Method Detail |
|---|
protected boolean isCompatibleDirection(AxisDirection direction)
true if the specified axis direction is allowed for this coordinate
system. This method is invoked at construction time for checking argument validity.
The default implementation returns true for all axis directions. Subclasses
will overrides this method in order to put more restrictions on allowed axis directions.
direction - The direction to test for compatibility.
true if the given direction is compatible with this coordinate system.
protected boolean isCompatibleUnit(AxisDirection direction,
Unit<?> unit)
true is the specified unit is legal for the specified axis direction.
This method is invoked at construction time for checking units compatibility. The default
implementation returns true in all cases. Subclasses can override this method and
check for compatibility with metre or
degree units.
direction - The direction of the axis having the given unit.unit - The unit to test for compatibility.
true if the given unit is compatible with this coordinate system.public int getDimension()
getDimension in interface CoordinateSystem
public CoordinateSystemAxis getAxis(int dimension)
throws IndexOutOfBoundsException
getAxis in interface CoordinateSystemdimension - The zero based index of axis.
IndexOutOfBoundsException - if dimension is out of bounds.
public static Matrix swapAndScaleAxis(CoordinateSystem sourceCS,
CoordinateSystem targetCS)
throws IllegalArgumentException,
ConversionException
Example: If coordinates in sourceCS are (x,y) pairs
in metres and coordinates in targetCS are (-y,x) pairs in
centimetres, then the transformation can be performed as below:
┌ ┐ ┌ ┐ ┌ ┐ │-y(cm)│ │ 0 -100 0 │ │ x(m)│ │ x(cm)│ = │ 100 0 0 │ │ y(m)│ │ 1 │ │ 0 0 1 │ │ 1 │ └ ┘ └ ┘ └ ┘
sourceCS - The source coordinate system.targetCS - The target coordinate system.
sourceCS to targetCS as
an affine transform. Only axis direction and units are taken in account.
IllegalArgumentException - if axis doesn't matches, or the CS doesn't have the
same geometry.
ConversionException - if the units are not compatible, or the conversion is non-linear.
public static CoordinateSystem standard(CoordinateSystem cs)
throws IllegalArgumentException
This method is typically used together with swapAndScaleAxis
for the creation of a transformation step before some
math transform.
Example:
A rational for standard axis order and units is explained in the Axis units and direction section in the description of map projection package.Matrix step1 = swapAndScaleAxis(sourceCS, standard(sourceCS)); Matrix step2 = ... some transform operating on standard axis ... Matrix step3 = swapAndScaleAxis(standard(targetCS), targetCS);
cs - The coordinate system.
cs with "standard" axis.
IllegalArgumentException - if the specified coordinate system is unknown to this method.
public Measure distance(double[] coord1,
double[] coord2)
throws UnsupportedOperationException,
MismatchedDimensionException
coord1 - Coordinates of the first point.coord2 - Coordinates of the second point.
coord1 and coord2.
UnsupportedOperationException - if this coordinate system can't compute distances.
MismatchedDimensionException - if a coordinate doesn't have the expected dimension.
public boolean equals(Object object,
ComparisonMode mode)
equals in interface LenientComparableequals in class AbstractIdentifiedObjectobject - The object to compare to this.mode - STRICT for performing a strict comparison, or
IGNORE_METADATA for comparing only properties
relevant to transformations.
true if both objects are equal.protected int computeHashCode()
AbstractIdentifiedObject.hashCode() when first needed.
Implementation specific feature
In the Geotk implementation, the name, identifiers and remarks are not used for hash code computation.
Consequently two identified objects will return the same hash value if they are equal in the
sense of equals(…,
ComparisonMode.IGNORE_METADATA). This feature allows users to
implement metadata-insensitive HashMap.
computeHashCode in class AbstractIdentifiedObjectpublic String formatWKT(Formatter formatter)
formatWKT in interface FormattableformatWKT in class FormattableObjectformatter - The formatter to use.
FormattableObject.toWKT(),
FormattableObject.toString()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||