|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectFormattable
AbstractMathTransform
MapProjection
public abstract class MapProjection
Base class for transformation services between ellipsoidal and cartographic projections. This base class provides the basic feature needed for all methods (no need to overrides methods). Subclasses must "only" implements the following methods:
getParameterValues()
transformNormalized(double, double, java.awt.geom.Point2D)
inverseTransformNormalized(double, double, java.awt.geom.Point2D)
NOTE:Serialization of this class is appropriate for short-term storage or RMI use, but will probably not be compatible with future version. For long term storage, WKT (Well Know Text) or XML (not yet implemented) are more appropriate.
Nested Class Summary | |
---|---|
static class |
MapProjection.AbstractProvider
The base provider for MapProjection s. |
Field Summary | |
---|---|
protected double |
centralMeridian
Central longitude in radians. |
protected double |
excentricity
Ellipsoid excentricity, equals to sqrt( . |
protected double |
excentricitySquared
The square of excentricity: e² = (a²-b²)/a² where e is the excentricity, a is the semi major axis length and b is the semi minor axis length. |
protected double |
falseEasting
False easting, in metres. |
protected double |
falseNorthing
False northing, in metres. |
protected double |
globalScale
Global scale factor. |
protected boolean |
isSpherical
true if this projection is spherical. |
protected double |
latitudeOfOrigin
Latitude of origin in radians. |
protected static Logger |
LOGGER
The projection package logger |
protected double |
scaleFactor
The scale factor. |
protected double |
semiMajor
Length of semi-major axis, in metres. |
protected double |
semiMinor
Length of semi-minor axis, in metres. |
Fields inherited from class Formattable |
---|
SINGLE_LINE |
Constructor Summary | |
---|---|
protected |
MapProjection(ParameterValueGroup values)
Constructs a new map projection from the suplied parameters. |
Method Summary | |
---|---|
boolean |
equals(Object object)
Compares the specified object with this map projection for equality. |
abstract ParameterDescriptorGroup |
getParameterDescriptors()
Returns the parameter descriptors for this map projection. |
ParameterValueGroup |
getParameterValues()
Returns the parameter values for this map projection. |
int |
getSourceDimensions()
Returns the dimension of input points. |
int |
getTargetDimensions()
Returns the dimension of output points. |
protected double |
getToleranceForAssertions(double longitude,
double latitude)
Maximal error (in metres) tolerated for assertions, if enabled. |
int |
hashCode()
Returns a hash value for this map projection. |
MathTransform2D |
inverse()
Returns the inverse of this map projection. |
protected abstract Point2D |
inverseTransformNormalized(double x,
double y,
Point2D ptDst)
Transforms the specified coordinate and stores the result in ptDst . |
static void |
resetWarnings()
Resets the warning status of all projections in the current JVM. |
void |
transform(double[] srcPts,
int srcOff,
double[] dstPts,
int dstOff,
int numPts)
Transforms a list of coordinate point ordinal values. |
void |
transform(float[] srcPts,
int srcOff,
float[] dstPts,
int dstOff,
int numPts)
Transforms a list of coordinate point ordinal values. |
Point2D |
transform(Point2D ptSrc,
Point2D ptDst)
Transforms the specified ptSrc and stores the result in ptDst . |
protected abstract Point2D |
transformNormalized(double lambda,
double phi,
Point2D ptDst)
Transforms the specified coordinate and stores the result in ptDst . |
Methods inherited from class AbstractMathTransform |
---|
createTransformedShape, derivative, derivative, ensureNonNull, formatWKT, getName, isIdentity, needCopy, rollLongitude, transform, transform, transform |
Methods inherited from class Formattable |
---|
toString, toWKT, toWKT, toWKT |
Methods inherited from class Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface MathTransform2D |
---|
createTransformedShape, derivative |
Methods inherited from interface MathTransform |
---|
derivative, isIdentity, toWKT, transform |
Field Detail |
---|
protected static final Logger LOGGER
protected final double excentricity
sqrt(excentricitySquared
)
.
Value 0 means that the ellipsoid is spherical.
excentricitySquared
,
isSpherical
protected final double excentricitySquared
excentricity
,
semiMajor
,
semiMinor
,
isSpherical
protected final boolean isSpherical
true
if this projection is spherical. Spherical model has identical
semi major and semi minor axis
length, and an excentricity zero.
excentricity
,
semiMajor
,
semiMinor
protected final double semiMajor
excentricity
,
semiMinor
protected final double semiMinor
excentricity
,
semiMajor
protected double centralMeridian
Consider this field as final. It is not final only because some classes need to modify it at construction time.
protected double latitudeOfOrigin
Consider this field as final. It is not final only because some classes need to modify it at construction time.
protected double scaleFactor
Consider this field as final. It is not final only because some classes need to modify it at construction time.
protected final double falseEasting
protected final double falseNorthing
protected double globalScale
globalScale
is equal
to semiMajor
×scaleFactor
.
Consider this field as final. It is not final only because some classes need to modify it at construction time.
Constructor Detail |
---|
protected MapProjection(ParameterValueGroup values) throws ParameterNotFoundException
values
- The parameter values in standard units.
The following parameter are recognized:
ParameterNotFoundException
- if a mandatory parameter is missing.Method Detail |
---|
public abstract ParameterDescriptorGroup getParameterDescriptors()
getParameterValues()
, as well as arguments checking.
getParameterDescriptors
in class AbstractMathTransform
null
.OperationMethod.getParameters()
public ParameterValueGroup getParameterValues()
getParameterValues
in class AbstractMathTransform
Operation.getParameterValues()
public final int getSourceDimensions()
getSourceDimensions
in interface MathTransform
getSourceDimensions
in class AbstractMathTransform
public final int getTargetDimensions()
getTargetDimensions
in interface MathTransform
getTargetDimensions
in class AbstractMathTransform
protected abstract Point2D inverseTransformNormalized(double x, double y, Point2D ptDst) throws ProjectionException
ptDst
. This method
returns longitude as x values in the range [-PI..PI]
and latitude as
y values in the range [-PI/2..PI/2]
. It will be checked by the caller,
so this method doesn't need to performs this check.
Input coordinates have the falseEasting
and falseNorthing
removed and are
divided by globalScale
before this method is invoked. After this method is invoked,
the centralMeridian
is added to the x
results in ptDst
. This means
that projections that implement this method are performed on an ellipse (or sphere) with a
semi-major axis of 1.
In PROJ.4, the same standardization,
described above, is handled by pj_inv.c
. Therefore when porting projections
from PROJ.4, the inverse transform equations can be used directly here with minimal
change. In the equations of Snyder, falseEasting
, falseNorthing
and
scaleFactor
are usually not given. When implementing these equations here, you
will not need to add the centralMeridian
to the output longitude or remove the
semiMajor
(a or R).
x
- The easting of the coordinate, linear distance on a unit sphere or ellipse.y
- The northing of the coordinate, linear distance on a unit sphere or ellipse.ptDst
- the specified coordinate point that stores the result of transforming
ptSrc
, or null
. Ordinates will be in radians.
x
, y
and storing the result in ptDst
.
ProjectionException
- if the point can't be transformed.protected abstract Point2D transformNormalized(double lambda, double phi, Point2D ptDst) throws ProjectionException
ptDst
. This method is
usually (but not guaranteed) to be invoked with values of x in
the range [-PI..PI]
and values of y in the range [-PI/2..PI/2]
.
Values outside those ranges are accepted (sometime with a warning logged) on the assumption
that most implementations use those values only in trigonometric functions like
sin and cos.
Coordinates have the centralMeridian
removed from lambda before this
method is invoked. After this method is invoked, the results in ptDst
are multiplied
by globalScale
, and the falseEasting
and falseNorthing
are added.
This means that projections that implement this method are performed on an ellipse (or sphere)
with a semi-major axis of 1.
In PROJ.4, the same standardization,
described above, is handled by pj_fwd.c
. Therefore when porting projections
from PROJ.4, the forward transform equations can be used directly here with minimal
change. In the equations of Snyder, falseEasting
, falseNorthing
and
scaleFactor
are usually not given. When implementing these equations here,
you will not need to remove the centralMeridian
from lambda or apply
the semiMajor
(a or R).
lambda
- The longitude of the coordinate, in radians.phi
- The latitude of the coordinate, in radians.ptDst
- the specified coordinate point that stores the result of transforming
ptSrc
, or null
. Ordinates will be in a
dimensionless unit, as a linear distance on a unit sphere or ellipse.
lambda
, phi
)
and storing the result in ptDst
.
ProjectionException
- if the point can't be transformed.public final Point2D transform(Point2D ptSrc, Point2D ptDst) throws ProjectionException
ptSrc
and stores the result in ptDst
.
This method standardizes the source x
coordinate
by removing the centralMeridian
, before invoking
.
It also multiplies by transformNormalized
(x, y, ptDst)globalScale
and adds the falseEasting
and
falseNorthing
to the point returned by the transformNormalized(...)
call.
transform
in interface MathTransform2D
transform
in class AbstractMathTransform
ptSrc
- the specified coordinate point to be transformed.
Ordinates must be in decimal degrees.ptDst
- the specified coordinate point that stores the result of transforming
ptSrc
, or null
. Ordinates will be in metres.
ptSrc
and storing
the result in ptDst
.
ProjectionException
- if the point can't be transformed.MathTransform2D.transform(Point2D,Point2D)
public final void transform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts) throws ProjectionException
transform
in interface MathTransform
ProjectionException
- if a point can't be transformed. This method tries to transform
every points even if some of them can't be transformed. Non-transformable points will
have value Double.NaN
. If more than one point can't be transformed, then this
exception may be about an arbitrary point.public final void transform(float[] srcPts, int srcOff, float[] dstPts, int dstOff, int numPts) throws ProjectionException
transform
in interface MathTransform
transform
in class AbstractMathTransform
ProjectionException
- if a point can't be transformed. This method tries to transform
every points even if some of them can't be transformed. Non-transformable points will
have value Float.NaN
. If more than one point can't be transformed, then this
exception may be about an arbitrary point.public final MathTransform2D inverse()
inverse
in interface MathTransform
inverse
in interface MathTransform2D
inverse
in class AbstractMathTransform
protected double getToleranceForAssertions(double longitude, double latitude)
ProjectionException
will be thrown. Subclasses should override this method if they
need to relax the tolerance level.
longitude
- The longitude in decimal degrees.latitude
- The latitude in decimal degrees.
public static void resetWarnings()
MapProjection
instance may log a warning the first time they are given coordinates outside their area of
validity. Subsequent coordinates outside the area of validity are silently projected in order
to avoid flowing the log with warnings. In case of suspicion, this method may be invoked in
order to force all projections to log again their first out-of-bounds coordinates.
Multi-threading
Calls to this method have immediate effect in the invoker's thread. The effect in other
threads may be delayed by some arbitrary amount of time. This method works only on a
"best effort" basis.
CRS.reset(java.lang.String)
public int hashCode()
hashCode
in class AbstractMathTransform
public boolean equals(Object object)
equals
in class AbstractMathTransform
object
- The object to compare with this transform.
true
if the given object is a transform of the same class
and if, given identical source position, the
transformed
position would be the equals.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |