diff --git a/src/blackmisc/simulation/settings/xswiftbussettings.h b/src/blackmisc/simulation/settings/xswiftbussettings.h
index 6c825bcd8..76eaeff87 100644
--- a/src/blackmisc/simulation/settings/xswiftbussettings.h
+++ b/src/blackmisc/simulation/settings/xswiftbussettings.h
@@ -105,6 +105,7 @@ namespace BlackMisc
BLACK_METAMEMBER(followAircraftDistanceM),
BLACK_METAMEMBER(logRenderPhases),
BLACK_METAMEMBER(tcasEnabled),
+ BLACK_METAMEMBER(terrainProbeEnabled),
BLACK_METAMEMBER(timestampMSecsSinceEpoch, 0, DisabledForComparison | DisabledForHashing)
);
};
diff --git a/src/blackmisc/simulation/settings/xswiftbussettingsqtfree.h b/src/blackmisc/simulation/settings/xswiftbussettingsqtfree.h
index 2756aa3c4..14d35d3b1 100644
--- a/src/blackmisc/simulation/settings/xswiftbussettingsqtfree.h
+++ b/src/blackmisc/simulation/settings/xswiftbussettingsqtfree.h
@@ -133,6 +133,12 @@ namespace BlackMisc
//! TCAS functionality?
void setTcasEnabled(bool tcas) { m_tcasEnabled = tcas; }
+ //! Terrain probe to establish ground elevation?
+ bool isTerrainProbeEnabled() const { return m_terrainProbeEnabled; }
+
+ //! Terrain probe to establish ground elevation?
+ void setTerrainProbeEnabled(bool enabled) { m_terrainProbeEnabled = enabled; }
+
//! Load and parse config file
bool parseXSwiftBusString(const std::string &json);
@@ -159,6 +165,7 @@ namespace BlackMisc
static constexpr char JsonDrawingLabels[] = "drawinglabels";
static constexpr char JsonLogRenderPhases[] = "renderPhases";
static constexpr char JsonTcas[] = "tcas";
+ static constexpr char JsonTerrainProbe[] = "terrainProbe";
static constexpr char JsonMaxPlanes[] = "maxplanes";
static constexpr char JsonMaxDrawDistance[] = "maxDrawDistance";
static constexpr char JsonNightTextureMode[] = "nighttexture";
@@ -180,6 +187,7 @@ namespace BlackMisc
bool m_bundleTaxiLandingLights = true; //!< bundle taxi and landing lights
bool m_logRenderPhases = false; //!< render phases debug messages
bool m_tcasEnabled = true; //!< TCAS functionality
+ bool m_terrainProbeEnabled = true; //!< terrain probe to establish ground elevation
double m_maxDrawDistanceNM = 50.0; //!< distance in XPlane
int64_t m_msSinceEpochQtFree = 0; //!< timestamp
};
diff --git a/src/blackmisc/simulation/settings/xswiftbussettingsqtfree.inc b/src/blackmisc/simulation/settings/xswiftbussettingsqtfree.inc
index a16a2eb53..b67e9d918 100644
--- a/src/blackmisc/simulation/settings/xswiftbussettingsqtfree.inc
+++ b/src/blackmisc/simulation/settings/xswiftbussettingsqtfree.inc
@@ -30,6 +30,7 @@ constexpr char BlackMisc::Simulation::Settings::CXSwiftBusSettingsQtFree::JsonMe
constexpr char BlackMisc::Simulation::Settings::CXSwiftBusSettingsQtFree::JsonBundleTaxiLandingLights[];
constexpr char BlackMisc::Simulation::Settings::CXSwiftBusSettingsQtFree::JsonTimestamp[];
constexpr char BlackMisc::Simulation::Settings::CXSwiftBusSettingsQtFree::JsonTcas[];
+constexpr char BlackMisc::Simulation::Settings::CXSwiftBusSettingsQtFree::JsonTerrainProbe[];
constexpr char BlackMisc::Simulation::Settings::CXSwiftBusSettingsQtFree::JsonLogRenderPhases[];
//! @endcond
@@ -73,6 +74,10 @@ namespace BlackMisc
{
m_tcasEnabled = settingsDoc[CXSwiftBusSettingsQtFree::JsonTcas].GetBool(); c++;
}
+ if (settingsDoc.HasMember(CXSwiftBusSettingsQtFree::JsonTerrainProbe) && settingsDoc[CXSwiftBusSettingsQtFree::JsonTerrainProbe].IsBool())
+ {
+ m_terrainProbeEnabled = settingsDoc[CXSwiftBusSettingsQtFree::JsonTerrainProbe].GetBool(); c++;
+ }
if (settingsDoc.HasMember(CXSwiftBusSettingsQtFree::JsonLogRenderPhases) && settingsDoc[CXSwiftBusSettingsQtFree::JsonLogRenderPhases].IsBool())
{
m_logRenderPhases = settingsDoc[CXSwiftBusSettingsQtFree::JsonLogRenderPhases].GetBool(); c++;
@@ -94,7 +99,7 @@ namespace BlackMisc
m_msSinceEpochQtFree = settingsDoc[CXSwiftBusSettingsQtFree::JsonTimestamp].GetInt64(); c++;
}
this->objectUpdated(); // post processing
- return c == 11;
+ return c == 12;
}
std::string CXSwiftBusSettingsQtFree::toXSwiftBusJsonString() const
@@ -118,6 +123,7 @@ namespace BlackMisc
document.AddMember(JsonFollowAircraftDistanceM, m_followAircraftDistanceM, a);
document.AddMember(JsonLogRenderPhases, m_logRenderPhases, a);
document.AddMember(JsonTcas, m_tcasEnabled, a);
+ document.AddMember(JsonTerrainProbe, m_terrainProbeEnabled, a);
// document[CXSwiftBusSettingsQtFree::JsonDBusServerAddress].SetString(StringRef(m_dBusServerAddress.c_str(), m_dBusServerAddress.size()));
// document[CXSwiftBusSettingsQtFree::JsonDrawingLabels].SetBool(m_drawingLabels);
@@ -138,6 +144,7 @@ namespace BlackMisc
", bundle lights: " + QtFreeUtils::boolToYesNo(m_bundleTaxiLandingLights) +
", phases: " + QtFreeUtils::boolToYesNo(m_logRenderPhases) +
", TCAS: " + QtFreeUtils::boolToYesNo(m_tcasEnabled) +
+ ", terr.probe: " + QtFreeUtils::boolToYesNo(m_terrainProbeEnabled) +
", night t.: " + m_nightTextureMode +
", max planes: " + std::to_string(m_maxPlanes) +
", max distance NM: " + std::to_string(m_maxDrawDistanceNM) +
@@ -155,6 +162,7 @@ namespace BlackMisc
if (m_nightTextureMode != newValues.m_nightTextureMode) { m_nightTextureMode = newValues.m_nightTextureMode; changed++; }
if (m_logRenderPhases != newValues.m_logRenderPhases) { m_logRenderPhases = newValues.m_logRenderPhases; changed++; }
if (m_tcasEnabled != newValues.m_tcasEnabled) { m_tcasEnabled = newValues.m_tcasEnabled; changed++; }
+ if (m_terrainProbeEnabled != newValues.m_terrainProbeEnabled) { m_terrainProbeEnabled = newValues.m_terrainProbeEnabled; changed++; }
if (m_maxPlanes != newValues.m_maxPlanes) { m_maxPlanes = newValues.m_maxPlanes; changed++; }
if (m_msSinceEpochQtFree != newValues.m_msSinceEpochQtFree) { m_msSinceEpochQtFree = newValues.m_msSinceEpochQtFree; changed++; }
if (m_bundleTaxiLandingLights != newValues.m_bundleTaxiLandingLights) { m_bundleTaxiLandingLights = newValues.m_bundleTaxiLandingLights; changed++; }
diff --git a/src/plugins/simulator/xplaneconfig/simulatorxplaneconfigwindow.cpp b/src/plugins/simulator/xplaneconfig/simulatorxplaneconfigwindow.cpp
index 9795a6466..b460d00ca 100644
--- a/src/plugins/simulator/xplaneconfig/simulatorxplaneconfigwindow.cpp
+++ b/src/plugins/simulator/xplaneconfig/simulatorxplaneconfigwindow.cpp
@@ -73,6 +73,7 @@ namespace BlackSimPlugin
s.setNightTextureModeQt(ui->cb_NightTextureMode->currentText());
s.setBundlingTaxiAndLandingLights(ui->cb_BundleTaxiLandingLights->isChecked());
s.setTcasEnabled(ui->cb_TcasEnabled->isChecked());
+ s.setTerrainProbeEnabled(ui->cb_TerrainProbeEnabled->isChecked());
s.setLogRenderPhases(ui->cb_LogRenderPhases->isChecked());
// left, top, right, bottom, height
@@ -96,6 +97,7 @@ namespace BlackSimPlugin
ui->cb_DrawLabels->setChecked(settings.isDrawingLabels());
ui->cb_BundleTaxiLandingLights->setChecked(settings.isBundlingTaxiAndLandingLights());
ui->cb_TcasEnabled->setChecked(settings.isTcasEnabled());
+ ui->cb_TerrainProbeEnabled->setChecked(settings.isTerrainProbeEnabled());
ui->cb_LogRenderPhases->setChecked(settings.isLogRenderPhases());
const QString s = settings.getNightTextureModeQt().left(1);
diff --git a/src/plugins/simulator/xplaneconfig/simulatorxplaneconfigwindow.ui b/src/plugins/simulator/xplaneconfig/simulatorxplaneconfigwindow.ui
index cb6929ac2..48cca9590 100644
--- a/src/plugins/simulator/xplaneconfig/simulatorxplaneconfigwindow.ui
+++ b/src/plugins/simulator/xplaneconfig/simulatorxplaneconfigwindow.ui
@@ -66,16 +66,6 @@
- -
-
-
- QDialogButtonBox::Cancel|QDialogButtonBox::Ok
-
-
- false
-
-
-
-
@@ -158,14 +148,42 @@
+ -
+
+
+ TCAS
+
+
+
+ -
+
+
+ show traffic on TCAS
+
+
+
-
+
+
+ Logging
+
+
+
+ -
+
+
+ log.render phases
+
+
+
+ -
Message box
- -
+
-
@@ -197,13 +215,36 @@
-
+
+
+ Box disappears after
+
+
+
+ -
+
+
+ ms
+
+
+ 1000
+
+
+ 25000
+
+
+ 250
+
+
+
+ -
Box margins px.
- -
+
-
@@ -277,14 +318,14 @@
- -
+
-
Night texture
- -
+
-
-
@@ -303,60 +344,33 @@
- -
-
-
- log.render phases
-
-
-
-
-
+
- Logging
+ Terrain probe
- -
-
+
-
+
- show traffic on TCAS
-
-
-
- -
-
-
- TCAS
-
-
-
- -
-
-
- ms
-
-
- 1000
-
-
- 25000
-
-
- 250
-
-
-
- -
-
-
- Box disappears after
+ probe to determine ground elevation
+ -
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Ok
+
+
+ false
+
+
+
-
diff --git a/src/xswiftbus/traffic.cpp b/src/xswiftbus/traffic.cpp
index e6c0856fa..f6cd26648 100644
--- a/src/xswiftbus/traffic.cpp
+++ b/src/xswiftbus/traffic.cpp
@@ -509,8 +509,12 @@ namespace XSwiftBus
const double latDeg = plane->position.lat;
const double lonDeg = plane->position.lon;
- double groundElevation = plane->terrainProbe.getElevation(latDeg, lonDeg, plane->position.elevation, requestedCallsign);
- if (std::isnan(groundElevation)) { groundElevation = 0.0; }
+ double groundElevation = 0.0;
+ if (getSettings().isTerrainProbeEnabled())
+ {
+ groundElevation = plane->terrainProbe.getElevation(latDeg, lonDeg, plane->position.elevation, requestedCallsign);
+ if (std::isnan(groundElevation)) { groundElevation = 0.0; }
+ }
double fudgeFactor = 3.0;
bool hasOffset = XPMPGetVerticalOffset(plane->id, &fudgeFactor);
@@ -524,6 +528,8 @@ namespace XSwiftBus
double CTraffic::getElevationAtPosition(const std::string &callsign, double latitudeDeg, double longitudeDeg, double altitudeMeters) const
{
+ if (getSettings().isTerrainProbeEnabled()) { return std::numeric_limits::quiet_NaN(); }
+
auto planeIt = m_planesByCallsign.find(callsign);
if (planeIt != m_planesByCallsign.end())
{