From 9e8316c1ae85ebeaae0e999699c60b7f59db544d Mon Sep 17 00:00:00 2001 From: Ruslan Kabatsayev Date: Wed, 5 Jul 2023 22:18:29 +0400 Subject: [PATCH] Add is-waning to planet info map It proved to be quite challenging to properly determine whether phase angle is increasing or decreasing. So it's worth providing a flag for this in the scripting API. --- src/core/modules/Planet.cpp | 2 ++ src/scripting/StelMainScriptAPI.hpp | 1 + 2 files changed, 3 insertions(+) diff --git a/src/core/modules/Planet.cpp b/src/core/modules/Planet.cpp index c839d492650fe..d2559a55d99de 100644 --- a/src/core/modules/Planet.cpp +++ b/src/core/modules/Planet.cpp @@ -1598,6 +1598,8 @@ QVariantMap Planet::getInfoMap(const StelCore *core) const map.insert("phase-angle", phaseAngle); map.insert("phase-angle-dms", StelUtils::radToDmsStr(phaseAngle)); map.insert("phase-angle-deg", StelUtils::radToDecDegStr(phaseAngle)); + const bool waning = isWaning(observerHelioPos, core->getObserverHeliocentricEclipticVelocity()); + map.insert("is-waning", waning); double elongation = getElongation(observerHelioPos); map.insert("elongation", elongation); map.insert("elongation-dms", StelUtils::radToDmsStr(elongation)); diff --git a/src/scripting/StelMainScriptAPI.hpp b/src/scripting/StelMainScriptAPI.hpp index 1f0bd8ccc2cb7..e6546b8b06951 100644 --- a/src/scripting/StelMainScriptAPI.hpp +++ b/src/scripting/StelMainScriptAPI.hpp @@ -259,6 +259,7 @@ public slots: //! - phase-angle : phase angle of object in radians (for Solar system objects only!) //! - phase-angle-dms : phase angle of object in DMS (for Solar system objects only!) //! - phase-angle-deg : phase angle of object in decimal degrees (for Solar system objects only!) + //! - is-waning : whether phase angle is increasing, signifying the waning phase (for Solar system objects only!) //! - elongation : elongation of object in radians (for Solar system objects only!) //! - elongation-dms : elongation of object in DMS (for Solar system objects only!) //! - elongation-deg : elongation of object in decimal degrees (for Solar system objects only!)