Class Projection
- java.lang.Object
-
- ext.plantuml.com.ctreber.acearth.projection.Projection
-
- Direct Known Subclasses:
ProjectionCyl
,ProjectionMerc
,ProjectionOrtho
public abstract class Projection extends Object
A projection for a globe on a flat surface (must be subclassed).
© 2002 Christian Treber, [email protected]
- Author:
- Christian Treber, [email protected]
-
-
Constructor Summary
Constructors Constructor Description Projection()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Point2D
finalize(Point2D pPoint)
double
finalizeX(double pX)
Since the final mapping is relative to the center of the image -PI and PI get mapped to the left and right border respectively.double
finalizeY(double pY)
Since the final mapping is relative to the center of the image -PI and PI get mapped to the bottom and top border respectively.abstract Coordinate
getLocation(int pX, int pY)
Translate screen point into coordinate on Earth.double
getScale()
Coordinate
getViewPos()
void
initTransformTable()
Initialize transform parameters, set offset to center of image (plus shifts), set scaledouble
inverseFinalizeX(double x)
Transform screen to image coordinates.double
inverseFinalizeY(double y)
Transform screen to image coordinates.abstract double
inverseProjectX(double pX)
abstract double
inverseProjectY(double pY)
abstract boolean
isVisible(Point3D pPoint)
boolean
isWithinImage(Point2D pPoint)
Point2D
project2D(Point3D pPoint)
Imagine view the globe, N is up, S is down, and N0E0 is in the center.protected abstract double
projectX(double pX, double pZ)
Project 3D point on x axis.abstract double
projectY(double pY)
Project 3D point on y axis.Point3D
rotate(Point3D pPoint)
Rotate the point according to the current rotation of Earth.Point3D
rotateReverse(Point3D pPoint)
void
setImageHeight(int pImageHeight)
void
setImageWidth(int pImageWidth)
protected abstract void
setScale()
void
setShiftX(int pX)
void
setShiftY(int pY)
void
setViewMagnification(double pViewMagnification)
void
setViewPos(Coordinate pViewPos)
void
setViewRotation(double pViewRotation)
-
-
-
Method Detail
-
initTransformTable
public void initTransformTable()
Initialize transform parameters, set offset to center of image (plus shifts), set scale
-
setScale
protected abstract void setScale()
-
projectY
public abstract double projectY(double pY)
Project 3D point on y axis.
-
inverseProjectY
public abstract double inverseProjectY(double pY)
-
projectX
protected abstract double projectX(double pX, double pZ)
Project 3D point on x axis.
-
inverseProjectX
public abstract double inverseProjectX(double pX)
-
isVisible
public abstract boolean isVisible(Point3D pPoint)
-
isWithinImage
public boolean isWithinImage(Point2D pPoint)
-
getLocation
public abstract Coordinate getLocation(int pX, int pY)
Translate screen point into coordinate on Earth.
- Parameters:
pX
-pY
-- Returns:
-
project2D
public Point2D project2D(Point3D pPoint)
Imagine view the globe, N is up, S is down, and N0E0 is in the center. x is right/left, y is up/down, and z is front/rear.
Map points are located on the surface of a unit sphere (diameter = 1). Latitude is the angle between x and y or z and y. Longitude is the angle between x and z.
Why? The way we choose our global coordinate system, longitude circles (latidude variable) always have the same size while the size of latidude circles (longitude variable) depends on the latitude.
- Parameters:
pPoint
-- Returns:
-
finalizeX
public double finalizeX(double pX)
Since the final mapping is relative to the center of the image -PI and PI get mapped to the left and right border respectively. But see ProjectionOrtho.setScale().
-
finalizeY
public double finalizeY(double pY)
Since the final mapping is relative to the center of the image -PI and PI get mapped to the bottom and top border respectively. But see ProjectionOrtho.setScale().
-
inverseFinalizeX
public double inverseFinalizeX(double x)
Transform screen to image coordinates.
-
inverseFinalizeY
public double inverseFinalizeY(double y)
Transform screen to image coordinates.
-
rotate
public Point3D rotate(Point3D pPoint)
Rotate the point according to the current rotation of Earth.
-
getScale
public double getScale()
-
getViewPos
public Coordinate getViewPos()
-
setViewMagnification
public void setViewMagnification(double pViewMagnification)
-
setViewPos
public void setViewPos(Coordinate pViewPos)
-
setShiftX
public void setShiftX(int pX)
-
setShiftY
public void setShiftY(int pY)
-
setViewRotation
public void setViewRotation(double pViewRotation)
-
setImageWidth
public void setImageWidth(int pImageWidth)
-
setImageHeight
public void setImageHeight(int pImageHeight)
-
-