Hi qgis-devs,
what do you think about exposing methods to copy/paste features from/to *given layers* through QgisInterface? 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: 1) Require the layers to be loaded in the QGIS Layer Tree. 2) Require the layers to be active when the corresponding method is called. There is really no need for those 2 GUI-related requirements. 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. That is, you have both layers and just pass them as parameters to the corresponding copy/paste methods: >> source_layer.selectAll() >> iface.copyFeatures(source_layer) >> target_layer.startEditing() >> iface.pasteFeatures(target_layer) *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.* Does it make sense for you? Regards, Germán ------------ [1] https://github.com/qgis/QGIS/blob/master/src/app/qgisapp.cpp#L8071-L8192 [2] https://github.com/qgis/QGIS/pull/5578 -- ----------- |\__ (:>__)( |/ Soluciones Geoinformáticas Libres http://geotux.tuxfamily.org/ http://twitter.com/GeoTux2 http://about.me/germancarrillo <http://gis.stackexchange.com/users/4972/germ%c3%a1n-carrillo>
_______________________________________________ QGIS-Developer mailing list [email protected] List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
