@@ -3524,7 +3524,7 @@ static void CutGeometryOnDateLineAndAddToMulti(OGRGeometryCollection *poMulti,
35243524/* RemovePoint() */
35253525/* ***********************************************************************/
35263526
3527- static void RemovePoint (OGRGeometry *poGeom, OGRPoint *poPoint)
3527+ static void RemovePoint (OGRGeometry *poGeom, const OGRPoint *poPoint)
35283528{
35293529 const OGRwkbGeometryType eType = wkbFlatten (poGeom->getGeometryType ());
35303530 switch (eType)
@@ -3561,14 +3561,11 @@ static void RemovePoint(OGRGeometry *poGeom, OGRPoint *poPoint)
35613561 case wkbPolygon:
35623562 {
35633563 OGRPolygon *poPoly = poGeom->toPolygon ();
3564- if (poPoly-> getExteriorRing () != nullptr )
3564+ for ( auto *poRing : *poPoly )
35653565 {
3566- RemovePoint (poPoly->getExteriorRing (), poPoint);
3567- for (int i = 0 ; i < poPoly->getNumInteriorRings (); ++i)
3568- {
3569- RemovePoint (poPoly->getInteriorRing (i), poPoint);
3570- }
3566+ RemovePoint (poRing, poPoint);
35713567 }
3568+ poPoly->closeRings ();
35723569 break ;
35733570 }
35743571
@@ -3577,9 +3574,9 @@ static void RemovePoint(OGRGeometry *poGeom, OGRPoint *poPoint)
35773574 case wkbGeometryCollection:
35783575 {
35793576 OGRGeometryCollection *poGC = poGeom->toGeometryCollection ();
3580- for (int i = 0 ; i < poGC-> getNumGeometries (); ++i )
3577+ for (auto *poPart : * poGC)
35813578 {
3582- RemovePoint (poGC-> getGeometryRef (i) , poPoint);
3579+ RemovePoint (poPart , poPoint);
35833580 }
35843581 break ;
35853582 }
0 commit comments