Observability.cpp   Observability.cpp 
skipping to change at line 155 skipping to change at line 155
show_Good_Nights = conf->value("show_Good_Nights", true).toBool(); show_Good_Nights = conf->value("show_Good_Nights", true).toBool();
show_Best_Night = conf->value("show_Best_Night", true).toBool(); show_Best_Night = conf->value("show_Best_Night", true).toBool();
show_Today = conf->value("show_Today", true).toBool(); show_Today = conf->value("show_Today", true).toBool();
show_FullMoon = conf->value("show_FullMoon", true).toBool(); show_FullMoon = conf->value("show_FullMoon", true).toBool();
// show_Crescent = conf->value("show_Crescent", true).toBool(); // show_Crescent = conf->value("show_Crescent", true).toBool();
// show_SuperMoon = conf->value("show_SuperMoon", true).toBool(); // show_SuperMoon = conf->value("show_SuperMoon", true).toBool();
conf->endGroup(); conf->endGroup();
///////////////////////////////// /////////////////////////////////
// Apply format for date from main settings
if (conf->value("localization/date_display_format", "system_default"
).toString() == "ddmmyyyy")
setDateFormat(true);
else
setDateFormat(false);
// Dummy initial values for parameters and data vectors: // Dummy initial values for parameters and data vectors:
mylat = 1000.; mylon = 1000.; mylat = 1000.; mylon = 1000.;
myJD = 0.0; myJD = 0.0;
currYear = 0; currYear = 0;
isStar = true; isStar = true;
isMoon = false; isMoon = false;
isSun = false; isSun = false;
isScreen = true; isScreen = true;
raised=false; raised=false;
skipping to change at line 184 skipping to change at line 190
for (int i=0;i<366;i++) { for (int i=0;i<366;i++) {
SunRA[i] = 0.0; SunDec[i] = 0.0; SunRA[i] = 0.0; SunDec[i] = 0.0;
ObjectRA[i] = 0.0; ObjectDec[i]=0.0; ObjectRA[i] = 0.0; ObjectDec[i]=0.0;
SunSidT[0][i]=0.0; SunSidT[1][i]=0.0; SunSidT[0][i]=0.0; SunSidT[1][i]=0.0;
ObjectSidT[0][i]=0.0; ObjectSidT[1][i]=0.0; ObjectSidT[0][i]=0.0; ObjectSidT[1][i]=0.0;
ObjectH0[i] = 0.0; ObjectH0[i] = 0.0;
yearJD[i] = 0.0; yearJD[i] = 0.0;
}; };
// Set names of the months:
QString mons[12]={qc_("Jan", "short month name"), qc_("Feb", "short
month name"), qc_("Mar", "short month name"), qc_("Apr", "short month name"
), qc_("May", "short month name"), qc_("Jun", "short month name"), qc_("Jul
", "short month name"), qc_("Aug", "short month name"), qc_("Sep", "short m
onth name"), qc_("Oct", "short month name"), qc_("Nov", "short month name")
, qc_("Dec", "short month name")};
for (int i=0;i<12;i++) {
months[i]=mons[i];
};
} }
Observability::~Observability() Observability::~Observability()
{ {
if (GlowIcon!=NULL) if (GlowIcon!=NULL)
delete GlowIcon; delete GlowIcon;
if (OnIcon!=NULL) if (OnIcon!=NULL)
delete OnIcon; delete OnIcon;
if (OffIcon!=NULL) if (OffIcon!=NULL)
delete OffIcon; delete OffIcon;
delete configDialog; delete configDialog;
} }
void Observability::updateMessageText()
{
// Set names of the months:
QString mons[12]={qc_("Jan", "short month name"), qc_("Feb", "short
month name"), qc_("Mar", "short month name"), qc_("Apr", "short month name"
), qc_("May", "short month name"), qc_("Jun", "short month name"), qc_("Jul
", "short month name"), qc_("Aug", "short month name"), qc_("Sep", "short m
onth name"), qc_("Oct", "short month name"), qc_("Nov", "short month name")
, qc_("Dec", "short month name")};
for (int i=0;i<12;i++) {
months[i]=mons[i];
};
msgH = q_("h");
msgM = q_("m");
msgS = q_("s");
msgSetsAt = q_("Sets at %1 (in %2)");
msgRoseAt = q_("Rose at %1 (%2 ago)");
msgSetAt = q_("Set at %1 (%2 ago)");
msgRisesAt = q_("Rises at %1 (in %2)");
msgCircumpolar = q_("Circumpolar.");
msgNoRise = q_("No rise.");
msgCulminatesAt = q_("Culminates at %1 (in %2) at %3 deg.");
msgCulminatedAt = q_("Culminated at %1 (%2 ago) at %3 deg.");
msgSrcNotObs = q_("Source is not observable.");
msgNoACRise = q_("No Acronychal nor Cosmical rise/set.");
msgGreatElong = q_("Greatest elongation: ");
msgLargSSep = q_("Largest Sun separation: ");
msgAtDeg = q_(" (at %1 deg.)");
msgNone = q_("None");
msgAcroRise = q_("Acronychal rise/set");
msgNoAcroRise = q_("No Acronychal rise/set.");
msgCosmRise = q_("Cosmical rise/set");
msgNoCosmRise = q_("No Cosmical rise/set.");
msgWholeYear = q_("Observable during the whole year.");
msgNotObs = q_("Not observable at dark night.");
msgAboveHoriz = q_("Nights above horizon: ");
msgToday = q_("TODAY:");
msgThisYear = q_("THIS YEAR:");
msgPrevFullMoon = q_("Previous Full Moon: %1 %2 at %3:%4. ");
msgNextFullMoon = q_("Next Full Moon: %1 %2 at %3:%4. ");
}
double Observability::getCallOrder(StelModuleActionName actionName) const double Observability::getCallOrder(StelModuleActionName actionName) const
{ {
if (actionName==StelModule::ActionDraw) if (actionName==StelModule::ActionDraw)
return StelApp::getInstance().getModuleMgr().getModule("Land scapeMgr")->getCallOrder(actionName)+10.; return StelApp::getInstance().getModuleMgr().getModule("Land scapeMgr")->getCallOrder(actionName)+10.;
return 0; return 0;
} }
void Observability::init() void Observability::init()
{ {
qDebug() << "init called for Observability"; qDebug() << "init called for Observability";
skipping to change at line 233 skipping to change at line 271
toolbarButton = new StelButton(NULL, *OnIcon, *OffIcon, *Glo wIcon, gui->getGuiAction("actionShow_Observability")); toolbarButton = new StelButton(NULL, *OnIcon, *OffIcon, *Glo wIcon, gui->getGuiAction("actionShow_Observability"));
gui->getButtonBar()->addButton(toolbarButton, "065-pluginsGr oup"); gui->getButtonBar()->addButton(toolbarButton, "065-pluginsGr oup");
connect(gui->getGuiAction("actionShow_Observability"), SIGNA L(toggled(bool)), this, SLOT(enableObservability(bool))); connect(gui->getGuiAction("actionShow_Observability"), SIGNA L(toggled(bool)), this, SLOT(enableObservability(bool)));
connect(gui->getGuiAction("actionShow_Observability_ConfigDi alog"), SIGNAL(toggled(bool)), configDialog, SLOT(setVisible(bool))); connect(gui->getGuiAction("actionShow_Observability_ConfigDi alog"), SIGNAL(toggled(bool)), configDialog, SLOT(setVisible(bool)));
connect(configDialog, SIGNAL(visibleChanged(bool)), gui->get GuiAction("actionShow_Observability_ConfigDialog"), SLOT(setChecked(bool))) ; connect(configDialog, SIGNAL(visibleChanged(bool)), gui->get GuiAction("actionShow_Observability_ConfigDialog"), SLOT(setChecked(bool))) ;
} }
catch (std::exception &e) catch (std::exception &e)
{ {
qWarning() << "WARNING: unable create toolbar button for Obs ervability plugin (or load gonfig GUI). " << e.what(); qWarning() << "WARNING: unable create toolbar button for Obs ervability plugin (or load gonfig GUI). " << e.what();
}; };
updateMessageText();
connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SL
OT(updateMessageText()));
} }
///////////////////////////////////////////// /////////////////////////////////////////////
// MAIN CODE: // MAIN CODE:
void Observability::draw(StelCore* core, StelRenderer* renderer) void Observability::draw(StelCore* core, StelRenderer* renderer)
{ {
if (!flagShowObservability) return; // Button is off. if (!flagShowObservability) return; // Button is off.
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
skipping to change at line 479 skipping to change at line 520
}; };
}; };
if ((solvedMoon && MoonRise>0.0) || (!isSun && !isMoon && ho rizH>0.0)) if ((solvedMoon && MoonRise>0.0) || (!isSun && !isMoon && ho rizH>0.0))
{ {
double2hms(TFrac*Set,d1,m1,s1); double2hms(TFrac*Set,d1,m1,s1);
double2hms(TFrac*Rise,d2,m2,s2); double2hms(TFrac*Rise,d2,m2,s2);
// Strings with time spans for rise/set/transit: // Strings with time spans for rise/set/transit:
RS1 = (d1==0)?"":QString("%1%2 ").arg(d1).arg(q_("h" RS1 = (d1==0)?"":QString("%1%2 ").arg(d1).arg(msgH);
)); RS1 += (m1==0)?"":QString("%1%2 ").arg(m1).arg(q_("m")); RS1 += QString RS1 += (m1==0)?"":QString("%1%2 ").arg(m1).arg(msgM); RS1 += QString("%1%2
("%1%2").arg(s1).arg(q_("s")); ").arg(s1).arg(msgS);
RS2 = (d2==0)?"":QString("%1%2 ").arg(d2).arg(q_("h" RS2 = (d2==0)?"":QString("%1%2 ").arg(d2).arg(msgH);
)); RS2 += (m2==0)?"":QString("%1%2 ").arg(m2).arg(q_("m")); RS2 += QString RS2 += (m2==0)?"":QString("%1%2 ").arg(m2).arg(msgM); RS2 += QString("%1%2
("%1%2").arg(s2).arg(q_("s")); ").arg(s2).arg(msgS);
if (raised) if (raised)
{ {
double2hms(toUnsignedRA(currLocalT+TFrac*Se t+12.),ephHour,ephMinute,ephSecond); double2hms(toUnsignedRA(currLocalT+TFrac*Se t+12.),ephHour,ephMinute,ephSecond);
SetTime = QString("%1:%2").arg(ephHour).arg( ephMinute,2,10,QLatin1Char('0')); // Local time for set. SetTime = QString("%1:%2").arg(ephHour).arg( ephMinute,2,10,QLatin1Char('0')); // Local time for set.
double2hms(toUnsignedRA(currLocalT-TFrac*Ri se+12.),ephHour,ephMinute,ephSecond); // Local time for rise. double2hms(toUnsignedRA(currLocalT-TFrac*Ri se+12.),ephHour,ephMinute,ephSecond); // Local time for rise.
RiseTime = QString("%1:%2").arg(ephHour).arg (ephMinute,2,10,QLatin1Char('0')); RiseTime = QString("%1:%2").arg(ephHour).arg (ephMinute,2,10,QLatin1Char('0'));
RS1 = q_("Sets at %1 (in %2)").arg(SetTime). //RS1 = q_("Sets at %1 (in %2)").arg(SetTime
arg(RS1); ).arg(RS1);
RS2 = q_("Rose at %1 (%2 ago)").arg(RiseTime //RS2 = q_("Rose at %1 (%2 ago)").arg(RiseTi
).arg(RS2); me).arg(RS2);
RS1 = msgSetsAt.arg(SetTime).arg(RS1);
RS2 = msgRoseAt.arg(RiseTime).arg(RS2);
} }
else else
{ {
double2hms(toUnsignedRA(currLocalT-TFrac*Se t+12.),ephHour,ephMinute,ephSecond); double2hms(toUnsignedRA(currLocalT-TFrac*Se t+12.),ephHour,ephMinute,ephSecond);
SetTime = QString("%1:%2").arg(ephHour).arg( ephMinute,2,10,QLatin1Char('0')); SetTime = QString("%1:%2").arg(ephHour).arg( ephMinute,2,10,QLatin1Char('0'));
double2hms(toUnsignedRA(currLocalT+TFrac*Ri se+12.),ephHour,ephMinute,ephSecond); double2hms(toUnsignedRA(currLocalT+TFrac*Ri se+12.),ephHour,ephMinute,ephSecond);
RiseTime = QString("%1:%2").arg(ephHour).arg (ephMinute,2,10,QLatin1Char('0')); RiseTime = QString("%1:%2").arg(ephHour).arg (ephMinute,2,10,QLatin1Char('0'));
RS1 = q_("Set at %1 (%2 ago)").arg(SetTime). //RS1 = q_("Set at %1 (%2 ago)").arg(SetTime
arg(RS1); ).arg(RS1);
RS2 = q_("Rises at %1 (in %2)").arg(RiseTime //RS2 = q_("Rises at %1 (in %2)").arg(RiseTi
).arg(RS2); me).arg(RS2);
RS1 = msgSetAt.arg(SetTime).arg(RS1);
RS2 = msgRisesAt.arg(RiseTime).arg(RS2);
}; };
} }
else { // The source is either circumpolar or never rises: else { // The source is either circumpolar or never rises:
(alti>RefracHoriz)? RS1 = q_("Circumpolar."): RS1 = q_("No rise."); (alti>RefracHoriz)? RS1 = msgCircumpolar: RS1 = msgN oRise;
RS2 = ""; RS2 = "";
}; };
// Culmination: // Culmination:
if (isStar) if (isStar)
{ {
culmAlt = std::abs(mylat-selDec); // 90.-altitude at transit . culmAlt = std::abs(mylat-selDec); // 90.-altitude at transit .
transit = LocPos[1]<0.0; transit = LocPos[1]<0.0;
}; };
if (culmAlt<halfpi-RefracHoriz) { // Source can be observed. if (culmAlt<halfpi-RefracHoriz) { // Source can be observed.
double altiAtCulmi = Rad2Deg*(halfpi-culmAlt-RefracHoriz); double altiAtCulmi = Rad2Deg*(halfpi-culmAlt-RefracHoriz);
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(q_("h")); Cul += (mc==0)?"":QString("%1%2 ").arg(mc).arg(q_("m")); Cul += QString("%1%2") .arg(sc).arg(q_("s")); Cul = (dc==0)?"":QString("%1%2 ").arg(dc).arg(msgH); Cul += (mc==0)?"":QString("%1%2 ").arg(mc).arg(msgM); Cul += QString("%1%2").arg(s c).arg(msgS);
if (transit==false) { if (transit==false) {
double2hms(toUnsignedRA(currLocalT+TFrac*currH+12.) ,ephHour,ephMinute,ephSecond); // Local time at transit. double2hms(toUnsignedRA(currLocalT+TFrac*currH+12.) ,ephHour,ephMinute,ephSecond); // Local time at transit.
CulmTime = QString("%1:%2").arg(ephHour).arg(ephMinu te,2,10,QLatin1Char('0')); CulmTime = QString("%1:%2").arg(ephHour).arg(ephMinu te,2,10,QLatin1Char('0'));
Cul = q_("Culminates at %1 (in %2) at %3 deg.").arg( //Cul = q_("Culminates at %1 (in %2) at %3 deg.").ar
CulmTime).arg(Cul).arg(altiAtCulmi,0,'f',1);} g(CulmTime).arg(Cul).arg(altiAtCulmi,0,'f',1);
else { Cul = msgCulminatesAt.arg(CulmTime).arg(Cul).arg(alt
iAtCulmi,0,'f',1);
}
else
{
double2hms(toUnsignedRA(currLocalT-TFrac*currH+12.) ,ephHour,ephMinute,ephSecond); double2hms(toUnsignedRA(currLocalT-TFrac*currH+12.) ,ephHour,ephMinute,ephSecond);
CulmTime = QString("%1:%2").arg(ephHour).arg(ephMinu te,2,10,QLatin1Char('0')); CulmTime = QString("%1:%2").arg(ephHour).arg(ephMinu te,2,10,QLatin1Char('0'));
Cul = q_("Culminated at %1 (%2 ago) at %3 deg.").arg //Cul = q_("Culminated at %1 (%2 ago) at %3 deg.").a
(CulmTime).arg(Cul).arg(altiAtCulmi,0,'f',1); rg(CulmTime).arg(Cul).arg(altiAtCulmi,0,'f',1);
Cul = msgCulminatedAt.arg(CulmTime).arg(Cul).arg(alt
iAtCulmi,0,'f',1);
}; };
}; };
}; // This comes from show_Today==True }; // This comes from show_Today==True
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// NOW WE ANALYZE THE SOURCE OBSERVABILITY FOR THE WHOLE YEAR: // NOW WE ANALYZE THE SOURCE OBSERVABILITY FOR THE WHOLE YEAR:
// Compute yearly ephemeris (only if necessary, and not for Sun nor Moon): // Compute yearly ephemeris (only if necessary, and not for Sun nor Moon):
skipping to change at line 570 skipping to change at line 619
ObjectSidT[0][i] = auxSidT1; ObjectSidT[0][i] = auxSidT1;
ObjectSidT[1][i] = auxSidT2; ObjectSidT[1][i] = auxSidT2;
}; };
}; };
// Determine source observability (only if something changed): // Determine source observability (only if something changed):
if ((souChanged || locChanged || yearChanged)) { if ((souChanged || locChanged || yearChanged)) {
bestNight=""; ObsRange = ""; bestNight=""; ObsRange = "";
if (culmAlt>=halfpi-RefracHoriz) { // Source cannot be seen. if (culmAlt>=halfpi-RefracHoriz) { // Source cannot be seen.
ObsRange = q_("Source is not observable."); //ObsRange = q_("Source is not observable.")
AcroCos = q_("No Acronychal nor Cosmical ris ;
e/set."); //AcroCos = q_("No Acronychal nor Cosmical r
ise/set.");
ObsRange = msgSrcNotObs;
AcroCos = msgNoACRise;
} }
else { // Source can be seen. else { // Source can be seen.
/////////////////////////// ///////////////////////////
// - Part 1. Determine the best observing night (i.e., opposition to the Su n): // - Part 1. Determine the best observing night (i.e., opposition to the Su n):
if (show_Best_Night) { if (show_Best_Night) {
int selday = 0; int selday = 0;
double deltaPhs = -1.0; // Initial d ummy value double deltaPhs = -1.0; // Initial d ummy value
double tempPhs; double tempPhs;
for (int i=0;i<nDays;i++) { // Maxim ize the Sun-object separation. for (int i=0;i<nDays;i++) { // Maxim ize the Sun-object separation.
tempPhs = Lambda(ObjectRA[i] ,ObjectDec[i],SunRA[i],SunDec[i]); tempPhs = Lambda(ObjectRA[i] ,ObjectDec[i],SunRA[i],SunDec[i]);
if (tempPhs>deltaPhs) {selda y=i;deltaPhs=tempPhs;}; if (tempPhs>deltaPhs) {selda y=i;deltaPhs=tempPhs;};
}; };
if (selName=="Mercury" || selName==" Venus") if (selName=="Mercury" || selName==" Venus")
{ {
bestNight = q_("Greatest elo //bestNight = q_("Greatest e
ngation: "); longation: ");
bestNight = msgGreatElong;
} else } else
{ {
bestNight = q_("Largest Sun //bestNight = q_("Largest Su
separation: "); n separation: ");
bestNight = msgLargSSep;
}; };
bestNight = bestNight + CalenDate(se //bestNight = bestNight + CalenDate(
lday) + q_(" (at %1 deg.)").arg(deltaPhs*Rad2Deg,0,'f',1); selday) + q_(" (at %1 deg.)").arg(deltaPhs*Rad2Deg,0,'f',1);
bestNight = bestNight + CalenDate(se
lday) + msgAtDeg.arg(deltaPhs*Rad2Deg,0,'f',1);
}; };
/////////////////////////////// ///////////////////////////////
// - Part 2. Determine Acronychal and Cosmical rise and set: // - Part 2. Determine Acronychal and Cosmical rise and set:
if (show_AcroCos) { if (show_AcroCos) {
int selRise, selSet, selRise2, selSe t2; // days of year for Acronical and Cosmical rise/set. int selRise, selSet, selRise2, selSe t2; // days of year for Acronical and Cosmical rise/set.
int Acro = CheckAcro(selRise,selSet, selRise2,selSet2); int Acro = CheckAcro(selRise,selSet, selRise2,selSet2);
QString AcroRiseStr, AcroSetStr; QString AcroRiseStr, AcroSetStr;
QString CosmRiseStr, CosmSetStr; QString CosmRiseStr, CosmSetStr;
AcroRiseStr = (selRise>0)?CalenDate( AcroRiseStr = (selRise>0)?CalenDate(
selRise):q_("None"); selRise):msgNone;
AcroSetStr = (selSet>0)?CalenDate(se AcroSetStr = (selSet>0)?CalenDate(se
lSet):q_("None"); lSet):msgNone;
CosmRiseStr = (selRise2>0)?CalenDate CosmRiseStr = (selRise2>0)?CalenDate
(selRise2):q_("None"); (selRise2):msgNone;
CosmSetStr = (selSet2>0)?CalenDate(s CosmSetStr = (selSet2>0)?CalenDate(s
elSet2):q_("None"); elSet2):msgNone;
AcroCos = (Acro==3 || Acro==1)?QStri //AcroCos = (Acro==3 || Acro==1)?QSt
ng("%1: %2/%3.").arg(q_("Acronychal rise/set")).arg(AcroRiseStr).arg(AcroSe ring("%1: %2/%3.").arg(q_("Acronychal rise/set")).arg(AcroRiseStr).arg(Acro
tStr):q_("No Acronychal rise/set."); SetStr):q_("No Acronychal rise/set.");
AcroCos += (Acro==3 || Acro==2)?QStr //AcroCos += (Acro==3 || Acro==2)?QS
ing(" %1: %2/%3.").arg(q_("Cosmical rise/set")).arg(CosmRiseStr).arg(CosmSe tring(" %1: %2/%3.").arg(q_("Cosmical rise/set")).arg(CosmRiseStr).arg(Cosm
tStr):QString(" %1").arg(q_("No Cosmical rise/set.")); SetStr):QString(" %1").arg(q_("No Cosmical rise/set."));
AcroCos = (Acro==3 || Acro==1)?QStri
ng("%1: %2/%3.").arg(msgAcroRise).arg(AcroRiseStr).arg(AcroSetStr):msgNoAcr
oRise;
AcroCos += (Acro==3 || Acro==2)?QStr
ing(" %1: %2/%3.").arg(msgCosmRise).arg(CosmRiseStr).arg(CosmSetStr):QStrin
g(" %1").arg(msgNoCosmRise);
}; };
//////////////////////////// ////////////////////////////
// - Part 3. Determine range of good nights // - Part 3. Determine range of good nights
// (i.e., above horizon before/after twilight): // (i.e., above horizon before/after twilight):
if (show_Good_Nights) { if (show_Good_Nights) {
int selday = 0; int selday = 0;
int selday2 = 0; int selday2 = 0;
skipping to change at line 658 skipping to change at line 714
if (bestBegun) { // There were good dates till the end of the year. if (bestBegun) { // There were good dates till the end of the year.
if (dateRange!="") { dateRa nge += ", ";}; if (dateRange!="") { dateRa nge += ", ";};
dateRange += RangeCalenDates (selday, 0); dateRange += RangeCalenDates (selday, 0);
}; };
if (dateRange == "") if (dateRange == "")
{ {
if (atLeastOne) if (atLeastOne)
{ // The whole year is good. { // The whole year is good.
ObsRange = q_("Obser //ObsRange = q_("Obs
vable during the whole year."); ervable during the whole year.");
ObsRange = msgWholeY
ear;
} }
else else
{ {
ObsRange = q_("Not o //ObsRange = q_("Not
bservable at dark night."); observable at dark night.");
ObsRange = msgNotObs
;
}; };
} }
else else
{ {
ObsRange = QString("%1 %2"). //ObsRange = QString("%1 %2"
arg(q_("Nights above horizon: ")).arg(dateRange); ).arg(q_("Nights above horizon: ")).arg(dateRange);
ObsRange = QString("%1 %2").
arg(msgAboveHoriz).arg(dateRange);
}; };
}; // Comes from show_Good_Nights==True" }; // Comes from show_Good_Nights==True"
}; // Comes from the "else" of "culmAlt>=..." }; // Comes from the "else" of "culmAlt>=..."
};// Comes from "souChanged || ..." };// Comes from "souChanged || ..."
}; // Comes from the "else" with "!isMoon" }; // Comes from the "else" with "!isMoon"
// Print all results: // Print all results:
int spacing = (int) (1.3* ( (double) fontSize)); // between lines int spacing = (int) (1.3* ( (double) fontSize)); // between lines
int spacing2 = 6*fontSize; // between daily and yearly results int spacing2 = 6*fontSize; // between daily and yearly results
int yLine = 8*fontSize+110; int yLine = 8*fontSize+110;
int xLine = 80; int xLine = 80;
if (show_Today) if (show_Today)
{ {
renderer->drawText(TextParams(xLine, yLine,q_("TODAY:"))); //renderer->drawText(TextParams(xLine, yLine,q_("TODAY:")));
renderer->drawText(TextParams(xLine, yLine,msgToday));
renderer->drawText(TextParams(xLine+fontSize, yLine-spacing, RS2)); renderer->drawText(TextParams(xLine+fontSize, yLine-spacing, RS2));
renderer->drawText(TextParams(xLine+fontSize, yLine-spacing* 2, RS1)); renderer->drawText(TextParams(xLine+fontSize, yLine-spacing* 2, RS1));
renderer->drawText(TextParams(xLine+fontSize, yLine-spacing* 3, Cul)); renderer->drawText(TextParams(xLine+fontSize, yLine-spacing* 3, Cul));
yLine -= spacing2; yLine -= spacing2;
}; };
if ((isMoon && show_FullMoon) || (!isSun && !isMoon && show_Year)) if ((isMoon && show_FullMoon) || (!isSun && !isMoon && show_Year))
{ {
renderer->drawText(TextParams(xLine,yLine,q_("THIS YEAR:"))) //renderer->drawText(TextParams(xLine,yLine,q_("THIS YEAR:")
; ));
renderer->drawText(TextParams(xLine,yLine,msgThisYear));
if (show_Best_Night || show_FullMoon) if (show_Best_Night || show_FullMoon)
{ {
yLine -= spacing; yLine -= spacing;
renderer->drawText(TextParams(xLine+fontSize, yLine, bestNight)); renderer->drawText(TextParams(xLine+fontSize, yLine, bestNight));
}; };
if (show_Good_Nights) if (show_Good_Nights)
{ {
yLine -= spacing; yLine -= spacing;
renderer->drawText(TextParams(xLine+fontSize, yLine, ObsRange)); renderer->drawText(TextParams(xLine+fontSize, yLine, ObsRange));
}; };
skipping to change at line 763 skipping to change at line 824
//////////////////////////////////// ////////////////////////////////////
//////////////////////////////////// ////////////////////////////////////
// Converts a float time/angle span (in hours/degrees) in the (integer) for mat hh/dd,mm,ss: // Converts a float time/angle span (in hours/degrees) in the (integer) for mat hh/dd,mm,ss:
void Observability::double2hms(double hfloat, int &h1, int &h2, int &h3) void Observability::double2hms(double hfloat, int &h1, int &h2, int &h3)
{ {
double f1,f2,f3; double f1,f2,f3;
hfloat = std::abs(hfloat); hfloat = std::abs(hfloat);
double ffrac = std::modf(hfloat,&f1); double ffrac = std::modf(hfloat,&f1);
double ffrac2 = std::modf(60.*ffrac,&f2); double ffrac2 = std::modf(60.*ffrac,&f2);
//FIXME: ffrac2 is unused variable; need fix
ffrac2 = std::modf(3600.*(ffrac-f2/60.),&f3); ffrac2 = std::modf(3600.*(ffrac-f2/60.),&f3);
h1 = (int)f1 ; h2 = (int)std::abs(f2+0.0*ffrac2) ; h3 = (int)std::ab s(f3); h1 = (int)f1 ; h2 = (int)std::abs(f2+0.0*ffrac2) ; h3 = (int)std::ab s(f3);
} }
//////////////////////////////////// ////////////////////////////////////
//////////////////////////////////// ////////////////////////////////////
// Adds/subtracts 24hr to ensure a RA between 0 and 24hr: // Adds/subtracts 24hr to ensure a RA between 0 and 24hr:
double Observability::toUnsignedRA(double RA) double Observability::toUnsignedRA(double RA)
{ {
double tempRA,tempmod; double tempRA,tempmod;
skipping to change at line 788 skipping to change at line 848
return auxRA; return auxRA;
} }
//////////////////////////////////// ////////////////////////////////////
/////////////////////////////////////////////// ///////////////////////////////////////////////
// Returns the day and month of year (to put it in format '25 Apr') // Returns the day and month of year (to put it in format '25 Apr')
QString Observability::CalenDate(int selday) QString Observability::CalenDate(int selday)
{ {
int day,month,year; int day,month,year;
StelUtils::getDateFromJulianDay(yearJD[selday],&year,&month,&day); StelUtils::getDateFromJulianDay(yearJD[selday],&year,&month,&day);
return QString("%1 %2").arg(day).arg(months[month-1]);
QString r;
if (getDateFormat())
r = QString("%1 %2").arg(day).arg(months[month-1]);
else
r = QString("%1 %2").arg(months[month-1]).arg(day);
return r;
} }
////////////////////////////////////////////// //////////////////////////////////////////////
/////////////////////////////////////////////// ///////////////////////////////////////////////
// Returns the day and month of year (to put it in format '25 Apr') // Returns the day and month of year (to put it in format '25 Apr')
QString Observability::RangeCalenDates(int fDoY, int sDoY) QString Observability::RangeCalenDates(int fDoY, int sDoY)
{ {
int day1,month1,year1,day2,month2,year2; int day1,month1,year1,day2,month2,year2;
QString range; QString range;
StelUtils::getDateFromJulianDay(yearJD[fDoY],&year1,&month1,&day1); StelUtils::getDateFromJulianDay(yearJD[fDoY],&year1,&month1,&day1);
skipping to change at line 812 skipping to change at line 879
day2 = 31; day2 = 31;
month2 = 12; month2 = 12;
} }
if (fDoY==0) if (fDoY==0)
{ {
day1 = 1; day1 = 1;
month1 = 1; month1 = 1;
} }
if (month1==month2) if (month1==month2)
{ {
range = QString("%1 - %2 %3").arg(day1).arg(day2).arg(months if (getDateFormat())
[month1-1]); range = QString("%1 - %2 %3").arg(day1).arg(day2).ar
g(months[month1-1]);
else
range = QString("%3 %1 - %2").arg(day1).arg(day2).ar
g(months[month1-1]);
} }
else else
{ {
range = QString("%1 %2 - %3 %4").arg(day1).arg(months[month1 if (getDateFormat())
-1]).arg(day2).arg(months[month2-1]); range = QString("%1 %2 - %3 %4").arg(day1).arg(month
s[month1-1]).arg(day2).arg(months[month2-1]);
else
range = QString("%1 %2 - %3 %4").arg(months[month1-1
]).arg(day1).arg(months[month2-1]).arg(day2);
} }
return range; return range;
} }
////////////////////////////////////////////// //////////////////////////////////////////////
////////////////////////////////////////////////// //////////////////////////////////////////////////
// Returns the RA and Dec of the selected planet // Returns the RA and Dec of the selected planet
//for each day of the current year: //for each day of the current year:
void Observability::PlanetRADec(StelCore *core) void Observability::PlanetRADec(StelCore *core)
skipping to change at line 1389 skipping to change at line 1462
}; };
// Update the string shown in the screen: // Update the string shown in the screen:
int fullDay, fullMonth,fullYear, fullHour, fullMinut e, fullSecond; int fullDay, fullMonth,fullYear, fullHour, fullMinut e, fullSecond;
double LocalPrev = prevFullMoon+GMTShift+0.5; // Sh ift to the local time. double LocalPrev = prevFullMoon+GMTShift+0.5; // Sh ift to the local time.
double LocalNext = nextFullMoon+GMTShift+0.5; double LocalNext = nextFullMoon+GMTShift+0.5;
double intMoon; double intMoon;
double LocalTMoon = 24.*modf(LocalPrev,&intMoon); double LocalTMoon = 24.*modf(LocalPrev,&intMoon);
StelUtils::getDateFromJulianDay(intMoon,&fullYear,&f ullMonth,&fullDay); StelUtils::getDateFromJulianDay(intMoon,&fullYear,&f ullMonth,&fullDay);
double2hms(toUnsignedRA(LocalTMoon),fullHour,fullMin ute,fullSecond); double2hms(toUnsignedRA(LocalTMoon),fullHour,fullMin ute,fullSecond);
bestNight = q_("Previous Full Moon: %1 %2 at %3:%4. if (getDateFormat())
").arg(months[fullMonth-1]).arg(fullDay).arg(fullHour).arg(fullMinute,2,10, bestNight = msgPrevFullMoon.arg(fullDay).arg
QLatin1Char('0')); (months[fullMonth-1]).arg(fullHour).arg(fullMinute,2,10,QLatin1Char('0'));
else
bestNight = msgPrevFullMoon.arg(months[fullM
onth-1]).arg(fullDay).arg(fullHour).arg(fullMinute,2,10,QLatin1Char('0'));
LocalTMoon = 24.*modf(LocalNext,&intMoon); LocalTMoon = 24.*modf(LocalNext,&intMoon);
StelUtils::getDateFromJulianDay(intMoon,&fullYear,&f ullMonth,&fullDay); StelUtils::getDateFromJulianDay(intMoon,&fullYear,&f ullMonth,&fullDay);
double2hms(toUnsignedRA(LocalTMoon),fullHour,fullMin ute,fullSecond); double2hms(toUnsignedRA(LocalTMoon),fullHour,fullMin ute,fullSecond);
bestNight += q_("Next Full Moon: %1 %2 at %3:%4. "). if (getDateFormat())
arg(months[fullMonth-1]).arg(fullDay).arg(fullHour).arg(fullMinute,2,10,QLa bestNight += msgNextFullMoon.arg(fullDay).ar
tin1Char('0')); g(months[fullMonth-1]).arg(fullHour).arg(fullMinute,2,10,QLatin1Char('0'));
else
bestNight += msgNextFullMoon.arg(months[full
Month-1]).arg(fullDay).arg(fullHour).arg(fullMinute,2,10,QLatin1Char('0'));
ObsRange = ""; ObsRange = "";
AcroCos = ""; AcroCos = "";
// Now, compute the days of all the Full Moons of the current year, and get the Earth/Moon distance: // Now, compute the days of all the Full Moons of the current year, and get the Earth/Moon distance:
// double monthFrac, monthTemp, maxMoonDate; // double monthFrac, monthTemp, maxMoonDate;
// monthFrac = std::modf((nextFullMoon-Jan1stJD)/MoonT, &monthTemp); // monthFrac = std::modf((nextFullMoon-Jan1stJD)/MoonT, &monthTemp);
// int PrevMonths = (int)(monthTemp+0.0*monthFrac); // int PrevMonths = (int)(monthTemp+0.0*monthFrac);
// double BestDistance = 1.0; // initial dummy value fo r Sun-Moon distance; // double BestDistance = 1.0; // initial dummy value fo r Sun-Moon distance;
// double Distance; // temporal variable to save Earth- Moon distance at each month. // double Distance; // temporal variable to save Earth- Moon distance at each month.
 End of changes. 29 change blocks. 
77 lines changed or deleted 171 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/