Wednesday, September 23, 2009

Plug-in-able Plot Window


The PlotTool class, which is the default plotting window in TinkerCell, has been modified to accept a variety of PlotWidgets. The current set of PlotWidgets include:

Plot2DWidget -- for drawing normal 2D graphs using Qwt
Plot3DWidget -- for drawing 3D surface plots using Qwt3D
PlotTextWidget -- for displaying information as text

All of the above classes inherit from PlotWidget

PlotWidget requires that each subclass define a data() method, which returns the current data shown in the graph. The PlotTool also requests the current PlotWidget to export the data in one of many formats (given as a string argument). The PlotWidget class will take care of exporting data as text, but it will handle any of the other export types.


Adding new plot types requires defining a new class that inherits from PlotWidget and overriding the data() and the exportData() methods. The PlotTool may need to be modified in order to add functions specific for plotting using the new widget. Each PlotWidget also comes with its own toolbar (variable names toolBar). This is automatically loaded by the PlotTool whenever a new PlotWidget is selected.

No comments: