File indexing completed on 2025-01-18 09:35:06
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
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 }
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 }
0136
0137
0138
0139
0140
0141
0142
0143
0144
0145
0146
0147
0148
0149
0150
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
0160
0161
0162
0163
0164
0165
0166
0167
0168
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 }}
0177
0178 #endif