mirror of
https://github.com/boostorg/geometry.git
synced 2025-05-09 23:24:02 +00:00
[test][overlaps] Add tests for GC and DG
This commit is contained in:
parent
17b939e07f
commit
040636c6c3
@ -4,8 +4,8 @@
|
|||||||
# Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
|
# Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
|
||||||
# Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
|
# Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
|
||||||
#
|
#
|
||||||
# This file was modified by Oracle on 2014, 2015, 2016.
|
# This file was modified by Oracle on 2014-2022.
|
||||||
# Modifications copyright (c) 2014-2016, Oracle and/or its affiliates.
|
# 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 Menelaos Karavelas, on behalf of Oracle
|
||||||
# Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
# Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
||||||
@ -19,6 +19,7 @@ test-suite boost-geometry-algorithms-overlaps
|
|||||||
[ run overlaps.cpp : : : : algorithms_overlaps ]
|
[ run overlaps.cpp : : : : algorithms_overlaps ]
|
||||||
[ run overlaps_areal.cpp : : : : algorithms_overlaps_areal ]
|
[ run overlaps_areal.cpp : : : : algorithms_overlaps_areal ]
|
||||||
[ run overlaps_box.cpp : : : : algorithms_overlaps_box ]
|
[ run overlaps_box.cpp : : : : algorithms_overlaps_box ]
|
||||||
|
[ run overlaps_gc.cpp : : : : algorithms_overlaps_gc ]
|
||||||
[ run overlaps_sph.cpp : : : : algorithms_overlaps_sph ]
|
[ run overlaps_sph.cpp : : : : algorithms_overlaps_sph ]
|
||||||
;
|
;
|
||||||
|
|
||||||
|
58
test/algorithms/overlaps/overlaps_gc.cpp
Normal file
58
test/algorithms/overlaps/overlaps_gc.cpp
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
// 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_overlaps.hpp"
|
||||||
|
|
||||||
|
using pt_t = bg::model::point<double, 2, bg::cs::cartesian>;
|
||||||
|
using ls_t = bg::model::linestring<pt_t>;
|
||||||
|
using po_t = bg::model::polygon<pt_t>;
|
||||||
|
using mpt_t = bg::model::multi_point<pt_t>;
|
||||||
|
using mls_t = bg::model::multi_linestring<ls_t>;
|
||||||
|
using mpo_t = bg::model::multi_polygon<po_t>;
|
||||||
|
using var_t = boost::variant<pt_t, ls_t, po_t, mpt_t, mls_t, mpo_t>;
|
||||||
|
//using var_t = boost::variant2::variant<pt_t, ls_t, po_t, mpt_t, mls_t, mpo_t>;
|
||||||
|
using gc_t = bg::model::geometry_collection<var_t>;
|
||||||
|
|
||||||
|
void test_gc()
|
||||||
|
{
|
||||||
|
test_geometry<gc_t, gc_t>("GEOMETRYCOLLECTION(MULTIPOINT(0 0,1 1,2 2))",
|
||||||
|
"GEOMETRYCOLLECTION(MULTIPOINT(1 1,3 3,4 4))",
|
||||||
|
true);
|
||||||
|
test_geometry<gc_t, gc_t>("GEOMETRYCOLLECTION(MULTIPOINT(0 0,1 1,2 2))",
|
||||||
|
"GEOMETRYCOLLECTION(MULTIPOINT(1 1,2 2))",
|
||||||
|
false);
|
||||||
|
|
||||||
|
test_geometry<gc_t, gc_t>("GEOMETRYCOLLECTION(POINT(0 0), POINT(1 1), POINT(2 2))",
|
||||||
|
"GEOMETRYCOLLECTION(POINT(1 1), POINT(3 3), POINT(4 4))",
|
||||||
|
true);
|
||||||
|
test_geometry<gc_t, gc_t>("GEOMETRYCOLLECTION(POINT(0 0), POINT(1 1), POINT(2 2))",
|
||||||
|
"GEOMETRYCOLLECTION(POINT(1 1), POINT(2 2))",
|
||||||
|
false);
|
||||||
|
|
||||||
|
test_geometry<mpt_t, gc_t>("MULTIPOINT(0 0,1 1,2 2)",
|
||||||
|
"GEOMETRYCOLLECTION(MULTIPOINT(1 1,3 3,4 4))",
|
||||||
|
true);
|
||||||
|
test_geometry<gc_t, mpt_t>("GEOMETRYCOLLECTION(MULTIPOINT(0 0,1 1,2 2))",
|
||||||
|
"MULTIPOINT(1 1,2 2)",
|
||||||
|
false);
|
||||||
|
|
||||||
|
test_geometry<gc_t, mpt_t>("GEOMETRYCOLLECTION(MULTIPOINT(0 0,1 1,2 2))",
|
||||||
|
"MULTIPOINT(1 1,3 3,4 4)",
|
||||||
|
true);
|
||||||
|
test_geometry<mpt_t, gc_t>("MULTIPOINT(0 0,1 1,2 2)",
|
||||||
|
"GEOMETRYCOLLECTION(MULTIPOINT(1 1,2 2))",
|
||||||
|
false);
|
||||||
|
}
|
||||||
|
|
||||||
|
int test_main(int , char* [])
|
||||||
|
{
|
||||||
|
test_gc();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
|
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
|
||||||
|
|
||||||
// This file was modified by Oracle on 2015, 2017.
|
// This file was modified by Oracle on 2015-2022.
|
||||||
// Modifications copyright (c) 2015-2017 Oracle and/or its affiliates.
|
// Modifications copyright (c) 2015-2022 Oracle and/or its affiliates.
|
||||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
||||||
|
|
||||||
// Use, modification and distribution is subject to the Boost Software License,
|
// Use, modification and distribution is subject to the Boost Software License,
|
||||||
@ -17,12 +17,10 @@
|
|||||||
|
|
||||||
#include <geometry_test_common.hpp>
|
#include <geometry_test_common.hpp>
|
||||||
|
|
||||||
#include <boost/geometry/core/ring_type.hpp>
|
#include <boost/variant/variant.hpp>
|
||||||
#include <boost/geometry/algorithms/overlaps.hpp>
|
|
||||||
#include <boost/geometry/strategies/strategies.hpp>
|
|
||||||
#include <boost/geometry/geometries/geometries.hpp>
|
|
||||||
#include <boost/geometry/geometries/point_xy.hpp>
|
|
||||||
|
|
||||||
|
#include <boost/geometry/algorithms/overlaps.hpp>
|
||||||
|
#include <boost/geometry/geometries/geometries.hpp>
|
||||||
#include <boost/geometry/io/wkt/read.hpp>
|
#include <boost/geometry/io/wkt/read.hpp>
|
||||||
|
|
||||||
|
|
||||||
@ -82,12 +80,19 @@ void test_geometry(std::string const& wkt1,
|
|||||||
|
|
||||||
test_geometry(geometry1, geometry2, wkt1, wkt2, expected, no_strategy());
|
test_geometry(geometry1, geometry2, wkt1, wkt2, expected, no_strategy());
|
||||||
|
|
||||||
typedef typename bg::strategy::relate::services::default_strategy
|
typedef typename bg::strategies::relate::services::default_strategy
|
||||||
<
|
<
|
||||||
Geometry1, Geometry2
|
Geometry1, Geometry2
|
||||||
>::type strategy_type;
|
>::type strategy_type;
|
||||||
|
|
||||||
test_geometry(geometry1, geometry2, wkt1, wkt2, expected, strategy_type());
|
test_geometry(geometry1, geometry2, wkt1, wkt2, expected, strategy_type());
|
||||||
|
|
||||||
|
boost::variant<Geometry1> v1 = geometry1;
|
||||||
|
boost::variant<Geometry2> v2 = geometry2;
|
||||||
|
|
||||||
|
test_geometry(v1, geometry2, wkt1, wkt2, expected, no_strategy());
|
||||||
|
test_geometry(geometry1, v2, wkt1, wkt2, expected, no_strategy());
|
||||||
|
test_geometry(v1, v2, wkt1, wkt2, expected, no_strategy());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user