From b73a401480a0de685b3ca1b8c62ad02ccbd913d2 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 28 Jun 2019 23:25:46 +0200 Subject: [PATCH] [test] Add cs::undefined tests. --- test/Jamfile.v2 | 5 +- test/cs_undefined/Jamfile.v2 | 20 ++ test/cs_undefined/common.hpp | 69 +++++++ test/cs_undefined/distance.cpp | 113 +++++++++++ test/cs_undefined/envelope_expand.cpp | 53 +++++ test/cs_undefined/index.cpp | 101 +++++++++ test/cs_undefined/is.cpp | 44 ++++ test/cs_undefined/measure.cpp | 51 +++++ test/cs_undefined/other.cpp | 40 ++++ test/cs_undefined/relops.cpp | 228 +++++++++++++++++++++ test/cs_undefined/setops.cpp | 281 ++++++++++++++++++++++++++ 11 files changed, 1003 insertions(+), 2 deletions(-) create mode 100644 test/cs_undefined/Jamfile.v2 create mode 100644 test/cs_undefined/common.hpp create mode 100644 test/cs_undefined/distance.cpp create mode 100644 test/cs_undefined/envelope_expand.cpp create mode 100644 test/cs_undefined/index.cpp create mode 100644 test/cs_undefined/is.cpp create mode 100644 test/cs_undefined/measure.cpp create mode 100644 test/cs_undefined/other.cpp create mode 100644 test/cs_undefined/relops.cpp create mode 100644 test/cs_undefined/setops.cpp diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 7e24f0e48..d179fe7c3 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -4,8 +4,8 @@ # Copyright (c) 2008-2012 Bruno Lalande, Paris, France. # Copyright (c) 2009-2018 Mateusz Loskot, London, UK. # -# This file was modified by Oracle on 2017, 2018. -# Modifications copyright (c) 2017-2018 Oracle and/or its affiliates. +# This file was modified by Oracle on 2017, 2018, 2019. +# Modifications copyright (c) 2017-2019 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, @@ -49,6 +49,7 @@ build-project strategies ; build-project policies ; build-project io ; build-project srs ; +build-project cs_undefined ; build-project util ; build-project views ; diff --git a/test/cs_undefined/Jamfile.v2 b/test/cs_undefined/Jamfile.v2 new file mode 100644 index 000000000..f0ea382da --- /dev/null +++ b/test/cs_undefined/Jamfile.v2 @@ -0,0 +1,20 @@ +# Boost.Geometry +# +# Copyright (c) 2019, Oracle and/or its affiliates. +# +# Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle +# +# Licensed under the Boost Software License version 1.0. +# http://www.boost.org/LICENSE_1_0.txt) + +test-suite boost-geometry-cs_undefined + : + [ compile distance.cpp : : csundef_distance ] + [ compile envelope_expand.cpp : : csundef_envelope_expand ] + [ compile index.cpp : : csundef_index ] + [ compile is.cpp : : csundef_is ] + [ compile measure.cpp : : csundef_measure ] + [ compile other.cpp : : csundef_other ] + [ compile relops.cpp : : csundef_relops ] + [ compile setops.cpp : : csundef_setops ] + ; diff --git a/test/cs_undefined/common.hpp b/test/cs_undefined/common.hpp new file mode 100644 index 000000000..92cb80680 --- /dev/null +++ b/test/cs_undefined/common.hpp @@ -0,0 +1,69 @@ +// Boost.Geometry + +// Copyright (c) 2019, Oracle and/or its affiliates. + +// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle + +// Licensed under the Boost Software License version 1.0. +// http://www.boost.org/users/license.html + +#ifndef BOOST_GEOMETRY_TEST_CS_UNDEFINED_COMMON_HPP +#define BOOST_GEOMETRY_TEST_CS_UNDEFINED_COMMON_HPP + +#include + +#include + +#include + +#include + +struct geom +{ + //typedef bg::model::point point; + typedef bg::model::point point; + typedef bg::model::box box; + typedef bg::model::segment segment; + typedef bg::model::linestring linestring; + typedef bg::model::ring ring; + typedef bg::model::polygon polygon; + typedef bg::model::multi_linestring multi_linestring; + typedef bg::model::multi_polygon multi_polygon; + typedef bg::model::multi_point multi_point; + + geom() + { + pt = point(0, 0); + b = box(point(-1, -1), point(1, 1)); + s = segment(point(0, 0), point(1, 1)); + ls.push_back(point(0, 0)); + ls.push_back(point(1, 1)); + ls.push_back(point(1.1, 1.1)); + r.push_back(point(0, 0)); + r.push_back(point(0, 1)); + r.push_back(point(1, 1)); + r.push_back(point(1, 0)); + r.push_back(point(0, 0)); + po.outer() = r; + po.inners().push_back(ring()); + po.inners().back().push_back(point(0, 0)); + po.inners().back().push_back(point(0.2, 0.1)); + po.inners().back().push_back(point(0.1, 0.2)); + po.inners().back().push_back(point(0, 0)); + mls.push_back(ls); + mpo.push_back(po); + mpt.push_back(pt); + } + + point pt; + box b; + segment s; + linestring ls; + ring r; + polygon po; + multi_linestring mls; + multi_polygon mpo; + multi_point mpt; +}; + +#endif // BOOST_GEOMETRY_TEST_CS_UNDEFINED_COMMON_HPP diff --git a/test/cs_undefined/distance.cpp b/test/cs_undefined/distance.cpp new file mode 100644 index 000000000..8bd03a44c --- /dev/null +++ b/test/cs_undefined/distance.cpp @@ -0,0 +1,113 @@ +// Boost.Geometry + +// Copyright (c) 2019, Oracle and/or its affiliates. + +// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle + +// Licensed under the Boost Software License version 1.0. +// http://www.boost.org/users/license.html + +#include "common.hpp" + +#include + +int test_main(int, char*[]) +{ + geom g; + + bg::distance(g.pt, g.pt, bg::strategy::distance::pythagoras<>()); + bg::distance(g.pt, g.pt, bg::strategy::distance::haversine<>()); + bg::distance(g.pt, g.pt, bg::strategy::distance::geographic<>()); + bg::distance(g.pt, g.mpt, bg::strategy::distance::pythagoras<>()); + bg::distance(g.pt, g.mpt, bg::strategy::distance::haversine<>()); + bg::distance(g.pt, g.mpt, bg::strategy::distance::geographic<>()); + bg::distance(g.mpt, g.mpt, bg::strategy::distance::pythagoras<>()); + bg::distance(g.mpt, g.mpt, bg::strategy::distance::haversine<>()); + bg::distance(g.mpt, g.mpt, bg::strategy::distance::geographic<>()); + bg::distance(g.pt, g.ls, bg::strategy::distance::projected_point<>()); + bg::distance(g.pt, g.ls, bg::strategy::distance::cross_track<>()); + bg::distance(g.pt, g.ls, bg::strategy::distance::geographic_cross_track<>()); + bg::distance(g.pt, g.mls, bg::strategy::distance::projected_point<>()); + bg::distance(g.pt, g.mls, bg::strategy::distance::cross_track<>()); + bg::distance(g.pt, g.mls, bg::strategy::distance::geographic_cross_track<>()); + bg::distance(g.mpt, g.ls, bg::strategy::distance::projected_point<>()); + bg::distance(g.mpt, g.ls, bg::strategy::distance::cross_track<>()); + bg::distance(g.mpt, g.ls, bg::strategy::distance::geographic_cross_track<>()); + bg::distance(g.mpt, g.mls, bg::strategy::distance::projected_point<>()); + bg::distance(g.mpt, g.mls, bg::strategy::distance::cross_track<>()); + bg::distance(g.mpt, g.mls, bg::strategy::distance::geographic_cross_track<>()); + bg::distance(g.ls, g.ls, bg::strategy::distance::projected_point<>()); + bg::distance(g.ls, g.ls, bg::strategy::distance::cross_track<>()); + bg::distance(g.ls, g.ls, bg::strategy::distance::geographic_cross_track<>()); + bg::distance(g.ls, g.mls, bg::strategy::distance::projected_point<>()); + bg::distance(g.ls, g.mls, bg::strategy::distance::cross_track<>()); + bg::distance(g.ls, g.mls, bg::strategy::distance::geographic_cross_track<>()); + bg::distance(g.mls, g.mls, bg::strategy::distance::projected_point<>()); + bg::distance(g.mls, g.mls, bg::strategy::distance::cross_track<>()); + bg::distance(g.mls, g.mls, bg::strategy::distance::geographic_cross_track<>()); + bg::distance(g.pt, g.r, bg::strategy::distance::projected_point<>()); + bg::distance(g.pt, g.r, bg::strategy::distance::cross_track<>()); + bg::distance(g.pt, g.r, bg::strategy::distance::geographic_cross_track<>()); + bg::distance(g.pt, g.po, bg::strategy::distance::projected_point<>()); + bg::distance(g.pt, g.po, bg::strategy::distance::cross_track<>()); + bg::distance(g.pt, g.po, bg::strategy::distance::geographic_cross_track<>()); + bg::distance(g.pt, g.mpo, bg::strategy::distance::projected_point<>()); + bg::distance(g.pt, g.mpo, bg::strategy::distance::cross_track<>()); + bg::distance(g.pt, g.mpo, bg::strategy::distance::geographic_cross_track<>()); + bg::distance(g.mpt, g.r, bg::strategy::distance::projected_point<>()); + bg::distance(g.mpt, g.r, bg::strategy::distance::cross_track<>()); + bg::distance(g.mpt, g.r, bg::strategy::distance::geographic_cross_track<>()); + bg::distance(g.mpt, g.po, bg::strategy::distance::projected_point<>()); + bg::distance(g.mpt, g.po, bg::strategy::distance::cross_track<>()); + bg::distance(g.mpt, g.po, bg::strategy::distance::geographic_cross_track<>()); + bg::distance(g.mpt, g.mpo, bg::strategy::distance::projected_point<>()); + bg::distance(g.mpt, g.mpo, bg::strategy::distance::cross_track<>()); + bg::distance(g.mpt, g.mpo, bg::strategy::distance::geographic_cross_track<>()); + bg::distance(g.ls, g.r, bg::strategy::distance::projected_point<>()); + bg::distance(g.ls, g.r, bg::strategy::distance::cross_track<>()); + bg::distance(g.ls, g.r, bg::strategy::distance::geographic_cross_track<>()); + bg::distance(g.ls, g.po, bg::strategy::distance::projected_point<>()); + bg::distance(g.ls, g.po, bg::strategy::distance::cross_track<>()); + bg::distance(g.ls, g.po, bg::strategy::distance::geographic_cross_track<>()); + bg::distance(g.ls, g.mpo, bg::strategy::distance::projected_point<>()); + bg::distance(g.ls, g.mpo, bg::strategy::distance::cross_track<>()); + bg::distance(g.ls, g.mpo, bg::strategy::distance::geographic_cross_track<>()); + bg::distance(g.mls, g.r, bg::strategy::distance::projected_point<>()); + bg::distance(g.mls, g.r, bg::strategy::distance::cross_track<>()); + bg::distance(g.mls, g.r, bg::strategy::distance::geographic_cross_track<>()); + bg::distance(g.mls, g.po, bg::strategy::distance::projected_point<>()); + bg::distance(g.mls, g.po, bg::strategy::distance::cross_track<>()); + bg::distance(g.mls, g.po, bg::strategy::distance::geographic_cross_track<>()); + bg::distance(g.mls, g.mpo, bg::strategy::distance::projected_point<>()); + bg::distance(g.mls, g.mpo, bg::strategy::distance::cross_track<>()); + bg::distance(g.mls, g.mpo, bg::strategy::distance::geographic_cross_track<>()); + bg::distance(g.r, g.r, bg::strategy::distance::projected_point<>()); + bg::distance(g.r, g.r, bg::strategy::distance::cross_track<>()); + bg::distance(g.r, g.r, bg::strategy::distance::geographic_cross_track<>()); + bg::distance(g.r, g.po, bg::strategy::distance::projected_point<>()); + bg::distance(g.r, g.po, bg::strategy::distance::cross_track<>()); + bg::distance(g.r, g.po, bg::strategy::distance::geographic_cross_track<>()); + bg::distance(g.r, g.mpo, bg::strategy::distance::projected_point<>()); + bg::distance(g.r, g.mpo, bg::strategy::distance::cross_track<>()); + bg::distance(g.r, g.mpo, bg::strategy::distance::geographic_cross_track<>()); + bg::distance(g.po, g.r, bg::strategy::distance::projected_point<>()); + bg::distance(g.po, g.r, bg::strategy::distance::cross_track<>()); + bg::distance(g.po, g.r, bg::strategy::distance::geographic_cross_track<>()); + bg::distance(g.po, g.po, bg::strategy::distance::projected_point<>()); + bg::distance(g.po, g.po, bg::strategy::distance::cross_track<>()); + bg::distance(g.po, g.po, bg::strategy::distance::geographic_cross_track<>()); + bg::distance(g.po, g.mpo, bg::strategy::distance::projected_point<>()); + bg::distance(g.po, g.mpo, bg::strategy::distance::cross_track<>()); + bg::distance(g.po, g.mpo, bg::strategy::distance::geographic_cross_track<>()); + bg::distance(g.mpo, g.r, bg::strategy::distance::projected_point<>()); + bg::distance(g.mpo, g.r, bg::strategy::distance::cross_track<>()); + bg::distance(g.mpo, g.r, bg::strategy::distance::geographic_cross_track<>()); + bg::distance(g.mpo, g.po, bg::strategy::distance::projected_point<>()); + bg::distance(g.mpo, g.po, bg::strategy::distance::cross_track<>()); + bg::distance(g.mpo, g.po, bg::strategy::distance::geographic_cross_track<>()); + bg::distance(g.mpo, g.mpo, bg::strategy::distance::projected_point<>()); + bg::distance(g.mpo, g.mpo, bg::strategy::distance::cross_track<>()); + bg::distance(g.mpo, g.mpo, bg::strategy::distance::geographic_cross_track<>()); + + return 0; +} diff --git a/test/cs_undefined/envelope_expand.cpp b/test/cs_undefined/envelope_expand.cpp new file mode 100644 index 000000000..5d16e6f25 --- /dev/null +++ b/test/cs_undefined/envelope_expand.cpp @@ -0,0 +1,53 @@ +// Boost.Geometry + +// Copyright (c) 2019, Oracle and/or its affiliates. + +// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle + +// Licensed under the Boost Software License version 1.0. +// http://www.boost.org/users/license.html + +#include "common.hpp" + +#include +#include + +int test_main(int, char*[]) +{ + geom g; + + bg::expand(g.b, g.pt, bg::strategy::expand::cartesian_point()); + bg::expand(g.b, g.pt, bg::strategy::expand::spherical_point()); + bg::expand(g.b, g.b, bg::strategy::expand::cartesian_box()); + bg::expand(g.b, g.b, bg::strategy::expand::spherical_box()); + bg::expand(g.b, g.s, bg::strategy::expand::cartesian_segment()); + bg::expand(g.b, g.s, bg::strategy::expand::spherical_segment<>()); + bg::expand(g.b, g.s, bg::strategy::expand::geographic_segment<>()); + + bg::envelope(g.pt, g.b, bg::strategy::envelope::cartesian_point()); + bg::envelope(g.pt, g.b, bg::strategy::envelope::spherical_point()); + bg::envelope(g.b, g.b, bg::strategy::envelope::cartesian_box()); + bg::envelope(g.b, g.b, bg::strategy::envelope::spherical_box()); + bg::envelope(g.s, g.b, bg::strategy::envelope::cartesian_segment<>()); + bg::envelope(g.s, g.b, bg::strategy::envelope::spherical_segment<>()); + bg::envelope(g.s, g.b, bg::strategy::envelope::geographic_segment<>()); + bg::envelope(g.ls, g.b, bg::strategy::envelope::cartesian<>()); + bg::envelope(g.ls, g.b, bg::strategy::envelope::spherical<>()); + bg::envelope(g.ls, g.b, bg::strategy::envelope::geographic<>()); + bg::envelope(g.r, g.b, bg::strategy::envelope::cartesian<>()); + bg::envelope(g.r, g.b, bg::strategy::envelope::spherical<>()); + bg::envelope(g.r, g.b, bg::strategy::envelope::geographic<>()); + bg::envelope(g.po, g.b, bg::strategy::envelope::cartesian<>()); + bg::envelope(g.po, g.b, bg::strategy::envelope::spherical<>()); + bg::envelope(g.po, g.b, bg::strategy::envelope::geographic<>()); + bg::envelope(g.mls, g.b, bg::strategy::envelope::cartesian<>()); + bg::envelope(g.mls, g.b, bg::strategy::envelope::spherical<>()); + bg::envelope(g.mls, g.b, bg::strategy::envelope::geographic<>()); + bg::envelope(g.mpo, g.b, bg::strategy::envelope::cartesian<>()); + bg::envelope(g.mpo, g.b, bg::strategy::envelope::spherical<>()); + bg::envelope(g.mpo, g.b, bg::strategy::envelope::geographic<>()); + bg::envelope(g.mpt, g.b, bg::strategy::envelope::cartesian_multipoint()); + bg::envelope(g.mpt, g.b, bg::strategy::envelope::spherical_multipoint()); + + return 0; +} diff --git a/test/cs_undefined/index.cpp b/test/cs_undefined/index.cpp new file mode 100644 index 000000000..008187044 --- /dev/null +++ b/test/cs_undefined/index.cpp @@ -0,0 +1,101 @@ +// Boost.Geometry + +// Copyright (c) 2019, Oracle and/or its affiliates. + +// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle + +// Licensed under the Boost Software License version 1.0. +// http://www.boost.org/users/license.html + +#include "common.hpp" + +// These includes are required for the following code to compile. +// This is probably wrong. +#include +#include +#include +#include + +#include + +#include + +namespace bgi = boost::geometry::index; + +template +< + typename VG, typename QG, + typename VTag = typename bg::tag::type, + typename QTag = typename bg::tag::type +> +struct call_query +{ + template + static inline void apply(Rtree const& , Res const& ) + {} +}; + +template +struct call_query +{ + template + static inline void apply(Rtree const& rtree, QG const& qg) + { + std::vector res; + rtree.query(bgi::intersects(qg), std::back_inserter(res)); + } +}; + +template +inline void rtree_test(G const& g, P const& p) +{ + { + bgi::rtree rtree; + } + + std::vector de2(100, g); + + bgi::rtree rtree(de2, p); + rtree.insert(g); + rtree.remove(g); + rtree.count(g); + + call_query::apply(rtree, geom::point(0, 0)); +} + +int test_main(int, char*[]) +{ + geom g; + + rtree_test(g.pt, bgi::parameters, bg::strategy::index::cartesian<> >()); + rtree_test(g.pt, bgi::parameters, bg::strategy::index::cartesian<> >()); + rtree_test(g.pt, bgi::parameters, bg::strategy::index::cartesian<> >()); + rtree_test(g.b, bgi::parameters, bg::strategy::index::cartesian<> >()); + rtree_test(g.b, bgi::parameters, bg::strategy::index::cartesian<> >()); + rtree_test(g.b, bgi::parameters, bg::strategy::index::cartesian<> >()); + rtree_test(g.s, bgi::parameters, bg::strategy::index::cartesian<> >()); + rtree_test(g.s, bgi::parameters, bg::strategy::index::cartesian<> >()); + rtree_test(g.s, bgi::parameters, bg::strategy::index::cartesian<> >()); + + rtree_test(g.pt, bgi::parameters, bg::strategy::index::spherical<> >()); + rtree_test(g.pt, bgi::parameters, bg::strategy::index::spherical<> >()); + rtree_test(g.pt, bgi::parameters, bg::strategy::index::spherical<> >()); + rtree_test(g.b, bgi::parameters, bg::strategy::index::spherical<> >()); + rtree_test(g.b, bgi::parameters, bg::strategy::index::spherical<> >()); + rtree_test(g.b, bgi::parameters, bg::strategy::index::spherical<> >()); + rtree_test(g.s, bgi::parameters, bg::strategy::index::spherical<> >()); + rtree_test(g.s, bgi::parameters, bg::strategy::index::spherical<> >()); + rtree_test(g.s, bgi::parameters, bg::strategy::index::spherical<> >()); + + rtree_test(g.pt, bgi::parameters, bg::strategy::index::geographic<> >()); + rtree_test(g.pt, bgi::parameters, bg::strategy::index::geographic<> >()); + rtree_test(g.pt, bgi::parameters, bg::strategy::index::geographic<> >()); + rtree_test(g.b, bgi::parameters, bg::strategy::index::geographic<> >()); + rtree_test(g.b, bgi::parameters, bg::strategy::index::geographic<> >()); + rtree_test(g.b, bgi::parameters, bg::strategy::index::geographic<> >()); + rtree_test(g.s, bgi::parameters, bg::strategy::index::geographic<> >()); + rtree_test(g.s, bgi::parameters, bg::strategy::index::geographic<> >()); + rtree_test(g.s, bgi::parameters, bg::strategy::index::geographic<> >()); + + return 0; +} diff --git a/test/cs_undefined/is.cpp b/test/cs_undefined/is.cpp new file mode 100644 index 000000000..c043d301b --- /dev/null +++ b/test/cs_undefined/is.cpp @@ -0,0 +1,44 @@ +// Boost.Geometry + +// Copyright (c) 2019, Oracle and/or its affiliates. + +// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle + +// Licensed under the Boost Software License version 1.0. +// http://www.boost.org/users/license.html + +#include "common.hpp" + +#include +#include + +template +inline void is(G const& g, S const& s) +{ + bg::is_simple(g, s); + bg::is_valid(g, s); +} + +template +inline void is_x(G const& g) +{ + ::is(g, bg::strategy::intersection::cartesian_segments<>()); + ::is(g, bg::strategy::intersection::spherical_segments<>()); + ::is(g, bg::strategy::intersection::geographic_segments<>()); +} + +int test_main(int, char*[]) +{ + geom g; + + ::is_x(g.pt); + ::is_x(g.mpt); + ::is_x(g.s); + ::is_x(g.ls); + ::is_x(g.mls); + ::is_x(g.r); + ::is_x(g.po); + ::is_x(g.mpo); + + return 0; +} diff --git a/test/cs_undefined/measure.cpp b/test/cs_undefined/measure.cpp new file mode 100644 index 000000000..40d8a4f97 --- /dev/null +++ b/test/cs_undefined/measure.cpp @@ -0,0 +1,51 @@ +// Boost.Geometry + +// Copyright (c) 2019, Oracle and/or its affiliates. + +// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle + +// Licensed under the Boost Software License version 1.0. +// http://www.boost.org/users/license.html + +#include "common.hpp" + +#include +#include +#include + +int test_main(int, char*[]) +{ + geom g; + + bg::area(g.r, bg::strategy::area::cartesian<>()); + bg::area(g.r, bg::strategy::area::spherical<>()); + bg::area(g.r, bg::strategy::area::geographic<>()); + bg::area(g.po, bg::strategy::area::cartesian<>()); + bg::area(g.po, bg::strategy::area::spherical<>()); + bg::area(g.po, bg::strategy::area::geographic<>()); + bg::area(g.mpo, bg::strategy::area::cartesian<>()); + bg::area(g.mpo, bg::strategy::area::spherical<>()); + bg::area(g.mpo, bg::strategy::area::geographic<>()); + + bg::length(g.s, bg::strategy::distance::pythagoras<>()); + bg::length(g.s, bg::strategy::distance::haversine<>()); + bg::length(g.s, bg::strategy::distance::geographic<>()); + bg::length(g.ls, bg::strategy::distance::pythagoras<>()); + bg::length(g.ls, bg::strategy::distance::haversine<>()); + bg::length(g.ls, bg::strategy::distance::geographic<>()); + bg::length(g.mls, bg::strategy::distance::pythagoras<>()); + bg::length(g.mls, bg::strategy::distance::haversine<>()); + bg::length(g.mls, bg::strategy::distance::geographic<>()); + + bg::perimeter(g.r, bg::strategy::distance::pythagoras<>()); + bg::perimeter(g.r, bg::strategy::distance::haversine<>()); + bg::perimeter(g.r, bg::strategy::distance::geographic<>()); + bg::perimeter(g.po, bg::strategy::distance::pythagoras<>()); + bg::perimeter(g.po, bg::strategy::distance::haversine<>()); + bg::perimeter(g.po, bg::strategy::distance::geographic<>()); + bg::perimeter(g.mpo, bg::strategy::distance::pythagoras<>()); + bg::perimeter(g.mpo, bg::strategy::distance::haversine<>()); + bg::perimeter(g.mpo, bg::strategy::distance::geographic<>()); + + return 0; +} diff --git a/test/cs_undefined/other.cpp b/test/cs_undefined/other.cpp new file mode 100644 index 000000000..fe2ad6501 --- /dev/null +++ b/test/cs_undefined/other.cpp @@ -0,0 +1,40 @@ +// Boost.Geometry + +// Copyright (c) 2019, Oracle and/or its affiliates. + +// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle + +// Licensed under the Boost Software License version 1.0. +// http://www.boost.org/users/license.html + +#include "common.hpp" + +#include +#include + +template +inline void simplify(G const& g1, G & g2) +{ + bg::simplify(g1, g2, 1, bg::strategy::simplify::douglas_peucker >()); + bg::simplify(g1, g2, 1, bg::strategy::simplify::douglas_peucker >()); + + // TODO: douglas_peucker does not define a ctor taking distance strategy + // which is needed in geographic CS + bg::simplify(g1, g2, 1, bg::strategy::simplify::douglas_peucker >()); +} + +int test_main(int, char*[]) +{ + geom g, o; + + // this compiles but it shouldn't! + // internally default_strategy is defined as not_applicable_strategy for box + bg::centroid(g.b, o.pt); + + ::simplify(g.ls, o.ls); + // TODO: + //::simplify(g.r, o.r); // area (point order) strategy not propagated + //::simplify(g.po, o.po); // area (point order) strategy not propagated + + return 0; +} diff --git a/test/cs_undefined/relops.cpp b/test/cs_undefined/relops.cpp new file mode 100644 index 000000000..a019fe876 --- /dev/null +++ b/test/cs_undefined/relops.cpp @@ -0,0 +1,228 @@ +// Boost.Geometry + +// Copyright (c) 2019, Oracle and/or its affiliates. + +// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle + +// Licensed under the Boost Software License version 1.0. +// http://www.boost.org/users/license.html + +#include "common.hpp" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +template +< + typename G1, + typename G2, + std::size_t Dim1 = bg::topological_dimension::value, + std::size_t Dim2 = bg::topological_dimension::value +> +struct call_equals +{ + template + static void apply(G1 const& g1, G2 const& g2, S const& s) {} +}; + +template +struct call_equals +{ + template + static void apply(G1 const& g1, G2 const& g2, S const& s) + { + bg::equals(g1, g2, s); + } +}; + +template +< + typename G1, + typename G2, + std::size_t Dim1 = bg::topological_dimension::value, + std::size_t Dim2 = bg::topological_dimension::value +> +struct call_overlaps +{ + template + static void apply(G1 const& g1, G2 const& g2, S const& s) {} +}; + +template +struct call_overlaps +{ + template + static void apply(G1 const& g1, G2 const& g2, S const& s) + { + bg::overlaps(g1, g2, s); + } +}; + +template +< + typename G1, + typename G2, + std::size_t Dim1 = bg::topological_dimension::value, + std::size_t Dim2 = bg::topological_dimension::value +> +struct call_touches +{ + template + static void apply(G1 const& g1, G2 const& g2, S const& s) + { + bg::touches(g1, g2, s); + } +}; + +template +struct call_touches +{ + template + static void apply(G1 const& g1, G2 const& g2, S const& s) {} +}; + +template +< + typename G1, + typename G2, + std::size_t Dim1 = bg::topological_dimension::value, + std::size_t Dim2 = bg::topological_dimension::value +> +struct call_crosses +{ + template + static void apply(G1 const& g1, G2 const& g2, S const& s) + { + bg::crosses(g1, g2, s); + } +}; + +template +struct call_crosses +{ + template + static void apply(G1 const& g1, G2 const& g2, S const& s) {} +}; + +template +struct call_crosses +{ + template + static void apply(G1 const& g1, G2 const& g2, S const& s) {} +}; + +template +inline void rel(G1 const& g1, G2 const& g2, S const& s) +{ + bg::relation(g1, g2, s); + bg::relate(g1, g2, bg::de9im::mask("*********"), s); + bg::covered_by(g1, g2, s); + call_crosses::apply(g1, g2, s); + bg::disjoint(g1, g2, s); + call_equals::apply(g1, g2, s); + bg::intersects(g1, g2, s); + call_overlaps::apply(g1, g2, s); + call_touches::apply(g1, g2, s); + bg::within(g1, g2, s); +} + +template +inline void rel_pp(G1 const& g1, G2 const& g2) +{ + ::rel(g1, g2, bg::strategy::within::cartesian_point_point()); + ::rel(g1, g2, bg::strategy::within::spherical_point_point()); +} + +template +inline void rel_ps(G1 const& g1, G2 const& g2) +{ + typedef typename bg::point_type::type point; + ::rel(g1, g2, bg::strategy::within::cartesian_winding()); + ::rel(g1, g2, bg::strategy::within::spherical_winding()); + ::rel(g1, g2, bg::strategy::within::geographic_winding()); +} + +template +inline void rel_ss(G1 const& g1, G2 const& g2) +{ + ::rel(g1, g2, bg::strategy::intersection::cartesian_segments<>()); + ::rel(g1, g2, bg::strategy::intersection::spherical_segments<>()); + ::rel(g1, g2, bg::strategy::intersection::geographic_segments<>()); +} + +int test_main(int, char*[]) +{ + geom g; + + bg::disjoint(g.pt, g.b, bg::strategy::covered_by::cartesian_point_box()); + bg::disjoint(g.pt, g.b, bg::strategy::covered_by::spherical_point_box()); + bg::disjoint(g.b, g.b, bg::strategy::disjoint::cartesian_box_box()); + bg::disjoint(g.b, g.b, bg::strategy::disjoint::spherical_box_box()); + bg::within(g.pt, g.b, bg::strategy::within::cartesian_point_box()); + bg::within(g.pt, g.b, bg::strategy::within::spherical_point_box()); + bg::within(g.b, g.b, bg::strategy::within::cartesian_box_box()); + bg::within(g.b, g.b, bg::strategy::within::spherical_box_box()); + bg::covered_by(g.pt, g.b, bg::strategy::covered_by::cartesian_point_box()); + bg::covered_by(g.pt, g.b, bg::strategy::covered_by::spherical_point_box()); + bg::covered_by(g.b, g.b, bg::strategy::covered_by::cartesian_box_box()); + bg::covered_by(g.b, g.b, bg::strategy::covered_by::spherical_box_box()); + + // P/P + ::rel_pp(g.pt, g.pt); + ::rel_pp(g.pt, g.mpt); + ::rel_pp(g.mpt, g.mpt); + // P/L + //::rel_ps(g.pt, g.s); // relate not implemented + ::rel_ps(g.pt, g.ls); + ::rel_ps(g.pt, g.mls); + //::rel_ps(g.mpt, g.s); // relate not implemented + ::rel_ps(g.mpt, g.ls); + ::rel_ps(g.mpt, g.mls); + // P/A + ::rel_ps(g.pt, g.r); + ::rel_ps(g.mpt, g.r); + ::rel_ps(g.pt, g.po); + ::rel_ps(g.mpt, g.po); + ::rel_ps(g.pt, g.mpo); + ::rel_ps(g.mpt, g.mpo); + // L/L + //::rel_ss(g.s, g.s); // relate not implemented + //::rel_ss(g.s, g.ls); // relate not implemented + //::rel_ss(g.s, g.mls); // relate not implemented + //::rel_ss(g.ls, g.s); // relate not implemented + ::rel_ss(g.ls, g.ls); + ::rel_ss(g.ls, g.mls); + //::rel_ss(g.mls, g.s); // relate not implemented + ::rel_ss(g.mls, g.ls); + ::rel_ss(g.mls, g.mls); + // L/A + //::rel_ss(g.s, g.r); // relate not implemented + ::rel_ss(g.ls, g.r); + ::rel_ss(g.mls, g.r); + //::rel_ss(g.s, g.po); // relate not implemented + ::rel_ss(g.ls, g.po); + ::rel_ss(g.mls, g.po); + //::rel_ss(g.s, g.mpo); // relate not implemented + ::rel_ss(g.ls, g.mpo); + ::rel_ss(g.mls, g.mpo); + // A/A + ::rel_ss(g.r, g.r); + ::rel_ss(g.po, g.r); + ::rel_ss(g.mpo, g.r); + ::rel_ss(g.r, g.po); + ::rel_ss(g.po, g.po); + ::rel_ss(g.mpo, g.po); + ::rel_ss(g.r, g.mpo); + ::rel_ss(g.po, g.mpo); + ::rel_ss(g.mpo, g.mpo); + + return 0; +} diff --git a/test/cs_undefined/setops.cpp b/test/cs_undefined/setops.cpp new file mode 100644 index 000000000..d684214a4 --- /dev/null +++ b/test/cs_undefined/setops.cpp @@ -0,0 +1,281 @@ +// Boost.Geometry + +// Copyright (c) 2019, Oracle and/or its affiliates. + +// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle + +// Licensed under the Boost Software License version 1.0. +// http://www.boost.org/users/license.html + +#include "common.hpp" + +#include +#include +#include +#include + +template +inline void set_idsu(G1 const& g1, G2 const& g2, G3 & g3, S const& s) +{ + bg::intersection(g1, g2, g3, s); + bg::difference(g1, g2, g3, s); + bg::sym_difference(g1, g2, g3, s); + bg::union_(g1, g2, g3, s); +} + +template +inline void set_ids(G1 const& g1, G2 const& g2, G3 & g3, S const& s) +{ + bg::intersection(g1, g2, g3, s); + bg::difference(g1, g2, g3, s); + bg::sym_difference(g1, g2, g3, s); +} + +template +inline void set_id(G1 const& g1, G2 const& g2, G3 & g3, S const& s) +{ + bg::intersection(g1, g2, g3, s); + bg::difference(g1, g2, g3, s); +} + +template +inline void set_i(G1 const& g1, G2 const& g2, G3 & g3, S const& s) +{ + bg::intersection(g1, g2, g3, s); +} + +template +inline void set_d(G1 const& g1, G2 const& g2, G3 & g3, S const& s) +{ + bg::difference(g1, g2, g3, s); +} + +template +inline void set_idsu_pp(G1 const& g1, G2 const& g2, G3 & g3) +{ + ::set_idsu(g1, g2, g3, bg::strategy::within::cartesian_point_point()); + ::set_idsu(g1, g2, g3, bg::strategy::within::spherical_point_point()); +} + +template +inline void set_idsu_ps(G1 const& g1, G2 const& g2, G3 & g3) +{ + typedef typename bg::point_type::type point_type; + ::set_idsu(g1, g2, g3, bg::strategy::within::cartesian_winding()); + ::set_idsu(g1, g2, g3, bg::strategy::within::spherical_winding()); + ::set_idsu(g1, g2, g3, bg::strategy::within::geographic_winding()); +} + +template +inline void set_idsu_ss(G1 const& g1, G2 const& g2, G3 & g3) +{ + ::set_idsu(g1, g2, g3, bg::strategy::intersection::cartesian_segments<>()); + ::set_idsu(g1, g2, g3, bg::strategy::intersection::spherical_segments<>()); + ::set_idsu(g1, g2, g3, bg::strategy::intersection::geographic_segments<>()); +} + +template +inline void set_ids_pp(G1 const& g1, G2 const& g2, G3 & g3) +{ + ::set_ids(g1, g2, g3, bg::strategy::within::cartesian_point_point()); + ::set_ids(g1, g2, g3, bg::strategy::within::spherical_point_point()); +} + +template +inline void set_ids_ps(G1 const& g1, G2 const& g2, G3 & g3) +{ + typedef typename bg::point_type::type point_type; + ::set_ids(g1, g2, g3, bg::strategy::within::cartesian_winding()); + ::set_ids(g1, g2, g3, bg::strategy::within::spherical_winding()); + ::set_ids(g1, g2, g3, bg::strategy::within::geographic_winding()); +} + +template +inline void set_ids_ss(G1 const& g1, G2 const& g2, G3 & g3) +{ + ::set_ids(g1, g2, g3, bg::strategy::intersection::cartesian_segments<>()); + ::set_ids(g1, g2, g3, bg::strategy::intersection::spherical_segments<>()); + ::set_ids(g1, g2, g3, bg::strategy::intersection::geographic_segments<>()); +} + +template +inline void set_id_pp(G1 const& g1, G2 const& g2, G3 & g3) +{ + ::set_id(g1, g2, g3, bg::strategy::within::cartesian_point_point()); + ::set_id(g1, g2, g3, bg::strategy::within::spherical_point_point()); +} + +template +inline void set_id_ps(G1 const& g1, G2 const& g2, G3 & g3) +{ + typedef typename bg::point_type::type point_type; + ::set_id(g1, g2, g3, bg::strategy::within::cartesian_winding()); + ::set_id(g1, g2, g3, bg::strategy::within::spherical_winding()); + ::set_id(g1, g2, g3, bg::strategy::within::geographic_winding()); +} + +template +inline void set_id_ss(G1 const& g1, G2 const& g2, G3 & g3) +{ + ::set_id(g1, g2, g3, bg::strategy::intersection::cartesian_segments<>()); + ::set_id(g1, g2, g3, bg::strategy::intersection::spherical_segments<>()); + ::set_id(g1, g2, g3, bg::strategy::intersection::geographic_segments<>()); +} + +template +inline void set_i_pp(G1 const& g1, G2 const& g2, G3 & g3) +{ + ::set_i(g1, g2, g3, bg::strategy::within::cartesian_point_point()); + ::set_i(g1, g2, g3, bg::strategy::within::spherical_point_point()); +} + +template +inline void set_i_ps(G1 const& g1, G2 const& g2, G3 & g3) +{ + typedef typename bg::point_type::type point_type; + ::set_i(g1, g2, g3, bg::strategy::within::cartesian_winding()); + ::set_i(g1, g2, g3, bg::strategy::within::spherical_winding()); + ::set_i(g1, g2, g3, bg::strategy::within::geographic_winding()); +} + +template +inline void set_i_ss(G1 const& g1, G2 const& g2, G3 & g3) +{ + ::set_i(g1, g2, g3, bg::strategy::intersection::cartesian_segments<>()); + ::set_i(g1, g2, g3, bg::strategy::intersection::spherical_segments<>()); + ::set_i(g1, g2, g3, bg::strategy::intersection::geographic_segments<>()); +} + +template +inline void set_d_pp(G1 const& g1, G2 const& g2, G3 & g3) +{ + ::set_d(g1, g2, g3, bg::strategy::within::cartesian_point_point()); + ::set_d(g1, g2, g3, bg::strategy::within::spherical_point_point()); +} + +template +inline void set_d_ps(G1 const& g1, G2 const& g2, G3 & g3) +{ + typedef typename bg::point_type::type point_type; + ::set_d(g1, g2, g3, bg::strategy::within::cartesian_winding()); + ::set_d(g1, g2, g3, bg::strategy::within::spherical_winding()); + ::set_d(g1, g2, g3, bg::strategy::within::geographic_winding()); +} + +template +inline void set_d_ss(G1 const& g1, G2 const& g2, G3 & g3) +{ + ::set_d(g1, g2, g3, bg::strategy::intersection::cartesian_segments<>()); + ::set_d(g1, g2, g3, bg::strategy::intersection::spherical_segments<>()); + ::set_d(g1, g2, g3, bg::strategy::intersection::geographic_segments<>()); +} + +int test_main(int, char*[]) +{ + geom g; + + // P/P->P + ::set_idsu_pp(g.pt, g.pt, g.mpt); + ::set_idsu_pp(g.pt, g.mpt, g.mpt); + ::set_idsu_pp(g.mpt, g.mpt, g.mpt); + + // P/L->P + ::set_id_ps(g.pt, g.s, g.mpt); + ::set_id_ps(g.pt, g.ls, g.mpt); + ::set_id_ps(g.pt, g.mls, g.mpt); + ::set_id_ps(g.mpt, g.s, g.mpt); + ::set_id_ps(g.mpt, g.ls, g.mpt); + ::set_id_ps(g.mpt, g.mls, g.mpt); + + // P/A->P + // no intersection nor difference + //::set_id_ps(g.pt, g.r, g.mpt); + //::set_id_ps(g.pt, g.po, g.mpt); + //::set_id_ps(g.pt, g.mpo, g.mpt); + //::set_id_ps(g.mpt, g.r, g.mpt); + //::set_id_ps(g.mpt, g.po, g.mpt); + //::set_id_ps(g.mpt, g.mpo, g.mpt); + + // L/L->P + ::set_ids_ss(g.s, g.s, g.mpt); + //::set_i_ss(g.s, g.ls, g.mpt); // no intersection nor difference + //::set_i_ss(g.s, g.mls, g.mpt); // no intersection nor difference + //::set_i_ss(g.ls, g.s, g.mpt); // no intersection nor difference + ::set_ids_ss(g.ls, g.ls, g.mpt); + ::set_i_ss(g.ls, g.mls, g.mpt); // no difference nor sym_difference + //::set_i_ss(g.mls, g.s, g.mpt); // no intersection nor difference + ::set_i_ss(g.mls, g.ls, g.mpt); // no difference nor sym_difference + ::set_ids_ss(g.mls, g.mls, g.mpt); + + // L/L->L + //::set_ids_ss(g.s, g.s, g.mls); // union not implemented, missing specialization + //::set_idsu_ss(g.s, g.ls, g.mls); // missing specialization + //::set_idsu_ss(g.s, g.mls, g.mls); // missing specialization + //::set_idsu_ss(g.ls, g.s, g.mls); // missing specialization + ::set_idsu_ss(g.ls, g.ls, g.mls); + ::set_idsu_ss(g.ls, g.mls, g.mls); + //::set_idsu_ss(g.mls, g.s, g.mls); // missing specialization + ::set_idsu_ss(g.mls, g.ls, g.mls); + ::set_idsu_ss(g.mls, g.mls, g.mls); + + // S/B->L ? + + // L/B->L ? + + // L/A->P + //::set_ids_ss(g.s, g.r, g.mpt); // no intersection + //::set_ids_ss(g.s, g.po, g.mpt); // no intersection + //::set_ids_ss(g.s, g.mpo, g.mpt); // no intersection + ::set_ids_ss(g.ls, g.r, g.mpt); + ::set_ids_ss(g.ls, g.po, g.mpt); + ::set_ids_ss(g.ls, g.mpo, g.mpt); + ::set_ids_ss(g.mls, g.r, g.mpt); + ::set_ids_ss(g.mls, g.po, g.mpt); + ::set_ids_ss(g.mls, g.mpo, g.mpt); + + // L/A->L + //::set_id_ss(g.s, g.r, g.mls); // no intersection + //::set_id_ss(g.s, g.po, g.mls); // no intersection + //::set_id_ss(g.s, g.mpo, g.mls); // no intersection + ::set_id_ss(g.ls, g.r, g.mls); + ::set_id_ss(g.ls, g.po, g.mls); + ::set_id_ss(g.ls, g.mpo, g.mls); + ::set_id_ss(g.mls, g.r, g.mls); + ::set_id_ss(g.mls, g.po, g.mls); + ::set_id_ss(g.mls, g.mpo, g.mls); + + // A/A->P + ::set_i_ss(g.r, g.r, g.mpt); + ::set_i_ss(g.r, g.po, g.mpt); + ::set_i_ss(g.r, g.mpo, g.mpt); + ::set_i_ss(g.po, g.r, g.mpt); + ::set_i_ss(g.po, g.po, g.mpt); + ::set_i_ss(g.po, g.mpo, g.mpt); + ::set_i_ss(g.mpo, g.r, g.mpt); + ::set_i_ss(g.mpo, g.po, g.mpt); + ::set_i_ss(g.mpo, g.mpo, g.mpt); + + // A/A->L + ::set_i_ss(g.r, g.r, g.mls); + ::set_i_ss(g.r, g.po, g.mls); + ::set_i_ss(g.r, g.mpo, g.mls); + ::set_i_ss(g.po, g.r, g.mls); + ::set_i_ss(g.po, g.po, g.mls); + ::set_i_ss(g.po, g.mpo, g.mls); + ::set_i_ss(g.mpo, g.r, g.mls); + ::set_i_ss(g.mpo, g.po, g.mls); + ::set_i_ss(g.mpo, g.mpo, g.mls); + + // A/A->A + ::set_idsu_ss(g.r, g.r, g.mpo); + ::set_idsu_ss(g.r, g.po, g.mpo); + ::set_idsu_ss(g.r, g.mpo, g.mpo); + ::set_idsu_ss(g.po, g.r, g.mpo); + ::set_idsu_ss(g.po, g.po, g.mpo); + ::set_idsu_ss(g.po, g.mpo, g.mpo); + ::set_idsu_ss(g.mpo, g.r, g.mpo); + ::set_idsu_ss(g.mpo, g.po, g.mpo); + ::set_idsu_ss(g.mpo, g.mpo, g.mpo); + + return 0; +}