annotate DEPENDENCIES/generic/include/boost/geometry/index/detail/algorithms/bounds.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents c530137014c0
children
rev   line source
Chris@16 1 // Boost.Geometry Index
Chris@16 2 //
Chris@16 3 // n-dimensional bounds
Chris@16 4 //
Chris@101 5 // Copyright (c) 2011-2014 Adam Wulkiewicz, Lodz, Poland.
Chris@16 6 //
Chris@16 7 // Use, modification and distribution is subject to the Boost Software License,
Chris@16 8 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
Chris@16 9 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 10
Chris@16 11 #ifndef BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_BOUNDS_HPP
Chris@16 12 #define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_BOUNDS_HPP
Chris@16 13
Chris@101 14 #include <boost/geometry/index/detail/bounded_view.hpp>
Chris@101 15
Chris@16 16 namespace boost { namespace geometry { namespace index { namespace detail {
Chris@16 17
Chris@16 18 namespace dispatch {
Chris@16 19
Chris@16 20 template <typename Geometry,
Chris@16 21 typename Bounds,
Chris@16 22 typename TagGeometry = typename geometry::tag<Geometry>::type,
Chris@16 23 typename TagBounds = typename geometry::tag<Bounds>::type>
Chris@16 24 struct bounds
Chris@16 25 {
Chris@16 26 static inline void apply(Geometry const& g, Bounds & b)
Chris@16 27 {
Chris@16 28 geometry::convert(g, b);
Chris@16 29 }
Chris@16 30 };
Chris@16 31
Chris@101 32 template <typename Geometry, typename Bounds>
Chris@101 33 struct bounds<Geometry, Bounds, segment_tag, box_tag>
Chris@101 34 {
Chris@101 35 static inline void apply(Geometry const& g, Bounds & b)
Chris@101 36 {
Chris@101 37 index::detail::bounded_view<Geometry, Bounds> v(g);
Chris@101 38 geometry::convert(v, b);
Chris@101 39 }
Chris@101 40 };
Chris@101 41
Chris@16 42 } // namespace dispatch
Chris@16 43
Chris@16 44 template <typename Geometry, typename Bounds>
Chris@16 45 inline void bounds(Geometry const& g, Bounds & b)
Chris@16 46 {
Chris@16 47 concept::check_concepts_and_equal_dimensions<Geometry const, Bounds>();
Chris@16 48 dispatch::bounds<Geometry, Bounds>::apply(g, b);
Chris@16 49 }
Chris@16 50
Chris@101 51 namespace dispatch {
Chris@101 52
Chris@101 53 template <typename Geometry,
Chris@101 54 typename TagGeometry = typename geometry::tag<Geometry>::type>
Chris@101 55 struct return_ref_or_bounds
Chris@101 56 {
Chris@101 57 typedef Geometry const& result_type;
Chris@101 58
Chris@101 59 static inline result_type apply(Geometry const& g)
Chris@101 60 {
Chris@101 61 return g;
Chris@101 62 }
Chris@101 63 };
Chris@101 64
Chris@101 65 template <typename Geometry>
Chris@101 66 struct return_ref_or_bounds<Geometry, segment_tag>
Chris@101 67 {
Chris@101 68 typedef typename point_type<Geometry>::type point_type;
Chris@101 69 typedef geometry::model::box<point_type> bounds_type;
Chris@101 70 typedef index::detail::bounded_view<Geometry, bounds_type> result_type;
Chris@101 71
Chris@101 72 static inline result_type apply(Geometry const& g)
Chris@101 73 {
Chris@101 74 return result_type(g);
Chris@101 75 }
Chris@101 76 };
Chris@101 77
Chris@101 78 } // namespace dispatch
Chris@101 79
Chris@101 80 template <typename Geometry>
Chris@101 81 inline
Chris@101 82 typename dispatch::return_ref_or_bounds<Geometry>::result_type
Chris@101 83 return_ref_or_bounds(Geometry const& g)
Chris@101 84 {
Chris@101 85 return dispatch::return_ref_or_bounds<Geometry>::apply(g);
Chris@101 86 }
Chris@101 87
Chris@16 88 }}}} // namespace boost::geometry::index::detail
Chris@16 89
Chris@16 90 #endif // BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_BOUNDS_HPP