Exoplanet.cpp   Exoplanet.cpp 
skipping to change at line 48 skipping to change at line 48
#include <QList> #include <QList>
StelTextureSP Exoplanet::markerTexture; StelTextureSP Exoplanet::markerTexture;
bool Exoplanet::distributionMode = false; bool Exoplanet::distributionMode = false;
bool Exoplanet::timelineMode = false; bool Exoplanet::timelineMode = false;
bool Exoplanet::habitableMode = false; bool Exoplanet::habitableMode = false;
Vec3f Exoplanet::exoplanetMarkerColor = Vec3f(0.4f,0.9f,0.5f); Vec3f Exoplanet::exoplanetMarkerColor = Vec3f(0.4f,0.9f,0.5f);
Vec3f Exoplanet::habitableExoplanetMarkerColor = Vec3f(1.f,0.5f,0.f); Vec3f Exoplanet::habitableExoplanetMarkerColor = Vec3f(1.f,0.5f,0.f);
Exoplanet::Exoplanet(const QVariantMap& map) Exoplanet::Exoplanet(const QVariantMap& map)
: initialized(false), : initialized(false)
EPCount(0), , EPCount(0)
PHEPCount(0), , PHEPCount(0)
designation(""), , designation("")
RA(0.), , RA(0.)
DE(0.), , DE(0.)
distance(0.), , distance(0.)
stype(""), , stype("")
smass(0.), , smass(0.)
smetal(0.), , smetal(0.)
Vmag(99.), , Vmag(99.)
sradius(0.), , sradius(0.)
effectiveTemp(0), , effectiveTemp(0)
hasHabitableExoplanets(false) , hasHabitableExoplanets(false)
{ {
// return initialized if the mandatory fields are not present // return initialized if the mandatory fields are not present
if (!map.contains("designation")) if (!map.contains("designation"))
return; return;
const StelTranslator& trans = StelApp::getInstance().getLocaleMgr().
getSkyTranslator();
designation = map.value("designation").toString(); designation = map.value("designation").toString();
starProperName = map.value("starProperName").toString();
RA = StelUtils::getDecAngle(map.value("RA").toString()); RA = StelUtils::getDecAngle(map.value("RA").toString());
DE = StelUtils::getDecAngle(map.value("DE").toString()); DE = StelUtils::getDecAngle(map.value("DE").toString());
distance = map.value("distance").toFloat(); distance = map.value("distance").toFloat();
stype = map.value("stype").toString(); stype = map.value("stype").toString();
smass = map.value("smass").toFloat(); smass = map.value("smass").toFloat();
smetal = map.value("smetal").toFloat(); smetal = map.value("smetal").toFloat();
Vmag = map.value("Vmag", 99.f).toFloat(); Vmag = map.value("Vmag", 99.f).toFloat();
sradius = map.value("sradius").toFloat(); sradius = map.value("sradius").toFloat();
effectiveTemp = map.value("effectiveTemp").toInt(); effectiveTemp = map.value("effectiveTemp").toInt();
hasHabitableExoplanets = map.value("hasHP", false).toBool(); hasHabitableExoplanets = map.value("hasHP", false).toBool();
EPCount=0; EPCount=0;
PHEPCount=0; PHEPCount=0;
eccentricityList.clear();
semiAxisList.clear();
massList.clear();
radiusList.clear();
periodList.clear();
angleDistanceList.clear();
englishNames.clear();
translatedNames.clear();
exoplanetDesignations.clear();
if (map.contains("exoplanets")) if (map.contains("exoplanets"))
{ {
foreach(const QVariant &expl, map.value("exoplanets").toList ()) foreach(const QVariant &expl, map.value("exoplanets").toList ())
{ {
QVariantMap exoplanetMap = expl.toMap(); QVariantMap exoplanetMap = expl.toMap();
exoplanetData p; exoplanetData p;
EPCount++; EPCount++;
if (exoplanetMap.contains("planetName")) p.planetNam if (exoplanetMap.contains("planetName"))
e = exoplanetMap.value("planetName").toString(); {
p.planetName = exoplanetMap.value("planetNam
e").toString();
QString epd = QString("%1 %2").arg(designati
on, p.planetName);
exoplanetDesignations.append(epd);
}
if (exoplanetMap.contains("planetProperName"))
{
p.planetProperName = exoplanetMap.value("pla
netProperName").toString();
englishNames.append(p.planetProperName);
translatedNames.append(trans.qtranslate(p.pl
anetProperName));
}
p.period = exoplanetMap.value("period", -1.f).toFloa t(); p.period = exoplanetMap.value("period", -1.f).toFloa t();
p.mass = exoplanetMap.value("mass", -1.f).toFloat(); p.mass = exoplanetMap.value("mass", -1.f).toFloat();
p.radius = exoplanetMap.value("radius", -1.f).toFloa t(); p.radius = exoplanetMap.value("radius", -1.f).toFloa t();
p.semiAxis = exoplanetMap.value("semiAxis", -1.f).to Float(); p.semiAxis = exoplanetMap.value("semiAxis", -1.f).to Float();
p.eccentricity = exoplanetMap.value("eccentricity", -1.f).toFloat(); p.eccentricity = exoplanetMap.value("eccentricity", -1.f).toFloat();
p.inclination = exoplanetMap.value("inclination", -1 .f).toFloat(); p.inclination = exoplanetMap.value("inclination", -1 .f).toFloat();
p.angleDistance = exoplanetMap.value("angleDistance" , -1.f).toFloat(); p.angleDistance = exoplanetMap.value("angleDistance" , -1.f).toFloat();
p.discovered = exoplanetMap.value("discovered", 0).t oInt(); p.discovered = exoplanetMap.value("discovered", 0).t oInt();
p.pclass = exoplanetMap.value("pclass", "").toString (); p.pclass = exoplanetMap.value("pclass", "").toString ();
if (!p.pclass.isEmpty()) if (!p.pclass.isEmpty())
PHEPCount++; PHEPCount++;
p.EqTemp = exoplanetMap.value("EqTemp", -1).toInt(); p.EqTemp = exoplanetMap.value("EqTemp", -1).toInt();
p.ESI = exoplanetMap.value("ESI", -1).toInt(); p.ESI = exoplanetMap.value("ESI", -1).toInt();
exoplanets.append(p); exoplanets.append(p);
if (p.eccentricity>0)
eccentricityList.append(p.eccentricity);
else
eccentricityList.append(0);
if (p.semiAxis>0)
semiAxisList.append(p.semiAxis);
else
semiAxisList.append(0);
if (p.mass>0)
massList.append(p.mass);
else
massList.append(0);
if (p.radius>0)
radiusList.append(p.radius);
else
radiusList.append(0);
if (p.angleDistance>0)
angleDistanceList.append(p.angleDistance);
else
angleDistanceList.append(0);
if (p.period>0)
periodList.append(p.period);
else
periodList.append(0);
} }
} }
initialized = true; initialized = true;
} }
Exoplanet::~Exoplanet() Exoplanet::~Exoplanet()
{ {
// //
} }
QVariantMap Exoplanet::getMap(void) QVariantMap Exoplanet::getMap(void)
{ {
QVariantMap map; QVariantMap map;
map["designation"] = designation; map["designation"] = designation;
if (!starProperName.isEmpty()) map["starProperName"] = starProperNam e;
map["RA"] = RA; map["RA"] = RA;
map["DE"] = DE; map["DE"] = DE;
map["distance"] = distance; map["distance"] = distance;
map["stype"] = stype; map["stype"] = stype;
map["smass"] = smass; map["smass"] = smass;
map["smetal"] = smetal; map["smetal"] = smetal;
map["Vmag"] = Vmag; map["Vmag"] = Vmag;
map["sradius"] = sradius; map["sradius"] = sradius;
map["effectiveTemp"] = effectiveTemp; map["effectiveTemp"] = effectiveTemp;
map["hasHP"] = hasHabitableExoplanets; map["hasHP"] = hasHabitableExoplanets;
QVariantList exoplanetList; QVariantList exoplanetList;
foreach(const exoplanetData &p, exoplanets) foreach(const exoplanetData &p, exoplanets)
{ {
QVariantMap explMap; QVariantMap explMap;
explMap["planetName"] = p.planetName; explMap["planetName"] = p.planetName;
if (!p.planetProperName.isEmpty()) explMap["planetProperName "] = p.planetProperName;
if (p.mass > -1.f) explMap["mass"] = p.mass; if (p.mass > -1.f) explMap["mass"] = p.mass;
if (p.period > -1.f) explMap["period"] = p.period; if (p.period > -1.f) explMap["period"] = p.period;
if (p.radius > -1.f) explMap["radius"] = p.radius; if (p.radius > -1.f) explMap["radius"] = p.radius;
if (p.semiAxis > -1.f) explMap["semiAxis"] = p.semiAxis; if (p.semiAxis > -1.f) explMap["semiAxis"] = p.semiAxis;
if (p.inclination > -1.f) explMap["inclination"] = p.inclina tion; if (p.inclination > -1.f) explMap["inclination"] = p.inclina tion;
if (p.eccentricity > -1.f) explMap["eccentricity"] = p.eccen tricity; if (p.eccentricity > -1.f) explMap["eccentricity"] = p.eccen tricity;
if (p.angleDistance > -1.f) explMap["angleDistance"] = p.ang leDistance; if (p.angleDistance > -1.f) explMap["angleDistance"] = p.ang leDistance;
if (p.discovered > 0) explMap["discovered"] = p.discovered; if (p.discovered > 0) explMap["discovered"] = p.discovered;
if (!p.pclass.isEmpty()) explMap["pclass"] = p.pclass; if (!p.pclass.isEmpty()) explMap["pclass"] = p.pclass;
if (p.EqTemp > 0) explMap["EqTemp"] = p.EqTemp; if (p.EqTemp > 0) explMap["EqTemp"] = p.EqTemp;
skipping to change at line 160 skipping to change at line 215
float Exoplanet::getSelectPriority(const StelCore *core) const float Exoplanet::getSelectPriority(const StelCore *core) const
{ {
return StelObject::getSelectPriority(core)-2.f; return StelObject::getSelectPriority(core)-2.f;
} }
QString Exoplanet::getNameI18n(void) const QString Exoplanet::getNameI18n(void) const
{ {
// Use SkyTranslator for translation star names // Use SkyTranslator for translation star names
const StelTranslator& trans = StelApp::getInstance().getLocaleMgr(). getSkyTranslator(); const StelTranslator& trans = StelApp::getInstance().getLocaleMgr(). getSkyTranslator();
return trans.qtranslate(designation); QString name = trans.qtranslate(designation);
if (!starProperName.isEmpty())
name = trans.qtranslate(starProperName);
return name;
}
QString Exoplanet::getEnglishName(void) const
{
QString name = designation;
if (!starProperName.isEmpty())
name = starProperName;
return name;
}
QString Exoplanet::getDesignation(void) const
{
return designation;
}
QStringList Exoplanet::getExoplanetsEnglishNames() const
{
return englishNames;
}
QStringList Exoplanet::getExoplanetsNamesI18n() const
{
return translatedNames;
}
QStringList Exoplanet::getExoplanetsDesignations() const
{
return exoplanetDesignations;
} }
QString Exoplanet::getInfoString(const StelCore* core, const InfoStringGrou p& flags) const QString Exoplanet::getInfoString(const StelCore* core, const InfoStringGrou p& flags) const
{ {
QString str; QString str;
QTextStream oss(&str); QTextStream oss(&str);
const StelTranslator& trans = StelApp::getInstance().getLocaleMgr(). getSkyTranslator();
if (flags&Name) if (flags&Name)
{ {
oss << "<h2>" << getNameI18n() << "</h2>"; QString systemName = getNameI18n();
if (!starProperName.isEmpty())
systemName.append(QString(" (%1)").arg(designation))
;
oss << "<h2>" << systemName << "</h2>";
} }
if (flags&ObjectType) if (flags&ObjectType)
{ {
oss << q_("Type: <b>%1</b>").arg(q_("planetary system")) << "<br />"; oss << q_("Type: <b>%1</b>").arg(q_("planetary system")) << "<br />";
} }
if (flags&Magnitude) if (flags&Magnitude)
{ {
if (Vmag<99 && !distributionMode) if (Vmag<99 && !distributionMode)
skipping to change at line 229 skipping to change at line 322
{ {
oss << QString("%1: %2 R<sub>%3</sub>").arg(q_("Radi us")).arg(QString::number(sradius, 'f', 5)).arg(q_("Sun")) << "<br>"; oss << QString("%1: %2 R<sub>%3</sub>").arg(q_("Radi us")).arg(QString::number(sradius, 'f', 5)).arg(q_("Sun")) << "<br>";
} }
if (effectiveTemp>0) if (effectiveTemp>0)
{ {
oss << q_("Effective temperature: %1 K").arg(effecti veTemp) << "<br>"; oss << q_("Effective temperature: %1 K").arg(effecti veTemp) << "<br>";
} }
if (exoplanets.size() > 0) if (exoplanets.size() > 0)
{ {
QString planetNameLabel = QString("<td style=\"paddi ng: 0 2px 0 0;\">%1</td>").arg(q_("Exoplanet")); QString planetNameLabel = QString("<td style=\"paddi ng: 0 2px 0 0;\">%1</td>").arg(q_("Exoplanet"));
QString planetProperNameLabel = QString("<td style=\ "padding: 0 2px 0 0;\">%1</td>").arg(q_("Name"));
QString periodLabel = QString("<td style=\"padding: 0 2px 0 0;\">%1 (%2)</td>").arg(q_("Period")).arg(q_("days")); QString periodLabel = QString("<td style=\"padding: 0 2px 0 0;\">%1 (%2)</td>").arg(q_("Period")).arg(q_("days"));
QString massLabel = QString("<td style=\"padding: 0 2px 0 0;\">%1 (M<sub>%2</sub>)</td>").arg(q_("Mass")).arg(q_("Jup")); QString massLabel = QString("<td style=\"padding: 0 2px 0 0;\">%1 (M<sub>%2</sub>)</td>").arg(q_("Mass")).arg(q_("Jup"));
QString radiusLabel = QString("<td style=\"padding: 0 2px 0 0;\">%1 (R<sub>%2</sub>)</td>").arg(q_("Radius")).arg(q_("Jup")); QString radiusLabel = QString("<td style=\"padding: 0 2px 0 0;\">%1 (R<sub>%2</sub>)</td>").arg(q_("Radius")).arg(q_("Jup"));
QString semiAxisLabel = QString("<td style=\"padding : 0 2px 0 0;\">%1 (%2)</td>").arg(q_("Semi-Major Axis")).arg(q_("AU")); QString semiAxisLabel = QString("<td style=\"padding : 0 2px 0 0;\">%1 (%2)</td>").arg(q_("Semi-Major Axis")).arg(q_("AU"));
QString eccentricityLabel = QString("<td style=\"pad ding: 0 2px 0 0;\">%1</td>").arg(q_("Eccentricity")); QString eccentricityLabel = QString("<td style=\"pad ding: 0 2px 0 0;\">%1</td>").arg(q_("Eccentricity"));
QString inclinationLabel = QString("<td style=\"padd ing: 0 2px 0 0;\">%1 (%2)</td>").arg(q_("Inclination")).arg(QChar(0x00B0)); QString inclinationLabel = QString("<td style=\"padd ing: 0 2px 0 0;\">%1 (%2)</td>").arg(q_("Inclination")).arg(QChar(0x00B0));
QString angleDistanceLabel = QString("<td style=\"pa dding: 0 2px 0 0;\">%1 (\")</td>").arg(q_("Angle Distance")); QString angleDistanceLabel = QString("<td style=\"pa dding: 0 2px 0 0;\">%1 (\")</td>").arg(q_("Angle Distance"));
QString discoveredLabel = QString("<td style=\"paddi ng: 0 2px 0 0;\">%1</td>").arg(q_("Discovered year")); QString discoveredLabel = QString("<td style=\"paddi ng: 0 2px 0 0;\">%1</td>").arg(q_("Discovered year"));
QString pClassLabel = QString("<td style=\"padding: 0 2px 0 0;\">%1</td>").arg(q_("Planetary class")); QString pClassLabel = QString("<td style=\"padding: 0 2px 0 0;\">%1</td>").arg(q_("Planetary class"));
//TRANSLATORS: Full phrase is "Equilibrium Temperatu re" //TRANSLATORS: Full phrase is "Equilibrium Temperatu re"
skipping to change at line 252 skipping to change at line 346
foreach(const exoplanetData &p, exoplanets) foreach(const exoplanetData &p, exoplanets)
{ {
if (!p.planetName.isEmpty()) if (!p.planetName.isEmpty())
{ {
planetNameLabel.append("<td style=\" padding:0 2px;\">").append(p.planetName).append("</td>"); planetNameLabel.append("<td style=\" padding:0 2px;\">").append(p.planetName).append("</td>");
} }
else else
{ {
planetNameLabel.append("<td style=\" padding:0 2px;\">&mdash;</td>"); planetNameLabel.append("<td style=\" padding:0 2px;\">&mdash;</td>");
} }
if (!p.planetProperName.isEmpty())
{
planetProperNameLabel.append("<td st
yle=\"padding:0 2px;\">").append(trans.qtranslate(p.planetProperName)).appe
nd("</td>");
}
else
{
planetProperNameLabel.append("<td st
yle=\"padding:0 2px;\">&mdash;</td>");
}
if (p.period > -1.f) if (p.period > -1.f)
{ {
periodLabel.append("<td style=\"padd ing:0 2px;\">").append(QString::number(p.period, 'f', 2)).append("</td>"); periodLabel.append("<td style=\"padd ing:0 2px;\">").append(QString::number(p.period, 'f', 2)).append("</td>");
} }
else else
{ {
periodLabel.append("<td style=\"padd ing:0 2px;\">&mdash;</td>"); periodLabel.append("<td style=\"padd ing:0 2px;\">&mdash;</td>");
} }
if (p.mass > -1.f) if (p.mass > -1.f)
{ {
skipping to change at line 343 skipping to change at line 445
{ {
ESILabel.append("<td style=\"padding :0 2px;\">").append(QString::number(p.ESI * 0.01, 'f', 2)).append("</td>"); ESILabel.append("<td style=\"padding :0 2px;\">").append(QString::number(p.ESI * 0.01, 'f', 2)).append("</td>");
} }
else else
{ {
ESILabel.append("<td style=\"padding :0 2px;\">&mdash;</td>"); ESILabel.append("<td style=\"padding :0 2px;\">&mdash;</td>");
} }
} }
oss << "<table>"; oss << "<table>";
oss << "<tr>" << planetNameLabel << "</tr>"; oss << "<tr>" << planetNameLabel << "</tr>";
oss << "<tr>" << planetProperNameLabel << "</tr>";
oss << "<tr>" << periodLabel << "</tr>"; oss << "<tr>" << periodLabel << "</tr>";
oss << "<tr>" << massLabel << "</tr>"; oss << "<tr>" << massLabel << "</tr>";
oss << "<tr>" << radiusLabel << "</tr>"; oss << "<tr>" << radiusLabel << "</tr>";
oss << "<tr>" << semiAxisLabel << "</tr>"; oss << "<tr>" << semiAxisLabel << "</tr>";
oss << "<tr>" << eccentricityLabel << "</tr>"; oss << "<tr>" << eccentricityLabel << "</tr>";
oss << "<tr>" << inclinationLabel << "</tr>"; oss << "<tr>" << inclinationLabel << "</tr>";
oss << "<tr>" << angleDistanceLabel << "</tr>"; oss << "<tr>" << angleDistanceLabel << "</tr>";
oss << "<tr>" << discoveredLabel << "</tr>"; oss << "<tr>" << discoveredLabel << "</tr>";
if (hasHabitableExoplanets) if (hasHabitableExoplanets)
{ {
 End of changes. 14 change blocks. 
18 lines changed or deleted 129 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/