Class Projection
- Direct Known Subclasses:
ProjectionCyl,ProjectionMerc,ProjectionOrtho
A projection for a globe on a flat surface (must be subclassed).
© 2002 Christian Treber, ct@ctreber.com
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoublefinalizeX(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.doublefinalizeY(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 CoordinategetLocation(int pX, int pY) Translate screen point into coordinate on Earth.doublegetScale()voidInitialize transform parameters, set offset to center of image (plus shifts), set scaledoubleinverseFinalizeX(double x) Transform screen to image coordinates.doubleinverseFinalizeY(double y) Transform screen to image coordinates.abstract doubleinverseProjectX(double pX) abstract doubleinverseProjectY(double pY) abstract booleanbooleanisWithinImage(Point2D pPoint) Imagine view the globe, N is up, S is down, and N0E0 is in the center.protected abstract doubleprojectX(double pX, double pZ) Project 3D point on x axis.abstract doubleprojectY(double pY) Project 3D point on y axis.Rotate the point according to the current rotation of Earth.rotateReverse(Point3D pPoint) voidsetImageHeight(int pImageHeight) voidsetImageWidth(int pImageWidth) protected abstract voidsetScale()voidsetShiftX(int pX) voidsetShiftY(int pY) voidsetViewMagnification(double pViewMagnification) voidsetViewPos(Coordinate pViewPos) voidsetViewRotation(double pViewRotation)
-
Constructor Details
-
Projection
public Projection()
-
-
Method Details
-
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
-
isWithinImage
-
getLocation
Translate screen point into coordinate on Earth.
- Parameters:
pX-pY-- Returns:
-
project2D
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:
-
finalize
-
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
Rotate the point according to the current rotation of Earth.
-
rotateReverse
-
getScale
public double getScale() -
getViewPos
-
setViewMagnification
public void setViewMagnification(double pViewMagnification) -
setViewPos
-
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)
-