feat: implement spatial boundary checks for Bari municipal area in GeoJSON handling

This commit is contained in:
gabdevele
2026-06-15 14:45:38 +02:00 Unverified
parent 088a2ed866
commit aab7420706
13 changed files with 310 additions and 15 deletions
+55
View File
@@ -106,6 +106,61 @@ DROGON_TEST(GeoJsonMatchesPointInsidePolygon)
CHECK(visione::geojson::pointInPolygon(41.5, 12.5, polygon));
CHECK(!visione::geojson::pointInPolygon(43.0, 12.5, polygon));
CHECK(visione::geojson::pointInGeometry(41.5, 12.5, polygon));
CHECK(!visione::geojson::pointInGeometry(43.0, 12.5, polygon));
}
DROGON_TEST(GeoJsonAcceptsContainedPolygon)
{
Json::Value container;
container["type"] = "Polygon";
Json::Value outer(Json::arrayValue);
Json::Value a(Json::arrayValue);
a.append(12.0);
a.append(41.0);
Json::Value b(Json::arrayValue);
b.append(13.0);
b.append(41.0);
Json::Value c(Json::arrayValue);
c.append(13.0);
c.append(42.0);
Json::Value d(Json::arrayValue);
d.append(12.0);
d.append(42.0);
outer.append(a);
outer.append(b);
outer.append(c);
outer.append(d);
outer.append(a);
container["coordinates"].append(outer);
Json::Value candidate;
candidate["type"] = "Polygon";
Json::Value inner(Json::arrayValue);
Json::Value p1(Json::arrayValue);
p1.append(12.2);
p1.append(41.2);
Json::Value p2(Json::arrayValue);
p2.append(12.8);
p2.append(41.2);
Json::Value p3(Json::arrayValue);
p3.append(12.8);
p3.append(41.8);
Json::Value p4(Json::arrayValue);
p4.append(12.2);
p4.append(41.8);
inner.append(p1);
inner.append(p2);
inner.append(p3);
inner.append(p4);
inner.append(p1);
candidate["coordinates"].append(inner);
CHECK(visione::geojson::polygonInsideGeometry(candidate, container));
candidate["coordinates"][0][3][0] = 14.0;
CHECK(!visione::geojson::polygonInsideGeometry(candidate, container));
}
DROGON_TEST(PasswordHashSupportsPbkdf2Only)