Exoplanet.cpp   Exoplanet.cpp 
skipping to change at line 20 skipping to change at line 20
* 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 "Exoplanet.hpp" #include "Exoplanet.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 "renderer/StelRenderer.hpp"
#include "renderer/StelTextureNew.hpp"
#include <QTextStream> #include <QTextStream>
#include <QDebug> #include <QDebug>
#include <QVariant> #include <QVariant>
#include <QtOpenGL>
#include <QVariantMap> #include <QVariantMap>
#include <QVariant> #include <QVariant>
#include <QList> #include <QList>
StelTextureSP Exoplanet::markerTexture;
Exoplanet::Exoplanet(const QVariantMap& map) Exoplanet::Exoplanet(const QVariantMap& map)
: initialized(false) : initialized(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());
skipping to change at line 338 skipping to change at line 336
float Exoplanet::getVMagnitude(const StelCore* core, bool withExtinction) c onst float Exoplanet::getVMagnitude(const StelCore* core, bool withExtinction) c onst
{ {
float extinctionMag=0.0; // track magnitude loss float extinctionMag=0.0; // track magnitude loss
if (withExtinction && core->getSkyDrawer()->getFlagHasAtmosphere()) if (withExtinction && core->getSkyDrawer()->getFlagHasAtmosphere())
{ {
Vec3d altAz=getAltAzPosApparent(core); Vec3d altAz=getAltAzPosApparent(core);
altAz.normalize(); altAz.normalize();
core->getSkyDrawer()->getExtinction().forward(&altAz[2], &extinc tionMag); core->getSkyDrawer()->getExtinction().forward(&altAz[2], &extinc tionMag);
} }
if (Vmag<99) if (GETSTELMODULE(Exoplanets)->getDisplayMode())
{ {
return Vmag + extinctionMag; return 4.f;
} }
else else
{ {
return 6.f + extinctionMag; if (Vmag<99)
{
return Vmag + extinctionMag;
}
else
{
return 6.f + extinctionMag;
}
} }
} }
double Exoplanet::getAngularSize(const StelCore*) const double Exoplanet::getAngularSize(const StelCore*) const
{ {
return 0.0001; return 0.0001;
} }
bool Exoplanet::isDiscovered(const StelCore *core)
{
int year, month, day;
QList<int> discovery;
// For getting value of new year from midnight at 1 Jan we need incr
ease a value of JD on 0.5.
// This hack need for correct display of discovery mode of exoplanet
s.
StelUtils::getDateFromJulianDay(core->getJDay()+0.5, &year, &month,
&day);
discovery.clear();
foreach(const exoplanetData &p, exoplanets)
{
if (p.discovered>0)
{
discovery.append(p.discovered);
}
}
qSort(discovery.begin(),discovery.end());
if (discovery.at(0)<=year && discovery.at(0)>0)
{
return true;
}
else
{
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, StelPainter& painter) void Exoplanet::draw(StelCore* core, StelRenderer* renderer, StelProjectorP
projector,
StelTextureNew* markerTexture)
{ {
bool visible;
StelSkyDrawer* sd = core->getSkyDrawer(); StelSkyDrawer* sd = core->getSkyDrawer();
Vec3f color = Vec3f(0.4f,1.2f,0.5f); Vec3f color = Vec3f(0.4f,1.2f,0.5f);
if (StelApp::getInstance().getVisionModeNight()) if (StelApp::getInstance().getVisionModeNight())
color = StelUtils::getNightColor(color); color = StelUtils::getNightColor(color);
const double mag = getVMagnitude(core, true);
double mag = getVMagnitude(core, true);
StelUtils::spheToRect(RA, DE, XYZ); StelUtils::spheToRect(RA, DE, XYZ);
glEnable(GL_BLEND); renderer->setBlendMode(BlendMode_Add);
glBlendFunc(GL_ONE, GL_ONE); renderer->setGlobalColor(color[0], color[1], color[2]);
painter.setColor(color[0], color[1], color[2], 1);
if (mag <= sd->getLimitMagnitude()) if (GETSTELMODULE(Exoplanets)->getTimelineMode())
{ {
visible = isDiscovered(core);
}
else
{
visible = true;
}
Exoplanet::markerTexture->bind(); if(!visible) {return;}
float size = getAngularSize(NULL)*M_PI/180.*painter.getProje
ctor()->getPixelPerRadAtCenter(); if (mag <= sd->getLimitMagnitude())
float shift = 5.f + size/1.6f; {
markerTexture->bind();
const float size = getAngularSize(NULL)*M_PI/180.*projector-
>getPixelPerRadAtCenter();
const float shift = 5.f + size/1.6f;
if (labelsFader.getInterstate()<=0.f) if (labelsFader.getInterstate()<=0.f)
{ {
painter.drawSprite2dMode(XYZ, 5); Vec3d win;
painter.drawText(XYZ, designation, 0, shift, shift, if(!projector->project(XYZ, win)){return;}
false); if (GETSTELMODULE(Exoplanets)->getDisplayMode())
{
renderer->drawTexturedRect(win[0] - 4, win[1
] - 4, 8, 8);
}
else
{
renderer->drawTexturedRect(win[0] - 5, win[1
] - 5, 10, 10);
renderer->drawText(TextParams(XYZ, projector
, designation).shift(shift, shift).useGravity());
}
} }
} }
} }
 End of changes. 18 change blocks. 
22 lines changed or deleted 78 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/