|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.cosylab.gui.components.gauger.ScaleTransform
public abstract class ScaleTransform
Abstract utility class that provides the mathematic foundation for drawing the Gauger scales. Scale is defined in its own coordinate system with the axis (u, v). In this system the extents of the scale are defined to be (0, 0) and (1, 1), meaning that any point on this scale can be specified with the (u, v) parameter value between 0 and 1. This class is the implementation of this transformation and the component cartesian coordinate system.
Nested Class Summary | |
---|---|
class |
ScaleTransform.ArcSegment
Definition of arc scale segment. |
class |
ScaleTransform.LineSegment
Class defining linear scale segment. |
class |
ScaleTransform.RectangleSegment
Defines rectangular scale segment. |
class |
ScaleTransform.ScaleSegment
Abstract base class for scale segments. |
Constructor Summary | |
---|---|
ScaleTransform()
Creates a new ScaleTransform object. |
Method Summary | |
---|---|
protected void |
addSegment(ScaleTransform.ScaleSegment segment)
Adds segment to this transform. |
double |
getAngle(double x)
Returns angle between horizontal and specified relative position in scale space. |
java.awt.Point |
getLabelPosition()
Returns the point where the label should be positioned. |
ScaleTransform.ScaleSegment |
getSegment(int i)
Returns scale segment at specified index. |
int |
getSegmentCount()
Returns the number of segments describing this scale. |
boolean |
isPolar()
Returns whether this scale is polar. |
java.awt.geom.Point2D |
mapUVtoXY(double u,
double v)
Maps point specified with (u, v) coordinates in scale space to cartesian space with coordinates (x, y) |
void |
mapUVtoXY(double u,
double v,
java.awt.geom.Point2D cartesianSpace)
Maps the point specified with (u, v) coordinates in the scale space to cartesian space with coordinates (x, y). |
abstract void |
mapUVtoXY(java.awt.geom.Point2D scaleSpace,
java.awt.geom.Point2D cartesianSpace)
Maps the point specified with (u, v) coordinates in the scale space to cartesian space with coordinates (x, y). |
abstract int |
measureTick(java.awt.Graphics g,
double x,
java.lang.String text)
Measues the width of tick label. |
abstract double |
scaleHeight(double u)
Returns the height of scale in pixels at the specified location u in the scale space. |
abstract double |
scaleWidth(double v)
Returns the width of scale in pixels at the specified location v in the scale space. |
protected void |
setLabelPosition(int x,
int y)
Sets position of value label. |
abstract void |
setParameters(int w,
int h,
int marginX,
int marginY,
int tickOffset)
Sets the component parameters for this transformation. |
void |
setPolar(boolean value)
Sets whether this transform is polar. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ScaleTransform()
Method Detail |
---|
public void setPolar(boolean value)
value
- True if polar.public boolean isPolar()
setPolar(boolean)
public abstract void setParameters(int w, int h, int marginX, int marginY, int tickOffset)
w
- width of the component that will display this transformationh
- height of the component that will display this transformationmarginX
- not usedmarginY
- not usedtickOffset
- space between the edge of the scale and the first tickpublic abstract void mapUVtoXY(java.awt.geom.Point2D scaleSpace, java.awt.geom.Point2D cartesianSpace)
scaleSpace
- point in scale spacecartesianSpace
- point in cartesian spacepublic void mapUVtoXY(double u, double v, java.awt.geom.Point2D cartesianSpace)
u
- coordinate in scale spacev
- coordinate in scale spacecartesianSpace
- point in cartesian spacepublic java.awt.geom.Point2D mapUVtoXY(double u, double v)
u
- coordinate in scale space.v
- coordinate in scale space.
mapUVtoXY(u, v, Point2D)
public final double getAngle(double x)
x
- Relative point in scale space in range 0.0 to 1.0.
public abstract double scaleWidth(double v)
public abstract double scaleHeight(double u)
public java.awt.Point getLabelPosition()
public int getSegmentCount()
protected void addSegment(ScaleTransform.ScaleSegment segment)
segment
- to add.public ScaleTransform.ScaleSegment getSegment(int i)
i
- Index of segment.
protected void setLabelPosition(int x, int y)
x
- coordinate of label center.y
- coordinate of label center.public abstract int measureTick(java.awt.Graphics g, double x, java.lang.String text)
g
- Graphic context.x
- Relative position of tick.text
- Tick label.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |