Skip to content
Permalink
Browse files

Merge pull request #7845 from m-kuhn/apiCleanup

Naming changes for QgsFeaturePool
  • Loading branch information
m-kuhn committed Sep 11, 2018
2 parents fae9256 + 1b4e007 commit 7a5a52b1623f51570d65dd139266220619632714
Showing with 59 additions and 59 deletions.
  1. +4 −4 src/analysis/vector/geometry_checker/qgsfeaturepool.cpp
  2. +2 −2 src/analysis/vector/geometry_checker/qgsfeaturepool.h
  3. +1 −1 src/analysis/vector/geometry_checker/qgsgeometryanglecheck.cpp
  4. +2 −2 src/analysis/vector/geometry_checker/qgsgeometryareacheck.cpp
  5. +1 −1 src/analysis/vector/geometry_checker/qgsgeometrycheck.cpp
  6. +2 −2 src/analysis/vector/geometry_checker/qgsgeometrychecker.cpp
  7. +1 −1 src/analysis/vector/geometry_checker/qgsgeometrycheckerutils.cpp
  8. +2 −2 src/analysis/vector/geometry_checker/qgsgeometrycontainedcheck.cpp
  9. +1 −1 src/analysis/vector/geometry_checker/qgsgeometrydegeneratepolygoncheck.cpp
  10. +2 −2 src/analysis/vector/geometry_checker/qgsgeometryduplicatecheck.cpp
  11. +1 −1 src/analysis/vector/geometry_checker/qgsgeometryduplicatenodescheck.cpp
  12. +1 −1 src/analysis/vector/geometry_checker/qgsgeometrygapcheck.cpp
  13. +1 −1 src/analysis/vector/geometry_checker/qgsgeometryholecheck.cpp
  14. +1 −1 src/analysis/vector/geometry_checker/qgsgeometrymultipartcheck.cpp
  15. +2 −2 src/analysis/vector/geometry_checker/qgsgeometryoverlapcheck.cpp
  16. +1 −1 src/analysis/vector/geometry_checker/qgsgeometrysegmentlengthcheck.cpp
  17. +1 −1 src/analysis/vector/geometry_checker/qgsgeometryselfintersectioncheck.cpp
  18. +1 −1 src/analysis/vector/geometry_checker/qgsgeometrytypecheck.cpp
  19. +1 −1 src/analysis/vector/geometry_checker/qgsvectordataproviderfeaturepool.cpp
  20. +31 −31 tests/src/geometry_checker/testqgsgeometrychecks.cpp
@@ -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 );
@@ -63,7 +63,7 @@ bool QgsFeaturePool::get( QgsFeatureId id, QgsFeature &feature )
return true;
}

QgsFeatureIds QgsFeaturePool::getFeatureIds() const
QgsFeatureIds QgsFeaturePool::allFeatureIds() const
{
return mFeatureIds;
}
@@ -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 );
@@ -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.
@@ -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
@@ -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;
@@ -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;
@@ -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;
}
@@ -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;
}
@@ -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
{
@@ -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() ) );
@@ -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 );
@@ -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;
@@ -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;
@@ -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;
@@ -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;
}
@@ -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;
@@ -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;
}
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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() );

0 comments on commit 7a5a52b

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