Open
Graph Drawing
Framework

 v.2012.05
 

OptimalHierarchyClusterLayout.h
Go to the documentation of this file.
00001 /*
00002  * $Revision: 2299 $
00003  * 
00004  * last checkin:
00005  *   $Author: gutwenger $ 
00006  *   $Date: 2012-05-07 15:57:08 +0200 (Mon, 07 May 2012) $ 
00007  ***************************************************************/
00008  
00044 #ifdef _MSC_VER
00045 #pragma once
00046 #endif
00047 
00048 #ifndef OGDF_OPTIMAL_HIERARCHY_CLUSTER_LAYOUT_H
00049 #define OGDF_OPTIMAL_HIERARCHY_CLUSTER_LAYOUT_H
00050 
00051 
00052 
00053 #include <ogdf/module/HierarchyClusterLayoutModule.h>
00054 #include <ogdf/basic/tuples.h>
00055 
00056 
00057 namespace ogdf {
00058 
00059 
00061 
00097 class OGDF_EXPORT OptimalHierarchyClusterLayout : public HierarchyClusterLayoutModule
00098 {
00099 #ifndef OGDF_LP_SOLVER
00100 protected:
00101     void doCall(const ExtendedNestingGraph& H,ClusterGraphCopyAttributes &ACGC) {
00102         OGDF_THROW_PARAM(LibraryNotSupportedException, lnscCoin);
00103     }
00104 
00105 #else
00106 
00107 public:
00109     OptimalHierarchyClusterLayout();
00110 
00112     OptimalHierarchyClusterLayout(const OptimalHierarchyClusterLayout &);
00113 
00114     // destructor
00115     ~OptimalHierarchyClusterLayout() { }
00116 
00117 
00119     OptimalHierarchyClusterLayout &operator=(const OptimalHierarchyClusterLayout &);
00120 
00121 
00127 
00128     double nodeDistance() const {
00129         return m_nodeDistance;
00130     }
00131 
00133     void nodeDistance(double x) {
00134         if(x >= 0)
00135             m_nodeDistance = x;
00136     }
00137 
00139     double layerDistance() const {
00140         return m_layerDistance;
00141     }
00142 
00144     void layerDistance(double x) {
00145         if(x >= 0)
00146             m_layerDistance = x;
00147     }
00148 
00150 
00154     bool fixedLayerDistance() const {
00155         return m_fixedLayerDistance;
00156     }
00157 
00159     void fixedLayerDistance(bool b) {
00160         m_fixedLayerDistance = b;
00161     }
00162 
00164     double weightSegments() const {
00165         return m_weightSegments;
00166     }
00167 
00169     void weightSegments(double w) {
00170         if(w > 0.0 && w <= 100.0)
00171             m_weightSegments = w;
00172     }
00173 
00175     double weightBalancing() const {
00176         return m_weightBalancing;
00177     }
00178 
00180     void weightBalancing(double w) {
00181         if(w >= 0.0 && w <= 100.0)
00182             m_weightBalancing = w;
00183     }
00184 
00186     double weightClusters() const {
00187         return m_weightClusters;
00188     }
00189 
00191     void weightClusters(double w) {
00192         if(w > 0.0 && w <= 100.0)
00193             m_weightClusters = w;
00194     }
00195 
00197 
00198 protected:
00200     void doCall(const ExtendedNestingGraph& H,ClusterGraphCopyAttributes &ACGC);
00201 
00202 private:
00203     void buildLayerList(
00204         const LHTreeNode *vNode,
00205         List<Tuple2<int,double> > &L);
00206 
00207     void computeXCoordinates(
00208         const ExtendedNestingGraph& H,
00209         ClusterGraphCopyAttributes &AGC);
00210     void computeYCoordinates(
00211         const ExtendedNestingGraph& H,
00212         ClusterGraphCopyAttributes &AGC);
00213 
00214     // options
00215     double m_nodeDistance;       
00216     double m_layerDistance;      
00217     bool   m_fixedLayerDistance; 
00218 
00219     double m_weightSegments;  
00220     double m_weightBalancing; 
00221     double m_weightClusters;  
00222 
00223     // auxiliary data
00224     ClusterGraphCopyAttributes *m_pACGC;
00225     const ExtendedNestingGraph *m_pH;
00226 
00227     int m_vertexOffset;
00228     int m_segmentOffset;
00229     int m_clusterLeftOffset;
00230     int m_clusterRightOffset;
00231 
00232     NodeArray<bool>   m_isVirtual;
00233     NodeArray<int>    m_vIndex;
00234     ClusterArray<int> m_cIndex;
00235 
00236 #endif
00237 };
00238 
00239 }
00240 
00241 
00242 #endif