Comet.cpp   Comet.cpp 
skipping to change at line 17 skipping to change at line 17
* 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 "Comet.hpp" #include "Comet.hpp"
#include "StelApp.hpp" #include "StelApp.hpp"
#include "StelCore.hpp" #include "StelCore.hpp"
#include "StelTexture.hpp" #include "StelTexture.hpp"
#include "StelTextureMgr.hpp" #include "StelTextureMgr.hpp"
#include "StelTranslator.hpp" #include "StelTranslator.hpp"
skipping to change at line 118 skipping to change at line 118
oss << "<h2>"; oss << "<h2>";
oss << q_(englishName); // UI translation can differ from s ky translation oss << q_(englishName); // UI translation can differ from s ky translation
oss.setRealNumberNotation(QTextStream::FixedNotation); oss.setRealNumberNotation(QTextStream::FixedNotation);
oss.setRealNumberPrecision(1); oss.setRealNumberPrecision(1);
if (sphereScale != 1.f) if (sphereScale != 1.f)
oss << QString::fromUtf8(" (\xC3\x97") << sphereScal e << ")"; oss << QString::fromUtf8(" (\xC3\x97") << sphereScal e << ")";
oss << "</h2>"; oss << "</h2>";
} }
if (flags&Magnitude) if (flags&Magnitude)
oss << q_("Magnitude: <b>%1</b>").arg(getVMagnitude(core), 0 {
, 'f', 2) << "<br>"; 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(getVMagnitude(core, fa
lse), 0, 'f', 2) << "<br>";
}
if (flags&AbsoluteMagnitude) if (flags&AbsoluteMagnitude)
{ {
//TODO: Make sure absolute magnitude is a sane value //TODO: Make sure absolute magnitude is a sane value
//If the two parameter magnitude system is not use, don't di splay this //If the two parameter magnitude system is not use, don't di splay this
//value. (Using radius/albedo doesn't make any sense for com ets.) //value. (Using radius/albedo doesn't make any sense for com ets.)
if (slopeParameter >= 0) if (slopeParameter >= 0)
oss << q_("Absolute Magnitude: %1").arg(absoluteMagn itude, 0, 'f', 2) << "<br>"; oss << q_("Absolute Magnitude: %1").arg(absoluteMagn itude, 0, 'f', 2) << "<br>";
} }
oss << getPositionInfoString(core, flags); oss << getPositionInfoString(core, flags);
if (flags&Distance) if (flags&Distance)
{ {
// xgettext:no-c-format double distanceAu = getJ2000EquatorialPos(core).length();
oss << q_("Distance: %1AU").arg(getJ2000EquatorialPos(core). if (distanceAu < 0.1)
length(), 0, 'f', 8) << "<br>"; {
double distanceKm = AU * distanceAu;
// xgettext:no-c-format
oss << QString(q_("Distance: %1AU (%2 km)"))
.arg(distanceAu, 0, 'f', 8)
.arg(distanceKm, 0, 'f', 0);
}
else
{
// xgettext:no-c-format
oss << q_("Distance: %1AU").arg(distanceAu, 0, 'f',
8);
}
oss << "<br>";
} }
/* /*
if (flags&Size) if (flags&Size)
oss << q_("Apparent diameter: %1").arg(StelUtils::radToDmsSt r(2.*getAngularSize(core)*M_PI/180., true)); oss << q_("Apparent diameter: %1").arg(StelUtils::radToDmsSt r(2.*getAngularSize(core)*M_PI/180., true));
*/ */
postProcessInfoString(str, flags); postProcessInfoString(str, flags);
return str; return str;
} }
float Comet::getVMagnitude(const StelCore* core) const float Comet::getVMagnitude(const StelCore* core, bool withExtinction) const
{ {
//If the two parameter system is not used, //If the two parameter system is not used,
//use the default radius/albedo mechanism //use the default radius/albedo mechanism
if (slopeParameter < 0) if (slopeParameter < 0)
{ {
return Planet::getVMagnitude(core); return Planet::getVMagnitude(core, withExtinction);
}
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);
} }
//Calculate distances //Calculate distances
const Vec3d& observerHeliocentricPosition = core->getObserverHelioce ntricEclipticPos(); const Vec3d& observerHeliocentricPosition = core->getObserverHelioce ntricEclipticPos();
const Vec3d& cometHeliocentricPosition = getHeliocentricEclipticPos( ); const Vec3d& cometHeliocentricPosition = getHeliocentricEclipticPos( );
const double cometSunDistance = std::sqrt(cometHeliocentricPosition. lengthSquared()); const double cometSunDistance = std::sqrt(cometHeliocentricPosition. lengthSquared());
const double observerCometDistance = std::sqrt((observerHeliocentric Position - cometHeliocentricPosition).lengthSquared()); const double observerCometDistance = std::sqrt((observerHeliocentric Position - cometHeliocentricPosition).lengthSquared());
//Calculate apparent magnitude //Calculate apparent magnitude
//Sources: http://www.clearskyinstitute.com/xephem/help/xephem.html# mozTocId564354 //Sources: http://www.clearskyinstitute.com/xephem/help/xephem.html# mozTocId564354
//(XEphem manual, section 7.1.2.3 "Magnitude models"), also //(XEphem manual, section 7.1.2.3 "Magnitude models"), also
//http://www.ayton.id.au/gary/Science/Astronomy/Ast_comets.htm#Comet %20facts: //http://www.ayton.id.au/gary/Science/Astronomy/Ast_comets.htm#Comet %20facts:
double apparentMagnitude = absoluteMagnitude + 5 * std::log10(observ erCometDistance) + 2.5 * slopeParameter * std::log10(cometSunDistance); double apparentMagnitude = absoluteMagnitude + 5 * std::log10(observ erCometDistance) + 2.5 * slopeParameter * std::log10(cometSunDistance);
return apparentMagnitude; return apparentMagnitude + extinctionMag;
} }
 End of changes. 6 change blocks. 
9 lines changed or deleted 39 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/