Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
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>
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
52namespace ogdf {
53class PlanRep;
54class PlanRepUML;
55
126public:
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
190 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
248 void setCrossMin(UMLCrossingMinimizationModule* pCrossMin) { m_crossMin.reset(pCrossMin); }
249
257 void setEmbedder(EmbedderModule* pEmbedder) { m_embedder.reset(pEmbedder); }
258
270 m_planarLayouter.reset(pPlanarLayouter);
271 }
272
280 void setPacker(CCLayoutPackModule* pPacker) { m_packer.reset(pPacker); }
281
288 int numberOfCrossings() const { return m_nCrossings; }
289
292
294
295protected:
297
298 //sorts the additional nodes for piecewise insertion
299 void sortIncrementalNodes(List<node>& addNodes, const NodeArray<bool>& fixedNodes);
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
310private:
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}
Declaration and implementation of Array class and Array algorithms.
Declaration of interface for algorithms that arrange/pack layouts of connected components.
Declaration of CombinatorialEmbedding and face.
Defines ogdf::EmbedderModule.
Includes declaration of graph class.
Declaration of class GraphAttributes which extends a Graph by additional attributes.
Declaration and implementation of HashArray class.
Declaration of interface for planar layout algorithms for UML diagrams (used in planarization approac...
Declaration of doubly linked lists and iterators.
Declaration of orthogonal representation of planar graphs.
Declaration of CrossingMinimization Module, an interface for crossing minimization algorithms.
Declaration of class UMLGraph.
Declaration of interface for layout algorithms for UML diagrams.
Declaration of classes GenericPoint, GenericPolyline, GenericLine, GenericSegment,...
Basic declarations, included by all source files.
The parameterized class Array implements dynamic arrays of type E.
Definition Array.h:219
Base class of algorithms that arrange/pack layouts of connected components.
Combinatorial embeddings of planar graphs with modification functionality.
Base class for embedder algorithms.
Faces in a combinatorial embedding.
Stores additional attributes of a graph (like layout information).
void removeUnnecessaryBendsHV()
Removes unnecessary bend points in orthogonal segements.
Indexed arrays using hashing for element access.
Definition HashArray.h:93
Interface for planar UML layout algorithms.
Doubly linked lists (maintaining the length of the list).
Definition List.h:1451
Class for the representation of nodes.
Definition Graph_d.h:241
Planarized representations (of a connected component) of a graph.
Definition PlanRep.h:68
Planarized representation (of a connected component) of a UMLGraph; allows special handling of hierar...
Definition PlanRepUML.h:55
The planarization layout algorithm.
PlanarizationLayoutUML()
Creates an instance of planarization layout and sets options to default values.
void pageRatio(double ratio)
Sets the option pageRatio to ratio.
void call(GraphAttributes &GA)
Calls planarization layout for GraphAttributes GA and computes a layout.
std::unique_ptr< LayoutPlanRepUMLModule > m_planarLayouter
The module for computing a planar layout.
virtual void postProcess(UMLGraph &UG)
double pageRatio() const
Returns the current setting of option pageRatio.
void getFixationDistance(node startNode, HashArray< int, int > &distance, const NodeArray< bool > &fixedNodes)
void setPlanarLayouter(LayoutPlanRepUMLModule *pPlanarLayouter)
Sets the module option for the planar layout algorithm.
void simpleCall(UMLGraph &umlGraph)
Simple call function that does not care about cliques etc.
virtual void callIncremental(UMLGraph &umlgraph, NodeArray< bool > &fixedNodes, const EdgeArray< bool > &fixedEdges)
Incremental call function.
void doSimpleCall(GraphAttributes &GA)
void setCrossMin(UMLCrossingMinimizationModule *pCrossMin)
Sets the module option for UML crossing minimization.
double m_pageRatio
The desired page ratio.
bool m_arrangeLabels
Option for re-arranging labels.
void simpleCall(GraphAttributes &GA)
Simple call function.
virtual void preProcess(UMLGraph &UG)
void reembed(PlanRepUML &PG, int ccNumber, bool l_align=false, bool l_gensExist=false)
std::unique_ptr< EmbedderModule > m_embedder
The module for planar embedding.
void setPacker(CCLayoutPackModule *pPacker)
Sets the module option for the arrangement of connected components.
std::unique_ptr< UMLCrossingMinimizationModule > m_crossMin
The moule for UML crossing minimization.
int m_nCrossings
The number of crossings in the computed layout.
void arrangeCCs(PlanRep &PG, GraphAttributes &GA, Array< DPoint > &boundingBox)
face findBestExternalFace(const PlanRep &PG, const CombinatorialEmbedding &E)
virtual void call(UMLGraph &umlGraph) override
Calls planarization layout for UML-graph umlGraph and computes a mixed-upward layout.
void assureDrawability(UMLGraph &umlGraph)
std::unique_ptr< CCLayoutPackModule > m_packer
The module for arranging connected components.
void sortIncrementalNodes(List< node > &addNodes, const NodeArray< bool > &fixedNodes)
int numberOfCrossings() const
Returns the number of crossings in computed layout.
void setEmbedder(EmbedderModule *pEmbedder)
Sets the module option for the graph embedding algorithm.
Base class for UML crossing minimization algorithms.
void undoGenMergers()
void insertGenMergers()
Merges generalizations at a common superclass.
Interface of UML layout algorithms.
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
Definition Graph_d.h:717
RegisteredArray for nodes, edges and adjEntries of a graph.
Definition Graph_d.h:659
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF dynamic library (shared object / DLL),...
Definition config.h:117
The namespace for all OGDF objects.