]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/test/algorithms/overlay/select_rings.cpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
3 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
5 // This file was modified by Oracle on 2017.
6 // Modifications copyright (c) 2017 Oracle and/or its affiliates.
7 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
9 // Use, modification and distribution is subject to the Boost Software License,
10 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
11 // http://www.boost.org/LICENSE_1_0.txt)
13 #include <geometry_test_common.hpp>
15 #include <boost/foreach.hpp>
16 #include <boost/range/algorithm/copy.hpp>
17 #include <boost/tuple/tuple.hpp>
18 #include <boost/typeof/typeof.hpp>
20 #include <algorithms/test_overlay.hpp>
22 #include <boost/geometry/geometry.hpp>
23 #include <boost/geometry/algorithms/detail/overlay/select_rings.hpp>
24 #include <boost/geometry/algorithms/detail/overlay/assign_parents.hpp>
26 #include <boost/geometry/geometries/point_xy.hpp>
27 #include <boost/geometry/geometries/polygon.hpp>
29 #include <boost/geometry/io/wkt/read.hpp>
31 #include <boost/assign/list_of.hpp>
38 bg::overlay_type OverlayType
,
41 void test_geometry(std::string
const& wkt1
, std::string
const& wkt2
,
42 RingIdVector
const& expected_ids
)
44 typedef bg::detail::overlay::ring_properties
46 typename
bg::point_type
<Geometry1
>::type
,
53 bg::read_wkt(wkt1
, geometry1
);
54 bg::read_wkt(wkt2
, geometry2
);
56 typedef std::map
<bg::ring_identifier
, properties
> map_type
;
58 std::map
<bg::ring_identifier
, bg::detail::overlay::ring_turn_info
> empty
;
60 typedef typename
bg::strategy::intersection::services::default_strategy
62 typename
bg::cs_tag
<Geometry1
>::type
63 >::type strategy_type
;
65 bg::detail::overlay::select_rings
<OverlayType
>(geometry1
, geometry2
, empty
, selected
, strategy_type());
67 BOOST_CHECK_EQUAL(selected
.size(), expected_ids
.size());
69 if (selected
.size() <= expected_ids
.size())
71 BOOST_AUTO(eit
, expected_ids
.begin());
72 for(typename
map_type::const_iterator it
= selected
.begin(); it
!= selected
.end(); ++it
, ++eit
)
74 bg::ring_identifier
const ring_id
= it
->first
;
75 BOOST_CHECK_EQUAL(ring_id
.source_index
, eit
->source_index
);
76 BOOST_CHECK_EQUAL(ring_id
.multi_index
, eit
->multi_index
);
77 BOOST_CHECK_EQUAL(ring_id
.ring_index
, eit
->ring_index
);
88 // Point in correct clockwise ring -> should return true
89 typedef bg::ring_identifier rid
;
91 test_geometry
<bg::model::polygon
<P
>, bg::model::polygon
<P
>, bg::overlay_union
>(
93 boost::assign::list_of
101 test_geometry
<bg::model::polygon
<P
>, bg::model::polygon
<P
>, bg::overlay_intersection
>(
102 winded
[0], winded
[1],
103 boost::assign::list_of
113 int test_main( int , char* [] )
115 test_all
<bg::model::d2::point_xy
<double> >();