<div dir="ltr">Hi qgis-devs,<div><br></div><div><br></div><div>what do you think about exposing methods to copy/paste features from/to *given layers* through QgisInterface?</div><div><br></div><div>Such methods are available in qgisapp.cpp already [1], but plugin devs cannot access them. What is exposed right now are the actionCopyFeatures and actionPasteFeatures, which:</div><div><br></div><div>1) Require the layers to be loaded in the QGIS Layer Tree.</div><div>2) Require the layers to be active when the corresponding method is called.</div><div><br></div><div>There is really no need for those 2 GUI-related requirements.</div><div><br></div><div><br></div><div>I've created a Pull Request [2] to make it possible to use source and target layers for copy/paste operations without loading them into the Layer Tree, which is much more handy for people using the QGIS API.</div><div><br></div><div>That is, you have both layers and just pass them as parameters to the corresponding copy/paste methods:</div><div><br></div><div>>> source_layer.selectAll()<br></div><div>>> iface.copyFeatures(source_layer)</div><div>>> target_layer.startEditing()</div><div>>> iface.pasteFeatures(target_layer)<br></div><div><br></div><div><br></div><div><i>FYI, I'm using copy/paste features functionality to mimic an append operation from one layer to another, which I've found difficult to achieve with the API or  even using current Processing algorithms.</i></div><div><br></div><div><br></div><div>Does it make sense for you?</div><div><br></div><div><br></div><div>Regards,<br></div><div><br></div><div>Germán </div><div>------------</div><div>[1] <a href="https://github.com/qgis/QGIS/blob/master/src/app/qgisapp.cpp#L8071-L8192">https://github.com/qgis/QGIS/blob/master/src/app/qgisapp.cpp#L8071-L8192</a></div><div>[2] <a href="https://github.com/qgis/QGIS/pull/5578">https://github.com/qgis/QGIS/pull/5578</a></div><div><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div>-----------<br></div><div>   |\__  <br>(:>__)(<br>   |/    <br>Soluciones Geoinformáticas Libres                            <br><a href="http://geotux.tuxfamily.org/" target="_blank">http://geotux.tuxfamily.org/</a><br><a href="http://twitter.com/GeoTux2" target="_blank">http://twitter.com/GeoTux2</a></div><div><a href="http://about.me/germancarrillo" target="_blank">http://about.me/germancarrillo</a><br></div><div><div><br></div><div><a href="http://gis.stackexchange.com/users/4972/germ%c3%a1n-carrillo" target="_blank"><img src="http://gis.stackexchange.com/users/flair/4972.png"></a></div></div></div></div></div></div></div>
</div></div>