Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

PlanarizationLayoutUML.h
Go to the documentation of this file.
1 
32 #pragma once
33 
34 #include <ogdf/basic/Array.h>
36 #include <ogdf/basic/Graph.h>
38 #include <ogdf/basic/HashArray.h>
39 #include <ogdf/basic/List.h>
40 #include <ogdf/basic/basic.h>
41 #include <ogdf/basic/geometry.h>
47 #include <ogdf/uml/UMLGraph.h>
49 
50 #include <memory>
51 
52 namespace ogdf {
53 class PlanRep;
54 class PlanRepUML;
55 
126 public:
129 
130  // destructor
132 
143  void call(GraphAttributes& GA) { doSimpleCall(GA); }
144 
150  virtual void call(UMLGraph& umlGraph) override;
151 
153  void simpleCall(UMLGraph& umlGraph) {
154  //this simple call method does not care about any special treatments
155  //of subgraphs, layout informations etc., therefore we save the
156  //option status and set them back later on
157 #if 0
158  //cliques are only handled for UMLGraphs, so it is save to
159  //only set this value here and not in the GraphAttributes interface method.
160  bool l_saveCliqueHandling = m_processCliques;
161  m_processCliques = false;
162 #endif
163 
164  // preprocessing: insert a merger for generalizations
165 
166  preProcess(umlGraph);
167  umlGraph.insertGenMergers();
168 
169  doSimpleCall(umlGraph);
170 
171  umlGraph.undoGenMergers();
172 
173  umlGraph.removeUnnecessaryBendsHV();
174 
175  postProcess(umlGraph);
176 
177 #if 0
178  m_processCliques = l_saveCliqueHandling;
179 #endif
180  }
181 
184  doSimpleCall(GA);
186  }
187 
188 #if 0
189  virtual void callSimDraw(UMLGraph &umlGraph);
191 
192  **
193  * \brief Calls planarization layout with fixed embedding given by \p umlGraph.
194  * \pre The graph has no self-loops.
195  * @param umlGraph is the input graph and will also be assigned the layout information.
196  * The fixed embedding is obtained from the layout information (node
197  * coordinates, bend points) in \p umlGraph.
198  */
199  virtual void callFixEmbed(UMLGraph &umlGraph);
200 #endif
201 
203 
209  virtual void callIncremental(UMLGraph& umlgraph, NodeArray<bool>& fixedNodes,
210  const EdgeArray<bool>& fixedEdges);
211 
223  double pageRatio() const { return m_pageRatio; }
224 
226  void pageRatio(double ratio) { m_pageRatio = ratio; }
227 
228  //set the option field for the planar layouter
229  void setLayouterOptions(int ops) { m_planarLayouter->setOptions(ops); }
230 
231  //draw hierarchy nodes corresponding to their level
232  void alignSons(bool b) {
233  int opts = m_planarLayouter->getOptions();
234 
235  if (b) {
236  m_planarLayouter->setOptions(opts | UMLOpt::OpAlign);
237  } else {
238  m_planarLayouter->setOptions(opts & ~UMLOpt::OpAlign);
239  }
240  }
241 
247  void setCrossMin(UMLCrossingMinimizationModule* pCrossMin) { m_crossMin.reset(pCrossMin); }
249 
257  void setEmbedder(EmbedderModule* pEmbedder) { m_embedder.reset(pEmbedder); }
258 
269  void setPlanarLayouter(LayoutPlanRepUMLModule* pPlanarLayouter) {
270  m_planarLayouter.reset(pPlanarLayouter);
271  }
272 
280  void setPacker(CCLayoutPackModule* pPacker) { m_packer.reset(pPacker); }
281 
287  int numberOfCrossings() const { return m_nCrossings; }
289 
291  void assureDrawability(UMLGraph& umlGraph);
292 
294 
295 protected:
296  void doSimpleCall(GraphAttributes& GA);
297 
298  //sorts the additional nodes for piecewise insertion
299  void sortIncrementalNodes(List<node>& addNodes, const NodeArray<bool>& fixedNodes);
300  void getFixationDistance(node startNode, HashArray<int, int>& distance,
301  const NodeArray<bool>& fixedNodes);
302  //reembeds already planarized PG in case of errors
303  void reembed(PlanRepUML& PG, int ccNumber, bool l_align = false, bool l_gensExist = false);
304 
305  virtual void preProcess(UMLGraph& UG);
306  virtual void postProcess(UMLGraph& UG); //redo changes at original
307 
308  void arrangeCCs(PlanRep& PG, GraphAttributes& GA, Array<DPoint>& boundingBox);
309 
310 private:
311  face findBestExternalFace(const PlanRep& PG, const CombinatorialEmbedding& E);
312 
314  std::unique_ptr<UMLCrossingMinimizationModule> m_crossMin;
315 
317  std::unique_ptr<EmbedderModule> m_embedder;
318 
320  std::unique_ptr<LayoutPlanRepUMLModule> m_planarLayouter;
321 
323  std::unique_ptr<CCLayoutPackModule> m_packer;
324 
325  double m_pageRatio;
328 
329  // temporary changes to avoid errors
330  List<edge> m_fakedGens; // made to associations
332 };
333 
334 }
ogdf::PlanarizationLayoutUML::m_packer
std::unique_ptr< CCLayoutPackModule > m_packer
The module for arranging connected components.
Definition: PlanarizationLayoutUML.h:323
HashArray.h
Declaration and implementation of HashArray class.
ogdf
The namespace for all OGDF objects.
Definition: multilevelmixer.cpp:39
ogdf::PlanarizationLayoutUML::m_arrangeLabels
bool m_arrangeLabels
Option for re-arranging labels.
Definition: PlanarizationLayoutUML.h:327
ogdf::GraphAttributes
Stores additional attributes of a graph (like layout information).
Definition: GraphAttributes.h:72
GraphAttributes.h
Declaration of class GraphAttributes which extends a Graph by additional attributes.
ogdf::PlanarizationLayoutUML::m_fakedGens
List< edge > m_fakedGens
Definition: PlanarizationLayoutUML.h:330
ogdf::PlanarizationLayoutUML::simpleCall
void simpleCall(GraphAttributes &GA)
Simple call function.
Definition: PlanarizationLayoutUML.h:183
ogdf::LayoutPlanRepUMLModule
Interface for planar UML layout algorithms.
Definition: LayoutPlanRepUMLModule.h:50
Graph.h
Includes declaration of graph class.
ogdf::UMLGraph::undoGenMergers
void undoGenMergers()
ogdf::GraphAttributes::removeUnnecessaryBendsHV
void removeUnnecessaryBendsHV()
Removes unnecessary bend points in orthogonal segements.
ogdf::PlanarizationLayoutUML::m_nCrossings
int m_nCrossings
The number of crossings in the computed layout.
Definition: PlanarizationLayoutUML.h:326
geometry.h
Declaration of classes GenericPoint, GenericPolyline, GenericLine, GenericSegment,...
LayoutPlanRepUMLModule.h
Declaration of interface for planar layout algorithms for UML diagrams (used in planarization approac...
ogdf::PlanarizationLayoutUML::m_planarLayouter
std::unique_ptr< LayoutPlanRepUMLModule > m_planarLayouter
The module for computing a planar layout.
Definition: PlanarizationLayoutUML.h:320
ogdf::PlanarizationLayoutUML::m_fakeTree
bool m_fakeTree
Definition: PlanarizationLayoutUML.h:331
ogdf::PlanarizationLayoutUML::m_crossMin
std::unique_ptr< UMLCrossingMinimizationModule > m_crossMin
The moule for UML crossing minimization.
Definition: PlanarizationLayoutUML.h:314
ogdf::PlanarizationLayoutUML::simpleCall
void simpleCall(UMLGraph &umlGraph)
Simple call function that does not care about cliques etc.
Definition: PlanarizationLayoutUML.h:153
ogdf::UMLGraph::insertGenMergers
void insertGenMergers()
Merges generalizations at a common superclass.
ogdf::PlanarizationLayoutUML::alignSons
void alignSons(bool b)
Definition: PlanarizationLayoutUML.h:232
ogdf::PlanarizationLayoutUML::m_pageRatio
double m_pageRatio
The desired page ratio.
Definition: PlanarizationLayoutUML.h:325
UMLGraph.h
Declaration of class UMLGraph.
ogdf::PlanarizationLayoutUML::~PlanarizationLayoutUML
virtual ~PlanarizationLayoutUML()
Definition: PlanarizationLayoutUML.h:131
ogdf::PlanarizationLayoutUML::setEmbedder
void setEmbedder(EmbedderModule *pEmbedder)
Sets the module option for the graph embedding algorithm.
Definition: PlanarizationLayoutUML.h:257
ogdf::CCLayoutPackModule
Base class of algorithms that arrange/pack layouts of connected components.
Definition: CCLayoutPackModule.h:49
ogdf::PlanarizationLayoutUML::m_embedder
std::unique_ptr< EmbedderModule > m_embedder
The module for planar embedding.
Definition: PlanarizationLayoutUML.h:317
ogdf::UMLCrossingMinimizationModule
Base class for UML crossing minimization algorithms.
Definition: UMLCrossingMinimizationModule.h:44
ogdf::PlanarizationLayoutUML::pageRatio
void pageRatio(double ratio)
Sets the option pageRatio to ratio.
Definition: PlanarizationLayoutUML.h:226
OrthoRep.h
Declaration of orthogonal representation of planar graphs.
ogdf::UMLLayoutModule
Interface of UML layout algorithms.
Definition: UMLLayoutModule.h:44
ogdf::UMLOpt::OpAlign
@ OpAlign
CCLayoutPackModule.h
Declaration of interface for algorithms that arrange/pack layouts of connected components.
ogdf::node
NodeElement * node
The type of nodes.
Definition: Graph_d.h:70
ogdf::List< edge >
ogdf::internal::GraphRegisteredArray
RegisteredArray for nodes, edges and adjEntries of a graph.
Definition: Graph_d.h:658
ogdf::PlanarizationLayoutUML
The planarization layout algorithm.
Definition: PlanarizationLayoutUML.h:125
ogdf::UMLGraph
Definition: UMLGraph.h:48
UMLCrossingMinimizationModule.h
Declaration of CrossingMinimization Module, an interface for crossing minimization algorithms.
ogdf::PlanarizationLayoutUML::setPlanarLayouter
void setPlanarLayouter(LayoutPlanRepUMLModule *pPlanarLayouter)
Sets the module option for the planar layout algorithm.
Definition: PlanarizationLayoutUML.h:269
ogdf::face
FaceElement * face
Definition: CombinatorialEmbedding.h:49
ogdf::EmbedderModule
Base class for embedder algorithms.
Definition: EmbedderModule.h:52
ogdf::PlanarizationLayoutUML::setLayouterOptions
void setLayouterOptions(int ops)
Definition: PlanarizationLayoutUML.h:229
UMLLayoutModule.h
Declaration of interface for layout algorithms for UML diagrams.
basic.h
Basic declarations, included by all source files.
ogdf::PlanarizationLayoutUML::call
void call(GraphAttributes &GA)
Calls planarization layout for GraphAttributes GA and computes a layout.
Definition: PlanarizationLayoutUML.h:143
CombinatorialEmbedding.h
Declaration of CombinatorialEmbedding and face.
OGDF_EXPORT
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:101
EmbedderModule.h
Defines ogdf::EmbedderModule.
Array.h
Declaration and implementation of Array class and Array algorithms.
List.h
Declaration of doubly linked lists and iterators.
ogdf::PlanarizationLayoutUML::setPacker
void setPacker(CCLayoutPackModule *pPacker)
Sets the module option for the arrangement of connected components.
Definition: PlanarizationLayoutUML.h:280
ogdf::NodeElement
Class for the representation of nodes.
Definition: Graph_d.h:240
ogdf::PlanarizationLayoutUML::pageRatio
double pageRatio() const
Returns the current setting of option pageRatio.
Definition: PlanarizationLayoutUML.h:223
ogdf::internal::EdgeArrayBase2
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
Definition: Graph_d.h:716