Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
qsavoye authored Jul 2, 2024
1 parent 576e803 commit 3fc6b7a
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# QField Past Geometry Plugin

This [QField](https://github.com/opengisch/QField/) plugin past geometry in the current editing vector layer.
36 changes: 36 additions & 0 deletions icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 43 additions & 0 deletions main.qml
Original file line number Diff line number Diff line change
@@ -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()
}
}
7 changes: 7 additions & 0 deletions metadata.txt
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 3fc6b7a

Please sign in to comment.