Comet.cpp   Comet.cpp 
skipping to change at line 25 skipping to change at line 25
* 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 "Comet.hpp" #include "Comet.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>
Comet::Comet(const QString& englishName, Comet::Comet(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));
//Comet specific members //Comet specific members
absoluteMagnitude = 0; absoluteMagnitude = 0;
slopeParameter = -1;//== uninitialized: used in getVMagnitude() slopeParameter = -1;//== uninitialized: used in getVMagnitude()
//TODO: Name processing? //TODO: Name processing?
nameI18 = englishName; nameI18 = englishName;
flagLabels = true; flagLabels = true;
skipping to change at line 117 skipping to change at line 116
{ {
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&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>";
} }
if (flags&AbsoluteMagnitude) if (flags&AbsoluteMagnitude)
skipping to change at line 161 skipping to change at line 166
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)); oss << q_("Apparent diameter: %1").arg(StelUtils::radToDmsSt r(2.*getAngularSize(core)*M_PI/180., true));
*/ */
// If semi-major axis not zero then calculate and display orbital pe
riod for comet in days
double siderealPeriod = getSiderealPeriod();
if ((flags&Extra1) && (siderealPeriod>0))
{
// 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>";
}
postProcessInfoString(str, flags); postProcessInfoString(str, flags);
return str; return str;
} }
void Comet::setSemiMajorAxis(double value)
{
semiMajorAxis = value;
}
double Comet::getSiderealPeriod() const
{
double period;
if (semiMajorAxis>0)
period = StelUtils::calculateSiderealPeriod(semiMajorAxis);
else
period = 0;
return period;
}
float Comet::getVMagnitude(const StelCore* core, bool withExtinction) 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, withExtinction); return Planet::getVMagnitude(core, withExtinction);
} }
float extinctionMag=0.0; // track magnitude loss float extinctionMag=0.0; // track magnitude loss
 End of changes. 7 change blocks. 
6 lines changed or deleted 40 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/