File tree 3 files changed +18
-2
lines changed
3 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -171,6 +171,11 @@ const QgsAttributeMap& QgsFeature::attributeMap() const
171
171
return mAttributes ;
172
172
}
173
173
174
+ void QgsFeature::setAttributeMap (const QgsAttributeMap& attributeMap)
175
+ {
176
+ mAttributes = attributeMap;
177
+ }
178
+
174
179
/* *
175
180
* Add an attribute to the map
176
181
*/
Original file line number Diff line number Diff line change @@ -101,6 +101,9 @@ class CORE_EXPORT QgsFeature {
101
101
*/
102
102
const QgsAttributeMap& attributeMap () const ;
103
103
104
+ /* *Sets all the attributes in one go*/
105
+ void setAttributeMap (const QgsAttributeMap& attributeMap);
106
+
104
107
/* *
105
108
* Add an attribute to the map
106
109
*/
Original file line number Diff line number Diff line change @@ -476,7 +476,11 @@ bool QgsPostgresProvider::getNextFeature(QgsFeature& feature)
476
476
}
477
477
}
478
478
479
- mFeatureQueue .push (feature);
479
+ // don't copy the geometry. Just pass a pointer instead
480
+ mFeatureQueue .push (QgsFeature ());
481
+ mFeatureQueue .back ().setGeometry (feature.geometryAndOwnership ());
482
+ mFeatureQueue .back ().setFeatureId (feature.featureId ());
483
+ mFeatureQueue .back ().setAttributeMap (feature.attributeMap ());
480
484
481
485
} // for each row in queue
482
486
@@ -490,7 +494,11 @@ bool QgsPostgresProvider::getNextFeature(QgsFeature& feature)
490
494
} // if new queue is required
491
495
492
496
// Now return the next feature from the queue
493
- feature = mFeatureQueue .front ();
497
+ // don't copy the geometry. Just pass a pointer instead
498
+ feature.setGeometry (mFeatureQueue .front ().geometryAndOwnership ());
499
+ feature.setFeatureId (mFeatureQueue .front ().featureId ());
500
+ feature.setAttributeMap (mFeatureQueue .front ().attributeMap ());
501
+
494
502
mFeatureQueue .pop ();
495
503
496
504
}
You can’t perform that action at this time.
0 commit comments