• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2 // Unit Test
3 
4 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
5 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
6 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
7 
8 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
9 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
10 
11 // Use, modification and distribution is subject to the Boost Software License,
12 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
13 // http://www.boost.org/LICENSE_1_0.txt)
14 
15 
16 #include "function_requiring_a_point.hpp"
17 
18 #include <boost/geometry/core/cs.hpp>
19 
20 struct point
21 {
pointpoint22     point() : x(0), y(0) {} // initialize to suppress warnings
23     float x, y;
24 };
25 
26 
27 namespace boost { namespace geometry { namespace traits {
28 
29 template <> struct tag<point> { typedef point_tag type; };
30 template <> struct coordinate_type<point> { typedef float type; };
31 template <> struct coordinate_system<point> { typedef bg::cs::cartesian type; };
32 //template <> struct dimension<point> { enum { value = 2 }; };
33 
34 template <> struct access<point, 0>
35 {
getboost::geometry::traits::access36     static float get(point const& p) { return p.x; }
setboost::geometry::traits::access37     static void set(point& p, float value) { p.x = value; }
38 };
39 
40 template <> struct access<point, 1>
41 {
getboost::geometry::traits::access42     static float get(point const& p) { return p.y; }
setboost::geometry::traits::access43     static void set(point& p, float value) { p.y = value; }
44 };
45 
46 
47 }}} // namespace bg::traits
48 
49 
main()50 int main()
51 {
52     point p1;
53     const point p2;
54     test::function_requiring_a_point(p1, p2);
55     return 0;
56 }
57