summaryrefslogtreecommitdiff
path: root/src/third_party/s2/s2loop.cc
diff options
context:
space:
mode:
authorBilly Donahue <billy.donahue@mongodb.com>2019-09-04 16:34:14 +0000
committerevergreen <evergreen@mongodb.com>2019-09-04 16:34:14 +0000
commit6c548a4a26a4d47e8fe3035b7964a24110d7d19d (patch)
tree9c487555ae6427233a62aeb683aabf2cf5cc89a4 /src/third_party/s2/s2loop.cc
parent02e8e17e9e04eb017f4493f0cf6fb9b62a6e1615 (diff)
downloadmongo-6c548a4a26a4d47e8fe3035b7964a24110d7d19d.tar.gz
Revert "SERVER-41648 remove mongo headers from s2 files."
This reverts commit e58bc0f552112f5c1c16f8092b771f7e562316fb.
Diffstat (limited to 'src/third_party/s2/s2loop.cc')
-rw-r--r--src/third_party/s2/s2loop.cc16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/third_party/s2/s2loop.cc b/src/third_party/s2/s2loop.cc
index dc6c9b8a4d5..d4087fab971 100644
--- a/src/third_party/s2/s2loop.cc
+++ b/src/third_party/s2/s2loop.cc
@@ -29,16 +29,19 @@ using std::make_pair;
#include "s2cell.h"
#include "s2edgeindex.h"
+#include "mongo/util/str.h"
+using mongo::str::stream;
+
static const unsigned char kCurrentEncodingVersionNumber = 1;
namespace {
- s2_env::StringStream& operator<<(s2_env::StringStream& strStream, const S1Angle& angle) {
+ stream& operator<<(stream& strStream, const S1Angle& angle) {
std::stringstream ss;
ss << angle;
return strStream << ss.str();
}
// Reverse the output order of Lat/Lng to Lng/Lat
- s2_env::StringStream& operator<<(s2_env::StringStream& strStream, const S2LatLng& ll) {
+ stream& operator<<(stream& strStream, const S2LatLng& ll) {
return strStream << "[" << ll.lng() << ", " << ll.lat() << "]";
}
}
@@ -115,7 +118,7 @@ bool S2Loop::IsValid(string* err) const {
for (int i = 0; i < num_vertices(); ++i) {
if (!S2::IsUnitLength(vertex(i))) {
VLOG(2) << "Vertex " << i << " is not unit length";
- if (err) *err = s2_env::StringStream() << "Vertex " << i << " is not unit length";
+ if (err) *err = stream() << "Vertex " << i << " is not unit length";
return false;
}
}
@@ -124,8 +127,7 @@ bool S2Loop::IsValid(string* err) const {
for (int i = 0; i < num_vertices(); ++i) {
if (!vmap.insert(make_pair(vertex(i), i)).second) {
VLOG(2) << "Duplicate vertices: " << vmap[vertex(i)] << " and " << i;
- if (err) *err = s2_env::StringStream() << "Duplicate vertices: " << vmap[vertex(i)]
- << " and " << i;
+ if (err) *err = stream() << "Duplicate vertices: " << vmap[vertex(i)] << " and " << i;
return false;
}
}
@@ -150,14 +152,14 @@ bool S2Loop::IsValid(string* err) const {
if (crosses) {
VLOG(2) << "Edges " << i << " and " << ai << " cross";
// additional debugging information, reverse Lat/Lng order.
- string errDetail = s2_env::StringStream()
+ string errDetail = stream()
<< "Edge locations in degrees: "
<< S2LatLng(vertex(i)) << "-" << S2LatLng(vertex(i + 1))
<< " and "
<< S2LatLng(vertex(ai)) << "-" << S2LatLng(vertex(ai + 1));
VLOG(2) << errDetail;
if (NULL != err) {
- *err = s2_env::StringStream()
+ *err = stream()
<< "Edges " << i << " and " << ai << " cross. " << errDetail;
}
break;