DisplayGraph Class Reference

Manages the display and layouting of a Graph. More...

#include <DisplayGraphNode.h>

Inheritance diagram for DisplayGraph:

Inheritance graph
[legend]
List of all members.

Public Slots

void on_cmdStartTimer_clicked ()
void on_cmdStopTimer_clicked ()
void on_cmdReset_clicked ()
void on_timerEvent ()

Public Member Functions

 DisplayGraph (QGraphicsScene *sc, QObject *par=0)
 ~DisplayGraph ()
QList< DisplayGraphNode * > & nodes ()
void addNode (DisplayGraphNode *n)
void addEdge (int nodeId1, int nodeId2, const QString &label="")
void addEdge (DisplayGraphNode *n1, DisplayGraphNode *n2, const QString &label="")
QWidget * controlWidget ()
int addGravityNode ()
void addInvisibleEdge (int i1, int i2)
void circleLayout ()
 good starting point for spring embedder
bool isAdjacentTo (DisplayGraphNode *n1, DisplayGraphNode *n2) const
virtual void deleteNode (DisplayNode *n)
void setOptimalDistance (qreal dist)
void setDelta (qreal newDelta)
qreal springBasedLayoutIteration (qreal delta)

Static Public Member Functions

static DisplayGraphgenerateTestGraph (QGraphicsScene *sc, QObject *par=0)

Protected Member Functions

qreal getCosBetween (QPointF &a, QPointF &b)
qreal getSinBetween (QPointF &a, QPointF &b)
QPointF repulsiveForce (const QPointF &n1, const QPointF &n2, qreal optDist)
QPointF attractiveForce (const QPointF &n1, const QPointF &n2, qreal optDist)
void updateWidget ()

Protected Attributes

QGraphicsScene * scene
QVector< QPointF > forcesList
 Vector of forces, used in function repulsiveForce().
QVector< QPointF > oldForcesList
qreal curDelta
int curIteration
 Iteration counter.
qreal optimalDistance
QWidget * uiWidget
 Members for the Control Widget.
Ui::LayoutControl * ui
QTimer * timer
QList< DisplayGraphNode * > n
 List of all nodes.
QMultiMap< DisplayGraphNode *,
DisplayGraphNode * > 
edgeInfo

Detailed Description

Manages the display and layouting of a Graph.

This class manages a graph consisting of DisplayGraphNode 's The graph can be displayed and layouted in a QGraphicsScene. For layouting a spring embedder algorithm is used, additional a control widget can be rendered into the QGraphicsView which can be used to control parameters of the spring embedder

Definition at line 82 of file DisplayGraphNode.h.


Constructor & Destructor Documentation

DisplayGraph::DisplayGraph ( QGraphicsScene *  sc,
QObject *  par = 0 
)

Definition at line 171 of file DisplayGraphNode.cpp.

Here is the call graph for this function:

DisplayGraph::~DisplayGraph (  ) 

Definition at line 194 of file DisplayGraphNode.cpp.


Member Function Documentation

void DisplayGraph::addEdge ( DisplayGraphNode n1,
DisplayGraphNode n2,
const QString &  label = "" 
)

Definition at line 260 of file DisplayGraphNode.cpp.

Here is the call graph for this function:

void DisplayGraph::addEdge ( int  nodeId1,
int  nodeId2,
const QString &  label = "" 
)

Definition at line 268 of file DisplayGraphNode.cpp.

Referenced by DisplayCallGraph::addCgEdge(), and addEdge().

Here is the call graph for this function:

Here is the caller graph for this function:

int DisplayGraph::addGravityNode (  ) 

Adds a node representing a center of gravity returns the index of the gravity node

Definition at line 299 of file DisplayGraphNode.cpp.

Here is the call graph for this function:

void DisplayGraph::addInvisibleEdge ( int  i1,
int  i2 
)

Definition at line 283 of file DisplayGraphNode.cpp.

Referenced by addEdge().

Here is the caller graph for this function:

void DisplayGraph::addNode ( DisplayGraphNode n  ) 

Definition at line 291 of file DisplayGraphNode.cpp.

Referenced by DisplayCallGraph::addCgNode().

Here is the call graph for this function:

Here is the caller graph for this function:

QPointF DisplayGraph::attractiveForce ( const QPointF &  n1,
const QPointF &  n2,
qreal  optDist 
) [protected]

Definition at line 470 of file DisplayGraphNode.cpp.

Referenced by springBasedLayoutIteration().

Here is the caller graph for this function:

void DisplayGraph::circleLayout (  ) 

good starting point for spring embedder

Definition at line 485 of file DisplayGraphNode.cpp.

Referenced by on_cmdReset_clicked().

QWidget* DisplayGraph::controlWidget (  )  [inline]

Definition at line 96 of file DisplayGraphNode.h.

Referenced by CallGraphWidget::CallGraphWidget().

Here is the caller graph for this function:

void DisplayGraph::deleteNode ( DisplayNode n  )  [virtual]

Reimplemented in DisplayCallGraph.

Definition at line 232 of file DisplayGraphNode.cpp.

Referenced by DisplayCallGraph::deleteNode().

Here is the call graph for this function:

Here is the caller graph for this function:

static DisplayGraph* DisplayGraph::generateTestGraph ( QGraphicsScene *  sc,
QObject *  par = 0 
) [static]

qreal DisplayGraph::getCosBetween ( QPointF &  a,
QPointF &  b 
) [protected]

Definition at line 429 of file DisplayGraphNode.cpp.

qreal DisplayGraph::getSinBetween ( QPointF &  a,
QPointF &  b 
) [protected]

Definition at line 443 of file DisplayGraphNode.cpp.

bool DisplayGraph::isAdjacentTo ( DisplayGraphNode n1,
DisplayGraphNode n2 
) const

Definition at line 326 of file DisplayGraphNode.cpp.

QList<DisplayGraphNode*>& DisplayGraph::nodes (  )  [inline]

Definition at line 90 of file DisplayGraphNode.h.

Referenced by DisplayCallGraph::generateCgSubGraph().

Here is the caller graph for this function:

void DisplayGraph::on_cmdReset_clicked (  )  [slot]

Definition at line 223 of file DisplayGraphNode.cpp.

Referenced by DisplayGraph().

void DisplayGraph::on_cmdStartTimer_clicked (  )  [slot]

Definition at line 206 of file DisplayGraphNode.cpp.

Referenced by DisplayGraph(), and CallGraphWidget::updateGraph().

void DisplayGraph::on_cmdStopTimer_clicked (  )  [slot]

Definition at line 215 of file DisplayGraphNode.cpp.

Referenced by DisplayGraph().

void DisplayGraph::on_timerEvent (  )  [slot]

Definition at line 308 of file DisplayGraphNode.cpp.

Referenced by DisplayGraph().

QPointF DisplayGraph::repulsiveForce ( const QPointF &  n1,
const QPointF &  n2,
qreal  optDist 
) [protected]

Definition at line 456 of file DisplayGraphNode.cpp.

Referenced by springBasedLayoutIteration().

Here is the caller graph for this function:

void DisplayGraph::setDelta ( qreal  newDelta  )  [inline]

Definition at line 117 of file DisplayGraphNode.h.

void DisplayGraph::setOptimalDistance ( qreal  dist  )  [inline]

Definition at line 116 of file DisplayGraphNode.h.

Referenced by CallGraphWidget::CallGraphWidget().

Here is the caller graph for this function:

qreal DisplayGraph::springBasedLayoutIteration ( qreal  delta  ) 

Definition at line 334 of file DisplayGraphNode.cpp.

Referenced by on_timerEvent().

Here is the call graph for this function:

void DisplayGraph::updateWidget (  )  [protected]

Definition at line 201 of file DisplayGraphNode.cpp.

Referenced by DisplayGraph(), on_cmdReset_clicked(), and on_timerEvent().

Here is the caller graph for this function:


Member Data Documentation

qreal DisplayGraph::curDelta [protected]

The bigger the delta the more a force changes the position called curDelta, because it may be decremented each iteration

Definition at line 146 of file DisplayGraphNode.h.

Referenced by DisplayGraph(), on_cmdReset_clicked(), on_cmdStartTimer_clicked(), on_timerEvent(), and setDelta().

int DisplayGraph::curIteration [protected]

Iteration counter.

Definition at line 149 of file DisplayGraphNode.h.

Referenced by on_cmdReset_clicked(), on_cmdStartTimer_clicked(), and on_timerEvent().

QMultiMap<DisplayGraphNode*, DisplayGraphNode *> DisplayGraph::edgeInfo [protected]

Multimap of (undirected) edges, edges are stored in nodes too but with the multimap the lookup of adjacency info is faster and invisible edges are supported i.e. edges considered in layouter but not in display to keep this data structure consistent don't use DisplayGraphNode-pointer outside of this class

Definition at line 170 of file DisplayGraphNode.h.

Referenced by addEdge(), addInvisibleEdge(), DisplayCallGraph::clear(), deleteNode(), isAdjacentTo(), and springBasedLayoutIteration().

QVector<QPointF> DisplayGraph::forcesList [protected]

Vector of forces, used in function repulsiveForce().

Definition at line 141 of file DisplayGraphNode.h.

Referenced by springBasedLayoutIteration().

QList<DisplayGraphNode * > DisplayGraph::n [protected]

List of all nodes.

Definition at line 162 of file DisplayGraphNode.h.

Referenced by addEdge(), addGravityNode(), addInvisibleEdge(), addNode(), circleLayout(), DisplayCallGraph::clear(), DisplayCallGraph::deleteNode(), deleteNode(), nodes(), springBasedLayoutIteration(), and ~DisplayGraph().

QVector<QPointF> DisplayGraph::oldForcesList [protected]

Definition at line 142 of file DisplayGraphNode.h.

Referenced by springBasedLayoutIteration().

qreal DisplayGraph::optimalDistance [protected]

Parameter for force calculation, optimal distance between two adjacent nodes

Definition at line 153 of file DisplayGraphNode.h.

Referenced by circleLayout(), DisplayGraph(), on_timerEvent(), setOptimalDistance(), and springBasedLayoutIteration().

QGraphicsScene* DisplayGraph::scene [protected]

Definition at line 138 of file DisplayGraphNode.h.

Referenced by addGravityNode(), addNode(), and springBasedLayoutIteration().

QTimer* DisplayGraph::timer [protected]

Definition at line 158 of file DisplayGraphNode.h.

Referenced by DisplayGraph(), on_cmdStartTimer_clicked(), on_cmdStopTimer_clicked(), and on_timerEvent().

Ui::LayoutControl* DisplayGraph::ui [protected]

Definition at line 157 of file DisplayGraphNode.h.

Referenced by DisplayGraph(), on_cmdReset_clicked(), on_cmdStartTimer_clicked(), on_cmdStopTimer_clicked(), on_timerEvent(), springBasedLayoutIteration(), and ~DisplayGraph().

QWidget* DisplayGraph::uiWidget [protected]

Members for the Control Widget.

Definition at line 156 of file DisplayGraphNode.h.

Referenced by controlWidget(), and DisplayGraph().


The documentation for this class was generated from the following files:
Generated on Tue Sep 15 14:48:49 2009 for RoseQtWidgets by  doxygen 1.4.7