com.bbn.openmap.proj
Class Gnomonic

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

public class Gnomonic
extends Azimuth

Implements the Gnomonic projection.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.bbn.openmap.proj.Azimuth
Azimuth.AzimuthVar
 
Field Summary
protected  double cosCtrLat
           
static double epsilon
           
static java.lang.String GnomonicName
          The Gnomonic name.
static double HEMISPHERE_EDGE
           
static double hPrime
           
protected  double hy
           
protected static float NORTH_BOUNDARY
           
protected  double sinCtrLat
           
protected static float SOUTH_BOUNDARY
           
protected  double wx
           
 
Fields inherited from class com.bbn.openmap.proj.Azimuth
clockwise, spaceColor, 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
Gnomonic(LatLonPoint center, float scale, int width, int height)
          Construct a Mercator projection.
 
Method Summary
protected  java.awt.geom.Point2D _forward(double phi, double lambda, java.awt.geom.Point2D p, Azimuth.AzimuthVar azVar)
          Forward project a point.
protected  java.awt.geom.Point2D _forward(float phi, float lambda, java.awt.geom.Point2D p, Azimuth.AzimuthVar azVar)
          Forward project a point.
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.
 LatLonPoint getLowerRight()
          Get the lower right (southeast) point of the projection.
 java.lang.String getName()
          Get the name string of the projection.
 LatLonPoint getUpperLeft()
          Get the upper left (northernmost and westernmost) point of the projection.
static boolean hemisphere_clip(double phi1, double lambda0, double phi, double lambda)
           
static boolean hemisphere_clip(float phi1, float lambda0, float phi, float lambda)
          Check if a given lat/lon is within the visible hemisphere.
static double hemisphere_distance(double phi1, double lambda0, double phi, double lambda)
           
protected  void init()
          Called after the center and scale is set in setParams, but before the scale is checked for legitimacy.
<T extends java.awt.geom.Point2D>
T
inverse(double x, double y, T llp)
          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.
 boolean overEquator()
          Check if equator is visible on screen.
 java.lang.String toString()
          Return stringified description of this projection.
 
Methods inherited from class com.bbn.openmap.proj.Azimuth
_forwardPoly, _forwardPoly, _panE, _panN, _panNE, _panNW, _panS, _panSE, _panSW, _panW, forward, forwardRaw, forwardRaw, getSpaceColor, isClockwiseTraversal, overNorthPole, overPoint, overSouthPole, pan, setClockwiseTraversal, setSpaceColor
 
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, 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, 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
 

Field Detail

GnomonicName

public static final transient java.lang.String GnomonicName
The Gnomonic name.

See Also:
Constant Field Values

hy

protected double hy

wx

protected double wx

cosCtrLat

protected double cosCtrLat

sinCtrLat

protected double sinCtrLat

epsilon

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

HEMISPHERE_EDGE

public static final transient double HEMISPHERE_EDGE
See Also:
Constant Field Values

hPrime

public static final transient double hPrime

NORTH_BOUNDARY

protected static final float NORTH_BOUNDARY
See Also:
Constant Field Values

SOUTH_BOUNDARY

protected static final float SOUTH_BOUNDARY
See Also:
Constant Field Values
Constructor Detail

Gnomonic

public Gnomonic(LatLonPoint center,
                float scale,
                int width,
                int height)
Construct a Mercator 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 Azimuth
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 Azimuth

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 Azimuth

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 Azimuth
Parameters:
g - Graphics

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)

hemisphere_distance

public static final double hemisphere_distance(double phi1,
                                               double lambda0,
                                               double phi,
                                               double lambda)

hemisphere_clip

public static final boolean hemisphere_clip(float phi1,
                                            float lambda0,
                                            float phi,
                                            float lambda)
Check if a given lat/lon is within the visible hemisphere.

Parameters:
phi1 - latitude
lambda0 - longitude
phi - latitude
lambda - longitude
Returns:
boolean true if within the visible hemisphere, false if not

hemisphere_clip

public static final boolean hemisphere_clip(double phi1,
                                            double lambda0,
                                            double phi,
                                            double lambda)

isPlotable

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

A point is plot-able if it is within the visible hemisphere.

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

protected java.awt.geom.Point2D _forward(float phi,
                                         float lambda,
                                         java.awt.geom.Point2D p,
                                         Azimuth.AzimuthVar azVar)
Forward project a point. If the point is not within the viewable hemisphere, return flags in AzimuthVar variable if specified.

Parameters:
phi - float latitude in radians
lambda - float longitude in radians
p - Point2D
azVar - AzimuthVar or null
Returns:
Point2D pt

_forward

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

Specified by:
_forward in class Azimuth
Parameters:
phi - double latitude in radians
lambda - double longitude in radians
p - Point2D
azVar - AzimuthVar or null
Returns:
Point2D pt

inverse

public <T extends java.awt.geom.Point2D> T inverse(double x,
                                                   double y,
                                                   T llp)
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
llp - LatLonPoint
Returns:
LatLonPoint llp
See Also:
Proj.inverse(Point2D)

overEquator

public boolean overEquator()
Check if equator is visible on screen.

Returns:
boolean

getUpperLeft

public LatLonPoint getUpperLeft()
Get the upper left (northernmost and westernmost) point of the projection.

Returns the upper left point (or closest equivalent) of the projection based on the center point and height and width of screen.

Specified by:
getUpperLeft in interface Projection
Overrides:
getUpperLeft in class Proj
Returns:
LatLonPoint

getLowerRight

public LatLonPoint getLowerRight()
Get the lower right (southeast) point of the projection.

Returns the lower right point (or closest equivalent) of the projection based on the center point and height and width of screen.

This is trivial for most cylindrical projections, but much more complicated for azimuthal projections.

Specified by:
getLowerRight in interface Projection
Overrides:
getLowerRight in class Proj
Returns:
LatLonPoint

getName

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

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


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