StarWrapper.cpp   StarWrapper.cpp 
skipping to change at line 28 skipping to change at line 28
* *
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, U SA.
*/ */
#include "StarWrapper.hpp" #include "StarWrapper.hpp"
#include "ZoneArray.hpp" #include "ZoneArray.hpp"
#include "StelUtils.hpp" #include "StelUtils.hpp"
#include "Translator.hpp" #include "StelTranslator.hpp"
#include <QTextStream> #include <QTextStream>
#include <limits>
template<typename T> inline bool isNan(T value)
{
return value != value;
}
template<typename T> inline bool isInf(T value)
{
return std::numeric_limits<T>::has_infinity && value == std::numeric
_limits<T>::infinity();
}
namespace BigStarCatalogExtension { namespace BigStarCatalogExtension {
QString StarWrapperBase::getInfoString(const StelCore *core, const InfoStri ngGroup& flags) const QString StarWrapperBase::getInfoString(const StelCore *core, const InfoStri ngGroup& flags) const
{ {
const Navigator* nav = core->getNavigation(); const StelNavigator* nav = core->getNavigator();
QString str; QString str;
QTextStream oss(&str); QTextStream oss(&str);
if (flags&Magnitude) if (flags&Magnitude)
oss << q_("Magnitude: <b>%1</b> (B-V: %2)").arg(QString::num ber(getVMagnitude(nav), 'f', 2), QString::number(getBV(), 'f', 2)) << "<br> "; oss << q_("Magnitude: <b>%1</b> (B-V: %2)").arg(QString::num ber(getVMagnitude(nav), 'f', 2), QString::number(getBV(), 'f', 2)) << "<br> ";
oss << getPositionInfoString(core, flags); oss << getPositionInfoString(core, flags);
StelObject::postProcessInfoString(str, flags); StelObject::postProcessInfoString(str, flags);
skipping to change at line 60 skipping to change at line 71
QString StarWrapper1::getEnglishName(void) const QString StarWrapper1::getEnglishName(void) const
{ {
if (s->hip) if (s->hip)
return QString("HP %1").arg(s->hip); return QString("HP %1").arg(s->hip);
return StarWrapperBase::getEnglishName(); return StarWrapperBase::getEnglishName();
} }
QString StarWrapper1::getInfoString(const StelCore *core, const InfoStringG roup& flags) const QString StarWrapper1::getInfoString(const StelCore *core, const InfoStringG roup& flags) const
{ {
QString str; QString str;
const Navigator* nav = core->getNavigation(); const StelNavigator* nav = core->getNavigator();
QTextStream oss(&str); QTextStream oss(&str);
if (s->hip) if (s->hip)
{ {
if ((flags&Name) || (flags&CatalogNumber)) if ((flags&Name) || (flags&CatalogNumber))
oss << "<h2>"; oss << "<h2>";
const QString commonNameI18 = StarMgr::getCommonName(s->hip) ; const QString commonNameI18 = StarMgr::getCommonName(s->hip) ;
const QString sciName = StarMgr::getSciName(s->hip); const QString sciName = StarMgr::getSciName(s->hip);
skipping to change at line 100 skipping to change at line 111
oss << " " << StarMgr::convertToComponentIds(s->comp onentIds); oss << " " << StarMgr::convertToComponentIds(s->comp onentIds);
if ((flags&Name) || (flags&CatalogNumber)) if ((flags&Name) || (flags&CatalogNumber))
oss << "</h2>"; oss << "</h2>";
} }
if (flags&Magnitude) if (flags&Magnitude)
oss << q_("Magnitude: <b>%1</b> (B-V: %2)").arg(QString::num ber(getVMagnitude(nav), 'f', 2), oss << q_("Magnitude: <b>%1</b> (B-V: %2)").arg(QString::num ber(getVMagnitude(nav), 'f', 2),
QString::num ber(s->getBV(), 'f', 2)) << "<br>"; QString::num ber(s->getBV(), 'f', 2)) << "<br>";
if (flags&AbsoluteMagnitude) if ((flags&AbsoluteMagnitude) && s->plx && !isNan(s->plx) && !isInf( s->plx))
oss << q_("Absolute Magnitude: %1").arg(getVMagnitude(nav)+5 .*(1.+std::log10(0.00001*s->plx)), 0, 'f', 2) << "<br>"; oss << q_("Absolute Magnitude: %1").arg(getVMagnitude(nav)+5 .*(1.+std::log10(0.00001*s->plx)), 0, 'f', 2) << "<br>";
oss << getPositionInfoString(core, flags); oss << getPositionInfoString(core, flags);
if (s->spInt && flags&Extra1) if (s->spInt && flags&Extra1)
{ {
oss << q_("Spectral Type: %1").arg(StarMgr::convertToSpectra lType(s->spInt)) << "<br>"; oss << q_("Spectral Type: %1").arg(StarMgr::convertToSpectra lType(s->spInt)) << "<br>";
} }
if (flags&Distance) if ((flags&Distance) && s->plx && !isNan(s->plx) && !isInf(s->plx))
oss << q_("Distance: %1 Light Years").arg((AU/(SPEED_OF_LIGH T*86400*365.25)) / (s->plx*((0.00001/3600)*(M_PI/180))), 0, 'f', 2) << "<br >"; oss << q_("Distance: %1 Light Years").arg((AU/(SPEED_OF_LIGH T*86400*365.25)) / (s->plx*((0.00001/3600)*(M_PI/180))), 0, 'f', 2) << "<br >";
if (s->plx && flags&Extra2) if (s->plx && flags&Extra2)
oss << q_("Parallax: %1\"").arg(0.00001*s->plx, 0, 'f', 5) < < "<br>"; oss << q_("Parallax: %1\"").arg(0.00001*s->plx, 0, 'f', 5) < < "<br>";
StelObject::postProcessInfoString(str, flags); StelObject::postProcessInfoString(str, flags);
return str; return str;
} }
 End of changes. 6 change blocks. 
5 lines changed or deleted 17 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/