Skip to content
Permalink
Browse files

Refresh feature after update

  • Loading branch information
m-kuhn committed Sep 6, 2018
1 parent 3557228 commit c55196c6bd09ebe6b8da373cd57a60a2f1257313
@@ -89,13 +89,15 @@ void QgsFeaturePool::insertFeature( const QgsFeature &feature )
mIndex.insertFeature( feature );
}

void QgsFeaturePool::changeFeature( const QgsFeature &feature )
void QgsFeaturePool::refreshCache( const QgsFeature &feature )
{
QgsReadWriteLocker locker( mIndexLock, QgsReadWriteLocker::Write );
mFeatureCache.remove( feature.id() );
mFeatureCache.insert( feature.id(), new QgsFeature( feature ) );
mIndex.deleteFeature( feature );
mIndex.insertFeature( feature );
locker.unlock();

QgsFeature tempFeature;
get( feature.id(), tempFeature );
}

void QgsFeaturePool::removeFeature( const QgsFeatureId featureId )
@@ -117,7 +117,7 @@ class ANALYSIS_EXPORT QgsFeaturePool
* Changes a feature in the cache and the spatial index.
* To be used by implementations of ``updateFeature``.
*/
void changeFeature( const QgsFeature &feature );
void refreshCache( const QgsFeature &feature );

/**
* Removes a feature from the cache and the spatial index.
@@ -110,7 +110,6 @@ void QgsVectorDataProviderFeaturePool::updateFeature( QgsFeature &feature )
}
changedAttributesMap.insert( feature.id(), attribMap );

removeFeature( origFeature.id() );
runOnMainThread( [this, geometryMap, changedAttributesMap]()
{
QgsVectorLayer *lyr = layer();
@@ -121,7 +120,7 @@ void QgsVectorDataProviderFeaturePool::updateFeature( QgsFeature &feature )
}
} );

insertFeature( feature );
refreshCache( feature );
}

void QgsVectorDataProviderFeaturePool::deleteFeature( QgsFeatureId fid )

0 comments on commit c55196c

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