Skip to content

Commit 31f6ce0

Browse files
committedDec 18, 2012
Changed data structure for added features from list to map to allow efficient lookups
1 parent 9317ffd commit 31f6ce0

9 files changed

+135
-165
lines changed
 

‎python/core/conversions.sip

Lines changed: 78 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ which are not wrapped by PyQt:
1414
- QMap<TYPE1, TYPE2*>
1515
- QMap<double, TYPE>
1616
- QMultiMap<double, TYPE2>
17-
- QMap<qint64, QgsGeometry>
17+
- QMap<qint64, TYPE>
1818
- QMap<qint64, QgsOverlayObject*>
1919
- QList< QPair< QString, QList<QString> > >
2020
- QVector<TYPE*>
@@ -661,94 +661,117 @@ template<TYPE>
661661
};
662662

663663

664+
//
665+
// copied from PyQt4 QMap<int, TYPE> and adapted to qint64
666+
//
664667

665-
%MappedType QMap<qint64, QgsGeometry>
668+
// QMap<qint64, TYPE> is implemented as a Python dictionary.
669+
template<TYPE>
670+
%MappedType QMap<qint64, TYPE> /DocType="dict-of-qint64-TYPE"/
666671
{
667672
%TypeHeaderCode
668-
#include <QMap>
673+
#include <qmap.h>
669674
%End
670675

671676
%ConvertFromTypeCode
672-
// Create the list.
673-
PyObject *d;
677+
// Create the dictionary.
678+
PyObject *d = PyDict_New();
674679

675-
if ((d = PyDict_New()) == NULL)
676-
return NULL;
680+
if (!d)
681+
return NULL;
677682

678-
// Set the list elements.
679-
for (QMap<qint64, QgsGeometry>::iterator it = sipCpp->begin(); it != sipCpp->end(); ++it)
680-
{
681-
PyObject *kobj = PyLong_FromLongLong(it.key());
682-
PyObject *tobj = sipConvertFromInstance( &it.value(), sipClass_QgsGeometry, sipTransferObj);
683+
// Set the dictionary elements.
684+
QMap<qint64, TYPE>::const_iterator i = sipCpp->constBegin();
683685

684-
if (kobj == NULL || tobj == NULL || PyDict_SetItem(d, kobj, tobj) < 0)
686+
while (i != sipCpp->constEnd())
685687
{
686-
Py_DECREF(d);
688+
TYPE *t = new TYPE(i.value());
687689

688-
if (kobj)
689-
{
690-
Py_DECREF(kobj);
691-
}
690+
PyObject *kobj = PyLong_FromLongLong(i.key());
691+
//PyObject *kobj = SIPLong_FromLong(i.key());
692+
PyObject *tobj = sipConvertFromNewType(t, sipType_TYPE, sipTransferObj);
692693

693-
if (tobj)
694-
{
694+
if (kobj == NULL || tobj == NULL || PyDict_SetItem(d, kobj, tobj) < 0)
695+
{
696+
Py_DECREF(d);
697+
698+
if (kobj)
699+
{
700+
Py_DECREF(kobj);
701+
}
702+
703+
if (tobj)
704+
{
705+
Py_DECREF(tobj);
706+
}
707+
else
708+
{
709+
delete t;
710+
}
711+
712+
return NULL;
713+
}
714+
715+
Py_DECREF(kobj);
695716
Py_DECREF(tobj);
696-
}
697717

698-
return NULL;
718+
++i;
699719
}
700720

701-
Py_DECREF(tobj);
702-
}
703-
704-
return d;
721+
return d;
705722
%End
706723

707724
%ConvertToTypeCode
708-
PyObject *kobj, *tobj;
725+
PyObject *kobj, *tobj;
726+
SIP_SSIZE_T i = 0;
709727

710-
// Check the type if that is all that is required.
711-
if (sipIsErr == NULL)
712-
{
713-
if (!PyDict_Check(sipPy))
714-
return 0;
728+
// Check the type if that is all that is required.
729+
if (sipIsErr == NULL)
730+
{
731+
if (!PyDict_Check(sipPy))
732+
return 0;
733+
734+
while (PyDict_Next(sipPy, &i, &kobj, &tobj))
735+
if (!sipCanConvertToType(tobj, sipType_TYPE, SIP_NOT_NONE))
736+
return 0;
737+
738+
return 1;
739+
}
740+
741+
QMap<qint64, TYPE> *qm = new QMap<qint64, TYPE>;
715742

716-
Py_ssize_t i = 0;
717743
while (PyDict_Next(sipPy, &i, &kobj, &tobj))
718744
{
719-
if (!sipCanConvertToInstance(tobj, sipClass_QgsGeometry, SIP_NOT_NONE))
720-
return 0;
721-
}
722-
return 1;
723-
}
745+
int state;
746+
//, k = SIPLong_AsLong(kobj);
747+
qint64 k = PyLong_AsLongLong(kobj);
748+
TYPE *t = reinterpret_cast<TYPE *>(sipConvertToType(tobj, sipType_TYPE, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr));
724749

725-
QMap<qint64, QgsGeometry> *qm = new QMap<qint64, QgsGeometry>;
750+
if (*sipIsErr)
751+
{
752+
sipReleaseType(t, sipType_TYPE, state);
726753

727-
Py_ssize_t i = 0;
728-
while (PyDict_Next(sipPy, &i, &kobj, &tobj))
729-
{
730-
int state;
731-
qint64 k = PyLong_AsLongLong(kobj);
732-
QgsGeometry * t = reinterpret_cast<QgsGeometry*>(sipConvertToInstance(tobj, sipClass_QgsGeometry, sipTransferObj,SIP_NOT_NONE,&state,sipIsErr));
754+
delete qm;
755+
return 0;
756+
}
733757

734-
if (*sipIsErr)
735-
{
736-
sipReleaseInstance(t, sipClass_QgsGeometry, state);
737-
delete qm;
738-
return 0;
758+
qm->insert(k, *t);
759+
760+
sipReleaseType(t, sipType_TYPE, state);
739761
}
740762

741-
qm->insert(k, *t);
742-
sipReleaseInstance(t, sipClass_QgsGeometry, state);
743-
}
763+
*sipCppPtr = qm;
744764

745-
*sipCppPtr = qm;
746-
return sipGetState(sipTransferObj);
765+
return sipGetState(sipTransferObj);
747766
%End
748767
};
749768

750769

751770

771+
772+
773+
774+
752775
%MappedType QMap<QString, QVariant::Type>
753776
{
754777
%TypeHeaderCode

‎python/core/qgsvectorlayereditbuffer.sip

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11

2+
typedef QMap<qint64, QgsFeature> QgsFeatureMap;
23

34
class QgsVectorLayerEditBuffer : QObject
45
{
@@ -65,7 +66,7 @@ public:
6566

6667

6768
/** New features which are not commited. */
68-
const QgsFeatureList& addedFeatures();
69+
const QgsFeatureMap& addedFeatures();
6970

7071
/** Changed attributes values which are not commited */
7172
const QgsChangedAttributesMap& changedAttributeValues();

‎src/core/qgsvectorlayer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1584,7 +1584,7 @@ QgsRectangle QgsVectorLayer::extent()
15841584
rect.combineExtentWith( &r );
15851585
}
15861586

1587-
for ( QgsFeatureList::iterator it = mEditBuffer->mAddedFeatures.begin(); it != mEditBuffer->mAddedFeatures.end(); it++ )
1587+
for ( QgsFeatureMap::iterator it = mEditBuffer->mAddedFeatures.begin(); it != mEditBuffer->mAddedFeatures.end(); it++ )
15881588
{
15891589
QgsRectangle r = it->geometry()->boundingBox();
15901590
rect.combineExtentWith( &r );

‎src/core/qgsvectorlayereditbuffer.cpp

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -113,16 +113,7 @@ bool QgsVectorLayerEditBuffer::deleteFeature( QgsFeatureId fid )
113113
{
114114
if ( FID_IS_NEW( fid ) )
115115
{
116-
bool found = false;
117-
for ( int i = 0; i < mAddedFeatures.count(); ++i )
118-
{
119-
if ( mAddedFeatures[i].id() == fid )
120-
{
121-
found = true;
122-
break;
123-
}
124-
}
125-
if (!found)
116+
if (!mAddedFeatures.contains(fid))
126117
return false;
127118
}
128119
else // existing feature
@@ -304,25 +295,22 @@ bool QgsVectorLayerEditBuffer::commitChanges(QStringList& commitErrors)
304295
{
305296
if ( cap & QgsVectorDataProvider::AddFeatures )
306297
{
307-
QList<QgsFeatureId> ids;
308-
foreach ( const QgsFeature &f, mAddedFeatures )
309-
{
310-
ids << f.id();
311-
}
298+
QList<QgsFeatureId> ids = mAddedFeatures.keys();
299+
QgsFeatureList featuresToAdd = mAddedFeatures.values();
312300

313-
if ( provider->addFeatures( mAddedFeatures ) )
301+
if ( provider->addFeatures( featuresToAdd ) )
314302
{
315-
commitErrors << tr( "SUCCESS: %n feature(s) added.", "added features count", mAddedFeatures.size() );
303+
commitErrors << tr( "SUCCESS: %n feature(s) added.", "added features count", featuresToAdd.size() );
316304

317-
emit committedFeaturesAdded( L->id(), mAddedFeatures );
305+
emit committedFeaturesAdded( L->id(), featuresToAdd );
318306

319307
// notify everyone that the features with temporary ids were updated with permanent ids
320-
for ( int i = 0; i < mAddedFeatures.size(); i++ )
308+
for ( int i = 0; i < featuresToAdd.count(); ++i )
321309
{
322-
if ( mAddedFeatures[i].id() != ids[i] )
310+
if ( featuresToAdd[i].id() != ids[i] )
323311
{
324312
emit featureDeleted( ids[i] );
325-
emit featureAdded( mAddedFeatures[i].id() );
313+
emit featureAdded( featuresToAdd[i].id() );
326314
}
327315
}
328316

@@ -448,7 +436,7 @@ void QgsVectorLayerEditBuffer::handleAttributeAdded( int index )
448436
}
449437

450438
// go through added features and adapt attributes
451-
QgsFeatureList::iterator featureIt = mAddedFeatures.begin();
439+
QgsFeatureMap::iterator featureIt = mAddedFeatures.begin();
452440
for ( ; featureIt != mAddedFeatures.end(); ++featureIt )
453441
{
454442
QgsAttributes& attrs = featureIt->attributes();
@@ -471,7 +459,7 @@ void QgsVectorLayerEditBuffer::handleAttributeDeleted( int index )
471459
}
472460

473461
// go through added features and adapt attributes
474-
QgsFeatureList::iterator featureIt = mAddedFeatures.begin();
462+
QgsFeatureMap::iterator featureIt = mAddedFeatures.begin();
475463
for ( ; featureIt != mAddedFeatures.end(); ++featureIt )
476464
{
477465
QgsAttributes& attrs = featureIt->attributes();

‎src/core/qgsvectorlayereditbuffer.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ class QgsVectorLayer;
1515

1616
typedef QList<int> QgsAttributeList;
1717
typedef QSet<int> QgsAttributeIds;
18+
typedef QMap<QgsFeatureId, QgsFeature> QgsFeatureMap;
1819

1920
class CORE_EXPORT QgsVectorLayerEditBuffer : public QObject
2021
{
@@ -79,7 +80,7 @@ class CORE_EXPORT QgsVectorLayerEditBuffer : public QObject
7980

8081

8182
/** New features which are not commited. */
82-
inline const QgsFeatureList& addedFeatures() { return mAddedFeatures; }
83+
inline const QgsFeatureMap& addedFeatures() { return mAddedFeatures; }
8384

8485
/** Changed attributes values which are not commited */
8586
inline const QgsChangedAttributesMap& changedAttributeValues() { return mChangedAttributeValues; }
@@ -161,7 +162,7 @@ protected slots:
161162
QgsFeatureIds mDeletedFeatureIds;
162163

163164
/** New features which are not commited. */
164-
QgsFeatureList mAddedFeatures;
165+
QgsFeatureMap mAddedFeatures;
165166

166167
/** Changed attributes values which are not commited */
167168
QgsChangedAttributesMap mChangedAttributeValues;

‎src/core/qgsvectorlayerfeatureiterator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ bool QgsVectorLayerFeatureIterator::nextFeatureFid( QgsFeature& f )
430430
}
431431

432432
// added features
433-
for ( QgsFeatureList::iterator iter = editBuffer->mAddedFeatures.begin(); iter != editBuffer->mAddedFeatures.end(); ++iter )
433+
for ( QgsFeatureMap::iterator iter = editBuffer->mAddedFeatures.begin(); iter != editBuffer->mAddedFeatures.end(); ++iter )
434434
{
435435
if ( iter->id() == featureId )
436436
{

‎src/core/qgsvectorlayerfeatureiterator.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
#include <QSet>
77

8+
typedef QMap<QgsFeatureId, QgsFeature> QgsFeatureMap;
9+
810
class QgsVectorLayer;
911
class QgsVectorJoinInfo;
1012

@@ -40,7 +42,7 @@ class QgsVectorLayerFeatureIterator : public QgsAbstractFeatureIterator
4042
// only related to editing
4143
QSet<QgsFeatureId> mFetchConsidered;
4244
QgsGeometryMap::iterator mFetchChangedGeomIt;
43-
QgsFeatureList::iterator mFetchAddedFeaturesIt;
45+
QgsFeatureMap::iterator mFetchAddedFeaturesIt;
4446

4547
bool mFetchedFid; // when iterating by FID: indicator whether it has been fetched yet or not
4648

‎src/core/qgsvectorlayerundocommand.cpp

Lines changed: 34 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,9 @@ QgsVectorLayerUndoCommandAddFeature::QgsVectorLayerUndoCommandAddFeature( QgsVec
4747

4848
void QgsVectorLayerUndoCommandAddFeature::undo()
4949
{
50-
for (int i = 0; mBuffer->mAddedFeatures.count(); ++i)
51-
{
52-
if (mBuffer->mAddedFeatures[i].id() == mFeature.id())
53-
{
54-
mBuffer->mAddedFeatures.removeAt(i);
55-
break;
56-
}
57-
}
50+
QgsFeatureMap::const_iterator it = mBuffer->mAddedFeatures.find(mFeature.id());
51+
Q_ASSERT( it != mBuffer->mAddedFeatures.end() );
52+
mBuffer->mAddedFeatures.remove(mFeature.id());
5853

5954
if ( mFeature.geometry() )
6055
cache()->removeGeometry(mFeature.id());
@@ -64,7 +59,7 @@ void QgsVectorLayerUndoCommandAddFeature::undo()
6459

6560
void QgsVectorLayerUndoCommandAddFeature::redo()
6661
{
67-
mBuffer->mAddedFeatures.append( mFeature );
62+
mBuffer->mAddedFeatures.insert( mFeature.id(), mFeature );
6863

6964
if ( mFeature.geometry() )
7065
cache()->cacheGeometry( mFeature.id(), *mFeature.geometry() );
@@ -81,22 +76,17 @@ QgsVectorLayerUndoCommandDeleteFeature::QgsVectorLayerUndoCommandDeleteFeature(
8176

8277
if ( FID_IS_NEW( mFid ) )
8378
{
84-
for ( int i = 0; i < mBuffer->mAddedFeatures.count(); ++i )
85-
{
86-
if ( mBuffer->mAddedFeatures[i].id() == fid )
87-
{
88-
mOldAddedFeature = mBuffer->mAddedFeatures[i];
89-
break;
90-
}
91-
}
79+
QgsFeatureMap::const_iterator it = mBuffer->mAddedFeatures.find( mFid );
80+
Q_ASSERT( it != mBuffer->mAddedFeatures.end() );
81+
mOldAddedFeature = it.value();
9282
}
9383
}
9484

9585
void QgsVectorLayerUndoCommandDeleteFeature::undo()
9686
{
9787
if ( FID_IS_NEW( mFid ) )
9888
{
99-
mBuffer->mAddedFeatures.append( mOldAddedFeature );
89+
mBuffer->mAddedFeatures.insert( mOldAddedFeature.id(), mOldAddedFeature );
10090
}
10191
else
10292
{
@@ -110,14 +100,7 @@ void QgsVectorLayerUndoCommandDeleteFeature::redo()
110100
{
111101
if ( FID_IS_NEW( mFid ) )
112102
{
113-
for ( int i = 0; i < mBuffer->mAddedFeatures.count(); ++i )
114-
{
115-
if ( mBuffer->mAddedFeatures[i].id() == mFid )
116-
{
117-
mBuffer->mAddedFeatures.removeAt(i);
118-
break;
119-
}
120-
}
103+
mBuffer->mAddedFeatures.remove( mFid );
121104
}
122105
else
123106
{
@@ -136,14 +119,9 @@ QgsVectorLayerUndoCommandChangeGeometry::QgsVectorLayerUndoCommandChangeGeometry
136119

137120
if ( FID_IS_NEW( mFid ) )
138121
{
139-
for ( int i = 0; i < mBuffer->mAddedFeatures.count(); ++i )
140-
{
141-
if ( mBuffer->mAddedFeatures[i].id() == mFid )
142-
{
143-
mOldGeom = new QgsGeometry( *mBuffer->mAddedFeatures[i].geometry() );
144-
break;
145-
}
146-
}
122+
QgsFeatureMap::const_iterator it = mBuffer->mAddedFeatures.find( mFid );
123+
Q_ASSERT( it != mBuffer->mAddedFeatures.end() );
124+
mOldGeom = new QgsGeometry( *it.value().geometry() );
147125
}
148126
else
149127
{
@@ -167,14 +145,10 @@ void QgsVectorLayerUndoCommandChangeGeometry::undo()
167145
if ( FID_IS_NEW( mFid ) )
168146
{
169147
// modify added features
170-
for ( int i = 0; i < mBuffer->mAddedFeatures.count(); ++i )
171-
{
172-
if ( mBuffer->mAddedFeatures[i].id() == mFid )
173-
{
174-
mBuffer->mAddedFeatures[i].setGeometry( *mOldGeom );
175-
break;
176-
}
177-
}
148+
QgsFeatureMap::iterator it = mBuffer->mAddedFeatures.find( mFid );
149+
Q_ASSERT( it != mBuffer->mAddedFeatures.end() );
150+
it.value().setGeometry( *mOldGeom );
151+
178152
cache()->cacheGeometry( mFid, *mOldGeom );
179153
emit mBuffer->geometryChanged( mFid, *mOldGeom );
180154
}
@@ -208,14 +182,9 @@ void QgsVectorLayerUndoCommandChangeGeometry::redo()
208182
if ( FID_IS_NEW( mFid ) )
209183
{
210184
// modify added features
211-
for ( int i = 0; i < mBuffer->mAddedFeatures.count(); ++i )
212-
{
213-
if ( mBuffer->mAddedFeatures[i].id() == mFid )
214-
{
215-
mBuffer->mAddedFeatures[i].setGeometry( *mNewGeom );
216-
break;
217-
}
218-
}
185+
QgsFeatureMap::iterator it = mBuffer->mAddedFeatures.find( mFid );
186+
Q_ASSERT( it != mBuffer->mAddedFeatures.end() );
187+
it.value().setGeometry( *mNewGeom );
219188
}
220189
else
221190
{
@@ -240,14 +209,12 @@ QgsVectorLayerUndoCommandChangeAttribute::QgsVectorLayerUndoCommandChangeAttribu
240209
if ( FID_IS_NEW( mFid ) )
241210
{
242211
// work with added feature
243-
for ( int i = 0; i < mBuffer->mAddedFeatures.size(); i++ )
212+
QgsFeatureMap::const_iterator it = mBuffer->mAddedFeatures.find( mFid );
213+
Q_ASSERT( it != mBuffer->mAddedFeatures.end() );
214+
if ( it.value().attribute( mFieldIndex ).isValid() )
244215
{
245-
if ( mBuffer->mAddedFeatures[i].id() == mFid && mBuffer->mAddedFeatures[i].attribute( mFieldIndex ).isValid() )
246-
{
247-
mOldValue = mBuffer->mAddedFeatures[i].attribute( mFieldIndex );
248-
mFirstChange = false;
249-
break;
250-
}
216+
mOldValue = it.value().attribute( mFieldIndex );
217+
mFirstChange = false;
251218
}
252219
}
253220
else
@@ -268,14 +235,9 @@ void QgsVectorLayerUndoCommandChangeAttribute::undo()
268235
if ( FID_IS_NEW( mFid ) )
269236
{
270237
// added feature
271-
for ( int i = 0; i < mBuffer->mAddedFeatures.size(); i++ )
272-
{
273-
if ( mBuffer->mAddedFeatures[i].id() == mFid )
274-
{
275-
mBuffer->mAddedFeatures[i].setAttribute( mFieldIndex, mOldValue );
276-
break;
277-
}
278-
}
238+
QgsFeatureMap::iterator it = mBuffer->mAddedFeatures.find( mFid );
239+
Q_ASSERT( it != mBuffer->mAddedFeatures.end() );
240+
it.value().setAttribute( mFieldIndex, mOldValue );
279241
}
280242
else
281243
{
@@ -310,14 +272,9 @@ void QgsVectorLayerUndoCommandChangeAttribute::redo()
310272
if ( FID_IS_NEW( mFid ) )
311273
{
312274
// updated added feature
313-
for ( int i = 0; i < mBuffer->mAddedFeatures.size(); i++ )
314-
{
315-
if ( mBuffer->mAddedFeatures[i].id() == mFid )
316-
{
317-
mBuffer->mAddedFeatures[i].setAttribute( mFieldIndex, mNewValue );
318-
break;
319-
}
320-
}
275+
QgsFeatureMap::iterator it = mBuffer->mAddedFeatures.find( mFid );
276+
Q_ASSERT( it != mBuffer->mAddedFeatures.end() );
277+
it.value().setAttribute( mFieldIndex, mNewValue );
321278
}
322279
else
323280
{
@@ -385,9 +342,9 @@ QgsVectorLayerUndoCommandDeleteAttribute::QgsVectorLayerUndoCommandDeleteAttribu
385342
}
386343

387344
// save values of new features
388-
for (int i = 0; i < mBuffer->mAddedFeatures.count(); ++i)
345+
for (QgsFeatureMap::const_iterator it = mBuffer->mAddedFeatures.begin(); it != mBuffer->mAddedFeatures.end(); ++it)
389346
{
390-
const QgsFeature& f = mBuffer->mAddedFeatures[i];
347+
const QgsFeature& f = it.value();
391348
mDeletedValues.insert(f.id(), f.attribute(mFieldIndex));
392349
}
393350

@@ -416,9 +373,9 @@ void QgsVectorLayerUndoCommandDeleteAttribute::undo()
416373
mBuffer->handleAttributeAdded( mFieldIndex ); // update changed attributes + new features
417374

418375
// set previously used attributes of new features
419-
for (int i = 0; i < mBuffer->mAddedFeatures.count(); ++i)
376+
for (QgsFeatureMap::iterator it = mBuffer->mAddedFeatures.begin(); it != mBuffer->mAddedFeatures.end(); ++it)
420377
{
421-
QgsFeature& f = mBuffer->mAddedFeatures[i];
378+
QgsFeature& f = it.value();
422379
f.setAttribute( mFieldIndex, mDeletedValues.value(f.id()) );
423380
}
424381
// set previously used changed attributes

‎tests/src/python/test_qgsvectorlayer.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def dumpEditBuffer(layer):
7272
print "NO EDITING!"
7373
return
7474
print "ADDED:"
75-
for f in editBuffer.addedFeatures(): print "%d: %s | %s" % (f.id(), formatAttributes(f.attributes()), f.geometry().exportToWkt())
75+
for fid,f in editBuffer.addedFeatures().iteritems(): print "%d: %s | %s" % (f.id(), formatAttributes(f.attributes()), f.geometry().exportToWkt())
7676
print "CHANGED GEOM:"
7777
for fid,geom in editBuffer.changedGeometries().iteritems(): print "%d | %s" % (f.id(), f.geometry().exportToWkt())
7878

@@ -136,7 +136,7 @@ def checkBefore():
136136
checkBefore()
137137
layer.undoStack().redo()
138138
checkAfter()
139-
139+
140140
assert layer.commitChanges()
141141

142142
checkAfter()
@@ -232,7 +232,6 @@ def checkAfter2():
232232
fid = feat.id()
233233
assert layer.deleteFeature(fid)
234234
checkAfter2()
235-
dumpEditBuffer(layer)
236235

237236
# now try undo/redo
238237
layer.undoStack().undo()
@@ -244,7 +243,6 @@ def checkAfter2():
244243
layer.undoStack().redo()
245244
checkAfter2()
246245

247-
dumpEditBuffer(layer)
248246
assert layer.commitChanges()
249247
checkAfter2()
250248

0 commit comments

Comments
 (0)
Please sign in to comment.