本文整理汇总了C++中Star::getCatalogNumber方法的典型用法代码示例。如果您正苦于以下问题:C++ Star::getCatalogNumber方法的具体用法?C++ Star::getCatalogNumber怎么用?C++ Star::getCatalogNumber使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Star
的用法示例。
在下文中一共展示了Star::getCatalogNumber方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getStarName
// Return the name for the star with specified catalog number. The returned
// string will be:
// the common name if it exists, otherwise
// the Bayer or Flamsteed designation if it exists, otherwise
// the HD catalog number if it exists, otherwise
// the HIPPARCOS catalog number.
//
// CAREFUL:
// If the star name is not present in the names database, a new
// string is constructed to contain the catalog number--keep in
// mind that calling this method could possibly incur the overhead
// of a memory allocation (though no explcit deallocation is
// required as it's all wrapped in the string class.)
string StarDatabase::getStarName(const Star& star, bool i18n) const
{
uint32 catalogNumber = star.getCatalogNumber();
if (namesDB != NULL)
{
StarNameDatabase::NumberIndex::const_iterator iter = namesDB->getFirstNameIter(catalogNumber);
if (iter != namesDB->getFinalNameIter() && iter->first == catalogNumber)
{
if (i18n && iter->second != _(iter->second.c_str()))
return _(iter->second.c_str());
else
return iter->second;
}
}
char buf[20];
/*
// Get the HD catalog name
if (star.getCatalogNumber() != Star::InvalidCatalogNumber)
sprintf(buf, "HD %d", star.getCatalogNumber(Star::HDCatalog));
else
*/
catalogNumberToString(catalogNumber, buf, sizeof(buf));
return string(buf);
}
示例2: operator
bool operator()(const Star& star0, const Star& star1) const
{
return (star0.getCatalogNumber() == star1.getCatalogNumber());
}
示例3: getStarNameList
string StarDatabase::getStarNameList(const Star& star, const unsigned int maxNames) const
{
string starNames;
char numString[32];
unsigned int catalogNumber = star.getCatalogNumber();
StarNameDatabase::NumberIndex::const_iterator iter = namesDB->getFirstNameIter(catalogNumber);
unsigned int count = 0;
while (iter != namesDB->getFinalNameIter() && iter->first == catalogNumber && count < maxNames)
{
if (count != 0)
starNames += " / ";
starNames += ReplaceGreekLetterAbbr(iter->second.c_str());
++iter;
++count;
}
uint32 hip = catalogNumber;
if (hip != Star::InvalidCatalogNumber && hip != 0 && count < maxNames)
{
if (hip <= Star::MaxTychoCatalogNumber)
{
if (count != 0)
starNames += " / ";
if (hip >= 1000000)
{
uint32 h = hip;
uint32 tyc3 = h / 1000000000;
h -= tyc3 * 1000000000;
uint32 tyc2 = h / 10000;
h -= tyc2 * 10000;
uint32 tyc1 = h;
sprintf(numString, "TYC %u-%u-%u", tyc1, tyc2, tyc3);
starNames += numString;
}
else
{
sprintf(numString, "HIP %u", hip);
starNames += numString;
}
++count;
}
}
uint32 hd = crossIndex(StarDatabase::HenryDraper, hip);
if (count < maxNames && hd != Star::InvalidCatalogNumber)
{
if (count != 0)
starNames += " / ";
sprintf(numString, "HD %u", hd);
starNames += numString;
}
uint32 sao = crossIndex(StarDatabase::SAO, hip);
if (count < maxNames && sao != Star::InvalidCatalogNumber)
{
if (count != 0)
starNames += " / ";
sprintf(numString, "SAO %u", sao);
starNames += numString;
}
return starNames;
}