Imported Upstream version 1.72.0
[platform/upstream/boost.git] / boost / geometry / policies / robustness / segment_ratio_type.hpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2
3 // Copyright (c) 2013 Barend Gehrels, Amsterdam, the Netherlands.
4 // Copyright (c) 2013 Bruno Lalande, Paris, France.
5 // Copyright (c) 2013 Mateusz Loskot, London, UK.
6 // Copyright (c) 2013 Adam Wulkiewicz, Lodz, Poland.
7
8 // Use, modification and distribution is subject to the Boost Software License,
9 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
10 // http://www.boost.org/LICENSE_1_0.txt)
11
12 #ifndef BOOST_GEOMETRY_POLICIES_ROBUSTNESS_SEGMENT_RATIO_TYPE_HPP
13 #define BOOST_GEOMETRY_POLICIES_ROBUSTNESS_SEGMENT_RATIO_TYPE_HPP
14
15 #include <boost/geometry/core/coordinate_type.hpp>
16 #include <boost/geometry/policies/robustness/rescale_policy_tags.hpp>
17
18 #include <boost/config.hpp>
19 #include <boost/mpl/if.hpp>
20
21 namespace boost { namespace geometry { namespace detail
22 {
23
24 // Temporary meta-function to access segment-ratio for a policy
25 template <typename Point, typename Policy>
26 struct segment_ratio_type
27 {
28     // Type in segment ratio is either the coordinate type, or for
29     // deprecated robust point types it is a long_long type
30     typedef typename boost::mpl::if_c
31     <
32         boost::is_same
33         <
34             typename rescale_policy_type<Policy>::type,
35             no_rescale_policy_tag
36         >::value,
37         typename geometry::coordinate_type<Point>::type,
38         boost::long_long_type
39     >::type coordinate_type;
40
41     // Define segment ratio based on the coordinate type
42     typedef geometry::segment_ratio<coordinate_type> type;
43 };
44
45
46 }}} // namespace boost::geometry::deatil
47
48
49 #endif // BOOST_GEOMETRY_POLICIES_ROBUSTNESS_SEGMENT_RATIO_TYPE_HPP