Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

OrthoShaper.h
Go to the documentation of this file.
1 
34 #pragma once
35 
37 #include <ogdf/uml/PlanRepUML.h>
38 
39 namespace ogdf {
40 
42 public:
44  enum class NetworkNodeType { low, high, inner, outer };
45 
46  OrthoShaper() { setDefaultSettings(); }
47 
49 
50  // Given a planar representation for a UML graph and its planar
51  // combinatorial embedding, call() produces an orthogonal
52  // representation using Tamassias bend minimization algorithm
53  // with a flow network where every flow unit defines 90 degree angle
54  // in traditional mode.
55 
56  void call(PlanRepUML& PG, CombinatorialEmbedding& E, OrthoRep& OR, bool fourPlanar = true);
57 
58  void call(PlanRep& PG, CombinatorialEmbedding& E, OrthoRep& OR, bool fourPlanar = true);
59 
60  //sets the default settings used in the standard constructor
62  m_distributeEdges = true; // true; //try to distribute edges to all node sides
63  m_fourPlanar = true; //do not allow zero degree angles at high degree
64  m_allowLowZero = false; //do allow zero degree at low degree nodes
65  m_multiAlign = true; //true; //start/end side of multi edges match
66  m_traditional = true; //true; //prefer 3/1 flow at degree 2 (false: 2/2)
67  m_deg4free = false; //allow free angle assignment at degree four
68  m_align = false; //align nodes on same hierarchy level
69  m_startBoundBendsPerEdge = 0; //don't use bound on bend number per edge
70  }
71 
72  // returns option distributeEdges
73  bool distributeEdges() { return m_distributeEdges; }
74 
75  // sets option distributeEdges to b
76  void distributeEdges(bool b) { m_distributeEdges = b; }
77 
78  // returns option multiAlign
79  bool multiAlign() { return m_multiAlign; }
80 
81  // sets option multiAlign to b
82  void multiAlign(bool b) { m_multiAlign = b; }
83 
84  // returns option traditional
85  bool traditional() { return m_traditional; }
86 
87  // sets option traditional to b
88  void traditional(bool b) { m_traditional = b; }
89 
90  //returns option deg4free
91  bool fixDegreeFourAngles() { return m_deg4free; }
92 
93  //sets option deg4free
94  void fixDegreeFourAngles(bool b) { m_deg4free = b; }
95 
96  //alignment of brothers in hierarchies
97  void align(bool al) { m_align = al; }
98 
99  bool align() { return m_align; }
100 
103  void setBendBound(int i) {
104  OGDF_ASSERT(i >= 0);
105  m_startBoundBendsPerEdge = i;
106  }
107 
108  int getBendBound() { return m_startBoundBendsPerEdge; }
109 
110 private:
113 
117 
121 
124 
127 
136 
138  bool m_align;
139 
154 
157  void setAngleBound(edge netArc, int angle, EdgeArray<int>& lowB, EdgeArray<int>& upB,
158  EdgeArray<edge>& aTwin, bool maxBound = true) {
159  // preliminary
160  OGDF_ASSERT(!m_traditional);
161 
162  const int angleId = angle / 90;
163  const edge e2 = aTwin[netArc];
164 
165  OGDF_ASSERT(angleId >= 0);
166  OGDF_ASSERT(angleId <= 2);
167 
168  if (maxBound) {
169  lowB[netArc] = 2 - angleId;
170  upB[netArc] = 2;
171 
172  if (e2) {
173  upB[e2] = lowB[e2] = 0;
174  }
175  } else {
176  upB[netArc] = 2 - angleId;
177  lowB[netArc] = 0;
178 
179  if (e2) {
180  upB[e2] = 2;
181  lowB[e2] = 0;
182  }
183  }
184  }
185 };
186 
187 }
ogdf
The namespace for all OGDF objects.
Definition: AugmentationModule.h:36
ogdf::OrthoShaper::~OrthoShaper
~OrthoShaper()
Definition: OrthoShaper.h:48
ogdf::PlanRep
Planarized representations (of a connected component) of a graph.
Definition: PlanRep.h:57
ogdf::OrthoShaper::m_traditional
bool m_traditional
Do not prefer 180-degree angles.
Definition: OrthoShaper.h:135
OGDF_ASSERT
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
Definition: basic.h:54
ogdf::OrthoShaper
Definition: OrthoShaper.h:41
ogdf::PlanRepUML
Planarized representation (of a connected component) of a UMLGraph; allows special handling of hierar...
Definition: PlanRepUML.h:48
ogdf::OrthoShaper::multiAlign
void multiAlign(bool b)
Definition: OrthoShaper.h:82
ogdf::OrthoShaper::m_deg4free
bool m_deg4free
allow degree four nodes free angle assignment
Definition: OrthoShaper.h:126
PlanRepUML.h
Declaration of class PlanRepUML.
ogdf::OrthoShaper::m_startBoundBendsPerEdge
int m_startBoundBendsPerEdge
Bound on the number of bends per edge for flow.
Definition: OrthoShaper.h:153
ogdf::OrthoShaper::NetworkNodeType
NetworkNodeType
Types of network nodes: nodes and faces.
Definition: OrthoShaper.h:44
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:157
ogdf::OrthoShaper::m_fourPlanar
bool m_fourPlanar
should the input graph be four planar (no zero degree)
Definition: OrthoShaper.h:116
ogdf::OrthoShaper::fixDegreeFourAngles
bool fixDegreeFourAngles()
Definition: OrthoShaper.h:91
ogdf::OrthoShaper::m_multiAlign
bool m_multiAlign
multi edges aligned on the same side
Definition: OrthoShaper.h:123
ogdf::OrthoShaper::m_distributeEdges
bool m_distributeEdges
distribute edges among all sides if degree > 4
Definition: OrthoShaper.h:112
OrthoRep.h
Declaration of orthogonal representation of planar graphs.
ogdf::OrthoShaper::fixDegreeFourAngles
void fixDegreeFourAngles(bool b)
Definition: OrthoShaper.h:94
ogdf::OrthoRep
Orthogonal representation of an embedded graph.
Definition: OrthoRep.h:219
ogdf::OrthoShaper::m_allowLowZero
bool m_allowLowZero
allow low degree nodes zero degree (to low for zero...)
Definition: OrthoShaper.h:120
ogdf::OrthoShaper::setDefaultSettings
void setDefaultSettings()
Definition: OrthoShaper.h:61
ogdf::OrthoShaper::distributeEdges
bool distributeEdges()
Definition: OrthoShaper.h:73
ogdf::OrthoShaper::OrthoShaper
OrthoShaper()
Definition: OrthoShaper.h:46
ogdf::OrthoShaper::traditional
bool traditional()
Definition: OrthoShaper.h:85
ogdf::OrthoShaper::align
void align(bool al)
Definition: OrthoShaper.h:97
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:103
ogdf::OrthoShaper::align
bool align()
Definition: OrthoShaper.h:99
ogdf::OrthoShaper::traditional
void traditional(bool b)
Definition: OrthoShaper.h:88
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:79
ogdf::CombinatorialEmbedding
Combinatorial embeddings of planar graphs with modification functionality.
Definition: CombinatorialEmbedding.h:397
ogdf::EdgeElement
Class for the representation of edges.
Definition: Graph_d.h:356
ogdf::OrthoShaper::m_align
bool m_align
Try to achieve an alignment in hierarchy levels.
Definition: OrthoShaper.h:138
ogdf::OrthoShaper::getBendBound
int getBendBound()
Definition: OrthoShaper.h:108
ogdf::internal::EdgeArrayBase2
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
Definition: Graph_d.h:709
ogdf::OrthoShaper::distributeEdges
void distributeEdges(bool b)
Definition: OrthoShaper.h:76