Changeset 1971:9a59a6cacfd9 in lemon-0.x
- Timestamp:
- 02/20/06 07:41:12 (19 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2555
- Files:
-
- 4 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
demo/Makefile.am
r1920 r1971 9 9 reader_writer_demo \ 10 10 dim_to_lgf \ 11 eps_demo \ 11 12 graph_to_eps_demo \ 12 13 graph_orientation \ … … 32 33 33 34 dijkstra_demo_SOURCES = dijkstra_demo.cc 35 36 eps_demo_SOURCES = eps_demo.cc 34 37 35 38 reader_writer_demo_SOURCES = reader_writer_demo.cc -
lemon/Makefile.am
r1968 r1971 9 9 lp_base.cc \ 10 10 lp_skeleton.cc \ 11 base.cc 11 base.cc \ 12 eps.cc 12 13 libemon_la_CXXFLAGS = $(GLPK_CFLAGS) $(CPLEX_CFLAGS) 13 14 libemon_la_LDFLAGS = $(GLPK_LIBS) $(CPLEX_LIBS) … … 27 28 dfs.h \ 28 29 bin_heap.h \ 30 color.h \ 29 31 config.h \ 30 32 counter.h \ … … 34 36 edge_set.h \ 35 37 error.h \ 38 eps.h \ 36 39 fib_heap.h \ 37 40 floyd_warshall.h \ -
lemon/graph_to_eps.h
r1956 r1971 34 34 #include<lemon/xy.h> 35 35 #include<lemon/maps.h> 36 #include<lemon/color.h> 36 37 #include<lemon/bezier.h> 37 38 … … 44 45 45 46 namespace lemon { 46 47 ///Data structure representing RGB colors.48 49 ///Data structure representing RGB colors.50 ///\ingroup misc51 class Color52 {53 double _r,_g,_b;54 public:55 ///Default constructor56 Color() {}57 ///Constructor58 Color(double r,double g,double b) :_r(r),_g(g),_b(b) {};59 ///Returns the red component60 double & red() {return _r;}61 ///Returns the red component62 const double & red() const {return _r;}63 ///Returns the green component64 double & green() {return _g;}65 ///Returns the green component66 const double & green() const {return _g;}67 ///Returns the blue component68 double & blue() {return _b;}69 ///Returns the blue component70 const double & blue() const {return _b;}71 ///Set the color components72 void set(double r,double g,double b) { _r=r;_g=g;_b=b; };73 };74 75 ///Maps <tt>int</tt>s to different \ref Color "Color"s76 77 ///This map assigns one of the predefined \ref Color "Color"s78 ///to each <tt>int</tt>. It is possible to change the colors as well as their79 ///number. The integer range is cyclically mapped to the provided set of colors.80 ///81 ///This is a true \ref concept::ReferenceMap "reference map", so you can also82 ///change the actual colors.83 84 class ColorSet : public MapBase<int,Color>85 {86 std::vector<Color> colors;87 public:88 ///Constructor89 90 ///Constructor91 ///\param have_white indicates whether white is92 ///amongst the provided color (\c true) or not (\c false). If it is true,93 ///white will be assigned to \c 0.94 ///\param num the number of the allocated colors. If it is \c 095 ///the default color configuration is set up (26 color plus the while).96 ///If \c num is less then 26/27 then the default color list is cut. Otherwise97 ///the color list is filled repeatedly with the default color list.98 ///(The colors can be changed later on.)99 ColorSet(bool have_white=false,int num=0)100 {101 do {102 if(have_white) colors.push_back(Color(1,1,1));103 104 colors.push_back(Color(0,0,0));105 colors.push_back(Color(1,0,0));106 colors.push_back(Color(0,1,0));107 colors.push_back(Color(0,0,1));108 colors.push_back(Color(1,1,0));109 colors.push_back(Color(1,0,1));110 colors.push_back(Color(0,1,1));111 112 colors.push_back(Color(.5,0,0));113 colors.push_back(Color(0,.5,0));114 colors.push_back(Color(0,0,.5));115 colors.push_back(Color(.5,.5,0));116 colors.push_back(Color(.5,0,.5));117 colors.push_back(Color(0,.5,.5));118 119 colors.push_back(Color(.5,.5,.5));120 colors.push_back(Color(1,.5,.5));121 colors.push_back(Color(.5,1,.5));122 colors.push_back(Color(.5,.5,1));123 colors.push_back(Color(1,1,.5));124 colors.push_back(Color(1,.5,1));125 colors.push_back(Color(.5,1,1));126 127 colors.push_back(Color(1,.5,0));128 colors.push_back(Color(.5,1,0));129 colors.push_back(Color(1,0,.5));130 colors.push_back(Color(0,1,.5));131 colors.push_back(Color(0,.5,1));132 colors.push_back(Color(.5,0,1));133 } while(int(colors.size())<num);134 // colors.push_back(Color(1,1,1));135 if(num>0) colors.resize(num);136 }137 ///\e138 Color &operator[](int i)139 {140 return colors[i%colors.size()];141 }142 ///\e143 const Color &operator[](int i) const144 {145 return colors[i%colors.size()];146 }147 ///\e148 void set(int i,const Color &c)149 {150 colors[i%colors.size()]=c;151 }152 ///Sets the number of the exiting colors.153 void resize(int s) { colors.resize(s);}154 ///Returns the number of the existing colors.155 std::size_t size() const { return colors.size();}156 };157 158 ///Returns a visible distinct \ref Color159 160 ///Returns a \ref Color which is as different from the given parameter161 ///as it is possible.162 inline Color distantColor(const Color &c)163 {164 return Color(c.red()<.5?1:0,c.green()<.5?1:0,c.blue()<.5?1:0);165 }166 ///Returns black for light colors and white for the dark ones.167 168 ///Returns black for light colors and white for the dark ones.169 inline Color distantBW(const Color &c){170 double v=(.2125*c.red()+.7154*c.green()+.0721*c.blue())<.5?1:0;171 return Color(v,v,v);172 }173 47 174 48 template<class MT>
Note: See TracChangeset
for help on using the changeset viewer.