// Boost.Geometry (aka GGL, Generic Geometry Library) // Copyright (c) 2012-2015 Barend Gehrels, Amsterdam, the Netherlands. // This file was modified by Oracle on 2020. // Modifications copyright (c) 2020 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_BUFFER_BUFFERED_RING #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_BUFFER_BUFFERED_RING #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace boost { namespace geometry { #ifndef DOXYGEN_NO_DETAIL namespace detail { namespace buffer { struct buffered_ring_collection_tag : polygonal_tag, multi_tag {}; template struct buffered_ring : public Ring { bool has_concave; bool has_accepted_intersections; bool has_discarded_intersections; bool is_untouched_outside_original; inline buffered_ring() : has_concave(false) , has_accepted_intersections(false) , has_discarded_intersections(false) , is_untouched_outside_original(false) {} inline bool discarded() const { return has_discarded_intersections && ! has_accepted_intersections; } inline bool has_intersections() const { return has_discarded_intersections || has_accepted_intersections; } }; // This is a collection now special for overlay (needs vector of rings) template struct buffered_ring_collection : public std::vector { }; }} // namespace detail::buffer // Turn off concept checking (for now) namespace concepts { template struct concept_type { struct dummy {}; using type = dummy; }; } #endif // DOXYGEN_NO_DETAIL // Register the types namespace traits { template struct tag > { typedef ring_tag type; }; template struct point_order > { static const order_selector value = geometry::point_order::value; }; template struct closure > { static const closure_selector value = geometry::closure::value; }; template struct point_type > { typedef typename geometry::point_type::type type; }; template struct tag > { typedef geometry::detail::buffer::buffered_ring_collection_tag type; }; } // namespace traits namespace core_dispatch { template struct ring_type < detail::buffer::buffered_ring_collection_tag, detail::buffer::buffered_ring_collection > { typedef Ring type; }; // There is a specific tag, so this specialization cannot be placed in traits template struct point_order > > { static const order_selector value = core_dispatch::point_order::value; }; } template <> struct single_tag_of { typedef ring_tag type; }; namespace dispatch { template < typename MultiRing, bool Reverse, typename SegmentIdentifier, typename PointOut > struct copy_segment_point < detail::buffer::buffered_ring_collection_tag, MultiRing, Reverse, SegmentIdentifier, PointOut > : detail::copy_segments::copy_segment_point_multi < MultiRing, SegmentIdentifier, PointOut, detail::copy_segments::copy_segment_point_range < typename boost::range_value::type, Reverse, SegmentIdentifier, PointOut > > {}; template struct copy_segments < detail::buffer::buffered_ring_collection_tag, Reverse > : detail::copy_segments::copy_segments_multi < detail::copy_segments::copy_segments_ring > {}; template struct within < Point, MultiGeometry, point_tag, detail::buffer::buffered_ring_collection_tag > { template static inline bool apply(Point const& point, MultiGeometry const& multi, Strategy const& strategy) { return detail::within::point_in_geometry(point, multi, strategy) == 1; } }; template struct is_empty : detail::is_empty::multi_is_empty {}; template struct envelope : detail::envelope::envelope_multi_range < detail::envelope::envelope_range > {}; } // namespace dispatch namespace detail { namespace overlay { template<> struct get_ring { template static inline typename ring_type::type const& apply( ring_identifier const& id, MultiGeometry const& multi_ring) { BOOST_GEOMETRY_ASSERT ( id.multi_index >= 0 && id.multi_index < int(boost::size(multi_ring)) ); return get_ring::apply(id, multi_ring[id.multi_index]); } }; }} }} // namespace boost::geometry #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_BUFFER_BUFFERED_RING