Supernova.cpp   Supernova.cpp 
skipping to change at line 16 skipping to change at line 16
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, U SA. * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*/ */
#include "Supernova.hpp" #include "Supernova.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"
skipping to change at line 80 skipping to change at line 80
map["snde"] = snde; map["snde"] = snde;
map["note"] = note; map["note"] = note;
map["distance"] = distance; map["distance"] = distance;
return map; return map;
} }
float Supernova::getSelectPriority(const StelCore* core) const float Supernova::getSelectPriority(const StelCore* core) const
{ {
//Same as StarWrapper::getSelectPriority() //Same as StarWrapper::getSelectPriority()
return getVMagnitude(core); return getVMagnitude(core, false);
} }
QString Supernova::getInfoString(const StelCore* core, const InfoStringGrou p& flags) const QString Supernova::getInfoString(const StelCore* core, const InfoStringGrou p& flags) const
{ {
QString str; QString str;
QTextStream oss(&str); QTextStream oss(&str);
double mag = getVMagnitude(core); double mag = getVMagnitude(core, false);
if (flags&Name) if (flags&Name)
{ {
oss << "<h2>" << designation; oss << "<h2>" << designation;
if (note.size()!=0) if (note.size()!=0)
oss << " (" << q_(note) << ")"; oss << " (" << q_(note) << ")";
oss << "</h2>"; oss << "</h2>";
} }
if (flags&Extra1)
oss << q_("Type: <b>%1</b>").arg(q_("supernova")) << "<br />
";
if (flags&Magnitude && mag <= core->getSkyDrawer()->getLimitMagnitud e()) if (flags&Magnitude && mag <= core->getSkyDrawer()->getLimitMagnitud e())
{
if (core->getSkyDrawer()->getFlagHasAtmosphere())
oss << q_("Magnitude: <b>%1</b> (extincted to: <b>%2</b>)").
arg(QString::number(getVMagnitude(core, false), 'f', 2),
QString::number(getVMagnitude(core, true), 'f', 2)) << "<br>";
else
oss << q_("Magnitude: <b>%1</b>").arg(mag, 0, 'f', 2) << "<b r>"; oss << q_("Magnitude: <b>%1</b>").arg(mag, 0, 'f', 2) << "<b r>";
}
// Ra/Dec etc. // Ra/Dec etc.
oss << getPositionInfoString(core, flags); oss << getPositionInfoString(core, flags);
if (flags&Extra1) if (flags&Extra1)
{ {
oss << q_("Type: %1").arg(sntype) << "<br>"; oss << q_("Type of supernova: %1").arg(sntype) << "<br>";
if (distance>0) if (distance>0)
oss << q_("Distance: %1 Light Years").arg(distance*1 000) << "<br>"; oss << q_("Distance: %1 Light Years").arg(distance*1 000) << "<br>";
} }
postProcessInfoString(str, flags); postProcessInfoString(str, flags);
return str; return str;
} }
Vec3f Supernova::getInfoColor(void) const Vec3f Supernova::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 Supernova::getVMagnitude(const StelCore* core) const float Supernova::getVMagnitude(const StelCore* core, bool withExtinction) c onst
{ {
float extinctionMag=0.0; // track magnitude loss
if (withExtinction && core->getSkyDrawer()->getFlagHasAtmosphere())
{
Vec3d altAz=getAltAzPosApparent(core);
altAz.normalize();
core->getSkyDrawer()->getExtinction().forward(&altAz[2], &extinc
tionMag);
}
double vmag = 20; double vmag = 20;
double currentJD = core->getJDay(); double currentJD = core->getJDay();
double deltaJD = std::abs(peakJD-currentJD); double deltaJD = std::abs(peakJD-currentJD);
// Use supernova light curve model from here - http://www.astronet.r u/db/msg/1188703 // Use supernova light curve model from here - http://www.astronet.r u/db/msg/1188703
if (sntype.contains("II", Qt::CaseSensitive)) if (sntype.contains("II", Qt::CaseSensitive))
{ {
// Type II // Type II
if (peakJD<=currentJD) if (peakJD<=currentJD)
skipping to change at line 175 skipping to change at line 192
{ {
if (deltaJD<=15) if (deltaJD<=15)
vmag = maxMagnitude + 1.13 * deltaJD; vmag = maxMagnitude + 1.13 * deltaJD;
} }
} }
if (vmag<maxMagnitude) if (vmag<maxMagnitude)
vmag = maxMagnitude; vmag = maxMagnitude;
return vmag; return vmag + extinctionMag;
} }
double Supernova::getAngularSize(const StelCore*) const double Supernova::getAngularSize(const StelCore*) const
{ {
return 0.00001; return 0.00001;
} }
void Supernova::update(double deltaTime) void Supernova::update(double deltaTime)
{ {
labelsFader.update((int)(deltaTime*1000)); labelsFader.update((int)(deltaTime*1000));
skipping to change at line 197 skipping to change at line 214
void Supernova::draw(StelCore* core, StelPainter& painter) void Supernova::draw(StelCore* core, StelPainter& painter)
{ {
StelSkyDrawer* sd = core->getSkyDrawer(); StelSkyDrawer* sd = core->getSkyDrawer();
Vec3f color = Vec3f(1.f,1.f,1.f); Vec3f color = Vec3f(1.f,1.f,1.f);
float rcMag[2], size, shift; float rcMag[2], size, shift;
double mag; double mag;
StelUtils::spheToRect(snra, snde, XYZ); StelUtils::spheToRect(snra, snde, XYZ);
mag = getVMagnitude(core); mag = getVMagnitude(core, true);
if (mag <= sd->getLimitMagnitude()) if (mag <= sd->getLimitMagnitude())
{ {
sd->computeRCMag(mag, rcMag); sd->computeRCMag(mag, rcMag);
sd->drawPointSource(&painter, Vec3f(XYZ[0], XYZ[1], XYZ[2]), rcMag, color, false); sd->drawPointSource(&painter, Vec3f(XYZ[0], XYZ[1], XYZ[2]), rcMag, color, false);
painter.setColor(color[0], color[1], color[2], 1); 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 = 6.f + size/1.8f;
if (labelsFader.getInterstate()<=0.f) if (labelsFader.getInterstate()<=0.f)
{ {
 End of changes. 11 change blocks. 
7 lines changed or deleted 28 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/