21 #ifndef TULIP_SUPERGRAPHABSTRACT_H 22 #define TULIP_SUPERGRAPHABSTRACT_H 26 #include <tulip/Graph.h> 27 #include <tulip/DataSet.h> 31 #define GRAPH_SEQ std::vector<Graph *> 34 class PropertyManager;
38 class TLP_SCOPE GraphAbstract:
public Graph {
39 friend class PropertyManager;
44 Graph* subGraphToKeep;
46 GraphProperty* metaGraphProperty;
48 GraphAbstract(Graph *supergraph,
unsigned int id = 0);
50 virtual ~GraphAbstract();
53 Graph* addSubGraph(
unsigned int id, BooleanProperty *selection=NULL,
54 const std::string& name =
"unnamed");
55 virtual Graph *addSubGraph(BooleanProperty *selection=NULL,
56 const std::string& name =
"unnamed") {
57 return addSubGraph(0, selection, name);
59 virtual void delSubGraph(Graph *);
60 virtual void delAllSubGraphs(Graph *);
61 inline Graph* getSuperGraph()
const {
64 inline Graph* getRoot()
const {
68 virtual bool isSubGraph(
const Graph* sg)
const;
69 virtual bool isDescendantGraph(
const Graph* sg)
const;
70 virtual Graph* getSubGraph(
unsigned int id)
const;
71 virtual Graph* getSubGraph(
const std::string& name)
const;
72 virtual Graph* getDescendantGraph(
unsigned int id)
const;
73 virtual Graph* getDescendantGraph(
const std::string &name)
const;
74 virtual Graph *getNthSubGraph(
unsigned int n)
const;
75 inline unsigned int numberOfSubGraphs()
const {
76 return subgraphs.size();
78 virtual unsigned int numberOfDescendantGraphs()
const;
81 virtual bool isMetaNode(
const node)
const;
82 virtual Graph* getNodeMetaInfo(
const node)
const;
83 virtual void delNodes(
Iterator<node>* itN,
bool deleteInAllGraphs);
84 virtual bool isMetaEdge(
const edge)
const;
86 virtual void delEdges(
Iterator<edge>* itE,
bool deleteInAllGraphs =
false);
88 virtual node getOneNode()
const;
89 virtual node getRandomNode()
const;
90 virtual node getInNode(
const node,
unsigned int )
const;
91 virtual node getOutNode(
const node,
unsigned int )
const;
92 virtual edge getOneEdge()
const;
93 virtual edge getRandomEdge()
const;
95 bool existProperty(
const std::string&)
const;
96 bool existLocalProperty(
const std::string&)
const;
97 void delLocalProperty(
const std::string&);
98 void addLocalProperty(
const std::string &name, PropertyInterface *prop);
105 PropertyInterface* getProperty(
const std::string &)
const;
108 GraphProperty* getMetaGraphProperty();
110 virtual void setName(
const std::string &name);
111 virtual std::string getName()
const;
117 DataSet& getNonConstAttributes() {
120 void setSuperGraph(Graph *);
121 PropertyManager *propertyContainer;
122 const std::set<edge>& getReferencedEdges(
const edge)
const;
124 virtual bool renameLocalProperty(PropertyInterface *prop,
125 const std::string& newName);
128 virtual void clearSubGraphs();
129 virtual void removeSubGraph(Graph*);
130 virtual void restoreSubGraph(Graph*);
131 virtual void setSubGraphToKeep(Graph*);
135 void notifyBeforeAddInheritedProperty(
const std::string& prop);
136 void notifyAddInheritedProperty(
const std::string& prop);
137 void notifyBeforeDelInheritedProperty(
const std::string& prop);
138 void notifyAfterDelInheritedProperty(
const std::string& prop);
140 void notifyBeforeRenameLocalProperty(PropertyInterface* prop,
141 const std::string& newName);
142 void notifyAfterRenameLocalProperty(PropertyInterface* prop,
143 const std::string& oldName);
Interface for Tulip iterators. Allows basic iteration operations only.