PageRenderTime 13ms CodeModel.GetById 8ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/Src/Dependencies/Boost/libs/geometry/test/point_concept/point_without_coordinate_type.cpp

http://hadesmem.googlecode.com/
C++ | 53 lines | 28 code | 14 blank | 11 comment | 0 complexity | a608bcc8fc4d0a8e68f3ff8adcd77c69 MD5 | raw file
 1// Boost.Geometry (aka GGL, Generic Geometry Library)
 2// Unit Test
 3
 4// Copyright (c) 2007-2011 Barend Gehrels, Amsterdam, the Netherlands.
 5// Copyright (c) 2008-2011 Bruno Lalande, Paris, France.
 6// Copyright (c) 2009-2011 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
20struct point
21{
22    float x, y;
23};
24
25namespace boost { namespace geometry { namespace traits {
26
27template <> struct tag<point> { typedef point_tag type; };
28//template <> struct coordinate_type<point> { typedef float type; };
29template <> struct coordinate_system<point> { typedef bg::cs::cartesian type; };
30template <> struct dimension<point> { enum { value = 2 }; };
31
32template <> struct access<point, 0>
33{
34    static float get(point const& p) { return p.x; }
35    static void set(point& p, float value) { p.x = value; }
36};
37
38template <> struct access<point, 1>
39{
40    static float get(point const& p) { return p.y; }
41    static void set(point& p, float value) { p.y = value; }
42};
43
44
45}}} // namespace bg::traits
46
47int main()
48{
49    point p1;
50    const point p2;
51    test::function_requiring_a_point(p1, p2);
52    return 0;
53}