File: NodeAttributes.h

package info (click to toggle)
tulip 4.8.0dfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 179,264 kB
  • ctags: 64,517
  • sloc: cpp: 600,444; ansic: 36,311; makefile: 22,136; python: 1,304; sh: 946; yacc: 522; xml: 337; pascal: 157; php: 66; lex: 55
file content (181 lines) | stat: -rw-r--r-- 6,254 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
/*
 * $Revision: 2555 $
 *
 * last checkin:
 *   $Author: gutwenger $
 *   $Date: 2012-07-06 12:12:10 +0200 (Fri, 06 Jul 2012) $
 ***************************************************************/

/** \file
 * \brief Declaration of class NodeAttributes.
 *
 * \author Stefan Hachul
 *
 * \par License:
 * This file is part of the Open Graph Drawing Framework (OGDF).
 *
 * \par
 * Copyright (C)<br>
 * See README.txt in the root directory of the OGDF installation for details.
 *
 * \par
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * Version 2 or 3 as published by the Free Software Foundation;
 * see the file LICENSE.txt included in the packaging of this file
 * for details.
 *
 * \par
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * \par
 * You should have received a copy of the GNU General Public
 * License along with this program; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 *
 * \see  http://www.gnu.org/copyleft/gpl.html
 ***************************************************************/


#ifdef _MSC_VER
#pragma once
#endif

#ifndef OGDF_NODE_ATTRIBUTES_H
#define OGDF_NODE_ATTRIBUTES_H

#include <ogdf/basic/geometry.h>
#include <ogdf/basic/Graph.h>
#include <ogdf/basic/List.h>

namespace ogdf {

class OGDF_EXPORT NodeAttributes
{
	//helping data structure that stores the graphical attributes of a node
	//that are needed for the force-directed algorithms.


	//outputstream for NodeAttributes
	friend ostream &operator<< (ostream &,const NodeAttributes &);

	//inputstream for NodeAttributes
	friend istream &operator>> (istream &,NodeAttributes &);

public:

	NodeAttributes();       //constructor
	~NodeAttributes() { }   //destructor

	void set_NodeAttributes(double w, double h, DPoint pos,node v_low,node
		v_high)
	{
		width = w;
		height = h;
		position = pos;
		v_lower_level = v_low;
		v_higher_level = v_high;
	}

	void set_position(DPoint pos) {position = pos;}
	void set_width(double w) {width = w;}
	void set_height(double h) {height = h;}
	void set_x(double x) {position.m_x = x;}
	void set_y(double y) {position.m_y = y;}

	DPoint get_position() const { return position; }
	double get_x() const {return position.m_x;}
	double get_y() const {return position.m_y;}
	double get_width() const {return width;}
	double get_height() const {return height;}


	//for preprocessing step in FMMM

	void set_original_node (node v) {v_lower_level = v;}
	void set_copy_node (node v) {v_higher_level = v;}
	node get_original_node() const {return v_lower_level;}
	node get_copy_node() const {return v_higher_level;}

	//for divide et impera step in FMMM (set/get_original_node() are needed, too)

	void set_subgraph_node (node v) {v_higher_level = v;}
	node get_subgraph_node() const {return v_higher_level;}

	//for the multilevel step in FMMM

	void set_lower_level_node (node v) {v_lower_level = v;}
	void set_higher_level_node (node v) {v_higher_level = v;}
	node get_lower_level_node() const {return v_lower_level;}
	node get_higher_level_node() const {return v_higher_level;}
	void set_mass(int m) {mass = m;}
	void set_type(int t) {type = t;}
	void set_dedicated_sun_node(node v){dedicated_sun_node = v;}
	void set_dedicated_sun_distance(double d) {dedicated_sun_distance = d;}
	void set_dedicated_pm_node(node v) {dedicated_pm_node = v;}
	void place(){placed = true;}
	void set_angle_1(double a) {angle_1 = a;}
	void set_angle_2(double a) {angle_2 = a;}

	int get_mass() const {return mass;}
	int get_type() const {return type;}
	node get_dedicated_sun_node() const {return dedicated_sun_node;}
	double get_dedicated_sun_distance() const {return dedicated_sun_distance;}
	node get_dedicated_pm_node() const {return dedicated_pm_node;}
	bool is_placed() const {return placed;}
	double get_angle_1() const {return angle_1;}
	double get_angle_2() const {return angle_2;}


	List<double>* get_lambda_List_ptr() {return lambda_List_ptr;}
	List<node>* get_neighbour_sun_node_List_ptr() {return neighbour_s_node_List_ptr;}
	List<node>* get_dedicated_moon_node_List_ptr() {return moon_List_ptr;}


	//initialzes all values needed for multilevel representations
	void init_mult_values();

private:

	DPoint position;
	double width;
	double height;

	//for the multilevel and divide et impera and preprocessing step

	node v_lower_level; //the corresponding node in the lower level graph
	node v_higher_level;//the corresponding node in the higher level graph
	//for divide et impera v_lower_level is the original graph and
	//v_higher_level is the copy of the copy of this node in the
	//maximum connected subraph

	//for the multilevel step

	int mass; //the mass (= number of previously collapsed nodes) of this node
	int type; //1 = sun node (s_node); 2 = planet node (p_node) without a dedicate moon
	//3 = planet node with dedicated moons (pm_node);4 = moon node (m_node)
	node dedicated_sun_node; //the dedicates s_node of the solar system of this node
	double dedicated_sun_distance;//the distance to the dedicated sun node of the galaxy
	//of this node
	node dedicated_pm_node;//if type == 4 the dedicated_pm_node is saved here
	List<double> lambda; //the factors lambda for scaling the length of this edge
	//relative to the pass between v's sun and the sun of a
	//neighbour solar system
	List<node> neighbour_s_node;//this is the list of the neighbour solar systems suns
	//lambda[i] corresponds to neighbour_s_node[i]
	List<double>* lambda_List_ptr; //a pointer to the lambda list
	List<node>* neighbour_s_node_List_ptr; //a pointer to to the neighbour_s_node list
	List<node>  moon_List;//the list of all dedicated moon nodes (!= nil if type == 3)
	List<node>* moon_List_ptr;//a pointer to the moon_List
	bool placed;   //indicates weather an initial position has been assigned to this
	//node or not
	double angle_1;//describes the sector where nodes that are not adjacent to other
	double angle_2;//solar systems have to be placed
};

}//namespace ogdf
#endif