Skip to content

Commit

Permalink
Applied patch provided by Adrien to fix problem where attributes wher…
Browse files Browse the repository at this point in the history
…e not copied for modified features

git-svn-id: http://svn.osgeo.org/qgis/trunk@8634 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Jun 9, 2008
1 parent cee57ab commit d344e96
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions src/core/qgsvectorlayer.cpp
Expand Up @@ -1273,10 +1273,30 @@ int QgsVectorLayer::featuresInRectangle(const QgsRect& searchRect, QList<QgsFeat
}
if(fetchAttributes)
{
QgsFeature tmpFeature;
mDataProvider->getFeatureAtId(changedIt.key(), tmpFeature, false, mDataProvider->allAttributesList());
newFeature.setAttributeMap(tmpFeature.attributeMap());

if(changedIt.key()<0)
{
//The feature is in mAddedFeature's list because its id<0
bool findMyFeature = false;
for (QgsFeatureList::iterator iter = mAddedFeatures.begin(); iter != mAddedFeatures.end(); ++iter)
{
if(iter->featureId()==changedIt.key())
{
findMyFeature = true;
newFeature.setAttributeMap(iter->attributeMap());
break;
}
}
if(!findMyFeature)
{
QgsLogger::warning("No attribute for the feature");
}
}
else
{
QgsFeature tmpFeature;
mDataProvider->getFeatureAtId(changedIt.key(), tmpFeature, false, mDataProvider->allAttributesList());
newFeature.setAttributeMap(tmpFeature.attributeMap());
}
}
features.push_back(newFeature);
}
Expand Down

0 comments on commit d344e96

Please sign in to comment.