Commit 4666c881 authored by Valentin Platzgummer's avatar Valentin Platzgummer

123

parent 6fb21c6f
optimize circular survey (improve) optimisation circular survey
profile survey profile survey
add dijkstra to flight view add dijkstra to flight view
add save and load to circular survey
...@@ -110,7 +110,7 @@ Rectangle { ...@@ -110,7 +110,7 @@ Rectangle {
Layout.columnSpan: 2 Layout.columnSpan: 2
Layout.preferredHeight: ScreenTools.defaultFontPixelHeight * 1.5 Layout.preferredHeight: ScreenTools.defaultFontPixelHeight * 1.5
onValueChanged: missionItem.deltaAlpha.value = value onValueChanged: missionItem.deltaAlpha.value = value
Component.onCompleted: value = missionItem.deltaAlpha.defaultValue Component.onCompleted: value = missionItem.deltaAlpha.value
updateValueWhileDragging: true updateValueWhileDragging: true
} }
} }
......
...@@ -247,43 +247,47 @@ void CircularSurveyComplexItem::_rebuildTransectsPhase1() ...@@ -247,43 +247,47 @@ void CircularSurveyComplexItem::_rebuildTransectsPhase1()
} }
} }
// // optimize path to lawn pattern // optimize path to lawn pattern
// if (fullPath.size() == 0) if (fullPath.size() == 0)
// return; return;
// QList<QPointF> currentSection = fullPath.takeFirst(); QList<QPointF> currentSection = fullPath.takeFirst();
// QList<QList<QPointF>> optiPath; // optimized path if ( currentSection.isEmpty() )
// while( !fullPath.empty() ) { return;
// optiPath.append(currentSection); QList<QList<QPointF>> optiPath; // optimized path
// QPointF endVertex = currentSection.last(); while( !fullPath.empty() ) {
// double minDist = std::numeric_limits<double>::infinity(); optiPath.append(currentSection);
// int index = 0; QPointF endVertex = currentSection.last();
// bool reversePath = false; double minDist = std::numeric_limits<double>::infinity();
int index = 0;
// // iterate over all paths in fullPath and assign the one with the shortest distance to endVertex to currentSection bool reversePath = false;
// for (int i = 0; i < fullPath.size(); i++) {
// auto iteratorPath = fullPath[i]; // iterate over all paths in fullPath and assign the one with the shortest distance to endVertex to currentSection
// double dist = PlanimetryCalculus::distance(endVertex, iteratorPath.first()); for (int i = 0; i < fullPath.size(); i++) {
// if ( dist < minDist ) { auto iteratorPath = fullPath[i];
// minDist = dist; double dist = PlanimetryCalculus::distance(endVertex, iteratorPath.first());
// index = i; if ( dist < minDist ) {
// } minDist = dist;
// dist = PlanimetryCalculus::distance(endVertex, iteratorPath.last()); index = i;
// if (dist < minDist) { }
// minDist = dist; dist = PlanimetryCalculus::distance(endVertex, iteratorPath.last());
// index = i; if (dist < minDist) {
// reversePath = true; minDist = dist;
// } index = i;
// } reversePath = true;
// currentSection = fullPath.takeAt(index); }
// if (reversePath) { }
// PolygonCalculus::reversePath(currentSection); currentSection = fullPath.takeAt(index);
// } if (reversePath) {
// } PolygonCalculus::reversePath(currentSection);
}
}
optiPath.append(currentSection); // append last section
// convert to CoordInfo_t // convert to CoordInfo_t
// for ( const QList<QPointF> &transect : optiPath) { for ( const QList<QPointF> &transect : optiPath) {
for ( const QList<QPointF> &transect : fullPath) { // for ( const QList<QPointF> &transect : fullPath) {
QList<QGeoCoordinate> geoPath = toGeo(transect, _referencePoint); QList<QGeoCoordinate> geoPath = toGeo(transect, _referencePoint);
QList<CoordInfo_t> transectList; QList<CoordInfo_t> transectList;
for ( const QGeoCoordinate &coordinate : geoPath) { for ( const QGeoCoordinate &coordinate : geoPath) {
......
...@@ -299,8 +299,11 @@ bool WimaPlaner::updateMission() ...@@ -299,8 +299,11 @@ bool WimaPlaner::updateMission()
} }
QGeoCoordinate start = _serviceArea.center(); QGeoCoordinate start = _serviceArea.center();
QGeoCoordinate end = survey->coordinate(); QGeoCoordinate end = survey->coordinate();
#ifdef QT_DEBUG
if (!_visualItems.contains(&_joinedArea)) if (!_visualItems.contains(&_joinedArea))
_visualItems.append(&_joinedArea); _visualItems.append(&_joinedArea);
#endif
QList<QGeoCoordinate> path; QList<QGeoCoordinate> path;
if ( !calcShortestPath(start, end, path)) { if ( !calcShortestPath(start, end, path)) {
......
...@@ -11,7 +11,7 @@ MapQuickItem { ...@@ -11,7 +11,7 @@ MapQuickItem {
property int sequenceNumber property int sequenceNumber
property string label property string label
//property bool visible property bool checked
signal clicked signal clicked
...@@ -21,7 +21,7 @@ MapQuickItem { ...@@ -21,7 +21,7 @@ MapQuickItem {
sourceItem: sourceItem:
MissionItemIndexLabel { MissionItemIndexLabel {
id: _label id: _label
checked: _item.visible checked: _item.checked
label: _item.label label: _item.label
index: _item.sequenceNumber index: _item.sequenceNumber
gimbalYaw: 0 gimbalYaw: 0
......
...@@ -22,11 +22,11 @@ import QGroundControl.FlightMap 1.0 ...@@ -22,11 +22,11 @@ import QGroundControl.FlightMap 1.0
Item { Item {
id: _root id: _root
property var map ///< Map control to place item in property var map ///< Map control to place item in
property var qgcView ///< QGCView to use for popping dialogs property var qgcView ///< QGCView to use for popping dialogs
//property var visible property var coordinate
property var coordinate property int sequenceNumber
property int sequenceNumber property bool checked
property var _itemVisual property var _itemVisual
property bool _itemVisualShowing: false property bool _itemVisualShowing: false
...@@ -66,7 +66,7 @@ Item { ...@@ -66,7 +66,7 @@ Item {
Component.onCompleted: { Component.onCompleted: {
showItemVisuals() showItemVisuals()
if (visible && map.planView) { if (checked && map.planView) {
showDragArea() showDragArea()
} }
} }
...@@ -76,8 +76,8 @@ Item { ...@@ -76,8 +76,8 @@ Item {
hideItemVisuals() hideItemVisuals()
} }
onVisibleChanged: { onCheckedChanged: {
if (visible) { if (checked) {
showDragArea() showDragArea()
} else { } else {
hideDragArea() hideDragArea()
...@@ -102,7 +102,7 @@ Item { ...@@ -102,7 +102,7 @@ Item {
CoordinateIndicator { CoordinateIndicator {
label: "Reference" label: "Reference"
visible: _root.visible checked: _root.checked
z: QGroundControl.zOrderMapItems z: QGroundControl.zOrderMapItems
sequenceNumber: _root.sequenceNumber sequenceNumber: _root.sequenceNumber
coordinate: _root.coordinate coordinate: _root.coordinate
......
...@@ -173,10 +173,11 @@ Item { ...@@ -173,10 +173,11 @@ Item {
map: _root.map map: _root.map
qgcView: _root.qgcView qgcView: _root.qgcView
z: QGroundControl.zOrderMapItems z: QGroundControl.zOrderMapItems
visible: _missionItem.isCurrentItem checked: _missionItem.isCurrentItem
coordinate: _missionItem.refPoint coordinate: _missionItem.refPoint
onCoordinateChanged: _missionItem.refPoint = coordinate onCoordinateChanged: _missionItem.refPoint = coordinate
onClicked: _root.clicked(_missionItem.sequenceNumber)
} }
} }
} }
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