1 // Boost.Geometry (aka GGL, Generic Geometry Library) 2 3 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. 4 5 // This file was modified by Oracle on 2018. 6 // Modifications copyright (c) 2018 Oracle and/or its affiliates. 7 8 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle 9 10 // Use, modification and distribution is subject to the Boost Software License, 11 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 12 // http://www.boost.org/LICENSE_1_0.txt) 13 14 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_APPEND_NO_DUPLICATES_HPP 15 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_APPEND_NO_DUPLICATES_HPP 16 17 18 #include <boost/geometry/algorithms/append.hpp> 19 #include <boost/geometry/algorithms/detail/equals/point_point.hpp> 20 21 #include <boost/geometry/util/range.hpp> 22 23 24 namespace boost { namespace geometry 25 { 26 27 28 #ifndef DOXYGEN_NO_DETAIL 29 namespace detail { namespace overlay 30 { 31 32 template <typename Range, typename Point> append_with_duplicates(Range & range,Point const & point)33 inline void append_with_duplicates(Range& range, Point const& 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 template <typename Range, typename Point, typename EqPPStrategy> append_no_duplicates(Range & range,Point const & point,EqPPStrategy const & strategy)44 inline void append_no_duplicates(Range& range, Point const& point, 45 EqPPStrategy const& strategy) 46 { 47 if ( boost::empty(range) 48 || ! geometry::detail::equals::equals_point_point(geometry::range::back(range), 49 point, 50 strategy) ) 51 { 52 #ifdef BOOST_GEOMETRY_DEBUG_INTERSECTION 53 std::cout << " add: (" 54 << geometry::get<0>(point) << ", " << geometry::get<1>(point) << ")" 55 << std::endl; 56 #endif 57 geometry::append(range, point); 58 } 59 } 60 61 62 }} // namespace detail::overlay 63 #endif // DOXYGEN_NO_DETAIL 64 65 66 67 }} // namespace boost::geometry 68 69 70 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_APPEND_NO_DUPLICATES_HPP 71