MinorPlanet.cpp   MinorPlanet.cpp 
skipping to change at line 75 skipping to change at line 75
osculatingFunc, osculatingFunc,
acloseOrbit, acloseOrbit,
hidden, hidden,
false, //No atmosphere false, //No atmosphere
true, //Halo true, //Halo
pTypeStr), pTypeStr),
minorPlanetNumber(0), minorPlanetNumber(0),
slopeParameter(-1.0f), //== mark as uninitialized: used in getVMagni tude() slopeParameter(-1.0f), //== mark as uninitialized: used in getVMagni tude()
semiMajorAxis(0.), semiMajorAxis(0.),
nameIsProvisionalDesignation(false), nameIsProvisionalDesignation(false),
properName(englishName) properName(englishName),
b_v(99.f),
specT(""),
specB("")
{ {
//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
//Try to detect number //Try to detect number
//TODO: Move this to the minor planet parse code in the plug-in? //TODO: Move this to the minor planet parse code in the plug-in?
/* /*
QString name = englishName; QString name = englishName;
QRegExp bracketedNumberPrefixPattern("^\\((\\d+)\\)\\s"); QRegExp bracketedNumberPrefixPattern("^\\((\\d+)\\)\\s");
skipping to change at line 137 skipping to change at line 140
//Do nothing for the moment //Do nothing for the moment
} }
void MinorPlanet::setSemiMajorAxis(double value) void MinorPlanet::setSemiMajorAxis(double value)
{ {
semiMajorAxis = value; semiMajorAxis = value;
// GZ: in case we have very many asteroids, this helps improving spe ed usually without sacrificing accuracy: // GZ: in case we have very many asteroids, this helps improving spe ed usually without sacrificing accuracy:
deltaJDE = 2.0*qMax(semiMajorAxis, 0.1)*StelCore::JD_SECOND; deltaJDE = 2.0*qMax(semiMajorAxis, 0.1)*StelCore::JD_SECOND;
} }
void MinorPlanet::setSpectralType(QString sT, QString sB)
{
specT = sT;
specB = sB;
}
void MinorPlanet::setColorIndexBV(float bv)
{
b_v = bv;
}
void MinorPlanet::setMinorPlanetNumber(int number) void MinorPlanet::setMinorPlanetNumber(int number)
{ {
if (minorPlanetNumber) if (minorPlanetNumber)
return; return;
minorPlanetNumber = number; minorPlanetNumber = number;
} }
void MinorPlanet::setAbsoluteMagnitudeAndSlope(const float magnitude, const float slope) void MinorPlanet::setAbsoluteMagnitudeAndSlope(const float magnitude, const float slope)
{ {
skipping to change at line 166 skipping to change at line 180
absoluteMagnitude = magnitude; absoluteMagnitude = magnitude;
slopeParameter = slope; slopeParameter = slope;
} }
void MinorPlanet::setProvisionalDesignation(QString designation) void MinorPlanet::setProvisionalDesignation(QString designation)
{ {
//TODO: This feature has to be implemented better, anyway. //TODO: This feature has to be implemented better, anyway.
provisionalDesignationHtml = renderProvisionalDesignationinHtml(desi gnation); provisionalDesignationHtml = renderProvisionalDesignationinHtml(desi gnation);
} }
QString MinorPlanet::getEnglishName() const
{
QString r = englishName;
if (minorPlanetNumber)
r = QString("(%1) %2").arg(minorPlanetNumber).arg(englishNam
e);
return r;
}
QString MinorPlanet::getNameI18n() const
{
QString r = nameI18;
if (minorPlanetNumber)
r = QString("(%1) %2").arg(minorPlanetNumber).arg(nameI18);
return r;
}
QString MinorPlanet::getInfoString(const StelCore *core, const InfoStringGr oup &flags) const QString MinorPlanet::getInfoString(const StelCore *core, const InfoStringGr oup &flags) const
{ {
//Mostly copied from Planet::getInfoString(): //Mostly copied from Planet::getInfoString():
QString str; QString str;
QTextStream oss(&str); QTextStream oss(&str);
double az_app, alt_app; double az_app, alt_app;
StelUtils::rectToSphe(&az_app,&alt_app,getAltAzPosApparent(core)); StelUtils::rectToSphe(&az_app,&alt_app,getAltAzPosApparent(core));
bool withDecimalDegree = StelApp::getInstance().getFlagShowDecimalDe grees(); bool withDecimalDegree = StelApp::getInstance().getFlagShowDecimalDe grees();
double distanceAu = getJ2000EquatorialPos(core).length(); double distanceAu = getJ2000EquatorialPos(core).length();
Q_UNUSED(az_app); Q_UNUSED(az_app);
if (flags&Name) if (flags&Name)
{ {
oss << "<h2>"; oss << "<h2>";
if (minorPlanetNumber)
oss << QString("(%1) ").arg(minorPlanetNumber);
if (nameIsProvisionalDesignation) if (nameIsProvisionalDesignation)
{
if (minorPlanetNumber)
oss << QString("(%1) ").arg(minorPlanetNumbe
r);
oss << provisionalDesignationHtml; oss << provisionalDesignationHtml;
}
else else
oss << getNameI18n(); // UI translation can differ from sky translation oss << getNameI18n(); // UI translation can differ from sky 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 (!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&ObjectType && getPlanetType()!=isUNDEFINED) if (flags&ObjectType && getPlanetType()!=isUNDEFINED)
{ {
oss << q_("Type: <b>%1</b>").arg(q_(getPlanetTypeString())) << "<br />"; oss << QString("%1: <b>%2</b>").arg(q_("Type"), q_(getPlanet TypeString())) << "<br />";
} }
if (flags&Magnitude) if (flags&Magnitude)
{ {
if (core->getSkyDrawer()->getFlagHasAtmosphere() && (alt_app>-3. QString emag = "";
0*M_PI/180.0)) // Don't show extincted magnitude much below horizon where m if (core->getSkyDrawer()->getFlagHasAtmosphere() && (alt_app
odel is meaningless. >-3.0*M_PI/180.0)) // Don't show extincted magnitude much below horizon whe
oss << q_("Magnitude: <b>%1</b> (after extinction: <b>%2</b> re model is meaningless.
)").arg(QString::number(getVMagnitude(core), 'f', 2), emag = QString(" (%1: <b>%2</b>)").arg(q_("extincted
to"), QString::number(getVMagnitudeWithExtinction(core), 'f', 2));
QString::number(getVMagnitudeWithExtinction(core), 'f', 2)) << "<br>";
else
oss << q_("Magnitude: <b>%1</b>").arg(getVMagnitude(core), 0
, 'f', 2) << "<br>";
oss << QString("%1: <b>%2</b>%3").arg(q_("Magnitude"), QStri ng::number(getVMagnitude(core), 'f', 2), emag) << "<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(distanceAu*AU/PARSEC)-1.), 0, 'f', 2) << "<br>"; oss << QString("%1: %2").arg(q_("Absolute Magnitude" )).arg(getVMagnitude(core) - 5. * (std::log10(distanceAu*AU/PARSEC)-1.), 0, 'f', 2) << "<br>";
} }
else else
{ {
oss << q_("Absolute Magnitude: %1").arg(absoluteMagn itude, 0, 'f', 2) << "<br>"; oss << QString("%1: %2").arg(q_("Absolute Magnitude" )).arg(absoluteMagnitude, 0, 'f', 2) << "<br>";
} }
} }
oss << getPositionInfoString(core, flags); if (flags&Extra && b_v<99.f)
oss << QString("%1: <b>%2</b>").arg(q_("Color Index (B-V)"),
QString::number(b_v, 'f', 2)) << "<br />";
oss << getCommonInfoString(core, flags);
if (flags&Distance) if (flags&Distance)
{ {
double hdistanceAu = getHeliocentricEclipticPos().length(); double hdistanceAu = getHeliocentricEclipticPos().length();
double hdistanceKm = AU * hdistanceAu; double hdistanceKm = AU * hdistanceAu;
if (englishName!="Sun") // TRANSLATORS: Unit of measure for distance - astronomical
unit
QString au = qc_("AU", "distance, astronomical unit");
// TRANSLATORS: Unit of measure for distance - kilometers
QString km = qc_("km", "distance");
QString distAU, distKM;
if (hdistanceAu < 0.1)
{ {
if (hdistanceAu < 0.1) distAU = QString::number(hdistanceAu, 'f', 6);
{ distKM = QString::number(hdistanceKm, 'f', 3);
// xgettext:no-c-format
oss << QString(q_("Distance from Sun: %1AU (
%2 km)"))
.arg(hdistanceAu, 0, 'f', 6)
.arg(hdistanceKm, 0, 'f', 3);
}
else
{
// xgettext:no-c-format
oss << QString(q_("Distance from Sun: %1AU (
%2 Mio km)"))
.arg(hdistanceAu, 0, 'f', 3)
.arg(hdistanceKm / 1.0e6, 0, 'f', 3);
}
oss << "<br>";
} }
else
{
distAU = QString::number(hdistanceAu, 'f', 3);
distKM = QString::number(hdistanceKm / 1.0e6, 'f', 3
);
// TRANSLATORS: Unit of measure for distance - milli
ones kilometers
km = qc_("Mio km", "distance");
}
oss << QString("%1: %2%3 (%4 %5)").arg(q_("Distance from Sun
"), distAU, au, distKM, km) << "<br />";
double distanceAu = getJ2000EquatorialPos(core).length();
double distanceKm = AU * distanceAu; double distanceKm = AU * distanceAu;
if (distanceAu < 0.1) if (distanceAu < 0.1)
{ {
// xgettext:no-c-format distAU = QString::number(distanceAu, 'f', 6);
oss << QString(q_("Distance: %1AU (%2 km)")) distKM = QString::number(distanceKm, 'f', 3);
.arg(distanceAu, 0, 'f', 6) }
.arg(distanceKm, 0, 'f', 3);
}
else else
{ {
// xgettext:no-c-format distAU = QString::number(distanceAu, 'f', 3);
oss << QString(q_("Distance: %1AU (%2 Mio km)")) distKM = QString::number(distanceKm / 1.0e6, 'f', 3)
.arg(distanceAu, 0, 'f', 3) ;
.arg(distanceKm / 1.0e6, 0, 'f', 3); // TRANSLATORS: Unit of measure for distance - milli
ones kilometers
km = qc_("Mio km", "distance");
} }
oss << "<br>"; oss << QString("%1: %2%3 (%4 %5)").arg(q_("Distance"), distA U, au, distKM, km) << "<br />";
} }
float aSize = 2.*getAngularSize(core)*M_PI/180.; double angularSize = 2.*getAngularSize(core)*M_PI/180.;
if (flags&Size && aSize>1e-6) if (flags&Size && angularSize>=4.8e-7)
{ {
if (withDecimalDegree) QString sizeStr = "";
oss << q_("Apparent diameter: %1").arg(StelUtils::ra if (sphereScale!=1.f) // We must give correct diameters even
dToDecDegStr(aSize,5,false,true)) << "<br>"; if upscaling (e.g. Moon)
{
QString sizeOrig, sizeScaled;
if (withDecimalDegree)
{
sizeOrig = StelUtils::radToDecDegStr(angul
arSize / sphereScale,5,false,true);
sizeScaled = StelUtils::radToDecDegStr(angul
arSize,5,false,true);
}
else
{
sizeOrig = StelUtils::radToDmsStr(angularS
ize / sphereScale, true);
sizeScaled = StelUtils::radToDmsStr(angularS
ize, true);
}
sizeStr = QString("%1, %2: %3").arg(sizeOrig, q_("sc
aled up to"), sizeScaled);
}
else else
oss << q_("Apparent diameter: %1").arg(StelUtils::ra {
dToDmsStr(aSize, true)) << "<br>"; if (withDecimalDegree)
sizeStr = StelUtils::radToDecDegStr(angularS
ize,5,false,true);
else
sizeStr = StelUtils::radToDmsStr(angularSize
, true);
}
oss << QString("%1: %2").arg(q_("Apparent diameter"), sizeSt
r) << "<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
double siderealPeriod = getSiderealPeriod(); double siderealPeriod = getSiderealPeriod();
if (flags&Extra) if (flags&Extra)
{ {
if (!specT.isEmpty())
{
// TRANSLATORS: Tholen spectral taxonomic classifica
tion of asteroids
oss << QString("%1: %2").arg(q_("Tholen spectral typ
e"), specT) << "<br />";
}
if (!specB.isEmpty())
{
// TRANSLATORS: SMASSII spectral taxonomic classific
ation of asteroids
oss << QString("%1: %2").arg(q_("SMASSII spectral ty
pe"), specB) << "<br />";
}
if (siderealPeriod>0) if (siderealPeriod>0)
{ {
// TRANSLATORS: Sidereal (orbital) period for solar QString days = qc_("days", "duration");
system bodies in days and in Julian years (symbol: a) // Sidereal (orbital) period for solar system bodies
oss << q_("Sidereal period: %1 days (%2 a)").arg(QSt in days and in Julian years (symbol: a)
ring::number(siderealPeriod, 'f', 2)).arg(QString::number(siderealPeriod/36 oss << QString("%1: %2 %3 (%4 a)").arg(q_("Sidereal
5.25, 'f', 3)) << "<br>"; period"), QString::number(siderealPeriod, 'f', 2), days, QString::number(si
derealPeriod/365.25, 'f', 3)) << "<br />";
} }
const Vec3d& observerHelioPos = core->getObserverHeliocentri cEclipticPos(); const Vec3d& observerHelioPos = core->getObserverHeliocentri cEclipticPos();
const double elongation = getElongation(observerHelioPos); const double elongation = getElongation(observerHelioPos);
QString pha, elo;
if (withDecimalDegree) if (withDecimalDegree)
{ {
oss << QString(q_("Phase Angle: %1")).arg(StelUtils: pha = StelUtils::radToDecDegStr(getPhaseAngle(observ
:radToDecDegStr(getPhaseAngle(observerHelioPos),4,false,true)) << "<br>"; erHelioPos),4,false,true);
oss << QString(q_("Elongation: %1")).arg(StelUtils:: elo = StelUtils::radToDecDegStr(elongation,4,false,t
radToDecDegStr(elongation,4,false,true)) << "<br>"; rue);
} }
else else
{ {
oss << QString(q_("Phase Angle: %1")).arg(StelUtils: pha = StelUtils::radToDmsStr(getPhaseAngle(observerH
:radToDmsStr(getPhaseAngle(observerHelioPos), true)) << "<br>"; elioPos), true);
oss << QString(q_("Elongation: %1")).arg(StelUtils:: elo = StelUtils::radToDmsStr(elongation, true);
radToDmsStr(elongation, true)) << "<br>";
} }
oss << QString("%1: %2").arg(q_("Phase angle"), pha) << "<br
/>";
oss << QString("%1: %2").arg(q_("Elongation"), elo) << "<br
/>";
} }
postProcessInfoString(str, flags); postProcessInfoString(str, flags);
return str; return str;
} }
double MinorPlanet::getSiderealPeriod() const double MinorPlanet::getSiderealPeriod() const
{ {
double period; double period;
 End of changes. 27 change blocks. 
65 lines changed or deleted 157 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/