com.bbn.openmap.proj
Interface Projection

All Superinterfaces:
java.io.Serializable
All Known Subinterfaces:
EqualArc
All Known Implementing Classes:
AspectRatioProjection, Azimuth, CADRG, Cartesian, Cylindrical, DatumShiftProjection, GeoProj, Gnomonic, LambertConformal, LLXY, Mercator, Orthographic, Proj, UTMProjection

public interface Projection
extends java.io.Serializable

Projection interface to the OpenMap projection library.

This is a READONLY interface to the projection object. See the Proj class for read/write access.

A projection is an object that is maintained by the map, and represents a abstract "view" of the data. The projection has the properties of x-width, * y-height, scale (in pixels/meters), and a x/y center point that is in different units, depending on the projection implementation.

Projection Notes/Assumptions:

Implementation Notes:

Bibliography:
Many of the specific projection equations were taken from Map Projections --A Working Manual , by John Synder.

See Also:
Proj, Cylindrical, Mercator, CADRG, Azimuth, Orthographic, Cartesian, GeoProj

Method Summary
 java.awt.geom.Point2D forward(double lat, double lon)
          Forward project y, x world coordinates into xy space.
 java.awt.geom.Point2D forward(double lat, double lon, java.awt.geom.Point2D pt)
          Forward projects y, x world coordinates into XY space and returns a Point2D.
 java.awt.geom.Point2D forward(float lat, float lon)
          Forward project y, x world coordinates into xy space.
 java.awt.geom.Point2D forward(float lat, float lon, java.awt.geom.Point2D pt)
          Forward projects y, x world coordinates into XY space and returns a Point2D.
 java.awt.geom.Point2D forward(java.awt.geom.Point2D coord)
          Forward project a world coordinate into XY pixel space.
 java.awt.geom.Point2D forward(java.awt.geom.Point2D llp, java.awt.geom.Point2D pt)
          Forward projects a world coordinate into XY space and return a Point2D.
 java.util.ArrayList<float[]> forwardLine(java.awt.geom.Point2D ll1, java.awt.geom.Point2D ll2)
          Forward project a line defined by two coordinate end points.
 java.util.ArrayList<float[]> forwardPoly(double[] rawllpts, boolean isFilled)
          Forward project a polygon defined by the coordinates.
 java.util.ArrayList<float[]> forwardPoly(float[] rawllpts, boolean isFilled)
          Forward project a polygon defined by the coordinates.
 boolean forwardRaw(double[] rawllpts, int rawoff, float[] xcoords, float[] ycoords, boolean[] visible, int copyoff, int copylen)
          Forward project a raw array of world coordinates.
 boolean forwardRaw(float[] rawllpts, int rawoff, float[] xcoords, float[] ycoords, boolean[] visible, int copyoff, int copylen)
          Forward project a raw array of world coordinates.
 java.util.ArrayList<float[]> forwardRect(java.awt.geom.Point2D ll1, java.awt.geom.Point2D ll2)
          Forward project a rectangle defined by an upper left point and a lower right point.
 java.awt.Shape forwardShape(java.awt.Shape shape)
          Forward project a shape defined with world coordinates into map x, y space.
<T extends java.awt.geom.Point2D>
T
getCenter()
          Get the center coordinate.
<T extends java.awt.geom.Point2D>
T
getCenter(T fillInThis)
          Get the center coordinates set in a Point2D object provided.
 int getHeight()
          Get the height of the map in pixels.
<T extends java.awt.geom.Point2D>
T
getLowerRight()
          Get the lower right (southeast) point of the projection.
 float getMaxScale()
          Get the maximum scale value.
 float getMinScale()
          Get the minimum scale value.
 java.lang.String getName()
          Get the String used as a name, usually as a type.
 java.lang.String getProjectionID()
          Get the projection ID string.
 double getRotationAngle()
          Get the rotation setting of the view for this projection.
 float getScale()
          Get the scale.
<T extends java.awt.geom.Point2D>
float
getScale(T ll1, T 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.
<T extends java.awt.geom.Point2D>
T
getUpperLeft()
          Get the upper left (northwest) point of the projection.
 int getWidth()
          Get the width of the map in pixels.
<T extends java.awt.geom.Point2D>
T
inverse(double x, double y)
          Inverse project x,y coordinates into world coordinates.
<T extends java.awt.geom.Point2D>
T
inverse(double x, double y, T llpt)
          Inverse project x,y coordinates into world coordinates.
<T extends java.awt.geom.Point2D>
T
inverse(java.awt.geom.Point2D point)
          Inverse project a Point2D from map x/y space into world coordinates.
<T extends java.awt.geom.Point2D>
T
inverse(java.awt.geom.Point2D point2D, T llpt)
          Inverse project a Point2D from map x/y space into world coordinates.
 java.awt.Shape inverseShape(java.awt.Shape shape)
          Simple shape inverse projection, converts the x,y values in the shape to the x, y values of the projection.
 boolean isPlotable(double lat, double lon)
          Checks if a location is plot-able.
 boolean isPlotable(java.awt.geom.Point2D point)
          Checks if a point is plot-able.
 Projection makeClone()
          Clone the projection.
 void pan(double Az)
          Pan the map/projection.
 void pan(double Az, double c)
          Pan the map/projection.
 

Method Detail

getScale

float getScale()
Get the scale.

Returns:
float scale

getMaxScale

float getMaxScale()
Get the maximum scale value.

Returns:
float maxscale

getMinScale

float getMinScale()
Get the minimum scale value.

Returns:
float minscale

getCenter

<T extends java.awt.geom.Point2D> T getCenter()
Get the center coordinate.

Returns:
center point

getCenter

<T extends java.awt.geom.Point2D> T getCenter(T fillInThis)
Get the center coordinates set in a Point2D object provided.

Parameters:
fillInThis - the Point2D to fill in.
Returns:
center point provided.

getWidth

int getWidth()
Get the width of the map in pixels.

Returns:
int width.

getHeight

int getHeight()
Get the height of the map in pixels.

Returns:
int height.

getProjectionID

java.lang.String getProjectionID()
Get the projection ID string.

Returns:
String projID

getUpperLeft

<T extends java.awt.geom.Point2D> T 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.

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

Returns:
Point2D

getLowerRight

<T extends java.awt.geom.Point2D> T 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.

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

Returns:
Point2D

isPlotable

boolean isPlotable(java.awt.geom.Point2D point)
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).

Parameters:
point - Point2D
Returns:
boolean

isPlotable

boolean isPlotable(double lat,
                   double lon)
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).

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.

forward

java.awt.geom.Point2D forward(java.awt.geom.Point2D coord)
Forward project a world coordinate into XY pixel space.

Parameters:
coord - Point2D
Returns:
Point2D (new)

forward

java.awt.geom.Point2D forward(java.awt.geom.Point2D llp,
                              java.awt.geom.Point2D pt)
Forward projects a world coordinate into XY space and return a Point2D.

Parameters:
llp - Point2D containing coordinates to be projected
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

java.awt.geom.Point2D forward(float lat,
                              float lon)
Forward project y, x world coordinates into xy space.

Parameters:
lat - float vertical location component (units depend on projection implementation).
lon - float horizontal location component (units depend on projection implementation).
Returns:
Point2D (new)

forward

java.awt.geom.Point2D forward(double lat,
                              double lon)
Forward project y, x world coordinates into xy space.

Parameters:
lat - double vertical location component (units depend on projection implementation).
lon - double horizontal location component (units depend on projection implementation).
Returns:
Point2D (new)

forward

java.awt.geom.Point2D forward(float lat,
                              float lon,
                              java.awt.geom.Point2D pt)
Forward projects y, x world coordinates into XY space and returns a Point2D.

Parameters:
lat - float vertical location component (units depend on projection implementation).
lon - float horizontal location component (units depend on projection implementation).
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

java.awt.geom.Point2D forward(double lat,
                              double lon,
                              java.awt.geom.Point2D pt)
Forward projects y, x world coordinates into XY space and returns a Point2D.

Parameters:
lat - double vertical location component (units depend on projection implementation).
lon - double horizontal location component (units depend on projection implementation).
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.

forwardShape

java.awt.Shape forwardShape(java.awt.Shape shape)
Forward project a shape defined with world coordinates into map x, y space.

Parameters:
shape - java.awt.Shape object to project.
Returns:
java.awt.Shape object defined for projection.

inverse

<T extends java.awt.geom.Point2D> T inverse(java.awt.geom.Point2D point)
Inverse project a Point2D from map x/y space into world coordinates.

Parameters:
point - XY Point2D
Returns:
Point2D (new)

inverse

<T extends java.awt.geom.Point2D> T inverse(java.awt.geom.Point2D point2D,
                                            T llpt)
Inverse project a Point2D from map x/y space into world coordinates.

Parameters:
point2D - XY Point2D
llpt - resulting Point2D object to load the result into, a new Point2D object will be created if this is null.
Returns:
Point2D Object containing result.

inverse

<T extends java.awt.geom.Point2D> T inverse(double x,
                                            double y)
Inverse project x,y coordinates into world coordinates.

Parameters:
x - integer x coordinate
y - integer y coordinate
Returns:
Point2D (new)

inverse

<T extends java.awt.geom.Point2D> T inverse(double x,
                                            double y,
                                            T llpt)
Inverse project x,y coordinates into world coordinates.

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)

inverseShape

java.awt.Shape inverseShape(java.awt.Shape shape)
Simple shape inverse projection, converts the x,y values in the shape to the x, y values of the projection.

Parameters:
shape - projected shape.
Returns:
Shape containing source coordinates inversely projected.

pan

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

Parameters:
Az - azimuth "east of north" in decimal degrees: -180 <= Az <= 180
c - distance in units determined by the projection implementation.

pan

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

Parameters:
Az - azimuth "east of north" in decimal degrees: -180 <= Az <= 180

forwardLine

java.util.ArrayList<float[]> forwardLine(java.awt.geom.Point2D ll1,
                                         java.awt.geom.Point2D ll2)
Forward project a line defined by two coordinate end points.

Returns a ArrayList int[] of (x[], y[]) coordinate pair(s) of the projected line(s).


forwardRect

java.util.ArrayList<float[]> forwardRect(java.awt.geom.Point2D ll1,
                                         java.awt.geom.Point2D ll2)
Forward project a rectangle defined by an upper left point and a lower right point.

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

Parameters:
ll1 - Point2D of northwest corner
ll2 - Point2D of southeast corner
Returns:
ArrayList

forwardPoly

java.util.ArrayList<float[]> forwardPoly(float[] rawllpts,
                                         boolean isFilled)
Forward project a polygon defined by the coordinates. The isFilled flag is only occasionally important, for certain projections in certain situations.

Parameters:
rawllpts - a set of y, x coordinates.
isFilled - true of is important to note the area of the poly, instead of just the edge.
Returns:
ArrayList float[] contains sets of float[]x, float[] y arrays.

forwardPoly

java.util.ArrayList<float[]> forwardPoly(double[] rawllpts,
                                         boolean isFilled)
Forward project a polygon defined by the coordinates. The isFilled flag is only occasionally important, for certain projections in certain situations.

Parameters:
rawllpts - a set of y, x coordinates.
isFilled - true of is important to note the area of the poly, instead of just the edge.
Returns:
ArrayList float[] contains sets of float[]x, float[] y arrays.

forwardRaw

boolean forwardRaw(float[] rawllpts,
                   int rawoff,
                   float[] xcoords,
                   float[] ycoords,
                   boolean[] visible,
                   int copyoff,
                   int copylen)
Forward project a raw array of world coordinates. 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 y, x
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.

forwardRaw

boolean forwardRaw(double[] rawllpts,
                   int rawoff,
                   float[] xcoords,
                   float[] ycoords,
                   boolean[] visible,
                   int copyoff,
                   int copylen)
Forward project a raw array of world coordinates. 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 y, x
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.

makeClone

Projection makeClone()
Clone the projection.

Returns:
Projection clone of this one.

getName

java.lang.String getName()
Get the String used as a name, usually as a type.


getScale

<T extends java.awt.geom.Point2D> float getScale(T ll1,
                                                 T 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.

Parameters:
ll1 - the upper left coordinates of the bounding box.
ll2 - the lower right coordinates of the bounding box.
point1 - a java.awt.geom.Point2D reflecting a pixel spot on the projection that matches the ll1 coordinate, the upper left corner of the area of interest. Note that this is where ll1 is going to go in the new projection, not where it is now.
point2 - a java.awt.geom.Point2D reflecting a pixel spot on the projection that matches the ll2 coordinate, usually the lower right corner of the area of interest. Note that this is where ll2 is going to go in the new projection, not where it is now.

getUcuom

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

Returns:
Length. May be null if unknown.

getRotationAngle

double getRotationAngle()
Get the rotation setting of the view for this projection. Provided here so that map objects manage their orientation if they want.

Returns:
rotation of the view in RADIANS.


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