Color handling of maps is a bit better now.
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/color.lgf Mon Nov 06 15:40:44 2006 +0000
1.3 @@ -0,0 +1,368 @@
1.4 +@nodeset
1.5 +coordinates_x coordinates_y label
1.6 +-357 -128 1
1.7 +-298 -135 2
1.8 +-229 -140 3
1.9 +-160 -146 4
1.10 +-84 -149 5
1.11 +-3 -155 6
1.12 +76 -155 7
1.13 +155 -151 8
1.14 +229 -138 9
1.15 +298 -113 10
1.16 +362 -88 11
1.17 +433 -53 12
1.18 +447 3 13
1.19 +416 59 14
1.20 +338 69 15
1.21 +281 31 16
1.22 +217 6 17
1.23 +143 -1 18
1.24 +69 -1 19
1.25 +-7 3 20
1.26 +-73 3 21
1.27 +-137 -3 22
1.28 +-193 -26 23
1.29 +-255 -30 24
1.30 +-303 -2 25
1.31 +-348 37 26
1.32 +-355 92 27
1.33 +-335 145 28
1.34 +-299 181 29
1.35 +-229 186 30
1.36 +-164 154 31
1.37 +-104 126 32
1.38 +-46 134 33
1.39 +0 169 34
1.40 +47 197 35
1.41 +100 195 36
1.42 +141 161 37
1.43 +195 134 38
1.44 +256 146 39
1.45 +314 182 40
1.46 +370 207 41
1.47 +431 244 42
1.48 +@edgeset
1.49 + label
1.50 +42 41 1
1.51 +41 40 2
1.52 +40 39 3
1.53 +39 38 4
1.54 +38 37 5
1.55 +37 36 6
1.56 +36 35 7
1.57 +35 34 8
1.58 +34 33 9
1.59 +33 32 10
1.60 +32 31 11
1.61 +31 30 12
1.62 +30 29 13
1.63 +29 28 14
1.64 +28 27 15
1.65 +27 26 16
1.66 +26 25 17
1.67 +25 24 18
1.68 +24 23 19
1.69 +23 22 20
1.70 +22 21 21
1.71 +21 20 22
1.72 +20 19 23
1.73 +19 18 24
1.74 +18 17 25
1.75 +17 16 26
1.76 +16 15 27
1.77 +15 14 28
1.78 +14 13 29
1.79 +13 12 30
1.80 +12 11 31
1.81 +11 10 32
1.82 +10 9 33
1.83 +9 8 34
1.84 +8 7 35
1.85 +7 6 36
1.86 +6 5 37
1.87 +5 4 38
1.88 +4 3 39
1.89 +3 2 40
1.90 +2 1 41
1.91 +@gui
1.92 +<arrow_pos>
1.93 + <item>
1.94 + <first>1</first>
1.95 + <second>
1.96 + <x>400.5</x><y>225.5</y>
1.97 + </second>
1.98 + </item>
1.99 + <item>
1.100 + <first>2</first>
1.101 + <second>
1.102 + <x>342</x><y>194.5</y>
1.103 + </second>
1.104 + </item>
1.105 + <item>
1.106 + <first>3</first>
1.107 + <second>
1.108 + <x>285</x><y>164</y>
1.109 + </second>
1.110 + </item>
1.111 + <item>
1.112 + <first>4</first>
1.113 + <second>
1.114 + <x>225.5</x><y>140</y>
1.115 + </second>
1.116 + </item>
1.117 + <item>
1.118 + <first>5</first>
1.119 + <second>
1.120 + <x>168</x><y>147.5</y>
1.121 + </second>
1.122 + </item>
1.123 + <item>
1.124 + <first>6</first>
1.125 + <second>
1.126 + <x>120.5</x><y>178</y>
1.127 + </second>
1.128 + </item>
1.129 + <item>
1.130 + <first>7</first>
1.131 + <second>
1.132 + <x>73.5</x><y>196</y>
1.133 + </second>
1.134 + </item>
1.135 + <item>
1.136 + <first>8</first>
1.137 + <second>
1.138 + <x>23.5</x><y>183</y>
1.139 + </second>
1.140 + </item>
1.141 + <item>
1.142 + <first>9</first>
1.143 + <second>
1.144 + <x>-23</x><y>151.5</y>
1.145 + </second>
1.146 + </item>
1.147 + <item>
1.148 + <first>10</first>
1.149 + <second>
1.150 + <x>-75</x><y>130</y>
1.151 + </second>
1.152 + </item>
1.153 + <item>
1.154 + <first>11</first>
1.155 + <second>
1.156 + <x>-134</x><y>140</y>
1.157 + </second>
1.158 + </item>
1.159 + <item>
1.160 + <first>12</first>
1.161 + <second>
1.162 + <x>-196.5</x><y>170</y>
1.163 + </second>
1.164 + </item>
1.165 + <item>
1.166 + <first>13</first>
1.167 + <second>
1.168 + <x>-264</x><y>183.5</y>
1.169 + </second>
1.170 + </item>
1.171 + <item>
1.172 + <first>14</first>
1.173 + <second>
1.174 + <x>-317</x><y>163</y>
1.175 + </second>
1.176 + </item>
1.177 + <item>
1.178 + <first>15</first>
1.179 + <second>
1.180 + <x>-345</x><y>118.5</y>
1.181 + </second>
1.182 + </item>
1.183 + <item>
1.184 + <first>16</first>
1.185 + <second>
1.186 + <x>-351.5</x><y>64.5</y>
1.187 + </second>
1.188 + </item>
1.189 + <item>
1.190 + <first>17</first>
1.191 + <second>
1.192 + <x>-325.5</x><y>17.5</y>
1.193 + </second>
1.194 + </item>
1.195 + <item>
1.196 + <first>18</first>
1.197 + <second>
1.198 + <x>-279</x><y>-16</y>
1.199 + </second>
1.200 + </item>
1.201 + <item>
1.202 + <first>19</first>
1.203 + <second>
1.204 + <x>-224</x><y>-28</y>
1.205 + </second>
1.206 + </item>
1.207 + <item>
1.208 + <first>20</first>
1.209 + <second>
1.210 + <x>-165</x><y>-14.5</y>
1.211 + </second>
1.212 + </item>
1.213 + <item>
1.214 + <first>21</first>
1.215 + <second>
1.216 + <x>-105</x><y>0</y>
1.217 + </second>
1.218 + </item>
1.219 + <item>
1.220 + <first>22</first>
1.221 + <second>
1.222 + <x>-40</x><y>3</y>
1.223 + </second>
1.224 + </item>
1.225 + <item>
1.226 + <first>23</first>
1.227 + <second>
1.228 + <x>31</x><y>1</y>
1.229 + </second>
1.230 + </item>
1.231 + <item>
1.232 + <first>24</first>
1.233 + <second>
1.234 + <x>106</x><y>-1</y>
1.235 + </second>
1.236 + </item>
1.237 + <item>
1.238 + <first>25</first>
1.239 + <second>
1.240 + <x>180</x><y>2.5</y>
1.241 + </second>
1.242 + </item>
1.243 + <item>
1.244 + <first>26</first>
1.245 + <second>
1.246 + <x>249</x><y>18.5</y>
1.247 + </second>
1.248 + </item>
1.249 + <item>
1.250 + <first>27</first>
1.251 + <second>
1.252 + <x>309.5</x><y>50</y>
1.253 + </second>
1.254 + </item>
1.255 + <item>
1.256 + <first>28</first>
1.257 + <second>
1.258 + <x>377</x><y>64</y>
1.259 + </second>
1.260 + </item>
1.261 + <item>
1.262 + <first>29</first>
1.263 + <second>
1.264 + <x>431.5</x><y>31</y>
1.265 + </second>
1.266 + </item>
1.267 + <item>
1.268 + <first>30</first>
1.269 + <second>
1.270 + <x>440</x><y>-25</y>
1.271 + </second>
1.272 + </item>
1.273 + <item>
1.274 + <first>31</first>
1.275 + <second>
1.276 + <x>397.5</x><y>-70.5</y>
1.277 + </second>
1.278 + </item>
1.279 + <item>
1.280 + <first>32</first>
1.281 + <second>
1.282 + <x>330</x><y>-100.5</y>
1.283 + </second>
1.284 + </item>
1.285 + <item>
1.286 + <first>33</first>
1.287 + <second>
1.288 + <x>263.5</x><y>-125.5</y>
1.289 + </second>
1.290 + </item>
1.291 + <item>
1.292 + <first>34</first>
1.293 + <second>
1.294 + <x>192</x><y>-144.5</y>
1.295 + </second>
1.296 + </item>
1.297 + <item>
1.298 + <first>35</first>
1.299 + <second>
1.300 + <x>115.5</x><y>-153</y>
1.301 + </second>
1.302 + </item>
1.303 + <item>
1.304 + <first>36</first>
1.305 + <second>
1.306 + <x>36.5</x><y>-155</y>
1.307 + </second>
1.308 + </item>
1.309 + <item>
1.310 + <first>37</first>
1.311 + <second>
1.312 + <x>-43.5</x><y>-152</y>
1.313 + </second>
1.314 + </item>
1.315 + <item>
1.316 + <first>38</first>
1.317 + <second>
1.318 + <x>-122</x><y>-147.5</y>
1.319 + </second>
1.320 + </item>
1.321 + <item>
1.322 + <first>39</first>
1.323 + <second>
1.324 + <x>-194.5</x><y>-143</y>
1.325 + </second>
1.326 + </item>
1.327 + <item>
1.328 + <first>40</first>
1.329 + <second>
1.330 + <x>-263.5</x><y>-137.5</y>
1.331 + </second>
1.332 + </item>
1.333 + <item>
1.334 + <first>41</first>
1.335 + <second>
1.336 + <x>-327.5</x><y>-131.5</y>
1.337 + </second>
1.338 + </item>
1.339 +</arrow_pos>
1.340 +<active_nodemaps>
1.341 + <item>
1.342 + <first>0</first>
1.343 + <second></second>
1.344 + </item>
1.345 + <item>
1.346 + <first>1</first>
1.347 + <second>label</second>
1.348 + </item>
1.349 + <item>
1.350 + <first>2</first>
1.351 + <second></second>
1.352 + </item>
1.353 +</active_nodemaps>
1.354 +<active_edgemaps>
1.355 + <item>
1.356 + <first>0</first>
1.357 + <second></second>
1.358 + </item>
1.359 + <item>
1.360 + <first>1</first>
1.361 + <second>label</second>
1.362 + </item>
1.363 + <item>
1.364 + <first>2</first>
1.365 + <second></second>
1.366 + </item>
1.367 +</active_edgemaps>
1.368 +<redesign-attraction>0.05</redesign-attraction>
1.369 +<redesign-propulsation>40000</redesign-propulsation>
1.370 +<redesign-iteration>20</redesign-iteration>
1.371 +@end
2.1 --- a/graph_displayer_canvas-edge.cc Mon Oct 30 15:43:13 2006 +0000
2.2 +++ b/graph_displayer_canvas-edge.cc Mon Nov 06 15:40:44 2006 +0000
2.3 @@ -147,11 +147,11 @@
2.4 Gdk::Color color;
2.5 if(max!=min)
2.6 {
2.7 - color.set_rgb_p (0, 100*(w-min)/(max-min), 0);
2.8 + color=rainbowColorCounter(min, max, w);
2.9 }
2.10 else
2.11 {
2.12 - color.set_rgb_p (0, 100, 0);
2.13 + color.set_rgb_p (0, 1, 0);
2.14 }
2.15 edgesmap[i]->setFillColor(color);
2.16 }
2.17 @@ -164,11 +164,11 @@
2.18
2.19 if(max!=min)
2.20 {
2.21 - color.set_rgb_p (0, 100*(w-min)/(max-min), 0);
2.22 + color=rainbowColorCounter(min, max, w);
2.23 }
2.24 else
2.25 {
2.26 - color.set_rgb_p (0, 100, 0);
2.27 + color.set_rgb_p (0, 1, 0);
2.28 }
2.29
2.30 edgesmap[edge]->setFillColor(color);
3.1 --- a/graph_displayer_canvas-event.cc Mon Oct 30 15:43:13 2006 +0000
3.2 +++ b/graph_displayer_canvas-event.cc Mon Nov 06 15:40:44 2006 +0000
3.3 @@ -453,12 +453,12 @@
3.4 {
3.5 if(active_item)
3.6 {
3.7 - *active_item << Gnome::Canvas::Properties::fill_color("blue");
3.8 + propertyUpdate(active_node,N_COLOR);
3.9 active_item=NULL;
3.10 }
3.11 if(target_item)
3.12 {
3.13 - *target_item << Gnome::Canvas::Properties::fill_color("blue");
3.14 + propertyUpdate((mytab.mapstorage).graph.target(active_edge),N_COLOR);
3.15 target_item=NULL;
3.16 }
3.17 active_node=INVALID;
3.18 @@ -874,3 +874,61 @@
3.19 }
3.20 }
3.21 }
3.22 +
3.23 +Gdk::Color GraphDisplayerCanvas::rainbowColorCounter(double min, double max, double w)
3.24 +{
3.25 + Gdk::Color color;
3.26 +
3.27 + double pos=(w-min)/(max-min);
3.28 + int phase=0;
3.29 +
3.30 + //rainbow transitions contain 6 phase
3.31 + //in each phase only one color is changed
3.32 + //first we determine the phase, in which
3.33 + //the actual value belongs to
3.34 + for (int i=0;i<=5;i++)
3.35 + {
3.36 + if(((double)i/6<pos)&&(pos<=(double(i+1)/6)))
3.37 + {
3.38 + phase=i;
3.39 + }
3.40 + }
3.41 + if(phase<6)
3.42 + {
3.43 + //within its 1/6 long phase the relativ position
3.44 + //determines the power of the color changed in
3.45 + //that phase
3.46 + //we normalize that to one, to be able to give percentage
3.47 + //value for the function
3.48 + double rel_pos=(pos-(phase/6))*6;
3.49 +
3.50 + switch(phase)
3.51 + {
3.52 + case 0:
3.53 + color.set_rgb_p (1, 0, 1-rel_pos);
3.54 + break;
3.55 + case 1:
3.56 + color.set_rgb_p (1, rel_pos, 0);
3.57 + break;
3.58 + case 2:
3.59 + color.set_rgb_p (1-rel_pos, 1, 0);
3.60 + break;
3.61 + case 3:
3.62 + color.set_rgb_p (0, 1, rel_pos);
3.63 + break;
3.64 + case 4:
3.65 + color.set_rgb_p (0, 1-rel_pos, 1);
3.66 + break;
3.67 + case 5:
3.68 + color.set_rgb_p ((rel_pos/3), 0, 1);
3.69 + break;
3.70 + default:
3.71 + std::cout << "Wrong phase: " << phase << " " << pos << std::endl;
3.72 + }
3.73 + }
3.74 + else
3.75 + {
3.76 + std::cout << "Wrong phase: " << phase << " " << pos << std::endl;
3.77 + }
3.78 + return color;
3.79 +}
4.1 --- a/graph_displayer_canvas-node.cc Mon Oct 30 15:43:13 2006 +0000
4.2 +++ b/graph_displayer_canvas-node.cc Mon Nov 06 15:40:44 2006 +0000
4.3 @@ -185,11 +185,11 @@
4.4
4.5 if(max!=min)
4.6 {
4.7 - color.set_rgb_p (0, 0, 100*(w-min)/(max-min));
4.8 + color=rainbowColorCounter(min, max, w);
4.9 }
4.10 else
4.11 {
4.12 - color.set_rgb_p (0, 0, 100);
4.13 + color.set_rgb_p (0, 0, 1);
4.14 }
4.15
4.16 nodesmap[i]->property_fill_color_gdk().set_value(color);
4.17 @@ -203,11 +203,11 @@
4.18
4.19 if(max!=min)
4.20 {
4.21 - color.set_rgb_p (0, 0, 100*(w-min)/(max-min));
4.22 + color=rainbowColorCounter(min, max, w);
4.23 }
4.24 else
4.25 {
4.26 - color.set_rgb_p (0, 0, 100);
4.27 + color.set_rgb_p (0, 0, 1);
4.28 }
4.29
4.30 nodesmap[node]->property_fill_color_gdk().set_value(color);
5.1 --- a/graph_displayer_canvas.h Mon Oct 30 15:43:13 2006 +0000
5.2 +++ b/graph_displayer_canvas.h Mon Nov 06 15:40:44 2006 +0000
5.3 @@ -145,6 +145,11 @@
5.4 ///destructor of the class
5.5 virtual ~GraphDisplayerCanvas();
5.6
5.7 + ///Returns a color of the rainbow based on a map value and the min and max value of the given map
5.8 +
5.9 + ///min and max is purple, between them there is a linear assign
5.10 + Gdk::Color rainbowColorCounter(double, double, double);
5.11 +
5.12 ///Changes the width of edge(s) according to the given map.
5.13
5.14 ///\param mapname is the name of the map which contains the values to be set