diff --git a/test/algorithms/touches/Jamfile b/test/algorithms/touches/Jamfile index fcce33366..8919360ab 100644 --- a/test/algorithms/touches/Jamfile +++ b/test/algorithms/touches/Jamfile @@ -4,8 +4,8 @@ # Copyright (c) 2008-2015 Bruno Lalande, Paris, France. # Copyright (c) 2009-2015 Mateusz Loskot, London, UK. # -# This file was modified by Oracle on 2014, 2015, 2016. -# Modifications copyright (c) 2014-2016, Oracle and/or its affiliates. +# This file was modified by Oracle on 2014-2022. +# Modifications copyright (c) 2014-2022, Oracle and/or its affiliates. # # Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle # Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle @@ -18,6 +18,7 @@ test-suite boost-geometry-algorithms-touches : [ run touches.cpp : : : : algorithms_touches ] [ run touches_box.cpp : : : : algorithms_touches_box ] + [ run touches_gc.cpp : : : : algorithms_touches_gc ] [ run touches_multi.cpp : : : : algorithms_touches_multi ] [ run touches_self.cpp : : : : algorithms_touches_self ] [ run touches_sph.cpp : : : : algorithms_touches_sph ] diff --git a/test/algorithms/touches/test_touches.hpp b/test/algorithms/touches/test_touches.hpp index fa7e39a34..f4178c411 100644 --- a/test/algorithms/touches/test_touches.hpp +++ b/test/algorithms/touches/test_touches.hpp @@ -92,7 +92,7 @@ void test_touches(std::string const& wkt1, boost::variant v1(geometry1); boost::variant v2(geometry2); - typedef typename bg::strategy::relate::services::default_strategy + typedef typename bg::strategies::relate::services::default_strategy < Geometry1, Geometry2 >::type strategy_type; diff --git a/test/algorithms/touches/touches_gc.cpp b/test/algorithms/touches/touches_gc.cpp new file mode 100644 index 000000000..650a90fde --- /dev/null +++ b/test/algorithms/touches/touches_gc.cpp @@ -0,0 +1,70 @@ +// Boost.Geometry + +// Copyright (c) 2022 Oracle and/or its affiliates. +// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include "test_touches.hpp" + +using pt_t = bg::model::point; +using ls_t = bg::model::linestring; +using po_t = bg::model::polygon; +using mpt_t = bg::model::multi_point; +using mls_t = bg::model::multi_linestring; +using mpo_t = bg::model::multi_polygon; +using var_t = boost::variant; +//using var_t = boost::variant2::variant; +using gc_t = bg::model::geometry_collection; + +void test_gc() +{ + test_geometry("GEOMETRYCOLLECTION(POLYGON((0 0,0 10,10 10,10 0,0 0)), LINESTRING(5 10, 10 11, 15 10))", + "GEOMETRYCOLLECTION(POLYGON((10 0,10 10,20 10,20 0,10 0)), POINT(15 5))", + true); + test_geometry("GEOMETRYCOLLECTION(POLYGON((0 0,0 10,10 10,10 0,0 0)), LINESTRING(5 10, 10 11, 15 10))", + "GEOMETRYCOLLECTION(POLYGON((10 0,10 10,20 10,20 0,10 0)), POINT(5 0))", + true); + test_geometry("GEOMETRYCOLLECTION(POLYGON((0 0,0 10,9 10,9 0,0 0)), LINESTRING(5 10, 10 11, 15 10))", + "GEOMETRYCOLLECTION(POLYGON((10 0,10 10,20 10,20 0,10 0)), POINT(15 5))", + true); + test_geometry("GEOMETRYCOLLECTION(POLYGON((0 0,0 10,9 10,9 0,0 0)), LINESTRING(5 10, 10 11, 15 10))", + "GEOMETRYCOLLECTION(POLYGON((10 0,10 10,20 10,20 0,10 0)), POINT(5 0))", + true); + test_geometry("GEOMETRYCOLLECTION(POLYGON((0 0,0 10,9 10,9 0,0 0)), LINESTRING(5 10, 10 11, 15 10, 15 5))", + "GEOMETRYCOLLECTION(POLYGON((10 0,10 10,20 10,20 0,10 0)), POINT(15 5))", + false); + + test_geometry("GEOMETRYCOLLECTION(POLYGON((0 10,0 20,10 20,10 10,0 10)), POLYGON((10 0,10 10,20 10,20 0,10 0))," + " POLYGON((20 10,20 20,30 20,30 10,20 10)), POLYGON((10 20,10 30,20 30,20 20,10 20)))", + "GEOMETRYCOLLECTION(POLYGON((10 10,10 20,20 20,20 10,10 10)), LINESTRING(11 11,19 19))", + true); + + test_geometry("GEOMETRYCOLLECTION(POINT(2 2))", + "GEOMETRYCOLLECTION(LINESTRING(0 0, 1 1), LINESTRING(1 1, 2 2))", + true); + test_geometry("GEOMETRYCOLLECTION(POINT(1 1))", + "GEOMETRYCOLLECTION(LINESTRING(0 0, 1 1), LINESTRING(1 1, 2 2))", + false); + + test_geometry("GEOMETRYCOLLECTION(POLYGON((0 0,0 5,5 5,5 0,0 0)), LINESTRING(1 1, 6 6))", + "GEOMETRYCOLLECTION(POLYGON((0 0,0 5,5 5,5 0,0 0)), LINESTRING(5 5, 6 6))", + false); + + test_geometry("POLYGON((0 0,0 10,10 10,10 0,0 0))", + "GEOMETRYCOLLECTION(POLYGON((10 0,10 10,20 10,20 0,10 0)), POINT(15 5))", + true); + + test_geometry("GEOMETRYCOLLECTION(POLYGON((10 0,10 10,20 10,20 0,10 0)), POINT(15 5))", + "POLYGON((0 0,0 10,10 10,10 0,0 0))", + true); +} + +int test_main(int , char* []) +{ + test_gc(); + + return 0; +}