org.gwoptics.graphics.graph2D.traces
Interface IGraph2DTrace

All Superinterfaces:
IRenderable
All Known Implementing Classes:
Blank2DTrace, Line2DTrace, RollingLine2DTrace, UpdatingLine2DTrace

public interface IGraph2DTrace
extends IRenderable

This interface provides the functionality that is required of a trace object, to be used by the Graph2D control.

Classes implementing this interface should be programmed for efficiency, as they are called many times per draw loop. The intended way to work is to store the points of the line in an internal array. When the draw() method is called from the IRenderable interface the method should use the array for plotting the trace. Usually the trace will not change so it is unnescessary to recalculate the equations everytime.

Traces also have the option of having an ITraceColourEffect applied to it. The draw() method should use this effect object to determine the colour of the trace at given points.

Since:
0.4.0
Author:
Daniel Brown 13/7/09
See Also:
ITraceColourEffect, ILine2DEquation

Method Summary
 void generate()
          This is called everytime the equation callback object is changed.
 void onAddTrace(java.lang.Object[] traces)
           Before the trace is added to the graph control this method is called.
 void onRemoveTrace()
           Before the trace is officially removed from the trace list of a Graph2D object, the onRemove method is called.
 void setGraph(IGraph2D grp)
          Sets an internal variable to store a reference to the graph object the trace is being plotted on
 void setPosition(int x, int y)
          alters the initial position of the trace on the graph
 
Methods inherited from interface org.gwoptics.graphics.IRenderable
draw, setParent
 

Method Detail

setGraph

void setGraph(IGraph2D grp)
Sets an internal variable to store a reference to the graph object the trace is being plotted on


generate

void generate()
This is called everytime the equation callback object is changed.


setPosition

void setPosition(int x,
                 int y)
alters the initial position of the trace on the graph


onAddTrace

void onAddTrace(java.lang.Object[] traces)

Before the trace is added to the graph control this method is called. It allows a trace to check the settings of other traces that have previously been added for in Compatibilities. Leave method empty in implementation if no checks are necessary.

w onAddTrace is called from with a synchronised lock so the traces object won't be modified whilst reading it. Therefore it is not necessary to provide custom thread locks.


onRemoveTrace

void onRemoveTrace()

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.



processing library gwoptics by Daniel Brown and Andreas Freise. (c) 2009 onwards