]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/test/algorithms/relational_operations/covered_by/covered_by_multi.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / geometry / test / algorithms / relational_operations / covered_by / covered_by_multi.cpp
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/algorithms/correct.hpp>
11 #include <boost/geometry/algorithms/covered_by.hpp>
12
13 #include <boost/geometry/geometries/box.hpp>
14
15 #include <boost/geometry/core/point_order.hpp>
16
17 #include <boost/geometry/geometries/point_xy.hpp>
18 #include <boost/geometry/geometries/multi_polygon.hpp>
19
20 #include <boost/geometry/io/wkt/wkt.hpp>
21
22 #include "test_covered_by.hpp"
23
24
25 template <typename P>
26 void test_all()
27 {
28 typedef bg::model::multi_polygon<bg::model::polygon<P> > mp;
29
30 // test multi-with-one-polygon (trivial case)
31 test_geometry<P, mp>("POINT(1 1)", "MULTIPOLYGON(((0 0,0 2,2 2,2 0,0 0)))", true);
32 test_geometry<P, mp>("POINT(3 3)", "MULTIPOLYGON(((0 0,0 2,2 2,2 0,0 0)))", false);
33 test_geometry<P, mp>("POINT(0 1)", "MULTIPOLYGON(((0 0,0 2,2 2,2 0,0 0)))", true);
34 test_geometry<P, mp>("POINT(4 4)", "MULTIPOLYGON(((0 0,0 2,2 2,2 0,0 0)))", false);
35
36 // test if it is in one of them
37 std::string multi("MULTIPOLYGON("
38 "((0 0,0 2,2 2,2 0,0 0))"
39 "((3 3,3 6,6 6,6 3,3 3))"
40 ")");
41 test_geometry<P, mp>("POINT(4 4)", multi, true);
42 test_geometry<P, mp>("POINT(1 1)", multi, true);
43 test_geometry<P, mp>("POINT(0 1)", multi, true);
44 }
45
46 int test_main( int , char* [] )
47 {
48 //test_all<bg::model::d2::point_xy<int> >();
49 test_all<bg::model::d2::point_xy<double> >();
50
51 #if defined(HAVE_TTMATH)
52 test_all<bg::model::d2::point_xy<ttmath_big> >();
53 #endif
54
55 return 0;
56 }