]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/geometry/strategies/concepts/simplify_concept.hpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / boost / geometry / strategies / concepts / simplify_concept.hpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2
3 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
4 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
5 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
6
7 // This file was modified by Oracle on 2020.
8 // Modifications copyright (c) 2020, Oracle and/or its affiliates.
9 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
10
11 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
12 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
13
14 // Use, modification and distribution is subject to the Boost Software License,
15 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
16 // http://www.boost.org/LICENSE_1_0.txt)
17
18 #ifndef BOOST_GEOMETRY_STRATEGIES_CONCEPTS_SIMPLIFY_CONCEPT_HPP
19 #define BOOST_GEOMETRY_STRATEGIES_CONCEPTS_SIMPLIFY_CONCEPT_HPP
20
21 #include <iterator>
22 #include <type_traits>
23 #include <vector>
24
25 #include <boost/concept_check.hpp>
26 #include <boost/core/ignore_unused.hpp>
27
28 #include <boost/geometry/geometries/point.hpp>
29 #include <boost/geometry/strategies/concepts/distance_concept.hpp>
30
31
32 namespace boost { namespace geometry { namespace concepts
33 {
34
35
36 /*!
37 \brief Checks strategy for simplify
38 \ingroup simplify
39 */
40 template <typename Strategy, typename Point>
41 struct SimplifyStrategy
42 {
43 #ifndef DOXYGEN_NO_CONCEPT_MEMBERS
44 private :
45
46 // 1) must define distance_strategy_type,
47 // defining point-segment distance strategy (to be checked)
48 typedef typename Strategy::distance_strategy_type ds_type;
49
50
51 struct checker
52 {
53 template <typename ApplyMethod>
54 static void apply(ApplyMethod)
55 {
56 namespace ft = boost::function_types;
57 typedef typename ft::parameter_types
58 <
59 ApplyMethod
60 >::type parameter_types;
61
62 typedef std::conditional_t
63 <
64 ft::is_member_function_pointer<ApplyMethod>::value,
65 std::integral_constant<int, 1>,
66 std::integral_constant<int, 0>
67 > base_index;
68
69 BOOST_CONCEPT_ASSERT
70 (
71 (concepts::PointSegmentDistanceStrategy<ds_type, Point, Point>)
72 );
73
74 Strategy *str = 0;
75 std::vector<Point> const* v1 = 0;
76 std::vector<Point> * v2 = 0;
77
78 // 2) must implement method apply with arguments
79 // - Range
80 // - OutputIterator
81 // - floating point value
82 str->apply(*v1, std::back_inserter(*v2), 1.0);
83
84 boost::ignore_unused<parameter_types, base_index>();
85 boost::ignore_unused(str);
86 }
87 };
88
89 public :
90 BOOST_CONCEPT_USAGE(SimplifyStrategy)
91 {
92 checker::apply(&ds_type::template apply<Point, Point>);
93 }
94 #endif
95 };
96
97
98
99 }}} // namespace boost::geometry::concepts
100
101 #endif // BOOST_GEOMETRY_STRATEGIES_CONCEPTS_SIMPLIFY_CONCEPT_HPP