Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve usability of light pollution display in landscape description #2296

Merged
merged 1 commit into from
Feb 23, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion src/core/modules/LandscapeMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,29 @@ QString LandscapeMgr::getCurrentLandscapeHtmlDescription() const

const auto lightPollutionLum = landscape->getDefaultLightPollutionLuminance();
if (lightPollutionLum.isValid())
desc += q_("<b>Light pollution</b>: %1 cd/m<sup>2</sup>").arg(lightPollutionLum.toFloat());
{
const auto lum = lightPollutionLum.toFloat();
auto scaledLum = lum;
QString unit = q_("cd/m<sup>2</sup>");
if(lum < 1e-6f)
{
scaledLum = lum*1e9f;
unit = q_("ncd/m<sup>2</sup>");
}
else if(lum < 1e-3f)
{
scaledLum = lum*1e6f;
unit = q_("&mu;cd/m<sup>2</sup>");
}
else if(lum < 1)
{
scaledLum = lum*1e3f;
unit = q_("mcd/m<sup>2</sup>");
}
desc += q_("<b>Light pollution</b>: %1 %2 (NELM: %3; Bortle class: %4)")
.arg(scaledLum).arg(unit).arg(StelCore::luminanceToNELM(lum))
.arg(StelCore::luminanceToBortleScaleIndex(lum));
}
}
return desc;
}
Expand Down