Skip to content

Commit

Permalink
fix reference resolution with new side-specific IDs, fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickbr committed Jan 31, 2025
1 parent 6360be3 commit bacb2f5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
12 changes: 7 additions & 5 deletions src/spatialjoin/Sweeper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,12 @@ void Sweeper::add(const std::string& parent, const util::geo::I32Box& box,
}

// _____________________________________________________________________________
void Sweeper::add(const std::string& parent, const util::geo::I32Box& box,
const std::string& gid, size_t subid, bool side,
void Sweeper::add(const std::string& parentR, const util::geo::I32Box& box,
const std::string& gidR, size_t subid, bool side,
WriteBatch& batch) const {
std::string gid = (side ? ("B" + gidR) : ("A" + gidR));
std::string parent = (side ? ("B" + parentR) : ("A" + parentR));

BoxVal boxl, boxr;
boxl.side = side;
boxr.side = side;
Expand All @@ -160,9 +163,7 @@ void Sweeper::add(const I32Polygon& poly, const std::string& gid, bool side,
// _____________________________________________________________________________
void Sweeper::add(const I32Polygon& poly, const std::string& gidR, size_t subid,
bool side, WriteBatch& batch) const {
std::string gid;

gid = (side ? ("B" + gidR) : ("A" + gidR));
std::string gid = (side ? ("B" + gidR) : ("A" + gidR));

WriteCand cur;
const auto& box = getBoundingBox(poly);
Expand Down Expand Up @@ -190,6 +191,7 @@ void Sweeper::add(const I32Polygon& poly, const std::string& gidR, size_t subid,
}

cur.subid = subid;
cur.gid = gid;

if (poly.getInners().size() == 0 && poly.getOuter().size() < 10 &&
subid == 0 && (!_cfg.useBoxIds || boxIds.front().first == 1)) {
Expand Down
11 changes: 7 additions & 4 deletions src/spatialjoin/tests/TestMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -374,12 +374,15 @@ int main(int, char**) {
std::string::npos);
TEST(res.find("$Brandenburg equals Brandenburg2$") == std::string::npos);
TEST(res.find("$Brandenburg2 equals Brandenburg$") == std::string::npos);
TEST(res.find("$Brandenburg intersects Grenzpart$") != std::string::npos);
TEST(res.find("$Brandenburg covers Grenzpart$") != std::string::npos);
TEST(res.find("$Brandenburg intersects Grenzpart$") == std::string::npos);
TEST(res.find("$Grenzpart intersects Brandenburg$") != std::string::npos);
TEST(res.find("$Brandenburg covers Grenzpart$") == std::string::npos);
TEST(res.find("$Brandenburg contains Grenzpart$") == std::string::npos);

TEST(res.find("$Brandenburg intersects Berlin$") != std::string::npos);
TEST(res.find("$Brandenburg touches Berlin$") != std::string::npos);
TEST(res.find("$Brandenburg intersects Berlin$") == std::string::npos);
TEST(res.find("$Berlin intersects Brandenburg$") != std::string::npos);
TEST(res.find("$Brandenburg touches Berlin$") == std::string::npos);
TEST(res.find("$Berlin touches Brandenburg$") != std::string::npos);
TEST(res.find("$Brandenburg overlaps Berlin$") == std::string::npos);
TEST(res.find("$Berlin touches Brandenburg$") != std::string::npos);
TEST(res.find("$Berlin overlaps Brandenburg$") == std::string::npos);
Expand Down

0 comments on commit bacb2f5

Please sign in to comment.