## com.bbn.openmap.proj
Class CADRG

    java.lang.Object
      com.bbn.openmap.proj.Proj
          com.bbn.openmap.proj.Cylindrical
              com.bbn.openmap.proj.CADRG

All Implemented Interfaces:
  java.lang.Cloneable, EqualArc, Projection, java.io.Serializable

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 int` `CADRGType` The CADRG type of projection.
`static float` `epsilon`

Fields inherited from class com.bbn.openmap.proj.Cylindrical
`half_world, world`

Fields inherited from class com.bbn.openmap.proj.Proj
`ctrLat, ctrLon, DATELINE, height, maxscale, mercator, MIN_HEIGHT, MIN_WIDTH, minscale, NORTH_POLE, NUM_DEFAULT_CIRCLE_VERTS, NUM_DEFAULT_GREAT_SEGS, pixelsPerMeter, planetPixelCircumference, planetPixelRadius, planetRadius, projID, scale, scaled_radius, SOUTH_POLE, type, width, XSCALE_THRESHOLD, XTHRESHOLD`

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.
`java.awt.Point` `forward(float lat, float lon, java.awt.Point ret_val)` Forward projects lat,lon coordinates.
`java.awt.Point` `forward(float lat, float lon, java.awt.Point ret_val, boolean b)` Forward projects lat,lon into XY space and returns a Point.
`java.awt.Point` `forward(LatLonPoint pt, java.awt.Point ret_val)` Projects a point from Lat/Lon space to X/Y space.
`float` `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.
`float` `getPlanetPixelCircumference()` Get the planet pixel circumference.
`static int` `getProjZone(char asciiZone)` Given a letter for a zone, return the CADRG zone equivalent,
`float` `getScale(LatLonPoint ll1, LatLonPoint ll2, java.awt.Point point1, java.awt.Point 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.
`float` `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.
`LatLonPoint` `inverse(int x, int y, LatLonPoint ret_val)` Inverse project x,y coordinates into a LatLonPoint.
`LatLonPoint` `inverse(java.awt.Point pt, LatLonPoint ret_val)` Inverse project a Point.
`boolean` `isPlotable(float lat, float lon)` Checks if a LatLonPoint is plot-able.
`float` `normalize_latitude(float 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, drawBackground, drawBackground, dumpPoly, forwardRaw, getLowerRight, getUpperLeft, pan`

Methods inherited from class com.bbn.openmap.proj.Proj

`clone, doPolyDispatch, equals, forward, forward, forwardArc, forwardArc, forwardArc, forwardCircle, forwardCircle, forwardCircle, forwardGreatPoly, forwardLine, forwardLine, forwardPoly, forwardPoly, forwardRaster, forwardRect, forwardRect, forwardRect, forwardRhumbPoly, getCenter, getHeight, getMaxScale, getMinScale, getPlanetPixelRadius, getPlanetRadius, getPPM, getProjectionID, getProjectionType, getScale, getWidth, hashCode, init, inverse, inverse, isComplicatedLineType, isPlotable, makeClone, pan, panE, panE, panN, panN, panNE, panNE, panNW, panNW, panS, panS, panSE, panSE, panSW, panSW, panW, panW, setCenter, setCenter, setHeight, setMaxScale, setMinScale, setParms, setPlanetRadius, setPPM, setProjectionID, setScale, setWidth, wrap_longitude`

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, forwardArc, forwardCircle, forwardLine, forwardPoly, forwardRaster, forwardRaw, forwardRect, getCenter, getHeight, getLowerRight, getMaxScale, getMinScale, getProjectionID, getProjectionType, getScale, getUpperLeft, getWidth, inverse, inverse, isPlotable, makeClone, pan, pan`

Field Detail

### CADRGName

    public static final transient java.lang.String CADRGName

  The CADRG name.

  See Also:
    Constant Field Values

### CADRGType

    public static final transient int CADRGType

  The CADRG type of projection.

  See Also:
    Constant Field Values

### epsilon

    public static final transient float 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

### normalize_latitude

    public float normalize_latitude(float lat)

  Sets radian latitude to something sane. This is an abstract function since some projections don't deal well with extreme latitudes.

  Specified by:
    `normalize_latitude` in class `Proj`
  Parameters:
    `lat` - float latitude in radians
  Returns:
    float latitude (-PI/2 <= y <= PI/2)
  See Also:
    `LatLonPoint.normalize_latitude(float)`

### 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 float getPlanetPixelCircumference()

  Get the planet pixel circumference.

  Overrides:
    `getPlanetPixelCircumference` in class `Proj`
  Returns:
    float circumference of planet in pixels

### getXPixConstant

    public double getXPixConstant()

  Returns the x pixel constant of the projection. This was calcuated 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 calcuated when the projection was created. Represents the number of pixels from 0 to 90 degrees.

  Specified by:
    `getYPixConstant` in interface `EqualArc`

### getUpperZoneExtent

    public float 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 float 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 columes 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(float lat,
                              float 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`
  Parameters:
    `lat` - float latitude in decimal degrees
    `lon` - float longitude in decimal degrees
  Returns:
    boolean

### forward

    public java.awt.Point forward(LatLonPoint pt,
                                  java.awt.Point ret_val)

  Projects a point from Lat/Lon space to X/Y space.

  Specified by:
    `forward` in interface `Projection`
  Parameters:
    `pt` - LatLonPoint
    `ret_val` - Point retval
  Returns:
    Point ret_val

### forward

    public java.awt.Point forward(float lat,
                                  float lon,
                                  java.awt.Point ret_val,
                                  boolean b)

  Forward projects lat,lon into XY space and returns a Point.

  Specified by:
    `forward` in interface `Projection`
  Parameters:
    `lat` - float latitude in radians
    `lon` - float longitude in radians
    `ret_val` - Resulting XY Point
    `b` - placeholder argument indicating that lat,lon arguments are in radians (can be true or false)
  Returns:
    Point ret_val
  See Also:
    `Projection.forward(float,float,Point)`

### forward

    public java.awt.Point forward(float lat,
                                  float lon,
                                  java.awt.Point ret_val)

  Forward projects lat,lon coordinates.

  Specified by:
    `forward` in interface `Projection`
  Parameters:
    `lat` - raw latitude in decimal degrees
    `lon` - raw longitude in decimal degrees
    `ret_val` - Resulting XY Point
  Returns:
    Point ret_val

### inverse

    public LatLonPoint inverse(java.awt.Point pt,
                               LatLonPoint ret_val)

  Inverse project a Point.

  Specified by:
    `inverse` in interface `Projection`
  Parameters:
    `pt` - x,y Point
    `ret_val` - resulting LatLonPoint
  Returns:
    LatLonPoint ret_val

### inverse

    public LatLonPoint inverse(int x,
                               int y,
                               LatLonPoint ret_val)

  Inverse project x,y coordinates into a LatLonPoint.

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

### 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" paramters 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(LatLonPoint ll1,
                          LatLonPoint ll2,
                          java.awt.Point point1,
                          java.awt.Point 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 `Proj`
  Parameters:
    `ll1` - the upper left coordinates of the bounding box.
    `ll2` - the lower right coordinates of the bounding box.
    `point1` - a java.awt.Point reflecting a pixel spot on the projection that matches the ll1 coordinate, the upper left corner of the area of interest.
    `point2` - a java.awt.Point reflecting a pixel spot on the projection that matches the ll2 coordinate, usually the lower right corner of the area of interest.

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