Class RoundScale
java.lang.Object
org.eclipse.draw2d.Figure
org.eclipse.nebula.visualization.xygraph.linearscale.AbstractScale
org.csstudio.swt.widgets.figureparts.RoundScale
- All Implemented Interfaces:
org.eclipse.draw2d.IFigure
public class RoundScale
extends org.eclipse.nebula.visualization.xygraph.linearscale.AbstractScale
Round scale has the tick labels and tick marks on a circle. It can be used for any round scale based widget, such
meter, gauge, knob etc.
A round scale is comprised of Scale line, tick labels and tick marks which include minor ticks and major ticks.
The endAngle is on the clockwise side of startAngle. Regardless the startAngle and endAngle, the scale will always be drawn in a square. The bounds will be automatically cropped to the square with the max possible size.
A round scale is comprised of Scale line, tick labels and tick marks which include minor ticks and major ticks.
The endAngle is on the clockwise side of startAngle. Regardless the startAngle and endAngle, the scale will always be drawn in a square. The bounds will be automatically cropped to the square with the max possible size.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.nebula.visualization.xygraph.linearscale.AbstractScale
org.eclipse.nebula.visualization.xygraph.linearscale.AbstractScale.LabelSideNested classes/interfaces inherited from class org.eclipse.draw2d.Figure
org.eclipse.draw2d.Figure.FigureIterator, org.eclipse.draw2d.Figure.IdentitySearch, org.eclipse.draw2d.Figure.ReverseFigureChildrenIteratorNested classes/interfaces inherited from interface org.eclipse.draw2d.IFigure
org.eclipse.draw2d.IFigure.NoInsets -
Field Summary
FieldsFields inherited from class org.eclipse.nebula.visualization.xygraph.linearscale.AbstractScale
DEFAULT_DATE_FORMAT, default_decimal_format, DEFAULT_ENGINEERING_FORMAT, DEFAULT_LOG_SCALE_MAX, DEFAULT_MAX, DEFAULT_MIN, dirty, ENGINEERING_LIMIT, max, minFields inherited from class org.eclipse.draw2d.Figure
bgColor, border, bounds, fgColor, flags, font, MAX_FLAG, maxSize, minSize, NO_MANAGER, prefSize, toolTipFields inherited from interface org.eclipse.draw2d.IFigure
MAX_DIMENSION, MIN_DIMENSION, NO_INSETS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoubleconvertPixelToRadians(int pixels) doublegetCoercedValuePosition(double value, boolean relative) doubleintintdoubleintorg.eclipse.draw2d.geometry.DimensiongetPreferredSize(int wHint, int hHint) intGets the scale tick labels.Gets the scale tick marks.doubledoublegetValuePosition(double value, boolean relative) Get the position of the value in degrees.protected voidlayout()voidsetBounds(org.eclipse.draw2d.geometry.Rectangle rect) voidsetEndAngle(double endAngle) voidvoidsetForegroundColor(Color color) voidsetRadius(int radius) voidsetStartAngle(double startAngle) voidUpdates the tick, recalculate all parameters, such as margin, length...protected booleanUpdates the tick layout.Methods inherited from class org.eclipse.nebula.visualization.xygraph.linearscale.AbstractScale
format, format, getFormatPattern, getMajorGridStep, getMajorTickMarkStepHint, getMinorTickMarkStepHint, getRange, getTickLabelSide, getTickLablesSide, getTimeUnit, internalSetAutoFormat, internalSetFormatPattern, internalSetLogScaleEnabled, internalSetRange, isAutoFormat, isDateEnabled, isDirty, isLogScaleEnabled, isMinorTicksVisible, isScaleLineVisible, setAutoFormat, setDateEnabled, setDirty, setFormatPattern, setLogScale, setMajorGridStep, setMajorTickMarkStepHint, setMinorTickMarkStepHint, setMinorTicksVisible, setRange, setRange, setRange, setScaleLineVisible, setTickLabelSide, setTickLableSide, setTimeUnitMethods inherited from class org.eclipse.draw2d.Figure
add, add, add, add, addAncestorListener, addCoordinateListener, addFigureListener, addFocusListener, addKeyListener, addLayoutListener, addListener, addMouseListener, addMouseMotionListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, containsPoint, containsPoint, erase, findDescendantAtExcluding, findFigureAt, findFigureAt, findFigureAt, findFigureAtExcluding, findMouseEventTargetAt, findMouseEventTargetInDescendantsAt, fireCoordinateSystemChanged, fireFigureMoved, fireMoved, firePropertyChange, firePropertyChange, firePropertyChange, getBackgroundColor, getBorder, getBounds, getChildren, getChildrenRevIterable, getClientArea, getClientArea, getClippingStrategy, getCursor, getFlag, getFont, getForegroundColor, getInsets, getLayoutManager, getListeners, getListenersIterable, getLocalBackgroundColor, getLocalFont, getLocalForegroundColor, getLocation, getMaximumSize, getMinimumSize, getMinimumSize, getParent, getPreferredSize, getSize, getToolTip, getUpdateManager, handleFocusGained, handleFocusLost, handleKeyPressed, handleKeyReleased, handleMouseDoubleClicked, handleMouseDragged, handleMouseEntered, handleMouseExited, handleMouseHover, handleMouseMoved, handleMousePressed, handleMouseReleased, hasFocus, internalGetEventDispatcher, intersects, invalidate, invalidateTree, isCoordinateSystem, isEnabled, isFocusTraversable, isMirrored, isMouseEventTarget, isOpaque, isRequestFocusEnabled, isShowing, isValid, isValidationRoot, isVisible, optimizeClip, paint, paintBorder, paintChildren, paintClientArea, paintFigure, primTranslate, remove, removeAll, removeAncestorListener, removeCoordinateListener, removeFigureListener, removeFocusListener, removeKeyListener, removeLayoutListener, removeListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, revalidate, setBackgroundColor, setBorder, setChildrenDirection, setChildrenEnabled, setChildrenOrientation, setClippingStrategy, setConstraint, setCursor, setEnabled, setFlag, setFocusTraversable, setLayoutManager, setLocation, setMaximumSize, setMinimumSize, setOpaque, setParent, setPreferredSize, setPreferredSize, setRequestFocusEnabled, setSize, setSize, setToolTip, setValid, setVisible, translate, translateFromParent, translateToAbsolute, translateToParent, translateToRelative, validate
-
Field Details
-
SPACE_BTW_MARK_LABEL
public static final int SPACE_BTW_MARK_LABEL- See Also:
-
-
Constructor Details
-
RoundScale
public RoundScale()Constructor.
-
-
Method Details
-
getLengthInPixels
public int getLengthInPixels()- Returns:
- the length of the whole scale in pixels
-
getLengthInDegrees
public double getLengthInDegrees()- Returns:
- the length of the whole scale in degrees
-
convertPixelToRadians
public double convertPixelToRadians(int pixels) - Parameters:
pixels- the pixels to be converted- Returns:
- the corresponding length in radians
-
getEstimatedDonutWidth
public int getEstimatedDonutWidth()- Returns:
- the estimated donut width, which is used to calculate the radius
-
getPreferredSize
public org.eclipse.draw2d.geometry.Dimension getPreferredSize(int wHint, int hHint) - Specified by:
getPreferredSizein interfaceorg.eclipse.draw2d.IFigure- Overrides:
getPreferredSizein classorg.eclipse.draw2d.Figure
-
getScaleTickLabels
Gets the scale tick labels.- Returns:
- the scale tick labels
-
getScaleTickMarks
Gets the scale tick marks.- Returns:
- the scale tick marks
-
getCoercedValuePosition
public double getCoercedValuePosition(double value, boolean relative) -
getValuePosition
public double getValuePosition(double value, boolean relative) Get the position of the value in degrees. Which is the angular coordinate in the polar coordinate system, whose pole(the origin) is the center of the bounds, whose polar axis is from left to right on horizontal if relative is false.- Parameters:
value- the value to find its position. It can be value out of range.relative- the polar axs would be counterclockwisely rotated to the endAngle if true.- Returns:
- position in degrees
-
layout
protected void layout()- Overrides:
layoutin classorg.eclipse.draw2d.Figure
-
setBounds
public void setBounds(org.eclipse.draw2d.geometry.Rectangle rect) - Specified by:
setBoundsin interfaceorg.eclipse.draw2d.IFigure- Overrides:
setBoundsin classorg.eclipse.draw2d.Figure
-
setFont
- Specified by:
setFontin interfaceorg.eclipse.draw2d.IFigure- Overrides:
setFontin classorg.eclipse.nebula.visualization.xygraph.linearscale.AbstractScale
-
setForegroundColor
- Specified by:
setForegroundColorin interfaceorg.eclipse.draw2d.IFigure- Overrides:
setForegroundColorin classorg.eclipse.draw2d.Figure
-
updateTick
public void updateTick()Updates the tick, recalculate all parameters, such as margin, length...- Specified by:
updateTickin classorg.eclipse.nebula.visualization.xygraph.linearscale.AbstractScale
-
useLocalCoordinates
protected boolean useLocalCoordinates()Updates the tick layout. protected void updateLayoutData() { axisTickLabels.updateLayoutData(); axisTickMarks.updateLayoutData(); }- Overrides:
useLocalCoordinatesin classorg.eclipse.draw2d.Figure
-
setStartAngle
public void setStartAngle(double startAngle) - Parameters:
startAngle- the startAngle to set
-
getStartAngle
public double getStartAngle()- Returns:
- the startAngle
-
setEndAngle
public void setEndAngle(double endAngle) - Parameters:
endAngle- the endAngle to set
-
getEndAngle
public double getEndAngle()- Returns:
- the endAngle
-
setRadius
public void setRadius(int radius) - Parameters:
radius- the radius to set
-
getRadius
public int getRadius()- Returns:
- the radius
-
getInnerRadius
public int getInnerRadius()- Returns:
- the inner radius for a primary tick label side scale.
-