|
Boost Users : |
Subject: Re: [Boost-users] boost::geometry::model::linestring
From: Barend Gehrels (barend_at_[hidden])
Date: 2014-05-13 16:11:12
Hi Alev,
alev mutlu wrote On 11-5-2014 14:16:
>
> 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 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("");
> }
Hard to say, basically the procedure seems OK. I see several things:
- line type is not included in your fragment, what does += for example?
- point type is point_xy or xy?
- you print v[i] while your loop variable is ia (this is probably the
reason for strange results)
HTH,
Barend
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net