traverse.hpp 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. // Boost.Geometry (aka GGL, Generic Geometry Library)
  2. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
  3. // This file was modified by Oracle on 2024.
  4. // Modifications copyright (c) 2024 Oracle and/or its affiliates.
  5. // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
  6. // Use, modification and distribution is subject to the Boost Software License,
  7. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  8. // http://www.boost.org/LICENSE_1_0.txt)
  9. #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_TRAVERSE_HPP
  10. #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_TRAVERSE_HPP
  11. #include <cstddef>
  12. #include <boost/range/size.hpp>
  13. #include <boost/geometry/algorithms/detail/overlay/graph/detect_biconnected_components.hpp>
  14. #include <boost/geometry/algorithms/detail/overlay/graph/fill_ring_turn_info_map.hpp>
  15. #include <boost/geometry/algorithms/detail/overlay/graph/traverse_graph.hpp>
  16. #include <boost/geometry/util/constexpr.hpp>
  17. namespace boost { namespace geometry
  18. {
  19. #ifndef DOXYGEN_NO_DETAIL
  20. namespace detail { namespace overlay
  21. {
  22. /*!
  23. \brief Traverses through intersection points / geometries
  24. \ingroup overlay
  25. */
  26. template
  27. <
  28. bool Reverse1, bool Reverse2,
  29. typename Geometry1,
  30. typename Geometry2,
  31. overlay_type OverlayType
  32. >
  33. class traverse
  34. {
  35. public :
  36. template
  37. <
  38. typename IntersectionStrategy,
  39. typename Turns,
  40. typename Rings,
  41. typename TurnInfoMap,
  42. typename Clusters,
  43. typename Visitor
  44. >
  45. static inline void apply(Geometry1 const& geometry1,
  46. Geometry2 const& geometry2,
  47. IntersectionStrategy const& intersection_strategy,
  48. Turns& turns, Rings& rings,
  49. TurnInfoMap& turn_info_map,
  50. Clusters& clusters,
  51. Visitor& visitor)
  52. {
  53. constexpr operation_type target_operation = operation_from_overlay<OverlayType>::value;
  54. detect_biconnected_components<target_operation>(turns, clusters);
  55. traverse_graph
  56. <
  57. Reverse1, Reverse2, OverlayType,
  58. Geometry1, Geometry2,
  59. Turns, Clusters,
  60. IntersectionStrategy
  61. > traverser(geometry1, geometry2, turns, clusters,
  62. intersection_strategy);
  63. traverser.iterate(rings);
  64. update_ring_turn_info_map(turn_info_map, turns);
  65. }
  66. };
  67. }} // namespace detail::overlay
  68. #endif // DOXYGEN_NO_DETAIL
  69. }} // namespace boost::geometry
  70. #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_TRAVERSE_HPP
  71. // remove