Skip to content
Permalink
Browse files

[vectorlayer] Update map extent when feature added / geom changed

  • Loading branch information
m-kuhn committed Jun 18, 2013
1 parent 6eb3188 commit d91f36d159957281dcbd806f5ec2ca9b0fc1405f
Showing with 10 additions and 1 deletion.
  1. +10 −1 src/core/qgsvectorlayer.cpp
@@ -1236,7 +1236,12 @@ bool QgsVectorLayer::addFeature( QgsFeature& f, bool alsoUpdateExtent )
if ( !mEditBuffer || !mDataProvider )
return false;

return mEditBuffer->addFeature( f );
bool success = mEditBuffer->addFeature( f );

if ( success )
updateExtents();

return success;
}

bool QgsVectorLayer::updateFeature( QgsFeature &f )
@@ -2436,6 +2441,8 @@ bool QgsVectorLayer::changeGeometry( QgsFeatureId fid, QgsGeometry* geom )
}

return mEditBuffer->changeGeometry( fid, geom );

updateExtents();
}


@@ -2717,6 +2724,8 @@ bool QgsVectorLayer::addFeatures( QgsFeatureList features, bool makeSelected )
setSelectedFeatures( ids );
}

updateExtents();

return res;
}

3 comments on commit d91f36d

@vinayan

This comment has been minimized.

Copy link
Contributor

@vinayan vinayan replied Jun 19, 2013

isn't it too costly to update on every feature change?

@NathanW2

This comment has been minimized.

Copy link
Member

@NathanW2 NathanW2 replied Jun 19, 2013

I agree on a large layer this could have massive impacts.

@m-kuhn

This comment has been minimized.

Copy link
Member Author

@m-kuhn m-kuhn replied Jun 19, 2013

Please sign in to comment.
You can’t perform that action at this time.