Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:35:06

0001 // Boost.Geometry (aka GGL, Generic Geometry Library)
0002 
0003 // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
0004 // Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
0005 // Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
0006 // Copyright (c) 2014-2015 Samuel Debionne, Grenoble, France.
0007 
0008 // This file was modified by Oracle on 2015-2021.
0009 // Modifications copyright (c) 2015-2021, Oracle and/or its affiliates.
0010 
0011 // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
0012 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
0013 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
0014 
0015 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
0016 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
0017 
0018 // Distributed under the Boost Software License, Version 1.0.
0019 // (See accompanying file LICENSE_1_0.txt or copy at
0020 // http://www.boost.org/LICENSE_1_0.txt)
0021 
0022 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_EXPAND_INTERFACE_HPP
0023 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_EXPAND_INTERFACE_HPP
0024 
0025 
0026 #include <boost/geometry/algorithms/dispatch/expand.hpp>
0027 
0028 #include <boost/geometry/core/coordinate_system.hpp>
0029 #include <boost/geometry/core/tag.hpp>
0030 #include <boost/geometry/core/tags.hpp>
0031 #include <boost/geometry/core/visit.hpp>
0032 
0033 #include <boost/geometry/geometries/adapted/boost_variant.hpp> // For backward compatibility
0034 #include <boost/geometry/geometries/concepts/check.hpp>
0035 
0036 #include <boost/geometry/strategies/default_strategy.hpp>
0037 #include <boost/geometry/strategies/detail.hpp>
0038 #include <boost/geometry/strategies/expand/services.hpp>
0039 
0040 #include <boost/geometry/util/type_traits_std.hpp>
0041 
0042 
0043 namespace boost { namespace geometry
0044 {
0045 
0046 namespace resolve_strategy
0047 {
0048 
0049 template
0050 <
0051     typename Strategy,
0052     bool IsUmbrella = strategies::detail::is_umbrella_strategy<Strategy>::value
0053 >
0054 struct expand
0055 {
0056     template <typename Box, typename Geometry>
0057     static inline void apply(Box& box,
0058                              Geometry const& geometry,
0059                              Strategy const& strategy)
0060     {
0061         dispatch::expand<Box, Geometry>::apply(box, geometry, strategy);
0062     }
0063 };
0064 
0065 template <typename Strategy>
0066 struct expand<Strategy, false>
0067 {
0068     template <typename Box, typename Geometry>
0069     static inline void apply(Box& box,
0070                              Geometry const& geometry,
0071                              Strategy const& strategy)
0072     {
0073         using strategies::expand::services::strategy_converter;
0074         dispatch::expand
0075             <
0076                 Box, Geometry
0077             >::apply(box, geometry, strategy_converter<Strategy>::get(strategy));
0078     }
0079 };
0080 
0081 template <>
0082 struct expand<default_strategy, false>
0083 {
0084     template <typename Box, typename Geometry>
0085     static inline void apply(Box& box,
0086                              Geometry const& geometry,
0087                              default_strategy)
0088     {
0089         typedef typename strategies::expand::services::default_strategy
0090             <
0091                 Box, Geometry
0092             >::type strategy_type;
0093 
0094         dispatch::expand<Box, Geometry>::apply(box, geometry, strategy_type());
0095     }
0096 };
0097 
0098 } //namespace resolve_strategy
0099 
0100 
0101 namespace resolve_dynamic
0102 {
0103 
0104 template <typename Geometry, typename Tag = typename tag<Geometry>::type>
0105 struct expand
0106 {
0107     template <typename Box, typename Strategy>
0108     static inline void apply(Box& box,
0109                              Geometry const& geometry,
0110                              Strategy const& strategy)
0111     {
0112         concepts::check<Box>();
0113         concepts::check<Geometry const>();
0114         concepts::check_concepts_and_equal_dimensions<Box, Geometry const>();
0115 
0116         resolve_strategy::expand<Strategy>::apply(box, geometry, strategy);
0117     }
0118 };
0119 
0120 template <typename Geometry>
0121 struct expand<Geometry, dynamic_geometry_tag>
0122 {
0123     template <class Box, typename Strategy>
0124     static inline void apply(Box& box,
0125                              Geometry const& geometry,
0126                              Strategy const& strategy)
0127     {
0128         traits::visit<Geometry>::apply([&](auto const& g)
0129         {
0130             expand<util::remove_cref_t<decltype(g)>>::apply(box, g, strategy);
0131         }, geometry);
0132     }
0133 };
0134 
0135 } // namespace resolve_dynamic
0136 
0137 
0138 /*!
0139 \brief Expands (with strategy)
0140 \ingroup expand
0141 \tparam Box type of the box
0142 \tparam Geometry \tparam_geometry
0143 \tparam Strategy \tparam_strategy{expand}
0144 \param box box to be expanded using another geometry, mutable
0145 \param geometry \param_geometry geometry which envelope (bounding box)
0146 \param strategy \param_strategy{expand}
0147 will be added to the box
0148 
0149 \qbk{distinguish,with strategy}
0150 \qbk{[include reference/algorithms/expand.qbk]}
0151  */
0152 template <typename Box, typename Geometry, typename Strategy>
0153 inline void expand(Box& box, Geometry const& geometry, Strategy const& strategy)
0154 {
0155     resolve_dynamic::expand<Geometry>::apply(box, geometry, strategy);
0156 }
0157 
0158 /*!
0159 \brief Expands a box using the bounding box (envelope) of another geometry
0160 (box, point)
0161 \ingroup expand
0162 \tparam Box type of the box
0163 \tparam Geometry \tparam_geometry
0164 \param box box to be expanded using another geometry, mutable
0165 \param geometry \param_geometry geometry which envelope (bounding box) will be
0166 added to the box
0167 
0168 \qbk{[include reference/algorithms/expand.qbk]}
0169  */
0170 template <typename Box, typename Geometry>
0171 inline void expand(Box& box, Geometry const& geometry)
0172 {
0173     resolve_dynamic::expand<Geometry>::apply(box, geometry, default_strategy());
0174 }
0175 
0176 }} // namespace boost::geometry
0177 
0178 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_EXPAND_INTERFACE_HPP