Exoplanet.cpp   Exoplanet.cpp 
skipping to change at line 19 skipping to change at line 19
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*/ */
#include "config.h"
#include "Exoplanet.hpp" #include "Exoplanet.hpp"
#include "Exoplanets.hpp" #include "Exoplanets.hpp"
#include "StelObject.hpp" #include "StelObject.hpp"
#include "StelPainter.hpp" #include "StelPainter.hpp"
#include "StelApp.hpp" #include "StelApp.hpp"
#include "StelCore.hpp" #include "StelCore.hpp"
#include "StelTexture.hpp" #include "StelTexture.hpp"
#include "StelUtils.hpp" #include "StelUtils.hpp"
#include "StelTranslator.hpp" #include "StelTranslator.hpp"
#include "StelModuleMgr.hpp" #include "StelModuleMgr.hpp"
skipping to change at line 99 skipping to change at line 97
EPCount++; EPCount++;
if (exoplanetMap.contains("planetName")) p.planetNam e = exoplanetMap.value("planetName").toString(); if (exoplanetMap.contains("planetName")) p.planetNam e = exoplanetMap.value("planetName").toString();
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.hclass = exoplanetMap.value("hclass", "").toString p.pclass = exoplanetMap.value("pclass", "").toString
(); ();
if (!p.hclass.isEmpty()) if (!p.pclass.isEmpty())
PHEPCount++; PHEPCount++;
p.MSTemp = exoplanetMap.value("MSTemp", -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);
} }
} }
initialized = true; initialized = true;
} }
Exoplanet::~Exoplanet() Exoplanet::~Exoplanet()
{ {
skipping to change at line 143 skipping to change at line 141
QVariantMap explMap; QVariantMap explMap;
explMap["planetName"] = p.planetName; explMap["planetName"] = p.planetName;
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.hclass.isEmpty()) explMap["hclass"] = p.hclass; if (!p.pclass.isEmpty()) explMap["pclass"] = p.pclass;
if (p.MSTemp > 0) explMap["MSTemp"] = p.MSTemp; if (p.EqTemp > 0) explMap["EqTemp"] = p.EqTemp;
if (p.ESI > 0) explMap["ESI"] = p.ESI; if (p.ESI > 0) explMap["ESI"] = p.ESI;
exoplanetList << explMap; exoplanetList << explMap;
} }
map["exoplanets"] = exoplanetList; map["exoplanets"] = exoplanetList;
return map; return map;
} }
float Exoplanet::getSelectPriority(const StelCore *core) const float Exoplanet::getSelectPriority(const StelCore *core) const
{ {
skipping to change at line 239 skipping to change at line 237
{ {
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 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 hClassLabel = QString("<td style=\"padding: QString pClassLabel = QString("<td style=\"padding:
0 2px 0 0;\">%1</td>").arg(q_("Habitable class")); 0 2px 0 0;\">%1</td>").arg(q_("Planetary class"));
//TRANSLATORS: Full phrase is "Mean Surface Temperat //TRANSLATORS: Full phrase is "Equilibrium Temperatu
ure" re"
QString meanSurfaceTempLabel = QString("<td style=\" QString equilibriumTempLabel = QString("<td style=\"
padding: 0 2px 0 0;\">%1 (%2C)</td>").arg(q_("Mean surface temp.")).arg(QCh padding: 0 2px 0 0;\">%1 (%2C)</td>").arg(q_("Equilibrium temp.")).arg(QCha
ar(0x00B0)); r(0x00B0));
//TRANSLATORS: ESI = Earth Similarity Index //TRANSLATORS: ESI = Earth Similarity Index
QString ESILabel = QString("<td style=\"padding: 0 2 px 0 0;\">%1</td>").arg(q_("ESI")); QString ESILabel = QString("<td style=\"padding: 0 2 px 0 0;\">%1</td>").arg(q_("ESI"));
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
{ {
skipping to change at line 318 skipping to change at line 316
angleDistanceLabel.append("<td style =\"padding:0 2px;\">&mdash;</td>"); angleDistanceLabel.append("<td style =\"padding:0 2px;\">&mdash;</td>");
} }
if (p.discovered > 0) if (p.discovered > 0)
{ {
discoveredLabel.append("<td style=\" padding:0 2px;\">").append(QString::number(p.discovered)).append("</td>"); discoveredLabel.append("<td style=\" padding:0 2px;\">").append(QString::number(p.discovered)).append("</td>");
} }
else else
{ {
discoveredLabel.append("<td style=\" padding:0 2px;\">&mdash;</td>"); discoveredLabel.append("<td style=\" padding:0 2px;\">&mdash;</td>");
} }
if (!p.hclass.isEmpty()) if (!p.pclass.isEmpty())
{ {
hClassLabel.append("<td style=\"padd ing:0 2px;\">").append(p.hclass).append("</td>"); pClassLabel.append("<td style=\"padd ing:0 2px;\">").append(getPlanetaryClassI18n(p.pclass)).append("</td>");
} }
else else
{ {
hClassLabel.append("<td style=\"padd ing:0 2px;\">&mdash;</td>"); pClassLabel.append("<td style=\"padd ing:0 2px;\">&mdash;</td>");
} }
if (p.MSTemp > 0) if (p.EqTemp > 0)
{ {
meanSurfaceTempLabel.append("<td sty le=\"padding:0 2px;\">").append(QString::number(p.MSTemp - 273.15, 'f', 2)) .append("</td>"); equilibriumTempLabel.append("<td sty le=\"padding:0 2px;\">").append(QString::number(p.EqTemp - 273.15, 'f', 2)) .append("</td>");
} }
else else
{ {
meanSurfaceTempLabel.append("<td sty le=\"padding:0 2px;\">&mdash;</td>"); equilibriumTempLabel.append("<td sty le=\"padding:0 2px;\">&mdash;</td>");
} }
if (p.ESI > 0) if (p.ESI > 0)
{ {
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>");
} }
} }
skipping to change at line 355 skipping to change at line 353
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)
{ {
oss << "<tr>" << hClassLabel << "</tr>"; oss << "<tr>" << pClassLabel << "</tr>";
oss << "<tr>" << meanSurfaceTempLabel << "</ oss << "<tr>" << equilibriumTempLabel << "</
tr>"; tr>";
oss << "<tr>" << ESILabel << "</tr>"; oss << "<tr>" << ESILabel << "</tr>";
} }
oss << "</table>"; oss << "</table>";
} }
} }
postProcessInfoString(str, flags); postProcessInfoString(str, flags);
return str; return str;
} }
QString Exoplanet::getPlanetaryClassI18n(QString ptype) const
{
QString result = "";
QRegExp dataRx("^(\\w)-(\\w+)\\s(\\w+)$");
if (dataRx.exactMatch(ptype))
{
QString spectral = dataRx.capturedTexts().at(1).trimmed();
QString zone = dataRx.capturedTexts().at(2).trimmed();
QString size = dataRx.capturedTexts().at(3).trimmed();
result = QString("%1-%2 %3")
.arg(spectral)
.arg(q_(zone))
.arg(q_(size));
}
return result;
}
Vec3f Exoplanet::getInfoColor(void) const Vec3f Exoplanet::getInfoColor(void) const
{ {
return Vec3f(1.0, 1.0, 1.0); return Vec3f(1.0, 1.0, 1.0);
} }
float Exoplanet::getVMagnitude(const StelCore* core) const float Exoplanet::getVMagnitude(const StelCore* core) const
{ {
Q_UNUSED(core); Q_UNUSED(core);
if (distributionMode) if (distributionMode)
{ {
skipping to change at line 476 skipping to change at line 492
if (mag <= mlimit) if (mag <= mlimit)
{ {
Exoplanet::markerTexture->bind(); Exoplanet::markerTexture->bind();
float size = getAngularSize(NULL)*M_PI/180.*painter->getProj ector()->getPixelPerRadAtCenter(); float size = getAngularSize(NULL)*M_PI/180.*painter->getProj ector()->getPixelPerRadAtCenter();
float shift = 5.f + size/1.6f; float shift = 5.f + size/1.6f;
painter->drawSprite2dMode(XYZ, distributionMode ? 4.f : 5.f) ; painter->drawSprite2dMode(XYZ, distributionMode ? 4.f : 5.f) ;
if (labelsFader.getInterstate()<=0.f && !distributionMode && (mag+1.f)<mlimit && smgr->getFlagLabels()) if (labelsFader.getInterstate()<=0.f && !distributionMode && (mag+1.f)<mlimit && smgr->getFlagLabels())
{ {
painter->drawText(XYZ, designation, 0, shift, shift, false); painter->drawText(XYZ, getNameI18n(), 0, shift, shif t, false);
} }
} }
} }
 End of changes. 14 change blocks. 
25 lines changed or deleted 41 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/