diff --git a/README.md b/README.md new file mode 100644 index 0000000..d82851b --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# QField Past Geometry Plugin + +This [QField](https://github.com/opengisch/QField/) plugin past geometry in the current editing vector layer. diff --git a/icon.svg b/icon.svg new file mode 100644 index 0000000..6bdfa95 --- /dev/null +++ b/icon.svg @@ -0,0 +1,36 @@ + + + + + + \ No newline at end of file diff --git a/main.qml b/main.qml new file mode 100644 index 0000000..c5135a7 --- /dev/null +++ b/main.qml @@ -0,0 +1,43 @@ +import QtQuick +import QtQuick.Controls + +import org.qfield +import org.qgis +import Theme + +import "qrc:/qml" as QFieldItems + +Item { + id: plugin + + property var mainWindow: iface.mainWindow() + property var dashBoard: iface.findItemByObjectName('dashBoard') + property var overlayFeatureFormDrawer: iface.findItemByObjectName('overlayFeatureFormDrawer') + + Component.onCompleted: { + iface.addItemToCanvasActionsToolbar(pastButton) + } + + MenuItem { + id: pastButton + text: qsTr( "Past Feature Into Current Layer" ) + icon.source: Theme.getThemeVectorIcon('ic_paste_black_24dp') + enabled: dashBoard.activeLayer.type == 0 && clipboardManager && clipboardManager.holdsFeature + height: 48 + leftPadding: 10 + font: Theme.defaultFont + + onTriggered: { + past() + } + } + + function past() + { + let featureFromPastFeature = clipboardManager.pasteFeatureFromClipboard() + let feature = FeatureUtils.createFeature(dashBoard.activeLayer, featureFromPastFeature.geometry) + overlayFeatureFormDrawer.featureModel.feature = feature + overlayFeatureFormDrawer.state = 'Add' + overlayFeatureFormDrawer.open() + } +} \ No newline at end of file diff --git a/metadata.txt b/metadata.txt new file mode 100644 index 0000000..eec5986 --- /dev/null +++ b/metadata.txt @@ -0,0 +1,7 @@ +[general] +name=Past Geometry +description=Past geometry in current vector layer. +author=Quentin Savoye +icon=icon.svg +version=1.0 +homepage=https://github.com/qsavoye