• 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 namespace boost { namespace geometry { namespace traits {
27 
28 template <> struct tag<point> { typedef point_tag type; };
29 template <> struct coordinate_type<point> { typedef float type; };
30 template <> struct coordinate_system<point> { typedef bg::cs::cartesian type; };
31 template <> struct dimension<point> { enum { value = 2 }; };
32 
33 template <> struct access<point, 0>
34 {
setboost::geometry::traits::access35     static void set(point& p, float value) { p.x = value; }
36 };
37 
38 template <> struct access<point, 1>
39 {
setboost::geometry::traits::access40     static void set(point& p, float value) { p.y = value; }
41 };
42 
43 
44 }}} // namespace bg::traits
45 
main()46 int main()
47 {
48     point p1;
49     const point p2;
50     test::function_requiring_a_point(p1, p2);
51     return 0;
52 }
53