SolarSystem.cpp   SolarSystem.cpp 
skipping to change at line 107 skipping to change at line 107
Planet::texEarthShadow.clear(); Planet::texEarthShadow.clear();
delete allTrails; delete allTrails;
allTrails = NULL; allTrails = NULL;
// Get rid of circular reference between the shared pointers which p revent proper destruction of the Planet objects. // Get rid of circular reference between the shared pointers which p revent proper destruction of the Planet objects.
foreach (PlanetP p, systemPlanets) foreach (PlanetP p, systemPlanets)
{ {
p->satellites.clear(); p->satellites.clear();
} }
//delete comet textures created in loadPlanets
Comet::comaTexture.clear();
Comet::tailTexture.clear();
//deinit of SolarSystem is NOT called at app end automatically
deinit();
} }
/************************************************************************* /*************************************************************************
Reimplementation of the getCallOrder method Reimplementation of the getCallOrder method
*************************************************************************/ *************************************************************************/
double SolarSystem::getCallOrder(StelModuleActionName actionName) const double SolarSystem::getCallOrder(StelModuleActionName actionName) const
{ {
if (actionName==StelModule::ActionDraw) if (actionName==StelModule::ActionDraw)
return StelApp::getInstance().getModuleMgr().getModule("Star Mgr")->getCallOrder(actionName)+10; return StelApp::getInstance().getModuleMgr().getModule("Star Mgr")->getCallOrder(actionName)+10;
return 0; return 0;
skipping to change at line 175 skipping to change at line 182
QString displayGroup = N_("Display Options"); QString displayGroup = N_("Display Options");
addAction("actionShow_Planets", displayGroup, N_("Planets"), "planet sDisplayed", "P"); addAction("actionShow_Planets", displayGroup, N_("Planets"), "planet sDisplayed", "P");
addAction("actionShow_Planets_Labels", displayGroup, N_("Planet labe ls"), "labelsDisplayed", "Alt+P"); addAction("actionShow_Planets_Labels", displayGroup, N_("Planet labe ls"), "labelsDisplayed", "Alt+P");
addAction("actionShow_Planets_Orbits", displayGroup, N_("Planet orbi ts"), "orbitsDisplayed", "O"); addAction("actionShow_Planets_Orbits", displayGroup, N_("Planet orbi ts"), "orbitsDisplayed", "O");
addAction("actionShow_Planets_Trails", displayGroup, N_("Planet trai ls"), "trailsDisplayed", "Shift+T"); addAction("actionShow_Planets_Trails", displayGroup, N_("Planet trai ls"), "trailsDisplayed", "Shift+T");
} }
void SolarSystem::deinit() void SolarSystem::deinit()
{ {
Planet::deinitShader(); if(Planet::planetShaderProgram)
Planet::deinitShader();
} }
void SolarSystem::recreateTrails() void SolarSystem::recreateTrails()
{ {
// Create a trail group containing all the planets orbiting the sun (not including satellites) // Create a trail group containing all the planets orbiting the sun (not including satellites)
if (allTrails!=NULL) if (allTrails!=NULL)
delete allTrails; delete allTrails;
allTrails = new TrailGroup(365.f); allTrails = new TrailGroup(365.f);
PlanetP p = getSelected(); PlanetP p = getSelected();
skipping to change at line 526 skipping to change at line 534
semi_major_axis = (eccentricity == 1.0) semi_major_axis = (eccentricity == 1.0)
? 0.0 // par abolic orbits have no semi_major_axis ? 0.0 // par abolic orbits have no semi_major_axis
: pericenter Distance / (1.0-eccentricity); : pericenter Distance / (1.0-eccentricity);
} }
double meanMotion = pd.value(secname+"/orbit_MeanMot ion",-1e100).toDouble(); double meanMotion = pd.value(secname+"/orbit_MeanMot ion",-1e100).toDouble();
double period; double period;
if (meanMotion <= -1e100) { if (meanMotion <= -1e100) {
period = pd.value(secname+"/orbit_Period",-1 e100).toDouble(); period = pd.value(secname+"/orbit_Period",-1 e100).toDouble();
if (period <= -1e100) { if (period <= -1e100) {
meanMotion = (eccentricity == 1.0) meanMotion = (eccentricity == 1.0)
? 0.01720209 895 * (1.5/pericenterDistance) * sqrt(0.5/pericenterDistance) ? 0.01720209 895 * (1.5/pericenterDistance) * std::sqrt(0.5/pericenterDistance)
: (semi_majo r_axis > 0.0) : (semi_majo r_axis > 0.0)
? 0.01720209 ? 0.01720209
895 / (semi_major_axis*sqrt(semi_major_axis)) 895 / (semi_major_axis*std::sqrt(semi_major_axis))
: 0.01720209 : 0.01720209
895 / (-semi_major_axis*sqrt(-semi_major_axis)); 895 / (-semi_major_axis*std::sqrt(-semi_major_axis));
period = 2.0*M_PI/meanMotion; period = 2.0*M_PI/meanMotion;
} else { } else {
meanMotion = 2.0*M_PI/period; meanMotion = 2.0*M_PI/period;
} }
} else { } else {
period = 2.0*M_PI/meanMotion; period = 2.0*M_PI/meanMotion;
} }
const double inclination = pd.value(secname+"/orbit_ Inclination").toDouble()*(M_PI/180.0); const double inclination = pd.value(secname+"/orbit_ Inclination").toDouble()*(M_PI/180.0);
const double ascending_node = pd.value(secname+"/orb it_AscendingNode").toDouble()*(M_PI/180.0); const double ascending_node = pd.value(secname+"/orb it_AscendingNode").toDouble()*(M_PI/180.0);
double arg_of_pericenter = pd.value(secname+"/orbit_ ArgOfPericenter",-1e100).toDouble(); double arg_of_pericenter = pd.value(secname+"/orbit_ ArgOfPericenter",-1e100).toDouble();
skipping to change at line 642 skipping to change at line 650
<< "either orbit_Mea nMotion or orbit_Period"; << "either orbit_Mea nMotion or orbit_Period";
} else { } else {
// in case of parent=sun: us e Gaussian gravitational constant // in case of parent=sun: us e Gaussian gravitational constant
// for calculating meanMotio n: // for calculating meanMotio n:
//meanMotion = (eccentricity >= 0.9999 && eccentricity <= 1.0) //meanMotion = (eccentricity >= 0.9999 && eccentricity <= 1.0)
// ? 0. 01720209895 * (1.5/pericenterDistance) * sqrt(0.5/pericenterDistance) // ? 0. 01720209895 * (1.5/pericenterDistance) * sqrt(0.5/pericenterDistance)
// : (s emi_major_axis > 0.0) // : (s emi_major_axis > 0.0)
// ? 0. 01720209895 / (semi_major_axis*sqrt(semi_major_axis)) // ? 0. 01720209895 / (semi_major_axis*sqrt(semi_major_axis))
// : 0. 01720209895 / (-semi_major_axis*sqrt(-semi_major_axis)); // : 0. 01720209895 / (-semi_major_axis*sqrt(-semi_major_axis));
meanMotion = (eccentricity = = 1.0) meanMotion = (eccentricity = = 1.0)
? 0. ? 0.
01720209895 * (1.5/pericenterDistance) * sqrt(0.5/pericenterDistance) // G 01720209895 * (1.5/pericenterDistance) * std::sqrt(0.5/pericenterDistance)
Z: This is Heafner's W / dt // GZ: This is Heafner's W / dt
: 0. : 0.
01720209895 / (fabs(semi_major_axis)*sqrt(fabs(semi_major_axis))); 01720209895 / (fabs(semi_major_axis)*std::sqrt(fabs(semi_major_axis)));
} }
} else { } else {
meanMotion = 2.0*M_PI/period; meanMotion = 2.0*M_PI/period;
} }
} else { } else {
meanMotion *= (M_PI/180.0); meanMotion *= (M_PI/180.0);
} }
double time_at_pericenter = pd.value(secname+"/orbit _TimeAtPericenter",-1e100).toDouble(); double time_at_pericenter = pd.value(secname+"/orbit _TimeAtPericenter",-1e100).toDouble();
if (time_at_pericenter <= -1e100) { if (time_at_pericenter <= -1e100) {
const double epoch = pd.value(secname+"/orbi t_Epoch",-1e100).toDouble(); const double epoch = pd.value(secname+"/orbi t_Epoch",-1e100).toDouble();
skipping to change at line 821 skipping to change at line 829
qWarning() << "ERROR : can't find posfunc " << funcN ame << " for " << englishName; qWarning() << "ERROR : can't find posfunc " << funcN ame << " for " << englishName;
exit(-1); exit(-1);
} }
// Create the Solar System body and add it to the list // Create the Solar System body and add it to the list
QString type = pd.value(secname+"/type").toString(); QString type = pd.value(secname+"/type").toString();
PlanetP p; PlanetP p;
// New class objects, named "plutino", "cubewano", "dwarf pl anet", "SDO", "OCO", has properties // New class objects, named "plutino", "cubewano", "dwarf pl anet", "SDO", "OCO", has properties
// similar to asteroids and we should calculate their positi ons like for asteroids. Dwarf planets // similar to asteroids and we should calculate their positi ons like for asteroids. Dwarf planets
// have one exception: Pluto - we should use special functio n for calculation of orbit of Pluto. // have one exception: Pluto - we should use special functio n for calculation of orbit of Pluto.
if ((type == "asteroid" || type == "dwarf planet" || type == "cubewano" || type == "plutino" || type == "sdo" || type == "oco") && !eng lishName.contains("Pluto")) if ((type == "asteroid" || type == "dwarf planet" || type == "cubewano" || type == "plutino" || type == "scattered disc object" || type == "Oort cloud object") && !englishName.contains("Pluto"))
{ {
p = PlanetP(new MinorPlanet(englishName, p = PlanetP(new MinorPlanet(englishName,
pd.value(secname+"/light ing").toBool(), pd.value(secname+"/light ing").toBool(),
pd.value(secname+"/radiu s").toDouble()/AU, pd.value(secname+"/radiu s").toDouble()/AU,
pd.value(secname+"/oblat eness", 0.0).toDouble(), pd.value(secname+"/oblat eness", 0.0).toDouble(),
StelUtils::strToVec3f(pd .value(secname+"/color").toString()), StelUtils::strToVec3f(pd .value(secname+"/color").toString()),
pd.value(secname+"/albed o").toFloat(), pd.value(secname+"/albed o").toFloat(),
pd.value(secname+"/tex_m ap").toString(), pd.value(secname+"/tex_m ap").toString(),
posfunc, posfunc,
userDataPtr, userDataPtr,
skipping to change at line 908 skipping to change at line 916
if (slope >= 0 && slope <= 20) if (slope >= 0 && slope <= 20)
{ {
mp->setAbsoluteMagnitudeAndSlope(mag nitude, slope); mp->setAbsoluteMagnitudeAndSlope(mag nitude, slope);
} }
else else
{ {
mp->setAbsoluteMagnitudeAndSlope(mag nitude, 4.0); mp->setAbsoluteMagnitudeAndSlope(mag nitude, 4.0);
} }
} }
mp->setSemiMajorAxis(pd.value(secname+"/orbit_SemiMa const double eccentricity = pd.value(secname+"/orbit
jorAxis", 0).toDouble()); _Eccentricity",0.0).toDouble();
const double pericenterDistance = pd.value(secname+"
/orbit_PericenterDistance",-1e100).toDouble();
if (eccentricity<1 && pericenterDistance>0)
{
mp->setSemiMajorAxis(pericenterDistance / (1
.0-eccentricity));
}
} }
else else
{ {
// Set possible default name of the normal map for a voiding yin-yang shaped moon // Set possible default name of the normal map for a voiding yin-yang shaped moon
// phase when normal map key not exists. Example: mo on_normals.png // phase when normal map key not exists. Example: mo on_normals.png
// Details: https://bugs.launchpad.net/stellarium/+b ug/1335609 // Details: https://bugs.launchpad.net/stellarium/+b ug/1335609
QString normalMapName = englishName.toLower().append ("_normals.png"); QString normalMapName = englishName.toLower().append ("_normals.png");
p = PlanetP(new Planet(englishName, p = PlanetP(new Planet(englishName,
pd.value(secname+"/lighting") .toBool(), pd.value(secname+"/lighting") .toBool(),
pd.value(secname+"/radius").t oDouble()/AU, pd.value(secname+"/radius").t oDouble()/AU,
skipping to change at line 999 skipping to change at line 1011
if (systemPlanets.isEmpty()) if (systemPlanets.isEmpty())
{ {
qWarning() << "No Solar System objects loaded from" << QDir: :toNativeSeparators(filePath); qWarning() << "No Solar System objects loaded from" << QDir: :toNativeSeparators(filePath);
return false; return false;
} }
// special case: load earth shadow texture // special case: load earth shadow texture
Planet::texEarthShadow = StelApp::getInstance().getTextureManager(). createTexture(StelFileMgr::getInstallationDir()+"/textures/earth-shadow.png "); Planet::texEarthShadow = StelApp::getInstance().getTextureManager(). createTexture(StelFileMgr::getInstallationDir()+"/textures/earth-shadow.png ");
// GZ: Also comets just have static textures. // Also comets just have static textures.
Comet::comaTexture = StelApp::getInstance().getTextureManager().crea teTextureThread(StelFileMgr::getInstallationDir()+"/textures/cometComa.png" , StelTexture::StelTextureParams(true, GL_LINEAR, GL_CLAMP_TO_EDGE)); Comet::comaTexture = StelApp::getInstance().getTextureManager().crea teTextureThread(StelFileMgr::getInstallationDir()+"/textures/cometComa.png" , StelTexture::StelTextureParams(true, GL_LINEAR, GL_CLAMP_TO_EDGE));
//GZ: tail textures. We use a paraboloid tail body, textured like a fisheye sphere, i.e. center=head. The texture should be something like a mo ttled star to give some structure. //tail textures. We use paraboloid tail bodies, textured like a fish eye sphere, i.e. center=head. The texture should be something like a mottle d star to give some structure.
Comet::tailTexture = StelApp::getInstance().getTextureManager().crea teTextureThread(StelFileMgr::getInstallationDir()+"/textures/cometTail.png" , StelTexture::StelTextureParams(true, GL_LINEAR, GL_CLAMP_TO_EDGE)); Comet::tailTexture = StelApp::getInstance().getTextureManager().crea teTextureThread(StelFileMgr::getInstallationDir()+"/textures/cometTail.png" , StelTexture::StelTextureParams(true, GL_LINEAR, GL_CLAMP_TO_EDGE));
//GZ: I think we need only one texture for the tails.
return true; return true;
} }
// Compute the position for every elements of the solar system. // Compute the position for every elements of the solar system.
// The order is not important since the position is computed relatively to the mother body // The order is not important since the position is computed relatively to the mother body
void SolarSystem::computePositions(double date, const Vec3d& observerPos) void SolarSystem::computePositions(double date, const Vec3d& observerPos)
{ {
if (flagLightTravelTime) if (flagLightTravelTime)
{ {
skipping to change at line 1599 skipping to change at line 1610
{ {
// Save flag states // Save flag states
bool flagScaleMoon = getFlagMoonScale(); bool flagScaleMoon = getFlagMoonScale();
float moonScale = getMoonScale(); float moonScale = getMoonScale();
bool flagPlanets = getFlagPlanets(); bool flagPlanets = getFlagPlanets();
bool flagHints = getFlagHints(); bool flagHints = getFlagHints();
bool flagLabels = getFlagLabels(); bool flagLabels = getFlagLabels();
bool flagOrbits = getFlagOrbits(); bool flagOrbits = getFlagOrbits();
bool flagNative = getFlagNativeNames(); bool flagNative = getFlagNativeNames();
bool flagTrans = getFlagTranslatedNames(); bool flagTrans = getFlagTranslatedNames();
bool hasSelection = false;
// Save observer location (fix for LP bug # 969211) // Save observer location (fix for LP bug # 969211)
// TODO: This can probably be done better with a better understandin g of StelObserver --BM // TODO: This can probably be done better with a better understandin g of StelObserver --BM
StelCore* core = StelApp::getInstance().getCore(); StelCore* core = StelApp::getInstance().getCore();
StelLocation loc = core->getCurrentLocation(); StelLocation loc = core->getCurrentLocation();
StelObjectMgr* objMgr = GETSTELMODULE(StelObjectMgr);
// Whether any planet are selected? Save the current selection...
const QList<StelObjectP> selectedObject = objMgr->getSelectedObject(
"Planet");
if (!selectedObject.isEmpty())
{
// ... unselect current planet.
hasSelection = true;
objMgr->unSelect();
}
// Unload all Solar System objects // Unload all Solar System objects
selected.clear();//Release the selected one selected.clear();//Release the selected one
foreach (Orbit* orb, orbits) foreach (Orbit* orb, orbits)
{ {
delete orb; delete orb;
orb = NULL; orb = NULL;
} }
orbits.clear(); orbits.clear();
sun.clear(); sun.clear();
skipping to change at line 1649 skipping to change at line 1670
// Restore flag states // Restore flag states
setFlagMoonScale(flagScaleMoon); setFlagMoonScale(flagScaleMoon);
setMoonScale(moonScale); setMoonScale(moonScale);
setFlagPlanets(flagPlanets); setFlagPlanets(flagPlanets);
setFlagHints(flagHints); setFlagHints(flagHints);
setFlagLabels(flagLabels); setFlagLabels(flagLabels);
setFlagOrbits(flagOrbits); setFlagOrbits(flagOrbits);
setFlagNativeNames(flagNative); setFlagNativeNames(flagNative);
setFlagTranslatedNames(flagTrans); setFlagTranslatedNames(flagTrans);
if (hasSelection)
{
// Restore selection...
objMgr->setSelectedObject(selectedObject);
}
// Restore translations // Restore translations
updateI18n(); updateI18n();
} }
// Set the algorithm for computation of apparent magnitudes for planets in case observer on the Earth // Set the algorithm for computation of apparent magnitudes for planets in case observer on the Earth
void SolarSystem::setApparentMagnitudeAlgorithmOnEarth(QString algorithm) void SolarSystem::setApparentMagnitudeAlgorithmOnEarth(QString algorithm)
{ {
getEarth()->setApparentMagnitudeAlgorithm(algorithm); getEarth()->setApparentMagnitudeAlgorithm(algorithm);
} }
 End of changes. 14 change blocks. 
18 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/