]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // Boost.Geometry (aka GGL, Generic Geometry Library) |
2 | // | |
3 | // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands. | |
4 | // Use, modification and distribution is subject to the Boost Software License, | |
5 | // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | |
6 | // http://www.boost.org/LICENSE_1_0.txt) | |
7 | ||
8 | #include <geometry_test_common.hpp> | |
9 | ||
10 | #include <boost/geometry/io/wkt/wkt.hpp> | |
11 | ||
12 | #include <boost/geometry/algorithms/correct.hpp> | |
13 | #include <boost/geometry/algorithms/within.hpp> | |
14 | ||
15 | #include <boost/geometry/geometries/box.hpp> | |
16 | #include <boost/geometry/geometries/polygon.hpp> | |
17 | #include <boost/geometry/geometries/point_xy.hpp> | |
18 | #include <boost/geometry/geometries/multi_polygon.hpp> | |
19 | ||
20 | #include "test_within.hpp" | |
21 | ||
22 | ||
23 | template <typename P> | |
24 | void test_all() | |
25 | { | |
26 | typedef bg::model::multi_polygon<bg::model::polygon<P> > mp; | |
27 | ||
28 | // test multi-with-one-polygon (trivial case) | |
29 | test_geometry<P, mp>("POINT(1 1)", "MULTIPOLYGON(((0 0,0 2,2 2,2 0,0 0)))", true); | |
30 | test_geometry<P, mp>("POINT(3 3)", "MULTIPOLYGON(((0 0,0 2,2 2,2 0,0 0)))", false); | |
31 | test_geometry<P, mp>("POINT(0 1)", "MULTIPOLYGON(((0 0,0 2,2 2,2 0,0 0)))", false); | |
32 | test_geometry<P, mp>("POINT(4 4)", "MULTIPOLYGON(((0 0,0 2,2 2,2 0,0 0)))", false); | |
33 | ||
34 | // test if it is in one of them | |
35 | std::string multi("MULTIPOLYGON(" | |
36 | "((0 0,0 2,2 2,2 0,0 0))" | |
37 | "((3 3,3 6,6 6,6 3,3 3))" | |
38 | ")"); | |
39 | test_geometry<P, mp>("POINT(4 4)", multi, true); | |
40 | test_geometry<P, mp>("POINT(1 1)", multi, true); | |
41 | test_geometry<P, mp>("POINT(0 1)", multi, false); | |
42 | } | |
43 | ||
44 | int test_main( int , char* [] ) | |
45 | { | |
46 | //test_all<bg::model::d2::point_xy<int> >(); | |
47 | test_all<bg::model::d2::point_xy<double> >(); | |
48 | ||
7c673cae FG |
49 | return 0; |
50 | } |