alevD - 2014-05-11

Hi all,

I have the following code. I can correctly print the content of line_smp with boost::geometry::dsv but get strange results when I copy line_smp into a vector and then print the content of the vector.

Any ideas on what I am doing wrong?

bg::model::d2::point_xy<double> p;
while(rs->next()){
bg::set<0>(p, i);
bg::set<1>(p, rs->getDouble("num"));
i++;
line +=p;
}
boost::geometry::simplify(line, line_smp, 0.3);

         std::cout<< "  original: " << boost::geometry::dsv(line) << std::endl
           << "simplified: " <<boost::geometry::dsv(line_smp) << std::endl;

         std::vector<xy> v;
         v.clear();
         std::copy(line_smp.begin(), line_smp.end(), std::back_inserter(v));

         stringstream sa, ssa;
         for(int ia = 0; ia < v.size(); ia++){
             sa << bg::get<1>(v[i]);
             cout << sa;
             sa.str("");
         }