mirror of
https://github.com/boostorg/geometry.git
synced 2025-05-11 05:24:02 +00:00
Support covered_by(multi_point, box).
This commit is contained in:
parent
8472f93658
commit
b4082158b7
@ -74,6 +74,23 @@ struct covered_by<Point, Box, point_tag, box_tag>
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <typename MultiPoint, typename Box>
|
||||||
|
struct covered_by<MultiPoint, Box, multi_point_tag, box_tag>
|
||||||
|
{
|
||||||
|
template <typename Strategy>
|
||||||
|
static inline bool apply(MultiPoint const& mpoint, Box const& box, Strategy const& strategy)
|
||||||
|
{
|
||||||
|
for (auto point : mpoint)
|
||||||
|
{
|
||||||
|
if (! strategy.covered_by(point, box).apply(point, box))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
template <typename Box1, typename Box2>
|
template <typename Box1, typename Box2>
|
||||||
struct covered_by<Box1, Box2, box_tag, box_tag>
|
struct covered_by<Box1, Box2, box_tag, box_tag>
|
||||||
{
|
{
|
||||||
|
@ -119,6 +119,10 @@ void test_all()
|
|||||||
test_geometry<P, box_type>("POINT(1 0)", "BOX(0 0,2 2)", true);
|
test_geometry<P, box_type>("POINT(1 0)", "BOX(0 0,2 2)", true);
|
||||||
test_geometry<P, box_type>("POINT(3 3)", "BOX(0 0,2 2)", false);
|
test_geometry<P, box_type>("POINT(3 3)", "BOX(0 0,2 2)", false);
|
||||||
|
|
||||||
|
test_geometry<mpt, box_type>("MULTIPOINT(1 1, 2 1)", "BOX(0 0,3 3)", true);
|
||||||
|
test_geometry<mpt, box_type>("MULTIPOINT(0 0, 1 1)", "BOX(0 0,2 2)", true);
|
||||||
|
test_geometry<mpt, box_type>("MULTIPOINT(0 0, 3 4)", "BOX(0 0,2 2)", false);
|
||||||
|
|
||||||
test_geometry<box_type, box_type>("BOX(1 1,2 2)", "BOX(0 0,3 3)", true);
|
test_geometry<box_type, box_type>("BOX(1 1,2 2)", "BOX(0 0,3 3)", true);
|
||||||
test_geometry<box_type, box_type>("BOX(0 0,3 3)", "BOX(1 1,2 2)", false);
|
test_geometry<box_type, box_type>("BOX(0 0,3 3)", "BOX(1 1,2 2)", false);
|
||||||
test_geometry<box_type, box_type>("BOX(0 0,2 2)", "BOX(0 0,3 3)", true);
|
test_geometry<box_type, box_type>("BOX(0 0,2 2)", "BOX(0 0,3 3)", true);
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
// Boost.Geometry
|
// Boost.Geometry
|
||||||
|
|
||||||
// Copyright (c) 2016-2021 Oracle and/or its affiliates.
|
// Copyright (c) 2016-2022 Oracle and/or its affiliates.
|
||||||
|
|
||||||
|
// Contributed and/or modified by Vissarion Fysikopoulos, 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
|
||||||
|
|
||||||
// Use, modification and distribution is subject to the Boost Software License,
|
// Use, modification and distribution is subject to the Boost Software License,
|
||||||
@ -44,6 +46,16 @@ void test_point_box()
|
|||||||
test_geometry<P, box_t>("POINT(-177.872408 1)", "BOX(179.08882 0, 182.127592 2)", true);
|
test_geometry<P, box_t>("POINT(-177.872408 1)", "BOX(179.08882 0, 182.127592 2)", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename P>
|
||||||
|
void test_multi_point_box()
|
||||||
|
{
|
||||||
|
typedef bg::model::box<P> box_t;
|
||||||
|
typedef bg::model::multi_point<P> mp_t;
|
||||||
|
|
||||||
|
test_geometry<mp_t, box_t>("MULTIPOINT(0 0,1 1)", "BOX(0 0, 1 1)", true);
|
||||||
|
test_geometry<mp_t, box_t>("MULTIPOINT(1 1,3 3)", "BOX(0 0, 2 2)", false);
|
||||||
|
}
|
||||||
|
|
||||||
template <typename P>
|
template <typename P>
|
||||||
void test_box_box()
|
void test_box_box()
|
||||||
{
|
{
|
||||||
@ -113,6 +125,7 @@ template <typename P>
|
|||||||
void test_cs()
|
void test_cs()
|
||||||
{
|
{
|
||||||
test_point_box<P>();
|
test_point_box<P>();
|
||||||
|
test_multi_point_box<P>();
|
||||||
test_box_box<P>();
|
test_box_box<P>();
|
||||||
test_point_polygon<P>();
|
test_point_polygon<P>();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user