Open
Graph Drawing
Framework

 v. snapshot-2017-02-16
 

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 
42 
44 {
45 public:
46 
47  enum class NetworkNodeType { low, high, inner, outer }; //types of network nodes: nodes and faces
48 
50  setDefaultSettings();
51  }
52 
54 
55  // Given a planar representation for a UML graph and its planar
56  // combinatorial embedding, call() produces an orthogonal
57  // representation using Tamassias bend minimization algorithm
58  // with a flow network where every flow unit defines 90 degree angle
59  // in traditional mode.
60 
61  void call(PlanRepUML &PG,
63  OrthoRep &OR,
64  bool fourPlanar = true);
65 
66  void call(PlanRep &PG,
68  OrthoRep &OR,
69  bool fourPlanar = true);
70 
71  //sets the default settings used in the standard constructor
73  {
74  m_distributeEdges = true; // true; //try to distribute edges to all node sides
75  m_fourPlanar = true; //do not allow zero degree angles at high degree
76  m_allowLowZero = false; //do allow zero degree at low degree nodes
77  m_multiAlign = true;//true; //start/end side of multi edges match
78  m_traditional = true;//true; //prefer 3/1 flow at degree 2 (false: 2/2)
79  m_deg4free = false; //allow free angle assignment at degree four
80  m_align = false; //align nodes on same hierarchy level
81  m_startBoundBendsPerEdge = 0; //don't use bound on bend number per edge
82  }
83 
84  // returns option distributeEdges
85  bool distributeEdges() { return m_distributeEdges; }
86  // sets option distributeEdges to b
87  void distributeEdges(bool b) { m_distributeEdges = b; }
88 
89  // returns option multiAlign
90  bool multiAlign() { return m_multiAlign; }
91  // sets option multiAlign to b
92  void multiAlign(bool b) { m_multiAlign = b; }
93 
94  // returns option traditional
95  bool traditional() { return m_traditional; }
96  // sets option traditional to b
97  void traditional(bool b) { m_traditional = b; }
98 
99  //returns option deg4free
100  bool fixDegreeFourAngles() { return m_deg4free; }
101  //sets option deg4free
102  void fixDegreeFourAngles(bool b) { m_deg4free = b; }
103 
104  //alignment of brothers in hierarchies
105  void align(bool al) {m_align = al;}
106  bool align() {return m_align;}
107 
110  void setBendBound(int i){ OGDF_ASSERT(i >= 0); m_startBoundBendsPerEdge = i;}
111  int getBendBound(){return m_startBoundBendsPerEdge;}
112 
113 private:
116 
120 
124 
127 
130 
139 
141  bool m_align;
142 
157 
161  edge netArc,
162  int angle,
163  EdgeArray<int>& lowB,
164  EdgeArray<int>& upB,
165  EdgeArray<edge>& aTwin,
166  bool maxBound = true)
167  {
168  // preliminary
169  OGDF_ASSERT(!m_traditional);
170 
171  const int angleId = angle / 90;
172  const edge e2 = aTwin[netArc];
173 
174  OGDF_ASSERT(angleId >= 0);
175  OGDF_ASSERT(angleId <= 2);
176 
177  if (maxBound) {
178  lowB[netArc] = 2 - angleId;
179  upB[netArc] = 2;
180 
181  if (e2) {
182  upB[e2] = lowB[e2] = 0;
183  }
184  } else {
185  upB[netArc] = 2 - angleId;
186  lowB[netArc] = 0;
187 
188  if (e2) {
189  upB[e2] = 2;
190  lowB[e2] = 0;
191  }
192  }
193  }//setAngleBound
194 };
195 
196 
197 } // end namespace ogdf
void align(bool al)
Definition: OrthoShaper.h:105
void multiAlign(bool b)
Definition: OrthoShaper.h:92
bool m_fourPlanar
should the input graph be four planar (no zero degree)
Definition: OrthoShaper.h:119
#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:97
Declaration of orthogonal representation of planar graphs.
void fixDegreeFourAngles(bool b)
Definition: OrthoShaper.h:102
bool m_traditional
Do not prefer 180-degree angles.
Definition: OrthoShaper.h:138
Orthogonal representation of an embedded graph.
Definition: OrthoRep.h:237
bool m_deg4free
allow degree four nodes free angle assignment
Definition: OrthoShaper.h:129
bool distributeEdges()
Definition: OrthoShaper.h:85
bool m_multiAlign
multi edges aligned on the same side
Definition: OrthoShaper.h:126
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:160
Declaration of class PlanRepUML.
bool fixDegreeFourAngles()
Definition: OrthoShaper.h:100
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:110
Class for the representation of edges.
Definition: Graph_d.h:291
int m_startBoundBendsPerEdge
Bound on the number of bends per edge for flow.
Definition: OrthoShaper.h:156
void distributeEdges(bool b)
Definition: OrthoShaper.h:87
void setDefaultSettings()
Definition: OrthoShaper.h:72
bool m_align
Try to achieve an alignment in hierarchy levels.
Definition: OrthoShaper.h:141
bool m_distributeEdges
distribute edges among all sides if degree > 4
Definition: OrthoShaper.h:115
The namespace for all OGDF objects.
bool m_allowLowZero
allow low degree nodes zero degree (to low for zero...)
Definition: OrthoShaper.h:123
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:60