Peter is able to read xy vector from file.
1.1 --- a/src/work/peter/xy-reader.cc Fri Apr 01 08:16:35 2005 +0000
1.2 +++ b/src/work/peter/xy-reader.cc Fri Apr 01 08:28:51 2005 +0000
1.3 @@ -14,14 +14,16 @@
1.4 typedef xy<double> Coordinates;
1.5 typedef Graph::NodeMap<Coordinates> CoordinatesMap;
1.6 typedef Graph::Node Node;
1.7 +typedef Graph::EdgeIt EdgeIt;
1.8 +typedef Graph::NodeIt NodeIt;
1.9
1.10 -class CoordReaderMap: public MapBase<Node, double>
1.11 +class CoordReaderMap: public MapBase <Node, double>
1.12 {
1.13 - CoordinatesMap * cm;
1.14 + CoordinatesMap & cm;
1.15 char xoy;
1.16
1.17 public:
1.18 - CoordReaderMap(char xory, CoordinatesMap * coordmap): cm(coordmap)
1.19 + CoordReaderMap(char xory, CoordinatesMap & coordmap): cm(coordmap)
1.20 {
1.21 switch(xory)
1.22 {
1.23 @@ -39,10 +41,10 @@
1.24 switch(xoy)
1.25 {
1.26 case 'x':
1.27 - (*cm)[node].x=coord;
1.28 + cm[node].x=coord;
1.29 break;
1.30 case 'y':
1.31 - (*cm)[node].y=coord;
1.32 + cm[node].y=coord;
1.33 break;
1.34 default:
1.35 throw UninitializedParameter() ;
1.36 @@ -55,15 +57,20 @@
1.37 Graph g;
1.38 CoordinatesMap cm(g);
1.39
1.40 - CoordReaderMap xreader('x',&cm);
1.41 - CoordReaderMap yreader('y',&cm);
1.42 + CoordReaderMap xreader('x',cm);
1.43 + CoordReaderMap yreader('y',cm);
1.44
1.45 - std::ifstream is("dijkstra_test.lemon");
1.46 + std::ifstream is("graphocska.lemon");
1.47
1.48 GraphReader<Graph> reader(is, g);
1.49 reader.addNodeMap("coordinates_x", xreader);
1.50 reader.addNodeMap("coordinates_y", yreader);
1.51 reader.run();
1.52 -
1.53 + std::cout << "Megvagyok" << std::endl;
1.54 +
1.55 + for (NodeIt i(g); i!=INVALID; ++i)
1.56 + std::cout << " " << g.id(i) << " " << cm[i];
1.57 + std::cout << std::endl;
1.58 +
1.59 return 0;
1.60 }