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 00043 #ifdef _MSC_VER 00044 #pragma once 00045 #endif 00046 00047 #ifndef OGDF_FRUCHTERMAN_REINGOLD_H 00048 #define OGDF_FRUCHTERMAN_REINGOLD_H 00049 00050 #include <ogdf/basic/Graph.h> 00051 #include <ogdf/basic/geometry.h> 00052 #include <ogdf/basic/NodeArray.h> 00053 #include <ogdf/internal/energybased/NodeAttributes.h> 00054 #include <ogdf/internal/energybased/EdgeAttributes.h> 00055 00056 namespace ogdf { 00057 00058 class OGDF_EXPORT FruchtermanReingold 00059 { 00060 00061 00062 public: 00063 FruchtermanReingold(); //constructor 00064 ~FruchtermanReingold(); //destructor 00065 00066 //Calculate exact rep. forces for each node. 00067 void calculate_exact_repulsive_forces(const Graph &G,NodeArray<NodeAttributes>& A, 00068 NodeArray<DPoint>& F_rep); 00069 00070 //Grid approximation of rep.forces for each node. 00071 void calculate_approx_repulsive_forces(const Graph &G,NodeArray<NodeAttributes>& 00072 A, NodeArray<DPoint>& F_rep); 00073 00074 //Make all initialisations that are needed for FruchtermanReingold. 00075 void make_initialisations (double boxlength,DPoint down_left_corner,int grid_quotient); 00076 00077 //Import updated information of the drawing area. 00078 void update_boxlength_and_cornercoordinate(double b_l,DPoint d_l_c) 00079 { boxlength = b_l; down_left_corner = d_l_c;} 00080 00081 private: 00082 int _grid_quotient;//for coarsening the FrRe-grid 00083 int max_gridindex; //maximum index of a grid row/column 00084 double boxlength; //length of drawing box 00085 DPoint down_left_corner;//down left corner of drawing box 00086 00087 //Returns the repulsing force_function_value of scalar d. 00088 double f_rep_scalar (double d); 00089 00090 //The number k of rows and colums of the grid is sqrt(|V|) / frGridQuotient() 00091 //(Note that in [FrRe] frGridQuotient() is 2.) 00092 void grid_quotient(int p) { _grid_quotient = ((0<=p) ? p : 2);} 00093 int grid_quotient() const {return _grid_quotient;} 00094 00095 }; 00096 }//namespace ogdf 00097 #endif 00098 00099