ZoneArray.cpp   ZoneArray.cpp 
skipping to change at line 291 skipping to change at line 291
} }
return true; return true;
} }
void HipZoneArray::updateHipIndex(HipIndexStruct hipIndex[]) const void HipZoneArray::updateHipIndex(HipIndexStruct hipIndex[]) const
{ {
for (const SpecialZoneData<Star1> *z=getZones()+(nr_of_zones-1);z>=g etZones();z--) for (const SpecialZoneData<Star1> *z=getZones()+(nr_of_zones-1);z>=g etZones();z--)
{ {
for (const Star1 *s = z->getStars()+z->size-1;s>=z->getStars ();s--) for (const Star1 *s = z->getStars()+z->size-1;s>=z->getStars ();s--)
{ {
const int hip = s->hip; const int hip = s->getHip();
if (hip < 0 || NR_OF_HIP < hip) if (hip < 0 || NR_OF_HIP < hip)
{ {
qDebug() << "ERROR: HipZoneArray::updateHipI ndex: invalid HIP number:" << hip; qDebug() << "ERROR: HipZoneArray::updateHipI ndex: invalid HIP number:" << hip;
exit(1); exit(1);
} }
if (hip != 0) if (hip != 0)
{ {
hipIndex[hip].a = this; hipIndex[hip].a = this;
hipIndex[hip].z = z; hipIndex[hip].z = z;
hipIndex[hip].s = s; hipIndex[hip].s = s;
skipping to change at line 427 skipping to change at line 427
nr_of_zones = 0; nr_of_zones = 0;
} }
else else
{ {
Star *s = stars; Star *s = stars;
for (unsigned int z=0;z<nr_of_zones; z++) for (unsigned int z=0;z<nr_of_zones; z++)
{ {
getZones()[z].stars = s; getZones()[z].stars = s;
s += getZones()[z].size; s += getZones()[z].size;
} }
if (
#if (!defined(__GNUC__))
true
#else
byte_swap
#endif
)
{
s = stars;
for (unsigned int i=0;i<nr_o
f_stars;i++,s++)
{
s->repack(
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
// need for
byte_swap on a BE machine means that catalog is LE
!byte_swap
#else
// need for
byte_swap on a LE machine means that catalog is BE
byte_swap
#endif
);
}
}
} }
file->close(); file->close();
} }
} }
// GZ: Some diagnostics to understand the undocumented vars around mag. // GZ: Some diagnostics to understand the undocumented vars around mag.
// qDebug() << "SpecialZoneArray: mag_min=" << mag_min << ", mag_steps=" << mag_steps << ", mag_range=" << mag_range ; // qDebug() << "SpecialZoneArray: mag_min=" << mag_min << ", mag_steps=" << mag_steps << ", mag_range=" << mag_range ;
} }
} }
template<class Star> template<class Star>
skipping to change at line 514 skipping to change at line 492
cutoffMagStep = limitMagIndex; cutoffMagStep = limitMagIndex;
} }
Q_ASSERT(cutoffMagStep<RCMAG_TABLE_SIZE); Q_ASSERT(cutoffMagStep<RCMAG_TABLE_SIZE);
// Go through all stars, which are sorted by magnitude (bright stars first) // Go through all stars, which are sorted by magnitude (bright stars first)
const SpecialZoneData<Star>* zoneToDraw = getZones() + index; const SpecialZoneData<Star>* zoneToDraw = getZones() + index;
const Star* lastStar = zoneToDraw->getStars() + zoneToDraw->size; const Star* lastStar = zoneToDraw->getStars() + zoneToDraw->size;
for (const Star* s=zoneToDraw->getStars();s<lastStar;++s) for (const Star* s=zoneToDraw->getStars();s<lastStar;++s)
{ {
// Artifical cutoff per magnitude // Artifical cutoff per magnitude
if (s->mag > cutoffMagStep) if (s->getMag() > cutoffMagStep)
break; break;
// Because of the test above, the star should always be visi ble from this point. // Because of the test above, the star should always be visi ble from this point.
// Array of 2 numbers containing radius and magnitude // Array of 2 numbers containing radius and magnitude
const RCMag* tmpRcmag = &rcmag_table[s->mag]; const RCMag* tmpRcmag = &rcmag_table[s->getMag()];
// Get the star position from the array // Get the star position from the array
s->getJ2000Pos(zoneToDraw, movementFactor, vf); s->getJ2000Pos(zoneToDraw, movementFactor, vf);
// If the star zone is not strictly contained inside the vie wport, eliminate from the // If the star zone is not strictly contained inside the vie wport, eliminate from the
// beginning the stars actually outside viewport. // beginning the stars actually outside viewport.
if (!isInsideViewport) if (!isInsideViewport)
{ {
vf.normalize();
bool isVisible = true; bool isVisible = true;
foreach (const SphericalCap& cap, boundingCaps) foreach (const SphericalCap& cap, boundingCaps)
{ {
// Don't use if (!cap.contains(vf)) here bec if (!cap.contains(vf))
ause we don't want to normalize the vector yet, but know
// that it's almost normalized, enough for m
anually computing the intersection avoiding the assert.
if (vf[0]*static_cast<float>(cap.n[0])+vf[1]
*static_cast<float>(cap.n[1])+vf[2]*static_cast<float>(cap.n[2])<static_cas
t<float>(cap.d))
{ {
isVisible = false; isVisible = false;
continue; continue;
} }
} }
if (!isVisible) if (!isVisible)
continue; continue;
} }
int extinctedMagIndex = s->mag; int extinctedMagIndex = s->getMag();
if (withExtinction) if (withExtinction)
{ {
Vec3f altAz(vf); Vec3f altAz(vf);
altAz.normalize(); altAz.normalize();
core->j2000ToAltAzInPlaceNoRefraction(&altAz); core->j2000ToAltAzInPlaceNoRefraction(&altAz);
float extMagShift=0.0f; float extMagShift=0.0f;
extinction.forward(altAz, &extMagShift); extinction.forward(altAz, &extMagShift);
extinctedMagIndex = s->mag + (int)(extMagShift/k); extinctedMagIndex = s->getMag() + (int)(extMagShift/ k);
if (extinctedMagIndex >= cutoffMagStep) // i.e., if extincted it is dimmer than cutoff, so remove if (extinctedMagIndex >= cutoffMagStep) // i.e., if extincted it is dimmer than cutoff, so remove
continue; continue;
tmpRcmag = &rcmag_table[extinctedMagIndex]; tmpRcmag = &rcmag_table[extinctedMagIndex];
} }
if (drawer->drawPointSource(sPainter, vf, *tmpRcmag, s->bV, !isInsideViewport) && s->hasName() && extinctedMagIndex < maxMagStarName && s->hasComponentID()<=1) if (drawer->drawPointSource(sPainter, vf, *tmpRcmag, s->getB VIndex(), !isInsideViewport) && s->hasName() && extinctedMagIndex < maxMagS tarName && s->hasComponentID()<=1)
{ {
const float offset = tmpRcmag->radius*0.7f; const float offset = tmpRcmag->radius*0.7f;
const Vec3f colorr = StelSkyDrawer::indexToColor(s-> bV)*0.75f; const Vec3f colorr = StelSkyDrawer::indexToColor(s-> getBVIndex())*0.75f;
sPainter->setColor(colorr[0], colorr[1], colorr[2],n ames_brightness); sPainter->setColor(colorr[0], colorr[1], colorr[2],n ames_brightness);
sPainter->drawText(Vec3d(vf[0], vf[1], vf[2]), s->ge tNameI18n(), 0, offset, offset, false); sPainter->drawText(Vec3d(vf[0], vf[1], vf[2]), s->ge tNameI18n(), 0, offset, offset, false);
} }
} }
} }
template<class Star> template<class Star>
void SpecialZoneArray<Star>::searchAround(const StelCore* core, int index, const Vec3d &v, double cosLimFov, void SpecialZoneArray<Star>::searchAround(const StelCore* core, int index, const Vec3d &v, double cosLimFov,
QList<StelObjectP > &result) QList<StelObjectP > &result)
{ {
 End of changes. 10 change blocks. 
39 lines changed or deleted 9 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/