|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.geotools.resources.CRSUtilities
public final class CRSUtilities
A set of static methods working on OpenGIS® coordinate reference system objects. Some of those methods are useful, but not really rigorous. This is why they do not appear in the "official" package, but instead in this private one. Do not rely on this API! It may change in incompatible way in any future release.
Method Summary | |
---|---|
static java.util.Map<java.lang.String,?> |
changeDimensionInName(org.opengis.referencing.IdentifiedObject object,
java.lang.String search,
java.lang.String replace)
Changes the dimension declared in the name. |
static java.awt.geom.Point2D |
deltaTransform(org.opengis.referencing.operation.MathTransform2D transform,
java.awt.geom.Point2D origin,
java.awt.geom.Point2D source,
java.awt.geom.Point2D dest)
Transforms the relative distance vector specified by source and stores
the result in dest . |
static org.opengis.geometry.DirectPosition |
deltaTransform(org.opengis.referencing.operation.MathTransform transform,
org.opengis.geometry.DirectPosition origin,
org.opengis.geometry.DirectPosition source)
Transforms the relative distance vector specified by source and stores
the result in dest . |
static int |
dimensionColinearWith(org.opengis.referencing.cs.CoordinateSystem cs,
org.opengis.referencing.cs.CoordinateSystemAxis axis)
Returns the dimension within the coordinate system of the first occurrence of an axis colinear with the specified axis. |
static org.opengis.referencing.crs.CoordinateReferenceSystem |
getCRS2D(org.opengis.referencing.crs.CoordinateReferenceSystem crs)
Returns a two-dimensional coordinate reference system representing the two first dimensions of the specified coordinate reference system. |
static org.opengis.referencing.datum.Datum |
getDatum(org.opengis.referencing.crs.CoordinateReferenceSystem crs)
Returns the datum of the specified CRS, or null if none. |
static int |
getDimensionOf(org.opengis.referencing.crs.CoordinateReferenceSystem crs,
java.lang.Class<? extends org.opengis.referencing.crs.CoordinateReferenceSystem> type)
Returns the dimension of the first coordinate reference system of the given type. |
static org.opengis.referencing.datum.Ellipsoid |
getHeadGeoEllipsoid(org.opengis.referencing.crs.CoordinateReferenceSystem crs)
Returns the ellipsoid used by the specified coordinate reference system, providing that the two first dimensions use an instance of GeographicCRS . |
static org.opengis.referencing.crs.GeographicCRS |
getStandardGeographicCRS2D(org.opengis.referencing.crs.CoordinateReferenceSystem crs)
Derives a geographic CRS with (longitude, latitude) axis order in decimal degrees, relative to Greenwich. |
static org.opengis.referencing.crs.CoordinateReferenceSystem |
getSubCRS(org.opengis.referencing.crs.CoordinateReferenceSystem crs,
int lower,
int upper)
Returns a sub-coordinate reference system for the specified dimension range. |
static javax.measure.unit.Unit<?> |
getUnit(org.opengis.referencing.cs.CoordinateSystem cs)
Returns the unit used for all axis in the specified coordinate system. |
static java.lang.String |
toWGS84String(org.opengis.referencing.crs.CoordinateReferenceSystem crs,
java.awt.geom.Rectangle2D bounds)
Returns a character string for the specified geographic area. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static int dimensionColinearWith(org.opengis.referencing.cs.CoordinateSystem cs, org.opengis.referencing.cs.CoordinateSystemAxis axis)
axis
ocurs in the coordinate system, then the dimension of the first such occurrence
is returned. That is, the a value k such that:
iscs.getAxis(k).getDirection().absolute() == axis.getDirection().absolute()
true
. If no such axis occurs in this coordinate system,
then -1
is returned.
For example, dimensionColinearWith(CoordinateSystemAxis.TIME)
returns the dimension number of time axis.
cs
- The coordinate system to examine.axis
- The axis to look for.
-1
if none.public static javax.measure.unit.Unit<?> getUnit(org.opengis.referencing.cs.CoordinateSystem cs)
null
.
This convenience method is often used for Well Know Text (WKT) formatting.
cs
- The coordinate system for which to get the unit.
null
.public static int getDimensionOf(org.opengis.referencing.crs.CoordinateReferenceSystem crs, java.lang.Class<? extends org.opengis.referencing.crs.CoordinateReferenceSystem> type) throws java.lang.IllegalArgumentException
type
argument must be a subinterface of CoordinateReferenceSystem
.
If no such dimension is found, then this method returns -1
.
crs
- The coordinate reference system (CRS) to examine.type
- The CRS type to look for.
Must be a subclass of CoordinateReferenceSystem
.
-1
if none.
java.lang.IllegalArgumentException
- if the type
is not legal.public static org.opengis.referencing.crs.CoordinateReferenceSystem getSubCRS(org.opengis.referencing.crs.CoordinateReferenceSystem crs, int lower, int upper)
crs
- The coordinate reference system to decompose.lower
- The first dimension to keep, inclusive.upper
- The last dimension to keep, exclusive.
null
if crs
can't
be decomposed for dimensions in the range [lower..upper]
.public static org.opengis.referencing.crs.CoordinateReferenceSystem getCRS2D(org.opengis.referencing.crs.CoordinateReferenceSystem crs) throws org.opengis.referencing.operation.TransformException
crs
is already a two-dimensional
CRS, then it is returned unchanged. Otherwise, if it is a CompoundCRS
, then the
head coordinate reference system is examined.
crs
- The coordinate system, or null
.
crs
, or null
if crs
was null
.
org.opengis.referencing.operation.TransformException
- if crs
can't be reduced to a two-coordinate system.
We use this exception class since this method is usually invoked in the context
of a transformation process.public static java.util.Map<java.lang.String,?> changeDimensionInName(org.opengis.referencing.IdentifiedObject object, java.lang.String search, java.lang.String replace)
name
is
"WGS 84 (geographic 3D)", search
is "3D" and replace
is "2D",
then this method returns "WGS 84 (geographic 2D)". If the string to search is
not found, then it is concatenated to the name.
object
- The identified object having the original name.search
- The dimension token to search in the object
name.replace
- The new token to substitute to the one we were looking for.
public static org.opengis.referencing.datum.Datum getDatum(org.opengis.referencing.crs.CoordinateReferenceSystem crs)
null
if none.
crs
- The coordinate reference system for which to get the datum. May be null
.
null
if none.public static org.opengis.referencing.datum.Ellipsoid getHeadGeoEllipsoid(org.opengis.referencing.crs.CoordinateReferenceSystem crs)
GeographicCRS
. Otherwise (i.e. if the
two first dimensions are not geographic), returns null
.
crs
- The coordinate reference system for which to get the ellipsoid.
null
if none.public static org.opengis.referencing.crs.GeographicCRS getStandardGeographicCRS2D(org.opengis.referencing.crs.CoordinateReferenceSystem crs)
DefaultGeographicCRS.WGS84
.
crs
- A source CRS.
null
.public static org.opengis.geometry.DirectPosition deltaTransform(org.opengis.referencing.operation.MathTransform transform, org.opengis.geometry.DirectPosition origin, org.opengis.geometry.DirectPosition source) throws org.opengis.referencing.operation.TransformException
source
and stores
the result in dest
. A relative distance vector is transformed without
applying the translation components.
transform
- The transform to apply.origin
- The position where to compute the delta transform in the source CS.source
- The distance vector to be delta transformed
org.opengis.referencing.operation.TransformException
- if the transformation failed.public static java.awt.geom.Point2D deltaTransform(org.opengis.referencing.operation.MathTransform2D transform, java.awt.geom.Point2D origin, java.awt.geom.Point2D source, java.awt.geom.Point2D dest) throws org.opengis.referencing.operation.TransformException
source
and stores
the result in dest
. A relative distance vector is transformed without
applying the translation components.
transform
- The transform to apply.origin
- The position where to compute the delta transform in the source CS.source
- The distance vector to be delta transformeddest
- The resulting transformed distance vector, or null
org.opengis.referencing.operation.TransformException
- if the transformation failed.AffineTransform.deltaTransform(Point2D,Point2D)
public static java.lang.String toWGS84String(org.opengis.referencing.crs.CoordinateReferenceSystem crs, java.awt.geom.Rectangle2D bounds)
crs
- The coordinate reference system of the bounding box.bounds
- The bounding box to format.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |