Added special handling for star barycenters to the UI.

ver1_5_1
Chris Laurel 2004-10-02 17:26:02 +00:00
parent 165a158632
commit 4e69c6998b
2 changed files with 35 additions and 21 deletions

View File

@ -2640,25 +2640,28 @@ static string starNameList(Star& star,
uint32 hip = star.getCatalogNumber();
if (hip != Star::InvalidCatalogNumber && hip != 0 && count < maxNames)
{
if (count != 0)
starNames += " / ";
if (hip >= 1000000)
if (hip <= Star::MaxTychoCatalogNumber)
{
uint32 tyc3 = hip / 1000000000;
hip -= tyc3 * 1000000000;
uint32 tyc2 = hip / 10000;
hip -= tyc2 * 10000;
uint32 tyc1 = hip;
sprintf(numString, "TYC %u-%u-%u", tyc1, tyc2, tyc3);
starNames += numString;
}
else
{
sprintf(numString, "HIP %u", hip);
starNames += numString;
}
if (count != 0)
starNames += " / ";
if (hip >= 1000000)
{
uint32 tyc3 = hip / 1000000000;
hip -= tyc3 * 1000000000;
uint32 tyc2 = hip / 10000;
hip -= tyc2 * 10000;
uint32 tyc1 = hip;
sprintf(numString, "TYC %u-%u-%u", tyc1, tyc2, tyc3);
starNames += numString;
}
else
{
sprintf(numString, "HIP %u", hip);
starNames += numString;
}
count++;
count++;
}
}
uint32 hd = starDB.crossIndex(StarDatabase::HenryDraper, hip);
@ -2693,10 +2696,17 @@ static void displayStarInfo(Overlay& overlay,
overlay << "Distance: ";
displayDistance(overlay, distance);
overlay << '\n';
if (!star.getVisibility())
{
overlay << "Star system barycenter\n";
return;
}
overlay.printf("Abs (app) mag: %.2f (%.2f)\n",
star.getAbsoluteMagnitude(),
astro::absToAppMag(star.getAbsoluteMagnitude(), (float) distance));
astro::absToAppMag(star.getAbsoluteMagnitude(),
(float) distance));
overlay << "Luminosity: " << SigDigitNum(star.getLuminosity(), 3) << "x Sun\n";
overlay << "Class: " << star.getSpectralType() << '\n';

View File

@ -164,7 +164,11 @@ FindStars(const StarDatabase& stardb, Pred pred, int nStars)
// up the list indiscriminately.
int i = 0;
for (i = 0; i < nStars; i++)
firstStars.insert(stardb.getStar(i));
{
Star* star = stardb.getStar(i);
if (star->getVisibility())
firstStars.insert(star);
}
// From here on, only add a star to the set if it's
// a better match than the worst matching star already
@ -173,7 +177,7 @@ FindStars(const StarDatabase& stardb, Pred pred, int nStars)
for (; i < totalStars; i++)
{
Star* star = stardb.getStar(i);
if (pred(star, lastStar))
if (star->getVisibility() && pred(star, lastStar))
{
firstStars.insert(star);
firstStars.erase(--firstStars.end());