Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
TopologyModule.h
Go to the documentation of this file.
1
36#pragma once
37
39#include <ogdf/basic/Graph.h>
40#include <ogdf/basic/List.h>
41#include <ogdf/basic/basic.h>
42#include <ogdf/basic/geometry.h>
43
44namespace ogdf {
45class GraphAttributes;
46class PlanRep;
47
48namespace topology_module {
49
51
56class EdgeLeg {
57public:
58 EdgeLeg() : m_xp(0.0, 0.0), m_topDown(false), m_copyEdge(nullptr), m_number(0) { }
59
61 : m_xp(DPoint(0.0, 0.0))
62 , m_topDown(false)
63 , m_copyEdge(e)
64 , m_p1(p1)
65 , m_p2(p2)
66 , m_number(number) { }
67
68 DPoint& start() { return m_p1; }
69
70 DPoint& end() { return m_p2; }
71
72 int& number() { return m_number; }
73
74 edge& copyEdge() { return m_copyEdge; }
75
83
87
88private:
92};
93
94}
95
97
106public:
108
112 enum class Options {
114 DegOneCrossings = 0x0001,
116 GenToAss = 0x0002,
119 CrossFlip = 0x0004,
121 FlipUML = 0x0010,
124 Loop = 0x0008,
125 };
126
127private:
128 friend int operator|(int, TopologyModule::Options);
130
131public:
133 : m_options(Options::DegOneCrossings | Options::GenToAss | Options::CrossFlip
134 | Options::Loop | Options::FlipUML) { }
135
136 virtual ~TopologyModule() { }
137
138 void setOptions(int i) { m_options = i; }
139
140 void addOption(TopologyModule::Options o) { m_options = m_options | o; }
141
143
159 bool setExternal = true, bool reuseGAEmbedding = false);
160
162
169
171
172 double faceSum(PlanRep& PG, const GraphAttributes& AG, face f);
173
174protected:
175 //compute a planarization, i.e. insert crossing vertices,
176 //corresponding to the AG layout
178 //compute crossing point and return if existing
180 //check if node v is a crossing of two edges with a common
181 //endpoint adjacent to v, crossing is removed if flip is set
182 bool checkFlipCrossing(PlanRep& PG, node v, bool flip = true);
183
187
188private:
189 //compare vectors for sorting
190 int compare_vectors(const double& x1, const double& y1, const double& x2, const double& y2);
191 //compute and return the angle defined by p-q,p-r
192 double angle(DPoint p, DPoint q, DPoint r);
193 //we have to save the position of the inserted crossing vertices
194 //in order to compute the external face
196
197 //we save a list of EdgeLegs for all original edges in
198 //AG
200
201 //option settings as bits
203};
204
205inline int operator&(int i, TopologyModule::Options b) { return i & static_cast<int>(b); }
206
208 return static_cast<int>(a) | static_cast<int>(b);
209}
210
211inline int operator|(int i, TopologyModule::Options b) { return i | static_cast<int>(b); }
212
213}
Declaration of CombinatorialEmbedding and face.
Includes declaration of graph class.
Declaration of doubly linked lists and iterators.
Declaration of classes GenericPoint, GenericPolyline, GenericLine, GenericSegment,...
Basic declarations, included by all source files.
Class for adjacency list elements.
Definition Graph_d.h:143
Class for the representation of edges.
Definition Graph_d.h:364
Faces in a combinatorial embedding.
Stores additional attributes of a graph (like layout information).
Data type for general directed graphs (adjacency list representation).
Definition Graph_d.h:866
Encapsulates a pointer to a list element.
Definition List.h:113
Class for the representation of nodes.
Definition Graph_d.h:241
Planarized representations (of a connected component) of a graph.
Definition PlanRep.h:68
Constructs embeddings from given layout.
bool skipable(topology_module::EdgeLeg *legA, topology_module::EdgeLeg *legB)
void addOption(TopologyModule::Options o)
Options
The (pre/post)processing options.
double faceSum(PlanRep &PG, const GraphAttributes &AG, face f)
bool checkFlipCrossing(PlanRep &PG, node v, bool flip=true)
double angle(DPoint p, DPoint q, DPoint r)
face getExternalFace(PlanRep &PG, const GraphAttributes &AG)
bool setEmbeddingFromGraph(PlanRep &PG, GraphAttributes &GA, adjEntry &adjExternal, bool setExternal=true, bool reuseGAEmbedding=false)
Uses the layout GA to determine an embedding for PG.
void sortEdgesFromLayout(Graph &G, GraphAttributes &GA)
Sorts the edges around all nodes of GA corresponding to the layout given in GA.
void postProcess(PlanRep &PG)
void planarizeFromLayout(PlanRep &PG, GraphAttributes &AG)
void handleImprecision(PlanRep &PG)
EdgeArray< List< topology_module::EdgeLeg * > > m_eLegs
int compare_vectors(const double &x1, const double &y1, const double &x2, const double &y2)
NodeArray< DPoint > m_crossPosition
bool hasCrossing(topology_module::EdgeLeg *legA, topology_module::EdgeLeg *legB, DPoint &xp)
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
Definition Graph_d.h:717
RegisteredArray for nodes, edges and adjEntries of a graph.
Definition Graph_d.h:659
Helper class for the computation of crossings.
ListIterator< EdgeLeg * > m_eIterator
each edgeLeg holds an entry with a ListIterator pointing to its entry in a <edgeLeg*> List for an ori...
EdgeLeg(edge e, int number, DPoint p1, DPoint p2)
int m_number
the order nuumber on the edge, starting at 0
edge m_copyEdge
the edge in the PlanRep copy corresponding to the EdgeLeg
DPoint m_p2
"Starting" and "End" point of the EdgeLeg
bool m_topDown
we store the direction of the crossed EdgeLeg, too if crossingEdgeLeg is horizontally left to right
DPoint m_xp
to avoid sorting both edgelegs and crossing points, do not store a pair of them, but allow the xp to ...
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF dynamic library (shared object / DLL),...
Definition config.h:117
The namespace for all OGDF objects.
int operator|(int lhs, UMLOpt rhs)
Definition OrthoRep.h:61
int operator&(int lhs, UMLOpt rhs)
Definition OrthoRep.h:65