Skip to content
Permalink
Browse files

Rename transform methods for clarity

  • Loading branch information
nyalldawson committed Jun 8, 2017
1 parent 1a418f5 commit 7d847bf34a02de586f7c831006fc27e1f35d4a0f
@@ -102,7 +102,7 @@ end of iterating: free the resources / lock
:rtype: bool
%End

void transformFeatureGeometry( QgsFeature &feature, const QgsCoordinateTransform &transform ) const;
void geometryToDestinationCrs( QgsFeature &feature, const QgsCoordinateTransform &transform ) const;
%Docstring
Transforms ``feature``'s geometry according to the specified coordinate ``transform``.
If ``feature`` has no geometry or ``transform`` is invalid then calling this method
@@ -113,7 +113,7 @@ end of iterating: free the resources / lock
%End


QgsRectangle transformedFilterRect( const QgsCoordinateTransform &transform ) const;
QgsRectangle filterRectToSourceCrs( const QgsCoordinateTransform &transform ) const;
%Docstring
Returns a rectangle representing the original request's QgsFeatureRequest.filterRect().
If ``transform`` is a valid coordinate transform, the return rectangle will represent
@@ -31,7 +31,7 @@ QgsMemoryFeatureIterator::QgsMemoryFeatureIterator( QgsMemoryFeatureSource *sour
{
mTransform = QgsCoordinateTransform( mSource->mCrs, mRequest.destinationCrs() );
}
mFilterRect = transformedFilterRect( mTransform );
mFilterRect = filterRectToSourceCrs( mTransform );

if ( !mSource->mSubsetString.isEmpty() )
{
@@ -132,7 +132,7 @@ bool QgsMemoryFeatureIterator::nextFeatureUsingList( QgsFeature &feature )
if ( hasFeature )
{
feature.setFields( mSource->mFields ); // allow name-based attribute lookups
transformFeatureGeometry( feature, mTransform );
geometryToDestinationCrs( feature, mTransform );
}

return hasFeature;
@@ -187,7 +187,7 @@ bool QgsMemoryFeatureIterator::nextFeatureTraverseAll( QgsFeature &feature )
++mSelectIterator;
feature.setValid( true );
feature.setFields( mSource->mFields ); // allow name-based attribute lookups
transformFeatureGeometry( feature, mTransform );
geometryToDestinationCrs( feature, mTransform );
}
else
close();
@@ -24,7 +24,7 @@ QgsCachedFeatureIterator::QgsCachedFeatureIterator( QgsVectorLayerCache *vlCache
{
mTransform = QgsCoordinateTransform( mVectorLayerCache->sourceCrs(), mRequest.destinationCrs() );
}
mFilterRect = transformedFilterRect( mTransform );
mFilterRect = filterRectToSourceCrs( mTransform );
if ( !mFilterRect.isNull() )
{
// update request to be the unprojected filter rect
@@ -72,7 +72,7 @@ bool QgsCachedFeatureIterator::fetchFeature( QgsFeature &f )
if ( mRequest.acceptFeature( f ) )
{
f.setValid( true );
transformFeatureGeometry( f, mTransform );
geometryToDestinationCrs( f, mTransform );
return true;
}
}
@@ -101,7 +101,7 @@ QgsCachedFeatureWriterIterator::QgsCachedFeatureWriterIterator( QgsVectorLayerCa
{
mTransform = QgsCoordinateTransform( mVectorLayerCache->sourceCrs(), mRequest.destinationCrs() );
}
mFilterRect = transformedFilterRect( mTransform );
mFilterRect = filterRectToSourceCrs( mTransform );
if ( !mFilterRect.isNull() )
{
// update request to be the unprojected filter rect
@@ -123,7 +123,7 @@ bool QgsCachedFeatureWriterIterator::fetchFeature( QgsFeature &f )
// As long as features can be fetched from the provider: Write them to cache
mVectorLayerCache->cacheFeature( f );
mFids.insert( f.id() );
transformFeatureGeometry( f, mTransform );
geometryToDestinationCrs( f, mTransform );
return true;
}
else
@@ -98,7 +98,7 @@ bool QgsAbstractFeatureIterator::nextFeatureFilterFids( QgsFeature &f )
return false;
}

void QgsAbstractFeatureIterator::transformFeatureGeometry( QgsFeature &feature, const QgsCoordinateTransform &transform ) const
void QgsAbstractFeatureIterator::geometryToDestinationCrs( QgsFeature &feature, const QgsCoordinateTransform &transform ) const
{
if ( transform.isValid() && feature.hasGeometry() )
{
@@ -119,7 +119,7 @@ void QgsAbstractFeatureIterator::transformFeatureGeometry( QgsFeature &feature,
}
}

QgsRectangle QgsAbstractFeatureIterator::transformedFilterRect( const QgsCoordinateTransform &transform ) const
QgsRectangle QgsAbstractFeatureIterator::filterRectToSourceCrs( const QgsCoordinateTransform &transform ) const
{
if ( mRequest.filterRect().isNull() )
return QgsRectangle();
@@ -122,7 +122,7 @@ class CORE_EXPORT QgsAbstractFeatureIterator
* QgsFeatureRequest::destinationCrs() set on the request is respected.
* \since QGIS 3.0
*/
void transformFeatureGeometry( QgsFeature &feature, const QgsCoordinateTransform &transform ) const;
void geometryToDestinationCrs( QgsFeature &feature, const QgsCoordinateTransform &transform ) const;


/**
@@ -133,7 +133,7 @@ class CORE_EXPORT QgsAbstractFeatureIterator
* features to ensure that any QgsFeatureRequest::destinationCrs() set on the request is respected.
* \since QGIS 3.0
*/
QgsRectangle transformedFilterRect( const QgsCoordinateTransform &transform ) const;
QgsRectangle filterRectToSourceCrs( const QgsCoordinateTransform &transform ) const;

//! A copy of the feature request.
QgsFeatureRequest mRequest;
@@ -113,7 +113,7 @@ QgsVectorLayerFeatureIterator::QgsVectorLayerFeatureIterator( QgsVectorLayerFeat
{
mTransform = QgsCoordinateTransform( mSource->mCrs, mRequest.destinationCrs() );
}
mFilterRect = transformedFilterRect( mTransform );
mFilterRect = filterRectToSourceCrs( mTransform );
if ( !mFilterRect.isNull() )
{
// update request to be the unprojected filter rect
@@ -717,7 +717,7 @@ bool QgsVectorLayerFeatureIterator::postProcessFeature( QgsFeature &feature )
{
bool result = checkGeometryValidity( feature );
if ( result )
transformFeatureGeometry( feature, mTransform );
geometryToDestinationCrs( feature, mTransform );
return result;
}

@@ -45,7 +45,7 @@ QgsAfsFeatureIterator::QgsAfsFeatureIterator( QgsAfsFeatureSource *source, bool
{
mTransform = QgsCoordinateTransform( mSource->mCrs, mRequest.destinationCrs() );
}
mFilterRect = transformedFilterRect( mTransform );
mFilterRect = filterRectToSourceCrs( mTransform );
}

QgsAfsFeatureIterator::~QgsAfsFeatureIterator()
@@ -74,7 +74,7 @@ bool QgsAfsFeatureIterator::fetchFeature( QgsFeature &f )
if ( mRequest.filterType() == QgsFeatureRequest::FilterFid )
{
bool result = mSource->provider()->getFeature( mRequest.filterFid(), f, fetchGeometries, fetchAttribures );
transformFeatureGeometry( f, mTransform );
geometryToDestinationCrs( f, mTransform );
return result;
}
else
@@ -88,7 +88,7 @@ bool QgsAfsFeatureIterator::fetchFeature( QgsFeature &f )
++mFeatureIterator;
if ( !success )
continue;
transformFeatureGeometry( f, mTransform );
geometryToDestinationCrs( f, mTransform );
return true;
}
}
@@ -37,7 +37,7 @@ QgsDb2FeatureIterator::QgsDb2FeatureIterator( QgsDb2FeatureSource *source, bool
{
mTransform = QgsCoordinateTransform( mSource->mCrs, mRequest.destinationCrs() );
}
mFilterRect = transformedFilterRect( mTransform );
mFilterRect = filterRectToSourceCrs( mTransform );

BuildStatement( request );

@@ -378,7 +378,7 @@ bool QgsDb2FeatureIterator::fetchFeature( QgsFeature &feature )
}
feature.setValid( true );
mFetchCount++;
transformFeatureGeometry( feature, mTransform );
geometryToDestinationCrs( feature, mTransform );
if ( mFetchCount % 100 == 0 )
{
QgsDebugMsg( QString( "Fetch count: %1" ).arg( mFetchCount ) );
@@ -43,7 +43,7 @@ QgsDelimitedTextFeatureIterator::QgsDelimitedTextFeatureIterator( QgsDelimitedTe
{
mTransform = QgsCoordinateTransform( mSource->mCrs, mRequest.destinationCrs() );
}
mFilterRect = transformedFilterRect( mTransform );
mFilterRect = filterRectToSourceCrs( mTransform );

if ( !mFilterRect.isNull() && hasGeometry )
{
@@ -216,7 +216,7 @@ bool QgsDelimitedTextFeatureIterator::fetchFeature( QgsFeature &feature )

if ( ! gotFeature ) close();

transformFeatureGeometry( feature, mTransform );
geometryToDestinationCrs( feature, mTransform );

return gotFeature;
}
@@ -32,7 +32,7 @@ QgsGPXFeatureIterator::QgsGPXFeatureIterator( QgsGPXFeatureSource *source, bool
{
mTransform = QgsCoordinateTransform( mSource->mCrs, mRequest.destinationCrs() );
}
mFilterRect = transformedFilterRect( mTransform );
mFilterRect = filterRectToSourceCrs( mTransform );

rewind();
}
@@ -87,7 +87,7 @@ bool QgsGPXFeatureIterator::fetchFeature( QgsFeature &feature )
bool res = readFid( feature );
close();
if ( res )
transformFeatureGeometry( feature, mTransform );
geometryToDestinationCrs( feature, mTransform );
return res;
}

@@ -100,7 +100,7 @@ bool QgsGPXFeatureIterator::fetchFeature( QgsFeature &feature )
if ( readWaypoint( *mWptIter, feature ) )
{
++mWptIter;
transformFeatureGeometry( feature, mTransform );
geometryToDestinationCrs( feature, mTransform );
return true;
}
}
@@ -114,7 +114,7 @@ bool QgsGPXFeatureIterator::fetchFeature( QgsFeature &feature )
if ( readRoute( *mRteIter, feature ) )
{
++mRteIter;
transformFeatureGeometry( feature, mTransform );
geometryToDestinationCrs( feature, mTransform );
return true;
}
}
@@ -128,7 +128,7 @@ bool QgsGPXFeatureIterator::fetchFeature( QgsFeature &feature )
if ( readTrack( *mTrkIter, feature ) )
{
++mTrkIter;
transformFeatureGeometry( feature, mTransform );
geometryToDestinationCrs( feature, mTransform );
return true;
}
}
@@ -37,7 +37,7 @@ QgsMssqlFeatureIterator::QgsMssqlFeatureIterator( QgsMssqlFeatureSource *source,
{
mTransform = QgsCoordinateTransform( mSource->mCrs, mRequest.destinationCrs() );
}
mFilterRect = transformedFilterRect( mTransform );
mFilterRect = filterRectToSourceCrs( mTransform );

BuildStatement( request );

@@ -330,7 +330,7 @@ bool QgsMssqlFeatureIterator::fetchFeature( QgsFeature &feature )
}

feature.setValid( true );
transformFeatureGeometry( feature, mTransform );
geometryToDestinationCrs( feature, mTransform );
return true;
}
return false;
@@ -80,7 +80,7 @@ QgsOgrFeatureIterator::QgsOgrFeatureIterator( QgsOgrFeatureSource *source, bool
{
mTransform = QgsCoordinateTransform( mSource->mCrs, mRequest.destinationCrs() );
}
mFilterRect = transformedFilterRect( mTransform );
mFilterRect = filterRectToSourceCrs( mTransform );

mFetchGeometry = ( !mFilterRect.isNull() ) || !( mRequest.flags() & QgsFeatureRequest::NoGeometry );
QgsAttributeList attrs = ( mRequest.flags() & QgsFeatureRequest::SubsetOfAttributes ) ? mRequest.subsetOfAttributes() : mSource->mFields.allAttributesList();
@@ -197,7 +197,7 @@ bool QgsOgrFeatureIterator::fetchFeatureWithId( QgsFeatureId id, QgsFeature &fea
OGR_F_Destroy( fet );

feature.setValid( true );
transformFeatureGeometry( feature, mTransform );
geometryToDestinationCrs( feature, mTransform );
return true;
}

@@ -242,7 +242,7 @@ bool QgsOgrFeatureIterator::fetchFeature( QgsFeature &feature )

// we have a feature, end this cycle
feature.setValid( true );
transformFeatureGeometry( feature, mTransform );
geometryToDestinationCrs( feature, mTransform );
return true;

} // while
@@ -42,7 +42,7 @@ QgsOracleFeatureIterator::QgsOracleFeatureIterator( QgsOracleFeatureSource *sour
{
mTransform = QgsCoordinateTransform( mSource->mCrs, mRequest.destinationCrs() );
}
mFilterRect = transformedFilterRect( mTransform );
mFilterRect = filterRectToSourceCrs( mTransform );

QVariantList args;
mQry = QSqlQuery( *mConnection );
@@ -400,7 +400,7 @@ bool QgsOracleFeatureIterator::fetchFeature( QgsFeature &feature )
feature.setValid( true );
feature.setFields( mSource->mFields ); // allow name-based attribute lookups

transformFeatureGeometry( feature, mTransform );
geometryToDestinationCrs( feature, mTransform );

return true;
}
@@ -57,7 +57,7 @@ QgsPostgresFeatureIterator::QgsPostgresFeatureIterator( QgsPostgresFeatureSource
{
mTransform = QgsCoordinateTransform( mSource->mCrs, mRequest.destinationCrs() );
}
mFilterRect = transformedFilterRect( mTransform );
mFilterRect = filterRectToSourceCrs( mTransform );

mCursorName = mConn->uniqueCursorName();
QString whereClause;
@@ -303,7 +303,7 @@ bool QgsPostgresFeatureIterator::fetchFeature( QgsFeature &feature )

feature.setValid( true );
feature.setFields( mSource->mFields ); // allow name-based attribute lookups
transformFeatureGeometry( feature, mTransform );
geometryToDestinationCrs( feature, mTransform );

return true;
}
@@ -47,7 +47,7 @@ QgsSpatiaLiteFeatureIterator::QgsSpatiaLiteFeatureIterator( QgsSpatiaLiteFeature
{
mTransform = QgsCoordinateTransform( mSource->mCrs, mRequest.destinationCrs() );
}
mFilterRect = transformedFilterRect( mTransform );
mFilterRect = filterRectToSourceCrs( mTransform );

//beware - limitAtProvider needs to be set to false if the request cannot be completely handled
//by the provider (e.g., utilising QGIS expression filters)
@@ -239,7 +239,7 @@ bool QgsSpatiaLiteFeatureIterator::fetchFeature( QgsFeature &feature )
}

feature.setValid( true );
transformFeatureGeometry( feature, mTransform );
geometryToDestinationCrs( feature, mTransform );
return true;
}

@@ -46,7 +46,7 @@ QgsVirtualLayerFeatureIterator::QgsVirtualLayerFeatureIterator( QgsVirtualLayerF
{
mTransform = QgsCoordinateTransform( mSource->mCrs, mRequest.destinationCrs() );
}
mFilterRect = transformedFilterRect( mTransform );
mFilterRect = filterRectToSourceCrs( mTransform );

try
{
@@ -266,7 +266,7 @@ bool QgsVirtualLayerFeatureIterator::fetchFeature( QgsFeature &feature )
}

feature.setValid( true );
transformFeatureGeometry( feature, mTransform );
geometryToDestinationCrs( feature, mTransform );
return true;
}

@@ -793,7 +793,7 @@ QgsWFSFeatureIterator::QgsWFSFeatureIterator( QgsWFSFeatureSource *source,
{
mTransform = QgsCoordinateTransform( mSource->mCrs, mRequest.destinationCrs() );
}
mFilterRect = transformedFilterRect( mTransform );
mFilterRect = filterRectToSourceCrs( mTransform );

// Configurable for the purpose of unit tests
QString threshold( getenv( "QGIS_WFS_ITERATOR_TRANSFER_THRESHOLD" ) );
@@ -1051,7 +1051,7 @@ bool QgsWFSFeatureIterator::fetchFeature( QgsFeature &f )
}

copyFeature( cachedFeature, f );
transformFeatureGeometry( f, mTransform );
geometryToDestinationCrs( f, mTransform );
return true;
}

0 comments on commit 7d847bf

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