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

core/modules/NebulaMgr.hpp

00001 /*
00002  * Stellarium
00003  * Copyright (C) 2002 Fabien Chereau
00004  *
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * as published by the Free Software Foundation; either version 2
00008  * of the License, or (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00018  */
00019 
00020 #ifndef _NEBULAMGR_HPP_
00021 #define _NEBULAMGR_HPP_
00022 
00023 #include <QString>
00024 #include <QStringList>
00025 #include <QFont>
00026 #include "StelObjectType.hpp"
00027 #include "StelFader.hpp"
00028 #include "StelSphericalIndex.hpp"
00029 #include "StelObjectModule.hpp"
00030 #include "StelTextureTypes.hpp"
00031 
00032 class Nebula;
00033 class StelTranslator;
00034 class StelToneReproducer;
00035 class QSettings;
00036 class StelPainter;
00037 
00038 typedef QSharedPointer<Nebula> NebulaP;
00039 
00043 class NebulaMgr : public StelObjectModule
00044 {
00045     Q_OBJECT
00046 
00047 public:
00048     NebulaMgr();
00049     virtual ~NebulaMgr();
00050 
00052     // Methods defined in the StelModule class
00060     virtual void init();
00061 
00063     virtual void draw(StelCore* core);
00064 
00066     virtual void update(double deltaTime) {hintsFader.update((int)(deltaTime*1000)); flagShow.update((int)(deltaTime*1000));}
00067 
00071     virtual void updateI18n();
00072 
00075     virtual void setStelStyle(const QString& section);
00076 
00078     virtual double getCallOrder(StelModuleActionName actionName) const;
00079 
00081     // Methods defined in StelObjectManager class
00087     virtual QList<StelObjectP> searchAround(const Vec3d& v, double limitFov, const StelCore* core) const;
00088 
00092     virtual StelObjectP searchByNameI18n(const QString& nameI18n) const;
00093 
00096     virtual StelObjectP searchByName(const QString& name) const;
00097 
00102     virtual QStringList listMatchingObjectsI18n(const QString& objPrefix, int maxNbItem=5) const;
00103 
00105     // Properties setters and getters
00106 public slots:
00108     void setCirclesColor(const Vec3f& c);
00110     const Vec3f& getCirclesColor(void) const;
00111 
00113     void setCircleScale(float scale);
00115     float getCircleScale(void) const;
00116 
00118     void setHintsFadeDuration(float duration) {hintsFader.setDuration((int) (duration * 1000.f));}
00119 
00121     void setFlagHints(bool b) {hintsFader=b;}
00123     bool getFlagHints(void) const {return hintsFader;}
00124 
00126     void setFlagShow(bool b) { flagShow = b; }
00128     bool getFlagShow(void) const { return flagShow; }
00129 
00131     void setLabelsColor(const Vec3f& c);
00133     const Vec3f& getLabelsColor(void) const;
00134 
00136     void setFlagDisplayNoTexture(bool b) {displayNoTexture = b;}
00138     bool getFlagDisplayNoTexture(void) const {return displayNoTexture;}
00139 
00143     void setLabelsAmount(float a) {labelsAmount=a;}
00146     float getLabelsAmount(void) const {return labelsAmount;}
00147 
00151     void setHintsAmount(float f) {hintsAmount = f;}
00154     float getHintsAmount(void) const {return hintsAmount;}
00155 
00156 private:
00158     NebulaP search(const QString& name);
00159 
00161     NebulaP search(const Vec3d& pos);
00162 
00169     void loadNebulaSet(const QString& setName);
00170 
00172     void drawPointer(const StelCore* core, StelPainter& sPainter);
00173 
00174     NebulaP searchM(unsigned int M);
00175     NebulaP searchNGC(unsigned int NGC);
00176     NebulaP searchIC(unsigned int IC);
00177     bool loadNGC(const QString& fileName);
00178     bool loadNGCOld(const QString& catNGC);
00179     bool loadNGCNames(const QString& fileName);
00180 
00181     QVector<NebulaP> nebArray;      // The nebulas list
00182     QHash<unsigned int, NebulaP> ngcIndex;
00183     LinearFader hintsFader;
00184     LinearFader flagShow;
00185 
00187     StelSphericalIndex nebGrid;
00188 
00190     float hintsAmount;
00192     float labelsAmount;
00193 
00194     bool displayNoTexture;          // Define if nebulas without textures are to be displayed
00195 
00197     StelTextureSP texPointer;
00198     
00199     QFont nebulaFont;      // Font used for names printing
00200 };
00201 
00202 #endif // _NEBULAMGR_HPP_