treebolic.view
Class Mapper

java.lang.Object
  extended by treebolic.view.Mapper
Direct Known Subclasses:
AbstractPainter

public class Mapper
extends java.lang.Object

Mapper of unit circle space to view

Author:
Bernard Bou

Field Summary
protected  int theLeft
          Left coordinate
protected  double theScaleX
          Scale x factor
protected  double theScaleY
          Scale y factor
protected  java.awt.Dimension theSize
          Size of graphics context
protected  int theTop
          Top coordinate
protected  double theXShift
          X shift
protected  double theYShift
          Y shift
private  double theZoomFactor
          Zoom factor
 
Constructor Summary
Mapper()
           
 
Method Summary
protected  void computeScale()
          Compute scale from view size
 java.awt.Dimension getSize()
          Get size
 java.awt.Point getViewLocation(INode thisNode)
          Get view coordinates of node
 double getXShift()
          Get view x-shift
 double getYShift()
          Get view y-shift
protected  int hUnitCircleToView(double cy)
          Convert unit circle y-extent to view y-extent
protected  double hViewToUnitCircle(double cvy)
          Convert view y-extent (height) to unit circle y-extent
 void setXShift(java.lang.Double thisX)
          Set view x-shift
 void setYShift(java.lang.Double thisY)
          Set view y-shift
 void setZoomFactor(java.lang.Double thisFactor)
          Set view zoom factor
 Complex viewToUnitCircle(int vx, int vy, java.awt.Dimension thisSize)
          Convert view coordinates to unit circle coordinates
protected  int wUnitCircleToView(double cx)
          Convert unit circle x-extent to view x-extent
protected  double wViewToUnitCircle(double cvx)
          Convert view x-extent (width) to unit circle x-extent
protected  int xUnitCircleToView(double x)
          Convert unit circle x-coordinate to view x-coordinate
protected  double xViewToUnitCircle(double vx)
          Convert view x-coordinate to unit circle x-coordinate
protected  int yUnitCircleToView(double y)
          Convert unit circle y-coordinate to view y-coordinate
protected  double yViewToUnitCircle(double vy)
          Convert view y-coordinate to unit circle y-coordinate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

theSize

protected java.awt.Dimension theSize
Size of graphics context


theScaleX

protected double theScaleX
Scale x factor


theScaleY

protected double theScaleY
Scale y factor


theXShift

protected double theXShift
X shift


theYShift

protected double theYShift
Y shift


theTop

protected int theTop
Top coordinate


theLeft

protected int theLeft
Left coordinate


theZoomFactor

private double theZoomFactor
Zoom factor

Constructor Detail

Mapper

public Mapper()
Method Detail

getSize

public java.awt.Dimension getSize()
Get size

Returns:
size

setZoomFactor

public void setZoomFactor(java.lang.Double thisFactor)
Set view zoom factor

Parameters:
thisFactor - zoom factor

setXShift

public void setXShift(java.lang.Double thisX)
Set view x-shift

Parameters:
thisX - view x-shift (0,1)

setYShift

public void setYShift(java.lang.Double thisY)
Set view y-shift

Parameters:
thisY - view y-shift (0,1)

getXShift

public double getXShift()
Get view x-shift

Returns:
view x-shift

getYShift

public double getYShift()
Get view y-shift

Returns:
view y-shift

computeScale

protected void computeScale()
Compute scale from view size


xUnitCircleToView

protected int xUnitCircleToView(double x)
Convert unit circle x-coordinate to view x-coordinate

Parameters:
x - unit circle x-coordinate
Returns:
view x-coordinate

yUnitCircleToView

protected int yUnitCircleToView(double y)
Convert unit circle y-coordinate to view y-coordinate

Parameters:
y - unit circle y-coordinate
Returns:
view y-coordinate

wUnitCircleToView

protected int wUnitCircleToView(double cx)
Convert unit circle x-extent to view x-extent

Parameters:
cx - unit circle x-extent
Returns:
view x-extent

hUnitCircleToView

protected int hUnitCircleToView(double cy)
Convert unit circle y-extent to view y-extent

Parameters:
cy - unit circle y-extent
Returns:
view y-extent

xViewToUnitCircle

protected double xViewToUnitCircle(double vx)
Convert view x-coordinate to unit circle x-coordinate

Parameters:
vx - view x-coordinate
Returns:
unit circle x-coordinate

yViewToUnitCircle

protected double yViewToUnitCircle(double vy)
Convert view y-coordinate to unit circle y-coordinate

Parameters:
vy - view y-coordinate
Returns:
unit circle y-coordinate

wViewToUnitCircle

protected double wViewToUnitCircle(double cvx)
Convert view x-extent (width) to unit circle x-extent

Parameters:
cvx - view x-extent
Returns:
unit circle x-extent

hViewToUnitCircle

protected double hViewToUnitCircle(double cvy)
Convert view y-extent (height) to unit circle y-extent

Parameters:
cvy - view y-extent
Returns:
unit circle y-extent

viewToUnitCircle

public Complex viewToUnitCircle(int vx,
                                int vy,
                                java.awt.Dimension thisSize)
Convert view coordinates to unit circle coordinates

Parameters:
vx - x coordinate in view space
vy - y coordinate in view space
thisSize - view size
Returns:
point in unit circle

getViewLocation

public java.awt.Point getViewLocation(INode thisNode)
Get view coordinates of node

Parameters:
thisNode - node
Returns:
view coordinate of node