Документ взят из кэша поисковой машины. Адрес оригинального документа : http://astro.uni-altai.ru/~aw/stellarium/api/StarMgr_8hpp_source.html
Дата изменения: Unknown
Дата индексирования: Fri Feb 28 07:31:22 2014
Кодировка:
Stellarium: core/modules/StarMgr.hpp Source File
Stellarium 0.12.3
StarMgr.hpp
1 /*
2  * Stellarium
3  * Copyright (C) 2002 Fabien Chereau
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
18  */
19 
20 #ifndef _STARMGR_HPP_
21 #define _STARMGR_HPP_
22 
23 #include <QFont>
24 #include <QVariantMap>
25 #include "StelFader.hpp"
26 #include "StelObjectModule.hpp"
27 #include "StelProjectorType.hpp"
28 
29 class StelObject;
30 class StelToneReproducer;
31 class StelProjector;
32 class QSettings;
33 
34 namespace BigStarCatalogExtension {
35  class ZoneArray;
36  struct HipIndexStruct;
37 }
38 
39 static const int RCMAG_TABLE_SIZE = 4096;
40 
41 typedef struct
42 {
43  QString designation;
44  QString vtype;
45  float maxmag;
46  int mflag;
47  float min1mag;
48  float min2mag;
49  QString photosys;
50  double epoch;
51  double period;
52  int Mm;
53  QString stype;
54 } varstar;
55 
79 class StarMgr : public StelObjectModule
80 {
81  Q_OBJECT
82 
83 public:
84  StarMgr(void);
85  ~StarMgr(void);
86 
88  // Methods defined in the StelModule class
96  virtual void init();
97 
99  virtual void draw(StelCore* core, class StelRenderer* renderer);
100 
103  virtual void update(double deltaTime) {labelsFader.update((int)(deltaTime*1000)); starsFader.update((int)(deltaTime*1000));}
104 
106  virtual double getCallOrder(StelModuleActionName actionName) const;
107 
109  // Methods defined in StelObjectManager class
111  virtual QList<StelObjectP > searchAround(const Vec3d& v, double limitFov, const StelCore* core) const;
112 
116  virtual StelObjectP searchByNameI18n(const QString& nameI18n) const;
117 
120  virtual StelObjectP searchByName(const QString& name) const;
121 
126  virtual QStringList listMatchingObjectsI18n(const QString& objPrefix, int maxNbItem=5) const;
131  virtual QStringList listMatchingObjects(const QString& objPrefix, int maxNbItem=5) const;
132  // empty, as there's too much stars for displaying at once
133  virtual QStringList listAllObjects(bool inEnglish) const { Q_UNUSED(inEnglish) return QStringList(); }
134  virtual QString getName() const { return "Stars"; }
135 
136 public slots:
138  // Methods callable from script and GUI
140  void setLabelColor(const Vec3f& c) {labelColor = c;}
142  Vec3f getLabelColor(void) const {return labelColor;}
143 
145  void setFlagStars(bool b) {starsFader=b;}
147  bool getFlagStars(void) const {return starsFader==true;}
148 
150  void setFlagLabels(bool b) {labelsFader=b;}
152  bool getFlagLabels(void) const {return labelsFader==true;}
153 
157  void setLabelsAmount(float a) {labelsAmount=a;}
160  float getLabelsAmount(void) const {return labelsAmount;}
161 
163  void setFontSize(double newFontSize);
164 
166  static void setFlagSciNames(bool f) {flagSciNames = f;}
167  static bool getFlagSciNames(void) {return flagSciNames;}
168 
169 public:
171  // Other methods
176  StelObjectP searchHP(int hip) const;
177 
180  static QString getCommonName(int hip);
181 
184  static QString getSciName(int hip);
185 
188  static QString getSciAdditionalName(int hip);
189 
192  static QString getGcvsName(int hip);
193 
196  static QString getGcvsVariabilityType(int hip);
197 
200  static float getGcvsMaxMagnitude(int hip);
201 
204  static int getGcvsMagnitudeFlag(int hip);
205 
208  static float getGcvsMinMagnitude(int hip, bool firstMinimumFlag=true);
209 
212  static QString getGcvsPhotometricSystem(int hip);
213 
216  static double getGcvsEpoch(int hip);
217 
220  static double getGcvsPeriod(int hip);
221 
224  static int getGcvsMM(int hip);
225 
226  static QString convertToSpectralType(int index);
227  static QString convertToComponentIds(int index);
228 
229  QVariantList getCatalogsDescription() const {return catalogsDescription;}
230 
234  bool checkAndLoadCatalog(QVariantMap m);
235 
236 private slots:
237  void setStelStyle(const QString& section);
239  void updateI18n();
240 
244  void updateSkyCulture(const QString& skyCultureDir);
245 
246 private:
247 
248  void setCheckFlag(const QString& catalogId, bool b);
249 
250  void copyDefaultConfigFile();
251 
255  int loadCommonNames(const QString& commonNameFile);
256 
260  void loadSciNames(const QString& sciNameFile);
261 
264  void loadGcvs(const QString& GcvsFile);
265 
267  // TODO: add a non-lame description - what is the purpose of the max search level?
268  int getMaxSearchLevel() const;
269 
271  void loadData(QVariantMap starsConfigFile);
272 
274  void drawPointer(class StelRenderer* renderer, StelProjectorP projector, const StelCore* core);
275 
276  LinearFader labelsFader;
277  LinearFader starsFader;
278 
279  bool flagStarName;
280  float labelsAmount;
281  bool gravityLabel;
282 
283  int maxGeodesicGridLevel;
284  int lastMaxSearchLevel;
285  typedef QHash<int,BigStarCatalogExtension::ZoneArray*> ZoneArrayMap;
286  ZoneArrayMap zoneArrays; // index is the grid level
287  static void initTriangleFunc(int lev, int index,
288  const Vec3f &c0,
289  const Vec3f &c1,
290  const Vec3f &c2,
291  void *context)
292  {
293  reinterpret_cast<StarMgr*>(context)->initTriangle(lev, index, c0, c1, c2);
294  }
295 
296  void initTriangle(int lev, int index,
297  const Vec3f &c0,
298  const Vec3f &c1,
299  const Vec3f &c2);
300 
301  BigStarCatalogExtension::HipIndexStruct *hipIndex; // array of hiparcos stars
302 
303  static QHash<int, QString> commonNamesMap;
304  static QHash<int, QString> commonNamesMapI18n;
305  static QMap<QString, int> commonNamesIndexI18n;
306  static QMap<QString, int> commonNamesIndex;
307 
308  static QHash<int, QString> sciNamesMapI18n;
309  static QMap<QString, int> sciNamesIndexI18n;
310 
311  static QHash<int, QString> sciAdditionalNamesMapI18n;
312  static QMap<QString, int> sciAdditionalNamesIndexI18n;
313 
314  static QHash<int, varstar> varStarsMapI18n;
315  static QMap<QString, int> varStarsIndexI18n;
316 
317  QFont starFont;
318  static bool flagSciNames;
319  Vec3f labelColor;
320 
321  class StelTextureNew* texPointer; // The selection pointer texture
322 
323  class StelObjectMgr* objectMgr;
324 
325  QString starConfigFileFullPath;
326  QVariantMap starSettings;
327  QVariantList catalogsDescription;
328 };
329 
330 
331 #endif // _STARMGR_HPP_
332