23#include <QGeoPositionInfo>
27#include "traffic/TrafficDataSource_Abstract.h"
29using namespace Qt::Literals::StringLiterals;
58 [[nodiscard]] QString
dataFormat()
const override {
return u
"FLARM/NMEA"_s; }
67 [[nodiscard]] QString
icon()
const override {
return u
"/icons/material/ic_file_download.svg"_s; }
76 [[nodiscard]]
auto sourceName() const -> QString
override
78 return tr(
"Simulator data");
102 barometricHeight = barAlt;
111 geoInfo.setCoordinate(coordinate);
112 geoInfo.setAttribute(QGeoPositionInfo::VerticalSpeed, 0.0);
121 geoInfo.setAttribute(QGeoPositionInfo::GroundSpeed, GS.
toMPS());
130 geoInfo.setAttribute(QGeoPositionInfo::Direction, TT.
toDEG());
139 trafficFactor_DistanceOnly = factor;
145 trafficFactor_DistanceOnly.reset();
154 geoInfo.setAttribute(QGeoPositionInfo::VerticalSpeed, vSpeed.
toMPS());
163 trafficFactors.append(factor);
169 trafficFactors.clear();
175 void sendSimulatorData();
181 QTimer simulatorTimer;
182 QGeoPositionInfo geoInfo;
184 QVector<TrafficFactorData_WithPosition> trafficFactors;
185 std::optional<TrafficFactorData_DistanceOnly> trafficFactor_DistanceOnly = std::nullopt;
TrafficDataSource_Abstract(bool isCanonical, QObject *parent)
Default constructor.
Traffic receiver: Simulator that provides configurable simulated data.
void setTT(Units::Angle TT)
Set angle that is to be reported by this class as the true track of ownship.
void clearTrafficFactor_DistanceOnly()
Stop reporting distance-only traffic.
void setVSpeed(Units::Speed vSpeed)
Set speed that is to be reported by this class as the vertical speed of ownship.
void setGS(Units::Speed GS)
Set speed that is to be reported by this class as the ground speed of ownship.
TrafficDataSource_Simulate(bool isCanonical, QObject *parent)
Default constructor.
QString icon() const override
Getter function for the property with the same name.
void connectToTrafficReceiver() override
Start attempt to connect to traffic receiver.
QString dataFormat() const override
Getter function for the property with the same name.
auto sourceName() const -> QString override
Getter function for the property with the same name.
void setCoordinate(const QGeoCoordinate &coordinate)
Set coordinate that is to be reported by this class as the position of ownship.
void setBarometricHeight(Units::Distance barAlt)
Set distance that is to be reported by this class as the barometric altitude of ownship.
void removeTraffic()
Remove all traffic factors (with position).
void disconnectFromTrafficReceiver() override
Disconnect from traffic receiver.
void setTrafficFactor_DistanceOnly(const Traffic::TrafficFactorData_DistanceOnly &factor)
Set traffic factor (distance only) that is to be reported by this class.
void addTraffic(const Traffic::TrafficFactorData_WithPosition &factor)
Add a traffic factor that is to be reported by this class.
Convenience class for angle computations.
Q_INVOKABLE double toDEG() const
Convert angle to degrees.
Convenience class for distance computations.
Convenience class for speed computations.
Q_INVOKABLE double toMPS() const
Convert to meters per second.
Plain-data record of a traffic factor whose position is not known.
Plain-data record of a traffic factor whose precise position is known.