DESY ACOP Beans Home

com.cosylab.gui.components.gauger
Class LinearHorizontalTransform

java.lang.Object
  extended by com.cosylab.gui.components.gauger.ScaleTransform
      extended by com.cosylab.gui.components.gauger.LinearHorizontalTransform

public class LinearHorizontalTransform
extends ScaleTransform

This transform defines shape of horizontal linear gauger. It imposes constraints on minimum and maximum sizes and defines borders, as well as position of value label.

Version:
$id$
Author:
Ales Pucelj

Nested Class Summary
 
Nested classes/interfaces inherited from class com.cosylab.gui.components.gauger.ScaleTransform
ScaleTransform.ArcSegment, ScaleTransform.LineSegment, ScaleTransform.RectangleSegment, ScaleTransform.ScaleSegment
 
Constructor Summary
LinearHorizontalTransform()
           
 
Method Summary
 void mapUVtoXY(java.awt.geom.Point2D scaleSpace, java.awt.geom.Point2D cartesianSpace)
          Converts point in scale space to point in gauger space.
 void mapXYtoUV(java.awt.geom.Point2D cartesianSpace, java.awt.geom.Point2D scaleScape)
          Not implemented.
 int measureTick(java.awt.Graphics g, double x, java.lang.String text)
          Calculates tick label width when rendered.
 double scaleHeight(double u)
          Returns scale height at relative horizontal position.
 double scaleWidth(double v)
          Returns width of scale at relative vertical position.
 void setParameters(int w, int h, int marginX, int marginY, int tickOffset)
          Sets the dimensions of this scale and calculates internal parameters.
 
Methods inherited from class com.cosylab.gui.components.gauger.ScaleTransform
addSegment, getAngle, getLabelPosition, getSegment, getSegmentCount, isPolar, mapUVtoXY, mapUVtoXY, setLabelPosition, setPolar
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LinearHorizontalTransform

public LinearHorizontalTransform()
Method Detail

setParameters

public void setParameters(int w,
                          int h,
                          int marginX,
                          int marginY,
                          int tickOffset)
Sets the dimensions of this scale and calculates internal parameters.

Specified by:
setParameters in class ScaleTransform
Parameters:
w - int Gauger width.
h - int Gauger height.
marginX - int Horizontal margin from border in pixels.
marginY - int Vertical margin from border in pixels.
tickOffset - int Minimum offset of first and last tick from scale in pixels.
See Also:
ScaleTransform#setParameters(int, int, int, int)

mapUVtoXY

public void mapUVtoXY(java.awt.geom.Point2D scaleSpace,
                      java.awt.geom.Point2D cartesianSpace)
Converts point in scale space to point in gauger space. Conversion is linear.

Specified by:
mapUVtoXY in class ScaleTransform
Parameters:
scaleSpace - PointDouble Point in scale space.
cartesianSpace - Point Point in gauger space.
See Also:
ScaleTransform#mapUVtoXY(PointDouble, Point)

mapXYtoUV

public void mapXYtoUV(java.awt.geom.Point2D cartesianSpace,
                      java.awt.geom.Point2D scaleScape)
Not implemented.

Parameters:
cartesianSpace - Point
scaleScape - PointDouble
See Also:
ScaleTransform#maxXYtoUV(Point, PointDouble)

scaleWidth

public double scaleWidth(double v)
Returns width of scale at relative vertical position. Returns constant width.

Specified by:
scaleWidth in class ScaleTransform
Parameters:
v - double Relative vertical position in range 0.0 to 1.0
Returns:
double Width in pixels.
See Also:
ScaleTransform.scaleWidth(double)

scaleHeight

public double scaleHeight(double u)
Returns scale height at relative horizontal position. Returns constant height.

Specified by:
scaleHeight in class ScaleTransform
Parameters:
u - double Relative horizontal position in range 0.0 to 1.0.
Returns:
double Heightin pixels.
See Also:
ScaleTransform.scaleHeight(double)

measureTick

public int measureTick(java.awt.Graphics g,
                       double x,
                       java.lang.String text)
Calculates tick label width when rendered.

Specified by:
measureTick in class ScaleTransform
Parameters:
g - Graphics Context to render to.
x - double Relative value of tick position.
text - String Text to render.
Returns:
int Width in pixels.
See Also:
ScaleTransform.measureTick(Graphics, double, String)


Copyright © 2010. All Rights Reserved.