From edd14a36738a3a84eab53df7d1bd8e31686288c4 Mon Sep 17 00:00:00 2001 From: Dewey Dunnington Date: Sun, 28 Jul 2024 01:38:39 +0000 Subject: [PATCH] maybe fix stderr references --- src/s2/s2boolean_operation.cc | 16 +++++++++------- src/s2/s2builder.cc | 12 +++++++----- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/s2/s2boolean_operation.cc b/src/s2/s2boolean_operation.cc index ef9a3084..7ec8cb24 100644 --- a/src/s2/s2boolean_operation.cc +++ b/src/s2/s2boolean_operation.cc @@ -62,6 +62,8 @@ // - GraphEdgeClipper: a helper class that does the actual work of the // EdgeClippingLayer. +#include "cpp-compat.h" + #include "s2/s2boolean_operation.h" #include @@ -425,8 +427,8 @@ void GraphEdgeClipper::Run() { } --i; if (s2builder_verbose) { - std::cout << "input edge " << a_input_id << " (inside=" << inside << "):"; - for (VertexId id : a_vertices) std::cout << " " << id; + cpp_compat_cout << "input edge " << a_input_id << " (inside=" << inside << "):"; + for (VertexId id : a_vertices) cpp_compat_cout << " " << id; } // Now for each B edge chain, decide which vertex of the A chain it // crosses, and keep track of the number of signed crossings at each A @@ -454,12 +456,12 @@ void GraphEdgeClipper::Run() { left_to_right); if (a_index >= 0) { if (s2builder_verbose) { - std::cout << std::endl << " " << "b input edge " + cpp_compat_cout << std::endl << " " << "b input edge " << b_input_edges[bi].input_id() << " (l2r=" << left_to_right << ", crossing=" << a_vertices[a_index] << ")"; for (const auto& x : b_edges[bi]) { const Graph::Edge& e = g_.edge(x.id); - std::cout << " (" << e.first << ", " << e.second << ")"; + cpp_compat_cout << " (" << e.first << ", " << e.second << ")"; } } // Keep track of the number of signed crossings (see above). @@ -475,7 +477,7 @@ void GraphEdgeClipper::Run() { S2_LOG(ERROR) << "Failed to get crossed vertex index."; } } - if (s2builder_verbose) std::cout << std::endl; + if (s2builder_verbose) cpp_compat_cout << std::endl; // Finally, we iterate through the A edge chain, keeping track of the // number of signed crossings as we go along. The "multiplicity" is @@ -802,9 +804,9 @@ void EdgeClippingLayer::Build(const Graph& g, S2Error* error) { GraphEdgeClipper(g, input_dimensions_, input_crossings_, &new_edges, &new_input_edge_ids).Run(); if (s2builder_verbose) { - std::cout << "Edges after clipping: " << std::endl; + cpp_compat_cout << "Edges after clipping: " << std::endl; for (size_t i = 0; i < new_edges.size(); ++i) { - std::cout << " " << new_input_edge_ids[i] << " (" << new_edges[i].first + cpp_compat_cout << " " << new_input_edge_ids[i] << " (" << new_edges[i].first << ", " << new_edges[i].second << ")" << std::endl; } } diff --git a/src/s2/s2builder.cc b/src/s2/s2builder.cc index 68aae5fc..0029206d 100644 --- a/src/s2/s2builder.cc +++ b/src/s2/s2builder.cc @@ -66,6 +66,8 @@ // Otherwise all layers are processed independently. For example, sibling // edge pairs can only cancel each other within a single layer (if desired). +#include "cpp-compat.h" + #include "s2/s2builder.h" #include @@ -826,7 +828,7 @@ void S2Builder::CollectSiteEdges(const S2PointIndex& site_index) { const S2Point& v0 = input_vertices_[edge.first]; const S2Point& v1 = input_vertices_[edge.second]; if (s2builder_verbose) { - std::cout << "S2Polyline: " << s2textformat::ToString(v0) + cpp_compat_cout << "S2Polyline: " << s2textformat::ToString(v0) << ", " << s2textformat::ToString(v1) << "\n"; } S2ClosestPointQueryEdgeTarget target(v0, v1); @@ -1252,9 +1254,9 @@ void S2Builder::SnapEdge(InputEdgeId e, vector* chain) const { } } if (s2builder_verbose) { - std::cout << "(" << edge.first << "," << edge.second << "): "; - for (SiteId id : *chain) std::cout << id << " "; - std::cout << std::endl; + cpp_compat_cout << "(" << edge.first << "," << edge.second << "): "; + for (SiteId id : *chain) cpp_compat_cout << id << " "; + cpp_compat_cout << std::endl; } } @@ -1330,7 +1332,7 @@ static void DumpEdges(const vector& edges, vector v; v.push_back(vertices[e.first]); v.push_back(vertices[e.second]); - std::cout << "S2Polyline: " << s2textformat::ToString(v) + cpp_compat_cout << "S2Polyline: " << s2textformat::ToString(v) << "(" << e.first << "," << e.second << ")" << std::endl; } }