Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Boost.Geometry
0002 
0003 // Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
0004 
0005 // This file was modified by Oracle on 2020-2023.
0006 // Modifications copyright (c) 2020-2023 Oracle and/or its affiliates.
0007 // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
0008 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
0009 
0010 // Use, modification and distribution is subject to the Boost Software License,
0011 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0012 // http://www.boost.org/LICENSE_1_0.txt)
0013 
0014 #ifndef BOOST_GEOMETRY_ALGORITHMS_AREA_RESULT_HPP
0015 #define BOOST_GEOMETRY_ALGORITHMS_AREA_RESULT_HPP
0016 
0017 
0018 #include <type_traits>
0019 
0020 #include <boost/geometry/algorithms/detail/select_geometry_type.hpp>
0021 
0022 #include <boost/geometry/core/coordinate_type.hpp>
0023 
0024 #include <boost/geometry/strategies/area/services.hpp>
0025 #include <boost/geometry/strategies/default_strategy.hpp>
0026 #include <boost/geometry/strategies/detail.hpp>
0027 
0028 #include <boost/geometry/util/select_most_precise.hpp>
0029 
0030 namespace boost { namespace geometry
0031 {
0032 
0033 
0034 #ifndef DOXYGEN_NO_DETAIL
0035 namespace detail { namespace area
0036 {
0037 
0038 
0039 template
0040 <
0041     typename Geometry,
0042     typename Strategy,
0043     bool IsUmbrella = strategies::detail::is_umbrella_strategy<Strategy>::value
0044 >
0045 struct area_result
0046 {
0047     typedef decltype(std::declval<Strategy>().area(std::declval<Geometry>())) strategy_type;
0048     typedef typename strategy_type::template result_type<Geometry>::type type;
0049 };
0050 
0051 template <typename Geometry, typename Strategy>
0052 struct area_result<Geometry, Strategy, false>
0053 {
0054     typedef typename Strategy::template result_type<Geometry>::type type;
0055 };
0056 
0057 
0058 template <typename Geometry>
0059 struct default_area_result
0060     : area_result
0061         <
0062             Geometry,
0063             typename geometry::strategies::area::services::default_strategy
0064                 <
0065                     Geometry
0066                 >::type
0067         >
0068 {};
0069 
0070 
0071 template <typename Curr, typename Next>
0072 struct more_precise_coordinate_type
0073     : std::is_same
0074         <
0075             typename geometry::coordinate_type<Curr>::type,
0076             typename geometry::select_most_precise
0077                 <
0078                     typename geometry::coordinate_type<Curr>::type,
0079                     typename geometry::coordinate_type<Next>::type
0080                 >::type
0081         >
0082 {};
0083 
0084 
0085 template <typename Curr, typename Next>
0086 struct more_precise_default_area_result
0087     : std::is_same
0088         <
0089             typename default_area_result<Curr>::type,
0090             typename geometry::select_most_precise
0091                 <
0092                     typename default_area_result<Curr>::type,
0093                     typename default_area_result<Next>::type
0094                 >::type
0095         >
0096 {};
0097 
0098 
0099 }} // namespace detail::area
0100 #endif //DOXYGEN_NO_DETAIL
0101 
0102 
0103 /*!
0104 \brief Meta-function defining return type of area function
0105 \ingroup area
0106 \note The return-type is defined by Geometry and Strategy
0107  */
0108 template
0109 <
0110     typename Geometry,
0111     typename Strategy = default_strategy
0112 >
0113 struct area_result
0114     : detail::area::area_result
0115         <
0116             typename detail::select_geometry_type
0117                 <
0118                     Geometry,
0119                     detail::area::more_precise_coordinate_type
0120                 >::type,
0121             Strategy
0122         >
0123 {};
0124 
0125 template <typename Geometry>
0126 struct area_result<Geometry, default_strategy>
0127     : detail::area::default_area_result
0128         <
0129             typename detail::select_geometry_type
0130                 <
0131                     Geometry,
0132                     detail::area::more_precise_default_area_result
0133                 >::type
0134         >
0135 {};
0136 
0137 
0138 }} // namespace boost::geometry
0139 
0140 
0141 #endif // BOOST_GEOMETRY_ALGORITHMS_AREA_RESULT_HPP