1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-03 06:24:48 -04:00

Map Updates

Fix 3D map for Qt < 5.15.
Add 3D map label scale setting.
Add 3D map time to Web report.
Reduce height of display settings dialog to fit on smaller screens.
This commit is contained in:
Jon Beniston
2022-02-09 16:41:40 +00:00
parent 73848c94e4
commit 29b2941951
18 changed files with 646 additions and 437 deletions
+50 -1
View File
@@ -43,7 +43,9 @@ const char* const Map::m_featureIdURI = "sdrangel.feature.map";
const char* const Map::m_featureId = "Map";
Map::Map(WebAPIAdapterInterface *webAPIAdapterInterface) :
Feature(m_featureIdURI, webAPIAdapterInterface)
Feature(m_featureIdURI, webAPIAdapterInterface),
m_multiplier(0.0),
m_dateTimeMutex(QMutex::Recursive)
{
qDebug("Map::Map: webAPIAdapterInterface: %p", webAPIAdapterInterface);
setObjectName(m_featureId);
@@ -206,6 +208,17 @@ int Map::webapiSettingsPutPatch(
return 200;
}
int Map::webapiReportGet(
SWGSDRangel::SWGFeatureReport& response,
QString& errorMessage)
{
(void) errorMessage;
response.setMapReport(new SWGSDRangel::SWGMapReport());
response.getMapReport()->init();
webapiFormatFeatureReport(response);
return 200;
}
int Map::webapiActionsPost(
const QStringList& featureActionsKeys,
SWGSDRangel::SWGFeatureActions& query,
@@ -356,6 +369,16 @@ void Map::webapiReverseSendSettings(QList<QString>& featureSettingsKeys, const M
delete swgFeatureSettings;
}
void Map::webapiFormatFeatureReport(SWGSDRangel::SWGFeatureReport& response)
{
QString mapDateTime = getMapDateTime().toString(Qt::ISODateWithMs);
if (response.getMapReport()->getDateTime()) {
*response.getMapReport()->getDateTime() = mapDateTime;
} else {
response.getMapReport()->setDateTime(new QString(mapDateTime));
}
}
void Map::networkManagerFinished(QNetworkReply *reply)
{
QNetworkReply::NetworkError replyError = reply->error();
@@ -376,3 +399,29 @@ void Map::networkManagerFinished(QNetworkReply *reply)
reply->deleteLater();
}
void Map::setMapDateTime(QDateTime mapDateTime, QDateTime systemDateTime, double multiplier)
{
QMutexLocker mutexLocker(&m_dateTimeMutex);
m_mapDateTime = mapDateTime;
m_systemDateTime = systemDateTime;
m_multiplier = multiplier;
}
QDateTime Map::getMapDateTime()
{
QMutexLocker mutexLocker(&m_dateTimeMutex);
if (m_multiplier == 0.0)
{
return m_mapDateTime;
}
else
{
// It's not possible to synchronously get the time from Cesium
// so we calculate it based on the system clock difference from
// when changes were made to the clock GUI elements
// Should be accurate enough for satellite tracker
qint64 diffMsecs = m_systemDateTime.msecsTo(QDateTime::currentDateTime());
return m_mapDateTime.addMSecs(diffMsecs * m_multiplier);
}
}