Open
Graph Drawing
Framework

 v. snapshot-2017-02-16
 

OrthoLayoutUML.h
Go to the documentation of this file.
1 
34 #pragma once
35 
38 
39 
40 namespace ogdf {
41 
45 {
46 public:
47  // constructor
49 
50 
51  // calls planar UML layout algorithm. Input is a planarized representation
52  // PG of a connected component of the graph, output is a layout of the
53  // (modified) planarized representation in drawing
54  virtual void call(PlanRepUML &PG, adjEntry adjExternal, Layout &drawing) override;
55 
56  //
57  // options
58 
59  // the minimum distance between edges and vertices
60  virtual double separation() const override {
61  return m_separation;
62  }
63 
64  virtual void separation(double sep) override {
65  m_separation = sep;
66  }
67 
68  // cOverhang * separation is the minimum distance between the glue point
69  // of an edge and a corner of the vertex boundary
70  double cOverhang() const {
71  return m_cOverhang;
72  }
73 
74  void cOverhang(double c) {
75  m_cOverhang = c;
76  }
77 
78 
79  // the distance from the tight bounding box to the boundary of the drawing
80  double margin() const {
81  return m_margin;
82  }
83 
84  void margin(double m) {
85  m_margin = m;
86  }
87 
88 
89  // the preferred direction of generalizations
91  return m_preferedDir;
92  }
93 
94  void preferedDir(OrthoDir dir) {
95  m_preferedDir = dir;
96  }
97 
98  // cost of associations
99  int costAssoc() const {
100  return m_costAssoc;
101  }
102 
103  void costAssoc(int c) {
104  m_costAssoc = c;
105  }
106 
107  // cost of generalizations
108  int costGen() const {
109  return m_costGen;
110  }
111 
112  void costGen(int c) {
113  m_costGen = c;
114  }
115 
117  void optionProfile(int i) {m_optionProfile = i;}
118 
120  void align(bool b) {m_align = b;}
121 
123  void scaling(bool b) {m_useScalingCompaction = b;}
124 
126  void setBendBound(int i) { OGDF_ASSERT(i >= 0); m_bendBound = i; }
127 
128  //set generic options by setting field bits,
129  //necessary to allow setting over base class pointer
130  //bit 0 = alignment
131  //bit 1 = scaling
132  //bit 2 = progressive/traditional
133  //=> 0 is standard
134  virtual void setOptions(int optionField) override
135  {
136  if (optionField & UMLOpt::OpAlign) m_align = true;
137  else m_align = false;
138  if (optionField & UMLOpt::OpScale) m_useScalingCompaction = true;
139  else m_useScalingCompaction = false;
140  if (optionField & UMLOpt::OpProg) m_orthoStyle = 1;
141  else m_orthoStyle = 0; //traditional
142  }//setOptions
143 
144  virtual int getOptions() override
145  {
146  int result = 0;
147  if (m_align) result = static_cast<int>(UMLOpt::OpAlign);
148  if (m_useScalingCompaction) result += UMLOpt::OpScale;
149  if (m_orthoStyle == 1) result += UMLOpt::OpProg;
150 
151  return result;
152  }//getOptions
153 
154 
155 protected:
156  void classifyEdges(PlanRepUML &PG, adjEntry &adjExternal);
157 
158 private:
159  // compute bounding box and move final drawing such that it is 0 aligned
160  // respecting margins
161  void computeBoundingBox(const PlanRepUML &PG, Layout &drawing);
162 
163 
164  // options
165  double m_separation;
166  double m_cOverhang;
167  double m_margin;
172  //align merger sons on same level
173  bool m_align;
174  //settings for scaling compaction
177  //mainly used for OrthoShaper traditional/progressive
180 };
181 
182 
183 } // end namespace ogdf
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:52
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:78
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