com.bbn.openmap.proj
Class GeoProj

java.lang.Object
  extended by com.bbn.openmap.proj.Proj
      extended by com.bbn.openmap.proj.GeoProj
All Implemented Interfaces:
Projection, java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
AspectRatioProjection, Azimuth, Cylindrical, DatumShiftProjection, LambertConformal, UTMProjection

public abstract class GeoProj
extends Proj

GeoProj is the base class of all Projections that deal with coordinates on the world sphere.

You probably don't want to use this class unless you are hacking your own projections, or need extended functionality. To be safe you will want to use the Projection interface.

Notes:

See Also:
Projection, Cylindrical, Mercator, CADRG, Azimuth, Orthographic, Planet, GreatCircle, OMPoly, Serialized Form

Field Summary
static float DATELINE
          Dateline longitude in radians.
protected  Mercator mercator
           
static float NORTH_POLE
          North pole latitude in radians.
protected static int NUM_DEFAULT_CIRCLE_VERTS
           
protected static int NUM_DEFAULT_GREAT_SEGS
           
protected  double pixelsPerMeter
           
protected  double planetPixelCircumference
           
protected  double planetPixelRadius
           
protected  double planetRadius
           
protected  double scaled_radius
           
static float SOUTH_POLE
          South pole latitude in radians.
protected  int XSCALE_THRESHOLD
           
protected static int 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
GeoProj(LatLonPoint center, float s, int w, int h)
           
 
Method Summary
protected abstract  java.util.ArrayList<float[]> _forwardPoly(double[] rawllpts, int ltype, int nsegs, boolean isFilled)
          Forward project a lat/lon Poly.
protected abstract  java.util.ArrayList<float[]> _forwardPoly(float[] rawllpts, int ltype, int nsegs, boolean isFilled)
          Forward project a lat/lon Poly.
protected  LatLonPoint assertLatLonPoint(java.awt.geom.Point2D p2d)
          Returns the Point2D provided if it is a LatLonPoint, otherwise it creates a LatLonPoint.Double and transfers the values from the provided Point2D object.
 java.lang.Object clone()
          Copies this projection.
protected  java.util.ArrayList<float[]> doPolyDispatch(double[] rawllpts, int ltype, int nsegs, boolean isFilled)
          Generates a complicated poly.
protected  java.util.ArrayList<float[]> doPolyDispatch(float[] rawllpts, int ltype, int nsegs, boolean isFilled)
          Generates a complicated poly.
 java.awt.geom.Point2D forward(double lat, double lon, java.awt.geom.Point2D pt)
          Project the point into view space.
abstract  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(float lat, float lon, java.awt.geom.Point2D pt, boolean isRadian)
          Project the point into view space.
 java.awt.geom.Point2D forward(java.awt.geom.Point2D llp)
          Forward project a LatLonPoint.
 java.awt.geom.Point2D forward(java.awt.geom.Point2D llp, java.awt.geom.Point2D pt)
          Forward project a point.
 java.util.ArrayList<float[]> forwardArc(LatLonPoint c, boolean radians, double radius, double start, double extent)
          Forward project an arc.
 java.util.ArrayList<float[]> forwardArc(LatLonPoint c, boolean radians, double radius, int nverts, double start, double extent)
           
 java.util.ArrayList<float[]> forwardArc(LatLonPoint c, boolean radians, double radius, int nverts, double start, double extent, int arcType)
          Forward project a Lat/Lon Arc.
 java.util.ArrayList<float[]> forwardCircle(LatLonPoint c, boolean radians, double radius)
          Forward project a circle.
 java.util.ArrayList<float[]> forwardCircle(LatLonPoint c, boolean radians, double radius, int nverts)
          Forward project a Lat/Lon Circle.
 java.util.ArrayList<float[]> forwardCircle(LatLonPoint c, boolean radians, double radius, int nverts, boolean isFilled)
          Forward project a Lat/Lon Circle.
protected  java.util.ArrayList<float[]> forwardGreatPoly(double[] rawllpts, int nsegs, boolean isFilled)
          Forward project a greatcircle poly.
protected  java.util.ArrayList<float[]> forwardGreatPoly(float[] rawllpts, int nsegs, boolean isFilled)
          Forward project a greatcircle poly.
 java.util.ArrayList<float[]> forwardLine(LatLonPoint ll1, LatLonPoint ll2, int ltype)
          Forward project a lat/lon Line.
 java.util.ArrayList<float[]> forwardLine(LatLonPoint ll1, LatLonPoint ll2, int ltype, int nsegs)
          Forward project a LatLon Line.
 java.util.ArrayList<float[]> forwardLLPoly(double[] llpts, int ltype, int nsegs, boolean isFilled)
          Forward project a lat/lon Poly defined as decimal degree lat/lons.
 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 LatLon Poly.
 java.util.ArrayList<float[]> forwardRect(LatLonPoint ll1, LatLonPoint ll2, int ltype)
          Forward project a lat/lon Rectangle.
 java.util.ArrayList<float[]> forwardRect(LatLonPoint ll1, LatLonPoint ll2, int ltype, int nsegs)
          Forward project a lat/lon Rectangle.
 java.util.ArrayList<float[]> forwardRect(LatLonPoint ll1, LatLonPoint ll2, int ltype, int nsegs, boolean isFilled)
          Forward project a rectangle defined by an upper left point and a lower right point.
protected  java.util.ArrayList<float[]> forwardRhumbPoly(double[] rawllpts, int nsegs, boolean isFilled)
          Forward project a rhumbline poly.
protected  java.util.ArrayList<float[]> forwardRhumbPoly(float[] rawllpts, int nsegs, boolean isFilled)
          Forward project a rhumbline poly.
 LatLonPoint getCenter()
          Get center point of projection.
<T extends java.awt.geom.Point2D>
T
getCenter(T center)
          Returns a center LatLonPoint that was provided, with the location filled into the LatLonPoint object.
<T extends GeoCoordTransformation>
T
getGCTForProjection()
          Convenience method to create a GCT for this projection.
 double getPlanetPixelCircumference()
          Get the planet pixel circumference.
 double getPlanetPixelRadius()
          Get the planet pixel radius.
 double getPlanetRadius()
          Get the planet radius.
 double getPPM()
          Get the pixels-per-meter constant.
 double getReferenceLon()
           
 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.
 Length getUcuom()
          Get the unprojected coordinates units of measure.
protected  void init()
          Called after the center and scale is set in setParams, but before the scale is checked for legitimacy.
 LatLonPoint inverse(double x, double y)
          Inverse project x,y coordinates.
 LatLonPoint inverse(java.awt.geom.Point2D point)
          Inverse project a Point from x,y space to LatLon space.
 boolean isComplicatedLineType(int ltype)
          Check for complicated linetypes.
 boolean isPlotable(java.awt.geom.Point2D point)
          Checks if a point is plot-able.
 double normalize_latitude(double lat)
          Deprecated. use normalizeLatitude() instead.
abstract  double normalizeLatitude(double lat)
           
 float normalizeLatitude(float lat)
          Sets radian latitude to something sane.
 void pan(double Az)
          Pan the map/projection.
 void pan(double Az, double c)
          Pan the map/projection.
 void setCenter(double lat, double lon)
          Set center point of projection.
 void setCenter(double lat, double lon, boolean isRadians)
          Set center point of projection.
 void setCenter(float lat, float lon)
          Set center point of projection.
 void setPlanetRadius(double radius)
          Set the planet radius.
 void setPPM(double ppm)
          Set the pixels per meter constant.
 void setUcuom(Length ucuom)
          Can't set the unprojected coordinates units of measure for a GeoProj, it's always Length.DECIMAL_DEGREE.
 java.lang.String toString()
          Stringify the projection.
static double wrap_longitude(double lon)
          Deprecated. use wrapLongitude() instead.
static double wrapLongitude(double lon)
           
static float wrapLongitude(float lon)
          Sets radian longitude to something sane.
static double wrapLongitudeDeg(double lon)
           
 
Methods inherited from class com.bbn.openmap.proj.Proj
computeParameters, drawBackground, drawBackground, equals, forward, forward, forward, forwardLine, forwardPoly, forwardPoly, forwardRaw, forwardRaw, forwardRect, forwardShape, getHeight, getLowerRight, getMaxScale, getMinScale, getName, getProjectionID, getRotationAngle, getScale, getUpperLeft, getWidth, hashCode, inverse, inverse, inverseShape, isPlotable, 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

NUM_DEFAULT_CIRCLE_VERTS

protected static transient int NUM_DEFAULT_CIRCLE_VERTS

NORTH_POLE

public static final transient float NORTH_POLE
North pole latitude in radians.

See Also:
Constant Field Values

SOUTH_POLE

public static final transient float SOUTH_POLE
South pole latitude in radians.

See Also:
Constant Field Values

DATELINE

public static final transient float DATELINE
Dateline longitude in radians.

See Also:
Constant Field Values

NUM_DEFAULT_GREAT_SEGS

protected static transient int NUM_DEFAULT_GREAT_SEGS

pixelsPerMeter

protected double pixelsPerMeter

planetRadius

protected double planetRadius

planetPixelRadius

protected double planetPixelRadius

planetPixelCircumference

protected double planetPixelCircumference

scaled_radius

protected double scaled_radius

mercator

protected Mercator mercator

XTHRESHOLD

protected static transient int XTHRESHOLD

XSCALE_THRESHOLD

protected transient int XSCALE_THRESHOLD
Constructor Detail

GeoProj

public GeoProj(LatLonPoint center,
               float s,
               int w,
               int h)
Method Detail

init

protected void init()
Description copied from class: Proj
Called after the center and scale is set in setParams, but before the scale is checked for legitimacy. This is an opportunity to set constants in subclasses before anything else gets called or checked for validity. This is different than computeParameters() which is called after some checks. This is a good time to pre-calculate constants and set maxscale and minscale.

Make sure you call super.init() if you override this method.

Overrides:
init in class Proj

setPPM

public void setPPM(double ppm)
Set the pixels per meter constant.

Parameters:
ppm - int Pixels Per Meter scale-factor constant

getPPM

public double getPPM()
Get the pixels-per-meter constant.

Returns:
int Pixels Per Meter scale-factor constant

setPlanetRadius

public void setPlanetRadius(double radius)
Set the planet radius.

Parameters:
radius - float planet radius in meters

getPlanetRadius

public double getPlanetRadius()
Get the planet radius.

Returns:
float radius of planet in meters

getPlanetPixelRadius

public double getPlanetPixelRadius()
Get the planet pixel radius.

Returns:
float radius of planet in pixels

getPlanetPixelCircumference

public double getPlanetPixelCircumference()
Get the planet pixel circumference.

Returns:
float circumference of planet in pixels

setCenter

public void setCenter(float lat,
                      float lon)
Set center point of projection.

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

setCenter

public void setCenter(double lat,
                      double lon)
Set center point of projection.

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

setCenter

public void setCenter(double lat,
                      double lon,
                      boolean isRadians)
Set center point of projection.

Parameters:
lat - double latitude in decimal degrees
lon - double longitude in decimal degrees

getCenter

public LatLonPoint getCenter()
Get center point of projection.

Specified by:
getCenter in interface Projection
Overrides:
getCenter in class Proj
Returns:
LatLonPoint center of projection, created just for you.

getCenter

public <T extends java.awt.geom.Point2D> T getCenter(T center)
Returns a center LatLonPoint that was provided, with the location filled into the LatLonPoint object. Calls Point2D.setLocation(x, y).

Specified by:
getCenter in interface Projection
Overrides:
getCenter in class Proj
Parameters:
center - the Point2D to fill in.
Returns:
center point provided.

normalizeLatitude

public float normalizeLatitude(float lat)
Sets radian latitude to something sane.

Normalizes the latitude according to the particular projection.

Parameters:
lat - float latitude in radians
Returns:
float latitude (-PI/2 <= y <= PI/2)
See Also:
ProjMath.normalizeLatitude(float, float), LatLonPoint.normalizeLatitude(float)

normalizeLatitude

public abstract double normalizeLatitude(double lat)

wrapLongitude

public static final float wrapLongitude(float lon)
Sets radian longitude to something sane.

Parameters:
lon - float longitude in radians
Returns:
float longitude (-PI <= x < PI)
See Also:
ProjMath.wrapLongitude(float), LatLonPoint.wrapLongitude(float)

wrapLongitude

public static final double wrapLongitude(double lon)

wrapLongitudeDeg

public static final double wrapLongitudeDeg(double lon)

normalize_latitude

public final double normalize_latitude(double lat)
Deprecated. use normalizeLatitude() instead.


wrap_longitude

public static final double wrap_longitude(double lon)
Deprecated. use wrapLongitude() instead.


pan

public void pan(double Az,
                double c)
Pan the map/projection.

Example pans:

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

pan

public void pan(double Az)
Pan the map/projection. Figures on an ellipse based around the center of the map in the direction provided.

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

toString

public java.lang.String toString()
Stringify the projection.

Overrides:
toString in class Proj
Returns:
stringified projection
See Also:
Proj.getProjectionID()

clone

public java.lang.Object clone()
Copies this projection.

Overrides:
clone in class Proj
Returns:
a copy of this projection.

isPlotable

public boolean isPlotable(java.awt.geom.Point2D point)
Description copied from interface: Projection
Checks if a point is plot-able.

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

Specified by:
isPlotable in interface Projection
Overrides:
isPlotable in class Proj
Parameters:
point - Point2D
Returns:
boolean

forwardRhumbPoly

protected java.util.ArrayList<float[]> forwardRhumbPoly(float[] rawllpts,
                                                        int nsegs,
                                                        boolean isFilled)
Forward project a rhumbline poly.

Draws rhumb lines between vertices of poly. Remember to specify vertices in radians! Check in-code comments for details about the algorithm.

Parameters:
rawllpts - float[] of lat,lon,lat,lon,... in RADIANS!
nsegs - number of segments to draw for greatcircle or rhumb lines (if < 1, this value is generated internally).
isFilled - filled poly?
Returns:
ArrayList float[] of x[], y[], x[], y[], ... projected poly

forwardRhumbPoly

protected java.util.ArrayList<float[]> forwardRhumbPoly(double[] rawllpts,
                                                        int nsegs,
                                                        boolean isFilled)
Forward project a rhumbline poly.

Draws rhumb lines between vertices of poly. Remember to specify vertices in radians! Check in-code comments for details about the algorithm.

Parameters:
rawllpts - double[] of lat,lon,lat,lon,... in RADIANS!
nsegs - number of segments to draw for greatcircle or rhumb lines (if < 1, this value is generated internally).
isFilled - filled poly?
Returns:
ArrayList float[] of x[], y[], x[], y[], ... projected poly

forwardGreatPoly

protected java.util.ArrayList<float[]> forwardGreatPoly(float[] rawllpts,
                                                        int nsegs,
                                                        boolean isFilled)
Forward project a greatcircle poly.

Draws great circle lines between vertices of poly. Remember to specify vertices in radians!

Parameters:
rawllpts - float[] of lat,lon,lat,lon,... in RADIANS!
nsegs - number of segments to draw for greatcircle or rhumb lines (if < 1, this value is generated internally).
isFilled - filled poly?
Returns:
ArrayList float[] of x[], y[], x[], y[], ... projected poly

forwardGreatPoly

protected java.util.ArrayList<float[]> forwardGreatPoly(double[] rawllpts,
                                                        int nsegs,
                                                        boolean isFilled)
Forward project a greatcircle poly.

Draws great circle lines between vertices of poly. Remember to specify vertices in radians!

Parameters:
rawllpts - float[] of lat,lon,lat,lon,... in RADIANS!
nsegs - number of segments to draw for greatcircle or rhumb lines (if < 1, this value is generated internally).
isFilled - filled poly?
Returns:
ArrayList float[] of x[], y[], x[], y[], ... projected poly

isComplicatedLineType

public boolean isComplicatedLineType(int ltype)
Check for complicated linetypes.

This depends on the line and this projection.

Parameters:
ltype - int LineType
Returns:
boolean

doPolyDispatch

protected java.util.ArrayList<float[]> doPolyDispatch(float[] rawllpts,
                                                      int ltype,
                                                      int nsegs,
                                                      boolean isFilled)
Generates a complicated poly.

Parameters:
rawllpts - LatLonPofloat[]
ltype - line type
nsegs - number of segments to draw for greatcircle or rhumb lines (if < 1, this value is generated internally).
isFilled - filled poly?
Returns:
ArrayList

doPolyDispatch

protected java.util.ArrayList<float[]> doPolyDispatch(double[] rawllpts,
                                                      int ltype,
                                                      int nsegs,
                                                      boolean isFilled)
Generates a complicated poly.

Parameters:
rawllpts - LatLonPofloat[]
ltype - line type
nsegs - number of segments to draw for greatcircle or rhumb lines (if < 1, this value is generated internally).
isFilled - filled poly?
Returns:
ArrayList int[]

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
Specified by:
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.

forward

public java.awt.geom.Point2D forward(java.awt.geom.Point2D llp,
                                     java.awt.geom.Point2D pt)
Forward project a point.

Specified by:
forward in interface Projection
Overrides:
forward in class Proj
Parameters:
llp - LatLonPoint to be projected
pt - Resulting XY Point2D
Returns:
Point2D pt

forward

public java.awt.geom.Point2D forward(java.awt.geom.Point2D llp)
Forward project a LatLonPoint.

Forward projects a LatLon point into XY space. Returns a Point.

Specified by:
forward in interface Projection
Overrides:
forward in class Proj
Parameters:
llp - LatLonPoint to be projected
Returns:
Point (new)

forward

public java.awt.geom.Point2D forward(double lat,
                                     double lon,
                                     java.awt.geom.Point2D pt)
Project the point into view space.

Specified by:
forward in interface Projection
Specified by:
forward in class Proj
Parameters:
lat - latitude in decimal degrees.
lon - longitue in decimal degrees.
pt - A Point2D object to load the result into, a new Point2D object will be created if this is null.
Returns:
Point2D The Point2D object provided (for convenience) or created with the result.

forward

public java.awt.geom.Point2D forward(float lat,
                                     float lon,
                                     java.awt.geom.Point2D pt,
                                     boolean isRadian)
Project the point into view space.

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 abstract java.awt.geom.Point2D forward(double lat,
                                              double lon,
                                              java.awt.geom.Point2D pt,
                                              boolean isRadian)
Project the point into view space.

Parameters:
lat - latitude
lon - longitude
pt - return point
isRadian - true if lat/lon are radians instead of decimal degrees
Returns:
Point2D for projected point

inverse

public LatLonPoint inverse(java.awt.geom.Point2D point)
Inverse project a Point from x,y space to LatLon space.

Specified by:
inverse in interface Projection
Overrides:
inverse in class Proj
Parameters:
point - x,y Point
Returns:
LatLonPoint (new)

inverse

public LatLonPoint inverse(double x,
                           double y)
Inverse project x,y coordinates.

Specified by:
inverse in interface Projection
Overrides:
inverse in class Proj
Parameters:
x - integer x coordinate
y - integer y coordinate
Returns:
LatLonPoint (new)
See Also:
inverse(Point2D)

assertLatLonPoint

protected LatLonPoint assertLatLonPoint(java.awt.geom.Point2D p2d)
Returns the Point2D provided if it is a LatLonPoint, otherwise it creates a LatLonPoint.Double and transfers the values from the provided Point2D object.


forwardLine

public java.util.ArrayList<float[]> forwardLine(LatLonPoint ll1,
                                                LatLonPoint ll2,
                                                int ltype,
                                                int nsegs)
Forward project a LatLon Line.

Returns a ArrayList of (x[], y[]) coordinate pair(s) of the projected line(s). RESTRICTIONS: A line segment must be less than 180 degrees of arc (half the circumference of the world). If you need to draw a longer line, then draw several several individual segments of less than 180 degrees, or draw a single polyline of those segments.

We make this restriction because from any point on a sphere, you can reach any other point with a maximum traversal of 180degrees of arc.

Furthermore, for the Cylindrical family of projections, a line must be < 180 degrees of arc in longitudinal extent. In other words, the difference of longitudes between both vertices must be < 180 degrees. Same as above: if you need a long line, you must break it into several segments.

Parameters:
ll1 - LatLonPoint
ll2 - LatLonPoint
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)
Returns:
ArrayList int[]
See Also:
LineType.Straight, LineType.Rhumb, LineType.GreatCircle

forwardLine

public java.util.ArrayList<float[]> forwardLine(LatLonPoint ll1,
                                                LatLonPoint ll2,
                                                int ltype)
Forward project a lat/lon Line.

See Also:
forwardLine(LatLonPoint, LatLonPoint, int, int)

forwardRect

public java.util.ArrayList<float[]> forwardRect(LatLonPoint ll1,
                                                LatLonPoint ll2,
                                                int ltype,
                                                int nsegs,
                                                boolean isFilled)
Forward project a rectangle defined by an upper left point and a lower right point.

Returns a ArrayList of (x[], y[]) coordinate pairs of the projected points.

Rects have the same restrictions as polys and lines .

Parameters:
ll1 - LatLonPoint of northwest corner
ll2 - LatLonPoint of southeast corner
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)
Returns:
ArrayList int[]
See Also:
forwardPoly(float[], int, int, boolean)

forwardRect

public java.util.ArrayList<float[]> forwardRect(LatLonPoint ll1,
                                                LatLonPoint ll2,
                                                int ltype)
Forward project a lat/lon Rectangle.

See Also:
forwardRect(LatLonPoint, LatLonPoint, int, int)

forwardRect

public java.util.ArrayList<float[]> forwardRect(LatLonPoint ll1,
                                                LatLonPoint ll2,
                                                int ltype,
                                                int nsegs)
Forward project a lat/lon Rectangle. *

Parameters:
ll1 - LatLonPoint of northwest corner
ll2 - LatLonPoint of southeast corner
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)
See Also:
forwardRect(LatLonPoint, LatLonPoint, int, int)

forwardArc

public java.util.ArrayList<float[]> forwardArc(LatLonPoint c,
                                               boolean radians,
                                               double radius,
                                               double start,
                                               double extent)
Forward project an arc.

Parameters:
c - LatLonPoint center
radians - boolean radius in radians?
radius - radius in radians or decimal degrees
start - the starting angle of the arc, zero being North up. Units are dependent on radians parameter - the start parameter is in radians if radians equals true, decimal degrees if not.
extent - the angular extent angle of the arc, zero being no length. Units are dependent on radians parameter - the extent parameter is in radians if radians equals true, decimal degrees if not.

forwardArc

public java.util.ArrayList<float[]> forwardArc(LatLonPoint c,
                                               boolean radians,
                                               double radius,
                                               int nverts,
                                               double start,
                                               double extent)

forwardArc

public java.util.ArrayList<float[]> forwardArc(LatLonPoint c,
                                               boolean radians,
                                               double radius,
                                               int nverts,
                                               double start,
                                               double extent,
                                               int arcType)
Forward project a Lat/Lon Arc.

Arcs have the same restrictions as polys .

Parameters:
c - LatLonPoint center of circle
radians - radius in radians or decimal degrees?
radius - radius of circle (0 < radius < 180)
nverts - number of vertices of the circle poly.
start - the starting angle of the arc, zero being North up. Units are dependent on radians parameter - the start parameter is in radians if radians equals true, decimal degrees if not.
extent - the angular extent angle of the arc, zero being no length. Units are dependent on radians parameter - the extent parameter is in radians if radians equals true, decimal degrees if not.
arcType - type of arc to create - see java.awt.geom.Arc2D for (OPEN, CHORD, PIE). Arc2D.OPEN means that the just the points for the curved edge will be provided. Arc2D.PIE means that addition lines from the edge of the curve to the center point will be added. Arc2D.CHORD means a single line from each end of the curve will be drawn.

forwardCircle

public java.util.ArrayList<float[]> forwardCircle(LatLonPoint c,
                                                  boolean radians,
                                                  double radius)
Forward project a circle.

Parameters:
c - LatLonPoint center
radians - boolean radius in radians?
radius - radius in radians or decimal degrees

forwardCircle

public java.util.ArrayList<float[]> forwardCircle(LatLonPoint c,
                                                  boolean radians,
                                                  double radius,
                                                  int nverts)
Forward project a Lat/Lon Circle.

Circles have the same restrictions as polys. .

Parameters:
c - LatLonPoint center of circle
radians - radius in radians or decimal degrees?
radius - radius of circle (0 < radius < 180)
nverts - number of vertices of the circle poly.

forwardCircle

public java.util.ArrayList<float[]> forwardCircle(LatLonPoint c,
                                                  boolean radians,
                                                  double radius,
                                                  int nverts,
                                                  boolean isFilled)
Forward project a Lat/Lon Circle.

Circles have the same restrictions as polys. .

Parameters:
c - LatLonPoint center of circle
radians - radius in radians or decimal degrees?
radius - radius of circle (0 < radius < 180)
nverts - number of vertices of the circle poly.
isFilled - filled poly?

forwardPoly

public java.util.ArrayList<float[]> forwardPoly(float[] rawllpts,
                                                int ltype,
                                                int nsegs,
                                                boolean isFilled)
Forward project a LatLon Poly.

Returns a ArrayList of (x[], y[]) coordinate pair(s) of the projected poly. RESTRICTIONS: All the following restrictions apply to LatLon polygons (either filled or non-filled). Many of these restrictions apply to other poly-like ArrayList graphics (Lines, Rectangles, Circles, Ellipses, ...). See also restrictions on LatLon lines.

For the cylindrical projections, (e.g. Mercator), your polygons should not include or touch the poles. This is because a polygon or polyline that includes a pole becomes a non-continuous straight line on the map. "So what about Antarctica", you say, "after all it's a polygon that is draped over the South Pole". Well, if you want to see it in a cylindrical projection, you will need to "augment" the vertices to turn it into a valid x-y polygon. You could do this by removing the segment which crosses the dateline, and instead add two extra edges down along both sides of the dateline to very near the south pole and then connect these ends back the other way around the world (not across the dateline) with a few extra line segments (remember the line length restrictions ). This way you've removed the polar anomaly from the data set. On the screen, all you see is a sliver artifact down along the dateline. This is the very method that our DCW data server shows Antarctica.

There is a fundamental ambiguity with filled polygons on a sphere: which side do you draw the fill-color? The Cylindrical family will draw the polygon as if it were in x-y space. For the Azimuthal projections, (e.g. Orthographic), you can have polygons that cover the pole, but it's important to specify the vertices in a clockwise order so that we can do the correct clipping along the hemisphere edge. We traverse the vertices assuming that the fill will be to the right hand side if the polygon straddles the edge of the projection. (This default can be changed).

To Be (Mostly) Safe:

Optimization Notes:

The projection library deals internally in radians, and so you're required to pass in an array of radian points. See ProjMath.arrayDegToRad(float[]) for an efficient in-place conversion.

For no-frills, no-assumptions, fast and efficient projecting, see forwardRaw() .

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 - poly is filled? or not
Returns:
ArrayList of x[], y[], x[], y[], ... projected poly
See Also:
Proj.forwardRaw(float[], int, float[], float[], boolean[], int, int), LineType.Straight, LineType.Rhumb, LineType.GreatCircle

forwardPoly

public java.util.ArrayList<float[]> forwardPoly(double[] rawllpts,
                                                int ltype,
                                                int nsegs,
                                                boolean isFilled)
Forward project a lat/lon Poly.

Delegates to _forwardPoly(), and may do additional clipping for Java XWindows problem. Remember to specify vertices in radians!

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
See Also:
Proj.forwardRaw(float[], int, float[], float[], boolean[], int, int), LineType.Straight, LineType.Rhumb, LineType.GreatCircle

forwardLLPoly

public java.util.ArrayList<float[]> forwardLLPoly(double[] llpts,
                                                  int ltype,
                                                  int nsegs,
                                                  boolean isFilled)
Forward project a lat/lon Poly defined as decimal degree lat/lons.

Delegates to _forwardPoly(), and may do additional clipping for Java XWindows problem. Remember to specify vertices in decimal degrees. If you have radians, use them and call forwardPoly, it's faster. This method will convert the coords to radians before calling the fowardPoly method.

Parameters:
llpts - double[] of lat,lon,lat,lon,... in decimal degree lat/lon!
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
See Also:
Proj.forwardRaw(float[], int, float[], float[], boolean[], int, int), LineType.Straight, LineType.Rhumb, LineType.GreatCircle

_forwardPoly

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

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 abstract java.util.ArrayList<float[]> _forwardPoly(double[] rawllpts,
                                                             int ltype,
                                                             int nsegs,
                                                             boolean isFilled)
Forward project a lat/lon Poly. Remember to specify vertices in radians!

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

getUcuom

public Length getUcuom()
Get the unprojected coordinates units of measure.

Specified by:
getUcuom in interface Projection
Overrides:
getUcuom in class Proj
Returns:
Length.DECIMAL_DEGREE
See Also:
Length

setUcuom

public void setUcuom(Length ucuom)
Can't set the unprojected coordinates units of measure for a GeoProj, it's always Length.DECIMAL_DEGREE.

Overrides:
setUcuom in class Proj
Parameters:
ucuom -

getGCTForProjection

public <T extends GeoCoordTransformation> T 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.

Returns:
GeoCoordTransformation for this projection

getReferenceLon

public double getReferenceLon()
Returns:
the reference longitude of the projection. For most projections, it'll just be the center point longitude. For LLC, it'll be the reference meridian.


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