Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
RoutingChannel.h
Go to the documentation of this file.
1
33#pragma once
34
36
37namespace ogdf {
38
41template<class ATYPE>
43public:
44 // constructor
47
48 // size of routing channel of side dir of node v
49 const ATYPE& operator()(node v, OrthoDir dir) const {
50 return m_channel[v].rc[static_cast<int>(dir)];
51 }
52
53 ATYPE& operator()(node v, OrthoDir dir) { return m_channel[v].rc[static_cast<int>(dir)]; }
54
55 // returns separation (minimum distance between vertices/edges)
56 ATYPE separation() const { return m_separation; }
57
58 // returns cOverhang (such that overhang = separation * cOverhang)
59 double cOverhang() const { return m_cOverhang; }
60
61 // returns overhang (distance between vertex corners and edges)
63
64 void computeRoutingChannels(const OrthoRep& OR, bool align = false) {
65 const Graph& G = OR;
66
67 for (node v : G.nodes) {
69
70 if (pInfo) {
72 pInfo->m_side[static_cast<int>(OrthoDir::North)];
74 pInfo->m_side[static_cast<int>(OrthoDir::South)];
75 const OrthoRep::SideInfoUML& sWest = pInfo->m_side[static_cast<int>(OrthoDir::West)];
76 const OrthoRep::SideInfoUML& sEast = pInfo->m_side[static_cast<int>(OrthoDir::East)];
77
80 (*this)(v, OrthoDir::West) = computeRoutingChannel(sWest, sEast, align);
81 (*this)(v, OrthoDir::East) = computeRoutingChannel(sEast, sWest, align);
82 }
83 }
84 }
85
86private:
87 // computes required size of routing channel at side si with opposite side siOpp
89 bool align = false) {
90 if (si.m_adjGen == nullptr) {
91 int k = si.m_nAttached[0];
92 if (k == 0 || ((k == 1 && siOpp.totalAttached() == 0) && !align)) {
93 return 0;
94 } else {
95 return (k + 1) * m_separation;
96 }
97
98 } else {
99 int m = max(si.m_nAttached[0], si.m_nAttached[1]);
100 if (m == 0) {
101 return 0;
102 } else {
103 return (m + 1) * m_separation;
104 }
105 }
106 }
107
108 struct vInfo {
110
111 vInfo() { rc[0] = rc[1] = rc[2] = rc[3] = ATYPE(); }
112 };
113
117};
118
119}
Declaration of orthogonal representation of planar graphs.
Data type for general directed graphs (adjacency list representation).
Definition Graph_d.h:521
Dynamic arrays indexed with nodes.
Definition NodeArray.h:125
Class for the representation of nodes.
Definition Graph_d.h:177
Orthogonal representation of an embedded graph.
Definition OrthoRep.h:219
const VertexInfoUML * cageInfo(node v) const
Definition OrthoRep.h:315
Maintains input sizes for constructive compaction (size of routing channels, separation,...
ATYPE overhang() const
NodeArray< vInfo > m_channel
int computeRoutingChannel(const OrthoRep::SideInfoUML &si, const OrthoRep::SideInfoUML &siOpp, bool align=false)
ATYPE & operator()(node v, OrthoDir dir)
RoutingChannel(const Graph &G, ATYPE sep, double cOver)
double cOverhang() const
void computeRoutingChannels(const OrthoRep &OR, bool align=false)
ATYPE separation() const
const ATYPE & operator()(node v, OrthoDir dir) const
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
The namespace for all OGDF objects.
OrthoDir
Definition OrthoRep.h:50
Information about a side of a vertex in UML diagrams.
Definition OrthoRep.h:222
Further information about the cages of vertices in UML diagrams.
Definition OrthoRep.h:258