]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/doc/src/examples/geometries/register/ring_templated.cpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
4 // Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
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)
10 //[register_ring_templated
11 //` Show the use of the macro BOOST_GEOMETRY_REGISTER_RING_TEMPLATED
16 #include <boost/geometry.hpp>
17 #include <boost/geometry/geometries/point_xy.hpp>
18 #include <boost/geometry/geometries/register/ring.hpp>
20 // Adapt any deque to Boost.Geometry Ring Concept
21 BOOST_GEOMETRY_REGISTER_RING_TEMPLATED(std::deque
)
25 std::deque
<boost::geometry::model::d2::point_xy
<double> > ring(3);
26 boost::geometry::assign_values(ring
[0], 0, 0);
27 boost::geometry::assign_values(ring
[2], 4, 1);
28 boost::geometry::assign_values(ring
[1], 1, 4);
30 // Boost.Geometry algorithms work on any deque now
31 boost::geometry::correct(ring
);
32 std::cout
<< "Area: " << boost::geometry::area(ring
) << std::endl
;
33 std::cout
<< "Contents: " << boost::geometry::wkt(ring
) << std::endl
;
41 //[register_ring_templated_output
46 Line: ((0, 0), (1, 4), (4, 1), (0, 0))