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 <QVariantMap>
00025 #include "StelFader.hpp"
00026 #include "StelObjectModule.hpp"
00027 #include "StelTextureTypes.hpp"
00028 #include "StelProjectorType.hpp"
00029
00030 class StelObject;
00031 class StelToneReproducer;
00032 class StelProjector;
00033 class StelPainter;
00034 class QSettings;
00035
00036 namespace BigStarCatalogExtension {
00037 class ZoneArray;
00038 class HipIndexStruct;
00039 }
00040
00064 class StarMgr : public StelObjectModule
00065 {
00066 Q_OBJECT
00067
00068 public:
00069 StarMgr(void);
00070 ~StarMgr(void);
00071
00073
00081 virtual void init();
00082
00084 virtual void draw(StelCore* core);
00085
00088 virtual void update(double deltaTime) {labelsFader.update((int)(deltaTime*1000)); starsFader.update((int)(deltaTime*1000));}
00089
00091 virtual double getCallOrder(StelModuleActionName actionName) const;
00092
00094
00096 virtual QList<StelObjectP > searchAround(const Vec3d& v, double limitFov, const StelCore* core) const;
00097
00101 virtual StelObjectP searchByNameI18n(const QString& nameI18n) const;
00102
00105 virtual StelObjectP searchByName(const QString& name) const;
00106
00111 virtual QStringList listMatchingObjectsI18n(const QString& objPrefix, int maxNbItem=5) const;
00112
00113 public slots:
00115
00117 void setLabelColor(const Vec3f& c) {labelColor = c;}
00119 Vec3f getLabelColor(void) const {return labelColor;}
00120
00122 void setFlagStars(bool b) {starsFader=b;}
00124 bool getFlagStars(void) const {return starsFader==true;}
00125
00127 void setFlagLabels(bool b) {labelsFader=b;}
00129 bool getFlagLabels(void) const {return labelsFader==true;}
00130
00134 void setLabelsAmount(float a) {labelsAmount=a;}
00137 float getLabelsAmount(void) const {return labelsAmount;}
00138
00140 void setFontSize(double newFontSize);
00141
00143 static void setFlagSciNames(bool f) {flagSciNames = f;}
00144 static bool getFlagSciNames(void) {return flagSciNames;}
00145
00146 public:
00148
00153 StelObjectP searchHP(int hip) const;
00154
00157 static QString getCommonName(int hip);
00158
00161 static QString getSciName(int hip);
00162
00163 static QString convertToSpectralType(int index);
00164 static QString convertToComponentIds(int index);
00165
00166 QVariantList getCatalogsDescription() const {return catalogsDescription;}
00167
00171 bool checkAndLoadCatalog(QVariantMap m);
00172
00173 private slots:
00174 void setStelStyle(const QString& section);
00176 void updateI18n();
00177
00181 void updateSkyCulture(const QString& skyCultureDir);
00182
00183 private:
00184
00185 void setCheckFlag(const QString& catalogId, bool b);
00186
00187 void copyDefaultConfigFile();
00188
00192 int loadCommonNames(const QString& commonNameFile);
00193
00197 void loadSciNames(const QString& sciNameFile);
00198
00200
00201 int getMaxSearchLevel() const;
00202
00204 void loadData(QVariantMap starsConfigFile);
00205
00207 void drawPointer(StelPainter& sPainter, const StelCore* core);
00208
00209 LinearFader labelsFader;
00210 LinearFader starsFader;
00211
00212 bool flagStarName;
00213 float labelsAmount;
00214 bool gravityLabel;
00215
00216 int maxGeodesicGridLevel;
00217 int lastMaxSearchLevel;
00218 typedef QHash<int,BigStarCatalogExtension::ZoneArray*> ZoneArrayMap;
00219 ZoneArrayMap zoneArrays;
00220 static void initTriangleFunc(int lev, int index,
00221 const Vec3f &c0,
00222 const Vec3f &c1,
00223 const Vec3f &c2,
00224 void *context)
00225 {
00226 reinterpret_cast<StarMgr*>(context)->initTriangle(lev, index, c0, c1, c2);
00227 }
00228
00229 void initTriangle(int lev, int index,
00230 const Vec3f &c0,
00231 const Vec3f &c1,
00232 const Vec3f &c2);
00233
00234 BigStarCatalogExtension::HipIndexStruct *hipIndex;
00235
00236 static QHash<int, QString> commonNamesMap;
00237 static QHash<int, QString> commonNamesMapI18n;
00238 static QMap<QString, int> commonNamesIndexI18n;
00239
00240 static QHash<int, QString> sciNamesMapI18n;
00241 static QMap<QString, int> sciNamesIndexI18n;
00242
00243 QFont starFont;
00244 static bool flagSciNames;
00245 Vec3f labelColor;
00246
00247 StelTextureSP texPointer;
00248
00249 class StelObjectMgr* objectMgr;
00250
00251 QString starConfigFileFullPath;
00252 QVariantMap starSettings;
00253 QVariantList catalogsDescription;
00254 };
00255
00256
00257 #endif // _STARMGR_HPP_
00258