skytexture.h

Go to the documentation of this file.
00001 #ifndef SKYTEXTURE_H
00002 #define SKYTEXTURE_H
00003 /* ============================================================================
00004 'skytexture.h' defines the interface that converts a skymap into a texture
00005 usable by the QGLViewer.
00006 
00007 Written by Nicholas Phillips.
00008 QT4 implementation.  Michael R. Greason, ADNET, 29 December 2006.
00009 ============================================================================ */
00010 /*
00011                         Fetch header files.
00012 */
00013 #include <vector>
00014 #include <map>
00015 #include <qtimer.h>
00016 #include <qthread.h>
00017 #include <QGLViewer/qglviewer.h>
00018 #include "healpixmap.h"
00019 #include "enums.h"
00020 
00021 class ColorTable;
00022 class RangeControl;
00023 /*
00024                         Typedefs.
00025 */
00026 typedef std::vector<long> PixLUT;                       // Skymap->texture lookup table.
00027 typedef std::map<int, PixLUT > PixLUTCache;             // Cache of computed texture look-up
00028                                                         // tables.
00029 
00030 /* ============================================================================
00031 'SkyTexture' defines the interface that converts a skymap into a texture
00032 usable by the QGLViewer.
00033 ============================================================================ */
00034 class SkyTexture : public QThread
00035 {
00036         Q_OBJECT
00037 private:
00038         unsigned char  hilite_level;
00039         unsigned char  select_level;
00040         unsigned char *texture;                 // Texture representation of skymap
00041         int            texture_res;             // Resolution per side of texture
00042         int            nside;                   // HealPix resolution parameter for texture.
00043         HealpixMap::PixOrder order;             // The HealPix ordering scheme.
00044         PixLUT        *lut;                     // Pointer to current look-up table
00045         PixLUTCache    lut_cache_ring;          // Cache of ring-ordered look-up tables
00046         PixLUTCache    lut_cache_nest;          // Cache of nest-ordered look-up tables
00047         HealpixMap *skymap;                             // Skymap to use
00048         ColorTable *ct;                         // The color table to use
00049         int    dpyfieldold;                     // The display fiels to use
00050         Field  dpyfield;                        // The display fiels to use
00051         double minv;                            // The minimum display value
00052         double maxv;                            // The maximum display value
00053         bool restart;                           // set when current repaint should stop
00054 
00055         QTimer *timer;                          // Controls how often to update GL
00056         bool update;                            // true while there is still a need to update
00057 
00058         bool buildLUT(const int ns, HealpixMap::PixOrder ordering);
00059         PixLUTCache::iterator getLUT(const int ns, HealpixMap::PixOrder ordering);
00060 
00061 protected:
00062         void run();
00063 
00064 protected slots:
00065         void reTexture(void);                   // send the texture to GL
00066 
00067 public :
00068         SkyTexture();
00069         virtual ~SkyTexture();
00070 
00071         void set(HealpixMap *skymap, RangeControl *rangecontrol);
00072 
00073         void glTexture();
00074         void highlite (const int pix, float alpha = 1.);
00075 
00076 signals:
00077         void retextured();                      // emitted every time the texture is sent to GL
00078 };
00079 #endif

Generated on Fri Feb 6 15:32:42 2009 for Skyviewer by  doxygen 1.4.7