Observability.cpp   Observability.cpp 
skipping to change at line 78 skipping to change at line 78
info.version = OBSERVABILITY_PLUGIN_VERSION; info.version = OBSERVABILITY_PLUGIN_VERSION;
return info; return info;
} }
// TODO: Migrate to static const? --BM ==> GZ during JDfix for 0.14: SURE! // TODO: Migrate to static const? --BM ==> GZ during JDfix for 0.14: SURE!
// Some useful constants: // Some useful constants:
const double Observability::Rad2Deg = 180./M_PI; // Convert degrees into radians const double Observability::Rad2Deg = 180./M_PI; // Convert degrees into radians
const double Observability::Rad2Hr = 12./M_PI; // Convert hours i nto radians const double Observability::Rad2Hr = 12./M_PI; // Convert hours i nto radians
const double Observability::UA = AU; // 1.4958e+8; // Astronomical Unit in Km. ==> HAS BEEN DEFINED IN StelUtils.hpp! const double Observability::UA = AU; // 1.4958e+8; // Astronomical Unit in Km. ==> HAS BEEN DEFINED IN StelUtils.hpp!
const double Observability::TFrac = 0.9972677595628414; // Convert siderea l time into Solar time const double Observability::TFrac = 0.9972677595628414; // Convert siderea l time into Solar time
const double Observability::JDsec = 1./86400.; // A second in day s. ==> TODO USE StelCore::JD_SECOND instead
const double Observability::halfpi = M_PI * 0.5; // 1.57079632675; // pi/2 const double Observability::halfpi = M_PI * 0.5; // 1.57079632675; // pi/2
const double Observability::MoonT = 29.530588; // Moon synodic pe riod (used as first estimate of Full Moon). ==> FIND MORE DEC. PLACES! const double Observability::MoonT = 29.530588; // Moon synodic pe riod (used as first estimate of Full Moon). ==> FIND MORE DEC. PLACES!
const double Observability::RefFullMoon = 2451564.696; // Reference Julian date of a Full Moon. const double Observability::RefFullMoon = 2451564.696; // Reference Julian date of a Full Moon.
const double Observability::MoonPerilune = 0.0024236308; // Smallest Earth- Moon distance (in AU). const double Observability::MoonPerilune = 0.0024236308; // Smallest Earth- Moon distance (in AU).
Observability::Observability() Observability::Observability()
: configDialog(new ObservabilityDialog()) : configDialog(new ObservabilityDialog())
, nextFullMoon(0.) , nextFullMoon(0.)
, prevFullMoon(0.) , prevFullMoon(0.)
, GMTShift(0.) , GMTShift(0.)
skipping to change at line 593 skipping to change at line 592
// Culmination: // Culmination:
if (isStar) if (isStar)
{ {
culmAlt = qAbs(mylat-selDec); // 90.-altitude at tra nsit. culmAlt = qAbs(mylat-selDec); // 90.-altitude at tra nsit.
transit = LocPos[1]<0.0; transit = LocPos[1]<0.0;
}; };
if (culmAlt < (halfpi - refractedHorizonAlt)) // Source can be observed. if (culmAlt < (halfpi - refractedHorizonAlt)) // Source can be observed.
{ {
double altiAtCulmi = Rad2Deg*(halfpi-culmAlt-refract // THESE IS FREE OF ATMOSPHERE AND REFERRED TO TRUE HOR
edHorizonAlt); IZON!
double altiAtCulmi = (halfpi-culmAlt); //-refractedH
orizonAlt);
// Add refraction, if necessary:
Vec3d TempRefr;
TempRefr[0] = std::cos(altiAtCulmi);
TempRefr[1] = 0.0;
TempRefr[2] = std::sin(altiAtCulmi);
Vec3d CorrRefr = core->altAzToEquinoxEqu(TempRefr,St
elCore::RefractionOff);
TempRefr = core->equinoxEquToAltAz(CorrRefr,StelCore
::RefractionAuto);
altiAtCulmi = Rad2Deg*std::asin(TempRefr[2]);
double2hms(TFrac*currH,dc,mc,sc); double2hms(TFrac*currH,dc,mc,sc);
//String with the time span for culmination: //String with the time span for culmination:
Cul = (dc==0)?"":QString("%1%2 ").arg(dc).arg(msgH); Cul = (dc==0)?"":QString("%1%2 ").arg(dc).arg(msgH);
Cul += (mc==0)?"":QString("%1%2 ").arg(mc).arg(msgM) ; Cul += (mc==0)?"":QString("%1%2 ").arg(mc).arg(msgM) ;
Cul += QString("%1%2").arg(sc).arg(msgS); Cul += QString("%1%2").arg(sc).arg(msgS);
if (!transit) if (!transit)
{ {
double2hms(toUnsignedRA(currLocalT + TFrac*c urrH + 12.), double2hms(toUnsignedRA(currLocalT + TFrac*c urrH + 12.),
ephHour, ephMinute, ephSecond); / / Local time at transit. ephHour, ephMinute, ephSecond); / / Local time at transit.
skipping to change at line 713 skipping to change at line 723
{ {
int acroRise, acroSet, cosRise, cosS et, heliRise, heliSet; int acroRise, acroSet, cosRise, cosS et, heliRise, heliSet;
int result = calculateAcroCos(acroRi se, acroSet, int result = calculateAcroCos(acroRi se, acroSet,
cosRis e, cosSet); cosRis e, cosSet);
int resultHeli = calculateHeli(0,hel iRise,heliSet); int resultHeli = calculateHeli(0,hel iRise,heliSet);
QString acroRiseStr, acroSetStr; QString acroRiseStr, acroSetStr;
QString cosRiseStr, cosSetStr; QString cosRiseStr, cosSetStr;
QString heliRiseStr, heliSetStr; QString heliRiseStr, heliSetStr;
// TODO: Possible error? Day 0 is 1 // TODO: Possible error? Day 0 is 1
Jan. Jan. ==> IMV: Indeed! Corrected
acroRiseStr = (acroRise>0)?formatAsD acroRiseStr = (acroRise>=0)?formatAs
ate(acroRise):msgNone; Date(acroRise):msgNone;
acroSetStr = (acroSet>0)?formatAsDat acroSetStr = (acroSet>=0)?formatAsDa
e(acroSet):msgNone; te(acroSet):msgNone;
cosRiseStr = (cosRise>0)?formatAsDat e(cosRise):msgNone; cosRiseStr = (cosRise>0)?formatAsDat e(cosRise):msgNone;
cosSetStr = (cosSet>0)?formatAsDate( cosSet):msgNone; cosSetStr = (cosSet>0)?formatAsDate( cosSet):msgNone;
heliRiseStr = (heliRise>0)?formatAsD heliRiseStr = (heliRise>=0)?formatAs
ate(heliRise):msgNone; Date(heliRise):msgNone;
heliSetStr = (heliSet>0)?formatAsDat heliSetStr = (heliSet>=0)?formatAsDa
e(heliSet):msgNone; te(heliSet):msgNone;
if (result==3 || result==1) if (result==3 || result==1)
lineAcroCos = msgAcroRise lineAcroCos = msgAcroRise
.arg(acroRise Str) .arg(acroRise Str)
.arg(acroSetS tr); .arg(acroSetS tr);
else else
lineAcroCos = msgNoAcroRise ; lineAcroCos = msgNoAcroRise ;
if (result==3 || result==2) if (result==3 || result==2)
lineAcroCos += msgCosmRise lineAcroCos += msgCosmRise
skipping to change at line 1359 skipping to change at line 1369
int i; int i;
double hHoriz, ra, dec, raSun, decSun, tempH, /* tempJd, */ tempEphH , curSidT, eclLon; double hHoriz, ra, dec, raSun, decSun, tempH, /* tempJd, */ tempEphH , curSidT, eclLon;
QPair<double, double> tempJd; QPair<double, double> tempJd;
//Vec3d Observer; //Vec3d Observer;
hHoriz = calculateHourAngle(mylat, refractedHorizonAlt, selDec); hHoriz = calculateHourAngle(mylat, refractedHorizonAlt, selDec);
bool raises = hHoriz > 0.0; bool raises = hHoriz > 0.0;
// Only recompute ephemeris from second to second (at least) // Only recompute ephemeris from second to second (at least)
// or if the source has changed (i.e., Sun <-> Moon). This saves resources: // or if the source has changed (i.e., Sun <-> Moon). This saves resources:
if (qAbs(myJD.first-lastJDMoon)>JDsec || lastType!=bodyType || souCh anged) if (qAbs(myJD.first-lastJDMoon)>StelCore::JD_SECOND || lastType!=bod yType || souChanged)
{ {
// qDebug() << q_("%1 %2 %3 %4").arg(Kind).arg(LastObject) .arg(myJD,0,'f',5).arg(lastJDMoon,0,'f',5); // qDebug() << q_("%1 %2 %3 %4").arg(Kind).arg(LastObject) .arg(myJD,0,'f',5).arg(lastJDMoon,0,'f',5);
lastType = bodyType; lastType = bodyType;
myEarth->computePosition(myJD.second); myEarth->computePosition(myJD.second);
myEarth->computeTransMatrix(myJD.first, myJD.second); myEarth->computeTransMatrix(myJD.first, myJD.second);
Vec3d earthPos = myEarth->getHeliocentricEclipticPos(); Vec3d earthPos = myEarth->getHeliocentricEclipticPos();
skipping to change at line 1448 skipping to change at line 1458
Hcurr = toUnsignedRA(SidT-ra); Hcurr = toUnsignedRA(SidT-ra);
Hcurr -= (hasRisen)?0.0:24.; Hcurr -= (hasRisen)?0.0:24.;
Hcurr -= (Hcurr>12.)?24.0:0.0; Hcurr -= (Hcurr>12.)?24.0:0.0;
// H at horizon for mod. coordinates: // H at horizon for mod. coordinates:
hHoriz = calculateHourAngle(mylat,refractedH orizonAlt,dec); hHoriz = calculateHourAngle(mylat,refractedH orizonAlt,dec);
// Compute eph. times for mod. coordinates: // Compute eph. times for mod. coordinates:
tempH = (-hHoriz-Hcurr)*TFrac; tempH = (-hHoriz-Hcurr)*TFrac;
if (hasRisen==false) tempH += (tempH<0.0)?24 .0:0.0; if (hasRisen==false) tempH += (tempH<0.0)?24 .0:0.0;
// Check convergence: // Check convergence:
if (qAbs(tempH-tempEphH)<JDsec) break; if (qAbs(tempH-tempEphH)<StelCore::JD_SECOND ) break;
// Update rise-time estimate: // Update rise-time estimate:
tempEphH = tempH; tempEphH = tempH;
MoonRise = myJD.first + (tempEphH/24.); MoonRise = myJD.first + (tempEphH/24.);
}; };
// Set time: // Set time:
tempEphH = MoonSet; tempEphH = MoonSet;
MoonSet = myJD.first + (MoonSet/24.); MoonSet = myJD.first + (MoonSet/24.);
for (i=0; i<NUM_ITER; i++) for (i=0; i<NUM_ITER; i++)
{ {
skipping to change at line 1484 skipping to change at line 1494
Hcurr = toUnsignedRA(SidT-ra); Hcurr = toUnsignedRA(SidT-ra);
Hcurr -= (hasRisen)?24.:0.; Hcurr -= (hasRisen)?24.:0.;
Hcurr += (Hcurr<-12.)?24.0:0.0; Hcurr += (Hcurr<-12.)?24.0:0.0;
// H at horizon for mod. coordinates: // H at horizon for mod. coordinates:
hHoriz = calculateHourAngle(mylat, refracted HorizonAlt, dec); hHoriz = calculateHourAngle(mylat, refracted HorizonAlt, dec);
// Compute eph. times for mod. coordinates: // Compute eph. times for mod. coordinates:
tempH = (hHoriz-Hcurr)*TFrac; tempH = (hHoriz-Hcurr)*TFrac;
if (!hasRisen) if (!hasRisen)
tempH -= (tempH>0.0)?24.0:0.0; tempH -= (tempH>0.0)?24.0:0.0;
// Check convergence: // Check convergence:
if (qAbs(tempH-tempEphH)<JDsec) if (qAbs(tempH-tempEphH)<StelCore::JD_SECOND )
break; break;
// Update set-time estimate: // Update set-time estimate:
tempEphH = tempH; tempEphH = tempH;
MoonSet = myJD.first + (tempEphH/24.); MoonSet = myJD.first + (tempEphH/24.);
}; };
} }
else // Comes from if(raises) else // Comes from if(raises)
{ {
MoonSet = -1.0; MoonSet = -1.0;
MoonRise = -1.0; MoonRise = -1.0;
skipping to change at line 1525 skipping to change at line 1535
if (bodyType==1) {ra = raSun; dec = decSun;}; if (bodyType==1) {ra = raSun; dec = decSun;};
// Current hour angle at mod. coordinates: // Current hour angle at mod. coordinates:
Hcurr = toUnsignedRA(SidT-ra); Hcurr = toUnsignedRA(SidT-ra);
Hcurr += (LocPos[1]<0.0)?24.0:-24.0; Hcurr += (LocPos[1]<0.0)?24.0:-24.0;
Hcurr -= (Hcurr>12.)?24.0:0.0; Hcurr -= (Hcurr>12.)?24.0:0.0;
// Compute eph. times for mod. coordinates: // Compute eph. times for mod. coordinates:
tempH = -Hcurr*TFrac; tempH = -Hcurr*TFrac;
// Check convergence: // Check convergence:
if (qAbs(tempH-tempEphH)<JDsec) break; if (qAbs(tempH-tempEphH)<StelCore::JD_SECOND) break;
tempEphH = tempH; tempEphH = tempH;
MoonCulm = myJD.first + (tempEphH/24.); MoonCulm = myJD.first + (tempEphH/24.);
culmAlt = qAbs(mylat-dec); // 90 - altitude at trans it. culmAlt = qAbs(mylat-dec); // 90 - altitude at trans it.
}; };
// qDebug() << q_("%1").arg(MoonCulm,0,'f',5); // qDebug() << q_("%1").arg(MoonCulm,0,'f',5);
lastJDMoon = myJD.first; lastJDMoon = myJD.first;
}; // Comes from if (qAbs(myJD.first-lastJDMoon)>JDsec || LastObject !=Kind) }; // Comes from if (qAbs(myJD.first-lastJDMoon)>JDsec || LastObject !=Kind)
 End of changes. 8 change blocks. 
17 lines changed or deleted 30 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/