debug_complement_graph.hpp 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. // Boost.Geometry (aka GGL, Generic Geometry Library)
  2. // Copyright (c) 2014, 2018, 2019, Oracle and/or its affiliates.
  3. // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
  4. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
  5. // Licensed under the Boost Software License version 1.0.
  6. // http://www.boost.org/users/license.html
  7. #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_IS_VALID_DEBUG_COMPLEMENT_GRAPH_HPP
  8. #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_IS_VALID_DEBUG_COMPLEMENT_GRAPH_HPP
  9. #ifdef BOOST_GEOMETRY_TEST_DEBUG
  10. #include <iostream>
  11. #endif
  12. #include <boost/geometry/algorithms/detail/is_valid/complement_graph.hpp>
  13. namespace boost { namespace geometry
  14. {
  15. namespace detail { namespace is_valid
  16. {
  17. #ifdef BOOST_GEOMETRY_TEST_DEBUG
  18. template <typename OutputStream, typename TurnPoint, typename CSTag>
  19. inline void
  20. debug_print_complement_graph(OutputStream& os,
  21. complement_graph<TurnPoint, CSTag> const& graph)
  22. {
  23. typedef typename complement_graph<TurnPoint>::vertex_handle vertex_handle;
  24. os << "num rings: " << graph.m_num_rings << std::endl;
  25. os << "vertex ids: {";
  26. for (vertex_handle it = graph.m_vertices.begin();
  27. it != graph.m_vertices.end(); ++it)
  28. {
  29. os << " " << it->id();
  30. }
  31. os << " }" << std::endl;
  32. for (vertex_handle it = graph.m_vertices.begin();
  33. it != graph.m_vertices.end(); ++it)
  34. {
  35. os << "neighbors of " << it->id() << ": {";
  36. for (typename complement_graph
  37. <
  38. TurnPoint
  39. >::neighbor_container::const_iterator
  40. nit = graph.m_neighbors[it->id()].begin();
  41. nit != graph.m_neighbors[it->id()].end(); ++nit)
  42. {
  43. os << " " << (*nit)->id();
  44. }
  45. os << "}" << std::endl;
  46. }
  47. }
  48. #else
  49. template <typename OutputStream, typename TurnPoint, typename CSTag>
  50. inline void debug_print_complement_graph(OutputStream&,
  51. complement_graph<TurnPoint, CSTag> const&)
  52. {
  53. }
  54. #endif
  55. }} // namespace detail::is_valid
  56. }} // namespace boost::geometry
  57. #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_IS_VALID_COMPLEMENT_GRAPH_HPP