1 // Boost.Geometry (aka GGL, Generic Geometry Library)
3 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
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)
9 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_APPEND_NO_DUPLICATES_HPP
10 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_APPEND_NO_DUPLICATES_HPP
13 #include <boost/range.hpp>
15 #include <boost/geometry/algorithms/append.hpp>
16 #include <boost/geometry/algorithms/detail/equals/point_point.hpp>
20 namespace boost { namespace geometry
24 #ifndef DOXYGEN_NO_DETAIL
25 namespace detail { namespace overlay
28 template <typename Range, typename Point>
29 inline void append_no_duplicates(Range& range, Point const& point, bool force = false)
31 if (boost::size(range) == 0
33 || ! geometry::detail::equals::equals_point_point(*(boost::end(range)-1), point))
35 #ifdef BOOST_GEOMETRY_DEBUG_INTERSECTION
36 std::cout << " add: ("
37 << geometry::get<0>(point) << ", " << geometry::get<1>(point) << ")"
40 geometry::append(range, point);
45 }} // namespace detail::overlay
46 #endif // DOXYGEN_NO_DETAIL
50 }} // namespace boost::geometry
53 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_APPEND_NO_DUPLICATES_HPP