Chris@16
|
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
|
Chris@16
|
2
|
Chris@16
|
3 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
|
Chris@16
|
4 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
|
Chris@16
|
5 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
|
Chris@16
|
6
|
Chris@16
|
7 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
|
Chris@16
|
8 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
|
Chris@16
|
9
|
Chris@16
|
10 // Use, modification and distribution is subject to the Boost Software License,
|
Chris@16
|
11 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
12 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
13
|
Chris@16
|
14 #ifndef BOOST_GEOMETRY_STRATEGIES_CONCEPTS_CENTROID_CONCEPT_HPP
|
Chris@16
|
15 #define BOOST_GEOMETRY_STRATEGIES_CONCEPTS_CENTROID_CONCEPT_HPP
|
Chris@16
|
16
|
Chris@16
|
17
|
Chris@16
|
18
|
Chris@16
|
19 #include <boost/concept_check.hpp>
|
Chris@16
|
20
|
Chris@16
|
21
|
Chris@16
|
22 namespace boost { namespace geometry { namespace concept
|
Chris@16
|
23 {
|
Chris@16
|
24
|
Chris@16
|
25
|
Chris@16
|
26 /*!
|
Chris@16
|
27 \brief Checks strategy for centroid
|
Chris@16
|
28 \ingroup centroid
|
Chris@16
|
29 */
|
Chris@16
|
30 template <typename Strategy>
|
Chris@16
|
31 class CentroidStrategy
|
Chris@16
|
32 {
|
Chris@16
|
33 #ifndef DOXYGEN_NO_CONCEPT_MEMBERS
|
Chris@16
|
34
|
Chris@16
|
35 // 1) must define state_type,
|
Chris@16
|
36 typedef typename Strategy::state_type state_type;
|
Chris@16
|
37
|
Chris@16
|
38 // 2) must define point_type,
|
Chris@16
|
39 typedef typename Strategy::point_type point_type;
|
Chris@16
|
40
|
Chris@16
|
41 // 3) must define point_type, of polygon (segments)
|
Chris@16
|
42 typedef typename Strategy::segment_point_type spoint_type;
|
Chris@16
|
43
|
Chris@16
|
44 struct check_methods
|
Chris@16
|
45 {
|
Chris@16
|
46 static void apply()
|
Chris@16
|
47 {
|
Chris@16
|
48 Strategy *str = 0;
|
Chris@16
|
49 state_type *st = 0;
|
Chris@16
|
50
|
Chris@16
|
51 // 4) must implement a static method apply,
|
Chris@16
|
52 // getting two segment-points
|
Chris@16
|
53 spoint_type const* sp = 0;
|
Chris@16
|
54 str->apply(*sp, *sp, *st);
|
Chris@16
|
55
|
Chris@16
|
56 // 5) must implement a static method result
|
Chris@16
|
57 // getting the centroid
|
Chris@16
|
58 point_type *c = 0;
|
Chris@16
|
59 bool r = str->result(*st, *c);
|
Chris@16
|
60
|
Chris@16
|
61 boost::ignore_unused_variable_warning(str);
|
Chris@16
|
62 boost::ignore_unused_variable_warning(r);
|
Chris@16
|
63 }
|
Chris@16
|
64 };
|
Chris@16
|
65
|
Chris@16
|
66 public :
|
Chris@16
|
67 BOOST_CONCEPT_USAGE(CentroidStrategy)
|
Chris@16
|
68 {
|
Chris@16
|
69 check_methods::apply();
|
Chris@16
|
70 }
|
Chris@16
|
71 #endif
|
Chris@16
|
72 };
|
Chris@16
|
73
|
Chris@16
|
74
|
Chris@16
|
75 }}} // namespace boost::geometry::concept
|
Chris@16
|
76
|
Chris@16
|
77
|
Chris@16
|
78 #endif // BOOST_GEOMETRY_STRATEGIES_CONCEPTS_CENTROID_CONCEPT_HPP
|