Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00053 #ifdef _MSC_VER
00054 #pragma once
00055 #endif
00056
00057 #ifndef OGDF_UML_PLANARIZATION_LAYOUT_H
00058 #define OGDF_UML_PLANARIZATION_LAYOUT_H
00059
00060
00061
00062 #include <ogdf/module/UMLLayoutModule.h>
00063 #include <ogdf/module/PlanarSubgraphModule.h>
00064 #include <ogdf/module/EdgeInsertionModule.h>
00065 #include <ogdf/module/LayoutPlanRepModule.h>
00066 #include <ogdf/module/CCLayoutPackModule.h>
00067 #include <ogdf/basic/ModuleOption.h>
00068 #include <ogdf/module/EmbedderModule.h>
00069 #include <ogdf/basic/HashArray.h>
00070
00071
00072
00073 namespace ogdf {
00074
00075
00151 class OGDF_EXPORT PlanarizationLayout : public UMLLayoutModule
00152 {
00153 public:
00155 PlanarizationLayout();
00156
00157
00158 virtual ~PlanarizationLayout() { }
00159
00170 void call(GraphAttributes &GA) {
00171 doSimpleCall(&GA, 0);
00172 }
00173
00179 virtual void call(UMLGraph ¨Graph);
00180
00182 void simpleCall(UMLGraph ¨Graph) {
00183 doSimpleCall(¨Graph, ¨Graph);
00184 }
00185
00187 virtual void callSimDraw(UMLGraph ¨Graph);
00188
00196 virtual void callFixEmbed(UMLGraph ¨Graph);
00197
00198
00199
00200
00201
00202
00203 virtual void callIncremental(UMLGraph ¨graph,
00204 NodeArray<bool> &fixedNodes, const EdgeArray<bool> &fixedEdges);
00205
00206
00218 double pageRatio() const {
00219 return m_pageRatio;
00220 }
00221
00223 void pageRatio(double ratio) {
00224 m_pageRatio = ratio;
00225 }
00226
00236 bool preprocessCliques() const {
00237 return m_processCliques;
00238 }
00239
00241 void preprocessCliques(bool b) {
00242 m_processCliques = b;
00243 }
00244
00251 int minCliqueSize() const {
00252 return m_cliqueSize;
00253 }
00254
00256 void minCliqueSize(int i) {
00257 m_cliqueSize = max(i, 3);
00258 }
00259
00260
00261 void setLayouterOptions(int ops)
00262 {m_planarLayouter.get().setOptions(ops);}
00263
00264
00265 void alignSons(bool b)
00266 {
00267 int opts = m_planarLayouter.get().getOptions();
00268
00269 if (b) m_planarLayouter.get().setOptions(opts | umlOpAlign);
00270 else m_planarLayouter.get().setOptions(opts & ~umlOpAlign);
00271 }
00272
00273
00285 void setSubgraph(PlanarSubgraphModule *pSubgraph) {
00286 m_subgraph.set(pSubgraph);
00287 }
00288
00297 void setInserter(EdgeInsertionModule *pInserter) {
00298 m_inserter.set(pInserter);
00299 }
00300
00308 void setEmbedder(EmbedderModule *pEmbedder) {
00309 m_embedder.set(pEmbedder);
00310 }
00311
00322 void setPlanarLayouter(LayoutPlanRepModule *pPlanarLayouter) {
00323 m_planarLayouter.set(pPlanarLayouter);
00324 }
00325
00333 void setPacker(CCLayoutPackModule *pPacker) {
00334 m_packer.set(pPacker);
00335 }
00336
00342
00343 int numberOfCrossings() const {
00344 return m_nCrossings;
00345 }
00346
00348 void assureDrawability(UMLGraph& umlGraph);
00349
00351
00352 protected:
00353 void doSimpleCall(GraphAttributes *pGA, UMLGraph *pUmlGraph);
00354
00355
00356 void sortIncrementalNodes(List<node> &addNodes, const NodeArray<bool> &fixedNodes);
00357 void getFixationDistance(node startNode, HashArray<int, int> &distance,
00358 const NodeArray<bool> &fixedNodes);
00359
00360 void reembed(PlanRepUML &PG, int ccNumber, bool l_align = false,
00361 bool l_gensExist = false);
00362
00363 virtual void preProcess(UMLGraph &UG);
00364 virtual void postProcess(UMLGraph& UG);
00365
00366
00367 void fillAdjNodes(List<node>& adjNodes, PlanRepUML& PG, node centerNode,
00368 NodeArray<bool>& isClique, Layout& drawing);
00369
00370 void arrangeCCs(PlanRep &PG, GraphAttributes &GA, Array<DPoint> &boundingBox);
00371
00372 private:
00374 ModuleOption<PlanarSubgraphModule> m_subgraph;
00375
00377 ModuleOption<EdgeInsertionModule> m_inserter;
00378
00380 ModuleOption<EmbedderModule> m_embedder;
00381
00383 ModuleOption<LayoutPlanRepModule> m_planarLayouter;
00384
00386 ModuleOption<CCLayoutPackModule> m_packer;
00387
00388 double m_pageRatio;
00389 int m_nCrossings;
00390 bool m_arrangeLabels;
00391 bool m_processCliques;
00392 int m_cliqueSize;
00393
00394
00395 List<edge> m_fakedGens;
00396 bool m_fakeTree;
00397
00398 face findBestExternalFace(
00399 const PlanRep &PG,
00400 const CombinatorialEmbedding &E);
00401 };
00402
00403
00404
00405
00406
00408 class AddNodeComparer
00409 {
00410 HashArray<int, int> *m_indToDeg;
00411
00412 public:
00413 AddNodeComparer(HashArray<int, int> &ha) : m_indToDeg(&ha) { }
00414
00415 int compare(const node &v1, const node &v2) const {
00416 if ((*m_indToDeg)[v1->index()] < (*m_indToDeg)[v2->index()])
00417 return 1;
00418 else if ((*m_indToDeg)[v1->index()] > (*m_indToDeg)[v2->index()])
00419 return -1;
00420 else
00421 return 0;
00422 }
00423
00424 OGDF_AUGMENT_COMPARER(node)
00425 };
00426
00427
00428 }
00429
00430
00431 #endif