StelObject.cpp   StelObject.cpp 
skipping to change at line 30 skipping to change at line 30
#include "StelObject.hpp" #include "StelObject.hpp"
#include "StelApp.hpp" #include "StelApp.hpp"
#include "StelCore.hpp" #include "StelCore.hpp"
#include "StelProjector.hpp" #include "StelProjector.hpp"
#include "StelUtils.hpp" #include "StelUtils.hpp"
#include "StelTranslator.hpp" #include "StelTranslator.hpp"
#include "StelSkyDrawer.hpp" #include "StelSkyDrawer.hpp"
#include "RefractionExtinction.hpp" #include "RefractionExtinction.hpp"
#include "StelLocation.hpp" #include "StelLocation.hpp"
#include "SolarSystem.hpp" #include "SolarSystem.hpp"
#include "StelModuleMgr.hpp"
#include "planetsephems/sidereal_time.h"
#include <QRegExp> #include <QRegExp>
#include <QDebug> #include <QDebug>
#include <QSettings> #include <QSettings>
Vec3d StelObject::getEquinoxEquatorialPos(const StelCore* core) const Vec3d StelObject::getEquinoxEquatorialPos(const StelCore* core) const
{ {
return core->j2000ToEquinoxEqu(getJ2000EquatorialPos(core)); return core->j2000ToEquinoxEqu(getJ2000EquatorialPos(core));
} }
// Get observer local sidereal coordinate // Get observer local sidereal coordinate
Vec3d StelObject::getSiderealPosGeometric(const StelCore* core) const Vec3d StelObject::getSiderealPosGeometric(const StelCore* core) const
{ {
// Hour Angle corrected to Delta-T value return Mat4d::zrotation(-core->getLocalSiderealTime())* getEquinoxEq
double dt = (core->getDeltaT(core->getJDay())/240.)*M_PI/180.; uatorialPos(core);
return Mat4d::zrotation(-core->getLocalSiderealTime()+dt)* getEquino
xEquatorialPos(core);
} }
// Get observer local sidereal coordinates, deflected by refraction // Get observer local sidereal coordinates, deflected by refraction
Vec3d StelObject::getSiderealPosApparent(const StelCore* core) const Vec3d StelObject::getSiderealPosApparent(const StelCore* core) const
{ {
Vec3d v=getAltAzPosApparent(core); Vec3d v=getAltAzPosApparent(core); // These already come with refrac tion!
v = core->altAzToEquinoxEqu(v, StelCore::RefractionOff); v = core->altAzToEquinoxEqu(v, StelCore::RefractionOff);
// Hour Angle corrected to Delta-T value return Mat4d::zrotation(-core->getLocalSiderealTime())*v;
double dt = (core->getDeltaT(core->getJDay())/240.)*M_PI/180.;
return Mat4d::zrotation(-core->getLocalSiderealTime()+dt)*v;
} }
Vec3d StelObject::getAltAzPosGeometric(const StelCore* core) const Vec3d StelObject::getAltAzPosGeometric(const StelCore* core) const
{ {
return core->j2000ToAltAz(getJ2000EquatorialPos(core), StelCore::Ref ractionOff); return core->j2000ToAltAz(getJ2000EquatorialPos(core), StelCore::Ref ractionOff);
} }
// Get observer-centered alt/az position // Get observer-centered alt/az position
Vec3d StelObject::getAltAzPosApparent(const StelCore* core) const Vec3d StelObject::getAltAzPosApparent(const StelCore* core) const
{ {
skipping to change at line 110 skipping to change at line 108
// without the test, planets flicker stupidly in fullsky atmosphere- less view. // without the test, planets flicker stupidly in fullsky atmosphere- less view.
if (core->getSkyDrawer()->getFlagHasAtmosphere()) if (core->getSkyDrawer()->getFlagHasAtmosphere())
core->getSkyDrawer()->getExtinction().forward(altAzPos, &vMa g); core->getSkyDrawer()->getExtinction().forward(altAzPos, &vMa g);
return vMag; return vMag;
} }
// Format the positional info string contain J2000/of date/altaz/hour angle positions for the object // Format the positional info string contain J2000/of date/altaz/hour angle positions for the object
QString StelObject::getPositionInfoString(const StelCore *core, const InfoS tringGroup& flags) const QString StelObject::getPositionInfoString(const StelCore *core, const InfoS tringGroup& flags) const
{ {
bool withAtmosphere = core->getSkyDrawer()->getFlagHasAtmosphere(); bool withAtmosphere = core->getSkyDrawer()->getFlagHasAtmosphere();
bool withDecimalDegree = StelApp::getInstance().getFlagShowDecimalDe bool withDecimalDegree = StelApp::getInstance().getFlagShowDecimalDe
grees();; grees();
double currentEpoch = core->getCurrentEpoch(); bool useOldAzimuth = StelApp::getInstance().getFlagOldAzimuthUsage()
;
double az_app, alt_app;
StelUtils::rectToSphe(&az_app,&alt_app,getAltAzPosApparent(core));
Q_UNUSED(az_app);
QString cepoch = qc_("on date", "coordinates for current epoch"); QString cepoch = qc_("on date", "coordinates for current epoch");
if (currentEpoch>0 && currentEpoch<9000.)
{
// OK, we can show epoch in format YYYY.F
cepoch = QString("J%1").arg(QString::number(currentEpoch, 'f
', 1));
}
QString res; QString res;
if (flags&RaDecJ2000) if (flags&RaDecJ2000)
{ {
double dec_j2000, ra_j2000; double dec_j2000, ra_j2000;
StelUtils::rectToSphe(&ra_j2000,&dec_j2000,getJ2000Equatoria lPos(core)); StelUtils::rectToSphe(&ra_j2000,&dec_j2000,getJ2000Equatoria lPos(core));
if (withDecimalDegree) if (withDecimalDegree)
res += q_("RA/Dec") + QString(" (J%1): %2/%3").arg(Q String::number(2000.f, 'f', 1), StelUtils::radToDecDegStr(ra_j2000,5,false, true), StelUtils::radToDecDegStr(dec_j2000)) + "<br>"; res += q_("RA/Dec") + QString(" (J2000.0): %1/%2").a rg(StelUtils::radToDecDegStr(ra_j2000,5,false,true), StelUtils::radToDecDeg Str(dec_j2000)) + "<br>";
else else
res += q_("RA/Dec") + QString(" (J%1): %2/%3").arg(Q String::number(2000.f, 'f', 1), StelUtils::radToHmsStr(ra_j2000,true), Stel Utils::radToDmsStr(dec_j2000,true)) + "<br>"; res += q_("RA/Dec") + QString(" (J2000.0): %1/%2").a rg(StelUtils::radToHmsStr(ra_j2000,true), StelUtils::radToDmsStr(dec_j2000, true)) + "<br>";
} }
if (flags&RaDecOfDate) if (flags&RaDecOfDate)
{ {
double dec_equ, ra_equ; double dec_equ, ra_equ;
StelUtils::rectToSphe(&ra_equ,&dec_equ,getEquinoxEquatorialP os(core)); StelUtils::rectToSphe(&ra_equ,&dec_equ,getEquinoxEquatorialP os(core));
if (withDecimalDegree) if (withDecimalDegree)
res += q_("RA/Dec") + QString(" (%1): %2/%3").arg(ce poch, StelUtils::radToDecDegStr(ra_equ,5,false,true), StelUtils::radToDecDe gStr(dec_equ)) + "<br>"; res += q_("RA/Dec") + QString(" (%1): %2/%3").arg(ce poch, StelUtils::radToDecDegStr(ra_equ,5,false,true), StelUtils::radToDecDe gStr(dec_equ)) + "<br>";
else else
res += q_("RA/Dec") + QString(" (%1): %2/%3").arg(ce poch, StelUtils::radToHmsStr(ra_equ,true), StelUtils::radToDmsStr(dec_equ,t rue)) + "<br>"; res += q_("RA/Dec") + QString(" (%1): %2/%3").arg(ce poch, StelUtils::radToHmsStr(ra_equ,true), StelUtils::radToDmsStr(dec_equ,t rue)) + "<br>";
} }
if (flags&HourAngle) if (flags&HourAngle)
{ {
double dec_sidereal, ra_sidereal, ha_sidereal; double dec_sidereal, ra_sidereal, ha_sidereal;
QString hadec; QString hadec;
StelUtils::rectToSphe(&ra_sidereal,&dec_sidereal,getSidereal PosGeometric(core)); StelUtils::rectToSphe(&ra_sidereal,&dec_sidereal,getSidereal PosGeometric(core));
ra_sidereal = 2.*M_PI-ra_sidereal; ra_sidereal = 2.*M_PI-ra_sidereal;
if (withAtmosphere) if (withAtmosphere && (alt_app>-3.0*M_PI/180.0)) // Don't sh ow refracted values much below horizon where model is meaningless.
{ {
StelUtils::rectToSphe(&ra_sidereal,&dec_sidereal,get SiderealPosApparent(core)); StelUtils::rectToSphe(&ra_sidereal,&dec_sidereal,get SiderealPosApparent(core));
ra_sidereal = 2.*M_PI-ra_sidereal; ra_sidereal = 2.*M_PI-ra_sidereal;
if (withDecimalDegree) if (withDecimalDegree)
{ {
ha_sidereal = ra_sidereal*12/M_PI; ha_sidereal = ra_sidereal*12/M_PI;
if (ha_sidereal>24.) if (ha_sidereal>24.)
ha_sidereal -= 24.; ha_sidereal -= 24.;
hadec = QString("%1h").arg(ha_sidereal, 0, ' f', 5); hadec = QString("%1h").arg(ha_sidereal, 0, ' f', 5);
res += q_("Hour angle/DE: %1/%2").arg(hadec, StelUtils::radToDecDegStr(dec_sidereal)) + " " + q_("(apparent)") + "<br>" ; res += q_("Hour angle/DE: %1/%2").arg(hadec, StelUtils::radToDecDegStr(dec_sidereal)) + " " + q_("(apparent)") + "<br>" ;
skipping to change at line 180 skipping to change at line 176
else else
res += q_("Hour angle/DE: %1/%2").arg(StelUt ils::radToHmsStr(ra_sidereal,true), StelUtils::radToDmsStr(dec_sidereal,tru e)) + " " + "<br>"; res += q_("Hour angle/DE: %1/%2").arg(StelUt ils::radToHmsStr(ra_sidereal,true), StelUtils::radToDmsStr(dec_sidereal,tru e)) + " " + "<br>";
} }
} }
if (flags&AltAzi) if (flags&AltAzi)
{ {
// calculate alt az // calculate alt az
double az,alt; double az,alt;
StelUtils::rectToSphe(&az,&alt,getAltAzPosGeometric(core)); StelUtils::rectToSphe(&az,&alt,getAltAzPosGeometric(core));
az = 3.*M_PI - az; // N is zero, E is 90 degrees float direction = 3.; // N is zero, E is 90 degrees
if (useOldAzimuth)
direction = 2.;
az = direction*M_PI - az;
if (az > M_PI*2) if (az > M_PI*2)
az -= M_PI*2; az -= M_PI*2;
if (withAtmosphere) if (withAtmosphere && (alt_app>-3.0*M_PI/180.0)) // Don't sh ow refracted altitude much below horizon where model is meaningless.
{ {
StelUtils::rectToSphe(&az,&alt,getAltAzPosApparent(c
ore));
az = 3.*M_PI - az; // N is zero, E is 90 degrees
if (az > M_PI*2)
az -= M_PI*2;
if (withDecimalDegree) if (withDecimalDegree)
res += q_("Az/Alt: %1/%2").arg(StelUtils::ra dToDecDegStr(az), StelUtils::radToDecDegStr(alt)) + " " + q_("(apparent)") + "<br>"; res += q_("Az/Alt: %1/%2").arg(StelUtils::ra dToDecDegStr(az), StelUtils::radToDecDegStr(alt_app)) + " " + q_("(apparent )") + "<br>";
else else
res += q_("Az/Alt: %1/%2").arg(StelUtils::ra dToDmsStr(az,true), StelUtils::radToDmsStr(alt,true)) + " " + q_("(apparent )") + "<br>"; res += q_("Az/Alt: %1/%2").arg(StelUtils::ra dToDmsStr(az,true), StelUtils::radToDmsStr(alt_app,true)) + " " + q_("(appa rent)") + "<br>";
} }
else else
{ {
if (withDecimalDegree) if (withDecimalDegree)
res += q_("Az/Alt: %1/%2").arg(StelUtils::ra dToDecDegStr(az), StelUtils::radToDecDegStr(alt)) + " " + "<br>"; res += q_("Az/Alt: %1/%2").arg(StelUtils::ra dToDecDegStr(az), StelUtils::radToDecDegStr(alt)) + " " + "<br>";
else else
res += q_("Az/Alt: %1/%2").arg(StelUtils::ra dToDmsStr(az,true), StelUtils::radToDmsStr(alt,true)) + " " + "<br>"; res += q_("Az/Alt: %1/%2").arg(StelUtils::ra dToDmsStr(az,true), StelUtils::radToDmsStr(alt,true)) + " " + "<br>";
} }
} }
if (flags&EclipticCoord) if (flags&EclipticCoord)
{ {
double ecl = core->getCurrentPlanet()->getRotObliquity(24515 // N.B. Ecliptical coordinates are particularly earth-bound.
45.0); // It may be OK to have terrestrial ecliptical coordinates o
f J2000.0 (standard epoch) because those are in practice linked with VSOP X
Y plane,
// and because the ecliptical grid of J2000 is also shown fo
r observers on other planets.
// The formulation here has never computed the true position
of any observer planet's orbital plane except for Earth,
// or ever displayed the coordinates in the observer planet'
s equivalent to Earth's ecliptical coordinates.
// As quick test you can observe if in any "Ecliptic coordin
ate" as seen from e.g. Mars or Jupiter the Sun was ever close to beta=0 (ex
cept if crossing the node...).
double ecl=GETSTELMODULE(SolarSystem)->getEarth()->getRotObl
iquity(2451545.0);
double ra_equ, dec_equ, lambda, beta; double ra_equ, dec_equ, lambda, beta;
StelUtils::rectToSphe(&ra_equ,&dec_equ,getJ2000EquatorialPos (core)); StelUtils::rectToSphe(&ra_equ,&dec_equ,getJ2000EquatorialPos (core));
StelUtils::equToEcl(ra_equ, dec_equ, ecl, &lambda, &beta); StelUtils::equToEcl(ra_equ, dec_equ, ecl, &lambda, &beta);
if (lambda<0) lambda+=2.0*M_PI; if (lambda<0) lambda+=2.0*M_PI;
if (withDecimalDegree) if (withDecimalDegree)
res += q_("Ecliptic longitude/latitude") + QString(" res += q_("Ecliptic longitude/latitude") + QString("
(J%1): %2/%3").arg(QString::number(2000.f, 'f', 1), StelUtils::radToDecDeg (J2000.0): %1/%2").arg(StelUtils::radToDecDegStr(lambda), StelUtils::radTo
Str(lambda), StelUtils::radToDecDegStr(beta)) + "<br>"; DecDegStr(beta)) + "<br>";
else
res += q_("Ecliptic longitude/latitude") + QString("
(J%1): %2/%3").arg(QString::number(2000.f, 'f', 1), StelUtils::radToDmsStr
(lambda, true), StelUtils::radToDmsStr(beta, true)) + "<br>";
ecl = core->getCurrentPlanet()->getRotObliquity(core->getJDa
y());
StelUtils::rectToSphe(&ra_equ,&dec_equ,getEquinoxEquatorialP
os(core));
StelUtils::equToEcl(ra_equ, dec_equ, ecl, &lambda, &beta);
if (lambda<0) lambda+=2.0*M_PI;
if (withDecimalDegree)
res += q_("Ecliptic longitude/latitude") + QString("
(%1): %2/%3").arg(cepoch, StelUtils::radToDecDegStr(lambda), StelUtils::ra
dToDecDegStr(beta)) + "<br>";
else else
res += q_("Ecliptic longitude/latitude") + QString(" res += q_("Ecliptic longitude/latitude") + QString("
(%1): %2/%3").arg(cepoch, StelUtils::radToDmsStr(lambda, true), StelUtils: (J2000.0): %1/%2").arg(StelUtils::radToDmsStr(lambda, true), StelUtils::ra
:radToDmsStr(beta, true)) + "<br>"; dToDmsStr(beta, true)) + "<br>";
if (core->getCurrentPlanet()->getEnglishName()=="Earth")
{
ecl = GETSTELMODULE(SolarSystem)->getEarth()->getRot
Obliquity(2451545.0);
StelUtils::rectToSphe(&ra_equ,&dec_equ,getEquinoxEqu
atorialPos(core));
StelUtils::equToEcl(ra_equ, dec_equ, ecl, &lambda, &
beta);
if (lambda<0) lambda+=2.0*M_PI;
if (withDecimalDegree)
res += q_("Ecliptic longitude/latitude") + Q
String(" (%1): %2/%3").arg(cepoch, StelUtils::radToDecDegStr(lambda), StelU
tils::radToDecDegStr(beta)) + "<br>";
else
res += q_("Ecliptic longitude/latitude") + Q
String(" (%1): %2/%3").arg(cepoch, StelUtils::radToDmsStr(lambda, true), St
elUtils::radToDmsStr(beta, true)) + "<br>";
// GZ Only for now: display epsilon_A, angle between
Earth's Axis and ecl. of date.
if (withDecimalDegree)
res += q_("Ecliptic obliquity") + QString("
(%1): %2").arg(cepoch, StelUtils::radToDecDegStr(ecl)) + "<br>";
else
res += q_("Ecliptic obliquity") + QString("
(%1): %2").arg(cepoch, StelUtils::radToDmsStr(ecl)) + "<br>";
}
} }
if (flags&GalacticCoord) if (flags&GalacticCoord)
{ {
double glong, glat; double glong, glat;
StelUtils::rectToSphe(&glong, &glat, getGalacticPos(core)); StelUtils::rectToSphe(&glong, &glat, getGalacticPos(core));
if (withDecimalDegree) if (withDecimalDegree)
res += q_("Galactic longitude/latitude: %1/%2").arg( StelUtils::radToDecDegStr(glong), StelUtils::radToDecDegStr(glat)) + "<br>" ; res += q_("Galactic longitude/latitude: %1/%2").arg( StelUtils::radToDecDegStr(glong), StelUtils::radToDecDegStr(glat)) + "<br>" ;
else else
res += q_("Galactic longitude/latitude: %1/%2").arg( StelUtils::radToDmsStr(glong,true), StelUtils::radToDmsStr(glat,true)) + "< br>"; res += q_("Galactic longitude/latitude: %1/%2").arg( StelUtils::radToDmsStr(glong,true), StelUtils::radToDmsStr(glat,true)) + "< br>";
} }
if ((flags&Extra) && core->getCurrentPlanet()->getEnglishName()=="Ea
rth")
{
double longitude=core->getCurrentLocation().longitude;
double sidereal=(get_mean_sidereal_time(core->getJD(), core-
>getJDE()) + longitude) / 15.;
res += q_("Mean Sidereal Time: %1").arg(StelUtils::hoursToHm
sStr(sidereal)) + "<br>";
sidereal=(get_apparent_sidereal_time(core->getJD(), core->ge
tJDE()) + longitude) / 15.;
res += q_("Apparent Sidereal Time: %1").arg(StelUtils::hours
ToHmsStr(sidereal)) + "<br>";
}
return res; return res;
} }
// Apply post processing on the info string // Apply post processing on the info string
void StelObject::postProcessInfoString(QString& str, const InfoStringGroup& flags) const void StelObject::postProcessInfoString(QString& str, const InfoStringGroup& flags) const
{ {
// chomp trailing line breaks // chomp trailing line breaks
str.replace(QRegExp("<br(\\s*/)?>\\s*$"), ""); str.replace(QRegExp("<br(\\s*/)?>\\s*$"), "");
if (flags&PlainText) if (flags&PlainText)
skipping to change at line 255 skipping to change at line 276
str.replace("<b>", ""); str.replace("<b>", "");
str.replace("</b>", ""); str.replace("</b>", "");
str.replace("<h2>", ""); str.replace("<h2>", "");
str.replace("</h2>", "\n"); str.replace("</h2>", "\n");
str.replace(QRegExp("<br(\\s*/)?>"), "\n"); str.replace(QRegExp("<br(\\s*/)?>"), "\n");
} }
else else
{ {
Vec3f color = getInfoColor(); Vec3f color = getInfoColor();
StelCore* core = StelApp::getInstance().getCore(); StelCore* core = StelApp::getInstance().getCore();
if (core->isDay() && core->getSkyDrawer()->getFlagHasAtmosph ere()==true) if (core->isBrightDaylight() && core->getSkyDrawer()->getFla gHasAtmosphere()==true && !StelApp::getInstance().getVisionModeNight())
{ {
// Let's make info text is more readable when atmosp // make info text more readable when atmosphere enab
here enabled at daylight. led at daylight.
color = StelUtils::strToVec3f(StelApp::getInstance() color = StelUtils::strToVec3f(StelApp::getInstance()
.getSettings()->value("color/daylight_color", "0.0,0.0,0.0").toString()); .getSettings()->value("color/daylight_text_color", "0.0,0.0,0.0").toString(
));
} }
str.prepend(QString("<font color=%1>").arg(StelUtils::vec3fT oHtmlColor(color))); str.prepend(QString("<font color=%1>").arg(StelUtils::vec3fT oHtmlColor(color)));
str.append(QString("</font>")); str.append(QString("</font>"));
} }
} }
 End of changes. 20 change blocks. 
56 lines changed or deleted 93 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/