view
Class AzimuthalProjection

java.lang.Object
  extended by view.TwoDimensionPixel
      extended by view.AzimuthalProjection
All Implemented Interfaces:
ScreenPixel

public abstract class AzimuthalProjection
extends TwoDimensionPixel

Abstract base class for sphere to planar projections. This class is only used for azimuthal projection, i.e. projections with a defined center of projection. The simpliest application is the orthonormal projection. The coordinate system used on the sphere is the longitude/latitude system, commonly used in astronomy and geography.
The method invert returns the longitude in zero index, latitude follows. getPoint and getError also expects longitude as the first argument.


Field Summary
private  boolean CenValid
          Center of projection set.
protected  double CosLat
           
protected  double CosLong
          Trignomotric functions of the projection center.
protected  boolean Distort
          Distortion allowed.
protected  double LatC
          Center of projection.
protected  double LongC
          Center of projection.
protected static String Name
          Name of projection.
protected  double SinLat
           
protected  double SinLong
          Trignomotric functions of the projection center.
private  boolean TriValid
          Trignomotric functions of the projection center set.
protected  double XConvert
          Conversion factor to pixels in x.
protected  double YConvert
          Conversion factor to pixels in y.
 
Constructor Summary
AzimuthalProjection(double longc, double latc)
          Constructs a new AzimuthalProjection with given projectional center.
AzimuthalProjection(double longsin, double longcos, double latsin, double latcos)
          Constructs a new AzimuthalProjection with given sines and cosines of the center of projection.
 
Method Summary
protected  void calcCen()
          Calculates the values of the central longitude and latitude.
abstract  double calcLambda(double x, double y)
          Calculates the spherical longitude from planar coordinates.
abstract  double calcPhi(double x, double y)
          Calculates the spherical latitude from planar coordinates.
protected  void calcTri()
          Calculates the values of the sines and cosines of the central longitude and latitude.
abstract  double calcX(double lambda, double phi)
          Calculates the planar x coordinate from the spherical coordinates.
abstract  double calcY(double lambda, double phi)
          Calculates the planar y coordinate from the spherical coordinates.
 boolean equals(Object that)
          Tests, if two AzimuthalProjections are equal.
 double getCentralLatitude()
          Returns the latitude of the center of projection.
 double getCentralLongitude()
          Returns the longitude of the center of projection.
 double getXMax()
          Returns the maximal x coordinate served by this AzimuthalProjection.
 double getYMax()
          Returns the maximal y coordinate served by this AzimuthalProjection.
 boolean setConversion(double xconv, double yconv)
          Sets the conversion factors.
 void setDistortion(boolean distort)
          Enables or disables distortion.
 String toString()
          Converts this AzimuthalProjection into a String.
 
Methods inherited from class view.TwoDimensionPixel
getError, getPoint, invert
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface view.ScreenPixel
getError, getPoint, update
 

Field Detail

LongC

protected double LongC
Center of projection. Longitude in radians.


LatC

protected double LatC
Center of projection. Latitude in radians.


CenValid

private boolean CenValid
Center of projection set.


SinLong

protected double SinLong
Trignomotric functions of the projection center.


CosLong

protected double CosLong
Trignomotric functions of the projection center.


SinLat

protected double SinLat

CosLat

protected double CosLat

TriValid

private boolean TriValid
Trignomotric functions of the projection center set.


XConvert

protected double XConvert
Conversion factor to pixels in x.


YConvert

protected double YConvert
Conversion factor to pixels in y.


Distort

protected boolean Distort
Distortion allowed. This means x/y radian differences may show up as different pixel distances.


Name

protected static String Name
Name of projection.

Constructor Detail

AzimuthalProjection

public AzimuthalProjection(double longc,
                           double latc)
Constructs a new AzimuthalProjection with given projectional center. The sines and cosines of the center are not calculated until request.

Parameters:
longc - Longitude of projection center, in radians.
latc - Latitude of projection center, in radians.

AzimuthalProjection

public AzimuthalProjection(double longsin,
                           double longcos,
                           double latsin,
                           double latcos)
Constructs a new AzimuthalProjection with given sines and cosines of the center of projection. Does not calculate the central longitude until asked with a call to getCentral...

Parameters:
longsin - Sine of the longitude of the projection center.
longcos - Cosine of the longitude of the projection center.
latsin - Sine of the latitude of the projection center.
latcos - Cosine of the latitude of the projection center.
Method Detail

calcTri

protected void calcTri()
Calculates the values of the sines and cosines of the central longitude and latitude. Checks, if the trignometric values have already be calculated for faster execution.


getCentralLongitude

public double getCentralLongitude()
Returns the longitude of the center of projection. If this AzimuthalProjection was constructed with the sines/cosines of the center, the reverse procedure is called, setting both central coordinates.

Returns:
The longitude of the projection center in radians.

getCentralLatitude

public double getCentralLatitude()
Returns the latitude of the center of projection. If this AzimuthalProjection was constructed with the sines/cosines of the center, the reverse procedure is called, setting both central coordinates.

Returns:
The latitude of the projection center in radians.

calcCen

protected void calcCen()
Calculates the values of the central longitude and latitude. If these values are already known, the trignometric calls are not commenced to save time.


setConversion

public boolean setConversion(double xconv,
                             double yconv)
Sets the conversion factors. Normally, x and y are restricted to a circle with unit radius, therefore the conversion factors are unity. Clipping the image to a part of the sphere induces x/y pairs sometimes well below unity. The conversion factors are the (absolute) maxima of all the x/y pairs available.
This routine is called by the update method.

Parameters:
xconv - The absolute maximum of all valid x-coordinates
yconv - The absolute maximum of all valid y-coordinates

getXMax

public double getXMax()
Returns the maximal x coordinate served by this AzimuthalProjection. Equals the conversion factor.


getYMax

public double getYMax()
Returns the maximal y coordinate served by this AzimuthalProjection. Equals the conversion factor.


setDistortion

public void setDistortion(boolean distort)
Enables or disables distortion. Distorted maps use different scaling factors in x and y direction to optimize screen usage.

Parameters:
distort - True, if distortion is allowed.

calcX

public abstract double calcX(double lambda,
                             double phi)
Calculates the planar x coordinate from the spherical coordinates.

Parameters:
lambda - The longitude in radians.
phi - The latitude in radians.

calcY

public abstract double calcY(double lambda,
                             double phi)
Calculates the planar y coordinate from the spherical coordinates.

Parameters:
lambda - The longitude in radians.
phi - The latitude in radians.

calcLambda

public abstract double calcLambda(double x,
                                  double y)
Calculates the spherical longitude from planar coordinates. Planar coordinates means undistorted ones.

Parameters:
x - The planar x coordinate
y - The planar y coordinate

calcPhi

public abstract double calcPhi(double x,
                               double y)
Calculates the spherical latitude from planar coordinates. Planar coordinates means undistorted ones.

Parameters:
x - The planar x coordinate
y - The planar y coordinate

equals

public boolean equals(Object that)
Tests, if two AzimuthalProjections are equal. Equality is given, if the central longitude and latitudes are equal.

Overrides:
equals in class Object

toString

public String toString()
Converts this AzimuthalProjection into a String.

Overrides:
toString in class Object