]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/test/algorithms/relational_operations/within/within_linear_areal.cpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
3 // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
4 // Copyright (c) 2013-2015 Adam Wulkiewicz, Lodz, Poland.
6 // This file was modified by Oracle on 2014, 2015, 2016.
7 // Modifications copyright (c) 2014-2016 Oracle and/or its affiliates.
9 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
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)
15 #include "test_within.hpp"
18 #include <boost/geometry/geometries/geometries.hpp>
19 #include <boost/geometry/geometries/point_xy.hpp>
20 #include <boost/geometry/geometries/multi_linestring.hpp>
21 #include <boost/geometry/geometries/multi_polygon.hpp>
23 template <typename P1
, typename P2
>
26 typedef bg::model::linestring
<P1
> ls
;
27 typedef bg::model::multi_linestring
<ls
> mls
;
28 typedef bg::model::polygon
<P2
> poly
;
29 typedef bg::model::ring
<P2
> ring
;
30 typedef bg::model::multi_polygon
<poly
> mpoly
;
33 test_geometry
<ls
, ring
>("LINESTRING(0 0, 2 2)", "POLYGON((0 0,0 5,5 5,5 0,0 0))", true);
36 test_geometry
<ls
, poly
>("LINESTRING(0 0, 2 2)", "POLYGON((0 0,0 5,5 5,5 0,0 0))", true);
38 test_geometry
<ls
, poly
>("LINESTRING(1 1, 2 2)", "POLYGON((0 0,0 5,5 5,5 0,0 0))", true);
40 test_geometry
<ls
, poly
>("LINESTRING(1 1, 6 6)", "POLYGON((0 0,0 5,5 5,5 0,0 0))", false);
42 test_geometry
<ls
, poly
>("LINESTRING(0 0, 5 0)", "POLYGON((0 0,0 5,5 5,5 0,0 0))", false);
43 test_geometry
<ls
, poly
>("LINESTRING(0 0, 0 5)", "POLYGON((0 0,0 5,5 5,5 0,0 0))", false);
45 test_geometry
<ls
, poly
>("LINESTRING(6 0, 6 5)", "POLYGON((0 0,0 5,5 5,5 0,0 0))", false);
48 test_geometry
<ls
, mpoly
>("LINESTRING(0 0, 10 10)", "MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0)),((5 5,5 10,10 10,10 5,5 5)))", true);
50 test_geometry
<ls
, mpoly
>("LINESTRING(0 0, 10 10)", "MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0)),((6 6,5 10,10 10,10 5,6 6)))", false);
52 // MySQL report 18.12.2014 (https://svn.boost.org/trac/boost/ticket/10887)
53 test_geometry
<ls
, mpoly
>("LINESTRING(5 -2,5 2)",
54 "MULTIPOLYGON(((5 0,0 5,10 5,5 0)),((5 0,10 -5,0 -5,5 0)))",
56 test_geometry
<ls
, mpoly
>("LINESTRING(5 -2,5 5)",
57 "MULTIPOLYGON(((5 0,0 5,10 5,5 0)),((5 0,10 -5,0 -5,5 0)))",
59 test_geometry
<ls
, mpoly
>("LINESTRING(5 -2,5 0)",
60 "MULTIPOLYGON(((5 0,0 5,10 5,5 0)),((5 0,10 -5,0 -5,5 0)))",
62 // MySQL report 18.12.2014 - extended
63 test_geometry
<ls
, mpoly
>("LINESTRING(5 -2,5 0)",
64 "MULTIPOLYGON(((5 0,0 5,10 5,5 0)),((5 0,10 -5,0 -5,5 0)),((5 0,7 1,7 -1,5 0)))",
66 test_geometry
<ls
, mpoly
>("LINESTRING(0 0,5 0)",
67 "MULTIPOLYGON(((5 0,0 5,10 5,5 0)),((5 0,10 -5,0 -5,5 0)),((5 0,7 1,7 -1,5 0)))",
69 test_geometry
<mls
, mpoly
>("MULTILINESTRING((5 -2,4 -2,5 0),(5 -2,6 -2,5 0))",
70 "MULTIPOLYGON(((5 0,0 5,10 5,5 0)),((5 0,10 -5,0 -5,5 0)))",
72 test_geometry
<mls
, mpoly
>("MULTILINESTRING((0 0,0 1,5 0),(0 0,0 -1,5 0))",
73 "MULTIPOLYGON(((5 0,0 5,10 5,5 0)),((5 0,10 -5,0 -5,5 0)))",
75 test_geometry
<mls
, mpoly
>("MULTILINESTRING((5 -2,4 -2,5 0),(6 -2,5 0))",
76 "MULTIPOLYGON(((5 0,0 5,10 5,5 0)),((5 0,10 -5,0 -5,5 0)))",
78 test_geometry
<mls
, mpoly
>("MULTILINESTRING((0 0,0 1,5 0),(0 -1,5 0))",
79 "MULTIPOLYGON(((5 0,0 5,10 5,5 0)),((5 0,10 -5,0 -5,5 0)))",
81 test_geometry
<mls
, mpoly
>("MULTILINESTRING((0 0,5 0),(5 -2,5 0))",
82 "MULTIPOLYGON(((5 0,0 5,10 5,5 0)),((5 0,10 -5,0 -5,5 0)))",
84 test_geometry
<mls
, mpoly
>("MULTILINESTRING((5 -2,5 0),(0 0,5 0))",
85 "MULTIPOLYGON(((5 0,0 5,10 5,5 0)),((5 0,10 -5,0 -5,5 0)))",
89 test_geometry
<mls
, poly
>("MULTILINESTRING((0 0,2 2),(2 2,3 3))", "POLYGON((0 0,0 5,5 5,5 0,0 0))", true);
91 test_geometry
<mls
, poly
>("MULTILINESTRING((1 1,2 2),(6 6,7 7))", "POLYGON((0 0,0 5,5 5,5 0,0 0))", false);
94 test_geometry
<mls
, mpoly
>("MULTILINESTRING((1 1,5 5),(6 6,7 7))",
95 "MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0)),((5 5,5 10,10 10,10 5,5 5)))",
98 test_geometry
<mls
, mpoly
>("MULTILINESTRING((1 1,5 5),(11 11,12 12))",
99 "MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0)),((5 5,5 10,10 10,10 5,5 5)))",
103 template <typename P1
, typename P2
>
109 template <typename P
>
115 int test_main( int , char* [] )
117 test_all
<bg::model::d2::point_xy
<int> >();
118 test_all
<bg::model::d2::point_xy
<double> >();
119 test_all
<bg::model::d2::point_xy
<double>, bg::model::point
<double, 2, bg::cs::cartesian
> >();
122 #if defined(HAVE_TTMATH)
123 test_all
<bg::model::d2::point_xy
<ttmath_big
> >();