Документ взят из кэша поисковой машины. Адрес оригинального документа : http://astro.uni-altai.ru/~aw/stellarium/api/ConstellationMgr_8hpp_source.html
Дата изменения: Unknown
Дата индексирования: Fri Feb 28 07:52:16 2014
Кодировка:

Поисковые слова: п п п п п р п р п р п р п
Stellarium: core/modules/ConstellationMgr.hpp Source File
Stellarium 0.12.3
ConstellationMgr.hpp
1 /*
2  * Stellarium
3  * Copyright (C) 2002 Fabien Chereau
4  * Copyright (C) 2012 Timothy Reaves
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
19  */
20 
21 #ifndef _CONSTELLATIONMGR_HPP_
22 #define _CONSTELLATIONMGR_HPP_
23 
24 #include <vector>
25 #include <QString>
26 #include <QStringList>
27 #include <QFont>
28 
29 #include "StelObjectType.hpp"
30 #include "StelObjectModule.hpp"
31 #include "StelProjectorType.hpp"
32 
33 class StelToneReproducer;
34 class StarMgr;
35 class Constellation;
36 class StelProjector;
37 
43 {
44  Q_OBJECT
45  Q_PROPERTY(bool artDisplayed
46  READ getFlagArt
47  WRITE setFlagArt
48  NOTIFY artDisplayedChanged)
49  Q_PROPERTY(bool artFadeDuration
51  WRITE setArtFadeDuration
52  NOTIFY artFadeDurationChanged)
53  Q_PROPERTY(bool artIntensity
54  READ getArtIntensity
55  WRITE setArtIntensity
56  NOTIFY artIntensityChanged)
57  Q_PROPERTY(bool boundariesColor
59  WRITE setBoundariesColor
60  NOTIFY boundariesColorChanged)
61  Q_PROPERTY(bool boundariesDisplayed
63  WRITE setFlagBoundaries
64  NOTIFY boundariesDisplayedChanged)
65  Q_PROPERTY(bool fontSize
66  READ getFontSize
67  WRITE setFontSize
68  NOTIFY fontSizeChanged)
69  Q_PROPERTY(bool isolateSelected
72  NOTIFY isolateSelectedChanged)
73  Q_PROPERTY(bool linesColor
74  READ getLinesColor
75  WRITE setLinesColor
76  NOTIFY linesColorChanged)
77  Q_PROPERTY(bool linesDisplayed
78  READ getFlagLines
79  WRITE setFlagLines
80  NOTIFY linesDisplayedChanged)
81  Q_PROPERTY(bool namesColor
82  READ getLabelsColor
83  WRITE setLabelsColor
84  NOTIFY namesColorChanged)
85  Q_PROPERTY(bool namesDisplayed
86  READ getFlagLabels
87  WRITE setFlagLabels
88  NOTIFY namesDisplayedChanged)
89 
90 public:
92  ConstellationMgr(StarMgr *stars);
94  virtual ~ConstellationMgr();
95 
97  // Methods defined in the StelModule class
101  virtual void init();
102 
104  virtual void draw(StelCore* core, class StelRenderer* renderer);
105 
107  virtual void update(double deltaTime);
108 
112  virtual double getCallOrder(StelModuleActionName actionName) const;
113 
115  // Methods defined in StelObjectManager class
116  virtual QList<StelObjectP> searchAround(const Vec3d& v, double limitFov, const StelCore* core) const;
117 
120  virtual StelObjectP searchByNameI18n(const QString& nameI18n) const;
121 
124  virtual StelObjectP searchByName(const QString& name) const;
125 
130  virtual QStringList listMatchingObjectsI18n(const QString& objPrefix, int maxNbItem=5) const;
135  virtual QStringList listMatchingObjects(const QString& objPrefix, int maxNbItem=5) const;
136  virtual QStringList listAllObjects(bool inEnglish) const;
137  virtual QString getName() const { return "Constellations"; }
138 
140  // Properties setters and getters
141 public slots:
143  void setFlagArt(const bool displayed);
145  bool getFlagArt(void) const;
146 
148  void setArtFadeDuration(const float duration);
150  float getArtFadeDuration() const;
151 
153  void setArtIntensity(const double intensity);
155  double getArtIntensity() const;
156 
158  void setBoundariesColor(const Vec3f& color);
160  Vec3f getBoundariesColor() const;
161 
163  void setFlagBoundaries(const bool displayed);
165  bool getFlagBoundaries(void) const;
166 
168  void setFlagIsolateSelected(const bool isolate);
170  bool getFlagIsolateSelected(void) const;
171 
173  void setLinesColor(const Vec3f& color);
175  Vec3f getLinesColor() const;
176 
178  void setFlagLines(const bool displayed);
180  bool getFlagLines(void) const;
181 
183  void setLabelsColor(const Vec3f& color);
185  Vec3f getLabelsColor() const;
186 
188  void setFlagLabels(bool displayed);
190  bool getFlagLabels(void) const;
191 
193  void setFontSize(const float newFontSize);
195  float getFontSize() const;
196 
197 signals:
198  void artDisplayedChanged(const bool displayed) const;
199  void artFadeDurationChanged(const float duration) const;
200  void artIntensityChanged(const double intensity) const;
201  void boundariesColorChanged(const Vec3f & color) const;
202  void boundariesDisplayedChanged(const bool displayed) const;
203  void fontSizeChanged(const float newSize) const;
204  void isolateSelectedChanged(const bool isolate) const;
205  void linesColorChanged(const Vec3f & color) const;
206  void linesDisplayedChanged(const bool displayed) const;
207  void namesColorChanged(const Vec3f & color) const;
208  void namesDisplayedChanged(const bool displayed) const;
209 
210 private slots:
215  void selectedObjectChange(StelModule::StelModuleSelectAction action);
216 
218  void setStelStyle(const QString& section);
219 
222  void updateSkyCulture(const QString& skyCultureDir);
223 
228  void updateI18n();
229 
230 private:
233  void loadNames(const QString& namesFile);
234 
239  void loadLinesAndArt(const QString& fileName, const QString& artfileName, const QString& cultureName);
240 
254  bool loadBoundaries(const QString& conCatFile);
256  void drawLines(class StelRenderer* renderer, StelProjectorP projector, const StelCore* core) const;
261  void drawArt(class StelRenderer* renderer, StelProjectorP projector) const;
267  void drawNames(class StelRenderer* renderer, StelProjectorP projector, QFont& font) const;
272  void drawBoundaries(StelRenderer* renderer, StelProjectorP projector) const;
274  void setSelectedConst(Constellation* c);
276  void unsetSelectedConst(Constellation* c);
278  void setSelected(const QString& abbreviation);
280  StelObjectP setSelectedStar(const QString& abbreviation);
282  void setSelected(const StelObject* s) {if (!s) setSelectedConst(NULL); else setSelectedConst(isStarIn(s));}
284  void deselect() {setSelected(NULL);}
288  StelObject* getSelected(void) const;
290  void deselectConstellations(void);
291 
292  std::vector<Constellation*> selected; // More than one can be selected at a time
293 
294  Constellation* isStarIn(const StelObject *s) const;
295  Constellation* findFromAbbreviation(const QString& abbreviation) const;
296  std::vector<Constellation*> asterisms;
297  QFont asterFont;
298  StarMgr* hipStarMgr;
299 
300  bool isolateSelected;
301  std::vector<std::vector<Vec3f> *> allBoundarySegments;
302 
303  QString lastLoadedSkyCulture; // Store the last loaded sky culture directory name
304 
305  // These are THE master settings - individual constellation settings can vary based on selection status
306  float artFadeDuration;
307  float artIntensity;
308  bool artDisplayed;
309  bool boundariesDisplayed;
310  bool linesDisplayed;
311  bool namesDisplayed;
312 };
313 
314 #endif // _CONSTELLATIONMGR_HPP_