// Boost.Geometry (aka GGL, Generic Geometry Library) // Copyright (c) 2012-2014 Barend Gehrels, Amsterdam, the Netherlands. // 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 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_accepted_intersections; bool has_discarded_intersections; inline buffered_ring() : has_accepted_intersections(false) , has_discarded_intersections(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 dispatch { template struct check { }; } #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 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; }; } 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; } }; } // 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_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