diff --git a/src/FlightDisplay/FlightDisplayView.qml b/src/FlightDisplay/FlightDisplayView.qml index f14eba3ae5b85e2ff7157c6c3b30d3d7a899d9ab..6712dbd901f3f956bb37d2d2f2d6f1e63cb14cca 100644 --- a/src/FlightDisplay/FlightDisplayView.qml +++ b/src/FlightDisplay/FlightDisplayView.qml @@ -607,7 +607,7 @@ QGCView { anchors.leftMargin: ScreenTools.defaultFontPixelWidth anchors.bottomMargin: ScreenTools.defaultFontPixelWidth maxWidth: 300 - maxHeight: 500 + maxHeight: parent.height - toolStrip.height - ScreenTools.defaultFontPixelWidth*4 wimaController: wimaController diff --git a/src/FlightDisplay/FlightDisplayWimaMenu.qml b/src/FlightDisplay/FlightDisplayWimaMenu.qml index 350fdb5bdf1fe0136556453ff69f1dcacf0868a7..45670d651b8534ba237bbf93e1da9a1ca1b466d2 100644 --- a/src/FlightDisplay/FlightDisplayWimaMenu.qml +++ b/src/FlightDisplay/FlightDisplayWimaMenu.qml @@ -30,7 +30,7 @@ Item { property bool _controllerValid: planMasterController !== undefined property real _controllerProgressPct: _controllerValid ? planMasterController.missionController.progressPct : 0 - property real _margins: ScreenTools.defaultPixelWidth*0.3 + property real _margins: ScreenTools.defaultFontPixelWidth / 2 signal initSmartRTL(); @@ -60,7 +60,7 @@ Item { // box containing all items Rectangle { // maybe replace with column and remove anchors => dynamic height: id: mainFrame - height: enableWima.height + flickable.height + height: enableWima.height + flickable.height + _margins*2 width: Math.max(enableWima.width, flickable.width) color: enableWima.enableWimaBoolean ? qgcPal.window : "transparent" radius: Math.min(height, width)/50 @@ -69,30 +69,9 @@ Item { property real _margins: _root._margins Component.onCompleted: { - console.log('onCompleted') - console.log('height') - console.log(height) - console.log('width') - console.log(width) - console.log(enableWima.width) - console.log(enableWima.height) - console.log(flickable.contentWidth) - console.log(flickable.contentHeight) - width = enableWima.width + flickable.contentWidth + 2*_margins - console.log('width') - console.log(width) - } - - onHeightChanged: { - console.log('height') - console.log(height) - //_root.height = mainFrame.height - } - - onWidthChanged: { - console.log('width') - console.log(width) - //_root.width = mainFrame.width + console.log('mainFrame onCompleted') + console.log('_margins') + console.log(_margins) } // checkbox to enable/ disable wima @@ -100,24 +79,13 @@ Item { id: enableWima anchors.horizontalCenter: flickable.horizontalCenter anchors.bottom: flickable.top + anchors.bottomMargin: _margins confirmText: enableWimaBoolean ? qsTr("disable WiMA") : qsTr("enable WiMA") property var enableWimaFact: wimaController.enableWimaController property bool enableWimaBoolean: enableWimaFact.value - /*onXChanged: { - console.log('x') - } - - onYChanged: { - console.log('y') - } - - Component.onCompleted: { - enableWimaFact.value = true - }*/ - onAccept: { if (enableWimaBoolean) { enableWimaFact.value = false @@ -145,8 +113,6 @@ Item { timer.start() } - - onExited: timer.start() } Timer { @@ -180,19 +146,6 @@ Item { contentHeight: columnWrapper.height contentWidth: columnWrapper.width - - onContentHeightChanged: { - console.log('contentHeight') - console.log(contentHeight) - //mainFrame.height = enableWima.enableWimaBoolean ? Math.min(parent.maxHeight, enableWima.height + flickable.contentHeight + 2*_margins) : enableWima.height + _margins - } - - onContentWidthChanged: { - console.log('contentWidth') - console.log(contentWidth) - //mainFrame.width = enableWima.enableWimaBoolean ? Math.min(parent.maxWidth, flickable.contentWidth + 2*_margins) : enableWima.width - } - Row { id: columnWrapper Item{ // spacer diff --git a/src/PlanView/CircularSurveyItemEditor.qml b/src/PlanView/CircularSurveyItemEditor.qml index 8f30522660bc1e9e176b5d30aeabcbcc1e059982..347a348c4253410f89058eaba0e124bd00aff223 100644 --- a/src/PlanView/CircularSurveyItemEditor.qml +++ b/src/PlanView/CircularSurveyItemEditor.qml @@ -131,7 +131,7 @@ Rectangle { } } - ColumnLayout { + Column { anchors.left: parent.left anchors.right: parent.right spacing: _margin @@ -144,7 +144,6 @@ Rectangle { QGCCheckBox { id: relAlt - Layout.alignment: Qt.AlignLeft text: qsTr("Relative altitude") checked: missionItem.cameraCalc.distanceToSurfaceRelative enabled: missionItem.cameraCalc.isManualCamera && !missionItem.followTerrain @@ -157,15 +156,14 @@ Rectangle { } } - QGCButton { - text: qsTr("Reset Reference") - onClicked: missionItem.resetReference(); - Layout.fillWidth: true + FactCheckBox { + text: qsTr("Reverse Path") + fact: missionItem.reverse } QGCButton { - text: qsTr("Rotate Entry Point") - onClicked: missionItem.rotateEntryPoint(); + text: qsTr("Reset Reference") + onClicked: missionItem.resetReference(); Layout.fillWidth: true } @@ -226,10 +224,10 @@ Rectangle { } } - SectionHeader { + /*SectionHeader { id: statsHeader text: qsTr("Statistics") - } + }*/ //TransectStyleComplexItemStats { } } // Column diff --git a/src/QmlControls/MissionItemIndexLabel.qml b/src/QmlControls/MissionItemIndexLabel.qml index 28a8eed3a9924700b927d5c471809b42538459b6..92869d17073beddff5dd893624539cb7bc7ea82b 100644 --- a/src/QmlControls/MissionItemIndexLabel.qml +++ b/src/QmlControls/MissionItemIndexLabel.qml @@ -11,6 +11,9 @@ Canvas { height: _height signal clicked + signal released + signal entered + signal exited property string label ///< Label to show to the side of the index indicator property int index: 0 ///< Index to show in the indicator, 0 will show single char label instead, -1 first char of label in indicator full label to the side @@ -120,5 +123,14 @@ Canvas { focus = true parent.clicked() } + onReleased: { + parent.released() + } + onEntered: { + parent.entered() + } + onExited: { + parent.exited() + } } } diff --git a/src/Wima/CircularSurvey.SettingsGroup.json b/src/Wima/CircularSurvey.SettingsGroup.json index 68c83f6114adf449ef753dabc4892edf37f101e1..2c54c8954347bd3b05e733d4ccedbb0dba4e23dd 100644 --- a/src/Wima/CircularSurvey.SettingsGroup.json +++ b/src/Wima/CircularSurvey.SettingsGroup.json @@ -32,5 +32,11 @@ "shortDescription": "Determines whether the transects are arranged in a snake or a zig-zag manner.", "type": "bool", "defaultValue": 1 +}, +{ + "name": "Reverse", + "shortDescription": "Reverses the transect path", + "type": "bool", + "defaultValue": 0 } ] diff --git a/src/Wima/CircularSurveyComplexItem.cc b/src/Wima/CircularSurveyComplexItem.cc index fcdeb1ccc2d4c9a2b1e34d48ea0d9b06c25f5062..6bc9aab78f2c4821bfd88c726897505f8ed09ba9 100644 --- a/src/Wima/CircularSurveyComplexItem.cc +++ b/src/Wima/CircularSurveyComplexItem.cc @@ -8,6 +8,7 @@ const char* CircularSurveyComplexItem::deltaRName = "DeltaR"; const char* CircularSurveyComplexItem::deltaAlphaName = "DeltaAlpha"; const char* CircularSurveyComplexItem::transectMinLengthName = "TransectMinLength"; const char* CircularSurveyComplexItem::isSnakePathName = "IsSnakePath"; +const char* CircularSurveyComplexItem::reverseName = "Reverse"; const char* CircularSurveyComplexItem::jsonComplexItemTypeValue = "circularSurvey"; @@ -26,8 +27,11 @@ CircularSurveyComplexItem::CircularSurveyComplexItem(Vehicle *vehicle, bool flyV , _deltaR (settingsGroup, _metaDataMap[deltaRName]) , _deltaAlpha (settingsGroup, _metaDataMap[deltaAlphaName]) , _transectMinLength (settingsGroup, _metaDataMap[transectMinLengthName]) - , _isSnakePath (settingsGroup, _metaDataMap[isSnakePathName]) + , _isSnakePath (settingsGroup, _metaDataMap[isSnakePathName]) + , _reverse (settingsGroup, _metaDataMap[reverseName]) , _isInitialized (false) + , _reverseOnly (false) + , _referencePointBeingChanged (false) , _updateCounter (0) { _editorQml = "qrc:/qml/CircularSurveyItemEditor.qml"; @@ -35,6 +39,7 @@ CircularSurveyComplexItem::CircularSurveyComplexItem(Vehicle *vehicle, bool flyV connect(&_deltaAlpha, &Fact::valueChanged, this, &CircularSurveyComplexItem::_rebuildTransects); connect(&_transectMinLength, &Fact::valueChanged, this, &CircularSurveyComplexItem::_rebuildTransects); connect(&_isSnakePath, &Fact::valueChanged, this, &CircularSurveyComplexItem::_rebuildTransects); + connect(&_reverse, &Fact::valueChanged, this, &CircularSurveyComplexItem::_reverseTransects); connect(this, &CircularSurveyComplexItem::refPointChanged, this, &CircularSurveyComplexItem::_rebuildTransects); //connect(&_cameraCalc.distanceToSurface(), &Fact::rawValueChanged, this->) @@ -45,6 +50,11 @@ void CircularSurveyComplexItem::resetReference() setRefPoint(_surveyAreaPolygon.center()); } +void CircularSurveyComplexItem::setReferencePointBeingChanged(bool changeing) +{ + _referencePointBeingChanged = changeing; +} + void CircularSurveyComplexItem::setRefPoint(const QGeoCoordinate &refPt) { if (refPt != _referencePoint){ @@ -83,6 +93,11 @@ bool CircularSurveyComplexItem::isInitialized() return _isInitialized; } +bool CircularSurveyComplexItem::referencePointBeingChanged() +{ + return _referencePointBeingChanged; +} + bool CircularSurveyComplexItem::load(const QJsonObject &complexObject, int sequenceNumber, QString &errorString) { // We need to pull version first to determine what validation/conversion needs to be performed @@ -350,7 +365,7 @@ void CircularSurveyComplexItem::_rebuildTransectsPhase1() using namespace PolygonCalculus; using namespace PlanimetryCalculus; - if (!_isInitialized) + if (!_isInitialized || _referencePointBeingChanged) return; _updateCounter++; @@ -369,6 +384,25 @@ void CircularSurveyComplexItem::_rebuildTransectsPhase1() return; } + // reverse transects and return + if (_reverseOnly) { + QList> transectsReverse; + + for (auto list : _transects) { + QList listReverse; + for (auto coordinate : list) + listReverse.prepend(coordinate); + + transectsReverse.prepend(listReverse); + } + + _transects.clear(); + _transects.append(transectsReverse); + + _reverseOnly = false; + return; + } + _transects.clear(); QPolygonF surveyPolygon = toQPolygonF(toCartesian2D(_surveyAreaPolygon.coordinateList(), _referencePoint)); @@ -579,8 +613,11 @@ void CircularSurveyComplexItem::_rebuildTransectsPhase1() // convert to CoordInfo_t - for ( const QList &transect : optiPath) { + for ( QList &transect : optiPath) { // for ( const QList &transect : fullPath) { + if (_reverse.rawValue().toBool()) + PolygonCalculus::reversePath(transect); + QList geoPath = toGeo(transect, _referencePoint); QList transectList; for ( const QGeoCoordinate &coordinate : geoPath) { @@ -609,6 +646,13 @@ void CircularSurveyComplexItem::_recalcCameraShots() _cameraShots = 0; } +void CircularSurveyComplexItem::_reverseTransects() +{ + _reverseOnly = true; + _rebuildTransects(); +} + + Fact *CircularSurveyComplexItem::transectMinLength() { @@ -620,6 +664,11 @@ Fact *CircularSurveyComplexItem::isSnakePath() return &_isSnakePath; } +Fact *CircularSurveyComplexItem::reverse() +{ + return &_reverse; +} + diff --git a/src/Wima/CircularSurveyComplexItem.h b/src/Wima/CircularSurveyComplexItem.h index ed82ee04ee4482a1d8034377ca8c95ad5c6e0484..8c9cee4b7913242af854365e08b3f596844863ef 100644 --- a/src/Wima/CircularSurveyComplexItem.h +++ b/src/Wima/CircularSurveyComplexItem.h @@ -23,9 +23,11 @@ public: Q_PROPERTY(Fact* deltaAlpha READ deltaAlpha CONSTANT) Q_PROPERTY(Fact* transectMinLength READ transectMinLength CONSTANT) Q_PROPERTY(Fact* isSnakePath READ isSnakePath CONSTANT) + Q_PROPERTY(Fact* reverse READ reverse CONSTANT) Q_PROPERTY(bool isInitialized READ isInitialized WRITE setIsInitialized NOTIFY isInitializedChanged) Q_INVOKABLE void resetReference(void); + Q_INVOKABLE void setReferencePointBeingChanged(bool changeing); // used by gui to indicate a changeing reference point (dagging by user) // Property setters void setRefPoint(const QGeoCoordinate &refPt); @@ -38,8 +40,10 @@ public: Fact *deltaAlpha(); Fact *transectMinLength(); Fact *isSnakePath(); + Fact *reverse(); // Is true if survey was automatically generated, prevents initialisation from gui. bool isInitialized(); + bool referencePointBeingChanged(); // returns true if the referencepoint is being changed (dragged by user) // Overrides from ComplexMissionItem bool load (const QJsonObject& complexObject, int sequenceNumber, QString& errorString) final; @@ -64,6 +68,7 @@ public: static const char* deltaAlphaName; static const char* transectMinLengthName; static const char* isSnakePathName; + static const char* reverseName; static const char* jsonComplexItemTypeValue; static const char* jsonDeltaRKey; @@ -80,12 +85,14 @@ signals: private slots: // Overrides from TransectStyleComplexItem - void _rebuildTransectsPhase1 (void) final; + void _rebuildTransectsPhase1 (void) final; // do not call this function, it is called by TransectStyleComplexItem::_rebuildTransects() void _recalcComplexDistance (void) final; void _recalcCameraShots (void) final; + void _reverseTransects (void); signals: + private: void _appendLoadedMissionItems(QList& items, QObject* missionItemParent); void _buildAndAppendMissionItems(QList& items, QObject* missionItemParent); @@ -100,10 +107,13 @@ private: SettingsFact _deltaAlpha; // angle discretisation of the circles SettingsFact _transectMinLength; // minimal transect lenght, transects are rejected if they are shorter than this value SettingsFact _isSnakePath; // bool value, determining if transects are connected in a snake like or zig zag like manner + SettingsFact _reverse; // reverses the _transects path QTimer _updateTimer; bool _isInitialized; // indicates if the polygon and refpoint etc. are initialized, prevents reinitialisation from gui and execution of _rebuildTransectsPhase1 during init from gui + bool _reverseOnly; // if this is true _rebuildTransectsPhase1() will reverse the path only, _rebuildTransectsPhase1() resets _reverseOnly + bool _referencePointBeingChanged; // is set to true by gui, if user is changeing the reference point int _updateCounter; diff --git a/src/Wima/WimaPlaner.cc b/src/Wima/WimaPlaner.cc index 2f06d60b23ef888ac437ce6ad25ea3455a6ebad3..9dace16b01dfcff85129203c346ecec1e88ec483 100644 --- a/src/Wima/WimaPlaner.cc +++ b/src/Wima/WimaPlaner.cc @@ -40,6 +40,11 @@ WimaPlaner::WimaPlaner(QObject *parent) connect(&_autoLoadTimer, &QTimer::timeout, this, &WimaPlaner::autoLoadMission); _autoLoadTimer.setSingleShot(true); _autoLoadTimer.start(300); + + _calcArrivalAndReturnPathTimer.setInterval(100); + _calcArrivalAndReturnPathTimer.setSingleShot(true); + connect(&_calcArrivalAndReturnPathTimer, &QTimer::timeout, this, &WimaPlaner::calcArrivalAndReturnPath); + } QmlObjectListModel* WimaPlaner::visualItems() @@ -237,17 +242,19 @@ bool WimaPlaner::updateMission() _lastSurveyRefPoint = _measurementArea.center(); _surveyRefChanging = false; _circularSurvey->setIsInitialized(true); // prevents reinitialisation from gui - connect(_circularSurvey->deltaR(), &Fact::rawValueChanged, this, &WimaPlaner::calcArrivalAndReturnPath); - connect(_circularSurvey->deltaAlpha(), &Fact::rawValueChanged, this, &WimaPlaner::calcArrivalAndReturnPath); - connect(_circularSurvey->isSnakePath(), &Fact::rawValueChanged, this, &WimaPlaner::calcArrivalAndReturnPath); - connect(_circularSurvey->transectMinLength(), &Fact::rawValueChanged, this, &WimaPlaner::calcArrivalAndReturnPath); +// connect(_circularSurvey->deltaR(), &Fact::rawValueChanged, this, &WimaPlaner::startCalcArrivalAndReturnTimer); +// connect(_circularSurvey->deltaAlpha(), &Fact::rawValueChanged, this, &WimaPlaner::startCalcArrivalAndReturnTimer); +// connect(_circularSurvey->isSnakePath(), &Fact::rawValueChanged, this, &WimaPlaner::startCalcArrivalAndReturnTimer); +// connect(_circularSurvey->transectMinLength(), &Fact::rawValueChanged, this, &WimaPlaner::startCalcArrivalAndReturnTimer); +// connect(_circularSurvey->reverse(), &Fact::rawValueChanged, this, &WimaPlaner::startCalcArrivalAndReturnTimer); + connect(_circularSurvey, &TransectStyleComplexItem::visualTransectPointsChanged, this, &WimaPlaner::startCalcArrivalAndReturnTimer); } // update survey area _circularSurvey->surveyAreaPolygon()->clear(); _circularSurvey->surveyAreaPolygon()->appendVertices(_measurementArea.coordinateList()); - calcArrivalAndReturnPath(); + //calcArrivalAndReturnPath(); setReadyForSync(true); return true; @@ -438,10 +445,12 @@ bool WimaPlaner::loadFromFile(const QString &filename) _lastSurveyRefPoint = _circularSurvey->refPoint(); _surveyRefChanging = false; _circularSurvey->setIsInitialized(true); // prevents reinitialisation from gui - connect(_circularSurvey->deltaR(), &Fact::rawValueChanged, this, &WimaPlaner::calcArrivalAndReturnPath); - connect(_circularSurvey->deltaAlpha(), &Fact::rawValueChanged, this, &WimaPlaner::calcArrivalAndReturnPath); - connect(_circularSurvey->isSnakePath(), &Fact::rawValueChanged, this, &WimaPlaner::calcArrivalAndReturnPath); - connect(_circularSurvey->transectMinLength(), &Fact::rawValueChanged, this, &WimaPlaner::calcArrivalAndReturnPath); +// connect(_circularSurvey->deltaR(), &Fact::rawValueChanged, this, &WimaPlaner::startCalcArrivalAndReturnTimer); +// connect(_circularSurvey->deltaAlpha(), &Fact::rawValueChanged, this, &WimaPlaner::startCalcArrivalAndReturnTimer); +// connect(_circularSurvey->isSnakePath(), &Fact::rawValueChanged, this, &WimaPlaner::startCalcArrivalAndReturnTimer); +// connect(_circularSurvey->transectMinLength(), &Fact::rawValueChanged, this, &WimaPlaner::startCalcArrivalAndReturnTimer); +// connect(_circularSurvey->reverse(), &Fact::rawValueChanged, this, &WimaPlaner::startCalcArrivalAndReturnTimer); + connect(_circularSurvey, &TransectStyleComplexItem::visualTransectPointsChanged, this, &WimaPlaner::startCalcArrivalAndReturnTimer); break; } } @@ -481,6 +490,7 @@ void WimaPlaner::recalcPolygonInteractivity(int index) bool WimaPlaner::calcArrivalAndReturnPath() { + static int counter = 0; setReadyForSync(false); // extract old survey data @@ -595,6 +605,9 @@ bool WimaPlaner::calcArrivalAndReturnPath() _missionController->setCurrentPlanViewIndex(missionItems->indexOf(_circularSurvey), false); setSyncronizedWithControllerFalse(); setReadyForSync(true); + counter++; + qWarning() << "WimaPlaner::calcArrivalAndReturnPath(): " << counter; + return true; } @@ -752,20 +765,20 @@ void WimaPlaner::updateTimerSlot() // Check if parameter has changed, wait until it stops changing, update mission // circular survey reference point - if (_missionController != nullptr - && _missionController->visualItems()->indexOf(_circularSurvey) != -1 - && _circularSurvey != nullptr) - { - if (_surveyRefChanging) { - if (_circularSurvey->refPoint() == _lastSurveyRefPoint) { // is it still changing? - calcArrivalAndReturnPath(); - _surveyRefChanging = false; - } - } else { - if (_circularSurvey->refPoint() != _lastSurveyRefPoint) // does it started changing? - _surveyRefChanging = true; - } - } +// if (_missionController != nullptr +// && _missionController->visualItems()->indexOf(_circularSurvey) != -1 +// && _circularSurvey != nullptr) +// { +// if (_surveyRefChanging) { +// if (_circularSurvey->refPoint() == _lastSurveyRefPoint) { // is it still changing? +// calcArrivalAndReturnPath(); +// _surveyRefChanging = false; +// } +// } else { +// if (_circularSurvey->refPoint() != _lastSurveyRefPoint) // does it started changing? +// _surveyRefChanging = true; +// } +// } // measurementArea if (_measurementAreaChanging) { @@ -802,10 +815,10 @@ void WimaPlaner::updateTimerSlot() // update old values - if (_missionController != nullptr - && _missionController->visualItems()->indexOf(_circularSurvey) != -1 - && _circularSurvey != nullptr) - _lastSurveyRefPoint = _circularSurvey->refPoint(); +// if (_missionController != nullptr +// && _missionController->visualItems()->indexOf(_circularSurvey) != -1 +// && _circularSurvey != nullptr) +// _lastSurveyRefPoint = _circularSurvey->refPoint(); _lastMeasurementAreaPath = _measurementArea.path(); _lastCorridorPath = _corridor.path(); @@ -823,6 +836,11 @@ void WimaPlaner::autoLoadMission() pushToContainer(); } +void WimaPlaner::startCalcArrivalAndReturnTimer() +{ + _calcArrivalAndReturnPathTimer.start(); +} + QJsonDocument WimaPlaner::saveToJson(FileType fileType) { /// This function save all areas (of WimaPlaner) and all mission items (of MissionController) to a QJsonDocument diff --git a/src/Wima/WimaPlaner.h b/src/Wima/WimaPlaner.h index c07c8c1bfad5cca67c87107005d410ebb6ac1824..f916d771058a7aafbe907c2749bfa4fdf8f1ebdf 100644 --- a/src/Wima/WimaPlaner.h +++ b/src/Wima/WimaPlaner.h @@ -29,6 +29,8 @@ #include "PlanimetryCalculus.h" #include "GeoUtilities.h" +#include "QSignalBlocker" + #define TEST_FUN 0 #if TEST_FUN @@ -134,6 +136,7 @@ private slots: void updateTimerSlot (); void setSyncronizedWithControllerFalse (void); void autoLoadMission (void); + void startCalcArrivalAndReturnTimer (void); private: signals: void joinedAreaValidChanged(); @@ -177,4 +180,5 @@ private: bool _readyForSync; // gets set by updateMission and calcArrivalAndReturnPath QTimer _autoLoadTimer; // timer to auto load mission after some time, prevents seg. faults + QTimer _calcArrivalAndReturnPathTimer; }; diff --git a/src/WimaView/CoordinateIndicator.qml b/src/WimaView/CoordinateIndicator.qml index cc6442c16eb515c79d6828d0ff0f5661de42cb92..b8428ae38b47756f7b4ab06f8f07abf204c1e743 100644 --- a/src/WimaView/CoordinateIndicator.qml +++ b/src/WimaView/CoordinateIndicator.qml @@ -14,6 +14,9 @@ MapQuickItem { property bool checked signal clicked + signal released + signal entered + signal exited anchorPoint.x: sourceItem.anchorPointX anchorPoint.y: sourceItem.anchorPointY @@ -27,6 +30,9 @@ MapQuickItem { gimbalYaw: 0 vehicleYaw: 0 showGimbalYaw: false - onClicked: _item.clicked() + onClicked: _item.clicked() + onReleased: _item.released() + onEntered: _item.entered() + onExited: _item.exited() } } diff --git a/src/WimaView/CoordinateIndicatorDrag.qml b/src/WimaView/CoordinateIndicatorDrag.qml index bcdef05afc84f15c26260d9f42dc984fbb1855f4..30686c66fcbb7ec621c9e96b3dbb7469fc5321b8 100644 --- a/src/WimaView/CoordinateIndicatorDrag.qml +++ b/src/WimaView/CoordinateIndicatorDrag.qml @@ -32,6 +32,7 @@ Rectangle { signal clicked signal dragStart signal dragStop + signal released property bool _preventCoordinateBindingLoop: false @@ -77,6 +78,10 @@ Rectangle { itemDragger.clicked() } + onReleased: { + itemDragger.released() + } + property bool dragActive: drag.active onDragActiveChanged: { if (dragActive) { diff --git a/src/WimaView/DragCoordinate.qml b/src/WimaView/DragCoordinate.qml index c4f6e1677560ee1aba647a5f7c7e08c7f0f9069c..7d64617831fd7d806f1e7ad4a64bf64dff206f9b 100644 --- a/src/WimaView/DragCoordinate.qml +++ b/src/WimaView/DragCoordinate.qml @@ -34,6 +34,14 @@ Item { property bool _dragAreaShowing: false signal clicked(int sequenceNumber) + signal released(int sequenceNumber) + signal entered(int sequenceNumber) + signal exited(int sequenceNumber) + + signal dragStart() + signal dragStop() + signal dragClicked() + signal dragReleased() function hideItemVisuals() { if (_itemVisualShowing) { @@ -94,6 +102,11 @@ Item { Component.onCompleted: itemCoordinate = _root.coordinate onItemCoordinateChanged: _root.coordinate = itemCoordinate + + onDragStart: _root.dragStart() + onDragStop: _root.dragStop() + onClicked: _root.dragClicked() + onReleased: _root.dragReleased() } } @@ -107,7 +120,10 @@ Item { sequenceNumber: _root.sequenceNumber coordinate: _root.coordinate - onClicked: _root.clicked(_missionItem.sequenceNumber) + onClicked: _root.clicked(_missionItem.sequenceNumber) + onReleased: _root.released(_missionItem.sequenceNumber) + onEntered: _root.entered(_missionItem.sequenceNumber) + onExited: _root.exited(_missionItem.sequenceNumber) } } } diff --git a/src/WimaView/SphericalSurveyMapVisual.qml b/src/WimaView/SphericalSurveyMapVisual.qml index 38bfcfc8a04a1302a7589494e4ff74ea46e8eef6..8f3677b5cc478e3985e410b4b24ecd739077a6b8 100644 --- a/src/WimaView/SphericalSurveyMapVisual.qml +++ b/src/WimaView/SphericalSurveyMapVisual.qml @@ -186,7 +186,20 @@ Item { } } - onClicked: _root.clicked(_missionItem.sequenceNumber) + onClicked: { + _root.clicked(_missionItem.sequenceNumber) + _missionItem.setReferencePointBeingChanged(true) + } + + onDragClicked: {// replace with entered + _missionItem.setReferencePointBeingChanged(true) + console.log('onDragClicked') + } + + onDragReleased: { // replace with exited + _missionItem.setReferencePointBeingChanged(false) + console.log('onDragReleased') + } } } }