00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _STARMGR_HPP_
00021 #define _STARMGR_HPP_
00022
00023 #include <QFont>
00024 #include <vector>
00025 #include <map>
00026 #include <QVariantMap>
00027 #include "StelFader.hpp"
00028 #include "StelObjectModule.hpp"
00029 #include "StelTextureTypes.hpp"
00030 #include "StelProjectorType.hpp"
00031
00032 class StelObject;
00033 class StelToneReproducer;
00034 class StelProjector;
00035 class StelNavigator;
00036 class StelLoadingBar;
00037 class StelPainter;
00038 class QSettings;
00039
00040 namespace BigStarCatalogExtension {
00041 class ZoneArray;
00042 class HipIndexStruct;
00043 }
00044
00068 class StarMgr : public StelObjectModule
00069 {
00070 Q_OBJECT
00071
00072 public:
00073 StarMgr(void);
00074 ~StarMgr(void);
00075
00077
00085 virtual void init();
00086
00088 virtual void draw(StelCore* core);
00089
00092 virtual void update(double deltaTime) {labelsFader.update((int)(deltaTime*1000)); starsFader.update((int)(deltaTime*1000));}
00093
00095 virtual void updateI18n();
00096
00100 virtual void updateSkyCulture(const QString& skyCultureDir);
00101
00103 virtual void setStelStyle(const StelStyle& style);
00104
00106 virtual double getCallOrder(StelModuleActionName actionName) const;
00107
00109
00111 virtual QList<StelObjectP > searchAround(const Vec3d& v, double limitFov, const StelCore* core) const;
00112
00116 virtual StelObjectP searchByNameI18n(const QString& nameI18n) const;
00117
00120 virtual StelObjectP searchByName(const QString& name) const;
00121
00126 virtual QStringList listMatchingObjectsI18n(const QString& objPrefix, int maxNbItem=5) const;
00127
00128 public slots:
00130
00132 void setLabelColor(const Vec3f& c) {labelColor = c;}
00134 Vec3f getLabelColor(void) const {return labelColor;}
00135
00137 void setFlagStars(bool b) {starsFader=b;}
00139 bool getFlagStars(void) const {return starsFader==true;}
00140
00142 void setFlagLabels(bool b) {labelsFader=b;}
00144 bool getFlagLabels(void) const {return labelsFader==true;}
00145
00149 void setLabelsAmount(float a) {labelsAmount=a;}
00152 float getLabelsAmount(void) const {return labelsAmount;}
00153
00155 void setFontSize(double newFontSize);
00156
00158 static void setFlagSciNames(bool f) {flagSciNames = f;}
00159 static bool getFlagSciNames(void) {return flagSciNames;}
00160
00161 public:
00163
00168 StelObjectP searchHP(int hip) const;
00169
00172 static QString getCommonName(int hip);
00173
00176 static QString getSciName(int hip);
00177
00178 static QString convertToSpectralType(int index);
00179 static QString convertToComponentIds(int index);
00180
00181 QVariantList getCatalogsDescription() const {return catalogsDescription;}
00182
00186 bool checkAndLoadCatalog(QVariantMap m, StelLoadingBar* lb=NULL);
00187
00188 private:
00189
00190 void setCheckFlag(const QString& catalogId, bool b);
00191
00192 void copyDefaultConfigFile();
00193
00197 int loadCommonNames(const QString& commonNameFile);
00198
00202 void loadSciNames(const QString& sciNameFile);
00203
00205
00206 int getMaxSearchLevel() const;
00207
00209 void loadData(QVariantMap starsConfigFile);
00210
00212 void drawPointer(StelPainter& sPainter, const StelNavigator * nav);
00213
00214 LinearFader labelsFader;
00215 LinearFader starsFader;
00216
00217 bool flagStarName;
00218 float labelsAmount;
00219 bool gravityLabel;
00220
00221 int maxGeodesicGridLevel;
00222 int lastMaxSearchLevel;
00223 typedef std::map<int,BigStarCatalogExtension::ZoneArray*> ZoneArrayMap;
00224 ZoneArrayMap zoneArrays;
00225 static void initTriangleFunc(int lev, int index,
00226 const Vec3d &c0,
00227 const Vec3d &c1,
00228 const Vec3d &c2,
00229 void *context)
00230 {
00231 reinterpret_cast<StarMgr*>(context)->initTriangle(lev, index, c0, c1, c2);
00232 }
00233
00234 void initTriangle(int lev, int index,
00235 const Vec3d &c0,
00236 const Vec3d &c1,
00237 const Vec3d &c2);
00238
00239 BigStarCatalogExtension::HipIndexStruct *hipIndex;
00240
00241 static std::map<int, QString> commonNamesMap;
00242 static std::map<int, QString> commonNamesMapI18n;
00243 static std::map<QString, int> commonNamesIndex;
00244 static std::map<QString, int> commonNamesIndexI18n;
00245
00246 static std::map<int, QString> sciNamesMapI18n;
00247 static std::map<QString, int> sciNamesIndexI18n;
00248
00249 QFont starFont;
00250 static bool flagSciNames;
00251 Vec3f labelColor;
00252
00253 StelTextureSP texPointer;
00254
00255 class StelObjectMgr* objectMgr;
00256
00257 QString starConfigFileFullPath;
00258 QVariantMap starSettings;
00259 QVariantList catalogsDescription;
00260 };
00261
00262
00263 #endif // _STARMGR_HPP_
00264