com.bbn.openmap.proj
Class Azimuth

java.lang.Object
  extended by com.bbn.openmap.proj.Proj
      extended by com.bbn.openmap.proj.GeoProj
          extended by com.bbn.openmap.proj.Azimuth
All Implemented Interfaces:
Projection, java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
Gnomonic, Orthographic

public abstract class Azimuth
extends GeoProj

Base of all azimuthal projections.

See Also:
Orthographic, Gnomonic, Serialized Form

Nested Class Summary
protected static class Azimuth.AzimuthVar
           
 
Field Summary
protected  boolean clockwise
          Traverse poly vertices in clockwise order.
protected  java.awt.Color spaceColor
           
protected  java.awt.Point 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
Azimuth(LatLonPoint center, float scale, int width, int height)
          Construct an azimuthal projection.
 
Method Summary
protected abstract  java.awt.geom.Point2D _forward(double lat, double lon, java.awt.geom.Point2D pt, Azimuth.AzimuthVar azVar)
          Forward project a point.
protected  java.util.ArrayList<float[]> _forwardPoly(double[] rawllpts, int ltype, int nsegs, boolean isFilled)
          Forward project a lat/lon Poly.
protected  java.util.ArrayList<float[]> _forwardPoly(float[] rawllpts, int ltype, int nsegs, boolean isFilled)
          Forward project a lat/lon Poly.
protected  void _panE()
          Pan the map east.
protected  void _panN()
          Pan the map north.
protected  void _panNE()
          Pan the map northeast.
protected  void _panNW()
          Pan the map northwest.
protected  void _panS()
          Pan the map south.
protected  void _panSE()
          Pan the map southeast.
protected  void _panSW()
          Pan the map southwest.
protected  void _panW()
          Pan the map west.
protected  void computeParameters()
          Called when some fundamental parameters change.
 void drawBackground(java.awt.Graphics g)
          Assume that the Graphics has been set with the Paint/Color needed, just render the shape of the background.
 java.awt.geom.Point2D forward(double lat, double lon, java.awt.geom.Point2D pt, boolean isRadian)
          Forward project a point.
 boolean forwardRaw(double[] rawllpts, int rawoff, float[] xcoords, float[] ycoords, boolean[] visible, int copyoff, int copylen)
          Forward project a raw array of radian points.
 boolean forwardRaw(float[] rawllpts, int rawoff, float[] xcoords, float[] ycoords, boolean[] visible, int copyoff, int copylen)
          Forward project a raw array of radian points.
 java.lang.String getName()
          Get the name string of the projection.
 java.awt.Color getSpaceColor()
           
protected  void init()
          Called after the center and scale is set in setParams, but before the scale is checked for legitimacy.
 boolean isClockwiseTraversal()
          Get poly-traversal setting (clockwise or counter-clockwise).
 boolean overNorthPole()
          Checks if the north pole is visible on the screen.
 boolean overPoint(float lat, float lon)
          Checks if the point is visible on the screen.
 boolean overSouthPole()
          Checks if the south pole is visible on the screen.
 void pan(float Az)
          Pan the map/projection.
 void setClockwiseTraversal(boolean value)
          Toggle clockwise traversal of poly vertices.
 void setSpaceColor(java.awt.Color spaceColor)
           
 java.lang.String toString()
          Return stringified description of this projection.
 
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, getPlanetPixelCircumference, getPlanetPixelRadius, getPlanetRadius, getPPM, getReferenceLon, getScale, getUcuom, inverse, inverse, isComplicatedLineType, isPlotable, normalize_latitude, normalizeLatitude, normalizeLatitude, pan, pan, setCenter, setCenter, setCenter, setPlanetRadius, setPPM, setUcuom, wrap_longitude, wrapLongitude, wrapLongitude, wrapLongitudeDeg
 
Methods inherited from class com.bbn.openmap.proj.Proj
drawBackground, equals, forward, forward, forward, forwardLine, forwardPoly, forwardPoly, forwardRect, forwardShape, getHeight, getLowerRight, getMaxScale, getMinScale, getProjectionID, getRotationAngle, getScale, getUpperLeft, getWidth, hashCode, inverse, inverse, inverseShape, isPlotable, 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
 

Field Detail

world

protected transient java.awt.Point world

clockwise

protected boolean clockwise
Traverse poly vertices in clockwise order.


spaceColor

protected java.awt.Color spaceColor
Constructor Detail

Azimuth

public Azimuth(LatLonPoint center,
               float scale,
               int width,
               int height)
Construct an azimuthal projection.

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

toString

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

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

init

protected void init()
Description copied from class: Proj
Called after the center and scale is set in setParams, but before the scale is checked for legitimacy. This is an opportunity to set constants in subclasses before anything else gets called or checked for validity. This is different than computeParameters() which is called after some checks. This is a good time to pre-calculate constants and set maxscale and minscale.

Make sure you call super.init() if you override this method.

Overrides:
init in class GeoProj

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.

Specified by:
computeParameters in class Proj

setClockwiseTraversal

public void setClockwiseTraversal(boolean value)
Toggle clockwise traversal of poly vertices.

Parameters:
value - boolean

isClockwiseTraversal

public boolean isClockwiseTraversal()
Get poly-traversal setting (clockwise or counter-clockwise).

Returns:
boolean

forward

public final java.awt.geom.Point2D forward(double lat,
                                           double lon,
                                           java.awt.geom.Point2D pt,
                                           boolean isRadian)
Forward project a point. Wrapper around Azimuth-specific forwarding.

Specified by:
forward in class GeoProj
Parameters:
lat - latitude
lon - longitude
pt - return point
isRadian - true if lat/lon are radians instead of decimal degrees
Returns:
Point2D for projected point

_forward

protected abstract java.awt.geom.Point2D _forward(double lat,
                                                  double lon,
                                                  java.awt.geom.Point2D pt,
                                                  Azimuth.AzimuthVar azVar)
Forward project a point. If the point is not within the viewable hemisphere, return flags in AzimuthVar variable if specified.

Parameters:
lat - latitude in radians
lon - longitude in radians
pt - Point2D
azVar - AzimuthVar or null
Returns:
Point2D pt

pan

public void pan(float Az)
Pan the map/projection. We check for N,S,E,W,SE,NE,SW,NW and manage those directions a bit, so that going back and forth between them will put the map back where it was, instead of inching toward the equator. For other Az values, we go to the inverse of the x, y point in that direction (superclass behavior).

Parameters:
Az - azimuth "east of north" in decimal degrees: -180 <= Az <= 180

_panNW

protected void _panNW()
Pan the map northwest.


_panN

protected void _panN()
Pan the map north.


_panNE

protected void _panNE()
Pan the map northeast.


_panE

protected void _panE()
Pan the map east.


_panSE

protected void _panSE()
Pan the map southeast.


_panS

protected void _panS()
Pan the map south.


_panSW

protected void _panSW()
Pan the map southwest.


_panW

protected void _panW()
Pan the map west.


overNorthPole

public boolean overNorthPole()
Checks if the north pole is visible on the screen.

Returns:
boolean

overSouthPole

public boolean overSouthPole()
Checks if the south pole is visible on the screen.

Returns:
boolean

overPoint

public boolean overPoint(float lat,
                         float lon)
Checks if the point is visible on the screen.

Parameters:
lat - latitude in radians
lon - longitude in radians
Returns:
boolean true if visible, false if not

_forwardPoly

protected java.util.ArrayList<float[]> _forwardPoly(float[] rawllpts,
                                                    int ltype,
                                                    int nsegs,
                                                    boolean isFilled)
Forward project a lat/lon Poly. This is a complex method. Please read the in-code documentation for an explanation of the algorithm.

Specified by:
_forwardPoly in class GeoProj
Parameters:
rawllpts - float[] of lat,lon,lat,lon,... in RADIANS!
ltype - line type (straight, rhumbline, greatcircle)
nsegs - number of segment points (only for greatcircle or rhumbline line types, and if < 1, this value is generated internally)
isFilled - filled poly?
Returns:
ArrayList of x[], y[], x[], y[], ... projected poly

_forwardPoly

protected java.util.ArrayList<float[]> _forwardPoly(double[] rawllpts,
                                                    int ltype,
                                                    int nsegs,
                                                    boolean isFilled)
Forward project a lat/lon Poly. This is a complex method. Please read the in-code documentation for an explanation of the algorithm.

Specified by:
_forwardPoly in class GeoProj
Parameters:
rawllpts - double[] of lat,lon,lat,lon,... in RADIANS!
ltype - line type (straight, rhumbline, greatcircle)
nsegs - number of segment points (only for greatcircle or rhumbline line types, and if < 1, this value is generated internally)
isFilled - filled poly?
Returns:
ArrayList of x[], y[], x[], y[], ... projected poly

forwardRaw

public boolean forwardRaw(float[] rawllpts,
                          int rawoff,
                          float[] xcoords,
                          float[] ycoords,
                          boolean[] visible,
                          int copyoff,
                          int copylen)
Forward project a raw array of radian points. This assumes nothing about the array of coordinates. In no way does it assume the points are connected or that the composite figure is to be filled.

It does populate a visible array indicating whether the points are visible on the projected view of the world.

Specified by:
forwardRaw in interface Projection
Overrides:
forwardRaw in class Proj
Parameters:
rawllpts - array of lat,lon,... in radians
rawoff - offset into rawllpts
xcoords - x coordinates
ycoords - y coordinates
visible - coordinates visible?
copyoff - offset into x,y,visible arrays
copylen - number of coordinates (coordinate arrays should be at least this long, rawllpts should be at least twice as long).
Returns:
boolean true if all points visible, false if some points not visible.

forwardRaw

public boolean forwardRaw(double[] rawllpts,
                          int rawoff,
                          float[] xcoords,
                          float[] ycoords,
                          boolean[] visible,
                          int copyoff,
                          int copylen)
Forward project a raw array of radian points. This assumes nothing about the array of coordinates. In no way does it assume the points are connected or that the composite figure is to be filled.

It does populate a visible array indicating whether the points are visible on the projected view of the world.

Specified by:
forwardRaw in interface Projection
Overrides:
forwardRaw in class Proj
Parameters:
rawllpts - array of lat,lon,... in radians
rawoff - offset into rawllpts
xcoords - x coordinates
ycoords - y coordinates
visible - coordinates visible?
copyoff - offset into x,y,visible arrays
copylen - number of coordinates (coordinate arrays should be at least this long, rawllpts should be at least twice as long).
Returns:
boolean true if all points visible, false if some points not visible.

drawBackground

public void drawBackground(java.awt.Graphics g)
Assume that the Graphics has been set with the Paint/Color needed, just render the shape of the background.

Overrides:
drawBackground in class Proj
Parameters:
g - Graphics

getName

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

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

getSpaceColor

public java.awt.Color getSpaceColor()

setSpaceColor

public void setSpaceColor(java.awt.Color spaceColor)


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