Back to home page

EIC code displayed by LXR

 
 

    


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

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 
0007 // This file was modified by Oracle on 2015-2021.
0008 // Modifications copyright (c) 2015-2021, Oracle and/or its affiliates.
0009 
0010 // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
0011 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
0012 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
0013 
0014 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
0015 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
0016 
0017 // Distributed under the Boost Software License, Version 1.0.
0018 // (See accompanying file LICENSE_1_0.txt or copy at
0019 // http://www.boost.org/LICENSE_1_0.txt)
0020 
0021 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_ENVELOPE_INTERFACE_HPP
0022 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_ENVELOPE_INTERFACE_HPP
0023 
0024 
0025 #include <boost/geometry/algorithms/dispatch/envelope.hpp>
0026 
0027 #include <boost/geometry/core/coordinate_system.hpp>
0028 #include <boost/geometry/core/tag.hpp>
0029 #include <boost/geometry/core/tags.hpp>
0030 #include <boost/geometry/core/visit.hpp>
0031 
0032 #include <boost/geometry/geometries/adapted/boost_variant.hpp> // For backward compatibility
0033 #include <boost/geometry/geometries/concepts/check.hpp>
0034 
0035 #include <boost/geometry/strategies/default_strategy.hpp>
0036 #include <boost/geometry/strategies/detail.hpp>
0037 #include <boost/geometry/strategies/envelope/services.hpp>
0038 
0039 #include <boost/geometry/util/select_most_precise.hpp>
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 envelope
0055 {
0056     template <typename Geometry, typename Box>
0057     static inline void apply(Geometry const& geometry,
0058                              Box& box,
0059                              Strategy const& strategy)
0060     {
0061         dispatch::envelope<Geometry>::apply(geometry, box, strategy);
0062     }
0063 };
0064 
0065 template <typename Strategy>
0066 struct envelope<Strategy, false>
0067 {
0068     template <typename Geometry, typename Box>
0069     static inline void apply(Geometry const& geometry,
0070                              Box& box,
0071                              Strategy const& strategy)
0072     {
0073         using strategies::envelope::services::strategy_converter;
0074         return dispatch::envelope
0075             <
0076                 Geometry
0077             >::apply(geometry, box, strategy_converter<Strategy>::get(strategy));
0078     }
0079 };
0080 
0081 template <>
0082 struct envelope<default_strategy, false>
0083 {
0084     template <typename Geometry, typename Box>
0085     static inline void apply(Geometry const& geometry,
0086                              Box& box,
0087                              default_strategy)
0088     {
0089         typedef typename strategies::envelope::services::default_strategy
0090             <
0091                 Geometry, Box
0092             >::type strategy_type;
0093 
0094         dispatch::envelope<Geometry>::apply(geometry, box, strategy_type());
0095     }
0096 };
0097 
0098 } // namespace resolve_strategy
0099 
0100 namespace resolve_dynamic
0101 {
0102 
0103 template <typename Geometry, typename Tag = typename tag<Geometry>::type>
0104 struct envelope
0105 {
0106     template <typename Box, typename Strategy>
0107     static inline void apply(Geometry const& geometry,
0108                              Box& box,
0109                              Strategy const& strategy)
0110     {
0111         concepts::check<Geometry const>();
0112         concepts::check<Box>();
0113 
0114         resolve_strategy::envelope<Strategy>::apply(geometry, box, strategy);
0115     }
0116 };
0117 
0118 
0119 template <typename Geometry>
0120 struct envelope<Geometry, dynamic_geometry_tag>
0121 {
0122     template <typename Box, typename Strategy>
0123     static inline void apply(Geometry const& geometry,
0124                              Box& box,
0125                              Strategy const& strategy)
0126     {
0127         traits::visit<Geometry>::apply([&](auto const& g)
0128         {
0129             envelope<util::remove_cref_t<decltype(g)>>::apply(g, box, strategy);
0130         }, geometry);
0131     }
0132 };
0133 
0134 } // namespace resolve_dynamic
0135 
0136 
0137 /*!
0138 \brief \brief_calc{envelope (with strategy)}
0139 \ingroup envelope
0140 \details \details_calc{envelope,\det_envelope}.
0141 \tparam Geometry \tparam_geometry
0142 \tparam Box \tparam_box
0143 \tparam Strategy \tparam_strategy{Envelope}
0144 \param geometry \param_geometry
0145 \param mbr \param_box \param_set{envelope}
0146 \param strategy \param_strategy{envelope}
0147 
0148 \qbk{distinguish,with strategy}
0149 \qbk{[include reference/algorithms/envelope.qbk]}
0150 \qbk{
0151 [heading Example]
0152 [envelope] [envelope_output]
0153 }
0154 */
0155 template<typename Geometry, typename Box, typename Strategy>
0156 inline void envelope(Geometry const& geometry, Box& mbr, Strategy const& strategy)
0157 {
0158     resolve_dynamic::envelope<Geometry>::apply(geometry, mbr, strategy);
0159 }
0160 
0161 /*!
0162 \brief \brief_calc{envelope}
0163 \ingroup envelope
0164 \details \details_calc{envelope,\det_envelope}.
0165 \tparam Geometry \tparam_geometry
0166 \tparam Box \tparam_box
0167 \param geometry \param_geometry
0168 \param mbr \param_box \param_set{envelope}
0169 
0170 \qbk{[include reference/algorithms/envelope.qbk]}
0171 \qbk{
0172 [heading Example]
0173 [envelope] [envelope_output]
0174 }
0175 */
0176 template<typename Geometry, typename Box>
0177 inline void envelope(Geometry const& geometry, Box& mbr)
0178 {
0179     resolve_dynamic::envelope<Geometry>::apply(geometry, mbr, default_strategy());
0180 }
0181 
0182 
0183 /*!
0184 \brief \brief_calc{envelope}
0185 \ingroup envelope
0186 \details \details_calc{return_envelope,\det_envelope}. \details_return{envelope}
0187 \tparam Box \tparam_box
0188 \tparam Geometry \tparam_geometry
0189 \tparam Strategy \tparam_strategy{Envelope}
0190 \param geometry \param_geometry
0191 \param strategy \param_strategy{envelope}
0192 \return \return_calc{envelope}
0193 
0194 \qbk{distinguish,with strategy}
0195 \qbk{[include reference/algorithms/envelope.qbk]}
0196 \qbk{
0197 [heading Example]
0198 [return_envelope] [return_envelope_output]
0199 }
0200 */
0201 template<typename Box, typename Geometry, typename Strategy>
0202 inline Box return_envelope(Geometry const& geometry, Strategy const& strategy)
0203 {
0204     Box mbr;
0205     resolve_dynamic::envelope<Geometry>::apply(geometry, mbr, strategy);
0206     return mbr;
0207 }
0208 
0209 /*!
0210 \brief \brief_calc{envelope}
0211 \ingroup envelope
0212 \details \details_calc{return_envelope,\det_envelope}. \details_return{envelope}
0213 \tparam Box \tparam_box
0214 \tparam Geometry \tparam_geometry
0215 \param geometry \param_geometry
0216 \return \return_calc{envelope}
0217 
0218 \qbk{[include reference/algorithms/envelope.qbk]}
0219 \qbk{
0220 [heading Example]
0221 [return_envelope] [return_envelope_output]
0222 }
0223 */
0224 template<typename Box, typename Geometry>
0225 inline Box return_envelope(Geometry const& geometry)
0226 {
0227     Box mbr;
0228     resolve_dynamic::envelope<Geometry>::apply(geometry, mbr, default_strategy());
0229     return mbr;
0230 }
0231 
0232 }} // namespace boost::geometry
0233 
0234 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_ENVELOPE_INTERFACE_HPP