apollo.gui
Class Transformer

java.lang.Object
  extended by apollo.gui.Transformer

public class Transformer
extends java.lang.Object

A class to perform coordinate transformations between pixel and user coordinates.


Nested Class Summary
 class Transformer.PixelRange
           
 
Field Summary
static int DOWN
           
static int LEFT
           
static int RIGHT
           
static int UP
          Directions for Y axis (setYOrientation)
 
Constructor Summary
Transformer(java.awt.Rectangle bounds)
           
Transformer(java.awt.Rectangle pixelBounds, java.awt.Rectangle userBounds)
           
 
Method Summary
 Transformer.PixelRange basepairRangeToPixelRange(RangeI range)
          This takes care of doing the inclusion at the end of base pair ranges and compensates for xOrientation.
 java.lang.Object clone()
           
 java.awt.Point fromPixel(java.awt.Point pixel)
           
 java.awt.Point fromUser(java.awt.Point user)
           
 java.awt.Rectangle getPixelBounds()
           
 int getXCentre()
           
 double getXCoordsPerPixel()
           
 int getXMaximum()
           
 int getXMinimum()
           
 int getXOrientation()
          This can be Transformer.LEFT and Transformer.RIGHT.
 double getXPixelsPerCoord()
           
 int[] getXRange()
           
 int[] getXVisibleRange()
           
 int getYCentre()
           
 double getYCoordsPerPixel()
           
 int getYMaximum()
           
 int getYMinimum()
           
 int getYOrientation()
           
 double getYPixelsPerCoord()
           
 int[] getYRange()
           
 int[] getYVisibleRange()
           
static void main(java.lang.String[] argv)
           
 int maxXPixelAtUserCoord(int user)
          This gives the pixel value at the end of the base pair, which is halfway between the basepair(user) and the next basepair(user+1).
 int maxXUserCoordAtPixel(int pixel)
           
 int minXPixelAtUserCoord(int user)
          This gives the pixel value at the beginning of the base pair, which is halfway between the basepair(user) and the previous basepair(user-1).
 int minXUserCoordAtPixel(int pixel)
           
 void reset()
           
 void setPixelBounds(java.awt.Rectangle rect)
           
 void setXCentre(int centre)
           
 void setXMaximum(int max)
           
 void setXMinimum(int min)
           
 void setXOrientation(int orientation)
           
 void setXRange(int[] limits)
           
 void setXVisibleMinimum(int min)
           
 void setXZoomFactor(double factor)
           
 void setYCentre(int centre)
           
 void setYMaximum(int max)
           
 void setYMinimum(int min)
           
 void setYOrientation(int orientation)
           
 void setYRange(int[] limits)
           
 void setYVisibleMinimum(int min)
           
 void setYZoomFactor(double factor)
           
 java.awt.Point toPixel(int x, int y)
           
 java.awt.Point toPixel(java.awt.Point user)
           
 int toPixelX(int userX)
          used to be a long version of these functions as well - took them out because we dont need them anymore i believe.
 int toPixelY(int userY)
           
 java.awt.Point toUser(int x, int y)
           
 java.awt.Point toUser(java.awt.Point pixel)
           
 void writeFactors()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UP

public static final int UP
Directions for Y axis (setYOrientation)

See Also:
Constant Field Values

DOWN

public static final int DOWN
See Also:
Constant Field Values

LEFT

public static final int LEFT
See Also:
Constant Field Values

RIGHT

public static final int RIGHT
See Also:
Constant Field Values
Constructor Detail

Transformer

public Transformer(java.awt.Rectangle bounds)

Transformer

public Transformer(java.awt.Rectangle pixelBounds,
                   java.awt.Rectangle userBounds)
Method Detail

reset

public void reset()

setPixelBounds

public void setPixelBounds(java.awt.Rectangle rect)

getPixelBounds

public java.awt.Rectangle getPixelBounds()

setYOrientation

public void setYOrientation(int orientation)

setXOrientation

public void setXOrientation(int orientation)

setXZoomFactor

public void setXZoomFactor(double factor)

setYZoomFactor

public void setYZoomFactor(double factor)

setXRange

public void setXRange(int[] limits)

setYRange

public void setYRange(int[] limits)

setXMinimum

public void setXMinimum(int min)

setYMinimum

public void setYMinimum(int min)

setXMaximum

public void setXMaximum(int max)

setYMaximum

public void setYMaximum(int max)

setXCentre

public void setXCentre(int centre)

setYCentre

public void setYCentre(int centre)

getXRange

public int[] getXRange()

getYRange

public int[] getYRange()

getXMaximum

public int getXMaximum()

getYMaximum

public int getYMaximum()

getXMinimum

public int getXMinimum()

getYMinimum

public int getYMinimum()

getXCentre

public int getXCentre()

getYCentre

public int getYCentre()

getXVisibleRange

public int[] getXVisibleRange()

getYVisibleRange

public int[] getYVisibleRange()

setYVisibleMinimum

public void setYVisibleMinimum(int min)

setXVisibleMinimum

public void setXVisibleMinimum(int min)

writeFactors

public void writeFactors()

toPixelX

public int toPixelX(int userX)
used to be a long version of these functions as well - took them out because we dont need them anymore i believe. toPixelX actually returns the pixel value of the end of the base pair (which is halfway between the basepair(userX) and the next bp(userX+1). To the left for xorientation LEFT, to the right for xorientation RIGHT


basepairRangeToPixelRange

public Transformer.PixelRange basepairRangeToPixelRange(RangeI range)
This takes care of doing the inclusion at the end of base pair ranges and compensates for xOrientation. the low basepair needs to subtract one from it to include it. the low basepair is low in LEFT (normal) and high in RIGHT x orientation (revcomp), so hi and lo get flipped for revcomp.


toPixelY

public int toPixelY(int userY)

toPixel

public java.awt.Point toPixel(java.awt.Point user)

toPixel

public java.awt.Point toPixel(int x,
                              int y)

fromPixel

public java.awt.Point fromPixel(java.awt.Point pixel)

toUser

public java.awt.Point toUser(int x,
                             int y)

toUser

public java.awt.Point toUser(java.awt.Point pixel)

fromUser

public java.awt.Point fromUser(java.awt.Point user)

minXUserCoordAtPixel

public int minXUserCoordAtPixel(int pixel)

maxXUserCoordAtPixel

public int maxXUserCoordAtPixel(int pixel)

minXPixelAtUserCoord

public int minXPixelAtUserCoord(int user)
This gives the pixel value at the beginning of the base pair, which is halfway between the basepair(user) and the previous basepair(user-1). This is actually toPixelX(user-1) because toPixelX actually returns the pixel value of the end of the base pair (which is halfway between the basepair(user) and the next bp (user+1)


maxXPixelAtUserCoord

public int maxXPixelAtUserCoord(int user)
This gives the pixel value at the end of the base pair, which is halfway between the basepair(user) and the next basepair(user+1). This is actually toPixelX(user) because toPixelX actually returns the pixel value of the end of the base pair


getYCoordsPerPixel

public double getYCoordsPerPixel()

getXCoordsPerPixel

public double getXCoordsPerPixel()

getYPixelsPerCoord

public double getYPixelsPerCoord()

getXPixelsPerCoord

public double getXPixelsPerCoord()

getYOrientation

public int getYOrientation()

getXOrientation

public int getXOrientation()
This can be Transformer.LEFT and Transformer.RIGHT. I believe that LEFT is normal (left to right) and RIGHT is revcomped (axis goes right to left)


main

public static void main(java.lang.String[] argv)

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException