Open
Graph Drawing
Framework

 v. 2020.02 (Catalpa)
 

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