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 intSPACE_BTW_MARK_LABELFields 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 doubleconvertPixelToRadians(int pixels)doublegetCoercedValuePosition(double value, boolean relative)doublegetEndAngle()intgetEstimatedDonutWidth()intgetInnerRadius()doublegetLengthInDegrees()intgetLengthInPixels()org.eclipse.draw2d.geometry.DimensiongetPreferredSize(int wHint, int hHint)intgetRadius()RoundScaleTickLabelsgetScaleTickLabels()Gets the scale tick labels.RoundScaleTickMarksgetScaleTickMarks()Gets the scale tick marks.doublegetStartAngle()doublegetValuePosition(double value, boolean relative)Get the position of the value in degrees.protected voidlayout()voidsetBounds(org.eclipse.draw2d.geometry.Rectangle rect)voidsetEndAngle(double endAngle)voidsetFont(org.eclipse.swt.graphics.Font font)voidsetForegroundColor(org.eclipse.swt.graphics.Color color)voidsetRadius(int radius)voidsetStartAngle(double startAngle)voidupdateTick()Updates the tick, recalculate all parameters, such as margin, length...protected booleanuseLocalCoordinates()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, 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, 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:
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
public void setFont(org.eclipse.swt.graphics.Font font)- Specified by:
setFontin interfaceorg.eclipse.draw2d.IFigure- Overrides:
setFontin classAbstractScale
-
setForegroundColor
public void setForegroundColor(org.eclipse.swt.graphics.Color color)- 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 classAbstractScale
-
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.
-