Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

PlanRepInc.h
Go to the documentation of this file.
1 
37 #pragma once
38 
39 #include <ogdf/basic/Array2D.h>
40 #include <ogdf/basic/Graph.h>
41 #include <ogdf/basic/basic.h>
42 #include <ogdf/uml/PlanRepUML.h>
43 #include <ogdf/uml/UMLGraph.h>
44 
45 #include <fstream>
46 
47 namespace ogdf {
48 class CombinatorialEmbedding;
49 class GraphAttributes;
50 class GraphCopy;
51 class Layout;
52 template<class E>
53 class List;
54 
62 public:
64  explicit PlanRepInc(const UMLGraph& UG);
65 
68  PlanRepInc(const UMLGraph& UG, const NodeArray<bool>& fixed);
69 
71  void initActiveCC(int i);
74  node initMinActiveCC(int i);
75 
79  virtual void nodeDeleted(node v) override;
80  virtual void nodeAdded(node v) override;
81  virtual void edgeDeleted(edge e) override;
82  virtual void edgeAdded(edge e) override;
83  virtual void cleared() override; //Graph cleared
85 
88  void activateNode(node v);
89 
91  void activateEdge(edge e);
92 
93  // TODO: deactivate, too
94 
100  bool makeTreeConnected(adjEntry adjExternal);
101 
104  void deleteTreeConnection(int i, int j);
105  void deleteTreeConnection(int i, int j, CombinatorialEmbedding& E);
107 
110  void getExtAdjs(List<adjEntry>& extAdjs);
111  adjEntry getExtAdj(GraphCopy& GC, CombinatorialEmbedding& E);
112 
114  int& componentNumber(node v) { return m_component[v]; }
115 
116  bool& treeEdge(edge e) { return m_treeEdge[e]; }
117 
118  //only valid if m_eTreeArray initialized, should be replaced later
119  edge treeEdge(int i, int j) const {
120  if (m_treeInit) {
121  return m_eTreeArray(i, j);
122  }
123  return nullptr;
124  }
125 
126  bool treeInit() { return m_treeInit; }
127 
130 
133  virtual edge split(edge e) override {
134  edge eNew = PlanRepUML::split(e);
135  if (m_treeEdge[e]) {
136  m_treeEdge[eNew] = true;
137  }
138 
139  return eNew;
140  }
141 
142  //debug output
143 #ifdef OGDF_DEBUG
144  void writeGML(const char* fileName) {
145  const GraphAttributes& AG = getUMLGraph();
146  std::ofstream os(fileName);
147  writeGML(os, AG); //getUMLGraph());//l);
148  }
149 
150  void writeGML(const char* fileName, const Layout& drawing) {
151  std::ofstream os(fileName);
152  writeGML(os, drawing);
153  }
154 
155  void writeGML(std::ostream& os, const GraphAttributes& AG);
156  void writeGML(std::ostream& os, const Layout& drawing, bool colorEmbed = true);
157 
158  //outputs a drawing if genus != 0
159  int genusLayout(Layout& drawing) const;
160 #endif
161 
163 
164 protected:
165  void initMembers(const UMLGraph& UG);
166 
168  node initActiveCCGen(int i, bool minNode);
169 
170 private:
175  bool m_treeInit;
176 };
177 
178 }
ogdf::PlanRepInc::m_eTreeArray
Array2D< edge > m_eTreeArray
used for treeConnection
Definition: PlanRepInc.h:174
ogdf
The namespace for all OGDF objects.
Definition: multilevelmixer.cpp:39
ogdf::GraphAttributes
Stores additional attributes of a graph (like layout information).
Definition: GraphAttributes.h:72
ogdf::PlanRepInc::treeEdge
edge treeEdge(int i, int j) const
Definition: PlanRepInc.h:119
Graph.h
Includes declaration of graph class.
ogdf::PlanRepInc::writeGML
void writeGML(const char *fileName)
Definition: PlanRepInc.h:144
ogdf::PlanRepUML
Planarized representation (of a connected component) of a UMLGraph; allows special handling of hierar...
Definition: PlanRepUML.h:55
PlanRepUML.h
Declaration of class PlanRepUML.
ogdf::PlanRepInc::split
virtual edge split(edge e) override
Splits edge e, can be removed when edge status in edgetype m_treedge can be removed afterwards.
Definition: PlanRepInc.h:133
UMLGraph.h
Declaration of class UMLGraph.
ogdf::GraphCopy
Copies of graphs supporting edge splitting.
Definition: GraphCopy.h:391
ogdf::Array2D
The parameterized class Array2D implements dynamic two-dimensional arrays.
Definition: Array2D.h:53
ogdf::PlanRepInc::m_treeInit
bool m_treeInit
check if the tree edge Array2D was initialized
Definition: PlanRepInc.h:175
ogdf::AdjElement
Class for adjacency list elements.
Definition: Graph_d.h:142
ogdf::PlanRepInc::treeEdge
bool & treeEdge(edge e)
Definition: PlanRepInc.h:116
ogdf::Layout
Stores a layout of a graph (coordinates of nodes, bend points of edges).
Definition: Layout.h:49
ogdf::GraphObserver
Abstract Base class for graph observers.
Definition: Graph_d.h:777
ogdf::List
Doubly linked lists (maintaining the length of the list).
Definition: DfsMakeBiconnected.h:40
ogdf::internal::GraphRegisteredArray
RegisteredArray for nodes, edges and adjEntries of a graph.
Definition: Graph_d.h:658
ogdf::PlanRepUML::split
virtual edge split(edge e) override
Splits edge e.
Definition: PlanRepUML.h:126
ogdf::PlanRepInc::componentNumber
int & componentNumber(node v)
Component number.
Definition: PlanRepInc.h:114
ogdf::PlanRepInc
This class is only an adaption of PlanRep for the special incremental drawing case.
Definition: PlanRepInc.h:61
ogdf::UMLGraph
Definition: UMLGraph.h:48
ogdf::PlanRepInc::m_treeEdge
EdgeArray< bool > m_treeEdge
edge inserted for connnectivity
Definition: PlanRepInc.h:172
basic.h
Basic declarations, included by all source files.
OGDF_EXPORT
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:101
ogdf::CombinatorialEmbedding
Combinatorial embeddings of planar graphs with modification functionality.
Definition: CombinatorialEmbedding.h:406
ogdf::PlanRepInc::m_component
NodeArray< int > m_component
number of partial component in current CC used for treeConnection
Definition: PlanRepInc.h:173
ogdf::EdgeElement
Class for the representation of edges.
Definition: Graph_d.h:363
ogdf::PlanRepInc::treeInit
bool treeInit()
Definition: PlanRepInc.h:126
ogdf::PlanRepInc::writeGML
void writeGML(const char *fileName, const Layout &drawing)
Definition: PlanRepInc.h:150
Array2D.h
Declaration and implementation of class Array2D which implements dynamic two dimensional arrays.
ogdf::NodeElement
Class for the representation of nodes.
Definition: Graph_d.h:240
ogdf::PlanRepInc::m_activeNodes
NodeArray< bool > m_activeNodes
stores the status of the nodes
Definition: PlanRepInc.h:171
ogdf::internal::EdgeArrayBase2
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
Definition: Graph_d.h:716