public final class CoordinateSystems extends Static
CoordinateSystem
objects and their axes.Defined in the sis-referencing
module
Modifier and Type | Method and Description |
---|---|
static Angle |
angle(AxisDirection source,
AxisDirection target)
Returns the arithmetic (counterclockwise) angle from the first axis direction to the second direction.
|
static AxisDirection |
parseAxisDirection(String name)
Returns an axis direction code from the given direction name.
|
static Matrix |
swapAndScaleAxes(CoordinateSystem sourceCS,
CoordinateSystem targetCS)
Returns an affine transform between two coordinate systems.
|
public static AxisDirection parseAxisDirection(String name) throws IllegalArgumentException
'-'
, '_'
or spaces as separator between the cardinal points."deg"
or "°"
symbol.name
- The direction name (e.g. "north", "north-east", etc.).IllegalArgumentException
- if the given name is not a known axis direction.public static Angle angle(AxisDirection source, AxisDirection target)
null
if no angle can be computed.
EAST
to NORTH
is 90°SOUTH
to WEST
is -90°UP
vertical direction as 90°, and the angle of any compass direction to the DOWN
vertical direction as -90°. The sign of those angles gives no indication about whether the coordinate system
is right-handed or left-handed. Those angles are returned as instances of ElevationAngle
.
All angles are approximative since this method does not take the Earth ellipsoidal or geoidal shape in account.
angle(A, A) = 0°
angle(A, opposite(A)) = ±180°
angle(A, B) = -angle(B, A)
source
- The source axis direction.target
- The target axis direction.null
if this value can not be computed.public static Matrix swapAndScaleAxes(CoordinateSystem sourceCS, CoordinateSystem targetCS) throws IllegalArgumentException, ConversionException
sourceCRS
is a CartesianCS
,
then targetCRS
must be a CartesianCS
too.
Only units and axes order (e.g. transforming from
(North, West) to
(East, North)
are taken in account by this method.
sourceCS
are (x,y) tuples in metres
and coordinates in targetCS
are (-y,x) tuples 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 the CS are not of the same type, or axes do not match.ConversionException
- if the units are not compatible, or the conversion is non-linear.Matrices.createTransform(AxisDirection[], AxisDirection[])
Copyright © 2010–2015 The Apache Software Foundation. All rights reserved.