Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
HierarchyLayoutModule.h
Go to the documentation of this file.
1
33#pragma once
34
38
39namespace ogdf {
40
41
48public:
51
53
61
62 // Copy over relevant nodeGraphics attributes that may be used by doCall
63 // or need to be preserved. edgeGraphics' bend points need to be cleared
64 // and are not copied over.
65 if (GA.has(GraphAttributes::nodeGraphics)) {
66 const GraphCopy& GC = dynamic_cast<const GraphCopy&>(AGC.constGraph());
67 for (node vOrig : GA.constGraph().nodes) {
68 node v = GC.copy(vOrig);
69 if (v != nullptr) {
70 AGC.height(v) = GA.height(vOrig);
71 AGC.width(v) = GA.width(vOrig);
72 AGC.shape(v) = GA.shape(vOrig);
73 }
74 }
75 }
76
77 doCall(levels, AGC);
78 AGC.transferToOriginal(GA);
79 }
80
81#if 0
87 void call(Hierarchy& H, GraphAttributes &AG) {
89 doCall(H,AGC);
90 HierarchyLayoutModule::dynLayerDistance(AGC, H);
91 HierarchyLayoutModule::addBends(AGC, H);
92 AGC.transferToOriginal(AG);
93 }
94
101 void call(const Hierarchy& H, GraphAttributes &, GraphAttributes &AGC) {
102 doCall(H,AGC);
103 }
104
106 static void addBends(GraphAttributes &AGC, HierarchyLevels &levels);
107#endif
108
110
111private:
113 static void overlap(GraphAttributes& AGC, HierarchyLevelsBase& levels, node s, node t, int i,
114 int& ci, int& cj);
115
116protected:
118 static inline double getWidth(const GraphAttributes& GA, const HierarchyLevelsBase& levels,
119 node v) {
120 const GraphCopy& GC = levels.hierarchy();
121 return GC.isDummy(v) ? 0.0 : GA.width(v);
122 }
123
125 static inline double getHeight(const GraphAttributes& GA, const HierarchyLevelsBase& levels,
126 node v) {
127 const GraphCopy& GC = levels.hierarchy();
128 return GC.isDummy(v) ? 0.0 : GA.height(v);
129 }
130
139 virtual void doCall(const HierarchyLevelsBase& levels, GraphAttributes& AGC) = 0;
140
142};
143
144}
Declaration of interfaces used in Sugiyama framework.
Declaration of class GraphAttributes which extends a Graph by additional attributes.
Declaration of Hierarchy class.
Stores additional attributes of a graph (like layout information).
Copies of graphs supporting edge splitting.
Definition GraphCopy.h:254
Representation of proper hierarchies used by Sugiyama-layout.
Definition Hierarchy.h:43
Interface of hierarchy layout algorithms.
static void overlap(GraphAttributes &AGC, HierarchyLevelsBase &levels, node s, node t, int i, int &ci, int &cj)
after calling, ci (cj) contains the number of nodes of level i (j=i-1) which overlap the edge (s,...
static void dynLayerDistance(GraphAttributes &AGC, HierarchyLevelsBase &levels)
virtual void doCall(const HierarchyLevelsBase &levels, GraphAttributes &AGC)=0
Implements the actual algorithm call.
void call(const HierarchyLevelsBase &levels, GraphAttributes &GA)
Computes a hierarchy layout of levels in GA.
static double getWidth(const GraphAttributes &GA, const HierarchyLevelsBase &levels, node v)
Returns the GA width of node v or 0 if it is a dummy node in the hierarchy of levels.
HierarchyLayoutModule()
Initializes a hierarchy layout module.
static double getHeight(const GraphAttributes &GA, const HierarchyLevelsBase &levels, node v)
Returns the GA height of node v or 0 if it is a dummy node in the hierarchy of levels.
virtual const Hierarchy & hierarchy() const =0
Class for the representation of nodes.
Definition Graph_d.h:177
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition config.h:101
#define OGDF_MALLOC_NEW_DELETE
Makes the class use malloc for memory allocation.
Definition memory.h:91
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
The namespace for all OGDF objects.