3 // Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
5 // This file was modified by Oracle on 2020-2021.
6 // Modifications copyright (c) 2020-2021 Oracle and/or its affiliates.
7 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
9 // Use, modification and distribution is subject to the Boost Software License,
10 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
11 // http://www.boost.org/LICENSE_1_0.txt)
13 #ifndef BOOST_GEOMETRY_ALGORITHMS_AREA_RESULT_HPP
14 #define BOOST_GEOMETRY_ALGORITHMS_AREA_RESULT_HPP
17 #include <type_traits>
19 #include <boost/geometry/algorithms/detail/select_geometry_type.hpp>
21 #include <boost/geometry/core/coordinate_type.hpp>
22 #include <boost/geometry/core/cs.hpp>
23 #include <boost/geometry/core/geometry_types.hpp>
24 #include <boost/geometry/core/tag.hpp>
25 #include <boost/geometry/core/tags.hpp>
27 #include <boost/geometry/strategies/area/services.hpp>
28 #include <boost/geometry/strategies/default_strategy.hpp>
29 #include <boost/geometry/strategies/detail.hpp>
31 #include <boost/geometry/util/select_most_precise.hpp>
32 #include <boost/geometry/util/sequence.hpp>
33 #include <boost/geometry/util/type_traits.hpp>
35 namespace boost { namespace geometry
39 #ifndef DOXYGEN_NO_DETAIL
40 namespace detail { namespace area
48 bool IsUmbrella = strategies::detail::is_umbrella_strategy<Strategy>::value
52 typedef decltype(std::declval<Strategy>().area(std::declval<Geometry>())) strategy_type;
53 typedef typename strategy_type::template result_type<Geometry>::type type;
56 template <typename Geometry, typename Strategy>
57 struct area_result<Geometry, Strategy, false>
59 typedef typename Strategy::template result_type<Geometry>::type type;
63 template <typename Geometry>
64 struct default_area_result
68 typename geometry::strategies::area::services::default_strategy
76 template <typename Curr, typename Next>
77 struct more_precise_coordinate_type
80 typename geometry::coordinate_type<Curr>::type,
81 typename geometry::select_most_precise
83 typename geometry::coordinate_type<Curr>::type,
84 typename geometry::coordinate_type<Next>::type
90 template <typename Curr, typename Next>
91 struct more_precise_default_area_result
94 typename default_area_result<Curr>::type,
95 typename geometry::select_most_precise
97 typename default_area_result<Curr>::type,
98 typename default_area_result<Next>::type
104 }} // namespace detail::area
105 #endif //DOXYGEN_NO_DETAIL
109 \brief Meta-function defining return type of area function
111 \note The return-type is defined by Geometry and Strategy
116 typename Strategy = default_strategy
119 : detail::area::area_result
121 typename detail::select_geometry_type
124 detail::area::more_precise_coordinate_type
130 template <typename Geometry>
131 struct area_result<Geometry, default_strategy>
132 : detail::area::default_area_result
134 typename detail::select_geometry_type
137 detail::area::more_precise_default_area_result
143 }} // namespace boost::geometry
146 #endif // BOOST_GEOMETRY_ALGORITHMS_AREA_RESULT_HPP