123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169 |
- #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_DISJOINT_AREAL_AREAL_HPP
- #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_DISJOINT_AREAL_AREAL_HPP
- #include <boost/geometry/core/point_type.hpp>
- #include <boost/geometry/algorithms/detail/covered_by/implementation.hpp>
- #include <boost/geometry/algorithms/detail/for_each_range.hpp>
- #include <boost/geometry/algorithms/detail/point_on_border.hpp>
- #include <boost/geometry/algorithms/detail/disjoint/linear_linear.hpp>
- #include <boost/geometry/algorithms/detail/disjoint/segment_box.hpp>
- #include <boost/geometry/geometries/helper_geometry.hpp>
- #include <boost/geometry/algorithms/for_each.hpp>
- namespace boost { namespace geometry
- {
- #ifndef DOXYGEN_NO_DETAIL
- namespace detail { namespace disjoint
- {
- template <typename Geometry1, typename Geometry2, typename Strategy>
- inline bool point_on_border_covered_by(Geometry1 const& geometry1,
- Geometry2 const& geometry2,
- Strategy const& strategy)
- {
- using point_type = typename geometry::point_type<Geometry1>::type;
- typename helper_geometry<point_type>::type pt;
- return geometry::point_on_border(pt, geometry1)
- && geometry::covered_by(pt, geometry2, strategy);
- }
- template <typename Geometry1, typename Geometry2, typename Strategy>
- inline bool rings_containing(Geometry1 const& geometry1,
- Geometry2 const& geometry2,
- Strategy const& strategy)
- {
- return geometry::detail::any_range_of(geometry2, [&](auto const& range)
- {
- return point_on_border_covered_by(range, geometry1, strategy);
- });
- }
- template <typename Geometry1, typename Geometry2>
- struct areal_areal
- {
-
- template <typename Strategy>
- static inline bool apply(Geometry1 const& geometry1,
- Geometry2 const& geometry2,
- Strategy const& strategy)
- {
- if ( ! disjoint_linear<Geometry1, Geometry2>::apply(geometry1, geometry2, strategy) )
- {
- return false;
- }
-
-
-
-
- if ( rings_containing(geometry1, geometry2, strategy)
- || rings_containing(geometry2, geometry1, strategy) )
- {
- return false;
- }
- return true;
- }
- };
- template <typename Areal, typename Box>
- struct areal_box
- {
-
- template <typename Strategy>
- static inline bool apply(Areal const& areal,
- Box const& box,
- Strategy const& strategy)
- {
- if (! geometry::all_segments_of(areal, [&](auto const& s)
- {
- return disjoint_segment_box::apply(s, box, strategy);
- }) )
- {
- return false;
- }
-
-
- if ( point_on_border_covered_by(box, areal, strategy) )
- {
- return false;
- }
- return true;
- }
- };
- }}
- #endif
- #ifndef DOXYGEN_NO_DISPATCH
- namespace dispatch
- {
- template <typename Areal1, typename Areal2>
- struct disjoint<Areal1, Areal2, 2, areal_tag, areal_tag, false>
- : detail::disjoint::areal_areal<Areal1, Areal2>
- {};
- template <typename Areal, typename Box>
- struct disjoint<Areal, Box, 2, areal_tag, box_tag, false>
- : detail::disjoint::areal_box<Areal, Box>
- {};
- }
- #endif
- }}
- #endif
|