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