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