Stellarium 0.12.0
Home · All Namespaces · All Classes · Functions · Coding Style · Scripting · Plugins · Renderer · File Structure

Nebula.hpp

00001 /*
00002  * Stellarium
00003  * Copyright (C) 2002 Fabien Chereau
00004  * Copyright (C) 2011 Alexander Wolf
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA  02110-1335, USA.
00019  */
00020 
00021 #ifndef _NEBULA_HPP_
00022 #define _NEBULA_HPP_
00023 
00024 #include <QString>
00025 #include "StelObject.hpp"
00026 #include "StelTranslator.hpp"
00027 #include "StelProjectorType.hpp"
00028 
00029 class QDataStream;
00030 
00031 class Nebula : public StelObject
00032 {
00033 friend class NebulaMgr;
00034 public:
00035     Nebula();
00036     ~Nebula();
00037 
00051     virtual QString getInfoString(const StelCore *core, const InfoStringGroup& flags) const;
00052     virtual QString getType() const {return "Nebula";}
00053     virtual Vec3d getJ2000EquatorialPos(const StelCore*) const {return XYZ;}
00054     virtual double getCloseViewFov(const StelCore* core = NULL) const;
00055     virtual float getVMagnitude(const StelCore* core, bool withExtinction=false) const;
00056     virtual float getSelectPriority(const StelCore* core) const;
00057     virtual Vec3f getInfoColor() const;
00058     virtual QString getNameI18n() const {return nameI18;}
00059     virtual QString getEnglishName() const {return englishName;}
00060     virtual double getAngularSize(const StelCore*) const {return angularSize*0.5;}
00061     virtual SphericalRegionP getRegion() const {return pointRegion;}
00062 
00063     // Methods specific to Nebula
00064     void setLabelColor(const Vec3f& v) {labelColor = v;}
00065     void setCircleColor(const Vec3f& v) {circleColor = v;}
00066 
00069     QString getTypeString() const;
00070 
00071 private:
00072     friend struct DrawNebulaFuncObject;
00073 
00075     struct NebulaHintTextures
00076     {
00078         class StelTextureNew* texCircle;  
00080         class StelTextureNew* texOpenCluster;
00082         class StelTextureNew* texGlobularCluster;
00084         class StelTextureNew* texPlanetaryNebula;
00086         bool initialized;
00087 
00089         NebulaHintTextures(): initialized(false){}
00091         ~NebulaHintTextures();
00093         void lazyInit(class StelRenderer* renderer);
00094     };
00095     
00097     enum NebulaType
00098     {
00099         NebGx=0,     
00100         NebOc=1,     
00101         NebGc=2,     
00102         NebN=3,      
00103         NebPn=4,     
00104         NebDn=5,     
00105         NebIg=6,     
00106         NebCn=7,     
00107         NebUnknown=8 
00108     };
00109 
00111     void translateName(StelTranslator& trans) {nameI18 = trans.qtranslate(englishName);}
00112 
00113     bool readNGC(char *record);
00114     void readNGC(QDataStream& in);
00115             
00116     void drawHints(StelRenderer* renderer, float maxMagHints, NebulaHintTextures& hintTextures);
00117     void drawLabel(StelRenderer* renderer, StelProjectorP projector, float maxMagLabel);
00118 
00119     unsigned int M_nb;              // Messier Catalog number
00120     unsigned int NGC_nb;            // New General Catalog number
00121     unsigned int IC_nb;             // Index Catalog number
00122     QString englishName;            // English name
00123     QString nameI18;                // Nebula name
00124     float mag;                      // Apparent magnitude
00125     float angularSize;              // Angular size in degree
00126     Vec3d XYZ;                      // Cartesian equatorial position
00127     Vec3d XY;                       // Store temporary 2D position
00128     NebulaType nType;
00129 
00130     SphericalRegionP pointRegion;
00131 
00132     static float hintsBrightness;
00133 
00134     static Vec3f labelColor, circleColor;
00135     static float circleScale;       // Define the scaling of the hints circle
00136 };
00137 
00138 #endif // _NEBULA_HPP_
00139 
Generated on Thu Jan 31 14:05:39 2013 for Stellarium by  doxygen 1.6.3