]>
Commit | Line | Data |
---|---|---|
1 | // Boost.Geometry (aka GGL, Generic Geometry Library) | |
2 | // QuickBook Example | |
3 | ||
4 | // Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands. | |
5 | ||
6 | // Use, modification and distribution is subject to the Boost Software License, | |
7 | // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | |
8 | // http://www.boost.org/LICENSE_1_0.txt) | |
9 | ||
10 | //[num_interior_rings | |
11 | //` Get the number of interior rings in a multi-polygon | |
12 | ||
13 | #include <iostream> | |
14 | ||
15 | #include <boost/geometry.hpp> | |
16 | #include <boost/geometry/geometries/point_xy.hpp> | |
17 | #include <boost/geometry/geometries/polygon.hpp> | |
18 | #include <boost/geometry/geometries/multi_polygon.hpp> | |
19 | ||
20 | ||
21 | int main() | |
22 | { | |
23 | boost::geometry::model::multi_polygon | |
24 | < | |
25 | boost::geometry::model::polygon | |
26 | < | |
27 | boost::geometry::model::d2::point_xy<double> | |
28 | > | |
29 | > mp; | |
30 | boost::geometry::read_wkt("MULTIPOLYGON(((0 0,0 10,10 0,0 0),(1 1,1 9,9 1,1 1)),((10 10,10 7,7 10,10 10)))", mp); | |
31 | std::cout << "Number of interior rings: " << boost::geometry::num_interior_rings(mp) << std::endl; | |
32 | ||
33 | return 0; | |
34 | } | |
35 | ||
36 | //] | |
37 | ||
38 | ||
39 | //[num_interior_rings_output | |
40 | /*` | |
41 | Output: | |
42 | [pre | |
43 | Number of interior rings: 1 | |
44 | ] | |
45 | */ | |
46 | //] |