@@ -1002,7 +1002,10 @@ bool QgsVectorLayer::insertVertex( double x, double y, QgsFeatureId atFeatureId,
1002
1002
return false ;
1003
1003
1004
1004
QgsVectorLayerEditUtils utils ( this );
1005
- return utils.insertVertex ( x, y, atFeatureId, beforeVertex );
1005
+ bool result = utils.insertVertex ( x, y, atFeatureId, beforeVertex );
1006
+ if ( result )
1007
+ updateExtents ();
1008
+ return result;
1006
1009
}
1007
1010
1008
1011
@@ -1012,7 +1015,11 @@ bool QgsVectorLayer::moveVertex( double x, double y, QgsFeatureId atFeatureId, i
1012
1015
return false ;
1013
1016
1014
1017
QgsVectorLayerEditUtils utils ( this );
1015
- return utils.moveVertex ( x, y, atFeatureId, atVertex );
1018
+ bool result = utils.moveVertex ( x, y, atFeatureId, atVertex );
1019
+
1020
+ if ( result )
1021
+ updateExtents ();
1022
+ return result;
1016
1023
}
1017
1024
1018
1025
bool QgsVectorLayer::moveVertex ( const QgsPointV2& p, QgsFeatureId atFeatureId, int atVertex )
@@ -1021,13 +1028,21 @@ bool QgsVectorLayer::moveVertex( const QgsPointV2& p, QgsFeatureId atFeatureId,
1021
1028
return false ;
1022
1029
1023
1030
QgsVectorLayerEditUtils utils ( this );
1024
- return utils.moveVertex ( p, atFeatureId, atVertex );
1031
+ bool result = utils.moveVertex ( p, atFeatureId, atVertex );
1032
+
1033
+ if ( result )
1034
+ updateExtents ();
1035
+ return result;
1025
1036
}
1026
1037
1027
1038
bool QgsVectorLayer::deleteVertex ( QgsFeatureId atFeatureId, int atVertex )
1028
1039
{
1029
1040
QgsVectorLayer::EditResult res = deleteVertexV2 ( atFeatureId, atVertex );
1030
- return res == QgsVectorLayer::Success || res == QgsVectorLayer::EmptyGeometry;
1041
+ bool result = ( res == QgsVectorLayer::Success || res == QgsVectorLayer::EmptyGeometry );
1042
+
1043
+ if ( result )
1044
+ updateExtents ();
1045
+ return result;
1031
1046
}
1032
1047
1033
1048
QgsVectorLayer::EditResult QgsVectorLayer::deleteVertexV2 ( QgsFeatureId featureId, int vertex )
@@ -1036,7 +1051,11 @@ QgsVectorLayer::EditResult QgsVectorLayer::deleteVertexV2( QgsFeatureId featureI
1036
1051
return QgsVectorLayer::InvalidLayer;
1037
1052
1038
1053
QgsVectorLayerEditUtils utils ( this );
1039
- return utils.deleteVertexV2 ( featureId, vertex );
1054
+ EditResult result = utils.deleteVertexV2 ( featureId, vertex );
1055
+
1056
+ if ( result == Success )
1057
+ updateExtents ();
1058
+ return result;
1040
1059
}
1041
1060
1042
1061
@@ -1152,7 +1171,11 @@ int QgsVectorLayer::addPart( const QList<QgsPoint> &points )
1152
1171
}
1153
1172
1154
1173
QgsVectorLayerEditUtils utils ( this );
1155
- return utils.addPart ( points, *mSelectedFeatureIds .constBegin () );
1174
+ int result = utils.addPart ( points, *mSelectedFeatureIds .constBegin () );
1175
+
1176
+ if ( result == 0 )
1177
+ updateExtents ();
1178
+ return result;
1156
1179
}
1157
1180
1158
1181
int QgsVectorLayer::addPart ( const QgsPointSequenceV2 &points )
@@ -1174,7 +1197,11 @@ int QgsVectorLayer::addPart( const QgsPointSequenceV2 &points )
1174
1197
}
1175
1198
1176
1199
QgsVectorLayerEditUtils utils ( this );
1177
- return utils.addPart ( points, *mSelectedFeatureIds .constBegin () );
1200
+ int result = utils.addPart ( points, *mSelectedFeatureIds .constBegin () );
1201
+
1202
+ if ( result == 0 )
1203
+ updateExtents ();
1204
+ return result;
1178
1205
}
1179
1206
1180
1207
int QgsVectorLayer::addPart ( QgsCurveV2* ring )
@@ -1196,7 +1223,11 @@ int QgsVectorLayer::addPart( QgsCurveV2* ring )
1196
1223
}
1197
1224
1198
1225
QgsVectorLayerEditUtils utils ( this );
1199
- return utils.addPart ( ring, *mSelectedFeatureIds .constBegin () );
1226
+ int result = utils.addPart ( ring, *mSelectedFeatureIds .constBegin () );
1227
+
1228
+ if ( result == 0 )
1229
+ updateExtents ();
1230
+ return result;
1200
1231
}
1201
1232
1202
1233
int QgsVectorLayer::translateFeature ( QgsFeatureId featureId, double dx, double dy )
@@ -1205,7 +1236,11 @@ int QgsVectorLayer::translateFeature( QgsFeatureId featureId, double dx, double
1205
1236
return -1 ;
1206
1237
1207
1238
QgsVectorLayerEditUtils utils ( this );
1208
- return utils.translateFeature ( featureId, dx, dy );
1239
+ int result = utils.translateFeature ( featureId, dx, dy );
1240
+
1241
+ if ( result == 0 )
1242
+ updateExtents ();
1243
+ return result;
1209
1244
}
1210
1245
1211
1246
int QgsVectorLayer::splitParts ( const QList<QgsPoint>& splitLine, bool topologicalEditing )
@@ -2098,7 +2133,11 @@ bool QgsVectorLayer::changeGeometry( QgsFeatureId fid, QgsGeometry* geom )
2098
2133
2099
2134
updateExtents ();
2100
2135
2101
- return mEditBuffer ->changeGeometry ( fid, geom );
2136
+ bool result = mEditBuffer ->changeGeometry ( fid, geom );
2137
+
2138
+ if ( result )
2139
+ updateExtents ();
2140
+ return result;
2102
2141
}
2103
2142
2104
2143
@@ -2215,9 +2254,10 @@ bool QgsVectorLayer::deleteFeature( QgsFeatureId fid )
2215
2254
2216
2255
bool res = mEditBuffer ->deleteFeature ( fid );
2217
2256
if ( res )
2257
+ {
2218
2258
mSelectedFeatureIds .remove ( fid ); // remove it from selection
2219
-
2220
- updateExtents ();
2259
+ updateExtents ();
2260
+ }
2221
2261
2222
2262
return res;
2223
2263
}
@@ -2230,9 +2270,10 @@ bool QgsVectorLayer::deleteFeatures( const QgsFeatureIds& fids )
2230
2270
bool res = mEditBuffer ->deleteFeatures ( fids );
2231
2271
2232
2272
if ( res )
2273
+ {
2233
2274
mSelectedFeatureIds .subtract ( fids ); // remove it from selection
2234
-
2235
- updateExtents ();
2275
+ updateExtents ();
2276
+ }
2236
2277
2237
2278
return res;
2238
2279
}
1 commit comments
nirvn commentedon Mar 29, 2016
Thanks