// Boost.Geometry (aka GGL, Generic Geometry Library) // Copyright (c) 2007-2011 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2011 Bruno Lalande, Paris, France. // Copyright (c) 2009-2011 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_SECTIONS_RANGE_BY_SECTION_HPP #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_SECTIONS_RANGE_BY_SECTION_HPP #include #include #include #include #include #include namespace boost { namespace geometry { #ifndef DOXYGEN_NO_DETAIL namespace detail { namespace section { template struct full_section_range { static inline Range const& apply(Range const& range, Section const& section) { return range; } }; template struct full_section_polygon { static inline typename ring_return_type::type apply(Polygon const& polygon, Section const& section) { return section.ring_id.ring_index < 0 ? geometry::exterior_ring(polygon) : geometry::interior_rings(polygon)[section.ring_id.ring_index]; } }; }} // namespace detail::section #endif #ifndef DOXYGEN_NO_DISPATCH namespace dispatch { template < typename Tag, typename Geometry, typename Section > struct range_by_section { BOOST_MPL_ASSERT_MSG ( false, NOT_OR_NOT_YET_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE , (types) ); }; template struct range_by_section : detail::section::full_section_range {}; template struct range_by_section : detail::section::full_section_range {}; template struct range_by_section : detail::section::full_section_polygon {}; } // namespace dispatch #endif /*! \brief Get full ring (exterior, one of interiors, one from multi) indicated by the specified section \ingroup sectionalize \tparam Geometry type \tparam Section type of section to get from \param geometry geometry to take section of \param section structure with section */ template inline typename ring_return_type::type range_by_section(Geometry const& geometry, Section const& section) { concept::check(); return dispatch::range_by_section < typename tag::type, Geometry, Section >::apply(geometry, section); } }} // namespace boost::geometry #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_SECTIONS_RANGE_BY_SECTION_HPP