com.bbn.openmap.proj
Class UTMProjection

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

public class UTMProjection
extends GeoProj

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

See Also:
Serialized Form

Field Summary
protected  Ellipsoid ellps
           
protected static double epsilon
           
protected  int half_world
           
protected  double hy
           
protected  boolean northern
           
protected  double ppu
          Pixel per map unit.
protected  java.awt.Point world
           
protected  double wx
           
protected  java.awt.geom.Point2D.Double xycenter
          Center of view as xy coordinates relative to the underlying projection
protected  int zoneNumber
           
 
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
UTMProjection(LatLonPoint center, float s, int w, int h, int zone_number, boolean isnorthern, Ellipsoid ellps)
           
 
Method Summary
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 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.geom.Point2D forward(double lat, double lon, java.awt.geom.Point2D pt, boolean isRadian)
          Project the point into view space.
 java.awt.geom.Point2D forward(double lat, double lon, java.awt.geom.Point2D pt, boolean isRadian, UTMPoint utmPoint)
           
 java.awt.geom.Point2D forward(LatLonPoint llp, java.awt.geom.Point2D pt)
           
 boolean forwardRaw(float[] rawllpts, int rawoff, int[] xcoords, int[] ycoords, boolean[] visible, int copyoff, int copylen)
           
 Ellipsoid getEllps()
           
 UTMGCT getGCTForProjection()
          Convenience method to create a GCT for this projection.
 LatLonPoint getLowerRight()
          Get the world coordinate of the lower right corner of the map.
 float getScale(java.awt.geom.Point2D ll1, java.awt.geom.Point2D ll2, java.awt.geom.Point2D point1, java.awt.geom.Point2D 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 world coordinate of the upper left corner of the map.
 int getZoneNumber()
           
<T extends java.awt.geom.Point2D>
T
inverse(double x, double y, T llpt)
          Inverse project x,y coordinates into world coordinates.
 boolean isNorthern()
           
 boolean isPlotable(double lat, double lon)
          Checks if a location is plot-able.
 double normalizeLatitude(double lat)
          Sets radian latitude to something sane.
 void setEllps(Ellipsoid ellps)
           
 void setNorthern(boolean northern)
           
 void setZoneNumber(int zoneNumber)
           
 
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, getPlanetPixelCircumference, getPlanetPixelRadius, getPlanetRadius, getPPM, getReferenceLon, getUcuom, init, inverse, inverse, isComplicatedLineType, isPlotable, normalize_latitude, normalizeLatitude, pan, pan, setCenter, setCenter, setCenter, setPlanetRadius, setPPM, setUcuom, toString, wrap_longitude, wrapLongitude, wrapLongitude, wrapLongitudeDeg
 
Methods inherited from class com.bbn.openmap.proj.Proj
equals, forward, forward, forward, forwardLine, forwardPoly, forwardPoly, forwardRaw, forwardRaw, forwardRect, forwardShape, getHeight, getMaxScale, getMinScale, getName, 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

xycenter

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


hy

protected double hy

wx

protected double wx

ppu

protected double 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

zoneNumber

protected int zoneNumber

northern

protected boolean northern

ellps

protected Ellipsoid ellps

epsilon

protected static double epsilon
Constructor Detail

UTMProjection

public UTMProjection(LatLonPoint center,
                     float s,
                     int w,
                     int h,
                     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" parameters used in the forward() and inverse() calls.

Specified by:
computeParameters in class Proj

forward

public java.awt.geom.Point2D forward(LatLonPoint llp,
                                     java.awt.geom.Point2D pt)

forward

public java.awt.geom.Point2D forward(double lat,
                                     double lon,
                                     java.awt.geom.Point2D pt,
                                     boolean isRadian)
Description copied from class: GeoProj
Project the point into view space.

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

public java.awt.geom.Point2D forward(double lat,
                                     double lon,
                                     java.awt.geom.Point2D pt,
                                     boolean isRadian,
                                     UTMPoint utmPoint)

inverse

public <T extends java.awt.geom.Point2D> T inverse(double x,
                                                   double y,
                                                   T llpt)
Description copied from interface: Projection
Inverse project x,y coordinates into world coordinates.

Specified by:
inverse in interface Projection
Specified by:
inverse in class Proj
Parameters:
x - integer x coordinate
y - integer y coordinate
llpt - Point2D to be loaded with the result. A new Point2D object will be created if this is null.
Returns:
Point2D llpt
See Also:
Proj.inverse(Point2D)

getScale

public float getScale(java.awt.geom.Point2D ll1,
                      java.awt.geom.Point2D ll2,
                      java.awt.geom.Point2D point1,
                      java.awt.geom.Point2D 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 GeoProj
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.

_forwardPoly

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

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)
Description copied from class: GeoProj
Forward project a lat/lon Poly. Remember to specify vertices in radians!

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

drawBackground

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

Overrides:
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.

Overrides:
drawBackground in class Proj
Parameters:
g - Graphics

forwardRaw

public boolean forwardRaw(float[] rawllpts,
                          int rawoff,
                          int[] xcoords,
                          int[] ycoords,
                          boolean[] visible,
                          int copyoff,
                          int copylen)

getLowerRight

public LatLonPoint getLowerRight()
Description copied from class: Proj
Get the world coordinate of the lower right corner of the map.

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

getUpperLeft

public LatLonPoint getUpperLeft()
Description copied from class: Proj
Get the world coordinate of the upper left corner of the map.

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

getZoneNumber

public int getZoneNumber()

setZoneNumber

public void setZoneNumber(int zoneNumber)

isNorthern

public boolean isNorthern()

setNorthern

public void setNorthern(boolean northern)

getEllps

public Ellipsoid getEllps()

setEllps

public void setEllps(Ellipsoid ellps)

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)

isPlotable

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

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

Specified by:
isPlotable in interface Projection
Overrides:
isPlotable in class Proj
Parameters:
lat - vertical location component (units depend on the projection implementation).
lon - horizontal location component (units depend on the projection implementation).
Returns:
boolean true of plotable.

getGCTForProjection

public UTMGCT getGCTForProjection()
Convenience method to create a GCT for this projection. For projections that start with lat/lon coordinates, this will return a LatLonGCT. For projections that have world coordinates in meters, the GCT will provide a way to get to those meter coordinates. For instance, a UTMProjection will return a UTMGCT.

Overrides:
getGCTForProjection in class GeoProj
Returns:
UTMGCT for current projection


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