MinorPlanet.cpp   MinorPlanet.cpp 
skipping to change at line 26 skipping to change at line 26
* 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 "MinorPlanet.hpp" #include "MinorPlanet.hpp"
#include "StelApp.hpp" #include "StelApp.hpp"
#include "StelCore.hpp" #include "StelCore.hpp"
#include "StelTexture.hpp"
#include "StelTextureMgr.hpp"
#include "StelTranslator.hpp" #include "StelTranslator.hpp"
#include "StelUtils.hpp" #include "StelUtils.hpp"
#include <QRegExp> #include <QRegExp>
#include <QDebug> #include <QDebug>
MinorPlanet::MinorPlanet(const QString& englishName, MinorPlanet::MinorPlanet(const QString& englishName,
int flagLighting, int flagLighting,
double radius, double radius,
double oblateness, double oblateness,
Vec3f color, Vec3f color,
float albedo, float albedo,
const QString& atexMapName, const QString& atexMapName,
posFuncType coordFunc, posFuncType coordFunc,
void* auserDataPtr, void* auserDataPtr,
OsculatingFunctType *oscula tingFunc, OsculatingFunctType *oscula tingFunc,
bool acloseOrbit, bool acloseOrbit,
bool hidden) bool hidden,
const QString& pType)
: Planet (englishName, : Planet (englishName,
flagLighti ng, flagLighti ng,
radius, radius,
oblateness , oblateness ,
color, color,
albedo, albedo,
atexMapNam e, atexMapNam e,
coordFunc, coordFunc,
auserDataP tr, auserDataP tr,
osculating Func, osculating Func,
acloseOrbi t, acloseOrbi t,
hidden, hidden,
false) //N false, //N
o atmosphere o atmosphere
pType)
{ {
texMapName = atexMapName; texMapName = atexMapName;
lastOrbitJD =0; lastOrbitJD =0;
deltaJD = StelCore::JD_SECOND; deltaJD = StelCore::JD_SECOND;
orbitCached = 0; orbitCached = 0;
closeOrbit = acloseOrbit; closeOrbit = acloseOrbit;
eclipticPos=Vec3d(0.,0.,0.); eclipticPos=Vec3d(0.,0.,0.);
rotLocalToParent = Mat4d::identity(); rotLocalToParent = Mat4d::identity();
texMap = StelApp::getInstance().getTextureManager().createTextureThr ead("textures/"+texMapName, StelTexture::StelTextureParams(true, GL_LINEAR, GL_REPEAT));
//MinorPlanet specific members //MinorPlanet specific members
minorPlanetNumber = 0; minorPlanetNumber = 0;
absoluteMagnitude = 0; absoluteMagnitude = 0;
slopeParameter = -1;//== uninitialized: used in getVMagnitude() slopeParameter = -1;//== uninitialized: used in getVMagnitude()
//TODO: Fix the name //TODO: Fix the name
// - Detect numeric prefix and set number if any // - Detect numeric prefix and set number if any
// - detect provisional designation // - detect provisional designation
// - create the HTML name // - create the HTML name
skipping to change at line 197 skipping to change at line 196
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 (!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&Extra1)
{
if (pType.length()>0)
oss << q_("Type: <b>%1</b>").arg(q_(pType)) << "<br
/>";
}
if (flags&Magnitude) if (flags&Magnitude)
{ {
if (core->getSkyDrawer()->getFlagHasAtmosphere()) if (core->getSkyDrawer()->getFlagHasAtmosphere())
oss << q_("Magnitude: <b>%1</b> (extincted to: <b>%2</b>)"). arg(QString::number(getVMagnitude(core, false), 'f', 2), 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>"; QString::number(getVMagnitude(core, true), 'f', 2)) << "<br>";
else else
oss << q_("Magnitude: <b>%1</b>").arg(getVMagnitude(core, fa lse), 0, 'f', 2) << "<br>"; oss << q_("Magnitude: <b>%1</b>").arg(getVMagnitude(core, fa lse), 0, 'f', 2) << "<br>";
} }
skipping to change at line 246 skipping to change at line 251
// xgettext:no-c-format // xgettext:no-c-format
oss << q_("Distance: %1AU").arg(distanceAu, 0, 'f', 8); oss << q_("Distance: %1AU").arg(distanceAu, 0, 'f', 8);
} }
oss << "<br>"; oss << "<br>";
} }
if (flags&Size) if (flags&Size)
oss << q_("Apparent diameter: %1").arg(StelUtils::radToDmsSt r(2.*getAngularSize(core)*M_PI/180., true)) << "<br>"; oss << q_("Apparent diameter: %1").arg(StelUtils::radToDmsSt r(2.*getAngularSize(core)*M_PI/180., true)) << "<br>";
// If semi-major axis not zero then calculate and display orbital pe riod for asteroid in days // If semi-major axis not zero then calculate and display orbital pe riod for asteroid in days
if ((flags&Extra1) && (semiMajorAxis>0)) double siderealPeriod = getSiderealPeriod();
oss << q_("Orbital period: %1 days").arg(QString::number(Ste if ((flags&Extra1) && (siderealPeriod>0))
lUtils::calculateOrbitalPeriod(semiMajorAxis), 'f', 0)) << "<br>"; {
// TRANSLATORS: Sidereal (orbital) period for solar system b
odies in days and in Julian years (symbol: a)
oss << q_("Sidereal period: %1 days (%2 a)").arg(QString::nu
mber(siderealPeriod, 'f', 2)).arg(QString::number(siderealPeriod/365.25, 'f
', 3)) << "<br>";
}
//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;
} }
double MinorPlanet::getSiderealPeriod() const
{
double period;
if (semiMajorAxis>0)
period = StelUtils::calculateSiderealPeriod(semiMajorAxis);
else
period = 0;
return period;
}
float MinorPlanet::getVMagnitude(const StelCore* core, bool withExtinction) const float MinorPlanet::getVMagnitude(const StelCore* core, bool withExtinction) const
{ {
float extinctionMag=0.0; // track magnitude loss float extinctionMag=0.0; // track magnitude loss
if (withExtinction) if (withExtinction)
{ {
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);
} }
 End of changes. 7 change blocks. 
9 lines changed or deleted 32 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/