public class Plotter
extends org.eclipse.swt.widgets.Canvas
Modifier and Type | Field and Description |
---|---|
static int |
BASE_CENTER
The base of the line is positioned at the center of the widget.
|
static int |
CURSOR_START_DEFAULT
The default cursor starting position.
|
static int |
DEFAULT_HEIGHT
The default comfortable widget height.
|
static int |
DEFAULT_WIDTH
The default comfortable widget width.
|
static int |
LINE_WIDTH_DEFAULT
The default line width.
|
static int |
PROGRESSION_DEFAULT
The default tail fade percentage
|
static int |
STEADYPOSITION_75PERCENT
Steady position @ 75% of graph.
|
static int |
TAILFADE_DEFAULT
The default amount of tail fading in percentages (25).
|
static int |
TAILFADE_NONE
No tailfade.
|
static int |
TAILFADE_PERCENTAGE
The default tail fade percentage
|
static int |
TAILSIZE_DEFAULT
The default tail size is 75% of the width.
|
static int |
TAILSIZE_FILL
Will draw a tail from the left border but is only valid if the boolean in
#setSteady(boolean, int) was set to true, will default to
TAILSIZE_MAX otherwise. |
static int |
TAILSIZE_MAX
Will draw a maximum tail.
|
Constructor and Description |
---|
Plotter(int channels,
org.eclipse.swt.widgets.Composite parent,
int style)
Creates a new plotter with
channels channels. |
Plotter(int channels,
org.eclipse.swt.widgets.Composite parent,
int style,
org.eclipse.swt.graphics.Color backgroundColor,
org.eclipse.swt.graphics.Color foregroundColor)
Creates a new plotter with
channels channels |
Modifier and Type | Method and Description |
---|---|
protected void |
controlMoved(org.eclipse.swt.widgets.Event e) |
protected void |
controlResized(org.eclipse.swt.widgets.Event e) |
protected int |
ConvertValueToScreenPosition(int Value,
int ScreenHeight) |
int |
getBase(int channel)
This method can be called outside of the UI thread.
|
int |
getBaseOffset(int channel)
Gets the relative location where the line is drawn in the widget.
|
java.lang.String |
getChannelName(int channel)
get the descriptive name of the channel
|
int |
getChannels()
Returns the number of channels on the plotter This method can be called
outside of the UI thread.
|
java.lang.String |
getData(boolean addHeader)
Returns the data in CSV format using the semicolon (;) as separator and
delegating to
getData(boolean, String) . |
java.lang.String |
getData(boolean addHeader,
java.lang.String separator)
This method returns the data in csv format using the passed separator as
field separator.
|
org.eclipse.swt.graphics.Color |
getForeground(int channel)
This method can be called outside of the UI thread.
|
int |
getLineWidth(int channel)
This method can be called outside of the UI thread.
|
int |
getRangeHighValue() |
int |
getRangeLowValue() |
int |
getTailFade(int channel)
Gets the percentage of tail that must be faded out.
|
int |
getTailSize(int channel)
Returns the size of the tail.
|
boolean |
isAntiAlias(int channel)
This method can be called outside of the UI thread.
|
boolean |
isConnect(int channel)
This method can be called outside of the UI thread.
|
boolean |
isFade(int channel)
This method can be called outside of the UI thread.
|
boolean |
isPercentage(int channel)
This method can be called outside of the UI thread.
|
boolean |
isSteady(int channel)
This method can be called outside of the UI thread.
|
protected void |
paintControl(org.eclipse.swt.widgets.Event e) |
protected void |
PositionPolyLine(int[] l1) |
void |
setAntialias(int channel,
boolean antialias)
Sets if the line must be anti-aliased which uses more processing power in
return of a smoother image.
|
void |
setBaseOffset(int channel,
int newBaseOffset)
Gets the relative location where the line is drawn in the widget, the default
is
BASE_CENTER which is in the middle of the plotter. |
void |
SetChannelName(int channel,
java.lang.String name)
Set the descriptive name of the channel
|
void |
setConnect(int channel,
boolean connectHeadAndTail)
Connects head and tail only if tail size is
TAILSIZE_MAX and no
fading. |
void |
setFade(int channel,
boolean fade)
Sets fade mode so that a percentage of the tail will be faded out at the
costs of extra CPU utilization (no beauty without pain or as the Dutch say:
"Wie mooi wil gaan moet pijn doorstaan").
|
void |
setForeground(int channel,
org.eclipse.swt.graphics.Color color)
Sets the foreground color for the supplied channel.
|
void |
setLineWidth(int channel,
int lineWidth)
Sets the line width.
|
void |
setPercentage(int channel,
boolean percentage)
If set to true then the values are treated as percentages of the available
space rather than absolute values.
|
void |
setRange(int lowValue,
int highValue) |
void |
setSteady(int channel,
boolean steady,
int steadyPosition)
If steady is true the graph will draw on a steady position instead of
advancing.
|
void |
setTailFade(int channel,
int newTailFade)
Sets the percentage of tail that must be faded out.
|
void |
setTailSize(int channel,
int newSize)
The tail size defaults to TAILSIZE_DEFAULT which is 75% of the width.
|
void |
setValue(int channel,
int value)
Sets a value to be drawn relative to the center of the channel.
|
protected void |
widgetDisposed(org.eclipse.swt.widgets.Event e) |
drawBackground, getCaret, getIME, scroll, setCaret, setFont, setIME
changed, checkSubclass, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList
computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, requestLayout, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData, toString
public static final int BASE_CENTER
#setBaseOffset(int)
,
Constant Field Valuespublic static final int CURSOR_START_DEFAULT
public static final int DEFAULT_HEIGHT
public static final int DEFAULT_WIDTH
public static final int LINE_WIDTH_DEFAULT
public static final int PROGRESSION_DEFAULT
public static final int STEADYPOSITION_75PERCENT
public static final int TAILFADE_DEFAULT
public static final int TAILFADE_NONE
public static final int TAILFADE_PERCENTAGE
public static final int TAILSIZE_DEFAULT
public static final int TAILSIZE_FILL
#setSteady(boolean, int)
was set to true, will default to
TAILSIZE_MAX
otherwise.public static final int TAILSIZE_MAX
public Plotter(int channels, org.eclipse.swt.widgets.Composite parent, int style)
channels
channels.channels
- parent
- style
- public Plotter(int channels, org.eclipse.swt.widgets.Composite parent, int style, org.eclipse.swt.graphics.Color backgroundColor, org.eclipse.swt.graphics.Color foregroundColor)
channels
channelschannels
- parent
- style
- backgroundColor
- if null use default backgroundforegroundColor
- if null use default foregroundprotected void paintControl(org.eclipse.swt.widgets.Event e)
public void setValue(int channel, int value)
channel
- value
- which is an absolute value or a percentageisPercentage(int)
,
setBaseOffset(int, int)
public int getRangeLowValue()
public int getRangeHighValue()
protected void PositionPolyLine(int[] l1)
protected int ConvertValueToScreenPosition(int Value, int ScreenHeight)
public void setRange(int lowValue, int highValue)
public java.lang.String getData(boolean addHeader)
getData(boolean, String)
.addHeader
- true to add the headergetData(boolean, String)
public java.lang.String getData(boolean addHeader, java.lang.String separator)
SetChannelName(int, String)
to set the names.public void SetChannelName(int channel, java.lang.String name)
channel
- the channel to set the name forname
- the descriptive namepublic java.lang.String getChannelName(int channel)
channel
- the channel to get the name from returns the descriptive namepublic void setSteady(int channel, boolean steady, int steadyPosition)
steady
- steadyPosition
- public boolean isSteady(int channel)
Oscilloscope#setSteady(boolean, int)
public int getBase(int channel)
public int getBaseOffset(int channel)
public int getChannels()
public org.eclipse.swt.graphics.Color getForeground(int channel)
channel
- public int getLineWidth(int channel)
#setLineWidth(int)
public int getTailFade(int channel)
#setFade(boolean)
public int getTailSize(int channel)
#setTailSize(int)
,
TAILSIZE_DEFAULT
,
TAILSIZE_FILL
,
TAILSIZE_MAX
public boolean isConnect(int channel)
TAILSIZE_MAX
no fading graph.public boolean isFade(int channel)
#setFade(boolean)
public boolean isPercentage(int channel)
#setPercentage(boolean)
public boolean isAntiAlias(int channel)
Oscilloscope.setAntialias(int, boolean)
public void setTailSize(int channel, int newSize)
size
- the size of the tail#getTailSize()
,
TAILSIZE_DEFAULT
,
TAILSIZE_FILL
,
TAILSIZE_MAX
protected void widgetDisposed(org.eclipse.swt.widgets.Event e)
protected void controlMoved(org.eclipse.swt.widgets.Event e)
protected void controlResized(org.eclipse.swt.widgets.Event e)
public void setTailFade(int channel, int newTailFade)
tailFade
- public void setFade(int channel, boolean fade)
GC.drawPolygon(int[])
routine which does not support alpha blending.
In addition to this, set the percentage of tail that must be faded out
#setTailFade(int)
.
This method can be called outside of the UI thread.
fade
- true or false#setTailFade(int)
public void setForeground(int channel, org.eclipse.swt.graphics.Color color)
channel
- color
- public void setLineWidth(int channel, int lineWidth)
lineWidth
- public void setPercentage(int channel, boolean percentage)
percentage
- true if percentagespublic void setBaseOffset(int channel, int newBaseOffset)
BASE_CENTER
which is in the middle of the plotter. This
method can be called outside of the UI thread.baseOffset
- must be between 100 and -100, exceeding values are rounded to the
closest allowable value.public void setConnect(int channel, boolean connectHeadAndTail)
TAILSIZE_MAX
and no
fading. This method can be called outside of the UI thread.connectHeadAndTail
- public void setAntialias(int channel, boolean antialias)
channel
- antialias
-