Skip to content

Commit

Permalink
Properly restore a polygon geometry rubber band (fixes #5235)
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed May 11, 2024
1 parent 5ffae02 commit ddf33a5
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/core/rubberbandmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,15 +344,15 @@ void RubberbandModel::setDataFromGeometry( QgsGeometry geometry, const QgsCoordi
{
break;
}

// skip last vertex on polygon, as it's duplicate of the last one
if ( geometry.type() == Qgis::GeometryType::Polygon && vertexId.vertex == abstractGeom->vertexCount() )
{
continue;
}

mPointList << pt;
}

// for polygons, remove the last vertex which is a duplicate of the first vertex
if ( geometry.type() == Qgis::GeometryType::Polygon )
{
mPointList.removeLast();
}

// insert the last point twice so the resutling rubberband's current coordinate property being modified (by e.g.
// the GNSS position) will not replace the last vertex from the passed geometry
mPointList << mPointList.last();
Expand Down

0 comments on commit ddf33a5

Please sign in to comment.