Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
OrthoLayoutUML.h
Go to the documentation of this file.
1
34#pragma once
35
38
39namespace ogdf {
40
44public:
45 // constructor
47
48
49 // calls planar UML layout algorithm. Input is a planarized representation
50 // PG of a connected component of the graph, output is a layout of the
51 // (modified) planarized representation in drawing
52 virtual void call(PlanRepUML& PG, adjEntry adjExternal, Layout& drawing) override;
53
54 //
55 // options
56
57 // the minimum distance between edges and vertices
58 virtual double separation() const override { return m_separation; }
59
60 virtual void separation(double sep) override { m_separation = sep; }
61
62 // cOverhang * separation is the minimum distance between the glue point
63 // of an edge and a corner of the vertex boundary
64 double cOverhang() const { return m_cOverhang; }
65
66 void cOverhang(double c) { m_cOverhang = c; }
67
68 // the distance from the tight bounding box to the boundary of the drawing
69 double margin() const { return m_margin; }
70
71 void margin(double m) { m_margin = m; }
72
73 // the preferred direction of generalizations
74 OrthoDir preferedDir() const { return m_preferedDir; }
75
76 void preferedDir(OrthoDir dir) { m_preferedDir = dir; }
77
78 // cost of associations
79 int costAssoc() const { return m_costAssoc; }
80
81 void costAssoc(int c) { m_costAssoc = c; }
82
83 // cost of generalizations
84 int costGen() const { return m_costGen; }
85
86 void costGen(int c) { m_costGen = c; }
87
89 void optionProfile(int i) { m_optionProfile = i; }
90
92 void align(bool b) { m_align = b; }
93
95 void scaling(bool b) { m_useScalingCompaction = b; }
96
98 void setBendBound(int i) {
99 OGDF_ASSERT(i >= 0);
100 m_bendBound = i;
101 }
102
103 //set generic options by setting field bits,
104 //necessary to allow setting over base class pointer
105 //bit 0 = alignment
106 //bit 1 = scaling
107 //bit 2 = progressive/traditional
108 //=> 0 is standard
109 virtual void setOptions(int optionField) override {
110 if (optionField & UMLOpt::OpAlign) {
111 m_align = true;
112 } else {
113 m_align = false;
114 }
115 if (optionField & UMLOpt::OpScale) {
116 m_useScalingCompaction = true;
117 } else {
118 m_useScalingCompaction = false;
119 }
120 if (optionField & UMLOpt::OpProg) {
121 m_orthoStyle = 1;
122 } else {
123 m_orthoStyle = 0; //traditional
124 }
125 }
126
127 virtual int getOptions() override {
128 int result = 0;
129 if (m_align) {
130 result = static_cast<int>(UMLOpt::OpAlign);
131 }
132 if (m_useScalingCompaction) {
133 result += UMLOpt::OpScale;
134 }
135 if (m_orthoStyle == 1) {
136 result += UMLOpt::OpProg;
137 }
138
139 return result;
140 }
141
142protected:
144
145private:
146 // compute bounding box and move final drawing such that it is 0 aligned
147 // respecting margins
149
150
151 // options
154 double m_margin;
159 //align merger sons on same level
161 //settings for scaling compaction
164 //mainly used for OrthoShaper traditional/progressive
167};
168
169}
Declaration of interface for planar layout algorithms for UML diagrams (used in planarization approac...
Declaration of orthogonal representation of planar graphs.
Class for adjacency list elements.
Definition Graph_d.h:79
Stores a layout of a graph (coordinates of nodes, bend points of edges).
Definition Layout.h:46
Interface for planar UML layout algorithms.
Represents planar orthogonal drawing algorithm for mixed-upward planar embedded graphs (UML-diagrams)
virtual void call(PlanRepUML &PG, adjEntry adjExternal, Layout &drawing) override
Computes a planar layout of PG in drawing.
virtual double separation() const override
Returns the minimal allowed distance between edges and vertices.
void classifyEdges(PlanRepUML &PG, adjEntry &adjExternal)
void computeBoundingBox(const PlanRepUML &PG, Layout &drawing)
virtual void setOptions(int optionField) override
Sets the (generic) options; derived classes have to cope with the interpretation)
void align(bool b)
Set alignment option.
OrthoDir preferedDir() const
virtual void separation(double sep) override
Sets the minimal allowed distance between edges and vertices to sep.
double margin() const
void optionProfile(int i)
Set the option profile, thereby fixing a set of drawing options.
void setBendBound(int i)
Set bound on the number of bends.
int m_bendBound
bounds number of bends per edge in ortho shaper
void cOverhang(double c)
virtual int getOptions() override
Returns the (generic) options.
void scaling(bool b)
Set scaling compaction.
void preferedDir(OrthoDir dir)
void margin(double m)
double cOverhang() const
Planarized representation (of a connected component) of a UMLGraph; allows special handling of hierar...
Definition PlanRepUML.h:48
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition config.h:101
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
Definition basic.h:41
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
The namespace for all OGDF objects.
OrthoDir
Definition OrthoRep.h:50