Open
Graph Drawing
Framework

 v. 2020.02 (Catalpa)
 

PlanarizationLayoutUML.h
Go to the documentation of this file.
1 
32 #pragma once
33 
38 #include <memory>
40 #include <ogdf/basic/HashArray.h>
42 
43 namespace ogdf {
44 
115 {
116 public:
119 
120  // destructor
122 
133  void call(GraphAttributes &GA) {
134  doSimpleCall(GA);
135  }
136 
142  virtual void call(UMLGraph &umlGraph) override;
143 
145  void simpleCall(UMLGraph &umlGraph) {
146  //this simple call method does not care about any special treatments
147  //of subgraphs, layout informations etc., therefore we save the
148  //option status and set them back later on
149 #if 0
150  //cliques are only handled for UMLGraphs, so it is save to
151  //only set this value here and not in the GraphAttributes interface method.
152  bool l_saveCliqueHandling = m_processCliques;
153  m_processCliques = false;
154 #endif
155 
156  // preprocessing: insert a merger for generalizations
157 
158  preProcess(umlGraph);
159  umlGraph.insertGenMergers();
160 
161  doSimpleCall(umlGraph);
162 
163  umlGraph.undoGenMergers();
164 
165  umlGraph.removeUnnecessaryBendsHV();
166 
167  postProcess(umlGraph);
168 
169 #if 0
170  m_processCliques = l_saveCliqueHandling;
171 #endif
172  }
173 
176  {
177  doSimpleCall(GA);
179  }
180 
181 #if 0
182  virtual void callSimDraw(UMLGraph &umlGraph);
184 
185  **
186  * \brief Calls planarization layout with fixed embedding given by \p umlGraph.
187  * \pre The graph has no self-loops.
188  * @param umlGraph is the input graph and will also be assigned the layout information.
189  * The fixed embedding is obtained from the layout information (node
190  * coordinates, bend points) in \p umlGraph.
191  */
192  virtual void callFixEmbed(UMLGraph &umlGraph);
193 #endif
194 
196 
202  virtual void callIncremental(UMLGraph &umlgraph,
203  NodeArray<bool> &fixedNodes, const EdgeArray<bool> &fixedEdges);
204 
205 
217  double pageRatio() const {
218  return m_pageRatio;
219  }
220 
222  void pageRatio(double ratio) {
223  m_pageRatio = ratio;
224  }
225 
226 
227  //set the option field for the planar layouter
228  void setLayouterOptions(int ops) { m_planarLayouter->setOptions(ops); }
229 
230  //draw hierarchy nodes corresponding to their level
231  void alignSons(bool b)
232  {
233  int opts = m_planarLayouter->getOptions();
234 
235  if (b) m_planarLayouter->setOptions(opts | UMLOpt::OpAlign);
236  else m_planarLayouter->setOptions(opts & ~UMLOpt::OpAlign);
237  }
238 
239 
245  void setCrossMin(UMLCrossingMinimizationModule *pCrossMin) {
247  m_crossMin.reset(pCrossMin);
248  }
249 
257  void setEmbedder(EmbedderModule *pEmbedder) {
258  m_embedder.reset(pEmbedder);
259  }
260 
271  void setPlanarLayouter(LayoutPlanRepUMLModule *pPlanarLayouter) {
272  m_planarLayouter.reset(pPlanarLayouter);
273  }
274 
282  void setPacker(CCLayoutPackModule *pPacker) {
283  m_packer.reset(pPacker);
284  }
285 
291  int numberOfCrossings() const {
293  return m_nCrossings;
294  }
295 
297  void assureDrawability(UMLGraph& umlGraph);
298 
300 
301 protected:
302  void doSimpleCall(GraphAttributes &GA);
303 
304  //sorts the additional nodes for piecewise insertion
305  void sortIncrementalNodes(List<node> &addNodes, const NodeArray<bool> &fixedNodes);
306  void getFixationDistance(node startNode, HashArray<int, int> &distance,
307  const NodeArray<bool> &fixedNodes);
308  //reembeds already planarized PG in case of errors
309  void reembed(PlanRepUML &PG, int ccNumber, bool l_align = false,
310  bool l_gensExist = false);
311 
312  virtual void preProcess(UMLGraph &UG);
313  virtual void postProcess(UMLGraph& UG); //redo changes at original
314 
315  void arrangeCCs(PlanRep &PG, GraphAttributes &GA, Array<DPoint> &boundingBox);
316 
317 private:
318  face findBestExternalFace(
319  const PlanRep &PG,
320  const CombinatorialEmbedding &E);
321 
323  std::unique_ptr<UMLCrossingMinimizationModule> m_crossMin;
324 
326  std::unique_ptr<EmbedderModule> m_embedder;
327 
329  std::unique_ptr<LayoutPlanRepUMLModule> m_planarLayouter;
330 
332  std::unique_ptr<CCLayoutPackModule> m_packer;
333 
334  double m_pageRatio;
337 
338  // temporary changes to avoid errors
339  List<edge> m_fakedGens; // made to associations
341 };
342 
343 }
double pageRatio() const
Returns the current setting of option pageRatio.
Declaration and implementation of HashArray class.
bool m_arrangeLabels
Option for re-arranging labels.
The parameterized class Array implements dynamic arrays of type E.
Definition: Array.h:200
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:99
Declaration of orthogonal representation of planar graphs.
void undoGenMergers()
void removeUnnecessaryBendsHV()
Removes unnecessary bend points in orthogonal segements.
Defines ogdf::EmbedderModule.
void simpleCall(GraphAttributes &GA)
Simple call function.
The planarization layout algorithm.
std::unique_ptr< UMLCrossingMinimizationModule > m_crossMin
The moule for UML crossing minimization.
void pageRatio(double ratio)
Sets the option pageRatio to ratio.
Interface of UML layout algorithms.
void simpleCall(UMLGraph &umlGraph)
Simple call function that does not care about cliques etc.
void call(GraphAttributes &GA)
Calls planarization layout for GraphAttributes GA and computes a layout.
int m_nCrossings
The number of crossings in the computed layout.
Stores additional attributes of a graph (like layout information).
Doubly linked lists (maintaining the length of the list).
Definition: List.h:40
Interface for planar UML layout algorithms.
Planarized representation (of a connected component) of a UMLGraph; allows special handling of hierar...
Definition: PlanRepUML.h:49
Declaration of CrossingMinimization Module, an interface for crossing minimization algorithms...
std::unique_ptr< CCLayoutPackModule > m_packer
The module for arranging connected components.
Base class for UML crossing minimization algorithms.
Faces in a combinatorial embedding.
Base class of algorithms that arrange/pack layouts of connected components.
Class for the representation of nodes.
Definition: Graph_d.h:169
double m_pageRatio
The desired page ratio.
void setPlanarLayouter(LayoutPlanRepUMLModule *pPlanarLayouter)
Sets the module option for the planar layout algorithm.
std::unique_ptr< EmbedderModule > m_embedder
The module for planar embedding.
void setEmbedder(EmbedderModule *pEmbedder)
Sets the module option for the graph embedding algorithm.
void setPacker(CCLayoutPackModule *pPacker)
Sets the module option for the arrangement of connected components.
The namespace for all OGDF objects.
void insertGenMergers()
Merges generalizations at a common superclass.
Base class for embedder algorithms.
std::unique_ptr< LayoutPlanRepUMLModule > m_planarLayouter
The module for computing a planar layout.
Combinatorial embeddings of planar graphs with modification functionality.
Declaration of interface for layout algorithms for UML diagrams.
Declaration of interface for planar layout algorithms for UML diagrams (used in planarization approac...
Planarized representations (of a connected component) of a graph.
Definition: PlanRep.h:59
Declaration of interface for algorithms that arrange/pack layouts of connected components.