Skip to content

Commit 3cee790

Browse files
authored
OverlayEdge: Avoid unintended ring rotation (#1412)
1 parent 52dc933 commit 3cee790

4 files changed

Lines changed: 6 additions & 7 deletions

File tree

src/operation/overlayng/OverlayEdge.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ OverlayEdge::getCoordinatesOriented() const
5555
void
5656
OverlayEdge::addCoordinates(CoordinateSequence* coords) const
5757
{
58-
bool isFirstEdge = coords->size() > 0;
58+
const bool isFirstEdge = coords->isEmpty();
5959
if (direction) {
6060
std::size_t startIndex = 1;
6161
if (isFirstEdge) {

tests/unit/capi/GEOSGeom_setPrecisionTest.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -333,12 +333,10 @@ void object::test<24>()
333333
// https://github.com/libgeos/geos/issues/1365{
334334
set_test_name("M value retained on last point");
335335

336-
input_ = fromWKT("POLYGON ZM ((0 0 0 0, 0 1 1 1, 1 1 2 3, 1 0 4 5, 0 0 6 7))");
337-
expected_ = fromWKT("POLYGON ZM ((0 1 1 1, 1 1 2 3, 1 0 4 5, 0 0 6 7, 0 1 1 1))");
338-
336+
input_ = fromWKT("POLYGON ZM ((0 0 6 7, 0 1 1 1, 1 1 2 3, 1 0 4 5, 0 0 6 7))");
339337
result_ = GEOSGeom_setPrecision(input_, 0.1, 0);
340338

341-
ensure(GEOSEqualsIdentical(result_, expected_));
339+
ensure_geometry_equals_identical(result_, input_);
342340
}
343341

344342
} // namespace tut

tests/unit/capi/GEOSMakeValidTest.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ void object::test<7>()
125125
ensure(input_);
126126

127127
result_ = GEOSMakeValid(input_);
128-
expected_ = fromWKT("MULTIPOLYGON ZM (((0 0 1 2, 0.5 0.5 2.5 3.5, 1 0 2 3, 0 0 1 2)), ((1 1 4 5, 0.5 0.5 2.5 3.5, 0 1 3 4, 1 1 4 5)))");
128+
expected_ = fromWKT("MULTIPOLYGON ZM (((0.5 0.5 2.5 3.5, 1 0 2 3, 0 0 1 2, 0.5 0.5 2.5 3.5)), ((0.5 0.5 2.5 3.5, 0 1 3 4, 1 1 4 5, 0.5 0.5 2.5 3.5)))");
129+
129130
ensure_geometry_equals_identical(result_, expected_);
130131
}
131132

tests/unit/capi/GEOSSubdivideByGridTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ void object::test<2>()
5050

5151
result_ = GEOSSubdivideByGrid(input_, 1, 0, 5, 3, 4, 3, true);
5252

53-
ensure_geometry_equals_identical(expected_, result_);
53+
ensure_geometry_equals(expected_, result_);
5454
}
5555

5656
}

0 commit comments

Comments
 (0)