| org.geotools.referencing.AbstractIdentifiedObject org.geotools.referencing.cs.AbstractCS
All known Subclasses: org.geotools.referencing.cs.DefaultCompoundCS, org.geotools.referencing.cs.DefaultUserDefinedCS, org.geotools.referencing.cs.DefaultEllipsoidalCS, org.geotools.referencing.cs.DefaultSphericalCS, org.geotools.referencing.cs.DefaultCylindricalCS, org.geotools.referencing.cs.DefaultVerticalCS, org.geotools.referencing.cs.DefaultTimeCS, org.geotools.referencing.cs.DefaultLinearCS, org.geotools.referencing.cs.DefaultPolarCS, org.geotools.referencing.cs.DefaultAffineCS,
AbstractCS | public class AbstractCS extends AbstractIdentifiedObject implements CoordinateSystem(Code) | | 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.
since: 2.1 version: $Id: AbstractCS.java 25485 2007-05-11 19:12:35Z desruisseaux $ author: Martin Desruisseaux See Also: DefaultCoordinateSystemAxis See Also: javax.units.Unit See Also: org.geotools.referencing.datum.AbstractDatum See Also: org.geotools.referencing.crs.AbstractCRS |
Constructor Summary | |
public | AbstractCS(CoordinateSystem cs) Constructs a new coordinate system 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. | public | AbstractCS(String name, CoordinateSystemAxis[] axis) Constructs a coordinate system from a name. | public | AbstractCS(Map properties, CoordinateSystemAxis[] axis) Constructs a coordinate system from a set of properties. |
Method Summary | |
final boolean | axisColinearWith(CoordinateSystem userCS) Returns
true if every axis in the specified
userCS are colinear with axis
in this coordinate system. | final CoordinateSystemAxis[] | axisUsingUnit(Unit unit) Returns all axis in the specified unit. | final boolean | directionColinearWith(CoordinateSystem userCS) Compares directions only, without consideration for the axis name. | public Measure | distance(double[] coord1, double[] coord2) Computes the distance between two points. | final void | ensureDimensionMatch(String name, double[] coordinates) Convenience method for checking object dimension validity. | public boolean | equals(AbstractIdentifiedObject object, boolean compareMetadata) Compares the specified object with this coordinate system for equality.
Parameters: object - The object to compare to this . Parameters: compareMetadata - true for performing a strict comparaison, or false for comparing only properties relevant to transformations. | protected String | formatWKT(Formatter formatter) Format the inner part of a
Well
Known Text (WKT) element. | public CoordinateSystemAxis | getAxis(int dimension) Returns the axis for this coordinate system at the specified dimension.
Parameters: dimension - The zero based index of axis. | public int | getDimension() Returns the dimension of the coordinate system. | final Unit | getDistanceUnit() Suggests an unit for measuring distances in this coordinate system. | public int | hashCode() Returns a hash value for this coordinate system.
The hash code value. | 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.
This method is invoked at construction time for checking units compatibility. | static Map | name(int key) Creates a name for the predefined constants in subclasses. | public static CoordinateSystem | standard(CoordinateSystem cs) Returns a coordinate system with "standard" axis order and units.
Most of the time, this method returns one of the predefined constants with axis in
(longitude,latitude) or (X,Y) order,
and units in degrees or metres. | public static Matrix | swapAndScaleAxis(CoordinateSystem sourceCS, CoordinateSystem targetCS) Returns an affine transform between two coordinate systems. |
AbstractCS | public AbstractCS(CoordinateSystem cs)(Code) | | Constructs a new coordinate system 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 |
AbstractCS | public AbstractCS(String name, CoordinateSystemAxis[] axis)(Code) | | Constructs a coordinate system from a name.
Parameters: name - The coordinate system name. Parameters: axis - The set of axis. |
AbstractCS | public AbstractCS(Map properties, CoordinateSystemAxis[] axis)(Code) | | Constructs a coordinate system from a set of properties. The properties map is given
unchanged to the
.
Parameters: properties - Set of properties. Should contains at least "name" . Parameters: axis - The set of axis. |
axisColinearWith | final boolean axisColinearWith(CoordinateSystem userCS)(Code) | | Returns
true if every axis in the specified
userCS are colinear with axis
in this coordinate system. The comparaison is insensitive to axis order and units. What
matter is axis names (because they are fixed by ISO 19111 specification) and directions.
If this method returns
true , then there is good chances that this CS can be used
together with
userCS as arguments to
AbstractCS.swapAndScaleAxis swapAndScaleAxis .
This method should not be public because current implementation is not fully consistent
for every pair of CS. It tries to check the opposite direction in addition of the usual
one, but only a few pre-defined axis declare their opposite. This method should be okay
when invoked on pre-defined CS declared in this package.
PredefinedCS uses this
method only that way.
|
directionColinearWith | final boolean directionColinearWith(CoordinateSystem userCS)(Code) | | Compares directions only, without consideration for the axis name.
|
distance | public Measure distance(double[] coord1, double[] coord2) throws UnsupportedOperationException, MismatchedDimensionException(Code) | | Computes the distance between two points. This method is not available for all coordinate
systems. For example,
doesn't have
suffisient information.
Parameters: coord1 - Coordinates of the first point. Parameters: coord2 - Coordinates of the second point. The distance between coord1 and coord2 . throws: UnsupportedOperationException - if this coordinate system can't compute distances. throws: MismatchedDimensionException - if a coordinate doesn't have the expected dimension. |
ensureDimensionMatch | final void ensureDimensionMatch(String name, double[] coordinates) throws MismatchedDimensionException(Code) | | Convenience method for checking object dimension validity.
Parameters: name - The name of the argument to check. Parameters: coordinates - The coordinate array to check. throws: MismatchedDimensionException - if the coordinate doesn't have the expected dimension. |
equals | public boolean equals(AbstractIdentifiedObject object, boolean compareMetadata)(Code) | | Compares the specified object with this coordinate system for equality.
Parameters: object - The object to compare to this . Parameters: compareMetadata - true for performing a strict comparaison, or false for comparing only properties relevant to transformations. true if both objects are equal. |
formatWKT | protected String formatWKT(Formatter formatter)(Code) | | Format the inner part of a
Well
Known Text (WKT) element. Note that WKT is not yet defined for coordinate system.
Current implementation list the axis contained in this CS.
Parameters: formatter - The formatter to use. The WKT element name. Current implementation default to the class name. |
getAxis | public CoordinateSystemAxis getAxis(int dimension) throws IndexOutOfBoundsException(Code) | | Returns the axis for this coordinate system at the specified dimension.
Parameters: dimension - The zero based index of axis. The axis at the specified dimension. throws: IndexOutOfBoundsException - if dimension is out of bounds. |
getDimension | public int getDimension()(Code) | | Returns the dimension of the coordinate system.
This is the number of axis.
|
getDistanceUnit | final Unit getDistanceUnit() throws ConversionException(Code) | | Suggests an unit for measuring distances in this coordinate system. The default
implementation scans all
,
ignoring angular ones (this also implies ignoring
ones).
If more than one non-angular unit is found, the default implementation returns the "largest"
one (e.g. kilometers instead of meters).
Suggested distance unit. throws: ConversionException - if some non-angular units are incompatibles. |
hashCode | public int hashCode()(Code) | | Returns a hash value for this coordinate system.
The hash code value. This value doesn't need to be the samein past or future versions of this class. |
isCompatibleDirection | protected boolean isCompatibleDirection(AxisDirection direction)(Code) | | Returns
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.
|
isCompatibleUnit | protected boolean isCompatibleUnit(AxisDirection direction, Unit unit)(Code) | | Returns
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
or
units.
since: 2.2 |
name | static Map name(int key)(Code) | | Creates a name for the predefined constants in subclasses. The name is an unlocalized String
object. However, since this method is used for creation of convenience objects only (not for
objects created from an "official" database), the "unlocalized" name is actually choosen
according the user's locale at class initialization time. The same name is also added in
a localizable form as an alias. Since the
AbstractCS.nameMatches convenience method checks
the alias, it still possible to consider two objects are equivalent even if their names
were formatted in different locales.
|
standard | public static CoordinateSystem standard(CoordinateSystem cs) throws IllegalArgumentException(Code) | | Returns a coordinate system with "standard" axis order and units.
Most of the time, this method returns one of the predefined constants with axis in
(longitude,latitude) or (X,Y) order,
and units in degrees or metres. In some particular cases like
, this method may
create a new instance on the fly. In every cases this method attempts to return a
right-handed coordinate
system, but this is not garanteed.
This method is typically used together with
AbstractCS.swapAndScaleAxis swapAndScaleAxis for the creation of a transformation step before some
.
Example:
Matrix step1 = swapAndScaleAxis(sourceCS, standard(sourceCS));
Matrix step2 = ... some transform operating on standard axis ...
Matrix step3 = swapAndScaleAxis(standard(targetCS), targetCS);
A rational for standard axis order and units is explained in the Axis units and
direction section in the
.
Parameters: cs - The coordinate system. A constant similar to the specified cs with "standard" axis. throws: IllegalArgumentException - if the specified coordinate system is unknow to this method. since: 2.2 |
swapAndScaleAxis | public static Matrix swapAndScaleAxis(CoordinateSystem sourceCS, CoordinateSystem targetCS) throws IllegalArgumentException, ConversionException(Code) | | Returns an affine transform between two coordinate systems. Only units and
axis order (e.g. transforming from
(
,
) to
(
,
are taken in account.
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 ]
Parameters: sourceCS - The source coordinate system. Parameters: targetCS - The target coordinate system. The conversion from sourceCS to targetCS asan affine transform. Only axis direction and units are taken in account. throws: IllegalArgumentException - if axis doesn't matches, or the CS doesn't have thesame geometry. throws: ConversionException - if the unit conversion is non-linear. |
Methods inherited from org.geotools.referencing.AbstractIdentifiedObject | protected static Set asSet(Object[] array)(Code)(Java Doc) protected static void ensureAngularUnit(Unit unit) throws IllegalArgumentException(Code)(Java Doc) protected static void ensureLinearUnit(Unit unit) throws IllegalArgumentException(Code)(Java Doc) protected static void ensureNonNull(String name, Object object) throws IllegalArgumentException(Code)(Java Doc) protected static void ensureNonNull(String name, Object[] array, int index) throws IllegalArgumentException(Code)(Java Doc) protected static void ensureTimeUnit(Unit unit) throws IllegalArgumentException(Code)(Java Doc) final public boolean equals(Object object)(Code)(Java Doc) public boolean equals(AbstractIdentifiedObject object, boolean compareMetadata)(Code)(Java Doc) protected static boolean equals(IdentifiedObject object1, IdentifiedObject object2, boolean compareMetadata)(Code)(Java Doc) protected static boolean equals(IdentifiedObject[] array1, IdentifiedObject[] array2, boolean compareMetadata)(Code)(Java Doc) protected static boolean equals(Collection collection1, Collection collection2, boolean compareMetadata)(Code)(Java Doc) public Collection getAlias()(Code)(Java Doc) public ReferenceIdentifier getIdentifier(Citation authority)(Code)(Java Doc) public static ReferenceIdentifier getIdentifier(IdentifiedObject info, Citation authority)(Code)(Java Doc) public Set getIdentifiers()(Code)(Java Doc) public ReferenceIdentifier getName()(Code)(Java Doc) public String getName(Citation authority)(Code)(Java Doc) public static String getName(IdentifiedObject info, Citation authority)(Code)(Java Doc) public static Map getProperties(IdentifiedObject info)(Code)(Java Doc) public static Map getProperties(IdentifiedObject info, Citation authority)(Code)(Java Doc) public InternationalString getRemarks()(Code)(Java Doc) public int hashCode()(Code)(Java Doc) public boolean nameMatches(String name)(Code)(Java Doc) public static boolean nameMatches(IdentifiedObject object, String name)(Code)(Java Doc) public static boolean nameMatches(IdentifiedObject o1, IdentifiedObject o2)(Code)(Java Doc)
|
|
|