StelObject.cpp   StelObject.cpp 
skipping to change at line 31 skipping to change at line 31
#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 "StelModuleMgr.hpp"
#include "StelGui.hpp"
#include <QRegExp> #include <QRegExp>
#include <QDebug> #include <QDebug>
#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 // Hour Angle corrected to Delta-T value
skipping to change at line 109 skipping to change at line 111
float vMag = getVMagnitude(core); float vMag = getVMagnitude(core);
// GZ 2014-01-02: without the test, planets flicker stupidly in full sky atmosphere-less view. // GZ 2014-01-02: without the test, planets flicker stupidly in full sky 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 = dynamic_cast<StelGui*>(StelApp::getInstance
().getGui())->getFlagShowDecimalDegrees();
double currentEpoch = core->getCurrentEpoch();
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));
res += q_("RA/DE (J2000): %1/%2").arg(StelUtils::radToHmsStr if (withDecimalDegree)
(ra_j2000,true), StelUtils::radToDmsStr(dec_j2000,true)) + "<br>"; res += q_("RA/Dec") + QString(" (J%1): %2/%3").arg(Q
String::number(2000.f, 'f', 1), StelUtils::radToDecDegStr(ra_j2000,false,tr
ue), StelUtils::radToDecDegStr(dec_j2000)) + "<br>";
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>";
} }
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));
res += q_("RA/DE (of date): %1/%2").arg(StelUtils::radToHmsS if (withDecimalDegree)
tr(ra_equ), StelUtils::radToDmsStr(dec_equ)) + "<br>"; res += q_("RA/Dec") + QString(" (J%1): %2/%3").arg(Q
} String::number(currentEpoch, 'f', 1), StelUtils::radToDecDegStr(ra_equ,fals
e,true), StelUtils::radToDecDegStr(dec_equ)) + "<br>";
if (flags&GalacticCoord) else
{ res += q_("RA/Dec") + QString(" (J%1): %2/%3").arg(Q
double glong, glat; String::number(currentEpoch, 'f', 1), StelUtils::radToHmsStr(ra_equ,true),
StelUtils::rectToSphe(&glong, &glat, getGalacticPos(core)); StelUtils::radToDmsStr(dec_equ,true)) + "<br>";
res += q_("Galactic longitude/latitude: %1/%2").arg(StelUtil
s::radToDmsStr(glong,true), StelUtils::radToDmsStr(glat,true)) + "<br>";
} }
if (flags&HourAngle) if (flags&HourAngle)
{ {
double dec_sidereal, ra_sidereal; double dec_sidereal, ra_sidereal;
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)
{ {
StelUtils::rectToSphe(&ra_sidereal,&dec_sidereal,getSide StelUtils::rectToSphe(&ra_sidereal,&dec_sidereal,get
realPosApparent(core)); SiderealPosApparent(core));
ra_sidereal = 2.*M_PI-ra_sidereal; ra_sidereal = 2.*M_PI-ra_sidereal;
res += q_("Hour angle/DE: %1/%2").arg(StelUtils::radToHm res += q_("Hour angle/DE: %1/%2").arg(StelUtils::rad
sStr(ra_sidereal), StelUtils::radToDmsStr(dec_sidereal)) + " " + q_("(appar ToHmsStr(ra_sidereal,true), StelUtils::radToDmsStr(dec_sidereal,true)) + "
ent)") + "<br>"; " + q_("(apparent)") + "<br>";
} }
else else
{ {
res += q_("Hour angle/DE: %1/%2").arg(StelUtils::radToHm sStr(ra_sidereal), StelUtils::radToDmsStr(dec_sidereal)) + " " + "<br>"; res += q_("Hour angle/DE: %1/%2").arg(StelUtils::rad ToHmsStr(ra_sidereal,true), StelUtils::radToDmsStr(dec_sidereal,true)) + " " + "<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 az = 3.*M_PI - az; // N is zero, E is 90 degrees
if (az > M_PI*2) if (az > M_PI*2)
az -= M_PI*2; az -= M_PI*2;
if (withAtmosphere) if (withAtmosphere)
{ {
StelUtils::rectToSphe(&az,&alt,getAltAzPosApparent(core) StelUtils::rectToSphe(&az,&alt,getAltAzPosApparent(c
); ore));
az = 3.*M_PI - az; // N is zero, E is 90 degrees az = 3.*M_PI - az; // N is zero, E is 90 degrees
if (az > M_PI*2) if (az > M_PI*2)
az -= M_PI*2; az -= M_PI*2;
res += q_("Az/Alt: %1/%2").arg(StelUtils::radToDmsStr(az if (withDecimalDegree)
), StelUtils::radToDmsStr(alt)) + " " + q_("(apparent)") + "<br>"; res += q_("Az/Alt: %1/%2").arg(StelUtils::ra
dToDecDegStr(az), StelUtils::radToDecDegStr(alt)) + " " + q_("(apparent)")
+ "<br>";
else
res += q_("Az/Alt: %1/%2").arg(StelUtils::ra
dToDmsStr(az,true), StelUtils::radToDmsStr(alt,true)) + " " + q_("(apparent
)") + "<br>";
} }
else else
{ {
res += q_("Az/Alt: %1/%2").arg(StelUtils::radToDmsStr(az if (withDecimalDegree)
), StelUtils::radToDmsStr(alt)) + " " + "<br>"; res += q_("Az/Alt: %1/%2").arg(StelUtils::ra
dToDecDegStr(az,false,true), StelUtils::radToDecDegStr(alt)) + " " + "<br>"
;
else
res += q_("Az/Alt: %1/%2").arg(StelUtils::ra
dToDmsStr(az,true), StelUtils::radToDmsStr(alt,true)) + " " + "<br>";
} }
} }
if ((flags&EclTopocentricCoord) && (core->getCurrentLocation().plane tName=="Earth")) if ((flags&EclipticCoord) && (core->getCurrentLocation().planetName= ="Earth"))
{ {
static SolarSystem *ssystem=GETSTELMODULE(SolarSystem); static SolarSystem *ssystem=GETSTELMODULE(SolarSystem);
double ecl= ssystem->getEarth()->getRotObliquity(2451545.0); double ecl= ssystem->getEarth()->getRotObliquity(2451545.0);
double ra_equ, dec_equ, lambda, beta; double ra_equ, dec_equ, lambda, beta;
StelUtils::rectToSphe(&ra_equ,&dec_equ,getEquinoxEquatorialP os(core)); StelUtils::rectToSphe(&ra_equ,&dec_equ,getJ2000EquatorialPos (core));
StelUtils::ctRadec2Ecl(ra_equ, dec_equ, ecl, &lambda, &beta) ; StelUtils::ctRadec2Ecl(ra_equ, dec_equ, ecl, &lambda, &beta) ;
if (lambda<0) lambda+=2.0*M_PI; if (lambda<0) lambda+=2.0*M_PI;
res += q_("Ecliptic Topocentric (of J2000): %1/%2").arg(Stel if (withDecimalDegree)
Utils::radToDmsStr(lambda, true), StelUtils::radToDmsStr(beta, true)) + "<b res += q_("Ecliptic longitude/latitude") + QString("
r>"; (J%1): %2/%3").arg(QString::number(2000.f, 'f', 1), StelUtils::radToDecDeg
Str(lambda), StelUtils::radToDecDegStr(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= ssystem->getEarth()->getRotObliquity(core->getJDay()); ecl= ssystem->getEarth()->getRotObliquity(core->getJDay());
StelUtils::rectToSphe(&ra_equ,&dec_equ,getEquinoxEquatorialP os(core)); StelUtils::rectToSphe(&ra_equ,&dec_equ,getEquinoxEquatorialP os(core));
StelUtils::ctRadec2Ecl(ra_equ, dec_equ, ecl, &lambda, &beta) ; StelUtils::ctRadec2Ecl(ra_equ, dec_equ, ecl, &lambda, &beta) ;
if (lambda<0) lambda+=2.0*M_PI; if (lambda<0) lambda+=2.0*M_PI;
res += q_("Ecliptic Topocentric (of date): %1/%2").arg(StelU if (withDecimalDegree)
tils::radToDmsStr(lambda, true), StelUtils::radToDmsStr(beta, true)) + "<br res += q_("Ecliptic longitude/latitude") + QString("
>"; (J%1): %2/%3").arg(QString::number(currentEpoch, 'f', 1), StelUtils::radTo
DecDegStr(lambda), StelUtils::radToDecDegStr(beta)) + "<br>";
else
res += q_("Ecliptic longitude/latitude") + QString("
(J%1): %2/%3").arg(QString::number(currentEpoch, 'f', 1), StelUtils::radTo
DmsStr(lambda, true), StelUtils::radToDmsStr(beta, true)) + "<br>";
} }
if (flags&GalacticCoord)
{
double glong, glat;
StelUtils::rectToSphe(&glong, &glat, getGalacticPos(core));
if (withDecimalDegree)
res += q_("Galactic longitude/latitude: %1/%2").arg(
StelUtils::radToDecDegStr(glong), StelUtils::radToDecDegStr(glat)) + "<br>"
;
else
res += q_("Galactic longitude/latitude: %1/%2").arg(
StelUtils::radToDmsStr(glong,true), StelUtils::radToDmsStr(glat,true)) + "<
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)
{ {
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
{ {
str.prepend(QString("<font color=%1>").arg(StelUtils::vec3fT Vec3f color = getInfoColor();
oHtmlColor(getInfoColor()))); StelCore* core = StelApp::getInstance().getCore();
if (core->isDay() && core->getSkyDrawer()->getFlagHasAtmosph
ere()==true)
{
// Let's make info text is more readable when atmosp
here enabled at daylight.
color = StelUtils::strToVec3f(StelApp::getInstance()
.getSettings()->value("color/daylight_color", "0.0,0.0,0.0").toString());
}
str.prepend(QString("<font color=%1>").arg(StelUtils::vec3fT
oHtmlColor(color)));
str.append(QString("</font>")); str.append(QString("</font>"));
} }
} }
 End of changes. 15 change blocks. 
39 lines changed or deleted 94 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/