1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 01:55:48 -05:00

Remove ships from map on close.

This commit is contained in:
Jon Beniston 2023-02-16 14:30:55 +00:00
parent 40f560daec
commit a522653676

View File

@ -239,6 +239,16 @@ AISGUI::AISGUI(PluginAPI* pluginAPI, FeatureUISet *featureUISet, Feature *featur
AISGUI::~AISGUI()
{
// Remove all ships from map
for (int row = ui->vessels->rowCount() - 1; row >= 0; row--)
{
QString mmsi = ui->vessels->item(row, VESSEL_COL_MMSI)->text();
sendToMap(mmsi, "",
"", "",
"", 0.0f, 0.0f,
0.0f, 0.0f, QDateTime(),
0.0f);
}
qDeleteAll(m_vessels);
delete ui;
}
@ -343,8 +353,8 @@ void AISGUI::removeOldVessels()
0.0f);
// Remove from table
ui->vessels->removeRow(row);
// Remove from hash
m_vessels.remove(mmsi);
// Remove from hash and free memory
delete m_vessels.take(mmsi);
}
}
}
@ -458,8 +468,11 @@ void AISGUI::sendToMap(const QString &name, const QString &label,
swgMapItem->setAltitude(0);
swgMapItem->setAltitudeReference(1); // CLAMP_TO_GROUND
if (positionDateTime.isValid()) {
if (positionDateTime.isValid())
{
swgMapItem->setPositionDateTime(new QString(positionDateTime.toString(Qt::ISODateWithMs)));
swgMapItem->setOrientationDateTime(new QString(positionDateTime.toString(Qt::ISODateWithMs)));
swgMapItem->setAvailableUntil(new QString(positionDateTime.addSecs(10*60).toString(Qt::ISODateWithMs)));
}
swgMapItem->setImageRotation(heading);