Quasar.cpp   Quasar.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 "Quasar.hpp" #include "Quasar.hpp"
#include "Quasars.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"
#include "StelSkyDrawer.hpp" #include "StelSkyDrawer.hpp"
#include <QTextStream> #include <QTextStream>
#include <QDebug> #include <QDebug>
#include <QVariant> #include <QVariant>
#include <QtOpenGL> #include <QtOpenGL>
#include <QVariantMap> #include <QVariantMap>
#include <QVariant> #include <QVariant>
#include <QList> #include <QList>
StelTextureSP Quasar::markerTexture;
Quasar::Quasar(const QVariantMap& map) Quasar::Quasar(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();
VMagnitude = map.value("Vmag").toFloat(); VMagnitude = map.value("Vmag").toFloat();
AMagnitude = map.value("Amag").toFloat(); AMagnitude = map.value("Amag").toFloat();
skipping to change at line 96 skipping to change at line 99
if (flags&Name) if (flags&Name)
{ {
oss << "<h2>" << designation << "</h2>"; oss << "<h2>" << designation << "</h2>";
} }
if (flags&Extra1) if (flags&Extra1)
oss << q_("Type: <b>%1</b>").arg(q_("quasar")) << "<br />"; oss << q_("Type: <b>%1</b>").arg(q_("quasar")) << "<br />";
if (flags&Magnitude) if (flags&Magnitude)
{ {
if (core->getSkyDrawer()->getFlagHasAtmosphere()) if (core->getSkyDrawer()->getFlagHasAtmosphere())
{ {
if (bV!=0) if (bV!=0)
{ {
oss << q_("Magnitude: <b>%1</b> (extincted to: <b>% oss << q_("Magnitude: <b>%1</b> (extincted t
2</b>. B-V: <b>%3</b>)").arg(QString::number(mag, 'f', 2), o: <b>%2</b>. B-V: <b>%3</b>)").arg(QString::number(mag, 'f', 2),
QString::number(getVMagnitude(core, true), 'f QString::number(getVMagnitude(core, tru
', 2), e), 'f', 2),
QString::number(bV, 'f', 2)) << "<br />"; QString::number(bV, 'f', 2)) << "<br />
";
}
else
{
oss << q_("Magnitude: <b>%1</b> (extincted t
o: <b>%2</b>)").arg(QString::number(mag, 'f', 2),
QString::number(getVMagnitude(core, true), 'f', 2)) <<
"<br />";
}
} }
else else
{ {
oss << q_("Magnitude: <b>%1</b> (extincted to: <b>% if (bV!=0)
2</b>)").arg(QString::number(mag, 'f', 2), {
oss << q_("Magnitude: <b>%1</b> (B-V: <b>%2<
QString::number(getVMagnitude(core, true), 'f', 2)) << "<br /> /b>)").arg(mag, 0, 'f', 2).arg(bV, 0, 'f', 2) << "<br />";
"; }
else
{
oss << q_("Magnitude: <b>%1</b>").arg(mag, 0
, 'f', 2) << "<br />";
}
} }
} if (AMagnitude!=0)
else
{
if (bV!=0)
{
oss << q_("Magnitude: <b>%1</b> (B-V: <b>%2</b>)").a
rg(mag, 0, 'f', 2).arg(bV, 0, 'f', 2) << "<br />";
}
else
{
oss << q_("Magnitude: <b>%1</b>").arg(mag, 0, 'f', 2
) << "<br />";
}
}
if (AMagnitude!=0)
{ {
oss << q_("Absolute Magnitude: %1").arg(AMagnitude, 0, 'f', 2) << "<br />"; oss << q_("Absolute Magnitude: %1").arg(AMagnitude, 0, 'f', 2) << "<br />";
} }
} }
// Ra/Dec etc. // Ra/Dec etc.
oss << getPositionInfoString(core, flags); oss << getPositionInfoString(core, flags);
if (flags&Extra1) if (flags&Extra1)
{ {
skipping to change at line 149 skipping to change at line 152
return str; return str;
} }
Vec3f Quasar::getInfoColor(void) const Vec3f Quasar::getInfoColor(void) const
{ {
return StelApp::getInstance().getVisionModeNight() ? Vec3f(0.6, 0.0, 0.0) : Vec3f(1.0, 1.0, 1.0); return StelApp::getInstance().getVisionModeNight() ? Vec3f(0.6, 0.0, 0.0) : Vec3f(1.0, 1.0, 1.0);
} }
float Quasar::getVMagnitude(const StelCore* core, bool withExtinction) cons t float Quasar::getVMagnitude(const StelCore* core, bool withExtinction) cons t
{ {
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], &extinctio core->getSkyDrawer()->getExtinction().forward(&altAz[2], &ex
nMag); tinctionMag);
} }
return VMagnitude + extinctionMag; return VMagnitude + extinctionMag;
} }
double Quasar::getAngularSize(const StelCore*) const double Quasar::getAngularSize(const StelCore*) const
{ {
return 0.00001; return 0.00001;
} }
void Quasar::update(double deltaTime) void Quasar::update(double deltaTime)
{ {
labelsFader.update((int)(deltaTime*1000)); labelsFader.update((int)(deltaTime*1000));
} }
void Quasar::draw(StelCore* core, StelPainter& painter) void Quasar::draw(StelCore* core, StelPainter& painter)
{ {
StelSkyDrawer* sd = core->getSkyDrawer(); StelSkyDrawer* sd = core->getSkyDrawer();
Vec3f color = sd->indexToColor(BvToColorIndex(bV))*0.75f; Vec3f color = sd->indexToColor(BvToColorIndex(bV))*0.75f;
Vec3f dcolor = Vec3f(1.2f,0.5f,0.4f);
if (StelApp::getInstance().getVisionModeNight())
dcolor = StelUtils::getNightColor(dcolor);
float rcMag[2], size, shift; float rcMag[2], size, shift;
double mag; double mag;
StelUtils::spheToRect(qRA, qDE, XYZ); StelUtils::spheToRect(qRA, qDE, XYZ);
mag = getVMagnitude(core, true); mag = getVMagnitude(core, true);
sd->preDrawPointSource(&painter);
if (mag <= sd->getLimitMagnitude()) if (GETSTELMODULE(Quasars)->getDisplayMode())
{ {
sd->computeRCMag(mag, rcMag); glEnable(GL_BLEND);
//sd->drawPointSource(&painter, Vec3f(XYZ[0], XYZ[1], XYZ[2] glBlendFunc(GL_ONE, GL_ONE);
), rcMag, sd->indexToColor(BvToColorIndex(bV)), false); painter.setColor(dcolor[0], dcolor[1], dcolor[2], 1);
sd->drawPointSource(&painter, XYZ, rcMag, sd->indexToColor(B
vToColorIndex(bV)), false); Quasar::markerTexture->bind();
painter.setColor(color[0], color[1], color[2], 1);
size = getAngularSize(NULL)*M_PI/180.*painter.getProjector() ->getPixelPerRadAtCenter(); size = getAngularSize(NULL)*M_PI/180.*painter.getProjector() ->getPixelPerRadAtCenter();
shift = 6.f + size/1.8f; shift = 5.f + size/1.6f;
if (labelsFader.getInterstate()<=0.f) if (labelsFader.getInterstate()<=0.f)
{ {
painter.drawText(XYZ, designation, 0, shift, shift, painter.drawSprite2dMode(XYZ, 4);
false); painter.drawText(XYZ, " ", 0, shift, shift, false);
} }
} }
else
{
sd->preDrawPointSource(&painter);
sd->postDrawPointSource(&painter); if (mag <= sd->getLimitMagnitude())
{
sd->computeRCMag(mag, rcMag);
//sd->drawPointSource(&painter, Vec3f(XYZ[0], XYZ[1]
, XYZ[2]), rcMag, sd->indexToColor(BvToColorIndex(bV)), false);
sd->drawPointSource(&painter, XYZ, rcMag, sd->indexT
oColor(BvToColorIndex(bV)), false);
painter.setColor(color[0], color[1], color[2], 1);
size = getAngularSize(NULL)*M_PI/180.*painter.getPro
jector()->getPixelPerRadAtCenter();
shift = 6.f + size/1.8f;
if (labelsFader.getInterstate()<=0.f)
{
painter.drawText(XYZ, designation, 0, shift,
shift, false);
}
}
sd->postDrawPointSource(&painter);
}
} }
unsigned char Quasar::BvToColorIndex(float b_v) unsigned char Quasar::BvToColorIndex(float b_v)
{ {
double dBV = b_v; double dBV = b_v;
dBV *= 1000.0; dBV *= 1000.0;
if (dBV < -500) if (dBV < -500)
{ {
dBV = -500; dBV = -500;
} }
 End of changes. 15 change blocks. 
52 lines changed or deleted 80 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/