SolarSystemEditor.cpp   SolarSystemEditor.cpp 
skipping to change at line 476 skipping to change at line 476
{ {
return SsoElements(); return SsoElements();
} }
result.insert("section_name", sectionName); result.insert("section_name", sectionName);
//After a name has been determined, insert the essential keys //After a name has been determined, insert the essential keys
result.insert("parent", "Sun"); result.insert("parent", "Sun");
result.insert("type", "comet"); result.insert("type", "comet");
//"comet_orbit" is used for all cases: //"comet_orbit" is used for all cases:
//"ell_orbit" interprets distances as kilometers, not AUs //"ell_orbit" interprets distances as kilometers, not AUs
result.insert("coord_func","comet_orbit"); result.insert("coord_func", "comet_orbit");
// GZ: moved next line below! // GZ: moved next line below!
//result.insert("orbit_good", 1000); // default validity for osculat ing elements, days //result.insert("orbit_good", 1000); // default validity for osculat ing elements, days
result.insert("lighting", false); result.insert("lighting", false);
result.insert("color", "1.0, 1.0, 1.0"); result.insert("color", "1.0, 1.0, 1.0");
result.insert("tex_map", "nomap.png"); result.insert("tex_map", "nomap.png");
bool ok = false; bool ok = false;
//TODO: Use this for VALIDATION! //TODO: Use this for VALIDATION!
skipping to change at line 520 skipping to change at line 520
double longitudeOfTheAscendingNode = mpcParser.cap(10).toDouble(&ok) ;//J2000.0, degrees double longitudeOfTheAscendingNode = mpcParser.cap(10).toDouble(&ok) ;//J2000.0, degrees
result.insert("orbit_AscendingNode", longitudeOfTheAscendingNode); result.insert("orbit_AscendingNode", longitudeOfTheAscendingNode);
double inclination = mpcParser.cap(11).toDouble(&ok); double inclination = mpcParser.cap(11).toDouble(&ok);
result.insert("orbit_Inclination", inclination); result.insert("orbit_Inclination", inclination);
// GZ: We should reduce orbit_good for elliptical orbits to one half period before/after perihel! // GZ: We should reduce orbit_good for elliptical orbits to one half period before/after perihel!
if (eccentricity < 1.0) if (eccentricity < 1.0)
{ {
// Heafner, p.71 // Heafner, Fundamental Ephemeris Computations, p.71
const double mu=(0.01720209895*0.01720209895); // GAUSS_GRAV const double a=perihelionDistance/(1.-eccentricity); // semi
_CONST^2 major axis.
const double meanMotion=std::sqrt(mu/(perihelionDistance*per const double meanMotion=0.01720209895/std::sqrt(a*a*a); // r
ihelionDistance*perihelionDistance)); // radians/day adians/day (0.01720209895 is Gaussian gravitational constant (symbol k))
double period=M_PI*2.0 / meanMotion; // period, days double period=M_PI*2.0 / meanMotion; // period, days
result.insert("orbit_good", qMin(1000, (int) floor(0.5*perio d))); // validity for elliptical osculating elements, days. Goes from aphel to next aphel or max 1000 days. result.insert("orbit_good", qMin(1000, (int) floor(0.5*perio d))); // validity for elliptical osculating elements, days. Goes from aphel to next aphel or max 1000 days.
result.insert("orbit_visualization_period", period); // add period for visualization of orbit
} }
else else
result.insert("orbit_good", 1000); // default validity for o sculating elements, days result.insert("orbit_good", 1000); // default validity for o sculating elements, days
double absoluteMagnitude = mpcParser.cap(15).toDouble(&ok); double absoluteMagnitude = mpcParser.cap(15).toDouble(&ok);
result.insert("absolute_magnitude", absoluteMagnitude); result.insert("absolute_magnitude", absoluteMagnitude);
//This is not the same "slope parameter" as used in asteroids. Bette r name? //This is not the same "slope parameter" as used in asteroids. Bette r name?
double slopeParameter = mpcParser.cap(16).toDouble(&ok); double slopeParameter = mpcParser.cap(16).toDouble(&ok);
result.insert("slope_parameter", slopeParameter); result.insert("slope_parameter", slopeParameter);
skipping to change at line 563 skipping to change at line 564
//Length validation //Length validation
if (oneLineElements.isEmpty() || if (oneLineElements.isEmpty() ||
oneLineElements.length() > 202 || oneLineElements.length() > 202 ||
oneLineElements.length() < 152) //The column ends at 160, but is left-aligned oneLineElements.length() < 152) //The column ends at 160, but is left-aligned
{ {
return result; return result;
} }
QString column; QString column;
QString objectType = "asteroid";
bool ok = false; bool ok = false;
//bool isLongForm = (oneLineElements.length() > 160) ? true : false; //bool isLongForm = (oneLineElements.length() > 160) ? true : false;
//Minor planet number or provisional designation //Minor planet number or provisional designation
column = oneLineElements.mid(0, 7).trimmed(); column = oneLineElements.mid(0, 7).trimmed();
if (column.isEmpty()) if (column.isEmpty())
{ {
return result; return result;
} }
int minorPlanetNumber = 0; int minorPlanetNumber = 0;
skipping to change at line 656 skipping to change at line 658
//Section name //Section name
QString sectionName = convertToGroupName(name, minorPlanetNumber); QString sectionName = convertToGroupName(name, minorPlanetNumber);
if (sectionName.isEmpty()) if (sectionName.isEmpty())
{ {
return SsoElements(); return SsoElements();
} }
result.insert("section_name", sectionName); result.insert("section_name", sectionName);
//After a name has been determined, insert the essential keys //After a name has been determined, insert the essential keys
result.insert("parent", "Sun"); result.insert("parent", "Sun");
result.insert("type", "asteroid");
//"comet_orbit" is used for all cases: //"comet_orbit" is used for all cases:
//"ell_orbit" interprets distances as kilometers, not AUs //"ell_orbit" interprets distances as kilometers, not AUs
result.insert("coord_func","comet_orbit"); result.insert("coord_func","comet_orbit");
result.insert("lighting", false); result.insert("lighting", false);
result.insert("color", "1.0, 1.0, 1.0"); result.insert("color", "1.0, 1.0, 1.0");
result.insert("tex_map", "nomap.png"); result.insert("tex_map", "nomap.png");
//Magnitude and slope parameter //Magnitude and slope parameter
column = oneLineElements.mid(8,5).trimmed(); column = oneLineElements.mid(8,5).trimmed();
skipping to change at line 758 skipping to change at line 759
double epochJD; double epochJD;
StelUtils::getJDFromDate(&epochJD, year, month, day, 0, 0, 0); StelUtils::getJDFromDate(&epochJD, year, month, day, 0, 0, 0);
result.insert("orbit_Epoch", epochJD); result.insert("orbit_Epoch", epochJD);
column = oneLineElements.mid(26, 9).trimmed(); column = oneLineElements.mid(26, 9).trimmed();
double meanAnomalyAtEpoch = column.toDouble(&ok);//degrees double meanAnomalyAtEpoch = column.toDouble(&ok);//degrees
if (!ok) if (!ok)
return SsoElements(); return SsoElements();
result.insert("orbit_MeanAnomaly", meanAnomalyAtEpoch); result.insert("orbit_MeanAnomaly", meanAnomalyAtEpoch);
// add period for visualization of orbit
if (semiMajorAxis>0)
result.insert("orbit_visualization_period", StelUtils::calcu
lateSiderealPeriod(semiMajorAxis));
// 2:3 resonanse to Neptune
if ((int)semiMajorAxis == 39)
objectType = "plutino";
// Classical Kuiper belt objects
if (semiMajorAxis>=40 && semiMajorAxis<=50)
objectType = "cubewano";
// Calculate perihelion
float r = (1 - eccentricity)*semiMajorAxis;
// Scattered disc objects
if (r > 35)
objectType = "scattered disc object";
// Sednoids
if (r > 50 && semiMajorAxis > 150)
objectType = "sednoid";
//Radius and albedo //Radius and albedo
//Assume albedo of 0.15 and calculate a radius based on the absolute magnitude //Assume albedo of 0.15 and calculate a radius based on the absolute magnitude
//as described here: http://www.physics.sfasu.edu/astro/asteroids/si zemagnitude.html //as described here: http://www.physics.sfasu.edu/astro/asteroids/si zemagnitude.html
double albedo = 0.15; //Assumed double albedo = 0.15; //Assumed
double radius = std::ceil((1329 / std::sqrt(albedo)) * std::pow(10, -0.2 * absoluteMagnitude)); double radius = std::ceil((1329 / std::sqrt(albedo)) * std::pow(10, -0.2 * absoluteMagnitude));
result.insert("albedo", albedo); result.insert("albedo", albedo);
result.insert("radius", radius); result.insert("radius", radius);
result.insert("type", objectType);
return result; return result;
} }
SsoElements SolarSystemEditor::readXEphemOneLineElements(QString oneLineEle ments) SsoElements SolarSystemEditor::readXEphemOneLineElements(QString oneLineEle ments)
{ {
SsoElements result; SsoElements result;
enum OrbitType {Elliptic, Hyperbolic, Parabolic} orbitType; enum OrbitType {Elliptic, Hyperbolic, Parabolic} orbitType;
skipping to change at line 835 skipping to change at line 860
name = name.right(name.length() - sp aceIndex - 1); name = name.right(name.length() - sp aceIndex - 1);
//qDebug() << name; //qDebug() << name;
} }
} }
} }
if (name.isEmpty()) if (name.isEmpty())
{ {
return SsoElements(); return SsoElements();
} }
result.insert("name", name); result.insert("name", name);
result.insert("type", objectType);
if (minorPlanetNumber) if (minorPlanetNumber)
result.insert("minor_planet_number", minorPlanetNumber); result.insert("minor_planet_number", minorPlanetNumber);
//Section name //Section name
QString sectionName = convertToGroupName(name, minorPlanetNumber); QString sectionName = convertToGroupName(name, minorPlanetNumber);
if (sectionName.isEmpty()) if (sectionName.isEmpty())
{ {
return SsoElements(); return SsoElements();
} }
result.insert("section_name", sectionName); result.insert("section_name", sectionName);
skipping to change at line 887 skipping to change at line 911
if (orbitType == Hyperbolic) if (orbitType == Hyperbolic)
field = fields.at(5);//Field 6 field = fields.at(5);//Field 6
else else
field = fields.at(4);//Field 5 field = fields.at(4);//Field 5
double argumentOfPerihelion = field.toDouble(&ok);//J2000.0, degrees double argumentOfPerihelion = field.toDouble(&ok);//J2000.0, degrees
if (!ok) if (!ok)
return SsoElements(); return SsoElements();
result.insert("orbit_ArgOfPericenter", argumentOfPerihelion); result.insert("orbit_ArgOfPericenter", argumentOfPerihelion);
double semiMajorAxis = -1.;
if (orbitType == Elliptic) if (orbitType == Elliptic)
{ {
field = fields.at(5);//Field 6 field = fields.at(5);//Field 6
double semiMajorAxis = field.toDouble(&ok); semiMajorAxis = field.toDouble(&ok);
if (!ok) if (!ok)
return SsoElements(); return SsoElements();
result.insert("orbit_SemiMajorAxis", semiMajorAxis); result.insert("orbit_SemiMajorAxis", semiMajorAxis);
field = fields.at(6);//Field 7 field = fields.at(6);//Field 7
double meanDailyMotion = field.toDouble(&ok);//degrees per d ay double meanDailyMotion = field.toDouble(&ok);//degrees per d ay
if (!ok) if (!ok)
return SsoElements(); return SsoElements();
result.insert("orbit_MeanMotion", meanDailyMotion); result.insert("orbit_MeanMotion", meanDailyMotion);
} }
skipping to change at line 997 skipping to change at line 1022
//Radius and albedo //Radius and albedo
double albedo = 0.04; double albedo = 0.04;
double radius = 5.0; double radius = 5.0;
if (objectType == "asteroid") if (objectType == "asteroid")
{ {
//Assume albedo of 0.15 and calculate a radius based on the absolute magnitude //Assume albedo of 0.15 and calculate a radius based on the absolute magnitude
//http://www.physics.sfasu.edu/astro/asteroids/sizemagnitude .html //http://www.physics.sfasu.edu/astro/asteroids/sizemagnitude .html
albedo = 0.15; albedo = 0.15;
radius = std::ceil((1329 / std::sqrt(albedo)) * std::pow(10, -0.2 * absoluteMagnitude)); radius = std::ceil((1329 / std::sqrt(albedo)) * std::pow(10, -0.2 * absoluteMagnitude));
// 2:3 resonanse to Neptune
if ((int)semiMajorAxis == 39)
objectType = "plutino";
// Classical Kuiper belt objects
if (semiMajorAxis>=40 && semiMajorAxis<=50)
objectType = "cubewano";
// Calculate perihelion
float r = (1 - eccentricity)*semiMajorAxis;
// Scattered disc objects
if (r > 35)
objectType = "scattered disc object";
// Sednoids
if (r > 50 && semiMajorAxis > 150)
objectType = "sednoid";
} }
result.insert("albedo", albedo); result.insert("albedo", albedo);
result.insert("radius", radius); result.insert("radius", radius);
result.insert("type", objectType);
return result; return result;
} }
QList<SsoElements> SolarSystemEditor::readMpcOneLineCometElementsFromFile(Q String filePath) QList<SsoElements> SolarSystemEditor::readMpcOneLineCometElementsFromFile(Q String filePath)
{ {
QList<SsoElements> objectList; QList<SsoElements> objectList;
if (!QFile::exists(filePath)) if (!QFile::exists(filePath))
{ {
 End of changes. 12 change blocks. 
9 lines changed or deleted 56 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/