Class RoundScale
java.lang.Object
org.eclipse.draw2d.Figure
org.eclipse.nebula.visualization.xygraph.linearscale.AbstractScale
org.eclipse.nebula.visualization.widgets.figureparts.RoundScale
- All Implemented Interfaces:
org.eclipse.draw2d.IFigure
public class RoundScale extends 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
AbstractScale.LabelSide
-
Field Summary
Fields Modifier and Type Field Description static int
SPACE_BTW_MARK_LABEL
Fields 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, min
-
Constructor Summary
Constructors Constructor Description RoundScale()
Constructor. -
Method Summary
Modifier and Type Method Description double
convertPixelToRadians(int pixels)
double
getCoercedValuePosition(double value, boolean relative)
double
getEndAngle()
int
getEstimatedDonutWidth()
int
getInnerRadius()
double
getLengthInDegrees()
int
getLengthInPixels()
org.eclipse.draw2d.geometry.Dimension
getPreferredSize(int wHint, int hHint)
int
getRadius()
RoundScaleTickLabels
getScaleTickLabels()
Gets the scale tick labels.RoundScaleTickMarks
getScaleTickMarks()
Gets the scale tick marks.double
getStartAngle()
double
getValuePosition(double value, boolean relative)
Get the position of the value in degrees.protected void
layout()
void
setBounds(org.eclipse.draw2d.geometry.Rectangle rect)
void
setEndAngle(double endAngle)
void
setFont(org.eclipse.swt.graphics.Font font)
void
setForegroundColor(org.eclipse.swt.graphics.Color color)
void
setRadius(int radius)
void
setStartAngle(double startAngle)
void
updateTick()
Updates the tick, recalculate all parameters, such as margin, length...protected boolean
useLocalCoordinates()
Updates 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, setTimeUnit
Methods 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, getClientArea, getClientArea, getClippingStrategy, getCursor, getFlag, getFont, getForegroundColor, getInsets, getLayoutManager, getListeners, 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, 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:
- Constant Field Values
-
-
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:
getPreferredSize
in interfaceorg.eclipse.draw2d.IFigure
- Overrides:
getPreferredSize
in 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:
layout
in classorg.eclipse.draw2d.Figure
-
setBounds
public void setBounds(org.eclipse.draw2d.geometry.Rectangle rect)- Specified by:
setBounds
in interfaceorg.eclipse.draw2d.IFigure
- Overrides:
setBounds
in classorg.eclipse.draw2d.Figure
-
setFont
public void setFont(org.eclipse.swt.graphics.Font font)- Specified by:
setFont
in interfaceorg.eclipse.draw2d.IFigure
- Overrides:
setFont
in classAbstractScale
-
setForegroundColor
public void setForegroundColor(org.eclipse.swt.graphics.Color color)- Specified by:
setForegroundColor
in interfaceorg.eclipse.draw2d.IFigure
- Overrides:
setForegroundColor
in classorg.eclipse.draw2d.Figure
-
updateTick
public void updateTick()Updates the tick, recalculate all parameters, such as margin, length...- Specified by:
updateTick
in classAbstractScale
-
useLocalCoordinates
protected boolean useLocalCoordinates()Updates the tick layout. protected void updateLayoutData() { axisTickLabels.updateLayoutData(); axisTickMarks.updateLayoutData(); }- Overrides:
useLocalCoordinates
in 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.
-