Open
Graph Drawing
Framework

 v.2010.10
 

NodeAttributes.h

Go to the documentation of this file.
00001 /*
00002  * $Revision: 2027 $
00003  * 
00004  * last checkin:
00005  *   $Author: gutwenger $ 
00006  *   $Date: 2010-09-01 11:55:17 +0200 (Wed, 01 Sep 2010) $ 
00007  ***************************************************************/
00008  
00053 #ifdef _MSC_VER
00054 #pragma once
00055 #endif
00056 
00057 #ifndef OGDF_NODE_ATTRIBUTES_H
00058 #define OGDF_NODE_ATTRIBUTES_H
00059 
00060 #include <ogdf/basic/geometry.h>
00061 #include <ogdf/basic/Graph.h>
00062 #include <ogdf/basic/List.h>
00063 
00064 namespace ogdf {
00065 
00066 class OGDF_EXPORT NodeAttributes
00067 {
00068    //helping data structure that stores the graphical attributes of a node
00069    //that are needed for the force-directed algorithms. 
00070  
00071 
00072    //outputstream for NodeAttributes
00073    friend ostream &operator<< (ostream &,const NodeAttributes &);
00074    
00075    //inputstream for NodeAttributes
00076    friend istream &operator>> (istream &,NodeAttributes &);
00077            
00078    public:
00079       
00080       NodeAttributes();    //constructor
00081       ~NodeAttributes();   //destructor
00082       
00083       void set_NodeAttributes(double w, double h, DPoint pos,node v_low,node
00084                   v_high)
00085       {
00086        width = w;
00087        height = h;
00088        position = pos;
00089        v_lower_level = v_low;
00090        v_higher_level = v_high;
00091       } 
00092 
00093       void set_position(DPoint pos) {position = pos;}
00094       void set_width(double w) {width = w;}
00095       void set_height(double h) {height = h;}    
00096       void set_x(double x) {position.m_x = x;}
00097       void set_y(double y) {position.m_y = y;}   
00098 
00099       DPoint get_position() const { return position; }  
00100       double get_x() const {return position.m_x;}
00101       double get_y() const {return position.m_y;}
00102       double get_width() const {return width;}
00103       double get_height() const {return height;}
00104 
00105       
00106       //for preprocessing step in FMMM
00107     
00108       void set_original_node (node v) {v_lower_level = v;}
00109       void set_copy_node (node v) {v_higher_level = v;}
00110       node get_original_node() const {return v_lower_level;}
00111       node get_copy_node() const {return v_higher_level;}
00112 
00113       //for divide et impera step in FMMM (set/get_original_node() are needed, too)
00114 
00115       void set_subgraph_node (node v) {v_higher_level = v;}
00116       node get_subgraph_node() const {return v_higher_level;}
00117 
00118       //for the multilevel step in FMMM
00119 
00120       void set_lower_level_node (node v) {v_lower_level = v;}
00121       void set_higher_level_node (node v) {v_higher_level = v;}
00122       node get_lower_level_node() const {return v_lower_level;}
00123       node get_higher_level_node() const {return v_higher_level;}
00124       void set_mass(int m) {mass = m;}
00125       void set_type(int t) {type = t;}
00126       void set_dedicated_sun_node(node v){dedicated_sun_node = v;}
00127       void set_dedicated_sun_distance(double d) {dedicated_sun_distance = d;}
00128       void set_dedicated_pm_node(node v) {dedicated_pm_node = v;} 
00129       void place(){placed = true;}
00130       void set_angle_1(double a) {angle_1 = a;}
00131       void set_angle_2(double a) {angle_2 = a;}
00132 
00133       int get_mass() const {return mass;}
00134       int get_type() const {return type;}
00135       node get_dedicated_sun_node() const {return dedicated_sun_node;}
00136       double get_dedicated_sun_distance() const {return dedicated_sun_distance;}
00137       node get_dedicated_pm_node() const {return dedicated_pm_node;}
00138       bool is_placed() const {return placed;}
00139       double get_angle_1() const {return angle_1;}
00140       double get_angle_2() const {return angle_2;}    
00141     
00142 
00143       List<double>* get_lambda_List_ptr() {return lambda_List_ptr;}
00144       List<node>* get_neighbour_sun_node_List_ptr() {return neighbour_s_node_List_ptr;}
00145       List<node>* get_dedicated_moon_node_List_ptr() {return moon_List_ptr;}
00146 
00147 
00148       //initialzes all values needed for multilevel representations
00149       void init_mult_values();
00150 
00151    private:         
00152 
00153      DPoint position;
00154      double width;
00155      double height;
00156 
00157     //for the multilevel and divide et impera and preprocessing step
00158 
00159     node v_lower_level; //the corresponding node in the lower level graph
00160     node v_higher_level;//the corresponding node in the higher level graph
00161                         //for divide et impera v_lower_level is the original graph and
00162                         //v_higher_level is the copy of the copy of this node in the 
00163                         //maximum connected subraph
00164  
00165     //for the multilevel step
00166 
00167     int mass; //the mass (= number of previously collapsed nodes) of this node
00168     int type; //1 = sun node (s_node); 2 = planet node (p_node) without a dedicate moon
00169               //3 = planet node with dedicated moons (pm_node);4 = moon node (m_node)
00170     node dedicated_sun_node; //the dedicates s_node of the solar system of this node
00171     double dedicated_sun_distance;//the distance to the dedicated sun node of the galaxy
00172                                   //of this node
00173     node dedicated_pm_node;//if type == 4 the dedicated_pm_node is saved here
00174     List<double> lambda; //the factors lambda for scaling the length of this edge
00175                  //relative to the pass between v's sun and the sun of a 
00176                          //neighbour solar system 
00177     List<node> neighbour_s_node;//this is the list of the neighbour solar systems suns
00178                                 //lambda[i] corresponds to neighbour_s_node[i]
00179     List<double>* lambda_List_ptr; //a pointer to the lambda list
00180     List<node>* neighbour_s_node_List_ptr; //a pointer to to the neighbour_s_node list
00181     List<node>  moon_List;//the list of all dedicated moon nodes (!= nil if type == 3) 
00182     List<node>* moon_List_ptr;//a pointer to the moon_List
00183     bool placed;   //indicates weather an initial position has been assigned to this 
00184                    //node or not
00185     double angle_1;//describes the sector where nodes that are not adjacent to other
00186     double angle_2;//solar systems have to be placed 
00187 };
00188 }//namespace ogdf
00189 #endif
00190 
00191