fable.imageviewer.internal
Class Coordinates

java.lang.Object
  extended by fable.imageviewer.internal.Coordinates
All Implemented Interfaces:
IImagesVarKeys

public class Coordinates
extends java.lang.Object
implements IImagesVarKeys

Class to manage the coordinates used to display the mouse position. These coordinates apply to the oriented image, not the raw image. They use the form:

x1 = pixelWidth * (x - x0)
y1 = pixelHeight * (y - y0)

where x and y are the image coordinates with origin at top left.

Author:
evans

Field Summary
 
Fields inherited from interface fable.imageviewer.internal.IImagesVarKeys
BTN_IMG_ADD, BTN_IMG_ADD_PLOT, BTN_IMG_DELETE, BTN_IMG_SETTINGS, BTN_IMG_SUBTRACT, BTN_IMG_SUBTRACT_PLOT, COORD_BL, COORD_BR, COORD_CUSTOM, COORD_TL, COORD_TR, coordNameValues, O_MOOM, O_MOOP, O_OMMO, O_OMPO, O_OPMO, O_OPPO, O_POOM, O_POOP, orientNameValues, PALETTE_AUTUMN, PALETTE_BLUES, PALETTE_COLOR, PALETTE_GREENS, PALETTE_GREY, PALETTE_PASTEL1, PALETTE_RAINBOW1, PALETTE_RAINBOW2, PALETTE_REDS, PALETTE_SPRING, PALETTE_SUMMER, PALETTE_WINTER, paletteNameValues
 
Constructor Summary
Coordinates()
          Constructor that uses the default values.
Coordinates(int type, double width, double height)
          Constructor that sets the parameters based on the width and height of the oriented image.
Coordinates(int type, double x0, double y0, double pixelWidth, double pixelHeight, java.lang.String xName, java.lang.String yName)
          Constructor that sets all the parameters.
 
Method Summary
 double[] getCoordinatesFromOriented(org.eclipse.swt.graphics.Point point)
          Gets the double coordinates given the integer oriented image coordinates.
 java.lang.String getCoordinateString(int x, int y)
          Gets a String with the coordinates given the oriented image coordinates.
 java.lang.String getCoordinateString(int x, int y, float pixelValue)
          Gets a String with the coordinates given the oriented image coordinates and the pixel value.
 double getPixelHeight()
           
 double getPixelWidth()
           
 int getType()
           
 double getX0()
           
 java.lang.String getXName()
           
 double getY0()
           
 java.lang.String getYName()
           
 boolean isXInverted()
          Determines whether the x axis is inverted, that is, whether values increase to the left or not.
 boolean isYInverted()
          Determines whether the y axis is inverted, that is, whether values increase upward or not.
 void reset(int type, double width, double height)
          Resets the values based on the width and height of the oriented image.
 void reset(int type, double x0, double y0, double pixelWidth, double pixelHeight, java.lang.String xName, java.lang.String yName)
          Resets all the parameters.
 void resetToDefault()
          Set the values to the defaults.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Coordinates

public Coordinates()
Constructor that uses the default values.


Coordinates

public Coordinates(int type,
                   double width,
                   double height)
Constructor that sets the parameters based on the width and height of the oriented image. Used with all but custom.

Parameters:
type -
width -
height -

Coordinates

public Coordinates(int type,
                   double x0,
                   double y0,
                   double pixelWidth,
                   double pixelHeight,
                   java.lang.String xName,
                   java.lang.String yName)
Constructor that sets all the parameters. Used for custom.

Parameters:
type -
x0 -
y0 -
pixelWidth -
pixelHeight -
xName -
yName -
Method Detail

resetToDefault

public void resetToDefault()
Set the values to the defaults.


reset

public void reset(int type,
                  double width,
                  double height)
Resets the values based on the width and height of the oriented image. Used with all but custom. Should be used when the orientation changes or the image width and height change.

Parameters:
type -
width -
height -

reset

public void reset(int type,
                  double x0,
                  double y0,
                  double pixelWidth,
                  double pixelHeight,
                  java.lang.String xName,
                  java.lang.String yName)
Resets all the parameters. Used for custom.

Parameters:
type -
x0 -
y0 -
pixelWidth -
pixelHeight -
xName -
yName -

getCoordinatesFromOriented

public double[] getCoordinatesFromOriented(org.eclipse.swt.graphics.Point point)
Gets the double coordinates given the integer oriented image coordinates.

Parameters:
point - The oriented image coordinates (x,y).
Returns:

getCoordinateString

public java.lang.String getCoordinateString(int x,
                                            int y)
Gets a String with the coordinates given the oriented image coordinates. Does not include the pixel value.

Parameters:
x -
y -
Returns:

getCoordinateString

public java.lang.String getCoordinateString(int x,
                                            int y,
                                            float pixelValue)
Gets a String with the coordinates given the oriented image coordinates and the pixel value.

Parameters:
x -
y -
pixelValue -
Returns:

isXInverted

public boolean isXInverted()
Determines whether the x axis is inverted, that is, whether values increase to the left or not.

Returns:

isYInverted

public boolean isYInverted()
Determines whether the y axis is inverted, that is, whether values increase upward or not.

Returns:

getX0

public double getX0()
Returns:
the x0

getY0

public double getY0()
Returns:
the y0

getPixelWidth

public double getPixelWidth()
Returns:
the pixelWidth

getPixelHeight

public double getPixelHeight()
Returns:
the pixelHeight

getXName

public java.lang.String getXName()
Returns:
the xName

getYName

public java.lang.String getYName()
Returns:
the yName

getType

public int getType()
Returns:
the type