Commit 830d7dee authored by Don Gagne's avatar Don Gagne

Merge pull request #1860 from DonLakeFlyer/MissionWork

Mission work
parents 00b393ba faa7500c
......@@ -28,25 +28,49 @@
#include <QtQml>
Fact::Fact(void) :
_componentId(-1),
_value(0),
_type(FactMetaData::valueTypeInt32),
_metaData(NULL)
Fact::Fact(QObject* parent)
: QObject(parent)
, _componentId(-1)
, _value(0)
, _type(FactMetaData::valueTypeInt32)
, _metaData(NULL)
{
FactMetaData* metaData = new FactMetaData(_type, this);
setMetaData(metaData);
}
Fact::Fact(int componentId, QString name, FactMetaData::ValueType_t type, QObject* parent) :
QObject(parent),
_name(name),
_componentId(componentId),
_value(0),
_type(type),
_metaData(NULL)
Fact::Fact(int componentId, QString name, FactMetaData::ValueType_t type, QObject* parent)
: QObject(parent)
, _name(name)
, _componentId(componentId)
, _value(0)
, _type(type)
, _metaData(NULL)
{
FactMetaData* metaData = new FactMetaData(_type, this);
setMetaData(metaData);
}
Fact::Fact(const Fact& other, QObject* parent)
: QObject(parent)
{
*this = other;
}
const Fact& Fact::operator=(const Fact& other)
{
_name = other._name;
_componentId = other._componentId;
_value = other._value;
_type = other._type;
if (_metaData && other._metaData) {
*_metaData = *other._metaData;
} else {
_metaData = NULL;
}
return *this;
}
void Fact::forceSetValue(const QVariant& value)
......
......@@ -40,9 +40,12 @@ class Fact : public QObject
Q_OBJECT
public:
Fact(void);
Fact(QObject* parent = NULL);
Fact(int componentId, QString name, FactMetaData::ValueType_t type, QObject* parent = NULL);
Fact(const Fact& other, QObject* parent = NULL);
const Fact& operator=(const Fact& other);
Q_PROPERTY(int componentId READ componentId CONSTANT)
Q_PROPERTY(QString name READ name CONSTANT)
Q_PROPERTY(QVariant value READ value WRITE setValue NOTIFY valueChanged USER true)
......
......@@ -32,6 +32,20 @@
#include <limits>
FactMetaData::FactMetaData(QObject* parent) :
QObject(parent),
_group("*Default Group"),
_type(valueTypeInt32),
_defaultValue(0),
_defaultValueAvailable(false),
_min(_minForType()),
_max(_maxForType()),
_minIsDefaultForType(true),
_maxIsDefaultForType(true)
{
}
FactMetaData::FactMetaData(ValueType_t type, QObject* parent) :
QObject(parent),
_group("*Default Group"),
......@@ -46,6 +60,26 @@ FactMetaData::FactMetaData(ValueType_t type, QObject* parent) :
}
FactMetaData::FactMetaData(const FactMetaData& other, QObject* parent)
: QObject(parent)
{
*this = other;
}
const FactMetaData& FactMetaData::operator=(const FactMetaData& other)
{
_group = other._group;
_type = other._type;
_defaultValue = other._defaultValue;
_defaultValueAvailable = other._defaultValueAvailable;
_min = other._min;
_max = other._max;
_minIsDefaultForType = other._minIsDefaultForType;
_maxIsDefaultForType = other._maxIsDefaultForType;
return *this;
}
QVariant FactMetaData::defaultValue(void)
{
if (_defaultValueAvailable) {
......
......@@ -52,7 +52,11 @@ public:
valueTypeDouble
} ValueType_t;
FactMetaData(QObject* parent = NULL);
FactMetaData(ValueType_t type, QObject* parent = NULL);
FactMetaData(const FactMetaData& other, QObject* parent = NULL);
const FactMetaData& operator=(const FactMetaData& other);
// Property accessors
QString name(void) { return _name; }
......
This diff is collapsed.
......@@ -53,7 +53,7 @@ public:
int frame = MAV_FRAME_GLOBAL,
int action = MAV_CMD_NAV_WAYPOINT);
MissionItem(const MissionItem& other);
MissionItem(const MissionItem& other, QObject* parent = NULL);
~MissionItem();
const MissionItem& operator=(const MissionItem& other);
......@@ -125,23 +125,23 @@ public:
bool getAutoContinue() const {
return _autocontinue;
}
double getLoiterOrbit() const {
return _orbit;
double loiterOrbitRadius() const {
return _loiterOrbitRadiusFact->value().toDouble();
}
double getAcceptanceRadius() const {
return _param2;
return getParam2();
}
double getHoldTime() const {
return _param1;
return getParam1();
}
double getParam1() const {
return _param1;
return _param1Fact->value().toDouble();
}
double getParam2() const {
return _param2;
return _param2Fact->value().toDouble();
}
double getParam3() const {
return _orbit;
return loiterOrbitRadius();
}
double getParam4() const {
return yawRadians();
......@@ -195,7 +195,7 @@ public:
void setFrame (int _frame);
void setAutocontinue(bool autoContinue);
void setCurrent (bool _current);
void setLoiterOrbit (double _orbit);
void setLoiterOrbitRadius (double radius);
void setParam1 (double _param1);
void setParam2 (double _param2);
void setParam3 (double param3);
......@@ -226,27 +226,20 @@ private:
int _sequenceNumber;
QGeoCoordinate _coordinate;
double _yawRadians;
int _frame;
int _action;
bool _autocontinue;
bool _isCurrentItem;
double _orbit;
double _param1;
double _param2;
quint64 _reachedTime;
Fact* _yawFact;
Fact* _pitchFact;
Fact* _loiterRadiusFact;
Fact* _yawRadiansFact;
Fact* _loiterOrbitRadiusFact;
Fact* _param1Fact;
Fact* _param2Fact;
FactMetaData* _yawMetaData;
FactMetaData* _pitchMetaData;
FactMetaData* _acceptanceRadiusMetaData;
FactMetaData* _holdTimeMetaData;
FactMetaData* _loiterRadiusMetaData;
FactMetaData* _loiterTurnsMetaData;
FactMetaData* _loiterSecondsMetaData;
FactMetaData* _delaySecondsMetaData;
......
......@@ -104,7 +104,7 @@ QRectF Waypoint2DIcon::boundingRect() const
}
if (((waypoint->getAction() == (int)MAV_CMD_NAV_LOITER_UNLIM) || (waypoint->getAction() == (int)MAV_CMD_NAV_LOITER_TIME) || (waypoint->getAction() == (int)MAV_CMD_NAV_LOITER_TURNS)))
{
loiter = map->metersToPixels(waypoint->getLoiterOrbit(), coord);
loiter = map->metersToPixels(waypoint->loiterOrbitRadius(), coord);
}
}
......@@ -306,7 +306,7 @@ void Waypoint2DIcon::paint(QPainter *painter, const QStyleOptionGraphicsItem *op
penDash.setWidth(1);
//penDash.setStyle(Qt::DotLine);
// A negative radius indicates counter-clockwise rotation, but we still want to draw it positive
const int loiter = map->metersToPixels(fabs(waypoint->getLoiterOrbit()), Coord());
const int loiter = map->metersToPixels(fabs(waypoint->loiterOrbitRadius()), Coord());
if (loiter > picture.width()/2)
{
painter->setPen(penBlack);
......
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