872 edgetextmap[ei]->property_x().set_value(text_pos.x); |
872 edgetextmap[ei]->property_x().set_value(text_pos.x); |
873 edgetextmap[ei]->property_y().set_value(text_pos.y); |
873 edgetextmap[ei]->property_y().set_value(text_pos.y); |
874 } |
874 } |
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 } |