Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan24680 committed Nov 20, 2024
1 parent 603ec46 commit 3831da8
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
19 changes: 16 additions & 3 deletions src/engine/SpatialJoinAlgorithms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -416,10 +416,23 @@ void SpatialJoinAlgorithms::convertToNormalCoordinates(Point& point) {
}
}

std::array<bool, 2> 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;
};
Expand Down Expand Up @@ -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);
Expand All @@ -466,7 +479,7 @@ Result SpatialJoinAlgorithms::BoundingBoxAlgorithm() {

// query the other rtree for every point using the following bounding box
std::vector<Box> bbox = computeBoundingBox(p);
std::vector<Value> results;
std::vector<Value, ad_utility::AllocatorWithLimit<Value>> results;

std::ranges::for_each(bbox, [&](const Box& bbox) {
rtree.query(bgi::intersects(bbox), std::back_inserter(results));
Expand Down
2 changes: 1 addition & 1 deletion src/engine/SpatialJoinAlgorithms.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool, 2> isAPoleTouched(const double& latitude);
};
2 changes: 1 addition & 1 deletion test/engine/SpatialJoinAlgorithmsTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3831da8

Please sign in to comment.