|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.bbn.openmap.proj.Proj
public abstract class Proj
Proj is the base class of all Projections.
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.
set
method of this class. This might interfere with another
thread that's using the same projection for forwardPoly
or
another Projection interface method. In general, you should not need to call
any of the set
methods directly, but let the MapBean do it for
you.
forwardOBJ()
methods for ArrayList graphics
ultimately go through forwardPoly()
.
Cartesian
,
GeoProj
,
Serialized FormField Summary | |
---|---|
protected double |
centerX
|
protected double |
centerY
|
protected int |
height
|
protected double |
maxscale
|
static int |
MIN_HEIGHT
Minimum height of projection. |
static int |
MIN_WIDTH
Minimum width of projection. |
protected double |
minscale
|
protected java.lang.String |
projID
|
protected double |
rotationAngle
The rotation angle of the map is stored here so that non-rotating things can correct themselves. |
protected double |
scale
|
protected Length |
ucuom
The unprojected coordinates units of measure. |
protected int |
width
|
Constructor Summary | |
---|---|
Proj(java.awt.geom.Point2D center,
float s,
int w,
int h)
Construct a projection. |
Method Summary | ||
---|---|---|
java.lang.Object |
clone()
Copies this projection. |
|
protected abstract 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 paint)
Draw the background for the projection. |
|
boolean |
equals(java.lang.Object o)
Test for equality. |
|
java.awt.geom.Point2D |
forward(double lat,
double lon)
Forward project y, x world coordinates into xy space. |
|
abstract 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 lat,lon coordinates. |
|
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 llp)
Forward project a LatLonPoint. |
|
java.awt.geom.Point2D |
forward(java.awt.geom.Point2D llp,
java.awt.geom.Point2D pt)
Forward projects a LatLonPoint into XY space and return a java.awt.geom.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 points. |
|
boolean |
forwardRaw(float[] rawllpts,
int rawoff,
float[] xcoords,
float[] ycoords,
boolean[] visible,
int copyoff,
int copylen)
Forward project a raw array of points. |
|
java.util.ArrayList<float[]> |
forwardRect(java.awt.geom.Point2D ll1,
java.awt.geom.Point2D ll2)
Forward project a rectangle. |
|
java.awt.Shape |
forwardShape(java.awt.Shape shape)
Simple shape projection, doesn't take into account what kind of lines should be drawn between shape points, assumes they should be 2D lines as rendered in 2D space, not interpolated for accuracy as Great Circle/Rhumb lines on a globe.. |
|
java.awt.geom.Point2D |
getCenter()
Get center point of projection. |
|
|
getCenter(T center)
Returns a center Point2D that was provided, with the location filled into the Point2D object. |
|
int |
getHeight()
Get projection height. |
|
java.awt.geom.Point2D |
getLowerRight()
Get the world coordinate of the lower right corner of the map. |
|
float |
getMaxScale()
Get the maximum scale of the projection. |
|
float |
getMinScale()
Get minimum scale of the projection. |
|
java.lang.String |
getName()
Get the name string of the projection. |
|
java.lang.String |
getProjectionID()
Gets the projection ID used for determining equality. |
|
double |
getRotationAngle()
Get the rotation setting of the view for this projection. |
|
float |
getScale()
Get the scale of the projection. |
|
abstract 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. |
|
java.awt.geom.Point2D |
getUpperLeft()
Get the world coordinate of the upper left corner of the map. |
|
int |
getWidth()
Get projection width. |
|
int |
hashCode()
Return hashcode value of projection. |
|
protected void |
init()
Called after the center and scale is set in setParams, but before the scale is checked for legitimacy. |
|
java.awt.geom.Point2D |
inverse(double x,
double y)
Inverse project x,y coordinates. |
|
abstract
|
inverse(double x,
double y,
T llpt)
Inverse project x,y coordinates into world coordinates. |
|
java.awt.geom.Point2D |
inverse(java.awt.geom.Point2D point)
Inverse project a Point2D from x,y space to coordinate space. |
|
|
inverse(java.awt.geom.Point2D point,
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. |
|
abstract void |
pan(double Az)
Pan the map/projection. |
|
abstract void |
pan(double Az,
double c)
Pan the map/projection. |
|
void |
panE()
pan the map east. |
|
void |
panE(double c)
|
|
void |
panN()
pan the map north. |
|
void |
panN(double c)
|
|
void |
panNE()
pan the map northeast. |
|
void |
panNE(double c)
|
|
void |
panNW()
pan the map northwest. |
|
void |
panNW(double c)
|
|
void |
panS()
pan the map south. |
|
void |
panS(double c)
|
|
void |
panSE()
pan the map southeast. |
|
void |
panSE(double c)
|
|
void |
panSW()
pan the map southwest. |
|
void |
panSW(double c)
|
|
void |
panW()
pan the map west. |
|
void |
panW(double c)
|
|
void |
setCenter(double y,
double x)
Set center point of projection. |
|
void |
setCenter(java.awt.geom.Point2D pt)
Set center point of projection. |
|
void |
setHeight(int height)
Set projection height. |
|
void |
setMaxScale(float s)
Set the maximum scale of the projection. |
|
void |
setMinScale(float s)
Set the minscale of the projection. |
|
protected void |
setParms(java.awt.geom.Point2D center,
float scale,
int width,
int height)
Sets all the projection variables at once before calling computeParameters(). |
|
protected void |
setProjectionID()
Sets the projection ID used for determining equality. |
|
void |
setRotationAngle(double rotationAngle)
This setting is purely for informational purposes, as a way for the projection to pass along any rotation activity of the MapBean to OMGraphics. |
|
void |
setScale(float s)
Set the scale of the projection. |
|
void |
setUcuom(Length ucuom)
Set the unprojected coordinates units of measure. |
|
void |
setWidth(int width)
Set projection width. |
|
java.lang.String |
toString()
Stringify the projection. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final transient int MIN_WIDTH
public static final transient int MIN_HEIGHT
protected int width
protected int height
protected double minscale
protected double maxscale
protected double scale
protected double centerX
protected double centerY
protected java.lang.String projID
protected double rotationAngle
protected Length ucuom
Constructor Detail |
---|
public Proj(java.awt.geom.Point2D center, float s, int w, int h)
center
- LatLonPoint center of projections
- float scale of projectionw
- width of screenh
- height of screenProjectionFactory
Method Detail |
---|
public void setScale(float s)
Sets the projection to the scale 1:s iff minscale < s < maxscale.
If s < minscale, sets the projection to minscale.
If s > maxscale, sets the projection to maxscale.
s
- float scalepublic void setMinScale(float s)
Usually you will not need to do this.
s
- float minscalepublic void setMaxScale(float s)
Usually you will not need to do this.
s
- float minscalepublic float getScale()
getScale
in interface Projection
public float getMaxScale()
getMaxScale
in interface Projection
public float getMinScale()
getMinScale
in interface Projection
public void setCenter(java.awt.geom.Point2D pt)
pt
- Point2D for center. Point2D values will be copied.public void setCenter(double y, double x)
y
- vertical value of center.x
- horizontal value of center.public java.awt.geom.Point2D getCenter()
getCenter
in interface Projection
public <T extends java.awt.geom.Point2D> T getCenter(T center)
getCenter
in interface Projection
center
- the Point2D to fill in.
public void setWidth(int width)
width
- width of projection screenpublic void setHeight(int height)
height
- height of projection screenpublic int getWidth()
getWidth
in interface Projection
public int getHeight()
getHeight
in interface Projection
protected void setParms(java.awt.geom.Point2D center, float scale, int width, int height)
center
- LatLonPoint centerscale
- float scalewidth
- width of screenheight
- height of screenprotected void init()
Make sure you call super.init() if you override this method.
protected void setProjectionID()
public java.lang.String getProjectionID()
getProjectionID
in interface Projection
protected abstract void computeParameters()
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.
public java.lang.String toString()
toString
in class java.lang.Object
getProjectionID()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- Object to compare.
public int hashCode()
hashCode
in class java.lang.Object
public Projection makeClone()
makeClone
in interface Projection
public java.lang.Object clone()
clone
in class java.lang.Object
public java.awt.geom.Point2D forward(java.awt.geom.Point2D llp)
Forward projects a LatLon point into XY space. Returns a Point2D.
forward
in interface Projection
llp
- LatLonPoint to be projected
public java.awt.geom.Point2D forward(java.awt.geom.Point2D llp, java.awt.geom.Point2D pt)
forward
in interface Projection
llp
- LatLonPoint to be projectedpt
- Resulting XY Point2D
public java.awt.geom.Point2D forward(float lat, float lon)
forward
in interface Projection
lat
- float latitude in decimal degreeslon
- float longitude in decimal degrees
public java.awt.geom.Point2D forward(float lat, float lon, java.awt.geom.Point2D pt)
Projection
forward
in interface Projection
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.
public java.awt.geom.Point2D forward(double lat, double lon)
Projection
forward
in interface Projection
lat
- double vertical location component (units depend on projection
implementation).lon
- double horizontal location component (units depend on
projection implementation).
public abstract java.awt.geom.Point2D forward(double lat, double lon, java.awt.geom.Point2D pt)
Projection
forward
in interface Projection
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.
public <T extends java.awt.geom.Point2D> T inverse(java.awt.geom.Point2D point, T llpt)
Projection
inverse
in interface Projection
point
- XY Point2Dllpt
- resulting Point2D object to load the result into, a new
Point2D object will be created if this is null.
public java.awt.geom.Point2D inverse(java.awt.geom.Point2D point)
inverse
in interface Projection
point
- x,y Point2D
public java.awt.geom.Point2D inverse(double x, double y)
inverse
in interface Projection
x
- integer x coordinatey
- integer y coordinate
inverse(Point2D)
public abstract <T extends java.awt.geom.Point2D> T inverse(double x, double y, T llpt)
Projection
inverse
in interface Projection
x
- integer x coordinatey
- integer y coordinatellpt
- Point2D to be loaded with the result. A new Point2D object
will be created if this is null.
inverse(Point2D)
public java.awt.Shape inverseShape(java.awt.Shape shape)
inverseShape
in interface Projection
shape
- projected shape.
public java.awt.Shape forwardShape(java.awt.Shape shape)
forwardShape
in interface Projection
shape
- java.awt.Shape object to project.
public boolean forwardRaw(float[] rawllpts, int rawoff, float[] xcoords, float[] ycoords, boolean[] visible, int copyoff, int copylen)
It does populate a visible array indicating whether the points are visible on the projected view of the world.
forwardRaw
in interface Projection
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).
public boolean forwardRaw(double[] rawllpts, int rawoff, float[] xcoords, float[] ycoords, boolean[] visible, int copyoff, int copylen)
It does populate a visible array indicating whether the points are visible on the projected view of the world.
forwardRaw
in interface Projection
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).
public java.util.ArrayList<float[]> forwardLine(java.awt.geom.Point2D ll1, java.awt.geom.Point2D ll2)
Projection
Returns a ArrayList int[] of (x[], y[]) coordinate pair(s) of the projected line(s).
forwardLine
in interface Projection
public java.util.ArrayList<float[]> forwardRect(java.awt.geom.Point2D ll1, java.awt.geom.Point2D ll2)
forwardRect
in interface Projection
ll1
- LatLonPointll2
- LatLonPoint
public java.util.ArrayList<float[]> forwardPoly(float[] rawllpts, boolean isFilled)
Projection
forwardPoly
in interface Projection
rawllpts
- a set of y, x coordinates.isFilled
- true of is important to note the area of the poly,
instead of just the edge.
public java.util.ArrayList<float[]> forwardPoly(double[] rawllpts, boolean isFilled)
Projection
forwardPoly
in interface Projection
rawllpts
- a set of y, x coordinates.isFilled
- true of is important to note the area of the poly,
instead of just the edge.
public abstract void pan(double Az, double c)
Example pans:
pan(180, c)
pan south `c' degrees
pan(-90, c)
pan west `c' degrees
pan(0, c)
pan north `c' degrees
pan(90, c)
pan east `c' degrees
pan
in interface Projection
Az
- azimuth "east of north" in decimal degrees:
-180 <= Az <= 180
c
- arc distance in decimal degreespublic abstract void pan(double Az)
pan(180, c)
pan south
pan(-90, c)
pan west
pan(0, c)
pan north
pan(90, c)
pan east
pan
in interface Projection
Az
- azimuth "east of north" in decimal degrees:
-180 <= Az <= 180
public final void panNW()
public final void panNW(double c)
public final void panN()
public final void panN(double c)
public final void panNE()
public final void panNE(double c)
public final void panE()
public final void panE(double c)
public final void panSE()
public final void panSE(double c)
public final void panS()
public final void panS(double c)
public final void panSW()
public final void panSW(double c)
public final void panW()
public final void panW(double c)
public boolean isPlotable(double lat, double lon)
Projection
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).
isPlotable
in interface Projection
lat
- vertical location component (units depend on the projection
implementation).lon
- horizontal location component (units depend on the projection
implementation).
public boolean isPlotable(java.awt.geom.Point2D point)
Projection
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).
isPlotable
in interface Projection
point
- Point2D
public void drawBackground(java.awt.Graphics2D g, java.awt.Paint paint)
g
- Graphics2Dpaint
- java.awt.Paint to use for the backgroundpublic void drawBackground(java.awt.Graphics g)
g
- Graphicspublic java.lang.String getName()
getName
in interface Projection
public abstract float getScale(java.awt.geom.Point2D ll1, java.awt.geom.Point2D ll2, java.awt.geom.Point2D point1, java.awt.geom.Point2D point2)
getScale
in interface Projection
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 the location where you
want ll1 to go in the new projection scale, 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 the
location where you want ll2 to go in the new projection, not where
it is now.public Length getUcuom()
getUcuom
in interface Projection
Length
public void setUcuom(Length ucuom)
ucuom
- public java.awt.geom.Point2D getUpperLeft()
getUpperLeft
in interface Projection
public java.awt.geom.Point2D getLowerRight()
getLowerRight
in interface Projection
public double getRotationAngle()
Projection
getRotationAngle
in interface Projection
public void setRotationAngle(double rotationAngle)
rotationAngle
- the rotationAngle to set, in RADIANS
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |