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
41
42#include <memory>
43
44namespace ogdf {
45
116public:
119
120 // destructor
122
133 void call(GraphAttributes& GA) { doSimpleCall(GA); }
134
140 virtual void call(UMLGraph& umlGraph) override;
141
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.
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
169#endif
170 }
171
174 doSimpleCall(GA);
175 GA.removeUnnecessaryBendsHV();
176 }
177
178#if 0
180 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
188 */
189 virtual void callFixEmbed(UMLGraph &umlGraph);
190#endif
191
193
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
239
247 void setEmbedder(EmbedderModule* pEmbedder) { m_embedder.reset(pEmbedder); }
248
260 m_planarLayouter.reset(pPlanarLayouter);
261 }
262
270 void setPacker(CCLayoutPackModule* pPacker) { m_packer.reset(pPacker); }
271
278 int numberOfCrossings() const { return m_nCrossings; }
279
282
284
285protected:
287
288 //sorts the additional nodes for piecewise insertion
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
299
300private:
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}
Declaration of interface for algorithms that arrange/pack layouts of connected components.
Defines ogdf::EmbedderModule.
Declaration and implementation of HashArray class.
Declaration of interface for planar layout algorithms for UML diagrams (used in planarization approac...
Declaration of orthogonal representation of planar graphs.
Declaration of CrossingMinimization Module, an interface for crossing minimization algorithms.
Declaration of interface for layout algorithms for UML diagrams.
The parameterized class Array implements dynamic arrays of type E.
Definition Array.h:214
Base class of algorithms that arrange/pack layouts of connected components.
Combinatorial embeddings of planar graphs with modification functionality.
Dynamic arrays indexed with edges.
Definition EdgeArray.h:125
Base class for embedder algorithms.
Faces in a combinatorial embedding.
Stores additional attributes of a graph (like layout information).
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:1435
Dynamic arrays indexed with nodes.
Definition NodeArray.h:125
Class for the representation of nodes.
Definition Graph_d.h:177
Planarized representations (of a connected component) of a graph.
Definition PlanRep.h:57
Planarized representation (of a connected component) of a UMLGraph; allows special handling of hierar...
Definition PlanRepUML.h:48
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.
Interface of UML layout algorithms.
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition config.h:101
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
The namespace for all OGDF objects.