|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.gwoptics.graphics.graph2D.traces.Line2DTrace
org.gwoptics.graphics.graph2D.traces.RollingLine2DTrace
public class RollingLine2DTrace
The rolling 2D trace object was created to act in a similar way to a Seismometer works, where the previous values on the graph move to the left and new values are added to the right.
In similar fashion to other Line2DTrace
objects a callback function needs to be specified, ILine2DEquation
,
that returns the value of a function or the value of some monitored variable.
Only Rolling2DTrace's can be added to a graph control, you cannot mix
this with other Line2DTrace
objects due to the way this object
updates the x-axis of the graph control it is added to.
Nested Class Summary | |
---|---|
class |
RollingLine2DTrace.RollingTraceTooFastException
This exception is thrown when the graph is trying to update too fast. |
Constructor Summary | |
---|---|
RollingLine2DTrace(ILine2DEquation eq,
long msRefreshRate,
float xIncr)
Creates a new RollingLine2DTrace to be added to a Graph2D
instance. |
Method Summary | |
---|---|
void |
generate()
Uses the ILineEquation object provided to fill the internal arrays. |
long |
getRefreshRate()
|
void |
onAddTrace(java.lang.Object[] traces)
Here we override the onAddTrace method to see if any Rolling2DTraces have been previously added. |
void |
onRemoveTrace()
Before the trace is officially removed from the trace list of a Graph2D object, the onRemove method is called. |
void |
pause()
Calling this stops the internal updating thread running. |
void |
pre()
|
void |
setGraph(IGraph2D grph)
Sets an internal variable to store a reference to the graph object the trace is being plotted on |
void |
setParent(processing.core.PApplet parent)
Sets the parent PApplet object |
void |
unpause()
Calling this resumes the internal updating thread. |
Methods inherited from class org.gwoptics.graphics.graph2D.traces.Line2DTrace |
---|
draw, removeEffect, setEquationCallback, setLineWidth, setPosition, setTraceColour, setTraceEffect |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RollingLine2DTrace(ILine2DEquation eq, long msRefreshRate, float xIncr)
Creates a new RollingLine2DTrace
to be added to a Graph2D
instance. A rolling graph is able to update itself automatically after a
user defined period in milliseconds indefinitely. All RollingLine2DTrace
traces that are added to a Graph2D
instance should have the same
update rate or an exception will be thrown.
Care needs to be taken when choosing values for the refresh and x axis
increment. Choosing very quick refresh rates using large x-axis increments
will cause the RollingLine2DTrace.RollingTraceTooFastException
to be thrown.
eq
- Equation that is to be used to generate the trace.msRefreshRate
- Rate at which trace is updated in millisecondsxIncr
- The amount the X-Axis value should increase every updateMethod Detail |
---|
public void pause()
public void unpause()
public long getRefreshRate()
public void setParent(processing.core.PApplet parent)
Line2DTrace
setParent
in interface IRenderable
setParent
in class Line2DTrace
public void setGraph(IGraph2D grph)
IGraph2DTrace
setGraph
in interface IGraph2DTrace
setGraph
in class Line2DTrace
public void onAddTrace(java.lang.Object[] traces)
onAddTrace
in interface IGraph2DTrace
onAddTrace
in class Line2DTrace
public void onRemoveTrace()
IGraph2DTrace
Before the trace is officially removed from the trace list of a Graph2D object, the onRemove method is called. This allows the trace object to provide any cleanup needed, if at all needed. Leave blank if nothing is needed.
onRemoveTrace
in interface IGraph2DTrace
onRemoveTrace
in class Line2DTrace
public void generate()
Line2DTrace
generate
in interface IGraph2DTrace
generate
in class Line2DTrace
public void pre()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |