Changeset 179:1f436ea3ef4f in glemon-0.x for graph_displayer_canvas-event.cc
- Timestamp:
- 11/06/06 16:40:44 (17 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/glemon/trunk@3065
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 }
Note: See TracChangeset
for help on using the changeset viewer.