# HG changeset patch
# User hegyi
# Date 1162827644 0
# Node ID 1f436ea3ef4f881ec79ed40f1dceab8cab54447a
# Parent a96d2a54045451a80808343782430a3a9bc07bb2
Color handling of maps is a bit better now.
diff -r a96d2a540454 -r 1f436ea3ef4f color.lgf
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/color.lgf Mon Nov 06 15:40:44 2006 +0000
@@ -0,0 +1,368 @@
+@nodeset
+coordinates_x coordinates_y label
+-357 -128 1
+-298 -135 2
+-229 -140 3
+-160 -146 4
+-84 -149 5
+-3 -155 6
+76 -155 7
+155 -151 8
+229 -138 9
+298 -113 10
+362 -88 11
+433 -53 12
+447 3 13
+416 59 14
+338 69 15
+281 31 16
+217 6 17
+143 -1 18
+69 -1 19
+-7 3 20
+-73 3 21
+-137 -3 22
+-193 -26 23
+-255 -30 24
+-303 -2 25
+-348 37 26
+-355 92 27
+-335 145 28
+-299 181 29
+-229 186 30
+-164 154 31
+-104 126 32
+-46 134 33
+0 169 34
+47 197 35
+100 195 36
+141 161 37
+195 134 38
+256 146 39
+314 182 40
+370 207 41
+431 244 42
+@edgeset
+ label
+42 41 1
+41 40 2
+40 39 3
+39 38 4
+38 37 5
+37 36 6
+36 35 7
+35 34 8
+34 33 9
+33 32 10
+32 31 11
+31 30 12
+30 29 13
+29 28 14
+28 27 15
+27 26 16
+26 25 17
+25 24 18
+24 23 19
+23 22 20
+22 21 21
+21 20 22
+20 19 23
+19 18 24
+18 17 25
+17 16 26
+16 15 27
+15 14 28
+14 13 29
+13 12 30
+12 11 31
+11 10 32
+10 9 33
+9 8 34
+8 7 35
+7 6 36
+6 5 37
+5 4 38
+4 3 39
+3 2 40
+2 1 41
+@gui
+
+ -
+ 1
+
+ 400.5225.5
+
+
+ -
+ 2
+
+ 342194.5
+
+
+ -
+ 3
+
+ 285164
+
+
+ -
+ 4
+
+ 225.5140
+
+
+ -
+ 5
+
+ 168147.5
+
+
+ -
+ 6
+
+ 120.5178
+
+
+ -
+ 7
+
+ 73.5196
+
+
+ -
+ 8
+
+ 23.5183
+
+
+ -
+ 9
+
+ -23151.5
+
+
+ -
+ 10
+
+ -75130
+
+
+ -
+ 11
+
+ -134140
+
+
+ -
+ 12
+
+ -196.5170
+
+
+ -
+ 13
+
+ -264183.5
+
+
+ -
+ 14
+
+ -317163
+
+
+ -
+ 15
+
+ -345118.5
+
+
+ -
+ 16
+
+ -351.564.5
+
+
+ -
+ 17
+
+ -325.517.5
+
+
+ -
+ 18
+
+ -279-16
+
+
+ -
+ 19
+
+ -224-28
+
+
+ -
+ 20
+
+ -165-14.5
+
+
+ -
+ 21
+
+ -1050
+
+
+ -
+ 22
+
+ -403
+
+
+ -
+ 23
+
+ 311
+
+
+ -
+ 24
+
+ 106-1
+
+
+ -
+ 25
+
+ 1802.5
+
+
+ -
+ 26
+
+ 24918.5
+
+
+ -
+ 27
+
+ 309.550
+
+
+ -
+ 28
+
+ 37764
+
+
+ -
+ 29
+
+ 431.531
+
+
+ -
+ 30
+
+ 440-25
+
+
+ -
+ 31
+
+ 397.5-70.5
+
+
+ -
+ 32
+
+ 330-100.5
+
+
+ -
+ 33
+
+ 263.5-125.5
+
+
+ -
+ 34
+
+ 192-144.5
+
+
+ -
+ 35
+
+ 115.5-153
+
+
+ -
+ 36
+
+ 36.5-155
+
+
+ -
+ 37
+
+ -43.5-152
+
+
+ -
+ 38
+
+ -122-147.5
+
+
+ -
+ 39
+
+ -194.5-143
+
+
+ -
+ 40
+
+ -263.5-137.5
+
+
+ -
+ 41
+
+ -327.5-131.5
+
+
+
+
+ -
+ 0
+
+
+ -
+ 1
+ label
+
+ -
+ 2
+
+
+
+
+ -
+ 0
+
+
+ -
+ 1
+ label
+
+ -
+ 2
+
+
+
+0.05
+40000
+20
+@end
diff -r a96d2a540454 -r 1f436ea3ef4f graph_displayer_canvas-edge.cc
--- a/graph_displayer_canvas-edge.cc Mon Oct 30 15:43:13 2006 +0000
+++ b/graph_displayer_canvas-edge.cc Mon Nov 06 15:40:44 2006 +0000
@@ -147,11 +147,11 @@
Gdk::Color color;
if(max!=min)
{
- color.set_rgb_p (0, 100*(w-min)/(max-min), 0);
+ color=rainbowColorCounter(min, max, w);
}
else
{
- color.set_rgb_p (0, 100, 0);
+ color.set_rgb_p (0, 1, 0);
}
edgesmap[i]->setFillColor(color);
}
@@ -164,11 +164,11 @@
if(max!=min)
{
- color.set_rgb_p (0, 100*(w-min)/(max-min), 0);
+ color=rainbowColorCounter(min, max, w);
}
else
{
- color.set_rgb_p (0, 100, 0);
+ color.set_rgb_p (0, 1, 0);
}
edgesmap[edge]->setFillColor(color);
diff -r a96d2a540454 -r 1f436ea3ef4f graph_displayer_canvas-event.cc
--- a/graph_displayer_canvas-event.cc Mon Oct 30 15:43:13 2006 +0000
+++ b/graph_displayer_canvas-event.cc Mon Nov 06 15:40:44 2006 +0000
@@ -453,12 +453,12 @@
{
if(active_item)
{
- *active_item << Gnome::Canvas::Properties::fill_color("blue");
+ propertyUpdate(active_node,N_COLOR);
active_item=NULL;
}
if(target_item)
{
- *target_item << Gnome::Canvas::Properties::fill_color("blue");
+ propertyUpdate((mytab.mapstorage).graph.target(active_edge),N_COLOR);
target_item=NULL;
}
active_node=INVALID;
@@ -874,3 +874,61 @@
}
}
}
+
+Gdk::Color GraphDisplayerCanvas::rainbowColorCounter(double min, double max, double w)
+{
+ Gdk::Color color;
+
+ double pos=(w-min)/(max-min);
+ int phase=0;
+
+ //rainbow transitions contain 6 phase
+ //in each phase only one color is changed
+ //first we determine the phase, in which
+ //the actual value belongs to
+ for (int i=0;i<=5;i++)
+ {
+ if(((double)i/6property_fill_color_gdk().set_value(color);
@@ -203,11 +203,11 @@
if(max!=min)
{
- color.set_rgb_p (0, 0, 100*(w-min)/(max-min));
+ color=rainbowColorCounter(min, max, w);
}
else
{
- color.set_rgb_p (0, 0, 100);
+ color.set_rgb_p (0, 0, 1);
}
nodesmap[node]->property_fill_color_gdk().set_value(color);
diff -r a96d2a540454 -r 1f436ea3ef4f graph_displayer_canvas.h
--- a/graph_displayer_canvas.h Mon Oct 30 15:43:13 2006 +0000
+++ b/graph_displayer_canvas.h Mon Nov 06 15:40:44 2006 +0000
@@ -145,6 +145,11 @@
///destructor of the class
virtual ~GraphDisplayerCanvas();
+ ///Returns a color of the rainbow based on a map value and the min and max value of the given map
+
+ ///min and max is purple, between them there is a linear assign
+ Gdk::Color rainbowColorCounter(double, double, double);
+
///Changes the width of edge(s) according to the given map.
///\param mapname is the name of the map which contains the values to be set