]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // Boost.Geometry (aka GGL, Generic Geometry Library) |
2 | // QuickBook Example | |
3 | ||
4 | // Copyright (c) 2014 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 | //[buffer_point_square | |
11 | //` Shows how the point_square strategy can be used as a PointStrategy to create square buffers where the original point lies in the center | |
12 | ||
13 | ||
14 | #include <boost/geometry.hpp> | |
15 | #include <boost/geometry/geometries/point_xy.hpp> | |
16 | #include <boost/geometry/geometries/geometries.hpp> | |
17 | /*<-*/ #include "../examples_utils/create_svg_buffer.hpp" /*->*/ | |
18 | ||
19 | int main() | |
20 | { | |
21 | typedef boost::geometry::model::d2::point_xy<double> point; | |
22 | typedef boost::geometry::model::polygon<point> polygon; | |
23 | ||
24 | // Declare the point_square strategy | |
25 | boost::geometry::strategy::buffer::point_square point_strategy; | |
26 | ||
27 | // Declare other strategies | |
28 | boost::geometry::strategy::buffer::distance_symmetric<double> distance_strategy(0.5); | |
29 | boost::geometry::strategy::buffer::join_round join_strategy; | |
30 | boost::geometry::strategy::buffer::end_round end_strategy; | |
31 | boost::geometry::strategy::buffer::side_straight side_strategy; | |
32 | ||
33 | // Declare/fill of a multi point | |
34 | boost::geometry::model::multi_point<point> mp; | |
35 | boost::geometry::read_wkt("MULTIPOINT((3 3),(3 4),(4 4),(7 3))", mp); | |
36 | ||
37 | // Create the buffer of a multi point | |
38 | boost::geometry::model::multi_polygon<polygon> result; | |
39 | boost::geometry::buffer(mp, result, | |
40 | distance_strategy, side_strategy, | |
41 | join_strategy, end_strategy, point_strategy); | |
42 | /*<-*/ create_svg_buffer("buffer_point_square.svg", mp, result); /*->*/ | |
43 | ||
44 | return 0; | |
45 | } | |
46 | ||
47 | //] | |
48 |