]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/geometry/test/algorithms/within/within_areal_areal.cpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / libs / geometry / test / algorithms / within / within_areal_areal.cpp
CommitLineData
7c673cae
FG
1// Boost.Geometry (aka GGL, Generic Geometry Library)
2
3// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
4// Copyright (c) 2013-2015 Adam Wulkiewicz, Lodz, Poland.
5
6// This file was modified by Oracle on 2014, 2015, 2016.
7// Modifications copyright (c) 2014-2016 Oracle and/or its affiliates.
8
9// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
10
11// Use, modification and distribution is subject to the Boost Software License,
12// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
13// http://www.boost.org/LICENSE_1_0.txt)
14
15
16#include "test_within.hpp"
17
18
19#include <boost/geometry/geometries/geometries.hpp>
20#include <boost/geometry/geometries/point_xy.hpp>
21#include <boost/geometry/geometries/multi_polygon.hpp>
22
23template <typename P1, typename P2>
24void test_a_a()
25{
26 typedef bg::model::polygon<P1> poly1;
27 typedef bg::model::ring<P1> ring1;
28 typedef bg::model::multi_polygon<poly1> mpoly1;
29 typedef bg::model::polygon<P2> poly2;
30 typedef bg::model::ring<P2> ring2;
31 typedef bg::model::multi_polygon<poly2> mpoly2;
32
33 test_geometry<ring1, ring2>("POLYGON((0 0,0 2,2 2,2 0,0 0))", "POLYGON((0 0,0 5,5 5,5 0,0 0))", true);
34 test_geometry<ring1, poly2>("POLYGON((0 0,0 5,5 5,5 0,0 0))", "POLYGON((0 0,0 5,5 5,5 0,0 0))", true);
35 test_geometry<poly1, ring2>("POLYGON((0 0,0 6,6 6,6 0,0 0))", "POLYGON((0 0,0 5,5 5,5 0,0 0))", false);
36
37 test_geometry<poly1, poly2>("POLYGON((0 0,0 9,9 9,9 0,0 0),(3 3,6 3,6 6,3 6,3 3))",
38 "POLYGON((0 0,0 9,9 9,9 0,0 0),(3 3,6 3,6 6,3 6,3 3))", true);
39 test_geometry<poly1, poly2>("POLYGON((0 0,0 9,9 9,9 0,0 0),(3 3,6 3,6 6,3 6,3 3))",
40 "POLYGON((0 0,0 9,9 9,9 0,0 0),(4 4,5 4,5 5,4 5,4 4))", true);
41 test_geometry<poly1, poly2>("POLYGON((1 1,1 8,8 8,8 1,1 1),(3 3,6 3,6 6,3 6,3 3))",
42 "POLYGON((0 0,0 9,9 9,9 0,0 0),(3 3,6 3,6 6,3 6,3 3))", true);
43 test_geometry<poly1, poly2>("POLYGON((1 1,1 8,8 8,8 1,1 1),(3 3,6 3,6 6,3 6,3 3))",
44 "POLYGON((0 0,0 9,9 9,9 0,0 0),(4 4,5 4,5 5,4 5,4 4))", true);
45
46 test_geometry<ring1, mpoly2>("POLYGON((0 0,0 2,2 2,2 0,0 0))",
47 "MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0)),((5 5,5 10,10 10,10 5,5 5)))", true);
48 test_geometry<poly1, mpoly2>("POLYGON((0 0,0 2,2 2,2 0,0 0))",
49 "MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0)),((5 5,5 10,10 10,10 5,5 5)))", true);
50
51 test_geometry<mpoly1, ring2>("MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0)),((5 5,5 10,10 10,10 5,5 5)))",
52 "POLYGON((0 0,0 10,10 10,10 0,0 0))", true);
53 test_geometry<mpoly1, poly2>("MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0)),((15 15,15 110,110 110,110 15,15 15)))",
54 "POLYGON((0 0,0 10,10 10,10 0,0 0))", false);
55
56 test_geometry<mpoly1, poly2>("MULTIPOLYGON(((0 0,0 1,1 0,0 0)),((3 3,3 4,4 3,3 3)))",
57 "POLYGON((0 0,0 10,10 10,10 0,0 0),(3 3,4 3,4 4,3 4,3 3))", false);
58
59 test_geometry<mpoly1, mpoly2>("MULTIPOLYGON(((0 0,0 1,1 0,0 0)),((3 3,3 4,4 3,3 3)))",
60 "MULTIPOLYGON(((0 0,0 1,1 0,0 0)),((3 3,3 4,4 3,3 3)))", true);
61 test_geometry<mpoly1, mpoly2>("MULTIPOLYGON(((0 0,0 1,1 0,0 0)),((3 3,3 4,4 3,3 3)))",
62 "MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0)),((5 5,5 10,10 10,10 5,5 5)))", true);
63 test_geometry<mpoly1, mpoly2>("MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0)),((5 5,5 10,10 10,10 5,5 5)))",
64 "MULTIPOLYGON(((0 0,0 1,1 0,0 0)),((3 3,3 4,4 3,3 3)))", false);
65
66 // https://svn.boost.org/trac/boost/ticket/10912
67 test_geometry<poly1, poly2>("POLYGON((0 0,0 5,5 5,5 0,0 0))",
68 "POLYGON((0 0,0 10,10 10,10 0,0 0),(2 2,4 2,4 4,2 4,2 2),(6 6,8 6,8 8,6 8,6 6))",
69 false);
70 test_geometry<poly1, poly2>("POLYGON((0 0,0 10,10 10,10 0,0 0))",
71 "POLYGON((0 0,0 10,10 10,10 0,0 0),(2 2,2 4,4 4,4 2,2 2))",
72 false);
73
74 test_geometry<poly1, mpoly2>("POLYGON((0 0,0 5,5 5,5 0,0 0))",
75 "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)),((0 0,0 -10,-10 -10,-10 0,0 0)))",
76 true);
77 test_geometry<poly1, mpoly2>("POLYGON((0 0,0 10,10 10,10 0,0 0))",
78 "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)),((0 0,0 -10,-10 -10,-10 0,0 0)))",
79 true);
80}
81
82template <typename P1, typename P2>
83void test_all()
84{
85 test_a_a<P1, P2>();
86}
87
88template <typename P>
89void test_all()
90{
91 test_a_a<P, P>();
92}
93
94int test_main( int , char* [] )
95{
96 test_all<bg::model::d2::point_xy<int> >();
97 test_all<bg::model::d2::point_xy<double> >();
98 test_all<bg::model::d2::point_xy<double>, bg::model::point<double, 2, bg::cs::cartesian> >();
99
7c673cae
FG
100 return 0;
101}