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 "StelApp.hpp" #include "StelApp.hpp"
#include "StelCore.hpp" #include "StelCore.hpp"
#include "StelTexture.hpp"
#include "StelUtils.hpp" #include "StelUtils.hpp"
#include "StelTranslator.hpp" #include "StelTranslator.hpp"
#include "StelModuleMgr.hpp" #include "StelModuleMgr.hpp"
#include "StelSkyDrawer.hpp" #include "StelSkyDrawer.hpp"
#include "StelLocaleMgr.hpp" #include "StelLocaleMgr.hpp"
#include "renderer/StelRenderer.hpp" #include "StarMgr.hpp"
#include "renderer/StelTextureNew.hpp"
#include <QTextStream> #include <QTextStream>
#include <QDebug> #include <QDebug>
#include <QVariant> #include <QVariant>
#include <QVariantMap> #include <QVariantMap>
#include <QVariant> #include <QVariant>
#include <QList> #include <QList>
StelTextureSP Exoplanet::markerTexture;
bool Exoplanet::distributionMode = false;
bool Exoplanet::timelineMode = false;
bool Exoplanet::habitableMode = false;
Vec3f Exoplanet::exoplanetMarkerColor = Vec3f(0.4f,0.9f,0.5f);
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),
PHEPCount(0),
designation(""),
RA(0.),
DE(0.),
distance(0.),
stype(""),
smass(0.),
smetal(0.),
Vmag(99.),
sradius(0.),
effectiveTemp(0),
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;
designation = map.value("designation").toString(); designation = map.value("designation").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;
PHEPCount=0;
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++;
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
();
if (!p.hclass.isEmpty())
PHEPCount++;
p.MSTemp = exoplanetMap.value("MSTemp", -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 112 skipping to change at line 143
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.MSTemp > 0) explMap["MSTemp"] = p.MSTemp;
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
{ {
if (getVMagnitude(core, false)>20.f) return StelObject::getSelectPriority(core)-2.f;
{
return 20.f;
}
else
{
return getVMagnitude(core, false) - 1.f;
}
} }
QString Exoplanet::getNameI18n(void) const QString Exoplanet::getNameI18n(void) const
{ {
// Use SkyTranslator for translation star names // Use SkyTranslator for translation star names
StelTranslator trans = StelApp::getInstance().getLocaleMgr().getSkyT ranslator(); const StelTranslator& trans = StelApp::getInstance().getLocaleMgr(). getSkyTranslator();
return trans.qtranslate(designation); return trans.qtranslate(designation);
} }
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);
if (flags&Name) if (flags&Name)
{ {
oss << "<h2>" << getNameI18n() << "</h2>"; oss << "<h2>" << getNameI18n() << "</h2>";
} }
if (flags&ObjectType)
{
oss << q_("Type: <b>%1</b>").arg(q_("planetary system")) <<
"<br />";
}
if (flags&Magnitude) if (flags&Magnitude)
{ {
if (Vmag<99 && !GETSTELMODULE(Exoplanets)->getDisplayMode()) if (Vmag<99 && !distributionMode)
{ {
if (core->getSkyDrawer()->getFlagHasAtmosphere()) if (core->getSkyDrawer()->getFlagHasAtmosphere())
{ {
oss << q_("Magnitude: <b>%1</b> (extincted t oss << q_("Magnitude: <b>%1</b> (extincted t
o: <b>%2</b>)").arg(QString::number(getVMagnitude(core, false), 'f', 2), o: <b>%2</b>)").arg(QString::number(getVMagnitude(core), 'f', 2),
QString::number(getVMagnitude(core, true), 'f', 2)) << QString::number(getVMagnitudeWithExtinction(core), 'f',
"<br>"; 2)) << "<br>";
} }
else else
{ {
oss << q_("Magnitude: <b>%1</b>").arg(QStrin g::number(getVMagnitude(core, false), 'f', 2)) << "<br>"; oss << q_("Magnitude: <b>%1</b>").arg(QStrin g::number(getVMagnitude(core), 'f', 2)) << "<br>";
} }
} }
} }
// Ra/Dec etc. // Ra/Dec etc.
oss << getPositionInfoString(core, flags); oss << getPositionInfoString(core, flags);
if (flags&Extra1) if (flags&Extra && !stype.isEmpty())
{ {
oss << q_("Spectral Type: %1").arg(stype) << "<br>"; oss << q_("Spectral Type: %1").arg(stype) << "<br>";
} }
if (flags&Distance) if (flags&Distance && distance>0)
{ {
oss << q_("Distance: %1 Light Years").arg(QString::number(di stance/0.306601, 'f', 2)) << "<br>"; oss << q_("Distance: %1 Light Years").arg(QString::number(di stance/0.306601, 'f', 2)) << "<br>";
} }
if (flags&Extra1) if (flags&Extra)
{ {
if (smetal!=0) if (smetal!=0)
{ {
oss << QString("%1 [Fe/H]: %2").arg(q_("Metallicity" )).arg(smetal) << "<br>"; oss << QString("%1 [Fe/H]: %2").arg(q_("Metallicity" )).arg(smetal) << "<br>";
} }
if (smass>0) if (smass>0)
{ {
oss << QString("%1: %2 M<sub>%3</sub>").arg(q_("Mass ")).arg(QString::number(smass, 'f', 3)).arg(q_("Sun")) << "<br>"; oss << QString("%1: %2 M<sub>%3</sub>").arg(q_("Mass ")).arg(QString::number(smass, 'f', 3)).arg(q_("Sun")) << "<br>";
} }
if (sradius>0) if (sradius>0)
{ {
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 (flags&Extra1 && exoplanets.size() > 0)
{
QString planetNameLabel = QString("<td style=\"padding: 0 2p
x 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 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 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=\"padding: 0
2px 0 0;\">%1</td>").arg(q_("Eccentricity"));
QString inclinationLabel = QString("<td style=\"padding: 0 2
px 0 0;\">%1 (%2)</td>").arg(q_("Inclination")).arg(QChar(0x00B0));
QString angleDistanceLabel = QString("<td style=\"padding: 0
2px 0 0;\">%1 (\")</td>").arg(q_("Angle Distance"));
QString discoveredLabel = QString("<td style=\"padding: 0 2p
x 0 0;\">%1</td>").arg(q_("Discovered year"));
foreach(const exoplanetData &p, exoplanets)
{ {
if (!p.planetName.isEmpty()) QString planetNameLabel = QString("<td style=\"paddi
{ ng: 0 2px 0 0;\">%1</td>").arg(q_("Exoplanet"));
planetNameLabel.append("<td style=\"padding: QString periodLabel = QString("<td style=\"padding:
0 2px;\">").append(p.planetName).append("</td>"); 0 2px 0 0;\">%1 (%2)</td>").arg(q_("Period")).arg(q_("days"));
} QString massLabel = QString("<td style=\"padding: 0
else 2px 0 0;\">%1 (M<sub>%2</sub>)</td>").arg(q_("Mass")).arg(q_("Jup"));
{ QString radiusLabel = QString("<td style=\"padding:
planetNameLabel.append("<td style=\"padding: 0 2px 0 0;\">%1 (R<sub>%2</sub>)</td>").arg(q_("Radius")).arg(q_("Jup"));
0 2px;\">&mdash;</td>"); QString semiAxisLabel = QString("<td style=\"padding
} : 0 2px 0 0;\">%1 (%2)</td>").arg(q_("Semi-Major Axis")).arg(q_("AU"));
if (p.period > -1.f) QString eccentricityLabel = QString("<td style=\"pad
{ ding: 0 2px 0 0;\">%1</td>").arg(q_("Eccentricity"));
periodLabel.append("<td style=\"padding:0 2p QString inclinationLabel = QString("<td style=\"padd
x;\">").append(QString::number(p.period, 'f', 2)).append("</td>"); ing: 0 2px 0 0;\">%1 (%2)</td>").arg(q_("Inclination")).arg(QChar(0x00B0));
} QString angleDistanceLabel = QString("<td style=\"pa
else dding: 0 2px 0 0;\">%1 (\")</td>").arg(q_("Angle Distance"));
{ QString discoveredLabel = QString("<td style=\"paddi
periodLabel.append("<td style=\"padding:0 2p ng: 0 2px 0 0;\">%1</td>").arg(q_("Discovered year"));
x;\">&mdash;</td>"); QString hClassLabel = QString("<td style=\"padding:
} 0 2px 0 0;\">%1</td>").arg(q_("Habitable class"));
if (p.mass > -1.f) //TRANSLATORS: Full phrase is "Mean Surface Temperat
{ ure"
massLabel.append("<td style=\"padding:0 2px; QString meanSurfaceTempLabel = QString("<td style=\"
\">").append(QString::number(p.mass, 'f', 2)).append("</td>"); padding: 0 2px 0 0;\">%1 (%2C)</td>").arg(q_("Mean surface temp.")).arg(QCh
} ar(0x00B0));
else //TRANSLATORS: ESI = Earth Similarity Index
{ QString ESILabel = QString("<td style=\"padding: 0 2
massLabel.append("<td style=\"padding:0 2px; px 0 0;\">%1</td>").arg(q_("ESI"));
\">&mdash;</td>"); foreach(const exoplanetData &p, exoplanets)
} {
if (p.radius > -1.f) if (!p.planetName.isEmpty())
{ {
radiusLabel.append("<td style=\"padding:0 2p planetNameLabel.append("<td style=\"
x;\">").append(QString::number(p.radius, 'f', 1)).append("</td>"); padding:0 2px;\">").append(p.planetName).append("</td>");
} }
else else
{ {
radiusLabel.append("<td style=\"padding:0 2p planetNameLabel.append("<td style=\"
x;\">&mdash;</td>"); padding:0 2px;\">&mdash;</td>");
} }
if (p.eccentricity > -1.f) if (p.period > -1.f)
{ {
eccentricityLabel.append("<td style=\"paddin periodLabel.append("<td style=\"padd
g:0 2px;\">").append(QString::number(p.eccentricity, 'f', 3)).append("</td> ing:0 2px;\">").append(QString::number(p.period, 'f', 2)).append("</td>");
"); }
} else
else {
{ periodLabel.append("<td style=\"padd
eccentricityLabel.append("<td style=\"paddin ing:0 2px;\">&mdash;</td>");
g:0 2px;\">&mdash;</td>"); }
} if (p.mass > -1.f)
if (p.inclination > -1.f) {
{ massLabel.append("<td style=\"paddin
inclinationLabel.append("<td style=\"padding g:0 2px;\">").append(QString::number(p.mass, 'f', 2)).append("</td>");
:0 2px;\">").append(QString::number(p.inclination, 'f', 1)).append("</td>") }
; else
} {
else massLabel.append("<td style=\"paddin
{ g:0 2px;\">&mdash;</td>");
inclinationLabel.append("<td style=\"padding }
:0 2px;\">&mdash;</td>"); if (p.radius > -1.f)
} {
if (p.semiAxis > -1.f) radiusLabel.append("<td style=\"padd
{ ing:0 2px;\">").append(QString::number(p.radius, 'f', 1)).append("</td>");
semiAxisLabel.append("<td style=\"padding:0 }
2px;\">").append(QString::number(p.semiAxis, 'f', 4)).append("</td>"); else
} {
else radiusLabel.append("<td style=\"padd
{ ing:0 2px;\">&mdash;</td>");
semiAxisLabel.append("<td style=\"padding:0 }
2px;\">&mdash;</td>"); if (p.eccentricity > -1.f)
} {
if (p.angleDistance > -1.f) eccentricityLabel.append("<td style=
{ \"padding:0 2px;\">").append(QString::number(p.eccentricity, 'f', 3)).appen
angleDistanceLabel.append("<td style=\"paddi d("</td>");
ng:0 2px;\">").append(QString::number(p.angleDistance, 'f', 6)).append("</t }
d>"); else
} {
else eccentricityLabel.append("<td style=
{ \"padding:0 2px;\">&mdash;</td>");
angleDistanceLabel.append("<td style=\"paddi }
ng:0 2px;\">&mdash;</td>"); if (p.inclination > -1.f)
} {
if (p.discovered > 0) inclinationLabel.append("<td style=\
{ "padding:0 2px;\">").append(QString::number(p.inclination, 'f', 1)).append(
discoveredLabel.append("<td style=\"padding: "</td>");
0 2px;\">").append(QString::number(p.discovered)).append("</td>"); }
} else
else {
{ inclinationLabel.append("<td style=\
discoveredLabel.append("<td style=\"padding: "padding:0 2px;\">&mdash;</td>");
0 2px;\">&mdash;</td>"); }
if (p.semiAxis > -1.f)
{
semiAxisLabel.append("<td style=\"pa
dding:0 2px;\">").append(QString::number(p.semiAxis, 'f', 4)).append("</td>
");
}
else
{
semiAxisLabel.append("<td style=\"pa
dding:0 2px;\">&mdash;</td>");
}
if (p.angleDistance > -1.f)
{
angleDistanceLabel.append("<td style
=\"padding:0 2px;\">").append(QString::number(p.angleDistance, 'f', 6)).app
end("</td>");
}
else
{
angleDistanceLabel.append("<td style
=\"padding:0 2px;\">&mdash;</td>");
}
if (p.discovered > 0)
{
discoveredLabel.append("<td style=\"
padding:0 2px;\">").append(QString::number(p.discovered)).append("</td>");
}
else
{
discoveredLabel.append("<td style=\"
padding:0 2px;\">&mdash;</td>");
}
if (!p.hclass.isEmpty())
{
hClassLabel.append("<td style=\"padd
ing:0 2px;\">").append(p.hclass).append("</td>");
}
else
{
hClassLabel.append("<td style=\"padd
ing:0 2px;\">&mdash;</td>");
}
if (p.MSTemp > 0)
{
meanSurfaceTempLabel.append("<td sty
le=\"padding:0 2px;\">").append(QString::number(p.MSTemp - 273.15, 'f', 2))
.append("</td>");
}
else
{
meanSurfaceTempLabel.append("<td sty
le=\"padding:0 2px;\">&mdash;</td>");
}
if (p.ESI > 0)
{
ESILabel.append("<td style=\"padding
:0 2px;\">").append(QString::number(p.ESI * 0.01, 'f', 2)).append("</td>");
}
else
{
ESILabel.append("<td style=\"padding
:0 2px;\">&mdash;</td>");
}
}
oss << "<table>";
oss << "<tr>" << planetNameLabel << "</tr>";
oss << "<tr>" << periodLabel << "</tr>";
oss << "<tr>" << massLabel << "</tr>";
oss << "<tr>" << radiusLabel << "</tr>";
oss << "<tr>" << semiAxisLabel << "</tr>";
oss << "<tr>" << eccentricityLabel << "</tr>";
oss << "<tr>" << inclinationLabel << "</tr>";
oss << "<tr>" << angleDistanceLabel << "</tr>";
oss << "<tr>" << discoveredLabel << "</tr>";
if (hasHabitableExoplanets)
{
oss << "<tr>" << hClassLabel << "</tr>";
oss << "<tr>" << meanSurfaceTempLabel << "</
tr>";
oss << "<tr>" << ESILabel << "</tr>";
} }
oss << "</table>";
} }
oss << "<table>";
oss << "<tr>" << planetNameLabel << "</tr>";
oss << "<tr>" << periodLabel << "</tr>";
oss << "<tr>" << massLabel << "</tr>";
oss << "<tr>" << radiusLabel << "</tr>";
oss << "<tr>" << semiAxisLabel << "</tr>";
oss << "<tr>" << eccentricityLabel << "</tr>";
oss << "<tr>" << inclinationLabel << "</tr>";
oss << "<tr>" << angleDistanceLabel << "</tr>";
oss << "<tr>" << discoveredLabel << "</tr>";
oss << "</table>";
} }
postProcessInfoString(str, flags); postProcessInfoString(str, flags);
return str; return str;
} }
Vec3f Exoplanet::getInfoColor(void) const Vec3f Exoplanet::getInfoColor(void) const
{ {
return StelApp::getInstance().getVisionModeNight() ? Vec3f(0.6, 0.0, 0.0) : Vec3f(1.0, 1.0, 1.0); return Vec3f(1.0, 1.0, 1.0);
} }
float Exoplanet::getVMagnitude(const StelCore* core, bool withExtinction) c onst float Exoplanet::getVMagnitude(const StelCore* core) const
{ {
float extinctionMag=0.0; // track magnitude loss Q_UNUSED(core);
if (withExtinction && core->getSkyDrawer()->getFlagHasAtmosphere()) if (distributionMode)
{
Vec3d altAz=getAltAzPosApparent(core);
altAz.normalize();
core->getSkyDrawer()->getExtinction().forward(&altAz[2], &extinc
tionMag);
}
if (GETSTELMODULE(Exoplanets)->getDisplayMode())
{ {
return 4.f; return 4.f;
} }
else else
{ {
if (Vmag<99) if (Vmag<99)
{ {
return Vmag + extinctionMag; return Vmag;
} }
else else
{ {
return 6.f + extinctionMag; return 6.f;
} }
} }
} }
double Exoplanet::getAngularSize(const StelCore*) const double Exoplanet::getAngularSize(const StelCore*) const
{ {
return 0.0001; return 0.0001;
} }
bool Exoplanet::isDiscovered(const StelCore *core) bool Exoplanet::isDiscovered(const StelCore *core)
skipping to change at line 369 skipping to change at line 427
} }
} }
return false; return false;
} }
void Exoplanet::update(double deltaTime) void Exoplanet::update(double deltaTime)
{ {
labelsFader.update((int)(deltaTime*1000)); labelsFader.update((int)(deltaTime*1000));
} }
void Exoplanet::draw(StelCore* core, StelRenderer* renderer, StelProjectorP void Exoplanet::draw(StelCore* core, StelPainter *painter)
projector,
StelTextureNew* markerTexture)
{ {
bool visible; bool visible;
StelSkyDrawer* sd = core->getSkyDrawer(); StelSkyDrawer* sd = core->getSkyDrawer();
StarMgr* smgr = GETSTELMODULE(StarMgr); // It's need for checking di splaying of labels for stars
Vec3f color = Vec3f(0.4f,1.2f,0.5f); Vec3f color = exoplanetMarkerColor;
if (StelApp::getInstance().getVisionModeNight()) if (hasHabitableExoplanets)
color = StelUtils::getNightColor(color); color = habitableExoplanetMarkerColor;
const double mag = getVMagnitude(core, true);
StelUtils::spheToRect(RA, DE, XYZ); StelUtils::spheToRect(RA, DE, XYZ);
renderer->setBlendMode(BlendMode_Add); double mag = getVMagnitudeWithExtinction(core);
renderer->setGlobalColor(color[0], color[1], color[2]);
if (GETSTELMODULE(Exoplanets)->getTimelineMode()) glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE);
painter->setColor(color[0], color[1], color[2], 1);
if (timelineMode)
{ {
visible = isDiscovered(core); visible = isDiscovered(core);
} }
else else
{ {
visible = true; visible = true;
} }
if(!visible) {return;} if (habitableMode)
{
if (!hasHabitableExoplanets)
return;
}
Vec3d win;
// Check visibility of exoplanet system
if(!visible || !(painter->getProjector()->projectCheck(XYZ, win))) {
return;}
if (mag <= sd->getLimitMagnitude()) float mlimit = sd->getLimitMagnitude();
if (mag <= mlimit)
{ {
markerTexture->bind(); Exoplanet::markerTexture->bind();
const float size = getAngularSize(NULL)*M_PI/180.*projector- float size = getAngularSize(NULL)*M_PI/180.*painter->getProj
>getPixelPerRadAtCenter(); ector()->getPixelPerRadAtCenter();
const float shift = 5.f + size/1.6f; float shift = 5.f + size/1.6f;
if (labelsFader.getInterstate()<=0.f)
{ painter->drawSprite2dMode(XYZ, distributionMode ? 4.f : 5.f)
Vec3d win; ;
if(!projector->project(XYZ, win)){return;}
if (GETSTELMODULE(Exoplanets)->getDisplayMode()) if (labelsFader.getInterstate()<=0.f && !distributionMode &&
{ (mag+1.f)<mlimit && smgr->getFlagLabels())
renderer->drawTexturedRect(win[0] - 4, win[1 {
] - 4, 8, 8); painter->drawText(XYZ, designation, 0, shift, shift,
} false);
else
{
renderer->drawTexturedRect(win[0] - 5, win[1
] - 5, 10, 10);
renderer->drawText(TextParams(XYZ, projector
, getNameI18n()).shift(shift, shift).useGravity());
}
} }
} }
} }
 End of changes. 38 change blocks. 
196 lines changed or deleted 274 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/