3 // Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
5 // Use, modification and distribution is subject to the Boost Software License,
6 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
9 #ifndef BOOST_GEOMETRY_STRATEGIES_AREA_RESULT_HPP
10 #define BOOST_GEOMETRY_STRATEGIES_AREA_RESULT_HPP
13 #include <boost/geometry/core/coordinate_type.hpp>
14 #include <boost/geometry/core/cs.hpp>
16 #include <boost/geometry/strategies/area.hpp>
17 #include <boost/geometry/strategies/default_strategy.hpp>
19 #include <boost/geometry/util/select_most_precise.hpp>
20 #include <boost/geometry/util/select_sequence_element.hpp>
23 #include <boost/mpl/if.hpp>
24 #include <boost/type_traits/is_same.hpp>
25 #include <boost/variant/variant_fwd.hpp>
28 namespace boost { namespace geometry
33 \brief Meta-function defining return type of area function
35 \note The return-type is defined by Geometry and Strategy
40 typename Strategy = default_strategy
43 : Strategy::template result_type<Geometry>
46 template <BOOST_VARIANT_ENUM_PARAMS(typename T), typename Strategy>
47 struct area_result<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>, Strategy>
48 : geometry::area_result
50 typename geometry::util::select_sequence_element
52 typename boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>::types
58 template <typename Geometry>
59 struct area_result<Geometry, default_strategy>
60 : geometry::area_result
63 typename geometry::strategy::area::services::default_strategy
65 typename cs_tag<Geometry>::type
70 #ifndef DOXYGEN_NO_DETAIL
71 namespace detail { namespace area
74 template <typename Curr, typename Next>
75 struct pred_more_precise_default_area_result
77 typedef typename geometry::area_result<Curr, default_strategy>::type curr_result_t;
78 typedef typename geometry::area_result<Next, default_strategy>::type next_result_t;
80 typedef typename boost::mpl::if_c
85 typename geometry::select_most_precise
96 }} // namespace detail::area
97 #endif //DOXYGEN_NO_DETAIL
99 template <BOOST_VARIANT_ENUM_PARAMS(typename T)>
100 struct area_result<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>, default_strategy>
101 : geometry::area_result
103 typename geometry::util::select_sequence_element
105 typename boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>::types,
106 geometry::detail::area::pred_more_precise_default_area_result
113 }} // namespace boost::geometry
116 #endif // BOOST_GEOMETRY_STRATEGIES_AREA_RESULT_HPP