|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.bbn.openmap.proj.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()
.
Projection
,
Cylindrical
,
Mercator
,
CADRG
,
Azimuth
,
Orthographic
,
Planet
,
GreatCircle
,
OMPoly
,
Serialized FormField Summary | |
protected float |
ctrLat
|
protected float |
ctrLon
|
static float |
DATELINE
Dateline longitude in radians. |
protected int |
height
|
protected float |
maxscale
|
protected Mercator |
mercator
|
static int |
MIN_HEIGHT
Minimum height of projection. |
static int |
MIN_WIDTH
Minimum width of projection. |
protected float |
minscale
|
static float |
NORTH_POLE
North pole latitude in radians. |
protected static int |
NUM_DEFAULT_CIRCLE_VERTS
|
protected static int |
NUM_DEFAULT_GREAT_SEGS
|
protected int |
pixelsPerMeter
|
protected float |
planetPixelCircumference
|
protected float |
planetPixelRadius
|
protected float |
planetRadius
|
protected java.lang.String |
projID
|
protected float |
scale
|
protected float |
scaled_radius
|
static float |
SOUTH_POLE
South pole latitude in radians. |
protected int |
type
|
protected int |
width
|
protected int |
XSCALE_THRESHOLD
|
protected static int |
XTHRESHOLD
|
Constructor Summary | |
Proj(LatLonPoint center,
float s,
int w,
int h,
int type)
Construct a projection. |
Method Summary | |
protected abstract java.util.ArrayList |
_forwardPoly(float[] rawllpts,
int ltype,
int nsegs,
boolean isFilled)
Forward project a lat/lon Poly. |
java.lang.Object |
clone()
Copies this projection. |
protected abstract void |
computeParameters()
Called when some fundamental parameters change. |
protected java.util.ArrayList |
doPolyDispatch(float[] rawllpts,
int ltype,
int nsegs,
boolean isFilled)
Generates a complicated poly. |
abstract 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. |
abstract void |
drawBackground(java.awt.Graphics2D g,
java.awt.Paint p)
Draw the background for the projection. |
boolean |
equals(java.lang.Object o)
Test for equality. |
java.awt.Point |
forward(float lat,
float lon)
Forward project lat,lon coordinates. |
java.awt.Point |
forward(LatLonPoint llp)
Forward project a LatLonPoint. |
java.util.ArrayList |
forwardArc(LatLonPoint c,
boolean radians,
float radius,
float start,
float extent)
Forward project an arc. |
java.util.ArrayList |
forwardArc(LatLonPoint c,
boolean radians,
float radius,
int nverts,
float start,
float extent)
|
java.util.ArrayList |
forwardArc(LatLonPoint c,
boolean radians,
float radius,
int nverts,
float start,
float extent,
int arcType)
Forward project a Lat/Lon Arc. |
java.util.ArrayList |
forwardCircle(LatLonPoint c,
boolean radians,
float radius)
Forward project a circle. |
java.util.ArrayList |
forwardCircle(LatLonPoint c,
boolean radians,
float radius,
int nverts)
|
java.util.ArrayList |
forwardCircle(LatLonPoint c,
boolean radians,
float radius,
int nverts,
boolean isFilled)
Forward project a Lat/Lon Circle. |
protected java.util.ArrayList |
forwardGreatPoly(float[] rawllpts,
int nsegs,
boolean isFilled)
Forward project a greatcircle poly. |
java.util.ArrayList |
forwardLine(LatLonPoint ll1,
LatLonPoint ll2,
int ltype)
Forward project a lat/lon Line. |
java.util.ArrayList |
forwardLine(LatLonPoint ll1,
LatLonPoint ll2,
int ltype,
int nsegs)
Forward project a line. |
java.util.ArrayList |
forwardPoly(float[] rawllpts,
int ltype,
int nsegs)
|
java.util.ArrayList |
forwardPoly(float[] rawllpts,
int ltype,
int nsegs,
boolean isFilled)
Forward project a lat/lon Poly. |
java.util.ArrayList |
forwardRaster(LatLonPoint llNW,
LatLonPoint llSE,
java.awt.Image image)
Forward projects a raster. |
java.util.ArrayList |
forwardRect(LatLonPoint ll1,
LatLonPoint ll2,
int ltype)
Forward project a lat/lon Rectangle. |
java.util.ArrayList |
forwardRect(LatLonPoint ll1,
LatLonPoint ll2,
int ltype,
int nsegs)
|
java.util.ArrayList |
forwardRect(LatLonPoint ll1,
LatLonPoint ll2,
int ltype,
int nsegs,
boolean isFilled)
Forward project a rectangle. |
protected java.util.ArrayList |
forwardRhumbPoly(float[] rawllpts,
int nsegs,
boolean isFilled)
Forward project a rhumbline poly. |
LatLonPoint |
getCenter()
Get center point of projection. |
int |
getHeight()
Get projection height. |
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. |
float |
getPlanetPixelCircumference()
Get the planet pixel circumference. |
float |
getPlanetPixelRadius()
Get the planet pixel radius. |
float |
getPlanetRadius()
Get the planet radius. |
int |
getPPM()
Get the pixels-per-meter constant. |
java.lang.String |
getProjectionID()
Gets the projection ID used for determining equality. |
int |
getProjectionType()
Gets the projection type. |
float |
getScale()
Get the scale of the projection. |
float |
getScale(LatLonPoint ll1,
LatLonPoint ll2,
java.awt.Point point1,
java.awt.Point 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. |
int |
getWidth()
Get projection width. |
int |
hashCode()
Return hashcode value of projection. |
protected void |
init()
Moved the initialization of constants to this method so they would be set by the time computeParams gets called the first time. |
LatLonPoint |
inverse(int x,
int y)
Inverse project x,y coordinates. |
LatLonPoint |
inverse(java.awt.Point point)
Inverse project a Point from x,y space to LatLon space. |
boolean |
isComplicatedLineType(int ltype)
Check for complicated linetypes. |
boolean |
isPlotable(LatLonPoint llpoint)
Checks if a LatLonPoint is plot-able. |
Projection |
makeClone()
Clone the projection. |
abstract float |
normalize_latitude(float lat)
Sets radian latitude to something sane. |
void |
pan(float Az)
Pan the map/projection. |
void |
pan(float Az,
float c)
Pan the map/projection. |
void |
panE()
pan the map east. |
void |
panE(float c)
|
void |
panN()
pan the map north. |
void |
panN(float c)
|
void |
panNE()
pan the map northeast. |
void |
panNE(float c)
|
void |
panNW()
pan the map northwest. |
void |
panNW(float c)
|
void |
panS()
pan the map south. |
void |
panS(float c)
|
void |
panSE()
pan the map southeast. |
void |
panSE(float c)
|
void |
panSW()
pan the map southwest. |
void |
panSW(float c)
|
void |
panW()
pan the map west. |
void |
panW(float c)
|
void |
setCenter(float lat,
float lon)
Set center point of projection. |
void |
setCenter(LatLonPoint 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(LatLonPoint center,
float scale,
int width,
int height)
Sets all the projection variables at once before calling computeParameters(). |
void |
setPlanetRadius(float radius)
Set the planet radius. |
void |
setPPM(int ppm)
Set the pixels per meter constant. |
protected void |
setProjectionID()
Sets the projection ID used for determining equality. |
void |
setScale(float s)
Set the scale of the projection. |
void |
setWidth(int width)
Set projection width. |
java.lang.String |
toString()
Stringify the projection. |
static float |
wrap_longitude(float lon)
Sets radian longitude to something sane. |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.bbn.openmap.proj.Projection |
forward, forward, forward, forwardRaw, getLowerRight, getUpperLeft, inverse, inverse, isPlotable |
Field Detail |
public static final transient float NORTH_POLE
public static final transient float SOUTH_POLE
public static final transient float DATELINE
public static final transient int MIN_WIDTH
public static final transient int MIN_HEIGHT
protected static transient int NUM_DEFAULT_CIRCLE_VERTS
protected static transient int NUM_DEFAULT_GREAT_SEGS
protected int pixelsPerMeter
protected float planetRadius
protected float planetPixelRadius
protected float planetPixelCircumference
protected int width
protected int height
protected float minscale
protected float maxscale
protected float scale
protected float scaled_radius
protected float ctrLat
protected float ctrLon
protected int type
protected java.lang.String projID
protected Mercator mercator
protected static transient int XTHRESHOLD
protected transient int XSCALE_THRESHOLD
Constructor Detail |
public Proj(LatLonPoint center, float s, int w, int h, int type)
center
- LatLonPoint center of projections
- float scale of projectionw
- width of screenh
- height of screentype
- projection typeProjectionFactory
Method Detail |
protected void init()
public void setPPM(int ppm)
ppm
- int Pixels Per Meter scale-factor constantpublic int getPPM()
public void setPlanetRadius(float radius)
radius
- float planet radius in meterspublic float getPlanetRadius()
public float getPlanetPixelRadius()
public float getPlanetPixelCircumference()
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(float lat, float lon)
lat
- float latitude in decimal degreeslon
- float longitude in decimal degreespublic void setCenter(LatLonPoint pt)
pt
- LatLonPointpublic LatLonPoint getCenter()
getCenter
in interface Projection
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(LatLonPoint center, float scale, int width, int height)
center
- LatLonPoint centerscale
- float scalewidth
- width of screenheight
- height of screenpublic int getProjectionType()
getProjectionType
in interface Projection
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" paramters used in the forward() and inverse() calls.
public abstract float normalize_latitude(float lat)
Normalizes the latitude according to the particular projection.
lat
- float latitude in radians
ProjMath.normalize_latitude(float, float)
,
LatLonPoint.normalize_latitude(float)
public static final float wrap_longitude(float lon)
lon
- float longitude in radians
ProjMath.wrap_longitude(float)
,
LatLonPoint.wrap_longitude(float)
public java.lang.String toString()
getProjectionID()
public boolean equals(java.lang.Object o)
o
- Object to compare.
public int hashCode()
public Projection makeClone()
makeClone
in interface Projection
public java.lang.Object clone()
public boolean isPlotable(LatLonPoint llpoint)
Call this to check and see if a LatLonPoint can be plotted. This is meant to be used for checking before projecting and rendering Point objects (bitmaps for instance).
isPlotable
in interface Projection
llpoint
- LatLonPoint
public final java.awt.Point forward(LatLonPoint llp)
Forward projects a LatLon point into XY space. Returns a Point.
forward
in interface Projection
llp
- LatLonPoint to be projected
public final java.awt.Point forward(float lat, float lon)
forward
in interface Projection
lat
- float latitude in decimal degreeslon
- float longitude in decimal degrees
public final LatLonPoint inverse(java.awt.Point point)
inverse
in interface Projection
point
- x,y Point
public final LatLonPoint inverse(int x, int y)
inverse
in interface Projection
x
- integer x coordinatey
- integer y coordinate
inverse(Point)
public java.util.ArrayList forwardLine(LatLonPoint ll1, LatLonPoint ll2, int ltype, int nsegs)
forwardLine
in interface Projection
ll1
- LatLonPointll2
- LatLonPointltype
- LineTypensegs
- number of segments
LineType.Straight
,
LineType.Rhumb
,
LineType.GreatCircle
public java.util.ArrayList forwardLine(LatLonPoint ll1, LatLonPoint ll2, int ltype)
forwardLine(LatLonPoint, LatLonPoint, int, int)
public java.util.ArrayList forwardRect(LatLonPoint ll1, LatLonPoint ll2, int ltype, int nsegs, boolean isFilled)
forwardRect
in interface Projection
ll1
- LatLonPointll2
- LatLonPointltype
- LineTypensegs
- number of segmentsisFilled
- filled poly?
Projection.forwardPoly(float[], int, int, boolean)
public java.util.ArrayList forwardRect(LatLonPoint ll1, LatLonPoint ll2, int ltype, int nsegs)
public java.util.ArrayList forwardRect(LatLonPoint ll1, LatLonPoint ll2, int ltype)
forwardRect(LatLonPoint, LatLonPoint, int, int)
public java.util.ArrayList forwardArc(LatLonPoint c, boolean radians, float radius, float start, float extent)
c
- LatLonPoint centerradians
- boolean radius in radians?radius
- radius in radians or decimal degreesstart
- the starting angle of the arc, zero being North up. Units
are dependent on radians parameter - the start paramter 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 paramter is
in radians if radians equals true, decimal degrees if not.public java.util.ArrayList forwardArc(LatLonPoint c, boolean radians, float radius, int nverts, float start, float extent)
public java.util.ArrayList forwardArc(LatLonPoint c, boolean radians, float radius, int nverts, float start, float extent, int arcType)
Arcs have the same restrictions as polys .
forwardArc
in interface Projection
c
- LatLonPoint center of circleradians
- 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 paramter 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 paramter 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.Projection.forwardPoly(float[], int, int, boolean)
public java.util.ArrayList forwardCircle(LatLonPoint c, boolean radians, float radius)
c
- LatLonPoint centerradians
- boolean radius in radians?radius
- radius in radians or decimal degreespublic java.util.ArrayList forwardCircle(LatLonPoint c, boolean radians, float radius, int nverts)
public java.util.ArrayList forwardCircle(LatLonPoint c, boolean radians, float radius, int nverts, boolean isFilled)
Circles have the same restrictions as polys .
forwardCircle
in interface Projection
c
- LatLonPoint center of circleradians
- radius in radians or decimal degrees?radius
- radius of circle (0 < radius < 180)nverts
- number of vertices of the circle poly.isFilled
- filled poly?Projection.forwardPoly(float[], int, int, boolean)
public java.util.ArrayList forwardPoly(float[] rawllpts, int ltype, int nsegs)
public java.util.ArrayList forwardPoly(float[] rawllpts, int ltype, int nsegs, boolean isFilled)
Delegates to _forwardPoly(), and may do additional clipping for Java XWindows problem. Remember to specify vertices in radians!
forwardPoly
in interface Projection
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?
Projection.forwardRaw(float[], int, int[], int[], boolean[], int, int)
,
LineType.Straight
,
LineType.Rhumb
,
LineType.GreatCircle
protected abstract java.util.ArrayList _forwardPoly(float[] rawllpts, int ltype, int nsegs, boolean isFilled)
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?
protected java.util.ArrayList forwardRhumbPoly(float[] rawllpts, int nsegs, boolean isFilled)
Draws rhumb lines between vertices of poly. Remember to specify vertices in radians! Check in-code comments for details about the algorithm.
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?
Projection.forwardPoly(float[], int, int, boolean)
protected java.util.ArrayList forwardGreatPoly(float[] rawllpts, int nsegs, boolean isFilled)
Draws great circle lines between vertices of poly. Remember to specify vertices in radians!
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?
Projection.forwardPoly(float[], int, int, boolean)
public java.util.ArrayList forwardRaster(LatLonPoint llNW, LatLonPoint llSE, java.awt.Image image)
HACK: not implemented yet.
forwardRaster
in interface Projection
llNW
- LatLonPoint of NorthWest corner of ImagellSE
- LatLonPoint of SouthEast corner of Imageimage
- raster imagepublic boolean isComplicatedLineType(int ltype)
This depends on the line and this projection.
ltype
- int LineType
protected java.util.ArrayList doPolyDispatch(float[] rawllpts, int ltype, int nsegs, boolean isFilled)
rawllpts
- LatLonPoint[]ltype
- line typensegs
- number of segments to draw for greatcircle or rhumb lines
(if < 1, this value is generated internally).isFilled
- filled poly?
Projection.forwardPoly(float[], int, int, boolean)
public void pan(float Az, float 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 void pan(float 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(float c)
public final void panN()
public final void panN(float c)
public final void panNE()
public final void panNE(float c)
public final void panE()
public final void panE(float c)
public final void panSE()
public final void panSE(float c)
public final void panS()
public final void panS(float c)
public final void panSW()
public final void panSW(float c)
public final void panW()
public final void panW(float c)
public abstract void drawBackground(java.awt.Graphics2D g, java.awt.Paint p)
g
- Graphics2Dp
- Paint to use for the backgroundpublic abstract void drawBackground(java.awt.Graphics g)
public java.lang.String getName()
getName
in interface Projection
public float getScale(LatLonPoint ll1, LatLonPoint ll2, java.awt.Point point1, java.awt.Point 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.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.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |