mirror of
				https://github.com/f4exb/sdrangel.git
				synced 2025-10-31 04:50:29 -04:00 
			
		
		
		
	Map: Add support for latest Cesium graphics settings: MSAA, Terrain Lighting, Water effects, Fog and HDR, display FPS.
Add setting to select default imagery. Use Sentinel 2 as default to avoid hitting Bing Maps quota. Add directional light strength setting. Add ArcGIS API Key setting.
This commit is contained in:
		
							parent
							
								
									24b1807a07
								
							
						
					
					
						commit
						d26aa35969
					
				| @ -97,7 +97,16 @@ void CesiumInterface::track(const QString& name) | ||||
|     send(obj); | ||||
| } | ||||
| 
 | ||||
| void CesiumInterface::setTerrain(const QString &terrain, const QString &maptilerAPIKey) | ||||
| void CesiumInterface::setDefaultImagery(const QString &imagery) | ||||
| { | ||||
|     QJsonObject obj { | ||||
|         {"command", "setDefaultImagery"}, | ||||
|         {"imagery", imagery} | ||||
|     }; | ||||
|     send(obj); | ||||
| } | ||||
| 
 | ||||
| void CesiumInterface::setTerrain(const QString &terrain, const QString &maptilerAPIKey, bool lighting, bool water) | ||||
| { | ||||
|     QString provider; | ||||
|     QString url; | ||||
| @ -118,7 +127,9 @@ void CesiumInterface::setTerrain(const QString &terrain, const QString &maptiler | ||||
|     QJsonObject obj { | ||||
|         {"command", "setTerrain"}, | ||||
|         {"provider", provider}, | ||||
|         {"url", url} | ||||
|         {"url", url}, | ||||
|         {"lighting", lighting}, | ||||
|         {"water", water} | ||||
|     }; | ||||
|     send(obj); | ||||
| } | ||||
| @ -132,11 +143,12 @@ void CesiumInterface::setBuildings(const QString &buildings) | ||||
|     send(obj); | ||||
| } | ||||
| 
 | ||||
| void CesiumInterface::setSunLight(bool useSunLight) | ||||
| void CesiumInterface::setLighting(bool useSunLight, float cameraLightIntensity) | ||||
| { | ||||
|     QJsonObject obj { | ||||
|         {"command", "setSunLight"}, | ||||
|         {"useSunLight", useSunLight} | ||||
|         {"command", "setLighting"}, | ||||
|         {"useSunLight", useSunLight}, | ||||
|         {"cameraLightIntensity", cameraLightIntensity} | ||||
|     }; | ||||
|     send(obj); | ||||
| } | ||||
| @ -150,11 +162,48 @@ void CesiumInterface::setCameraReferenceFrame(bool eci) | ||||
|     send(obj); | ||||
| } | ||||
| 
 | ||||
| void CesiumInterface::setAntiAliasing(const QString &antiAliasing) | ||||
| void CesiumInterface::setAntiAliasing(bool fxaa, int msaa) | ||||
| { | ||||
|     QJsonObject obj { | ||||
|         {"command", "setAntiAliasing"}, | ||||
|         {"antiAliasing", antiAliasing} | ||||
|         {"fxaa", fxaa}, | ||||
|         {"msaa", msaa} | ||||
|     }; | ||||
|     send(obj); | ||||
| } | ||||
| 
 | ||||
| void CesiumInterface::setHDR(bool enabled) | ||||
| { | ||||
|     QJsonObject obj { | ||||
|         {"command", "setHDR"}, | ||||
|         {"hdr", enabled} | ||||
|     }; | ||||
|     send(obj); | ||||
| } | ||||
| 
 | ||||
| void CesiumInterface::setFog(bool enabled) | ||||
| { | ||||
|     QJsonObject obj { | ||||
|         {"command", "setFog"}, | ||||
|         {"fog", enabled} | ||||
|     }; | ||||
|     send(obj); | ||||
| } | ||||
| 
 | ||||
| void CesiumInterface::showFPS(bool show) | ||||
| { | ||||
|     QJsonObject obj { | ||||
|         {"command", "showFPS"}, | ||||
|         {"show", show} | ||||
|     }; | ||||
|     send(obj); | ||||
| } | ||||
| 
 | ||||
| void CesiumInterface::showPFD(bool show) | ||||
| { | ||||
|     QJsonObject obj { | ||||
|         {"command", "showPFD"}, | ||||
|         {"show", show} | ||||
|     }; | ||||
|     send(obj); | ||||
| } | ||||
|  | ||||
| @ -60,11 +60,15 @@ public: | ||||
|     void setDateTime(QDateTime dateTime); | ||||
|     void getDateTime(); | ||||
|     void track(const QString &name); | ||||
|     void setTerrain(const QString &terrain, const QString &maptilerAPIKey); | ||||
|     void setDefaultImagery(const QString &imagery); | ||||
|     void setTerrain(const QString &terrain, const QString &maptilerAPIKey, bool lighting, bool water); | ||||
|     void setBuildings(const QString &buildings); | ||||
|     void setCameraReferenceFrame(bool eci); | ||||
|     void setSunLight(bool useSunLight); | ||||
|     void setAntiAliasing(const QString &antiAliasing); | ||||
|     void setLighting(bool useSunLight, float cameraLightIntensity); | ||||
|     void setAntiAliasing(bool fxaa, int msaa); | ||||
|     void setHDR(bool enabled); | ||||
|     void setFog(bool enabled); | ||||
|     void showFPS(bool show); | ||||
|     void showMUF(bool show); | ||||
|     void showfoF2(bool show); | ||||
|     void showMagDec(bool show); | ||||
|  | ||||
| @ -1925,6 +1925,7 @@ void MapGUI::applyMap3DSettings(bool reloadMap) | ||||
|         } | ||||
|         m_webServer->addSubstitution("/map/map/map3d.html", "$WS_PORT$", QString::number(m_cesium->serverPort())); | ||||
|         m_webServer->addSubstitution("/map/map/map3d.html", "$CESIUM_ION_API_KEY$", cesiumIonAPIKey()); | ||||
|         m_webServer->addSubstitution("/map/map/map3d.html", "$ARCGIS_API_KEY$", m_settings.m_arcGISAPIKey); | ||||
|         //ui->web->page()->profile()->clearHttpCache();
 | ||||
|         ui->web->load(QUrl(QString("http://127.0.0.1:%1/map/map/map3d.html").arg(m_webPort))); | ||||
|         //ui->web->load(QUrl(QString("http://webglreport.com/")));
 | ||||
| @ -1941,12 +1942,16 @@ void MapGUI::applyMap3DSettings(bool reloadMap) | ||||
|     ui->web->setVisible(m_settings.m_map3DEnabled); | ||||
|     if (m_cesium && m_cesium->isConnected()) | ||||
|     { | ||||
|         m_cesium->setTerrain(m_settings.m_terrain, maptilerAPIKey()); | ||||
|         m_cesium->setDefaultImagery(m_settings.m_defaultImagery); | ||||
|         m_cesium->setTerrain(m_settings.m_terrain, maptilerAPIKey(), m_settings.m_terrainLighting, m_settings.m_water); | ||||
|         m_cesium->setBuildings(m_settings.m_buildings); | ||||
|         m_cesium->setSunLight(m_settings.m_sunLightEnabled); | ||||
|         m_cesium->setLighting(m_settings.m_sunLightEnabled, m_settings.m_lightIntensity); | ||||
|         m_cesium->setCameraReferenceFrame(m_settings.m_eciCamera); | ||||
|         m_cesium->setAntiAliasing(m_settings.m_antiAliasing); | ||||
|         m_cesium->setAntiAliasing(m_settings.m_fxaa, m_settings.m_msaa); | ||||
|         m_cesium->getDateTime(); | ||||
|         m_cesium->setHDR(m_settings.m_hdr); | ||||
|         m_cesium->setFog(m_settings.m_fog); | ||||
|         m_cesium->showFPS(m_settings.m_fps); | ||||
|         m_cesium->showMUF(m_settings.m_displayMUF); | ||||
|         m_cesium->showfoF2(m_settings.m_displayfoF2); | ||||
|         m_cesium->showMagDec(m_settings.m_displayMagDec); | ||||
| @ -2030,12 +2035,16 @@ void MapGUI::init3DMap() | ||||
|     float stationAltitude = MainCore::instance()->getSettings().getLongitude(); | ||||
| 
 | ||||
|     m_cesium->setPosition(QGeoCoordinate(stationLatitude, stationLongitude, stationAltitude)); | ||||
|     m_cesium->setTerrain(m_settings.m_terrain, maptilerAPIKey()); | ||||
|     m_cesium->setDefaultImagery(m_settings.m_defaultImagery); | ||||
|     m_cesium->setTerrain(m_settings.m_terrain, maptilerAPIKey(), m_settings.m_terrainLighting, m_settings.m_water); | ||||
|     m_cesium->setBuildings(m_settings.m_buildings); | ||||
|     m_cesium->setSunLight(m_settings.m_sunLightEnabled); | ||||
|     m_cesium->setLighting(m_settings.m_sunLightEnabled, m_settings.m_lightIntensity); | ||||
|     m_cesium->setCameraReferenceFrame(m_settings.m_eciCamera); | ||||
|     m_cesium->setAntiAliasing(m_settings.m_antiAliasing); | ||||
|     m_cesium->setAntiAliasing(m_settings.m_fxaa, m_settings.m_msaa); | ||||
|     m_cesium->getDateTime(); | ||||
|     m_cesium->setHDR(m_settings.m_hdr); | ||||
|     m_cesium->setFog(m_settings.m_fog); | ||||
|     m_cesium->showFPS(m_settings.m_fps); | ||||
| 
 | ||||
|     m_objectMapModel.allUpdated(); | ||||
|     m_imageMapModel.allUpdated(); | ||||
|  | ||||
| @ -123,6 +123,26 @@ | ||||
|         </property> | ||||
|        </widget> | ||||
|       </item> | ||||
|       <item> | ||||
|        <widget class="ButtonSwitch" name="displayMaidenheadGrid"> | ||||
|         <property name="toolTip"> | ||||
|          <string>Display Maidenhead grid (3D map only)</string> | ||||
|         </property> | ||||
|         <property name="text"> | ||||
|          <string/> | ||||
|         </property> | ||||
|         <property name="icon"> | ||||
|          <iconset resource="mapicons.qrc"> | ||||
|           <normaloff>:/map/icons/grid.png</normaloff>:/map/icons/grid.png</iconset> | ||||
|         </property> | ||||
|         <property name="checkable"> | ||||
|          <bool>true</bool> | ||||
|         </property> | ||||
|         <property name="checked"> | ||||
|          <bool>true</bool> | ||||
|         </property> | ||||
|        </widget> | ||||
|       </item> | ||||
|       <item> | ||||
|        <widget class="QToolButton" name="beacons"> | ||||
|         <property name="toolTip"> | ||||
| @ -299,6 +319,46 @@ | ||||
|         </property> | ||||
|        </widget> | ||||
|       </item> | ||||
|       <item> | ||||
|        <widget class="ButtonSwitch" name="displayMagDec"> | ||||
|         <property name="toolTip"> | ||||
|          <string>Display magnetic declination contours (3D map only)</string> | ||||
|         </property> | ||||
|         <property name="text"> | ||||
|          <string/> | ||||
|         </property> | ||||
|         <property name="icon"> | ||||
|          <iconset resource="mapicons.qrc"> | ||||
|           <normaloff>:/map/icons/compass.png</normaloff>:/map/icons/compass.png</iconset> | ||||
|         </property> | ||||
|         <property name="checkable"> | ||||
|          <bool>true</bool> | ||||
|         </property> | ||||
|         <property name="checked"> | ||||
|          <bool>true</bool> | ||||
|         </property> | ||||
|        </widget> | ||||
|       </item> | ||||
|       <item> | ||||
|        <widget class="ButtonSwitch" name="displayAurora"> | ||||
|         <property name="toolTip"> | ||||
|          <string>Display aurora probabilty (3D only)</string> | ||||
|         </property> | ||||
|         <property name="text"> | ||||
|          <string/> | ||||
|         </property> | ||||
|         <property name="icon"> | ||||
|          <iconset resource="mapicons.qrc"> | ||||
|           <normaloff>:/map/icons/aurora.png</normaloff>:/map/icons/aurora.png</iconset> | ||||
|         </property> | ||||
|         <property name="checkable"> | ||||
|          <bool>true</bool> | ||||
|         </property> | ||||
|         <property name="checked"> | ||||
|          <bool>true</bool> | ||||
|         </property> | ||||
|        </widget> | ||||
|       </item> | ||||
|       <item> | ||||
|        <widget class="ButtonSwitch" name="displayNASAGlobalImagery"> | ||||
|         <property name="toolTip"> | ||||
|  | ||||
| @ -14,6 +14,10 @@ | ||||
|         <file>icons/railway.png</file> | ||||
|         <file>icons/waypoints.png</file> | ||||
|         <file>icons/earthsat.png</file> | ||||
|         <file>icons/aurora.png</file> | ||||
|         <file>icons/compass.png</file> | ||||
|         <file>icons/grid.png</file> | ||||
|         <file>icons/thirdperson.png</file> | ||||
|         <file>icons/firstperson.png</file> | ||||
|     </qresource> | ||||
| </RCC> | ||||
|  | ||||
| @ -204,9 +204,16 @@ void MapSettings::resetToDefaults() | ||||
|     m_terrain = "Cesium World Terrain"; | ||||
|     m_buildings = "None"; | ||||
|     m_sunLightEnabled = true; | ||||
|     m_lightIntensity = 3.0f; | ||||
|     m_eciCamera = false; | ||||
|     m_modelDir = HttpDownloadManager::downloadDir() + "/3d"; | ||||
|     m_antiAliasing = "None"; | ||||
|     m_fxaa = true; | ||||
|     m_msaa = 1; | ||||
|     m_terrainLighting = true; | ||||
|     m_water = false; | ||||
|     m_hdr = true; | ||||
|     m_fog = true; | ||||
|     m_fps = false; | ||||
|     m_displayMUF = false; | ||||
|     m_displayfoF2 = false; | ||||
|     m_displayRain = false; | ||||
| @ -275,9 +282,23 @@ QByteArray MapSettings::serialize() const | ||||
|     s.writeBool(41, m_displayNASAGlobalImagery); | ||||
|     s.writeString(42, m_nasaGlobalImageryIdentifier); | ||||
|     s.writeS32(43, m_nasaGlobalImageryOpacity); | ||||
|     s.writeBool(44, m_displayAurora); | ||||
|     s.writeBool(45, m_displayMagDec); | ||||
| 
 | ||||
|     s.writeString(46, m_checkWXAPIKey); | ||||
| 
 | ||||
|     s.writeFloat(47, m_lightIntensity); | ||||
| 
 | ||||
|     s.writeBool(48, m_displayMaidenheadGrid); | ||||
|     s.writeString(49, m_defaultImagery); | ||||
|     s.writeString(50, m_arcGISAPIKey); | ||||
|     s.writeBool(53, m_terrainLighting); | ||||
|     s.writeBool(54, m_water); | ||||
|     s.writeBool(55, m_hdr); | ||||
|     s.writeBool(56, m_fog); | ||||
|     s.writeBool(57, m_fps); | ||||
|     s.writeBool(58, m_fxaa); | ||||
|     s.writeS32(59, m_msaa); | ||||
|     return s.final(); | ||||
| } | ||||
| 
 | ||||
| @ -361,10 +382,22 @@ bool MapSettings::deserialize(const QByteArray& data) | ||||
|         d.readBool(41, &m_displayNASAGlobalImagery, false); | ||||
|         d.readString(42, &m_nasaGlobalImageryIdentifier, ""); | ||||
|         d.readS32(43, &m_nasaGlobalImageryOpacity, 50); | ||||
|         d.readBool(44, &m_displayAurora, false); | ||||
|         d.readBool(45, &m_displayMagDec, false); | ||||
| 
 | ||||
|         d.readString(46, &m_checkWXAPIKey, ""); | ||||
| 
 | ||||
|         d.readFloat(47, &m_lightIntensity, 3.0f); | ||||
|         d.readBool(48, &m_displayMaidenheadGrid, false); | ||||
|         d.readString(49, &m_defaultImagery, "Sentinel-2"); | ||||
|         d.readString(50, &m_arcGISAPIKey, ""); | ||||
|         d.readBool(53, &m_terrainLighting, true); | ||||
|         d.readBool(54, &m_water, false); | ||||
|         d.readBool(55, &m_hdr, true); | ||||
|         d.readBool(56, &m_fog, true); | ||||
|         d.readBool(57, &m_fps, false); | ||||
|         d.readBool(58, &m_fxaa, false); | ||||
|         d.readS32(59, &m_msaa, 1); | ||||
|         return true; | ||||
|     } | ||||
|     else | ||||
| @ -598,14 +631,35 @@ void MapSettings::applySettings(const QStringList& settingsKeys, const MapSettin | ||||
|     if (settingsKeys.contains("sunLightEnabled")) { | ||||
|         m_sunLightEnabled = settings.m_sunLightEnabled; | ||||
|     } | ||||
|     if (settingsKeys.contains("lightIntensity")) { | ||||
|         m_lightIntensity = settings.m_lightIntensity; | ||||
|     } | ||||
|     if (settingsKeys.contains("eciCamera")) { | ||||
|         m_eciCamera = settings.m_eciCamera; | ||||
|     } | ||||
|     if (settingsKeys.contains("modelDir")) { | ||||
|         m_modelDir = settings.m_modelDir; | ||||
|     } | ||||
|     if (settingsKeys.contains("antiAliasing")) { | ||||
|         m_antiAliasing = settings.m_antiAliasing; | ||||
|     if (settingsKeys.contains("fxaa")) { | ||||
|         m_fxaa = settings.m_fxaa; | ||||
|     } | ||||
|     if (settingsKeys.contains("msaa")) { | ||||
|         m_msaa = settings.m_msaa; | ||||
|     } | ||||
|     if (settingsKeys.contains("terrainLighting")) { | ||||
|         m_terrainLighting = settings.m_terrainLighting; | ||||
|     } | ||||
|     if (settingsKeys.contains("water")) { | ||||
|         m_water = settings.m_water; | ||||
|     } | ||||
|     if (settingsKeys.contains("hdr")) { | ||||
|         m_hdr = settings.m_hdr; | ||||
|     } | ||||
|     if (settingsKeys.contains("fog")) { | ||||
|         m_fog = settings.m_fog; | ||||
|     } | ||||
|     if (settingsKeys.contains("fps")) { | ||||
|         m_fps = settings.m_fps; | ||||
|     } | ||||
|     if (settingsKeys.contains("displayMUF")) { | ||||
|         m_displayMUF = settings.m_displayMUF; | ||||
| @ -634,9 +688,21 @@ void MapSettings::applySettings(const QStringList& settingsKeys, const MapSettin | ||||
|     if (settingsKeys.contains("nasaGlobalImageryOpacity")) { | ||||
|         m_nasaGlobalImageryOpacity = settings.m_nasaGlobalImageryOpacity; | ||||
|     } | ||||
|     if (settingsKeys.contains("displayAurora")) { | ||||
|         m_displayAurora = settings.m_displayAurora; | ||||
|     } | ||||
|     if (settingsKeys.contains("displayMagDec")) { | ||||
|         m_displayMagDec = settings.m_displayMagDec; | ||||
|     } | ||||
|     if (settingsKeys.contains("displayMaidenheadGrid")) { | ||||
|         m_displayMaidenheadGrid = settings.m_displayMaidenheadGrid; | ||||
|     } | ||||
|     if (settingsKeys.contains("defaultImagery")) { | ||||
|         m_defaultImagery = settings.m_defaultImagery; | ||||
|     } | ||||
|     if (settingsKeys.contains("arcGISAPIKey")) { | ||||
|         m_arcGISAPIKey = settings.m_arcGISAPIKey; | ||||
|     } | ||||
|     if (settingsKeys.contains("workspaceIndex")) { | ||||
|         m_workspaceIndex = settings.m_workspaceIndex; | ||||
|     } | ||||
| @ -709,14 +775,35 @@ QString MapSettings::getDebugString(const QStringList& settingsKeys, bool force) | ||||
|     if (settingsKeys.contains("sunLightEnabled") || force) { | ||||
|         ostr << " m_sunLightEnabled: " << m_sunLightEnabled; | ||||
|     } | ||||
|     if (settingsKeys.contains("lightIntensity") || force) { | ||||
|         ostr << " m_lightIntensity: " << m_lightIntensity; | ||||
|     } | ||||
|     if (settingsKeys.contains("eciCamera") || force) { | ||||
|         ostr << " m_eciCamera: " << m_eciCamera; | ||||
|     } | ||||
|     if (settingsKeys.contains("modelDir") || force) { | ||||
|         ostr << " m_modelDir: " << m_modelDir.toStdString(); | ||||
|     } | ||||
|     if (settingsKeys.contains("antiAliasing") || force) { | ||||
|         ostr << " m_antiAliasing: " << m_antiAliasing.toStdString(); | ||||
|     if (settingsKeys.contains("fxaa") || force) { | ||||
|         ostr << " m_fxaa: " << m_fxaa; | ||||
|     } | ||||
|     if (settingsKeys.contains("msaa") || force) { | ||||
|         ostr << " m_msaa: " << m_msaa; | ||||
|     } | ||||
|     if (settingsKeys.contains("terrainLighting") || force) { | ||||
|         ostr << " m_terrainLighting: " << m_terrainLighting; | ||||
|     } | ||||
|     if (settingsKeys.contains("water") || force) { | ||||
|         ostr << " m_water: " << m_water; | ||||
|     } | ||||
|     if (settingsKeys.contains("hdr") || force) { | ||||
|         ostr << " m_hdr: " << m_hdr; | ||||
|     } | ||||
|     if (settingsKeys.contains("fog") || force) { | ||||
|         ostr << " m_fog: " << m_fog; | ||||
|     } | ||||
|     if (settingsKeys.contains("fps") || force) { | ||||
|         ostr << " m_fps: " << m_fps; | ||||
|     } | ||||
|     if (settingsKeys.contains("displayMUF") || force) { | ||||
|         ostr << " m_displayMUF: " << m_displayMUF; | ||||
| @ -745,9 +832,21 @@ QString MapSettings::getDebugString(const QStringList& settingsKeys, bool force) | ||||
|     if (settingsKeys.contains("nasaGlobalImageryOpacity") || force) { | ||||
|         ostr << " m_nasaGlobalImageryOpacity: " << m_nasaGlobalImageryOpacity; | ||||
|     } | ||||
|     if (settingsKeys.contains("displayAurora") || force) { | ||||
|         ostr << " m_displayAurora: " << m_displayAurora; | ||||
|     } | ||||
|     if (settingsKeys.contains("displayMagDec") || force) { | ||||
|         ostr << " m_displayMagDec: " << m_displayMagDec; | ||||
|     } | ||||
|     if (settingsKeys.contains("displayMaidenheadGrid") || force) { | ||||
|         ostr << " m_displayMaidenheadGrid: " << m_displayMaidenheadGrid; | ||||
|     } | ||||
|     if (settingsKeys.contains("defaultImagery") || force) { | ||||
|         ostr << " m_defaultImagery: " << m_defaultImagery.toStdString(); | ||||
|     } | ||||
|     if (settingsKeys.contains("arcGISAPIKey") || force) { | ||||
|         ostr << " m_arcGISAPIKey: " << m_arcGISAPIKey.toStdString(); | ||||
|     } | ||||
|     if (settingsKeys.contains("workspaceIndex") || force) { | ||||
|         ostr << " m_workspaceIndex: " << m_workspaceIndex; | ||||
|     } | ||||
|  | ||||
| @ -97,9 +97,16 @@ struct MapSettings | ||||
|     QString m_modelURL;         // Base URL for 3D models (Not user settable, as depends on web server port)
 | ||||
|     QString m_modelDir;         // Directory to store 3D models (not customizable for now, as ADS-B plugin needs to know)
 | ||||
|     bool m_sunLightEnabled;     // Light globe from direction of Sun
 | ||||
|     float m_lightIntensity;     // Intensity of camera light
 | ||||
|     bool m_eciCamera;           // Use ECI instead of ECEF for camera
 | ||||
|     QString m_cesiumIonAPIKey; | ||||
|     QString m_antiAliasing; | ||||
|     bool m_fxaa; | ||||
|     int m_msaa; | ||||
|     bool m_terrainLighting; | ||||
|     bool m_water; | ||||
|     bool m_hdr; | ||||
|     bool m_fog; | ||||
|     bool m_fps; | ||||
| 
 | ||||
|     bool m_displayMUF;          // Plot MUF contours
 | ||||
|     bool m_displayfoF2;         // Plot foF2 contours
 | ||||
| @ -110,9 +117,13 @@ struct MapSettings | ||||
|     bool m_displayNASAGlobalImagery; | ||||
|     QString m_nasaGlobalImageryIdentifier; | ||||
|     int m_nasaGlobalImageryOpacity; | ||||
|     bool m_displayAurora; | ||||
|     bool m_displayMagDec; | ||||
|     bool m_displayMaidenheadGrid; | ||||
|     QString m_defaultImagery; | ||||
| 
 | ||||
|     QString m_checkWXAPIKey;    //!< checkwxapi.com API key
 | ||||
|     QString m_arcGISAPIKey; | ||||
| 
 | ||||
|     // Per source settings
 | ||||
|     QHash<QString, MapItemSettings *> m_itemSettings; | ||||
|  | ||||
| @ -83,15 +83,25 @@ MapSettingsDialog::MapSettingsDialog(MapSettings *settings, QWidget* parent) : | ||||
|     ui->mapBoxAPIKey->setText(settings->m_mapBoxAPIKey); | ||||
|     ui->cesiumIonAPIKey->setText(settings->m_cesiumIonAPIKey); | ||||
|     ui->checkWXAPIKey->setText(settings->m_checkWXAPIKey); | ||||
|     ui->arcGISAPIKey->setText(settings->m_arcGISAPIKey); | ||||
|     ui->osmURL->setText(settings->m_osmURL); | ||||
|     ui->mapBoxStyles->setText(settings->m_mapBoxStyles); | ||||
|     ui->map2DEnabled->setChecked(m_settings->m_map2DEnabled); | ||||
|     ui->map3DEnabled->setChecked(m_settings->m_map3DEnabled); | ||||
|     ui->defaultImagery->setCurrentIndex(ui->defaultImagery->findText(m_settings->m_defaultImagery)); | ||||
|     ui->terrain->setCurrentIndex(ui->terrain->findText(m_settings->m_terrain)); | ||||
|     ui->buildings->setCurrentIndex(ui->buildings->findText(m_settings->m_buildings)); | ||||
|     ui->sunLightEnabled->setCurrentIndex((int)m_settings->m_sunLightEnabled); | ||||
|     ui->lightIntensity->setValue(m_settings->m_lightIntensity); | ||||
|     ui->lightIntensity->setEnabled(!m_settings->m_sunLightEnabled); | ||||
|     ui->eciCamera->setCurrentIndex((int)m_settings->m_eciCamera); | ||||
|     ui->antiAliasing->setCurrentIndex(ui->antiAliasing->findText(m_settings->m_antiAliasing)); | ||||
|     ui->fxaa->setChecked(m_settings->m_fxaa); | ||||
|     ui->msaa->setCurrentText(msaaToString(m_settings->m_msaa)); | ||||
|     ui->terrainLighting->setChecked(m_settings->m_terrainLighting); | ||||
|     ui->water->setChecked(m_settings->m_water); | ||||
|     ui->hdr->setChecked(m_settings->m_hdr); | ||||
|     ui->fog->setChecked(m_settings->m_fog); | ||||
|     ui->fps->setChecked(m_settings->m_fps); | ||||
| 
 | ||||
|     // Sort groups in table alphabetically
 | ||||
|     QList<MapSettings::MapItemSettings *> itemSettings = m_settings->m_itemSettings.values(); | ||||
| @ -178,6 +188,7 @@ void MapSettingsDialog::accept() | ||||
|     QString thunderforestAPIKey = ui->thunderforestAPIKey->text(); | ||||
|     QString maptilerAPIKey = ui->maptilerAPIKey->text(); | ||||
|     QString cesiumIonAPIKey = ui->cesiumIonAPIKey->text(); | ||||
|     QString arcGISAPIKey = ui->arcGISAPIKey->text(); | ||||
|     m_osmURLChanged = osmURL != m_settings->m_osmURL; | ||||
|     if ((mapProvider != m_settings->m_mapProvider) | ||||
|         || (thunderforestAPIKey != m_settings->m_thunderforestAPIKey) | ||||
| @ -199,10 +210,14 @@ void MapSettingsDialog::accept() | ||||
|     { | ||||
|         m_map2DSettingsChanged = false; | ||||
|     } | ||||
|     if (cesiumIonAPIKey != m_settings->m_cesiumIonAPIKey) | ||||
|     if (   (cesiumIonAPIKey != m_settings->m_cesiumIonAPIKey) | ||||
|         || (arcGISAPIKey != m_settings->m_arcGISAPIKey)) | ||||
|     { | ||||
|         m_settings->m_cesiumIonAPIKey = cesiumIonAPIKey; | ||||
|         m_settings->m_arcGISAPIKey = arcGISAPIKey; | ||||
|         m_map3DSettingsChanged = true; | ||||
|         m_settingsKeysChanged.append("cesiumIonAPIKey"); | ||||
|         m_settingsKeysChanged.append("arcGISAPIKey"); | ||||
|     } | ||||
|     else | ||||
|     { | ||||
| @ -219,6 +234,11 @@ void MapSettingsDialog::accept() | ||||
|         m_settings->m_map3DEnabled = ui->map3DEnabled->isChecked(); | ||||
|         m_settingsKeysChanged.append("map3DEnabled"); | ||||
|     } | ||||
|     if (m_settings->m_defaultImagery != ui->defaultImagery->currentText()) | ||||
|     { | ||||
|         m_settings->m_defaultImagery = ui->defaultImagery->currentText(); | ||||
|         m_settingsKeysChanged.append("defaultImagery"); | ||||
|     } | ||||
|     if (m_settings->m_terrain != ui->terrain->currentText()) | ||||
|     { | ||||
|         m_settings->m_terrain = ui->terrain->currentText(); | ||||
| @ -234,15 +254,50 @@ void MapSettingsDialog::accept() | ||||
|         m_settings->m_sunLightEnabled = ui->sunLightEnabled->currentIndex() == 1; | ||||
|         m_settingsKeysChanged.append("sunLightEnabled"); | ||||
|     } | ||||
|     if (m_settings->m_lightIntensity != ui->lightIntensity->value()) | ||||
|     { | ||||
|         m_settings->m_lightIntensity = ui->lightIntensity->value(); | ||||
|         m_settingsKeysChanged.append("lightIntensity"); | ||||
|     } | ||||
|     if (m_settings->m_eciCamera != (ui->eciCamera->currentIndex() == 1)) | ||||
|     { | ||||
|         m_settings->m_eciCamera = ui->eciCamera->currentIndex() == 1; | ||||
|         m_settingsKeysChanged.append("eciCamera"); | ||||
|     } | ||||
|     if (m_settings->m_antiAliasing != ui->antiAliasing->currentText()) | ||||
|     if (m_settings->m_fxaa != ui->fxaa->isChecked()) | ||||
|     { | ||||
|         m_settings->m_antiAliasing = ui->antiAliasing->currentText(); | ||||
|         m_settingsKeysChanged.append("antiAliasing"); | ||||
|         m_settings->m_fxaa = ui->fxaa->isChecked(); | ||||
|         m_settingsKeysChanged.append("fxaa"); | ||||
|     } | ||||
|     if (m_settings->m_msaa != stringToMSAA(ui->msaa->currentText())) | ||||
|     { | ||||
|         m_settings->m_msaa = stringToMSAA(ui->msaa->currentText()); | ||||
|         m_settingsKeysChanged.append("msaa"); | ||||
|     } | ||||
|     if (m_settings->m_terrainLighting != ui->terrainLighting->isChecked()) | ||||
|     { | ||||
|         m_settings->m_terrainLighting = ui->terrainLighting->isChecked(); | ||||
|         m_settingsKeysChanged.append("terrainLighting"); | ||||
|     } | ||||
|     if (m_settings->m_water != ui->water->isChecked()) | ||||
|     { | ||||
|         m_settings->m_water = ui->water->isChecked(); | ||||
|         m_settingsKeysChanged.append("water"); | ||||
|     } | ||||
|     if (m_settings->m_hdr != ui->hdr->isChecked()) | ||||
|     { | ||||
|         m_settings->m_hdr = ui->hdr->isChecked(); | ||||
|         m_settingsKeysChanged.append("hdr"); | ||||
|     } | ||||
|     if (m_settings->m_fog != ui->fog->isChecked()) | ||||
|     { | ||||
|         m_settings->m_fog = ui->fog->isChecked(); | ||||
|         m_settingsKeysChanged.append("fog"); | ||||
|     } | ||||
|     if (m_settings->m_fps != ui->fps->isChecked()) | ||||
|     { | ||||
|         m_settings->m_fps = ui->fps->isChecked(); | ||||
|         m_settingsKeysChanged.append("fps"); | ||||
|     } | ||||
| 
 | ||||
|     for (int row = 0; row < ui->mapItemSettings->rowCount(); row++) | ||||
| @ -318,7 +373,16 @@ void MapSettingsDialog::on_map3DEnabled_clicked(bool checked) | ||||
|     ui->buildings->setEnabled(checked); | ||||
|     ui->sunLightEnabled->setEnabled(checked); | ||||
|     ui->eciCamera->setEnabled(checked); | ||||
|     ui->antiAliasing->setEnabled(checked); | ||||
|     ui->fxaa->setEnabled(checked); | ||||
|     ui->msaa->setEnabled(checked); | ||||
| } | ||||
| 
 | ||||
| void MapSettingsDialog::on_terrain_currentIndexChanged(int index) | ||||
| { | ||||
|     bool ellipsoid = ui->terrain->currentText() == "Ellipsoid"; | ||||
| 
 | ||||
|     ui->terrainLighting->setEnabled(!ellipsoid); | ||||
|     ui->water->setEnabled(!ellipsoid); | ||||
| } | ||||
| 
 | ||||
| // Models have individual licensing. See LICENSE on github
 | ||||
| @ -554,3 +618,25 @@ void MapSettingsDialog::downloadWaypointsFinished() | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| void MapSettingsDialog::on_sunLightEnabled_currentIndexChanged(int index) | ||||
| { | ||||
|     ui->lightIntensity->setEnabled(index == 0); | ||||
| } | ||||
| 
 | ||||
| QString MapSettingsDialog::msaaToString(int msaa) const | ||||
| { | ||||
|     if (msaa <= 1) { | ||||
|         return "Off"; | ||||
|     } else { | ||||
|         return QString::number(msaa); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| int MapSettingsDialog::stringToMSAA(const QString& string) const | ||||
| { | ||||
|     if (string == "Off") { | ||||
|         return 1; | ||||
|     } else { | ||||
|         return string.toInt(); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -91,15 +91,19 @@ private: | ||||
|     Waypoints m_waypoints; | ||||
| 
 | ||||
|     void unzip(const QString &filename); | ||||
|     QString msaaToString(int msaa) const; | ||||
|     int stringToMSAA(const QString& string) const; | ||||
|      | ||||
| private slots: | ||||
|     void accept(); | ||||
|     void on_map2DEnabled_clicked(bool checked=false); | ||||
|     void on_map3DEnabled_clicked(bool checked=false); | ||||
|     void on_terrain_currentIndexChanged(int index); | ||||
|     void on_downloadModels_clicked(); | ||||
|     void on_getAirportDB_clicked(); | ||||
|     void on_getAirspacesDB_clicked(); | ||||
|     void on_getWaypoints_clicked(); | ||||
|     void on_sunLightEnabled_currentIndexChanged(int index); | ||||
|     void downloadComplete(const QString &filename, bool success, const QString &url, const QString &errorMessage); | ||||
|     void downloadingURL(const QString& url); | ||||
|     void downloadProgress(qint64 bytesRead, qint64 totalBytes); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user