Commit e38db208 authored by DoinLakeFlyer's avatar DoinLakeFlyer

parent dccfcc1f
......@@ -32,6 +32,7 @@ public:
Q_PROPERTY(bool interactive READ interactive WRITE setInteractive NOTIFY interactiveChanged)
Q_PROPERTY(bool isValid READ isValid NOTIFY isValidChanged)
Q_PROPERTY(bool empty READ empty NOTIFY isEmptyChanged)
Q_PROPERTY(bool traceMode MEMBER _traceMode NOTIFY traceModeChanged)
Q_INVOKABLE void clear(void);
Q_INVOKABLE void appendVertex(const QGeoCoordinate& coordinate);
......@@ -106,6 +107,7 @@ signals:
void interactiveChanged (bool interactive);
void isValidChanged (void);
void isEmptyChanged (void);
void traceModeChanged (bool traceMode);
private slots:
void _polylineModelCountChanged(int count);
......@@ -123,4 +125,5 @@ private:
bool _dirty;
bool _interactive;
bool _resetActive;
bool _traceMode = false;
};
......@@ -32,7 +32,6 @@ Item {
property var _dragHandlesComponent
property var _splitHandlesComponent
property bool _traceMode: false
property string _instructionText: _corridorToolsText
property real _zorderDragHandle: QGroundControl.zOrderMapItems + 3 // Highest to prevent splitting when items overlap
property real _zorderSplitHandle: QGroundControl.zOrderMapItems + 2
......@@ -96,13 +95,16 @@ Item {
}
}
on_TraceModeChanged: {
if (_traceMode) {
_instructionText = _traceText
_objMgrTraceVisuals.createObject(traceMouseAreaComponent, mapControl, false)
} else {
_instructionText = _corridorToolsText
_objMgrTraceVisuals.destroyObjects()
Connections {
target: mapPolyline
onTraceModeChanged: {
if (mapPolyline.traceMode) {
_instructionText = _traceText
_objMgrTraceVisuals.createObject(traceMouseAreaComponent, mapControl, false)
} else {
_instructionText = _corridorToolsText
_objMgrTraceVisuals.destroyObjects()
}
}
}
......@@ -112,6 +114,7 @@ Item {
_addInteractiveVisuals()
}
}
Component.onDestruction: mapPolyline.traceMode = false
QGCDynamicObjectManager { id: _objMgrCommonVisuals }
QGCDynamicObjectManager { id: _objMgrInteractiveVisuals }
......@@ -323,22 +326,22 @@ Item {
QGCButton {
_horizontalPadding: 0
text: qsTr("Basic")
visible: !_traceMode
visible: !mapPolyline.traceMode
onClicked: _resetPolyline()
}
QGCButton {
_horizontalPadding: 0
text: _traceMode ? qsTr("Done Tracing") : qsTr("Trace")
text: mapPolyline.traceMode ? qsTr("Done Tracing") : qsTr("Trace")
onClicked: {
if (_traceMode) {
if (mapPolyline.traceMode) {
if (mapPolyline.count < 2) {
_restorePreviousVertices()
}
_traceMode = false
mapPolyline.traceMode = false
} else {
_saveCurrentVertices()
_traceMode = true
mapPolyline.traceMode = true
mapPolyline.clear();
}
}
......@@ -348,7 +351,7 @@ Item {
_horizontalPadding: 0
text: qsTr("Load KML...")
onClicked: kmlLoadDialog.openForLoad()
visible: !_traceMode
visible: !mapPolyline.traceMode
}
}
}
......
......@@ -71,7 +71,7 @@ Rectangle {
QGCButton {
text: qsTr("Done With Polyline")
Layout.fillWidth: true
enabled: missionItem.corridorPolyline.isValid
enabled: missionItem.corridorPolyline.isValid && !missionItem.corridorPolyline.traceMode
onClicked: {
missionItem.wizardMode = false
editorRoot.selectNextNotReadyItem()
......
......@@ -72,7 +72,7 @@ Rectangle {
QGCButton {
text: qsTr("Done With Polygon")
Layout.fillWidth: true
enabled: missionItem.structurePolygon.isValid
enabled: missionItem.structurePolygon.isValid && !missionItem.structurePolygon.traceMode
onClicked: {
missionItem.wizardMode = false
editorRoot.selectNextNotReadyItem()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment