Chris@16: // Boost.Geometry Index Chris@16: // Chris@16: // n-dimensional bounds Chris@16: // Chris@101: // Copyright (c) 2011-2014 Adam Wulkiewicz, Lodz, Poland. Chris@16: // Chris@16: // Use, modification and distribution is subject to the Boost Software License, Chris@16: // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSE_1_0.txt) Chris@16: Chris@16: #ifndef BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_BOUNDS_HPP Chris@16: #define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_BOUNDS_HPP Chris@16: Chris@101: #include Chris@101: Chris@16: namespace boost { namespace geometry { namespace index { namespace detail { Chris@16: Chris@16: namespace dispatch { Chris@16: Chris@16: template ::type, Chris@16: typename TagBounds = typename geometry::tag::type> Chris@16: struct bounds Chris@16: { Chris@16: static inline void apply(Geometry const& g, Bounds & b) Chris@16: { Chris@16: geometry::convert(g, b); Chris@16: } Chris@16: }; Chris@16: Chris@101: template Chris@101: struct bounds Chris@101: { Chris@101: static inline void apply(Geometry const& g, Bounds & b) Chris@101: { Chris@101: index::detail::bounded_view v(g); Chris@101: geometry::convert(v, b); Chris@101: } Chris@101: }; Chris@101: Chris@16: } // namespace dispatch Chris@16: Chris@16: template Chris@16: inline void bounds(Geometry const& g, Bounds & b) Chris@16: { Chris@16: concept::check_concepts_and_equal_dimensions(); Chris@16: dispatch::bounds::apply(g, b); Chris@16: } Chris@16: Chris@101: namespace dispatch { Chris@101: Chris@101: template ::type> Chris@101: struct return_ref_or_bounds Chris@101: { Chris@101: typedef Geometry const& result_type; Chris@101: Chris@101: static inline result_type apply(Geometry const& g) Chris@101: { Chris@101: return g; Chris@101: } Chris@101: }; Chris@101: Chris@101: template Chris@101: struct return_ref_or_bounds Chris@101: { Chris@101: typedef typename point_type::type point_type; Chris@101: typedef geometry::model::box bounds_type; Chris@101: typedef index::detail::bounded_view result_type; Chris@101: Chris@101: static inline result_type apply(Geometry const& g) Chris@101: { Chris@101: return result_type(g); Chris@101: } Chris@101: }; Chris@101: Chris@101: } // namespace dispatch Chris@101: Chris@101: template Chris@101: inline Chris@101: typename dispatch::return_ref_or_bounds::result_type Chris@101: return_ref_or_bounds(Geometry const& g) Chris@101: { Chris@101: return dispatch::return_ref_or_bounds::apply(g); Chris@101: } Chris@101: Chris@16: }}}} // namespace boost::geometry::index::detail Chris@16: Chris@16: #endif // BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_BOUNDS_HPP