public class GralCurveView extends GralWidget implements GralCurveView_ifc
#setSample(float[], int)
: Write out with new measured values.
GralCurveViewTrack_ifc.
Modifier and Type | Class and Description |
---|---|
class |
GralCurveView.CommonCurve |
protected static class |
GralCurveView.DataOrganisation |
protected class |
GralCurveView.GralCurveViewMouseAction |
static class |
GralCurveView.GraphicImplAccess
All tracks to return for filling.
|
static class |
GralCurveView.PixelOrganisation |
protected static class |
GralCurveView.SaveOrganisation |
static class |
GralCurveView.TimeOrganisation
Inner class for time organisation.
|
static class |
GralCurveView.Track
The describing and the actual data of one track (one curve)
|
static class |
GralCurveView.TrackScale
Instances of this class contain the scaling for one ore more tracks.
|
class |
GralCurveView.ZbnfSetCurve
The instance of this class
zbnfSetCurve will be used only temporary while transfer a parse result
of applySettings(String)
The instance contains only the capabilty to get the track info from the parse result
and to call addTrack(String, String, GralColor, int, int, float, float)
inside #add_Track(ZbnfSetTrack) . |
static class |
GralCurveView.ZbnfSetTrack
Instances of this class were be created only temporary while transfer a parse result of
applySettings(String)
The instance holds values for ZbnfJavaOutput to apply to a track
calling addTrack(String, String, GralColor, int, int, float, float)
inside GralCurveView.ZbnfSetCurve#add_Track(ZbnfSetTrack) . |
GralWidget.ActionChangeSelect, GralWidget.ConfigData, GralWidget.DynamicData, GralWidget.ImplAccess
GralWidgetBase.GralWidgComposite, GralWidgetBase.TimeOrderCreateImplWidget
GralCurveView_ifc.ModeWrite
GralWidget_ifc.ActionChange, GralWidget_ifc.ActionChangeWhen
Modifier and Type | Field and Description |
---|---|
GralUserAction |
actionCleanBuffer |
GralUserAction |
actionGo |
private GralUserAction |
actionMoveCursor
This action is called whenever a cursor position is changed.
|
GralUserAction |
actionPaintAll |
private GralUserAction |
actionSelectTrack
This action is called whenever a track was selected.
|
GralUserAction |
actionShowAll |
GralUserAction |
actionZoomBetweenCursors |
GralUserAction |
actionZoomOut |
int |
adIxData
The increment step of ixData.
|
boolean |
bActive
True then saves values.
|
private boolean |
bNewGetVariables |
GralCurveView.CommonCurve |
common
All tracks to return for filling.
|
protected GralCurveView.DataOrganisation |
dataOrg |
int |
gridDistanceStrongY
Distance of nrofValues for one vertical strong grid line.
|
int |
ixDataWr
Write index of values, increment by
#setSample(float[], int) . |
java.util.List<GralCurveView.Track> |
listTracks
All tracks.
|
int |
maxNrofXValues
Deepness of the storage of values to present.
|
protected int |
mIxData
Mask of any ixData.
|
int |
mIxiData
Mask of index in values.
|
protected GralCurveView.GralCurveViewMouseAction |
mouseAction |
int |
newSamples |
int |
nrofValues
Current number of values in the data field.
|
protected int |
nrofValuesForGrid |
protected GralCurveView.SaveOrganisation |
saveOrg |
int |
shIxiData
The number of shift right to get the numeric index in values.
|
boolean |
testStopWr |
GralCurveView.TimeOrganisation |
timeorg |
TimedValues |
tracksValue |
static int |
version
Version, history and license.
|
(package private) GralCurveView.ZbnfSetCurve |
zbnfSetCurve |
_wdgImpl, bEditable, bShouldInitialize, cfg, contextMenu, dateUser, dyda, htmlHelp, lastTimeSetVisible, redrawDelayMax, redrawtDelay, sCmd, sFormat, showWidgetInfo, sToolTip, sVersion, whatIs, XXXbuildMng
_cdata, _wdgPos, bVisibleState, gralMng, name, pixSize
syntaxSettings
sVersion
Constructor and Description |
---|
GralCurveView(GralPos refPos,
java.lang.String sPosName,
int maxNrofXvaluesP,
GralCurveView.CommonCurve curveVariables,
TimedValues tracksValues)
Constructs the CurveView comprehensive widget.
|
GralCurveView(java.lang.String sName,
int maxNrofXvaluesP,
GralCurveView.CommonCurve common)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
void |
activate(boolean activate)
Activates or deactivates.
|
GralCurveView.Track |
addTrack(java.lang.String sNameTrack,
java.lang.String sDataPath,
GralColor color,
int style,
int nullLine,
float scale,
float offset)
Creates and adds a track of the curve view.
|
boolean |
applySettings(java.lang.String in)
Applies the settings from the given String (maybe read from a file)
and sets all tracks newly.
|
private java.lang.CharSequence |
buildDate(int ixStart,
int ixEnd) |
void |
cleanBuffer() |
GralCurveView.CommonCurve |
getCommonData() |
float |
getdTimeCursors() |
java.lang.String |
getTimeVariable()
Returns the path of the time variable if given or null.
|
java.lang.Iterable<? extends GralCurveViewTrack_ifc> |
getTrackInfo()
This Iterable describes the data paths in that order, which should be regard
calling
#setSample(float[]) . |
java.util.List<GralSetValue_ifc> |
getTracks()
This list describes the data paths in that order, which should be regard
calling
#setSample(float[]) . |
GralCurveView.Track |
getTrackSelected()
Returns that track which was selected by set cursor at last.
|
void |
initMenuContext()
It will be called after construction of the implementation graphic in the derived ctor.
|
boolean |
isActiv()
Returns true if the curve view is active.
|
boolean |
isFreezed()
Returns true if the curve view is active but freezed in presentation.
|
void |
readCurve(java.io.File file)
Reads a curve ///
|
private void |
readCurveCsvHeadline(java.io.File file) |
void |
redraw(int delay,
int latest)
Forces repaint of the whole curves.
|
void |
refreshFromVariable(VariableContainer_ifc container)
The specific for this refresh is, that all variables are quest with the same time.
|
private GralCurveView.Track |
searchTrack(java.lang.String name)
Searches and returns the track from listTrack per name.
|
void |
setActionMoveCursor(GralUserAction action)
This action will be called whenever a cursor position is changed.
|
void |
setActionTrackSelected(GralUserAction action)
This action will be called whenever a track was selected.
|
GralColor |
setBackgroundColor(GralColor color) |
void |
setBoundsPixel(int x,
int y,
int dx,
int dy)
This operation is used if the pixel are calculated on gral level.
|
GralColor |
setForegroundColor(GralColor color) |
void |
setSample(float[] values,
int timeShort,
int timeShortAdd)
Adds a sampling value set.
|
void |
setTimePerPixel(int time) |
void |
setTimePoint(long date,
int timeshort,
float millisecPerTimeshort)
Sets a point of absolute time.
|
void |
setTimeSpread(int time) |
boolean |
shouldAutosave() |
void |
showAll() |
java.lang.CharSequence |
timeInitAutoSave()
Initializes an auto-save data write process.
|
java.lang.CharSequence |
timeInitSaveViewArea() |
long |
timeRight() |
void |
writeCurve(WriteCurve_ifc out,
GralCurveView_ifc.ModeWrite mode)
Writes the curve to the given interface, it is an exporter class.
|
private void |
writeCurve(WriteCurve_ifc out,
int ixDataStart,
int ixDataEnd)
Writes.
|
void |
writeSettings(java.lang.Appendable out)
Writes the settings of the curve view in an output, maybe a file.
|
clearShowParam, createImplWidget_Gthread, getActionChange, getActionChangeStrict, getActionDrag, getActionDrop, getActionFocused, getActionShow, getBackColor, getCfgElement, getCmd, getCmd, getContentIdent, getContentInfo, getContextMenu, getData, getDataIx, getDataPath, getDataPath, getFloatValue, getFocusedWidget, getFormat, getGralWidget, getHtmlHelp, getImplAccess, getImplWidget, getItsPanel, getLongValue, getName, getShowMethod, getShowParam, getsToolTip, getText, getValue, getVariable, getVariableFromContentInfo, isChanged, isEditable, isGraphicDisposed, isInFocus, isNotEditableOrShouldInitialize, isVisible, redraw, redraw, redraw1, redrawOnlyDynamics, refreshFromVariable, removeImplWidget_Gthread, requestNewValueForVariable, setActionChange, setActionFocused, setActionMouse, setActionShow, setBackColor, setCfgElement, setCmd, setContentIdent, setContentInfo, setData, setDataIx, setDataPath, setDragEnable, setDropEnable, setEditable, setFocus, setFocus, setFocusedWidget, setFormat, setHtmlHelp, setLineColor, setLongValue, setMinMax, setPrimaryWidgetOfPanel, setText, setTextColor, setToolTip, setToPanel, setValue, setValue, setValue, setValue, setVariable, setVisible, specifyActionChange, specifyContextMenu, stop, toString, toString, XXXgetWidgetImplementation, XXXremoveWidgetImplementation, XXXrepaintGthread, XXXsetFocusGThread
checkImplWidgetCreation, createImplWidget, gralMng, hasFocus, pos, remove, resizePostPreparation, setFocused
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getActionChange, getBackColor, getCmd, getContentIdent, getContentInfo, getData, getDataPath, getImplWidget, isChanged, isEditable, isGraphicDisposed, isNotEditableOrShouldInitialize, redraw, refreshFromVariable, setBackColor, setCmd, setContentIdent, setData, setDataPath, setEditable, setFocus, setHtmlHelp, setLineColor, setText, setTextColor
getFocusedWidget, getImplAccess, getName, gralMng, isInFocus, isVisible, pos, setFocus, setFocused, setFocusedWidget, setVisible
getContentInfo, getDataIx, getDataPath, setContentInfo, setDataIx, setDataPath, setLongValue, setMinMax, setText, setValue, setValue
getGralWidget
public static final int version
System.currentTimeMillis()
or also possible for a given absolute time relation for the values outside of the current values.
readCurveCsvHeadline(File)
, a variable which is not yet in cfg is disabled.
Elsewhere not prepared stuff is shown in the graphic. It can be enabled and scaled by the user afterwards.
The importance is, the variable will be inserted as signal (track) automatically
addTrack(String, String, GralColor, int, int, float, float)
searchTrack(String)
if data are read from csv for existing configuration.
readCurve(File)
now expects names of variable in the first line in any case, not specific format.
readCurveCsvHeadline(File)
can replace the correct variables in the configuration or builds new tracks
for non existing configurated tracks.
GralCurveView.GraphicImplAccess
as base class of the implementing class SwtCurveView adequate to the new concept:
An implementing widget is derived from its derived class of GralWidget.ImplAccess
. Therefore only that base class implements the GralWidgetImpl_ifc.
refreshFromVariable(VariableContainer_ifc)
: Handling of timeshort: If the timeshort starts with a lesser value
it seems to be a new simulation starting with 0. Then the time difference to the last simulation is calculated and added to the timeshort.
It sets a new setTimePoint(long, int, float)
to prevent overflow later. Initially or if cleanBuffer()
was invoked the timeshort counts from 0.
Therewith the simulation results have an exact relative time but with the absolute timestamp of the PC's time though the simulation does not supply an absolute time.
Before that change a bug is detected in #prepareIndicesDataForDrawing(int, int, int, boolean)
: If the buffer from right side contains a greater short time,
the indices return only 1 point. It is a bug in this function, not corrected yet because there are not greater times from right to left with the change above.
TODO fix it though.
CommonCurve#lastTimeShort
: Don't store points with the same time stamp.
applySettings(String)
after read cfg: remove previous GralCurveView.CommonCurve.timeVariable
, may be a new one!
GralCurveView.Track.setVisible(int)
to control the visibility of tracks.
GralCurveView.Track.groupTrackScale(GralCurveViewTrack_ifc)
for groups of tracks with same scaling.
#setSample(float[], int)
: write a point only if at least one variable was refreshed.
GralCurveView.CommonCurve.timeVariable
for time from target.
GralCurveView.CommonCurve.bFreeze
: freeze as common property of more as one GralCurveView. Constructor argument.
redraw(int, int)
overridden forces paint of the whole curve
by setting #bPaintAllCmd
, whereby in #setSample(float[], int)
super.repaint is invoked,
which does not set #bPaintAllCmd
and paints therefore only the new data.
GralCurveView.GralCurveViewMouseAction
#selectTrack(int, int, int, int)
with ctrl and left mouse pressed
Track#getIxTrack()
bNewGetVariables
have to be set in GralWidget.setDataPath(String)
and
applySettings(String)
because this methods sets a new variable which should be searched.
All other changes are gardening and comments.
refreshFromVariable(VariableContainer_ifc)
only on
paint-complete of the view. If the implementation receives a paintAll command by mouseClick on the graphic
or because the graphic is shown the first time, the #setPaintAllCmd()
is invoked there. The variable
bNewGetVariables
is set, that causes the error message.
Before: no error message was created, the error was obscure.
applySettings(String)
and writeSettings(Appendable)
for saving
and getting the configuration of curve view from a file or another text.
VariableAccessWithIdx
to access values.
GralCurveView.Track
inner class.
GralCfgBuilder
. The old GuiDialogZbnfControlled.class
was not use nevermore. But the CurveView was not adapted for that.
final GralCurveView.ZbnfSetCurve zbnfSetCurve
public TimedValues tracksValue
public GralCurveView.TimeOrganisation timeorg
protected final GralCurveView.DataOrganisation dataOrg
protected GralCurveView.SaveOrganisation saveOrg
public final GralCurveView.CommonCurve common
listTracks
public boolean bActive
public int nrofValues
#setSample(float[])
,
then the nrofValues is less than values.length.
Else it is ==values.length.private boolean bNewGetVariables
public int gridDistanceStrongY
public final int maxNrofXValues
public boolean testStopWr
public int ixDataWr
#setSample(float[], int)
.
The index refers to the last written value.
Initially it is -1, the first write will be increment ?? to prevent any exception while values are not set before.public final int shIxiData
public final int mIxiData
protected final int mIxData
public int newSamples
protected int nrofValuesForGrid
public final int adIxData
public java.util.List<GralCurveView.Track> listTracks
protected final GralCurveView.GralCurveViewMouseAction mouseAction
private GralUserAction actionMoveCursor
private GralUserAction actionSelectTrack
public GralUserAction actionZoomBetweenCursors
public GralUserAction actionZoomOut
public GralUserAction actionCleanBuffer
public GralUserAction actionShowAll
public GralUserAction actionGo
public GralUserAction actionPaintAll
public GralCurveView(GralPos refPos, java.lang.String sPosName, int maxNrofXvaluesP, GralCurveView.CommonCurve curveVariables, TimedValues tracksValues)
refPos
- reference position will also be changed by given position in sPosName, will be cloned for the widget.sName
- widget name or also "@maxNrofXvaluesP
- deepness of values, max. 16000000 (16 Mega), usual 10000 or such. This value will be increased to the next power of 2.
Not used if tracksValues are given.curveVariables
- null or possible given Variable set for more as one curve viewtracksValues
- null or possible given Track Values from another CurveView or such.@Deprecated public GralCurveView(java.lang.String sName, int maxNrofXvaluesP, GralCurveView.CommonCurve common)
public void cleanBuffer()
public void showAll()
public void initMenuContext()
public GralCurveView.CommonCurve getCommonData()
public void setActionMoveCursor(GralUserAction action)
public void setActionTrackSelected(GralUserAction action)
public GralCurveView.Track addTrack(java.lang.String sNameTrack, java.lang.String sDataPath, GralColor color, int style, int nullLine, float scale, float offset)
listTracks
instance won't be changed.
Instead, a new ArrayList is created here with the content of listTracks and the new track.
This is because the listTracks
instance may be used in a iterator in another thread.
That is in #setSample(float[], int)
which can be invoked in a cyclically or receiving thread,
or in refreshFromVariable(VariableContainer_ifc)
which is invoked in the Inspector Gui cyclically
to get values from target. If during operation a track was add by the users operation on GUI, it should not disturb the current process.
This routine should be called only one time per track to create a new one.
in the order of tracks.
Note: renamed from initTrack, 2018-09sNameTrack
- sDataPath
- color
- style
- nullLine
- scale
- offset
- private GralCurveView.Track searchTrack(java.lang.String name)
name
- public void setTimePerPixel(int time)
public void setTimeSpread(int time)
public float getdTimeCursors()
public java.lang.String getTimeVariable()
public java.util.List<GralSetValue_ifc> getTracks()
#setSample(float[])
.
return a new List which should not modify. Modify has no sense because the list is not used inside this class.public java.lang.Iterable<? extends GralCurveViewTrack_ifc> getTrackInfo()
#setSample(float[])
.public GralCurveView.Track getTrackSelected()
public boolean shouldAutosave()
public long timeRight()
public void setTimePoint(long date, int timeshort, float millisecPerTimeshort)
GralCurveView_ifc
setTimePoint
in interface GralCurveView_ifc
date
- The absolute time appropriate to the timeshort value.timeshort
- The wrapping short time at this moment of data.millisecPerTimeshort
- Number of milliseconds per step of timeshort.public void setSample(float[] values, int timeShort, int timeShortAdd)
GralCurveView_ifc
setSample
in interface GralCurveView_ifc
values
- The values.timeShort
- relative time-stamp as currently wrapping time in any user step width, for example milliseconds.timeShortAdd
- additional value for timeShort to refer to an absolute time stamp.org.vishia.gral.ifc.GralCurveView_ifc#setSample(float[], int)
public void refreshFromVariable(VariableContainer_ifc container)
refreshFromVariable
in interface GralWidget_ifc
refreshFromVariable
in class GralWidget
container
- The container is used only if the variable is not known by direct reference
in the private GralWidget.variable
or GralWidget.variables
. If the variable(s) is/are
not known, they are searched by there data path set by GralWidget_ifc.setDataPath(String)
. More as one
variables are possible separated by "," in the setDataPath("variable1, variable2").
The variables are searched in the container calling VariableContainer_ifc#getVariable(String)
.org.vishia.gral.base.GralWidget#refreshFromVariable(org.vishia.byteData.VariableContainer_ifc)
public GralColor setBackgroundColor(GralColor color)
setBackgroundColor
in interface GralWidget_ifc
setBackgroundColor
in class GralWidget
public GralColor setForegroundColor(GralColor color)
setForegroundColor
in interface GralWidget_ifc
setForegroundColor
in class GralWidget
public void setBoundsPixel(int x, int y, int dx, int dy)
GralWidget_ifc
setBoundsPixel
in interface GralWidget_ifc
setBoundsPixel
in class GralWidget
public void activate(boolean activate)
GralCurveView_ifc
activate
in interface GralCurveView_ifc
activate
- true to activate, false to deactivate.public boolean isActiv()
GralCurveView_ifc
GralCurveView_ifc.activate(boolean)
.isActiv
in interface GralCurveView_ifc
public boolean isFreezed()
GralCurveView_ifc
isFreezed
in interface GralCurveView_ifc
public boolean applySettings(java.lang.String in)
GralCurveView_ifc
applySettings
in interface GralCurveView_ifc
in
- Input, syntax see GralCurveView_ifc.syntaxSettings
public void writeSettings(java.lang.Appendable out)
GralCurveView_ifc
GralCurveView_ifc.applySettings(String)
.writeSettings
in interface GralCurveView_ifc
out
- any output stream.public java.lang.CharSequence timeInitSaveViewArea()
public java.lang.CharSequence timeInitAutoSave()
GralCurveView_ifc
GralCurveView_ifc.writeCurve(WriteCurve_ifc, org.vishia.gral.ifc.GralCurveView_ifc.ModeWrite)
with GralCurveView_ifc.ModeWrite.autoSave
can be done with this current time range.timeInitAutoSave
in interface GralCurveView_ifc
private java.lang.CharSequence buildDate(int ixStart, int ixEnd)
public void readCurve(java.io.File file) throws java.io.IOException
java.io.IOException
private void readCurveCsvHeadline(java.io.File file) throws java.io.IOException
java.io.IOException
public void writeCurve(WriteCurve_ifc out, GralCurveView_ifc.ModeWrite mode)
GralCurveView_ifc
writeCurve
in interface GralCurveView_ifc
out
- exporter class referencemode
- autosave: Then the data range from GralCurveView_ifc.timeInitAutoSave()
is used.
currentView: Then the data range visible in window will be used.private void writeCurve(WriteCurve_ifc out, int ixDataStart, int ixDataEnd)
out
- ixDataStart
- 32-bit-wrapping indexixDataEnd
- public void redraw(int delay, int latest)
#bPaintAllCmd
which is checked
in the paint event routine. In opposite #setSample(float[], int)
invokes
super.repaint of GralWidget.redraw(int, int)
without setting that flag. Therefore the graphic
will be shifted to left only with paint of only the new data.redraw
in interface GralWidget_ifc
redraw
in class GralWidget
delay
- in milliseconds. If 0 or less 0, then it is executed immediately if the calling
thread is the graphic thread.latest
- The latest draw time in milliseconds. If it is <= 0, then it is unused.
Note that a new call of repaint removes an existing repaint order to the new given time.
With the latest argument for this time the repaint is always executing independent of new calls.GralWidget.redraw(int, int)