diff --git a/ToDo.txt b/ToDo.txt new file mode 100644 index 0000000000000000000000000000000000000000..7fae9ae45e572561ed4efabd654deaf7b8f110e0 --- /dev/null +++ b/ToDo.txt @@ -0,0 +1,3 @@ +optimize circular survey +remove Reference artefacts +solve Dijkstra issue (no path found, for some geometries) diff --git a/qgroundcontrol.qrc b/qgroundcontrol.qrc index 10909b627d54c618ffbdc05b81b61f2f63c74147..fc92fbc324bb9db224ec63b26cbbb55cdccef6a8 100644 --- a/qgroundcontrol.qrc +++ b/qgroundcontrol.qrc @@ -222,6 +222,9 @@ src/WimaView/WimaMeasurementAreaEditor.qml src/WimaView/SphericalSurveyMapVisual.qml src/PlanView/CircularSurveyItemEditor.qml + src/WimaView/DragCoordinate.qml + src/WimaView/CoordinateIndicatorDrag.qml + src/WimaView/CoordinateIndicator.qml src/Settings/APMMavlinkStreamRate.SettingsGroup.json diff --git a/src/PlanView/CircularSurveyItemEditor.qml b/src/PlanView/CircularSurveyItemEditor.qml index a7ae505d73f2d164c0ff44ec67a32cc3fc5a8a55..0929168fec9d8769f1c33bedd01aa03b53194544 100644 --- a/src/PlanView/CircularSurveyItemEditor.qml +++ b/src/PlanView/CircularSurveyItemEditor.qml @@ -82,7 +82,7 @@ Rectangle { /*QGCSlider { id: rSlider minimumValue: 0.1 - maximumValue: 20 + maximumValue: 5 stepSize: 0.1 tickmarksEnabled: false Layout.fillWidth: true @@ -102,8 +102,8 @@ Rectangle { QGCSlider { id: angleSlider - minimumValue: 0.1 - maximumValue: 20 + minimumValue: 0.3 + maximumValue: 5 stepSize: 0.1 tickmarksEnabled: false Layout.fillWidth: true diff --git a/src/QmlControls/QGroundControl.Controls.qmldir b/src/QmlControls/QGroundControl.Controls.qmldir index e335b7e39ea8d3ec496a189e3debf3a3d88d1634..a9a8ef2b202dbc76a88d23e7e2b1b067485ed491 100644 --- a/src/QmlControls/QGroundControl.Controls.qmldir +++ b/src/QmlControls/QGroundControl.Controls.qmldir @@ -96,5 +96,8 @@ WimaItemEditor 1.0 WimaItemEditor.qml WimaMapPolygonVisuals 1.0 WimaMapPolygonVisuals.qml WimaMapPolylineVisuals 1.0 WimaMapPolylineVisuals.qml SphericalSurveyMapVisual 1.0 SphericalSurveyMapVisual.qml +DragCoordinate 1.0 DragCoordinate.qml +CoordinateIndicator 1.0 CoordinateIndicator.qml +CoordinateIndicatorDrag 1.0 CoordinateIndicatorDrag.qml diff --git a/src/Wima/CircularSurvey.SettingsGroup.json b/src/Wima/CircularSurvey.SettingsGroup.json index 3b74e7374c4f54339fa29ffb3dc0e515a55d9db4..88eeccfb4d821569c32a60773b2a9426157e9750 100644 --- a/src/Wima/CircularSurvey.SettingsGroup.json +++ b/src/Wima/CircularSurvey.SettingsGroup.json @@ -15,6 +15,6 @@ "units": "Deg", "min": 0.3, "decimalPlaces": 1, - "defaultValue": 0.5 + "defaultValue": 1 } ] diff --git a/src/Wima/CircularSurveyComplexItem.cc b/src/Wima/CircularSurveyComplexItem.cc index 590041a92981f7bda95586a7f879656f8d67370d..fcbd2b45dc343edbc5afcd46c8fdfeeb1858775a 100644 --- a/src/Wima/CircularSurveyComplexItem.cc +++ b/src/Wima/CircularSurveyComplexItem.cc @@ -1,22 +1,27 @@ #include "CircularSurveyComplexItem.h" -const char* CircularSurveyComplexItem::settingsGroup = "Survey"; +const char* CircularSurveyComplexItem::settingsGroup = "CircularSurvey"; const char* CircularSurveyComplexItem::deltaRName = "DeltaR"; const char* CircularSurveyComplexItem::deltaAlphaName = "DeltaAlpha"; CircularSurveyComplexItem::CircularSurveyComplexItem(Vehicle *vehicle, bool flyView, const QString &kmlOrShpFile, QObject *parent) : TransectStyleComplexItem (vehicle, flyView, settingsGroup, parent) - , _referencePoint (QGeoCoordinate(47.770859, 16.531076,0)) + , _referencePoint (QGeoCoordinate(0, 0,0)) , _metaDataMap (FactMetaData::createMapFromJsonFile(QStringLiteral(":/json/CircularSurvey.SettingsGroup.json"), this)) , _deltaR (settingsGroup, _metaDataMap[deltaRName]) , _deltaAlpha (settingsGroup, _metaDataMap[deltaAlphaName]) { _editorQml = "qrc:/qml/CircularSurveyItemEditor.qml"; - //connect(&_deltaR, &Fact::valueChanged, this, &CircularSurveyComplexItem::_setDirty); - //connect(&_deltaAlpha, &Fact::valueChanged, this, &CircularSurveyComplexItem::_setDirty); + connect(&_deltaR, &Fact::valueChanged, this, &CircularSurveyComplexItem::_setDirty); + connect(&_deltaAlpha, &Fact::valueChanged, this, &CircularSurveyComplexItem::_setDirty); + connect(this, &CircularSurveyComplexItem::refPointChanged, this, &CircularSurveyComplexItem::_setDirty); + _deltaR.setRawValue(_deltaR.rawDefaultValue()); + _deltaAlpha.setRawValue(_deltaAlpha.rawDefaultValue()); + qDebug() << _deltaAlpha.rawDefaultValue().toDouble(); + qDebug() << _deltaAlpha.rawValue().toDouble(); connect(&_updateTimer, &QTimer::timeout, this, &CircularSurveyComplexItem::_updateItem); _updateTimer.start(100); @@ -28,6 +33,7 @@ void CircularSurveyComplexItem::setRefPoint(const QGeoCoordinate &refPt) _referencePoint = refPt; emit refPointChanged(); + //qDebug() << _referencePoint.toString(); } } @@ -285,6 +291,7 @@ void CircularSurveyComplexItem::_updateItem() { if (_dirty) { _rebuildTransects(); + qDebug() << "CircularSurveyComplexItem::_updateItem()"; setDirty(false); } diff --git a/src/Wima/doc/Skriptum_ADM_II_130704.pdf b/src/Wima/doc/Skriptum_ADM_II_130704.pdf new file mode 100644 index 0000000000000000000000000000000000000000..8e6ad6208a763357b08186141db01ca355c2a3ea Binary files /dev/null and b/src/Wima/doc/Skriptum_ADM_II_130704.pdf differ diff --git a/src/WimaView/CoordinateIndicator.qml b/src/WimaView/CoordinateIndicator.qml new file mode 100644 index 0000000000000000000000000000000000000000..72b94dfa1ada6c837dd0e69ad05eff5303251b00 --- /dev/null +++ b/src/WimaView/CoordinateIndicator.qml @@ -0,0 +1,32 @@ +import QtQuick 2.3 +import QtLocation 5.3 + +import QGroundControl.ScreenTools 1.0 +import QGroundControl.Controls 1.0 +import QGroundControl.Vehicle 1.0 + +/// Marker for displaying a mission item on the map +MapQuickItem { + id: _item + + property int sequenceNumber + property string label + //property bool visible + + signal clicked + + anchorPoint.x: sourceItem.anchorPointX + anchorPoint.y: sourceItem.anchorPointY + + sourceItem: + MissionItemIndexLabel { + id: _label + checked: _item.visible + label: _item.label + index: _item.sequenceNumber + gimbalYaw: 0 + vehicleYaw: 0 + showGimbalYaw: false + onClicked: _item.clicked() + } +} diff --git a/src/WimaView/CoordinateIndicatorDrag.qml b/src/WimaView/CoordinateIndicatorDrag.qml new file mode 100644 index 0000000000000000000000000000000000000000..bcdef05afc84f15c26260d9f42dc984fbb1855f4 --- /dev/null +++ b/src/WimaView/CoordinateIndicatorDrag.qml @@ -0,0 +1,94 @@ +/**************************************************************************** + * + * (c) 2009-2016 QGROUNDCONTROL PROJECT + * + * QGroundControl is licensed according to the terms in the file + * COPYING.md in the root of the source code directory. + * + ****************************************************************************/ + +import QtQuick 2.3 +import QtLocation 5.3 + +import QGroundControl 1.0 +import QGroundControl.ScreenTools 1.0 +import QGroundControl.Controls 1.0 + +/// Use to drag a MissionItemIndicator +Rectangle { + id: itemDragger + x: _itemIndicatorX - _touchMarginHorizontal + y: _itemIndicatorY - _touchMarginVertical + width: _itemIndicatorWidth + (_touchMarginHorizontal * 2) + height: _itemIndicatorHeight + (_touchMarginVertical * 2) + color: "transparent" + z: QGroundControl.zOrderMapItems + 1 // Above item icons + + // Properties which must be specific by consumer + property var mapControl ///< Map control which contains this item + property var itemIndicator ///< The mission item indicator to drag around + property var itemCoordinate ///< Coordinate we are updating during drag + + signal clicked + signal dragStart + signal dragStop + + property bool _preventCoordinateBindingLoop: false + + property real _itemIndicatorX: itemIndicator ? itemIndicator.x : 0 + property real _itemIndicatorY: itemIndicator ? itemIndicator.y : 0 + property real _itemIndicatorWidth: itemIndicator ? itemIndicator.width : 0 + property real _itemIndicatorHeight: itemIndicator ? itemIndicator.height : 0 + property bool _mobile: ScreenTools.isMobile + property real _touchWidth: Math.max(_itemIndicatorWidth, ScreenTools.minTouchPixels) + property real _touchHeight: Math.max(_itemIndicatorHeight, ScreenTools.minTouchPixels) + property real _touchMarginHorizontal: _mobile ? (_touchWidth - _itemIndicatorWidth) / 2 : 0 + property real _touchMarginVertical: _mobile ? (_touchHeight - _itemIndicatorHeight) / 2 : 0 + property bool _dragStartSignalled: false + + onXChanged: liveDrag() + onYChanged: liveDrag() + + function liveDrag() { + if (!itemDragger._preventCoordinateBindingLoop && itemDrag.drag.active) { + var point = Qt.point(itemDragger.x + _touchMarginHorizontal + itemIndicator.anchorPoint.x, itemDragger.y + _touchMarginVertical + itemIndicator.anchorPoint.y) + var coordinate = mapControl.toCoordinate(point, false /* clipToViewPort */) + itemDragger._preventCoordinateBindingLoop = true + coordinate.altitude = itemCoordinate.altitude + itemCoordinate = coordinate + itemDragger._preventCoordinateBindingLoop = false + } + } + + Drag.active: itemDrag.drag.active + + QGCMouseArea { + id: itemDrag + anchors.fill: parent + drag.target: parent + drag.minimumX: 0 + drag.minimumY: 0 + drag.maximumX: itemDragger.parent.width - parent.width + drag.maximumY: itemDragger.parent.height - parent.height + preventStealing: true + + onClicked: { + focus = true + itemDragger.clicked() + } + + property bool dragActive: drag.active + onDragActiveChanged: { + if (dragActive) { + focus = true + if (!_dragStartSignalled) { + _dragStartSignalled = true + dragStart() + } + } else { + _dragStartSignalled = false + dragStop() + } + } + } +} diff --git a/src/WimaView/DragCoordinate.qml b/src/WimaView/DragCoordinate.qml new file mode 100644 index 0000000000000000000000000000000000000000..4bc6dd0e7bfbf9ae01410d7c878081c103387ecd --- /dev/null +++ b/src/WimaView/DragCoordinate.qml @@ -0,0 +1,113 @@ +/**************************************************************************** + * + * (c) 2009-2016 QGROUNDCONTROL PROJECT + * + * QGroundControl is licensed according to the terms in the file + * COPYING.md in the root of the source code directory. + * + ****************************************************************************/ + +import QtQuick 2.3 +import QtQuick.Controls 1.2 +import QtLocation 5.3 +import QtPositioning 5.3 + +import QGroundControl 1.0 +import QGroundControl.ScreenTools 1.0 +import QGroundControl.Palette 1.0 +import QGroundControl.Controls 1.0 +import QGroundControl.FlightMap 1.0 + +/// Draggable Coordinate Item visuals +Item { + id: _root + + property var map ///< Map control to place item in + property var qgcView ///< QGCView to use for popping dialogs + //property var visible + property var coordinate + property int sequenceNumber + + property var _itemVisual + property bool _itemVisualShowing: false + property var _dragArea + property bool _dragAreaShowing: false + + signal clicked(int sequenceNumber) + + function hideItemVisuals() { + if (_itemVisualShowing) { + _itemVisual.destroy() + _itemVisualShowing = false + } + } + + function showItemVisuals() { + if (!_itemVisualShowing) { + _itemVisual = indicatorComponent.createObject(map) + map.addMapItem(_itemVisual) + _itemVisualShowing = true + } + } + + function hideDragArea() { + if (_dragAreaShowing) { + _dragArea.destroy() + _dragAreaShowing = false + } + } + + function showDragArea() { + if (!_dragAreaShowing) { + _dragArea = dragAreaComponent.createObject(map) + _dragAreaShowing = true + } + } + + Component.onCompleted: { + showItemVisuals() + if (visible && map.planView) { + showDragArea() + } + } + + Component.onDestruction: { + hideDragArea() + hideItemVisuals() + } + + onVisibleChanged: { + if (visible) { + showDragArea() + } else { + hideDragArea() + } + } + + // Control which is used to drag items + Component { + id: dragAreaComponent + + CoordinateIndicatorDrag { + mapControl: _root.map + itemIndicator: _itemVisual + Component.onCompleted: itemCoordinate = _root.coordinate + + onItemCoordinateChanged: _root.coordinate = itemCoordinate + } + } + + Component { + id: indicatorComponent + + CoordinateIndicator { + label: "Reference" + visible: _root.visible + z: QGroundControl.zOrderMapItems + sequenceNumber: _root.sequenceNumber + coordinate: _root.coordinate + + onClicked: _root.clicked(_missionItem.sequenceNumber) + } + } +} diff --git a/src/WimaView/SphericalSurveyMapVisual.qml b/src/WimaView/SphericalSurveyMapVisual.qml index f48717c9e5891c3bd88fc6ecd78d003ef50e2959..63dceed27f48a06b4bada0ad954383e713d634dd 100644 --- a/src/WimaView/SphericalSurveyMapVisual.qml +++ b/src/WimaView/SphericalSurveyMapVisual.qml @@ -32,6 +32,7 @@ Item { property var _visualTransectsComponent property var _entryCoordinate property var _exitCoordinate + property var _refPoint signal clicked(int sequenceNumber) @@ -39,15 +40,18 @@ Item { _visualTransectsComponent = visualTransectsComponent.createObject(map) _entryCoordinate = entryPointComponent.createObject(map) _exitCoordinate = exitPointComponent.createObject(map) + _refPoint = refPointComponent.createObject(map) map.addMapItem(_visualTransectsComponent) map.addMapItem(_entryCoordinate) map.addMapItem(_exitCoordinate) + map.addMapItem(_refPoint) } function _destroyVisualElements() { _visualTransectsComponent.destroy() _entryCoordinate.destroy() _exitCoordinate.destroy() + _refPoint.destroy() } /// Add an initial 4 sided polygon if there is none @@ -162,19 +166,14 @@ Item { Component { id: refPointComponent - MapQuickItem { - anchorPoint.x: sourceItem.anchorPointX - anchorPoint.y: sourceItem.anchorPointY + DragCoordinate { + map: _root.map + qgcView: _root.qgcView z: QGroundControl.zOrderMapItems - coordinate: _missionItem.refPoint - visible: _missionItem.refPoint.isValid + visible: _missionItem.isCurrentItem + coordinate: _missionItem.refPoint - sourceItem: MissionItemIndexLabel { - index: _missionItem.sequenceNumber - label: "Ref." - checked: _missionItem.isCurrentItem - onClicked: _root.clicked(_missionItem.sequenceNumber) - } + onCoordinateChanged: _missionItem.refPoint = coordinate } } }