Commit b0c57f4b authored by DoinLakeFlyer's avatar DoinLakeFlyer

parent d52d9f1d
...@@ -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,8 +182,18 @@ Item { ...@@ -183,8 +182,18 @@ Item {
onInteractiveChanged: _handleInteractiveChanged() onInteractiveChanged: _handleInteractiveChanged()
on_TraceModeChanged: { on_CircleModeChanged: {
if (_traceMode) { if (_circleMode) {
addCircleVisuals()
} else {
_objMgrCircleVisuals.destroyObjects()
}
}
Connections {
target: mapPolygon
onTraceModeChanged: {
if (mapPolygon.traceMode) {
_instructionText = _traceText _instructionText = _traceText
_objMgrTraceVisuals.createObject(traceMouseAreaComponent, mapControl, false) _objMgrTraceVisuals.createObject(traceMouseAreaComponent, mapControl, false)
} else { } else {
...@@ -192,19 +201,13 @@ Item { ...@@ -192,19 +201,13 @@ Item {
_objMgrTraceVisuals.destroyObjects() _objMgrTraceVisuals.destroyObjects()
} }
} }
on_CircleModeChanged: {
if (_circleMode) {
addCircleVisuals()
} else {
_objMgrCircleVisuals.destroyObjects()
}
} }
Component.onCompleted: { Component.onCompleted: {
addCommonVisuals() addCommonVisuals()
_handleInteractiveChanged() _handleInteractiveChanged()
} }
Component.onDestruction: map.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