Tulip  5.3.0
Large graphs analysis and drawing
tlp::GlMainView Class Reference

#include <GlMainView.h>

+ Inheritance diagram for tlp::GlMainView:
+ Collaboration diagram for tlp::GlMainView:

Public Types

enum  OverviewPosition { OVERVIEW_TOP_LEFT, OVERVIEW_TOP_RIGHT, OVERVIEW_BOTTOM_LEFT, OVERVIEW_BOTTOM_RIGHT }
 

Public Slots

void applySettings () override
 
void centerView (bool graphChanged=false) override
 
void draw () override
 
virtual void drawOverview (bool generatePixmap=true)
 
static bool getNodeOrEdgeAtViewportPos (GlMainWidget *glw, int x, int y, node &n, edge &e)
 
bool getNodeOrEdgeAtViewportPos (int x, int y, node &n, edge &e) const override
 
void redraw ()
 
void refresh () override
 
void setOverviewVisible (bool)
 
void setViewOrtho (bool)
 
void undoCallback () override
 
- Public Slots inherited from tlp::ViewWidget
void draw () override
 
void setupUi () override
 
- Public Slots inherited from tlp::View
void addRedrawTrigger (tlp::Observable *)
 
virtual void applySettings ()
 
virtual void centerView (bool graphChanged=false)
 
virtual bool checkOnClose ()
 
void clearRedrawTriggers ()
 
virtual void draw ()=0
 
void emitDrawNeededSignal ()
 
virtual bool getNodeOrEdgeAtViewportPos (int, int, node &, edge &) const
 
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 setupUi ()=0
 
void treatEvent (const Event &) override
 
virtual void undoCallback ()
 

Public Member Functions

 GlMainView (bool needTooltipAndUrlManager=false)
 
QList< QWidget * > configurationWidgets () const override
 
tlp::GlMainWidgetgetGlMainWidget () const
 
OverviewPosition overviewPosition () const
 
bool overviewVisible () const
 
void setOverviewPosition (const OverviewPosition &position)
 
void setState (const tlp::DataSet &) override
 
void setUpdateOverview (bool updateOverview)
 
QPixmap snapshot (const QSize &outputSize=QSize()) const override
 
tlp::DataSet state () const override
 
bool updateOverview () const
 
- Public Member Functions inherited from tlp::ViewWidget
QGraphicsView * graphicsView () const override
 
void resetGraphicsScene () override
 
- Public Member Functions inherited from tlp::View
 View ()
 
 ~View () override
 
std::string category () const override
 
virtual QString configurationWidgetsStyleSheet () const
 
tlp::InteractorcurrentInteractor () const
 
tlp::Graphgraph () const
 
std::string icon () const override
 
const QList< Interactor * > & interactors () const
 
virtual bool interactorsEnabled () const
 
void setShowContextMenu (bool show)
 
void showContextMenu (const QPoint &point, const QPointF &scenePoint)
 
void treatEvents (const std::vector< Event > &events) override
 
QSet< tlp::Observable * > triggers () const
 
- Public Member Functions inherited from tlp::Plugin
virtual std::string author () const =0
 
virtual std::string date () const =0
 
void declareDeprecatedName (const std::string &oldName)
 
std::string deprecatedName ()
 
virtual std::string group () const =0
 
virtual int id () const
 
virtual std::string info () const =0
 
virtual std::string major () const
 
virtual std::string minor () const
 
virtual std::string name () const =0
 
virtual std::string programmingLanguage () const
 
virtual std::string release () const =0
 
virtual std::string tulipMajor () const
 
virtual std::string tulipMinor () const
 
virtual std::string tulipRelease () const =0
 
- Public Member Functions inherited from tlp::WithParameter
template<typename T >
void addInOutParameter (const std::string &name, const std::string &help=std::string(), const std::string &defaultValue=std::string(), bool isMandatory=true, const std::string &valuesDescription=std::string())
 
template<typename T >
void addInParameter (const std::string &name, const std::string &help, const std::string &defaultValue, bool isMandatory=true, const std::string &valuesDescription=std::string())
 
template<typename T >
void addOutParameter (const std::string &name, const std::string &help=std::string(), const std::string &defaultValue=std::string(), bool isMandatory=true, const std::string &valuesDescription=std::string())
 
template<typename T >
void addParameter (const std::string &name, const std::string &help=std::string(), const std::string &defaultValue=std::string(), bool isMandatory=true)
 
const tlp::ParameterDescriptionListgetParameters () const
 
bool inputRequired () const
 
- Public Member Functions inherited from tlp::WithDependency
void addDependency (const char *name, const char *release)
 
const std::list< Dependency > & dependencies () const
 
- Public Member Functions inherited from tlp::Observable
void addListener (Observable *const listener) const
 
void addObserver (Observable *const observer) const
 
unsigned int countListeners () const
 
unsigned int countObservers () const
 
unsigned int getReceived () const
 
unsigned int getSent () const
 
void removeListener (Observable *const listener) const
 
void removeObserver (Observable *const observerver) const
 

Protected Slots

void fillContextMenu (QMenu *menu, const QPointF &) override
 
virtual void glMainViewDrawn (bool graphChanged)
 
virtual void sceneRectChanged (const QRectF &)
 
void setQuickAccessBarVisible (bool)
 
- Protected Slots inherited from tlp::ViewWidget
void currentInteractorChanged (tlp::Interactor *) override
 
void graphDeleted (Graph *parentGraph) override
 
- Protected Slots inherited from tlp::View
void activateTooltipAndUrlManager (QWidget *)
 
virtual void currentInteractorChanged (tlp::Interactor *)
 
virtual void fillContextMenu (QMenu *, const QPointF &)
 
void fillContextMenu (QMenu *menu, node n)
 
void fillContextMenu (QMenu *menu, edge e)
 
virtual void graphChanged (tlp::Graph *)=0
 
virtual void graphDeleted (tlp::Graph *parentGraph)=0
 
virtual void interactorsInstalled (const QList< tlp::Interactor *> &interactors)
 
void toggleInteractors (const bool activate, const std::unordered_set< const char *> &exceptions)
 

Protected Member Functions

void assignNewGlMainWidget (GlMainWidget *glMainWidget, bool deleteOldGlMainWidget=true)
 
bool eventFilter (QObject *obj, QEvent *event) override
 
virtual QuickAccessBar * getQuickAccessBarImpl ()
 
tlp::GlOverviewGraphicsItem * overviewItem () const
 
bool quickAccessBarVisible () const
 
void setupWidget () override
 
void updateShowOverviewButton ()
 
void updateShowQuickAccessBarButton ()
 
- Protected Member Functions inherited from tlp::ViewWidget
void addToScene (QGraphicsItem *item)
 
QGraphicsItem * centralItem () const override
 
void removeFromScene (QGraphicsItem *item)
 
void setCentralWidget (QWidget *, bool deleteOldCentralWidget=true)
 
QPixmap snapshot (const QSize &outputSize=QSize()) const override
 
- Protected Member Functions inherited from tlp::Observable
 Observable (const Observable &)
 
bool hasOnlookers () const
 
void observableDeleted ()
 
Observableoperator= (const Observable &)
 
void sendEvent (const Event &message)
 
virtual void treatEvent (const Event &message)
 

Protected Attributes

bool _needTooltipAndUrlManager
 
OverviewPosition _overviewPosition
 
tlp::QuickAccessBar * _quickAccessBar
 
QGraphicsProxyWidget * _quickAccessBarItem
 
tlp::SceneConfigWidget * _sceneConfigurationWidget
 
tlp::SceneLayersConfigWidget * _sceneLayersConfigurationWidget
 
bool _updateOverview
 
bool needQuickAccessBar
 
- Protected Attributes inherited from tlp::Plugin
std::string oldName
 
- Protected Attributes inherited from tlp::WithDependency
std::list< Dependency_dependencies
 

Additional Inherited Members

- Signals inherited from tlp::View
void drawNeeded ()
 
void graphSet (tlp::Graph *)
 
void interactorsChanged ()
 
- Static Public Member Functions inherited from tlp::Observable
static void disableEventNotification ()
 
static void enableEventNotification ()
 
static tlp::node getNode (const tlp::Observable *obs)
 
static ObservablegetObject (tlp::node n)
 
static const tlp::VectorGraph & getObservableGraph ()
 
static unsigned int getScheduled (tlp::node n)
 
static void holdObservers ()
 
static bool isAlive (tlp::node n)
 
static unsigned int observersHoldCounter ()
 
static void unholdObservers ()
 

Detailed Description

An abstract view that displays a GlMainWidget as its central widget.

The GlMainView subclasses ViewWidget and always uses a GlMainWidget as the central widget of the panel. It also adds the following features:

  • An overview of the scene that can be toggled on or off.
  • Some configuration widgets that modify the rendering parameters.
  • A quick access bar widget that allows the user to quickly modify some of the most used rendering parameters and graph properties (nodes color, edges display, etc)
  • The possibility to make snapshots of the current scene

Subclassing GlMainView means you will only want to display graphs in a single GlMainWidget. Switching the central widget can only be achieved from the ViewWidget class.

Warning
It is strongly unadvised to re-implement methods already implemented into tlp::View or tlp::ViewWidget. If you have to add custom behavior to those method, make sure to call the upper-class methods first:
void MyView::setupWidget() { // Where MyView is a subclass of tlp::GlMainView
GlMainView::setupWidget(); // call this first
// insert custom behavior here
}
See also
tlp::ViewWidget
Examples:
interactor_plugin/interactor_plugin.cpp.

Definition at line 68 of file GlMainView.h.

Member Function Documentation

◆ applySettings

void tlp::GlMainView::applySettings ( )
overrideslot

Force the settings set in the configuration widgets to be re-applied.

◆ centerView

void tlp::GlMainView::centerView ( bool  graphChanged = false)
overrideslot

Centers the scene's camera.

◆ configurationWidgets()

QList<QWidget *> tlp::GlMainView::configurationWidgets ( ) const
overridevirtual
Returns
a list of widgets that can be used to set up the view. Since several widgets can be retrived, user will be able to select them from a combo box where each widget will be identified by its windowsTitle.
See also
View::applySettings()
Warning
This method must not instantiate configuration widgets on the fly.

Reimplemented from tlp::View.

◆ draw

void tlp::GlMainView::draw ( )
overrideslot

◆ drawOverview

virtual void tlp::GlMainView::drawOverview ( bool  generatePixmap = true)
virtualslot

Force the overview to be redrawn. Since GlMainView already detects graph's modifications, this method should not be called manually to avoid extra rendering.

◆ redraw

void tlp::GlMainView::redraw ( )
slot

◆ refresh

void tlp::GlMainView::refresh ( )
overrideslot

◆ setOverviewVisible

void tlp::GlMainView::setOverviewVisible ( bool  )
slot

Toggles the overview on or off.

◆ setState()

void tlp::GlMainView::setState ( const tlp::DataSet )
overridevirtual

Restores the state of the view. DataSet passed down to this method can come from a previous backup or be generated by the overlaying system. It's up to the view to use this data or not.

Reimplemented from tlp::View.

◆ setupWidget()

void tlp::GlMainView::setupWidget ( )
overrideprotectedvirtual

Sets up the central widget. This is similar to View::setupUi in the sense that the purpose of setupWidget is to construct the GUI element.

Warning
This method MUST call the setCentralWidget to provide the ViewWidget with a valid widget.

Implements tlp::ViewWidget.

◆ setViewOrtho

void tlp::GlMainView::setViewOrtho ( bool  )
slot

Toggles the orthogonal projection on or off, then draws.

◆ snapshot()

QPixmap tlp::GlMainView::snapshot ( const QSize &  outputSize = QSize()) const
overridevirtual

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.

Returns
A non-null pixmap of the snapshot was correctly taken.

Implements tlp::View.

◆ state()

tlp::DataSet tlp::GlMainView::state ( ) const
overridevirtual

Backup the state of the view. This method is used to restore the View's parameters when it's re-opened.

Reimplemented from tlp::View.