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_SPRING_EMBEDDER_FR_H 00049 #define OGDF_SPRING_EMBEDDER_FR_H 00050 00051 00052 #include <ogdf/module/LayoutModule.h> 00053 #include <ogdf/basic/Array2D.h> 00054 00055 00056 namespace ogdf { 00057 00058 00059 class OGDF_EXPORT GraphCopyAttributes; 00060 class OGDF_EXPORT GraphCopy; 00061 00062 00064 00101 class OGDF_EXPORT SpringEmbedderFR : public LayoutModule 00102 { 00103 public: 00105 enum Scaling { 00106 scInput, 00107 scUserBoundingBox, 00108 scScaleFunction 00109 }; 00110 00111 00113 SpringEmbedderFR(); 00114 00115 // destructor 00116 ~SpringEmbedderFR() { } 00117 00118 00120 void call(GraphAttributes &GA); 00121 00122 00124 int iterations() const { 00125 return m_iterations; 00126 } 00127 00129 void iterations(int i) { 00130 if (i>0) 00131 m_iterations = i; 00132 } 00133 00134 double fineness() const { 00135 return m_fineness; 00136 } 00137 00138 void fineness(double f) { 00139 m_fineness = f; 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