Merge lp:~georg-zotti/stellarium/extinction into lp:stellarium

Proposed by gzotti
Status: Merged
Merged at revision: 5101
Proposed branch: lp:~georg-zotti/stellarium/extinction
Merge into: lp:stellarium
Diff against target: 1234 lines (+444/-174)
29 files modified
CHANGES-FROM-TRUNK.txt (+34/-28)
data/default_config.ini (+1/-0)
plugins/Quasars/src/Quasar.cpp (+34/-10)
plugins/Quasars/src/Quasar.hpp (+1/-1)
plugins/Satellites/src/Satellite.cpp (+10/-2)
plugins/Satellites/src/Satellite.hpp (+1/-1)
plugins/Supernovae/src/Supernova.cpp (+19/-5)
plugins/Supernovae/src/Supernova.hpp (+1/-1)
src/core/RefractionExtinction.cpp (+16/-3)
src/core/RefractionExtinction.hpp (+29/-22)
src/core/StelObject.cpp (+24/-13)
src/core/StelObject.hpp (+1/-1)
src/core/StelSkyDrawer.cpp (+14/-4)
src/core/modules/Comet.cpp (+18/-4)
src/core/modules/Comet.hpp (+1/-1)
src/core/modules/Constellation.cpp (+1/-1)
src/core/modules/ConstellationMgr.hpp (+1/-1)
src/core/modules/LandscapeMgr.cpp (+1/-1)
src/core/modules/MinorPlanet.cpp (+21/-6)
src/core/modules/MinorPlanet.hpp (+1/-1)
src/core/modules/Nebula.cpp (+23/-4)
src/core/modules/Nebula.hpp (+1/-1)
src/core/modules/Planet.cpp (+115/-28)
src/core/modules/Planet.hpp (+1/-1)
src/core/modules/StarMgr.cpp (+8/-3)
src/core/modules/StarMgr.hpp (+1/-1)
src/core/modules/StarWrapper.cpp (+18/-6)
src/core/modules/StarWrapper.hpp (+10/-3)
src/core/modules/ZoneArray.cpp (+38/-21)
To merge this branch: bzr merge lp:~georg-zotti/stellarium/extinction
Reviewer Review Type Date Requested Status
gzotti Needs Resubmitting
Alexander Wolf Approve
Bogdan Marinov Needs Fixing
Review via email: mp+86985@code.launchpad.net

Commit message

Extinction for point-like objects

Description of the change

Extinction (reduced symbol size) and textual info on reduced magnitudes work for all (?) point-like and planetary objects.

I don't know how to process Milky Way and the nebulous images, help welcome!

Extinction introduces a new entry in config.ini:
[astro]/flag_extinction_below_horizon=(true|false).
[edited to follow Bogdan's suggestion]

If true, objects lower than -2 degrees are extincted with 42 airmasses (just below horizontal... ;-), if false, 0, i.e., they are bright again below the horizon.

To post a comment you must log in.
Revision history for this message
Alexander Wolf (alexwolf) wrote :

You need add [astro]/subhorizontal_extinction to default_config.ini and set some default setting value. Also we added new plugin with stellar objects - Quasars - I think you can copy code for this plugin from Supernovae plugin.

review: Needs Fixing
Revision history for this message
Bogdan Marinov (daggerstab) wrote :

Also, for consistency, it should be something like "astro/flag_extinction_below_horizon".

review: Needs Fixing
4977. By gzotti

added extinction to Quasars plugin.
harmonized infostrings.
renamed flag, added to default_config.ini

4978. By gzotti

fixed Supernova::getSelectPriority()

4979. By gzotti

updated docs

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

Work looks is very good!

review: Approve
4980. By gzotti

docfix

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

@Alex: OK, I was not aware of the default_config.ini. Quasars is done.
@Bogdan: OK, name changed

I hope it's all done now for the point sources.

Note that I also implemented 2 more sets of planetary magnitude computation (I forgot that already...), including the missing Saturn's rings magnitude contribution which was marked TODO. For Stellarium, I think the classical naked-eye "visual" magnitudes are preferrable over instrumental "V" magnitudes. Whichever solution you choose, please do not delete the other implementations.

Yours, Georg.

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

Oops, we crossed...

The last changes are small, mostly docfixes and cosmetics.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'CHANGES-FROM-TRUNK.txt'
--- CHANGES-FROM-TRUNK.txt 2010-12-07 15:22:03 +0000
+++ CHANGES-FROM-TRUNK.txt 2011-12-29 12:15:27 +0000
@@ -1,35 +1,44 @@
1REFRACTION branch:1EXTINCTION branch:
22
3Introduces changes necessary for refraction and extinction effects. 3Introduces changes necessary for extinction effects.
44
5Status: Partial solution, needs help.5Status: Partial solution, needs help.
66
7Contributor: Georg.Zotti@univie.ac.at7Contributor: Georg.Zotti@univie.ac.at
8All changes are donated to the Stellarium project for distribution under opensource licenses like GNU.8All changes are donated to the Stellarium project for distribution under opensource licenses like GNU.
99
10COMPUTING: core/RefractionExtinction. DONE10
11STARS: core/modules/ZoneArray::draw11
12 BUG: stars appear to have a problem after magnitude loss.12
13+SELECT-MARK: StarMgr.cpp::drawPointer(). DONE132011-Oct: A new attempt in Extinction:
14CLICK-IDENTIFY: core/StelObjectMgr::cleverFind(core, x, y) DONE14=========================================
15INFOSTRING: core/StelObject.cpp::getPositionInfoString(core, flags) DONE15
16 new core/StelObject.cpp::getSideralPosRefr(core) DONE16StelObject and derived classes: getVMagnitude() has new optional arg: withExtinction.
17DEEPSKY: NebulaMgr::draw(). Influences symbols and labels only.17This should be set to true only for determining magnitude for drawing (draw()) and also for textual info (getInfoString()),
18+DSO TEXTURES: ---TODO. May require a vertex shader program, beyond my knowledge.18not e.g. for selection (getSelectPriority()).
19+SELECT-MARK: NebulaMgr::drawPointer(). DONE19It will also only change the result if atmosphere rendering is ON.
20+MILKY WAY: Should become dimmer in low sky. May require a vertex shader program, beyond my knowledge.20
21PLANETS: ---TODO. Involves StelPainter, 3D spheres, full matrices. 21StelSkyDrawer::drawPointSource
22 May require a vertex shader program, beyond my knowledge, sorry.22StelObject::getVMagnitude
23+SELECT-MARK: SolarSystem::drawPointer. DONE23Satellite::getVMagnitude, ::getInfoString
24RA-DEC+GAL.GRIDS: core/GridLinesMgr. TODO OR LEAVE-AS-IS24Supernova::getVMagnitude, ::getInfoString
25 Requires changes in StelPainter's arc drawing methods.25Quasar::getVMagnitude, ::getInfoString
26 Currently this seems not viable and will not be changed.26Satellite::getVMagnitude
27SATELLITES: Not required, practically unobservable on horizon, orbital parameters unsure, etc.27Planet::getVMagnitude, ::getInfoString
28 Should be easy, however.28Comet::getVMagnitude, ::getInfoString
29CONSTELLATIONS: Large-scale items. Vertices could be refracted. Extinction would be a nice effect. 29MinorPlanet::getVMagnitude, ::getInfoString
30 Not urgent, later.30Nebula::getVMagnitude, ::getInfoString
31METEORS NOT NECESSARY.31StarWrapper::getInfoString
32OTHER? ???32
33I currently have no solution for extended objects! Therefore ...
34
35TODO: Milky Way, Nebula figures, Constellations??
36
37
38
39================================================================================
40
41TODO, but maybe in yet another branch: See implementation in abandoned refraction branch!
3342
34CHANGES IN LANDSCAPE HANDLING:43CHANGES IN LANDSCAPE HANDLING:
351) Moved config.ini:[stars].init_bortle_scale to [landscape] section441) Moved config.ini:[stars].init_bortle_scale to [landscape] section
@@ -43,9 +52,6 @@
43 LandscapeMgr forwards those settings to the respective recipients. 52 LandscapeMgr forwards those settings to the respective recipients.
44 TODO: make GUI aware of changed values (how?).53 TODO: make GUI aware of changed values (how?).
4554
46GUI changes: ViewDialog.ui
47added 3 DoubleSpinBoxes for temperature, pressure, extinction coefficient into atmosphereGroupBox
48ViewDialog.cpp: TODO: when switching landscapes, new data only load partially into GUI. No idea why!
4955
50CHANGES IN ASTR.COMPUTATIONS56CHANGES IN ASTR.COMPUTATIONS
51planetsephems/sideral_time.[hc]: added get_mean_ecliptical_obliquity(double JDE), 57planetsephems/sideral_time.[hc]: added get_mean_ecliptical_obliquity(double JDE),
5258
=== modified file 'data/default_config.ini'
--- data/default_config.ini 2011-12-18 20:43:39 +0000
+++ data/default_config.ini 2011-12-29 12:15:27 +0000
@@ -221,6 +221,7 @@
221flag_nebula_name = false221flag_nebula_name = false
222flag_nebula_long_name = false222flag_nebula_long_name = false
223flag_nebula_display_no_texture = false223flag_nebula_display_no_texture = false
224flag_extinction_below_horizon = true
224max_mag_nebula_name = 8225max_mag_nebula_name = 8
225nebula_scale = 1226nebula_scale = 1
226flag_milky_way = true227flag_milky_way = true
227228
=== modified file 'plugins/Quasars/src/Quasar.cpp'
--- plugins/Quasars/src/Quasar.cpp 2011-12-18 15:37:49 +0000
+++ plugins/Quasars/src/Quasar.cpp 2011-12-29 12:15:27 +0000
@@ -75,31 +75,47 @@
75float Quasar::getSelectPriority(const StelCore* core) const75float Quasar::getSelectPriority(const StelCore* core) const
76{76{
77 //Same as StarWrapper::getSelectPriority()77 //Same as StarWrapper::getSelectPriority()
78 return getVMagnitude(core);78 return getVMagnitude(core, false);
79}79}
8080
81QString Quasar::getInfoString(const StelCore* core, const InfoStringGroup& flags) const81QString Quasar::getInfoString(const StelCore* core, const InfoStringGroup& flags) const
82{82{
83 QString str;83 QString str;
84 QTextStream oss(&str);84 QTextStream oss(&str);
85 double mag = getVMagnitude(core);85 double mag = getVMagnitude(core, false);
8686
87 if (flags&Name)87 if (flags&Name)
88 {88 {
89 oss << "<h2>" << designation << "</h2>";89 oss << "<h2>" << designation << "</h2>";
90 }90 }
91
92 if (flags&Magnitude && mag <= core->getSkyDrawer()->getLimitMagnitude())91 if (flags&Magnitude && mag <= core->getSkyDrawer()->getLimitMagnitude())
93 {92 {
94 if (bV!=0)93 if (core->getSkyDrawer()->getFlagHasAtmosphere())
94 {
95 if (bV!=0)
95 {96 {
96 oss << q_("Magnitude: <b>%1</b> (B-V: %2)").arg(mag, 0, 'f', 2).arg(bV, 0, 'f', 2) << "<br>";97 oss << q_("Magnitude: <b>%1</b> (extincted to: <b>%2</b>. B-V: <b>%3</b>)").arg(QString::number(mag, 'f', 2),
98 QString::number(getVMagnitude(core, true), 'f', 2),
99 QString::number(bV, 'f', 2)) << "<br>";
97 }100 }
98 else101 else
99 {102 {
100 oss << q_("Magnitude: <b>%1</b>").arg(mag, 0, 'f', 2) << "<br>";103 oss << q_("Magnitude: <b>%1</b> (extincted to: <b>%2</b>)").arg(QString::number(mag, 'f', 2),
104 QString::number(getVMagnitude(core, true), 'f', 2)) << "<br>";
101 }105 }
102 if (AMagnitude!=0)106 }
107 else
108 {
109 if (bV!=0)
110 {
111 oss << q_("Magnitude: <b>%1</b> (B-V: <b>%2</b>)").arg(mag, 0, 'f', 2).arg(bV, 0, 'f', 2) << "<br>";
112 }
113 else
114 {
115 oss << q_("Magnitude: <b>%1</b>").arg(mag, 0, 'f', 2) << "<br>";
116 }
117 }
118 if (AMagnitude!=0)
103 {119 {
104 oss << q_("Absolute Magnitude: %1").arg(AMagnitude, 0, 'f', 2) << "<br>";120 oss << q_("Absolute Magnitude: %1").arg(AMagnitude, 0, 'f', 2) << "<br>";
105 }121 }
@@ -126,9 +142,17 @@
126 return StelApp::getInstance().getVisionModeNight() ? Vec3f(0.6, 0.0, 0.0) : Vec3f(1.0, 1.0, 1.0);142 return StelApp::getInstance().getVisionModeNight() ? Vec3f(0.6, 0.0, 0.0) : Vec3f(1.0, 1.0, 1.0);
127}143}
128144
129float Quasar::getVMagnitude(const StelCore* core) const145float Quasar::getVMagnitude(const StelCore* core, bool withExtinction) const
130{146{
131 return VMagnitude; 147 float extinctionMag=0.0; // track magnitude loss
148 if (withExtinction && core->getSkyDrawer()->getFlagHasAtmosphere())
149 {
150 Vec3d altAz=getAltAzPosApparent(core);
151 altAz.normalize();
152 core->getSkyDrawer()->getExtinction().forward(&altAz[2], &extinctionMag);
153 }
154
155 return VMagnitude + extinctionMag;
132}156}
133157
134double Quasar::getAngularSize(const StelCore*) const158double Quasar::getAngularSize(const StelCore*) const
@@ -150,7 +174,7 @@
150 double mag;174 double mag;
151175
152 StelUtils::spheToRect(qRA, qDE, XYZ);176 StelUtils::spheToRect(qRA, qDE, XYZ);
153 mag = getVMagnitude(core);177 mag = getVMagnitude(core, true);
154 178
155 if (mag <= sd->getLimitMagnitude())179 if (mag <= sd->getLimitMagnitude())
156 {180 {
157181
=== modified file 'plugins/Quasars/src/Quasar.hpp'
--- plugins/Quasars/src/Quasar.hpp 2011-12-11 12:51:25 +0000
+++ plugins/Quasars/src/Quasar.hpp 2011-12-29 12:15:27 +0000
@@ -65,7 +65,7 @@
65 {65 {
66 return XYZ;66 return XYZ;
67 }67 }
68 virtual float getVMagnitude(const StelCore* core) const;68 virtual float getVMagnitude(const StelCore* core, bool withExtinction=false) const;
69 virtual double getAngularSize(const StelCore* core) const;69 virtual double getAngularSize(const StelCore* core) const;
70 virtual QString getNameI18n(void) const70 virtual QString getNameI18n(void) const
71 {71 {
7272
=== modified file 'plugins/Satellites/src/Satellite.cpp'
--- plugins/Satellites/src/Satellite.cpp 2011-12-17 07:51:42 +0000
+++ plugins/Satellites/src/Satellite.cpp 2011-12-29 12:15:27 +0000
@@ -326,9 +326,17 @@
326 return StelApp::getInstance().getVisionModeNight() ? Vec3f(0.6, 0.0, 0.0) : hintColor;326 return StelApp::getInstance().getVisionModeNight() ? Vec3f(0.6, 0.0, 0.0) : hintColor;
327}327}
328328
329float Satellite::getVMagnitude(const StelCore*) const329float Satellite::getVMagnitude(const StelCore* core, bool withExtinction) const
330{330{
331 return 5.0;331 float extinctionMag=0.0; // track magnitude loss
332 if (withExtinction && core->getSkyDrawer()->getFlagHasAtmosphere())
333 {
334 Vec3d altAz=getAltAzPosApparent(core);
335 altAz.normalize();
336 core->getSkyDrawer()->getExtinction().forward(&altAz[2], &extinctionMag);
337 }
338
339 return 5.0 + extinctionMag;
332}340}
333341
334double Satellite::getAngularSize(const StelCore*) const342double Satellite::getAngularSize(const StelCore*) const
335343
=== modified file 'plugins/Satellites/src/Satellite.hpp'
--- plugins/Satellites/src/Satellite.hpp 2011-12-14 10:31:15 +0000
+++ plugins/Satellites/src/Satellite.hpp 2011-12-29 12:15:27 +0000
@@ -84,7 +84,7 @@
84 {84 {
85 return XYZ;85 return XYZ;
86 }86 }
87 virtual float getVMagnitude(const StelCore* core=NULL) const;87 virtual float getVMagnitude(const StelCore* core=NULL, bool withExtinction=false) const;
88 virtual double getAngularSize(const StelCore* core) const;88 virtual double getAngularSize(const StelCore* core) const;
89 virtual QString getNameI18n(void) const89 virtual QString getNameI18n(void) const
90 {90 {
9191
=== modified file 'plugins/Supernovae/src/Supernova.cpp'
--- plugins/Supernovae/src/Supernova.cpp 2011-08-28 16:38:25 +0000
+++ plugins/Supernovae/src/Supernova.cpp 2011-12-29 12:15:27 +0000
@@ -77,14 +77,14 @@
77float Supernova::getSelectPriority(const StelCore* core) const77float Supernova::getSelectPriority(const StelCore* core) const
78{78{
79 //Same as StarWrapper::getSelectPriority()79 //Same as StarWrapper::getSelectPriority()
80 return getVMagnitude(core);80 return getVMagnitude(core, false);
81}81}
8282
83QString Supernova::getInfoString(const StelCore* core, const InfoStringGroup& flags) const83QString Supernova::getInfoString(const StelCore* core, const InfoStringGroup& flags) const
84{84{
85 QString str;85 QString str;
86 QTextStream oss(&str);86 QTextStream oss(&str);
87 double mag = getVMagnitude(core);87 double mag = getVMagnitude(core, false);
8888
89 if (flags&Name)89 if (flags&Name)
90 {90 {
@@ -96,7 +96,13 @@
96 }96 }
9797
98 if (flags&Magnitude && mag <= core->getSkyDrawer()->getLimitMagnitude())98 if (flags&Magnitude && mag <= core->getSkyDrawer()->getLimitMagnitude())
99 {
100 if (core->getSkyDrawer()->getFlagHasAtmosphere())
101 oss << q_("Magnitude: <b>%1</b> (extincted to: <b>%2</b>)").arg(QString::number(getVMagnitude(core, false), 'f', 2),
102 QString::number(getVMagnitude(core, true), 'f', 2)) << "<br>";
103 else
99 oss << q_("Magnitude: <b>%1</b>").arg(mag, 0, 'f', 2) << "<br>";104 oss << q_("Magnitude: <b>%1</b>").arg(mag, 0, 'f', 2) << "<br>";
105 }
100106
101 // Ra/Dec etc.107 // Ra/Dec etc.
102 oss << getPositionInfoString(core, flags);108 oss << getPositionInfoString(core, flags);
@@ -117,8 +123,16 @@
117 return StelApp::getInstance().getVisionModeNight() ? Vec3f(0.6, 0.0, 0.0) : Vec3f(1.0, 1.0, 1.0);123 return StelApp::getInstance().getVisionModeNight() ? Vec3f(0.6, 0.0, 0.0) : Vec3f(1.0, 1.0, 1.0);
118}124}
119125
120float Supernova::getVMagnitude(const StelCore* core) const126float Supernova::getVMagnitude(const StelCore* core, bool withExtinction) const
121{127{
128 float extinctionMag=0.0; // track magnitude loss
129 if (withExtinction && core->getSkyDrawer()->getFlagHasAtmosphere())
130 {
131 Vec3d altAz=getAltAzPosApparent(core);
132 altAz.normalize();
133 core->getSkyDrawer()->getExtinction().forward(&altAz[2], &extinctionMag);
134 }
135
122 double vmag = 20;136 double vmag = 20;
123 double currentJD = core->getJDay();137 double currentJD = core->getJDay();
124 double deltaJD = std::abs(peakJD-currentJD);138 double deltaJD = std::abs(peakJD-currentJD);
@@ -172,7 +186,7 @@
172 if (vmag<maxMagnitude)186 if (vmag<maxMagnitude)
173 vmag = maxMagnitude;187 vmag = maxMagnitude;
174188
175 return vmag; 189 return vmag + extinctionMag;
176}190}
177191
178double Supernova::getAngularSize(const StelCore*) const192double Supernova::getAngularSize(const StelCore*) const
@@ -194,7 +208,7 @@
194 double mag;208 double mag;
195209
196 StelUtils::spheToRect(snra, snde, XYZ);210 StelUtils::spheToRect(snra, snde, XYZ);
197 mag = getVMagnitude(core);211 mag = getVMagnitude(core, true);
198 212
199 if (mag <= sd->getLimitMagnitude())213 if (mag <= sd->getLimitMagnitude())
200 {214 {
201215
=== modified file 'plugins/Supernovae/src/Supernova.hpp'
--- plugins/Supernovae/src/Supernova.hpp 2011-07-25 17:29:18 +0000
+++ plugins/Supernovae/src/Supernova.hpp 2011-12-29 12:15:27 +0000
@@ -65,7 +65,7 @@
65 {65 {
66 return XYZ;66 return XYZ;
67 }67 }
68 virtual float getVMagnitude(const StelCore* core) const;68 virtual float getVMagnitude(const StelCore* core, bool withExtinction=false) const;
69 virtual double getAngularSize(const StelCore* core) const;69 virtual double getAngularSize(const StelCore* core) const;
70 virtual QString getNameI18n(void) const70 virtual QString getNameI18n(void) const
71 {71 {
7272
=== modified file 'src/core/RefractionExtinction.cpp'
--- src/core/RefractionExtinction.cpp 2011-06-10 11:31:13 +0000
+++ src/core/RefractionExtinction.cpp 2011-12-29 12:15:27 +0000
@@ -20,17 +20,21 @@
20 * Principal implementation: 2010-03-23 GZ=Georg Zotti, Georg.Zotti@univie.ac.at20 * Principal implementation: 2010-03-23 GZ=Georg Zotti, Georg.Zotti@univie.ac.at
21 */21 */
2222
23#include <qsettings.h>
24#include "StelApp.hpp"
23#include "RefractionExtinction.hpp"25#include "RefractionExtinction.hpp"
2426
2527
26// To be decided: The following should be either 0 or 40 (or 42? ;-)28// To be decided: The following should be either 0 or 40 (or 42? ;-)
27const float Extinction::SUBHORIZONTAL_AIRMASS=0.0f;29float Extinction::SUBHORIZONTAL_AIRMASS=0.0f;
2830
29Extinction::Extinction() : ext_coeff(0.20f)31Extinction::Extinction() : ext_coeff(0.20f)
30{32{
33 QSettings* conf = StelApp::getInstance().getSettings();
34 SUBHORIZONTAL_AIRMASS = (conf->value("astro/flag_extinction_below_horizon", true).toBool()? 42.0f : 0.0f);
31}35}
3236
33// altAzPos is the normalized star position vector AFTER REFRACTION, and its z component sin(altitude).37// altAzPos is the NORMALIZED (!!!) star position vector AFTER REFRACTION, and its z component sin(altitude).
34void Extinction::forward(const Vec3d *altAzPos, float *mag, const int num) const38void Extinction::forward(const Vec3d *altAzPos, float *mag, const int num) const
35{39{
36 for (int i=0; i<num; ++i) mag[i] += airmass(altAzPos[i][2], true) * ext_coeff;40 for (int i=0; i<num; ++i) mag[i] += airmass(altAzPos[i][2], true) * ext_coeff;
@@ -48,6 +52,14 @@
48{52{
49 for (int i=0; i<num; ++i) mag[i] += airmass(sinAlt[i], true) * ext_coeff;53 for (int i=0; i<num; ++i) mag[i] += airmass(sinAlt[i], true) * ext_coeff;
50}54}
55void Extinction::forward(const double *sinAlt, float *mag) const
56{
57 *mag += airmass(*sinAlt, true) * ext_coeff;
58}
59void Extinction::forward(const float *sinAlt, float *mag) const
60{
61 *mag += airmass(*sinAlt, true) * ext_coeff;
62}
51// from observed magnitude in apparent (observed) altitude to atmosphere-free mag, still in apparent, refracted altitude.63// from observed magnitude in apparent (observed) altitude to atmosphere-free mag, still in apparent, refracted altitude.
52void Extinction::backward(const Vec3d *altAzPos, float *mag, const int num) const64void Extinction::backward(const Vec3d *altAzPos, float *mag, const int num) const
53{65{
@@ -70,7 +82,7 @@
70// airmass computation for cosine of zenith angle z82// airmass computation for cosine of zenith angle z
71float Extinction::airmass(const float cosZ, const bool apparent_z) const83float Extinction::airmass(const float cosZ, const bool apparent_z) const
72{84{
73 if (cosZ<-0.035f)85 if (cosZ<-0.035f) // about -2 degrees. Here, RozenbergZ>574 and climbs fast!
74 return Extinction::SUBHORIZONTAL_AIRMASS; // Safety: 0 or 40 for below -2 degrees.86 return Extinction::SUBHORIZONTAL_AIRMASS; // Safety: 0 or 40 for below -2 degrees.
7587
76 float X;88 float X;
@@ -89,6 +101,7 @@
89 return X;101 return X;
90}102}
91103
104/* ***************************************************************************************************** */
92105
93// The following 4 are to be configured, the rest is derived.106// The following 4 are to be configured, the rest is derived.
94// Recommendations: -4.9/-4.3/0.1/0.1: sharp but continuous transition, no effects below -5.107// Recommendations: -4.9/-4.3/0.1/0.1: sharp but continuous transition, no effects below -5.
95108
=== modified file 'src/core/RefractionExtinction.hpp'
--- src/core/RefractionExtinction.hpp 2011-06-10 11:31:13 +0000
+++ src/core/RefractionExtinction.hpp 2011-12-29 12:15:27 +0000
@@ -31,41 +31,39 @@
31#include "VecMath.hpp"31#include "VecMath.hpp"
32#include "StelProjector.hpp"32#include "StelProjector.hpp"
3333
34//! @class RefractionExtinction34//! @class Extinction
35//! This class performs refraction and extinction computations, following literature from atmospheric optics and astronomy.35//! This class performs extinction computations, following literature from atmospheric optics and astronomy.
36//! Airmass computations are limited to meaningful altitudes,36//! Airmass computations are limited to meaningful altitudes.
37//! and refraction solutions can only be aproximate, given the turbulent, unpredictable real atmosphere.
38//! The solution provided here will [hopefully!] result in a visible "zone of avoidance" near the horizon down to altitude -2,37//! The solution provided here will [hopefully!] result in a visible "zone of avoidance" near the horizon down to altitude -2,
39//! and will show stars in their full brightness at their geometrical positions below -5 degrees.38//! and may show stars in their full brightness below -2 degrees.
40//! Of course, plotting stars below the horizon could be coupled to setting of horizon foreground,39//! Typical horizons do not go down below -1, so all natural sites should be covered.
41//! it's another usability issue. Typical horizons do not go down below -1, so strange effects between -2 and -5 should be covered.
42//! Note that forward/backward are no absolute reverse operations!40//! Note that forward/backward are no absolute reverse operations!
43//! All the computations should be in effect41//! All the computations should be in effect
44//! (1) only if atmosphere effects are true42//! (1) only if atmosphere effects are true
45//! (2) only for celestial objects, never for landscape coordinates43//! (2) only for terrestrial locations, not on Moon/Mars/Saturn etc
46//! (3) only for terrestrial locations, not on Moon/Mars/Saturn etc44//! config.ini:astro/flag_extinction_below_horizon=true|false controls if extinction kills objects below -2 degrees altitude by setting airmass to 42.
47class Extinction45class Extinction
48{46{
49public:47public:
50 Extinction();48 Extinction();
51 //! Compute extinction effect for arrays of size @param num position vectors and magnitudes.49 //! Compute extinction effect for arrays of size @param num position vectors and magnitudes.
52 //! @param altAzPos are the normalized (apparent) star position vectors, and their z components sin(apparent_altitude).50 //! @param altAzPos are the NORMALIZED (!!) (apparent) star position vectors, and their z components sin(apparent_altitude).
53 //! This call must therefore be done after application of Refraction, and only if atmospheric effects are on.51 //! This call must therefore be done after application of Refraction, and only if atmospheric effects are on.
54 //! Note that forward/backward are no absolute reverse operations!52 //! Note that forward/backward are no absolute reverse operations!
55 void forward(const Vec3d *altAzPos, float *mag, const int num) const;53 void forward(const Vec3d *altAzPos, float *mag, const int num=1) const;
56 void forward(const Vec3f *altAzPos, float *mag, const int num) const;54 void forward(const Vec3f *altAzPos, float *mag, const int num=1) const;
57 //! Convenience method for the same
58 void forward(const double *sinAlt, float *mag, const int num) const;55 void forward(const double *sinAlt, float *mag, const int num) const;
59 void forward(const float *sinAlt, float *mag, const int num) const;56 void forward(const float *sinAlt, float *mag, const int num) const;
57 void forward(const double *sinAlt, float *mag) const;
58 void forward(const float *sinAlt, float *mag) const;
6059
61 //! Compute extinction effect for arrays of size @param size position vectors and magnitudes.60 //! Compute inverse extinction effect for arrays of size @param num position vectors and magnitudes.
62 //! @param altAzPos are the normalized (apparent) star position vectors, and their z components sin(apparent_altitude).61 //! @param altAzPos are the NORMALIZED (!!) (apparent) star position vectors, and their z components sin(apparent_altitude).
63 //! Note that forward/backward are no absolute reverse operations!62 //! Note that forward/backward are no absolute reverse operations!
64 void backward(const Vec3d *altAzPos, float *mag, const int num) const;63 void backward(const Vec3d *altAzPos, float *mag, const int num=1) const;
65 void backward(const Vec3f *altAzPos, float *mag, const int num) const;64 void backward(const Vec3f *altAzPos, float *mag, const int num=1) const;
66 //! Convenience method for the same65 void backward(const double *sinAlt, float *mag, const int num=1) const;
67 void backward(const double *sinAlt, float *mag, const int num) const;66 void backward(const float *sinAlt, float *mag, const int num=1) const;
68 void backward(const float *sinAlt, float *mag, const int num) const;
6967
70 //! Set visual extinction coefficient (mag/airmass), influences extinction computation.68 //! Set visual extinction coefficient (mag/airmass), influences extinction computation.
71 //! @param k= 0.1 for highest mountains, 0.2 for very good lowland locations, 0.35 for typical lowland, 0.5 in humid climates.69 //! @param k= 0.1 for highest mountains, 0.2 for very good lowland locations, 0.35 for typical lowland, 0.5 in humid climates.
@@ -84,11 +82,20 @@
8482
85 //! k, magnitudes/airmass, in [0.00, ... 1.00], (default 0.20).83 //! k, magnitudes/airmass, in [0.00, ... 1.00], (default 0.20).
86 float ext_coeff;84 float ext_coeff;
87 //! should be either 0.0 (stars visible in full brightness below horizon) or 40.0 (practically invisible)85 //! should be either 0.0 (stars visible in full brightness below horizon) or 40.0 (or 42? ;-) practically invisible)
88 //! Maybe make this a user-configurable option?86 //! Maybe make this a user-configurable option?
89 static const float SUBHORIZONTAL_AIRMASS;87 static float SUBHORIZONTAL_AIRMASS;
90};88};
9189
90//! @class Refraction
91//! This class performs refraction computations, following literature from atmospheric optics and astronomy.
92//! Refraction solutions can only be aproximate, given the turbulent, unpredictable real atmosphere.
93//! Typical horizons do not go down below -1, so strange effects (distortion) between -2 and -5 should be covered.
94//! Note that forward/backward are no absolute reverse operations!
95//! All the computations should be in effect
96//! (1) only if atmosphere effects are true
97//! (2) only for celestial objects, never for landscape images
98//! (3) only for terrestrial locations, not on Moon/Mars/Saturn etc
9299
93class Refraction: public StelProjector::ModelViewTranform100class Refraction: public StelProjector::ModelViewTranform
94{101{
95102
=== modified file 'src/core/StelObject.cpp'
--- src/core/StelObject.cpp 2011-06-08 15:08:06 +0000
+++ src/core/StelObject.cpp 2011-12-29 12:15:27 +0000
@@ -71,6 +71,7 @@
71// Format the positional info string contain J2000/of date/altaz/hour angle positions for the object71// Format the positional info string contain J2000/of date/altaz/hour angle positions for the object
72QString StelObject::getPositionInfoString(const StelCore *core, const InfoStringGroup& flags) const72QString StelObject::getPositionInfoString(const StelCore *core, const InfoStringGroup& flags) const
73{73{
74 bool withAtmosphere=core->getSkyDrawer()->getFlagHasAtmosphere();
74 QString res;75 QString res;
75 if (flags&RaDecJ2000)76 if (flags&RaDecJ2000)
76 {77 {
@@ -88,13 +89,18 @@
8889
89 if (flags&HourAngle)90 if (flags&HourAngle)
90 {91 {
91 double dec_sideral, ra_sideral;92 double dec_sidereal, ra_sidereal;
92 StelUtils::rectToSphe(&ra_sideral,&dec_sideral,getSideralPosGeometric(core));93 StelUtils::rectToSphe(&ra_sidereal,&dec_sidereal,getSideralPosGeometric(core));
93 ra_sideral = 2.*M_PI-ra_sideral;94 ra_sidereal = 2.*M_PI-ra_sidereal;
94 res += q_("Hour angle/DE: %1/%2").arg(StelUtils::radToHmsStr(ra_sideral), StelUtils::radToDmsStr(dec_sideral)) + " " + q_("(geometric)") + "<br>";95 if (withAtmosphere)
95 StelUtils::rectToSphe(&ra_sideral,&dec_sideral,getSideralPosApparent(core));96 {
96 ra_sideral = 2.*M_PI-ra_sideral;97 res += q_("Hour angle/DE: %1/%2").arg(StelUtils::radToHmsStr(ra_sidereal), StelUtils::radToDmsStr(dec_sidereal)) + " " + q_("(geometric)") + "<br>";
97 res += q_("Hour angle/DE: %1/%2").arg(StelUtils::radToHmsStr(ra_sideral), StelUtils::radToDmsStr(dec_sideral)) + " " + q_("(apparent)") + "<br>";98 StelUtils::rectToSphe(&ra_sidereal,&dec_sidereal,getSideralPosApparent(core));
99 ra_sidereal = 2.*M_PI-ra_sidereal;
100 res += q_("Hour angle/DE: %1/%2").arg(StelUtils::radToHmsStr(ra_sidereal), StelUtils::radToDmsStr(dec_sidereal)) + " " + q_("(apparent)") + "<br>";
101 }
102 else
103 res += q_("Hour angle/DE: %1/%2").arg(StelUtils::radToHmsStr(ra_sidereal), StelUtils::radToDmsStr(dec_sidereal)) + " " + "<br>";
98 }104 }
99105
100 if (flags&AltAzi)106 if (flags&AltAzi)
@@ -105,13 +111,18 @@
105 az = 3.*M_PI - az; // N is zero, E is 90 degrees111 az = 3.*M_PI - az; // N is zero, E is 90 degrees
106 if (az > M_PI*2)112 if (az > M_PI*2)
107 az -= M_PI*2;113 az -= M_PI*2;
108 res += q_("Az/Alt: %1/%2").arg(StelUtils::radToDmsStr(az), StelUtils::radToDmsStr(alt)) + " " + q_("(geometric)") + "<br>";114 if (withAtmosphere)
115 {
116 res += q_("Az/Alt: %1/%2").arg(StelUtils::radToDmsStr(az), StelUtils::radToDmsStr(alt)) + " " + q_("(geometric)") + "<br>";
109117
110 StelUtils::rectToSphe(&az,&alt,getAltAzPosApparent(core));118 StelUtils::rectToSphe(&az,&alt,getAltAzPosApparent(core));
111 az = 3.*M_PI - az; // N is zero, E is 90 degrees119 az = 3.*M_PI - az; // N is zero, E is 90 degrees
112 if (az > M_PI*2)120 if (az > M_PI*2)
113 az -= M_PI*2;121 az -= M_PI*2;
114 res += q_("Az/Alt: %1/%2").arg(StelUtils::radToDmsStr(az), StelUtils::radToDmsStr(alt)) + " " + q_("(apparent)") + "<br>";122 res += q_("Az/Alt: %1/%2").arg(StelUtils::radToDmsStr(az), StelUtils::radToDmsStr(alt)) + " " + q_("(apparent)") + "<br>";
123 }
124 else
125 res += q_("Az/Alt: %1/%2").arg(StelUtils::radToDmsStr(az), StelUtils::radToDmsStr(alt)) + " " + "<br>";
115 }126 }
116 return res;127 return res;
117}128}
118129
=== modified file 'src/core/StelObject.hpp'
--- src/core/StelObject.hpp 2011-06-03 09:45:50 +0000
+++ src/core/StelObject.hpp 2011-12-29 12:15:27 +0000
@@ -120,7 +120,7 @@
120 Vec3d getAltAzPosAuto(const StelCore* core) const;120 Vec3d getAltAzPosAuto(const StelCore* core) const;
121121
122 //! Return object's apparent V magnitude as seen from observer122 //! Return object's apparent V magnitude as seen from observer
123 virtual float getVMagnitude(const StelCore*) const {return 99;}123 virtual float getVMagnitude(const StelCore*, bool withExtinction=false) const {return 99;}
124124
125 //! Return a priority value which is used to discriminate objects by priority125 //! Return a priority value which is used to discriminate objects by priority
126 //! As for magnitudes, the lower is the higher priority126 //! As for magnitudes, the lower is the higher priority
127127
=== modified file 'src/core/StelSkyDrawer.cpp'
--- src/core/StelSkyDrawer.cpp 2011-05-31 13:06:03 +0000
+++ src/core/StelSkyDrawer.cpp 2011-12-29 12:15:27 +0000
@@ -106,7 +106,7 @@
106 ok = true;106 ok = true;
107 }107 }
108108
109 //GZ: load 3 values from config for now. TODO: make adjustable with GUI!109 //GZ: load 3 values from config.
110 setExtinctionCoefficient(conf->value("landscape/atmospheric_extinction_coefficient",0.2).toDouble(&ok));110 setExtinctionCoefficient(conf->value("landscape/atmospheric_extinction_coefficient",0.2).toDouble(&ok));
111 if (!ok)111 if (!ok)
112 {112 {
@@ -242,6 +242,16 @@
242 fov = minAdaptFov;242 fov = minAdaptFov;
243 }243 }
244244
245 // GZ: Light pollution must take global atmosphere setting into acount!
246 // moved parts from setBortleScale() here
247 // These value have been calibrated by hand, looking at the faintest star in stellarium at around 40 deg FOV
248 // They should roughly match the scale described at http://en.wikipedia.org/wiki/Bortle_Dark-Sky_Scale
249 static const float bortleToInScale[9] = {2.45, 1.55, 1.0, 0.63, 0.40, 0.24, 0.23, 0.145, 0.09};
250 if (getFlagHasAtmosphere())
251 setInputScale(bortleToInScale[bortleScaleIndex-1]);
252 else
253 setInputScale(bortleToInScale[0]);
254
245 // This factor is fully arbitrary. It corresponds to the collecting area x exposure time of the instrument255 // This factor is fully arbitrary. It corresponds to the collecting area x exposure time of the instrument
246 // It is based on a power law, so that it varies progressively with the FOV to smoothly switch from human256 // It is based on a power law, so that it varies progressively with the FOV to smoothly switch from human
247 // vision to binocculares/telescope. Use a max of 0.7 because after that the atmosphere starts to glow too much!257 // vision to binocculares/telescope. Use a max of 0.7 because after that the atmosphere starts to glow too much!
@@ -731,11 +741,11 @@
731 }741 }
732742
733 bortleScaleIndex = bIndex;743 bortleScaleIndex = bIndex;
734744 // GZ: I moved this block to update()
735 // These value have been calibrated by hand, looking at the faintest star in stellarium at around 40 deg FOV745 // These value have been calibrated by hand, looking at the faintest star in stellarium at around 40 deg FOV
736 // They should roughly match the scale described at http://en.wikipedia.org/wiki/Bortle_Dark-Sky_Scale746 // They should roughly match the scale described at http://en.wikipedia.org/wiki/Bortle_Dark-Sky_Scale
737 static const float bortleToInScale[9] = {2.45, 1.55, 1.0, 0.63, 0.40, 0.24, 0.23, 0.145, 0.09};747 // static const float bortleToInScale[9] = {2.45, 1.55, 1.0, 0.63, 0.40, 0.24, 0.23, 0.145, 0.09};
738 setInputScale(bortleToInScale[bIndex-1]);748 // setInputScale(bortleToInScale[bIndex-1]);
739}749}
740750
741751
742752
=== modified file 'src/core/modules/Comet.cpp'
--- src/core/modules/Comet.cpp 2011-11-25 13:51:35 +0000
+++ src/core/modules/Comet.cpp 2011-12-29 12:15:27 +0000
@@ -115,7 +115,13 @@
115 }115 }
116116
117 if (flags&Magnitude)117 if (flags&Magnitude)
118 oss << q_("Magnitude: <b>%1</b>").arg(getVMagnitude(core), 0, 'f', 2) << "<br>";118 {
119 if (core->getSkyDrawer()->getFlagHasAtmosphere())
120 oss << q_("Magnitude: <b>%1</b> (extincted to: <b>%2</b>)").arg(QString::number(getVMagnitude(core, false), 'f', 2),
121 QString::number(getVMagnitude(core, true), 'f', 2)) << "<br>";
122 else
123 oss << q_("Magnitude: <b>%1</b>").arg(getVMagnitude(core, false), 0, 'f', 2) << "<br>";
124 }
119125
120 if (flags&AbsoluteMagnitude)126 if (flags&AbsoluteMagnitude)
121 {127 {
@@ -157,13 +163,21 @@
157 return str;163 return str;
158}164}
159165
160float Comet::getVMagnitude(const StelCore* core) const166float Comet::getVMagnitude(const StelCore* core, bool withExtinction) const
161{167{
162 //If the two parameter system is not used,168 //If the two parameter system is not used,
163 //use the default radius/albedo mechanism169 //use the default radius/albedo mechanism
164 if (slopeParameter < 0)170 if (slopeParameter < 0)
165 {171 {
166 return Planet::getVMagnitude(core);172 return Planet::getVMagnitude(core, withExtinction);
173 }
174
175 float extinctionMag=0.0; // track magnitude loss
176 if (withExtinction && core->getSkyDrawer()->getFlagHasAtmosphere())
177 {
178 Vec3d altAz=getAltAzPosApparent(core);
179 altAz.normalize();
180 core->getSkyDrawer()->getExtinction().forward(&altAz[2], &extinctionMag);
167 }181 }
168182
169 //Calculate distances183 //Calculate distances
@@ -178,5 +192,5 @@
178 //http://www.ayton.id.au/gary/Science/Astronomy/Ast_comets.htm#Comet%20facts:192 //http://www.ayton.id.au/gary/Science/Astronomy/Ast_comets.htm#Comet%20facts:
179 double apparentMagnitude = absoluteMagnitude + 5 * std::log10(observerCometDistance) + 2.5 * slopeParameter * std::log10(cometSunDistance);193 double apparentMagnitude = absoluteMagnitude + 5 * std::log10(observerCometDistance) + 2.5 * slopeParameter * std::log10(cometSunDistance);
180194
181 return apparentMagnitude;195 return apparentMagnitude + extinctionMag;
182}196}
183197
=== modified file 'src/core/modules/Comet.hpp'
--- src/core/modules/Comet.hpp 2011-06-12 15:30:54 +0000
+++ src/core/modules/Comet.hpp 2011-12-29 12:15:27 +0000
@@ -65,7 +65,7 @@
65 //was not designed to handle different types of objects.65 //was not designed to handle different types of objects.
66 //virtual QString getType() const {return "Comet";}66 //virtual QString getType() const {return "Comet";}
67 //! \todo Find better sources for the g,k system67 //! \todo Find better sources for the g,k system
68 virtual float getVMagnitude(const StelCore* core) const;68 virtual float getVMagnitude(const StelCore* core, bool withExtinction=false) const;
6969
70 //! \brief sets absolute magnitude and slope parameter.70 //! \brief sets absolute magnitude and slope parameter.
71 //! These are the parameters in the IAU's two-parameter magnitude system71 //! These are the parameters in the IAU's two-parameter magnitude system
7272
=== modified file 'src/core/modules/Constellation.cpp'
--- src/core/modules/Constellation.cpp 2011-05-31 13:06:03 +0000
+++ src/core/modules/Constellation.cpp 2011-12-29 12:15:27 +0000
@@ -220,7 +220,7 @@
220 // so check all segment endpoints:220 // so check all segment endpoints:
221 for (int i=2*numberOfSegments-1;i>=0;i--)221 for (int i=2*numberOfSegments-1;i>=0;i--)
222 {222 {
223 const float Mag = asterism[i]->getVMagnitude(0);223 const float Mag = asterism[i]->getVMagnitude(0, false);
224 if (Mag < maxMag)224 if (Mag < maxMag)
225 {225 {
226 brightest = asterism[i];226 brightest = asterism[i];
227227
=== modified file 'src/core/modules/ConstellationMgr.hpp'
--- src/core/modules/ConstellationMgr.hpp 2011-05-31 13:06:03 +0000
+++ src/core/modules/ConstellationMgr.hpp 2011-12-29 12:15:27 +0000
@@ -189,7 +189,7 @@
189 //! the boundary separates.189 //! the boundary separates.
190 //! @param conCatFile the path to the file which contains the constellation boundary data.190 //! @param conCatFile the path to the file which contains the constellation boundary data.
191 bool loadBoundaries(const QString& conCatFile);191 bool loadBoundaries(const QString& conCatFile);
192 //! Draw the constellation lines at the epoch given by the StelNavigator.192 //! Draw the constellation lines at the epoch given by the StelCore.
193 void drawLines(StelPainter& sPainter, const StelCore* core) const;193 void drawLines(StelPainter& sPainter, const StelCore* core) const;
194 //! Draw the constellation art.194 //! Draw the constellation art.
195 void drawArt(StelPainter& sPainter) const;195 void drawArt(StelPainter& sPainter) const;
196196
=== modified file 'src/core/modules/LandscapeMgr.cpp'
--- src/core/modules/LandscapeMgr.cpp 2011-09-29 07:14:01 +0000
+++ src/core/modules/LandscapeMgr.cpp 2011-12-29 12:15:27 +0000
@@ -239,7 +239,7 @@
239 else239 else
240 landscapeBrightness = (0.01 + 1.5*(sinSunAngleRad+0.1/1.5));240 landscapeBrightness = (0.01 + 1.5*(sinSunAngleRad+0.1/1.5));
241 if (moonPos[2] > -0.1/1.5)241 if (moonPos[2] > -0.1/1.5)
242 landscapeBrightness += qMax(0.2/-12.*ssystem->getMoon()->getVMagnitude(core),0.)*moonPos[2];242 landscapeBrightness += qMax(0.2/-12.*ssystem->getMoon()->getVMagnitude(core, true),0.)*moonPos[2];
243243
244 // TODO make this more generic for non-atmosphere planets244 // TODO make this more generic for non-atmosphere planets
245 if(atmosphere->getFadeIntensity() == 1)245 if(atmosphere->getFadeIntensity() == 1)
246246
=== modified file 'src/core/modules/MinorPlanet.cpp'
--- src/core/modules/MinorPlanet.cpp 2011-11-25 13:51:35 +0000
+++ src/core/modules/MinorPlanet.cpp 2011-12-29 12:15:27 +0000
@@ -190,7 +190,14 @@
190 }190 }
191191
192 if (flags&Magnitude)192 if (flags&Magnitude)
193 oss << q_("Magnitude: <b>%1</b>").arg(getVMagnitude(core), 0, 'f', 2) << "<br>";193 {
194 if (core->getSkyDrawer()->getFlagHasAtmosphere())
195 oss << q_("Magnitude: <b>%1</b> (extincted to: <b>%2</b>)").arg(QString::number(getVMagnitude(core, false), 'f', 2),
196 QString::number(getVMagnitude(core, true), 'f', 2)) << "<br>";
197 else
198 oss << q_("Magnitude: <b>%1</b>").arg(getVMagnitude(core, false), 0, 'f', 2) << "<br>";
199
200 }
194201
195 if (flags&AbsoluteMagnitude)202 if (flags&AbsoluteMagnitude)
196 {203 {
@@ -198,7 +205,7 @@
198 //If the H-G system is not used, use the default radius/albedo mechanism205 //If the H-G system is not used, use the default radius/albedo mechanism
199 if (slopeParameter < 0)206 if (slopeParameter < 0)
200 {207 {
201 oss << q_("Absolute Magnitude: %1").arg(getVMagnitude(core) - 5. * (std::log10(getJ2000EquatorialPos(core).length()*AU/PARSEC)-1.), 0, 'f', 2) << "<br>";208 oss << q_("Absolute Magnitude: %1").arg(getVMagnitude(core, false) - 5. * (std::log10(getJ2000EquatorialPos(core).length()*AU/PARSEC)-1.), 0, 'f', 2) << "<br>";
202 }209 }
203 else210 else
204 {211 {
@@ -241,17 +248,25 @@
241 return str;248 return str;
242}249}
243250
244float MinorPlanet::getVMagnitude(const StelCore* core) const251float MinorPlanet::getVMagnitude(const StelCore* core, bool withExtinction) const
245{252{
253 float extinctionMag=0.0; // track magnitude loss
254 if (withExtinction)
255 {
256 Vec3d altAz=getAltAzPosApparent(core);
257 altAz.normalize();
258 core->getSkyDrawer()->getExtinction().forward(&altAz[2], &extinctionMag);
259 }
260
246 //If the H-G system is not used, use the default radius/albedo mechanism261 //If the H-G system is not used, use the default radius/albedo mechanism
247 if (slopeParameter < 0)262 if (slopeParameter < 0)
248 {263 {
249 return Planet::getVMagnitude(core);264 return Planet::getVMagnitude(core, withExtinction);
250 }265 }
251266
252 //Calculate phase angle267 //Calculate phase angle
253 //(Code copied from Planet::getVMagnitude())268 //(Code copied from Planet::getVMagnitude())
254 //(LOL, this is actually vector substraction + the cosine theorem :))269 //(LOL, this is actually vector subtraction + the cosine theorem :))
255 const Vec3d& observerHelioPos = core->getObserverHeliocentricEclipticPos();270 const Vec3d& observerHelioPos = core->getObserverHeliocentricEclipticPos();
256 const double observerRq = observerHelioPos.lengthSquared();271 const double observerRq = observerHelioPos.lengthSquared();
257 const Vec3d& planetHelioPos = getHeliocentricEclipticPos();272 const Vec3d& planetHelioPos = getHeliocentricEclipticPos();
@@ -270,7 +285,7 @@
270 //TODO: See if you can "collapse" some calculations285 //TODO: See if you can "collapse" some calculations
271 double apparentMagnitude = reducedMagnitude + 5 * std::log10(std::sqrt(planetRq * observerPlanetRq));286 double apparentMagnitude = reducedMagnitude + 5 * std::log10(std::sqrt(planetRq * observerPlanetRq));
272287
273 return apparentMagnitude;288 return apparentMagnitude+extinctionMag;
274}289}
275290
276void MinorPlanet::translateName(StelTranslator &translator)291void MinorPlanet::translateName(StelTranslator &translator)
277292
=== modified file 'src/core/modules/MinorPlanet.hpp'
--- src/core/modules/MinorPlanet.hpp 2011-06-12 15:30:54 +0000
+++ src/core/modules/MinorPlanet.hpp 2011-12-29 12:15:27 +0000
@@ -70,7 +70,7 @@
70 //was not designed to handle different types of objects.70 //was not designed to handle different types of objects.
71 // \todo Decide if this is going to be "MinorPlanet" or "Asteroid"71 // \todo Decide if this is going to be "MinorPlanet" or "Asteroid"
72 //virtual QString getType() const {return "MinorPlanet";}72 //virtual QString getType() const {return "MinorPlanet";}
73 virtual float getVMagnitude(const StelCore* core) const;73 virtual float getVMagnitude(const StelCore* core, bool withExtinction=false) const;
74 //! sets the nameI18 property with the appropriate translation.74 //! sets the nameI18 property with the appropriate translation.
75 //! Function overriden to handle the problem with name conflicts.75 //! Function overriden to handle the problem with name conflicts.
76 virtual void translateName(StelTranslator& trans);76 virtual void translateName(StelTranslator& trans);
7777
=== modified file 'src/core/modules/Nebula.cpp'
--- src/core/modules/Nebula.cpp 2011-05-31 13:06:03 +0000
+++ src/core/modules/Nebula.cpp 2011-12-29 12:15:27 +0000
@@ -96,8 +96,13 @@
96 oss << q_("Type: <b>%1</b>").arg(getTypeString()) << "<br>";96 oss << q_("Type: <b>%1</b>").arg(getTypeString()) << "<br>";
9797
98 if (mag < 50 && flags&Magnitude)98 if (mag < 50 && flags&Magnitude)
99 oss << q_("Magnitude: <b>%1</b>").arg(mag, 0, 'f', 2) << "<br>";99 {
100100 if (core->getSkyDrawer()->getFlagHasAtmosphere())
101 oss << q_("Magnitude: <b>%1</b> (extincted to: <b>%2</b>)").arg(QString::number(getVMagnitude(core, false), 'f', 2),
102 QString::number(getVMagnitude(core, true), 'f', 2)) << "<br>";
103 else
104 oss << q_("Magnitude: <b>%1</b>").arg(getVMagnitude(core, false), 0, 'f', 2) << "<br>";
105 }
101 oss << getPositionInfoString(core, flags);106 oss << getPositionInfoString(core, flags);
102107
103 if (angularSize>0 && flags&Size)108 if (angularSize>0 && flags&Size)
@@ -108,6 +113,20 @@
108 return str;113 return str;
109}114}
110115
116float Nebula::getVMagnitude(const StelCore* core, bool withExtinction) const
117{
118 float extinctionMag=0.0; // track magnitude loss
119 if (withExtinction && core->getSkyDrawer()->getFlagHasAtmosphere())
120 {
121 Vec3d altAz=getAltAzPosApparent(core);
122 altAz.normalize();
123 core->getSkyDrawer()->getExtinction().forward(&altAz[2], &extinctionMag);
124 }
125
126 return mag+extinctionMag;
127}
128
129
111float Nebula::getSelectPriority(const StelCore* core) const130float Nebula::getSelectPriority(const StelCore* core) const
112{131{
113 if( ((NebulaMgr*)StelApp::getInstance().getModuleMgr().getModule("NebulaMgr"))->getFlagHints() )132 if( ((NebulaMgr*)StelApp::getInstance().getModuleMgr().getModule("NebulaMgr"))->getFlagHints() )
@@ -117,8 +136,8 @@
117 }136 }
118 else137 else
119 {138 {
120 if (getVMagnitude(core)>20.f) return 20.f;139 if (getVMagnitude(core, false)>20.f) return 20.f;
121 return getVMagnitude(core);140 return getVMagnitude(core, false);
122 }141 }
123}142}
124143
125144
=== modified file 'src/core/modules/Nebula.hpp'
--- src/core/modules/Nebula.hpp 2011-05-31 13:06:03 +0000
+++ src/core/modules/Nebula.hpp 2011-12-29 12:15:27 +0000
@@ -53,7 +53,7 @@
53 virtual QString getType() const {return "Nebula";}53 virtual QString getType() const {return "Nebula";}
54 virtual Vec3d getJ2000EquatorialPos(const StelCore*) const {return XYZ;}54 virtual Vec3d getJ2000EquatorialPos(const StelCore*) const {return XYZ;}
55 virtual double getCloseViewFov(const StelCore* core = NULL) const;55 virtual double getCloseViewFov(const StelCore* core = NULL) const;
56 virtual float getVMagnitude(const StelCore* core = NULL) const {Q_UNUSED(core); return mag;}56 virtual float getVMagnitude(const StelCore* core, bool withExtinction=false) const;
57 virtual float getSelectPriority(const StelCore* core) const;57 virtual float getSelectPriority(const StelCore* core) const;
58 virtual Vec3f getInfoColor() const;58 virtual Vec3f getInfoColor() const;
59 virtual QString getNameI18n() const {return nameI18;}59 virtual QString getNameI18n() const {return nameI18;}
6060
=== modified file 'src/core/modules/Planet.cpp'
--- src/core/modules/Planet.cpp 2011-11-25 13:51:35 +0000
+++ src/core/modules/Planet.cpp 2011-12-29 12:15:27 +0000
@@ -118,10 +118,15 @@
118 }118 }
119119
120 if (flags&Magnitude)120 if (flags&Magnitude)
121 oss << q_("Magnitude: <b>%1</b>").arg(getVMagnitude(core), 0, 'f', 2) << "<br>";121 {
122122 if (core->getSkyDrawer()->getFlagHasAtmosphere())
123 oss << q_("Magnitude: <b>%1</b> (extincted to: <b>%2</b>)").arg(QString::number(getVMagnitude(core, false), 'f', 2),
124 QString::number(getVMagnitude(core, true), 'f', 2)) << "<br>";
125 else
126 oss << q_("Magnitude: <b>%1</b>").arg(getVMagnitude(core, false), 0, 'f', 2) << "<br>";
127 }
123 if (flags&AbsoluteMagnitude)128 if (flags&AbsoluteMagnitude)
124 oss << q_("Absolute Magnitude: %1").arg(getVMagnitude(core)-5.*(std::log10(getJ2000EquatorialPos(core).length()*AU/PARSEC)-1.), 0, 'f', 2) << "<br>";129 oss << q_("Absolute Magnitude: %1").arg(getVMagnitude(core, false)-5.*(std::log10(getJ2000EquatorialPos(core).length()*AU/PARSEC)-1.), 0, 'f', 2) << "<br>";
125130
126 oss << getPositionInfoString(core, flags);131 oss << getPositionInfoString(core, flags);
127132
@@ -185,11 +190,11 @@
185 if( ((SolarSystem*)StelApp::getInstance().getModuleMgr().getModule("SolarSystem"))->getFlagHints() )190 if( ((SolarSystem*)StelApp::getInstance().getModuleMgr().getModule("SolarSystem"))->getFlagHints() )
186 {191 {
187 // easy to select, especially pluto192 // easy to select, especially pluto
188 return getVMagnitude(core)-15.f;193 return getVMagnitude(core, false)-15.f;
189 }194 }
190 else195 else
191 {196 {
192 return getVMagnitude(core) - 8.f;197 return getVMagnitude(core, false) - 8.f;
193 }198 }
194}199}
195200
@@ -478,13 +483,22 @@
478}483}
479484
480// Computation of the visual magnitude (V band) of the planet.485// Computation of the visual magnitude (V band) of the planet.
481float Planet::getVMagnitude(const StelCore* core) const486float Planet::getVMagnitude(const StelCore* core, bool withExtinction) const
482{487{
488 float extinctionMag=0.0; // track magnitude loss
489 if (withExtinction && core->getSkyDrawer()->getFlagHasAtmosphere())
490 {
491 Vec3d altAz=getAltAzPosApparent(core);
492 altAz.normalize();
493 core->getSkyDrawer()->getExtinction().forward(&altAz[2], &extinctionMag);
494 }
495
496
483 if (parent == 0)497 if (parent == 0)
484 {498 {
485 // sun, compute the apparent magnitude for the absolute mag (4.83) and observer's distance499 // sun, compute the apparent magnitude for the absolute mag (4.83) and observer's distance
486 const double distParsec = std::sqrt(core->getObserverHeliocentricEclipticPos().lengthSquared())*AU/PARSEC;500 const double distParsec = std::sqrt(core->getObserverHeliocentricEclipticPos().lengthSquared())*AU/PARSEC;
487 return 4.83 + 5.*(std::log10(distParsec)-1.);501 return 4.83 + 5.*(std::log10(distParsec)-1.) + extinctionMag;
488 }502 }
489503
490 // Compute the angular phase504 // Compute the angular phase
@@ -529,45 +543,118 @@
529 }543 }
530544
531 // Use empirical formulae for main planets when seen from earth545 // Use empirical formulae for main planets when seen from earth
532 // Algorithm provided by Pere Planesas (Observatorio Astronomico Nacional)
533 if (core->getCurrentLocation().planetName=="Earth")546 if (core->getCurrentLocation().planetName=="Earth")
534 {547 {
535 phase*=180./M_PI;548 const double phaseDeg=phase*180./M_PI;
536 const double d = 5. * log10(sqrt(observerPlanetRq*planetRq));549 const double d = 5. * log10(sqrt(observerPlanetRq*planetRq));
537 double f1 = phase/100.;550 //double f1 = phaseDeg/100.;
538551
552 /*
553 // Algorithm provided by Pere Planesas (Observatorio Astronomico Nacional)
539 if (englishName=="Mercury")554 if (englishName=="Mercury")
540 {555 {
541 if ( phase > 150. ) f1 = 1.5;556 if ( phaseDeg > 150. ) f1 = 1.5;
542 return -0.36 + d + 3.8*f1 - 2.73*f1*f1 + 2*f1*f1*f1;557 return -0.36 + d + 3.8*f1 - 2.73*f1*f1 + 2*f1*f1*f1 + extinctionMag;
543 }558 }
544 if (englishName=="Venus")559 if (englishName=="Venus")
545 return -4.29 + d + 0.09*f1 + 2.39*f1*f1 - 0.65*f1*f1*f1;560 return -4.29 + d + 0.09*f1 + 2.39*f1*f1 - 0.65*f1*f1*f1 + extinctionMag;
546 if (englishName=="Mars")561 if (englishName=="Mars")
547 return -1.52 + d + 0.016*phase;562 return -1.52 + d + 0.016*phaseDeg + extinctionMag;
548 if (englishName=="Jupiter")563 if (englishName=="Jupiter")
549 return -9.25 + d + 0.005*phase;564 return -9.25 + d + 0.005*phaseDeg + extinctionMag;
550 if (englishName=="Saturn")565 if (englishName=="Saturn")
551 {566 {
552 // TODO re-add rings computation567 // TODO re-add rings computation
553 // double rings = -2.6*sinx + 1.25*sinx*sinx;568 // double rings = -2.6*sinx + 1.25*sinx*sinx;
554 return -8.88 + d + 0.044*phase;// + rings;569 return -8.88 + d + 0.044*phaseDeg + extinctionMag;// + rings;
555 }570 }
556571 if (englishName=="Uranus")
557 if (englishName=="Uranus")572 return -7.19 + d + 0.0028*phaseDeg + extinctionMag;
558 return -7.19 + d + 0.0028*phase;573 if (englishName=="Neptune")
559 if (englishName=="Neptune")574 return -6.87 + d + extinctionMag;
560 return -6.87 + d;575 if (englishName=="Pluto")
561 if (englishName=="Pluto")576 return -1.01 + d + 0.041*phaseDeg + extinctionMag;
562 return -1.01 + d + 0.041*phase;577 */
563578 // GZ: I prefer the values given by Meeus, Astronomical Algorithms (1992).
564 phase/=180./M_PI;579 // There are two solutions:
580 // (1) G. Müller, based on visual observations 1877-91. [Expl.Suppl.1961]
581 // (2) Astronomical Almanac 1984 and later. These give V (instrumental) magnitudes.
582 // The structure is almost identical, just the numbers are different!
583 // I activate (1) for now, because we want to simulate the eye's impression. (Esp. Venus!)
584 // (1)
585 if (englishName=="Mercury")
586 {
587 double ph50=phaseDeg-50.0;
588 return 1.16 + d + 0.02838*ph50 + 0.0001023*ph50*ph50 + extinctionMag;
589 }
590 if (englishName=="Venus")
591 return -4.0 + d + 0.01322*phaseDeg + 0.0000004247*phaseDeg*phaseDeg*phaseDeg + extinctionMag;
592 if (englishName=="Mars")
593 return -1.3 + d + 0.01486*phaseDeg + extinctionMag;
594 if (englishName=="Jupiter")
595 return -8.93 + d + extinctionMag;
596 if (englishName=="Saturn")
597 {
598 // TODO re-add rings computation
599 // GZ: implemented from Meeus, Astr.Alg.1992
600 const double jd=core->getJDay();
601 const double T=(jd-2451545.0)/36525.0;
602 const double i=((0.000004*T-0.012998)*T+28.075216)*M_PI/180.0;
603 const double Omega=((0.000412*T+1.394681)*T+169.508470)*M_PI/180.0;
604 static SolarSystem *ssystem=GETSTELMODULE(SolarSystem);
605 const Vec3d saturnEarth=getHeliocentricEclipticPos() - ssystem->getEarth()->getHeliocentricEclipticPos();
606 double lambda=atan2(saturnEarth[1], saturnEarth[0]);
607 double beta=atan2(saturnEarth[2], sqrt(saturnEarth[0]*saturnEarth[0]+saturnEarth[1]*saturnEarth[1]));
608 const double sinB=sin(i)*cos(beta)*sin(lambda-Omega)-cos(i)*sin(beta);
609 double rings = -2.6*fabs(sinB) + 1.25*sinB*sinB; // sinx=sinB, saturnicentric latitude of earth. longish, see Meeus.
610 return -8.68 + d + 0.044*phaseDeg + rings + extinctionMag;
611 }
612 if (englishName=="Uranus")
613 return -6.85 + d + extinctionMag;
614 if (englishName=="Neptune")
615 return -7.05 + d + extinctionMag;
616 if (englishName=="Pluto")
617 return -1.0 + d + extinctionMag;
618 /*
619 // (2)
620 if (englishName=="Mercury")
621 return 0.42 + d + .038*phaseDeg - 0.000273*phaseDeg*phaseDeg + 0.000002*phaseDeg*phaseDeg*phaseDeg + extinctionMag;
622 if (englishName=="Venus")
623 return -4.40 + d + 0.0009*phaseDeg + 0.000239*phaseDeg*phaseDeg - 0.00000065*phaseDeg*phaseDeg*phaseDeg + extinctionMag;
624 if (englishName=="Mars")
625 return -1.52 + d + 0.016*phaseDeg + extinctionMag;
626 if (englishName=="Jupiter")
627 return -9.40 + d + 0.005*phaseDeg + extinctionMag;
628 if (englishName=="Saturn")
629 {
630 // TODO re-add rings computation
631 // GZ: implemented from Meeus, Astr.Alg.1992
632 const double jd=core->getJDay();
633 const double T=(jd-2451545.0)/36525.0;
634 const double i=((0.000004*T-0.012998)*T+28.075216)*M_PI/180.0;
635 const double Omega=((0.000412*T+1.394681)*T+169.508470)*M_PI/180.0;
636 static SolarSystem *ssystem=GETSTELMODULE(SolarSystem);
637 const Vec3d saturnEarth=getHeliocentricEclipticPos() - ssystem->getEarth()->getHeliocentricEclipticPos();
638 double lambda=atan2(saturnEarth[1], saturnEarth[0]);
639 double beta=atan2(saturnEarth[2], sqrt(saturnEarth[0]*saturnEarth[0]+saturnEarth[1]*saturnEarth[1]));
640 const double sinB=sin(i)*cos(beta)*sin(lambda-Omega)-cos(i)*sin(beta);
641 double rings = -2.6*fabs(sinB) + 1.25*sinB*sinB; // sinx=sinB, saturnicentric latitude of earth. longish, see Meeus.
642 return -8.88 + d + 0.044*phaseDeg + rings + extinctionMag;
643 }
644 if (englishName=="Uranus")
645 return -7.19f + d + extinctionMag;
646 if (englishName=="Neptune")
647 return -6.87f + d + extinctionMag;
648 if (englishName=="Pluto")
649 return -1.00f + d + extinctionMag;
650 */
651 // TODO: decide which set of formulae is best?
565 }652 }
566653
567 // This formula seems to give wrong results654 // This formula seems to give wrong results
568 const double p = (1.0 - phase/M_PI) * cos_chi + std::sqrt(1.0 - cos_chi*cos_chi) / M_PI;655 const double p = (1.0 - phase/M_PI) * cos_chi + std::sqrt(1.0 - cos_chi*cos_chi) / M_PI;
569 double F = 2.0 * albedo * radius * radius * p / (3.0*observerPlanetRq*planetRq) * shadowFactor;656 double F = 2.0 * albedo * radius * radius * p / (3.0*observerPlanetRq*planetRq) * shadowFactor;
570 return -26.73 - 2.5 * std::log10(F);657 return -26.73 - 2.5 * std::log10(F) + extinctionMag;
571}658}
572659
573double Planet::getAngularSize(const StelCore* core) const660double Planet::getAngularSize(const StelCore* core) const
@@ -742,7 +829,7 @@
742829
743 StelPainter sPainter(core->getProjection(StelCore::FrameJ2000));830 StelPainter sPainter(core->getProjection(StelCore::FrameJ2000));
744 Vec3d tmp = getJ2000EquatorialPos(core);831 Vec3d tmp = getJ2000EquatorialPos(core);
745 core->getSkyDrawer()->postDrawSky3dModel(&sPainter, Vec3f(tmp[0], tmp[1], tmp[2]), surfArcMin2, getVMagnitude(core), color);832 core->getSkyDrawer()->postDrawSky3dModel(&sPainter, Vec3f(tmp[0], tmp[1], tmp[2]), surfArcMin2, getVMagnitude(core, true), color);
746}833}
747834
748835
749836
=== modified file 'src/core/modules/Planet.hpp'
--- src/core/modules/Planet.hpp 2011-05-31 15:56:59 +0000
+++ src/core/modules/Planet.hpp 2011-12-29 12:15:27 +0000
@@ -119,7 +119,7 @@
119 virtual double getCloseViewFov(const StelCore* core) const;119 virtual double getCloseViewFov(const StelCore* core) const;
120 virtual double getSatellitesFov(const StelCore* core) const;120 virtual double getSatellitesFov(const StelCore* core) const;
121 virtual double getParentSatellitesFov(const StelCore* core) const;121 virtual double getParentSatellitesFov(const StelCore* core) const;
122 virtual float getVMagnitude(const StelCore* core) const;122 virtual float getVMagnitude(const StelCore* core, bool withExtinction=false) const;
123 virtual float getSelectPriority(const StelCore* core) const;123 virtual float getSelectPriority(const StelCore* core) const;
124 virtual Vec3f getInfoColor(void) const;124 virtual Vec3f getInfoColor(void) const;
125 virtual QString getType(void) const {return "Planet";}125 virtual QString getType(void) const {return "Planet";}
126126
=== modified file 'src/core/modules/StarMgr.cpp'
--- src/core/modules/StarMgr.cpp 2011-10-28 07:57:30 +0000
+++ src/core/modules/StarMgr.cpp 2011-12-29 12:15:27 +0000
@@ -644,13 +644,18 @@
644 skyDrawer->preDrawPointSource(&sPainter);644 skyDrawer->preDrawPointSource(&sPainter);
645645
646 // draw all the stars of all the selected zones646 // draw all the stars of all the selected zones
647 float rcmag_table[2*256];647 // GZ: This table must be enlarged from 2x256 to many more entries. CORRELATE IN Zonearray.cpp!
648 //float rcmag_table[2*256];
649 //float rcmag_table[2*16384];
650 float rcmag_table[2*4096];
648651
649 for (ZoneArrayMap::const_iterator it(zoneArrays.constBegin()); it!=zoneArrays.constEnd();++it)652 for (ZoneArrayMap::const_iterator it(zoneArrays.constBegin()); it!=zoneArrays.constEnd();++it)
650 {653 {
651 const float mag_min = 0.001f*it.value()->mag_min;654 const float mag_min = 0.001f*it.value()->mag_min;
652 const float k = (0.001f*it.value()->mag_range)/it.value()->mag_steps;655 const float k = (0.001f*it.value()->mag_range)/it.value()->mag_steps; // MagStepIncrement
653 for (int i=it.value()->mag_steps-1;i>=0;--i)656 // GZ: add a huge number of entries to rcMag
657 //for (int i=it.value()->mag_steps-1;i>=0;--i)
658 for (int i=4096-1;i>=0;--i)
654 {659 {
655 const float mag = mag_min+k*i;660 const float mag = mag_min+k*i;
656 if (skyDrawer->computeRCMag(mag,rcmag_table + 2*i)==false)661 if (skyDrawer->computeRCMag(mag,rcmag_table + 2*i)==false)
657662
=== modified file 'src/core/modules/StarMgr.hpp'
--- src/core/modules/StarMgr.hpp 2011-05-31 13:06:03 +0000
+++ src/core/modules/StarMgr.hpp 2011-12-29 12:15:27 +0000
@@ -82,7 +82,7 @@
82 virtual void init();82 virtual void init();
8383
84 //! Draw the stars and the star selection indicator if necessary.84 //! Draw the stars and the star selection indicator if necessary.
85 virtual void draw(StelCore* core); //! Draw all the stars85 virtual void draw(StelCore* core);
8686
87 //! Update any time-dependent features.87 //! Update any time-dependent features.
88 //! Includes fading in and out stars and labels when they are turned on and off.88 //! Includes fading in and out stars and labels when they are turned on and off.
8989
=== modified file 'src/core/modules/StarWrapper.cpp'
--- src/core/modules/StarWrapper.cpp 2011-05-31 13:06:03 +0000
+++ src/core/modules/StarWrapper.cpp 2011-12-29 12:15:27 +0000
@@ -48,9 +48,14 @@
48 QTextStream oss(&str);48 QTextStream oss(&str);
4949
50 if (flags&Magnitude)50 if (flags&Magnitude)
51 oss << q_("Magnitude: <b>%1</b> (B-V: %2)").arg(QString::number(getVMagnitude(core), 'f', 2), QString::number(getBV(), 'f', 2)) << "<br>";51 {
5252 oss << q_("Magnitude: <b>%1</b> (B-V: %2)").arg(QString::number(getVMagnitude(core, false), 'f', 2), QString::number(getBV(), 'f', 2)) << "<br>";
53 oss << getPositionInfoString(core, flags);53 if (core->getSkyDrawer()->getFlagHasAtmosphere())
54 {
55 oss << q_("Apparent Magnitude: <b>%1</b> (by extinction)").arg(QString::number(getVMagnitude(core, true), 'f', 2)) << "<br>";
56 }
57 }
58 oss << getPositionInfoString(core, flags);
5459
55 StelObject::postProcessInfoString(str, flags);60 StelObject::postProcessInfoString(str, flags);
5661
@@ -105,11 +110,18 @@
105 }110 }
106111
107 if (flags&Magnitude)112 if (flags&Magnitude)
108 oss << q_("Magnitude: <b>%1</b> (B-V: %2)").arg(QString::number(getVMagnitude(core), 'f', 2),113 {
109 QString::number(s->getBV(), 'f', 2)) << "<br>";114 if (core->getSkyDrawer()->getFlagHasAtmosphere())
115 oss << q_("Magnitude: <b>%1</b> (extincted to: <b>%2</b>. B-V: <b>%3</b>)").arg(QString::number(getVMagnitude(core, false), 'f', 2),
116 QString::number(getVMagnitude(core, true), 'f', 2),
117 QString::number(s->getBV(), 'f', 2)) << "<br>";
118 else
119 oss << q_("Magnitude: <b>%1</b> (B-V: <b>%2</b>)").arg(QString::number(getVMagnitude(core, false), 'f', 2),
120 QString::number(s->getBV(), 'f', 2)) << "<br>";
121 }
110122
111 if ((flags&AbsoluteMagnitude) && s->plx && !isNan(s->plx) && !isInf(s->plx))123 if ((flags&AbsoluteMagnitude) && s->plx && !isNan(s->plx) && !isInf(s->plx))
112 oss << q_("Absolute Magnitude: %1").arg(getVMagnitude(core)+5.*(1.+std::log10(0.00001*s->plx)), 0, 'f', 2) << "<br>";124 oss << q_("Absolute Magnitude: %1").arg(getVMagnitude(core, false)+5.*(1.+std::log10(0.00001*s->plx)), 0, 'f', 2) << "<br>";
113125
114 oss << getPositionInfoString(core, flags);126 oss << getPositionInfoString(core, flags);
115127
116128
=== modified file 'src/core/modules/StarWrapper.hpp'
--- src/core/modules/StarWrapper.hpp 2011-05-31 13:06:03 +0000
+++ src/core/modules/StarWrapper.hpp 2011-12-29 12:15:27 +0000
@@ -85,11 +85,18 @@
85 {85 {
86 return StelApp::getInstance().getVisionModeNight() ? Vec3f(0.8, 0.2, 0.2) : StelSkyDrawer::indexToColor(s->bV);86 return StelApp::getInstance().getVisionModeNight() ? Vec3f(0.8, 0.2, 0.2) : StelSkyDrawer::indexToColor(s->bV);
87 }87 }
88 float getVMagnitude(const StelCore*) const88 float getVMagnitude(const StelCore* core, bool withExtinction=false) const
89 {89 {
90 return 0.001f*a->mag_min + s->mag*(0.001f*a->mag_range)/a->mag_steps;90 float extinctionMag=0.0; // track magnitude loss
91 if (withExtinction && core->getSkyDrawer()->getFlagHasAtmosphere())
92 {
93 double alt=getAltAzPosApparent(core)[2];
94 core->getSkyDrawer()->getExtinction().forward(&alt, &extinctionMag);
95 }
96
97 return 0.001f*a->mag_min + s->mag*(0.001f*a->mag_range)/a->mag_steps + extinctionMag;
91 }98 }
92 float getSelectPriority(const StelCore* core) const {return getVMagnitude(core);}99 float getSelectPriority(const StelCore* core) const {return getVMagnitude(core, false);}
93 float getBV(void) const {return s->getBV();}100 float getBV(void) const {return s->getBV();}
94 QString getEnglishName(void) const {return QString();}101 QString getEnglishName(void) const {return QString();}
95 QString getNameI18n(void) const {return s->getNameI18n();}102 QString getNameI18n(void) const {return s->getNameI18n();}
96103
=== modified file 'src/core/modules/ZoneArray.cpp'
--- src/core/modules/ZoneArray.cpp 2011-06-23 11:26:56 +0000
+++ src/core/modules/ZoneArray.cpp 2011-12-29 12:15:27 +0000
@@ -476,27 +476,44 @@
476void SpecialZoneArray<Star>::draw(StelPainter* sPainter, int index, bool is_inside, const float *rcmag_table, StelCore* core, unsigned int maxMagStarName,476void SpecialZoneArray<Star>::draw(StelPainter* sPainter, int index, bool is_inside, const float *rcmag_table, StelCore* core, unsigned int maxMagStarName,
477 float names_brightness) const477 float names_brightness) const
478{478{
479 StelSkyDrawer* drawer = core->getSkyDrawer();479 StelSkyDrawer* drawer = core->getSkyDrawer();
480 SpecialZoneData<Star> *const z = getZones() + index;480 SpecialZoneData<Star> *const z = getZones() + index;
481 Vec3f vf; 481 Vec3f vf;
482 const Star *const end = z->getStars() + z->size;482 const Star *const end = z->getStars() + z->size;
483 static const double d2000 = 2451545.0;483 static const double d2000 = 2451545.0;
484 const double movementFactor = (M_PI/180)*(0.0001/3600) * ((core->getJDay()-d2000)/365.25) / star_position_scale;484 const double movementFactor = (M_PI/180)*(0.0001/3600) * ((core->getJDay()-d2000)/365.25) / star_position_scale;
485 const float* tmpRcmag;485 const float* tmpRcmag; // will point to precomputed rC in table
486 for (const Star *s=z->getStars();s<end;++s)486 // GZ, added for extinction
487 {487 Extinction extinction=core->getSkyDrawer()->getExtinction();
488 tmpRcmag = rcmag_table+2*s->mag;488 const bool withExtinction=(drawer->getFlagHasAtmosphere() && extinction.getExtinctionCoefficient()>=0.01f);
489 if (*tmpRcmag<=0.f)489 const float k = (0.001f*mag_range)/mag_steps; // from StarMgr.cpp line 654
490 break;490
491 s->getJ2000Pos(z,movementFactor, vf);491 // go through all stars, which are sorted by magnitude (bright stars first)
492 if (drawer->drawPointSource(sPainter, vf, tmpRcmag, s->bV, !is_inside) && s->hasName() && s->mag < maxMagStarName && s->hasComponentID()<=1)492 for (const Star *s=z->getStars();s<end;++s)
493 {493 {
494 const float offset = *tmpRcmag*0.7f;494 tmpRcmag = rcmag_table+2*s->mag;
495 const Vec3f& colorr = (StelApp::getInstance().getVisionModeNight() ? Vec3f(0.8f, 0.2f, 0.2f) : StelSkyDrawer::indexToColor(s->bV))*0.75f;495 if (*tmpRcmag<=0.f) break; // no size for this and following (even dimmer, unextincted) stars? --> early exit
496 sPainter->setColor(colorr[0], colorr[1], colorr[2],names_brightness);496 s->getJ2000Pos(z,movementFactor, vf);
497 sPainter->drawText(Vec3d(vf[0], vf[1], vf[2]), s->getNameI18n(), 0, offset, offset, false);497
498 }498 // GZ new:
499 }499 if (withExtinction)
500 {
501 //GZ: We must compute position first, then shift magnitude.
502 Vec3d altAz=core->j2000ToAltAz(Vec3d(vf[0], vf[1], vf[2]), StelCore::RefractionOn);
503 float extMagShift=0.0f;
504 extinction.forward(&altAz, &extMagShift);
505 int extMagShiftStep=qMin((int)floor(extMagShift/k), 4096-mag_steps); // this number muist be equal StarMgr.cpp line 649
506 tmpRcmag = rcmag_table+2*(s->mag+extMagShiftStep);
507 }
508
509 if (drawer->drawPointSource(sPainter, vf, tmpRcmag, s->bV, !is_inside) && s->hasName() && s->mag < maxMagStarName && s->hasComponentID()<=1)
510 {
511 const float offset = *tmpRcmag*0.7f;
512 const Vec3f& colorr = (StelApp::getInstance().getVisionModeNight() ? Vec3f(0.8f, 0.2f, 0.2f) : StelSkyDrawer::indexToColor(s->bV))*0.75f;
513 sPainter->setColor(colorr[0], colorr[1], colorr[2],names_brightness);
514 sPainter->drawText(Vec3d(vf[0], vf[1], vf[2]), s->getNameI18n(), 0, offset, offset, false);
515 }
516 }
500}517}
501518
502template<class Star>519template<class Star>