Open
Graph Drawing
Framework

 v.2012.05
 

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