com.bbn.openmap.proj
Class CADRG

java.lang.Object
  extended by com.bbn.openmap.proj.Proj
      extended by com.bbn.openmap.proj.GeoProj
          extended by com.bbn.openmap.proj.Cylindrical
              extended by com.bbn.openmap.proj.CADRG
All Implemented Interfaces:
EqualArc, Projection, java.io.Serializable, java.lang.Cloneable

public class CADRG
extends Cylindrical
implements EqualArc

Implements the CADRG projection. This is really an Equal Arc Projection with pixel spacings as dictated by the RPF specification.

See Also:
Serialized Form

Field Summary
static java.lang.String CADRGName
          The CADRG name.
static double epsilon
           
 
Fields inherited from class com.bbn.openmap.proj.Cylindrical
half_world, world
 
Fields inherited from class com.bbn.openmap.proj.GeoProj
DATELINE, mercator, NORTH_POLE, NUM_DEFAULT_CIRCLE_VERTS, NUM_DEFAULT_GREAT_SEGS, pixelsPerMeter, planetPixelCircumference, planetPixelRadius, planetRadius, scaled_radius, SOUTH_POLE, XSCALE_THRESHOLD, XTHRESHOLD
 
Fields inherited from class com.bbn.openmap.proj.Proj
centerX, centerY, height, maxscale, MIN_HEIGHT, MIN_WIDTH, minscale, projID, rotationAngle, scale, ucuom, width
 
Constructor Summary
CADRG(LatLonPoint center, float scale, int width, int height)
          Construct a CADRG projection.
 
Method Summary
protected  void computeParameters()
          Called when some fundamental parameters change.
static CADRG convertProjection(Projection proj)
           
 java.awt.geom.Point2D forward(double lat, double lon, java.awt.geom.Point2D ret_val, boolean isRadians)
          Forward projects lat,lon into XY space and returns a Point2D.
 double getLowerZoneExtent(int zone)
          Returns the lower zone extent for the given zone at the current scale.
 java.lang.String getName()
          Get the name string of the projection.
 double getPlanetPixelCircumference()
          Get the planet pixel circumference.
static int getProjZone(char asciiZone)
          Given a letter for a zone, return the CADRG zone equivalent,
 float getScale(java.awt.geom.Point2D ll1, java.awt.geom.Point2D ll2, java.awt.geom.Point2D point1, java.awt.geom.Point2D point2)
          Given a couple of points representing a bounding box, find out what the scale should be in order to make those points appear at the corners of the projection.
 double getUpperZoneExtent(int zone)
          Returns the upper zone extent for the given zone at the current scale.
 double getXPixConstant()
          Returns the x pixel constant of the projection.
 double getYPixConstant()
          Returns the y pixel constant of the projection.
 int getZone()
          Returns the current zone of the projection.
protected  int getZone(double lat, double y_pix_constant)
          Returns the zone based on the y_pix_constant and a latitude.
<T extends java.awt.geom.Point2D>
T
inverse(double x, double y, T ret_val)
          Inverse project x,y coordinates into a LatLonPoint.
 boolean isPlotable(double lat, double lon)
          Checks if a LatLonPoint is plot-able.
 double normalizeLatitude(double lat)
          Sets radian latitude to something sane.
 int numHorizontalFrames()
          Return the number of horizontal frame files that will fit around the world in the current zone.
 int numVerticalFrames()
          Return the number of vertical frame files that will fit within the current zone, overlaps included.
 java.lang.String toString()
          Return stringified description of this projection.
 
Methods inherited from class com.bbn.openmap.proj.Cylindrical
_forwardPoly, _forwardPoly, dumpPoly, dumpPoly, forwardRaw, forwardRaw, getLowerRight, getUpperLeft, init
 
Methods inherited from class com.bbn.openmap.proj.GeoProj
assertLatLonPoint, clone, doPolyDispatch, doPolyDispatch, forward, forward, forward, forward, forwardArc, forwardArc, forwardArc, forwardCircle, forwardCircle, forwardCircle, forwardGreatPoly, forwardGreatPoly, forwardLine, forwardLine, forwardLLPoly, forwardPoly, forwardPoly, forwardRect, forwardRect, forwardRect, forwardRhumbPoly, forwardRhumbPoly, getCenter, getCenter, getGCTForProjection, getPlanetPixelRadius, getPlanetRadius, getPPM, getReferenceLon, getUcuom, inverse, inverse, isComplicatedLineType, isPlotable, normalize_latitude, normalizeLatitude, pan, pan, setCenter, setCenter, setCenter, setPlanetRadius, setPPM, setUcuom, wrap_longitude, wrapLongitude, wrapLongitude, wrapLongitudeDeg
 
Methods inherited from class com.bbn.openmap.proj.Proj
drawBackground, drawBackground, equals, forward, forward, forward, forwardLine, forwardPoly, forwardPoly, forwardRect, forwardShape, getHeight, getMaxScale, getMinScale, getProjectionID, getRotationAngle, getScale, getWidth, hashCode, inverse, inverseShape, makeClone, panE, panE, panN, panN, panNE, panNE, panNW, panNW, panS, panS, panSE, panSE, panSW, panSW, panW, panW, setCenter, setHeight, setMaxScale, setMinScale, setParms, setProjectionID, setRotationAngle, setScale, setWidth
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.bbn.openmap.proj.Projection
forward, forward, forward, forward, forward, forward, forwardLine, forwardPoly, forwardPoly, forwardRaw, forwardRaw, forwardRect, forwardShape, getCenter, getCenter, getHeight, getLowerRight, getMaxScale, getMinScale, getProjectionID, getRotationAngle, getScale, getUcuom, getUpperLeft, getWidth, inverse, inverse, inverse, inverseShape, isPlotable, makeClone, pan, pan
 

Field Detail

CADRGName

public static final transient java.lang.String CADRGName
The CADRG name.

See Also:
Constant Field Values

epsilon

public static final transient double epsilon
See Also:
Constant Field Values
Constructor Detail

CADRG

public CADRG(LatLonPoint center,
             float scale,
             int width,
             int height)
Construct a CADRG projection.

Parameters:
center - LatLonPoint center of projection
scale - float scale of projection
width - width of screen
height - height of screen
Method Detail

normalizeLatitude

public double normalizeLatitude(double lat)
Sets radian latitude to something sane. This is an abstract function since some projections don't deal well with extreme latitudes.

Specified by:
normalizeLatitude in class GeoProj
Parameters:
lat - float latitude in radians
Returns:
float latitude (-PI/2 <= y <= PI/2)

toString

public java.lang.String toString()
Return stringified description of this projection.

Overrides:
toString in class Cylindrical
Returns:
String
See Also:
Projection.getProjectionID()

getZone

public int getZone()
Returns the current zone of the projection. Zone number starts at 1, goes to 8, per the RPF specification. We don't handle zone 9 (polar).

Returns:
the zone of the projection.

getProjZone

public static int getProjZone(char asciiZone)
Given a letter for a zone, return the CADRG zone equivalent,


getPlanetPixelCircumference

public double getPlanetPixelCircumference()
Get the planet pixel circumference.

Overrides:
getPlanetPixelCircumference in class GeoProj
Returns:
double circumference of planet in pixels

getZone

protected int getZone(double lat,
                      double y_pix_constant)
Returns the zone based on the y_pix_constant and a latitude.

HACK: latitude in decimal degrees DO THE CONSTANTS DEPEND ON THIS?!!

Parameters:
lat - latitude
y_pix_constant - pixel constant

getXPixConstant

public double getXPixConstant()
Returns the x pixel constant of the projection. This was calculated when the projection was created. Represents the number of pixels around the earth (360 degrees).

Specified by:
getXPixConstant in interface EqualArc

getYPixConstant

public double getYPixConstant()
Returns the y pixel constant of the projection. This was calculated when the projection was created. Represents the number of pixels from 0 to 90 degrees.

Specified by:
getYPixConstant in interface EqualArc

getUpperZoneExtent

public double getUpperZoneExtent(int zone)
Returns the upper zone extent for the given zone at the current scale. This only makes sense if the projection is at the same scale as the chart data you are interested in.


getLowerZoneExtent

public double getLowerZoneExtent(int zone)
Returns the lower zone extent for the given zone at the current scale. This only makes sense if the projection is at the same scale as the chart data you are interested in.


numHorizontalFrames

public int numHorizontalFrames()
Return the number of horizontal frame files that will fit around the world in the current zone. This only makes sense if the projection is at the same scale as the chart data you are interested in.

Returns:
number of frame columns in the current zone, to go around the world.

numVerticalFrames

public int numVerticalFrames()
Return the number of vertical frame files that will fit within the current zone, overlaps included. This only makes sense if the projection is at the same scale as the chart data you are interested in.

Returns:
number of frame rows in the current zone.

isPlotable

public boolean isPlotable(double lat,
                          double lon)
Checks if a LatLonPoint is plot-able.

A point is plot-able in the CADRG projection if it is within the North and South zone limits.

Specified by:
isPlotable in interface Projection
Overrides:
isPlotable in class Proj
Parameters:
lat - float latitude in decimal degrees
lon - float longitude in decimal degrees
Returns:
boolean

forward

public java.awt.geom.Point2D forward(double lat,
                                     double lon,
                                     java.awt.geom.Point2D ret_val,
                                     boolean isRadians)
Forward projects lat,lon into XY space and returns a Point2D.

Specified by:
forward in class GeoProj
Parameters:
lat - float latitude in radians
lon - float longitude in radians
ret_val - Resulting XY Point2D
isRadians - true if lat/lon are radians instead of decimal degrees
Returns:
Point2D ret_val

inverse

public <T extends java.awt.geom.Point2D> T inverse(double x,
                                                   double y,
                                                   T ret_val)
Inverse project x,y coordinates into a LatLonPoint.

Specified by:
inverse in interface Projection
Specified by:
inverse in class Proj
Parameters:
x - integer x coordinate
y - integer y coordinate
ret_val - LatLonPoint
Returns:
LatLonPoint ret_val
See Also:
Proj.inverse(Point2D)

computeParameters

protected void computeParameters()
Called when some fundamental parameters change.

Each projection will decide how to respond to this change. For instance, they may need to recalculate "constant" parameters used in the forward() and inverse() calls.

Overrides:
computeParameters in class Cylindrical

getName

public java.lang.String getName()
Get the name string of the projection.

Specified by:
getName in interface Projection
Overrides:
getName in class Cylindrical

getScale

public float getScale(java.awt.geom.Point2D ll1,
                      java.awt.geom.Point2D ll2,
                      java.awt.geom.Point2D point1,
                      java.awt.geom.Point2D point2)
Given a couple of points representing a bounding box, find out what the scale should be in order to make those points appear at the corners of the projection.

Specified by:
getScale in interface Projection
Overrides:
getScale in class GeoProj
Parameters:
ll1 - the upper left coordinates of the bounding box.
ll2 - the lower right coordinates of the bounding box.
point1 - a Point2D reflecting a pixel spot on the projection that matches the ll1 coordinate, the upper left corner of the area of interest.
point2 - a Point2D reflecting a pixel spot on the projection that matches the ll2 coordinate, usually the lower right corner of the area of interest.

convertProjection

public static CADRG convertProjection(Projection proj)


Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details