Skip to content

Commit

Permalink
Improve usability of light pollution display in landscape description (
Browse files Browse the repository at this point in the history
  • Loading branch information
10110111 committed Feb 23, 2022
1 parent 5b4cbe0 commit 00ca307
Showing 1 changed file with 23 additions and 1 deletion.
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

0 comments on commit 00ca307

Please sign in to comment.