@@ -1004,7 +1004,10 @@ bool QgsVectorLayer::insertVertex( double x, double y, QgsFeatureId atFeatureId,
1004
1004
return false ;
1005
1005
1006
1006
QgsVectorLayerEditUtils utils ( this );
1007
- return utils.insertVertex ( x, y, atFeatureId, beforeVertex );
1007
+ bool result = utils.insertVertex ( x, y, atFeatureId, beforeVertex );
1008
+ if ( result )
1009
+ updateExtents ();
1010
+ return result;
1008
1011
}
1009
1012
1010
1013
@@ -1014,7 +1017,11 @@ bool QgsVectorLayer::moveVertex( double x, double y, QgsFeatureId atFeatureId, i
1014
1017
return false ;
1015
1018
1016
1019
QgsVectorLayerEditUtils utils ( this );
1017
- return utils.moveVertex ( x, y, atFeatureId, atVertex );
1020
+ bool result = utils.moveVertex ( x, y, atFeatureId, atVertex );
1021
+
1022
+ if ( result )
1023
+ updateExtents ();
1024
+ return result;
1018
1025
}
1019
1026
1020
1027
bool QgsVectorLayer::moveVertex ( const QgsPointV2& p, QgsFeatureId atFeatureId, int atVertex )
@@ -1023,13 +1030,21 @@ bool QgsVectorLayer::moveVertex( const QgsPointV2& p, QgsFeatureId atFeatureId,
1023
1030
return false ;
1024
1031
1025
1032
QgsVectorLayerEditUtils utils ( this );
1026
- return utils.moveVertex ( p, atFeatureId, atVertex );
1033
+ bool result = utils.moveVertex ( p, atFeatureId, atVertex );
1034
+
1035
+ if ( result )
1036
+ updateExtents ();
1037
+ return result;
1027
1038
}
1028
1039
1029
1040
bool QgsVectorLayer::deleteVertex ( QgsFeatureId atFeatureId, int atVertex )
1030
1041
{
1031
1042
QgsVectorLayer::EditResult res = deleteVertexV2 ( atFeatureId, atVertex );
1032
- return res == QgsVectorLayer::Success || res == QgsVectorLayer::EmptyGeometry;
1043
+ bool result = ( res == QgsVectorLayer::Success || res == QgsVectorLayer::EmptyGeometry );
1044
+
1045
+ if ( result )
1046
+ updateExtents ();
1047
+ return result;
1033
1048
}
1034
1049
1035
1050
QgsVectorLayer::EditResult QgsVectorLayer::deleteVertexV2 ( QgsFeatureId featureId, int vertex )
@@ -1038,7 +1053,11 @@ QgsVectorLayer::EditResult QgsVectorLayer::deleteVertexV2( QgsFeatureId featureI
1038
1053
return QgsVectorLayer::InvalidLayer;
1039
1054
1040
1055
QgsVectorLayerEditUtils utils ( this );
1041
- return utils.deleteVertexV2 ( featureId, vertex );
1056
+ EditResult result = utils.deleteVertexV2 ( featureId, vertex );
1057
+
1058
+ if ( result == Success )
1059
+ updateExtents ();
1060
+ return result;
1042
1061
}
1043
1062
1044
1063
@@ -1154,7 +1173,11 @@ int QgsVectorLayer::addPart( const QList<QgsPoint> &points )
1154
1173
}
1155
1174
1156
1175
QgsVectorLayerEditUtils utils ( this );
1157
- return utils.addPart ( points, *mSelectedFeatureIds .constBegin () );
1176
+ int result = utils.addPart ( points, *mSelectedFeatureIds .constBegin () );
1177
+
1178
+ if ( result == 0 )
1179
+ updateExtents ();
1180
+ return result;
1158
1181
}
1159
1182
1160
1183
int QgsVectorLayer::addPart ( const QgsPointSequenceV2 &points )
@@ -1176,7 +1199,11 @@ int QgsVectorLayer::addPart( const QgsPointSequenceV2 &points )
1176
1199
}
1177
1200
1178
1201
QgsVectorLayerEditUtils utils ( this );
1179
- return utils.addPart ( points, *mSelectedFeatureIds .constBegin () );
1202
+ int result = utils.addPart ( points, *mSelectedFeatureIds .constBegin () );
1203
+
1204
+ if ( result == 0 )
1205
+ updateExtents ();
1206
+ return result;
1180
1207
}
1181
1208
1182
1209
int QgsVectorLayer::addPart ( QgsCurveV2* ring )
@@ -1198,7 +1225,11 @@ int QgsVectorLayer::addPart( QgsCurveV2* ring )
1198
1225
}
1199
1226
1200
1227
QgsVectorLayerEditUtils utils ( this );
1201
- return utils.addPart ( ring, *mSelectedFeatureIds .constBegin () );
1228
+ int result = utils.addPart ( ring, *mSelectedFeatureIds .constBegin () );
1229
+
1230
+ if ( result == 0 )
1231
+ updateExtents ();
1232
+ return result;
1202
1233
}
1203
1234
1204
1235
int QgsVectorLayer::translateFeature ( QgsFeatureId featureId, double dx, double dy )
@@ -1207,7 +1238,11 @@ int QgsVectorLayer::translateFeature( QgsFeatureId featureId, double dx, double
1207
1238
return -1 ;
1208
1239
1209
1240
QgsVectorLayerEditUtils utils ( this );
1210
- return utils.translateFeature ( featureId, dx, dy );
1241
+ int result = utils.translateFeature ( featureId, dx, dy );
1242
+
1243
+ if ( result == 0 )
1244
+ updateExtents ();
1245
+ return result;
1211
1246
}
1212
1247
1213
1248
int QgsVectorLayer::splitParts ( const QList<QgsPoint>& splitLine, bool topologicalEditing )
@@ -2093,7 +2128,11 @@ bool QgsVectorLayer::changeGeometry( QgsFeatureId fid, QgsGeometry* geom )
2093
2128
2094
2129
updateExtents ();
2095
2130
2096
- return mEditBuffer ->changeGeometry ( fid, geom );
2131
+ bool result = mEditBuffer ->changeGeometry ( fid, geom );
2132
+
2133
+ if ( result )
2134
+ updateExtents ();
2135
+ return result;
2097
2136
}
2098
2137
2099
2138
@@ -2210,9 +2249,10 @@ bool QgsVectorLayer::deleteFeature( QgsFeatureId fid )
2210
2249
2211
2250
bool res = mEditBuffer ->deleteFeature ( fid );
2212
2251
if ( res )
2252
+ {
2213
2253
mSelectedFeatureIds .remove ( fid ); // remove it from selection
2214
-
2215
- updateExtents ();
2254
+ updateExtents ();
2255
+ }
2216
2256
2217
2257
return res;
2218
2258
}
@@ -2225,9 +2265,10 @@ bool QgsVectorLayer::deleteFeatures( const QgsFeatureIds& fids )
2225
2265
bool res = mEditBuffer ->deleteFeatures ( fids );
2226
2266
2227
2267
if ( res )
2268
+ {
2228
2269
mSelectedFeatureIds .subtract ( fids ); // remove it from selection
2229
-
2230
- updateExtents ();
2270
+ updateExtents ();
2271
+ }
2231
2272
2232
2273
return res;
2233
2274
}
0 commit comments