update boost
This commit is contained in:
@@ -4,8 +4,8 @@
|
||||
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
|
||||
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
|
||||
|
||||
// This file was modified by Oracle on 2013, 2014, 2017, 2019.
|
||||
// Modifications copyright (c) 2013-2019 Oracle and/or its affiliates.
|
||||
// This file was modified by Oracle on 2013-2022.
|
||||
// Modifications copyright (c) 2013-2022 Oracle and/or its affiliates.
|
||||
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
||||
|
||||
@@ -20,11 +20,17 @@
|
||||
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_WITHIN_IMPLEMENTATION_HPP
|
||||
|
||||
#include <cstddef>
|
||||
#include <deque>
|
||||
|
||||
#include <boost/core/ignore_unused.hpp>
|
||||
#include <boost/range.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/detail/overlay/get_turns.hpp>
|
||||
#include <boost/geometry/algorithms/detail/overlay/do_reverse.hpp>
|
||||
#include <boost/geometry/algorithms/detail/within/interface.hpp>
|
||||
#include <boost/geometry/algorithms/detail/within/multi_point.hpp>
|
||||
#include <boost/geometry/algorithms/detail/within/point_in_geometry.hpp>
|
||||
#include <boost/geometry/algorithms/detail/relate/implementation.hpp>
|
||||
#include <boost/geometry/algorithms/detail/relate/relate_impl.hpp>
|
||||
|
||||
#include <boost/geometry/core/access.hpp>
|
||||
#include <boost/geometry/core/closure.hpp>
|
||||
@@ -36,19 +42,12 @@
|
||||
#include <boost/geometry/core/interior_rings.hpp>
|
||||
#include <boost/geometry/core/tags.hpp>
|
||||
|
||||
#include <boost/geometry/strategies/relate/cartesian.hpp>
|
||||
#include <boost/geometry/strategies/relate/geographic.hpp>
|
||||
#include <boost/geometry/strategies/relate/spherical.hpp>
|
||||
|
||||
#include <boost/geometry/util/math.hpp>
|
||||
#include <boost/geometry/util/order_as_direction.hpp>
|
||||
#include <boost/geometry/views/closeable_view.hpp>
|
||||
#include <boost/geometry/views/reversible_view.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/detail/within/multi_point.hpp>
|
||||
#include <boost/geometry/algorithms/detail/within/point_in_geometry.hpp>
|
||||
#include <boost/geometry/algorithms/relate.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/detail/overlay/get_turns.hpp>
|
||||
#include <boost/geometry/algorithms/detail/overlay/do_reverse.hpp>
|
||||
#include <deque>
|
||||
|
||||
|
||||
namespace boost { namespace geometry
|
||||
{
|
||||
@@ -70,11 +69,12 @@ struct use_relate
|
||||
template <typename Geometry1, typename Geometry2, typename Strategy>
|
||||
static inline bool apply(Geometry1 const& geometry1, Geometry2 const& geometry2, Strategy const& strategy)
|
||||
{
|
||||
typedef typename detail::de9im::static_mask_within_type
|
||||
return detail::relate::relate_impl
|
||||
<
|
||||
Geometry1, Geometry2
|
||||
>::type within_mask;
|
||||
return geometry::relate(geometry1, geometry2, within_mask(), strategy);
|
||||
detail::de9im::static_mask_within_type,
|
||||
Geometry1,
|
||||
Geometry2
|
||||
>::apply(geometry1, geometry2, strategy);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -91,8 +91,7 @@ struct within<Point, Box, point_tag, box_tag>
|
||||
template <typename Strategy>
|
||||
static inline bool apply(Point const& point, Box const& box, Strategy const& strategy)
|
||||
{
|
||||
boost::ignore_unused(strategy);
|
||||
return strategy.apply(point, box);
|
||||
return strategy.within(point, box).apply(point, box);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -103,8 +102,7 @@ struct within<Box1, Box2, box_tag, box_tag>
|
||||
static inline bool apply(Box1 const& box1, Box2 const& box2, Strategy const& strategy)
|
||||
{
|
||||
assert_dimension_equal<Box1, Box2>();
|
||||
boost::ignore_unused(strategy);
|
||||
return strategy.apply(box1, box2);
|
||||
return strategy.within(box1, box2).apply(box1, box2);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
// 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)
|
||||
|
||||
#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_WITHIN_IMPLEMENTATION_GC_HPP
|
||||
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_WITHIN_IMPLEMENTATION_GC_HPP
|
||||
|
||||
|
||||
#include <boost/geometry/algorithms/detail/relate/implementation_gc.hpp>
|
||||
#include <boost/geometry/algorithms/detail/within/implementation.hpp>
|
||||
|
||||
|
||||
namespace boost { namespace geometry {
|
||||
|
||||
|
||||
#ifndef DOXYGEN_NO_DISPATCH
|
||||
namespace dispatch {
|
||||
|
||||
template <typename Geometry1, typename Geometry2>
|
||||
struct within<Geometry1, Geometry2, geometry_collection_tag, geometry_collection_tag>
|
||||
: detail::within::use_relate
|
||||
{};
|
||||
|
||||
template <typename Geometry1, typename Geometry2, typename Tag1>
|
||||
struct within<Geometry1, Geometry2, Tag1, geometry_collection_tag>
|
||||
: detail::within::use_relate
|
||||
{};
|
||||
|
||||
template <typename Geometry1, typename Geometry2, typename Tag2>
|
||||
struct within<Geometry1, Geometry2, geometry_collection_tag, Tag2>
|
||||
: detail::within::use_relate
|
||||
{};
|
||||
|
||||
} // namespace dispatch
|
||||
#endif // DOXYGEN_NO_DISPATCH
|
||||
|
||||
|
||||
}} // namespace boost::geometry
|
||||
|
||||
#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_WITHIN_IMPLEMENTATION_GC_HPP
|
||||
@@ -4,9 +4,8 @@
|
||||
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
|
||||
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
|
||||
|
||||
// This file was modified by Oracle on 2013, 2014, 2017, 2018.
|
||||
// Modifications copyright (c) 2013-2018 Oracle and/or its affiliates.
|
||||
|
||||
// This file was modified by Oracle on 2013-2022.
|
||||
// Modifications copyright (c) 2013-2022 Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
||||
|
||||
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
|
||||
@@ -22,19 +21,18 @@
|
||||
|
||||
#include <boost/concept_check.hpp>
|
||||
|
||||
#include <boost/variant/apply_visitor.hpp>
|
||||
#include <boost/variant/static_visitor.hpp>
|
||||
#include <boost/variant/variant_fwd.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/not_implemented.hpp>
|
||||
|
||||
#include <boost/geometry/core/tag.hpp>
|
||||
#include <boost/geometry/core/tag_cast.hpp>
|
||||
|
||||
#include <boost/geometry/geometries/adapted/boost_variant.hpp>
|
||||
#include <boost/geometry/geometries/concepts/check.hpp>
|
||||
|
||||
#include <boost/geometry/strategies/concepts/within_concept.hpp>
|
||||
#include <boost/geometry/strategies/default_strategy.hpp>
|
||||
#include <boost/geometry/strategies/within.hpp>
|
||||
#include <boost/geometry/strategies/detail.hpp>
|
||||
#include <boost/geometry/strategies/relate/services.hpp>
|
||||
|
||||
|
||||
namespace boost { namespace geometry
|
||||
@@ -63,40 +61,78 @@ struct within
|
||||
namespace resolve_strategy
|
||||
{
|
||||
|
||||
template
|
||||
<
|
||||
typename Strategy,
|
||||
bool IsUmbrella = strategies::detail::is_umbrella_strategy<Strategy>::value
|
||||
>
|
||||
struct within
|
||||
{
|
||||
template <typename Geometry1, typename Geometry2, typename Strategy>
|
||||
template <typename Geometry1, typename Geometry2>
|
||||
static inline bool apply(Geometry1 const& geometry1,
|
||||
Geometry2 const& geometry2,
|
||||
Strategy const& strategy)
|
||||
{
|
||||
concepts::within::check<Geometry1, Geometry2, Strategy>();
|
||||
|
||||
return dispatch::within<Geometry1, Geometry2>::apply(geometry1, geometry2, strategy);
|
||||
return dispatch::within
|
||||
<
|
||||
Geometry1, Geometry2
|
||||
>::apply(geometry1, geometry2, strategy);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Strategy>
|
||||
struct within<Strategy, false>
|
||||
{
|
||||
template <typename Geometry1, typename Geometry2>
|
||||
static inline bool apply(Geometry1 const& geometry1,
|
||||
Geometry2 const& geometry2,
|
||||
Strategy const& strategy)
|
||||
{
|
||||
using strategies::relate::services::strategy_converter;
|
||||
|
||||
return within
|
||||
<
|
||||
decltype(strategy_converter<Strategy>::get(strategy))
|
||||
>::apply(geometry1, geometry2,
|
||||
strategy_converter<Strategy>::get(strategy));
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct within<default_strategy, false>
|
||||
{
|
||||
template <typename Geometry1, typename Geometry2>
|
||||
static inline bool apply(Geometry1 const& geometry1,
|
||||
Geometry2 const& geometry2,
|
||||
default_strategy)
|
||||
{
|
||||
typedef typename strategy::within::services::default_strategy
|
||||
typedef typename strategies::relate::services::default_strategy
|
||||
<
|
||||
Geometry1,
|
||||
Geometry2
|
||||
>::type strategy_type;
|
||||
|
||||
return apply(geometry1, geometry2, strategy_type());
|
||||
return within
|
||||
<
|
||||
strategy_type
|
||||
>::apply(geometry1, geometry2, strategy_type());
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace resolve_strategy
|
||||
|
||||
|
||||
namespace resolve_variant
|
||||
namespace resolve_dynamic
|
||||
{
|
||||
|
||||
template <typename Geometry1, typename Geometry2>
|
||||
template
|
||||
<
|
||||
typename Geometry1, typename Geometry2,
|
||||
typename Tag1 = typename geometry::tag<Geometry1>::type,
|
||||
typename Tag2 = typename geometry::tag<Geometry2>::type
|
||||
>
|
||||
struct within
|
||||
{
|
||||
template <typename Strategy>
|
||||
@@ -108,116 +144,73 @@ struct within
|
||||
concepts::check<Geometry2 const>();
|
||||
assert_dimension_equal<Geometry1, Geometry2>();
|
||||
|
||||
return resolve_strategy::within::apply(geometry1,
|
||||
geometry2,
|
||||
strategy);
|
||||
return resolve_strategy::within
|
||||
<
|
||||
Strategy
|
||||
>::apply(geometry1, geometry2, strategy);
|
||||
}
|
||||
};
|
||||
|
||||
template <BOOST_VARIANT_ENUM_PARAMS(typename T), typename Geometry2>
|
||||
struct within<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>, Geometry2>
|
||||
template <typename Geometry1, typename Geometry2, typename Tag2>
|
||||
struct within<Geometry1, Geometry2, dynamic_geometry_tag, Tag2>
|
||||
{
|
||||
template <typename Strategy>
|
||||
struct visitor: boost::static_visitor<bool>
|
||||
static inline bool apply(Geometry1 const& geometry1,
|
||||
Geometry2 const& geometry2,
|
||||
Strategy const& strategy)
|
||||
{
|
||||
Geometry2 const& m_geometry2;
|
||||
Strategy const& m_strategy;
|
||||
|
||||
visitor(Geometry2 const& geometry2, Strategy const& strategy)
|
||||
: m_geometry2(geometry2)
|
||||
, m_strategy(strategy)
|
||||
{}
|
||||
|
||||
template <typename Geometry1>
|
||||
bool operator()(Geometry1 const& geometry1) const
|
||||
bool result = false;
|
||||
traits::visit<Geometry1>::apply([&](auto const& g1)
|
||||
{
|
||||
return within<Geometry1, Geometry2>::apply(geometry1,
|
||||
m_geometry2,
|
||||
m_strategy);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Strategy>
|
||||
static inline bool
|
||||
apply(boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> const& geometry1,
|
||||
Geometry2 const& geometry2,
|
||||
Strategy const& strategy)
|
||||
{
|
||||
return boost::apply_visitor(visitor<Strategy>(geometry2, strategy),
|
||||
geometry1);
|
||||
result = within
|
||||
<
|
||||
util::remove_cref_t<decltype(g1)>,
|
||||
Geometry2
|
||||
>::apply(g1, geometry2, strategy);
|
||||
}, geometry1);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Geometry1, BOOST_VARIANT_ENUM_PARAMS(typename T)>
|
||||
struct within<Geometry1, boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> >
|
||||
template <typename Geometry1, typename Geometry2, typename Tag1>
|
||||
struct within<Geometry1, Geometry2, Tag1, dynamic_geometry_tag>
|
||||
{
|
||||
template <typename Strategy>
|
||||
struct visitor: boost::static_visitor<bool>
|
||||
static inline bool apply(Geometry1 const& geometry1,
|
||||
Geometry2 const& geometry2,
|
||||
Strategy const& strategy)
|
||||
{
|
||||
Geometry1 const& m_geometry1;
|
||||
Strategy const& m_strategy;
|
||||
|
||||
visitor(Geometry1 const& geometry1, Strategy const& strategy)
|
||||
: m_geometry1(geometry1)
|
||||
, m_strategy(strategy)
|
||||
{}
|
||||
|
||||
template <typename Geometry2>
|
||||
bool operator()(Geometry2 const& geometry2) const
|
||||
bool result = false;
|
||||
traits::visit<Geometry2>::apply([&](auto const& g2)
|
||||
{
|
||||
return within<Geometry1, Geometry2>::apply(m_geometry1,
|
||||
geometry2,
|
||||
m_strategy);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Strategy>
|
||||
static inline bool
|
||||
apply(Geometry1 const& geometry1,
|
||||
boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> const& geometry2,
|
||||
Strategy const& strategy)
|
||||
{
|
||||
return boost::apply_visitor(visitor<Strategy>(geometry1, strategy),
|
||||
geometry2
|
||||
);
|
||||
result = within
|
||||
<
|
||||
Geometry1,
|
||||
util::remove_cref_t<decltype(g2)>
|
||||
>::apply(geometry1, g2, strategy);
|
||||
}, geometry2);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
template <
|
||||
BOOST_VARIANT_ENUM_PARAMS(typename T1),
|
||||
BOOST_VARIANT_ENUM_PARAMS(typename T2)
|
||||
>
|
||||
struct within<
|
||||
boost::variant<BOOST_VARIANT_ENUM_PARAMS(T1)>,
|
||||
boost::variant<BOOST_VARIANT_ENUM_PARAMS(T2)>
|
||||
>
|
||||
template <typename Geometry1, typename Geometry2>
|
||||
struct within<Geometry1, Geometry2, dynamic_geometry_tag, dynamic_geometry_tag>
|
||||
{
|
||||
template <typename Strategy>
|
||||
struct visitor: boost::static_visitor<bool>
|
||||
static inline bool apply(Geometry1 const& geometry1,
|
||||
Geometry2 const& geometry2,
|
||||
Strategy const& strategy)
|
||||
{
|
||||
Strategy const& m_strategy;
|
||||
|
||||
visitor(Strategy const& strategy): m_strategy(strategy) {}
|
||||
|
||||
template <typename Geometry1, typename Geometry2>
|
||||
bool operator()(Geometry1 const& geometry1,
|
||||
Geometry2 const& geometry2) const
|
||||
bool result = false;
|
||||
traits::visit<Geometry1, Geometry2>::apply([&](auto const& g1, auto const& g2)
|
||||
{
|
||||
return within<Geometry1, Geometry2>::apply(geometry1,
|
||||
geometry2,
|
||||
m_strategy);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Strategy>
|
||||
static inline bool
|
||||
apply(boost::variant<BOOST_VARIANT_ENUM_PARAMS(T1)> const& geometry1,
|
||||
boost::variant<BOOST_VARIANT_ENUM_PARAMS(T2)> const& geometry2,
|
||||
Strategy const& strategy)
|
||||
{
|
||||
return boost::apply_visitor(visitor<Strategy>(strategy),
|
||||
geometry1,
|
||||
geometry2);
|
||||
result = within
|
||||
<
|
||||
util::remove_cref_t<decltype(g1)>,
|
||||
util::remove_cref_t<decltype(g2)>
|
||||
>::apply(g1, g2, strategy);
|
||||
}, geometry1, geometry2);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -248,7 +241,7 @@ struct within<
|
||||
template<typename Geometry1, typename Geometry2>
|
||||
inline bool within(Geometry1 const& geometry1, Geometry2 const& geometry2)
|
||||
{
|
||||
return resolve_variant::within
|
||||
return resolve_dynamic::within
|
||||
<
|
||||
Geometry1,
|
||||
Geometry2
|
||||
@@ -286,7 +279,7 @@ inline bool within(Geometry1 const& geometry1,
|
||||
Geometry2 const& geometry2,
|
||||
Strategy const& strategy)
|
||||
{
|
||||
return resolve_variant::within
|
||||
return resolve_dynamic::within
|
||||
<
|
||||
Geometry1,
|
||||
Geometry2
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
// Boost.Geometry
|
||||
|
||||
// Copyright (c) 2017 Oracle and/or its affiliates.
|
||||
// Copyright (c) 2023 Adam Wulkiewicz, Lodz, Poland.
|
||||
|
||||
// Copyright (c) 2017-2023, 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
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
@@ -15,8 +18,10 @@
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
#include <boost/range.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/range/size.hpp>
|
||||
#include <boost/range/value_type.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/detail/disjoint/box_box.hpp>
|
||||
#include <boost/geometry/algorithms/detail/disjoint/point_box.hpp>
|
||||
@@ -37,6 +42,9 @@
|
||||
#include <boost/geometry/strategies/covered_by.hpp>
|
||||
#include <boost/geometry/strategies/disjoint.hpp>
|
||||
|
||||
#include <boost/geometry/util/condition.hpp>
|
||||
#include <boost/geometry/util/type_traits.hpp>
|
||||
|
||||
|
||||
namespace boost { namespace geometry {
|
||||
|
||||
@@ -50,10 +58,11 @@ struct multi_point_point
|
||||
Point const& point,
|
||||
Strategy const& strategy)
|
||||
{
|
||||
typedef typename boost::range_const_iterator<MultiPoint>::type iterator;
|
||||
for ( iterator it = boost::begin(multi_point) ; it != boost::end(multi_point) ; ++it )
|
||||
auto const s = strategy.relate(multi_point, point);
|
||||
|
||||
for (auto it = boost::begin(multi_point); it != boost::end(multi_point); ++it)
|
||||
{
|
||||
if (! strategy.apply(*it, point))
|
||||
if (! s.apply(*it, point))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -73,16 +82,16 @@ struct multi_point_multi_point
|
||||
Strategy const& /*strategy*/)
|
||||
{
|
||||
typedef typename boost::range_value<MultiPoint2>::type point2_type;
|
||||
typedef geometry::less<void, -1, Strategy> less_type;
|
||||
|
||||
geometry::less<> const less = geometry::less<>();
|
||||
less_type const less = less_type();
|
||||
|
||||
std::vector<point2_type> points2(boost::begin(multi_point2), boost::end(multi_point2));
|
||||
std::sort(points2.begin(), points2.end(), less);
|
||||
|
||||
bool result = false;
|
||||
|
||||
typedef typename boost::range_const_iterator<MultiPoint1>::type iterator;
|
||||
for ( iterator it = boost::begin(multi_point1) ; it != boost::end(multi_point1) ; ++it )
|
||||
for (auto it = boost::begin(multi_point1); it != boost::end(multi_point1); ++it)
|
||||
{
|
||||
if (! std::binary_search(points2.begin(), points2.end(), *it, less))
|
||||
{
|
||||
@@ -114,27 +123,23 @@ struct multi_point_single_geometry
|
||||
LinearOrAreal const& linear_or_areal,
|
||||
Strategy const& strategy)
|
||||
{
|
||||
typedef typename boost::range_value<MultiPoint>::type point1_type;
|
||||
//typedef typename boost::range_value<MultiPoint>::type point1_type;
|
||||
typedef typename point_type<LinearOrAreal>::type point2_type;
|
||||
typedef model::box<point2_type> box2_type;
|
||||
|
||||
// Create envelope of geometry
|
||||
box2_type box;
|
||||
geometry::envelope(linear_or_areal, box, strategy.get_envelope_strategy());
|
||||
geometry::envelope(linear_or_areal, box, strategy);
|
||||
geometry::detail::expand_by_epsilon(box);
|
||||
|
||||
typedef typename strategy::covered_by::services::default_strategy
|
||||
<
|
||||
point1_type, box2_type
|
||||
>::type point_in_box_type;
|
||||
|
||||
// Test each Point with envelope and then geometry if needed
|
||||
// If in the exterior, break
|
||||
bool result = false;
|
||||
|
||||
typedef typename boost::range_const_iterator<MultiPoint>::type iterator;
|
||||
for ( iterator it = boost::begin(multi_point) ; it != boost::end(multi_point) ; ++it )
|
||||
for (auto it = boost::begin(multi_point); it != boost::end(multi_point); ++it )
|
||||
{
|
||||
typedef decltype(strategy.covered_by(*it, box)) point_in_box_type;
|
||||
|
||||
int in_val = 0;
|
||||
|
||||
// exterior of box and of geometry
|
||||
@@ -168,18 +173,7 @@ struct multi_point_multi_geometry
|
||||
{
|
||||
typedef typename point_type<LinearOrAreal>::type point2_type;
|
||||
typedef model::box<point2_type> box2_type;
|
||||
static const bool is_linear = is_same
|
||||
<
|
||||
typename tag_cast
|
||||
<
|
||||
typename tag<LinearOrAreal>::type,
|
||||
linear_tag
|
||||
>::type,
|
||||
linear_tag
|
||||
>::value;
|
||||
|
||||
typename Strategy::envelope_strategy_type const
|
||||
envelope_strategy = strategy.get_envelope_strategy();
|
||||
static const bool is_linear = util::is_linear<LinearOrAreal>::value;
|
||||
|
||||
// TODO: box pairs could be constructed on the fly, inside the rtree
|
||||
|
||||
@@ -190,20 +184,22 @@ struct multi_point_multi_geometry
|
||||
box_pair_vector boxes(count2);
|
||||
for (std::size_t i = 0 ; i < count2 ; ++i)
|
||||
{
|
||||
geometry::envelope(linear_or_areal, boxes[i].first, envelope_strategy);
|
||||
geometry::envelope(linear_or_areal, boxes[i].first, strategy);
|
||||
geometry::detail::expand_by_epsilon(boxes[i].first);
|
||||
boxes[i].second = i;
|
||||
}
|
||||
|
||||
// Create R-tree
|
||||
index::rtree<box_pair_type, index::rstar<4> > rtree(boxes.begin(), boxes.end());
|
||||
typedef index::parameters<index::rstar<4>, Strategy> index_parameters_type;
|
||||
index::rtree<box_pair_type, index_parameters_type>
|
||||
rtree(boxes.begin(), boxes.end(),
|
||||
index_parameters_type(index::rstar<4>(), strategy));
|
||||
|
||||
// For each point find overlapping envelopes and test corresponding single geometries
|
||||
// If a point is in the exterior break
|
||||
bool result = false;
|
||||
|
||||
typedef typename boost::range_const_iterator<MultiPoint>::type iterator;
|
||||
for ( iterator it = boost::begin(multi_point) ; it != boost::end(multi_point) ; ++it )
|
||||
for (auto it = boost::begin(multi_point); it != boost::end(multi_point); ++it)
|
||||
{
|
||||
// TODO: investigate the possibility of using satisfies
|
||||
// TODO: investigate the possibility of using iterative queries (optimization below)
|
||||
@@ -214,15 +210,21 @@ struct multi_point_multi_geometry
|
||||
bool found_boundary = false;
|
||||
int boundaries = 0;
|
||||
|
||||
typedef typename box_pair_vector::const_iterator iterator;
|
||||
for ( iterator box_it = inters_boxes.begin() ; box_it != inters_boxes.end() ; ++box_it )
|
||||
typedef typename box_pair_vector::const_iterator box_iterator;
|
||||
for (box_iterator box_it = inters_boxes.begin() ;
|
||||
box_it != inters_boxes.end() ; ++box_it )
|
||||
{
|
||||
int in_val = point_in_geometry(*it, range::at(linear_or_areal, box_it->second), strategy);
|
||||
int const in_val = point_in_geometry(*it,
|
||||
range::at(linear_or_areal, box_it->second), strategy);
|
||||
|
||||
if (in_val > 0)
|
||||
{
|
||||
found_interior = true;
|
||||
}
|
||||
else if (in_val == 0)
|
||||
{
|
||||
++boundaries;
|
||||
}
|
||||
|
||||
// If the result was set previously (interior or
|
||||
// interior/boundary found) the only thing that needs to be
|
||||
@@ -234,12 +236,16 @@ struct multi_point_multi_geometry
|
||||
}
|
||||
}
|
||||
|
||||
if ( boundaries > 0)
|
||||
if (boundaries > 0)
|
||||
{
|
||||
if (is_linear && boundaries % 2 == 0)
|
||||
if (BOOST_GEOMETRY_CONDITION(is_linear) && boundaries % 2 == 0)
|
||||
{
|
||||
found_interior = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
found_boundary = true;
|
||||
}
|
||||
}
|
||||
|
||||
// exterior
|
||||
|
||||
@@ -5,9 +5,8 @@
|
||||
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
|
||||
// Copyright (c) 2014 Adam Wulkiewicz, Lodz, Poland.
|
||||
|
||||
// This file was modified by Oracle on 2013, 2014, 2015, 2017, 2018, 2019.
|
||||
// Modifications copyright (c) 2013-2019, Oracle and/or its affiliates.
|
||||
|
||||
// This file was modified by Oracle on 2013-2021.
|
||||
// Modifications copyright (c) 2013-2021, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
||||
|
||||
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
|
||||
@@ -22,78 +21,45 @@
|
||||
|
||||
|
||||
#include <boost/core/ignore_unused.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
#include <boost/range.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/range/size.hpp>
|
||||
#include <boost/range/value_type.hpp>
|
||||
|
||||
#include <boost/geometry/core/assert.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/detail/assign_indexed_point.hpp>
|
||||
#include <boost/geometry/algorithms/detail/equals/point_point.hpp>
|
||||
#include <boost/geometry/algorithms/detail/interior_iterator.hpp>
|
||||
|
||||
#include <boost/geometry/geometries/concepts/check.hpp>
|
||||
#include <boost/geometry/strategies/concepts/within_concept.hpp>
|
||||
#include <boost/geometry/strategies/default_strategy.hpp>
|
||||
#include <boost/geometry/strategies/relate.hpp>
|
||||
|
||||
#include <boost/geometry/util/range.hpp>
|
||||
#include <boost/geometry/views/detail/normalized_view.hpp>
|
||||
#include <boost/geometry/views/detail/closed_clockwise_view.hpp>
|
||||
|
||||
namespace boost { namespace geometry {
|
||||
|
||||
#ifndef DOXYGEN_NO_DETAIL
|
||||
namespace detail { namespace within {
|
||||
|
||||
template <typename Point1, typename Point2, typename Strategy>
|
||||
inline bool equals_point_point(Point1 const& p1, Point2 const& p2, Strategy const& strategy)
|
||||
{
|
||||
return equals::equals_point_point(p1, p2, strategy.get_equals_point_point_strategy());
|
||||
}
|
||||
|
||||
// TODO: is this needed?
|
||||
inline int check_result_type(int result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline T check_result_type(T result)
|
||||
{
|
||||
BOOST_GEOMETRY_ASSERT(false);
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename Point, typename Range, typename Strategy> inline
|
||||
int point_in_range(Point const& point, Range const& range, Strategy const& strategy)
|
||||
{
|
||||
boost::ignore_unused(strategy);
|
||||
|
||||
typedef typename boost::range_iterator<Range const>::type iterator_type;
|
||||
typename Strategy::state_type state;
|
||||
iterator_type it = boost::begin(range);
|
||||
iterator_type end = boost::end(range);
|
||||
|
||||
for ( iterator_type previous = it++ ; it != end ; ++previous, ++it )
|
||||
auto it = boost::begin(range);
|
||||
auto const end = boost::end(range);
|
||||
|
||||
for (auto previous = it++; it != end; ++previous, ++it)
|
||||
{
|
||||
if ( ! strategy.apply(point, *previous, *it, state) )
|
||||
if (! strategy.apply(point, *previous, *it, state))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return check_result_type(strategy.result(state));
|
||||
}
|
||||
|
||||
template <typename Geometry, typename Point, typename Range>
|
||||
inline int point_in_range(Point const& point, Range const& range)
|
||||
{
|
||||
typedef typename strategy::point_in_geometry::services::default_strategy
|
||||
<
|
||||
Point, Geometry
|
||||
>::type strategy_type;
|
||||
|
||||
return point_in_range(point, range, strategy_type());
|
||||
return strategy.result(state);
|
||||
}
|
||||
|
||||
}} // namespace detail::within
|
||||
@@ -117,8 +83,8 @@ struct point_in_geometry<Point2, point_tag>
|
||||
template <typename Point1, typename Strategy> static inline
|
||||
int apply(Point1 const& point1, Point2 const& point2, Strategy const& strategy)
|
||||
{
|
||||
boost::ignore_unused(strategy);
|
||||
return strategy.apply(point1, point2) ? 1 : -1;
|
||||
typedef decltype(strategy.relate(point1, point2)) strategy_type;
|
||||
return strategy_type::apply(point1, point2) ? 1 : -1;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -128,24 +94,23 @@ struct point_in_geometry<Segment, segment_tag>
|
||||
template <typename Point, typename Strategy> static inline
|
||||
int apply(Point const& point, Segment const& segment, Strategy const& strategy)
|
||||
{
|
||||
boost::ignore_unused(strategy);
|
||||
|
||||
typedef typename geometry::point_type<Segment>::type point_type;
|
||||
point_type p0, p1;
|
||||
// TODO: don't copy points
|
||||
detail::assign_point_from_index<0>(segment, p0);
|
||||
detail::assign_point_from_index<1>(segment, p1);
|
||||
|
||||
typename Strategy::state_type state;
|
||||
strategy.apply(point, p0, p1, state);
|
||||
int r = detail::within::check_result_type(strategy.result(state));
|
||||
auto const s = strategy.relate(point, segment);
|
||||
typename decltype(s)::state_type state;
|
||||
s.apply(point, p0, p1, state);
|
||||
int r = s.result(state);
|
||||
|
||||
if ( r != 0 )
|
||||
return -1; // exterior
|
||||
|
||||
// if the point is equal to the one of the terminal points
|
||||
if ( detail::within::equals_point_point(point, p0, strategy)
|
||||
|| detail::within::equals_point_point(point, p1, strategy) )
|
||||
if ( detail::equals::equals_point_point(point, p0, strategy)
|
||||
|| detail::equals::equals_point_point(point, p1, strategy) )
|
||||
return 0; // boundary
|
||||
else
|
||||
return 1; // interior
|
||||
@@ -162,24 +127,37 @@ struct point_in_geometry<Linestring, linestring_tag>
|
||||
std::size_t count = boost::size(linestring);
|
||||
if ( count > 1 )
|
||||
{
|
||||
if ( detail::within::point_in_range(point, linestring, strategy) != 0 )
|
||||
if ( detail::within::point_in_range(point, linestring,
|
||||
strategy.relate(point, linestring)) != 0 )
|
||||
{
|
||||
return -1; // exterior
|
||||
}
|
||||
|
||||
typedef typename boost::range_value<Linestring>::type point_type;
|
||||
point_type const& front = range::front(linestring);
|
||||
point_type const& back = range::back(linestring);
|
||||
|
||||
// if the linestring doesn't have a boundary
|
||||
if (detail::within::equals_point_point(range::front(linestring), range::back(linestring), strategy))
|
||||
if ( detail::equals::equals_point_point(front, back, strategy) )
|
||||
{
|
||||
return 1; // interior
|
||||
}
|
||||
// else if the point is equal to the one of the terminal points
|
||||
else if (detail::within::equals_point_point(point, range::front(linestring), strategy)
|
||||
|| detail::within::equals_point_point(point, range::back(linestring), strategy))
|
||||
else if ( detail::equals::equals_point_point(point, front, strategy)
|
||||
|| detail::equals::equals_point_point(point, back, strategy) )
|
||||
{
|
||||
return 0; // boundary
|
||||
}
|
||||
else
|
||||
{
|
||||
return 1; // interior
|
||||
}
|
||||
}
|
||||
// TODO: for now degenerated linestrings are ignored
|
||||
// throw an exception here?
|
||||
/*else if ( count == 1 )
|
||||
{
|
||||
if ( detail::equals::equals_point_point(point, range::front(linestring)) )
|
||||
if ( detail::equals::equals_point_point(point, front, strategy) )
|
||||
return 1;
|
||||
}*/
|
||||
|
||||
@@ -201,8 +179,9 @@ struct point_in_geometry<Ring, ring_tag>
|
||||
return -1;
|
||||
}
|
||||
|
||||
detail::normalized_view<Ring const> view(ring);
|
||||
return detail::within::point_in_range(point, view, strategy);
|
||||
detail::closed_clockwise_view<Ring const> view(ring);
|
||||
return detail::within::point_in_range(point, view,
|
||||
strategy.relate(point, ring));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -221,13 +200,8 @@ struct point_in_geometry<Polygon, polygon_tag>
|
||||
|
||||
if (code == 1)
|
||||
{
|
||||
typename interior_return_type<Polygon const>::type
|
||||
rings = interior_rings(polygon);
|
||||
|
||||
for (typename detail::interior_iterator<Polygon const>::type
|
||||
it = boost::begin(rings);
|
||||
it != boost::end(rings);
|
||||
++it)
|
||||
auto const& rings = interior_rings(polygon);
|
||||
for (auto it = boost::begin(rings); it != boost::end(rings); ++it)
|
||||
{
|
||||
int const interior_code = point_in_geometry
|
||||
<
|
||||
@@ -254,14 +228,16 @@ struct point_in_geometry<Geometry, multi_point_tag>
|
||||
int apply(Point const& point, Geometry const& geometry, Strategy const& strategy)
|
||||
{
|
||||
typedef typename boost::range_value<Geometry>::type point_type;
|
||||
typedef typename boost::range_const_iterator<Geometry>::type iterator;
|
||||
for ( iterator it = boost::begin(geometry) ; it != boost::end(geometry) ; ++it )
|
||||
for (auto it = boost::begin(geometry); it != boost::end(geometry); ++it)
|
||||
{
|
||||
int pip = point_in_geometry<point_type>::apply(point, *it, strategy);
|
||||
|
||||
//BOOST_GEOMETRY_ASSERT(pip != 0);
|
||||
if ( pip > 0 ) // inside
|
||||
if (pip > 0)
|
||||
{
|
||||
// inside
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return -1; // outside
|
||||
@@ -278,14 +254,13 @@ struct point_in_geometry<Geometry, multi_linestring_tag>
|
||||
|
||||
typedef typename boost::range_value<Geometry>::type linestring_type;
|
||||
typedef typename boost::range_value<linestring_type>::type point_type;
|
||||
typedef typename boost::range_iterator<Geometry const>::type iterator;
|
||||
iterator it = boost::begin(geometry);
|
||||
for ( ; it != boost::end(geometry) ; ++it )
|
||||
auto it = boost::begin(geometry);
|
||||
for ( ; it != boost::end(geometry); ++it)
|
||||
{
|
||||
pip = point_in_geometry<linestring_type>::apply(point, *it, strategy);
|
||||
|
||||
// inside or on the boundary
|
||||
if ( pip >= 0 )
|
||||
if (pip >= 0)
|
||||
{
|
||||
++it;
|
||||
break;
|
||||
@@ -293,28 +268,34 @@ struct point_in_geometry<Geometry, multi_linestring_tag>
|
||||
}
|
||||
|
||||
// outside
|
||||
if ( pip < 0 )
|
||||
if (pip < 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
// TODO: the following isn't needed for covered_by()
|
||||
|
||||
unsigned boundaries = pip == 0 ? 1 : 0;
|
||||
|
||||
for ( ; it != boost::end(geometry) ; ++it )
|
||||
for (; it != boost::end(geometry); ++it)
|
||||
{
|
||||
if ( boost::size(*it) < 2 )
|
||||
if (boost::size(*it) < 2)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
point_type const& front = range::front(*it);
|
||||
point_type const& back = range::back(*it);
|
||||
|
||||
// is closed_ring - no boundary
|
||||
if ( detail::within::equals_point_point(front, back, strategy) )
|
||||
if (detail::equals::equals_point_point(front, back, strategy))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// is point on boundary
|
||||
if ( detail::within::equals_point_point(point, front, strategy)
|
||||
|| detail::within::equals_point_point(point, back, strategy) )
|
||||
if ( detail::equals::equals_point_point(point, front, strategy)
|
||||
|| detail::equals::equals_point_point(point, back, strategy) )
|
||||
{
|
||||
++boundaries;
|
||||
}
|
||||
@@ -335,14 +316,15 @@ struct point_in_geometry<Geometry, multi_polygon_tag>
|
||||
//int res = -1; // outside
|
||||
|
||||
typedef typename boost::range_value<Geometry>::type polygon_type;
|
||||
typedef typename boost::range_const_iterator<Geometry>::type iterator;
|
||||
for ( iterator it = boost::begin(geometry) ; it != boost::end(geometry) ; ++it )
|
||||
for (auto it = boost::begin(geometry); it != boost::end(geometry); ++it)
|
||||
{
|
||||
int pip = point_in_geometry<polygon_type>::apply(point, *it, strategy);
|
||||
|
||||
// inside or on the boundary
|
||||
if ( pip >= 0 )
|
||||
if (pip >= 0)
|
||||
{
|
||||
return pip;
|
||||
}
|
||||
|
||||
// For invalid multi-polygons
|
||||
//if ( 1 == pip ) // inside polygon
|
||||
@@ -371,41 +353,18 @@ inline int point_in_geometry(Point const& point, Geometry const& geometry, Strat
|
||||
return detail_dispatch::within::point_in_geometry<Geometry>::apply(point, geometry, strategy);
|
||||
}
|
||||
|
||||
template <typename Point, typename Geometry>
|
||||
inline int point_in_geometry(Point const& point, Geometry const& geometry)
|
||||
{
|
||||
typedef typename strategy::point_in_geometry::services::default_strategy
|
||||
<
|
||||
Point, Geometry
|
||||
>::type strategy_type;
|
||||
|
||||
return point_in_geometry(point, geometry, strategy_type());
|
||||
}
|
||||
|
||||
template <typename Point, typename Geometry, typename Strategy>
|
||||
inline bool within_point_geometry(Point const& point, Geometry const& geometry, Strategy const& strategy)
|
||||
{
|
||||
return point_in_geometry(point, geometry, strategy) > 0;
|
||||
}
|
||||
|
||||
template <typename Point, typename Geometry>
|
||||
inline bool within_point_geometry(Point const& point, Geometry const& geometry)
|
||||
{
|
||||
return point_in_geometry(point, geometry) > 0;
|
||||
}
|
||||
|
||||
template <typename Point, typename Geometry, typename Strategy>
|
||||
inline bool covered_by_point_geometry(Point const& point, Geometry const& geometry, Strategy const& strategy)
|
||||
{
|
||||
return point_in_geometry(point, geometry, strategy) >= 0;
|
||||
}
|
||||
|
||||
template <typename Point, typename Geometry>
|
||||
inline bool covered_by_point_geometry(Point const& point, Geometry const& geometry)
|
||||
{
|
||||
return point_in_geometry(point, geometry) >= 0;
|
||||
}
|
||||
|
||||
}} // namespace detail::within
|
||||
#endif // DOXYGEN_NO_DETAIL
|
||||
|
||||
|
||||
@@ -4,8 +4,9 @@
|
||||
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
|
||||
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
|
||||
|
||||
// This file was modified by Oracle on 2013.
|
||||
// Modifications copyright (c) 2013, Oracle and/or its affiliates.
|
||||
// This file was modified by Oracle on 2013-2023.
|
||||
// Modifications copyright (c) 2013-2023, Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
|
||||
|
||||
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
|
||||
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
|
||||
@@ -41,8 +42,10 @@ struct within_no_turns
|
||||
{
|
||||
typedef typename geometry::point_type<Geometry1>::type point1_type;
|
||||
point1_type p;
|
||||
if ( !geometry::point_on_border(p, geometry1) )
|
||||
if (! geometry::point_on_border(p, geometry1))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return detail::within::point_in_geometry(p, geometry2, strategy) >= 0;
|
||||
}
|
||||
@@ -57,25 +60,28 @@ struct within_no_turns<Geometry1, Geometry2, ring_tag, polygon_tag>
|
||||
typedef typename geometry::point_type<Geometry1>::type point1_type;
|
||||
typedef typename geometry::point_type<Geometry2>::type point2_type;
|
||||
point1_type p;
|
||||
if ( !geometry::point_on_border(p, geometry1) )
|
||||
if (! geometry::point_on_border(p, geometry1))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// check if one of ring points is outside the polygon
|
||||
if ( detail::within::point_in_geometry(p, geometry2, strategy) < 0 )
|
||||
if (detail::within::point_in_geometry(p, geometry2, strategy) < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// Now check if holes of G2 aren't inside G1
|
||||
typedef typename boost::range_const_iterator
|
||||
<
|
||||
typename geometry::interior_type<Geometry2>::type
|
||||
>::type iterator;
|
||||
for ( iterator it = boost::begin(geometry::interior_rings(geometry2)) ;
|
||||
it != boost::end(geometry::interior_rings(geometry2)) ;
|
||||
++it )
|
||||
auto const& rings2 = geometry::interior_rings(geometry2);
|
||||
for (auto it = boost::begin(rings2); it != boost::end(rings2); ++it)
|
||||
{
|
||||
point2_type p;
|
||||
if ( !geometry::point_on_border(p, *it) )
|
||||
if (! geometry::point_on_border(p, *it))
|
||||
{
|
||||
return false;
|
||||
if ( detail::within::point_in_geometry(p, geometry1, strategy) > 0 )
|
||||
}
|
||||
if (detail::within::point_in_geometry(p, geometry1, strategy) > 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -90,44 +96,42 @@ struct within_no_turns<Geometry1, Geometry2, polygon_tag, polygon_tag>
|
||||
typedef typename geometry::point_type<Geometry1>::type point1_type;
|
||||
typedef typename geometry::point_type<Geometry2>::type point2_type;
|
||||
point1_type p;
|
||||
if ( !geometry::point_on_border(p, geometry1) )
|
||||
if (! geometry::point_on_border(p, geometry1))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// check if one of ring points is outside the polygon
|
||||
if ( detail::within::point_in_geometry(p, geometry2, strategy) < 0 )
|
||||
if (detail::within::point_in_geometry(p, geometry2, strategy) < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// Now check if holes of G2 aren't inside G1
|
||||
typedef typename boost::range_const_iterator
|
||||
<
|
||||
typename geometry::interior_type<Geometry2>::type
|
||||
>::type iterator2;
|
||||
for ( iterator2 it = boost::begin(geometry::interior_rings(geometry2)) ;
|
||||
it != boost::end(geometry::interior_rings(geometry2)) ;
|
||||
++it )
|
||||
auto const& rings2 = geometry::interior_rings(geometry2);
|
||||
for (auto it2 = boost::begin(rings2); it2 != boost::end(rings2); ++it2)
|
||||
{
|
||||
point2_type p2;
|
||||
if ( !geometry::point_on_border(p2, *it) )
|
||||
if (! geometry::point_on_border(p2, *it2))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// if the hole of G2 is inside G1
|
||||
if ( detail::within::point_in_geometry(p2, geometry1, strategy) > 0 )
|
||||
if (detail::within::point_in_geometry(p2, geometry1, strategy) > 0)
|
||||
{
|
||||
// if it's also inside one of the G1 holes, it's ok
|
||||
bool ok = false;
|
||||
typedef typename boost::range_const_iterator
|
||||
<
|
||||
typename geometry::interior_type<Geometry1>::type
|
||||
>::type iterator1;
|
||||
for ( iterator1 it1 = boost::begin(geometry::interior_rings(geometry1)) ;
|
||||
it1 != boost::end(geometry::interior_rings(geometry1)) ;
|
||||
++it1 )
|
||||
auto const& rings1 = geometry::interior_rings(geometry1);
|
||||
for (auto it1 = boost::begin(rings1); it1 != boost::end(rings1); ++it1)
|
||||
{
|
||||
if ( detail::within::point_in_geometry(p2, *it1, strategy) < 0 )
|
||||
if (detail::within::point_in_geometry(p2, *it1, strategy) < 0)
|
||||
{
|
||||
ok = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( !ok )
|
||||
if (! ok)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@@ -157,11 +161,12 @@ struct within_no_turns_multi<Geometry1, Geometry2, Tag1, Tag2, true, false>
|
||||
{
|
||||
// All values of G1 must be inside G2
|
||||
typedef typename boost::range_value<Geometry1>::type subgeometry1;
|
||||
typedef typename boost::range_const_iterator<Geometry1>::type iterator;
|
||||
for ( iterator it = boost::begin(geometry1) ; it != boost::end(geometry1) ; ++it )
|
||||
for (auto it = boost::begin(geometry1) ; it != boost::end(geometry1) ; ++it )
|
||||
{
|
||||
if ( !within_no_turns<subgeometry1, Geometry2>::apply(*it, geometry2, strategy) )
|
||||
if (! within_no_turns<subgeometry1, Geometry2>::apply(*it, geometry2, strategy))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -175,11 +180,12 @@ struct within_no_turns_multi<Geometry1, Geometry2, Tag1, Tag2, false, true>
|
||||
{
|
||||
// G1 must be within at least one value of G2
|
||||
typedef typename boost::range_value<Geometry2>::type subgeometry2;
|
||||
typedef typename boost::range_const_iterator<Geometry2>::type iterator;
|
||||
for ( iterator it = boost::begin(geometry2) ; it != boost::end(geometry2) ; ++it )
|
||||
for (auto it = boost::begin(geometry2); it != boost::end(geometry2); ++it)
|
||||
{
|
||||
if ( within_no_turns<Geometry1, subgeometry2>::apply(geometry1, *it, strategy) )
|
||||
if (within_no_turns<Geometry1, subgeometry2>::apply(geometry1, *it, strategy))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -193,11 +199,12 @@ struct within_no_turns_multi<Geometry1, Geometry2, Tag1, Tag2, true, true>
|
||||
{
|
||||
// each value of G1 must be inside at least one value of G2
|
||||
typedef typename boost::range_value<Geometry1>::type subgeometry1;
|
||||
typedef typename boost::range_const_iterator<Geometry1>::type iterator;
|
||||
for ( iterator it = boost::begin(geometry1) ; it != boost::end(geometry1) ; ++it )
|
||||
for (auto it = boost::begin(geometry1) ; it != boost::end(geometry1) ; ++it)
|
||||
{
|
||||
if ( !within_no_turns_multi<subgeometry1, Geometry2>::apply(*it, geometry2, strategy) )
|
||||
if (! within_no_turns_multi<subgeometry1, Geometry2>::apply(*it, geometry2, strategy))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user