Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Boost.Geometry (aka GGL, Generic Geometry Library)
0002 
0003 // Copyright (c) 1995, 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
0004 // Copyright (c) 1995 Maarten Hilferink, Amsterdam, the Netherlands
0005 
0006 // This file was modified by Oracle on 2015-2021.
0007 // Modifications copyright (c) 2015-2021, Oracle and/or its affiliates.
0008 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
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_STRATEGY_AGNOSTIC_SIMPLIFY_DOUGLAS_PEUCKER_HPP
0019 #define BOOST_GEOMETRY_STRATEGY_AGNOSTIC_SIMPLIFY_DOUGLAS_PEUCKER_HPP
0020 
0021 
0022 #include <boost/geometry/strategies/distance.hpp>
0023 
0024 
0025 namespace boost { namespace geometry
0026 {
0027 
0028 namespace strategy { namespace simplify
0029 {
0030 
0031 
0032 // NOTE: Left here for backward compatibility.
0033 
0034 
0035 /*!
0036 \brief Implements the simplify algorithm.
0037 \ingroup strategies
0038 \details The douglas_peucker strategy simplifies a linestring, ring or
0039     vector of points using the well-known Douglas-Peucker algorithm.
0040 \tparam Point the point type
0041 \tparam PointDistanceStrategy point-segment distance strategy to be used
0042 \note This strategy uses itself a point-segment-distance strategy which
0043     can be specified
0044 \author Barend and Maarten, 1995/1996
0045 \author Barend, revised for Generic Geometry Library, 2008
0046 */
0047 
0048 /*
0049 For the algorithm, see for example:
0050  - http://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm
0051  - http://www2.dcs.hull.ac.uk/CISRG/projects/Royal-Inst/demos/dp.html
0052 */
0053 template
0054 <
0055     typename Point,
0056     typename PointDistanceStrategy
0057 >
0058 class douglas_peucker
0059 {
0060 public :
0061 
0062     typedef PointDistanceStrategy distance_strategy_type;
0063 
0064     typedef typename strategy::distance::services::return_type
0065                      <
0066                          distance_strategy_type,
0067                          Point, Point
0068                      >::type distance_type;
0069 
0070     template <typename Range, typename OutputIterator>
0071     static inline OutputIterator apply(Range const& ,
0072                                        OutputIterator out,
0073                                        distance_type const& )
0074     {
0075         return out;
0076     }
0077 };
0078 
0079 }} // namespace strategy::simplify
0080 
0081 
0082 }} // namespace boost::geometry
0083 
0084 #endif // BOOST_GEOMETRY_STRATEGY_AGNOSTIC_SIMPLIFY_DOUGLAS_PEUCKER_HPP