info.bioinfweb.treegraph.document.format
Class DistanceValue
java.lang.Object
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
POINTS_PER_MM
public static final float POINTS_PER_MM
- See Also:
- Constant Field Values
millimeters
private float millimeters
DistanceValue
public DistanceValue()
DistanceValue
public DistanceValue(float inMillimeters)
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