public class TLcdGeodetic extends ALcdProjection implements Cloneable
The geodetic projection is basically a linear transformation from lat-lon coordinates to XY world coordinates. The (lon,lat) are transformed to (x,y) coordinates with x=scaleX*lon and y=scaleY*lat.
ILcdProjection projection =
new TLcdGeodetic(10000.0, 10000.0);
Creating a grid reference that can be used as a world reference using a TLcdGeodetic
projection
is not straightforward. One must make sure that the unit of measure and scale values are correctly set.
By doing this, we make sure that values are transformed correctly to degrees, and that scale ranges are
interpreted correctly. Not doing this correctly may cause several scale related problems. For example using a scale
and unit-of-measure of 1 will make lon lat grids way to dense (making the application go out-of-memory) when
using this projection in the world reference of the view.
The following code shows how to correctly set up a grid reference with a geodetic projection:
public static TLcdGridReference createGeodeticGridReference(ILcdGeodeticDatum aDatum) {
ILcdEllipsoid ellipsoid = aDatum.getEllipsoid();
// Factor to convert a degree (along the equator) to meters
double uom = ellipsoid.getA() * Math.toRadians(1.0);
TLcdGeodetic projection = new TLcdGeodetic(uom, uom);
return new TLcdGridReference(aDatum,
projection,
0.0, 0.0, 1.0,
uom,
0.0);
}
fPropertyChangeDispatcher
EPSILON
Constructor and Description |
---|
TLcdGeodetic()
Default constructor with scale factors 1.0 for both x
and y directions.
|
TLcdGeodetic(double aXFactor,
double aYFactor)
Constructor with given scale factors for x and y axes.
|
Modifier and Type | Method and Description |
---|---|
double[][] |
boundaryLats(double aLongitude)
Calculates the two latitude values that for a given longitude
are at the boundary of the valid area of
the transformation of the projection.
|
double[][] |
boundaryLons(double aLatitude)
Calculates the two longitude values for a given latitude
that are at the boundary of the valid area of
the transformation of the projection.
|
Object |
clone()
Makes a deep clone of this
ILcdProjection . |
boolean |
equals(Object aProjection)
Checks if this
ILcdProjection equals some other Object. |
ILcdPoint |
getOrigin()
Origin of the projection is the
ILcd2DEditablePoint that
corresponds with origin (0, 0) of the cartesian coordinate system of the
projection. |
double |
getScaleFactorX()
Returns the scale factor along the X-axis.
|
double |
getScaleFactorY()
Returns the scale factor along the Y-axis.
|
int |
hashCode() |
boolean |
inLonLatBounds(ILcdPoint aLLP)
Checks if an
ILcd2DEditablePoint is inside the valid area of
the transformation of the projection. |
boolean |
inWorldBoundsOnSphere(ILcdPoint aXYPoint,
double aRadius)
Checks if a
ILcdPoint is inside the valid cartesian area of
the projection. |
boolean |
isAllInBounds()
If all geodetic coordinates (l ,j ) are projected (visible) by an
ILcdProjection
and all (x,y ) coordinates are bounded this is true . |
boolean |
isContinuous()
An
ILcdProjection is continuous if there are no interruptions
in the world coordinates. |
void |
loadProperties(String aPrefix,
Properties aProperty)
Loads the two properties of this geodetic projection, i.e., the scale
factors along the two axes.
|
void |
lonlatheight2worldOnSphereSFCT(ILcdPoint aLLP,
double aRadius,
ILcd2DEditablePoint aXYPointSFCT)
Transforms an
ILcd2DEditablePoint on a sphere into the
cartesian coordinate system of the projection. |
void |
setScaleFactorX(double aXFactor)
Sets the scale factor along the X-axis.
|
void |
setScaleFactorY(double aYFactor)
Sets the scale factor along the Y-axis.
|
String |
toString()
Returns the
String representation of the TLcdGeodetic projection. |
void |
world2DEditableBoundsOnSphereSFCT(double aRadius,
ILcd2DEditableBounds aWorldBound)
Sets the
ILcd2DEditableBounds object to the bounds of the projection
in world coordinates. |
void |
world2lonlatOnSphereSFCT(ILcdPoint aXYPoint,
double aRadius,
ILcd2DEditablePoint aLLPSFCT)
Transforms an
ILcdPoint from the cartesian coordinate system
of the projection into an ILcd2DEditablePoint onto a sphere. |
void |
writePropertiesSFCT(String aPrefix,
Properties aPropertySFCT)
Writes the two properties of this geodetic projection, i.e., the scale
factors along the two axes.
|
addPropertyChangeListener, firePropertyChangeEvent, inWorldBoundsOnEllipsoid, lonlatheight2worldOnEllipsoidSFCT, removePropertyChangeListener, world2DEditableBoundsOnEllipsoidSFCT, world2lonlatOnEllipsoidSFCT
public TLcdGeodetic()
public TLcdGeodetic(double aXFactor, double aYFactor)
aXFactor
- scale factor along X-axis.aYFactor
- scale factor along Y-axis.public void setScaleFactorX(double aXFactor)
aXFactor
- the new scaleFactorX value.getScaleFactorX()
public double getScaleFactorX()
setScaleFactorX(double)
public void setScaleFactorY(double aYFactor)
aYFactor
- the new scaleFactorY value.getScaleFactorY()
public double getScaleFactorY()
setScaleFactorY(double)
public ILcdPoint getOrigin()
ILcdProjection
ILcd2DEditablePoint
that
corresponds with origin (0, 0) of the cartesian coordinate system of the
projection.getOrigin
in interface ILcdProjection
public void loadProperties(String aPrefix, Properties aProperty) throws IllegalArgumentException
loadProperties
in interface ILcdProjection
aPrefix
- prefix for property names.aProperty
- Properties object containing the serialized projection.IllegalArgumentException
public void writePropertiesSFCT(String aPrefix, Properties aPropertySFCT)
writePropertiesSFCT
in interface ILcdProjection
aPrefix
- prefix for property names.aPropertySFCT
- Properties object in which to store the serialized
projection properties as side effect.public void lonlatheight2worldOnSphereSFCT(ILcdPoint aLLP, double aRadius, ILcd2DEditablePoint aXYPointSFCT) throws TLcdOutOfBoundsException
ILcdProjection
ILcd2DEditablePoint
on a sphere into the
cartesian coordinate system of the projection.lonlatheight2worldOnSphereSFCT
in interface ILcdProjection
aLLP
- point to be projected.aRadius
- radius of the sphere (meters).aXYPointSFCT
- projected point as side effect.TLcdOutOfBoundsException
- If the
ILcdPoint
aLLHP
is not within the valid area
of the projection (visible area), then this exception is thrown.public void world2lonlatOnSphereSFCT(ILcdPoint aXYPoint, double aRadius, ILcd2DEditablePoint aLLPSFCT) throws TLcdOutOfBoundsException
ILcdProjection
ILcdPoint
from the cartesian coordinate system
of the projection into an ILcd2DEditablePoint
onto a sphere.world2lonlatOnSphereSFCT
in interface ILcdProjection
aXYPoint
- projected point for which the corresponding geodetic point is sought.aRadius
- radius of the sphere (meters).aLLPSFCT
- resulting geodetic coordinate as side effect.TLcdOutOfBoundsException
- If the
ILcdPoint
aXYPoint
is not within the valid
area of the projection (visible area), then this exception is thrown.public boolean isAllInBounds()
ILcdProjection
ILcdProjection
and all (x,y ) coordinates are bounded this is true
.
All ILcdProjection
objects have bounded (x,y )
coordinates because the projection is cut off if necessary.isAllInBounds
in interface ILcdProjection
true
if all LonLatPoints are within the bounds of
the projection, false
otherwise.public boolean isContinuous()
ILcdProjection
ILcdProjection
is continuous if there are no interruptions
in the world coordinates. Most projections are continuous.isContinuous
in interface ILcdProjection
true
if the projection is continuous,
false
otherwise.public boolean inLonLatBounds(ILcdPoint aLLP)
ILcd2DEditablePoint
is inside the valid area of
the transformation of the projection.inLonLatBounds
in interface ILcdProjection
aLLP
- ILcd2DEditablePoint
to be checked upon.true
if valid, false
if invalid.public double[][] boundaryLons(double aLatitude)
boundaryLons
in interface ILcdProjection
boundaryLons
in class ALcdProjection
aLatitude
- latitude in decimal degrees
-90.0 <= lat <= 90.0
.-180.0 <= lon[i] <= 180.0
.public double[][] boundaryLats(double aLongitude)
boundaryLats
in interface ILcdProjection
boundaryLats
in class ALcdProjection
aLongitude
- longitude in decimal degrees
-180.0 <= lon <= 180.0
.-90.0 <= lats[i] <= 90.0
.public void world2DEditableBoundsOnSphereSFCT(double aRadius, ILcd2DEditableBounds aWorldBound)
ILcdProjection
ILcd2DEditableBounds
object to the bounds of the projection
in world coordinates.world2DEditableBoundsOnSphereSFCT
in interface ILcdProjection
aRadius
- radius of the sphere.aWorldBound
- the bounds of the projection in world coordinates as side effect.public boolean inWorldBoundsOnSphere(ILcdPoint aXYPoint, double aRadius)
ILcdProjection
ILcdPoint
is inside the valid cartesian area of
the projection. The valid cartesian area is determined naturally by the
projection bounds or by an artificial introduced boundary limit because
some cartesian points are at infinity. The shape of the valid cartesian
area is in many cases rectangular or circular although it might be more
complex.inWorldBoundsOnSphere
in interface ILcdProjection
aXYPoint
- point to be checked upon.aRadius
- radius of the sphere.true
if valid, false
if invalid.public Object clone()
ILcdProjection
ILcdProjection
.clone
in interface ILcdProjection
clone
in class ALcdProjection
ILcdProjection
.public String toString()
String
representation of the TLcdGeodetic
projection.toString
in interface ILcdProjection
toString
in class Object
ILcdProjection
.public boolean equals(Object aProjection)
ILcdProjection
ILcdProjection
equals some other Object.equals
in interface ILcdProjection
equals
in class Object
aProjection
- Object to compare with.ILcdProjection
class and having the same
projection properties, false otherwise.