Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
OGDFFaceWrapper.h
Go to the documentation of this file.
1
31#pragma once
32
33#ifdef OGDF_INCLUDE_CGAL
34
37
38namespace ogdf {
39namespace internal {
40namespace gcm {
41namespace graph {
42
46class OGDFFaceWrapper {
47private:
48 using Node = node;
50 std::shared_ptr<CombinatorialEmbedding> m_ce;
51 std::vector<unsigned int> is_on_flag;
52 std::vector<Node> nodes; //TODO defince cyclic iterator?
53public:
54 OGDFFaceWrapper() : m_ce(new CombinatorialEmbedding()) { }
55
56 CombinatorialEmbedding& get_combinatorial_embedding() { return *m_ce; }
57
58 void set_face(adjEntry external_entry) {
60 }
61
62 void set_face(face _face) {
63 is_on_flag.assign(m_ce->getGraph().maxNodeIndex() + 1, false);
64 m_face = _face;
65 unsigned int c = 1;
66 nodes.clear();
67 for_all_nodes([&](const Node v) {
68 is_on_flag[v->index()] = c++;
69 nodes.push_back(v);
70 });
71 }
72
73 face ogdf_face() { return m_face; }
74
75 adjEntry first_adj() { return m_face->firstAdj(); }
76
77 std::vector<Node>::iterator begin() { return nodes.begin(); }
78
79 std::vector<Node>::const_iterator begin() const { return nodes.cbegin(); }
80
81 std::vector<Node>::iterator end() { return nodes.end(); }
82
83 std::vector<Node>::const_iterator end() const { return nodes.cend(); }
84
85 template<typename Handler>
86 void for_all_nodes(Handler&& handler) const {
87 adjEntry current = m_face->firstAdj();
88 do {
89 handler(current->theNode());
90 current = current->faceCycleSucc();
91 OGDF_ASSERT(current != nullptr);
92 } while (current != m_face->firstAdj());
93 }
94
95 bool has_on(Node v) const { return is_on_flag[v->index()]; }
96
97 unsigned int ordering_number(Node v) const { return is_on_flag[v->index()]; }
98
99 size_t number_of_nodes() const { return nodes.size(); }
100};
101
102}
103}
104}
105}
106
107#endif
Declaration of CombinatorialEmbedding and face.
AdjElement * adjEntry
The type of adjacency entries.
Definition Graph_d.h:72
NodeElement * node
The type of nodes.
Definition Graph_d.h:64
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
Definition basic.h:41
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
The namespace for all OGDF objects.
FaceElement * face