Ticket #6585: test1.cpp

File test1.cpp, 2.0 KB (added by Aleksey Tulinov <aleksey.tulinov@…>, 2 years ago)
Line 
1
2#include <boost/geometry.hpp>
3#include <boost/geometry/geometries/geometries.hpp>
4#include <boost/geometry/geometries/point_xy.hpp>
5#include <boost/geometry/multi/geometries/multi_point.hpp>
6#include <boost/geometry/multi/geometries/multi_linestring.hpp>
7
8namespace bg = boost::geometry;
9
10typedef bg::model::point<double, 2, bg::cs::cartesian> point_t;
11typedef bg::model::multi_point<point_t> multipoint_t;
12typedef bg::model::linestring<point_t> linestring_t;
13typedef bg::model::multi_linestring<linestring_t> multilinestring_t;
14
15int main()
16{
17    // should fail
18    /*
19    multilinestring_t ml;
20    bg::read_wkt("MULTILINESTRING ((10 10, 20 20, 10 40),"
21    "(40 40, 30 30, 40 20, 30 10)),(0 0, 1 1)", ml);
22    */
23   
24        multipoint_t mp;
25       
26        bg::read_wkt("MULTIPOINT(0 1, 2 3)", mp);
27        for (multipoint_t::const_iterator it = mp.begin(); it != mp.end(); ++it) {
28            std::cout << it->get<0>() << ":" << it->get<1>() << std::endl;
29        }
30       
31        bg::read_wkt("MULTIPOINT((4 5), (6 7))", mp);
32        for (multipoint_t::const_iterator it = mp.begin(); it != mp.end(); ++it) {
33            std::cout << it->get<0>() << ":" << it->get<1>() << std::endl;
34        }
35       
36        // should fail
37        /*
38        bg::read_wkt("MULTIPOINT((8 9), 10 11)", mp);
39        for (multipoint_t::const_iterator it = mp.begin(); it != mp.end(); ++it) {
40            std::cout << it->get<0>() << ":" << it->get<1>() << std::endl;
41        }
42        */
43       
44        // should fail
45        /*
46        bg::read_wkt("MULTIPOINT(12 13, (14 15))", mp);
47        for (multipoint_t::const_iterator it = mp.begin(); it != mp.end(); ++it) {
48            std::cout << it->get<0>() << ":" << it->get<1>() << std::endl;
49        }
50        */
51       
52    // should fail
53    /*
54        bg::read_wkt("MULTIPOINT((16 17), (18 19)", mp);
55        for (multipoint_t::const_iterator it = mp.begin(); it != mp.end(); ++it) {
56            std::cout << it->get<0>() << ":" << it->get<1>() << std::endl;
57        }
58        */
59
60    // should fail
61    /*
62        bg::read_wkt("MULTIPOINT(16 17), (18 19)", mp);
63        for (multipoint_t::const_iterator it = mp.begin(); it != mp.end(); ++it) {
64            std::cout << it->get<0>() << ":" << it->get<1>() << std::endl;
65        }
66        */
67
68        return 0;
69}
70