com.bbn.openmap.proj
Class Gnomonic

java.lang.Object
  |
  +--com.bbn.openmap.proj.Proj
        |
        +--com.bbn.openmap.proj.Azimuth
              |
              +--com.bbn.openmap.proj.Gnomonic
All Implemented Interfaces:
java.lang.Cloneable, Projection, java.io.Serializable

public class Gnomonic
extends Azimuth

Implements the Gnomonic projection.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class com.bbn.openmap.proj.Azimuth
Azimuth.AzimuthVar
 
Field Summary
protected  float cosCtrLat
           
static float epsilon
           
static java.lang.String GnomonicName
          The Gnomonic name.
static int GnomonicType
          The Gnomonic type of projection.
static float HEMISPHERE_EDGE
           
static float hPrime
           
protected  int hy
           
protected static float NORTH_BOUNDARY
           
protected  float sinCtrLat
           
protected static float SOUTH_BOUNDARY
           
protected  int wx
           
 
Fields inherited from class com.bbn.openmap.proj.Azimuth
clockwise, spaceColor, 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
Gnomonic(LatLonPoint center, float scale, int width, int height)
          Construct a Mercator projection.
 
Method Summary
protected  java.awt.Point _forward(float phi, float lambda, java.awt.Point 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.
 void drawBackground(java.awt.Graphics2D g, java.awt.Paint paint)
          Draw the background for the projection.
 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(float phi1, float lambda0, float phi, float lambda)
          Check if a given lat/lon is within the visible hemisphere.
static float hemisphere_distance(float phi1, float lambda0, float phi, float lambda)
          Get the distance c of the point from the center of the hemisphere.
 LatLonPoint inverse(int x, int y, LatLonPoint llp)
          Inverse project x,y coordinates into a LatLonPoint.
 LatLonPoint inverse(java.awt.Point pt, LatLonPoint llp)
          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.
 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, _panE, _panN, _panNE, _panNW, _panS, _panSE, _panSW, _panW, forward, forward, forward, forwardRaw, isClockwiseTraversal, overNorthPole, overPoint, overSouthPole, pan, setClockwiseTraversal
 
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, getPlanetPixelCircumference, getPlanetPixelRadius, getPlanetRadius, getPPM, getProjectionID, getProjectionType, getScale, getScale, getWidth, hashCode, 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
 

Field Detail

GnomonicName

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

See Also:
Constant Field Values

GnomonicType

public static final transient int GnomonicType
The Gnomonic type of projection.

See Also:
Constant Field Values

hy

protected int hy

wx

protected int wx

cosCtrLat

protected float cosCtrLat

sinCtrLat

protected float sinCtrLat

epsilon

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

HEMISPHERE_EDGE

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

hPrime

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

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 Azimuth

drawBackground

public void drawBackground(java.awt.Graphics2D g,
                           java.awt.Paint paint)
Draw the background for the projection.

Overrides:
drawBackground in class Azimuth
Parameters:
g - Graphics2D
paint - java.awt.Paint to use for the background

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

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)

hemisphere_distance

public static final float hemisphere_distance(float phi1,
                                              float lambda0,
                                              float phi,
                                              float lambda)
Get the distance c of the point from the center of the hemisphere.

Parameters:
phi1 - latitude
lambda0 - longitude
phi - latitude
lambda - longitude
Returns:
float c angular distance in radians

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

isPlotable

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

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

Parameters:
lat - float latitude in decimal degrees
lon - float longitude in decimal degrees
Returns:
boolean

_forward

protected java.awt.Point _forward(float phi,
                                  float lambda,
                                  java.awt.Point 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 - float latitude in radians
lambda - float longitude in radians
p - Point
azVar - AzimuthVar or null
Returns:
Point pt

inverse

public LatLonPoint inverse(int x,
                           int y,
                           LatLonPoint llp)
Inverse project x,y coordinates into a LatLonPoint.

Parameters:
x - integer x coordinate
y - integer y coordinate
llp - LatLonPoint
Returns:
LatLonPoint llp
See Also:
Proj.inverse(Point)

inverse

public LatLonPoint inverse(java.awt.Point pt,
                           LatLonPoint llp)
Inverse project a Point.

Parameters:
pt - x,y Point
llp - resulting LatLonPoint
Returns:
LatLonPoint llp

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.

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.

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