Merge lp:~i-martividal/stellarium/Observability-1.1.0 into lp:stellarium

Proposed by Ivan Marti-Vidal
Status: Merged
Approved by: Alexander Wolf
Approved revision: 5749
Merged at revision: 5758
Proposed branch: lp:~i-martividal/stellarium/Observability-1.1.0
Merge into: lp:stellarium
Diff against target: 621 lines (+170/-82)
6 files modified
plugins/Observability/CMakeLists.txt (+1/-1)
plugins/Observability/src/Observability.cpp (+112/-73)
plugins/Observability/src/Observability.hpp (+11/-3)
plugins/Observability/src/gui/ObservabilityDialog.cpp (+17/-2)
plugins/Observability/src/gui/ObservabilityDialog.hpp (+1/-0)
plugins/Observability/src/gui/ObservabilityDialog.ui (+28/-3)
To merge this branch: bzr merge lp:~i-martividal/stellarium/Observability-1.1.0
Reviewer Review Type Date Requested Status
Alexander Wolf Approve
Review via email: mp+143688@code.launchpad.net

Description of the change

Dear all,

Here you have the revised version of Observability. Now, the dates of Full Moon are computed by solving the Ecliptic longitude to be 180 deg away from the Sun. It's faster and much more precise.

I've also solved a few minor bugs and added the possibility to set the altitude of the horizon manually. After discussion with some colleagues, I think that this feature may be quite useful for some people (for instance, those who want to know when will an object reach a given minimum altitude, if they want to take good pictures).

  Best Wishes,

       Ivan

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/Observability/CMakeLists.txt'
2--- plugins/Observability/CMakeLists.txt 2012-12-09 19:10:43 +0000
3+++ plugins/Observability/CMakeLists.txt 2013-01-17 13:33:22 +0000
4@@ -1,4 +1,4 @@
5-SET(OBSERVABILITY_VERSION "1.0.3")
6+SET(OBSERVABILITY_VERSION "1.1.0")
7
8 IF(APPLE)
9 SET(CMAKE_INSTALL_PREFIX $ENV{HOME}/Library/Application\ Support/Stellarium)
10
11=== modified file 'plugins/Observability/src/Observability.cpp'
12--- plugins/Observability/src/Observability.cpp 2012-09-23 12:08:15 +0000
13+++ plugins/Observability/src/Observability.cpp 2013-01-17 13:33:22 +0000
14@@ -91,6 +91,7 @@
15 MoonPerilune = 0.0024236308; // Smallest Earth-Moon distance (in AU).
16 nextFullMoon = 0.0;
17 prevFullMoon = 0.0;
18+ RefracHoriz = 0.0; // Geometric altitude at refraction-corrected horizon.
19 selName = "";
20
21
22@@ -122,6 +123,9 @@
23 if (!conf->contains("Sun_Altitude"))
24 conf->setValue("Sun_Altitude", 12);
25
26+ if (!conf->contains("Horizon_Altitude"))
27+ conf->setValue("Horizon_Altitude", 0);
28+
29 if (!conf->contains("show_FullMoon"))
30 conf->setValue("show_FullMoon", true);
31
32@@ -135,7 +139,9 @@
33 // Load settings from main config file
34 fontSize = conf->value("font_size",15).toInt();
35 iAltitude = conf->value("Sun_Altitude",12).toInt();
36+ iHorizAltitude = conf->value("Horizon_Altitude",0).toInt();
37 AstroTwiAlti = -((double) iAltitude)/Rad2Deg ;
38+ HorizAlti = ((double) iHorizAltitude)/Rad2Deg ;
39 font.setPixelSize(fontSize);
40 QString fontColorStr = conf->value("font_color", "0,0.5,1").toString();
41 fontColor = StelUtils::strToVec3f(fontColorStr);
42@@ -264,7 +270,11 @@
43 double currheight = (6371.+(core->getCurrentLocation().altitude)/1000.)/UA;
44 double currJD = core->getJDay();
45 double currJDint;
46+// GMTShift = StelUtils::getGMTShiftFromQT(currJD)/24.0;
47 GMTShift = StelApp::getInstance().getLocaleMgr().getGMTShift(currJD)/24.0;
48+
49+// qDebug() << QString("%1%2 ").arg(GMTShift);
50+
51 double currLocalT = 24.*modf(currJD + GMTShift,&currJDint);
52
53 int auxm, auxd, auxy;
54@@ -302,6 +312,28 @@
55 ObserverLoc[2] = currheight*std::sin(currlat);
56 };
57
58+
59+
60+// Add refraction, if necessary:
61+ Vec3d TempRefr;
62+ TempRefr[0] = std::cos(HorizAlti);
63+ TempRefr[1] = 0.0;
64+ TempRefr[2] = std::sin(HorizAlti);
65+ Vec3d CorrRefr = core->altAzToEquinoxEqu(TempRefr,StelCore::RefractionAuto);
66+ TempRefr = core->equinoxEquToAltAz(CorrRefr,StelCore::RefractionOff);
67+ double RefracAlt = std::asin(TempRefr[2]);
68+
69+ if (std::abs(RefracHoriz-RefracAlt)>2.91e-4) // Diference larger than 1 arcminute.
70+ { // Configuration for refraction changed notably:
71+ RefracHoriz = RefracAlt;
72+ configChanged = true;
73+ souChanged = true;
74+ };
75+
76+
77+
78+
79+
80 // If we have changed latitude (or year), we update the vector of Sun's hour
81 // angles at twilight, and re-compute Sun/Moon ephemeris (if selected):
82 if (locChanged || yearChanged || configChanged)
83@@ -409,7 +441,7 @@
84 /////////////////////////////////////////////////////////////////
85 // NOW WE COMPUTE RISE/SET/TRANSIT TIMES FOR THE CURRENT DAY:
86 double currH = HourAngle(mylat,alti,selDec);
87- horizH = HourAngle(mylat,0.0,selDec);
88+ horizH = HourAngle(mylat,RefracHoriz,selDec);
89 QString RS1, RS2, Cul; // strings with Rise/Set/Culmination times
90 double Rise, Set; // Actual Rise/Set times (in GMT).
91 int d1,m1,s1,d2,m2,s2,dc,mc,sc; // Integers for the time spans in hh:mm:ss.
92@@ -490,7 +522,7 @@
93 };
94 }
95 else { // The source is either circumpolar or never rises:
96- (alti>0.0)? RS1 = q_("Circumpolar."): RS1 = q_("No rise.");
97+ (alti>RefracHoriz)? RS1 = q_("Circumpolar."): RS1 = q_("No rise.");
98 RS2 = "";
99 };
100
101@@ -502,8 +534,8 @@
102 transit = LocPos[1]<0.0;
103 };
104
105- if (culmAlt<halfpi) { // Source can be observed.
106- double altiAtCulmi = Rad2Deg*(halfpi-culmAlt);
107+ if (culmAlt<halfpi-RefracHoriz) { // Source can be observed.
108+ double altiAtCulmi = Rad2Deg*(halfpi-culmAlt-RefracHoriz);
109 double2hms(TFrac*currH,dc,mc,sc);
110
111 // String with the time span for culmination:
112@@ -516,7 +548,7 @@
113 else {
114 double2hms(toUnsignedRA(currLocalT-TFrac*currH+12.),ephHour,ephMinute,ephSecond);
115 CulmTime = QString("%1:%2").arg(ephHour).arg(ephMinute,2,10,QLatin1Char('0'));
116- Cul = q_("Culminated at %1 (%2 ago) at %3 deg.").arg(CulmTime).arg(Cul).arg(altiAtCulmi,0,'f',1);
117+ Cul = q_("Transit at %1 (%2 ago) at %3 deg.").arg(CulmTime).arg(Cul).arg(altiAtCulmi,0,'f',1);
118 };
119 };
120
121@@ -540,7 +572,7 @@
122 PlanetRADec(core);} // Re-compute ephemeris.
123
124 else { // Object is fixed on the sky.
125- double auxH = HourAngle(mylat,0.0,selDec);
126+ double auxH = HourAngle(mylat,RefracHoriz,selDec);
127 double auxSidT1 = toUnsignedRA(selRA - auxH);
128 double auxSidT2 = toUnsignedRA(selRA + auxH);
129 for (int i=0;i<nDays;i++) {
130@@ -556,7 +588,7 @@
131 if ((souChanged || locChanged || yearChanged)) {
132 bestNight=""; ObsRange = "";
133
134- if (culmAlt>=halfpi) { // Source cannot be seen.
135+ if (culmAlt>=halfpi-RefracHoriz) { // Source cannot be seen.
136 ObsRange = q_("Source is not observable.");
137 AcroCos = q_("No Acronychal nor Cosmical rise/set.");
138 }
139@@ -593,11 +625,11 @@
140 QString AcroRiseStr, AcroSetStr;
141 QString CosmRiseStr, CosmSetStr;
142
143- AcroRiseStr = (selRise>0)?CalenDate(selRise):q_("N/A");
144- AcroSetStr = (selSet>0)?CalenDate(selSet):q_("N/A");
145+ AcroRiseStr = (selRise>0)?CalenDate(selRise):q_("None");
146+ AcroSetStr = (selSet>0)?CalenDate(selSet):q_("None");
147
148- CosmRiseStr = (selRise2>0)?CalenDate(selRise2):q_("N/A");
149- CosmSetStr = (selSet2>0)?CalenDate(selSet2):q_("N/A");
150+ CosmRiseStr = (selRise2>0)?CalenDate(selRise2):q_("None");
151+ CosmSetStr = (selSet2>0)?CalenDate(selSet2):q_("None");
152
153 AcroCos = (Acro==3 || Acro==1)?QString("%1: %2/%3.").arg(q_("Acronychal rise/set")).arg(AcroRiseStr).arg(AcroSetStr):q_("No Acronychal rise/set.");
154 AcroCos += (Acro==3 || Acro==2)?QString(" %1: %2/%3.").arg(q_("Cosmical rise/set")).arg(CosmRiseStr).arg(CosmSetStr):QString(" %1").arg(q_("No Cosmical rise/set."));
155@@ -829,7 +861,7 @@
156
157 for (int i=0;i<nDays;i++) {
158 getPlanetCoords(core,yearJD[i],ObjectRA[i],ObjectDec[i],false);
159- TempH = HourAngle(mylat,0.0,ObjectDec[i]);
160+ TempH = HourAngle(mylat,RefracHoriz,ObjectDec[i]);
161 ObjectH0[i] = TempH;
162 ObjectSidT[0][i] = toUnsignedRA(ObjectRA[i]-TempH);
163 ObjectSidT[1][i] = toUnsignedRA(ObjectRA[i]+TempH);
164@@ -884,7 +916,7 @@
165
166 for (int i=0; i<nDays; i++) {
167 TempH = HourAngle(mylat,AstroTwiAlti,SunDec[i]);
168- TempH00 = HourAngle(mylat,0.0,SunDec[i]);
169+ TempH00 = HourAngle(mylat,RefracHoriz,SunDec[i]);
170 if (TempH>0.0) {
171 SunSidT[0][i] = toUnsignedRA(SunRA[i]-TempH*(1.00278));
172 SunSidT[1][i] = toUnsignedRA(SunRA[i]+TempH*(1.00278));}
173@@ -1026,7 +1058,7 @@
174 //////////////////////////
175 // Get the coordinates of Sun or Moon for a given JD:
176 // getBack controls whether Earth and Moon must be returned to their original positions after computation.
177-void Observability::getSunMoonCoords(StelCore *core, double JD, double &RASun, double &DecSun, double &RAMoon, double &DecMoon, bool getBack) //, Vec3d &AltAzVector)
178+void Observability::getSunMoonCoords(StelCore *core, double JD, double &RASun, double &DecSun, double &RAMoon, double &DecMoon, double &EclLon, bool getBack) //, Vec3d &AltAzVector)
179 {
180
181 if (getBack) // Return the Moon and Earth to their current position:
182@@ -1056,6 +1088,8 @@
183 Pos1 = myMoon->getHeliocentricEclipticPos();
184 Pos2 = (core->j2000ToEquinoxEqu(LocTrans*Pos1))-RotObserver;
185
186+ EclLon = Pos1[0]*Pos0[1] - Pos1[1]*Pos0[0];
187+
188 toRADec(Pos2,RAMoon,DecMoon);
189 };
190 }
191@@ -1144,10 +1178,10 @@
192
193 int Niter = 100;
194 int i;
195- double Hhoriz, RA, Dec, RAS, DecS, TempH, jd1, tempEphH, currSidT;
196+ double Hhoriz, RA, Dec, RAS, DecS, TempH, jd1, tempEphH, currSidT, EclLon;
197 Vec3d Observer;
198
199- Hhoriz = HourAngle(mylat,0.0,selDec);
200+ Hhoriz = HourAngle(mylat,RefracHoriz,selDec);
201 bool raises = Hhoriz > 0.0;
202
203
204@@ -1187,7 +1221,7 @@
205
206 toRADec(Pos2,RA,Dec);
207 Vec3d MoonAltAz = core->equinoxEquToAltAz(Pos2,StelCore::RefractionOff);
208- raised = MoonAltAz[2] > 0.0;
209+ raised = MoonAltAz[2] > RefracHoriz;
210
211 // Initial guesses of rise/set/transit times.
212 // They are called 'Moon', but are also used for the Sun or planet:
213@@ -1215,7 +1249,7 @@
214
215 if (Kind<3)
216 {
217- getSunMoonCoords(core,jd1,RAS,DecS,RA,Dec,false);
218+ getSunMoonCoords(core,jd1,RAS,DecS,RA,Dec,EclLon,false);
219 } else
220 {
221 getPlanetCoords(core,jd1,RA,Dec,false);
222@@ -1229,7 +1263,7 @@
223 Hcurr -= (Hcurr>12.)?24.0:0.0;
224
225 // H at horizon for mod. coordinates:
226- Hhoriz = HourAngle(mylat,0.0,Dec);
227+ Hhoriz = HourAngle(mylat,RefracHoriz,Dec);
228 // Compute eph. times for mod. coordinates:
229 TempH = (-Hhoriz-Hcurr)*TFrac;
230 if (raised==false) TempH += (TempH<0.0)?24.0:0.0;
231@@ -1250,7 +1284,7 @@
232
233 if (Kind<3)
234 {
235- getSunMoonCoords(core,jd1,RAS,DecS,RA,Dec,false);
236+ getSunMoonCoords(core,jd1,RAS,DecS,RA,Dec,EclLon,false);
237 } else
238 {
239 getPlanetCoords(core,jd1,RA,Dec,false);
240@@ -1263,7 +1297,7 @@
241 Hcurr -= (raised)?24.:0.;
242 Hcurr += (Hcurr<-12.)?24.0:0.0;
243 // H at horizon for mod. coordinates:
244- Hhoriz = HourAngle(mylat,0.0,Dec);
245+ Hhoriz = HourAngle(mylat,RefracHoriz,Dec);
246 // Compute eph. times for mod. coordinates:
247 TempH = (Hhoriz-Hcurr)*TFrac;
248 if (raised==false) TempH -= (TempH>0.0)?24.0:0.0;
249@@ -1290,7 +1324,7 @@
250
251 if (Kind<3)
252 {
253- getSunMoonCoords(core,jd1,RAS,DecS,RA,Dec,false);
254+ getSunMoonCoords(core,jd1,RAS,DecS,RA,Dec,EclLon,false);
255 } else
256 {
257 getPlanetCoords(core,jd1,RA,Dec,false);
258@@ -1316,6 +1350,9 @@
259
260 // qDebug() << q_("%1").arg(MoonCulm,0,'f',5);
261
262+
263+ lastJDMoon = myJD;
264+
265 }; // Comes from if (std::abs(myJD-lastJDMoon)>JDsec || LastObject!=Kind)
266
267
268@@ -1341,10 +1378,10 @@
269 // Improve the estimate iteratively (Secant method over Lunar-phase vs. time):
270
271 dT = 0.1/1440.; // 6 seconds. Our time span for the finite-difference derivative estimate.
272- double Deriv1, Deriv2; // Variables for temporal use.
273- double Sec1, Sec2, SecMed, Temp1, Temp2; // Variables for temporal use.
274+// double Deriv1, Deriv2; // Variables for temporal use.
275+ double Sec1, Sec2, Temp1, Temp2; // Variables for temporal use.
276 double iniEst1, iniEst2; // JD values that MUST include the solution within them.
277- double Phase1, Phase2, PhaseMed;
278+ double Phase1;
279
280 for (int j=0; j<2; j++)
281 { // Two steps: one for the previos Full Moon and the other for the next one.
282@@ -1355,55 +1392,40 @@
283 Sec1 = iniEst1; // TempFullMoon - 0.05*MoonT; // Initial estimates of Full-Moon dates
284 Sec2 = iniEst2; // TempFullMoon + 0.05*MoonT;
285
286+ getSunMoonCoords(core,Sec1,RAS,DecS,RA,Dec,EclLon,false);
287+ Temp1 = EclLon; //Lambda(RA,Dec,RAS,DecS);
288+ getSunMoonCoords(core,Sec2,RAS,DecS,RA,Dec,EclLon,false);
289+ Temp2 = EclLon; //Lambda(RA,Dec,RAS,DecS);
290+
291+
292 for (int i=0; i<100; i++) // A limit of 100 iterations.
293 {
294- getSunMoonCoords(core,Sec1+dT/2.,RAS,DecS,RA,Dec,false);
295- Temp1 = Lambda(RA,Dec,RAS,DecS);
296- getSunMoonCoords(core,Sec1-dT/2.,RAS,DecS,RA,Dec,false);
297- Temp2 = Lambda(RA,Dec,RAS,DecS);
298-
299- Deriv1 = (Temp1-Temp2)/dT;
300- Phase1 = (Temp1+Temp2)/2.;
301-
302- getSunMoonCoords(core,Sec2+dT/2.,RAS,DecS,RA,Dec,false);
303- Temp1 = Lambda(RA,Dec,RAS,DecS);
304- getSunMoonCoords(core,Sec2-dT/2.,RAS,DecS,RA,Dec,false);
305- Temp2 = Lambda(RA,Dec,RAS,DecS);
306-
307- Deriv2 = (Temp1-Temp2)/dT;
308- Phase2 = (Temp1+Temp2)/2.;
309-
310- SecMed = (Sec2+Sec1)/2.;
311- getSunMoonCoords(core,SecMed+dT/2.,RAS,DecS,RA,Dec,false);
312- Temp1 = Lambda(RA,Dec,RAS,DecS);
313- getSunMoonCoords(core,SecMed-dT/2.,RAS,DecS,RA,Dec,false);
314- Temp2 = Lambda(RA,Dec,RAS,DecS);
315-
316- // DerivMed = (Temp1-Temp2)/dT;
317- PhaseMed = (Temp1+Temp2)/2.;
318-
319- Temp1 = Sec2 - Deriv2*(Sec2-Sec1)/(Deriv2-Deriv1);
320-
321- // Force the solution to fall within the range of good possible solutions:
322- if (Temp1 < iniEst1 || Temp1 > iniEst2)
323- {
324- if (Phase1>Phase2)
325- {
326- Sec2 = (Phase2 > PhaseMed)?Sec2:SecMed;
327- } else
328- {
329- Sec1 = Sec2;
330- Sec2 = (Phase1>PhaseMed)?Sec1:SecMed;
331- };
332- } else
333- {
334- Sec1 = Sec2; Sec2 = Temp1;
335- };
336-
337- if (std::abs(Sec2-Sec1) < 10.*dT) {TempFullMoon = Temp1; break;} // 1 minute accuracy. Convergence.
338-
339+ Phase1 = (Sec2-Sec1)/(Temp1-Temp2)*Temp1+Sec1;
340+ getSunMoonCoords(core,Phase1,RAS,DecS,RA,Dec,EclLon,false);
341+
342+ if (Temp1*EclLon < 0.0)
343+ {
344+ Sec2 = Phase1;
345+ Temp2 = EclLon;
346+ } else {
347+ Sec1 = Phase1;
348+ Temp1 = EclLon;
349+
350+ };
351+
352+ // qDebug() << QString("%1 %2 %3 %4 ").arg(Sec1).arg(Sec2).arg(Temp1).arg(Temp2);
353+
354+
355+ if (std::abs(Sec2-Sec1) < 10.*dT) // 1 minute accuracy; convergence.
356+ {
357+ TempFullMoon = (Sec1+Sec2)/2.;
358+ // qDebug() << QString("%1%2 ").arg(TempFullMoon);
359+ break;
360+ };
361+
362 };
363
364+
365 if (TempFullMoon > myJD)
366 {
367 nextFullMoon = TempFullMoon;
368@@ -1473,14 +1495,12 @@
369 // Return the Moon and Earth to its current position:
370 if (Kind<3)
371 {
372- getSunMoonCoords(core,myJD,RAS,DecS,RA,Dec,true);
373+ getSunMoonCoords(core,myJD,RAS,DecS,RA,Dec,EclLon,true);
374 } else
375 {
376 getPlanetCoords(core,myJD,RA,Dec,true);
377 };
378
379- lastJDMoon = myJD;
380-
381
382 return raises;
383 }
384@@ -1520,6 +1540,7 @@
385 // Set defaults
386 conf->setValue("font_size", 15);
387 conf->setValue("Sun_Altitude", 12);
388+ conf->setValue("Horizon_Altitude", 0);
389 conf->setValue("font_color", "0,0.5,1");
390 conf->setValue("show_AcroCos", true);
391 conf->setValue("show_Good_Nights", true);
392@@ -1552,7 +1573,11 @@
393
394 iAltitude = conf->value("Sun_Altitude", 12).toInt();
395 AstroTwiAlti = -((double)iAltitude)/Rad2Deg ;
396+
397+ iHorizAltitude = conf->value("Horizon_Altitude", 0).toInt();
398+ HorizAlti = ((double)iHorizAltitude)/Rad2Deg ;
399
400+
401 conf->endGroup();
402 }
403
404@@ -1564,6 +1589,7 @@
405 conf->beginGroup("Observability");
406 conf->setValue("font_size", fontSize);
407 conf->setValue("Sun_Altitude", iAltitude);
408+ conf->setValue("Horizon_Altitude", iHorizAltitude);
409 conf->setValue("font_color", fontColorStr);
410 conf->setValue("show_AcroCos", show_AcroCos);
411 conf->setValue("show_Good_Nights", show_Good_Nights);
412@@ -1623,6 +1649,12 @@
413 return iAltitude;
414 }
415
416+int Observability::getHorizAltitude(void)
417+{
418+ return iHorizAltitude;
419+}
420+
421+
422 void Observability::setFontColor(int color, int value)
423 {
424 float fValue = (float)(value) / 100.;
425@@ -1641,6 +1673,13 @@
426 configChanged = true;
427 }
428
429+void Observability::setHorizAltitude(int value)
430+{
431+ HorizAlti = ((double) value)/Rad2Deg ;
432+ iHorizAltitude = value;
433+ configChanged = true;
434+}
435+
436
437 /// END OF STUFF FOR THE GUI CONFIG.
438 ///////////////////////////////
439
440=== modified file 'plugins/Observability/src/Observability.hpp'
441--- plugins/Observability/src/Observability.hpp 2012-08-29 13:18:51 +0000
442+++ plugins/Observability/src/Observability.hpp 2013-01-17 13:33:22 +0000
443@@ -71,6 +71,9 @@
444 //! Set the Sun altitude at twilight:
445 void setSunAltitude(int);
446
447+ //! Set the Sun altitude at twilight:
448+ void setHorizAltitude(int);
449+
450
451 //! get Show Flags from current configuration:
452 bool getShowFlags(int);
453@@ -84,6 +87,10 @@
454 //! get current Sun altitude at twilight:
455 int getSunAltitude(void);
456
457+ //! get current Horizon altitude:
458+ int getHorizAltitude(void);
459+
460+
461 public slots:
462 //! Set whether observability will execute or not:
463 void enableObservability(bool b);
464@@ -127,8 +134,9 @@
465 //! @param DecSun declination of the Sun (in radians).
466 //! @param RAMoon idem for the Moon.
467 //! @param DecMoon idem for the Moon.
468+//! @param EclLon is the module of the vector product of Heliocentric Ecliptic Coordinates of Sun and Moon (projected over the Ecliptic plane). Useful to derive the dates of Full Moon.
469 //! @param getBack controls whether Earth and Moon must be returned to their original positions after computation.
470- virtual void getSunMoonCoords(StelCore* core, double JD, double &RASun, double &DecSun, double &RAMoon, double &DecMoon, bool getBack);
471+ virtual void getSunMoonCoords(StelCore* core, double JD, double &RASun, double &DecSun, double &RAMoon, double &DecMoon, double &EclLon, bool getBack);
472
473
474 //! computes the selected-planet coordinates at a given Julian date.
475@@ -194,7 +202,7 @@
476 virtual bool CheckRise(int i);
477
478 //! Some useful constants and variables(almost self-explanatory).
479- double Rad2Deg, Rad2Hr, AstroTwiAlti, UA, TFrac, JDsec, Jan1stJD, halfpi, MoonT, nextFullMoon, prevFullMoon, RefFullMoon, GMTShift, MoonPerilune;
480+ double Rad2Deg, Rad2Hr, AstroTwiAlti, UA, TFrac, JDsec, Jan1stJD, halfpi, MoonT, nextFullMoon, prevFullMoon, RefFullMoon, GMTShift, MoonPerilune,RefracHoriz,HorizAlti;
481
482 //! RA, Dec, observer latitude, object's elevation, and Hour Angle at horizon.
483 double selRA, selDec, mylat, mylon, alti, horizH, culmAlt, myJD;
484@@ -224,7 +232,7 @@
485
486
487 //! Current simulation year and number of days in the year.;
488- int currYear, nDays, iAltitude;
489+ int currYear, nDays, iAltitude, iHorizAltitude;
490
491 //! Useful auxiliary strings, to help checking changes in source/observer. Also to store results that must survive between iterations.
492 QString selName, bestNight, ObsRange, objname, AcroCos;
493
494=== modified file 'plugins/Observability/src/gui/ObservabilityDialog.cpp'
495--- plugins/Observability/src/gui/ObservabilityDialog.cpp 2012-09-20 12:46:16 +0000
496+++ plugins/Observability/src/gui/ObservabilityDialog.cpp 2013-01-17 13:33:22 +0000
497@@ -74,6 +74,7 @@
498 connect(ui->Blue, SIGNAL(sliderMoved(int)), this, SLOT(setBlue(int)));
499 connect(ui->fontSize, SIGNAL(sliderMoved(int)), this, SLOT(setSize(int)));
500 connect(ui->SunAltitude, SIGNAL(sliderMoved(int)), this, SLOT(setAltitude(int)));
501+ connect(ui->HorizAltitude, SIGNAL(sliderMoved(int)), this, SLOT(setHorizon(int)));
502
503 connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close()));
504 connect(ui->restoreDefaultsButton, SIGNAL(clicked()), this, SLOT(restoreDefaults()));
505@@ -101,6 +102,9 @@
506
507 html += "<h3>" + q_("Explanation of some parameters") + "</h3><table width=\"90%\">";
508 html += QString("<tr><td>%1</td><td>%2</td></tr>").arg(q_("Sun altitude at twilight:")).arg(q_("Any celestial object will be considered visible when the Sun is below this altitude. The altitude at astronomical twilight ranges usually between -12 and -18 degrees. This parameter is only used for the estimate of the range of observable epochs (see below)."));
509+
510+ html += QString("<tr><td>%1</td><td>%2</td></tr>").arg(q_("Horizon altitude:")).arg(q_("Minimum observable altitude (due to mountains, buildings, or just a limited telescope mount)."));
511+
512 html += QString("<tr><td>%1</td><td>%2</td></tr>").arg(q_("Today ephemeris:")).arg(q_("Self-explanatory. The program will show the rise, set, and culmination (transit) times. The exact times for these ephemeris are given in two ways: as time spans (referred to the current time) and as clock hours (in local time)."));
513 html += QString("<tr><td>%1</td><td>%2</td></tr>").arg(q_("Acronychal/Cosmical rise/set:")).arg(q_("The Acronychal rise (or set) of an object happens when the object rises (or sets) just when the Sun sets (or rises), respectively. The exact dates of these ephemeris depend on the Observer's location. The dates between the Acronychal set and rise are those when the altitude of the celestial object uses to be high when the Sun is well below the horizon (hence the object can be well observed). On the contrary, the Cosmical rise (or set) happens when both, the object and the Sun, rise (or set) simultaneously. It is obvious that the source is hardly observable (or not observable at all) in the dates between Cosmical set and rise."));
514 html += QString("<tr><td>%1</td><td>%2</td></tr>").arg(q_("Largest Sun separation:")).arg(q_("Happens when the angular separation between the Sun and the celestial object are maximum. In most cases, this is equivalent to say that the Equatorial longitudes of the Sun and the object differ by 180 degrees, so the Sun is in opposition to the object. When an object is at its maximum possible angular separation from the Sun (no matter if it is a planet or a star), it culminates roughly at midnight, and on the darkest possible area of the Sky at that declination. Hence, that is the 'best' night to observe a particular object."));
515@@ -141,7 +145,12 @@
516 ui->fontSize->setValue(GETSTELMODULE(Observability)->getFontSize());
517 int SAlti = GETSTELMODULE(Observability)->getSunAltitude();
518 ui->SunAltitude->setValue(SAlti);
519- ui->AltiText->setText(QString("-%1 %2").arg(SAlti).arg(q_("deg.")));
520+ ui->AltiText->setText(QString("%1 -%2 %3").arg(q_("Sun altitude at twilight:")).arg(SAlti).arg(q_("deg.")));
521+
522+ SAlti = GETSTELMODULE(Observability)->getHorizAltitude();
523+ ui->HorizAltitude->setValue(SAlti);
524+ ui->HorizText->setText(QString("%1 %2 %3").arg(q_("Horizon altitude:")).arg(SAlti).arg(q_("deg.")));
525+
526 }
527
528 void ObservabilityDialog::saveSettings(void)
529@@ -213,9 +222,15 @@
530
531 void ObservabilityDialog::setAltitude(int Value)
532 {
533- ui->AltiText->setText(QString("-%1 %2").arg(Value).arg(q_("deg.")));
534+ ui->AltiText->setText(QString("%1 -%2 %3").arg(q_("Sun altitude at twilight:")).arg(Value).arg(q_("deg.")));
535 GETSTELMODULE(Observability)->setSunAltitude(Value);
536 }
537
538
539+void ObservabilityDialog::setHorizon(int Value)
540+{
541+ ui->HorizText->setText(QString("%1 %2 %3").arg(q_("Horizon altitude:")).arg(Value).arg(q_("deg.")));
542+ GETSTELMODULE(Observability)->setHorizAltitude(Value);
543+}
544+
545
546
547=== modified file 'plugins/Observability/src/gui/ObservabilityDialog.hpp'
548--- plugins/Observability/src/gui/ObservabilityDialog.hpp 2012-08-10 15:26:42 +0000
549+++ plugins/Observability/src/gui/ObservabilityDialog.hpp 2013-01-17 13:33:22 +0000
550@@ -58,6 +58,7 @@
551 void setBlue(int);
552 void setSize(int);
553 void setAltitude(int);
554+ void setHorizon(int);
555
556 private:
557 Ui_ObservabilityDialog* ui;
558
559=== modified file 'plugins/Observability/src/gui/ObservabilityDialog.ui'
560--- plugins/Observability/src/gui/ObservabilityDialog.ui 2012-08-25 13:47:58 +0000
561+++ plugins/Observability/src/gui/ObservabilityDialog.ui 2013-01-17 13:33:22 +0000
562@@ -6,7 +6,7 @@
563 <rect>
564 <x>0</x>
565 <y>0</y>
566- <width>528</width>
567+ <width>530</width>
568 <height>556</height>
569 </rect>
570 </property>
571@@ -351,16 +351,40 @@
572 </font>
573 </property>
574 <property name="text">
575- <string>Sun altitude at twilight</string>
576+ <string>Observing conditions</string>
577 </property>
578 </widget>
579 </item>
580 <item>
581 <layout class="QHBoxLayout" name="horizontalLayout_5">
582 <item>
583+ <widget class="QLabel" name="HorizText">
584+ <property name="text">
585+ <string>Horizon altitude: 0 deg.</string>
586+ </property>
587+ <property name="alignment">
588+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
589+ </property>
590+ </widget>
591+ </item>
592+ <item alignment="Qt::AlignLeft">
593+ <widget class="QSlider" name="HorizAltitude">
594+ <property name="maximum">
595+ <number>45</number>
596+ </property>
597+ <property name="orientation">
598+ <enum>Qt::Horizontal</enum>
599+ </property>
600+ </widget>
601+ </item>
602+ </layout>
603+ </item>
604+ <item>
605+ <layout class="QHBoxLayout" name="horizontalLayout_55">
606+ <item>
607 <widget class="QLabel" name="AltiText">
608 <property name="text">
609- <string>0 deg.</string>
610+ <string>Sun altitude at twilight: 0 deg.</string>
611 </property>
612 <property name="alignment">
613 <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
614@@ -378,6 +402,7 @@
615 </widget>
616 </item>
617 </layout>
618+
619 </item>
620 </layout>
621 </item>