public class Cartesian extends Proj implements Projection, java.io.Serializable
Modifier and Type | Field and Description |
---|---|
protected double |
bottomLimit
The coordinate limit of the bottom side of the projection.
|
static java.lang.String |
CartesianName
The Cartesian name.
|
protected double |
hHeight |
protected double |
hWidth |
protected double |
leftLimit
The coordinate limit of the left side of the projection.
|
protected java.awt.geom.Point2D |
limitAnchorPoint
A point that can be used for force the projection against the limits.
|
protected double |
rightLimit
The coordinate limit of the right side of the projection.
|
protected double |
scaleFactor |
protected double |
SFScale |
protected double |
topLimit
The coordinate limit of the top side of the projection.
|
protected java.awt.geom.AffineTransform |
transform1 |
protected java.awt.geom.AffineTransform |
transform2 |
protected java.awt.geom.AffineTransform |
transform4 |
Constructor and Description |
---|
Cartesian(java.awt.geom.Point2D center,
float scale,
int width,
int height)
Create a Cartesian projection that does straight scaling, no wrapping.
|
Modifier and Type | Method and Description |
---|---|
protected void |
checkLimits()
The method you want to call.
|
protected void |
checkLimits(boolean checkScale)
Should only be called if you've checked there are limits set on the
projection.
|
protected java.awt.geom.Point2D |
checkLowerLimits()
Checks the lower limits and returns new center coordinates to keep the
limits at the edge if necessary.
|
protected double |
checkScaleAgainstLimits()
Checks the corner values against the limits and returns the right scale
to keep limits at the edge if necessary.
|
protected java.awt.geom.Point2D |
checkUpperLimits()
Checks the upper limits and returns new center coordinates to keep the
limits at the edge if necessary.
|
protected void |
computeParameters()
Called when some fundamental parameters change.
|
java.awt.geom.Point2D |
forward(double wy,
double wx,
java.awt.geom.Point2D mapPoint)
Forward project a world coordinate into screen space.
|
double |
getBottomLimit() |
java.awt.geom.Point2D |
getCenter()
Get center point of projection.
|
double |
getLeftLimit() |
java.awt.geom.Point2D |
getLimitAnchorPoint() |
java.lang.String |
getName()
Get the name string of the projection.
|
double |
getRightLimit() |
float |
getScale(java.awt.geom.Point2D ulWorldPoint,
java.awt.geom.Point2D lrWorldPoint,
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.
|
double |
getTopLimit() |
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,
java.awt.geom.Point2D worldPoint)
Inverse projection a map coordinate into world space.
|
boolean |
isPlotable(double lat,
double lon)
Checks if a location is plot-able.
|
void |
pan(float Az)
Pan half a view.
|
void |
pan(float Az,
float c)
Pan the map/projection.
|
void |
setBottomLimit(double bottomLimit) |
void |
setLeftLimit(double leftLimit) |
void |
setLimitAnchorPoint(java.awt.geom.Point2D limitAnchorPoint) |
void |
setLimits(double top,
double bottom,
double left,
double right,
java.awt.geom.Point2D anchor) |
void |
setRightLimit(double rightLimit) |
void |
setTopLimit(double topLimit) |
clone, drawBackground, drawBackground, equals, forward, forward, forward, forward, forward, forwardLine, forwardPoly, forwardPoly, forwardRaw, forwardRaw, forwardRect, forwardShape, getCenter, getHeight, getLowerRight, getMaxScale, getMinScale, getProjectionID, getScale, getUcuom, getUpperLeft, getWidth, hashCode, inverse, inverse, inverse, isPlotable, isPlotable, makeClone, panE, panE, panN, panN, panNE, panNE, panNW, panNW, panS, panS, panSE, panSE, panSW, panSW, panW, panW, setCenter, setCenter, setHeight, setMaxScale, setMinScale, setParms, setProjectionID, setScale, setUcuom, setWidth, toString
finalize, getClass, notify, notifyAll, wait, wait, wait
forward, forward, forward, forward, forward, forwardLine, forwardPoly, forwardPoly, forwardRaw, forwardRaw, forwardRect, forwardShape, getCenter, getHeight, getLowerRight, getMaxScale, getMinScale, getProjectionID, getScale, getUcuom, getUpperLeft, getWidth, inverse, inverse, inverse, isPlotable, isPlotable, makeClone
public static final transient java.lang.String CartesianName
protected double leftLimit
protected double rightLimit
protected double topLimit
protected double bottomLimit
protected java.awt.geom.Point2D limitAnchorPoint
protected double scaleFactor
protected transient double hWidth
protected transient double hHeight
protected transient double SFScale
protected transient java.awt.geom.AffineTransform transform1
protected transient java.awt.geom.AffineTransform transform2
protected transient java.awt.geom.AffineTransform transform4
public Cartesian(java.awt.geom.Point2D center, float scale, int width, int height)
center
- the coordinates of the center of the map.scale
- the scale to use for the map, referring to the difference of
the ration between pixels versus coordinate values.width
- the pixel width of the map.height
- the pixel height of the map.public void init()
Proj
Make sure you call super.init() if you override this method.
protected void computeParameters()
Proj
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.
computeParameters
in class Proj
protected void checkLimits()
protected void checkLimits(boolean checkScale)
checkScale
- true the first time through, if the scale changes this
method calls itself with false to prevent a loop.protected java.awt.geom.Point2D checkLowerLimits()
protected java.awt.geom.Point2D checkUpperLimits()
protected double checkScaleAgainstLimits()
public java.awt.geom.Point2D forward(double wy, double wx, java.awt.geom.Point2D mapPoint)
forward
in interface Projection
forward
in class Proj
wy
- vertical coordinate component in world units.wx
- horizontal coordinate component in world units.mapPoint
- screen point to load result into. OK if null, a new one
will be created and returned.public java.awt.geom.Point2D inverse(double x, double y, java.awt.geom.Point2D worldPoint)
inverse
in interface Projection
inverse
in class Proj
x
- horizontal map coordinate from left side of map.y
- vertical map coordinate from top of map.worldPoint
- a Point2D object to load result into. OK if null, a new
one will be created if necessary.Proj.inverse(Point2D)
public void pan(float Az, float c)
Proj
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
pan
in class Proj
Az
- direction, 0 is north, positive is clockwise.c
- number of world coordinates to pan.public void pan(float Az)
pan
in interface Projection
pan
in class Proj
Az
- azimuth "east of north" in decimal degrees:
-180 <= Az <= 180
public java.lang.String getName()
Proj
getName
in interface Projection
getName
in class Proj
public float getScale(java.awt.geom.Point2D ulWorldPoint, java.awt.geom.Point2D lrWorldPoint, java.awt.geom.Point2D point1, java.awt.geom.Point2D point2)
Proj
getScale
in interface Projection
getScale
in class Proj
ulWorldPoint
- the upper left coordinates of the bounding box.lrWorldPoint
- 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 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 java.awt.geom.Point2D getCenter()
Proj
getCenter
in interface Projection
getCenter
in class Proj
public double getBottomLimit()
public void setBottomLimit(double bottomLimit)
public double getLeftLimit()
public void setLeftLimit(double leftLimit)
public java.awt.geom.Point2D getLimitAnchorPoint()
public void setLimitAnchorPoint(java.awt.geom.Point2D limitAnchorPoint)
public double getRightLimit()
public void setRightLimit(double rightLimit)
public double getTopLimit()
public void setTopLimit(double topLimit)
public void setLimits(double top, double bottom, double left, double right, java.awt.geom.Point2D anchor)
Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details