]>
Commit | Line | Data |
---|---|---|
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 | //[boost_range_sliced | |
11 | //` Shows how to use a Boost.Geometry linestring, sliced by Boost.Range adaptor | |
12 | ||
13 | #include <iostream> | |
14 | ||
15 | #include <boost/assign.hpp> | |
16 | ||
17 | #include <boost/geometry.hpp> | |
18 | #include <boost/geometry/geometries/linestring.hpp> | |
19 | #include <boost/geometry/geometries/point_xy.hpp> | |
20 | #include <boost/geometry/geometries/adapted/boost_range/sliced.hpp> | |
21 | ||
22 | ||
23 | int main() | |
24 | { | |
25 | using namespace boost::assign; | |
26 | ||
27 | typedef boost::geometry::model::d2::point_xy<int> xy; | |
28 | boost::geometry::model::linestring<xy> line; | |
29 | line += xy(0, 0); | |
30 | line += xy(1, 1); | |
31 | line += xy(2, 2); | |
32 | line += xy(3, 3); | |
33 | line += xy(4, 4); | |
34 | ||
35 | std::cout | |
36 | << boost::geometry::dsv(line | boost::adaptors::sliced(1, 3)) << std::endl; | |
37 | ||
38 | return 0; | |
39 | } | |
40 | ||
41 | //] | |
42 | ||
43 | //[boost_range_sliced_output | |
44 | /*` | |
45 | Output: | |
46 | [pre | |
47 | ((1, 1), (2, 2)) | |
48 | ] | |
49 | */ | |
50 | //] |