Boost logo

Geometry :

Subject: [ggl] Difference / xor for multi polygons
From: Barend Gehrels (barend)
Date: 2011-02-27 05:48:32


Hi Javier,

On 27-2-2011 1:58, Javier Gonzalez wrote:
>
> Unfortunately now upon compilation of the same code (VS2010), even if
> I only leave the union inserterer, I get this:
>
> 1> BoostGeometry.cpp
> 1>Programming\C++
> Libraries\boost_1_46_0\boost/geometry/core/point_type.hpp(42): error
> C2664: 'boost::mpl::assertion_failed' : cannot convert parameter 1
> from 'boost::mpl::failed ************(__cdecl
> boost::geometry::traits::point_type<Geometry>::NOT_IMPLEMENTED_FOR_THIS_POINT_TYPE::*
> ***********)(boost::mpl::assert_::types<T1>)' to
> 'boost::mpl::assert<false>::type'

I see. This is not caused by the change of yesterday, but by an earlier
(and correct) change.

The problematic lines are:
(...) typedef vector<polygon_2d> polygon_2d_list;
(...) static polygon_2d_list Combine(polygon_2d_list const& subjectPoly,
polygon_2d_list const& clipPoly, clip_type clipType)
(...) intersection_inserter<polygon_2d>(subjectPoly, clipPoly,
back_inserter(outputPoly));

First a polygonlist is declared but it is not a multi-polygon. For
output, using it with the back_inserter, this is OK.

But for input, it should conform to the multi-polygon concept. A
vector<polygon> does conform to most of it, but it still needs the tag
to note the library "I'm a multi-polygon".

So in the last line it expects a multi-polygon and gets a vector of
polygons, and therefore the MPL assertion of point_type goes off.

That MPL assertion is relatively new, but I'm surprised that the code
earlier compiled because it needs to assure the multi-polygon concept on
several places.

So three solutions possible:
1) change typedef vector<polygon_2d> to multi_polygon<polygon_2d>
2) change Combine from poylgon_2d_list to polygon_2d (but I don't know
if that is what you want)
3) add a traits class to register your polygon_2d_list:

namespace boost { namespace geometry { namespace traits
{

template <> struct tag<polygon_2d_list>
{
     typedef multi_polygon_tag type;
};

}}}

>
> I'm using the version from
>
> Subversion repository with source code of *Boost Geometry* is hosted
> in the Boost Trunk available at
>
> svn cohttp://svn.boost.org/svn/boost/trunk/boost/geometry boost-geometry
>
> though I only got the geometry part and used it over the release
> version of boost 1.46

That should be no problem.

Regards, Barend

-- 
Barend Gehrels
http://about.me/barendgehrels
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/ggl/attachments/20110227/28391590/attachment.html

Geometry list run by mateusz at loskot.net