10 ifstream location_file(
"london-locations.csv"), path_file(
"london.txt");
12 map<string,Point> idlookup;
13 while (getline(location_file,
id,
','))
15 getline(location_file,sx,
',');
16 getline(location_file,sy,
'\n');
18 double x = strtod(sx.c_str(),&e), y = strtod(sy.c_str(),&e);
19 cout <<
id <<
" (" << x <<
"," << y <<
")"<< endl;
20 idlookup[id]=make_pair(x,y);
23 vector<vector<Point> >
paths;
24 while (getline(path_file,l,
'\n')) {
26 if(l.size() < 2)
continue;
27 if(l.find(
":",0)!=string::npos)
continue;
28 string::size_type p=0,q;
29 while((q=l.find(
",",p))!=string::npos || p < l.size() && (q = l.size()-1)) {
32 ps.push_back(idlookup[
id]);
36 cout <<
"*******************************************" << endl;
38 for(
unsigned i=0;i<
paths.size();i++) {
39 vector<Point> ps=
paths[i];
40 for(
unsigned j=0;j<ps.size();j++) {
41 double x=ps[j].first, y=ps[j].second;
42 cout <<
"(" << x <<
"," << y <<
")" <<
",";