MinorPlanet.cpp   MinorPlanet.cpp 
skipping to change at line 18 skipping to change at line 18
* 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 "MinorPlanet.hpp" #include "MinorPlanet.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 193 skipping to change at line 193
oss << QString::fromUtf8(" (\xC3\x97") << sphereScal e << ")"; oss << QString::fromUtf8(" (\xC3\x97") << sphereScal e << ")";
oss << "</h2>"; oss << "</h2>";
if (!nameIsProvisionalDesignation && !provisionalDesignation Html.isEmpty()) if (!nameIsProvisionalDesignation && !provisionalDesignation Html.isEmpty())
{ {
oss << QString(q_("Provisional designation: %1")).ar g(provisionalDesignationHtml); oss << QString(q_("Provisional designation: %1")).ar g(provisionalDesignationHtml);
oss << "<br>"; oss << "<br>";
} }
} }
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 H-G system is not used, use the default radius/albe do mechanism //If the H-G system is not used, use the default radius/albe do mechanism
if (slopeParameter < 0) if (slopeParameter < 0)
{ {
oss << q_("Absolute Magnitude: %1").arg(getVMagnitud e(core) - 5. * (std::log10(getJ2000EquatorialPos(core).length()*AU/PARSEC)- 1.), 0, 'f', 2) << "<br>"; oss << q_("Absolute Magnitude: %1").arg(getVMagnitud e(core, false) - 5. * (std::log10(getJ2000EquatorialPos(core).length()*AU/P ARSEC)-1.), 0, 'f', 2) << "<br>";
} }
else else
{ {
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));
//This doesn't work, even if setOpenExternalLinks(true) is used in I nfoPanel //This doesn't work, even if setOpenExternalLinks(true) is used in I nfoPanel
/* /*
if (flags&Extra1) if (flags&Extra1)
oss << QString("<br><a href=\"http://ssd.jpl.nasa.gov/sbdb.c gi?sstr=%1\">JPL Small-Body Database Browser</a>").arg( (minorPlanetNumber) ? QString::number(minorPlanetNumber) : englishName ); oss << QString("<br><a href=\"http://ssd.jpl.nasa.gov/sbdb.c gi?sstr=%1\">JPL Small-Body Database Browser</a>").arg( (minorPlanetNumber) ? QString::number(minorPlanetNumber) : englishName );
*/ */
postProcessInfoString(str, flags); postProcessInfoString(str, flags);
return str; return str;
} }
float MinorPlanet::getVMagnitude(const StelCore* core) const float MinorPlanet::getVMagnitude(const StelCore* core, bool withExtinction) const
{ {
float extinctionMag=0.0; // track magnitude loss
if (withExtinction)
{
Vec3d altAz=getAltAzPosApparent(core);
altAz.normalize();
core->getSkyDrawer()->getExtinction().forward(&altAz[2], &extinc
tionMag);
}
//If the H-G system is not used, use the default radius/albedo mecha nism //If the H-G system is not used, use the default radius/albedo mecha nism
if (slopeParameter < 0) if (slopeParameter < 0)
{ {
return Planet::getVMagnitude(core); return Planet::getVMagnitude(core, withExtinction);
} }
//Calculate phase angle //Calculate phase angle
//(Code copied from Planet::getVMagnitude()) //(Code copied from Planet::getVMagnitude())
//(LOL, this is actually vector substraction + the cosine theorem :) ) //(LOL, this is actually vector subtraction + the cosine theorem :))
const Vec3d& observerHelioPos = core->getObserverHeliocentricEclipti cPos(); const Vec3d& observerHelioPos = core->getObserverHeliocentricEclipti cPos();
const double observerRq = observerHelioPos.lengthSquared(); const double observerRq = observerHelioPos.lengthSquared();
const Vec3d& planetHelioPos = getHeliocentricEclipticPos(); const Vec3d& planetHelioPos = getHeliocentricEclipticPos();
const double planetRq = planetHelioPos.lengthSquared(); const double planetRq = planetHelioPos.lengthSquared();
const double observerPlanetRq = (observerHelioPos - planetHelioPos). lengthSquared(); const double observerPlanetRq = (observerHelioPos - planetHelioPos). lengthSquared();
const double cos_chi = (observerPlanetRq + planetRq - observerRq)/(2 .0*sqrt(observerPlanetRq*planetRq)); const double cos_chi = (observerPlanetRq + planetRq - observerRq)/(2 .0*sqrt(observerPlanetRq*planetRq));
double phaseAngle = std::acos(cos_chi); double phaseAngle = std::acos(cos_chi);
//Calculate reduced magnitude (magnitude without the influence of di stance) //Calculate reduced magnitude (magnitude without the influence of di stance)
//Source of the formulae: http://www.britastro.org/asteroids/dymock4 .pdf //Source of the formulae: http://www.britastro.org/asteroids/dymock4 .pdf
const double phi1 = std::exp(-3.33 * std::pow(std::tan(phaseAngle/2) , 0.63)); const double phi1 = std::exp(-3.33 * std::pow(std::tan(phaseAngle/2) , 0.63));
const double phi2 = std::exp(-1.87 * std::pow(std::tan(phaseAngle/2) , 1.22)); const double phi2 = std::exp(-1.87 * std::pow(std::tan(phaseAngle/2) , 1.22));
double reducedMagnitude = absoluteMagnitude - 2.5 * std::log10( (1 - slopeParameter) * phi1 + slopeParameter * phi2 ); double reducedMagnitude = absoluteMagnitude - 2.5 * std::log10( (1 - slopeParameter) * phi1 + slopeParameter * phi2 );
//Calculate apparent magnitude //Calculate apparent magnitude
//TODO: See if you can "collapse" some calculations //TODO: See if you can "collapse" some calculations
double apparentMagnitude = reducedMagnitude + 5 * std::log10(std::sq rt(planetRq * observerPlanetRq)); double apparentMagnitude = reducedMagnitude + 5 * std::log10(std::sq rt(planetRq * observerPlanetRq));
return apparentMagnitude; return apparentMagnitude+extinctionMag;
} }
void MinorPlanet::translateName(StelTranslator &translator) void MinorPlanet::translateName(StelTranslator &translator)
{ {
nameI18 = translator.qtranslate(properName); nameI18 = translator.qtranslate(properName);
if (englishName.endsWith('*')) if (englishName.endsWith('*'))
{ {
nameI18.append('*'); nameI18.append('*');
} }
} }
 End of changes. 9 change blocks. 
11 lines changed or deleted 42 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/