00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef _CONSTELLATIONMGR_HPP_
00022 #define _CONSTELLATIONMGR_HPP_
00023
00024 #include <vector>
00025 #include <QString>
00026 #include <QStringList>
00027 #include <QFont>
00028
00029 #include "StelObjectType.hpp"
00030 #include "StelObjectModule.hpp"
00031 #include "StelProjectorType.hpp"
00032
00033 class StelToneReproducer;
00034 class StarMgr;
00035 class Constellation;
00036 class StelProjector;
00037 class StelPainter;
00038
00043 class ConstellationMgr : public StelObjectModule
00044 {
00045 Q_OBJECT
00046 Q_PROPERTY(bool artDisplayed
00047 READ getFlagArt
00048 WRITE setFlagArt
00049 NOTIFY artDisplayedChanged)
00050 Q_PROPERTY(bool artFadeDuration
00051 READ getArtFadeDuration
00052 WRITE setArtFadeDuration
00053 NOTIFY artFadeDurationChanged)
00054 Q_PROPERTY(bool artIntensity
00055 READ getArtIntensity
00056 WRITE setArtIntensity
00057 NOTIFY artIntensityChanged)
00058 Q_PROPERTY(bool boundariesColor
00059 READ getBoundariesColor
00060 WRITE setBoundariesColor
00061 NOTIFY boundariesColorChanged)
00062 Q_PROPERTY(bool boundariesDisplayed
00063 READ getFlagBoundaries
00064 WRITE setFlagBoundaries
00065 NOTIFY boundariesDisplayedChanged)
00066 Q_PROPERTY(bool fontSize
00067 READ getFontSize
00068 WRITE setFontSize
00069 NOTIFY fontSizeChanged)
00070 Q_PROPERTY(bool isolateSelected
00071 READ getFlagIsolateSelected
00072 WRITE setFlagIsolateSelected
00073 NOTIFY isolateSelectedChanged)
00074 Q_PROPERTY(bool linesColor
00075 READ getLinesColor
00076 WRITE setLinesColor
00077 NOTIFY linesColorChanged)
00078 Q_PROPERTY(bool linesDisplayed
00079 READ getFlagLines
00080 WRITE setFlagLines
00081 NOTIFY linesDisplayedChanged)
00082 Q_PROPERTY(bool namesColor
00083 READ getLabelsColor
00084 WRITE setLabelsColor
00085 NOTIFY namesColorChanged)
00086 Q_PROPERTY(bool namesDisplayed
00087 READ getFlagLabels
00088 WRITE setFlagLabels
00089 NOTIFY namesDisplayedChanged)
00090
00091 public:
00093 ConstellationMgr(StarMgr *stars);
00095 virtual ~ConstellationMgr();
00096
00098
00102 virtual void init();
00103
00105 virtual void draw(StelCore* core);
00106
00108 virtual void update(double deltaTime);
00109
00113 virtual double getCallOrder(StelModuleActionName actionName) const;
00114
00116
00117 virtual QList<StelObjectP> searchAround(const Vec3d& v, double limitFov, const StelCore* core) const;
00118
00121 virtual StelObjectP searchByNameI18n(const QString& nameI18n) const;
00122
00125 virtual StelObjectP searchByName(const QString& name) const;
00126
00131 virtual QStringList listMatchingObjectsI18n(const QString& objPrefix, int maxNbItem=5) const;
00132
00134
00135 public slots:
00137 void setFlagArt(const bool displayed);
00139 bool getFlagArt(void) const;
00140
00142 void setArtFadeDuration(const float duration);
00144 float getArtFadeDuration() const;
00145
00147 void setArtIntensity(const double intensity);
00149 double getArtIntensity() const;
00150
00152 void setBoundariesColor(const Vec3f& color);
00154 Vec3f getBoundariesColor() const;
00155
00157 void setFlagBoundaries(const bool displayed);
00159 bool getFlagBoundaries(void) const;
00160
00162 void setFlagIsolateSelected(const bool isolate);
00164 bool getFlagIsolateSelected(void) const;
00165
00167 void setLinesColor(const Vec3f& color);
00169 Vec3f getLinesColor() const;
00170
00172 void setFlagLines(const bool displayed);
00174 bool getFlagLines(void) const;
00175
00177 void setLabelsColor(const Vec3f& color);
00179 Vec3f getLabelsColor() const;
00180
00182 void setFlagLabels(bool displayed);
00184 bool getFlagLabels(void) const;
00185
00187 void setFontSize(const float newFontSize);
00189 float getFontSize() const;
00190
00191 signals:
00192 void artDisplayedChanged(const bool displayed) const;
00193 void artFadeDurationChanged(const float duration) const;
00194 void artIntensityChanged(const double intensity) const;
00195 void boundariesColorChanged(const Vec3f & color) const;
00196 void boundariesDisplayedChanged(const bool displayed) const;
00197 void fontSizeChanged(const float newSize) const;
00198 void isolateSelectedChanged(const bool isolate) const;
00199 void linesColorChanged(const Vec3f & color) const;
00200 void linesDisplayedChanged(const bool displayed) const;
00201 void namesColorChanged(const Vec3f & color) const;
00202 void namesDisplayedChanged(const bool displayed) const;
00203
00204 private slots:
00209 void selectedObjectChange(StelModule::StelModuleSelectAction action);
00210
00212 void setStelStyle(const QString& section);
00213
00216 void updateSkyCulture(const QString& skyCultureDir);
00217
00222 void updateI18n();
00223
00224 private:
00227 void loadNames(const QString& namesFile);
00228
00233 void loadLinesAndArt(const QString& fileName, const QString& artfileName, const QString& cultureName);
00234
00248 bool loadBoundaries(const QString& conCatFile);
00250 void drawLines(StelPainter& sPainter, const StelCore* core) const;
00252 void drawArt(StelPainter& sPainter) const;
00254 void drawNames(StelPainter& sPainter) const;
00256 void drawBoundaries(StelPainter& sPainter) const;
00258 void setSelectedConst(Constellation* c);
00260 void unsetSelectedConst(Constellation* c);
00262 void setSelected(const QString& abbreviation);
00264 StelObjectP setSelectedStar(const QString& abbreviation);
00266 void setSelected(const StelObject* s) {if (!s) setSelectedConst(NULL); else setSelectedConst(isStarIn(s));}
00268 void deselect() {setSelected(NULL);}
00272 StelObject* getSelected(void) const;
00274 void deselectConstellations(void);
00275
00276 std::vector<Constellation*> selected;
00277
00278 Constellation* isStarIn(const StelObject *s) const;
00279 Constellation* findFromAbbreviation(const QString& abbreviation) const;
00280 std::vector<Constellation*> asterisms;
00281 QFont asterFont;
00282 StarMgr* hipStarMgr;
00283
00284 bool isolateSelected;
00285 std::vector<std::vector<Vec3f> *> allBoundarySegments;
00286
00287 QString lastLoadedSkyCulture;
00288
00289
00290 float artFadeDuration;
00291 float artIntensity;
00292 bool artDisplayed;
00293 bool boundariesDisplayed;
00294 bool linesDisplayed;
00295 bool namesDisplayed;
00296 };
00297
00298 #endif // _CONSTELLATIONMGR_HPP_