Skip to content

Commit

Permalink
[vectorlayer] Update map extent when feature added / geom changed
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Jun 18, 2013
1 parent 6eb3188 commit d91f36d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/core/qgsvectorlayer.cpp
Expand Up @@ -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 )
Expand Down Expand Up @@ -2436,6 +2441,8 @@ bool QgsVectorLayer::changeGeometry( QgsFeatureId fid, QgsGeometry* geom )
}

return mEditBuffer->changeGeometry( fid, geom );

updateExtents();
}


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

updateExtents();

return res;
}

Expand Down

3 comments on commit d91f36d

@vinayan
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@NathanW2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@m-kuhn
Copy link
Member Author

@m-kuhn m-kuhn commented on d91f36d Jun 19, 2013 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.