mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-09-28 15:56:33 -04:00
Map feature and dependent plugins: implement new message pipes. Part of #1154
This commit is contained in:
parent
10ae0f3efc
commit
35f1c2aacc
@ -712,22 +712,24 @@ bool ADSBDemodGUI::updateLocalPosition(Aircraft *aircraft, double latitude, doub
|
|||||||
void ADSBDemodGUI::sendToMap(Aircraft *aircraft, QList<SWGSDRangel::SWGMapAnimation *> *animations)
|
void ADSBDemodGUI::sendToMap(Aircraft *aircraft, QList<SWGSDRangel::SWGMapAnimation *> *animations)
|
||||||
{
|
{
|
||||||
// Send to Map feature
|
// Send to Map feature
|
||||||
MessagePipesLegacy& messagePipes = MainCore::instance()->getMessagePipesLegacy();
|
QList<ObjectPipe*> mapPipes;
|
||||||
QList<MessageQueue*> *mapMessageQueues = messagePipes.getMessageQueues(m_adsbDemod, "mapitems");
|
MainCore::instance()->getMessagePipes().getMessagePipes(m_adsbDemod, "mapitems", mapPipes);
|
||||||
if (mapMessageQueues)
|
|
||||||
{
|
|
||||||
QList<MessageQueue*>::iterator it = mapMessageQueues->begin();
|
|
||||||
|
|
||||||
|
if (mapPipes.size() > 0)
|
||||||
|
{
|
||||||
// Adjust altitude by airfield barometric elevation, so aircraft appears to
|
// Adjust altitude by airfield barometric elevation, so aircraft appears to
|
||||||
// take-off/land at correct point on runway
|
// take-off/land at correct point on runway
|
||||||
int altitudeFt = aircraft->m_altitude;
|
int altitudeFt = aircraft->m_altitude;
|
||||||
|
|
||||||
if (!aircraft->m_onSurface && !aircraft->m_altitudeGNSS) {
|
if (!aircraft->m_onSurface && !aircraft->m_altitudeGNSS) {
|
||||||
altitudeFt -= m_settings.m_airfieldElevation;
|
altitudeFt -= m_settings.m_airfieldElevation;
|
||||||
}
|
}
|
||||||
|
|
||||||
float altitudeM = Units::feetToMetres(altitudeFt);
|
float altitudeM = Units::feetToMetres(altitudeFt);
|
||||||
|
|
||||||
for (; it != mapMessageQueues->end(); ++it)
|
for (const auto& pipe : mapPipes)
|
||||||
{
|
{
|
||||||
|
MessageQueue *messageQueue = qobject_cast<MessageQueue*>(pipe->m_element);
|
||||||
SWGSDRangel::SWGMapItem *swgMapItem = new SWGSDRangel::SWGMapItem();
|
SWGSDRangel::SWGMapItem *swgMapItem = new SWGSDRangel::SWGMapItem();
|
||||||
swgMapItem->setName(new QString(aircraft->m_icaoHex));
|
swgMapItem->setName(new QString(aircraft->m_icaoHex));
|
||||||
swgMapItem->setLatitude(aircraft->m_latitude);
|
swgMapItem->setLatitude(aircraft->m_latitude);
|
||||||
@ -738,12 +740,15 @@ void ADSBDemodGUI::sendToMap(Aircraft *aircraft, QList<SWGSDRangel::SWGMapAnimat
|
|||||||
swgMapItem->setImage(new QString(QString("qrc:///map/%1").arg(aircraft->getImage())));
|
swgMapItem->setImage(new QString(QString("qrc:///map/%1").arg(aircraft->getImage())));
|
||||||
swgMapItem->setImageRotation(aircraft->m_heading);
|
swgMapItem->setImageRotation(aircraft->m_heading);
|
||||||
swgMapItem->setText(new QString(aircraft->getText(true)));
|
swgMapItem->setText(new QString(aircraft->getText(true)));
|
||||||
|
|
||||||
if (!aircraft->m_aircraft3DModel.isEmpty()) {
|
if (!aircraft->m_aircraft3DModel.isEmpty()) {
|
||||||
swgMapItem->setModel(new QString(aircraft->m_aircraft3DModel));
|
swgMapItem->setModel(new QString(aircraft->m_aircraft3DModel));
|
||||||
} else {
|
} else {
|
||||||
swgMapItem->setModel(new QString(aircraft->m_aircraftCat3DModel));
|
swgMapItem->setModel(new QString(aircraft->m_aircraftCat3DModel));
|
||||||
}
|
}
|
||||||
|
|
||||||
swgMapItem->setLabel(new QString(aircraft->m_callsign));
|
swgMapItem->setLabel(new QString(aircraft->m_callsign));
|
||||||
|
|
||||||
if (aircraft->m_headingValid)
|
if (aircraft->m_headingValid)
|
||||||
{
|
{
|
||||||
swgMapItem->setOrientation(1);
|
swgMapItem->setOrientation(1);
|
||||||
@ -757,13 +762,14 @@ void ADSBDemodGUI::sendToMap(Aircraft *aircraft, QList<SWGSDRangel::SWGMapAnimat
|
|||||||
// Orient aircraft based on velocity calculated from position
|
// Orient aircraft based on velocity calculated from position
|
||||||
swgMapItem->setOrientation(0);
|
swgMapItem->setOrientation(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
swgMapItem->setModelAltitudeOffset(aircraft->m_modelAltitudeOffset);
|
swgMapItem->setModelAltitudeOffset(aircraft->m_modelAltitudeOffset);
|
||||||
swgMapItem->setLabelAltitudeOffset(aircraft->m_labelAltitudeOffset);
|
swgMapItem->setLabelAltitudeOffset(aircraft->m_labelAltitudeOffset);
|
||||||
swgMapItem->setAltitudeReference(3); // CLIP_TO_GROUND so aircraft don't go under runway
|
swgMapItem->setAltitudeReference(3); // CLIP_TO_GROUND so aircraft don't go under runway
|
||||||
swgMapItem->setAnimations(animations); // Does this need to be duplicated?
|
swgMapItem->setAnimations(animations); // Does this need to be duplicated?
|
||||||
|
|
||||||
MainCore::MsgMapItem *msg = MainCore::MsgMapItem::create(m_adsbDemod, swgMapItem);
|
MainCore::MsgMapItem *msg = MainCore::MsgMapItem::create(m_adsbDemod, swgMapItem);
|
||||||
(*it)->push(msg);
|
messageQueue->push(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4037,10 +4043,12 @@ void ADSBDemodGUI::tick()
|
|||||||
QDateTime now = QDateTime::currentDateTime();
|
QDateTime now = QDateTime::currentDateTime();
|
||||||
qint64 nowSecs = now.toSecsSinceEpoch();
|
qint64 nowSecs = now.toSecsSinceEpoch();
|
||||||
QHash<int, Aircraft *>::iterator i = m_aircraft.begin();
|
QHash<int, Aircraft *>::iterator i = m_aircraft.begin();
|
||||||
|
|
||||||
while (i != m_aircraft.end())
|
while (i != m_aircraft.end())
|
||||||
{
|
{
|
||||||
Aircraft *aircraft = i.value();
|
Aircraft *aircraft = i.value();
|
||||||
qint64 secondsSinceLastFrame = nowSecs - aircraft->m_time.toSecsSinceEpoch();
|
qint64 secondsSinceLastFrame = nowSecs - aircraft->m_time.toSecsSinceEpoch();
|
||||||
|
|
||||||
if (secondsSinceLastFrame >= m_settings.m_removeTimeout)
|
if (secondsSinceLastFrame >= m_settings.m_removeTimeout)
|
||||||
{
|
{
|
||||||
// Don't try to track it anymore
|
// Don't try to track it anymore
|
||||||
@ -4049,6 +4057,7 @@ void ADSBDemodGUI::tick()
|
|||||||
m_adsbDemod->clearTarget();
|
m_adsbDemod->clearTarget();
|
||||||
m_trackAircraft = nullptr;
|
m_trackAircraft = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove map model
|
// Remove map model
|
||||||
m_aircraftModel.removeAircraft(aircraft);
|
m_aircraftModel.removeAircraft(aircraft);
|
||||||
// Remove row from table
|
// Remove row from table
|
||||||
@ -4056,25 +4065,26 @@ void ADSBDemodGUI::tick()
|
|||||||
// Remove aircraft from hash
|
// Remove aircraft from hash
|
||||||
i = m_aircraft.erase(i);
|
i = m_aircraft.erase(i);
|
||||||
// Remove from map feature
|
// Remove from map feature
|
||||||
MessagePipesLegacy& messagePipes = MainCore::instance()->getMessagePipesLegacy();
|
QList<ObjectPipe*> mapPipes;
|
||||||
QList<MessageQueue*> *mapMessageQueues = messagePipes.getMessageQueues(m_adsbDemod, "mapitems");
|
MainCore::instance()->getMessagePipes().getMessagePipes(this, "mapitems", mapPipes);
|
||||||
if (mapMessageQueues)
|
|
||||||
|
for (const auto& pipe : mapPipes)
|
||||||
{
|
{
|
||||||
QList<MessageQueue*>::iterator it = mapMessageQueues->begin();
|
MessageQueue *messageQueue = qobject_cast<MessageQueue*>(pipe->m_element);
|
||||||
for (; it != mapMessageQueues->end(); ++it)
|
SWGSDRangel::SWGMapItem *swgMapItem = new SWGSDRangel::SWGMapItem();
|
||||||
{
|
swgMapItem->setName(new QString(QString("%1").arg(aircraft->m_icao, 0, 16)));
|
||||||
SWGSDRangel::SWGMapItem *swgMapItem = new SWGSDRangel::SWGMapItem();
|
swgMapItem->setImage(new QString(""));
|
||||||
swgMapItem->setName(new QString(QString("%1").arg(aircraft->m_icao, 0, 16)));
|
MainCore::MsgMapItem *msg = MainCore::MsgMapItem::create(m_adsbDemod, swgMapItem);
|
||||||
swgMapItem->setImage(new QString(""));
|
messageQueue->push(msg);
|
||||||
MainCore::MsgMapItem *msg = MainCore::MsgMapItem::create(m_adsbDemod, swgMapItem);
|
|
||||||
(*it)->push(msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// And finally free its memory
|
// And finally free its memory
|
||||||
delete aircraft;
|
delete aircraft;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
++i;
|
++i;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -867,20 +867,18 @@ void APTDemodGUI::on_deleteImageFromMap_clicked()
|
|||||||
|
|
||||||
void APTDemodGUI::deleteImageFromMap(const QString &name)
|
void APTDemodGUI::deleteImageFromMap(const QString &name)
|
||||||
{
|
{
|
||||||
MessagePipesLegacy& messagePipes = MainCore::instance()->getMessagePipesLegacy();
|
QList<ObjectPipe*> mapPipes;
|
||||||
QList<MessageQueue*> *mapMessageQueues = messagePipes.getMessageQueues(m_aptDemod, "mapitems");
|
MainCore::instance()->getMessagePipes().getMessagePipes(m_aptDemod, "mapitems", mapPipes);
|
||||||
if (mapMessageQueues)
|
|
||||||
{
|
|
||||||
QList<MessageQueue*>::iterator it = mapMessageQueues->begin();
|
|
||||||
for (; it != mapMessageQueues->end(); ++it)
|
|
||||||
{
|
|
||||||
SWGSDRangel::SWGMapItem *swgMapItem = new SWGSDRangel::SWGMapItem();
|
|
||||||
swgMapItem->setName(new QString(name));
|
|
||||||
swgMapItem->setImage(new QString()); // Set image to "" to delete it
|
|
||||||
swgMapItem->setType(1);
|
|
||||||
|
|
||||||
MainCore::MsgMapItem *msg = MainCore::MsgMapItem::create(m_aptDemod, swgMapItem);
|
for (const auto& pipe : mapPipes)
|
||||||
(*it)->push(msg);
|
{
|
||||||
}
|
MessageQueue *messageQueue = qobject_cast<MessageQueue*>(pipe->m_element);
|
||||||
|
SWGSDRangel::SWGMapItem *swgMapItem = new SWGSDRangel::SWGMapItem();
|
||||||
|
swgMapItem->setName(new QString(name));
|
||||||
|
swgMapItem->setImage(new QString()); // Set image to "" to delete it
|
||||||
|
swgMapItem->setType(1);
|
||||||
|
|
||||||
|
MainCore::MsgMapItem *msg = MainCore::MsgMapItem::create(m_aptDemod, swgMapItem);
|
||||||
|
messageQueue->push(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -661,9 +661,10 @@ void APTDemodImageWorker::makeTransparent(QImage &image)
|
|||||||
void APTDemodImageWorker::sendImageToMap(QImage image)
|
void APTDemodImageWorker::sendImageToMap(QImage image)
|
||||||
{
|
{
|
||||||
// Send to Map feature
|
// Send to Map feature
|
||||||
MessagePipesLegacy& messagePipes = MainCore::instance()->getMessagePipesLegacy();
|
QList<ObjectPipe*> mapPipes;
|
||||||
QList<MessageQueue*> *mapMessageQueues = messagePipes.getMessageQueues(m_aptDemod, "mapitems");
|
MainCore::instance()->getMessagePipes().getMessagePipes(m_aptDemod, "mapitems", mapPipes);
|
||||||
if (mapMessageQueues)
|
|
||||||
|
if (mapPipes.size() > 0)
|
||||||
{
|
{
|
||||||
// Only display one channel on map
|
// Only display one channel on map
|
||||||
QImage selectedChannel;
|
QImage selectedChannel;
|
||||||
@ -695,9 +696,9 @@ void APTDemodImageWorker::sendImageToMap(QImage image)
|
|||||||
// Send name to GUI
|
// Send name to GUI
|
||||||
m_messageQueueToGUI->push(APTDemod::MsgMapImageName::create(name));
|
m_messageQueueToGUI->push(APTDemod::MsgMapImageName::create(name));
|
||||||
|
|
||||||
QList<MessageQueue*>::iterator it = mapMessageQueues->begin();
|
for (const auto& pipe : mapPipes)
|
||||||
for (; it != mapMessageQueues->end(); ++it)
|
|
||||||
{
|
{
|
||||||
|
MessageQueue *messageQueue = qobject_cast<MessageQueue*>(pipe->m_element);
|
||||||
SWGSDRangel::SWGMapItem *swgMapItem = new SWGSDRangel::SWGMapItem();
|
SWGSDRangel::SWGMapItem *swgMapItem = new SWGSDRangel::SWGMapItem();
|
||||||
swgMapItem->setName(new QString(name));
|
swgMapItem->setName(new QString(name));
|
||||||
swgMapItem->setImage(new QString(data));
|
swgMapItem->setImage(new QString(data));
|
||||||
@ -709,7 +710,7 @@ void APTDemodImageWorker::sendImageToMap(QImage image)
|
|||||||
swgMapItem->setImageTileSouth(m_tileSouth);
|
swgMapItem->setImageTileSouth(m_tileSouth);
|
||||||
|
|
||||||
MainCore::MsgMapItem *msg = MainCore::MsgMapItem::create(m_aptDemod, swgMapItem);
|
MainCore::MsgMapItem *msg = MainCore::MsgMapItem::create(m_aptDemod, swgMapItem);
|
||||||
(*it)->push(msg);
|
messageQueue->push(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -416,46 +416,44 @@ void AISGUI::sendToMap(const QString &name, const QString &label,
|
|||||||
float heading
|
float heading
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
MessagePipesLegacy& messagePipes = MainCore::instance()->getMessagePipesLegacy();
|
QList<ObjectPipe*> mapPipes;
|
||||||
QList<MessageQueue*> *mapMessageQueues = messagePipes.getMessageQueues(m_ais, "mapitems");
|
MainCore::instance()->getMessagePipes().getMessagePipes(m_ais, "mapitems", mapPipes);
|
||||||
if (mapMessageQueues)
|
|
||||||
|
for (const auto& pipe : mapPipes)
|
||||||
{
|
{
|
||||||
QList<MessageQueue*>::iterator it = mapMessageQueues->begin();
|
MessageQueue *messageQueue = qobject_cast<MessageQueue*>(pipe->m_element);
|
||||||
|
SWGSDRangel::SWGMapItem *swgMapItem = new SWGSDRangel::SWGMapItem();
|
||||||
|
swgMapItem->setName(new QString(name));
|
||||||
|
swgMapItem->setLatitude(latitude);
|
||||||
|
swgMapItem->setLongitude(longitude);
|
||||||
|
swgMapItem->setAltitude(0);
|
||||||
|
swgMapItem->setAltitudeReference(1); // CLAMP_TO_GROUND
|
||||||
|
|
||||||
for (; it != mapMessageQueues->end(); ++it)
|
if (positionDateTime.isValid()) {
|
||||||
{
|
swgMapItem->setPositionDateTime(new QString(positionDateTime.toString(Qt::ISODateWithMs)));
|
||||||
SWGSDRangel::SWGMapItem *swgMapItem = new SWGSDRangel::SWGMapItem();
|
|
||||||
swgMapItem->setName(new QString(name));
|
|
||||||
swgMapItem->setLatitude(latitude);
|
|
||||||
swgMapItem->setLongitude(longitude);
|
|
||||||
swgMapItem->setAltitude(0);
|
|
||||||
swgMapItem->setAltitudeReference(1); // CLAMP_TO_GROUND
|
|
||||||
|
|
||||||
if (positionDateTime.isValid()) {
|
|
||||||
swgMapItem->setPositionDateTime(new QString(positionDateTime.toString(Qt::ISODateWithMs)));
|
|
||||||
}
|
|
||||||
|
|
||||||
swgMapItem->setImageRotation(heading);
|
|
||||||
swgMapItem->setText(new QString(text));
|
|
||||||
|
|
||||||
if (image.isEmpty()) {
|
|
||||||
swgMapItem->setImage(new QString(""));
|
|
||||||
} else {
|
|
||||||
swgMapItem->setImage(new QString(QString("qrc:///ais/map/%1").arg(image)));
|
|
||||||
}
|
|
||||||
swgMapItem->setModel(new QString(model));
|
|
||||||
swgMapItem->setModelAltitudeOffset(modelOffset);
|
|
||||||
swgMapItem->setLabel(new QString(label));
|
|
||||||
swgMapItem->setLabelAltitudeOffset(labelOffset);
|
|
||||||
swgMapItem->setFixedPosition(false);
|
|
||||||
swgMapItem->setOrientation(1);
|
|
||||||
swgMapItem->setHeading(heading);
|
|
||||||
swgMapItem->setPitch(0.0);
|
|
||||||
swgMapItem->setRoll(0.0);
|
|
||||||
|
|
||||||
MainCore::MsgMapItem *msg = MainCore::MsgMapItem::create(m_ais, swgMapItem);
|
|
||||||
(*it)->push(msg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
swgMapItem->setImageRotation(heading);
|
||||||
|
swgMapItem->setText(new QString(text));
|
||||||
|
|
||||||
|
if (image.isEmpty()) {
|
||||||
|
swgMapItem->setImage(new QString(""));
|
||||||
|
} else {
|
||||||
|
swgMapItem->setImage(new QString(QString("qrc:///ais/map/%1").arg(image)));
|
||||||
|
}
|
||||||
|
|
||||||
|
swgMapItem->setModel(new QString(model));
|
||||||
|
swgMapItem->setModelAltitudeOffset(modelOffset);
|
||||||
|
swgMapItem->setLabel(new QString(label));
|
||||||
|
swgMapItem->setLabelAltitudeOffset(labelOffset);
|
||||||
|
swgMapItem->setFixedPosition(false);
|
||||||
|
swgMapItem->setOrientation(1);
|
||||||
|
swgMapItem->setHeading(heading);
|
||||||
|
swgMapItem->setPitch(0.0);
|
||||||
|
swgMapItem->setRoll(0.0);
|
||||||
|
|
||||||
|
MainCore::MsgMapItem *msg = MainCore::MsgMapItem::create(m_ais, swgMapItem);
|
||||||
|
messageQueue->push(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -337,46 +337,52 @@ bool APRSGUI::handleMessage(const Message& message)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Forward to map
|
// Forward to map
|
||||||
MessagePipesLegacy& messagePipes = MainCore::instance()->getMessagePipesLegacy();
|
if (aprs->m_hasPosition && (aprs->m_from != ""))
|
||||||
QList<MessageQueue*> *mapMessageQueues = messagePipes.getMessageQueues(m_aprs, "mapitems");
|
|
||||||
if (mapMessageQueues)
|
|
||||||
{
|
{
|
||||||
if (aprs->m_hasPosition && (aprs->m_from != ""))
|
QList<ObjectPipe*> mapPipes;
|
||||||
|
MainCore::instance()->getMessagePipes().getMessagePipes(m_aprs, "mapitems", mapPipes);
|
||||||
|
|
||||||
|
for (const auto& pipe : mapPipes)
|
||||||
{
|
{
|
||||||
QList<MessageQueue*>::iterator it = mapMessageQueues->begin();
|
MessageQueue *messageQueue = qobject_cast<MessageQueue*>(pipe->m_element);
|
||||||
|
SWGSDRangel::SWGMapItem *swgMapItem = new SWGSDRangel::SWGMapItem();
|
||||||
|
|
||||||
for (; it != mapMessageQueues->end(); ++it)
|
if (!aprs->m_objectName.isEmpty()) {
|
||||||
{
|
swgMapItem->setName(new QString(aprs->m_objectName));
|
||||||
SWGSDRangel::SWGMapItem *swgMapItem = new SWGSDRangel::SWGMapItem();
|
} else {
|
||||||
if (!aprs->m_objectName.isEmpty())
|
swgMapItem->setName(new QString(aprs->m_from));
|
||||||
swgMapItem->setName(new QString(aprs->m_objectName));
|
|
||||||
else
|
|
||||||
swgMapItem->setName(new QString(aprs->m_from));
|
|
||||||
swgMapItem->setLatitude(aprs->m_latitude);
|
|
||||||
swgMapItem->setLongitude(aprs->m_longitude);
|
|
||||||
swgMapItem->setAltitude(aprs->m_hasAltitude ? Units::feetToMetres(aprs->m_altitudeFt) : 0);
|
|
||||||
swgMapItem->setAltitudeReference(1); // CLAMP_TO_GROUND
|
|
||||||
if (aprs->m_objectKilled)
|
|
||||||
{
|
|
||||||
swgMapItem->setImage(new QString(""));
|
|
||||||
swgMapItem->setText(new QString(""));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
swgMapItem->setImage(new QString(QString("qrc:///%1").arg(aprs->m_symbolImage)));
|
|
||||||
swgMapItem->setText(new QString(aprs->toText(true, false, '\n',
|
|
||||||
m_settings.m_altitudeUnits == APRSSettings::METRES,
|
|
||||||
(int)m_settings.m_speedUnits,
|
|
||||||
m_settings.m_temperatureUnits == APRSSettings::CELSIUS,
|
|
||||||
m_settings.m_rainfallUnits == APRSSettings::MILLIMETRE)));
|
|
||||||
}
|
|
||||||
|
|
||||||
MainCore::MsgMapItem *msg = MainCore::MsgMapItem::create(m_aprs, swgMapItem);
|
|
||||||
(*it)->push(msg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
swgMapItem->setLatitude(aprs->m_latitude);
|
||||||
|
swgMapItem->setLongitude(aprs->m_longitude);
|
||||||
|
swgMapItem->setAltitude(aprs->m_hasAltitude ? Units::feetToMetres(aprs->m_altitudeFt) : 0);
|
||||||
|
swgMapItem->setAltitudeReference(1); // CLAMP_TO_GROUND
|
||||||
|
|
||||||
|
if (aprs->m_objectKilled)
|
||||||
|
{
|
||||||
|
swgMapItem->setImage(new QString(""));
|
||||||
|
swgMapItem->setText(new QString(""));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
swgMapItem->setImage(new QString(QString("qrc:///%1").arg(aprs->m_symbolImage)));
|
||||||
|
swgMapItem->setText(new QString(
|
||||||
|
aprs->toText(
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
'\n',
|
||||||
|
m_settings.m_altitudeUnits == APRSSettings::METRES,
|
||||||
|
(int)m_settings.m_speedUnits,
|
||||||
|
m_settings.m_temperatureUnits == APRSSettings::CELSIUS,
|
||||||
|
m_settings.m_rainfallUnits == APRSSettings::MILLIMETRE
|
||||||
|
)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
MainCore::MsgMapItem *msg = MainCore::MsgMapItem::create(m_aprs, swgMapItem);
|
||||||
|
messageQueue->push(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -385,7 +391,10 @@ bool APRSGUI::handleMessage(const Message& message)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
qDebug() << "APRSGUI::handleMessage: Failed to decode as AX.25";
|
qDebug() << "APRSGUI::handleMessage: Failed to decode as AX.25";
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include <QNetworkAccessManager>
|
#include <QNetworkAccessManager>
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
#include <QBuffer>
|
#include <QBuffer>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
#include "SWGFeatureSettings.h"
|
#include "SWGFeatureSettings.h"
|
||||||
#include "SWGFeatureReport.h"
|
#include "SWGFeatureReport.h"
|
||||||
@ -38,6 +39,7 @@
|
|||||||
MESSAGE_CLASS_DEFINITION(Map::MsgConfigureMap, Message)
|
MESSAGE_CLASS_DEFINITION(Map::MsgConfigureMap, Message)
|
||||||
MESSAGE_CLASS_DEFINITION(Map::MsgFind, Message)
|
MESSAGE_CLASS_DEFINITION(Map::MsgFind, Message)
|
||||||
MESSAGE_CLASS_DEFINITION(Map::MsgSetDateTime, Message)
|
MESSAGE_CLASS_DEFINITION(Map::MsgSetDateTime, Message)
|
||||||
|
MESSAGE_CLASS_DEFINITION(Map::MsgReportAvailableChannelOrFeatures, Message)
|
||||||
|
|
||||||
const char* const Map::m_featureIdURI = "sdrangel.feature.map";
|
const char* const Map::m_featureIdURI = "sdrangel.feature.map";
|
||||||
const char* const Map::m_featureId = "Map";
|
const char* const Map::m_featureId = "Map";
|
||||||
@ -51,8 +53,6 @@ Map::Map(WebAPIAdapterInterface *webAPIAdapterInterface) :
|
|||||||
setObjectName(m_featureId);
|
setObjectName(m_featureId);
|
||||||
m_state = StIdle;
|
m_state = StIdle;
|
||||||
m_errorMessage = "Map error";
|
m_errorMessage = "Map error";
|
||||||
connect(&m_updatePipesTimer, SIGNAL(timeout()), this, SLOT(updatePipes()));
|
|
||||||
m_updatePipesTimer.start(1000);
|
|
||||||
m_networkManager = new QNetworkAccessManager();
|
m_networkManager = new QNetworkAccessManager();
|
||||||
QObject::connect(
|
QObject::connect(
|
||||||
m_networkManager,
|
m_networkManager,
|
||||||
@ -60,10 +60,35 @@ Map::Map(WebAPIAdapterInterface *webAPIAdapterInterface) :
|
|||||||
this,
|
this,
|
||||||
&Map::networkManagerFinished
|
&Map::networkManagerFinished
|
||||||
);
|
);
|
||||||
|
QObject::connect(
|
||||||
|
MainCore::instance(),
|
||||||
|
&MainCore::featureAdded,
|
||||||
|
this,
|
||||||
|
&Map::handleFeatureAdded
|
||||||
|
);
|
||||||
|
QObject::connect(
|
||||||
|
MainCore::instance(),
|
||||||
|
&MainCore::channelAdded,
|
||||||
|
this,
|
||||||
|
&Map::handleChannelAdded
|
||||||
|
);
|
||||||
|
QTimer::singleShot(2000, this, SLOT(scanAvailableChannelsAndFeatures()));
|
||||||
}
|
}
|
||||||
|
|
||||||
Map::~Map()
|
Map::~Map()
|
||||||
{
|
{
|
||||||
|
QObject::disconnect(
|
||||||
|
MainCore::instance(),
|
||||||
|
&MainCore::featureAdded,
|
||||||
|
this,
|
||||||
|
&Map::handleFeatureAdded
|
||||||
|
);
|
||||||
|
QObject::disconnect(
|
||||||
|
MainCore::instance(),
|
||||||
|
&MainCore::channelAdded,
|
||||||
|
this,
|
||||||
|
&Map::handleChannelAdded
|
||||||
|
);
|
||||||
QObject::disconnect(
|
QObject::disconnect(
|
||||||
m_networkManager,
|
m_networkManager,
|
||||||
&QNetworkAccessManager::finished,
|
&QNetworkAccessManager::finished,
|
||||||
@ -85,6 +110,7 @@ bool Map::handleMessage(const Message& cmd)
|
|||||||
}
|
}
|
||||||
else if (MainCore::MsgMapItem::match(cmd))
|
else if (MainCore::MsgMapItem::match(cmd))
|
||||||
{
|
{
|
||||||
|
qDebug() << "Map::handleMessage: MsgMapItem";
|
||||||
MainCore::MsgMapItem& msgMapItem = (MainCore::MsgMapItem&) cmd;
|
MainCore::MsgMapItem& msgMapItem = (MainCore::MsgMapItem&) cmd;
|
||||||
MainCore::MsgMapItem *copy = new MainCore::MsgMapItem(msgMapItem);
|
MainCore::MsgMapItem *copy = new MainCore::MsgMapItem(msgMapItem);
|
||||||
getMessageQueueToGUI()->push(copy);
|
getMessageQueueToGUI()->push(copy);
|
||||||
@ -96,23 +122,6 @@ bool Map::handleMessage(const Message& cmd)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Map::updatePipes()
|
|
||||||
{
|
|
||||||
QList<AvailablePipeSource> availablePipes = updateAvailablePipeSources("mapitems", MapSettings::m_pipeTypes, MapSettings::m_pipeURIs, this);
|
|
||||||
|
|
||||||
if (availablePipes != m_availablePipes)
|
|
||||||
{
|
|
||||||
m_availablePipes = availablePipes;
|
|
||||||
if (getMessageQueueToGUI())
|
|
||||||
{
|
|
||||||
MsgReportPipes *msgToGUI = MsgReportPipes::create();
|
|
||||||
QList<AvailablePipeSource>& msgAvailablePipes = msgToGUI->getAvailablePipes();
|
|
||||||
msgAvailablePipes.append(availablePipes);
|
|
||||||
getMessageQueueToGUI()->push(msgToGUI);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QByteArray Map::serialize() const
|
QByteArray Map::serialize() const
|
||||||
{
|
{
|
||||||
return m_settings.serialize();
|
return m_settings.serialize();
|
||||||
@ -435,3 +444,164 @@ QDateTime Map::getMapDateTime()
|
|||||||
return m_mapDateTime.addMSecs(diffMsecs * m_multiplier);
|
return m_mapDateTime.addMSecs(diffMsecs * m_multiplier);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Map::scanAvailableChannelsAndFeatures()
|
||||||
|
{
|
||||||
|
qDebug("Map::scanAvailableChannelsAndFeatures");
|
||||||
|
std::vector<FeatureSet*>& featureSets = MainCore::instance()->getFeatureeSets();
|
||||||
|
m_availableChannelOrFeatures.clear();
|
||||||
|
|
||||||
|
for (const auto& featureSet : featureSets)
|
||||||
|
{
|
||||||
|
for (int fei = 0; fei < featureSet->getNumberOfFeatures(); fei++)
|
||||||
|
{
|
||||||
|
Feature *feature = featureSet->getFeatureAt(fei);
|
||||||
|
|
||||||
|
if (MapSettings::m_pipeURIs.contains(feature->getURI()) && !m_availableChannelOrFeatures.contains(feature))
|
||||||
|
{
|
||||||
|
qDebug("Map::scanAvailableChannelsAndFeatures: store feature %d:%d %s (%p)",
|
||||||
|
featureSet->getIndex(), fei, qPrintable(feature->getURI()), feature);
|
||||||
|
registerPipe(feature);
|
||||||
|
MapSettings::AvailableChannelOrFeature availableItem =
|
||||||
|
MapSettings::AvailableChannelOrFeature{
|
||||||
|
"F",
|
||||||
|
featureSet->getIndex(),
|
||||||
|
fei,
|
||||||
|
feature->getIdentifier(),
|
||||||
|
feature
|
||||||
|
};
|
||||||
|
m_availableChannelOrFeatures[feature] = availableItem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<DeviceSet*>& deviceSets = MainCore::instance()->getDeviceSets();
|
||||||
|
|
||||||
|
for (const auto& deviceSet : deviceSets)
|
||||||
|
{
|
||||||
|
DSPDeviceSourceEngine *deviceSourceEngine = deviceSet->m_deviceSourceEngine;
|
||||||
|
|
||||||
|
if (deviceSourceEngine)
|
||||||
|
{
|
||||||
|
for (int chi = 0; chi < deviceSet->getNumberOfChannels(); chi++)
|
||||||
|
{
|
||||||
|
ChannelAPI *channel = deviceSet->getChannelAt(chi);
|
||||||
|
|
||||||
|
if (MapSettings::m_pipeURIs.contains(channel->getURI()) && !m_availableChannelOrFeatures.contains(channel))
|
||||||
|
{
|
||||||
|
qDebug("Map::scanAvailableChannelsAndFeatures: store channel %d:%d %s (%p)",
|
||||||
|
deviceSet->getIndex(), chi, qPrintable(channel->getURI()), channel);
|
||||||
|
registerPipe(channel);
|
||||||
|
MapSettings::AvailableChannelOrFeature availableItem =
|
||||||
|
MapSettings::AvailableChannelOrFeature{
|
||||||
|
"R",
|
||||||
|
deviceSet->getIndex(),
|
||||||
|
chi,
|
||||||
|
channel->getIdentifier(),
|
||||||
|
channel};
|
||||||
|
m_availableChannelOrFeatures[channel] = availableItem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
notifyUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Map::handleFeatureAdded(int featureSetIndex, Feature *feature)
|
||||||
|
{
|
||||||
|
FeatureSet *featureSet = MainCore::instance()->getFeatureeSets()[featureSetIndex];
|
||||||
|
|
||||||
|
if (MapSettings::m_pipeURIs.contains(feature->getURI()))
|
||||||
|
{
|
||||||
|
qDebug("Map::handleFeatureAdded: featureSetIndex: %d:%d feature: %s (%p)",
|
||||||
|
featureSetIndex, feature->getIndexInFeatureSet(), qPrintable(feature->getURI()), feature);
|
||||||
|
registerPipe(feature);
|
||||||
|
MapSettings::AvailableChannelOrFeature availableItem =
|
||||||
|
MapSettings::AvailableChannelOrFeature{
|
||||||
|
"F",
|
||||||
|
featureSet->getIndex(),
|
||||||
|
feature->getIndexInFeatureSet(),
|
||||||
|
feature->getIdentifier(),
|
||||||
|
feature
|
||||||
|
};
|
||||||
|
m_availableChannelOrFeatures[feature] = availableItem;
|
||||||
|
notifyUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Map::handleChannelAdded(int deviceSetIndex, ChannelAPI *channel)
|
||||||
|
{
|
||||||
|
DeviceSet *deviceSet = MainCore::instance()->getDeviceSets()[deviceSetIndex];
|
||||||
|
DSPDeviceSourceEngine *deviceSourceEngine = deviceSet->m_deviceSourceEngine;
|
||||||
|
|
||||||
|
if (deviceSourceEngine && MapSettings::m_pipeURIs.contains(channel->getURI()))
|
||||||
|
{
|
||||||
|
qDebug("Map::handleChannelAdded: deviceSetIndex: %d:%d channel: %s (%p)",
|
||||||
|
deviceSetIndex, channel->getIndexInDeviceSet(), qPrintable(channel->getURI()), channel);
|
||||||
|
registerPipe(channel);
|
||||||
|
MapSettings::AvailableChannelOrFeature availableItem =
|
||||||
|
MapSettings::AvailableChannelOrFeature{
|
||||||
|
"R",
|
||||||
|
deviceSet->getIndex(),
|
||||||
|
channel->getIndexInDeviceSet(),
|
||||||
|
channel->getIdentifier(),
|
||||||
|
channel
|
||||||
|
};
|
||||||
|
m_availableChannelOrFeatures[channel] = availableItem;
|
||||||
|
notifyUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Map::registerPipe(QObject *object)
|
||||||
|
{
|
||||||
|
qDebug("Map::registerPipe: register %s (%p)", qPrintable(object->objectName()), object);
|
||||||
|
MessagePipes& messagePipes = MainCore::instance()->getMessagePipes();
|
||||||
|
ObjectPipe *pipe = messagePipes.registerProducerToConsumer(object, this, "mapitems");
|
||||||
|
MessageQueue *messageQueue = qobject_cast<MessageQueue*>(pipe->m_element);
|
||||||
|
QObject::connect(
|
||||||
|
messageQueue,
|
||||||
|
&MessageQueue::messageEnqueued,
|
||||||
|
this,
|
||||||
|
[=](){ this->handlePipeMessageQueue(messageQueue); },
|
||||||
|
Qt::QueuedConnection
|
||||||
|
);
|
||||||
|
QObject::connect(
|
||||||
|
pipe,
|
||||||
|
&ObjectPipe::toBeDeleted,
|
||||||
|
this,
|
||||||
|
&Map::handleMessagePipeToBeDeleted
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Map::notifyUpdate()
|
||||||
|
{
|
||||||
|
if (getMessageQueueToGUI())
|
||||||
|
{
|
||||||
|
MsgReportAvailableChannelOrFeatures *msg = MsgReportAvailableChannelOrFeatures::create();
|
||||||
|
msg->getItems() = m_availableChannelOrFeatures.values();
|
||||||
|
getMessageQueueToGUI()->push(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Map::handleMessagePipeToBeDeleted(int reason, QObject* object)
|
||||||
|
{
|
||||||
|
if ((reason == 0) && m_availableChannelOrFeatures.contains(object)) // producer
|
||||||
|
{
|
||||||
|
qDebug("Map::handleMessagePipeToBeDeleted: removing channel or feature at (%p)", object);
|
||||||
|
m_availableChannelOrFeatures.remove(object);
|
||||||
|
notifyUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Map::handlePipeMessageQueue(MessageQueue* messageQueue)
|
||||||
|
{
|
||||||
|
Message* message;
|
||||||
|
|
||||||
|
while ((message = messageQueue->pop()) != nullptr)
|
||||||
|
{
|
||||||
|
if (handleMessage(*message)) {
|
||||||
|
delete message;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
#include <QNetworkRequest>
|
#include <QNetworkRequest>
|
||||||
#include <QTimer>
|
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
|
|
||||||
@ -103,6 +102,24 @@ public:
|
|||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class MsgReportAvailableChannelOrFeatures : public Message {
|
||||||
|
MESSAGE_CLASS_DECLARATION
|
||||||
|
|
||||||
|
public:
|
||||||
|
QList<MapSettings::AvailableChannelOrFeature>& getItems() { return m_availableChannelOrFeatures; }
|
||||||
|
|
||||||
|
static MsgReportAvailableChannelOrFeatures* create() {
|
||||||
|
return new MsgReportAvailableChannelOrFeatures();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
QList<MapSettings::AvailableChannelOrFeature> m_availableChannelOrFeatures;
|
||||||
|
|
||||||
|
MsgReportAvailableChannelOrFeatures() :
|
||||||
|
Message()
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
|
||||||
Map(WebAPIAdapterInterface *webAPIAdapterInterface);
|
Map(WebAPIAdapterInterface *webAPIAdapterInterface);
|
||||||
virtual ~Map();
|
virtual ~Map();
|
||||||
virtual void destroy() { delete this; }
|
virtual void destroy() { delete this; }
|
||||||
@ -156,8 +173,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
QThread m_thread;
|
QThread m_thread;
|
||||||
MapSettings m_settings;
|
MapSettings m_settings;
|
||||||
QList<AvailablePipeSource> m_availablePipes;
|
QHash<QObject*, MapSettings::AvailableChannelOrFeature> m_availableChannelOrFeatures;
|
||||||
QTimer m_updatePipesTimer;
|
|
||||||
|
|
||||||
QNetworkAccessManager *m_networkManager;
|
QNetworkAccessManager *m_networkManager;
|
||||||
QNetworkRequest m_networkRequest;
|
QNetworkRequest m_networkRequest;
|
||||||
@ -165,6 +181,8 @@ private:
|
|||||||
void applySettings(const MapSettings& settings, bool force = false);
|
void applySettings(const MapSettings& settings, bool force = false);
|
||||||
void webapiFormatFeatureReport(SWGSDRangel::SWGFeatureReport& response);
|
void webapiFormatFeatureReport(SWGSDRangel::SWGFeatureReport& response);
|
||||||
void webapiReverseSendSettings(QList<QString>& featureSettingsKeys, const MapSettings& settings, bool force);
|
void webapiReverseSendSettings(QList<QString>& featureSettingsKeys, const MapSettings& settings, bool force);
|
||||||
|
void registerPipe(QObject *object);
|
||||||
|
void notifyUpdate();
|
||||||
|
|
||||||
QDateTime m_mapDateTime;
|
QDateTime m_mapDateTime;
|
||||||
QDateTime m_systemDateTime;
|
QDateTime m_systemDateTime;
|
||||||
@ -172,8 +190,12 @@ private:
|
|||||||
QMutex m_dateTimeMutex;
|
QMutex m_dateTimeMutex;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void updatePipes();
|
|
||||||
void networkManagerFinished(QNetworkReply *reply);
|
void networkManagerFinished(QNetworkReply *reply);
|
||||||
|
void scanAvailableChannelsAndFeatures();
|
||||||
|
void handleFeatureAdded(int featureSetIndex, Feature *feature);
|
||||||
|
void handleChannelAdded(int deviceSetIndex, ChannelAPI *channel);
|
||||||
|
void handleMessagePipeToBeDeleted(int reason, QObject* object);
|
||||||
|
void handlePipeMessageQueue(MessageQueue* messageQueue);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INCLUDE_FEATURE_MAP_H_
|
#endif // INCLUDE_FEATURE_MAP_H_
|
||||||
|
@ -96,10 +96,10 @@ bool MapGUI::handleMessage(const Message& message)
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (PipeEndPoint::MsgReportPipes::match(message))
|
else if (Map::MsgReportAvailableChannelOrFeatures::match(message))
|
||||||
{
|
{
|
||||||
PipeEndPoint::MsgReportPipes& report = (PipeEndPoint::MsgReportPipes&) message;
|
Map::MsgReportAvailableChannelOrFeatures& report = (Map::MsgReportAvailableChannelOrFeatures&) message;
|
||||||
m_availablePipes = report.getAvailablePipes();
|
m_availableChannelOrFeatures = report.getItems();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -124,18 +124,20 @@ bool MapGUI::handleMessage(const Message& message)
|
|||||||
|
|
||||||
// TODO: Could have this in SWGMapItem so plugins can create additional groups
|
// TODO: Could have this in SWGMapItem so plugins can create additional groups
|
||||||
QString group;
|
QString group;
|
||||||
for (int i = 0; i < m_availablePipes.size(); i++)
|
|
||||||
|
for (int i = 0; i < m_availableChannelOrFeatures.size(); i++)
|
||||||
{
|
{
|
||||||
if (m_availablePipes[i].m_source == msgMapItem.getPipeSource())
|
if (m_availableChannelOrFeatures[i].m_source == msgMapItem.getPipeSource())
|
||||||
{
|
{
|
||||||
for (int j = 0; j < MapSettings::m_pipeTypes.size(); j++)
|
for (int j = 0; j < MapSettings::m_pipeTypes.size(); j++)
|
||||||
{
|
{
|
||||||
if (m_availablePipes[i].m_id == MapSettings::m_pipeTypes[j]) {
|
if (m_availableChannelOrFeatures[i].m_type == MapSettings::m_pipeTypes[j]) {
|
||||||
group = m_availablePipes[i].m_id;
|
group = m_availableChannelOrFeatures[i].m_type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
update(msgMapItem.getPipeSource(), swgMapItem, group);
|
update(msgMapItem.getPipeSource(), swgMapItem, group);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -288,7 +290,7 @@ MapGUI::~MapGUI()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update a map item or image
|
// Update a map item or image
|
||||||
void MapGUI::update(const PipeEndPoint *source, SWGSDRangel::SWGMapItem *swgMapItem, const QString &group)
|
void MapGUI::update(const QObject *source, SWGSDRangel::SWGMapItem *swgMapItem, const QString &group)
|
||||||
{
|
{
|
||||||
if (swgMapItem->getType() == 0)
|
if (swgMapItem->getType() == 0)
|
||||||
{
|
{
|
||||||
|
@ -97,7 +97,7 @@ private:
|
|||||||
MapSettings m_settings;
|
MapSettings m_settings;
|
||||||
RollupState m_rollupState;
|
RollupState m_rollupState;
|
||||||
bool m_doApplySettings;
|
bool m_doApplySettings;
|
||||||
QList<PipeEndPoint::AvailablePipeSource> m_availablePipes;
|
QList<MapSettings::AvailableChannelOrFeature> m_availableChannelOrFeatures;
|
||||||
|
|
||||||
Map* m_map;
|
Map* m_map;
|
||||||
MessageQueue m_inputMessageQueue;
|
MessageQueue m_inputMessageQueue;
|
||||||
@ -119,7 +119,7 @@ private:
|
|||||||
explicit MapGUI(PluginAPI* pluginAPI, FeatureUISet *featureUISet, Feature *feature, QWidget* parent = nullptr);
|
explicit MapGUI(PluginAPI* pluginAPI, FeatureUISet *featureUISet, Feature *feature, QWidget* parent = nullptr);
|
||||||
virtual ~MapGUI();
|
virtual ~MapGUI();
|
||||||
|
|
||||||
void update(const PipeEndPoint *source, SWGSDRangel::SWGMapItem *swgMapItem, const QString &group);
|
void update(const QObject *source, SWGSDRangel::SWGMapItem *swgMapItem, const QString &group);
|
||||||
void blockApplySettings(bool block);
|
void blockApplySettings(bool block);
|
||||||
void applySettings(bool force = false);
|
void applySettings(bool force = false);
|
||||||
void applyMap2DSettings(bool reloadMap);
|
void applyMap2DSettings(bool reloadMap);
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
#include "SWGTargetAzimuthElevation.h"
|
#include "SWGTargetAzimuthElevation.h"
|
||||||
|
|
||||||
MapItem::MapItem(const PipeEndPoint *sourcePipe, const QString &group, MapSettings::MapItemSettings *itemSettings, SWGSDRangel::SWGMapItem *mapItem) :
|
MapItem::MapItem(const QObject *sourcePipe, const QString &group, MapSettings::MapItemSettings *itemSettings, SWGSDRangel::SWGMapItem *mapItem) :
|
||||||
m_altitude(0.0)
|
m_altitude(0.0)
|
||||||
{
|
{
|
||||||
m_sourcePipe = sourcePipe;
|
m_sourcePipe = sourcePipe;
|
||||||
@ -216,7 +216,7 @@ Q_INVOKABLE void MapModel::add(MapItem *item)
|
|||||||
endInsertRows();
|
endInsertRows();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapModel::update(const PipeEndPoint *sourcePipe, SWGSDRangel::SWGMapItem *swgMapItem, const QString &group)
|
void MapModel::update(const QObject *sourcePipe, SWGSDRangel::SWGMapItem *swgMapItem, const QString &group)
|
||||||
{
|
{
|
||||||
QString name = *swgMapItem->getName();
|
QString name = *swgMapItem->getName();
|
||||||
// Add, update or delete and item
|
// Add, update or delete and item
|
||||||
@ -440,7 +440,7 @@ Q_INVOKABLE void MapModel::moveToBack(int oldRow)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MapItem *MapModel::findMapItem(const PipeEndPoint *source, const QString& name)
|
MapItem *MapModel::findMapItem(const QObject *source, const QString& name)
|
||||||
{
|
{
|
||||||
// FIXME: Should consider adding a QHash for this
|
// FIXME: Should consider adding a QHash for this
|
||||||
QListIterator<MapItem *> i(m_items);
|
QListIterator<MapItem *> i(m_items);
|
||||||
|
@ -31,13 +31,12 @@
|
|||||||
class MapModel;
|
class MapModel;
|
||||||
class MapGUI;
|
class MapGUI;
|
||||||
class CZML;
|
class CZML;
|
||||||
class PipeEndPoint;
|
|
||||||
|
|
||||||
// Information required about each item displayed on the map
|
// Information required about each item displayed on the map
|
||||||
class MapItem {
|
class MapItem {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MapItem(const PipeEndPoint *sourcePipe, const QString &group, MapSettings::MapItemSettings *itemSettings, SWGSDRangel::SWGMapItem *mapItem);
|
MapItem(const QObject *sourcePipe, const QString &group, MapSettings::MapItemSettings *itemSettings, SWGSDRangel::SWGMapItem *mapItem);
|
||||||
void update(SWGSDRangel::SWGMapItem *mapItem);
|
void update(SWGSDRangel::SWGMapItem *mapItem);
|
||||||
QGeoCoordinate getCoordinates();
|
QGeoCoordinate getCoordinates();
|
||||||
|
|
||||||
@ -50,7 +49,7 @@ private:
|
|||||||
friend CZML;
|
friend CZML;
|
||||||
QString m_group;
|
QString m_group;
|
||||||
MapSettings::MapItemSettings *m_itemSettings;
|
MapSettings::MapItemSettings *m_itemSettings;
|
||||||
const PipeEndPoint *m_sourcePipe; // Channel/feature that created the item
|
const QObject *m_sourcePipe; // Channel/feature that created the item
|
||||||
QString m_name;
|
QString m_name;
|
||||||
QString m_label;
|
QString m_label;
|
||||||
float m_latitude;
|
float m_latitude;
|
||||||
@ -127,7 +126,7 @@ public:
|
|||||||
void playAnimations(MapItem *item);
|
void playAnimations(MapItem *item);
|
||||||
|
|
||||||
Q_INVOKABLE void add(MapItem *item);
|
Q_INVOKABLE void add(MapItem *item);
|
||||||
void update(const PipeEndPoint *source, SWGSDRangel::SWGMapItem *swgMapItem, const QString &group="");
|
void update(const QObject *source, SWGSDRangel::SWGMapItem *swgMapItem, const QString &group="");
|
||||||
void update(MapItem *item);
|
void update(MapItem *item);
|
||||||
void remove(MapItem *item);
|
void remove(MapItem *item);
|
||||||
void allUpdated();
|
void allUpdated();
|
||||||
@ -141,7 +140,7 @@ public:
|
|||||||
Q_INVOKABLE void moveToFront(int oldRow);
|
Q_INVOKABLE void moveToFront(int oldRow);
|
||||||
Q_INVOKABLE void moveToBack(int oldRow);
|
Q_INVOKABLE void moveToBack(int oldRow);
|
||||||
|
|
||||||
MapItem *findMapItem(const PipeEndPoint *source, const QString& name);
|
MapItem *findMapItem(const QObject *source, const QString& name);
|
||||||
MapItem *findMapItem(const QString& name);
|
MapItem *findMapItem(const QString& name);
|
||||||
QModelIndex findMapItemIndex(const QString& name);
|
QModelIndex findMapItemIndex(const QString& name);
|
||||||
|
|
||||||
|
@ -51,6 +51,26 @@ struct MapSettings
|
|||||||
bool deserialize(const QByteArray& data);
|
bool deserialize(const QByteArray& data);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct AvailableChannelOrFeature
|
||||||
|
{
|
||||||
|
QString m_kind; //!< "R" for channel, "F" for feature
|
||||||
|
int m_superIndex;
|
||||||
|
int m_index;
|
||||||
|
QString m_type;
|
||||||
|
QObject *m_source;
|
||||||
|
|
||||||
|
AvailableChannelOrFeature() = default;
|
||||||
|
AvailableChannelOrFeature(const AvailableChannelOrFeature&) = default;
|
||||||
|
AvailableChannelOrFeature& operator=(const AvailableChannelOrFeature&) = default;
|
||||||
|
bool operator==(const AvailableChannelOrFeature& a) const {
|
||||||
|
return (m_kind == a.m_kind)
|
||||||
|
&& (m_superIndex == a.m_superIndex)
|
||||||
|
&& (m_index == a.m_index)
|
||||||
|
&& (m_type == a.m_type)
|
||||||
|
&& (m_source == a.m_source);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
bool m_displayNames;
|
bool m_displayNames;
|
||||||
QString m_mapProvider;
|
QString m_mapProvider;
|
||||||
QString m_thunderforestAPIKey;
|
QString m_thunderforestAPIKey;
|
||||||
|
@ -353,46 +353,44 @@ void RadiosondeGUI::sendToMap(const QString &name, const QString &label,
|
|||||||
float heading
|
float heading
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
MessagePipesLegacy& messagePipes = MainCore::instance()->getMessagePipesLegacy();
|
QList<ObjectPipe*> mapPipes;
|
||||||
QList<MessageQueue*> *mapMessageQueues = messagePipes.getMessageQueues(m_radiosonde, "mapitems");
|
MainCore::instance()->getMessagePipes().getMessagePipes(m_radiosonde, "mapitems", mapPipes);
|
||||||
if (mapMessageQueues)
|
|
||||||
|
for (const auto& pipe : mapPipes)
|
||||||
{
|
{
|
||||||
QList<MessageQueue*>::iterator it = mapMessageQueues->begin();
|
MessageQueue *messageQueue = qobject_cast<MessageQueue*>(pipe->m_element);
|
||||||
|
SWGSDRangel::SWGMapItem *swgMapItem = new SWGSDRangel::SWGMapItem();
|
||||||
|
swgMapItem->setName(new QString(name));
|
||||||
|
swgMapItem->setLatitude(latitude);
|
||||||
|
swgMapItem->setLongitude(longitude);
|
||||||
|
swgMapItem->setAltitude(altitude);
|
||||||
|
swgMapItem->setAltitudeReference(0); // ABSOLUTE
|
||||||
|
|
||||||
for (; it != mapMessageQueues->end(); ++it)
|
if (positionDateTime.isValid()) {
|
||||||
{
|
swgMapItem->setPositionDateTime(new QString(positionDateTime.toString(Qt::ISODateWithMs)));
|
||||||
SWGSDRangel::SWGMapItem *swgMapItem = new SWGSDRangel::SWGMapItem();
|
|
||||||
swgMapItem->setName(new QString(name));
|
|
||||||
swgMapItem->setLatitude(latitude);
|
|
||||||
swgMapItem->setLongitude(longitude);
|
|
||||||
swgMapItem->setAltitude(altitude);
|
|
||||||
swgMapItem->setAltitudeReference(0); // ABSOLUTE
|
|
||||||
|
|
||||||
if (positionDateTime.isValid()) {
|
|
||||||
swgMapItem->setPositionDateTime(new QString(positionDateTime.toString(Qt::ISODateWithMs)));
|
|
||||||
}
|
|
||||||
|
|
||||||
swgMapItem->setImageRotation(heading);
|
|
||||||
swgMapItem->setText(new QString(text));
|
|
||||||
|
|
||||||
if (image.isEmpty()) {
|
|
||||||
swgMapItem->setImage(new QString(""));
|
|
||||||
} else {
|
|
||||||
swgMapItem->setImage(new QString(QString("qrc:///radiosonde/map/%1").arg(image)));
|
|
||||||
}
|
|
||||||
swgMapItem->setModel(new QString(model));
|
|
||||||
swgMapItem->setModelAltitudeOffset(0.0f);
|
|
||||||
swgMapItem->setLabel(new QString(label));
|
|
||||||
swgMapItem->setLabelAltitudeOffset(labelOffset);
|
|
||||||
swgMapItem->setFixedPosition(false);
|
|
||||||
swgMapItem->setOrientation(1);
|
|
||||||
swgMapItem->setHeading(heading);
|
|
||||||
swgMapItem->setPitch(0.0);
|
|
||||||
swgMapItem->setRoll(0.0);
|
|
||||||
|
|
||||||
MainCore::MsgMapItem *msg = MainCore::MsgMapItem::create(m_radiosonde, swgMapItem);
|
|
||||||
(*it)->push(msg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
swgMapItem->setImageRotation(heading);
|
||||||
|
swgMapItem->setText(new QString(text));
|
||||||
|
|
||||||
|
if (image.isEmpty()) {
|
||||||
|
swgMapItem->setImage(new QString(""));
|
||||||
|
} else {
|
||||||
|
swgMapItem->setImage(new QString(QString("qrc:///radiosonde/map/%1").arg(image)));
|
||||||
|
}
|
||||||
|
|
||||||
|
swgMapItem->setModel(new QString(model));
|
||||||
|
swgMapItem->setModelAltitudeOffset(0.0f);
|
||||||
|
swgMapItem->setLabel(new QString(label));
|
||||||
|
swgMapItem->setLabelAltitudeOffset(labelOffset);
|
||||||
|
swgMapItem->setFixedPosition(false);
|
||||||
|
swgMapItem->setOrientation(1);
|
||||||
|
swgMapItem->setHeading(heading);
|
||||||
|
swgMapItem->setPitch(0.0);
|
||||||
|
swgMapItem->setRoll(0.0);
|
||||||
|
|
||||||
|
MainCore::MsgMapItem *msg = MainCore::MsgMapItem::create(m_radiosonde, swgMapItem);
|
||||||
|
messageQueue->push(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,25 +234,34 @@ void SatelliteTrackerWorker::applySettings(const SatelliteTrackerSettings& setti
|
|||||||
|
|
||||||
void SatelliteTrackerWorker::removeFromMap(QString id)
|
void SatelliteTrackerWorker::removeFromMap(QString id)
|
||||||
{
|
{
|
||||||
MessagePipesLegacy& messagePipes = MainCore::instance()->getMessagePipesLegacy();
|
QList<ObjectPipe*> mapMessagePipes;
|
||||||
QList<MessageQueue*> *mapMessageQueues = messagePipes.getMessageQueues(m_satelliteTracker, "mapitems");
|
MainCore::instance()->getMessagePipes().getMessagePipes(m_satelliteTracker, "mapitems", mapMessagePipes);
|
||||||
if (mapMessageQueues)
|
|
||||||
sendToMap(mapMessageQueues, id, "", "", "", 0.0f, 0.0, 0.0, 0.0, 0.0, nullptr, nullptr, nullptr, nullptr);
|
if (mapMessagePipes.size() > 0) {
|
||||||
|
sendToMap(mapMessagePipes, id, "", "", "", 0.0f, 0.0, 0.0, 0.0, 0.0, nullptr, nullptr, nullptr, nullptr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SatelliteTrackerWorker::sendToMap(QList<MessageQueue*> *mapMessageQueues,
|
void SatelliteTrackerWorker::sendToMap(
|
||||||
QString name, QString image, QString model, QString text,
|
const QList<ObjectPipe*>& mapMessagePipes,
|
||||||
float labelOffset,
|
QString name,
|
||||||
double lat, double lon, double altitude, double rotation,
|
QString image,
|
||||||
QList<QGeoCoordinate *> *track,
|
QString model,
|
||||||
QList<QDateTime *> *trackDateTime,
|
QString text,
|
||||||
QList<QGeoCoordinate *> *predictedTrack,
|
float labelOffset,
|
||||||
QList<QDateTime *> *predictedTrackDateTime)
|
double lat,
|
||||||
|
double lon,
|
||||||
|
double altitude,
|
||||||
|
double rotation,
|
||||||
|
QList<QGeoCoordinate *> *track,
|
||||||
|
QList<QDateTime *> *trackDateTime,
|
||||||
|
QList<QGeoCoordinate *> *predictedTrack,
|
||||||
|
QList<QDateTime *> *predictedTrackDateTime
|
||||||
|
)
|
||||||
{
|
{
|
||||||
QList<MessageQueue*>::iterator it = mapMessageQueues->begin();
|
for (const auto& pipe : mapMessagePipes)
|
||||||
|
|
||||||
for (; it != mapMessageQueues->end(); ++it)
|
|
||||||
{
|
{
|
||||||
|
MessageQueue *messageQueue = qobject_cast<MessageQueue*>(pipe->m_element);
|
||||||
SWGSDRangel::SWGMapItem *swgMapItem = new SWGSDRangel::SWGMapItem();
|
SWGSDRangel::SWGMapItem *swgMapItem = new SWGSDRangel::SWGMapItem();
|
||||||
swgMapItem->setName(new QString(name));
|
swgMapItem->setName(new QString(name));
|
||||||
swgMapItem->setLatitude(lat);
|
swgMapItem->setLatitude(lat);
|
||||||
@ -298,7 +307,7 @@ void SatelliteTrackerWorker::sendToMap(QList<MessageQueue*> *mapMessageQueues,
|
|||||||
}
|
}
|
||||||
|
|
||||||
MainCore::MsgMapItem *msg = MainCore::MsgMapItem::create(m_satelliteTracker, swgMapItem);
|
MainCore::MsgMapItem *msg = MainCore::MsgMapItem::create(m_satelliteTracker, swgMapItem);
|
||||||
(*it)->push(msg);
|
messageQueue->push(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -423,9 +432,10 @@ void SatelliteTrackerWorker::update()
|
|||||||
// Send to Map
|
// Send to Map
|
||||||
if (m_settings.m_drawOnMap)
|
if (m_settings.m_drawOnMap)
|
||||||
{
|
{
|
||||||
MessagePipesLegacy& messagePipes = MainCore::instance()->getMessagePipesLegacy();
|
QList<ObjectPipe*> mapMessagePipes;
|
||||||
QList<MessageQueue*> *mapMessageQueues = messagePipes.getMessageQueues(m_satelliteTracker, "mapitems");
|
MainCore::instance()->getMessagePipes().getMessagePipes(m_satelliteTracker, "mapitems", mapMessagePipes);
|
||||||
if (mapMessageQueues)
|
|
||||||
|
if (mapMessagePipes.size() > 0)
|
||||||
{
|
{
|
||||||
const QStringList cubeSats({"AISAT-1", "FOX-1B", "FOX-1C", "FOX-1D", "FOX-1E", "FUNCUBE-1", "NO-84"});
|
const QStringList cubeSats({"AISAT-1", "FOX-1B", "FOX-1C", "FOX-1D", "FOX-1E", "FUNCUBE-1", "NO-84"});
|
||||||
QString image;
|
QString image;
|
||||||
@ -484,11 +494,18 @@ void SatelliteTrackerWorker::update()
|
|||||||
.arg(QChar(0xb0));
|
.arg(QChar(0xb0));
|
||||||
}
|
}
|
||||||
|
|
||||||
sendToMap(mapMessageQueues, sat->m_name, image, model, text, labelOffset,
|
sendToMap(
|
||||||
satWorkerState->m_satState.m_latitude, satWorkerState->m_satState.m_longitude,
|
mapMessagePipes,
|
||||||
satWorkerState->m_satState.m_altitude * 1000.0, 0,
|
sat->m_name,
|
||||||
&satWorkerState->m_satState.m_groundTrack, &satWorkerState->m_satState.m_groundTrackDateTime,
|
image,
|
||||||
&satWorkerState->m_satState.m_predictedGroundTrack, &satWorkerState->m_satState.m_predictedGroundTrackDateTime);
|
model,
|
||||||
|
text,
|
||||||
|
labelOffset,
|
||||||
|
satWorkerState->m_satState.m_latitude, satWorkerState->m_satState.m_longitude,
|
||||||
|
satWorkerState->m_satState.m_altitude * 1000.0, 0,
|
||||||
|
&satWorkerState->m_satState.m_groundTrack, &satWorkerState->m_satState.m_groundTrackDateTime,
|
||||||
|
&satWorkerState->m_satState.m_predictedGroundTrack, &satWorkerState->m_satState.m_predictedGroundTrackDateTime
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,6 +38,7 @@ class SatelliteTracker;
|
|||||||
class SatelliteTrackerWorker;
|
class SatelliteTrackerWorker;
|
||||||
class QDateTime;
|
class QDateTime;
|
||||||
class QGeoCoordinate;
|
class QGeoCoordinate;
|
||||||
|
class ObjectPipe;
|
||||||
|
|
||||||
class SatWorkerState
|
class SatWorkerState
|
||||||
{
|
{
|
||||||
@ -122,13 +123,22 @@ private:
|
|||||||
void applySettings(const SatelliteTrackerSettings& settings, bool force = false);
|
void applySettings(const SatelliteTrackerSettings& settings, bool force = false);
|
||||||
MessageQueue *getMessageQueueToGUI() { return m_msgQueueToGUI; }
|
MessageQueue *getMessageQueueToGUI() { return m_msgQueueToGUI; }
|
||||||
void removeFromMap(QString id);
|
void removeFromMap(QString id);
|
||||||
void sendToMap(QList<MessageQueue*> *mapMessageQueues, QString id, QString image, QString model, QString text,
|
void sendToMap(
|
||||||
float labelOffset,
|
const QList<ObjectPipe*>& mapMessagePipes,
|
||||||
double lat, double lon, double altitude, double rotation,
|
QString id,
|
||||||
QList<QGeoCoordinate *> *track = nullptr,
|
QString image,
|
||||||
QList<QDateTime *> *trackDateTime = nullptr,
|
QString model,
|
||||||
QList<QGeoCoordinate *> *predictedTrack = nullptr,
|
QString text,
|
||||||
QList<QDateTime *> *predictedTrackDateTime = nullptr);
|
float labelOffset,
|
||||||
|
double lat,
|
||||||
|
double lon,
|
||||||
|
double altitude,
|
||||||
|
double rotation,
|
||||||
|
QList<QGeoCoordinate *> *track = nullptr,
|
||||||
|
QList<QDateTime *> *trackDateTime = nullptr,
|
||||||
|
QList<QGeoCoordinate *> *predictedTrack = nullptr,
|
||||||
|
QList<QDateTime *> *predictedTrackDateTime = nullptr
|
||||||
|
);
|
||||||
void applyDeviceAOSSettings(const QString& name);
|
void applyDeviceAOSSettings(const QString& name);
|
||||||
void startStopSinks(bool start);
|
void startStopSinks(bool start);
|
||||||
void calculateRotation(SatWorkerState *satWorkerState);
|
void calculateRotation(SatWorkerState *satWorkerState);
|
||||||
|
@ -407,19 +407,27 @@ void StarTrackerWorker::updateRaDec(RADec rd, QDateTime dt, bool lbTarget)
|
|||||||
|
|
||||||
void StarTrackerWorker::removeFromMap(QString id)
|
void StarTrackerWorker::removeFromMap(QString id)
|
||||||
{
|
{
|
||||||
MessagePipesLegacy& messagePipes = MainCore::instance()->getMessagePipesLegacy();
|
QList<ObjectPipe*> mapMessagePipes;
|
||||||
QList<MessageQueue*> *mapMessageQueues = messagePipes.getMessageQueues(m_starTracker, "mapitems");
|
MainCore::instance()->getMessagePipes().getMessagePipes(m_starTracker, "mapitems", mapMessagePipes);
|
||||||
if (mapMessageQueues) {
|
|
||||||
sendToMap(mapMessageQueues, id, "", "", 0.0, 0.0);
|
if (mapMessagePipes.size() > 0) {
|
||||||
|
sendToMap(mapMessagePipes, id, "", "", 0.0, 0.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void StarTrackerWorker::sendToMap(QList<MessageQueue*> *mapMessageQueues, QString name, QString image, QString text, double lat, double lon, double rotation)
|
void StarTrackerWorker::sendToMap(
|
||||||
|
const QList<ObjectPipe*>& mapMessagePipes,
|
||||||
|
QString name,
|
||||||
|
QString image,
|
||||||
|
QString text,
|
||||||
|
double lat,
|
||||||
|
double lon,
|
||||||
|
double rotation
|
||||||
|
)
|
||||||
{
|
{
|
||||||
QList<MessageQueue*>::iterator it = mapMessageQueues->begin();
|
for (const auto& pipe : mapMessagePipes)
|
||||||
|
|
||||||
for (; it != mapMessageQueues->end(); ++it)
|
|
||||||
{
|
{
|
||||||
|
MessageQueue *messageQueue = qobject_cast<MessageQueue*>(pipe->m_element);
|
||||||
SWGSDRangel::SWGMapItem *swgMapItem = new SWGSDRangel::SWGMapItem();
|
SWGSDRangel::SWGMapItem *swgMapItem = new SWGSDRangel::SWGMapItem();
|
||||||
swgMapItem->setName(new QString(name));
|
swgMapItem->setName(new QString(name));
|
||||||
swgMapItem->setLatitude(lat);
|
swgMapItem->setLatitude(lat);
|
||||||
@ -429,7 +437,7 @@ void StarTrackerWorker::sendToMap(QList<MessageQueue*> *mapMessageQueues, QStrin
|
|||||||
swgMapItem->setText(new QString(text));
|
swgMapItem->setText(new QString(text));
|
||||||
|
|
||||||
MainCore::MsgMapItem *msg = MainCore::MsgMapItem::create(m_starTracker, swgMapItem);
|
MainCore::MsgMapItem *msg = MainCore::MsgMapItem::create(m_starTracker, swgMapItem);
|
||||||
(*it)->push(msg);
|
messageQueue->push(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -636,11 +644,10 @@ void StarTrackerWorker::update()
|
|||||||
// Send to Map
|
// Send to Map
|
||||||
if (m_settings.m_drawSunOnMap || m_settings.m_drawMoonOnMap || m_settings.m_drawStarOnMap)
|
if (m_settings.m_drawSunOnMap || m_settings.m_drawMoonOnMap || m_settings.m_drawStarOnMap)
|
||||||
{
|
{
|
||||||
MessagePipesLegacy& messagePipes = MainCore::instance()->getMessagePipesLegacy();
|
QList<ObjectPipe*> mapMessagePipes;
|
||||||
QList<MessageQueue*>* messageQueues;
|
MainCore::instance()->getMessagePipes().getMessagePipes(m_starTracker, "mapitems", mapMessagePipes);
|
||||||
messageQueues = messagePipes.getMessageQueues(m_starTracker, "mapitems");
|
|
||||||
|
|
||||||
if (messageQueues)
|
if (mapMessagePipes.size() > 0)
|
||||||
{
|
{
|
||||||
// Different between GMST(Lst at Greenwich) and RA
|
// Different between GMST(Lst at Greenwich) and RA
|
||||||
double lst = Astronomy::localSiderealTime(dt, 0.0);
|
double lst = Astronomy::localSiderealTime(dt, 0.0);
|
||||||
@ -651,7 +658,7 @@ void StarTrackerWorker::update()
|
|||||||
{
|
{
|
||||||
sunLongitude = Astronomy::lstAndRAToLongitude(lst, sunRD.ra);
|
sunLongitude = Astronomy::lstAndRAToLongitude(lst, sunRD.ra);
|
||||||
sunLatitude = sunRD.dec;
|
sunLatitude = sunRD.dec;
|
||||||
sendToMap(messageQueues, "Sun", "qrc:///startracker/startracker/sun-40.png", "Sun", sunLatitude, sunLongitude);
|
sendToMap(mapMessagePipes, "Sun", "qrc:///startracker/startracker/sun-40.png", "Sun", sunLatitude, sunLongitude);
|
||||||
}
|
}
|
||||||
if (m_settings.m_drawMoonOnMap)
|
if (m_settings.m_drawMoonOnMap)
|
||||||
{
|
{
|
||||||
@ -659,7 +666,7 @@ void StarTrackerWorker::update()
|
|||||||
double moonLatitude = moonRD.dec;
|
double moonLatitude = moonRD.dec;
|
||||||
double moonRotation;
|
double moonRotation;
|
||||||
QString phase = moonPhase(sunLongitude, moonLongitude, m_settings.m_latitude, moonRotation);
|
QString phase = moonPhase(sunLongitude, moonLongitude, m_settings.m_latitude, moonRotation);
|
||||||
sendToMap(messageQueues, "Moon", QString("qrc:///startracker/startracker/moon-%1-32").arg(phase), "Moon",
|
sendToMap(mapMessagePipes, "Moon", QString("qrc:///startracker/startracker/moon-%1-32").arg(phase), "Moon",
|
||||||
moonLatitude, moonLongitude, moonRotation);
|
moonLatitude, moonLongitude, moonRotation);
|
||||||
}
|
}
|
||||||
if ((m_settings.m_drawStarOnMap) && (m_settings.m_target != "Sun") && (m_settings.m_target != "Moon"))
|
if ((m_settings.m_drawStarOnMap) && (m_settings.m_target != "Sun") && (m_settings.m_target != "Moon"))
|
||||||
@ -667,7 +674,7 @@ void StarTrackerWorker::update()
|
|||||||
double starLongitude = Astronomy::lstAndRAToLongitude(lst, rd.ra);
|
double starLongitude = Astronomy::lstAndRAToLongitude(lst, rd.ra);
|
||||||
double starLatitude = rd.dec;
|
double starLatitude = rd.dec;
|
||||||
QString text = m_settings.m_target.startsWith("Custom") ? "Star" : m_settings.m_target;
|
QString text = m_settings.m_target.startsWith("Custom") ? "Star" : m_settings.m_target;
|
||||||
sendToMap(messageQueues, "Star", "qrc:///startracker/startracker/pulsar-32.png", text, starLatitude, starLongitude);
|
sendToMap(mapMessagePipes, "Star", "qrc:///startracker/startracker/pulsar-32.png", text, starLatitude, starLongitude);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,7 @@ class QTcpServer;
|
|||||||
class QTcpSocket;
|
class QTcpSocket;
|
||||||
class StarTracker;
|
class StarTracker;
|
||||||
class QDateTime;
|
class QDateTime;
|
||||||
|
class ObjectPipe;
|
||||||
|
|
||||||
class StarTrackerWorker : public QObject
|
class StarTrackerWorker : public QObject
|
||||||
{
|
{
|
||||||
@ -94,7 +95,15 @@ private:
|
|||||||
void updateRaDec(RADec rd, QDateTime dt, bool lbTarget);
|
void updateRaDec(RADec rd, QDateTime dt, bool lbTarget);
|
||||||
void writeStellariumTarget(double ra, double dec);
|
void writeStellariumTarget(double ra, double dec);
|
||||||
void removeFromMap(QString id);
|
void removeFromMap(QString id);
|
||||||
void sendToMap(QList<MessageQueue*> *mapMessageQueues, QString id, QString image, QString text, double lat, double lon, double rotation=0.0);
|
void sendToMap(
|
||||||
|
const QList<ObjectPipe*>& mapMessagePipes,
|
||||||
|
QString id,
|
||||||
|
QString image,
|
||||||
|
QString text,
|
||||||
|
double lat,
|
||||||
|
double lon,
|
||||||
|
double rotation = 0.0
|
||||||
|
);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void started();
|
void started();
|
||||||
|
@ -553,19 +553,19 @@ public:
|
|||||||
MESSAGE_CLASS_DECLARATION
|
MESSAGE_CLASS_DECLARATION
|
||||||
|
|
||||||
public:
|
public:
|
||||||
const PipeEndPoint *getPipeSource() const { return m_pipeSource; }
|
const QObject *getPipeSource() const { return m_pipeSource; }
|
||||||
SWGSDRangel::SWGMapItem *getSWGMapItem() const { return m_swgMapItem; }
|
SWGSDRangel::SWGMapItem *getSWGMapItem() const { return m_swgMapItem; }
|
||||||
|
|
||||||
static MsgMapItem* create(const PipeEndPoint *pipeSource, SWGSDRangel::SWGMapItem *swgMapItem)
|
static MsgMapItem* create(const QObject *pipeSource, SWGSDRangel::SWGMapItem *swgMapItem)
|
||||||
{
|
{
|
||||||
return new MsgMapItem(pipeSource, swgMapItem);
|
return new MsgMapItem(pipeSource, swgMapItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const PipeEndPoint *m_pipeSource;
|
const QObject *m_pipeSource;
|
||||||
SWGSDRangel::SWGMapItem *m_swgMapItem;
|
SWGSDRangel::SWGMapItem *m_swgMapItem;
|
||||||
|
|
||||||
MsgMapItem(const PipeEndPoint *pipeSource, SWGSDRangel::SWGMapItem *swgMapItem) :
|
MsgMapItem(const QObject *pipeSource, SWGSDRangel::SWGMapItem *swgMapItem) :
|
||||||
Message(),
|
Message(),
|
||||||
m_pipeSource(pipeSource),
|
m_pipeSource(pipeSource),
|
||||||
m_swgMapItem(swgMapItem)
|
m_swgMapItem(swgMapItem)
|
||||||
|
Loading…
Reference in New Issue
Block a user