Changeset 1178:3c176c65d33b in lemon-0.x for src/demo/graph_to_eps_demo.cc
- Timestamp:
- 02/25/05 15:50:22 (20 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1584
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/demo/graph_to_eps_demo.cc
r1164 r1178 24 24 using namespace lemon; 25 25 26 class ColorSet : public MapBase<int,Color>27 {28 public:29 Color operator[](int i) const30 {31 switch(i%8){32 case 0: return Color(0,0,0);33 case 1: return Color(1,0,0);34 case 2: return Color(0,1,0);35 case 3: return Color(0,0,1);36 case 4: return Color(1,1,0);37 case 5: return Color(1,0,1);38 case 6: return Color(0,1,1);39 case 7: return Color(1,1,1);40 }41 return Color(0,0,0);42 }43 } colorSet;44 45 26 class IdMap :public MapBase<ListGraph::Node,int> 46 27 { … … 53 34 int main() 54 35 { 36 ColorSet colorSet; 37 55 38 ListGraph g; 56 39 typedef ListGraph::Node Node; … … 166 149 run(); 167 150 151 ListGraph h; 152 ListGraph::NodeMap<int> hcolors(h); 153 ListGraph::NodeMap<Xy> hcoords(h); 154 155 int cols=int(sqrt(double(colorSet.size()))); 156 for(int i=0;i<int(colorSet.size());i++) { 157 Node n=h.addNode(); 158 hcoords[n]=Xy(i%cols,i/cols); 159 hcolors[n]=i; 160 } 161 162 graphToEps(h,"graph_to_eps_demo_out_colors.eps").scale(60). 163 title("Sample .eps figure (parallel edges and arrowheads)"). 164 copyright("(C) 2005 LEMON Project"). 165 coords(hcoords). 166 nodeScale(.45). 167 distantColorNodeTexts(). 168 // distantBWNodeTexts(). 169 nodeTexts(hcolors).nodeTextSize(.6). 170 nodeColors(composeMap(colorSet,hcolors)). 171 run(); 172 173 168 174 }
Note: See TracChangeset
for help on using the changeset viewer.