]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/geometry/doc/src/examples/geometries/register/multi_polygon.cpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / geometry / doc / src / examples / geometries / register / multi_polygon.cpp
CommitLineData
7c673cae
FG
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//[register_multi_polygon
11//` Show the use of the macro BOOST_GEOMETRY_REGISTER_MULTI_POLYGON
12
13#include <iostream>
14
15#include <boost/geometry.hpp>
16#include <boost/geometry/geometries/polygon.hpp>
17#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
18#include <boost/geometry/geometries/register/multi_polygon.hpp>
19
20typedef boost::geometry::model::polygon
21 <
22 boost::tuple<float, float>
23 > polygon_type;
24
25BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
26BOOST_GEOMETRY_REGISTER_MULTI_POLYGON(std::vector<polygon_type>)
27
28int main()
29{
30 // Normal usage of std::
31 std::vector<polygon_type> polygons(2);
32 boost::geometry::read_wkt("POLYGON((0 0,0 1,1 1,1 0,0 0))", polygons[0]);
33 boost::geometry::read_wkt("POLYGON((3 0,3 1,4 1,4 0,3 0))", polygons[1]);
34
35 // Usage of Boost.Geometry
36 std::cout << "AREA: " << boost::geometry::area(polygons) << std::endl;
37
38 return 0;
39}
40
41//]
42
43
44//[register_multi_polygon_output
45/*`
46Output:
47[pre
48AREA: 2
49]
50*/
51//]