Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

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 
41 namespace ogdf {
42 class Layout;
43 class PlanRepUML;
44 
48 public:
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 
146 protected:
147  void classifyEdges(PlanRepUML& PG, adjEntry& adjExternal);
148 
149 private:
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
156  double m_separation;
157  double m_cOverhang;
158  double m_margin;
163  //align merger sons on same level
164  bool m_align;
165  //settings for scaling compaction
168  //mainly used for OrthoShaper traditional/progressive
171 };
172 
173 }
ogdf
The namespace for all OGDF objects.
Definition: multilevelmixer.cpp:39
ogdf::OrthoLayoutUML::m_costAssoc
int m_costAssoc
Definition: OrthoLayoutUML.h:161
ogdf::OrthoLayoutUML::costAssoc
int costAssoc() const
Definition: OrthoLayoutUML.h:83
ogdf::LayoutPlanRepUMLModule
Interface for planar UML layout algorithms.
Definition: LayoutPlanRepUMLModule.h:50
Graph.h
Includes declaration of graph class.
OGDF_ASSERT
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
Definition: basic.h:66
ogdf::OrthoLayoutUML::costGen
void costGen(int c)
Definition: OrthoLayoutUML.h:90
LayoutPlanRepUMLModule.h
Declaration of interface for planar layout algorithms for UML diagrams (used in planarization approac...
ogdf::OrthoDir
OrthoDir
Definition: OrthoRep.h:56
ogdf::PlanRepUML
Planarized representation (of a connected component) of a UMLGraph; allows special handling of hierar...
Definition: PlanRepUML.h:55
ogdf::OrthoLayoutUML::m_preferedDir
OrthoDir m_preferedDir
Definition: OrthoLayoutUML.h:159
ogdf::OrthoLayoutUML::m_orthoStyle
int m_orthoStyle
Definition: OrthoLayoutUML.h:169
ogdf::OrthoLayoutUML::preferedDir
void preferedDir(OrthoDir dir)
Definition: OrthoLayoutUML.h:80
ogdf::OrthoLayoutUML::m_margin
double m_margin
Definition: OrthoLayoutUML.h:158
ogdf::OrthoLayoutUML::align
void align(bool b)
Set alignment option.
Definition: OrthoLayoutUML.h:96
ogdf::OrthoLayoutUML::m_align
bool m_align
Definition: OrthoLayoutUML.h:164
ogdf::OrthoLayoutUML::margin
double margin() const
Definition: OrthoLayoutUML.h:73
ogdf::OrthoLayoutUML::margin
void margin(double m)
Definition: OrthoLayoutUML.h:75
ogdf::AdjElement
Class for adjacency list elements.
Definition: Graph_d.h:142
ogdf::OrthoLayoutUML::m_separation
double m_separation
Definition: OrthoLayoutUML.h:156
ogdf::Layout
Stores a layout of a graph (coordinates of nodes, bend points of edges).
Definition: Layout.h:49
ogdf::OrthoLayoutUML
Represents planar orthogonal drawing algorithm for mixed-upward planar embedded graphs (UML-diagrams)
Definition: OrthoLayoutUML.h:47
ogdf::OrthoLayoutUML::setBendBound
void setBendBound(int i)
Set bound on the number of bends.
Definition: OrthoLayoutUML.h:102
OrthoRep.h
Declaration of orthogonal representation of planar graphs.
ogdf::OrthoLayoutUML::cOverhang
void cOverhang(double c)
Definition: OrthoLayoutUML.h:70
ogdf::OrthoLayoutUML::separation
virtual void separation(double sep) override
Sets the minimal allowed distance between edges and vertices to sep.
Definition: OrthoLayoutUML.h:64
ogdf::UMLOpt::OpAlign
@ OpAlign
ogdf::OrthoLayoutUML::costGen
int costGen() const
Definition: OrthoLayoutUML.h:88
ogdf::OrthoLayoutUML::m_optionProfile
int m_optionProfile
Definition: OrthoLayoutUML.h:160
ogdf::OrthoLayoutUML::m_bendBound
int m_bendBound
bounds number of bends per edge in ortho shaper
Definition: OrthoLayoutUML.h:170
ogdf::OrthoLayoutUML::m_costGen
int m_costGen
Definition: OrthoLayoutUML.h:162
ogdf::OrthoLayoutUML::preferedDir
OrthoDir preferedDir() const
Definition: OrthoLayoutUML.h:78
basic.h
Basic declarations, included by all source files.
ogdf::OrthoLayoutUML::scaling
void scaling(bool b)
Set scaling compaction.
Definition: OrthoLayoutUML.h:99
ogdf::OrthoLayoutUML::optionProfile
void optionProfile(int i)
Set the option profile, thereby fixing a set of drawing options.
Definition: OrthoLayoutUML.h:93
OGDF_EXPORT
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:101
ogdf::OrthoLayoutUML::m_cOverhang
double m_cOverhang
Definition: OrthoLayoutUML.h:157
ogdf::OrthoLayoutUML::cOverhang
double cOverhang() const
Definition: OrthoLayoutUML.h:68
ogdf::UMLOpt::OpScale
@ OpScale
ogdf::OrthoLayoutUML::getOptions
virtual int getOptions() override
Returns the (generic) options.
Definition: OrthoLayoutUML.h:131
ogdf::OrthoLayoutUML::m_scalingSteps
int m_scalingSteps
Definition: OrthoLayoutUML.h:167
ogdf::OrthoLayoutUML::separation
virtual double separation() const override
Returns the minimal allowed distance between edges and vertices.
Definition: OrthoLayoutUML.h:62
ogdf::OrthoLayoutUML::m_useScalingCompaction
bool m_useScalingCompaction
Definition: OrthoLayoutUML.h:166
ogdf::UMLOpt::OpProg
@ OpProg
ogdf::OrthoLayoutUML::setOptions
virtual void setOptions(int optionField) override
Sets the (generic) options; derived classes have to cope with the interpretation)
Definition: OrthoLayoutUML.h:113
ogdf::OrthoLayoutUML::costAssoc
void costAssoc(int c)
Definition: OrthoLayoutUML.h:85