// Boost.Geometry Index // // n-dimensional bounds // // Copyright (c) 2011-2014 Adam Wulkiewicz, Lodz, Poland. // // This file was modified by Oracle on 2019-2021. // Modifications copyright (c) 2019-2021 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_INDEX_DETAIL_ALGORITHMS_BOUNDS_HPP #define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_BOUNDS_HPP #include #include #include #include #include namespace boost { namespace geometry { namespace index { namespace detail { namespace dispatch { template ::type, typename TagBounds = typename geometry::tag::type> struct bounds { template static inline void apply(Geometry const& g, Bounds & b, Strategy const& ) { geometry::convert(g, b); } }; template struct bounds { template static inline void apply(Geometry const& g, Bounds & b, Strategy const& s) { index::detail::bounded_view v(g, s); geometry::convert(v, b); } }; } // namespace dispatch template inline void bounds(Geometry const& g, Bounds & b, Strategy const& s) { concepts::check_concepts_and_equal_dimensions(); dispatch::bounds::apply(g, b, s); } namespace dispatch { template ::type, typename TagGeometry = typename geometry::tag::type> struct expand { // STATIC ASSERT }; template struct expand { static inline void apply(Bounds & b, Geometry const& g) { geometry::expand(b, g); } template static inline void apply(Bounds & b, Geometry const& g, Strategy const& s) { geometry::expand(b, g, s); } }; template struct expand { static inline void apply(Bounds & b, Geometry const& g) { geometry::expand(b, g); } template static inline void apply(Bounds & b, Geometry const& g, Strategy const& s) { geometry::expand(b, g, s); } }; template struct expand { static inline void apply(Bounds & b, Geometry const& g) { geometry::expand(b, g); } template static inline void apply(Bounds & b, Geometry const& g, Strategy const& s) { geometry::expand(b, geometry::return_envelope(g, s), s); // requires additional strategy //geometry::expand(b, g, s); } }; } // namespace dispatch template inline void expand(Bounds & b, Geometry const& g, Strategy const& s) { dispatch::expand::apply(b, g, s); } template inline void expand(Bounds & b, Geometry const& g, default_strategy const& ) { dispatch::expand::apply(b, g); } namespace dispatch { template ::type, typename TagBounds = typename geometry::tag::type> struct covered_by_bounds {}; template struct covered_by_bounds { static inline bool apply(Geometry const& g, Bounds & b) { return geometry::covered_by(g, b); } template static inline bool apply(Geometry const& g, Bounds & b, Strategy const& s) { return geometry::covered_by(g, b, s); } }; template struct covered_by_bounds { static inline bool apply(Geometry const& g, Bounds & b) { return geometry::covered_by(g, b); } template static inline bool apply(Geometry const& g, Bounds & b, Strategy const& s) { return geometry::covered_by(g, b, s); } }; template struct covered_by_bounds { static inline bool apply(Geometry const& g, Bounds & b) { typedef typename point_type::type point_type; typedef geometry::model::box bounds_type; typedef index::detail::bounded_view view_type; return geometry::covered_by(view_type(g, default_strategy()), b); } template static inline bool apply(Geometry const& g, Bounds & b, Strategy const& strategy) { typedef typename point_type::type point_type; typedef geometry::model::box bounds_type; typedef index::detail::bounded_view view_type; return geometry::covered_by(view_type(g, strategy), b, strategy); } }; } // namespace dispatch template inline bool covered_by_bounds(Geometry const& g, Bounds & b, Strategy const& s) { return dispatch::covered_by_bounds::apply(g, b, s); } template inline bool covered_by_bounds(Geometry const& g, Bounds & b, default_strategy const& ) { return dispatch::covered_by_bounds::apply(g, b); } }}}} // namespace boost::geometry::index::detail #endif // BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_BOUNDS_HPP