rectangle_traits.hpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. Copyright 2008 Intel Corporation
  3. Use, modification and distribution are subject to the Boost Software License,
  4. Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  5. http://www.boost.org/LICENSE_1_0.txt).
  6. */
  7. #ifndef BOOST_POLYGON_RECTANGLE_TRAITS_HPP
  8. #define BOOST_POLYGON_RECTANGLE_TRAITS_HPP
  9. #include "isotropy.hpp"
  10. namespace boost { namespace polygon{
  11. template <typename T, typename enable = gtl_yes>
  12. struct rectangle_traits {};
  13. template <typename T>
  14. struct rectangle_traits<T, gtl_no> {};
  15. template <typename T>
  16. struct rectangle_traits<T, typename gtl_same_type<typename T::interval_type, typename T::interval_type>::type> {
  17. typedef typename T::coordinate_type coordinate_type;
  18. typedef typename T::interval_type interval_type;
  19. static inline interval_type get(const T& rectangle, orientation_2d orient) {
  20. return rectangle.get(orient); }
  21. };
  22. template <typename T>
  23. struct rectangle_mutable_traits {
  24. template <typename T2>
  25. static inline void set(T& rectangle, orientation_2d orient, const T2& interval) {
  26. rectangle.set(orient, interval); }
  27. template <typename T2, typename T3>
  28. static inline T construct(const T2& interval_horizontal,
  29. const T3& interval_vertical) {
  30. return T(interval_horizontal, interval_vertical); }
  31. };
  32. }
  33. }
  34. #endif