Skip to content

Commit 2995bdc

Browse files
committed
Render added/changed features on top
1 parent 109bd99 commit 2995bdc

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

src/core/qgsvectorlayerfeatureiterator.cpp

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -95,19 +95,6 @@ bool QgsVectorLayerFeatureIterator::nextFeature( QgsFeature& f )
9595
return res;
9696
}
9797

98-
if ( mRequest.filterType() == QgsFeatureRequest::FilterRect )
99-
{
100-
if ( fetchNextChangedGeomFeature( f ) )
101-
return true;
102-
103-
// no more changed geometries
104-
}
105-
106-
if ( fetchNextAddedFeature( f ) )
107-
return true;
108-
109-
// no more added features
110-
11198
while ( mProviderIterator.nextFeature( f ) )
11299
{
113100
if ( mFetchConsidered.contains( f.id() ) )
@@ -123,11 +110,26 @@ bool QgsVectorLayerFeatureIterator::nextFeature( QgsFeature& f )
123110
addJoinedAttributes( f );
124111

125112
// update geometry
113+
// TODO[MK]: FilterRect check after updating the geometry
126114
if ( !( mRequest.flags() & QgsFeatureRequest::NoGeometry ) )
127115
updateFeatureGeometry( f );
128116

129117
return true;
130118
}
119+
// no more provider features
120+
121+
if ( mRequest.filterType() == QgsFeatureRequest::FilterRect )
122+
{
123+
if ( fetchNextChangedGeomFeature( f ) )
124+
return true;
125+
}
126+
// no more changed geometries
127+
128+
129+
if ( fetchNextAddedFeature( f ) )
130+
return true;
131+
// no more added features
132+
131133

132134
close();
133135
return false;
@@ -169,7 +171,7 @@ bool QgsVectorLayerFeatureIterator::close()
169171

170172
bool QgsVectorLayerFeatureIterator::fetchNextAddedFeature( QgsFeature& f )
171173
{
172-
for ( ; mFetchAddedFeaturesIt != mAddedFeatures.constEnd(); mFetchAddedFeaturesIt++ )
174+
while ( mFetchAddedFeaturesIt-- != mAddedFeatures.constBegin() )
173175
{
174176
QgsFeatureId fid = mFetchAddedFeaturesIt->id();
175177

@@ -185,7 +187,6 @@ bool QgsVectorLayerFeatureIterator::fetchNextAddedFeature( QgsFeature& f )
185187

186188
useAddedFeature( *mFetchAddedFeaturesIt, f );
187189

188-
mFetchAddedFeaturesIt++;
189190
return true;
190191
}
191192

@@ -279,7 +280,7 @@ void QgsVectorLayerFeatureIterator::rewindEditBuffer()
279280
{
280281
mFetchConsidered = mDeletedFeatureIds;
281282

282-
mFetchAddedFeaturesIt = mAddedFeatures.constBegin();
283+
mFetchAddedFeaturesIt = mAddedFeatures.constEnd();
283284
mFetchChangedGeomIt = mChangedGeometries.constBegin();
284285
}
285286

0 commit comments

Comments
 (0)