Imported Upstream version 1.57.0
[platform/upstream/boost.git] / libs / geometry / doc / src / examples / core / closure.cpp
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 //[closure
11 //` Examine if a polygon is defined as "should be closed"
12
13 #include <iostream>
14
15 #include <boost/geometry.hpp>
16 #include <boost/geometry/geometries/polygon.hpp>
17 #include <boost/geometry/geometries/point_xy.hpp>
18
19 int main()
20 {
21     typedef boost::geometry::model::d2::point_xy<double> point_type;
22     typedef boost::geometry::model::polygon<point_type> polygon_type;
23
24     boost::geometry::closure_selector clos = boost::geometry::closure<polygon_type>::value;
25
26     std::cout << "closure: " << clos << std::endl
27         << "(open = " << boost::geometry::open
28         << ", closed = " << boost::geometry::closed
29         << ") "<< std::endl;
30
31     return 0;
32 }
33
34 //]
35
36
37 //[closure_output
38 /*`
39 Output:
40 [pre
41 closure: 1
42 (open = 0, closed = 1)
43 ]
44 */
45 //]