com.bbn.openmap.proj
Class UTMProjection

java.lang.Object
  extended bycom.bbn.openmap.proj.Proj
      extended bycom.bbn.openmap.proj.UTMProjection
All Implemented Interfaces:
java.lang.Cloneable, Projection, java.io.Serializable

public class UTMProjection
extends Proj

A OpenMap Projection class that uses the UTMPoint to do its calculation.

See Also:
Serialized Form

Field Summary
protected  int half_world
           
protected  int hy
           
protected  float ppu
          Pixel per map unit.
static int UTMType
          The UTMType number.
protected  java.awt.Point world
           
protected  int wx
           
protected  java.awt.geom.Point2D.Double xycenter
          Center of view as xy coordinates relative to the underlying projection
 
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
UTMProjection(LatLonPoint center, float s, int w, int h, int type, int zone_number, boolean isnorthern, Ellipsoid ellps)
           
 
Method Summary
protected  java.util.ArrayList _forwardPoly(float[] rawllpts, int ltype, int nsegs, boolean isFilled)
          Forward project a lat/lon Poly.
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.
 java.awt.Point forward(float lat, float lon, java.awt.Point pt)
          Forward projects lat,lon coordinates into XY space and returns a Point.
 java.awt.Point forward(float lat, float lon, java.awt.Point pt, boolean isRadian)
          Forward projects lat,lon coordinates into XY space and returns a Point.
 java.awt.Point forward(LatLonPoint llp, java.awt.Point pt)
          Forward projects a LatLonPoint into XY space and return a Point.
 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.
 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.
 LatLonPoint getUpperLeft()
          Get the upper left (northwest) point of the projection.
 LatLonPoint inverse(int x, int y, LatLonPoint llpt)
          Inverse project x,y coordinates into a LatLonPoint.
 LatLonPoint inverse(java.awt.Point point, LatLonPoint llpt)
          Inverse project a point with llpt.
 boolean isPlotable(float lat, float lon)
          Checks if a LatLonPoint is plot-able.
 float normalize_latitude(float lat)
          Sets radian latitude to something sane.
 
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, getName, getPlanetPixelCircumference, getPlanetPixelRadius, getPlanetRadius, getPPM, getProjectionID, getProjectionType, getScale, getWidth, hashCode, init, inverse, inverse, isComplicatedLineType, isPlotable, makeClone, pan, 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

xycenter

protected java.awt.geom.Point2D.Double xycenter
Center of view as xy coordinates relative to the underlying projection


hy

protected int hy

wx

protected int wx

ppu

protected float ppu
Pixel per map unit. this is for a projection with a quadratic grid like utm


world

protected java.awt.Point world

half_world

protected int half_world

UTMType

public static final transient int UTMType
The UTMType number. Just a random int not used by any other.

See Also:
Constant Field Values
Constructor Detail

UTMProjection

public UTMProjection(LatLonPoint center,
                     float s,
                     int w,
                     int h,
                     int type,
                     int zone_number,
                     boolean isnorthern,
                     Ellipsoid ellps)
Method Detail

computeParameters

protected void computeParameters()
Description copied from class: Proj
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.

Specified by:
computeParameters in class Proj

normalize_latitude

public float normalize_latitude(float lat)
Description copied from class: Proj
Sets radian latitude to something sane.

Normalizes the latitude according to the particular projection.

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

forward

public java.awt.Point forward(LatLonPoint llp,
                              java.awt.Point pt)
Description copied from interface: Projection
Forward projects a LatLonPoint into XY space and return a Point.

Parameters:
llp - LatLonPoint to be projected
pt - Resulting XY Point
Returns:
Point pt

forward

public java.awt.Point forward(float lat,
                              float lon,
                              java.awt.Point pt)
Description copied from interface: Projection
Forward projects lat,lon coordinates into XY space and returns a Point.

Parameters:
lat - float latitude in decimal degrees
lon - float longitude in decimal degrees
pt - Resulting XY Point
Returns:
Point pt

forward

public java.awt.Point forward(float lat,
                              float lon,
                              java.awt.Point pt,
                              boolean isRadian)
Description copied from interface: Projection
Forward projects lat,lon coordinates into XY space and returns a Point.

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

inverse

public LatLonPoint inverse(java.awt.Point point,
                           LatLonPoint llpt)
Description copied from interface: Projection
Inverse project a point with llpt.

Parameters:
point - x,y Point
llpt - resulting LatLonPoint
Returns:
LatLonPoint llpt

inverse

public LatLonPoint inverse(int x,
                           int y,
                           LatLonPoint llpt)
Description copied from interface: Projection
Inverse project x,y coordinates into a LatLonPoint.

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

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.

isPlotable

public boolean isPlotable(float lat,
                          float lon)
Description copied from interface: Projection
Checks if a LatLonPoint is plot-able.

Call this to check and see if a LatLonPoint can be plotted. This is meant to be used for checking before projecting and rendering Point objects (bitmaps or text objects tacked at a LatLonPoint for instance).

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

_forwardPoly

protected java.util.ArrayList _forwardPoly(float[] rawllpts,
                                           int ltype,
                                           int nsegs,
                                           boolean isFilled)
Description copied from class: Proj
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?
Returns:
ArrayList 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)
Assume that the Graphics has been set with the Paint/Color needed, just render the shape of the background.

Specified by:
drawBackground in class Proj

forwardRaw

public boolean forwardRaw(float[] rawllpts,
                          int rawoff,
                          int[] xcoords,
                          int[] ycoords,
                          boolean[] visible,
                          int copyoff,
                          int copylen)
Description copied from interface: Projection
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.

getLowerRight

public LatLonPoint getLowerRight()
Description copied from interface: Projection
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

getUpperLeft

public LatLonPoint getUpperLeft()
Description copied from interface: Projection
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.

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

Returns:
LatLonPoint


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