Unverified Commit eae48e1f authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #8373 from DonLakeFlyer/PolygonTrace

Track trace mode in polygon so we can use it to exit wizard mode
parents d52d9f1d 8035844d
...@@ -38,6 +38,7 @@ public: ...@@ -38,6 +38,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);
...@@ -124,6 +125,7 @@ signals: ...@@ -124,6 +125,7 @@ signals:
void interactiveChanged (bool interactive); void interactiveChanged (bool interactive);
bool isValidChanged (void); bool isValidChanged (void);
bool isEmptyChanged (void); bool isEmptyChanged (void);
void traceModeChanged (bool traceMode);
private slots: private slots:
void _polygonModelCountChanged(int count); void _polygonModelCountChanged(int count);
...@@ -146,6 +148,7 @@ private: ...@@ -146,6 +148,7 @@ private:
bool _ignoreCenterUpdates; bool _ignoreCenterUpdates;
bool _interactive; bool _interactive;
bool _resetActive; bool _resetActive;
bool _traceMode = false;
}; };
#endif #endif
...@@ -38,7 +38,6 @@ Item { ...@@ -38,7 +38,6 @@ Item {
property bool _circleRadiusDrag: false property bool _circleRadiusDrag: false
property var _circleRadiusDragCoord: QtPositioning.coordinate() property var _circleRadiusDragCoord: QtPositioning.coordinate()
property bool _editCircleRadius: false property bool _editCircleRadius: false
property bool _traceMode: false
property string _instructionText: _polygonToolsText property string _instructionText: _polygonToolsText
property var _savedVertices: [ ] property var _savedVertices: [ ]
property bool _savedCircleMode property bool _savedCircleMode
...@@ -157,7 +156,7 @@ Item { ...@@ -157,7 +156,7 @@ Item {
addEditingVisuals() addEditingVisuals()
addToolbarVisuals() addToolbarVisuals()
} else { } else {
_traceMode = false mapPolygon.traceMode = false
removeEditingVisuals() removeEditingVisuals()
removeToolVisuals() removeToolVisuals()
} }
...@@ -183,16 +182,6 @@ Item { ...@@ -183,16 +182,6 @@ Item {
onInteractiveChanged: _handleInteractiveChanged() onInteractiveChanged: _handleInteractiveChanged()
on_TraceModeChanged: {
if (_traceMode) {
_instructionText = _traceText
_objMgrTraceVisuals.createObject(traceMouseAreaComponent, mapControl, false)
} else {
_instructionText = _polygonToolsText
_objMgrTraceVisuals.destroyObjects()
}
}
on_CircleModeChanged: { on_CircleModeChanged: {
if (_circleMode) { if (_circleMode) {
addCircleVisuals() addCircleVisuals()
...@@ -201,10 +190,24 @@ Item { ...@@ -201,10 +190,24 @@ Item {
} }
} }
Connections {
target: mapPolygon
onTraceModeChanged: {
if (mapPolygon.traceMode) {
_instructionText = _traceText
_objMgrTraceVisuals.createObject(traceMouseAreaComponent, mapControl, false)
} else {
_instructionText = _polygonToolsText
_objMgrTraceVisuals.destroyObjects()
}
}
}
Component.onCompleted: { Component.onCompleted: {
addCommonVisuals() addCommonVisuals()
_handleInteractiveChanged() _handleInteractiveChanged()
} }
Component.onDestruction: mapPolygon.traceMode = false
QGCDynamicObjectManager { id: _objMgrCommonVisuals } QGCDynamicObjectManager { id: _objMgrCommonVisuals }
QGCDynamicObjectManager { id: _objMgrToolVisuals } QGCDynamicObjectManager { id: _objMgrToolVisuals }
...@@ -526,30 +529,30 @@ Item { ...@@ -526,30 +529,30 @@ Item {
QGCButton { QGCButton {
_horizontalPadding: 0 _horizontalPadding: 0
text: qsTr("Basic") text: qsTr("Basic")
visible: !_traceMode visible: !mapPolygon.traceMode
onClicked: _resetPolygon() onClicked: _resetPolygon()
} }
QGCButton { QGCButton {
_horizontalPadding: 0 _horizontalPadding: 0
text: qsTr("Circular") text: qsTr("Circular")
visible: !_traceMode visible: !mapPolygon.traceMode
onClicked: _resetCircle() onClicked: _resetCircle()
} }
QGCButton { QGCButton {
_horizontalPadding: 0 _horizontalPadding: 0
text: _traceMode ? qsTr("Done Tracing") : qsTr("Trace") text: mapPolygon.traceMode ? qsTr("Done Tracing") : qsTr("Trace")
onClicked: { onClicked: {
if (_traceMode) { if (mapPolygon.traceMode) {
if (mapPolygon.count < 3) { if (mapPolygon.count < 3) {
_restorePreviousVertices() _restorePreviousVertices()
} }
_traceMode = false mapPolygon.traceMode = false
} else { } else {
_saveCurrentVertices() _saveCurrentVertices()
_circleMode = false _circleMode = false
_traceMode = true mapPolygon.traceMode = true
mapPolygon.clear(); mapPolygon.clear();
} }
} }
...@@ -559,7 +562,7 @@ Item { ...@@ -559,7 +562,7 @@ Item {
_horizontalPadding: 0 _horizontalPadding: 0
text: qsTr("Load KML/SHP...") text: qsTr("Load KML/SHP...")
onClicked: kmlOrSHPLoadDialog.openForLoad() onClicked: kmlOrSHPLoadDialog.openForLoad()
visible: !_traceMode visible: !mapPolygon.traceMode
} }
} }
} }
......
...@@ -80,7 +80,7 @@ Rectangle { ...@@ -80,7 +80,7 @@ Rectangle {
QGCButton { QGCButton {
text: qsTr("Done With Polygon") text: qsTr("Done With Polygon")
Layout.fillWidth: true Layout.fillWidth: true
enabled: missionItem.surveyAreaPolygon.isValid enabled: missionItem.surveyAreaPolygon.isValid && !missionItem.surveyAreaPolygon.traceMode
onClicked: { onClicked: {
if (!_presetsAvailable) { if (!_presetsAvailable) {
missionItem.wizardMode = false missionItem.wizardMode = false
......
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