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 StelNavigator;
00034 class StelPainter;
00035 class QSettings;
00036
00037 namespace BigStarCatalogExtension {
00038 class ZoneArray;
00039 class HipIndexStruct;
00040 }
00041
00065 class StarMgr : public StelObjectModule
00066 {
00067 Q_OBJECT
00068
00069 public:
00070 StarMgr(void);
00071 ~StarMgr(void);
00072
00074
00082 virtual void init();
00083
00085 virtual void draw(StelCore* core);
00086
00089 virtual void update(double deltaTime) {labelsFader.update((int)(deltaTime*1000)); starsFader.update((int)(deltaTime*1000));}
00090
00092 virtual void updateI18n();
00093
00097 virtual void updateSkyCulture(const QString& skyCultureDir);
00098
00100 virtual void setStelStyle(const QString& section);
00101
00103 virtual double getCallOrder(StelModuleActionName actionName) const;
00104
00106
00108 virtual QList<StelObjectP > searchAround(const Vec3d& v, double limitFov, const StelCore* core) const;
00109
00113 virtual StelObjectP searchByNameI18n(const QString& nameI18n) const;
00114
00117 virtual StelObjectP searchByName(const QString& name) const;
00118
00123 virtual QStringList listMatchingObjectsI18n(const QString& objPrefix, int maxNbItem=5) const;
00124
00125 public slots:
00127
00129 void setLabelColor(const Vec3f& c) {labelColor = c;}
00131 Vec3f getLabelColor(void) const {return labelColor;}
00132
00134 void setFlagStars(bool b) {starsFader=b;}
00136 bool getFlagStars(void) const {return starsFader==true;}
00137
00139 void setFlagLabels(bool b) {labelsFader=b;}
00141 bool getFlagLabels(void) const {return labelsFader==true;}
00142
00146 void setLabelsAmount(float a) {labelsAmount=a;}
00149 float getLabelsAmount(void) const {return labelsAmount;}
00150
00152 void setFontSize(double newFontSize);
00153
00155 static void setFlagSciNames(bool f) {flagSciNames = f;}
00156 static bool getFlagSciNames(void) {return flagSciNames;}
00157
00158 public:
00160
00165 StelObjectP searchHP(int hip) const;
00166
00169 static QString getCommonName(int hip);
00170
00173 static QString getSciName(int hip);
00174
00175 static QString convertToSpectralType(int index);
00176 static QString convertToComponentIds(int index);
00177
00178 QVariantList getCatalogsDescription() const {return catalogsDescription;}
00179
00183 bool checkAndLoadCatalog(QVariantMap m);
00184
00185 private:
00186
00187 void setCheckFlag(const QString& catalogId, bool b);
00188
00189 void copyDefaultConfigFile();
00190
00194 int loadCommonNames(const QString& commonNameFile);
00195
00199 void loadSciNames(const QString& sciNameFile);
00200
00202
00203 int getMaxSearchLevel() const;
00204
00206 void loadData(QVariantMap starsConfigFile);
00207
00209 void drawPointer(StelPainter& sPainter, const StelNavigator * nav);
00210
00211 LinearFader labelsFader;
00212 LinearFader starsFader;
00213
00214 bool flagStarName;
00215 float labelsAmount;
00216 bool gravityLabel;
00217
00218 int maxGeodesicGridLevel;
00219 int lastMaxSearchLevel;
00220 typedef QHash<int,BigStarCatalogExtension::ZoneArray*> ZoneArrayMap;
00221 ZoneArrayMap zoneArrays;
00222 static void initTriangleFunc(int lev, int index,
00223 const Vec3f &c0,
00224 const Vec3f &c1,
00225 const Vec3f &c2,
00226 void *context)
00227 {
00228 reinterpret_cast<StarMgr*>(context)->initTriangle(lev, index, c0, c1, c2);
00229 }
00230
00231 void initTriangle(int lev, int index,
00232 const Vec3f &c0,
00233 const Vec3f &c1,
00234 const Vec3f &c2);
00235
00236 BigStarCatalogExtension::HipIndexStruct *hipIndex;
00237
00238 static QHash<int, QString> commonNamesMap;
00239 static QHash<int, QString> commonNamesMapI18n;
00240 static QMap<QString, int> commonNamesIndexI18n;
00241
00242 static QHash<int, QString> sciNamesMapI18n;
00243 static QMap<QString, int> sciNamesIndexI18n;
00244
00245 QFont starFont;
00246 static bool flagSciNames;
00247 Vec3f labelColor;
00248
00249 StelTextureSP texPointer;
00250
00251 class StelObjectMgr* objectMgr;
00252
00253 QString starConfigFileFullPath;
00254 QVariantMap starSettings;
00255 QVariantList catalogsDescription;
00256 };
00257
00258
00259 #endif // _STARMGR_HPP_
00260