Computer Assisted Medical Intervention Tool Kit version 6.0
 
Loading...
Searching...
No Matches
camitk::GraphDisplayWidget Class Reference

GraphDisplayWidget is used to manage a Widget to display a graph with nodes and links onto a 2D canvas. More...

#include <GraphDisplayWidget.h>

+ Inheritance diagram for camitk::GraphDisplayWidget:
+ Collaboration diagram for camitk::GraphDisplayWidget:

Public Slots

void setSelectedLink (const void *link)
 Specify to the view that a link was selected.
 
void setSelectedNode (const void *node)
 Specify to the view that a node was selected.
 
void updateView ()
 Get the selection of nodes and links from the 2D canvas.
 

Signals

void linkDoubleClicked (const void *node)
 link was double clicked
 
void linkSelectionChanged (const void *link)
 Signal emitted when a link was selected in the 2D canvas It sends the pointer to the object represented by the link.
 
void nodeDoubleClicked (const void *node)
 node was double clicked
 
void nodeSelectionChanged (const void *node)
 Signal emitted when a node was selected in the 2D canvas It sends the pointer to the object represented by the node.
 

Public Member Functions

void addLink (const void *ptr, const void *from, const void *to, QString tooltip, const QPen &pen, bool arrowHead)
 Add a link in the graph.
 
void addNode (const void *ptr, QString tooltip, QColor color, QColor lineColor, QString internalText="")
 Add a node to the graph.
 
void autoScale ()
 Resize the content of the canvas to the size of the widget.
 
void clear ()
 Empty all nodes and links.
 
 GraphDisplayWidget (QWidget *parent=nullptr)
 constructor (build the scene and connect signals/slots)
 
void refresh ()
 Refresh the 2D canvas display.
 
void setNodeDiameter (float d)
 Set the diameter of nodes' graphical representation.
 
virtual ~GraphDisplayWidget ()
 destructor
 

Protected Member Functions

void mouseDoubleClickEvent (QMouseEvent *) override
 process double clicked nodes and link
 
void mouseReleaseEvent (QMouseEvent *e) override
 
void resizeEvent (QResizeEvent *) override
 make sure the scene fit the new size entirely
 

Detailed Description

GraphDisplayWidget is used to manage a Widget to display a graph with nodes and links onto a 2D canvas.

It's inherits from QGraphicsView.

It is used by TransformationExplorer to display the graph of FrameOfReference and Transformation but is not aware of the object that are managed graphically (all managed using const void*)

Constructor & Destructor Documentation

◆ GraphDisplayWidget()

GraphDisplayWidget::GraphDisplayWidget ( QWidget *  parent = nullptr)

constructor (build the scene and connect signals/slots)

References updateView().

+ Here is the call graph for this function:

◆ ~GraphDisplayWidget()

GraphDisplayWidget::~GraphDisplayWidget ( )
virtual

destructor

Member Function Documentation

◆ addLink()

void GraphDisplayWidget::addLink ( const void *  ptr,
const void *  from,
const void *  to,
QString  tooltip,
const QPen &  pen,
bool  arrowHead 
)

Add a link in the graph.

Parameters
ptra pointer to the object that is represented by this link.
froma pointer to the object represented as a node (and added before by addNode) that this links from
toa pointer to the object represented as a node (and added before by addNode) that this links to
tooltipThe tooltip to be displayed when the mouse hovers over the link
penThe pen used to draw the line (color, brush, width...)
arrowHeadif true adds an arrow pointing to the to object

◆ addNode()

void GraphDisplayWidget::addNode ( const void *  ptr,
QString  tooltip,
QColor  color,
QColor  lineColor,
QString  internalText = "" 
)

Add a node to the graph.

Parameters
ptrthe Object referred to by the node
tooltipThe tooltip to be displayed when the mouse hovers over the node
colorThe color of the disc representing the node
lineColorThe color of the circle around the disc
internalTextText to display inside the node (can be any UTF-8 character)

◆ autoScale()

void GraphDisplayWidget::autoScale ( )

Resize the content of the canvas to the size of the widget.

Referenced by mouseReleaseEvent(), refresh(), and resizeEvent().

+ Here is the caller graph for this function:

◆ clear()

void GraphDisplayWidget::clear ( )

Empty all nodes and links.

Referenced by TransformationExplorer::refresh().

+ Here is the caller graph for this function:

◆ linkDoubleClicked

void camitk::GraphDisplayWidget::linkDoubleClicked ( const void *  node)
signal

link was double clicked

Referenced by TransformationExplorer::getWidget(), and mouseDoubleClickEvent().

+ Here is the caller graph for this function:

◆ linkSelectionChanged

void camitk::GraphDisplayWidget::linkSelectionChanged ( const void *  link)
signal

Signal emitted when a link was selected in the 2D canvas It sends the pointer to the object represented by the link.

Referenced by TransformationExplorer::getWidget(), and updateView().

+ Here is the caller graph for this function:

◆ mouseDoubleClickEvent()

void GraphDisplayWidget::mouseDoubleClickEvent ( QMouseEvent *  mouseEvent)
overrideprotected

process double clicked nodes and link

References linkDoubleClicked(), and nodeDoubleClicked().

+ Here is the call graph for this function:

◆ mouseReleaseEvent()

void GraphDisplayWidget::mouseReleaseEvent ( QMouseEvent *  e)
overrideprotected

References autoScale().

+ Here is the call graph for this function:

◆ nodeDoubleClicked

void camitk::GraphDisplayWidget::nodeDoubleClicked ( const void *  node)
signal

node was double clicked

Referenced by TransformationExplorer::getWidget(), and mouseDoubleClickEvent().

+ Here is the caller graph for this function:

◆ nodeSelectionChanged

void camitk::GraphDisplayWidget::nodeSelectionChanged ( const void *  node)
signal

Signal emitted when a node was selected in the 2D canvas It sends the pointer to the object represented by the node.

Referenced by TransformationExplorer::getWidget(), and updateView().

+ Here is the caller graph for this function:

◆ refresh()

void GraphDisplayWidget::refresh ( )

Refresh the 2D canvas display.

References autoScale().

Referenced by TransformationExplorer::refresh(), and setNodeDiameter().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resizeEvent()

void GraphDisplayWidget::resizeEvent ( QResizeEvent *  resizeEvent)
overrideprotected

make sure the scene fit the new size entirely

References autoScale(), and resizeEvent().

Referenced by resizeEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setNodeDiameter()

void GraphDisplayWidget::setNodeDiameter ( float  d)

Set the diameter of nodes' graphical representation.

References refresh().

+ Here is the call graph for this function:

◆ setSelectedLink

void GraphDisplayWidget::setSelectedLink ( const void *  link)
slot

Specify to the view that a link was selected.

Parameters
linka pointer to the object represented by the link

Referenced by updateView().

+ Here is the caller graph for this function:

◆ setSelectedNode

void GraphDisplayWidget::setSelectedNode ( const void *  node)
slot

Specify to the view that a node was selected.

Parameters
nodea pointer to the object represented by the node

Referenced by updateView().

+ Here is the caller graph for this function:

◆ updateView

void GraphDisplayWidget::updateView ( )
slot

Get the selection of nodes and links from the 2D canvas.

References linkSelectionChanged(), nodeSelectionChanged(), setSelectedLink(), and setSelectedNode().

Referenced by GraphDisplayWidget().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

The documentation for this class was generated from the following files: