Open
Graph Drawing
Framework

 v. snapshot-2017-02-16
 

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 
49 enum class BendType {
50  BendFree,
51  Bend1Left,
52  Bend1Right,
53  Bend2Left,
54  Bend2Right, //results
55  ProbBf,
56  ProbB1L,
57  ProbB1R,
58  ProbB2L,
59  ProbB2R
60 }; //and preliminary
61 
62 
63 // unprocessed, processed in degree1 preprocessing, used by degree1
64 enum class ProcessType {
66  processed,
67  used
68 };
69 
70 
76 {
78 public:
79  //constructor
80  EdgeRouter() { }
81 
82  EdgeRouter(
83  PlanRep& pru,
84  OrthoRep& H,
89  NodeArray<int>& nodewidth,
90  NodeArray<int>& nodeheight);
91 
92  virtual ~EdgeRouter() { }
93 
94  void init(
95  PlanRep& pru,
97  bool align = false);
98 
100  void setDistances();
101 
103  void call();
104 
106  void call(
107  PlanRep& pru,
108  OrthoRep& H,
109  GridLayoutMapped& L,
111  RoutingChannel<int>& rou,
113  NodeArray<int>& nodewidth,
114  NodeArray<int>& nodeheight,
115  bool align = false);
116 
118  void place(node v/*, int l_sep, int l_overh*/);
119 
121  void compute_place(node v, NodeInfo& inf/*, int sep = 10.0, int overh = 2*/);
122 
124  void compute_routing(node v);
125 
127  void compute_glue_points_y(node v);
128 
130  void compute_gen_glue_points_y(node v);
131 
133  void compute_glue_points_x(node& v);
134 
136  void compute_gen_glue_points_x(node v);
137 
139  void initialize_node_info(node v, int sep);
140 
141  // returns assigned connection point and glue point coordinates for each edge
142  int cp_x(adjEntry ae) { return m_acp_x[ae]; }
143  int cp_y(adjEntry ae) { return m_acp_y[ae]; }
144  int gp_x(adjEntry ae) { return m_agp_x[ae]; }
145  int gp_y(adjEntry ae) { return m_agp_y[ae]; }
146 
147  BendType abendType(adjEntry ae) { return m_abends[ae]; }
148 
149  void addbends(BendString& bs, const char* s2);
150 
151  edge addRightBend(edge e);
152 
153  edge addLeftBend(edge e);
154 
156  adjEntry outEntry(NodeInfo& inf, OrthoDir d, int pos) {
157  if (inf.is_in_edge(d, pos))
158  return (*inf.inList(d).get(pos))->adjTarget();
159  else
160  return (*inf.inList(d).get(pos))->adjSource();//we only bend on outentries
161  }
162 
164  adjEntry inEntry(NodeInfo& inf, OrthoDir d, int pos) {
165  if (inf.is_in_edge(d, pos))
166  return (*inf.inList(d).get(pos))->adjSource();
167  else
168  return (*inf.inList(d).get(pos))->adjTarget();
169  }
170 
172  void set_position(node v, int x = 0, int y = 0);
173 
175  void fix_position(node v, int x = 0, int y = 0);
176 
178 
181  void multiDelta();
182 
184 
187  void align(bool b) { m_align = b; }
188 
189 #if 0
190  void setOrSep(int sep) {m_hasOrSep = true; m_orSep = sep;}
192 #endif
193 
194 
195 private:
204 
206 
207  int m_sep;
208  int m_overh;
209  double Cconst;
210 
211  void unsplit(edge e1, edge e2);
212 
214  void set_corners(node v);
215 
217  int alpha_move(OrthoDir s_to, OrthoDir s_from, node v);
218 
221 
223  node oppositeNode(adjEntry ae) { return ae->twinNode(); }
224 
227  Graph::NodeType nt;
228  nt = m_prup->typeOf(oppositeNode(ae));
230  }
231  //if yes, set its m_oppositeBendType value according to the newly introduced bend
232 
234 
238  int beta_move(OrthoDir s_from, OrthoDir s_to, int move_num, node v);
239 
241 
244  int compute_move(OrthoDir s_from, OrthoDir s_to, int& kflip, node v);
245 
246  int updateBends(
247  const node v,
248  ListIterator<edge> &it,
249  const bool updateX,
250  const OrthoDir dir,
251  const bool bendLeft,
252  const bool bendUp,
253  int pos = 0);
254 
255  void updateBends(
256  const node v,
257  ListIterator<edge> &it,
258  int &pos,
259  int &lastunbend,
260  const bool updateX,
261  const OrthoDir dir,
262  const bool bendLeft,
263  const bool bendUp,
264  const bool subtract);
265 
266  void updateLowerEdgesBends(
267  const node v,
268  ListIterator<edge> &it,
269  int &pos,
270  int &base,
271  const bool updateX,
272  const OrthoDir dir,
273  const bool bendLeft);
274 
276  const bool isDoubleBend,
277  const adjEntry adj,
278  const node v,
279  const OrthoDir dir,
280  const bool bendLeft,
281  const BendType btSingle,
282  const BendType btDouble) {
283  const OrthoDir dirB = bendLeft ? OrthoRep::nextDir(dir) : OrthoRep::prevDir(dir);
284  auto &inf = infos[v];
285 
286  if (isDoubleBend) { // paper E^
287  // must be double-bend
288  m_abends[adj] = btDouble;
289  inf.inc_E(dirB, dir);
290  } else {
291  // may be single-bend
292  m_abends[adj] = btSingle;
293  inf.inc_E_hook(dirB, dir);
294  }
295  }
296 
299  EdgeArray<int> lowe, uppe, lefte, righte;
300  AdjEntryArray<int> alowe, auppe, alefte, arighte;
304 
306 
312 
315 
318 
319  //alignment test
322  bool m_align;
323 };
324 
325 } //end namespace
int m_sep
minimum separation
Definition: EdgeRouter.h:207
AdjEntryArray< int > auppe
Definition: EdgeRouter.h:300
adjEntry inEntry(NodeInfo &inf, OrthoDir d, int pos)
adjEntries for edges in inLists
Definition: EdgeRouter.h:164
AdjEntryArray< int > m_agp_y
because edges can connect two replacement cages
Definition: EdgeRouter.h:301
NodeArray< bool > m_mergerSon
is part of merger son cage
Definition: EdgeRouter.h:320
#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:220
Declaration of orthogonal representation of planar graphs.
Extends GridLayout by a grid mapping mechanism.
AdjEntryArray< BendType > m_abends
bends
Definition: EdgeRouter.h:311
int gp_y(adjEntry ae)
glue point (node border)
Definition: EdgeRouter.h:145
int gp_x(adjEntry ae)
glue point (node border)
Definition: EdgeRouter.h:144
Orthogonal representation of an embedded graph.
Definition: OrthoRep.h:237
Declaration of a base class for planar representations of graphs and cluster graphs.
List< edge > & inList(OrthoDir bs)
Definition: NodeInfo.h:168
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:275
int cp_y(adjEntry ae)
connection point (cage border) coord of source
Definition: EdgeRouter.h:143
BendType abendType(adjEntry ae)
Definition: EdgeRouter.h:147
AdjEntryArray< node > m_cage_point
newly introduced bends destroy edge to point connection
Definition: EdgeRouter.h:302
EdgeArray< int > uppe
Definition: EdgeRouter.h:299
Graph::NodeType typeOf(node v) const
Returns the type of node v.
Definition: PlanRep.h:209
Declaration of class RoutingChannel which maintains required size of routing channels and separation...
GridLayoutMapped * m_layoutp
Definition: EdgeRouter.h:197
void align(bool b)
set alignment option: place nodes in cage at outgoing generalization
Definition: EdgeRouter.h:187
Places node boxes in replacement areas of orthogonal drawing step and route edges to minimize bends...
Definition: EdgeRouter.h:75
Declaration of class Layout.
NodeArray< OrthoDir > m_mergeDir
direction of adjacent (to) merger edges
Definition: EdgeRouter.h:321
int cp_x(adjEntry ae)
connection point (cage border) coord of source
Definition: EdgeRouter.h:142
NodeArray< int > * m_nodewidth
Definition: EdgeRouter.h:202
CombinatorialEmbedding * m_comb
Definition: EdgeRouter.h:199
Declaration of class GridLayout.
MinimumEdgeDistances< int > * m_med
Definition: EdgeRouter.h:201
NodeArray< ProcessType > m_processStatus
keep information about already processed Nodes
Definition: EdgeRouter.h:317
node twinNode() const
Returns the associated node of the corresponding adjacency entry (shorthand for twin()->theNode()).
Definition: Graph_d.h:105
Class for the representation of edges.
Definition: Graph_d.h:291
double Cconst
relative sep to overhang / delta to eps
Definition: EdgeRouter.h:209
const_iterator get(int pos) const
Returns a const iterator pointing to the element at position pos.
Definition: List.h:290
Class for the representation of nodes.
Definition: Graph_d.h:167
Encapsulates a pointer to a list element.
Definition: List.h:41
adjEntry outEntry(NodeInfo &inf, OrthoDir d, int pos)
adjEntries for edges in inLists
Definition: EdgeRouter.h:156
OrthoDir
Definition: OrthoRep.h:52
node oppositeNode(adjEntry ae)
helper for oppositeExpander
Definition: EdgeRouter.h:223
RoutingChannel< int > * m_rc
Definition: EdgeRouter.h:200
bool oppositeExpander(adjEntry ae)
check if the target node of the outgoing adjEntry still is a expander
Definition: EdgeRouter.h:226
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:445
PlanRep * m_prup
Definition: EdgeRouter.h:196
static OrthoDir nextDir(OrthoDir d)
Returns the next OrthoDir (in a clockwise manner)
Definition: OrthoRep.h:440
NodeArray< int > m_newy
new placement position for original node
Definition: EdgeRouter.h:297
Represents the bends on an edge e consisting of vertical and horizontal segments. ...
Definition: OrthoRep.h:69
virtual ~EdgeRouter()
Definition: EdgeRouter.h:92
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:314
NodeArray< bool > m_fixed
saves info about changed position, no further change is allowed
Definition: EdgeRouter.h:298
void inc_E_hook(OrthoDir s_from, OrthoDir s_to, int num=1)
Definition: NodeInfo.h:268
NodeType
The type of nodes.
Definition: Graph_d.h:525
int m_overh
minimum overhang
Definition: EdgeRouter.h:208
bool is_in_edge(OrthoDir od, int pos)
Definition: NodeInfo.h:205
Combinatorial embeddings of planar graphs with modification functionality.
NodeArray< int > * m_nodeheight
Definition: EdgeRouter.h:203
OrthoRep * m_orp
Definition: EdgeRouter.h:198
Class for adjacency list elements.
Definition: Graph_d.h:78
void inc_E(OrthoDir s_from, OrthoDir s_to, int num=1)
Definition: NodeInfo.h:273
BendType
edge types, defined by necessary bends
Definition: EdgeRouter.h:49
ProcessType
Definition: EdgeRouter.h:64
NodeArray< NodeInfo > infos
holds the cage and placement information
Definition: EdgeRouter.h:205
AdjEntryArray< int > m_acp_y
edge connection point coordinates before treatment
Definition: EdgeRouter.h:303
Planarized representations (of a connected component) of a graph.
Definition: PlanRep.h:60