Planet.cpp   Planet.cpp 
skipping to change at line 54 skipping to change at line 54
#include <QDebug> #include <QDebug>
#include <QVarLengthArray> #include <QVarLengthArray>
#include <QOpenGLContext> #include <QOpenGLContext>
#include <QOpenGLShader> #include <QOpenGLShader>
Vec3f Planet::labelColor = Vec3f(0.4,0.4,0.8); Vec3f Planet::labelColor = Vec3f(0.4,0.4,0.8);
Vec3f Planet::orbitColor = Vec3f(1,0.6,1); Vec3f Planet::orbitColor = Vec3f(1,0.6,1);
StelTextureSP Planet::hintCircleTex; StelTextureSP Planet::hintCircleTex;
StelTextureSP Planet::texEarthShadow; StelTextureSP Planet::texEarthShadow;
bool Planet::permanentDrawingOrbits = false;
QOpenGLShaderProgram* Planet::planetShaderProgram=NULL; QOpenGLShaderProgram* Planet::planetShaderProgram=NULL;
Planet::PlanetShaderVars Planet::planetShaderVars; Planet::PlanetShaderVars Planet::planetShaderVars;
QOpenGLShaderProgram* Planet::ringPlanetShaderProgram=NULL; QOpenGLShaderProgram* Planet::ringPlanetShaderProgram=NULL;
Planet::RingPlanetShaderVars Planet::ringPlanetShaderVars; Planet::RingPlanetShaderVars Planet::ringPlanetShaderVars;
QOpenGLShaderProgram* Planet::moonShaderProgram=NULL; QOpenGLShaderProgram* Planet::moonShaderProgram=NULL;
Planet::MoonShaderVars Planet::moonShaderVars; Planet::MoonShaderVars Planet::moonShaderVars;
QMap<Planet::PlanetType, QString> Planet::pTypeMap; QMap<Planet::PlanetType, QString> Planet::pTypeMap;
QMap<Planet::ApparentMagnitudeAlgorithm, QString> Planet::vMagAlgorithmMap; QMap<Planet::ApparentMagnitudeAlgorithm, QString> Planet::vMagAlgorithmMap;
skipping to change at line 202 skipping to change at line 204
return nameI18; return nameI18;
} }
// Return the information string "ready to print" :) // Return the information string "ready to print" :)
QString Planet::getInfoString(const StelCore* core, const InfoStringGroup& flags) const QString Planet::getInfoString(const StelCore* core, const InfoStringGroup& flags) const
{ {
QString str; QString str;
QTextStream oss(&str); QTextStream oss(&str);
double az_app, alt_app; double az_app, alt_app;
StelUtils::rectToSphe(&az_app,&alt_app,getAltAzPosApparent(core)); StelUtils::rectToSphe(&az_app,&alt_app,getAltAzPosApparent(core));
bool withDecimalDegree = StelApp::getInstance().getFlagShowDecimalDe grees();
Q_UNUSED(az_app); Q_UNUSED(az_app);
if (flags&Name) if (flags&Name)
{ {
oss << "<h2>" << getNameI18n(); // UI translation can diffe r from sky translation oss << "<h2>" << getNameI18n(); // UI translation can diffe r from sky translation
oss.setRealNumberNotation(QTextStream::FixedNotation); oss.setRealNumberNotation(QTextStream::FixedNotation);
oss.setRealNumberPrecision(1); oss.setRealNumberPrecision(1);
if (sphereScale != 1.f) if (sphereScale != 1.f)
oss << QString::fromUtf8(" (\xC3\x97") << sphereScal e << ")"; oss << QString::fromUtf8(" (\xC3\x97") << sphereScal e << ")";
oss << "</h2>"; oss << "</h2>";
skipping to change at line 238 skipping to change at line 241
oss << q_("Absolute Magnitude: %1").arg(getVMagnitude(core)- 5.*(std::log10(getJ2000EquatorialPos(core).length()*AU/PARSEC)-1.), 0, 'f', 2) << "<br>"; oss << q_("Absolute Magnitude: %1").arg(getVMagnitude(core)- 5.*(std::log10(getJ2000EquatorialPos(core).length()*AU/PARSEC)-1.), 0, 'f', 2) << "<br>";
oss << getPositionInfoString(core, flags); oss << getPositionInfoString(core, flags);
// GZ This is mostly for debugging. Maybe also useful for letting pe ople use our results to cross-check theirs, but we should not act as refere nce, currently... // GZ This is mostly for debugging. Maybe also useful for letting pe ople use our results to cross-check theirs, but we should not act as refere nce, currently...
// TODO: maybe separate this out into: // TODO: maybe separate this out into:
//if (flags&EclipticCoordXYZ) //if (flags&EclipticCoordXYZ)
// For now: add to EclipticCoord // For now: add to EclipticCoord
//if (flags&EclipticCoord) //if (flags&EclipticCoord)
// oss << q_("Ecliptical XYZ (VSOP87A): %1/%2/%3").arg(QString: :number(eclipticPos[0], 'f', 3), QString::number(eclipticPos[1], 'f', 3), Q String::number(eclipticPos[2], 'f', 3)) << "<br>"; // oss << q_("Ecliptical XYZ (VSOP87A): %1/%2/%3").arg(QString: :number(eclipticPos[0], 'f', 3), QString::number(eclipticPos[1], 'f', 3), Q String::number(eclipticPos[2], 'f', 3)) << "<br>";
// if (flags&Extra)
// {
// static SolarSystem *ssystem=GETSTELMODULE(SolarSystem);
// double ecl= ssystem->getEarth()->getRotObliquity(core->getJD
ay());
// if (core->getCurrentLocation().planetName=="Earth")
// oss << q_("Ecliptic obliquity (of date): %1").arg(St
elUtils::radToDmsStr(ecl, true)) << "<br>";
// //if (englishName!="Sun")
// // oss << q_("Obliquity (of date): %1").arg(StelUtils::
radToDmsStr(getRotObliquity(core->getJDay()), true)) << "<br>";
// }
if (flags&Distance) if (flags&Distance)
{ {
double distanceAu = getJ2000EquatorialPos(core).length(); double distanceAu = getJ2000EquatorialPos(core).length();
double distanceKm = AU * distanceAu; double distanceKm = AU * distanceAu;
if (distanceAu < 0.1) if (distanceAu < 0.1)
{ {
// xgettext:no-c-format // xgettext:no-c-format
oss << QString(q_("Distance: %1AU (%2 km)")) oss << QString(q_("Distance: %1AU (%2 km)"))
.arg(distanceAu, 0, 'f', 6) .arg(distanceAu, 0, 'f', 6)
skipping to change at line 275 skipping to change at line 269
} }
oss << "<br>"; oss << "<br>";
} }
if (flags&Size) if (flags&Size)
{ {
double angularSize = 2.*getAngularSize(core)*M_PI/180.; double angularSize = 2.*getAngularSize(core)*M_PI/180.;
if (rings) if (rings)
{ {
double withoutRings = 2.*getSpheroidAngularSize(core )*M_PI/180.; double withoutRings = 2.*getSpheroidAngularSize(core )*M_PI/180.;
oss << q_("Apparent diameter: %1, with rings: %2") if (withDecimalDegree)
.arg(StelUtils::radToDmsStr(withoutRings, tru oss << q_("Apparent diameter: %1, with rings
e), : %2")
StelUtils::radToDmsStr(angularSize, true .arg(StelUtils::radToDecDegStr(withou
)); tRings,4,false,true),
StelUtils::radToDecDegStr(angula
rSize,4,false,true));
else
oss << q_("Apparent diameter: %1, with rings
: %2")
.arg(StelUtils::radToDmsStr(withoutRi
ngs, true),
StelUtils::radToDmsStr(angularSi
ze, true));
} }
else else
{ {
oss << q_("Apparent diameter: %1").arg(StelUtils::ra if (withDecimalDegree)
dToDmsStr(angularSize, true)); oss << q_("Apparent diameter: %1").arg(StelU
tils::radToDecDegStr(angularSize,5,false,true));
else
oss << q_("Apparent diameter: %1").arg(StelU
tils::radToDmsStr(angularSize, true));
} }
oss << "<br>"; oss << "<br>";
} }
double siderealPeriod = getSiderealPeriod(); double siderealPeriod = getSiderealPeriod();
double siderealDay = getSiderealDay(); double siderealDay = getSiderealDay();
if (flags&Extra) if (flags&Extra)
{ {
// This is a string you can activate for debugging. It shows the distance between observer and center of the body you are standing on. // This is a string you can activate for debugging. It shows the distance between observer and center of the body you are standing on.
// May be helpful for debugging critical parallax correction s for eclipses. // May be helpful for debugging critical parallax correction s for eclipses.
skipping to change at line 325 skipping to change at line 327
StelUtils::radToDecDeg(elongation, sign, deg); StelUtils::radToDecDeg(elongation, sign, deg);
if (deg>=357.5 && deg<=2.5) if (deg>=357.5 && deg<=2.5)
phase = q_("New Moon"); phase = q_("New Moon");
if (deg>=87.5 && deg<=92.5) if (deg>=87.5 && deg<=92.5)
phase = q_("Last Quarter"); phase = q_("Last Quarter");
if (deg>=177.5 && deg<=182.5) if (deg>=177.5 && deg<=182.5)
phase = q_("Full Moon"); phase = q_("Full Moon");
if (deg>=267.5 && deg<=272.5) if (deg>=267.5 && deg<=272.5)
phase = q_("First Quarter"); phase = q_("First Quarter");
oss << QString(q_("Phase Angle: %1")).arg(StelUtils: if (withDecimalDegree)
:radToDmsStr(getPhaseAngle(observerHelioPos))) << "<br>"; {
oss << QString(q_("Elongation: %1")).arg(StelUtils:: oss << QString(q_("Phase Angle: %1")).arg(St
radToDmsStr(elongation)) << "<br>"; elUtils::radToDecDegStr(getPhaseAngle(observerHelioPos),4,false,true)) << "
<br>";
oss << QString(q_("Elongation: %1")).arg(Ste
lUtils::radToDecDegStr(elongation,4,false,true)) << "<br>";
}
else
{
oss << QString(q_("Phase Angle: %1")).arg(St
elUtils::radToDmsStr(getPhaseAngle(observerHelioPos))) << "<br>";
oss << QString(q_("Elongation: %1")).arg(Ste
lUtils::radToDmsStr(elongation)) << "<br>";
}
if (englishName=="Moon" && !phase.isEmpty()) if (englishName=="Moon" && !phase.isEmpty())
{ {
if (qRound(deg)==180.f || qRound(deg)==90.f || qRound(deg)==270.f || qRound(deg)==0.f) if (qRound(deg)==180.f || qRound(deg)==90.f || qRound(deg)==270.f || qRound(deg)==0.f)
phase = QString("%1 (<b>%2</b>)").ar g(getPhase(observerHelioPos), 0, 'f', 2).arg(phase); phase = QString("%1 (<b>%2</b>)").ar g(getPhase(observerHelioPos), 0, 'f', 2).arg(phase);
else else
phase = QString("%1 (%2)").arg(getPh ase(observerHelioPos), 0, 'f', 2).arg(phase); phase = QString("%1 (%2)").arg(getPh ase(observerHelioPos), 0, 'f', 2).arg(phase);
} }
else else
phase = QString("%1").arg(getPhase(observerH elioPos), 0, 'f', 2); phase = QString("%1").arg(getPhase(observerH elioPos), 0, 'f', 2);
skipping to change at line 502 skipping to change at line 512
res.append(planet.data()); res.append(planet.data());
} }
if (willCastShadow(this, parent.data())) if (willCastShadow(this, parent.data()))
res.append(parent.data()); res.append(parent.data());
return res; return res;
} }
void Planet::computePosition(const double dateJDE) void Planet::computePosition(const double dateJDE)
{ {
// Make sure the parent position is computed for the dateJD, otherwi // Make sure the parent position is computed for the dateJDE, otherw
se ise
// getHeliocentricPos() would return incorect values. // getHeliocentricPos() would return incorrect values.
if (parent) if (parent)
parent->computePositionWithoutOrbits(dateJDE); parent->computePositionWithoutOrbits(dateJDE);
if (orbitFader.getInterstate()>0.000001 && deltaOrbitJDE > 0 && (fab s(lastOrbitJDE-dateJDE)>deltaOrbitJDE || !orbitCached)) if (orbitFader.getInterstate()>0.000001 && deltaOrbitJDE > 0 && (fab s(lastOrbitJDE-dateJDE)>deltaOrbitJDE || !orbitCached))
{ {
StelCore *core=StelApp::getInstance().getCore(); StelCore *core=StelApp::getInstance().getCore();
double calc_date; double calc_date;
// int delta_points = (int)(0.5 + (date - lastOrbitJD)/date_ increment); // int delta_points = (int)(0.5 + (date - lastOrbitJD)/date_ increment);
int delta_points; int delta_points;
skipping to change at line 525 skipping to change at line 535
if( dateJDE > lastOrbitJDE ) if( dateJDE > lastOrbitJDE )
{ {
delta_points = (int)(0.5 + (dateJDE - lastOrbitJDE)/ deltaOrbitJDE); delta_points = (int)(0.5 + (dateJDE - lastOrbitJDE)/ deltaOrbitJDE);
} }
else else
{ {
delta_points = (int)(-0.5 + (dateJDE - lastOrbitJDE) /deltaOrbitJDE); delta_points = (int)(-0.5 + (dateJDE - lastOrbitJDE) /deltaOrbitJDE);
} }
double new_date = lastOrbitJDE + delta_points*deltaOrbitJDE; double new_date = lastOrbitJDE + delta_points*deltaOrbitJDE;
// qDebug( "Updating orbit coordinates for %s (delta %f) (%d points)\n", getEnglishName().toUtf8().data(), deltaOrbitJD, delta_points); // qDebug( "Updating orbit coordinates for %s (delta %f) (%d points)\n", getEnglishName().toUtf8().data(), deltaOrbitJDE, delta_points) ;
if( delta_points > 0 && delta_points < ORBIT_SEGMENTS && orb itCached) if( delta_points > 0 && delta_points < ORBIT_SEGMENTS && orb itCached)
{ {
for( int d=0; d<ORBIT_SEGMENTS; d++ ) for( int d=0; d<ORBIT_SEGMENTS; d++ )
{ {
if(d + delta_points >= ORBIT_SEGMENTS ) if(d + delta_points >= ORBIT_SEGMENTS )
{ {
// calculate new points // calculate new points
calc_date = new_date + (d-ORBIT_SEGM ENTS/2)*deltaOrbitJDE; calc_date = new_date + (d-ORBIT_SEGM ENTS/2)*deltaOrbitJDE;
skipping to change at line 1158 skipping to change at line 1168
draw3dModel(core, transfo, 1024, true); draw3dModel(core, transfo, 1024, true);
} }
return; return;
} }
// Compute the 2D position and check if in the screen // Compute the 2D position and check if in the screen
const StelProjectorP prj = core->getProjection(transfo); const StelProjectorP prj = core->getProjection(transfo);
float screenSz = getAngularSize(core)*M_PI/180.*prj->getPixelPerRadA tCenter(); float screenSz = getAngularSize(core)*M_PI/180.*prj->getPixelPerRadA tCenter();
float viewport_left = prj->getViewportPosX(); float viewport_left = prj->getViewportPosX();
float viewport_bottom = prj->getViewportPosY(); float viewport_bottom = prj->getViewportPosY();
if (prj->project(Vec3d(0), screenPos) if ((prj->project(Vec3d(0), screenPos)
&& screenPos[1]>viewport_bottom - screenSz && screenPos[1] < vie && screenPos[1]>viewport_bottom - screenSz && screenPos[1] < vi
wport_bottom + prj->getViewportHeight()+screenSz ewport_bottom + prj->getViewportHeight()+screenSz
&& screenPos[0]>viewport_left - screenSz && screenPos[0] < viewp && screenPos[0]>viewport_left - screenSz && screenPos[0] < view
ort_left + prj->getViewportWidth() + screenSz) port_left + prj->getViewportWidth() + screenSz)
|| permanentDrawingOrbits)
{ {
// Draw the name, and the circle if it's not too close from the body it's turning around // Draw the name, and the circle if it's not too close from the body it's turning around
// this prevents name overlapping (e.g. for Jupiter's satell ites) // this prevents name overlapping (e.g. for Jupiter's satell ites)
float ang_dist = 300.f*atan(getEclipticPos().length()/getEqu inoxEquatorialPos(core).length())/core->getMovementMgr()->getCurrentFov(); float ang_dist = 300.f*atan(getEclipticPos().length()/getEqu inoxEquatorialPos(core).length())/core->getMovementMgr()->getCurrentFov();
if (ang_dist==0.f) if (ang_dist==0.f)
ang_dist = 1.f; // if ang_dist == 0, the Planet is s un.. ang_dist = 1.f; // if ang_dist == 0, the Planet is s un..
// by putting here, only draw orbit if Planet is visible for clarity // by putting here, only draw orbit if Planet is visible for clarity
drawOrbit(core); // TODO - fade in here also... drawOrbit(core); // TODO - fade in here also...
 End of changes. 9 change blocks. 
32 lines changed or deleted 48 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/