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