~ubuntu-branches/debian/sid/boost1.49/sid

« back to all changes in this revision

Viewing changes to libs/geometry/test/geometries/concepts/check.cpp

  • Committer: Package Import Robot
  • Author(s): Steve M. Robbins
  • Date: 2012-02-26 00:31:44 UTC
  • Revision ID: package-import@ubuntu.com-20120226003144-eaytp12cbf6ubpms
Tags: upstream-1.49.0
ImportĀ upstreamĀ versionĀ 1.49.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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 <boost/geometry/core/cs.hpp>
 
17
#include <boost/geometry/geometries/concepts/check.hpp>
 
18
 
 
19
struct ro_point
 
20
{
 
21
    float x, y;
 
22
};
 
23
 
 
24
 
 
25
struct rw_point
 
26
{
 
27
    float x, y;
 
28
};
 
29
 
 
30
 
 
31
namespace boost { namespace geometry { namespace traits {
 
32
 
 
33
template <> struct tag<ro_point> { typedef point_tag type; };
 
34
template <> struct coordinate_type<ro_point> { typedef float type; };
 
35
template <> struct coordinate_system<ro_point> { typedef bg::cs::cartesian type; };
 
36
template <> struct dimension<ro_point> { enum { value = 2 }; };
 
37
 
 
38
template <> struct access<ro_point, 0>
 
39
{
 
40
    static float get(ro_point const& p) { return p.x; }
 
41
};
 
42
 
 
43
template <> struct access<ro_point, 1>
 
44
{
 
45
    static float get(ro_point const& p) { return p.y; }
 
46
};
 
47
 
 
48
 
 
49
 
 
50
 
 
51
template <> struct tag<rw_point> { typedef point_tag type; };
 
52
template <> struct coordinate_type<rw_point> { typedef float type; };
 
53
template <> struct coordinate_system<rw_point> { typedef bg::cs::cartesian type; };
 
54
template <> struct dimension<rw_point> { enum { value = 2 }; };
 
55
 
 
56
template <> struct access<rw_point, 0>
 
57
{
 
58
    static float get(rw_point const& p) { return p.x; }
 
59
    static void set(rw_point& p, float value) { p.x = value; }
 
60
};
 
61
 
 
62
template <> struct access<rw_point, 1>
 
63
{
 
64
    static float get(rw_point const& p) { return p.y; }
 
65
    static void set(rw_point& p, float value) { p.y = value; }
 
66
};
 
67
 
 
68
 
 
69
}}} // namespace bg::traits
 
70
 
 
71
 
 
72
int main()
 
73
{
 
74
    bg::concept::check<const ro_point>();
 
75
    bg::concept::check<rw_point>();
 
76
}