Skip to content

Commit

Permalink
Merge pull request #7845 from m-kuhn/apiCleanup
Browse files Browse the repository at this point in the history
Naming changes for QgsFeaturePool
  • Loading branch information
m-kuhn committed Sep 11, 2018
2 parents fae9256 + 1b4e007 commit 7a5a52b
Show file tree
Hide file tree
Showing 20 changed files with 59 additions and 59 deletions.
8 changes: 4 additions & 4 deletions src/analysis/vector/geometry_checker/qgsfeaturepool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ QgsFeaturePool::QgsFeaturePool( QgsVectorLayer *layer, double layerToMapUnits, c

}

bool QgsFeaturePool::get( QgsFeatureId id, QgsFeature &feature )
bool QgsFeaturePool::getFeature( QgsFeatureId id, QgsFeature &feature )
{
QgsReadWriteLocker locker( mCacheLock, QgsReadWriteLocker::Read );
QgsFeature *cachedFeature = mFeatureCache.object( id );
Expand All @@ -63,7 +63,7 @@ bool QgsFeaturePool::get( QgsFeatureId id, QgsFeature &feature )
return true;
}

QgsFeatureIds QgsFeaturePool::getFeatureIds() const
QgsFeatureIds QgsFeaturePool::allFeatureIds() const
{
return mFeatureIds;
}
Expand Down Expand Up @@ -97,14 +97,14 @@ void QgsFeaturePool::refreshCache( const QgsFeature &feature )
locker.unlock();

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

void QgsFeaturePool::removeFeature( const QgsFeatureId featureId )
{
QgsFeature origFeature;
QgsReadWriteLocker locker( mCacheLock, QgsReadWriteLocker::Unlocked );
if ( get( featureId, origFeature ) )
if ( getFeature( featureId, origFeature ) )
{
locker.changeMode( QgsReadWriteLocker::Write );
mIndex.deleteFeature( origFeature );
Expand Down
4 changes: 2 additions & 2 deletions src/analysis/vector/geometry_checker/qgsfeaturepool.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class ANALYSIS_EXPORT QgsFeaturePool : public QgsFeatureSink
* It will be retrieved from the cache or from the underlying layer if unavailable.
* If the feature is neither available from the cache nor from the layer it will return false.
*/
bool get( QgsFeatureId id, QgsFeature &feature );
bool getFeature( QgsFeatureId id, QgsFeature &feature );

/**
* Updates a feature in this pool.
Expand All @@ -64,7 +64,7 @@ class ANALYSIS_EXPORT QgsFeaturePool : public QgsFeatureSink
* Returns the complete set of feature ids in this pool.
* Note that this concerns the features governed by this pool, which are not necessarily all cached.
*/
QgsFeatureIds getFeatureIds() const;
QgsFeatureIds allFeatureIds() const;

/**
* Get all feature ids in the bounding box \a rect. It will use a spatial index to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void QgsGeometryAngleCheck::fixError( QgsGeometryCheckError *error, int method,
{
QgsFeaturePool *featurePool = mContext->featurePools[ error->layerId() ];
QgsFeature feature;
if ( !featurePool->get( error->featureId(), feature ) )
if ( !featurePool->getFeature( error->featureId(), feature ) )
{
error->setObsolete();
return;
Expand Down
4 changes: 2 additions & 2 deletions src/analysis/vector/geometry_checker/qgsgeometryareacheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void QgsGeometryAreaCheck::fixError( QgsGeometryCheckError *error, int method, c
{
QgsFeaturePool *featurePool = mContext->featurePools[ error->layerId() ];
QgsFeature feature;
if ( !featurePool->get( error->featureId(), feature ) )
if ( !featurePool->getFeature( error->featureId(), feature ) )
{
error->setObsolete();
return;
Expand Down Expand Up @@ -118,7 +118,7 @@ bool QgsGeometryAreaCheck::mergeWithNeighbor( const QString &layerId, QgsFeature
for ( QgsFeatureId testId : intersects )
{
QgsFeature testFeature;
if ( !featurePool->get( testId, testFeature ) )
if ( !featurePool->getFeature( testId, testFeature ) )
{
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/vector/geometry_checker/qgsgeometrycheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ QMap<QString, QgsFeatureIds> QgsGeometryCheck::allLayerFeatureIds() const
QMap<QString, QgsFeatureIds> featureIds;
for ( QgsFeaturePool *pool : mContext->featurePools )
{
featureIds.insert( pool->layerId(), pool->getFeatureIds() );
featureIds.insert( pool->layerId(), pool->allFeatureIds() );
}
return featureIds;
}
Expand Down
4 changes: 2 additions & 2 deletions src/analysis/vector/geometry_checker/qgsgeometrychecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ QFuture<void> QgsGeometryChecker::execute( int *totalSteps )
{
if ( check->checkType() <= QgsGeometryCheck::FeatureCheck )
{
*totalSteps += check->isCompatible( it.value()->layer()->geometryType() ) ? it.value()->getFeatureIds().size() : 0;
*totalSteps += check->isCompatible( it.value()->layer()->geometryType() ) ? it.value()->allFeatureIds().size() : 0;
}
else
{
Expand Down Expand Up @@ -160,7 +160,7 @@ bool QgsGeometryChecker::fixError( QgsGeometryCheckError *error, int method, boo
if ( !removed )
{
QgsFeature f;
if ( featurePool->get( layerChangeIt.key(), f ) )
if ( featurePool->getFeature( layerChangeIt.key(), f ) )
{
recheckFeatures[it.key()].insert( layerChangeIt.key() );
recheckArea.combineExtentWith( t.transformBoundingBox( f.geometry().boundingBox() ) );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ namespace QgsGeometryCheckerUtils
if ( mParent->mProgressCounter )
mParent->mProgressCounter->fetchAndAddRelaxed( 1 );
QgsFeature feature;
if ( featurePool->get( *mFeatureIt, feature ) && feature.geometry() && feature.geometry().constGet() )
if ( featurePool->getFeature( *mFeatureIt, feature ) && feature.geometry() && feature.geometry().constGet() )
{
delete mCurrentFeature;
mCurrentFeature = new LayerFeature( mParent->mFeaturePools[*mLayerIt], feature, mParent->mUseMapCrs );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ void QgsGeometryContainedCheck::fixError( QgsGeometryCheckError *error, int meth

QgsFeature featureA;
QgsFeature featureB;
if ( !featurePoolA->get( error->featureId(), featureA ) ||
!featurePoolB->get( containerError->containingFeature().second, featureB ) )
if ( !featurePoolA->getFeature( error->featureId(), featureA ) ||
!featurePoolB->getFeature( containerError->containingFeature().second, featureB ) )
{
error->setObsolete();
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ void QgsGeometryDegeneratePolygonCheck::fixError( QgsGeometryCheckError *error,
{
QgsFeaturePool *featurePool = mContext->featurePools[ error->layerId() ];
QgsFeature feature;
if ( !featurePool->get( error->featureId(), feature ) )
if ( !featurePool->getFeature( error->featureId(), feature ) )
{
error->setObsolete();
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ void QgsGeometryDuplicateCheck::fixError( QgsGeometryCheckError *error, int meth
{
QgsFeaturePool *featurePoolA = mContext->featurePools[ error->layerId() ];
QgsFeature featureA;
if ( !featurePoolA->get( error->featureId(), featureA ) )
if ( !featurePoolA->getFeature( error->featureId(), featureA ) )
{
error->setObsolete();
return;
Expand All @@ -110,7 +110,7 @@ void QgsGeometryDuplicateCheck::fixError( QgsGeometryCheckError *error, int meth
for ( QgsFeatureId idB : duplicateError->duplicates()[layerIdB] )
{
QgsFeature featureB;
if ( !featurePoolB->get( idB, featureB ) )
if ( !featurePoolB->getFeature( idB, featureB ) )
{
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void QgsGeometryDuplicateNodesCheck::fixError( QgsGeometryCheckError *error, int
{
QgsFeaturePool *featurePool = mContext->featurePools[ error->layerId() ];
QgsFeature feature;
if ( !featurePool->get( error->featureId(), feature ) )
if ( !featurePool->getFeature( error->featureId(), feature ) )
{
error->setObsolete();
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ bool QgsGeometryGapCheck::mergeWithNeighbor( QgsGeometryGapCheckError *err, Chan
for ( QgsFeatureId testId : featureIds )
{
QgsFeature testFeature;
if ( !featurePool->get( testId, testFeature ) )
if ( !featurePool->getFeature( testId, testFeature ) )
{
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void QgsGeometryHoleCheck::fixError( QgsGeometryCheckError *error, int method, c
{
QgsFeaturePool *featurePool = mContext->featurePools[ error->layerId() ];
QgsFeature feature;
if ( !featurePool->get( error->featureId(), feature ) )
if ( !featurePool->getFeature( error->featureId(), feature ) )
{
error->setObsolete();
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ void QgsGeometryMultipartCheck::fixError( QgsGeometryCheckError *error, int meth
{
QgsFeaturePool *featurePool = mContext->featurePools[ error->layerId() ];
QgsFeature feature;
if ( !featurePool->get( error->featureId(), feature ) )
if ( !featurePool->getFeature( error->featureId(), feature ) )
{
error->setObsolete();
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ void QgsGeometryOverlapCheck::fixError( QgsGeometryCheckError *error, int method
QgsFeaturePool *featurePoolB = mContext->featurePools[ overlapError->overlappedFeature().first ];
QgsFeature featureA;
QgsFeature featureB;
if ( !featurePoolA->get( overlapError->featureId(), featureA ) ||
!featurePoolB->get( overlapError->overlappedFeature().second, featureB ) )
if ( !featurePoolA->getFeature( overlapError->featureId(), featureA ) ||
!featurePoolB->getFeature( overlapError->overlappedFeature().second, featureB ) )
{
error->setObsolete();
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void QgsGeometrySegmentLengthCheck::fixError( QgsGeometryCheckError *error, int
{
QgsFeaturePool *featurePool = mContext->featurePools[ error->layerId() ];
QgsFeature feature;
if ( !featurePool->get( error->featureId(), feature ) )
if ( !featurePool->getFeature( error->featureId(), feature ) )
{
error->setObsolete();
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void QgsGeometrySelfIntersectionCheck::fixError( QgsGeometryCheckError *error, i
{
QgsFeaturePool *featurePool = mContext->featurePools[ error->layerId() ];
QgsFeature feature;
if ( !featurePool->get( error->featureId(), feature ) )
if ( !featurePool->getFeature( error->featureId(), feature ) )
{
error->setObsolete();
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void QgsGeometryTypeCheck::fixError( QgsGeometryCheckError *error, int method, c
{
QgsFeaturePool *featurePool = mContext->featurePools[ error->layerId() ];
QgsFeature feature;
if ( !featurePool->get( error->featureId(), feature ) )
if ( !featurePool->getFeature( error->featureId(), feature ) )
{
error->setObsolete();
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ bool QgsVectorDataProviderFeaturePool::addFeatures( QgsFeatureList &features, Qg
void QgsVectorDataProviderFeaturePool::updateFeature( QgsFeature &feature )
{
QgsFeature origFeature;
get( feature.id(), origFeature );
getFeature( feature.id(), origFeature );

QgsGeometryMap geometryMap;
geometryMap.insert( feature.id(), feature.geometry() );
Expand Down

0 comments on commit 7a5a52b

Please sign in to comment.