From 3831da815ccca3a76b61d499422c667a91b70c96 Mon Sep 17 00:00:00 2001 From: Jonathan Zeller Date: Wed, 20 Nov 2024 01:08:31 +0100 Subject: [PATCH] PR feedback --- src/engine/SpatialJoinAlgorithms.cpp | 19 ++++++++++++++++--- src/engine/SpatialJoinAlgorithms.h | 2 +- test/engine/SpatialJoinAlgorithmsTest.cpp | 2 +- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/engine/SpatialJoinAlgorithms.cpp b/src/engine/SpatialJoinAlgorithms.cpp index d3df1b6140..15a6bb3f48 100644 --- a/src/engine/SpatialJoinAlgorithms.cpp +++ b/src/engine/SpatialJoinAlgorithms.cpp @@ -416,10 +416,23 @@ void SpatialJoinAlgorithms::convertToNormalCoordinates(Point& point) { } } +std::array SpatialJoinAlgorithms::isAPoleTouched( + const double& latitude) { + bool northPoleReached = false; + bool southPoleReached = false; + if (latitude >= 90) { + northPoleReached = true; + } + if (latitude <= -90) { + southPoleReached = true; + } + return std::array{northPoleReached, southPoleReached}; +} + // ____________________________________________________________________________ Result SpatialJoinAlgorithms::BoundingBoxAlgorithm() { auto printWarning = []() { - LOG(WARN) + AD_LOG(AD_WARN) << "expected a point here, but no point is given. Skipping this point" << std::endl; }; @@ -452,7 +465,7 @@ Result SpatialJoinAlgorithms::BoundingBoxAlgorithm() { Point p(geopoint.value().getLng(), geopoint.value().getLat()); // add every point together with the row number into the rtree - rtree.insert(std::make_pair(p, i)); + rtree.insert(std::make_pair(std::move(p), i)); } for (size_t i = 0; i < otherResult->numRows(); i++) { auto geopoint1 = getPoint(otherResult, i, otherResJoinCol); @@ -466,7 +479,7 @@ Result SpatialJoinAlgorithms::BoundingBoxAlgorithm() { // query the other rtree for every point using the following bounding box std::vector bbox = computeBoundingBox(p); - std::vector results; + std::vector> results; std::ranges::for_each(bbox, [&](const Box& bbox) { rtree.query(bgi::intersects(bbox), std::back_inserter(results)); diff --git a/src/engine/SpatialJoinAlgorithms.h b/src/engine/SpatialJoinAlgorithms.h index 34c7ca95e6..c2a447c8b0 100644 --- a/src/engine/SpatialJoinAlgorithms.h +++ b/src/engine/SpatialJoinAlgorithms.h @@ -107,6 +107,6 @@ class SpatialJoinAlgorithms { // convert coordinates to the usual ranges (-180 to 180 and -90 to 90) void convertToNormalCoordinates(BoostGeometryNamespace::Point& point); - // return whether one of the poles is beeing touched + // return whether one of the poles is being touched std::array isAPoleTouched(const double& latitude); }; diff --git a/test/engine/SpatialJoinAlgorithmsTest.cpp b/test/engine/SpatialJoinAlgorithmsTest.cpp index 95f4d774a6..4c9ab579e2 100644 --- a/test/engine/SpatialJoinAlgorithmsTest.cpp +++ b/test/engine/SpatialJoinAlgorithmsTest.cpp @@ -803,7 +803,7 @@ using BoostGeometryNamespace::Value; // function, the other time move it slightly outside of the bounding box and // give 'shouldBeTrue' = false to the function. Do this for all edges. Note // that this function is not taking a set of boxes, as neighboring boxes would -// not work with this approach (slighly outside of one box can be inside the +// not work with this approach (slightly outside of one box can be inside the // neighboring box. For a set of boxes, check each box separately) void testBounds(double x, double y, const Box& bbox, bool shouldBeWithin) { // correct lon bounds if necessary