Class TLcdGeodetic

java.lang.Object
com.luciad.projection.ALcdProjection
com.luciad.projection.TLcdGeodetic
All Implemented Interfaces:
ILcdProjection, ILcdPropertyChangeSource, Serializable, Cloneable

public class TLcdGeodetic extends ALcdProjection implements Cloneable
Geodetic projection.

Introduction

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.

Properties

  • Neither equal-area nor conformal.
  • Meridians and parallels are straight lines, equally spaced and intersecting each other at right angles.
  • Poles are projected as straight lines.

Example

Sample code


 ILcdProjection projection =
     new TLcdGeodetic(10000.0, 10000.0);
 

Creating a grid reference using TLcdGeodetic.

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);
 }
 
See Also:
  • Constructor Details

    • TLcdGeodetic

      public TLcdGeodetic()
      Default constructor with scale factors 1.0 for both x and y directions.
    • TLcdGeodetic

      public TLcdGeodetic(double aXFactor, double aYFactor)
      Constructor with given scale factors for x and y axes.
      Parameters:
      aXFactor - scale factor along X-axis.
      aYFactor - scale factor along Y-axis.
  • Method Details

    • setScaleFactorX

      public void setScaleFactorX(double aXFactor)
      Sets the scale factor along the X-axis.
      Parameters:
      aXFactor - the new scaleFactorX value.
      See Also:
    • getScaleFactorX

      public double getScaleFactorX()
      Returns the scale factor along the X-axis.
      Returns:
      the scale factor along the X-axis.
      See Also:
    • setScaleFactorY

      public void setScaleFactorY(double aYFactor)
      Sets the scale factor along the Y-axis.
      Parameters:
      aYFactor - the new scaleFactorY value.
      See Also:
    • getScaleFactorY

      public double getScaleFactorY()
      Returns the scale factor along the Y-axis.
      Returns:
      the scale factor along the Y-axis.
      See Also:
    • getOrigin

      public ILcdPoint getOrigin()
      Description copied from interface: ILcdProjection
      Origin of the projection is the ILcd2DEditablePoint that corresponds with origin (0, 0) of the cartesian coordinate system of the projection.
      Specified by:
      getOrigin in interface ILcdProjection
      Returns:
      the origin of the projection.
    • loadProperties

      public void loadProperties(String aPrefix, Properties aProperty) throws IllegalArgumentException
      Loads the two properties of this geodetic projection, i.e., the scale factors along the two axes. This method will, given aPrefix, analyze the aProperties object to set the properties of this projection. The values of following keys are retrieved:
      • <aPrefix>.scaleFactorX
      • <aPrefix>.scaleFactorY
      If these factors are not available they are set to the default value 1.0.
      Specified by:
      loadProperties in interface ILcdProjection
      Parameters:
      aPrefix - prefix for property names.
      aProperty - Properties object containing the serialized projection.
      Throws:
      IllegalArgumentException
    • writePropertiesSFCT

      public void writePropertiesSFCT(String aPrefix, Properties aPropertySFCT)
      Writes the two properties of this geodetic projection, i.e., the scale factors along the two axes. This method will, given aPrefix, store the properties of this projection into the aPropertiesSFCT object. The values of following keys are stored:
      • <aPrefix>.scaleFactorX
      • <aPrefix>.scaleFactorY
      Specified by:
      writePropertiesSFCT in interface ILcdProjection
      Parameters:
      aPrefix - prefix for property names.
      aPropertySFCT - Properties object in which to store the serialized projection properties as side effect.
    • lonlatheight2worldOnSphereSFCT

      public void lonlatheight2worldOnSphereSFCT(ILcdPoint aLLP, double aRadius, ILcd2DEditablePoint aXYPointSFCT) throws TLcdOutOfBoundsException
      Description copied from interface: ILcdProjection
      Transforms an ILcd2DEditablePoint on a sphere into the cartesian coordinate system of the projection.
      Specified by:
      lonlatheight2worldOnSphereSFCT in interface ILcdProjection
      Parameters:
      aLLP - point to be projected.
      aRadius - radius of the sphere (meters).
      aXYPointSFCT - projected point as side effect.
      Throws:
      TLcdOutOfBoundsException - If the ILcdPoint aLLHP is not within the valid area of the projection (visible area), then this exception is thrown.
    • world2lonlatOnSphereSFCT

      public void world2lonlatOnSphereSFCT(ILcdPoint aXYPoint, double aRadius, ILcd2DEditablePoint aLLPSFCT) throws TLcdOutOfBoundsException
      Description copied from interface: ILcdProjection
      Transforms an ILcdPoint from the cartesian coordinate system of the projection into an ILcd2DEditablePoint onto a sphere.
      Specified by:
      world2lonlatOnSphereSFCT in interface ILcdProjection
      Parameters:
      aXYPoint - projected point for which the corresponding geodetic point is sought.
      aRadius - radius of the sphere (meters).
      aLLPSFCT - resulting geodetic coordinate as side effect.
      Throws:
      TLcdOutOfBoundsException - If the ILcdPoint aXYPoint is not within the valid area of the projection (visible area), then this exception is thrown.
    • isAllInBounds

      public boolean isAllInBounds()
      Description copied from interface: ILcdProjection
      If all geodetic coordinates (l ,j ) are projected (visible) by an 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.
      Specified by:
      isAllInBounds in interface ILcdProjection
      Returns:
      true if all LonLatPoints are within the bounds of the projection, false otherwise.
    • isContinuous

      public boolean isContinuous()
      Description copied from interface: ILcdProjection
      An ILcdProjection is continuous if there are no interruptions in the world coordinates. Most projections are continuous.
      Specified by:
      isContinuous in interface ILcdProjection
      Returns:
      true if the projection is continuous, false otherwise.
    • inLonLatBounds

      public boolean inLonLatBounds(ILcdPoint aLLP)
      Checks if an ILcd2DEditablePoint is inside the valid area of the transformation of the projection.
      Specified by:
      inLonLatBounds in interface ILcdProjection
      Parameters:
      aLLP - ILcd2DEditablePoint to be checked upon.
      Returns:
      true if valid, false if invalid.
    • boundaryLons

      public 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.
      Specified by:
      boundaryLons in interface ILcdProjection
      Overrides:
      boundaryLons in class ALcdProjection
      Parameters:
      aLatitude - latitude in decimal degrees -90.0 <= lat <= 90.0.
      Returns:
      the array of longitudes[0] and longitudes[1], with longitudes[0] -> longitudes[1] is in visible area and -180.0 <= lon[i] <= 180.0.
    • boundaryLats

      public 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.
      Specified by:
      boundaryLats in interface ILcdProjection
      Overrides:
      boundaryLats in class ALcdProjection
      Parameters:
      aLongitude - longitude in decimal degrees -180.0 <= lon <= 180.0.
      Returns:
      the array of latitudes lats[0] and lats[1], with lats[0] -> lats[1] is in visible area and -90.0 <= lats[i] <= 90.0.
    • world2DEditableBoundsOnSphereSFCT

      public void world2DEditableBoundsOnSphereSFCT(double aRadius, ILcd2DEditableBounds aWorldBound)
      Description copied from interface: ILcdProjection
      Sets the ILcd2DEditableBounds object to the bounds of the projection in world coordinates.
      Specified by:
      world2DEditableBoundsOnSphereSFCT in interface ILcdProjection
      Parameters:
      aRadius - radius of the sphere.
      aWorldBound - the bounds of the projection in world coordinates as side effect.
    • inWorldBoundsOnSphere

      public boolean inWorldBoundsOnSphere(ILcdPoint aXYPoint, double aRadius)
      Description copied from interface: ILcdProjection
      Checks if a 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.
      Specified by:
      inWorldBoundsOnSphere in interface ILcdProjection
      Parameters:
      aXYPoint - point to be checked upon.
      aRadius - radius of the sphere.
      Returns:
      true if valid, false if invalid.
    • clone

      public Object clone()
      Description copied from interface: ILcdProjection
      Makes a deep clone of this ILcdProjection.
      Specified by:
      clone in interface ILcdProjection
      Overrides:
      clone in class ALcdProjection
      Returns:
      deep clone of this ILcdProjection.
    • toString

      public String toString()
      Returns the String representation of the TLcdGeodetic projection.
      Specified by:
      toString in interface ILcdProjection
      Overrides:
      toString in class Object
      Returns:
      String representation of this ILcdProjection.
    • equals

      public boolean equals(Object aProjection)
      Description copied from interface: ILcdProjection
      Checks if this ILcdProjection equals some other Object.
      Specified by:
      equals in interface ILcdProjection
      Overrides:
      equals in class Object
      Parameters:
      aProjection - Object to compare with.
      Returns:
      true if the Object is an instance of the same ILcdProjection class and having the same projection properties, false otherwise.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object