jview
Class AbstractFormattingTransform

java.lang.Object
  extended by jview.AbstractFormattingTransform
All Implemented Interfaces:
CoordinateTransforming, DeltaFormattedTransforming, DeltaTransforming, FormattedTransforming
Direct Known Subclasses:
BasicTransform, CylindricalProjection, JFitsCanvas.PixelCoordinate, OrthographicTransformation

public abstract class AbstractFormattingTransform
extends Object
implements FormattedTransforming, DeltaFormattedTransforming

This class is a basic morpher in the way that it comprises a linear mapping in x and y to pixel space starting at 0,0 with an extend of 1x1. It can be constructed either giving the extend of the true coordinate space or the true coordinate space with an offset. The default formatting is done with the default number format instances, as returned by NumberFormat.getNumberInstance(). It may be changed with a call to the appropriate set...Format methods.


Field Summary
private  Format dxprim
          A formatter for primary x distances.
private  Format dyprim
          A formatter for primary y distances.
private  Format xprim
          A formatter for primary x coordinates.
private  Format yprim
          A formatter for primary y coordinates.
 
Constructor Summary
protected AbstractFormattingTransform()
          Constructs a new abstract format.
 
Method Summary
 String deltaFormatUserSpaceX(Rectangle2D delta)
          Formats the x-coordinate difference of a secondary x-distance.
 String deltaFormatUserSpaceY(Rectangle2D delta)
          Formats the y-coordinate difference of a secondary y-distance.
private static String formatDouble(Format f, double x)
          Takes the specified format and proceeds into converting the double in the following way: If the format is a number format, use it directly on the double. If the format is a date format, interpret x as a JD and convert it to a time stamp.
 List formatUserCoordinates(Point2D pixel)
          Formats the x-coordinate of a primary x-coordinate.
 String formatUserSpaceX(Point2D pixel)
          Formats the x-coordinate of a secondary x-coordinate.
 String formatUserSpaceY(Point2D pixel)
          Formats the y-coordinate of a secondary y-coordinate.
 Format getFormatUserX()
          Gets the formatter assigned to the primary x coordinate.
 Format getFormatUserY()
          Changes the default formatting for the primary y coordinate.
 void setDeltaFormatUserX(Format nf)
          Changes the default formatting for the primary x distance.
 void setDeltaFormatUserY(Format nf)
          Changes the default formatting for the primary y distance.
 void setFormatUserX(Format nf)
          Changes the default formatting for the primary x coordinate.
 void setFormatUserY(Format nf)
          Changes the default formatting for the primary y coordinate.
 void useEstimatedFormats(Rectangle2D view, int xp, int yp)
          Estimates the decimal formatter to use on the axis.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface jview.FormattedTransforming
estimateX, estimateY
 
Methods inherited from interface jview.DeltaTransforming
toNormalizedDistance, toUserDistance
 
Methods inherited from interface jview.CoordinateTransforming
toNormalizedSpace, toUserSpace
 

Field Detail

xprim

private Format xprim
A formatter for primary x coordinates.


yprim

private Format yprim
A formatter for primary y coordinates.


dxprim

private Format dxprim
A formatter for primary x distances.


dyprim

private Format dyprim
A formatter for primary y distances.

Constructor Detail

AbstractFormattingTransform

protected AbstractFormattingTransform()
Constructs a new abstract format.

Method Detail

formatUserSpaceX

public String formatUserSpaceX(Point2D pixel)
Formats the x-coordinate of a secondary x-coordinate. Should be called with the Point2D.getX() from the #toSecondary return.

Specified by:
formatUserSpaceX in interface FormattedTransforming
Parameters:
pixel - The screen coordinate in normalized form.
Returns:
A formatted version of the argument.

formatUserSpaceY

public String formatUserSpaceY(Point2D pixel)
Formats the y-coordinate of a secondary y-coordinate. Should be called with the Point2D.getY() from the #toSecondary return.

Specified by:
formatUserSpaceY in interface FormattedTransforming
Parameters:
pixel - The screen coordinate in normalized form.
Returns:
A formatted version of the argument.

formatUserCoordinates

public List formatUserCoordinates(Point2D pixel)
Formats the x-coordinate of a primary x-coordinate. Should be called with the Point2D.getX() from the #toPrimary return.

Specified by:
formatUserCoordinates in interface FormattedTransforming
Parameters:
pixel - The screen coordinate in normalized form.
Returns:
A formatted version of the argument.

deltaFormatUserSpaceX

public String deltaFormatUserSpaceX(Rectangle2D delta)
Formats the x-coordinate difference of a secondary x-distance. Should be called with the Point2D.getX() difference from two #toSecondary calls.

Specified by:
deltaFormatUserSpaceX in interface DeltaFormattedTransforming
Returns:
A formatted version of the argument.

deltaFormatUserSpaceY

public String deltaFormatUserSpaceY(Rectangle2D delta)
Formats the y-coordinate difference of a secondary y-distance. Should be called with the Point2D.getY() difference from two #toPrimary calls.

Specified by:
deltaFormatUserSpaceY in interface DeltaFormattedTransforming
Returns:
A formatted version of the argument.

setFormatUserX

public void setFormatUserX(Format nf)
Changes the default formatting for the primary x coordinate.


getFormatUserX

public Format getFormatUserX()
Gets the formatter assigned to the primary x coordinate.

Specified by:
getFormatUserX in interface FormattedTransforming

setFormatUserY

public void setFormatUserY(Format nf)
Changes the default formatting for the primary y coordinate.


getFormatUserY

public Format getFormatUserY()
Changes the default formatting for the primary y coordinate.

Specified by:
getFormatUserY in interface FormattedTransforming

setDeltaFormatUserX

public void setDeltaFormatUserX(Format nf)
Changes the default formatting for the primary x distance.


setDeltaFormatUserY

public void setDeltaFormatUserY(Format nf)
Changes the default formatting for the primary y distance.


useEstimatedFormats

public void useEstimatedFormats(Rectangle2D view,
                                int xp,
                                int yp)
Estimates the decimal formatter to use on the axis.

Specified by:
useEstimatedFormats in interface FormattedTransforming

formatDouble

private static String formatDouble(Format f,
                                   double x)
Takes the specified format and proceeds into converting the double in the following way: