com.bbn.openmap.proj
Class LambertConformal

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

public class LambertConformal
extends Proj

Implements the LambertConformalConic projection.

NOTE: This implementation only works for the northern hemisphere.

Needs to be modified for use in the southern hemesphere.

Author:
David J. Ward
See Also:
Serialized Form

Field Summary
static java.lang.String LambertConformalName
          The LambertCC name.
static int LambertConformalType
          The LambertCC type of projection.
protected  java.awt.Point plotablePoint
           
 
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
LambertConformal(LatLonPoint center, float scale, int width, int height, double centralMeridian, double sp_one, double sp_two, double reference_latitude, double falseEasting, double falseNorthing)
          Constructor for the lambert conformal projection.
 
Method Summary
protected  java.util.ArrayList _forwardPoly(float[] rawllpts, int ltype, int nsegs, boolean isFilled)
          Forward project a lat/lon Poly.
 void computeParameters()
          Called when some fundamental parameters change.
 void drawBackground(java.awt.Graphics g)
          Draw the background for the projection.
 void drawBackground(java.awt.Graphics2D g, java.awt.Paint paint)
          Draw the background for the projection.
 java.awt.Point forward(float lat, float lon, java.awt.Point p)
          Forward projects a lat,lon coordinates.
 java.awt.Point forward(float lat, float lon, java.awt.Point p, boolean isRadian)
          Forward projects lat,lon into XY space and returns a Point.
 java.awt.Point forward(LatLonPoint pt, java.awt.Point p)
          Projects a point from Lat/Lon space to X/Y space.
 boolean forwardRaw(float[] rawllpts, int rawoff, int[] xcoords, int[] ycoords, boolean[] visible, int copyoff, int copylen)
          Forward project a raw array of radian points.
 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 (northwest) point of the projection.
 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)
          Determine if the location is plotable on the screen.
 boolean isPlotable(LatLonPoint llpoint)
          Determine if the location is plotable
 java.awt.Point LLToPixel(double lat, double lon, java.awt.Point p)
           
 java.awt.geom.Point2D LLToWorld(double lat, double lon, java.awt.geom.Point2D lp)
           
static void main(java.lang.String[] argv)
          test method
 float normalize_latitude(float lat)
          Sets radian latitude to something sane.
 void pan(float Az)
          Pan the map/projection.
 LatLonPoint pixelToLL(int xabs, int yabs, LatLonPoint llp)
           
 LatLonPoint worldToLL(double x, double y, LatLonPoint llp)
           
 
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, 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, toString, wrap_longitude
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

LambertConformalName

public static final transient java.lang.String LambertConformalName
The LambertCC name.

See Also:
Constant Field Values

LambertConformalType

public static final transient int LambertConformalType
The LambertCC type of projection.

See Also:
Constant Field Values

plotablePoint

protected java.awt.Point plotablePoint
Constructor Detail

LambertConformal

public LambertConformal(LatLonPoint center,
                        float scale,
                        int width,
                        int height,
                        double centralMeridian,
                        double sp_one,
                        double sp_two,
                        double reference_latitude,
                        double falseEasting,
                        double falseNorthing)
Constructor for the lambert conformal projection.

Parameters:
center - center location for projections
scale - scale of projection
width - width of projection
height - height of projection
centralMeridian - the Central Meridian in degrees.
sp_one - Standard Parallel One in degrees.
sp_two - Standard Parallel Two in degrees.
reference_latitude - the latitude for the origin of the projection
falseEasting - number of meters added as buffer to origin E/W.
falseNorthing - number of meters added as buffer to origin for N/S.
Method Detail

computeParameters

public 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

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)

pan

public void pan(float Az)
Pan the map/projection.

Specified by:
pan in interface Projection
Overrides:
pan in class Proj
Parameters:
Az - azimuth "east of north" in decimal degrees: -180 <= Az <= 180

LLToWorld

public java.awt.geom.Point2D LLToWorld(double lat,
                                       double lon,
                                       java.awt.geom.Point2D lp)

LLToPixel

public java.awt.Point LLToPixel(double lat,
                                double lon,
                                java.awt.Point p)

worldToLL

public LatLonPoint worldToLL(double x,
                             double y,
                             LatLonPoint llp)

pixelToLL

public LatLonPoint pixelToLL(int xabs,
                             int yabs,
                             LatLonPoint llp)

isPlotable

public boolean isPlotable(float lat,
                          float lon)
Determine if the location is plotable on the screen. The Lambert Conformal projection does not lend its self to a simple determination. This method invokes forward to obtain the screen coordinates. If the screen coordinates are visible returns true otherwise returns false.

Parameters:
lat - latitude in degrees
lon - longitude in degrees
Returns:
true is plotable, otherwise false

isPlotable

public boolean isPlotable(LatLonPoint llpoint)
Determine if the location is plotable

Specified by:
isPlotable in interface Projection
Overrides:
isPlotable in class Proj
Parameters:
llpoint - location to check
Returns:
returns true is plotable, otherwise false

forward

public java.awt.Point forward(LatLonPoint pt,
                              java.awt.Point p)
Projects a point from Lat/Lon space to X/Y space.

Parameters:
pt - LatLonPoint
p - Point retval
Returns:
Point p

forward

public java.awt.Point forward(float lat,
                              float lon,
                              java.awt.Point p)
Forward projects a lat,lon coordinates.

Parameters:
lat - raw latitude in decimal degrees
lon - raw longitude in decimal degrees
p - Resulting XY Point
Returns:
Point p

forward

public java.awt.Point forward(float lat,
                              float lon,
                              java.awt.Point p,
                              boolean isRadian)
Forward projects lat,lon into XY space and returns a Point.

Parameters:
lat - latitude
lon - longitude
p - Resulting XY Point
isRadian - indicates that lat,lon arguments are in radians
Returns:
Point p
See Also:
Projection.forward(float,float,Point)

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 - Point
llp - resulting LatLonPoint
Returns:
LatLonPoint llp

getUpperLeft

public LatLonPoint getUpperLeft()
Get the upper left (northwest) 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.

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 Proj
Returns:
the projection name

forwardRaw

public boolean forwardRaw(float[] rawllpts,
                          int rawoff,
                          int[] xcoords,
                          int[] 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.

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.

_forwardPoly

protected java.util.ArrayList _forwardPoly(float[] rawllpts,
                                           int ltype,
                                           int nsegs,
                                           boolean isFilled)
Forward project a lat/lon Poly. Remember to specify vertices in radians!

Specified by:
_forwardPoly in class Proj
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? this is currently ignored for cylindrical projections.
Returns:
Vector of x[], y[], x[], y[], ... projected poly

drawBackground

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

Specified by:
drawBackground in class Proj
Parameters:
g - Graphics2D
paint - java.awt.Paint to use for the background

drawBackground

public void drawBackground(java.awt.Graphics g)
Draw the background for the projection.

Specified by:
drawBackground in class Proj
Parameters:
g - Graphics

main

public static void main(java.lang.String[] argv)
test method

Parameters:
argv - command line parameters


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