// Boost.Geometry (aka GGL, Generic Geometry Library) // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // (geolib/GGL), copyright (c) 1995-2010 Geodan, 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_FOR_EACH_RANGE_HPP #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_FOR_EACH_RANGE_HPP #include #include #include #include #include #include #include #include #include #include namespace boost { namespace geometry { #ifndef DOXYGEN_NO_DETAIL namespace detail { namespace for_each { template struct fe_range_range { static inline void apply(Range & range, Actor & actor) { actor.apply(range); } }; template struct fe_range_polygon { static inline void apply(Polygon & polygon, Actor & actor) { actor.apply(exterior_ring(polygon)); // TODO: If some flag says true, also do the inner rings. // for convex hull, it's not necessary } }; template struct fe_range_box { static inline void apply(Box & box, Actor & actor) { actor.apply(box_view::type>(box)); } }; template struct fe_range_multi { static inline void apply(Multi & multi, Actor & actor) { for ( typename boost::range_iterator::type it = boost::begin(multi); it != boost::end(multi); ++it) { SinglePolicy::apply(*it, actor); } } }; }} // namespace detail::for_each #endif // DOXYGEN_NO_DETAIL #ifndef DOXYGEN_NO_DISPATCH namespace dispatch { template < typename Geometry, typename Actor, typename Tag = typename tag::type > struct for_each_range { BOOST_MPL_ASSERT_MSG ( false, NOT_OR_NOT_YET_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE , (types) ); }; template struct for_each_range : detail::for_each::fe_range_range {}; template struct for_each_range : detail::for_each::fe_range_range {}; template struct for_each_range : detail::for_each::fe_range_polygon {}; template struct for_each_range : detail::for_each::fe_range_box {}; template struct for_each_range : detail::for_each::fe_range_range {}; template struct for_each_range : detail::for_each::fe_range_multi < Geometry, Actor, detail::for_each::fe_range_range < typename add_const_if_c < boost::is_const::value, typename boost::range_value::type >::type, Actor > > {}; template struct for_each_range : detail::for_each::fe_range_multi < Geometry, Actor, detail::for_each::fe_range_polygon < typename add_const_if_c < boost::is_const::value, typename boost::range_value::type >::type, Actor > > {}; } // namespace dispatch #endif // DOXYGEN_NO_DISPATCH namespace detail { template inline void for_each_range(Geometry const& geometry, Actor & actor) { dispatch::for_each_range < Geometry const, Actor >::apply(geometry, actor); } } }} // namespace boost::geometry #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_FOR_EACH_RANGE_HPP