Couldn't we just expose to the API the collection of changed features via QgsVectorLayer?<div><br></div><div>- Nathan</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Dec 1, 2012 at 12:45 AM, Martin Dobias <span dir="ltr"><<a href="mailto:wonder.sk@gmail.com" target="_blank">wonder.sk@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>Hi Ivan</div><br><div class="gmail_extra"><div class="gmail_quote"><div class="im">On Thu, Nov 29, 2012 at 2:15 PM, Ivan Mincik <span dir="ltr"><<a href="mailto:ivan.mincik@gmail.com" target="_blank">ivan.mincik@gmail.com</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
sure you know this - when editing/adding multiple features to layer and<br>
pressing 'save' button an error message appears because of some database<br>
constraint violation or invalid data type in attribute table.<br>
There is very hard to find out a problematic features when many of them<br>
where changed or added.<br>
<br>
We wrote a small Python console script to print all dirty features with<br>
their attributes and WKT geometry:<br>
<br>
# QGIS 1.7, 1.8, author: Marcel Dancak, Gista s.r.o.<br>
layer = qgis.utils.iface.activeLayer()<br>
map = qgis.utils.iface.mapCanvas()<br>
layer.select(map.fullExtent(), False)<br>
fields = layer.dataProvider().fields()<br>
features = layer.selectedFeatures()<br>
<br>
# filter only new features<br>
features = [f for f in features if <a href="http://f.id" target="_blank">f.id</a>() < 0]<br>
for f in features:<br>
        attribs = dict([(unicode(fields[k].name().toUtf8()),<br>
unicode(v.toString().toUtf8())) for k, v in f.attributeMap().iteritems()])<br>
        print <a href="http://f.id" target="_blank">f.id</a>(), attribs, f.geometry().type(), f.geometry().exportToWkt()<br></blockquote><div><br></div></div><div>Are you interested just in newly added features or any "dirty" features, i.e. also changed features and removed features? Because the above would work just for new features. Currently it's not possible to access uncommitted changes... but in theory you could still iterate over vector layer and then iterate through its data provider and compare the results to detect all changes.</div>


<div><br></div><div>If you decide to create a plugin, you could listen to signals from QgsVectorLayer (featureAdded, featureDeleted and others) to immediately detect any changes.</div><div><br></div><div>In general, any tools that would lead to easier detection of problems would be welcome.</div>


<div><br></div><div>Regards</div><span class="HOEnZb"><font color="#888888"><div>Martin</div><div><br></div></font></span></div></div>
<br>_______________________________________________<br>
Qgis-developer mailing list<br>
<a href="mailto:Qgis-developer@lists.osgeo.org">Qgis-developer@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
<br></blockquote></div><br></div>