Home / Development / Documentation / 2.0.44 / DistanceValue
TreeGraph 2
 


info.bioinfweb.treegraph.document.format
Class DistanceValue

java.lang.Object
  extended by info.bioinfweb.treegraph.document.format.DistanceValue
All Implemented Interfaces:
Cloneable

public class DistanceValue
extends Object
implements Cloneable

This class represents a distance in the document. Distances are internaly stored in millimeters (mm) but can be converted tp pixels (px) and DTP-Points (pt). Converting values in millimeters to pixels depends on the resolution (e.g. dpi) of the generated image or the zoomfactor of the view displaying the document.

Author:
BenStoever

Field Summary
private  float millimeters
           
static float POINTS_PER_MM
           
 
Constructor Summary
DistanceValue()
           
DistanceValue(float inMillimeters)
           
 
Method Summary
 void add(DistanceValue other)
           
 void add(float addend)
          Adds the specified value to the stored value in millimeters.
 void assign(DistanceValue other)
           
 DistanceValue clone()
           
 boolean equals(Object obj)
           
 float getInMillimeters()
           
 float getInPixels(float pixelsPerMillimeter)
           
 float getInPoints()
          Returns the value in DTP-Points (1 pt = 0.3527777 mm).
 int getRoundedInPixels(float pixelsPerMillimeter)
          Gives the uprounded value in pixels
 int hashCode()
           
static float millimetersToPixels(float mm, float pixelsPerMillimeter)
           
static float millimetersToPoints(float mm)
           
static float pixelsToMillimeters(float pixels, float pixelsPerMillimeter)
           
static float pointsToMillimeters(float pt)
           
 void setInMillimeters(float value)
           
 void setInPixels(float value, float pixelsPerMillimeter)
           
 void setInPoints(float value)
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

POINTS_PER_MM

public static final float POINTS_PER_MM
See Also:
Constant Field Values

millimeters

private float millimeters
Constructor Detail

DistanceValue

public DistanceValue()

DistanceValue

public DistanceValue(float inMillimeters)
Method Detail

getInMillimeters

public float getInMillimeters()

setInMillimeters

public void setInMillimeters(float value)

getInPixels

public float getInPixels(float pixelsPerMillimeter)

getRoundedInPixels

public int getRoundedInPixels(float pixelsPerMillimeter)
Gives the uprounded value in pixels


setInPixels

public void setInPixels(float value,
                        float pixelsPerMillimeter)

getInPoints

public float getInPoints()
Returns the value in DTP-Points (1 pt = 0.3527777 mm).

Returns:
vlaue in DTP-Points

setInPoints

public void setInPoints(float value)

assign

public void assign(DistanceValue other)

add

public void add(DistanceValue other)

add

public void add(float addend)
Adds the specified value to the stored value in millimeters.

Parameters:
addend - The addend in millimeters

pixelsToMillimeters

public static float pixelsToMillimeters(float pixels,
                                        float pixelsPerMillimeter)

millimetersToPixels

public static float millimetersToPixels(float mm,
                                        float pixelsPerMillimeter)

millimetersToPoints

public static float millimetersToPoints(float mm)

pointsToMillimeters

public static float pointsToMillimeters(float pt)

clone

public DistanceValue clone()
Overrides:
clone in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object