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/HashArray.h>
41 
42 #include <memory>
43 
44 namespace ogdf {
45 
116 public:
119 
120  // destructor
122 
133  void call(GraphAttributes& GA) { doSimpleCall(GA); }
134 
140  virtual void call(UMLGraph& umlGraph) override;
141 
143  void simpleCall(UMLGraph& umlGraph) {
144  //this simple call method does not care about any special treatments
145  //of subgraphs, layout informations etc., therefore we save the
146  //option status and set them back later on
147 #if 0
148  //cliques are only handled for UMLGraphs, so it is save to
149  //only set this value here and not in the GraphAttributes interface method.
150  bool l_saveCliqueHandling = m_processCliques;
151  m_processCliques = false;
152 #endif
153 
154  // preprocessing: insert a merger for generalizations
155 
156  preProcess(umlGraph);
157  umlGraph.insertGenMergers();
158 
159  doSimpleCall(umlGraph);
160 
161  umlGraph.undoGenMergers();
162 
163  umlGraph.removeUnnecessaryBendsHV();
164 
165  postProcess(umlGraph);
166 
167 #if 0
168  m_processCliques = l_saveCliqueHandling;
169 #endif
170  }
171 
174  doSimpleCall(GA);
176  }
177 
178 #if 0
179  virtual void callSimDraw(UMLGraph &umlGraph);
181 
182  **
183  * \brief Calls planarization layout with fixed embedding given by \p umlGraph.
184  * \pre The graph has no self-loops.
185  * @param umlGraph is the input graph and will also be assigned the layout information.
186  * The fixed embedding is obtained from the layout information (node
187  * coordinates, bend points) in \p umlGraph.
188  */
189  virtual void callFixEmbed(UMLGraph &umlGraph);
190 #endif
191 
193 
199  virtual void callIncremental(UMLGraph& umlgraph, NodeArray<bool>& fixedNodes,
200  const EdgeArray<bool>& fixedEdges);
201 
213  double pageRatio() const { return m_pageRatio; }
214 
216  void pageRatio(double ratio) { m_pageRatio = ratio; }
217 
218  //set the option field for the planar layouter
219  void setLayouterOptions(int ops) { m_planarLayouter->setOptions(ops); }
220 
221  //draw hierarchy nodes corresponding to their level
222  void alignSons(bool b) {
223  int opts = m_planarLayouter->getOptions();
224 
225  if (b) {
226  m_planarLayouter->setOptions(opts | UMLOpt::OpAlign);
227  } else {
228  m_planarLayouter->setOptions(opts & ~UMLOpt::OpAlign);
229  }
230  }
231 
237  void setCrossMin(UMLCrossingMinimizationModule* pCrossMin) { m_crossMin.reset(pCrossMin); }
239 
247  void setEmbedder(EmbedderModule* pEmbedder) { m_embedder.reset(pEmbedder); }
248 
259  void setPlanarLayouter(LayoutPlanRepUMLModule* pPlanarLayouter) {
260  m_planarLayouter.reset(pPlanarLayouter);
261  }
262 
270  void setPacker(CCLayoutPackModule* pPacker) { m_packer.reset(pPacker); }
271 
277  int numberOfCrossings() const { return m_nCrossings; }
279 
281  void assureDrawability(UMLGraph& umlGraph);
282 
284 
285 protected:
286  void doSimpleCall(GraphAttributes& GA);
287 
288  //sorts the additional nodes for piecewise insertion
289  void sortIncrementalNodes(List<node>& addNodes, const NodeArray<bool>& fixedNodes);
290  void getFixationDistance(node startNode, HashArray<int, int>& distance,
291  const NodeArray<bool>& fixedNodes);
292  //reembeds already planarized PG in case of errors
293  void reembed(PlanRepUML& PG, int ccNumber, bool l_align = false, bool l_gensExist = false);
294 
295  virtual void preProcess(UMLGraph& UG);
296  virtual void postProcess(UMLGraph& UG); //redo changes at original
297 
298  void arrangeCCs(PlanRep& PG, GraphAttributes& GA, Array<DPoint>& boundingBox);
299 
300 private:
301  face findBestExternalFace(const PlanRep& PG, const CombinatorialEmbedding& E);
302 
304  std::unique_ptr<UMLCrossingMinimizationModule> m_crossMin;
305 
307  std::unique_ptr<EmbedderModule> m_embedder;
308 
310  std::unique_ptr<LayoutPlanRepUMLModule> m_planarLayouter;
311 
313  std::unique_ptr<CCLayoutPackModule> m_packer;
314 
315  double m_pageRatio;
318 
319  // temporary changes to avoid errors
320  List<edge> m_fakedGens; // made to associations
322 };
323 
324 }
ogdf::PlanarizationLayoutUML::m_packer
std::unique_ptr< CCLayoutPackModule > m_packer
The module for arranging connected components.
Definition: PlanarizationLayoutUML.h:313
HashArray.h
Declaration and implementation of HashArray class.
ogdf
The namespace for all OGDF objects.
Definition: AugmentationModule.h:36
ogdf::PlanarizationLayoutUML::m_arrangeLabels
bool m_arrangeLabels
Option for re-arranging labels.
Definition: PlanarizationLayoutUML.h:317
ogdf::GraphAttributes
Stores additional attributes of a graph (like layout information).
Definition: GraphAttributes.h:66
ogdf::PlanarizationLayoutUML::m_fakedGens
List< edge > m_fakedGens
Definition: PlanarizationLayoutUML.h:320
ogdf::PlanarizationLayoutUML::simpleCall
void simpleCall(GraphAttributes &GA)
Simple call function.
Definition: PlanarizationLayoutUML.h:173
ogdf::LayoutPlanRepUMLModule
Interface for planar UML layout algorithms.
Definition: LayoutPlanRepUMLModule.h:46
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:316
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:310
ogdf::PlanarizationLayoutUML::m_fakeTree
bool m_fakeTree
Definition: PlanarizationLayoutUML.h:321
ogdf::PlanarizationLayoutUML::m_crossMin
std::unique_ptr< UMLCrossingMinimizationModule > m_crossMin
The moule for UML crossing minimization.
Definition: PlanarizationLayoutUML.h:304
ogdf::PlanarizationLayoutUML::simpleCall
void simpleCall(UMLGraph &umlGraph)
Simple call function that does not care about cliques etc.
Definition: PlanarizationLayoutUML.h:143
ogdf::UMLGraph::insertGenMergers
void insertGenMergers()
Merges generalizations at a common superclass.
ogdf::PlanarizationLayoutUML::alignSons
void alignSons(bool b)
Definition: PlanarizationLayoutUML.h:222
ogdf::PlanarizationLayoutUML::m_pageRatio
double m_pageRatio
The desired page ratio.
Definition: PlanarizationLayoutUML.h:315
ogdf::PlanarizationLayoutUML::~PlanarizationLayoutUML
virtual ~PlanarizationLayoutUML()
Definition: PlanarizationLayoutUML.h:121
ogdf::PlanarizationLayoutUML::setEmbedder
void setEmbedder(EmbedderModule *pEmbedder)
Sets the module option for the graph embedding algorithm.
Definition: PlanarizationLayoutUML.h:247
ogdf::CCLayoutPackModule
Base class of algorithms that arrange/pack layouts of connected components.
Definition: CCLayoutPackModule.h:46
ogdf::PlanarizationLayoutUML::m_embedder
std::unique_ptr< EmbedderModule > m_embedder
The module for planar embedding.
Definition: PlanarizationLayoutUML.h:307
ogdf::UMLCrossingMinimizationModule
Base class for UML crossing minimization algorithms.
Definition: UMLCrossingMinimizationModule.h:41
ogdf::PlanarizationLayoutUML::pageRatio
void pageRatio(double ratio)
Sets the option pageRatio to ratio.
Definition: PlanarizationLayoutUML.h:216
OrthoRep.h
Declaration of orthogonal representation of planar graphs.
ogdf::UMLLayoutModule
Interface of UML layout algorithms.
Definition: UMLLayoutModule.h:43
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:63
ogdf::List< edge >
ogdf::internal::GraphRegisteredArray
RegisteredArray for nodes, edges and adjEntries of a graph.
Definition: Graph_d.h:651
ogdf::PlanarizationLayoutUML
The planarization layout algorithm.
Definition: PlanarizationLayoutUML.h:115
ogdf::UMLGraph
Definition: UMLGraph.h:40
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:259
ogdf::face
FaceElement * face
Definition: CombinatorialEmbedding.h:40
ogdf::EmbedderModule
Base class for embedder algorithms.
Definition: EmbedderModule.h:49
ogdf::PlanarizationLayoutUML::setLayouterOptions
void setLayouterOptions(int ops)
Definition: PlanarizationLayoutUML.h:219
UMLLayoutModule.h
Declaration of interface for layout algorithms for UML diagrams.
ogdf::PlanarizationLayoutUML::call
void call(GraphAttributes &GA)
Calls planarization layout for GraphAttributes GA and computes a layout.
Definition: PlanarizationLayoutUML.h:133
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.
ogdf::PlanarizationLayoutUML::setPacker
void setPacker(CCLayoutPackModule *pPacker)
Sets the module option for the arrangement of connected components.
Definition: PlanarizationLayoutUML.h:270
ogdf::NodeElement
Class for the representation of nodes.
Definition: Graph_d.h:233
ogdf::PlanarizationLayoutUML::pageRatio
double pageRatio() const
Returns the current setting of option pageRatio.
Definition: PlanarizationLayoutUML.h:213
ogdf::internal::EdgeArrayBase2
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
Definition: Graph_d.h:709