Commit ecf3d85b authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #4693 from DonLakeFlyer/FWLandingUpdates

Fw landing updates
parents a9de4cf7 419f8a89
......@@ -248,13 +248,9 @@ QGCView {
id: _mapTypeButtonsExclusiveGroup
}
ExclusiveGroup {
id: _dropButtonsExclusiveGroup
}
function setCurrentItem(sequenceNumber) {
if (sequenceNumber !== _currentMissionIndex) {
//editorMap.polygonDraw.cancelPolygonEdit()
console.log("setCurrentItem", sequenceNumber)
_currentMissionItem = undefined
_currentMissionIndex = -1
for (var i=0; i<_visualItems.count; i++) {
......@@ -457,59 +453,6 @@ QGCView {
}
}
Component {
id: missionItemComponent
MissionItemIndicator {
id: itemIndicator
coordinate: object.coordinate
visible: object.isSimpleItem && object.specifiesCoordinate
z: QGroundControl.zOrderMapItems
missionItem: object
sequenceNumber: object.sequenceNumber
//-- If you don't want to allow selecting items beneath the
// toolbar, the code below has to check and see if mouse.y
// is greater than (map.height - ScreenTools.availableHeight)
onClicked: setCurrentItem(object.sequenceNumber)
function updateItemIndicator() {
if (object.isCurrentItem && itemIndicator.visible && object.specifiesCoordinate && object.isSimpleItem) {
// Setup our drag item
itemDragger.visible = true
itemDragger.coordinateItem = Qt.binding(function() { return object })
itemDragger.mapCoordinateIndicator = Qt.binding(function() { return itemIndicator })
}
}
Connections {
target: object
onIsCurrentItemChanged: updateItemIndicator()
onSpecifiesCoordinateChanged: updateItemIndicator()
}
// These are the non-coordinate child mission items attached to this item
Row {
anchors.top: parent.top
anchors.left: parent.right
Repeater {
model: object.isSimpleItem ? object.childItems : 0
delegate: MissionItemIndexLabel {
label: object.abbreviation
checked: object.isCurrentItem
z: 2
specifiesCoordinate: false
onClicked: setCurrentItem(object.sequenceNumber)
}
}
}
}
}
// Add lines between waypoints
MissionLineView {
model: _editingLayer == _layerMission ? missionController.waypointLines : undefined
......@@ -635,9 +578,13 @@ QGCView {
onClicked: setCurrentItem(object.sequenceNumber)
onRemove: {
var removeIndex = index
itemDragger.clearItem()
missionController.removeMissionItem(index)
editorMap.polygonDraw.cancelPolygonEdit()
missionController.removeMissionItem(removeIndex)
if (removeIndex >= missionController.visualItems.count) {
removeIndex--
}
setCurrentItem(removeIndex)
}
onInsert: {
......@@ -750,17 +697,6 @@ QGCView {
}
}
//-- Dismiss Drop Down (if any)
MouseArea {
anchors.fill: parent
enabled: _dropButtonsExclusiveGroup.current != null
onClicked: {
if(_dropButtonsExclusiveGroup.current)
_dropButtonsExclusiveGroup.current.checked = false
_dropButtonsExclusiveGroup.current = null
}
}
ToolStrip {
id: toolStrip
anchors.leftMargin: ScreenTools.defaultFontPixelWidth
......
......@@ -5,11 +5,11 @@
"type": "double",
"units": "m",
"decimalPlaces": 1,
"defaultValue": 100.0
"defaultValue": 300.0
},
{
"name": "Landing heading",
"shortDescription": "Heading from land point to loiter point.",
"shortDescription": "Heading from loiter point to land point.",
"type": "double",
"units": "deg",
"min": 0.0,
......
......@@ -230,7 +230,7 @@ void FixedWingLandingComplexItem::_recalcLoiterCoordFromFacts(void)
QPointF originPoint(east, north);
north += _loiterToLandDistanceFact.rawValue().toDouble();
QPointF loiterPoint(east, north);
QPointF rotatedLoiterPoint = _rotatePoint(loiterPoint, originPoint, -_landingHeadingFact.rawValue().toDouble());
QPointF rotatedLoiterPoint = _rotatePoint(loiterPoint, originPoint, _landingHeadingFact.rawValue().toDouble());
convertNedToGeo(rotatedLoiterPoint.y(), rotatedLoiterPoint.x(), down, tangentOrigin, &_loiterCoordinate);
......@@ -273,7 +273,7 @@ void FixedWingLandingComplexItem::_recalcFactsFromCoords(void)
// Calc new heading
QPointF vector(eastLoiter - eastLand, northLoiter - northLand);
QPointF vector(eastLand - eastLoiter, northLand - northLoiter);
double radians = atan2(vector.y(), vector.x());
double degrees = qRadiansToDegrees(radians);
// Change angle to north up = 0 degrees
......
......@@ -258,16 +258,6 @@ void MissionController::removeMissionItem(int index)
item->deleteLater();
_recalcAll();
// Set the new current item
if (index >= _visualItems->count()) {
index--;
}
for (int i=0; i<_visualItems->count(); i++) {
VisualMissionItem* item = qobject_cast<VisualMissionItem*>(_visualItems->get(i));
item->setIsCurrentItem(i == index);
}
_visualItems->setDirty(true);
}
......
......@@ -45,7 +45,7 @@ public:
// Property accesors
QString category (void) const;
MavlinkQmlSingleton::Qml_MAV_CMD command(void) const { return (MavlinkQmlSingleton::Qml_MAV_CMD)_missionItem._commandFact.cookedValue().toInt(); };
MavlinkQmlSingleton::Qml_MAV_CMD command(void) const { return (MavlinkQmlSingleton::Qml_MAV_CMD)_missionItem._commandFact.cookedValue().toInt(); }
bool friendlyEditAllowed (void) const;
bool homePosition (void) const { return _homePositionSpecialCase; }
bool rawEdit (void) const;
......
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