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_SIMPLIFY_CONCEPT_HPP
|
Chris@16
|
15 #define BOOST_GEOMETRY_STRATEGIES_CONCEPTS_SIMPLIFY_CONCEPT_HPP
|
Chris@16
|
16
|
Chris@16
|
17 #include <vector>
|
Chris@16
|
18 #include <iterator>
|
Chris@16
|
19
|
Chris@16
|
20 #include <boost/concept_check.hpp>
|
Chris@101
|
21 #include <boost/core/ignore_unused.hpp>
|
Chris@16
|
22
|
Chris@16
|
23 #include <boost/geometry/geometries/point.hpp>
|
Chris@16
|
24 #include <boost/geometry/strategies/concepts/distance_concept.hpp>
|
Chris@16
|
25
|
Chris@16
|
26
|
Chris@16
|
27 namespace boost { namespace geometry { namespace concept
|
Chris@16
|
28 {
|
Chris@16
|
29
|
Chris@16
|
30
|
Chris@16
|
31 /*!
|
Chris@16
|
32 \brief Checks strategy for simplify
|
Chris@16
|
33 \ingroup simplify
|
Chris@16
|
34 */
|
Chris@16
|
35 template <typename Strategy, typename Point>
|
Chris@16
|
36 struct SimplifyStrategy
|
Chris@16
|
37 {
|
Chris@16
|
38 #ifndef DOXYGEN_NO_CONCEPT_MEMBERS
|
Chris@16
|
39 private :
|
Chris@16
|
40
|
Chris@16
|
41 // 1) must define distance_strategy_type,
|
Chris@16
|
42 // defining point-segment distance strategy (to be checked)
|
Chris@16
|
43 typedef typename Strategy::distance_strategy_type ds_type;
|
Chris@16
|
44
|
Chris@16
|
45
|
Chris@16
|
46 struct checker
|
Chris@16
|
47 {
|
Chris@16
|
48 template <typename ApplyMethod>
|
Chris@16
|
49 static void apply(ApplyMethod)
|
Chris@16
|
50 {
|
Chris@16
|
51 namespace ft = boost::function_types;
|
Chris@16
|
52 typedef typename ft::parameter_types
|
Chris@16
|
53 <
|
Chris@16
|
54 ApplyMethod
|
Chris@16
|
55 >::type parameter_types;
|
Chris@16
|
56
|
Chris@16
|
57 typedef typename boost::mpl::if_
|
Chris@16
|
58 <
|
Chris@16
|
59 ft::is_member_function_pointer<ApplyMethod>,
|
Chris@16
|
60 boost::mpl::int_<1>,
|
Chris@16
|
61 boost::mpl::int_<0>
|
Chris@16
|
62 >::type base_index;
|
Chris@16
|
63
|
Chris@16
|
64 BOOST_CONCEPT_ASSERT
|
Chris@16
|
65 (
|
Chris@16
|
66 (concept::PointSegmentDistanceStrategy<ds_type, Point, Point>)
|
Chris@16
|
67 );
|
Chris@16
|
68
|
Chris@16
|
69 Strategy *str = 0;
|
Chris@16
|
70 std::vector<Point> const* v1 = 0;
|
Chris@16
|
71 std::vector<Point> * v2 = 0;
|
Chris@16
|
72
|
Chris@16
|
73 // 2) must implement method apply with arguments
|
Chris@16
|
74 // - Range
|
Chris@16
|
75 // - OutputIterator
|
Chris@16
|
76 // - floating point value
|
Chris@16
|
77 str->apply(*v1, std::back_inserter(*v2), 1.0);
|
Chris@16
|
78
|
Chris@101
|
79 boost::ignore_unused<parameter_types, base_index>();
|
Chris@101
|
80 boost::ignore_unused(str);
|
Chris@16
|
81 }
|
Chris@16
|
82 };
|
Chris@16
|
83
|
Chris@16
|
84 public :
|
Chris@16
|
85 BOOST_CONCEPT_USAGE(SimplifyStrategy)
|
Chris@16
|
86 {
|
Chris@16
|
87 checker::apply(&ds_type::template apply<Point, Point>);
|
Chris@16
|
88 }
|
Chris@16
|
89 #endif
|
Chris@16
|
90 };
|
Chris@16
|
91
|
Chris@16
|
92
|
Chris@16
|
93
|
Chris@16
|
94 }}} // namespace boost::geometry::concept
|
Chris@16
|
95
|
Chris@16
|
96 #endif // BOOST_GEOMETRY_STRATEGIES_CONCEPTS_SIMPLIFY_CONCEPT_HPP
|