Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:36:44

0001 // Boost.Geometry (aka GGL, Generic Geometry Library)
0002 
0003 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
0004 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
0005 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
0006 
0007 // This file was modified by Oracle on 2020.
0008 // Modifications copyright (c) 2020, Oracle and/or its affiliates.
0009 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
0010 
0011 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
0012 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
0013 
0014 // Use, modification and distribution is subject to the Boost Software License,
0015 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0016 // http://www.boost.org/LICENSE_1_0.txt)
0017 
0018 #ifndef BOOST_GEOMETRY_STRATEGIES_CONCEPTS_SIMPLIFY_CONCEPT_HPP
0019 #define BOOST_GEOMETRY_STRATEGIES_CONCEPTS_SIMPLIFY_CONCEPT_HPP
0020 
0021 #include <iterator>
0022 #include <type_traits>
0023 #include <vector>
0024 
0025 #include <boost/concept_check.hpp>
0026 #include <boost/core/ignore_unused.hpp>
0027 
0028 #include <boost/geometry/geometries/point.hpp>
0029 #include <boost/geometry/strategies/concepts/distance_concept.hpp>
0030 
0031 
0032 namespace boost { namespace geometry { namespace concepts
0033 {
0034 
0035 
0036 /*!
0037     \brief Checks strategy for simplify
0038     \ingroup simplify
0039 */
0040 template <typename Strategy, typename Point>
0041 struct SimplifyStrategy
0042 {
0043 #ifndef DOXYGEN_NO_CONCEPT_MEMBERS
0044 private :
0045 
0046     // 1) must define distance_strategy_type,
0047     //    defining point-segment distance strategy (to be checked)
0048     typedef typename Strategy::distance_strategy_type ds_type;
0049 
0050 
0051     struct checker
0052     {
0053         template <typename ApplyMethod>
0054         static void apply(ApplyMethod)
0055         {
0056             namespace ft = boost::function_types;
0057             typedef typename ft::parameter_types
0058                 <
0059                     ApplyMethod
0060                 >::type parameter_types;
0061 
0062             typedef std::conditional_t
0063                 <
0064                     ft::is_member_function_pointer<ApplyMethod>::value,
0065                     std::integral_constant<int, 1>,
0066                     std::integral_constant<int, 0>
0067                 > base_index;
0068 
0069             BOOST_CONCEPT_ASSERT
0070                 (
0071                     (concepts::PointSegmentDistanceStrategy<ds_type, Point, Point>)
0072                 );
0073 
0074             Strategy *str = 0;
0075             std::vector<Point> const* v1 = 0;
0076             std::vector<Point> * v2 = 0;
0077 
0078             // 2) must implement method apply with arguments
0079             //    - Range
0080             //    - OutputIterator
0081             //    - floating point value
0082             str->apply(*v1, std::back_inserter(*v2), 1.0);
0083 
0084             boost::ignore_unused<parameter_types, base_index>();
0085             boost::ignore_unused(str);
0086         }
0087     };
0088 
0089 public :
0090     BOOST_CONCEPT_USAGE(SimplifyStrategy)
0091     {
0092         checker::apply(&ds_type::template apply<Point, Point>);
0093     }
0094 #endif
0095 };
0096 
0097 
0098 
0099 }}} // namespace boost::geometry::concepts
0100 
0101 #endif // BOOST_GEOMETRY_STRATEGIES_CONCEPTS_SIMPLIFY_CONCEPT_HPP