mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-16 05:11:49 -05:00
Fix positioning of Home antenna. Create cache directory on Linux.
This commit is contained in:
parent
56e9f4284f
commit
9eac758088
@ -2409,7 +2409,13 @@ void ADSBDemodGUI::applyMapSettings()
|
||||
// Use our repo, so we can append API key and redefine transmit maps
|
||||
parameters["osm.mapping.providersrepository.address"] = QString("http://127.0.0.1:%1/").arg(m_osmPort);
|
||||
// Use ADS-B specific cache, as we use different transmit maps
|
||||
parameters["osm.mapping.cache.directory"] = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + "/QtLocation/osm/sdrangel/adsb";
|
||||
QString cachePath = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + "/QtLocation/5.8/tiles/osm/sdrangel_adsb";
|
||||
parameters["osm.mapping.cache.directory"] = cachePath;
|
||||
// On Linux, we need to create the directory
|
||||
QDir dir(cachePath);
|
||||
if (!dir.exists()) {
|
||||
dir.mkpath(cachePath);
|
||||
}
|
||||
|
||||
QString mapType;
|
||||
switch (m_settings.m_mapType)
|
||||
@ -2427,17 +2433,49 @@ void ADSBDemodGUI::applyMapSettings()
|
||||
mapType = "Satellite Map";
|
||||
break;
|
||||
}
|
||||
QMetaObject::invokeMethod(item, "createMap",
|
||||
|
||||
QVariant retVal;
|
||||
if (!QMetaObject::invokeMethod(item, "createMap", Qt::DirectConnection,
|
||||
Q_RETURN_ARG(QVariant, retVal),
|
||||
Q_ARG(QVariant, QVariant::fromValue(parameters)),
|
||||
Q_ARG(QVariant, mapType),
|
||||
Q_ARG(QVariant, QVariant::fromValue(this)));
|
||||
Q_ARG(QVariant, QVariant::fromValue(this))))
|
||||
{
|
||||
qCritical() << "ADSBDemodGUI::applyMapSettings - Failed to invoke createMap";
|
||||
}
|
||||
QObject *newMap = retVal.value<QObject *>();
|
||||
|
||||
// Restore position of map
|
||||
object = item->findChild<QObject*>("map");
|
||||
if ((object != nullptr) && coords.isValid())
|
||||
if (newMap != nullptr)
|
||||
{
|
||||
object->setProperty("zoomLevel", QVariant::fromValue(zoom));
|
||||
object->setProperty("center", QVariant::fromValue(coords));
|
||||
if (coords.isValid())
|
||||
{
|
||||
newMap->setProperty("zoomLevel", QVariant::fromValue(zoom));
|
||||
newMap->setProperty("center", QVariant::fromValue(coords));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "ADSBDemodGUI::applyMapSettings - createMap returned a nullptr";
|
||||
}
|
||||
|
||||
// Move antenna icon to My Position
|
||||
QObject *stationObject = newMap->findChild<QObject*>("station");
|
||||
if(stationObject != NULL)
|
||||
{
|
||||
Real stationLatitude = MainCore::instance()->getSettings().getLatitude();
|
||||
Real stationLongitude = MainCore::instance()->getSettings().getLongitude();
|
||||
Real stationAltitude = MainCore::instance()->getSettings().getAltitude();
|
||||
QGeoCoordinate coords = stationObject->property("coordinate").value<QGeoCoordinate>();
|
||||
coords.setLatitude(stationLatitude);
|
||||
coords.setLongitude(stationLongitude);
|
||||
coords.setAltitude(stationAltitude);
|
||||
stationObject->setProperty("coordinate", QVariant::fromValue(coords));
|
||||
stationObject->setProperty("stationName", QVariant::fromValue(MainCore::instance()->getSettings().getStationName()));
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "ADSBDemodGUI::applyMapSettings - Couldn't find station";
|
||||
}
|
||||
}
|
||||
|
||||
@ -2580,17 +2618,6 @@ ADSBDemodGUI::ADSBDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseb
|
||||
coords.setLongitude(stationLongitude);
|
||||
object->setProperty("center", QVariant::fromValue(coords));
|
||||
}
|
||||
// Move antenna icon to My Position
|
||||
QObject *stationObject = item->findChild<QObject*>("station");
|
||||
if(stationObject != NULL)
|
||||
{
|
||||
QGeoCoordinate coords = stationObject->property("coordinate").value<QGeoCoordinate>();
|
||||
coords.setLatitude(stationLatitude);
|
||||
coords.setLongitude(stationLongitude);
|
||||
coords.setAltitude(stationAltitude);
|
||||
stationObject->setProperty("coordinate", QVariant::fromValue(coords));
|
||||
stationObject->setProperty("stationName", QVariant::fromValue(MainCore::instance()->getSettings().getStationName()));
|
||||
}
|
||||
// Add airports within range of My Position
|
||||
if (m_airportInfo != nullptr) {
|
||||
updateAirports();
|
||||
|
@ -74,7 +74,7 @@ void ADSBDemodSettings::resetToDefaults()
|
||||
}
|
||||
m_logFilename = "adsb_log.csv";
|
||||
m_logEnabled = false;
|
||||
m_airspaces = QStringList({"A", "C", "TMZ"});
|
||||
m_airspaces = QStringList({"A", "D", "TMZ"});
|
||||
m_airspaceRange = 500.0f;
|
||||
m_mapType = AVIATION_LIGHT;
|
||||
m_displayNavAids = true;
|
||||
@ -225,7 +225,7 @@ bool ADSBDemodSettings::deserialize(const QByteArray& data)
|
||||
d.readString(36, &m_logFilename, "adsb_log.csv");
|
||||
d.readBool(37, &m_logEnabled, false);
|
||||
|
||||
d.readString(38, &string, "A C TMZ");
|
||||
d.readString(38, &string, "A D TMZ");
|
||||
m_airspaces = string.split(" ");
|
||||
d.readFloat(39, &m_airspaceRange, 500.0f);
|
||||
d.readS32(40, (int *)&m_mapType, (int)AVIATION_LIGHT);
|
||||
|
@ -27,17 +27,14 @@ Item {
|
||||
var plugin = Qt.createQmlObject (pluginString, qmlMap)
|
||||
|
||||
if (mapPtr) {
|
||||
// Objects aren't destroyed immediately, so rename the old
|
||||
// map, so any C++ code that calls findChild("map") doesn't find
|
||||
// the old map
|
||||
mapPtr.objectName = "oldMap";
|
||||
// Objects aren't destroyed immediately, so don't call findChild("map")
|
||||
mapPtr.destroy()
|
||||
mapPtr = null
|
||||
}
|
||||
mapPtr = actualMapComponent.createObject(page)
|
||||
mapPtr.plugin = plugin;
|
||||
mapPtr.plugin = plugin
|
||||
mapPtr.forceActiveFocus()
|
||||
mapPtr.objectName = "map";
|
||||
return mapPtr
|
||||
}
|
||||
|
||||
Item {
|
||||
@ -50,6 +47,7 @@ Item {
|
||||
|
||||
Map {
|
||||
id: map
|
||||
objectName: "map"
|
||||
anchors.fill: parent
|
||||
center: QtPositioning.coordinate(51.5, 0.125) // London
|
||||
zoomLevel: 10
|
||||
@ -68,7 +66,6 @@ Item {
|
||||
id: station
|
||||
objectName: "station"
|
||||
stationName: "Home"
|
||||
coordinate: QtPositioning.coordinate(51.5, 0.125)
|
||||
}
|
||||
|
||||
MapItemView {
|
||||
|
Loading…
Reference in New Issue
Block a user