File tree Expand file tree Collapse file tree 3 files changed +18
-2
lines changed
Expand file tree Collapse file tree 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
171171 return mAttributes ;
172172}
173173
174+ void QgsFeature::setAttributeMap (const QgsAttributeMap& attributeMap)
175+ {
176+ mAttributes = attributeMap;
177+ }
178+
174179/* *
175180 * Add an attribute to the map
176181 */
Original file line number Diff line number Diff line change @@ -101,6 +101,9 @@ class CORE_EXPORT QgsFeature {
101101 */
102102 const QgsAttributeMap& attributeMap () const ;
103103
104+ /* *Sets all the attributes in one go*/
105+ void setAttributeMap (const QgsAttributeMap& attributeMap);
106+
104107 /* *
105108 * Add an attribute to the map
106109 */
Original file line number Diff line number Diff line change @@ -476,7 +476,11 @@ bool QgsPostgresProvider::getNextFeature(QgsFeature& feature)
476476 }
477477 }
478478
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 ());
480484
481485 } // for each row in queue
482486
@@ -490,7 +494,11 @@ bool QgsPostgresProvider::getNextFeature(QgsFeature& feature)
490494 } // if new queue is required
491495
492496 // 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+
494502 mFeatureQueue .pop ();
495503
496504 }
You can’t perform that action at this time.
0 commit comments