QtiPlot 0.9.8.2
|
#include <PlotToolInterface.h>
Public Types | |
enum | RttiValues { Rtti_PlotTool = 0, Rtti_RangeSelector, Rtti_DataPicker, Rtti_TranslateCurveTool, Rtti_MultiPeakFitTool, Rtti_LineProfileTool, Rtti_AddWidgetTool, Rtti_DrawDataPoints, Rtti_ImageProfilesTool, Rtti_SubtractLineTool, Rtti_PlotUserTool = 1000 } |
Public Member Functions | |
PlotToolInterface (Graph *graph, const QObject *status_target=NULL, const char *status_slot="") | |
virtual int | rtti () const |
virtual | ~PlotToolInterface () |
Protected Attributes | |
Graph * | d_graph |
const char * | d_status_slot |
const QObject * | d_status_target |
Interface for tools operating on a Graph.
The basic idea is to have one PlotToolInterface subclass per user-visible tool operating on a Graph, although there may be cases where exceptions to this rule are appropriate. Note that tools can be presented to the user via icons (like DataPickerTool) or via menu entries (like TranslateCurveTool); the basic concept is quite similar. The main point in managing plot tools as subclasses of this class (as opposed to using void pointers) is the virtual destructor that allows tools to clean up after themselves. Additionally, a pointer to the parent Graph (d_graph) is managed. In the future, this class may provide other generic tool functionality.
Note that zooming and range selection are somewhat special in that they can be active in addition to other tools. These are handled as special cases, while all other tools are rendered mutually exclusive by having Graph manage a pointer to the currently active tool (Graph::d_active_tool).
It would be nice for some of the plot tools (like TranslateCurveTool or MultiPeakFitTool) to send a signal when they are finished and to generalize the statusText signal provided by most tools, but having PlotToolInterface inherit from QObject would make it impossible for plot tools to also inherit from other QObject decendants (such as QwtPlotPicker). As a workaround, plot tools can call Graph::setActiveTool(), carefully noting that they are deleted during this call.
Currently, plot tools are instantiated by ApplicationWindow and handed to the Graph in question; this scheme will have to be revised for dynamically adding new tools via plugins.
PlotToolInterface::PlotToolInterface | ( | Graph * | graph, |
const QObject * | status_target = NULL , |
||
const char * | status_slot = "" |
||
) | [inline] |
References d_graph, d_status_slot, and d_status_target.
virtual PlotToolInterface::~PlotToolInterface | ( | ) | [inline, virtual] |
virtual int PlotToolInterface::rtti | ( | ) | const [inline, virtual] |
Reimplemented in MultiPeakFitTool, AddWidgetTool, DataPickerTool, LineProfileTool, MultiPeakFitTool, RangeSelectorTool, DrawPointTool, ImageProfilesTool, SubtractLineTool, and TranslateCurveTool.
References Rtti_PlotTool.
Referenced by ApplicationWindow::clearSelection(), Graph::copy(), ApplicationWindow::copySelection(), ApplicationWindow::custom2DPlotTools(), ApplicationWindow::cutSelection(), SubtractLineTool::finalize(), MultiPeakFitTool::finalize(), ApplicationWindow::pasteSelection(), Graph::saveToString(), Graph::setActiveTool(), ApplicationWindow::showCurveContextMenu(), and ApplicationWindow::showCurveWorksheet().
Graph* PlotToolInterface::d_graph [protected] |
Referenced by AddWidgetTool::addEllipse(), AddWidgetTool::addEquation(), AddWidgetTool::addRectangle(), AddWidgetTool::addText(), ImageProfilesTool::append(), ScreenPickerTool::append(), DataPickerTool::append(), DrawPointTool::appendPoint(), LineProfileTool::calculateLineProfile(), RangeSelectorTool::clearMultipleSelection(), RangeSelectorTool::clearSelectedCurve(), RangeSelectorTool::copyMultipleSelection(), RangeSelectorTool::copySelectedCurve(), DataPickerTool::DataPickerTool(), RangeSelectorTool::emitStatusText(), DrawPointTool::eventFilter(), AddWidgetTool::eventFilter(), SubtractLineTool::finalize(), MultiPeakFitTool::finalize(), ImageProfilesTool::ImageProfilesTool(), RangeSelectorTool::keyEventFilter(), DataPickerTool::keyEventFilter(), LineProfileTool::LineProfileTool(), RangeSelectorTool::mightNeedMultipleSelection(), ImageProfilesTool::modifiedMatrix(), LineProfileTool::mouseReleaseEvent(), DataPickerTool::movePoint(), MultiPeakFitTool::MultiPeakFitTool(), RangeSelectorTool::pasteSelection(), DataPickerTool::pasteSelection(), DataPickerTool::pasteSelectionAsLayerText(), PlotToolInterface(), RangeSelectorTool::pointSelected(), RangeSelectorTool::RangeSelectorTool(), DataPickerTool::removePoint(), ScreenPickerTool::ScreenPickerTool(), TranslateCurveTool::selectCurvePoint(), TranslateCurveTool::selectDestination(), MultiPeakFitTool::selectPeak(), SubtractLineTool::selectPoint(), RangeSelectorTool::setCurveRange(), RangeSelectorTool::setEnabled(), DataPickerTool::setSelection(), RangeSelectorTool::setVisible(), RangeSelectorTool::showSelectionDialog(), SubtractLineTool::SubtractLineTool(), RangeSelectorTool::switchActiveMarker(), TranslateCurveTool::TranslateCurveTool(), ImageProfilesTool::updateCursorPosition(), AddWidgetTool::~AddWidgetTool(), DataPickerTool::~DataPickerTool(), RangeSelectorTool::~RangeSelectorTool(), ScreenPickerTool::~ScreenPickerTool(), and SubtractLineTool::~SubtractLineTool().
const char* PlotToolInterface::d_status_slot [protected] |
Referenced by ImageProfilesTool::clone(), and PlotToolInterface().
const QObject* PlotToolInterface::d_status_target [protected] |
Referenced by ImageProfilesTool::clone(), and PlotToolInterface().