Tulip
4.6.0
Better Visualization Through Research
|
#include <View.h>
Public Slots | |
void | addRedrawTrigger (tlp::Observable *) |
virtual void | applySettings () |
virtual void | centerView (bool graphChanged=false) |
void | clearRedrawTriggers () |
virtual void | draw ()=0 |
void | emitDrawNeededSignal () |
virtual void | refresh () |
void | removeRedrawTrigger (tlp::Observable *) |
void | setCurrentInteractor (tlp::Interactor *currentInteractor) |
void | setGraph (tlp::Graph *graph) |
virtual void | setInteractors (const QList< tlp::Interactor * > &) |
virtual void | setState (const tlp::DataSet &)=0 |
virtual void | setupUi ()=0 |
void | showContextMenu (const QPoint &point, const QPointF &scenePoint) |
virtual void | treatEvent (const Event &) |
virtual void | undoCallback () |
Signals | |
void | drawNeeded () |
void | graphSet (tlp::Graph *) |
void | interactorsChanged () |
Public Member Functions | |
View () | |
virtual | ~View () |
virtual std::string | category () const |
virtual QGraphicsItem * | centralItem () const |
virtual QList< QWidget * > | configurationWidgets () const |
virtual QString | configurationWidgetsStyleSheet () const |
tlp::Interactor * | currentInteractor () const |
tlp::Graph * | graph () const |
virtual QGraphicsView * | graphicsView () const =0 |
std::string | icon () const |
QList< tlp::Interactor * > | interactors () const |
virtual QPixmap | snapshot (const QSize &outputSize=QSize()) const =0 |
virtual tlp::DataSet | state () const =0 |
void | treatEvents (const std::vector< Event > &events) |
QSet< tlp::Observable * > | triggers () const |
Protected Slots | |
virtual void | currentInteractorChanged (tlp::Interactor *) |
virtual void | fillContextMenu (QMenu *, const QPointF &) |
virtual void | graphChanged (tlp::Graph *)=0 |
virtual void | graphDeleted (tlp::Graph *parentGraph)=0 |
virtual void | interactorsInstalled (const QList< tlp::Interactor * > &interactors) |
View plugins provide a way to dynamically add to a Tulip plateform various ways to visualize a graph.
A view takes the following elements as inputs:
tlp::DataSet
) which contains initialization parameters.As an output, a View must provide a QGraphicsView
instance where all drawing is done. User interaction on a View is handled by the tlp::Interactor class. Several interactors can be installed on the same view but there can be only one active interactor at the same time. In the end, the view can provide several configuration widgets used to set up additional parameters.
When a View gets created, the following methods will always be called in the following order:
Once the View is initialized, none of the previously mentioned methods, except View::setGraph(), can be called again. View::setGraph method may be called again to notify the view that another graph should be displayed (this may be a sub/parent graph of the previously displayed graph or a graph coming from a totally different hierarchy)
Views are meant to be managed by an overleying system. As a consequence, a view may not decide directly when to redraw. Thus, you should never call the View::draw() method. To notify the overleying system that your view needs to be redrawn, emit the View::drawNeeded() signal instead.
A tlp::View subclass automatically inherits from the tlp::Observable interface. The tlp::View interface also automatically listn to its active graph to trigger handling trigger when this graph gets deleted. When the graph associated to a View gets deleted, the View::graphDeleted() callback is triggered.
tlp::View::View | ( | ) |
Default constructor.
virtual tlp::View::~View | ( | ) | [virtual] |
void tlp::View::addRedrawTrigger | ( | tlp::Observable * | ) | [slot] |
Registers a new trigger for automatic view drawing. Triggers are tlp::Observable subclasses. Once registered, the view will listen to the trigger's events and emit the drawNeeded signal each time the Observable::treatEvents() callback is run. For more information about the Observable system,.
virtual void tlp::View::applySettings | ( | ) | [virtual, slot] |
This method applies settings changed in the configuration widgets This method may be called from the overleying system in various situations. The View is expected to apply settings in an optimized way to prevent extra redraws. By default, this method does nothing.
Reimplemented in tlp::GlMainView.
virtual std::string tlp::View::category | ( | ) | const [inline, virtual] |
A string identifier for a plugin used for categorization purposes.
Implements tlp::Plugin.
virtual void tlp::View::centerView | ( | bool | graphChanged = false | ) | [virtual, slot] |
Reset the visualization to the center. This method is called after major changes into the data structure. At this point, the user point of view should be reset and brought back to a point where all the data can be seen.
Reimplemented in tlp::GlMainView.
virtual QGraphicsItem* tlp::View::centralItem | ( | ) | const [virtual] |
defines which item is considered as the central item in the view. The central item is considered to be a background item that will be set as parent of every graphics item added by the workspace into the view. By default, this method returns NULL, which means that no central item is defined.
Reimplemented in tlp::ViewWidget.
void tlp::View::clearRedrawTriggers | ( | ) | [slot] |
Clears the list of attached triggers This method removes all triggers associated to the View.
virtual QList<QWidget*> tlp::View::configurationWidgets | ( | ) | const [virtual] |
Reimplemented in tlp::GlMainView.
virtual QString tlp::View::configurationWidgetsStyleSheet | ( | ) | const [virtual] |
This method can be used to change the configuration widgets' style sheet. From Qt documentation: The style sheet contains a textual description of customizations to the widget's style, as described in the Qt Style Sheets document. see http://qt-project.org/doc/qt-4.7/stylesheet.html.
tlp::Interactor* tlp::View::currentInteractor | ( | ) | const |
virtual void tlp::View::currentInteractorChanged | ( | tlp::Interactor * | ) | [protected, virtual, slot] |
Callback method after setCurrentInteractor() was called. At this point, a call to View::currentInteractor() is considered valid and return the newly active interactor.
Reimplemented in tlp::ViewWidget.
virtual void tlp::View::draw | ( | ) | [pure virtual, slot] |
Asks the view to draw. A call to draw() means that internal data has most probably been modified and that the View should take that into account when drawing.
Implemented in tlp::GlMainView, and tlp::ViewWidget.
void tlp::View::drawNeeded | ( | ) | [signal] |
Inform the overlying subsystem that this view needs to be drawn.
void tlp::View::emitDrawNeededSignal | ( | ) | [slot] |
This function emit the signal drawNeeded.
virtual void tlp::View::fillContextMenu | ( | QMenu * | , |
const QPointF & | |||
) | [inline, protected, virtual, slot] |
fills the context menu with entries related to the view. This method is called whenever the context menu is displayed on the panel.
QMenu | The popup menu that will be displayed. This menu should be populated with context action related to the panel. |
Reimplemented in tlp::GlMainView.
tlp::Graph* tlp::View::graph | ( | ) | const |
virtual void tlp::View::graphChanged | ( | tlp::Graph * | ) | [protected, pure virtual, slot] |
Callback method after setGraph() was called. At this point, a call to View::graph() is considered valid and return the lastly set graph.
virtual void tlp::View::graphDeleted | ( | tlp::Graph * | parentGraph | ) | [protected, pure virtual, slot] |
Called when the graph associated to the view gets deleted. This method should call setGraph to input a new graph pointer (NULL or valid)
parentGraph | The parent of the graph that was just deleted. If there is no parent available (eg. the graph was root), parentGraph is NULL |
Implemented in tlp::ViewWidget.
virtual QGraphicsView* tlp::View::graphicsView | ( | ) | const [pure virtual] |
QGraphicsView
instance. Implemented in tlp::ViewWidget.
void tlp::View::graphSet | ( | tlp::Graph * | ) | [signal] |
Emitted after the setGraph method has been called.
std::string tlp::View::icon | ( | ) | const [inline, virtual] |
The icon (preferably a thumbnail) of the plugin.
Reimplemented from tlp::Plugin.
QList<tlp::Interactor*> tlp::View::interactors | ( | ) | const |
virtual void tlp::View::interactorsInstalled | ( | const QList< tlp::Interactor * > & | interactors | ) | [protected, virtual, slot] |
Callback method after setInteractors() was called. At this point, a call to View::interactors() is considered valid.
virtual void tlp::View::refresh | ( | ) | [inline, virtual, slot] |
Refresh the View's panel. Calling refresh() means that no internal data has been modified. This can happen when the view's panel gets resized, restored etc.
Reimplemented in tlp::GlMainView.
void tlp::View::removeRedrawTrigger | ( | tlp::Observable * | ) | [slot] |
Removes a trigger from the list of registered triggers. Event coming from this trigger will no longer trigger the drawNeeded signal.
void tlp::View::setCurrentInteractor | ( | tlp::Interactor * | currentInteractor | ) | [slot] |
defines the active interactor that will receive user inputs.
void tlp::View::setGraph | ( | tlp::Graph * | graph | ) | [slot] |
Defines the graph that should be displayed by the View.
virtual void tlp::View::setInteractors | ( | const QList< tlp::Interactor * > & | ) | [virtual, slot] |
defines the list of interactors available on this View
virtual void tlp::View::setState | ( | const tlp::DataSet & | ) | [pure virtual, slot] |
Restores the state of the view. DataSet passed down to this method can come from a previous backup or be generated by the overleying system. It's up to the view to use this data or not.
virtual void tlp::View::setupUi | ( | ) | [pure virtual, slot] |
Sets up GUI elements belonging to the View. This method is called once the initial state as been set (using setGraph and setState) and is called only once.
Implemented in tlp::ViewWidget.
void tlp::View::showContextMenu | ( | const QPoint & | point, |
const QPointF & | scenePoint | ||
) | [slot] |
This method is called whenever the context menu is required on the view.
point | The screen coordinates where the context menu should be displayed. |
virtual QPixmap tlp::View::snapshot | ( | const QSize & | outputSize = QSize() | ) | const [pure virtual] |
Takes a snapshot of the view's screen and saves it into the given pixmap. The snapshot is scaled to outputSize. If a null size is given, the snapshot is to be on a 1:1 ratio.
Implemented in tlp::ViewWidget, and tlp::GlMainView.
virtual tlp::DataSet tlp::View::state | ( | ) | const [pure virtual] |
Backup the state of the view. This method is used to restore the View's parameters when it's re-opened.
virtual void tlp::View::treatEvent | ( | const Event & | ) | [virtual, slot] |
This method is inherited from tlp::Observable and allows the view to trigger custom callback when its associated graph gets deleted.
Reimplemented from tlp::Observable.
void tlp::View::treatEvents | ( | const std::vector< Event > & | events | ) | [virtual] |
reimplemented from tlp::Observable to provide the triggers mechanism.
Reimplemented from tlp::Observable.
QSet<tlp::Observable*> tlp::View::triggers | ( | ) | const |
virtual void tlp::View::undoCallback | ( | ) | [virtual, slot] |
This method is a callback to notify the panel that the pop() method (undo) has just been called on the graph. By default, this method will make a call to centerView()
Reimplemented in tlp::GlMainView.