提升multi_polygon相交而不编译

时间:2015-12-22 15:55:07

标签: c++ boost intersection boost-geometry

我试图找到两个multi_polygon几何的交集。它没有编译涉及add_rings.hpp和convert_ring.hpp的错误。

这是我试图编译的一些测试代码:

#include "stdafx.h"

#include <vector>
#include <sstream>
#include <iostream>

#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/geometries.hpp>

namespace bg = boost::geometry;

// Typedef to simplify our point object declaration.
typedef bg::model::d2::point_xy< double > boostPoint;

// Typedef to simplify our polygon object declaration.
typedef bg::model::polygon<boostPoint,true> boostPolygon;

// Typedef to simplify our polygon object declaration.
typedef bg::model::multi_polygon<boostPolygon> boostMultiPolygon;

int _tmain(int argc, _TCHAR* argv[])
{
    std::string multiPolyOne = "MULTIPOLYGON(((2 2,2 12,12 12,12 2,2 2)),((6 6,6 9,9 9,9 6,6 6)))";
    std::string multiPolyTwo = "MULTIPOLYGON(((2 2,2 12,12 12,12 2,2 2)),((3 3,3 13,13 13,13 3,3 3)))";
    std::string multiPolyThree = "MULTIPOLYGON(((4 4,4 8,8 8,8 4,4 4),(5 5,6 5,6 6,5 6,5 5)))";

    boostMultiPolygon mp1, mp2, mp3;

    // A deque required by boost.
    std::deque<boostMultiPolygon> output;

    // boost method we will be using.
    using bg::read_wkt;

    read_wkt(multiPolyOne,mp1);
    read_wkt(multiPolyTwo,mp2);
    read_wkt(multiPolyThree,mp3);

    // Run the boost intersection.
    bg::intersection(mp1, mp2, output);

    return 0;
}

这会产生以下错误:

c:\sourcecode\commoncomponents\boost\boost_1_59_0\boost\geometry\algorithms\detail\overlay\convert_ring.hpp(41): error C2664: 'boost::mpl::assertion_failed' : cannot convert parameter 1 from 'boost::mpl::failed ************(__thiscall boost::geometry::detail::overlay::convert_ring<Tag>::NOT_OR_NOT_YET_IMPLEMENTED_FOR_THIS_GEOMETRY_TAG::* ***********)(boost::mpl::assert_::types<T    )' to 'boost::mpl::assert<false>::type'
          with
          [
              Tag=tag_out,
              T1=tag_out
          ]
          No constructor could take the source type, or constructor overload resolution was ambiguous
          c:\sourcecode\commoncomponents\boost\boost_1_59_0\boost\geometry\algorithms\detail\overlay\add_rings.hpp(47) : see reference to class template instantiation 'boost::geometry::detail::overlay::convert_ring<Tag>' being compiled
          with
          [
              Tag=tag_out
          ]
          c:\sourcecode\commoncomponents\boost\boost_1_59_0\boost\geometry\algorithms\detail\overlay\add_rings.hpp(105) : see reference to function template instantiation 'void boost::geometry::detail::overlay::convert_and_add<GeometryOut,Geometry1,Geometry2,RingCollection>(GeometryOut &,const Geometry1 &,const Geometry2 &,const RingCollection &,boost::geometry::ring_identifier,bool,bool)' being compiled
          with
          [
              GeometryOut=OneOut,
              Geometry1=boostMultiPolygon,
              Geometry2=boostMultiPolygon,
              RingCollection=ring_container_type
          ]
          c:\sourcecode\commoncomponents\boost\boost_1_59_0\boost\geometry\algorithms\detail\overlay\overlay.hpp(268) : see reference to function template instantiation 'OutputIterator boost::geometry::detail::overlay::add_rings<GeometryOut,std::map<_Kty,_Ty>,Geometry1,Geometry2,ring_container_type,OutputIterator>(const SelectionMap &,const Geometry1 &,const Geometry2 &,const RingCollection &,OutputIterator)' being compiled
          with
          [
              OutputIterator=std::back_insert_iterator<std::deque<boostMultiPolygon>>,
              GeometryOut=OneOut,
              _Kty=boost::geometry::ring_identifier,
              _Ty=properties,
              Geometry1=boostMultiPolygon,
              Geometry2=boostMultiPolygon,
              SelectionMap=std::map<boost::geometry::ring_identifier,properties>,
              RingCollection=ring_container_type
          ]
          c:\sourcecode\commoncomponents\boost\boost_1_59_0\boost\geometry\algorithms\detail\intersection\interface.hpp(57) : see reference to function template instantiation 'OutputIterator boost::geometry::detail::overlay::overlay<Geometry1,Geometry2,Reverse1,Reverse2,ReverseOut,GeometryOut,Direction>::apply<RobustPolicy,std::back_insert_iterator<_Container>,Strategy>(const Geometry1 &,const Geometry2 &,const RobustPolicy &,OutputIterator,const Strategy &)' being compiled
          with
          [
              OutputIterator=std::back_insert_iterator<std::deque<boostMultiPolygon>>,
              Geometry1=boostMultiPolygon,
              Geometry2=boostMultiPolygon,
              Reverse1=false,
              Reverse2=false,
              ReverseOut=false,
              GeometryOut=OneOut,
              Direction=overlay_intersection,
              RobustPolicy=rescale_policy_type,
              _Container=std::deque<boostMultiPolygon>,
              Strategy=boost::geometry::strategy_intersection<boost::geometry::cartesian_tag,boostMultiPolygon,boostMultiPolygon,boost::geometry::model::d2::point_xy<double>,rescale_policy_type>
          ]
          c:\sourcecode\commoncomponents\boost\boost_1_59_0\boost\geometry\algorithms\detail\intersection\interface.hpp(139) : see reference to function template instantiation 'bool boost::geometry::dispatch::intersection<Geometry1,Geometry2>::apply<rescale_policy_type,GeometryOut,boost::geometry::strategy_intersection<Tag,Geometry1,Geometry2,IntersectionPoint,RobustPolicy>>(const Geometry1 &,const Geometry2 &,const RobustPolicy &,GeometryOut &,const Strategy &)' being compiled
          with
          [
              Geometry1=boostMultiPolygon,
              Geometry2=boostMultiPolygon,
              GeometryOut=std::deque<boostMultiPolygon>,
              Tag=boost::geometry::cartesian_tag,
              IntersectionPoint=boost::geometry::model::d2::point_xy<double>,
              RobustPolicy=rescale_policy_type,
              Strategy=boost::geometry::strategy_intersection<boost::geometry::cartesian_tag,boostMultiPolygon,boostMultiPolygon,boost::geometry::model::d2::point_xy<double>,rescale_policy_type>
          ]
          c:\sourcecode\commoncomponents\boost\boost_1_59_0\boost\geometry\algorithms\detail\intersection\interface.hpp(300) : see reference to function template instantiation 'bool boost::geometry::resolve_variant::intersection<Geometry1,Geometry2>::apply<GeometryOut>(const Geometry1 &,const Geometry2 &,GeometryOut &)' being compiled
          with
          [
              Geometry1=boostMultiPolygon,
              Geometry2=boostMultiPolygon,
              GeometryOut=std::deque<boostMultiPolygon>
          ]
          c:\boost_test\test1\runtest2\runtest2.cpp(65) : see reference to function template instantiation 'bool boost::geometry::intersection<boostMultiPolygon,boostMultiPolygon,std::deque<_Ty>>(const Geometry1 &,const Geometry2 &,GeometryOut &)' being compiled
          with
          [
              _Ty=boostMultiPolygon,
              Geometry1=boostMultiPolygon,
              Geometry2=boostMultiPolygon,
              GeometryOut=std::deque<boostMultiPolygon>
          ]
c:\sourcecode\commoncomponents\boost\boost_1_59_0\boost\geometry\algorithms\detail\overlay\convert_ring.hpp(41): error C2866: 'boost::geometry::detail::overlay::convert_ring<Tag>::mpl_assertion_in_line_80' : a const static data member of a managed type must be initialized at the point of declaration
          with
          [
              Tag=tag_out
          ]
c:\sourcecode\commoncomponents\boost\boost_1_59_0\boost\geometry\algorithms\detail\overlay\add_rings.hpp(47): error C2039: 'apply' : is not a member of 'boost::geometry::detail::overlay::convert_ring<Tag>'
          with
          [
              Tag=tag_out
          ]
c:\sourcecode\commoncomponents\boost\boost_1_59_0\boost\geometry\algorithms\detail\overlay\add_rings.hpp(47): error C3861: 'apply': identifier not found
c:\sourcecode\commoncomponents\boost\boost_1_59_0\boost\geometry\algorithms\detail\overlay\add_rings.hpp(53): error C2039: 'apply' : is not a member of 'boost::geometry::detail::overlay::convert_ring<Tag>'
          with
          [
              Tag=tag_out
          ]
c:\sourcecode\commoncomponents\boost\boost_1_59_0\boost\geometry\algorithms\detail\overlay\add_rings.hpp(53): error C3861: 'apply': identifier not found
c:\sourcecode\commoncomponents\boost\boost_1_59_0\boost\geometry\algorithms\detail\overlay\add_rings.hpp(59): error C2039: 'apply' : is not a member of 'boost::geometry::detail::overlay::convert_ring<Tag>'
          with
          [
              Tag=tag_out
          ]
c:\sourcecode\commoncomponents\boost\boost_1_59_0\boost\geometry\algorithms\detail\overlay\add_rings.hpp(59): error C3861: 'apply': identifier not found

1 个答案:

答案 0 :(得分:1)

您的评论是错误的:

<div id="topParent">
  <div id="midParent">
    <div id="leaf">
    Click Here
    </div>
  </div>
</div>

不是:

  

// A deque required by boost. std::vectorstd::deque或{{ 1}},或者是输出几何(例如盒子)

boost::geometry::multi*

修复它