Unverified Commit 92eff455 authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #8397 from DonLakeFlyer/DoneTracing

Plan: Structure/Corridor Fix Done Tracing <-> Done PolyFoo in wizard relationship
parents dccfcc1f e38db208
...@@ -32,6 +32,7 @@ public: ...@@ -32,6 +32,7 @@ public:
Q_PROPERTY(bool interactive READ interactive WRITE setInteractive NOTIFY interactiveChanged) Q_PROPERTY(bool interactive READ interactive WRITE setInteractive NOTIFY interactiveChanged)
Q_PROPERTY(bool isValid READ isValid NOTIFY isValidChanged) Q_PROPERTY(bool isValid READ isValid NOTIFY isValidChanged)
Q_PROPERTY(bool empty READ empty NOTIFY isEmptyChanged) Q_PROPERTY(bool empty READ empty NOTIFY isEmptyChanged)
Q_PROPERTY(bool traceMode MEMBER _traceMode NOTIFY traceModeChanged)
Q_INVOKABLE void clear(void); Q_INVOKABLE void clear(void);
Q_INVOKABLE void appendVertex(const QGeoCoordinate& coordinate); Q_INVOKABLE void appendVertex(const QGeoCoordinate& coordinate);
...@@ -106,6 +107,7 @@ signals: ...@@ -106,6 +107,7 @@ signals:
void interactiveChanged (bool interactive); void interactiveChanged (bool interactive);
void isValidChanged (void); void isValidChanged (void);
void isEmptyChanged (void); void isEmptyChanged (void);
void traceModeChanged (bool traceMode);
private slots: private slots:
void _polylineModelCountChanged(int count); void _polylineModelCountChanged(int count);
...@@ -123,4 +125,5 @@ private: ...@@ -123,4 +125,5 @@ private:
bool _dirty; bool _dirty;
bool _interactive; bool _interactive;
bool _resetActive; bool _resetActive;
bool _traceMode = false;
}; };
...@@ -32,7 +32,6 @@ Item { ...@@ -32,7 +32,6 @@ Item {
property var _dragHandlesComponent property var _dragHandlesComponent
property var _splitHandlesComponent property var _splitHandlesComponent
property bool _traceMode: false
property string _instructionText: _corridorToolsText property string _instructionText: _corridorToolsText
property real _zorderDragHandle: QGroundControl.zOrderMapItems + 3 // Highest to prevent splitting when items overlap property real _zorderDragHandle: QGroundControl.zOrderMapItems + 3 // Highest to prevent splitting when items overlap
property real _zorderSplitHandle: QGroundControl.zOrderMapItems + 2 property real _zorderSplitHandle: QGroundControl.zOrderMapItems + 2
...@@ -96,13 +95,16 @@ Item { ...@@ -96,13 +95,16 @@ Item {
} }
} }
on_TraceModeChanged: { Connections {
if (_traceMode) { target: mapPolyline
_instructionText = _traceText onTraceModeChanged: {
_objMgrTraceVisuals.createObject(traceMouseAreaComponent, mapControl, false) if (mapPolyline.traceMode) {
} else { _instructionText = _traceText
_instructionText = _corridorToolsText _objMgrTraceVisuals.createObject(traceMouseAreaComponent, mapControl, false)
_objMgrTraceVisuals.destroyObjects() } else {
_instructionText = _corridorToolsText
_objMgrTraceVisuals.destroyObjects()
}
} }
} }
...@@ -112,6 +114,7 @@ Item { ...@@ -112,6 +114,7 @@ Item {
_addInteractiveVisuals() _addInteractiveVisuals()
} }
} }
Component.onDestruction: mapPolyline.traceMode = false
QGCDynamicObjectManager { id: _objMgrCommonVisuals } QGCDynamicObjectManager { id: _objMgrCommonVisuals }
QGCDynamicObjectManager { id: _objMgrInteractiveVisuals } QGCDynamicObjectManager { id: _objMgrInteractiveVisuals }
...@@ -323,22 +326,22 @@ Item { ...@@ -323,22 +326,22 @@ Item {
QGCButton { QGCButton {
_horizontalPadding: 0 _horizontalPadding: 0
text: qsTr("Basic") text: qsTr("Basic")
visible: !_traceMode visible: !mapPolyline.traceMode
onClicked: _resetPolyline() onClicked: _resetPolyline()
} }
QGCButton { QGCButton {
_horizontalPadding: 0 _horizontalPadding: 0
text: _traceMode ? qsTr("Done Tracing") : qsTr("Trace") text: mapPolyline.traceMode ? qsTr("Done Tracing") : qsTr("Trace")
onClicked: { onClicked: {
if (_traceMode) { if (mapPolyline.traceMode) {
if (mapPolyline.count < 2) { if (mapPolyline.count < 2) {
_restorePreviousVertices() _restorePreviousVertices()
} }
_traceMode = false mapPolyline.traceMode = false
} else { } else {
_saveCurrentVertices() _saveCurrentVertices()
_traceMode = true mapPolyline.traceMode = true
mapPolyline.clear(); mapPolyline.clear();
} }
} }
...@@ -348,7 +351,7 @@ Item { ...@@ -348,7 +351,7 @@ Item {
_horizontalPadding: 0 _horizontalPadding: 0
text: qsTr("Load KML...") text: qsTr("Load KML...")
onClicked: kmlLoadDialog.openForLoad() onClicked: kmlLoadDialog.openForLoad()
visible: !_traceMode visible: !mapPolyline.traceMode
} }
} }
} }
......
...@@ -71,7 +71,7 @@ Rectangle { ...@@ -71,7 +71,7 @@ Rectangle {
QGCButton { QGCButton {
text: qsTr("Done With Polyline") text: qsTr("Done With Polyline")
Layout.fillWidth: true Layout.fillWidth: true
enabled: missionItem.corridorPolyline.isValid enabled: missionItem.corridorPolyline.isValid && !missionItem.corridorPolyline.traceMode
onClicked: { onClicked: {
missionItem.wizardMode = false missionItem.wizardMode = false
editorRoot.selectNextNotReadyItem() editorRoot.selectNextNotReadyItem()
......
...@@ -72,7 +72,7 @@ Rectangle { ...@@ -72,7 +72,7 @@ Rectangle {
QGCButton { QGCButton {
text: qsTr("Done With Polygon") text: qsTr("Done With Polygon")
Layout.fillWidth: true Layout.fillWidth: true
enabled: missionItem.structurePolygon.isValid enabled: missionItem.structurePolygon.isValid && !missionItem.structurePolygon.traceMode
onClicked: { onClicked: {
missionItem.wizardMode = false missionItem.wizardMode = false
editorRoot.selectNextNotReadyItem() 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