]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/doc/src/examples/algorithms/num_geometries.cpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / geometry / doc / src / examples / algorithms / num_geometries.cpp
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_geometries
11 //` Get the number of geometries making up a multi-geometry
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 geometries: " << boost::geometry::num_geometries(mp) << std::endl;
32
33 return 0;
34 }
35
36 //]
37
38
39 //[num_geometries_output
40 /*`
41 Output:
42 [pre
43 Number of geometries: 2
44 ]
45 */
46 //]