public class LinearScale extends AbstractScale implements IScaleProvider
Modifier and Type | Class and Description |
---|---|
static class |
LinearScale.Orientation
scale direction
|
AbstractScale.LabelSide
Modifier and Type | Field and Description |
---|---|
protected static int |
SPACE_BTW_MARK_LABEL |
DEFAULT_DATE_FORMAT, default_decimal_format, DEFAULT_ENGINEERING_FORMAT, DEFAULT_LOG_SCALE_MAX, DEFAULT_MAX, DEFAULT_MIN, dirty, ENGINEERING_LIMIT, max, min
Constructor and Description |
---|
LinearScale()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected LinearScaleTickLabels |
createLinearScaleTickLabels()
Creates the linearScaleTickLabel.
|
protected LinearScaleTickMarks |
createLinearScaleTickMarks()
Creates the LinearScaleTickMarks.
|
void |
figureLayout()
Simple call of
org.eclipse.draw2d.Figure.layout() |
org.eclipse.draw2d.geometry.Dimension |
getDimension(java.lang.Object obj)
Calculate dimension of a textual form of object
|
double |
getLabel(double value)
Override to provide custom axis labels.
|
int |
getLength() |
Range |
getLocalRange() |
int |
getMargin()
Margin is half of the label's length(Horizontal Scale) or height(Vertical
scale), so that the label can be displayed correctly.
|
int |
getMargin(boolean updateTick)
If updateTick is True,
getMargin() is used where the tick are
updated, if not, the method returns margin . |
LinearScale.Orientation |
getOrientation() |
double |
getPositionValue(double position,
boolean relative)
Get the corresponding value on the position of the scale.
|
double |
getPositionValue(int position,
boolean relative)
Get the corresponding value on the position of the scale.
|
org.eclipse.draw2d.geometry.Dimension |
getPreferredSize(int wHint,
int hHint) |
Range |
getScaleRange() |
LinearScaleTickLabels |
getScaleTickLabels()
Gets the scale tick labels.
|
LinearScaleTickMarks |
getScaleTickMarks()
Gets the scale tick marks.
|
int |
getTickLength() |
ITicksProvider |
getTicksProvider()
Gets the ticks provider
|
int |
getValuePosition(double value,
boolean relative)
Get the position of the value based on scale.
|
double |
getValuePrecisePosition(double value,
boolean relative)
Get the position of the value based on scale.
|
boolean |
hasTicksAtEnds() |
boolean |
isHorizontal() |
boolean |
isLabelCustomised() |
boolean |
isPrimary() |
boolean |
isShowMaxLabel()
shows the maximum value of the range as a label
|
boolean |
isShowMinLabel()
shows the minimum value of the range as a label
|
protected void |
layout() |
void |
setBounds(org.eclipse.draw2d.geometry.Rectangle rect) |
void |
setFont(org.eclipse.swt.graphics.Font font) |
void |
setForegroundColor(org.eclipse.swt.graphics.Color color) |
void |
setLength(int length) |
void |
setLocalRange(Range localRange) |
void |
setMargin(int margin) |
void |
setOrientation(LinearScale.Orientation orientation)
sets the orientation
|
void |
setShowMaxLabel(boolean b)
sets the visibility of the maximum label
|
void |
setShowMinLabel(boolean b)
sets the visibility of the minimum label
|
void |
updateTick()
Updates the tick, recalculate all parameters, such as margin, length...
|
protected boolean |
useLocalCoordinates() |
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
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
format, format, getFont, getForegroundColor, getFormatPattern, getMajorGridStep, getMajorTickMarkStepHint, getMinorTickMarkStepHint, getTimeUnit, isAutoFormat, isDateEnabled, isLogScaleEnabled, setAutoFormat
protected static final int SPACE_BTW_MARK_LABEL
protected LinearScaleTickLabels createLinearScaleTickLabels()
protected LinearScaleTickMarks createLinearScaleTickMarks()
public int getLength()
getLength
in interface IScaleProvider
public void setLength(int length)
length
- public int getMargin(boolean updateTick)
getMargin()
is used where the tick are
updated, if not, the method returns margin
.updateTick
- public int getMargin()
getMargin
in interface IScaleProvider
public void setMargin(int margin)
margin
- public LinearScale.Orientation getOrientation()
public org.eclipse.draw2d.geometry.Dimension getPreferredSize(int wHint, int hHint)
getPreferredSize
in interface org.eclipse.draw2d.IFigure
getPreferredSize
in class org.eclipse.draw2d.Figure
public ITicksProvider getTicksProvider()
IScaleProvider
getTicksProvider
in interface IScaleProvider
public LinearScaleTickLabels getScaleTickLabels()
public LinearScaleTickMarks getScaleTickMarks()
public int getTickLength()
public int getValuePosition(double value, boolean relative)
value
- the value to find its position. Support value out of range.relative
- return the position relative to the left/bottom bound of the
scale if true. If false, return the absolute position which
has the scale bounds counted.public double getValuePrecisePosition(double value, boolean relative)
value
- the value to find its position. Support value out of range.relative
- return the position relative to the left/bottom bound of the
scale if true. If false, return the absolute position which
has the scale bounds counted.public double getPositionValue(int position, boolean relative)
position
- relative
- if true the position is relative to the left/bottom bound of the
scale; if false it is the absolute position.public double getPositionValue(double position, boolean relative)
position
- relative
- if true the position is relative to the left/bottom bound of the
scale; if false it is the absolute position.public boolean isHorizontal()
isHorizontal
in interface IScaleProvider
public boolean isShowMaxLabel()
public boolean isShowMinLabel()
protected void layout()
layout
in class org.eclipse.draw2d.Figure
public void figureLayout()
org.eclipse.draw2d.Figure.layout()
public void setBounds(org.eclipse.draw2d.geometry.Rectangle rect)
setBounds
in interface org.eclipse.draw2d.IFigure
setBounds
in class org.eclipse.draw2d.Figure
public void setFont(org.eclipse.swt.graphics.Font font)
setFont
in interface org.eclipse.draw2d.IFigure
setFont
in class AbstractScale
public void setForegroundColor(org.eclipse.swt.graphics.Color color)
setForegroundColor
in interface org.eclipse.draw2d.IFigure
setForegroundColor
in class org.eclipse.draw2d.Figure
public void setOrientation(LinearScale.Orientation orientation)
orientation
- the orientation to setpublic void setShowMaxLabel(boolean b)
b
- show maximal value as a labelpublic void setShowMinLabel(boolean b)
b
- show minimum value as a labelpublic Range getLocalRange()
public void setLocalRange(Range localRange)
localRange
- public void updateTick()
updateTick
in class AbstractScale
protected boolean useLocalCoordinates()
useLocalCoordinates
in class org.eclipse.draw2d.Figure
public Range getScaleRange()
getScaleRange
in interface IScaleProvider
public org.eclipse.draw2d.geometry.Dimension getDimension(java.lang.Object obj)
getDimension
in interface IScaleProvider
obj
- objectpublic boolean isPrimary()
isPrimary
in interface IScaleProvider
public double getLabel(double value)
getLabel
in interface IScaleProvider
public boolean isLabelCustomised()
isLabelCustomised
in interface IScaleProvider
public boolean hasTicksAtEnds()
hasTicksAtEnds
in interface IScaleProvider