Open
Graph Drawing
Framework

 v.2007.11
 

SugiyamaLayout.h

Go to the documentation of this file.
00001 /*
00002  * $Revision: 1.4 $
00003  * 
00004  * last checkin:
00005  *   $Author: gutwenger $ 
00006  *   $Date: 2007-11-12 21:15:31 +0100 (Mo, 12 Nov 2007) $ 
00007  ***************************************************************/
00008  
00051 #ifdef _MSC_VER
00052 #pragma once
00053 #endif
00054 
00055 #ifndef OGDF_SUGIYAMA_LAYOUT_H
00056 #define OGDF_SUGIYAMA_LAYOUT_H
00057 
00058 
00059 
00060 #include <ogdf/module/LayoutModule.h>
00061 #include <ogdf/module/RankingModule.h>
00062 #include <ogdf/simultaneous/TwoLayerCrossMinSimDraw.h>
00063 #include <ogdf/module/HierarchyLayoutModule.h>
00064 #include <ogdf/module/HierarchyClusterLayoutModule.h>
00065 #include <ogdf/module/CCLayoutPackModule.h>
00066 #include <ogdf/basic/ModuleOption.h>
00067 #include <ogdf/cluster/ClusterGraphAttributes.h>
00068 
00069 
00070 namespace ogdf {
00071 
00072     class ExtendedNestingGraph;
00073 
00183 class SugiyamaLayout : public LayoutModule {
00184 
00185 protected:
00186 
00188     ModuleOption<RankingModule>                m_ranking;
00189 
00191     ModuleOption<TwoLayerCrossMin>             m_crossMin;
00192 
00193     ModuleOption<TwoLayerCrossMinSimDraw>      m_crossMinSimDraw;
00194 
00196     ModuleOption<HierarchyLayoutModule>        m_layout;
00197 
00199     ModuleOption<HierarchyClusterLayoutModule> m_clusterLayout;
00200 
00202     ModuleOption<CCLayoutPackModule>           m_packer;
00203 
00204     int    m_fails;      
00205     int    m_runs;       
00206     bool   m_transpose;  
00207     bool   m_arrangeCCs; 
00208     double m_minDistCC;  
00209     double m_pageRatio;  
00210 
00211     int m_nCrossings;    
00212     RCCrossings m_nCrossingsCluster;
00213     Array<bool> m_levelChanged;
00214 
00215     bool m_alignBaseClasses; 
00216     bool m_alignSiblings;    
00217     
00218     EdgeArray<unsigned int> *m_subgraphs; 
00219 
00220 public:
00221 
00223     SugiyamaLayout();
00224 
00225     // destructor
00226     ~SugiyamaLayout() { }
00227 
00228 
00239     void call(GraphAttributes &AG);
00240 
00246     void call(ClusterGraphAttributes &AG);
00247 
00256     void call(GraphAttributes &AG, NodeArray<int> &rank);
00257 
00258     // special call for UML graphs
00259     void callUML(GraphAttributes &AG);
00260 
00261 
00274     int fails() const { return m_fails; }
00275 
00277     void fails(int nFails) { m_fails = nFails; }
00278 
00287     int runs() const { return m_runs; }
00288 
00290     void runs(int nRuns) { m_runs = nRuns; }
00291 
00299     bool transpose() const { return m_transpose; }
00300 
00302     void transpose(bool bTranspose) { m_transpose = bTranspose; }
00303 
00310     bool arrangeCCs() const { return m_arrangeCCs; }
00311 
00313     void arrangeCCs(bool bArrange) { m_arrangeCCs = bArrange; }
00314 
00321     double minDistCC() const { return m_minDistCC; }
00322 
00324     void minDistCC(double x) { m_minDistCC = x; }
00325 
00333     double pageRatio() const { return m_pageRatio; }
00334 
00336     void pageRatio(double x) { m_pageRatio = x; }
00337 
00344     bool alignBaseClasses() const { return m_alignBaseClasses; }
00345 
00347     void alignBaseClasses(bool b) { m_alignBaseClasses = b; }
00348 
00355     bool alignSiblings() const { return m_alignSiblings; }
00356 
00358     void alignSiblings(bool b) { m_alignSiblings = b; }
00359 
00361     void setSubgraphs(EdgeArray<unsigned int> *esg) { m_subgraphs = esg; }
00362 
00364     bool useSubgraphs() const { return (m_subgraphs == 0) ? 0 : 1; }
00365 
00366 
00382     void setRanking(RankingModule *pRanking) {
00383         m_ranking.set(pRanking);
00384     }
00385 
00392     void setCrossMin(TwoLayerCrossMin *pCrossMin) {
00393         m_crossMin.set(pCrossMin);
00394     }
00395 
00403     void setLayout(HierarchyLayoutModule *pLayout) {
00404         m_layout.set(pLayout);
00405     }
00406 
00414     void setClusterLayout(HierarchyClusterLayoutModule *pLayout) {
00415         m_clusterLayout.set(pLayout);
00416     }
00417 
00425     void setPacker(CCLayoutPackModule *pPacker) {
00426         m_packer.set(pPacker);
00427     }
00428 
00435 
00436     int numberOfCrossings() const { return m_nCrossings; }
00437 
00439     RCCrossings numberOfCrossingsCluster() const { return m_nCrossingsCluster; }
00440 
00442 
00443 protected:
00444 
00445     void reduceCrossings(Hierarchy &H);
00446     void reduceCrossings(ExtendedNestingGraph &H);
00447 
00448 private:
00449     int m_numCC;
00450     NodeArray<int> m_compGC;
00451 
00452     void doCall(GraphAttributes &AG, bool umlCall);
00453     void doCall(GraphAttributes &AG, bool umlCall, NodeArray<int> &rank);
00454 
00455     int traverseTopDown (Hierarchy &H);
00456     int traverseBottomUp(Hierarchy &H);
00457 
00458     bool transposeLevel(int i, Hierarchy &H);
00459     void doTranspose(Hierarchy &H);
00460     void doTransposeRev(Hierarchy &H);
00461 
00462     RCCrossings traverseTopDown (ExtendedNestingGraph &H);
00463     RCCrossings traverseBottomUp(ExtendedNestingGraph &H);
00464 };
00465 
00466 
00467 }
00468 
00469 #endif


© 1999-2007 by oreas GmbH, © 2005-2007 by University Dortmund and University Cologne.

Generated on Thu Nov 22 19:40:03 2007 by doxygen 1.5.4.