ZoneArray.cpp   ZoneArray.cpp 
skipping to change at line 28 skipping to change at line 28
*/ */
#include <QDebug> #include <QDebug>
#include <QFile> #include <QFile>
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
#include <io.h> #include <io.h>
#include <windows.h> #include <windows.h>
#endif #endif
#include "ZoneArray.hpp" #include "ZoneArray.hpp"
#include "renderer/StelRenderer.hpp"
#include "StelApp.hpp" #include "StelApp.hpp"
#include "StelFileMgr.hpp" #include "StelFileMgr.hpp"
#include "StelGeodesicGrid.hpp" #include "StelGeodesicGrid.hpp"
#include "StelObject.hpp" #include "StelObject.hpp"
static unsigned int stel_bswap_32(unsigned int val) { static unsigned int stel_bswap_32(unsigned int val) {
return (((val) & 0xff000000) >> 24) | (((val) & 0x00ff0000) >> 8) | return (((val) & 0xff000000) >> 24) | (((val) & 0x00ff0000) >> 8) |
(((val) & 0x0000ff00) << 8) | (((val) & 0x000000ff) << 24); (((val) & 0x0000ff00) << 8) | (((val) & 0x000000ff) << 24);
} }
namespace BigStarCatalogExtension namespace BigStarCatalogExtension
{ {
static const Vec3f north(0,0,1); static const Vec3f north(0,0,1);
void ZoneArray::initTriangle(int index, const Vec3f &c0, const Vec3f &c1, void ZoneArray::initTriangle(int index, const Vec3f &c0, const Vec3f &c1,
const Vec3f &c2) const Vec3f &c2)
{ {
// initialize center,axis0,axis1: // initialize center,axis0,axis1:
ZoneData &z(zones[index]); ZoneData &z(zones[index]);
z.center = c0+c1+c2; z.center = c0+c1+c2;
z.center.normalize(); z.center.normalize();
z.axis0 = north ^ z.center; z.axis0 = north ^ z.center;
z.axis0.normalize(); z.axis0.normalize();
z.axis1 = z.center ^ z.axis0; z.axis1 = z.center ^ z.axis0;
// initialize star_position_scale: // initialize star_position_scale:
double mu0,mu1,f,h; double mu0,mu1,f,h;
skipping to change at line 247 skipping to change at line 248
if (rval) if (rval)
{ {
delete rval; delete rval;
rval = 0; rval = 0;
} }
} }
return rval; return rval;
} }
ZoneArray::ZoneArray(const QString& fname, QFile* file, int level, int mag_ min, ZoneArray::ZoneArray(const QString& fname, QFile* file, int level, int mag_ min,
int mag_range, int mag_steps) int mag_range, int mag_steps)
: fname(fname), level(level), mag_min(mag_min), : fname(fname), level(level), mag_min(mag_min),
mag_range(mag_range), mag_steps(mag_steps), mag_range(mag_range), mag_steps(mag_steps),
star_position_scale(0.0), zones(0), file(file) star_position_scale(0.0), zones(0), file(file)
{ {
nr_of_zones = StelGeodesicGrid::nrOfZones(level); nr_of_zones = StelGeodesicGrid::nrOfZones(level);
nr_of_stars = 0; nr_of_stars = 0;
} }
bool ZoneArray::readFile(QFile& file, void *data, qint64 size) bool ZoneArray::readFile(QFile& file, void *data, qint64 size)
{ {
int parts = 256; int parts = 256;
int part_size = (size + (parts>>1)) / parts; int part_size = (size + (parts>>1)) / parts;
if (part_size < 64*1024) if (part_size < 64*1024)
skipping to change at line 475 skipping to change at line 476
if (zones) if (zones)
{ {
delete[] getZones(); delete[] getZones();
zones = NULL; zones = NULL;
} }
nr_of_zones = 0; nr_of_zones = 0;
nr_of_stars = 0; nr_of_stars = 0;
} }
template<class Star> template<class Star>
void SpecialZoneArray<Star>::draw(StelPainter* sPainter, int index, bool is void SpecialZoneArray<Star>::draw
_inside, const float *rcmag_table, StelCore* core, unsigned int maxMagStarN (StelProjectorP projector, StelRenderer* renderer, int index, bool i
ame, s_inside,
float names_brightness) const const float *rcmag_table, StelCore* core, unsigned int maxMagStarNa
{ me,
StelSkyDrawer* drawer = core->getSkyDrawer(); float names_brightness) const
SpecialZoneData<Star> *const z = getZones() + index; {
Vec3f vf; StelSkyDrawer* drawer = core->getSkyDrawer();
const Star *const end = z->getStars() + z->size; SpecialZoneData<Star> *const z = getZones() + index;
static const double d2000 = 2451545.0; Vec3f vf;
const double movementFactor = (M_PI/180)*(0.0001/3600) * ((core->getJDa const Star *const end = z->getStars() + z->size;
y()-d2000)/365.25) / star_position_scale; static const double d2000 = 2451545.0;
const float* tmpRcmag; // will point to precomputed rC in table const double movementFactor = (M_PI/180)*(0.0001/3600) * ((core->get
// GZ, added for extinction JDay()-d2000)/365.25) / star_position_scale;
Extinction extinction=core->getSkyDrawer()->getExtinction(); const float* tmpRcmag; // will point to precomputed rC in table
const bool withExtinction=(drawer->getFlagHasAtmosphere() && extinction // GZ, added for extinction
.getExtinctionCoefficient()>=0.01f); Extinction extinction=core->getSkyDrawer()->getExtinction();
const float k = (0.001f*mag_range)/mag_steps; // from StarMgr.cpp line const bool withExtinction=(drawer->getFlagHasAtmosphere() && extinct
654 ion.getExtinctionCoefficient()>=0.01f);
const float k = (0.001f*mag_range)/mag_steps; // from StarMgr.cpp li
// go through all stars, which are sorted by magnitude (bright stars fi ne 654
rst)
for (const Star *s=z->getStars();s<end;++s) // go through all stars, which are sorted by magnitude (bright stars
{ first)
tmpRcmag = rcmag_table+2*s->mag; for (const Star *s=z->getStars();s<end;++s)
if (*tmpRcmag<=0.f) break; // no size for this and following (even d {
immer, unextincted) stars? --> early exit tmpRcmag = rcmag_table+2*s->mag;
s->getJ2000Pos(z,movementFactor, vf); if (*tmpRcmag<=0.f) break; // no size for this and following
(even dimmer, unextincted) stars? --> early exit
// GZ new: s->getJ2000Pos(z,movementFactor, vf);
if (withExtinction)
{ const Vec3d vd(vf[0], vf[1], vf[2]);
//GZ: We must compute position first, then shift magnitude.
Vec3d altAz=core->j2000ToAltAz(Vec3d(vf[0], vf[1], vf[2]), StelC // GZ new:
ore::RefractionOn); if (withExtinction)
float extMagShift=0.0f; {
extinction.forward(&altAz, &extMagShift); //GZ: We must compute position first, then shift mag
int extMagShiftStep=qMin((int)floor(extMagShift/k), 4096-mag_st nitude.
eps); // this number muist be equal StarMgr.cpp line 649 Vec3d altAz = core->j2000ToAltAz(vd, StelCore::Refra
tmpRcmag = rcmag_table+2*(s->mag+extMagShiftStep); ctionOn);
} float extMagShift = 0.0f;
extinction.forward(&altAz, &extMagShift);
if (drawer->drawPointSource(sPainter, Vec3d(vf[0], vf[1], vf[2]), tm const int extMagShiftStep =
pRcmag, s->bV, !is_inside) && s->hasName() && s->mag < maxMagStarName && s- qMin((int)floor(extMagShift / k), RCMAG_TABL
>hasComponentID()<=1) E_SIZE-mag_steps);
{ tmpRcmag = rcmag_table + 2 * (s->mag+extMagShiftStep
const float offset = *tmpRcmag*0.7f; );
const Vec3f& colorr = (StelApp::getInstance().getVisionModeNight }
() ? Vec3f(0.8f, 0.0f, 0.0f) : StelSkyDrawer::indexToColor(s->bV))*0.75f;
sPainter->setColor(colorr[0], colorr[1], colorr[2],names_brightn Vec3f win;
ess); if(drawer->pointSourceVisible(&(*projector), vf, tmpRcmag, !
sPainter->drawText(Vec3d(vf[0], vf[1], vf[2]), s->getNameI18n(), is_inside, win))
0, offset, offset, false); {
drawer->drawPointSource(win, tmpRcmag, s->bV);
if(s->hasName() && s->mag < maxMagStarName && s->has
ComponentID()<=1)
{
const float offset = *tmpRcmag*0.7f;
const Vec3f& colorr = (StelApp::getInstance(
).getVisionModeNight() ? Vec3f(0.8f, 0.0f, 0.0f) : StelSkyDrawer::indexToCo
lor(s->bV))*0.75f;
renderer->setGlobalColor(colorr[0], colorr[1
], colorr[2], names_brightness);
renderer->drawText(TextParams(vf, projector,
s->getNameI18n())
.shift(offset, offset).us
eGravity());
}
}
} }
}
} }
template<class Star> template<class Star>
void SpecialZoneArray<Star>::searchAround(const StelCore* core, int index, void SpecialZoneArray<Star>::searchAround
const Vec3d &v, double cosLimFov, (const StelCore* core, int index, const Vec3d &v, double cosLimFov,
QList<StelObjectP > &result) QList<StelObjectP > &result)
{ {
static const double d2000 = 2451545.0; static const double d2000 = 2451545.0;
const double movementFactor = (M_PI/180.)*(0.0001/3600.) * ((core->g etJDay()-d2000)/365.25)/ star_position_scale; const double movementFactor = (M_PI/180.)*(0.0001/3600.) * ((core->g etJDay()-d2000)/365.25)/ star_position_scale;
const SpecialZoneData<Star> *const z = getZones()+index; const SpecialZoneData<Star> *const z = getZones()+index;
Vec3f tmp; Vec3f tmp;
Vec3f vf(v[0], v[1], v[2]); Vec3f vf(v[0], v[1], v[2]);
for (const Star* s=z->getStars();s<z->getStars()+z->size;++s) for (const Star* s=z->getStars();s<z->getStars()+z->size;++s)
{ {
s->getJ2000Pos(z,movementFactor, tmp); s->getJ2000Pos(z,movementFactor, tmp);
tmp.normalize(); tmp.normalize();
 End of changes. 6 change blocks. 
62 lines changed or deleted 79 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/