[algorithms][is_valid] remove all explicit usages of debug macro;

clean-up/polish debug-related code;
This commit is contained in:
Menelaos Karavelas
2014-06-20 13:41:00 +03:00
parent 36def7632c
commit 5a71e83bd5

View File

@@ -40,14 +40,12 @@
#include <boost/geometry/algorithms/detail/is_valid/ring.hpp>
#include <boost/geometry/algorithms/detail/is_valid/complement_graph.hpp>
#include <boost/geometry/algorithms/detail/is_valid/debug_print_turns.hpp>
#include <boost/geometry/algorithms/detail/is_valid/debug_validity_phase.hpp>
#include <boost/geometry/algorithms/detail/is_valid/debug_complement_graph.hpp>
#include <boost/geometry/algorithms/dispatch/is_valid.hpp>
#ifdef GEOMETRY_TEST_DEBUG
#include <boost/geometry/io/dsv/write.hpp>
#include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp>
#endif
namespace boost { namespace geometry
{
@@ -185,10 +183,11 @@ public:
typedef typename point_type<Polygon>::type point_type;
typedef typename ring_type<Polygon>::type ring_type;
typedef debug_validity_phase<Polygon> debug_phase;
// check validity of exterior ring
#ifdef GEOMETRY_TEST_DEBUG
std::cout << "checking exterior ring..." << std::endl;
#endif
debug_phase::apply(1);
if ( !detail::is_valid::is_valid_ring
<
ring_type,
@@ -199,11 +198,9 @@ public:
return false;
}
// check validity of interior rings
#ifdef GEOMETRY_TEST_DEBUG
std::cout << "checking interior rings..." << std::endl;
#endif
debug_phase::apply(2);
if ( !are_valid_interior_rings(geometry::interior_rings(polygon)) )
{
return false;
@@ -211,9 +208,8 @@ public:
// compute turns and check if all are acceptable
#ifdef GEOMETRY_TEST_DEBUG
std::cout << "computing and analyzing turns..." << std::endl;
#endif
debug_phase::apply(3);
typedef typename geometry::rescale_policy_type
<
point_type
@@ -253,24 +249,7 @@ public:
return false;
}
#ifdef GEOMETRY_TEST_DEBUG
std::cout << "turns:";
for (typename std::deque<turn_info>::const_iterator tit = turns.begin();
tit != turns.end(); ++tit)
{
std::cout << " [" << geometry::method_char(tit->method);
std::cout << ","
<< geometry::operation_char(tit->operations[0].operation);
std::cout << "/"
<< geometry::operation_char(tit->operations[1].operation);
std::cout << " {" << tit->operations[0].seg_id.ring_index
<< ", " << tit->operations[0].other_id.ring_index
<< "}";
std::cout << " " << geometry::dsv(tit->point);
std::cout << "] ";
}
std::cout << std::endl << std::endl;
#endif
debug_print_turns(turns.begin(), turns.end());
// put the ring id's that are associated with turns in a
// container with fast lookup (std::set)
@@ -284,10 +263,8 @@ public:
// check if all interior rings are inside the exterior ring
#ifdef GEOMETRY_TEST_DEBUG
std::cout << "checking if holes are inside the exterior ring..."
<< std::endl;
#endif
debug_phase::apply(4);
if ( !are_holes_inside(geometry::interior_rings(polygon),
geometry::exterior_ring(polygon),
rings_with_turns) )
@@ -297,9 +274,8 @@ public:
// check whether the interior of the polygon is a connected set
#ifdef GEOMETRY_TEST_DEBUG
std::cout << "checking connectivity of interior..." << std::endl;
#endif
debug_phase::apply(5);
typedef graph_vertex<typename turn_info::point_type> graph_vertex;
typedef complement_graph<graph_vertex> graph;
@@ -317,9 +293,8 @@ public:
g.add_edge(v2, vip);
}
#ifdef GEOMETRY_TEST_DEBUG
g.print();
#endif
debug_print_complement_graph(std::cout, g);
return !g.has_cycles();
}
};