jview
Class CylindricalProjection

java.lang.Object
  extended by jview.AbstractFormattingTransform
      extended by jview.CylindricalProjection
All Implemented Interfaces:
CoordinateTransforming, DeltaFormattedTransforming, DeltaTransforming, FormattedTransforming
Direct Known Subclasses:
CylindricalEqualAreaProjection, CylindricalEquidistantProjection, MercatorProjection

public class CylindricalProjection
extends AbstractFormattingTransform

Base class for cylindrical projections of geographic coordinates longitude λ and latitude φ, both measured in degrees. Longitudes to the east are positive. From a central meridian, λ_0 , and a k_0, you get to NormalizedCoordinates via.

   x = confine360(λ-λ_0+180.)/360.
   y = 0.5-k_0*tan(φ), |φ| < atan(1/2k_0) 
   
The name is kept also for non-straight cylindrical projections, that change the y-dependency.
Each cylindrical projection should provide a default constructor and a constructor with a single double, the central meridian.


Field Summary
private  double k0
          The k0 factor for phi scaling.
protected  double lambda0
          The central meridian.
private  boolean sexagesimal
          If true, we use sexagesimal format.
static double TOPLATITUDE
          The default highest latitude to show.
 
Constructor Summary
  CylindricalProjection()
          Constructs a new cylindrical Projection for the greenwhich standard.
  CylindricalProjection(double l0)
          Constructs a new cylindrical Projection for the given standard, scaling such that all up to TOPLATITUDE is visible.
protected CylindricalProjection(double l0, double k)
          Constructs a cylindrical Projection with the given central meridian and a scaling factor for y.
 
Method Summary
protected  Format deduceFormat(double degrees)
          Returns a format that is decued from the viewing size.
 Format estimateX(double xs)
          Estimates the decimal formatter to use on the axis.
 Format estimateY(double xs)
          Estimates the decimal formatter to use on the axis.
protected  double getLambda(Point2D norm)
          The standard cylindrical projection uses
protected  double getPhi(Point2D norm)
          This method is normally overriddn, as cylindric projection is a general term used for other projection with the same x, but different y transformation.
protected  double getScale()
          Returns the scaling factor.
protected  double getX(VectorG lamphi)
          The standard cylindrical projection uses
protected  double getY(VectorG lamphi)
          This method is normally overriddn, as cylindric projection is a general term used for other projection with the same x, but different y transformation.
 void setSexagesimal(boolean sex)
          Sets the sexagesimal scale in the format.
 Point2D toNormalizedDistance(VectorG location, VectorG delta)
          We call the #toNormalized twice and return the difference.
 Point2D toNormalizedSpace(VectorG lamphi)
          Converts user space corrdinates, which are a longitude/latitude pair in degrees into x/y.
 VectorG toUserDistance(Rectangle2D norm)
          We call the toUserSpace(java.awt.geom.Point2D) twice and return the difference.
 VectorG toUserSpace(Point2D pix)
          Converts normalized space into user space.
 
Methods inherited from class jview.AbstractFormattingTransform
deltaFormatUserSpaceX, deltaFormatUserSpaceY, formatUserCoordinates, formatUserSpaceX, formatUserSpaceY, getFormatUserX, getFormatUserY, setDeltaFormatUserX, setDeltaFormatUserY, setFormatUserX, setFormatUserY, useEstimatedFormats
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TOPLATITUDE

public static final double TOPLATITUDE
The default highest latitude to show.

See Also:
Constant Field Values

lambda0

protected double lambda0
The central meridian.


k0

private double k0
The k0 factor for phi scaling.


sexagesimal

private boolean sexagesimal
If true, we use sexagesimal format.

Constructor Detail

CylindricalProjection

public CylindricalProjection()
Constructs a new cylindrical Projection for the greenwhich standard.


CylindricalProjection

public CylindricalProjection(double l0)
Constructs a new cylindrical Projection for the given standard, scaling such that all up to TOPLATITUDE is visible.


CylindricalProjection

protected CylindricalProjection(double l0,
                                double k)
Constructs a cylindrical Projection with the given central meridian and a scaling factor for y.

Method Detail

getScale

protected double getScale()
Returns the scaling factor.


toNormalizedSpace

public Point2D toNormalizedSpace(VectorG lamphi)
Converts user space corrdinates, which are a longitude/latitude pair in degrees into x/y. Lambda is positve to the east.

Parameters:
lamphi - A vector of user coordinates.
Returns:
A point in normalized screen coordinate, with 0≤x,y≤1

toUserSpace

public VectorG toUserSpace(Point2D pix)
Converts normalized space into user space.

Parameters:
pix - A pixel in normalized coordinates.
Returns:
A vector in user space, never null

getX

protected double getX(VectorG lamphi)
The standard cylindrical projection uses
       x = confine360(λ-λ_0+180.)/360.
       


getY

protected double getY(VectorG lamphi)
This method is normally overriddn, as cylindric projection is a general term used for other projection with the same x, but different y transformation. The standard cylindrcal projection uses
       y = 0.5-k_0*tan(φ), |φ| < atan(1/2k_0) 
       


getLambda

protected double getLambda(Point2D norm)
The standard cylindrical projection uses
       λ=confine360(360*x+λ_0)-180.
       


getPhi

protected double getPhi(Point2D norm)
This method is normally overriddn, as cylindric projection is a general term used for other projection with the same x, but different y transformation. The standard cylindrcal projection uses
       φ = atan((0.5-y)/k_0)
       


toNormalizedDistance

public Point2D toNormalizedDistance(VectorG location,
                                    VectorG delta)
We call the #toNormalized twice and return the difference.


toUserDistance

public VectorG toUserDistance(Rectangle2D norm)
We call the toUserSpace(java.awt.geom.Point2D) twice and return the difference.


estimateX

public Format estimateX(double xs)
Estimates the decimal formatter to use on the axis.


estimateY

public Format estimateY(double xs)
Estimates the decimal formatter to use on the axis.


setSexagesimal

public void setSexagesimal(boolean sex)
Sets the sexagesimal scale in the format.


deduceFormat

protected Format deduceFormat(double degrees)
Returns a format that is decued from the viewing size. If distance is smaller than 1 arcmin, we always use scientific notation.