Open
Graph Drawing
Framework

 v.2012.05
 

OptimalHierarchyLayout.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_LAYOUT_H
00049 #define OGDF_OPTIMAL_HIERARCHY_LAYOUT_H
00050 
00051 
00052 
00053 #include <ogdf/module/HierarchyLayoutModule.h>
00054 
00055 
00056 namespace ogdf {
00057 
00058 
00060 
00093 class OGDF_EXPORT OptimalHierarchyLayout : public HierarchyLayoutModule
00094 {
00095 #ifndef OGDF_LP_SOLVER
00096 protected:
00097     void doCall(const Hierarchy& /*H*/, GraphCopyAttributes & /*AGC*/) {
00098         OGDF_THROW_PARAM(LibraryNotSupportedException, lnscCoin);
00099     }
00100 
00101 #else
00102 
00103 public:
00105     OptimalHierarchyLayout();
00106 
00108     OptimalHierarchyLayout(const OptimalHierarchyLayout &);
00109 
00110     // destructor
00111     ~OptimalHierarchyLayout() { }
00112 
00113 
00115     OptimalHierarchyLayout &operator=(const OptimalHierarchyLayout &);
00116 
00117 
00123 
00124     double nodeDistance() const {
00125         return m_nodeDistance;
00126     }
00127 
00129     void nodeDistance(double x) {
00130         if(x >= 0)
00131             m_nodeDistance = x;
00132     }
00133 
00135     double layerDistance() const {
00136         return m_layerDistance;
00137     }
00138 
00140     void layerDistance(double x) {
00141         if(x >= 0)
00142             m_layerDistance = x;
00143     }
00144 
00146 
00150     bool fixedLayerDistance() const {
00151         return m_fixedLayerDistance;
00152     }
00153 
00155     void fixedLayerDistance(bool b) {
00156         m_fixedLayerDistance = b;
00157     }
00158 
00160     double weightSegments() const {
00161         return m_weightSegments;
00162     }
00163 
00165     void weightSegments(double w) {
00166         if(w > 0.0 && w <= 100.0)
00167             m_weightSegments = w;
00168     }
00169 
00171     double weightBalancing() const {
00172         return m_weightBalancing;
00173     }
00174 
00176     void weightBalancing(double w) {
00177         if(w >= 0.0 && w <= 100.0)
00178             m_weightBalancing = w;
00179     }
00180 
00182 
00183 protected:
00185     void doCall(const Hierarchy& H,GraphCopyAttributes &AGC);
00186 
00187 private:
00188     void computeXCoordinates(
00189         const Hierarchy& H,
00190         GraphCopyAttributes &AGC);
00191     void computeYCoordinates(
00192         const Hierarchy& H,
00193         GraphCopyAttributes &AGC);
00194 
00195     // options
00196     double m_nodeDistance;  
00197     double m_layerDistance; 
00198     bool   m_fixedLayerDistance; 
00199 
00200     double m_weightSegments;  
00201     double m_weightBalancing; 
00202 
00203 #endif
00204 };
00205 
00206 }
00207 
00208 
00209 #endif