Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

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 
39 namespace ogdf {
40 class CombinatorialEmbedding;
41 class OrthoRep;
42 class PlanRep;
43 class PlanRepUML;
44 
46 public:
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 
114 private:
117 
121 
125 
128 
131 
140 
142  bool m_align;
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 }
ogdf
The namespace for all OGDF objects.
Definition: multilevelmixer.cpp:39
ogdf::OrthoShaper::~OrthoShaper
~OrthoShaper()
Definition: OrthoShaper.h:52
Graph.h
Includes declaration of graph class.
ogdf::PlanRep
Planarized representations (of a connected component) of a graph.
Definition: PlanRep.h:69
ogdf::OrthoShaper::m_traditional
bool m_traditional
Do not prefer 180-degree angles.
Definition: OrthoShaper.h:139
OGDF_ASSERT
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
Definition: basic.h:66
ogdf::OrthoShaper
Definition: OrthoShaper.h:45
ogdf::PlanRepUML
Planarized representation (of a connected component) of a UMLGraph; allows special handling of hierar...
Definition: PlanRepUML.h:55
ogdf::OrthoShaper::multiAlign
void multiAlign(bool b)
Definition: OrthoShaper.h:86
ogdf::OrthoShaper::m_deg4free
bool m_deg4free
allow degree four nodes free angle assignment
Definition: OrthoShaper.h:130
ogdf::OrthoShaper::m_startBoundBendsPerEdge
int m_startBoundBendsPerEdge
Bound on the number of bends per edge for flow.
Definition: OrthoShaper.h:157
ogdf::OrthoShaper::NetworkNodeType
NetworkNodeType
Types of network nodes: nodes and faces.
Definition: OrthoShaper.h:48
ogdf::OrthoShaper::setAngleBound
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...
Definition: OrthoShaper.h:161
ogdf::OrthoShaper::m_fourPlanar
bool m_fourPlanar
should the input graph be four planar (no zero degree)
Definition: OrthoShaper.h:120
ogdf::OrthoShaper::fixDegreeFourAngles
bool fixDegreeFourAngles()
Definition: OrthoShaper.h:95
ogdf::OrthoShaper::m_multiAlign
bool m_multiAlign
multi edges aligned on the same side
Definition: OrthoShaper.h:127
ogdf::OrthoShaper::m_distributeEdges
bool m_distributeEdges
distribute edges among all sides if degree > 4
Definition: OrthoShaper.h:116
ogdf::OrthoShaper::fixDegreeFourAngles
void fixDegreeFourAngles(bool b)
Definition: OrthoShaper.h:98
ogdf::OrthoRep
Orthogonal representation of an embedded graph.
Definition: OrthoRep.h:225
ogdf::OrthoShaper::m_allowLowZero
bool m_allowLowZero
allow low degree nodes zero degree (to low for zero...)
Definition: OrthoShaper.h:124
ogdf::OrthoShaper::setDefaultSettings
void setDefaultSettings()
Definition: OrthoShaper.h:65
ogdf::OrthoShaper::distributeEdges
bool distributeEdges()
Definition: OrthoShaper.h:77
ogdf::OrthoShaper::OrthoShaper
OrthoShaper()
Definition: OrthoShaper.h:50
ogdf::OrthoShaper::traditional
bool traditional()
Definition: OrthoShaper.h:89
ogdf::OrthoShaper::align
void align(bool al)
Definition: OrthoShaper.h:101
ogdf::OrthoShaper::setBendBound
void setBendBound(int i)
Set bound for number of bends per edge (none if set to 0). If shape flow computation is unsuccessful,...
Definition: OrthoShaper.h:107
ogdf::OrthoShaper::align
bool align()
Definition: OrthoShaper.h:103
basic.h
Basic declarations, included by all source files.
ogdf::OrthoShaper::traditional
void traditional(bool b)
Definition: OrthoShaper.h:92
OGDF_EXPORT
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:101
ogdf::OrthoShaper::multiAlign
bool multiAlign()
Definition: OrthoShaper.h:83
ogdf::CombinatorialEmbedding
Combinatorial embeddings of planar graphs with modification functionality.
Definition: CombinatorialEmbedding.h:406
ogdf::EdgeElement
Class for the representation of edges.
Definition: Graph_d.h:363
ogdf::OrthoShaper::m_align
bool m_align
Try to achieve an alignment in hierarchy levels.
Definition: OrthoShaper.h:142
ogdf::OrthoShaper::getBendBound
int getBendBound()
Definition: OrthoShaper.h:112
ogdf::internal::EdgeArrayBase2
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
Definition: Graph_d.h:716
ogdf::OrthoShaper::distributeEdges
void distributeEdges(bool b)
Definition: OrthoShaper.h:80