1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-01 13:47:01 -04:00

Map: Add DSC and VLF transmitters. Fix removal of polylines from 3D map. Add find support for polylines and polygoins

This commit is contained in:
Jon Beniston
2023-05-15 16:47:29 +01:00
parent 7fe09b9a20
commit a111c1f1a0
8 changed files with 161 additions and 61 deletions
+33 -34
View File
@@ -87,12 +87,11 @@ void MapModel::update(const QObject *sourcePipe, SWGSDRangel::SWGMapItem *swgMap
QString image = *swgMapItem->getImage();
if (image.isEmpty())
{
// Delete the item
// Delete the item from 2D map
remove(item);
// Need to call update, for it to be removed in 3D map
// Item is set to not be available from this point in time
// It will still be available if time is set in the past
// Delete from 3D map
item->update(swgMapItem);
update3D(item);
}
else
{
@@ -178,6 +177,36 @@ MapItem *MapModel::findMapItem(const QObject *source, const QString& name)
return nullptr;
}
// FIXME: This should potentially return a list, as we have have multiple items with the same name
// from different sources
MapItem *MapModel::findMapItem(const QString& name)
{
QListIterator<MapItem *> i(m_items);
while (i.hasNext())
{
MapItem *item = i.next();
if (!item->m_name.compare(name, Qt::CaseInsensitive)) {
return item;
}
}
return nullptr;
}
QModelIndex MapModel::findMapItemIndex(const QString& name)
{
int idx = 0;
QListIterator<MapItem *> i(m_items);
while (i.hasNext())
{
MapItem *item = i.next();
if (item->m_name == name) {
return index(idx);
}
idx++;
}
return index(-1);
}
QHash<int, QByteArray> MapModel::roleNames() const
{
QHash<int, QByteArray> roles;
@@ -589,36 +618,6 @@ Q_INVOKABLE void ObjectMapModel::moveToBack(int oldRow)
}
}
// FIXME: This should potentially return a list, as we have have multiple items with the same name
// from different sources
ObjectMapItem *ObjectMapModel::findMapItem(const QString& name)
{
QListIterator<MapItem *> i(m_items);
while (i.hasNext())
{
MapItem *item = i.next();
if (!item->m_name.compare(name, Qt::CaseInsensitive)) {
return (ObjectMapItem *)item;
}
}
return nullptr;
}
QModelIndex ObjectMapModel::findMapItemIndex(const QString& name)
{
int idx = 0;
QListIterator<MapItem *> i(m_items);
while (i.hasNext())
{
MapItem *item = i.next();
if (item->m_name == name) {
return index(idx);
}
idx++;
}
return index(-1);
}
QVariant ObjectMapModel::data(const QModelIndex &index, int role) const
{
int row = index.row();