@@ -79,7 +79,10 @@ void QgsMapToolFillRing::canvasMapReleaseEvent( QgsMapMouseEvent * e )
79
79
closePolygon ();
80
80
81
81
vlayer->beginEditCommand ( tr ( " Ring added and filled" ) );
82
- int addRingReturnCode = vlayer->addRing ( points () );
82
+ QList< QgsPoint > pointList = points ();
83
+
84
+ QgsFeatureId modifiedFid;
85
+ int addRingReturnCode = vlayer->addRing ( pointList, &modifiedFid );
83
86
if ( addRingReturnCode != 0 )
84
87
{
85
88
QString errorMessage;
@@ -122,7 +125,7 @@ void QgsMapToolFillRing::canvasMapReleaseEvent( QgsMapMouseEvent * e )
122
125
yMin = std::numeric_limits<double >::max ();
123
126
yMax = -std::numeric_limits<double >::max ();
124
127
125
- Q_FOREACH ( const QgsPoint& point, points () )
128
+ Q_FOREACH ( const QgsPoint& point, pointList )
126
129
{
127
130
xMin = qMin ( xMin, point.x () );
128
131
xMax = qMax ( xMax, point.x () );
@@ -135,18 +138,16 @@ void QgsMapToolFillRing::canvasMapReleaseEvent( QgsMapMouseEvent * e )
135
138
bBox.setXMaximum ( xMax );
136
139
bBox.setYMaximum ( yMax );
137
140
138
- QgsFeatureIterator fit = vlayer->getFeatures ( QgsFeatureRequest ().setFilterRect ( bBox ). setFlags ( QgsFeatureRequest::ExactIntersect ) );
141
+ QgsFeatureIterator fit = vlayer->getFeatures ( QgsFeatureRequest ().setFilterFid ( modifiedFid ) );
139
142
140
143
QgsFeature f;
141
144
bool res = false ;
142
- while ( fit.nextFeature ( f ) )
145
+ if ( fit.nextFeature ( f ) )
143
146
{
144
147
// create QgsFeature with wkb representation
145
148
QgsFeature* ft = new QgsFeature ( vlayer->pendingFields (), 0 );
146
149
147
- QgsGeometry *g;
148
- g = QgsGeometry::fromPolygon ( QgsPolygon () << points ().toVector () );
149
- ft->setGeometry ( g );
150
+ ft->setGeometry ( QgsGeometry::fromPolygon ( QgsPolygon () << pointList.toVector () ) );
150
151
ft->setAttributes ( f.attributes () );
151
152
152
153
if ( QgsApplication::keyboardModifiers () == Qt::ControlModifier )
0 commit comments