Graph Class Reference

this class acts as a container for nodes and edges. this class has all the edges and nodes, plus a few extra funcionalities to help programming with it on the programming backend. More...

#include <graph.h>

Inheritance diagram for Graph:
QObject

List of all members.

Public Slots

void setName (const QString &s)
const QString & name () const
void setDirected (bool directed=true)
bool directed () const
NodeList nodes () const
EdgeList edges () const
Nodebegin () const
bool setBegin (Node *b)
NodeaddNode (QString name)
EdgeaddEdge (Node *from, Node *to, QGraphicsSvgItem *cFrom, QGraphicsSvgItem *cTo)
Nodenode (const QString &name=i18n("Untitled"))
void remove (Node *n)
void remove (Edge *e)
NodeaddEnd (Node *n)
 add a new node to the 'end' list. end list is an QList that will hold every node as a final value. n the node to be added.
void removeEnd (Node *n)
void setNodeDefaultColor (const QString &color)
const QString & nodeDefaultColor () const
void setEdgeDefaultColor (const QString &color)
const QString & edgeDefaultColor () const
void setAutomate (bool b)
bool automate ()
void addDynamicProperty (QString property, QVariant value=QVariant(0))
void removeDynamicProperty (QString property)
void addNodesDynamicProperty (QString property, QVariant value=QVariant(0))
void addEdgesDynamicProperty (QString property, QVariant value=QVariant(0))
void removeNodesDynamicProperty (QString property)
void removeEdgesDynamicProperty (QString property)
void addNode (QString name, QPointF point)
void addNode (QString name, QPointF point, QString type)
void addNode (QString name, QString type)
void setNodesColor (QString c)
void setEdgesColor (QString c)
void setNodeNameVisibility (bool b)
bool nodeNameVisibility ()
void setEdgeNameVisibility (bool b)
bool edgeNameVisibility ()
void setNodeValueVisibility (bool b)
bool nodeValueVisibility ()
void setEdgeValueVisibility (bool b)
bool edgeValueVisibility ()
void remove ()

Signals

void nodeCreated (Node *n)
void edgeCreated (Edge *e)
void complexityChanged (bool directed)
void changed ()
void orientedChanged (bool b)
void automateChanged (bool b)
void iAmDisappoint ()
void forceUpdate ()

Public Member Functions

 Graph (GraphDocument *parent=0)
 ~Graph ()
void calcRelativeCenter ()
QPointF relativeCenter () const
GraphDocumentdocument () const
void readOnly (bool r)
bool readOnly () const
void setKCB (KComboBox *list)

Properties

bool directed
QString name
QString nodeDefaultColor
QString edgeDefaultColor
bool automate

Detailed Description

this class acts as a container for nodes and edges. this class has all the edges and nodes, plus a few extra funcionalities to help programming with it on the programming backend.

Definition at line 38 of file graph.h.


Constructor & Destructor Documentation

Graph::Graph ( GraphDocument parent = 0  ) 

constructo parent the parent QObject

Definition at line 35 of file graph.cpp.

Graph::~Graph (  ) 

destructor

Definition at line 52 of file graph.cpp.


Member Function Documentation

void Graph::addDynamicProperty ( QString  property,
QVariant  value = QVariant( 0 ) 
) [slot]

Add a property to this graph.

Parameters:
property Name of property
Parameters:
value Value of the property. value shoud be different of QVariant::Invalid.

Definition at line 571 of file graph.cpp.

Edge * Graph::addEdge ( Node from,
Node to,
QGraphicsSvgItem *  cFrom,
QGraphicsSvgItem *  cTo 
) [slot]

creates a new edge from the 'from' node. to the 'to' node. cFrom the from connector cTo the to connector

Returns:
the newly created edge.

Definition at line 214 of file graph.cpp.

void Graph::addEdgesDynamicProperty ( QString  property,
QVariant  value = QVariant( 0 ) 
) [slot]

remove a property to all nodes in this graph.

Parameters:
property Name of property

Definition at line 594 of file graph.cpp.

Node * Graph::addEnd ( Node n  )  [slot]

add a new node to the 'end' list. end list is an QList that will hold every node as a final value. n the node to be added.

Returns:
the recently added node.

Definition at line 530 of file graph.cpp.

void Graph::addNode ( QString  name,
QString  type 
) [slot]

adds a node of type into graph

Parameters:
name the name of the node,
Parameters:
type the type of node created.

Definition at line 127 of file graph.cpp.

void Graph::addNode ( QString  name,
QPointF  point,
QString  type 
) [slot]

adds a node of type into graph

Parameters:
name the name of the node,
Parameters:
point the point in the eculidian space where this node is,
Parameters:
type the type of node created.

Definition at line 170 of file graph.cpp.

void Graph::addNode ( QString  name,
QPointF  point 
) [slot]

adds a node in this graph.

Parameters:
name the name of the node,
Parameters:
point the point in the euclidian space where this node is.

Definition at line 121 of file graph.cpp.

Node * Graph::addNode ( QString  name  )  [slot]

creates a new node. name the name of the node.

Returns:
the newly created node.

Definition at line 109 of file graph.cpp.

void Graph::addNodesDynamicProperty ( QString  property,
QVariant  value = QVariant( 0 ) 
) [slot]

Add a property to all nodes in this graph. If a new node is add later, the node will not containg this property.

Parameters:
property Name of property
Parameters:
value Value of the property. value shoud be different of QVariant::Invalid.

Definition at line 586 of file graph.cpp.

bool Graph::automate (  )  [slot]

boolean that represents if the graph is an automate or not

Returns:
true = automate, false = graph.
void Graph::automateChanged ( bool  b  )  [signal]
Node * Graph::begin (  )  const [slot]

get the node marked as 'begin'

Returns:
the 'begin' node. (node.begin == true), NULL if there isn't a begin node.

Definition at line 525 of file graph.cpp.

void Graph::calcRelativeCenter (  ) 

calculates the relative center of the graph, taking into account the top, bottom, left and right edges.

this will be here till I find a better way to calculate a *relative* center of the graph, and not the center of the document.

Definition at line 459 of file graph.cpp.

void Graph::changed (  )  [signal]
void Graph::complexityChanged ( bool  directed  )  [signal]
bool Graph::directed (  )  const [slot]

gets if the node is diirected of simple.

Returns:
true if directed, false if simple. FIXME: change that to enum.
GraphDocument * Graph::document (  )  const

gets the document that holds this graph.

Returns:
the GraphDocument

Definition at line 65 of file graph.cpp.

void Graph::edgeCreated ( Edge e  )  [signal]
const QString& Graph::edgeDefaultColor (  )  const [slot]

gets the default edge color for this graph

Returns:
a QColor
bool Graph::edgeNameVisibility (  )  [slot]

Definition at line 640 of file graph.cpp.

QList< Edge * > Graph::edges (  )  const [slot]

all edges are accessible from that method.

Returns:
the QList containing all the edges.

Definition at line 81 of file graph.cpp.

bool Graph::edgeValueVisibility (  )  [slot]

Definition at line 667 of file graph.cpp.

void Graph::forceUpdate (  )  [signal]
void Graph::iAmDisappoint (  )  [signal]
const QString& Graph::name (  )  const [slot]

gets the name of the graph.

Returns:
the name of the graph
Node * Graph::node ( const QString &  name = i18n( "Untitled" )  )  [slot]

creates a new edge name_from the name of the node that will be used as 'from' name_to the name of the node that will be used as 'to'

Returns:
the newly created edge.
returns a node name the name of the node to be returned.
Returns:
a node, or null if an invalid name is provided.

Definition at line 400 of file graph.cpp.

void Graph::nodeCreated ( Node n  )  [signal]
const QString& Graph::nodeDefaultColor (  )  const [slot]

gets the default node color for this graph.

Returns:
a QColor.
bool Graph::nodeNameVisibility (  )  [slot]

Definition at line 626 of file graph.cpp.

QList< Node * > Graph::nodes (  )  const [slot]

all nodes are accessible from that method.

Returns:
the QList containing all the nodes.

Definition at line 76 of file graph.cpp.

bool Graph::nodeValueVisibility (  )  [slot]

Definition at line 653 of file graph.cpp.

void Graph::orientedChanged ( bool  b  )  [signal]
bool Graph::readOnly (  )  const [inline]

Definition at line 84 of file graph.h.

void Graph::readOnly ( bool  r  )  [inline]

Definition at line 80 of file graph.h.

QPointF Graph::relativeCenter (  )  const

gets the precalculated relative center.

Returns:
the center of the graph.

Definition at line 488 of file graph.cpp.

void Graph::remove (  )  [slot]

remove this graph from the document.

Definition at line 70 of file graph.cpp.

void Graph::remove ( Edge e  )  [slot]

removes an edge e the edge to be removed.

Definition at line 421 of file graph.cpp.

void Graph::remove ( Node n  )  [slot]

removes a node. n the node to be removed.

Definition at line 414 of file graph.cpp.

void Graph::removeDynamicProperty ( QString  property  )  [slot]

remove a property from this graph.

Parameters:
property Name of property

Definition at line 580 of file graph.cpp.

void Graph::removeEdgesDynamicProperty ( QString  property  )  [slot]

remove a property to all edges in this graph.

Parameters:
property Name of property

Definition at line 609 of file graph.cpp.

void Graph::removeEnd ( Node n  )  [slot]

remove a node from the end's list. n the node to be removed from the list.

Definition at line 536 of file graph.cpp.

void Graph::removeNodesDynamicProperty ( QString  property  )  [slot]

Add a property to all Edges in this graph. If a new edge is add later, the edge will not containg this property.

Parameters:
property Name of property
Parameters:
value Value of the property. value shoud be different of QVariant::Invalid.

Definition at line 602 of file graph.cpp.

void Graph::setAutomate ( bool  b  )  [slot]

sets this graph an automate

Parameters:
b true = automate, false = graph.

Definition at line 561 of file graph.cpp.

bool Graph::setBegin ( Node b  )  [slot]

sets a node as begin.

Parameters:
b the new begin of the graph.

Definition at line 502 of file graph.cpp.

void Graph::setDirected ( bool  directed = true  )  [slot]

sets if the graph is directed or simple node

Parameters:
directed true directed, false simple. FIXME: change that to enum.

Definition at line 428 of file graph.cpp.

void Graph::setEdgeDefaultColor ( const QString &  color  )  [slot]

sets the default color for new added edges. color the new color.http://imagebin.ca/view/VoxkFg.html

Definition at line 552 of file graph.cpp.

void Graph::setEdgeNameVisibility ( bool  b  )  [slot]

Definition at line 631 of file graph.cpp.

void Graph::setEdgesColor ( QString  c  )  [slot]

sets all edges for this color

Parameters:
color the color that each edge will have.

Definition at line 95 of file graph.cpp.

void Graph::setEdgeValueVisibility ( bool  b  )  [slot]

Definition at line 658 of file graph.cpp.

void Graph::setKCB ( KComboBox *  list  ) 

Definition at line 104 of file graph.cpp.

void Graph::setName ( const QString &  s  )  [slot]

sets the name of the graph. s the new name of the graph.

Definition at line 497 of file graph.cpp.

void Graph::setNodeDefaultColor ( const QString &  color  )  [slot]

sets the default color for new added nodes. color the new color.

Definition at line 541 of file graph.cpp.

void Graph::setNodeNameVisibility ( bool  b  )  [slot]

puts sets the visitbility of the names in the nodes.

Parameters:
b true if visible false invisible

Definition at line 617 of file graph.cpp.

void Graph::setNodesColor ( QString  c  )  [slot]

sets all nodes for this color.

Parameters:
color the color that each node will have.

Definition at line 86 of file graph.cpp.

void Graph::setNodeValueVisibility ( bool  b  )  [slot]

Definition at line 645 of file graph.cpp.


Property Documentation

bool Graph::automate [read, write]

this property tells the system if this graph is to be treated as an automate

Definition at line 55 of file graph.h.

bool Graph::directed [read, write]

this property defines if the graph is directed or simple

Definition at line 43 of file graph.h.

const QString & Graph::edgeDefaultColor [read, write]

this property holds the default color for new nodes

Definition at line 52 of file graph.h.

const QString & Graph::name [read, write]

this property holds the name of the graph

Definition at line 46 of file graph.h.

const QString & Graph::nodeDefaultColor [read, write]

this property holds the default color for new nodes

Definition at line 49 of file graph.h.


The documentation for this class was generated from the following files:
Generated on Mon Dec 27 13:13:41 2010 for Gluon by  doxygen 1.6.3