|
|
|
@ -186,6 +186,59 @@ Item {
@@ -186,6 +186,59 @@ Item {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Menu { |
|
|
|
|
id: menu |
|
|
|
|
|
|
|
|
|
property int _removeVertexIndex |
|
|
|
|
|
|
|
|
|
function popUpWithIndex(curIndex) { |
|
|
|
|
_removeVertexIndex = curIndex |
|
|
|
|
removeVertexItem.visible = (mapPolygon.count > 3 && _removeVertexIndex >= 0) |
|
|
|
|
menu.popup() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
MenuItem { |
|
|
|
|
id: removeVertexItem |
|
|
|
|
text: qsTr("Remove vertex") |
|
|
|
|
onTriggered: { |
|
|
|
|
if(menu._removeVertexIndex >= 0) { |
|
|
|
|
mapPolygon.removeVertex(menu._removeVertexIndex) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
MenuSeparator { |
|
|
|
|
visible: removeVertexItem.visible |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
MenuItem { |
|
|
|
|
text: qsTr("Circle" ) |
|
|
|
|
onTriggered: resetCircle() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
MenuItem { |
|
|
|
|
text: qsTr("Polygon") |
|
|
|
|
onTriggered: resetPolygon() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
MenuItem { |
|
|
|
|
text: qsTr("Set radius..." ) |
|
|
|
|
visible: _circle |
|
|
|
|
onTriggered: radiusDialog.visible = true |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
MenuItem { |
|
|
|
|
text: qsTr("Edit position..." ) |
|
|
|
|
enabled: _circle |
|
|
|
|
onTriggered: qgcView.showDialog(editPositionDialog, qsTr("Edit Position"), qgcView.showDialogDefaultWidth, StandardButton.Cancel) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
MenuItem { |
|
|
|
|
text: qsTr("Load KML...") |
|
|
|
|
onTriggered: kmlLoadDialog.openForLoad() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Component { |
|
|
|
|
id: polygonComponent |
|
|
|
|
|
|
|
|
@ -291,32 +344,36 @@ Item {
@@ -291,32 +344,36 @@ Item {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
onClicked: mapPolygon.removeVertex(polygonVertex) |
|
|
|
|
onClicked: { |
|
|
|
|
menu.popUpWithIndex(polygonVertex) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Component { |
|
|
|
|
id: centerDragHandle |
|
|
|
|
|
|
|
|
|
MapQuickItem { |
|
|
|
|
id: mapQuickItem |
|
|
|
|
anchorPoint.x: dragHandle.width / 2 |
|
|
|
|
anchorPoint.y: dragHandle.height / 2 |
|
|
|
|
anchorPoint.x: dragHandle.width * 0.5 |
|
|
|
|
anchorPoint.y: dragHandle.height * 0.5 |
|
|
|
|
z: _zorderDragHandle |
|
|
|
|
|
|
|
|
|
sourceItem: Rectangle { |
|
|
|
|
id: dragHandle |
|
|
|
|
width: ScreenTools.defaultFontPixelHeight * 1.5 |
|
|
|
|
height: width |
|
|
|
|
radius: width / 2 |
|
|
|
|
color: "white" |
|
|
|
|
opacity: .90 |
|
|
|
|
|
|
|
|
|
QGCLabel { |
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter |
|
|
|
|
anchors.verticalCenter: parent.verticalCenter |
|
|
|
|
text: "..." |
|
|
|
|
color: "black" |
|
|
|
|
id: dragHandle |
|
|
|
|
width: ScreenTools.defaultFontPixelHeight * 1.5 |
|
|
|
|
height: width |
|
|
|
|
radius: width * 0.5 |
|
|
|
|
color: Qt.rgba(1,1,1,0.8) |
|
|
|
|
border.color: Qt.rgba(0,0,0,0.25) |
|
|
|
|
border.width: 1 |
|
|
|
|
QGCColoredImage { |
|
|
|
|
width: parent.width |
|
|
|
|
height: width |
|
|
|
|
color: Qt.rgba(0,0,0,1) |
|
|
|
|
mipmap: true |
|
|
|
|
fillMode: Image.PreserveAspectFit |
|
|
|
|
source: "/qmlimages/MapCenter.svg" |
|
|
|
|
sourceSize.height: height |
|
|
|
|
anchors.centerIn: parent |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -327,7 +384,7 @@ Item {
@@ -327,7 +384,7 @@ Item {
|
|
|
|
|
|
|
|
|
|
MapQuickItem { |
|
|
|
|
id: mapQuickItem |
|
|
|
|
anchorPoint.x: dragHandle.width / 2 |
|
|
|
|
anchorPoint.x: dragHandle.width / 2 |
|
|
|
|
anchorPoint.y: dragHandle.height / 2 |
|
|
|
|
z: _zorderDragHandle |
|
|
|
|
visible: !_circle |
|
|
|
@ -335,12 +392,13 @@ Item {
@@ -335,12 +392,13 @@ Item {
|
|
|
|
|
property int polygonVertex |
|
|
|
|
|
|
|
|
|
sourceItem: Rectangle { |
|
|
|
|
id: dragHandle |
|
|
|
|
width: ScreenTools.defaultFontPixelHeight * 1.5 |
|
|
|
|
height: width |
|
|
|
|
radius: width / 2 |
|
|
|
|
color: "white" |
|
|
|
|
opacity: .90 |
|
|
|
|
id: dragHandle |
|
|
|
|
width: ScreenTools.defaultFontPixelHeight * 1.5 |
|
|
|
|
height: width |
|
|
|
|
radius: width * 0.5 |
|
|
|
|
color: Qt.rgba(1,1,1,0.8) |
|
|
|
|
border.color: Qt.rgba(0,0,0,0.25) |
|
|
|
|
border.width: 1 |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -393,44 +451,16 @@ Item {
@@ -393,44 +451,16 @@ Item {
|
|
|
|
|
onItemCoordinateChanged: mapPolygon.center = itemCoordinate |
|
|
|
|
onDragStart: mapPolygon.centerDrag = true |
|
|
|
|
onDragStop: mapPolygon.centerDrag = false |
|
|
|
|
onClicked: menu.popup() |
|
|
|
|
|
|
|
|
|
onClicked: { |
|
|
|
|
menu.popUpWithIndex(-1) //-- Don't offer a choice to delete vertex (cur index == -1) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function setRadiusFromDialog() { |
|
|
|
|
setCircleRadius(mapPolygon.center, radiusField.text) |
|
|
|
|
radiusDialog.visible = false |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Menu { |
|
|
|
|
id: menu |
|
|
|
|
|
|
|
|
|
MenuItem { |
|
|
|
|
text: qsTr("Circle" ) |
|
|
|
|
onTriggered: resetCircle() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
MenuItem { |
|
|
|
|
text: qsTr("Polygon") |
|
|
|
|
onTriggered: resetPolygon() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
MenuItem { |
|
|
|
|
text: qsTr("Set radius..." ) |
|
|
|
|
visible: _circle |
|
|
|
|
onTriggered: radiusDialog.visible = true |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
MenuItem { |
|
|
|
|
text: qsTr("Edit position..." ) |
|
|
|
|
enabled: _circle |
|
|
|
|
onTriggered: qgcView.showDialog(editPositionDialog, qsTr("Edit Position"), qgcView.showDialogDefaultWidth, StandardButton.Cancel) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
MenuItem { |
|
|
|
|
text: qsTr("Load KML...") |
|
|
|
|
onTriggered: kmlLoadDialog.openForLoad() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Rectangle { |
|
|
|
|
id: radiusDialog |
|
|
|
|
anchors.margins: _margin |
|
|
|
|