]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/doc/src/examples/geometries/register/linestring_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_linestring_templated
11 //` Show the use of the macro BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED
16 #include <boost/geometry.hpp>
17 #include <boost/geometry/geometries/point_xy.hpp>
18 #include <boost/geometry/geometries/register/linestring.hpp>
20 // Adapt any deque to Boost.Geometry Linestring Concept
21 BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED(std::deque
)
25 std::deque
<boost::geometry::model::d2::point_xy
<double> > line(2);
26 boost::geometry::assign_values(line
[0], 1, 1);
27 boost::geometry::assign_values(line
[1], 2, 2);
29 // Boost.Geometry algorithms work on any deque now
30 std::cout
<< "Length: " << boost::geometry::length(line
) << std::endl
;
31 std::cout
<< "Line: " << boost::geometry::dsv(line
) << std::endl
;
39 //[register_linestring_templated_output
44 Line: ((1, 1), (2, 2))