Changeset 179:1f436ea3ef4f in glemon-0.x
- Timestamp:
- 11/06/06 16:40:44 (17 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/glemon/trunk@3065
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
graph_displayer_canvas-edge.cc
r178 r179 148 148 if(max!=min) 149 149 { 150 color .set_rgb_p (0, 100*(w-min)/(max-min), 0);151 } 152 else 153 { 154 color.set_rgb_p (0, 1 00, 0);150 color=rainbowColorCounter(min, max, w); 151 } 152 else 153 { 154 color.set_rgb_p (0, 1, 0); 155 155 } 156 156 edgesmap[i]->setFillColor(color); … … 165 165 if(max!=min) 166 166 { 167 color .set_rgb_p (0, 100*(w-min)/(max-min), 0);167 color=rainbowColorCounter(min, max, w); 168 168 } 169 169 else 170 170 { 171 color.set_rgb_p (0, 1 00, 0);171 color.set_rgb_p (0, 1, 0); 172 172 } 173 173 -
graph_displayer_canvas-event.cc
r178 r179 454 454 if(active_item) 455 455 { 456 *active_item << Gnome::Canvas::Properties::fill_color("blue");456 propertyUpdate(active_node,N_COLOR); 457 457 active_item=NULL; 458 458 } 459 459 if(target_item) 460 460 { 461 *target_item << Gnome::Canvas::Properties::fill_color("blue");461 propertyUpdate((mytab.mapstorage).graph.target(active_edge),N_COLOR); 462 462 target_item=NULL; 463 463 } … … 875 875 } 876 876 } 877 878 Gdk::Color GraphDisplayerCanvas::rainbowColorCounter(double min, double max, double w) 879 { 880 Gdk::Color color; 881 882 double pos=(w-min)/(max-min); 883 int phase=0; 884 885 //rainbow transitions contain 6 phase 886 //in each phase only one color is changed 887 //first we determine the phase, in which 888 //the actual value belongs to 889 for (int i=0;i<=5;i++) 890 { 891 if(((double)i/6<pos)&&(pos<=(double(i+1)/6))) 892 { 893 phase=i; 894 } 895 } 896 if(phase<6) 897 { 898 //within its 1/6 long phase the relativ position 899 //determines the power of the color changed in 900 //that phase 901 //we normalize that to one, to be able to give percentage 902 //value for the function 903 double rel_pos=(pos-(phase/6))*6; 904 905 switch(phase) 906 { 907 case 0: 908 color.set_rgb_p (1, 0, 1-rel_pos); 909 break; 910 case 1: 911 color.set_rgb_p (1, rel_pos, 0); 912 break; 913 case 2: 914 color.set_rgb_p (1-rel_pos, 1, 0); 915 break; 916 case 3: 917 color.set_rgb_p (0, 1, rel_pos); 918 break; 919 case 4: 920 color.set_rgb_p (0, 1-rel_pos, 1); 921 break; 922 case 5: 923 color.set_rgb_p ((rel_pos/3), 0, 1); 924 break; 925 default: 926 std::cout << "Wrong phase: " << phase << " " << pos << std::endl; 927 } 928 } 929 else 930 { 931 std::cout << "Wrong phase: " << phase << " " << pos << std::endl; 932 } 933 return color; 934 } -
graph_displayer_canvas-node.cc
r174 r179 186 186 if(max!=min) 187 187 { 188 color .set_rgb_p (0, 0, 100*(w-min)/(max-min));188 color=rainbowColorCounter(min, max, w); 189 189 } 190 190 else 191 191 { 192 color.set_rgb_p (0, 0, 1 00);192 color.set_rgb_p (0, 0, 1); 193 193 } 194 194 … … 204 204 if(max!=min) 205 205 { 206 color .set_rgb_p (0, 0, 100*(w-min)/(max-min));206 color=rainbowColorCounter(min, max, w); 207 207 } 208 208 else 209 209 { 210 color.set_rgb_p (0, 0, 1 00);210 color.set_rgb_p (0, 0, 1); 211 211 } 212 212 -
graph_displayer_canvas.h
r177 r179 146 146 virtual ~GraphDisplayerCanvas(); 147 147 148 ///Returns a color of the rainbow based on a map value and the min and max value of the given map 149 150 ///min and max is purple, between them there is a linear assign 151 Gdk::Color rainbowColorCounter(double, double, double); 152 148 153 ///Changes the width of edge(s) according to the given map. 149 154
Note: See TracChangeset
for help on using the changeset viewer.