Imported Upstream version 1.57.0
[platform/upstream/boost.git] / libs / geometry / doc / src / examples / algorithms / is_simple.cpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2 // QuickBook Example
3
4 // Copyright (c) 2014, Oracle and/or its affiliates
5
6 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
7
8 // Licensed under the Boost Software License version 1.0.
9 // http://www.boost.org/users/license.html
10
11 //[is_simple
12 //` Checks whether a geometry is simple
13
14 #include <iostream>
15
16 #include <boost/geometry.hpp>
17 #include <boost/geometry/geometries/point_xy.hpp>
18 #include <boost/geometry/geometries/linestring.hpp>
19 #include <boost/geometry/geometries/multi_linestring.hpp>
20 /*<-*/ #include "create_svg_one.hpp" /*->*/
21
22 int main()
23 {
24     typedef boost::geometry::model::d2::point_xy<double> point_type;
25     typedef boost::geometry::model::linestring<point_type> linestring_type;
26     typedef boost::geometry::model::multi_linestring<linestring_type> multi_linestring_type;
27
28     multi_linestring_type multi_linestring;
29     boost::geometry::read_wkt("MULTILINESTRING((0 0,0 10,10 10,10 0,0 0),(10 10,20 20))", multi_linestring);
30
31     std::cout << "is simple? "
32               << (boost::geometry::is_simple(multi_linestring) ? "yes" : "no")
33               << std::endl;
34     /*<-*/ create_svg("is_simple_example.svg", multi_linestring); /*->*/
35     return 0;
36 }
37
38 //]
39
40 //[is_simple_output
41 /*`
42 Output:
43 [pre
44 is simple? no
45
46 [$img/algorithms/is_simple_example.png]
47
48 ]
49
50 */
51 //]