@@ -35,12 +35,6 @@ bool QgsAfsSharedData::getFeature( QgsFeatureId id, QgsFeature &f, bool fetchGeo
35
35
return filterRect.isNull () || ( f.hasGeometry () && f.geometry ().intersects ( filterRect ) );
36
36
}
37
37
38
- // Determine attributes to fetch
39
- /* QStringList fetchAttribNames;
40
- foreach ( int idx, fetchAttributes )
41
- fetchAttribNames.append( mFields.at( idx ).name() );
42
- */
43
-
44
38
// When fetching from server, fetch all attributes and geometry by default so that we can cache them
45
39
QStringList fetchAttribNames;
46
40
QList<int > fetchAttribIdx;
@@ -65,33 +59,33 @@ bool QgsAfsSharedData::getFeature( QgsFeatureId id, QgsFeature &f, bool fetchGeo
65
59
66
60
// Query
67
61
QString errorTitle, errorMessage;
68
- QVariantMap queryData = QgsArcGisRestUtils::getObjects (
69
- mDataSource .param ( QStringLiteral ( " url" ) ), objectIds, mDataSource .param ( QStringLiteral ( " crs" ) ), fetchGeometry,
70
- fetchAttribNames, QgsWkbTypes::hasM ( mGeometryType ), QgsWkbTypes::hasZ ( mGeometryType ),
71
- filterRect, errorTitle, errorMessage );
62
+ const QVariantMap queryData = QgsArcGisRestUtils::getObjects (
63
+ mDataSource .param ( QStringLiteral ( " url" ) ), objectIds, mDataSource .param ( QStringLiteral ( " crs" ) ), fetchGeometry,
64
+ fetchAttribNames, QgsWkbTypes::hasM ( mGeometryType ), QgsWkbTypes::hasZ ( mGeometryType ),
65
+ filterRect, errorTitle, errorMessage );
72
66
if ( queryData.isEmpty () )
73
67
{
74
68
// const_cast<QgsAfsProvider *>( this )->pushError( errorTitle + ": " + errorMessage );
75
69
QgsDebugMsg ( " Query returned empty result" );
76
70
return false ;
77
71
}
78
72
79
- QVariantList featuresData = queryData[QStringLiteral ( " features" )].toList ();
73
+ const QVariantList featuresData = queryData[QStringLiteral ( " features" )].toList ();
80
74
if ( featuresData.isEmpty () )
81
75
{
82
76
QgsDebugMsgLevel ( " Query returned no features" , 3 );
83
77
return false ;
84
78
}
85
79
for ( int i = 0 , n = featuresData.size (); i < n; ++i )
86
80
{
87
- QVariantMap featureData = featuresData[i].toMap ();
81
+ const QVariantMap featureData = featuresData[i].toMap ();
88
82
QgsFeature feature;
89
83
int featureId = startId + i;
90
84
91
85
// Set attributes
92
86
if ( !fetchAttribIdx.isEmpty () )
93
87
{
94
- QVariantMap attributesData = featureData[QStringLiteral ( " attributes" )].toMap ();
88
+ const QVariantMap attributesData = featureData[QStringLiteral ( " attributes" )].toMap ();
95
89
feature.setFields ( mFields );
96
90
QgsAttributes attributes ( mFields .size () );
97
91
foreach ( int idx, fetchAttribIdx )
@@ -111,7 +105,7 @@ bool QgsAfsSharedData::getFeature( QgsFeatureId id, QgsFeature &f, bool fetchGeo
111
105
// Set geometry
112
106
if ( fetchGeometry )
113
107
{
114
- QVariantMap geometryData = featureData[QStringLiteral ( " geometry" )].toMap ();
108
+ const QVariantMap geometryData = featureData[QStringLiteral ( " geometry" )].toMap ();
115
109
QgsAbstractGeometry *geometry = QgsArcGisRestUtils::parseEsriGeoJSON ( geometryData, queryData[QStringLiteral ( " geometryType" )].toString (),
116
110
QgsWkbTypes::hasM ( mGeometryType ), QgsWkbTypes::hasZ ( mGeometryType ) );
117
111
// Above might return 0, which is OK since in theory empty geometries are allowed
0 commit comments