]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // Boost.Geometry (aka GGL, Generic Geometry Library) |
2 | ||
3 | // Copyright (c) 1995, 2007-2015 Barend Gehrels, Amsterdam, the Netherlands. | |
4 | // Copyright (c) 1995 Maarten Hilferink, Amsterdam, the Netherlands | |
5 | ||
1e59de90 TL |
6 | // This file was modified by Oracle on 2015-2021. |
7 | // Modifications copyright (c) 2015-2021, Oracle and/or its affiliates. | |
7c673cae | 8 | // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle |
20effc67 | 9 | // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle |
7c673cae FG |
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_STRATEGY_AGNOSTIC_SIMPLIFY_DOUGLAS_PEUCKER_HPP | |
19 | #define BOOST_GEOMETRY_STRATEGY_AGNOSTIC_SIMPLIFY_DOUGLAS_PEUCKER_HPP | |
20 | ||
21 | ||
7c673cae FG |
22 | #include <boost/geometry/strategies/distance.hpp> |
23 | ||
24 | ||
7c673cae FG |
25 | namespace boost { namespace geometry |
26 | { | |
27 | ||
28 | namespace strategy { namespace simplify | |
29 | { | |
30 | ||
31 | ||
1e59de90 | 32 | // NOTE: Left here for backward compatibility. |
7c673cae FG |
33 | |
34 | ||
35 | /*! | |
36 | \brief Implements the simplify algorithm. | |
37 | \ingroup strategies | |
38 | \details The douglas_peucker strategy simplifies a linestring, ring or | |
39 | vector of points using the well-known Douglas-Peucker algorithm. | |
40 | \tparam Point the point type | |
41 | \tparam PointDistanceStrategy point-segment distance strategy to be used | |
42 | \note This strategy uses itself a point-segment-distance strategy which | |
43 | can be specified | |
44 | \author Barend and Maarten, 1995/1996 | |
45 | \author Barend, revised for Generic Geometry Library, 2008 | |
46 | */ | |
47 | ||
48 | /* | |
49 | For the algorithm, see for example: | |
50 | - http://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm | |
51 | - http://www2.dcs.hull.ac.uk/CISRG/projects/Royal-Inst/demos/dp.html | |
52 | */ | |
53 | template | |
54 | < | |
55 | typename Point, | |
56 | typename PointDistanceStrategy | |
57 | > | |
58 | class douglas_peucker | |
59 | { | |
60 | public : | |
61 | ||
62 | typedef PointDistanceStrategy distance_strategy_type; | |
63 | ||
1e59de90 TL |
64 | typedef typename strategy::distance::services::return_type |
65 | < | |
66 | distance_strategy_type, | |
67 | Point, Point | |
68 | >::type distance_type; | |
7c673cae FG |
69 | |
70 | template <typename Range, typename OutputIterator> | |
1e59de90 | 71 | static inline OutputIterator apply(Range const& , |
7c673cae | 72 | OutputIterator out, |
1e59de90 | 73 | distance_type const& ) |
7c673cae | 74 | { |
1e59de90 | 75 | return out; |
7c673cae | 76 | } |
7c673cae FG |
77 | }; |
78 | ||
79 | }} // namespace strategy::simplify | |
80 | ||
81 | ||
7c673cae FG |
82 | }} // namespace boost::geometry |
83 | ||
84 | #endif // BOOST_GEOMETRY_STRATEGY_AGNOSTIC_SIMPLIFY_DOUGLAS_PEUCKER_HPP |