Open
Graph Drawing
Framework

 v. 2020.02 (Catalpa)
 

OrthoShaper.h
Go to the documentation of this file.
1 
34 #pragma once
35 
37 #include <ogdf/uml/PlanRepUML.h>
38 
39 
40 namespace ogdf {
41 
43 {
44 public:
46  enum class NetworkNodeType { low, high, inner, outer };
47 
49  setDefaultSettings();
50  }
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,
62  OrthoRep &OR,
63  bool fourPlanar = true);
64 
65  void call(PlanRep &PG,
67  OrthoRep &OR,
68  bool fourPlanar = true);
69 
70  //sets the default settings used in the standard constructor
72  {
73  m_distributeEdges = true; // true; //try to distribute edges to all node sides
74  m_fourPlanar = true; //do not allow zero degree angles at high degree
75  m_allowLowZero = false; //do allow zero degree at low degree nodes
76  m_multiAlign = true;//true; //start/end side of multi edges match
77  m_traditional = true;//true; //prefer 3/1 flow at degree 2 (false: 2/2)
78  m_deg4free = false; //allow free angle assignment at degree four
79  m_align = false; //align nodes on same hierarchy level
80  m_startBoundBendsPerEdge = 0; //don't use bound on bend number per edge
81  }
82 
83  // returns option distributeEdges
84  bool distributeEdges() { return m_distributeEdges; }
85  // sets option distributeEdges to b
86  void distributeEdges(bool b) { m_distributeEdges = b; }
87 
88  // returns option multiAlign
89  bool multiAlign() { return m_multiAlign; }
90  // sets option multiAlign to b
91  void multiAlign(bool b) { m_multiAlign = b; }
92 
93  // returns option traditional
94  bool traditional() { return m_traditional; }
95  // sets option traditional to b
96  void traditional(bool b) { m_traditional = b; }
97 
98  //returns option deg4free
99  bool fixDegreeFourAngles() { return m_deg4free; }
100  //sets option deg4free
101  void fixDegreeFourAngles(bool b) { m_deg4free = b; }
102 
103  //alignment of brothers in hierarchies
104  void align(bool al) {m_align = al;}
105  bool align() {return m_align;}
106 
109  void setBendBound(int i){ OGDF_ASSERT(i >= 0); m_startBoundBendsPerEdge = i;}
110  int getBendBound(){return m_startBoundBendsPerEdge;}
111 
112 private:
115 
119 
123 
126 
129 
138 
140  bool m_align;
141 
156 
160  edge netArc,
161  int angle,
162  EdgeArray<int>& lowB,
163  EdgeArray<int>& upB,
164  EdgeArray<edge>& aTwin,
165  bool maxBound = true)
166  {
167  // preliminary
168  OGDF_ASSERT(!m_traditional);
169 
170  const int angleId = angle / 90;
171  const edge e2 = aTwin[netArc];
172 
173  OGDF_ASSERT(angleId >= 0);
174  OGDF_ASSERT(angleId <= 2);
175 
176  if (maxBound) {
177  lowB[netArc] = 2 - angleId;
178  upB[netArc] = 2;
179 
180  if (e2) {
181  upB[e2] = lowB[e2] = 0;
182  }
183  } else {
184  upB[netArc] = 2 - angleId;
185  lowB[netArc] = 0;
186 
187  if (e2) {
188  upB[e2] = 2;
189  lowB[e2] = 0;
190  }
191  }
192  }
193 };
194 
195 }
void align(bool al)
Definition: OrthoShaper.h:104
void multiAlign(bool b)
Definition: OrthoShaper.h:91
NetworkNodeType
Types of network nodes: nodes and faces.
Definition: OrthoShaper.h:46
bool m_fourPlanar
should the input graph be four planar (no zero degree)
Definition: OrthoShaper.h:118
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:99
void traditional(bool b)
Definition: OrthoShaper.h:96
Declaration of orthogonal representation of planar graphs.
void fixDegreeFourAngles(bool b)
Definition: OrthoShaper.h:101
bool m_traditional
Do not prefer 180-degree angles.
Definition: OrthoShaper.h:137
Orthogonal representation of an embedded graph.
Definition: OrthoRep.h:236
bool m_deg4free
allow degree four nodes free angle assignment
Definition: OrthoShaper.h:128
bool distributeEdges()
Definition: OrthoShaper.h:84
bool m_multiAlign
multi edges aligned on the same side
Definition: OrthoShaper.h:125
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:159
Declaration of class PlanRepUML.
bool fixDegreeFourAngles()
Definition: OrthoShaper.h:99
Planarized representation (of a connected component) of a UMLGraph; allows special handling of hierar...
Definition: PlanRepUML.h:49
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:109
Class for the representation of edges.
Definition: Graph_d.h:292
int m_startBoundBendsPerEdge
Bound on the number of bends per edge for flow.
Definition: OrthoShaper.h:155
void distributeEdges(bool b)
Definition: OrthoShaper.h:86
void setDefaultSettings()
Definition: OrthoShaper.h:71
bool m_align
Try to achieve an alignment in hierarchy levels.
Definition: OrthoShaper.h:140
bool m_distributeEdges
distribute edges among all sides if degree > 4
Definition: OrthoShaper.h:114
The namespace for all OGDF objects.
bool m_allowLowZero
allow low degree nodes zero degree (to low for zero...)
Definition: OrthoShaper.h:122
Combinatorial embeddings of planar graphs with modification functionality.
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
Definition: basic.h:41
Planarized representations (of a connected component) of a graph.
Definition: PlanRep.h:59