]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/doc/src/examples/geometries/register/linestring.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
11 //` Show the use of BOOST_GEOMETRY_REGISTER_LINESTRING
15 #include <boost/geometry.hpp>
16 #include <boost/geometry/geometries/point_xy.hpp>
17 #include <boost/geometry/geometries/register/linestring.hpp>
19 typedef boost::geometry::model::d2::point_xy
<double> point_2d
;
21 BOOST_GEOMETRY_REGISTER_LINESTRING(std::vector
<point_2d
>)
25 // Normal usage of std::
26 std::vector
<point_2d
> line
;
27 line
.push_back(point_2d(1, 1));
28 line
.push_back(point_2d(2, 2));
29 line
.push_back(point_2d(3, 1));
31 // Usage of Boost.Geometry's length and wkt functions
32 std::cout
<< "Length: "
33 << boost::geometry::length(line
)
37 << boost::geometry::wkt(line
)
46 //[register_linestring_output
51 WKT: LINESTRING(1 1,2 2,3 1)