Commit 748f1dd9 authored by Don Gagne's avatar Don Gagne

Merge pull request #1853 from DonLakeFlyer/MissionEdit

More mission editing work
parents c6aff9f4 2ca5bd84
......@@ -92,6 +92,9 @@ public:
void _containerSetValue(const QVariant& value);
/// Generally you should not change the name of a fact. But if you know what you are doing, you can.
void _setName(const QString& name) { _name = name; }
signals:
/// QObject Property System signal for value property changes
///
......
This diff is collapsed.
......@@ -33,6 +33,8 @@
#include "QGCMAVLink.h"
#include "QGC.h"
#include "MavlinkQmlSingleton.h"
#include "QmlObjectListModel.h"
#include "Fact.h"
class MissionItem : public QObject
{
......@@ -56,17 +58,18 @@ public:
const MissionItem& operator=(const MissionItem& other);
Q_PROPERTY(int sequenceNumber READ sequenceNumber WRITE setSequenceNumber NOTIFY sequenceNumberChanged)
Q_PROPERTY(bool isCurrentItem READ isCurrentItem WRITE setIsCurrentItem NOTIFY isCurrentItemChanged)
Q_PROPERTY(bool specifiesCoordinate READ specifiesCoordinate NOTIFY specifiesCoordinateChanged)
Q_PROPERTY(QGeoCoordinate coordinate READ coordinate WRITE setCoordinate NOTIFY coordinateChanged)
Q_PROPERTY(double yaw READ yaw WRITE setYaw NOTIFY yawChanged)
Q_PROPERTY(QStringList commandNames READ commandNames CONSTANT)
Q_PROPERTY(QString commandName READ commandName NOTIFY commandChanged)
Q_PROPERTY(QStringList valueLabels READ valueLabels NOTIFY commandChanged)
Q_PROPERTY(QStringList valueStrings READ valueStrings NOTIFY valueStringsChanged)
Q_PROPERTY(int commandByIndex READ commandByIndex WRITE setCommandByIndex NOTIFY commandChanged)
Q_PROPERTY(MavlinkQmlSingleton::Qml_MAV_CMD command READ command WRITE setCommand NOTIFY commandChanged)
Q_PROPERTY(int sequenceNumber READ sequenceNumber WRITE setSequenceNumber NOTIFY sequenceNumberChanged)
Q_PROPERTY(bool isCurrentItem READ isCurrentItem WRITE setIsCurrentItem NOTIFY isCurrentItemChanged)
Q_PROPERTY(bool specifiesCoordinate READ specifiesCoordinate NOTIFY specifiesCoordinateChanged)
Q_PROPERTY(QGeoCoordinate coordinate READ coordinate WRITE setCoordinate NOTIFY coordinateChanged)
Q_PROPERTY(double yaw READ yawDegrees WRITE setYawDegrees NOTIFY yawChanged)
Q_PROPERTY(QStringList commandNames READ commandNames CONSTANT)
Q_PROPERTY(QString commandName READ commandName NOTIFY commandChanged)
Q_PROPERTY(QStringList valueLabels READ valueLabels NOTIFY commandChanged)
Q_PROPERTY(QStringList valueStrings READ valueStrings NOTIFY valueStringsChanged)
Q_PROPERTY(int commandByIndex READ commandByIndex WRITE setCommandByIndex NOTIFY commandChanged)
Q_PROPERTY(QmlObjectListModel* facts READ facts NOTIFY commandChanged)
Q_PROPERTY(MavlinkQmlSingleton::Qml_MAV_CMD command READ command WRITE setCommand NOTIFY commandChanged)
// Property accesors
......@@ -93,6 +96,11 @@ public:
QStringList valueLabels(void);
QStringList valueStrings(void);
QmlObjectListModel* facts(void);
double yawDegrees(void) const;
void setYawDegrees(double yaw);
// C++ only methods
double latitude(void) const { return _coordinate.latitude(); }
......@@ -111,8 +119,8 @@ public:
void setY(double y);
void setZ(double z);
double yaw(void) const { return _yaw; }
void setYaw(double yaw);
double yawRadians(void) const;
void setYawRadians(double yaw);
bool getAutoContinue() const {
return _autocontinue;
......@@ -136,7 +144,7 @@ public:
return _orbit;
}
double getParam4() const {
return yaw();
return yawRadians();
}
double getParam5() const {
return latitude();
......@@ -147,9 +155,6 @@ public:
double getParam7() const {
return altitude();
}
int getTurns() const {
return _param1;
}
// MAV_FRAME
int getFrame() const {
return _frame;
......@@ -201,8 +206,6 @@ public:
void setAcceptanceRadius(double radius);
void setHoldTime (int holdTime);
void setHoldTime (double holdTime);
/** @brief Number of turns for loiter waypoints */
void setTurns (int _turns);
/** @brief Set waypoint as reached */
void setReached () { _reachedTime = QGC::groundTimeMilliseconds(); }
/** @brief Wether this waypoint has been reached yet */
......@@ -223,7 +226,7 @@ private:
int _sequenceNumber;
QGeoCoordinate _coordinate;
double _yaw;
double _yawRadians;
int _frame;
int _action;
bool _autocontinue;
......@@ -231,9 +234,25 @@ private:
double _orbit;
double _param1;
double _param2;
int _turns;
quint64 _reachedTime;
Fact* _yawFact;
Fact* _pitchFact;
Fact* _loiterRadiusFact;
Fact* _param1Fact;
Fact* _param2Fact;
FactMetaData* _yawMetaData;
FactMetaData* _pitchMetaData;
FactMetaData* _acceptanceRadiusMetaData;
FactMetaData* _holdTimeMetaData;
FactMetaData* _loiterRadiusMetaData;
FactMetaData* _loiterTurnsMetaData;
FactMetaData* _loiterSecondsMetaData;
FactMetaData* _delaySecondsMetaData;
FactMetaData* _jumpSequenceMetaData;
FactMetaData* _jumpRepeatMetaData;
static const int _cMavCmd2Name = 9;
static const MavCmd2Name_t _rgMavCmd2Name[_cMavCmd2Name];
};
......
......@@ -4,6 +4,8 @@ import QtQuick.Controls.Styles 1.2
import QGroundControl.ScreenTools 1.0
import QGroundControl.Vehicle 1.0
import QGroundControl.Controls 1.0
import QGroundControl.FactControls 1.0
/// Mission item edit control
Rectangle {
......@@ -117,32 +119,29 @@ Rectangle {
anchors.left: parent.left
anchors.right: parent.right
anchors.top: missionItem.specifiesCoordinate ? _altitudeField.bottom : _commandCombo.bottom
spacing: parent.radius / 2
Repeater {
model: missionItem.valueLabels
QGCLabel {
color: "black"
text: modelData
model: missionItem.facts
Item {
width: _valueColumn.width
height: textField.height
QGCLabel {
anchors.baseline: textField.baseline
color: "black"
text: object.name
}
FactTextField {
id: textField
anchors.right: parent.right
width: _editFieldWidth
showUnits: true
fact: object
}
}
}
}
Column {
anchors.margins: parent.radius / 2
anchors.left: parent.left
anchors.right: parent.right
anchors.top: _valueColumn.top
Repeater {
model: missionItem.valueStrings
QGCLabel {
width: _valueColumn.width
color: "black"
text: modelData
horizontalAlignment: Text.AlignRight
}
}
}
}
} // Column - Values column
} // Rectangle
......@@ -1313,7 +1313,7 @@ void HSIDisplay::drawWaypoint(QPainter& painter, const QColor& color, float widt
float radius = (waypointSize/2.0f) * 0.8 * (1/sqrt(2.0f));
float acceptRadius = w->getAcceptanceRadius();
double yawDiff = w->yaw()/180.0*M_PI-yaw;
double yawDiff = w->yawRadians()/180.0*M_PI-yaw;
// Draw background
pen.setColor(Qt::black);
......
......@@ -750,7 +750,7 @@ void QGCMapWidget::updateWaypoint(int uas, MissionItem* wp)
// Use safe standard interfaces for non MissionItem-class based wps
icon->SetCoord(internals::PointLatLng(wp->latitude(), wp->longitude()));
icon->SetAltitude(wp->altitude());
icon->SetHeading(wp->yaw());
icon->SetHeading(wp->yawRadians());
icon->SetNumber(wpindex);
}
// Re-enable signals again
......
......@@ -33,7 +33,7 @@ Waypoint2DIcon::Waypoint2DIcon(mapcontrol::MapGraphicItem* map, mapcontrol::OPMa
showOrbit(false),
color(color)
{
SetHeading(wp->yaw());
SetHeading(wp->yawRadians());
SetNumber(listindex);
this->setFlag(QGraphicsItem::ItemIgnoresTransformations,true);
picture = QPixmap(radius+1, radius+1);
......@@ -59,7 +59,7 @@ void Waypoint2DIcon::updateWaypoint()
// Store old size
static QRectF oldSize;
SetHeading(waypoint->yaw());
SetHeading(waypoint->yawRadians());
SetCoord(internals::PointLatLng(waypoint->latitude(), waypoint->longitude()));
// qDebug() << "UPDATING WP:" << waypoint->sequenceNumber() << "LAT:" << waypoint->latitude() << "LON:" << waypoint->longitude();
......
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