Open
Graph Drawing
Framework

 v.2007.11
 

SpringEmbedderFR.h

Go to the documentation of this file.
00001 /*
00002  * $Revision: 1.5 $
00003  * 
00004  * last checkin:
00005  *   $Author: gutwenger $ 
00006  *   $Date: 2007-11-13 21:44:33 +0100 (Di, 13 Nov 2007) $ 
00007  ***************************************************************/
00008  
00052 #ifdef _MSC_VER
00053 #pragma once
00054 #endif
00055 
00056 #ifndef OGDF_SPRING_EMBEDDER_FR_H
00057 #define OGDF_SPRING_EMBEDDER_FR_H
00058 
00059 
00060 #include <ogdf/module/LayoutModule.h>
00061 #include <ogdf/basic/Array2D.h>
00062 
00063 
00064 namespace ogdf {
00065 
00066 
00067     class GraphCopyAttributes;
00068     class GraphCopy;
00069 
00070 
00072 
00109 class SpringEmbedderFR : public LayoutModule
00110 {
00111 public:
00113     enum Scaling {
00114         scInput,           
00115         scUserBoundingBox, 
00116         scScaleFunction    
00117     };
00118 
00119 
00121     SpringEmbedderFR();
00122 
00123     // destructor
00124     ~SpringEmbedderFR() { }
00125 
00126 
00128     void call(GraphAttributes &GA);
00129 
00130 
00132     int iterations() const {
00133         return m_iterations;
00134     }
00135 
00137     void iterations(int i) {
00138         if (i>0)
00139             m_iterations = i;
00140     }
00141 
00143     bool noise() const {
00144         return m_noise;
00145     }
00146 
00148     void noise(bool on) {
00149         m_noise = on;
00150     }
00151     
00153     double minDistCC() const { return m_minDistCC; }
00154 
00156     void minDistCC(double x) { m_minDistCC = x; }
00157 
00159     double pageRatio() { return m_pageRatio; }
00160 
00162     void pageRatio(double x) { m_pageRatio = x; }
00163 
00165     Scaling scaling() const {
00166         return m_scaling;
00167     }
00168 
00170     void scaling(Scaling sc) {
00171         m_scaling = sc;
00172     }
00173 
00175     double scaleFunctionFactor() const {
00176         return m_scaleFactor;
00177     }
00178 
00180     void scaleFunctionFactor(double f) {
00181         m_scaleFactor = f;
00182     }
00183 
00185     void userBoundingBox(double xmin, double ymin, double xmax, double ymax) {
00186         m_bbXmin = xmin;
00187         m_bbYmin = ymin;
00188         m_bbXmax = xmax;
00189         m_bbYmax = ymax;
00190     }
00191 
00192 private:
00193     bool initialize(GraphCopy &G, GraphCopyAttributes &AG);
00194 
00195     void mainStep(GraphCopy &G, GraphCopyAttributes &AG);
00196     void cleanup() {
00197         delete m_A;
00198         m_A = 0;
00199     }
00200     
00201     NodeArray<ListIterator<node> > m_lit; 
00202 
00203     int m_cF;
00204     
00205     double m_width;
00206     double m_height; 
00207 
00208     double m_txNull;
00209     double m_tyNull;
00210     double m_tx;
00211     double m_ty;
00212 
00213     double m_k;
00214     double m_k2;
00215     double m_kk;
00216     int m_ki;
00217     
00218     int m_xA;
00219     int m_yA;
00220 
00221     Array2D<List<node> > *m_A;
00222 
00223 
00224     double mylog2(int x) {
00225         double l = 0.0;
00226         while(x > 0) {
00227             l++;
00228             x >>= 1;
00229         }
00230         return l/2;
00231     }
00232 
00233     int    m_iterations;  
00234     double m_fineness;    
00235     double m_edgeLength;
00236 
00237     double m_xleft;       
00238     double m_xright;      
00239     double m_ysmall;      
00240     double m_ybig;        
00241 
00242     bool m_noise;         
00243 
00244     Scaling m_scaling;    
00245     double m_scaleFactor; 
00246     
00247     double m_bbXmin; 
00248     double m_bbYmin; 
00249     double m_bbXmax; 
00250     double m_bbYmax; 
00251 
00252     double m_minDistCC; 
00253     double m_pageRatio; 
00254 };
00255 
00256 
00257 } // end namespace ogdf
00258 
00259 
00260 #endif


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

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