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
36#include <ogdf/basic/Graph.h>
37#include <ogdf/basic/basic.h>
40
41namespace ogdf {
42class Layout;
43class PlanRepUML;
44
48public:
49 // constructor
51
52
53 // calls planar UML layout algorithm. Input is a planarized representation
54 // PG of a connected component of the graph, output is a layout of the
55 // (modified) planarized representation in drawing
56 virtual void call(PlanRepUML& PG, adjEntry adjExternal, Layout& drawing) override;
57
58 //
59 // options
60
61 // the minimum distance between edges and vertices
62 virtual double separation() const override { return m_separation; }
63
64 virtual void separation(double sep) override { m_separation = sep; }
65
66 // cOverhang * separation is the minimum distance between the glue point
67 // of an edge and a corner of the vertex boundary
68 double cOverhang() const { return m_cOverhang; }
69
70 void cOverhang(double c) { m_cOverhang = c; }
71
72 // the distance from the tight bounding box to the boundary of the drawing
73 double margin() const { return m_margin; }
74
75 void margin(double m) { m_margin = m; }
76
77 // the preferred direction of generalizations
78 OrthoDir preferedDir() const { return m_preferedDir; }
79
80 void preferedDir(OrthoDir dir) { m_preferedDir = dir; }
81
82 // cost of associations
83 int costAssoc() const { return m_costAssoc; }
84
85 void costAssoc(int c) { m_costAssoc = c; }
86
87 // cost of generalizations
88 int costGen() const { return m_costGen; }
89
90 void costGen(int c) { m_costGen = c; }
91
93 void optionProfile(int i) { m_optionProfile = i; }
94
96 void align(bool b) { m_align = b; }
97
99 void scaling(bool b) { m_useScalingCompaction = b; }
100
102 void setBendBound(int i) {
103 OGDF_ASSERT(i >= 0);
104 m_bendBound = i;
105 }
106
107 //set generic options by setting field bits,
108 //necessary to allow setting over base class pointer
109 //bit 0 = alignment
110 //bit 1 = scaling
111 //bit 2 = progressive/traditional
112 //=> 0 is standard
113 virtual void setOptions(int optionField) override {
114 if (optionField & UMLOpt::OpAlign) {
115 m_align = true;
116 } else {
117 m_align = false;
118 }
119 if (optionField & UMLOpt::OpScale) {
120 m_useScalingCompaction = true;
121 } else {
122 m_useScalingCompaction = false;
123 }
124 if (optionField & UMLOpt::OpProg) {
125 m_orthoStyle = 1;
126 } else {
127 m_orthoStyle = 0; //traditional
128 }
129 }
130
131 virtual int getOptions() override {
132 int result = 0;
133 if (m_align) {
134 result = static_cast<int>(UMLOpt::OpAlign);
135 }
136 if (m_useScalingCompaction) {
137 result += UMLOpt::OpScale;
138 }
139 if (m_orthoStyle == 1) {
140 result += UMLOpt::OpProg;
141 }
142
143 return result;
144 }
145
146protected:
147 void classifyEdges(PlanRepUML& PG, adjEntry& adjExternal);
148
149private:
150 // compute bounding box and move final drawing such that it is 0 aligned
151 // respecting margins
152 void computeBoundingBox(const PlanRepUML& PG, Layout& drawing);
153
154
155 // options
158 double m_margin;
163 //align merger sons on same level
165 //settings for scaling compaction
168 //mainly used for OrthoShaper traditional/progressive
171};
172
173}
Includes declaration of graph class.
Declaration of interface for planar layout algorithms for UML diagrams (used in planarization approac...
Declaration of orthogonal representation of planar graphs.
Basic declarations, included by all source files.
Class for adjacency list elements.
Definition Graph_d.h:143
Stores a layout of a graph (coordinates of nodes, bend points of edges).
Definition Layout.h:49
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:55
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF dynamic library (shared object / DLL),...
Definition config.h:117
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
Definition basic.h:52
The namespace for all OGDF objects.
OrthoDir
Definition OrthoRep.h:56