Skip to content

Commit

Permalink
Add some interrupt checking in MakeValid loop, references https://tra…
Browse files Browse the repository at this point in the history
  • Loading branch information
pramsey committed Aug 13, 2020
1 parent 34b8d63 commit 8a4f50e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/operation/valid/MakeValid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#include <geos/operation/valid/MakeValid.h>
#include <geos/operation/valid/IsValidOp.h>

#include <geos/operation/overlay/OverlayOp.h>
#include <geos/operation/polygonize/BuildArea.h>
#include <geos/operation/union/UnaryUnionOp.h>
Expand All @@ -33,9 +34,11 @@
#include <geos/geom/Polygon.h>
#include <geos/geom/MultiLineString.h>
#include <geos/geom/MultiPolygon.h>
#include <geos/util/Interrupt.h>
#include <geos/util/UniqueCoordinateArrayFilter.h>
#include <geos/util/UnsupportedOperationException.h>


// std
#include <cassert>
#include <algorithm>
Expand Down Expand Up @@ -231,6 +234,8 @@ static std::unique_ptr<geom::Geometry> MakeValidPoly(const geom::Geometry* geom)
*/
while( cut_edges->getNumGeometries() ) {

GEOS_CHECK_FOR_INTERRUPTS();

// ASSUMPTION: cut_edges should already be fully noded
auto new_area = geos::operation::polygonize::BuildArea().build(cut_edges.get());
assert(new_area); // never return nullptr, but exception
Expand All @@ -248,6 +253,8 @@ static std::unique_ptr<geom::Geometry> MakeValidPoly(const geom::Geometry* geom)
std::unique_ptr<geom::Geometry> symdif = makeValidSymDifference(area.get(), new_area.get());
assert(symdif);

GEOS_CHECK_FOR_INTERRUPTS();

area = std::move(symdif);

/*
Expand Down

0 comments on commit 8a4f50e

Please sign in to comment.