Skip to content

Commit

Permalink
Test overlay op with mixed GeometryCollection
Browse files Browse the repository at this point in the history
  • Loading branch information
mwtoews committed Feb 24, 2024
1 parent db33be2 commit 6cc22d9
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/geom/HeuristicOverlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,8 @@ HeuristicOverlay(const Geometry* g0, const Geometry* g1, int opCode)

return ret;
}
catch(const geos::util::TopologyException& ex) {
catch(const geos::util::IllegalArgumentException& ex) {
// Mixed GeometryCollection
::geos::ignore_unused_variable_warning(ex);

#if GEOS_DEBUG_HEURISTICOVERLAY
Expand Down
28 changes: 28 additions & 0 deletions tests/unit/capi/GEOSDifferenceTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,33 @@ void object::test<1>()
GEOSGeom_destroy(result);
}

/**
* Mixed GeometryCollection types permitted at a high-level
*/
template<>
template<>
void object::test<2>()
{
GEOSGeometry* a = GEOSGeomFromWKT("GEOMETRYCOLLECTION (POINT (51 -1), LINESTRING (52 -1, 49 2))");
GEOSGeometry* b = GEOSGeomFromWKT("POINT (2 3)");

ensure(a);
ensure(b);

GEOSGeometry* ab = GEOSDifference(a, b);
GEOSGeometry* ba = GEOSDifference(b, a);

ensure(ab);
ensure(ba);

ensure_geometry_equals(ab, a);
ensure_geometry_equals(ba, b);

GEOSGeom_destroy(a);
GEOSGeom_destroy(b);
GEOSGeom_destroy(ab);
GEOSGeom_destroy(ba);
}

} // namespace tut

0 comments on commit 6cc22d9

Please sign in to comment.