DisplayTreeNode Class Reference

A DisplayNode used to manage a tree. More...

#include <DisplayNode.h>

Inheritance diagram for DisplayTreeNode:

Inheritance graph
[legend]
List of all members.

Public Types

 DisplayNodeType = UserType + 1
enum  { DisplayNodeType = UserType + 1 }
 Each user defined QGraphicsItem needs a unique constant. More...

Public Member Functions

 DisplayTreeNode (QGraphicsScene *scene=NULL)
virtual ~DisplayTreeNode ()
DisplayTreeNodegetParent ()
int childrenCount () const
DisplayTreeNodegetChild (int i)
DisplayTreeNodegetFirstChild ()
DisplayTreeNodegetLastChild ()
void deleteChildren (int from, int to)
DisplayTreeNodeaddChild (const QString &dispName)
 Inserts a child with a given displayName in the tree.
void addChild (DisplayTreeNode *c)
virtual void setScene (QGraphicsScene *s)
 Overloaded to set recursively the scene in the children.
void registerAdditionalEdge (DisplayEdge *e)
virtual const QString & getDisplayName ()
 Display Name is the String which is printed in the node.
virtual void setDisplayName (const QString &n)
virtual void setBgColor (const QColor &c)
 Background color, when not selected.
virtual void setBgColorSelected (const QColor &c)
virtual QColor getBgColor () const
virtual QColor getBgColorSelected () const
virtual SgNode * getSgNode ()
 Returns the Sage Node which corresponds to this DisplayNode.
virtual void setSgNode (SgNode *sgNode)
virtual QRectF boundingRect () const
 Functions required by QGraphicsScene.
virtual QPainterPath shape () const
virtual int type () const
virtual void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
 Custom Paint Event.
virtual bool isMouseHold () const

Static Public Member Functions

static DisplayTreeNodemergeTrees (QGraphicsScene *scene, const QString &name, DisplayTreeNode *n1, DisplayTreeNode *n2)
static void simplifyTree (DisplayTreeNode *node)

Protected Member Functions

QVariant itemChange (GraphicsItemChange change, const QVariant &value)
DisplayTreeNodeaddChild (SgNode *sgNode)
virtual void mousePressEvent (QGraphicsSceneMouseEvent *event)
virtual void mouseReleaseEvent (QGraphicsSceneMouseEvent *event)
void init ()

Protected Attributes

QList< DisplayEdge * > childEdges
 Child Edges go from parent to child.
QList< DisplayEdge * > additionalEdges
DisplayEdgeparentEdge
 Source node of parentEdge is the parent, destination is this node.
QGraphicsScene * scene
QString caption
 Text which is rendered inside of node.
SgNode * sg
QFont textFont
 The font used for drawing the caption.
QColor bgColor
 Background color if node is not selected.
QColor bgColorSelected
 Background color when node is selected.
bool mouseHold
 True when a mouse button is pressed over this node.

Friends

class DisplayTreeGenerator

Detailed Description

A DisplayNode used to manage a tree.

A DisplayTreeNode is a DisplayGraphNode which has only outputEdges (children) and a dedicated inputEdge (parent)

Definition at line 114 of file DisplayNode.h.


Member Enumeration Documentation

anonymous enum [inherited]

Each user defined QGraphicsItem needs a unique constant.

Enumerator:
DisplayNodeType 

Definition at line 24 of file DisplayNode.h.


Constructor & Destructor Documentation

DisplayTreeNode::DisplayTreeNode ( QGraphicsScene *  scene = NULL  ) 

Definition at line 140 of file DisplayNode.cpp.

Referenced by addChild(), and mergeTrees().

Here is the caller graph for this function:

DisplayTreeNode::~DisplayTreeNode (  )  [virtual]

Definition at line 145 of file DisplayNode.cpp.

Here is the call graph for this function:


Member Function Documentation

DisplayTreeNode * DisplayTreeNode::addChild ( SgNode *  sgNode  )  [protected]

Definition at line 162 of file DisplayNode.cpp.

Here is the call graph for this function:

void DisplayTreeNode::addChild ( DisplayTreeNode c  ) 

Adds an existing DisplayTreeNode (and with it a subtree) to the tree (DisplayTreeNode takes ownership of c)

Definition at line 180 of file DisplayNode.cpp.

Here is the call graph for this function:

DisplayTreeNode * DisplayTreeNode::addChild ( const QString &  dispName  ) 

Inserts a child with a given displayName in the tree.

Definition at line 170 of file DisplayNode.cpp.

Referenced by addChild(), generateFullTree(), generateLeftBTree(), generateSmallInterleaving(), mergeTrees(), and DisplayTreeGenerator::visit().

Here is the call graph for this function:

Here is the caller graph for this function:

QRectF DisplayNode::boundingRect (  )  const [virtual, inherited]

Functions required by QGraphicsScene.

Definition at line 61 of file DisplayNode.cpp.

Referenced by DisplayEdge::adjust(), TreeLayoutGenerator::ExtremeInfo::merge(), DisplayNode::paint(), DisplayNode::shape(), and DisplayGraph::springBasedLayoutIteration().

Here is the caller graph for this function:

int DisplayTreeNode::childrenCount (  )  const [inline]

Definition at line 124 of file DisplayNode.h.

Referenced by TreeLayoutGenerator::advanceLeft(), TreeLayoutGenerator::advanceRight(), getFirstChild(), getLastChild(), TreeLayoutGenerator::layoutTraversal(), TreeLayoutGenerator::paintThreadTraversal(), TreeLayoutGenerator::posCalcTraversal(), setScene(), and simplifyTree().

Here is the caller graph for this function:

void DisplayTreeNode::deleteChildren ( int  from,
int  to 
)

Definition at line 312 of file DisplayNode.cpp.

Referenced by simplifyTree().

Here is the caller graph for this function:

virtual QColor DisplayNode::getBgColor (  )  const [inline, virtual, inherited]

Definition at line 42 of file DisplayNode.h.

virtual QColor DisplayNode::getBgColorSelected (  )  const [inline, virtual, inherited]

Definition at line 43 of file DisplayNode.h.

DisplayTreeNode * DisplayTreeNode::getChild ( int  i  ) 

Definition at line 193 of file DisplayNode.cpp.

Referenced by getFirstChild(), getLastChild(), TreeLayoutGenerator::layoutTraversal(), TreeLayoutGenerator::paintThreadTraversal(), TreeLayoutGenerator::posCalcTraversal(), setScene(), and simplifyTree().

Here is the caller graph for this function:

virtual const QString& DisplayNode::getDisplayName (  )  [inline, virtual, inherited]

Display Name is the String which is printed in the node.

Definition at line 34 of file DisplayNode.h.

DisplayTreeNode * DisplayTreeNode::getFirstChild (  ) 

Definition at line 202 of file DisplayNode.cpp.

Referenced by TreeLayoutGenerator::advanceRight().

Here is the call graph for this function:

Here is the caller graph for this function:

DisplayTreeNode * DisplayTreeNode::getLastChild (  ) 

Definition at line 208 of file DisplayNode.cpp.

Referenced by TreeLayoutGenerator::advanceLeft().

Here is the call graph for this function:

Here is the caller graph for this function:

DisplayTreeNode * DisplayTreeNode::getParent (  ) 

Definition at line 218 of file DisplayNode.cpp.

Referenced by TreeLayoutGenerator::calcSubtreeDistance(), and TreeLayoutGenerator::layoutTraversal().

Here is the call graph for this function:

Here is the caller graph for this function:

virtual SgNode* DisplayNode::getSgNode (  )  [inline, virtual, inherited]

Returns the Sage Node which corresponds to this DisplayNode.

Definition at line 47 of file DisplayNode.h.

Referenced by DisplayCallGraph::deleteNode(), RoseGraphicsView::mouseMoveEvent(), and RoseGraphicsView::mousePressEvent().

Here is the caller graph for this function:

void DisplayNode::init (  )  [protected, inherited]

Definition at line 31 of file DisplayNode.cpp.

Referenced by DisplayNode::DisplayNode().

Here is the call graph for this function:

Here is the caller graph for this function:

virtual bool DisplayNode::isMouseHold (  )  const [inline, virtual, inherited]

Definition at line 67 of file DisplayNode.h.

QVariant DisplayTreeNode::itemChange ( GraphicsItemChange  change,
const QVariant &  value 
) [protected, virtual]

Needed to listen on selection-changes node is drawn differently when selected)

Reimplemented from DisplayNode.

Definition at line 285 of file DisplayNode.cpp.

Here is the call graph for this function:

DisplayTreeNode * DisplayTreeNode::mergeTrees ( QGraphicsScene *  scene,
const QString &  name,
DisplayTreeNode n1,
DisplayTreeNode n2 
) [static]

Generates a new Tree out of two separate subtrees

Parameters:
scene the scene of the merged tree, the subtrees are moved to that scene
name displayName of the new root node
n1 left subtree
n2 right subtree

Definition at line 268 of file DisplayNode.cpp.

Here is the call graph for this function:

void DisplayNode::mousePressEvent ( QGraphicsSceneMouseEvent *  event  )  [protected, virtual, inherited]

Definition at line 125 of file DisplayNode.cpp.

void DisplayNode::mouseReleaseEvent ( QGraphicsSceneMouseEvent *  event  )  [protected, virtual, inherited]

Definition at line 131 of file DisplayNode.cpp.

void DisplayNode::paint ( QPainter *  painter,
const QStyleOptionGraphicsItem *  option,
QWidget *  widget 
) [virtual, inherited]

Custom Paint Event.

Definition at line 79 of file DisplayNode.cpp.

Here is the call graph for this function:

void DisplayTreeNode::registerAdditionalEdge ( DisplayEdge e  ) 

Additional edges for displaying can be added here takes ownership of the edge f.e. for debug purposes

Definition at line 231 of file DisplayNode.cpp.

Referenced by TreeLayoutGenerator::paintThreadTraversal().

Here is the caller graph for this function:

void DisplayNode::setBgColor ( const QColor &  c  )  [virtual, inherited]

Background color, when not selected.

Definition at line 48 of file DisplayNode.cpp.

Referenced by DisplayGraph::addGravityNode().

Here is the caller graph for this function:

void DisplayNode::setBgColorSelected ( const QColor &  c  )  [virtual, inherited]

Definition at line 54 of file DisplayNode.cpp.

virtual void DisplayNode::setDisplayName ( const QString &  n  )  [inline, virtual, inherited]

Definition at line 35 of file DisplayNode.h.

Referenced by addChild(), and mergeTrees().

Here is the caller graph for this function:

void DisplayTreeNode::setScene ( QGraphicsScene *  s  )  [virtual]

Overloaded to set recursively the scene in the children.

Reimplemented from DisplayNode.

Definition at line 239 of file DisplayNode.cpp.

Referenced by addChild(), mergeTrees(), setScene(), and AstGraphWidget::updateGraph().

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void DisplayNode::setSgNode ( SgNode *  sgNode  )  [inline, virtual, inherited]

Definition at line 48 of file DisplayNode.h.

Referenced by DisplayCallGraph::addCgNode(), and addChild().

Here is the caller graph for this function:

QPainterPath DisplayNode::shape (  )  const [virtual, inherited]

Definition at line 71 of file DisplayNode.cpp.

Here is the call graph for this function:

void DisplayTreeNode::simplifyTree ( DisplayTreeNode node  )  [static]

If n successing children have no subchildren and have same caption delete them, and create node with caption "n x oldcaption" useful f.e. in an Sage-AST when a lot nodes with the same caption appear after each other

Definition at line 330 of file DisplayNode.cpp.

Referenced by AstGraphWidget::updateGraph().

Here is the call graph for this function:

Here is the caller graph for this function:

virtual int DisplayNode::type (  )  const [inline, virtual, inherited]

Definition at line 53 of file DisplayNode.h.


Friends And Related Function Documentation

friend class DisplayTreeGenerator [friend]

Definition at line 116 of file DisplayNode.h.


Member Data Documentation

QList<DisplayEdge* > DisplayTreeNode::additionalEdges [protected]

Additional edges, difference to childEdges: target is not deleted when node is deleted each node deletes its outgoing additionalEdges

Definition at line 176 of file DisplayNode.h.

Referenced by itemChange(), registerAdditionalEdge(), setScene(), and ~DisplayTreeNode().

QColor DisplayNode::bgColor [protected, inherited]

Background color if node is not selected.

Definition at line 96 of file DisplayNode.h.

Referenced by DisplayNode::getBgColor(), DisplayNode::init(), DisplayNode::paint(), and DisplayNode::setBgColor().

QColor DisplayNode::bgColorSelected [protected, inherited]

Background color when node is selected.

Definition at line 98 of file DisplayNode.h.

Referenced by DisplayNode::getBgColorSelected(), DisplayNode::init(), DisplayNode::paint(), and DisplayNode::setBgColorSelected().

QString DisplayNode::caption [protected, inherited]

Text which is rendered inside of node.

Definition at line 86 of file DisplayNode.h.

Referenced by DisplayNode::boundingRect(), DisplayTreeGenerator::generateTree(), DisplayNode::paint(), and simplifyTree().

QList<DisplayEdge* > DisplayTreeNode::childEdges [protected]

Child Edges go from parent to child.

Definition at line 173 of file DisplayNode.h.

Referenced by addChild(), childrenCount(), deleteChildren(), getChild(), itemChange(), setScene(), and ~DisplayTreeNode().

bool DisplayNode::mouseHold [protected, inherited]

True when a mouse button is pressed over this node.

Definition at line 101 of file DisplayNode.h.

Referenced by DisplayNode::init(), DisplayNode::isMouseHold(), DisplayNode::mousePressEvent(), and DisplayNode::mouseReleaseEvent().

DisplayEdge* DisplayTreeNode::parentEdge [protected]

Source node of parentEdge is the parent, destination is this node.

Definition at line 179 of file DisplayNode.h.

Referenced by addChild(), DisplayTreeGenerator::generateTree(), getParent(), and itemChange().

QGraphicsScene* DisplayNode::scene [protected, inherited]

GraphicsScene where this node is rendered, or NULL if in no scene the scene takes ownership of nodes

Definition at line 83 of file DisplayNode.h.

Referenced by addChild(), DisplayGraphNode::addEdge(), DisplayGraphNode::addInEdge(), DisplayGraphNode::addOutEdge(), DisplayNode::init(), registerAdditionalEdge(), setScene(), DisplayNode::setScene(), and DisplayGraphNode::setScene().

SgNode* DisplayNode::sg [protected, inherited]

SgNode associated with this DisplayNode not used internally

Definition at line 90 of file DisplayNode.h.

Referenced by DisplayTreeGenerator::generateTree(), DisplayNode::getSgNode(), and DisplayNode::setSgNode().

QFont DisplayNode::textFont [protected, inherited]

The font used for drawing the caption.

Definition at line 93 of file DisplayNode.h.

Referenced by DisplayNode::boundingRect().


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