Open
Graph Drawing
Framework

 v. 2020.02 (Catalpa)
 

EdgeRouter.h
Go to the documentation of this file.
1 
35 #pragma once
36 
39 #include <ogdf/basic/Layout.h>
40 #include <ogdf/basic/GridLayout.h>
42 #include <ogdf/planarity/PlanRep.h>
45 
46 namespace ogdf {
47 
53 {
55 public:
56  //constructor
57  EdgeRouter() { }
58 
59  EdgeRouter(
60  PlanRep& pru,
61  OrthoRep& H,
66  NodeArray<int>& nodewidth,
67  NodeArray<int>& nodeheight);
68 
69  virtual ~EdgeRouter() { }
70 
71  void init(
72  PlanRep& pru,
74  bool align = false);
75 
77  void setDistances();
78 
80  void call();
81 
83  void call(
84  PlanRep& pru,
85  OrthoRep& H,
90  NodeArray<int>& nodewidth,
91  NodeArray<int>& nodeheight,
92  bool align = false);
93 
95  void place(node v/*, int l_sep, int l_overh*/);
96 
98  void compute_place(node v, NodeInfo& inf/*, int sep = 10.0, int overh = 2*/);
99 
101  void compute_routing(node v);
102 
104  void compute_glue_points_y(node v);
105 
107  void compute_gen_glue_points_y(node v);
108 
110  void compute_glue_points_x(node& v);
111 
113  void compute_gen_glue_points_x(node v);
114 
116  void initialize_node_info(node v, int sep);
117 
119  int cp_x(adjEntry ae) { return m_acp_x[ae]; }
120 
122  int cp_y(adjEntry ae) { return m_acp_y[ae]; }
123 
125  int gp_x(adjEntry ae) { return m_agp_x[ae]; }
126 
128  int gp_y(adjEntry ae) { return m_agp_y[ae]; }
129 
130  void addbends(BendString& bs, const char* s2);
131 
132  edge addRightBend(edge e);
133 
134  edge addLeftBend(edge e);
135 
137  adjEntry outEntry(NodeInfo& inf, OrthoDir d, int pos) {
138  if (inf.is_in_edge(d, pos))
139  return (*inf.inList(d).get(pos))->adjTarget();
140  else
141  return (*inf.inList(d).get(pos))->adjSource();//we only bend on outentries
142  }
143 
145  adjEntry inEntry(NodeInfo& inf, OrthoDir d, int pos) {
146  if (inf.is_in_edge(d, pos))
147  return (*inf.inList(d).get(pos))->adjSource();
148  else
149  return (*inf.inList(d).get(pos))->adjTarget();
150  }
151 
153  void set_position(node v, int x = 0, int y = 0);
154 
156  void fix_position(node v, int x = 0, int y = 0);
157 
159 
162  void multiDelta();
163 
165 
168  void align(bool b) { m_align = b; }
169 
170 #if 0
171  void setOrSep(int sep) {m_hasOrSep = true; m_orSep = sep;}
173 #endif
174 
175 private:
177  enum class BendType {
179  BendFree,
181  Bend1Left,
183  Bend1Right,
185  Bend2Left,
187  Bend2Right,
189  ProbBf,
191  ProbB1L,
193  ProbB1R,
195  ProbB2L,
197  ProbB2R
198  };
199 
201  enum class ProcessType {
203  unprocessed,
205  processed,
207  used
208  };
209 
218 
220 
221  int m_sep;
222  int m_overh;
223  double Cconst;
224 
225  BendType abendType(adjEntry ae) { return m_abends[ae]; }
226 
227  void unsplit(edge e1, edge e2);
228 
230  void set_corners(node v);
231 
233  int alpha_move(OrthoDir s_to, OrthoDir s_from, node v);
234 
237 
239  node oppositeNode(adjEntry ae) { return ae->twinNode(); }
240 
243  Graph::NodeType nt;
244  nt = m_prup->typeOf(oppositeNode(ae));
247  }
248  //if yes, set its m_oppositeBendType value according to the newly introduced bend
249 
251 
255  int beta_move(OrthoDir s_from, OrthoDir s_to, int move_num, node v);
256 
258 
261  int compute_move(OrthoDir s_from, OrthoDir s_to, int& kflip, node v);
262 
263  int updateBends(
264  const node v,
265  ListIterator<edge> &it,
266  const bool updateX,
267  const OrthoDir dir,
268  const bool bendLeft,
269  const bool bendUp,
270  int pos = 0);
271 
272  void updateBends(
273  const node v,
274  ListIterator<edge> &it,
275  int &pos,
276  int &lastunbend,
277  const bool updateX,
278  const OrthoDir dir,
279  const bool bendLeft,
280  const bool bendUp,
281  const bool subtract);
282 
283  void updateLowerEdgesBends(
284  const node v,
285  ListIterator<edge> &it,
286  int &pos,
287  int &base,
288  const bool updateX,
289  const OrthoDir dir,
290  const bool bendLeft);
291 
293  const bool isDoubleBend,
294  const adjEntry adj,
295  const node v,
296  const OrthoDir dir,
297  const bool bendLeft,
298  const BendType btSingle,
299  const BendType btDouble) {
300  const OrthoDir dirB = bendLeft ? OrthoRep::nextDir(dir) : OrthoRep::prevDir(dir);
301  auto &inf = infos[v];
302 
303  if (isDoubleBend) { // paper E^
304  // must be double-bend
305  m_abends[adj] = btDouble;
306  inf.inc_E(dirB, dir);
307  } else {
308  // may be single-bend
309  m_abends[adj] = btSingle;
310  inf.inc_E_hook(dirB, dir);
311  }
312  }
313 
316  EdgeArray<int> lowe, uppe, lefte, righte;
317  AdjEntryArray<int> alowe, auppe, alefte, arighte;
321 
323 
329 
332 
335 
336  //alignment test
339  bool m_align;
340 };
341 
342 }
int m_sep
minimum separation
Definition: EdgeRouter.h:221
AdjEntryArray< int > auppe
Definition: EdgeRouter.h:317
adjEntry inEntry(NodeInfo &inf, OrthoDir d, int pos)
adjEntries for edges in inLists
Definition: EdgeRouter.h:145
AdjEntryArray< int > m_agp_y
because edges can connect two replacement cages
Definition: EdgeRouter.h:318
NodeArray< bool > m_mergerSon
is part of merger son cage
Definition: EdgeRouter.h:337
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:99
bool m_minDelta
set minimum delta values for flip decision and adjust distances correspondingly
Definition: EdgeRouter.h:236
Declaration of orthogonal representation of planar graphs.
Extends GridLayout by a grid mapping mechanism.
AdjEntryArray< BendType > m_abends
bends
Definition: EdgeRouter.h:328
int gp_y(adjEntry ae)
Returns assigned glue point (node border) y-coordinate.
Definition: EdgeRouter.h:128
int gp_x(adjEntry ae)
Returns assigned glue point (node border) x-coordinate.
Definition: EdgeRouter.h:125
Orthogonal representation of an embedded graph.
Definition: OrthoRep.h:236
Declaration of a base class for planar representations of graphs and cluster graphs.
List< edge > & inList(OrthoDir bs)
Definition: NodeInfo.h:171
ProcessType
Process status of nodes.
Definition: EdgeRouter.h:201
void updateOneBend(const bool isDoubleBend, const adjEntry adj, const node v, const OrthoDir dir, const bool bendLeft, const BendType btSingle, const BendType btDouble)
Definition: EdgeRouter.h:292
void init()
Definition: graphics.h:472
int cp_y(adjEntry ae)
Returns assigned connection point (cage border) y-coordinate of ae &#39;s source.
Definition: EdgeRouter.h:122
BendType abendType(adjEntry ae)
Definition: EdgeRouter.h:225
AdjEntryArray< node > m_cage_point
newly introduced bends destroy edge to point connection
Definition: EdgeRouter.h:319
EdgeArray< int > uppe
Definition: EdgeRouter.h:316
Graph::NodeType typeOf(node v) const
Returns the type of node v.
Definition: PlanRep.h:208
Declaration of class RoutingChannel which maintains required size of routing channels and separation...
GridLayoutMapped * m_layoutp
Definition: EdgeRouter.h:211
void align(bool b)
set alignment option: place nodes in cage at outgoing generalization
Definition: EdgeRouter.h:168
Places node boxes in replacement areas of orthogonal drawing step and route edges to minimize bends...
Definition: EdgeRouter.h:52
Declaration of class Layout.
NodeArray< OrthoDir > m_mergeDir
direction of adjacent (to) merger edges
Definition: EdgeRouter.h:338
int cp_x(adjEntry ae)
Returns assigned connection point (cage border) x-coordinate of ae &#39;s source.
Definition: EdgeRouter.h:119
NodeArray< int > * m_nodewidth
Definition: EdgeRouter.h:216
CombinatorialEmbedding * m_comb
Definition: EdgeRouter.h:213
Declaration of class GridLayout.
MinimumEdgeDistances< int > * m_med
Definition: EdgeRouter.h:215
NodeArray< ProcessType > m_processStatus
keep information about already processed Nodes
Definition: EdgeRouter.h:334
node twinNode() const
Returns the associated node of the corresponding adjacency entry (shorthand for twin()->theNode()).
Definition: Graph_d.h:108
Class for the representation of edges.
Definition: Graph_d.h:292
double Cconst
relative sep to overhang / delta to eps
Definition: EdgeRouter.h:223
const_iterator get(int pos) const
Returns a const iterator pointing to the element at position pos.
Definition: List.h:310
Class for the representation of nodes.
Definition: Graph_d.h:169
Encapsulates a pointer to a list element.
Definition: List.h:42
adjEntry outEntry(NodeInfo &inf, OrthoDir d, int pos)
adjEntries for edges in inLists
Definition: EdgeRouter.h:137
OrthoDir
Definition: OrthoRep.h:51
node oppositeNode(adjEntry ae)
helper for oppositeExpander
Definition: EdgeRouter.h:239
RoutingChannel< int > * m_rc
Definition: EdgeRouter.h:214
bool oppositeExpander(adjEntry ae)
check if the target node of the outgoing adjEntry still is a expander
Definition: EdgeRouter.h:242
Declaration of class GridLayoutMapped which extends GridLayout by a grid mapping mechanism.
static OrthoDir prevDir(OrthoDir d)
Returns the previous OrthoDir (in a clockwise manner)
Definition: OrthoRep.h:444
PlanRep * m_prup
Definition: EdgeRouter.h:210
static OrthoDir nextDir(OrthoDir d)
Returns the next OrthoDir (in a clockwise manner)
Definition: OrthoRep.h:439
NodeArray< int > m_newy
new placement position for original node
Definition: EdgeRouter.h:314
Represents the bends on an edge e consisting of vertical and horizontal segments. ...
Definition: OrthoRep.h:68
virtual ~EdgeRouter()
Definition: EdgeRouter.h:69
Declaration of class MinimumEdgeDistances which maintains minimum distances between attached edges at...
Declaration of class NodeInfo.
The namespace for all OGDF objects.
NodeArray< BendType > m_oppositeBendType
keep the information about the type of bend inserted at one end of an (originally unbend) edge...
Definition: EdgeRouter.h:331
NodeArray< bool > m_fixed
saves info about changed position, no further change is allowed
Definition: EdgeRouter.h:315
void inc_E_hook(OrthoDir s_from, OrthoDir s_to, int num=1)
Definition: NodeInfo.h:273
NodeType
The type of nodes.
Definition: Graph_d.h:545
int m_overh
minimum overhang
Definition: EdgeRouter.h:222
bool is_in_edge(OrthoDir od, int pos)
Definition: NodeInfo.h:210
Combinatorial embeddings of planar graphs with modification functionality.
NodeArray< int > * m_nodeheight
Definition: EdgeRouter.h:217
OrthoRep * m_orp
Definition: EdgeRouter.h:212
Class for adjacency list elements.
Definition: Graph_d.h:79
void inc_E(OrthoDir s_from, OrthoDir s_to, int num=1)
Definition: NodeInfo.h:278
NodeArray< NodeInfo > infos
holds the cage and placement information
Definition: EdgeRouter.h:219
AdjEntryArray< int > m_acp_y
edge connection point coordinates before treatment
Definition: EdgeRouter.h:320
Planarized representations (of a connected component) of a graph.
Definition: PlanRep.h:59
BendType
Edge types, defined by necessary bends.
Definition: EdgeRouter.h:177