Stellarium 0.11.4
Home · All Namespaces · All Classes · Functions · Coding Style · Scripting · Plugins · File Structure

core/modules/ConstellationMgr.hpp

00001 /*
00002  * Stellarium
00003  * Copyright (C) 2002 Fabien Chereau
00004  * Copyright (C) 2012 Timothy Reaves
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA  02110-1335, USA.
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     // Methods defined in the StelModule class
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     // Methods defined in StelObjectManager class
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     // Properties setters and getters
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; // More than one can be selected at a time
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;   // Store the last loaded sky culture directory name
00288 
00289     // These are THE master settings - individual constellation settings can vary based on selection status
00290     float artFadeDuration;
00291     float artIntensity;
00292     bool artDisplayed;
00293     bool boundariesDisplayed;
00294     bool linesDisplayed;
00295     bool namesDisplayed;
00296 };
00297 
00298 #endif // _CONSTELLATIONMGR_HPP_
Generated on Sat Aug 25 22:13:29 2012 for Stellarium by  doxygen 1.6.3