Merge pull request #1029 from awulkiew/fix/touches

Fix compilation of touches for geometry collections with gcc-10
This commit is contained in:
Adam Wulkiewicz 2022-07-06 13:56:10 +02:00 committed by GitHub
commit 89f01bf44b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 73 additions and 20 deletions

View File

@ -1,6 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2022 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2013-2022.
// Modifications copyright (c) 2013-2022 Oracle and/or its affiliates.
@ -274,6 +275,11 @@ struct static_mask_touches_impl<Geometry1, Geometry2, 0, 0>
typedef geometry::detail::relate::false_mask type;
};
template <typename Geometry1, typename Geometry2>
struct static_mask_touches_not_pp_type
: static_mask_touches_impl<Geometry1, Geometry2, 2, 2> // dummy dimensions
{};
template <typename Geometry1, typename Geometry2>
struct static_mask_touches_type
: static_mask_touches_impl<Geometry1, Geometry2>

View File

@ -1,5 +1,7 @@
// Boost.Geometry
// Copyright (c) 2022 Adam Wulkiewicz, Lodz, Poland.
// Copyright (c) 2022 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -200,7 +202,6 @@ struct gc_gc
bool disjoint_found[2][3] = {{false, false, false}, {false, false, false}};
bool disjoint_linear_boundary_found[2] = {false, false};
bool has_disjoint = false;
bool has_disjoint_linear = false;
gc_group_elements(gc1_view, gc2_view, strategy,
[&](auto const& inters_group)

View File

@ -3,7 +3,7 @@
// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
// Copyright (c) 2013-2015 Adam Wulkiewicz, Lodz, Poland.
// Copyright (c) 2013-2022 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2013-2022.
// Modifications copyright (c) 2013-2022, Oracle and/or its affiliates.
@ -24,6 +24,7 @@
#include <type_traits>
#include <boost/geometry/algorithms/detail/for_each_range.hpp>
#include <boost/geometry/algorithms/detail/gc_topological_dimension.hpp>
#include <boost/geometry/algorithms/detail/overlay/overlay.hpp>
#include <boost/geometry/algorithms/detail/overlay/self_turn_points.hpp>
#include <boost/geometry/algorithms/detail/sub_range.hpp>
@ -44,6 +45,8 @@
#include <boost/geometry/strategies/relate/geographic.hpp>
#include <boost/geometry/strategies/relate/spherical.hpp>
#include <boost/geometry/views/detail/geometry_collection_view.hpp>
namespace boost { namespace geometry
{
@ -270,6 +273,55 @@ struct use_point_in_geometry
}
};
// GC
struct gc_gc
{
template <typename Geometry1, typename Geometry2, typename Strategy>
static inline bool apply(Geometry1 const& geometry1, Geometry2 const& geometry2,
Strategy const& strategy)
{
int const dimension1 = detail::gc_topological_dimension(geometry1);
int const dimension2 = detail::gc_topological_dimension(geometry2);
if (dimension1 == 0 && dimension2 == 0)
{
return false;
}
else
{
return detail::relate::relate_impl
<
detail::de9im::static_mask_touches_not_pp_type,
Geometry1,
Geometry2
>::apply(geometry1, geometry2, strategy);
}
}
};
struct notgc_gc
{
template <typename Geometry1, typename Geometry2, typename Strategy>
static inline bool apply(Geometry1 const& geometry1, Geometry2 const& geometry2,
Strategy const& strategy)
{
using gc1_view_t = detail::geometry_collection_view<Geometry1>;
return gc_gc::apply(gc1_view_t(geometry1), geometry2, strategy);
}
};
struct gc_notgc
{
template <typename Geometry1, typename Geometry2, typename Strategy>
static inline bool apply(Geometry1 const& geometry1, Geometry2 const& geometry2,
Strategy const& strategy)
{
using gc2_view_t = detail::geometry_collection_view<Geometry2>;
return gc_gc::apply(geometry1, gc2_view_t(geometry2), strategy);
}
};
}}
#endif // DOXYGEN_NO_DETAIL
@ -412,12 +464,7 @@ struct touches
geometry_collection_tag, geometry_collection_tag,
false
>
: detail::relate::relate_impl
<
detail::de9im::static_mask_touches_type,
Geometry1,
Geometry2
>
: detail::touches::gc_gc
{};
@ -429,12 +476,7 @@ struct touches
CastedTag1, geometry_collection_tag,
false
>
: detail::relate::relate_impl
<
detail::de9im::static_mask_touches_type,
Geometry1,
Geometry2
>
: detail::touches::notgc_gc
{};
@ -446,12 +488,7 @@ struct touches
geometry_collection_tag, CastedTag2,
false
>
: detail::relate::relate_impl
<
detail::de9im::static_mask_touches_type,
Geometry1,
Geometry2
>
: detail::touches::gc_notgc
{};

View File

@ -1,5 +1,7 @@
// Boost.Geometry
// Copyright (c) 2022 Adam Wulkiewicz, Lodz, Poland.
// Copyright (c) 2022 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -42,6 +44,13 @@ void test_gc()
"GEOMETRYCOLLECTION(POLYGON((10 10,10 20,20 20,20 10,10 10)), LINESTRING(11 11,19 19))",
true);
test_geometry<gc_t, gc_t>("GEOMETRYCOLLECTION(POINT(0 0), POINT(2 2))",
"GEOMETRYCOLLECTION(POINT(0 0), POINT(1 1))",
false);
test_geometry<gc_t, gc_t>("GEOMETRYCOLLECTION(POINT(0 0))",
"GEOMETRYCOLLECTION(POINT(0 0))",
false);
test_geometry<gc_t, gc_t>("GEOMETRYCOLLECTION(POINT(2 2))",
"GEOMETRYCOLLECTION(LINESTRING(0 0, 1 1), LINESTRING(1 1, 2 2))",
true);