Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

OrthoLayoutUML.h
Go to the documentation of this file.
1 
34 #pragma once
35 
38 
39 namespace ogdf {
40 
44 public:
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 
142 protected:
143  void classifyEdges(PlanRepUML& PG, adjEntry& adjExternal);
144 
145 private:
146  // compute bounding box and move final drawing such that it is 0 aligned
147  // respecting margins
148  void computeBoundingBox(const PlanRepUML& PG, Layout& drawing);
149 
150 
151  // options
152  double m_separation;
153  double m_cOverhang;
154  double m_margin;
159  //align merger sons on same level
160  bool m_align;
161  //settings for scaling compaction
164  //mainly used for OrthoShaper traditional/progressive
167 };
168 
169 }
ogdf
The namespace for all OGDF objects.
Definition: AugmentationModule.h:36
ogdf::OrthoLayoutUML::m_costAssoc
int m_costAssoc
Definition: OrthoLayoutUML.h:157
ogdf::OrthoLayoutUML::costAssoc
int costAssoc() const
Definition: OrthoLayoutUML.h:79
ogdf::LayoutPlanRepUMLModule
Interface for planar UML layout algorithms.
Definition: LayoutPlanRepUMLModule.h:46
OGDF_ASSERT
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
Definition: basic.h:54
ogdf::OrthoLayoutUML::costGen
void costGen(int c)
Definition: OrthoLayoutUML.h:86
LayoutPlanRepUMLModule.h
Declaration of interface for planar layout algorithms for UML diagrams (used in planarization approac...
ogdf::OrthoDir
OrthoDir
Definition: OrthoRep.h:50
ogdf::PlanRepUML
Planarized representation (of a connected component) of a UMLGraph; allows special handling of hierar...
Definition: PlanRepUML.h:48
ogdf::OrthoLayoutUML::m_preferedDir
OrthoDir m_preferedDir
Definition: OrthoLayoutUML.h:155
ogdf::OrthoLayoutUML::m_orthoStyle
int m_orthoStyle
Definition: OrthoLayoutUML.h:165
ogdf::OrthoLayoutUML::preferedDir
void preferedDir(OrthoDir dir)
Definition: OrthoLayoutUML.h:76
ogdf::OrthoLayoutUML::m_margin
double m_margin
Definition: OrthoLayoutUML.h:154
ogdf::OrthoLayoutUML::align
void align(bool b)
Set alignment option.
Definition: OrthoLayoutUML.h:92
ogdf::OrthoLayoutUML::m_align
bool m_align
Definition: OrthoLayoutUML.h:160
ogdf::OrthoLayoutUML::margin
double margin() const
Definition: OrthoLayoutUML.h:69
ogdf::OrthoLayoutUML::margin
void margin(double m)
Definition: OrthoLayoutUML.h:71
ogdf::AdjElement
Class for adjacency list elements.
Definition: Graph_d.h:135
ogdf::OrthoLayoutUML::m_separation
double m_separation
Definition: OrthoLayoutUML.h:152
ogdf::Layout
Stores a layout of a graph (coordinates of nodes, bend points of edges).
Definition: Layout.h:46
ogdf::OrthoLayoutUML
Represents planar orthogonal drawing algorithm for mixed-upward planar embedded graphs (UML-diagrams)
Definition: OrthoLayoutUML.h:43
ogdf::OrthoLayoutUML::setBendBound
void setBendBound(int i)
Set bound on the number of bends.
Definition: OrthoLayoutUML.h:98
OrthoRep.h
Declaration of orthogonal representation of planar graphs.
ogdf::OrthoLayoutUML::cOverhang
void cOverhang(double c)
Definition: OrthoLayoutUML.h:66
ogdf::OrthoLayoutUML::separation
virtual void separation(double sep) override
Sets the minimal allowed distance between edges and vertices to sep.
Definition: OrthoLayoutUML.h:60
ogdf::UMLOpt::OpAlign
@ OpAlign
ogdf::OrthoLayoutUML::costGen
int costGen() const
Definition: OrthoLayoutUML.h:84
ogdf::OrthoLayoutUML::m_optionProfile
int m_optionProfile
Definition: OrthoLayoutUML.h:156
ogdf::OrthoLayoutUML::m_bendBound
int m_bendBound
bounds number of bends per edge in ortho shaper
Definition: OrthoLayoutUML.h:166
ogdf::OrthoLayoutUML::m_costGen
int m_costGen
Definition: OrthoLayoutUML.h:158
ogdf::OrthoLayoutUML::preferedDir
OrthoDir preferedDir() const
Definition: OrthoLayoutUML.h:74
ogdf::OrthoLayoutUML::scaling
void scaling(bool b)
Set scaling compaction.
Definition: OrthoLayoutUML.h:95
ogdf::OrthoLayoutUML::optionProfile
void optionProfile(int i)
Set the option profile, thereby fixing a set of drawing options.
Definition: OrthoLayoutUML.h:89
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:153
ogdf::OrthoLayoutUML::cOverhang
double cOverhang() const
Definition: OrthoLayoutUML.h:64
ogdf::UMLOpt::OpScale
@ OpScale
ogdf::OrthoLayoutUML::getOptions
virtual int getOptions() override
Returns the (generic) options.
Definition: OrthoLayoutUML.h:127
ogdf::OrthoLayoutUML::m_scalingSteps
int m_scalingSteps
Definition: OrthoLayoutUML.h:163
ogdf::OrthoLayoutUML::separation
virtual double separation() const override
Returns the minimal allowed distance between edges and vertices.
Definition: OrthoLayoutUML.h:58
ogdf::OrthoLayoutUML::m_useScalingCompaction
bool m_useScalingCompaction
Definition: OrthoLayoutUML.h:162
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:109
ogdf::OrthoLayoutUML::costAssoc
void costAssoc(int c)
Definition: OrthoLayoutUML.h:81