Skip to content

Commit

Permalink
Provide a UI for toggling atmosphere pseudo-mirror
Browse files Browse the repository at this point in the history
This is only relevant to ShowMySky model.
  • Loading branch information
10110111 committed Feb 1, 2025
1 parent 29ac8f3 commit 75023dd
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 5 deletions.
6 changes: 6 additions & 0 deletions src/core/modules/AtmosphereShowMySky.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ struct SkySettings : ShowMySky::Settings, QObject
static constexpr const char* zeroOrderScatteringPropName() { return "LandscapeMgr.flagAtmosphereZeroOrderScattering"; }
static constexpr const char* singleScatteringPropName() { return "LandscapeMgr.flagAtmosphereSingleScattering"; }
static constexpr const char* multipleScatteringPropName() { return "LandscapeMgr.flagAtmosphereMultipleScattering"; }
static constexpr const char* pseudoMirrorPropName() { return "LandscapeMgr.flagAtmospherePseudoMirror"; }
bool inited=false; // We have to lazy initialize because at the time of construction, LandscapeMgr isn't registered with StelPropertyMgr
void init()
{
Expand All @@ -119,6 +120,11 @@ struct SkySettings : ShowMySky::Settings, QObject
QObject::connect(prop, &StelProperty::changed, this, [this](const QVariant& v) { multipleScatteringEnabled_=v.toBool(); });
multipleScatteringEnabled_ = prop->getValue().toBool();
}
{
const auto prop = propMan->getProperty(pseudoMirrorPropName());
QObject::connect(prop, &StelProperty::changed, this, [this](const QVariant& v) { pseudoMirrorEnabled_=v.toBool(); });
pseudoMirrorEnabled_ = prop->getValue().toBool();
}
inited=true;
}
};
Expand Down
11 changes: 11 additions & 0 deletions src/core/modules/LandscapeMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1768,6 +1768,12 @@ void LandscapeMgr::setFlagAtmosphereMultipleScattering(const bool enable)
emit flagAtmosphereMultipleScatteringChanged(enable);
}

void LandscapeMgr::setFlagAtmospherePseudoMirror(const bool enable)
{
atmospherePseudoMirrorEnabled=enable;
emit flagAtmospherePseudoMirrorChanged(enable);
}

void LandscapeMgr::setAtmosphereEclipseSimulationQuality(const int quality)
{
if(getAtmosphereEclipseSimulationQuality() == quality)
Expand Down Expand Up @@ -1843,6 +1849,11 @@ bool LandscapeMgr::getFlagAtmosphereMultipleScattering() const
return atmosphereMultipleScatteringEnabled;
}

bool LandscapeMgr::getFlagAtmospherePseudoMirror() const
{
return atmospherePseudoMirrorEnabled;
}

int LandscapeMgr::getAtmosphereEclipseSimulationQuality() const
{
const auto conf=StelApp::getInstance().getSettings();
Expand Down
9 changes: 9 additions & 0 deletions src/core/modules/LandscapeMgr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,10 @@ class LandscapeMgr : public StelModule
READ getFlagAtmosphereMultipleScattering
WRITE setFlagAtmosphereMultipleScattering
NOTIFY flagAtmosphereMultipleScatteringChanged)
Q_PROPERTY(bool flagAtmospherePseudoMirror
READ getFlagAtmospherePseudoMirror
WRITE setFlagAtmospherePseudoMirror
NOTIFY flagAtmospherePseudoMirrorChanged)
Q_PROPERTY(int atmosphereEclipseSimulationQuality
READ getAtmosphereEclipseSimulationQuality
WRITE setAtmosphereEclipseSimulationQuality
Expand Down Expand Up @@ -567,6 +571,9 @@ public slots:
bool getFlagAtmosphereMultipleScattering() const;
void setFlagAtmosphereMultipleScattering(bool enable);

bool getFlagAtmospherePseudoMirror() const;
void setFlagAtmospherePseudoMirror(bool enable);

int getAtmosphereEclipseSimulationQuality() const;
void setAtmosphereEclipseSimulationQuality(int quality);

Expand Down Expand Up @@ -718,6 +725,7 @@ public slots:
void flagAtmosphereZeroOrderScatteringChanged(bool value);
void flagAtmosphereSingleScatteringChanged(bool value);
void flagAtmosphereMultipleScatteringChanged(bool value);
void flagAtmospherePseudoMirrorChanged(bool value);
void atmosphereEclipseSimulationQualityChanged(unsigned quality);
void atmosphereNoScatterChanged(const bool noScatter);
void cardinalPointsDisplayedChanged(const bool displayed);
Expand Down Expand Up @@ -883,6 +891,7 @@ private slots:
bool atmosphereZeroOrderScatteringEnabled=false;
bool atmosphereSingleScatteringEnabled=true;
bool atmosphereMultipleScatteringEnabled=true;
bool atmospherePseudoMirrorEnabled=true;

QString atmosphereShowMySkyStatusText;
bool atmosphereShowMySkyStoppedWithError=false;
Expand Down
1 change: 1 addition & 0 deletions src/gui/AtmosphereDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ void AtmosphereDialog::createDialogContent()
connectBoolProperty(ui->showMySky_zeroOrderEnabled, "LandscapeMgr.flagAtmosphereZeroOrderScattering");
connectBoolProperty(ui->showMySky_singleScatteringEnabled, "LandscapeMgr.flagAtmosphereSingleScattering");
connectBoolProperty(ui->showMySky_multipleScatteringEnabled, "LandscapeMgr.flagAtmosphereMultipleScattering");
connectBoolProperty(ui->showMySky_pseudoMirrorEnabled, "LandscapeMgr.flagAtmospherePseudoMirror");
connectIntProperty(ui->showMySky_eclipseSimulationQualitySpinBox, ECLIPSE_SIM_QUALITY_PROPERTY);
#else
ui->visualModelConfigGroup->hide();
Expand Down
12 changes: 7 additions & 5 deletions src/gui/atmosphereDialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="showMySky_pseudoMirrorEnabled">
<property name="text">
<string>Mirror the sky under the horizon</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
Expand Down Expand Up @@ -434,11 +441,6 @@
<header>Dialog.hpp</header>
<container>1</container>
</customwidget>
<customwidget>
<class>StelCloseButton</class>
<extends>QPushButton</extends>
<header>gui/StelCloseButton.hpp</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>atmosphereModel</tabstop>
Expand Down

0 comments on commit 75023dd

Please sign in to comment.