com.bbn.openmap.proj
Class DatumShiftProjection

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

public class DatumShiftProjection
extends GeoProj

This projection wraps another projection and adds datum handling. The motivation for this projection is to be able to serve wms clients requesting maps in a datum different from wgs84.

The underlying data is supposed to be wgs4. The given DatumShiftGCT convert this to another datum before using the wrapped projection to calculate the screen coordinates.

LatLonPoint as input or output of any of the methods in this class is in wgs84. Internally, each method will convert datums as needed.

A user (like wms) of this projection will use a CoordinateReferenceSystem to convert coordinates to wgs84 before using this method.

See Also:
Serialized Form

Field Summary
 
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
DatumShiftProjection(GeoProj proj, DatumShiftGCT datum)
           
 
Method Summary
protected  java.util.ArrayList<float[]> _forwardPoly(double[] rawllpts, int ltype, int nsegs, boolean isFilled)
          Forward project a lat/lon Poly.
 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)
          Draw the background for the projection.
 void drawBackground(java.awt.Graphics2D g, java.awt.Paint p)
          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.
 boolean forwardRaw(float[] rawllpts, int rawoff, float[] xcoords, float[] ycoords, boolean[] visible, int copyoff, int copylen)
          Forward project a raw array of points.
 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.
 LatLonPoint inverse(double x, double y, java.awt.geom.Point2D pt)
          Inverse project x,y coordinates into world coordinates.
 boolean isPlotable(double lat, double lon)
          Checks if a location is plot-able.
 double normalizeLatitude(double lat)
           
 void setCenter(double lat, double lon)
          Set center point of projection.
 
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, getUcuom, init, inverse, inverse, isComplicatedLineType, isPlotable, normalize_latitude, normalizeLatitude, pan, pan, 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, 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
 

Constructor Detail

DatumShiftProjection

public DatumShiftProjection(GeoProj proj,
                            DatumShiftGCT datum)
Method Detail

setCenter

public void setCenter(double lat,
                      double lon)
Description copied from class: GeoProj
Set center point of projection.

Overrides:
setCenter in class GeoProj
Parameters:
lat - double latitude in decimal degrees
lon - double longitude in decimal degrees

_forwardPoly

public 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

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

drawBackground

public void drawBackground(java.awt.Graphics2D g,
                           java.awt.Paint p)
Description copied from class: Proj
Draw the background for the projection.

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

drawBackground

public void drawBackground(java.awt.Graphics g)
Description copied from class: Proj
Draw the background for the projection. 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

normalizeLatitude

public double normalizeLatitude(double lat)
Specified by:
normalizeLatitude in class GeoProj

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

forwardRaw

public boolean forwardRaw(float[] rawllpts,
                          int rawoff,
                          float[] xcoords,
                          float[] ycoords,
                          boolean[] visible,
                          int copyoff,
                          int copylen)
Description copied from class: Proj
Forward project a raw array of 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.

Specified by:
forwardRaw in interface Projection
Overrides:
forwardRaw in class Proj
Parameters:
rawllpts - array of y, x world coordinates.
rawoff - offset into rawllpts.
xcoords - x projected horizontal map coordinates.
ycoords - y projected vertical map 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 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

inverse

public LatLonPoint inverse(double x,
                           double y,
                           java.awt.geom.Point2D pt)
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
pt - 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)

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.

getScale

public float getScale(java.awt.geom.Point2D ll1,
                      java.awt.geom.Point2D ll2,
                      java.awt.geom.Point2D point1,
                      java.awt.geom.Point2D point2)
Description copied from class: GeoProj
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.


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