segment_ratio_type.hpp 1.6 KB

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