1 | // Boost.Polygon library point_traits.hpp header file |
2 | |
3 | // Copyright (c) Intel Corporation 2008. |
4 | // Copyright (c) 2008-2012 Simonson Lucanus. |
5 | // Copyright (c) 2012-2012 Andrii Sydorchuk. |
6 | |
7 | // See http://www.boost.org for updates, documentation, and revision history. |
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_POLYGON_POINT_TRAITS_HPP |
13 | #define BOOST_POLYGON_POINT_TRAITS_HPP |
14 | |
15 | #include "isotropy.hpp" |
16 | |
17 | namespace boost { |
18 | namespace polygon { |
19 | |
20 | template <typename PointType> |
21 | struct point_traits { |
22 | typedef PointType point_type; |
23 | typedef typename point_type::coordinate_type coordinate_type; |
24 | |
25 | static coordinate_type get( |
26 | const point_type& point, orientation_2d orient) { |
27 | return point.get(orient); |
28 | } |
29 | }; |
30 | |
31 | template <typename PointType> |
32 | struct point_mutable_traits { |
33 | typedef PointType point_type; |
34 | typedef typename point_type::coordinate_type coordinate_type; |
35 | |
36 | static void set( |
37 | point_type& point, orientation_2d orient, coordinate_type value) { |
38 | point.set(orient, value); |
39 | } |
40 | |
41 | static point_type construct(coordinate_type x, coordinate_type y) { |
42 | return point_type(x, y); |
43 | } |
44 | }; |
45 | } // polygon |
46 | } // boost |
47 | |
48 | #endif // BOOST_POLYGON_POINT_TRAITS_HPP |
49 | |