Merge lp:~alexwolf/stellarium/apparent-magnitude-algorithm into lp:stellarium

Proposed by Alexander Wolf
Status: Merged
Merged at revision: 7113
Proposed branch: lp:~alexwolf/stellarium/apparent-magnitude-algorithm
Merge into: lp:stellarium
Diff against target: 411 lines (+196/-104)
4 files modified
src/core/modules/Planet.cpp (+144/-100)
src/core/modules/Planet.hpp (+19/-4)
src/core/modules/SolarSystem.cpp (+15/-0)
src/core/modules/SolarSystem.hpp (+18/-0)
To merge this branch: bzr merge lp:~alexwolf/stellarium/apparent-magnitude-algorithm
Reviewer Review Type Date Requested Status
gzotti Approve
Fabien Chéreau Pending
Stellarium Pending
Review via email: mp+240359@code.launchpad.net

Description of the change

This branch extends customization for computation of apparent magnitudes.

I introduced the new option in config.ini "astro/apparent_magnitude_algorithm", which gave users possibility to setting the algorithm for computation of apparent magnitudes for planets in case observer on the Earth.

Possible values for it:
* Planesas (algorithm provided by Pere Planesas (Observatorio Astronomico Nacional))
* Mueller (G. Mueller, based on visual observations 1877-91. [Expl.Suppl.1961])
* Harris (Astronomical Almanac 1984 and later. These give V (instrumental) magnitudes)

I activated Harris's algorithm by default because users asks about "wrong magnitudes for planets", plus all modern astronomical almanacs and websites like JPL's HORIZONS and IMCCE uses this algorithm by default.

I don't added new option to GUI and I think it's shouldn't be added because GUI of the Stellarium are bloated already and this option is proposed for advanced users, who can yourself edit config.ini and know what they are doing.

To post a comment you must log in.
Revision history for this message
gzotti (georg-zotti) wrote :

In principle the idea is very good, given that historical research from early 20th century was based on Mueller, and many people nowadays seem to prefer comparing instrumental magnitudes. I'd lke to know Planesa's original sources, was that some original contribution to Stellarium? (Fabien?)

However, currently it seems to me this is a property of each planet, which seems confusing. I assume users will want a global algorithm setting for all planets. It should either go into SolarSystem or be a static property of the Planet class. There is also a small typo, see below (lowercasing - ah, it's auto-corrected ...).

There could be a selector combo in the Config/Information panel:
Planesas (Stellarium original)
Mueller (visual mag, [Expl.Suppl. 1961])
Harris (V mag [Astron. Almanach 1984])

with details in the README. But I don't insist on that.

review: Needs Fixing
Revision history for this message
Alexander Wolf (alexwolf) wrote :

> In principle the idea is very good, given that historical research from early
> 20th century was based on Mueller, and many people nowadays seem to prefer
> comparing instrumental magnitudes. I'd lke to know Planesa's original sources,
> was that some original contribution to Stellarium? (Fabien?)

Sorry, I don't have Planesas original sources (this algorithm was in the code and I just uncommented it).

> However, currently it seems to me this is a property of each planet, which
> seems confusing.

Yes, but I don't know how to avoid crash without applied of this property for all planets.

> I assume users will want a global algorithm setting for all planets.

Huh? It's problematic, because we don't have empirical algorithms for each other planets. Or I just wrongly understood you?

> It should either go into SolarSystem or be a static property of the
> Planet class.

Are you mean the line 121 in Planet.cpp?

> There could be a selector combo in the Config/Information panel:
> Planesas (Stellarium original)
> Mueller (visual mag, [Expl.Suppl. 1961])
> Harris (V mag [Astron. Almanach 1984])
>
> with details in the README. But I don't insist on that.

I'm agree with proposal for README (who read it - maybe we should add it into Help?). But I disagree with proposal for GUI because this feature in really required for little group of the advanced peoples, who make research in archaeoastronomy (or history of astronomy). I hope those peoples can change settings without GUI and we can use the simple GUI yet.

Revision history for this message
gzotti (georg-zotti) wrote :

> Planesas
I think Fabien may know more on this history. Private communication on known sources (which?), original work, or where is this from?

> Are you mean the line 121 in Planet.cpp?
Ah sorry, I had overlooked this. Yes, then it's fine for me.

At least the wiki manual must be updated to notify users of the possibility to change values, and of possible values for this setting.

review: Approve
7113. By Alexander Wolf

a tiny fixation

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/core/modules/Planet.cpp'
--- src/core/modules/Planet.cpp 2014-10-27 16:19:19 +0000
+++ src/core/modules/Planet.cpp 2014-11-01 17:59:05 +0000
@@ -55,6 +55,9 @@
55Planet::RingPlanetShaderVars Planet::ringPlanetShaderVars;55Planet::RingPlanetShaderVars Planet::ringPlanetShaderVars;
56QOpenGLShaderProgram* Planet::moonShaderProgram=NULL;56QOpenGLShaderProgram* Planet::moonShaderProgram=NULL;
57Planet::MoonShaderVars Planet::moonShaderVars;57Planet::MoonShaderVars Planet::moonShaderVars;
58
59QMap<Planet::PlanetType, QString> Planet::pTypeMap;
60QMap<Planet::ApparentMagnitudeAlgorithm, QString> Planet::vMagAlgorithmMap;
58 61
59Planet::Planet(const QString& englishName,62Planet::Planet(const QString& englishName,
60 int flagLighting,63 int flagLighting,
@@ -101,9 +104,10 @@
101104
102 // Initialize pType with the key found in pTypeMap, or mark planet type as undefined.105 // Initialize pType with the key found in pTypeMap, or mark planet type as undefined.
103 // The latter condition should obviously never happen.106 // The latter condition should obviously never happen.
104 pType=pTypeMap.key(pTypeStr, Planet::isUNDEFINED);107 pType = pTypeMap.key(pTypeStr, Planet::isUNDEFINED);
108 vMagAlgorithm = Planet::UndefinedAlgorithm;
105109
106 eclipticPos=Vec3d(0.,0.,0.);110 eclipticPos = Vec3d(0.,0.,0.);
107 rotLocalToParent = Mat4d::identity();111 rotLocalToParent = Mat4d::identity();
108 texMap = StelApp::getInstance().getTextureManager().createTextureThread(StelFileMgr::getInstallationDir()+"/textures/"+texMapName, StelTexture::StelTextureParams(true, GL_LINEAR, GL_REPEAT));112 texMap = StelApp::getInstance().getTextureManager().createTextureThread(StelFileMgr::getInstallationDir()+"/textures/"+texMapName, StelTexture::StelTextureParams(true, GL_LINEAR, GL_REPEAT));
109 normalMap = StelApp::getInstance().getTextureManager().createTextureThread(StelFileMgr::getInstallationDir()+"/textures/"+normalMapName, StelTexture::StelTextureParams(true, GL_LINEAR, GL_REPEAT));113 normalMap = StelApp::getInstance().getTextureManager().createTextureThread(StelFileMgr::getInstallationDir()+"/textures/"+normalMapName, StelTexture::StelTextureParams(true, GL_LINEAR, GL_REPEAT));
@@ -116,8 +120,6 @@
116 flagLabels = true;120 flagLabels = true;
117}121}
118122
119QMap<Planet::PlanetType, QString> Planet::pTypeMap;
120
121// called in SolarSystem::init() before first planet is created. Loads pTypeMap.123// called in SolarSystem::init() before first planet is created. Loads pTypeMap.
122void Planet::init()124void Planet::init()
123{125{
@@ -133,7 +135,17 @@
133 pTypeMap.insert(Planet::isAsteroid, "asteroid");135 pTypeMap.insert(Planet::isAsteroid, "asteroid");
134 pTypeMap.insert(Planet::isPlutoid, "plutoid");136 pTypeMap.insert(Planet::isPlutoid, "plutoid");
135 pTypeMap.insert(Planet::isComet, "comet");137 pTypeMap.insert(Planet::isComet, "comet");
136 pTypeMap.insert(Planet::isUNDEFINED, "UNDEFINED"); // something must be broken before we ever see this!138 pTypeMap.insert(Planet::isUNDEFINED,"UNDEFINED"); // something must be broken before we ever see this!
139
140 if (vMagAlgorithmMap.count() > 0)
141 {
142 qDebug() << "Planet::init(): Non-empty static map. This is a programming error, but we can fix that.";
143 vMagAlgorithmMap.clear();
144 }
145 vMagAlgorithmMap.insert(Planet::Planesas, "planesas");
146 vMagAlgorithmMap.insert(Planet::Mueller, "mueller");
147 vMagAlgorithmMap.insert(Planet::Harris, "harris");
148 vMagAlgorithmMap.insert(Planet::UndefinedAlgorithm, "");
137}149}
138150
139Planet::~Planet()151Planet::~Planet()
@@ -760,108 +772,135 @@
760 {772 {
761 const double phaseDeg=phase*180./M_PI;773 const double phaseDeg=phase*180./M_PI;
762 const double d = 5. * log10(sqrt(observerPlanetRq*planetRq));774 const double d = 5. * log10(sqrt(observerPlanetRq*planetRq));
763 //double f1 = phaseDeg/100.;
764775
765 /*
766 // Algorithm provided by Pere Planesas (Observatorio Astronomico Nacional)
767 if (englishName=="Mercury")
768 {
769 if ( phaseDeg > 150. ) f1 = 1.5;
770 return -0.36 + d + 3.8*f1 - 2.73*f1*f1 + 2*f1*f1*f1;
771 }
772 if (englishName=="Venus")
773 return -4.29 + d + 0.09*f1 + 2.39*f1*f1 - 0.65*f1*f1*f1;
774 if (englishName=="Mars")
775 return -1.52 + d + 0.016*phaseDeg;
776 if (englishName=="Jupiter")
777 return -9.25 + d + 0.005*phaseDeg;
778 if (englishName=="Saturn")
779 {
780 // TODO re-add rings computation
781 // double rings = -2.6*sinx + 1.25*sinx*sinx;
782 return -8.88 + d + 0.044*phaseDeg;// + rings;
783 }
784 if (englishName=="Uranus")
785 return -7.19 + d + 0.0028*phaseDeg;
786 if (englishName=="Neptune")
787 return -6.87 + d;
788 if (englishName=="Pluto")
789 return -1.01 + d + 0.041*phaseDeg;
790 */
791 // GZ: I prefer the values given by Meeus, Astronomical Algorithms (1992).776 // GZ: I prefer the values given by Meeus, Astronomical Algorithms (1992).
792 // There are two solutions:777 // There are two solutions:
793 // (1) G. Mueller, based on visual observations 1877-91. [Expl.Suppl.1961]778 // (1) G. Mueller, based on visual observations 1877-91. [Expl.Suppl.1961]
794 // (2) Astronomical Almanac 1984 and later. These give V (instrumental) magnitudes.779 // (2) Astronomical Almanac 1984 and later. These give V (instrumental) magnitudes.
795 // The structure is almost identical, just the numbers are different!780 // The structure is almost identical, just the numbers are different!
796 // I activate (1) for now, because we want to simulate the eye's impression. (Esp. Venus!)781 // I activate (1) for now, because we want to simulate the eye's impression. (Esp. Venus!)
797 // (1)782 // AW: (2) activated by default
798 if (englishName=="Mercury")783
799 {784 switch (core->getCurrentPlanet()->getApparentMagnitudeAlgorithm())
800 double ph50=phaseDeg-50.0;785 {
801 return 1.16 + d + 0.02838*ph50 + 0.0001023*ph50*ph50;786 case Planesas:
802 }787 {
803 if (englishName=="Venus")788 // Algorithm provided by Pere Planesas (Observatorio Astronomico Nacional)
804 return -4.0 + d + 0.01322*phaseDeg + 0.0000004247*phaseDeg*phaseDeg*phaseDeg;789 double f1 = phaseDeg/100.;
805 if (englishName=="Mars")790
806 return -1.3 + d + 0.01486*phaseDeg;791 if (englishName=="Mercury")
807 if (englishName=="Jupiter")792 {
808 return -8.93 + d;793 if ( phaseDeg > 150. ) f1 = 1.5;
809 if (englishName=="Saturn")794 return -0.36 + d + 3.8*f1 - 2.73*f1*f1 + 2*f1*f1*f1;
810 {795 }
811 // add rings computation796 if (englishName=="Venus")
812 // GZ: implemented from Meeus, Astr.Alg.1992797 return -4.29 + d + 0.09*f1 + 2.39*f1*f1 - 0.65*f1*f1*f1;
813 const double jd=core->getJDay();798 if (englishName=="Mars")
814 const double T=(jd-2451545.0)/36525.0;799 return -1.52 + d + 0.016*phaseDeg;
815 const double i=((0.000004*T-0.012998)*T+28.075216)*M_PI/180.0;800 if (englishName=="Jupiter")
816 const double Omega=((0.000412*T+1.394681)*T+169.508470)*M_PI/180.0;801 return -9.25 + d + 0.005*phaseDeg;
817 SolarSystem *ssystem=GETSTELMODULE(SolarSystem);802 if (englishName=="Saturn")
818 const Vec3d saturnEarth=getHeliocentricEclipticPos() - ssystem->getEarth()->getHeliocentricEclipticPos();803 {
819 double lambda=atan2(saturnEarth[1], saturnEarth[0]);804 // add rings computation
820 double beta=atan2(saturnEarth[2], sqrt(saturnEarth[0]*saturnEarth[0]+saturnEarth[1]*saturnEarth[1]));805 // implemented from Meeus, Astr.Alg.1992
821 const double sinB=sin(i)*cos(beta)*sin(lambda-Omega)-cos(i)*sin(beta);806 const double jd=core->getJDay();
822 double rings = -2.6*fabs(sinB) + 1.25*sinB*sinB; // sinx=sinB, saturnicentric latitude of earth. longish, see Meeus.807 const double T=(jd-2451545.0)/36525.0;
823 return -8.68 + d + 0.044*phaseDeg + rings;808 const double i=((0.000004*T-0.012998)*T+28.075216)*M_PI/180.0;
824 }809 const double Omega=((0.000412*T+1.394681)*T+169.508470)*M_PI/180.0;
825 if (englishName=="Uranus")810 static SolarSystem *ssystem=GETSTELMODULE(SolarSystem);
826 return -6.85 + d;811 const Vec3d saturnEarth=getHeliocentricEclipticPos() - ssystem->getEarth()->getHeliocentricEclipticPos();
827 if (englishName=="Neptune")812 double lambda=atan2(saturnEarth[1], saturnEarth[0]);
828 return -7.05 + d;813 double beta=atan2(saturnEarth[2], sqrt(saturnEarth[0]*saturnEarth[0]+saturnEarth[1]*saturnEarth[1]));
829 if (englishName=="Pluto")814 const double sinx=sin(i)*cos(beta)*sin(lambda-Omega)-cos(i)*sin(beta);
830 return -1.0 + d;815 double rings = -2.6*sinx + 1.25*sinx*sinx;
831 /*816 return -8.88 + d + 0.044*phaseDeg + rings;
832 // (2)817 }
833 if (englishName=="Mercury")818 if (englishName=="Uranus")
834 return 0.42 + d + .038*phaseDeg - 0.000273*phaseDeg*phaseDeg + 0.000002*phaseDeg*phaseDeg*phaseDeg;819 return -7.19 + d + 0.0028*phaseDeg;
835 if (englishName=="Venus")820 if (englishName=="Neptune")
836 return -4.40 + d + 0.0009*phaseDeg + 0.000239*phaseDeg*phaseDeg - 0.00000065*phaseDeg*phaseDeg*phaseDeg;821 return -6.87 + d;
837 if (englishName=="Mars")822 if (englishName=="Pluto")
838 return -1.52 + d + 0.016*phaseDeg;823 return -1.01 + d + 0.041*phaseDeg;
839 if (englishName=="Jupiter")824
840 return -9.40 + d + 0.005*phaseDeg;825 break;
841 if (englishName=="Saturn")826 }
842 {827 case Mueller:
843 // add rings computation828 {
844 // GZ: implemented from Meeus, Astr.Alg.1992829 // (1)
845 const double jd=core->getJDay();830 if (englishName=="Mercury")
846 const double T=(jd-2451545.0)/36525.0;831 {
847 const double i=((0.000004*T-0.012998)*T+28.075216)*M_PI/180.0;832 double ph50=phaseDeg-50.0;
848 const double Omega=((0.000412*T+1.394681)*T+169.508470)*M_PI/180.0;833 return 1.16 + d + 0.02838*ph50 + 0.0001023*ph50*ph50;
849 static SolarSystem *ssystem=GETSTELMODULE(SolarSystem);834 }
850 const Vec3d saturnEarth=getHeliocentricEclipticPos() - ssystem->getEarth()->getHeliocentricEclipticPos();835 if (englishName=="Venus")
851 double lambda=atan2(saturnEarth[1], saturnEarth[0]);836 return -4.0 + d + 0.01322*phaseDeg + 0.0000004247*phaseDeg*phaseDeg*phaseDeg;
852 double beta=atan2(saturnEarth[2], sqrt(saturnEarth[0]*saturnEarth[0]+saturnEarth[1]*saturnEarth[1]));837 if (englishName=="Mars")
853 const double sinB=sin(i)*cos(beta)*sin(lambda-Omega)-cos(i)*sin(beta);838 return -1.3 + d + 0.01486*phaseDeg;
854 double rings = -2.6*fabs(sinB) + 1.25*sinB*sinB; // sinx=sinB, saturnicentric latitude of earth. longish, see Meeus.839 if (englishName=="Jupiter")
855 return -8.88 + d + 0.044*phaseDeg + rings;840 return -8.93 + d;
856 }841 if (englishName=="Saturn")
857 if (englishName=="Uranus")842 {
858 return -7.19f + d;843 // add rings computation
859 if (englishName=="Neptune")844 // implemented from Meeus, Astr.Alg.1992
860 return -6.87f + d;845 const double jd=core->getJDay();
861 if (englishName=="Pluto")846 const double T=(jd-2451545.0)/36525.0;
862 return -1.00f + d;847 const double i=((0.000004*T-0.012998)*T+28.075216)*M_PI/180.0;
863 */848 const double Omega=((0.000412*T+1.394681)*T+169.508470)*M_PI/180.0;
864 // TODO: decide which set of formulae is best?849 SolarSystem *ssystem=GETSTELMODULE(SolarSystem);
850 const Vec3d saturnEarth=getHeliocentricEclipticPos() - ssystem->getEarth()->getHeliocentricEclipticPos();
851 double lambda=atan2(saturnEarth[1], saturnEarth[0]);
852 double beta=atan2(saturnEarth[2], sqrt(saturnEarth[0]*saturnEarth[0]+saturnEarth[1]*saturnEarth[1]));
853 const double sinB=sin(i)*cos(beta)*sin(lambda-Omega)-cos(i)*sin(beta);
854 double rings = -2.6*fabs(sinB) + 1.25*sinB*sinB; // sinx=sinB, saturnicentric latitude of earth. longish, see Meeus.
855 return -8.68 + d + 0.044*phaseDeg + rings;
856 }
857 if (englishName=="Uranus")
858 return -6.85 + d;
859 if (englishName=="Neptune")
860 return -7.05 + d;
861 if (englishName=="Pluto")
862 return -1.0 + d;
863
864 break;
865 }
866 case Harris:
867 case UndefinedAlgorithm: // activated by default
868 {
869 // (2)
870 if (englishName=="Mercury")
871 return 0.42 + d + .038*phaseDeg - 0.000273*phaseDeg*phaseDeg + 0.000002*phaseDeg*phaseDeg*phaseDeg;
872 if (englishName=="Venus")
873 return -4.40 + d + 0.0009*phaseDeg + 0.000239*phaseDeg*phaseDeg - 0.00000065*phaseDeg*phaseDeg*phaseDeg;
874 if (englishName=="Mars")
875 return -1.52 + d + 0.016*phaseDeg;
876 if (englishName=="Jupiter")
877 return -9.40 + d + 0.005*phaseDeg;
878 if (englishName=="Saturn")
879 {
880 // add rings computation
881 // implemented from Meeus, Astr.Alg.1992
882 const double jd=core->getJDay();
883 const double T=(jd-2451545.0)/36525.0;
884 const double i=((0.000004*T-0.012998)*T+28.075216)*M_PI/180.0;
885 const double Omega=((0.000412*T+1.394681)*T+169.508470)*M_PI/180.0;
886 static SolarSystem *ssystem=GETSTELMODULE(SolarSystem);
887 const Vec3d saturnEarth=getHeliocentricEclipticPos() - ssystem->getEarth()->getHeliocentricEclipticPos();
888 double lambda=atan2(saturnEarth[1], saturnEarth[0]);
889 double beta=atan2(saturnEarth[2], sqrt(saturnEarth[0]*saturnEarth[0]+saturnEarth[1]*saturnEarth[1]));
890 const double sinB=sin(i)*cos(beta)*sin(lambda-Omega)-cos(i)*sin(beta);
891 double rings = -2.6*fabs(sinB) + 1.25*sinB*sinB; // sinx=sinB, saturnicentric latitude of earth. longish, see Meeus.
892 return -8.88 + d + 0.044*phaseDeg + rings;
893 }
894 if (englishName=="Uranus")
895 return -7.19f + d;
896 if (englishName=="Neptune")
897 return -6.87f + d;
898 if (englishName=="Pluto")
899 return -1.00f + d;
900
901 break;
902 }
903 }
865 }904 }
866905
867 // This formula seems to give wrong results906 // This formula seems to give wrong results
@@ -1707,3 +1746,8 @@
1707 labelsFader.update(deltaTime);1746 labelsFader.update(deltaTime);
1708 orbitFader.update(deltaTime);1747 orbitFader.update(deltaTime);
1709}1748}
1749
1750void Planet::setApparentMagnitudeAlgorithm(QString algorithm)
1751{
1752 vMagAlgorithm = vMagAlgorithmMap.key(algorithm.toLower(), Planet::UndefinedAlgorithm);
1753}
17101754
=== modified file 'src/core/modules/Planet.hpp'
--- src/core/modules/Planet.hpp 2014-08-31 10:34:41 +0000
+++ src/core/modules/Planet.hpp 2014-11-01 17:59:05 +0000
@@ -76,6 +76,7 @@
76 friend class SolarSystem;76 friend class SolarSystem;
7777
78 Q_ENUMS(PlanetType)78 Q_ENUMS(PlanetType)
79 Q_ENUMS(ApparentMagnitudeAlgorithm)
79 //! numeric typecodes for the type descriptions in ssystem.ini80 //! numeric typecodes for the type descriptions in ssystem.ini
80 // GZ: Until 0.13 QStrings were used for types.81 // GZ: Until 0.13 QStrings were used for types.
81 // GZ: Enums are slightly faster than string comparisons in time-critical comparisons.82 // GZ: Enums are slightly faster than string comparisons in time-critical comparisons.
@@ -91,6 +92,14 @@
91 isUNDEFINED // ssystem.ini: type=<anything else>92 isUNDEFINED // ssystem.ini: type=<anything else>
92 };93 };
9394
95 enum ApparentMagnitudeAlgorithm
96 {
97 Planesas, // Algorithm provided by Pere Planesas (Observatorio Astronomico Nacional)
98 Mueller, // G. Mueller, based on visual observations 1877-91. [Expl.Suppl.1961]
99 Harris, // Astronomical Almanac 1984 and later. These give V (instrumental) magnitudes (D.L. Harris)
100 UndefinedAlgorithm
101 };
102
94 Planet(const QString& englishName,103 Planet(const QString& englishName,
95 int flagLighting,104 int flagLighting,
96 double radius,105 double radius,
@@ -170,6 +179,10 @@
170 const QString getPlanetTypeString() const {return pTypeMap.value(pType);}179 const QString getPlanetTypeString() const {return pTypeMap.value(pType);}
171 PlanetType getPlanetType() const {return pType;}180 PlanetType getPlanetType() const {return pType;}
172181
182 ApparentMagnitudeAlgorithm getApparentMagnitudeAlgorithm() const { return vMagAlgorithm; }
183 const QString getApparentMagnitudeAlgorithmString() const { return vMagAlgorithmMap.value(vMagAlgorithm); }
184 void setApparentMagnitudeAlgorithm(QString algorithm);
185
173 // Compute the z rotation to use from equatorial to geographic coordinates186 // Compute the z rotation to use from equatorial to geographic coordinates
174 double getSiderealTime(double jd) const;187 double getSiderealTime(double jd) const;
175 Mat4d getRotEquatorialToVsop87(void) const;188 Mat4d getRotEquatorialToVsop87(void) const;
@@ -313,13 +326,15 @@
313 bool flagLabels; // Define whether labels should be displayed326 bool flagLabels; // Define whether labels should be displayed
314 bool hidden; // useful for fake planets used as observation positions - not drawn or labeled327 bool hidden; // useful for fake planets used as observation positions - not drawn or labeled
315 bool atmosphere; // Does the planet have an atmosphere?328 bool atmosphere; // Does the planet have an atmosphere?
316 bool halo; // Does the planet have a halo?329 bool halo; // Does the planet have a halo?
317 // QString pTypeStr; // Type of body, old version just had a string here.330 PlanetType pType; // Type of body
318 PlanetType pType; // GZ this is now a proper type...331
332 ApparentMagnitudeAlgorithm vMagAlgorithm;
319333
320 static Vec3f labelColor;334 static Vec3f labelColor;
321 static StelTextureSP hintCircleTex;335 static StelTextureSP hintCircleTex;
322 static QMap<PlanetType, QString> pTypeMap; // GZ: maps fast type to english name.336 static QMap<PlanetType, QString> pTypeMap; // Maps fast type to english name.
337 static QMap<ApparentMagnitudeAlgorithm, QString> vMagAlgorithmMap;
323 338
324 // Shader-related variables339 // Shader-related variables
325 struct PlanetShaderVars {340 struct PlanetShaderVars {
326341
=== modified file 'src/core/modules/SolarSystem.cpp'
--- src/core/modules/SolarSystem.cpp 2014-08-31 10:34:41 +0000
+++ src/core/modules/SolarSystem.cpp 2014-11-01 17:59:05 +0000
@@ -136,6 +136,9 @@
136 setFlagOrbits(conf->value("astro/flag_planets_orbits").toBool());136 setFlagOrbits(conf->value("astro/flag_planets_orbits").toBool());
137 setFlagLightTravelTime(conf->value("astro/flag_light_travel_time", false).toBool());137 setFlagLightTravelTime(conf->value("astro/flag_light_travel_time", false).toBool());
138 setFlagMarkers(conf->value("astro/flag_planets_markers", true).toBool());138 setFlagMarkers(conf->value("astro/flag_planets_markers", true).toBool());
139 // Set the algorithm from Astronomical Almanac for computation of apparent magnitudes for
140 // planets in case observer on the Earth by default
141 setApparentMagnitudeAlgorithmOnEarth(conf->value("astro/apparent_magnitude_algorithm", "Harris").toString());
139142
140 recreateTrails();143 recreateTrails();
141144
@@ -1520,3 +1523,15 @@
1520 // Restore translations1523 // Restore translations
1521 updateI18n();1524 updateI18n();
1522}1525}
1526
1527// Set the algorithm for computation of apparent magnitudes for planets in case observer on the Earth
1528void SolarSystem::setApparentMagnitudeAlgorithmOnEarth(QString algorithm)
1529{
1530 getEarth()->setApparentMagnitudeAlgorithm(algorithm);
1531}
1532
1533// Get the algorithm used for computation of apparent magnitudes for planets in case observer on the Earth
1534QString SolarSystem::getApparentMagnitudeAlgorithmOnEarth() const
1535{
1536 return getEarth()->getApparentMagnitudeAlgorithmString();
1537}
15231538
=== modified file 'src/core/modules/SolarSystem.hpp'
--- src/core/modules/SolarSystem.hpp 2014-08-30 16:58:25 +0000
+++ src/core/modules/SolarSystem.hpp 2014-11-01 17:59:05 +0000
@@ -261,6 +261,24 @@
261 //! @return a phase261 //! @return a phase
262 float getPhaseForPlanet(QString planetName) const;262 float getPhaseForPlanet(QString planetName) const;
263263
264 //! Set the algorithm for computation of apparent magnitudes for planets in case observer on the Earth.
265 //! Possible values:
266 //! * Planesas (algorithm provided by Pere Planesas (Observatorio Astronomico Nacional))
267 //! * Mueller (G. Mueller, based on visual observations 1877-91. [Expl.Suppl.1961])
268 //! * Harris (Astronomical Almanac 1984 and later. These give V (instrumental) magnitudes)
269 //! Details:
270 //! J. Meeus "Astronomical Algorithms" (2nd ed., with corrections as of August 10, 2009) p.283-286.
271 //! O. Montenbruck, T. Pfleger "Astronomy on the Personal Computer" (4th ed.) p.143-145.
272 //! Daniel L. Harris "Photometry and Colorimetry of Planets and Satellites" http://adsabs.harvard.edu/abs/1961plsa.book..272H
273 //! Hint: Default option in config.ini: astro/apparent_magnitude_algorithm = Harris
274 //! @param algorithm the case in-sensitive algorithm name
275 //! @note: The structure of algorithms is almost identical, just the numbers are different! You should activate
276 //! Mueller's algorithm for simulate the eye's impression. (Esp. Venus!)
277 void setApparentMagnitudeAlgorithmOnEarth(QString algorithm);
278
279 //! Get the algorithm used for computation of apparent magnitudes for planets in case observer on the Earth
280 QString getApparentMagnitudeAlgorithmOnEarth() const;
281
264public:282public:
265 ///////////////////////////////////////////////////////////////////////////283 ///////////////////////////////////////////////////////////////////////////
266 // Other public methods284 // Other public methods