public class Mercator extends Cylindrical
Modifier and Type | Field and Description |
---|---|
protected double |
asinh_of_tanCtrLat |
protected static double |
epsilon |
protected double |
hy |
protected static int |
MAX_RHUMB_SEGS |
static java.lang.String |
MercatorName
The Mercator name.
|
protected double |
tanCtrLat |
protected double |
wx |
half_world, world
DATELINE, mercator, NORTH_POLE, NUM_DEFAULT_CIRCLE_VERTS, NUM_DEFAULT_GREAT_SEGS, pixelsPerMeter, planetPixelCircumference, planetPixelRadius, planetRadius, scaled_radius, SOUTH_POLE, XSCALE_THRESHOLD, XTHRESHOLD
Constructor and Description |
---|
Mercator(LatLonPoint center,
float scale,
int width,
int height)
Construct a Mercator projection.
|
Modifier and Type | Method and Description |
---|---|
protected void |
computeParameters()
Called when some fundamental parameters change.
|
java.awt.geom.Point2D |
forward(double lat,
double lon,
java.awt.geom.Point2D p,
boolean isRadian)
Forward projects lat,lon into XY space and returns a Point2D.
|
java.lang.String |
getName()
Get the name string of the projection.
|
<T extends java.awt.geom.Point2D> |
inverse(double x,
double y,
T llp)
Inverse project x,y coordinates into a LatLonPoint.
|
boolean |
isPlotable(double lat,
double lon)
Checks if a LatLonPoint is plot-able.
|
double |
normalizeLatitude(double lat)
Sets radian latitude to something sane.
|
protected float[] |
rhumbProject(java.awt.geom.Point2D from,
java.awt.geom.Point2D to,
boolean include_last,
int nsegs)
Calculates the points along a rhumbline between two XY points.
|
protected double[] |
rhumbProjectDouble(java.awt.geom.Point2D from,
java.awt.geom.Point2D to,
boolean include_last,
int nsegs)
Calculates the points along a rhumbline between two XY points.
|
protected static int |
rhumbStep(java.awt.geom.Point2D pt1,
java.awt.geom.Point2D pt2)
Computes the best stepping factor for a rhumbline.
|
java.lang.String |
toString()
Return stringified description of this projection.
|
_forwardPoly, _forwardPoly, dumpPoly, dumpPoly, forwardRaw, forwardRaw, getLowerRight, getUpperLeft, init, pan
assertLatLonPoint, clone, doPolyDispatch, doPolyDispatch, forward, forward, forward, forward, forwardArc, forwardArc, forwardArc, forwardCircle, forwardCircle, forwardCircle, forwardGreatPoly, forwardGreatPoly, forwardLine, forwardLine, forwardLLPoly, forwardPoly, forwardPoly, forwardRect, forwardRect, forwardRect, forwardRhumbPoly, forwardRhumbPoly, getCenter, getCenter, getGCTForProjection, getPlanetPixelCircumference, getPlanetPixelRadius, getPlanetRadius, getPPM, getReferenceLon, getScale, getUcuom, inverse, inverse, isComplicatedLineType, isPlotable, normalize_latitude, normalizeLatitude, pan, setCenter, setCenter, setCenter, setPlanetRadius, setPPM, setUcuom, wrap_longitude, wrapLongitude, wrapLongitude, wrapLongitudeDeg
drawBackground, drawBackground, equals, forward, forward, forward, forwardLine, forwardPoly, forwardPoly, forwardRect, forwardShape, getHeight, getMaxScale, getMinScale, getProjectionID, getScale, getWidth, hashCode, inverse, isPlotable, makeClone, panE, panE, panN, panN, panNE, panNE, panNW, panNW, panS, panS, panSE, panSE, panSW, panSW, panW, panW, setCenter, setHeight, setMaxScale, setMinScale, setParms, setProjectionID, setScale, setWidth
public static final transient java.lang.String MercatorName
protected static final int MAX_RHUMB_SEGS
protected static double epsilon
protected transient double hy
protected transient double wx
protected transient double tanCtrLat
protected transient double asinh_of_tanCtrLat
public Mercator(LatLonPoint center, float scale, int width, int height)
center
- LatLonPoint center of projectionscale
- float scale of projectionwidth
- width of screenheight
- height of screenpublic java.lang.String toString()
toString
in class Cylindrical
Projection.getProjectionID()
protected 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.
computeParameters
in class Cylindrical
public double normalizeLatitude(double lat)
normalizeLatitude
in class GeoProj
lat
- float latitude in radianspublic boolean isPlotable(double lat, double lon)
A point is always plot-able in the Mercator projection (even the North and South poles since we normalize latitude).
lat
- double latitude in decimal degreeslon
- double longitude in decimal degreespublic java.awt.geom.Point2D forward(double lat, double lon, java.awt.geom.Point2D p, boolean isRadian)
public <T extends java.awt.geom.Point2D> T inverse(double x, double y, T llp)
inverse
in interface Projection
inverse
in class Proj
x
- integer x coordinatey
- integer y coordinatellp
- LatLonPointProj.inverse(Point2D)
protected static final int rhumbStep(java.awt.geom.Point2D pt1, java.awt.geom.Point2D pt2)
Computes the best stepping factor between two x,y points in order to interpolate points on a rhumb line. (We calculate rhumb lines by forward projecting the line in the Mercator projection, and then calculating segments along the straight line between them.)
pt1
- Point2Dpt2
- Point2Dprotected float[] rhumbProject(java.awt.geom.Point2D from, java.awt.geom.Point2D to, boolean include_last, int nsegs)
Loxodromes are straight in the Mercator projection. Calculate a bunch of extra points between the two points, inverse project back into LatLons and return all the vertices.
from
- Point2Dto
- Point2Dinclude_last
- include the very last point?nsegs
- number of segmentsprotected double[] rhumbProjectDouble(java.awt.geom.Point2D from, java.awt.geom.Point2D to, boolean include_last, int nsegs)
Loxodromes are straight in the Mercator projection. Calculate a bunch of extra points between the two points, inverse project back into LatLons and return all the vertices.
from
- Point2Dto
- Point2Dinclude_last
- include the very last point?nsegs
- number of segmentspublic java.lang.String getName()
getName
in interface Projection
getName
in class Cylindrical
Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details