mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
[ArcGIS REST] fix caching logic for extent filtered requests
This commit is contained in:
parent
d2369425c6
commit
f32791ee21
@ -32,7 +32,7 @@ bool QgsAfsSharedData::getFeature( QgsFeatureId id, QgsFeature &f, bool fetchGeo
|
||||
if ( it != mCache.constEnd() )
|
||||
{
|
||||
f = it.value();
|
||||
return filterRect.isNull() || f.geometry().intersects( filterRect );
|
||||
return filterRect.isNull() || ( f.hasGeometry() && f.geometry().intersects( filterRect ) );
|
||||
}
|
||||
|
||||
// Determine attributes to fetch
|
||||
@ -86,9 +86,7 @@ bool QgsAfsSharedData::getFeature( QgsFeatureId id, QgsFeature &f, bool fetchGeo
|
||||
{
|
||||
QVariantMap featureData = featuresData[i].toMap();
|
||||
QgsFeature feature;
|
||||
|
||||
// Set FID
|
||||
feature.setId( startId + i );
|
||||
int objectId = startId + i;
|
||||
|
||||
// Set attributes
|
||||
if ( !fetchAttribIdx.isEmpty() )
|
||||
@ -99,10 +97,17 @@ bool QgsAfsSharedData::getFeature( QgsFeatureId id, QgsFeature &f, bool fetchGeo
|
||||
foreach ( int idx, fetchAttribIdx )
|
||||
{
|
||||
attributes[idx] = attributesData[mFields.at( idx ).name()];
|
||||
if ( mFields.at( idx ).name() == QStringLiteral( "OBJECTID" ) )
|
||||
{
|
||||
objectId = attributesData[mFields.at( idx ).name()].toInt();
|
||||
}
|
||||
}
|
||||
feature.setAttributes( attributes );
|
||||
}
|
||||
|
||||
// Set FID
|
||||
feature.setId( startId + objectIds.indexOf( objectId ) );
|
||||
|
||||
// Set geometry
|
||||
if ( fetchGeometry )
|
||||
{
|
||||
@ -115,7 +120,14 @@ bool QgsAfsSharedData::getFeature( QgsFeatureId id, QgsFeature &f, bool fetchGeo
|
||||
feature.setValid( true );
|
||||
mCache.insert( feature.id(), feature );
|
||||
}
|
||||
f = mCache[id];
|
||||
Q_ASSERT( f.isValid() );
|
||||
return filterRect.isNull() || ( f.hasGeometry() && f.geometry().intersects( filterRect ) );
|
||||
|
||||
// If added to cache, return feature
|
||||
it = mCache.constFind( id );
|
||||
if ( it != mCache.constEnd() )
|
||||
{
|
||||
f = it.value();
|
||||
return filterRect.isNull() || ( f.hasGeometry() && f.geometry().intersects( filterRect ) );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user