1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2 
3 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
4 
5 // Use, modification and distribution is subject to the Boost Software License,
6 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
8 
9 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_APPEND_NO_DUPLICATES_HPP
10 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_APPEND_NO_DUPLICATES_HPP
11 
12 
13 #include <boost/range.hpp>
14 
15 #include <boost/geometry/algorithms/append.hpp>
16 #include <boost/geometry/algorithms/detail/equals/point_point.hpp>
17 
18 
19 
20 namespace boost { namespace geometry
21 {
22 
23 
24 #ifndef DOXYGEN_NO_DETAIL
25 namespace detail { namespace overlay
26 {
27 
28 template <typename Range, typename Point>
append_no_duplicates(Range & range,Point const & point,bool force=false)29 inline void append_no_duplicates(Range& range, Point const& point, bool force = false)
30 {
31     if (boost::size(range) == 0
32         || force
33         || ! geometry::detail::equals::equals_point_point(*(boost::end(range)-1), point))
34     {
35 #ifdef BOOST_GEOMETRY_DEBUG_INTERSECTION
36         std::cout << "  add: ("
37             << geometry::get<0>(point) << ", " << geometry::get<1>(point) << ")"
38             << std::endl;
39 #endif
40         geometry::append(range, point);
41     }
42 }
43 
44 
45 }} // namespace detail::overlay
46 #endif // DOXYGEN_NO_DETAIL
47 
48 
49 
50 }} // namespace boost::geometry
51 
52 
53 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_APPEND_NO_DUPLICATES_HPP
54