Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
OrthoShaper.h
Go to the documentation of this file.
1
34#pragma once
35
36#include <ogdf/basic/Graph.h>
37#include <ogdf/basic/basic.h>
38
39namespace ogdf {
40class CombinatorialEmbedding;
41class OrthoRep;
42class PlanRep;
43class PlanRepUML;
44
46public:
48 enum class NetworkNodeType { low, high, inner, outer };
49
50 OrthoShaper() { setDefaultSettings(); }
51
53
54 // Given a planar representation for a UML graph and its planar
55 // combinatorial embedding, call() produces an orthogonal
56 // representation using Tamassias bend minimization algorithm
57 // with a flow network where every flow unit defines 90 degree angle
58 // in traditional mode.
59
60 void call(PlanRepUML& PG, CombinatorialEmbedding& E, OrthoRep& OR, bool fourPlanar = true);
61
62 void call(PlanRep& PG, CombinatorialEmbedding& E, OrthoRep& OR, bool fourPlanar = true);
63
64 //sets the default settings used in the standard constructor
66 m_distributeEdges = true; // true; //try to distribute edges to all node sides
67 m_fourPlanar = true; //do not allow zero degree angles at high degree
68 m_allowLowZero = false; //do allow zero degree at low degree nodes
69 m_multiAlign = true; //true; //start/end side of multi edges match
70 m_traditional = true; //true; //prefer 3/1 flow at degree 2 (false: 2/2)
71 m_deg4free = false; //allow free angle assignment at degree four
72 m_align = false; //align nodes on same hierarchy level
73 m_startBoundBendsPerEdge = 0; //don't use bound on bend number per edge
74 }
75
76 // returns option distributeEdges
77 bool distributeEdges() { return m_distributeEdges; }
78
79 // sets option distributeEdges to b
80 void distributeEdges(bool b) { m_distributeEdges = b; }
81
82 // returns option multiAlign
83 bool multiAlign() { return m_multiAlign; }
84
85 // sets option multiAlign to b
86 void multiAlign(bool b) { m_multiAlign = b; }
87
88 // returns option traditional
89 bool traditional() { return m_traditional; }
90
91 // sets option traditional to b
92 void traditional(bool b) { m_traditional = b; }
93
94 //returns option deg4free
95 bool fixDegreeFourAngles() { return m_deg4free; }
96
97 //sets option deg4free
98 void fixDegreeFourAngles(bool b) { m_deg4free = b; }
99
100 //alignment of brothers in hierarchies
101 void align(bool al) { m_align = al; }
102
103 bool align() { return m_align; }
104
107 void setBendBound(int i) {
108 OGDF_ASSERT(i >= 0);
109 m_startBoundBendsPerEdge = i;
110 }
111
112 int getBendBound() { return m_startBoundBendsPerEdge; }
113
114private:
117
121
125
128
131
140
143
158
161 void setAngleBound(edge netArc, int angle, EdgeArray<int>& lowB, EdgeArray<int>& upB,
162 EdgeArray<edge>& aTwin, bool maxBound = true) {
163 // preliminary
164 OGDF_ASSERT(!m_traditional);
165
166 const int angleId = angle / 90;
167 const edge e2 = aTwin[netArc];
168
169 OGDF_ASSERT(angleId >= 0);
170 OGDF_ASSERT(angleId <= 2);
171
172 if (maxBound) {
173 lowB[netArc] = 2 - angleId;
174 upB[netArc] = 2;
175
176 if (e2) {
177 upB[e2] = lowB[e2] = 0;
178 }
179 } else {
180 upB[netArc] = 2 - angleId;
181 lowB[netArc] = 0;
182
183 if (e2) {
184 upB[e2] = 2;
185 lowB[e2] = 0;
186 }
187 }
188 }
189};
190
191}
Includes declaration of graph class.
Basic declarations, included by all source files.
Combinatorial embeddings of planar graphs with modification functionality.
Class for the representation of edges.
Definition Graph_d.h:364
Orthogonal representation of an embedded graph.
Definition OrthoRep.h:225
bool m_allowLowZero
allow low degree nodes zero degree (to low for zero...)
void setAngleBound(edge netArc, int angle, EdgeArray< int > &lowB, EdgeArray< int > &upB, EdgeArray< edge > &aTwin, bool maxBound=true)
Set angle boundary. Warning: sets upper AND lower bounds, therefore may interfere with existing bound...
void call(PlanRep &PG, CombinatorialEmbedding &E, OrthoRep &OR, bool fourPlanar=true)
bool m_align
Try to achieve an alignment in hierarchy levels.
void setBendBound(int i)
Set bound for number of bends per edge (none if set to 0). If shape flow computation is unsuccessful,...
bool fixDegreeFourAngles()
Definition OrthoShaper.h:95
void call(PlanRepUML &PG, CombinatorialEmbedding &E, OrthoRep &OR, bool fourPlanar=true)
bool m_deg4free
allow degree four nodes free angle assignment
int m_startBoundBendsPerEdge
Bound on the number of bends per edge for flow.
bool m_fourPlanar
should the input graph be four planar (no zero degree)
void fixDegreeFourAngles(bool b)
Definition OrthoShaper.h:98
NetworkNodeType
Types of network nodes: nodes and faces.
Definition OrthoShaper.h:48
void traditional(bool b)
Definition OrthoShaper.h:92
void align(bool al)
bool m_multiAlign
multi edges aligned on the same side
void distributeEdges(bool b)
Definition OrthoShaper.h:80
void setDefaultSettings()
Definition OrthoShaper.h:65
bool m_traditional
Do not prefer 180-degree angles.
void multiAlign(bool b)
Definition OrthoShaper.h:86
bool m_distributeEdges
distribute edges among all sides if degree > 4
Planarized representations (of a connected component) of a graph.
Definition PlanRep.h:68
Planarized representation (of a connected component) of a UMLGraph; allows special handling of hierar...
Definition PlanRepUML.h:55
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
Definition Graph_d.h:717
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF dynamic library (shared object / DLL),...
Definition config.h:117
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
Definition basic.h:52
The namespace for all OGDF objects.