mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 12:55:33 +08:00
[xplane] Allow disabling terrain probe for diagnosing performance issues
This commit is contained in:
@@ -105,6 +105,7 @@ namespace BlackMisc
|
||||
BLACK_METAMEMBER(followAircraftDistanceM),
|
||||
BLACK_METAMEMBER(logRenderPhases),
|
||||
BLACK_METAMEMBER(tcasEnabled),
|
||||
BLACK_METAMEMBER(terrainProbeEnabled),
|
||||
BLACK_METAMEMBER(timestampMSecsSinceEpoch, 0, DisabledForComparison | DisabledForHashing)
|
||||
);
|
||||
};
|
||||
|
||||
@@ -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
|
||||
};
|
||||
|
||||
@@ -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++; }
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -66,16 +66,6 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QDialogButtonBox" name="bb_OkCancel">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
<property name="centerButtons">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QGroupBox" name="gb_XPSettings">
|
||||
<property name="title">
|
||||
@@ -158,14 +148,42 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="lbl_TcasEnabled">
|
||||
<property name="text">
|
||||
<string>TCAS</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QCheckBox" name="cb_TcasEnabled">
|
||||
<property name="text">
|
||||
<string>show traffic on TCAS</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="lbl_DebugMode">
|
||||
<property name="text">
|
||||
<string>Logging</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QCheckBox" name="cb_LogRenderPhases">
|
||||
<property name="text">
|
||||
<string>log.render phases</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="lbl_MessageBox">
|
||||
<property name="text">
|
||||
<string>Message box </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<item row="8" column="1">
|
||||
<widget class="QWidget" name="wi_MessageBox" native="true">
|
||||
<layout class="QHBoxLayout" name="hl_MessageBox">
|
||||
<property name="leftMargin">
|
||||
@@ -197,13 +215,36 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="lbl_MessageBoxDuration">
|
||||
<property name="text">
|
||||
<string>Box disappears after</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<widget class="QSpinBox" name="sb_MessageBoxDuration">
|
||||
<property name="suffix">
|
||||
<string>ms</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>25000</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>250</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<widget class="QLabel" name="lbl_MessageBoxMargins">
|
||||
<property name="text">
|
||||
<string>Box margins px.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<item row="10" column="1">
|
||||
<widget class="QWidget" name="wi_Margins" native="true">
|
||||
<layout class="QGridLayout" name="gl_MessageBoxMargins">
|
||||
<property name="leftMargin">
|
||||
@@ -277,14 +318,14 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<item row="11" column="0">
|
||||
<widget class="QLabel" name="lbl_NightTextureMode">
|
||||
<property name="text">
|
||||
<string>Night texture</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<item row="11" column="1">
|
||||
<widget class="QComboBox" name="cb_NightTextureMode">
|
||||
<item>
|
||||
<property name="text">
|
||||
@@ -303,60 +344,33 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QCheckBox" name="cb_LogRenderPhases">
|
||||
<property name="text">
|
||||
<string>log.render phases</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="lbl_DebugMode">
|
||||
<widget class="QLabel" name="lbl_TerrainProbeEnabled">
|
||||
<property name="text">
|
||||
<string>Logging</string>
|
||||
<string>Terrain probe</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QCheckBox" name="cb_TcasEnabled">
|
||||
<item row="6" column="1">
|
||||
<widget class="QCheckBox" name="cb_TerrainProbeEnabled">
|
||||
<property name="text">
|
||||
<string>show traffic on TCAS</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="lbl_TcasEnabled">
|
||||
<property name="text">
|
||||
<string>TCAS</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QSpinBox" name="sb_MessageBoxDuration">
|
||||
<property name="suffix">
|
||||
<string>ms</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>25000</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>250</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="lbl_MessageBoxDuration">
|
||||
<property name="text">
|
||||
<string>Box disappears after</string>
|
||||
<string>probe to determine ground elevation</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QDialogButtonBox" name="bb_OkCancel">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
<property name="centerButtons">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<spacer name="vs_Buutons">
|
||||
<property name="orientation">
|
||||
|
||||
@@ -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<double>::quiet_NaN(); }
|
||||
|
||||
auto planeIt = m_planesByCallsign.find(callsign);
|
||||
if (planeIt != m_planesByCallsign.end())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user