Compile Error with douglas peucker

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Compile Error with douglas peucker

Stephan Menzel
Hello,

I am trying to port existing and working code from 1.54 to above and ever since 1.55 there's a compile error on both gcc and VC9 here:

typedef boost::geometry::model::point<double, 3, boost::geometry::cs::cartesian> Point;
typedef boost::geometry::model::box<Point>                                       BoundingBox;
typedef boost::geometry::model::segment<Point>                                   Segment;
typedef boost::geometry::model::linestring<Point>                                LineString;

// LineString raw is being filled
LineString ret;

    typedef boost::geometry::strategy::distance::projected_point<Point> PointSegmentDistanceStrategy;
    typedef boost::geometry::strategy::simplify::douglas_peucker<Point, PointSegmentDistanceStrategy> SimplificationStrategy;
    SimplificationStrategy strat;
    boost::geometry::simplify<LineString, double, SimplificationStrategy>(raw, ret, 20, strat);

The error appears to be different in 1.57.

GCC says:

In file included from /home/sm/devel/boost_1_57_0/boost/geometry/algorithms/detail/buffer/buffer_inserter.hpp:31:0,
                 from /home/sm/devel/boost_1_57_0/boost/geometry/algorithms/buffer.hpp:32,
                 from /home/sm/devel/boost_1_57_0/boost/geometry/geometry.hpp:48,
                 from /home/sm/devel/boost_1_57_0/boost/geometry.hpp:17,
                 from /home/sm/devel/ogre/DouglasPeucker.hpp:4,
                 from /home/sm/devel/ogre/DouglasPeucker.cpp:1:
/home/sm/devel/boost_1_57_0/boost/geometry/algorithms/simplify.hpp: In instantiation of 'static void boost::geometry::detail::simplify::simplify_range_insert::apply(const Range&, OutputIterator, const Distance&, const Strategy&) [with Range = boost::geometry::model::linestring<boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian> >; Strategy = boost::geometry::strategy::simplify::douglas_peucker<boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian>, boost::geometry::strategy::distance::projected_point<boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian> > >; OutputIterator = std::back_insert_iterator<boost::geometry::model::linestring<boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian> > >; Distance = double]':
/home/sm/devel/boost_1_57_0/boost/geometry/algorithms/simplify.hpp:112:17:   required from 'static void boost::geometry::detail::simplify::simplify_range<Minimum>::apply(const Range&, Range&, const Distance&, const Strategy&) [with Range = boost::geometry::model::linestring<boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian> >; Strategy = boost::geometry::strategy::simplify::douglas_peucker<boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian>, boost::geometry::strategy::distance::projected_point<boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian> > >; Distance = double; long unsigned int Minimum = 2ul]'
/home/sm/devel/boost_1_57_0/boost/geometry/algorithms/simplify.hpp:309:82:   required from 'static void boost::geometry::resolve_strategy::simplify::apply(const Geometry&, Geometry&, const Distance&, const Strategy&) [with Geometry = boost::geometry::model::linestring<boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian> >; Distance = double; Strategy = boost::geometry::strategy::simplify::douglas_peucker<boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian>, boost::geometry::strategy::distance::projected_point<boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian> > >]'
/home/sm/devel/boost_1_57_0/boost/geometry/algorithms/simplify.hpp:395:80:   required from 'static void boost::geometry::resolve_variant::simplify<Geometry>::apply(const Geometry&, Geometry&, const Distance&, const Strategy&) [with Distance = double; Strategy = boost::geometry::strategy::simplify::douglas_peucker<boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian>, boost::geometry::strategy::distance::projected_point<boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian> > >; Geometry = boost::geometry::model::linestring<boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian> >]'
/home/sm/devel/boost_1_57_0/boost/geometry/algorithms/simplify.hpp:463:85:   required from 'void boost::geometry::simplify(const Geometry&, Geometry&, const Distance&, const Strategy&) [with Geometry = boost::geometry::model::linestring<boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian> >; Distance = double; Strategy = boost::geometry::strategy::simplify::douglas_peucker<boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian>, boost::geometry::strategy::distance::projected_point<boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian> > >]'
/home/sm/devel/ogre/DouglasPeucker.cpp:113:91:   required from here
/home/sm/devel/boost_1_57_0/boost/geometry/algorithms/simplify.hpp:61:13: error: no matching function for call to 'boost::geometry::strategy::simplify::douglas_peucker<boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian>, boost::geometry::strategy::distance::projected_point<boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian> > >::apply(const boost::geometry::model::linestring<boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian> >&, std::back_insert_iterator<boost::geometry::model::linestring<boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian> > >&, const double&) const'
             strategy.apply(range, out, max_distance);
             ^
/home/sm/devel/boost_1_57_0/boost/geometry/algorithms/simplify.hpp:61:13: note: candidate is:
In file included from /home/sm/devel/boost_1_57_0/boost/geometry/strategies/strategies.hpp:72:0,
                 from /home/sm/devel/boost_1_57_0/boost/geometry/geometry.hpp:43,
                 from /home/sm/devel/boost_1_57_0/boost/geometry.hpp:17,
                 from /home/sm/devel/ogre/DouglasPeucker.hpp:4,
                 from /home/sm/devel/ogre/DouglasPeucker.cpp:1:
/home/sm/devel/boost_1_57_0/boost/geometry/strategies/agnostic/simplify_douglas_peucker.hpp:275:34: note: static OutputIterator boost::geometry::strategy::simplify::douglas_peucker<Point, PointDistanceStrategy>::apply(const Range&, OutputIterator, boost::geometry::strategy::simplify::douglas_peucker<Point, PointDistanceStrategy>::distance_type) [with Range = boost::geometry::model::linestring<boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian> >; OutputIterator = std::back_insert_iterator<boost::geometry::model::linestring<boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian> > >; Point = boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian>; PointDistanceStrategy = boost::geometry::strategy::distance::projected_point<boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian> >; boost::geometry::strategy::simplify::douglas_peucker<Point, PointDistanceStrategy>::distance_type = boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian>]
     static inline OutputIterator apply(Range const& range,
                                  ^
/home/sm/devel/boost_1_57_0/boost/geometry/strategies/agnostic/simplify_douglas_peucker.hpp:275:34: note:   no known conversion for argument 3 from 'const double' to 'boost::geometry::strategy::simplify::douglas_peucker<boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian>, boost::geometry::strategy::distance::projected_point<boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian> > >::distance_type {aka boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian>}'


I didn't notice any change in interface that would explain this so I suppose it could be a bug in geometry.


Any ideas?

Cheers,
Stephan

_______________________________________________
Geometry mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/geometry
Reply | Threaded
Open this post in threaded view
|

Re: Compile Error with douglas peucker

Stephan Menzel
May I humbly bump this...

I have a standanlone cpp file attached for your convenience but it's really just those lines...

Thank you for your consideration.

Stephan


On Tue, Dec 9, 2014 at 11:17 AM, Stephan Menzel <[hidden email]> wrote:
Hello,

I am trying to port existing and working code from 1.54 to above and ever since 1.55 there's a compile error on both gcc and VC9 here:

typedef boost::geometry::model::point<double, 3, boost::geometry::cs::cartesian> Point;
typedef boost::geometry::model::box<Point>                                       BoundingBox;
typedef boost::geometry::model::segment<Point>                                   Segment;
typedef boost::geometry::model::linestring<Point>                                LineString;

// LineString raw is being filled
LineString ret;

    typedef boost::geometry::strategy::distance::projected_point<Point> PointSegmentDistanceStrategy;
    typedef boost::geometry::strategy::simplify::douglas_peucker<Point, PointSegmentDistanceStrategy> SimplificationStrategy;
    SimplificationStrategy strat;
    boost::geometry::simplify<LineString, double, SimplificationStrategy>(raw, ret, 20, strat);

The error appears to be different in 1.57.

GCC says:

In file included from /home/sm/devel/boost_1_57_0/boost/geometry/algorithms/detail/buffer/buffer_inserter.hpp:31:0,
                 from /home/sm/devel/boost_1_57_0/boost/geometry/algorithms/buffer.hpp:32,
                 from /home/sm/devel/boost_1_57_0/boost/geometry/geometry.hpp:48,
                 from /home/sm/devel/boost_1_57_0/boost/geometry.hpp:17,
                 from /home/sm/devel/ogre/DouglasPeucker.hpp:4,
                 from /home/sm/devel/ogre/DouglasPeucker.cpp:1:
/home/sm/devel/boost_1_57_0/boost/geometry/algorithms/simplify.hpp: In instantiation of 'static void boost::geometry::detail::simplify::simplify_range_insert::apply(const Range&, OutputIterator, const Distance&, const Strategy&) [with Range = boost::geometry::model::linestring<boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian> >; Strategy = boost::geometry::strategy::simplify::douglas_peucker<boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian>, boost::geometry::strategy::distance::projected_point<boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian> > >; OutputIterator = std::back_insert_iterator<boost::geometry::model::linestring<boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian> > >; Distance = double]':
/home/sm/devel/boost_1_57_0/boost/geometry/algorithms/simplify.hpp:112:17:   required from 'static void boost::geometry::detail::simplify::simplify_range<Minimum>::apply(const Range&, Range&, const Distance&, const Strategy&) [with Range = boost::geometry::model::linestring<boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian> >; Strategy = boost::geometry::strategy::simplify::douglas_peucker<boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian>, boost::geometry::strategy::distance::projected_point<boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian> > >; Distance = double; long unsigned int Minimum = 2ul]'
/home/sm/devel/boost_1_57_0/boost/geometry/algorithms/simplify.hpp:309:82:   required from 'static void boost::geometry::resolve_strategy::simplify::apply(const Geometry&, Geometry&, const Distance&, const Strategy&) [with Geometry = boost::geometry::model::linestring<boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian> >; Distance = double; Strategy = boost::geometry::strategy::simplify::douglas_peucker<boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian>, boost::geometry::strategy::distance::projected_point<boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian> > >]'
/home/sm/devel/boost_1_57_0/boost/geometry/algorithms/simplify.hpp:395:80:   required from 'static void boost::geometry::resolve_variant::simplify<Geometry>::apply(const Geometry&, Geometry&, const Distance&, const Strategy&) [with Distance = double; Strategy = boost::geometry::strategy::simplify::douglas_peucker<boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian>, boost::geometry::strategy::distance::projected_point<boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian> > >; Geometry = boost::geometry::model::linestring<boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian> >]'
/home/sm/devel/boost_1_57_0/boost/geometry/algorithms/simplify.hpp:463:85:   required from 'void boost::geometry::simplify(const Geometry&, Geometry&, const Distance&, const Strategy&) [with Geometry = boost::geometry::model::linestring<boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian> >; Distance = double; Strategy = boost::geometry::strategy::simplify::douglas_peucker<boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian>, boost::geometry::strategy::distance::projected_point<boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian> > >]'
/home/sm/devel/ogre/DouglasPeucker.cpp:113:91:   required from here
/home/sm/devel/boost_1_57_0/boost/geometry/algorithms/simplify.hpp:61:13: error: no matching function for call to 'boost::geometry::strategy::simplify::douglas_peucker<boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian>, boost::geometry::strategy::distance::projected_point<boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian> > >::apply(const boost::geometry::model::linestring<boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian> >&, std::back_insert_iterator<boost::geometry::model::linestring<boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian> > >&, const double&) const'
             strategy.apply(range, out, max_distance);
             ^
/home/sm/devel/boost_1_57_0/boost/geometry/algorithms/simplify.hpp:61:13: note: candidate is:
In file included from /home/sm/devel/boost_1_57_0/boost/geometry/strategies/strategies.hpp:72:0,
                 from /home/sm/devel/boost_1_57_0/boost/geometry/geometry.hpp:43,
                 from /home/sm/devel/boost_1_57_0/boost/geometry.hpp:17,
                 from /home/sm/devel/ogre/DouglasPeucker.hpp:4,
                 from /home/sm/devel/ogre/DouglasPeucker.cpp:1:
/home/sm/devel/boost_1_57_0/boost/geometry/strategies/agnostic/simplify_douglas_peucker.hpp:275:34: note: static OutputIterator boost::geometry::strategy::simplify::douglas_peucker<Point, PointDistanceStrategy>::apply(const Range&, OutputIterator, boost::geometry::strategy::simplify::douglas_peucker<Point, PointDistanceStrategy>::distance_type) [with Range = boost::geometry::model::linestring<boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian> >; OutputIterator = std::back_insert_iterator<boost::geometry::model::linestring<boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian> > >; Point = boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian>; PointDistanceStrategy = boost::geometry::strategy::distance::projected_point<boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian> >; boost::geometry::strategy::simplify::douglas_peucker<Point, PointDistanceStrategy>::distance_type = boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian>]
     static inline OutputIterator apply(Range const& range,
                                  ^
/home/sm/devel/boost_1_57_0/boost/geometry/strategies/agnostic/simplify_douglas_peucker.hpp:275:34: note:   no known conversion for argument 3 from 'const double' to 'boost::geometry::strategy::simplify::douglas_peucker<boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian>, boost::geometry::strategy::distance::projected_point<boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian> > >::distance_type {aka boost::geometry::model::point<double, 3ul, boost::geometry::cs::cartesian>}'


I didn't notice any change in interface that would explain this so I suppose it could be a bug in geometry.


Any ideas?

Cheers,
Stephan


_______________________________________________
Geometry mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/geometry

geometry1.cpp (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Compile Error with douglas peucker

Barend
Hi Stephan,

Stephan Menzel schreef op 3-1-2015 om 18:43:
May I humbly bump this...

I have a standanlone cpp file attached for your convenience but it's really just those lines...

Thank you for your consideration.

Stephan


On Tue, Dec 9, 2014 at 11:17 AM, Stephan Menzel <[hidden email]> wrote:
Hello,

I am trying to port existing and working code from 1.54 to above and ever since 1.55 there's a compile error on both gcc and VC9 here:

typedef boost::geometry::model::point<double, 3, boost::geometry::cs::cartesian> Point;
typedef boost::geometry::model::box<Point>                                       BoundingBox;
typedef boost::geometry::model::segment<Point>                                   Segment;
typedef boost::geometry::model::linestring<Point>                                LineString;

// LineString raw is being filled
LineString ret;

    typedef boost::geometry::strategy::distance::projected_point<Point> PointSegmentDistanceStrategy;
    typedef boost::geometry::strategy::simplify::douglas_peucker<Point, PointSegmentDistanceStrategy> SimplificationStrategy;
    SimplificationStrategy strat;
    boost::geometry::simplify<LineString, double, SimplificationStrategy>(raw, ret, 20, strat);



Sorry for the late reaction.

I had to dig it up but projected_point<Point> is now not templated anymore with Point but with an optional calculation type. So saying the next is OK:

        typedef boost::geometry::strategy::distance::projected_point<> PointSegmentDistanceStrategy;
        typedef boost::geometry::strategy::simplify::douglas_peucker<Point, PointSegmentDistanceStrategy> SimplificationStrategy;
        SimplificationStrategy strat;

and then one of:
        boost::geometry::simplify<LineString, double, SimplificationStrategy>(raw, ret, 20, strat);
        boost::geometry::simplify(raw, ret, 20, strat);
        boost::geometry::simplify(raw, ret, 20);

(because you use the default simplify strategy, you don't have to mention it)

This change was already done in July 2013 (so indeed, as you mentioned, for 1.55) and alas it was mentioned in the release notes but as a TODO (to be documented) item. Sorry for the inconvience.

Regards, Barend



_______________________________________________
Geometry mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/geometry
Reply | Threaded
Open this post in threaded view
|

Re: Compile Error with douglas peucker

Stephan Menzel
Hello Barend,

thank you, that compiles. I can move to 1.57 now.

I can't believe though I had this verbose code in place when keeping all default would have done the same job and avoid this error. Guess I just didn't know.

Thanks for the clarification.

Cheers,
Stephan

On Sat, Jan 3, 2015 at 7:15 PM, Barend Gehrels <[hidden email]> wrote:
Hi Stephan,

Stephan Menzel schreef op 3-1-2015 om 18:43:
May I humbly bump this...

I have a standanlone cpp file attached for your convenience but it's really just those lines...

Thank you for your consideration.

Stephan


On Tue, Dec 9, 2014 at 11:17 AM, Stephan Menzel <[hidden email]> wrote:
Hello,

I am trying to port existing and working code from 1.54 to above and ever since 1.55 there's a compile error on both gcc and VC9 here:

typedef boost::geometry::model::point<double, 3, boost::geometry::cs::cartesian> Point;
typedef boost::geometry::model::box<Point>                                       BoundingBox;
typedef boost::geometry::model::segment<Point>                                   Segment;
typedef boost::geometry::model::linestring<Point>                                LineString;

// LineString raw is being filled
LineString ret;

    typedef boost::geometry::strategy::distance::projected_point<Point> PointSegmentDistanceStrategy;
    typedef boost::geometry::strategy::simplify::douglas_peucker<Point, PointSegmentDistanceStrategy> SimplificationStrategy;
    SimplificationStrategy strat;
    boost::geometry::simplify<LineString, double, SimplificationStrategy>(raw, ret, 20, strat);



Sorry for the late reaction.

I had to dig it up but projected_point<Point> is now not templated anymore with Point but with an optional calculation type. So saying the next is OK:

        typedef boost::geometry::strategy::distance::projected_point<> PointSegmentDistanceStrategy;
        typedef boost::geometry::strategy::simplify::douglas_peucker<Point, PointSegmentDistanceStrategy> SimplificationStrategy;
        SimplificationStrategy strat;

and then one of:
        boost::geometry::simplify<LineString, double, SimplificationStrategy>(raw, ret, 20, strat);
        boost::geometry::simplify(raw, ret, 20, strat);
        boost::geometry::simplify(raw, ret, 20);

(because you use the default simplify strategy, you don't have to mention it)

This change was already done in July 2013 (so indeed, as you mentioned, for 1.55) and alas it was mentioned in the release notes but as a TODO (to be documented) item. Sorry for the inconvience.

Regards, Barend



_______________________________________________
Geometry mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/geometry



_______________________________________________
Geometry mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/geometry