Home · All Namespaces · All Classes · Functions · Coding Style · Plugins · File Structure

modules/ConstellationMgr.hpp

00001 /*
00002  * Stellarium
00003  * Copyright (C) 2002 Fabien Chereau
00004  * 
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * as published by the Free Software Foundation; either version 2
00008  * of the License, or (at your option) any later version.
00009  * 
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  * 
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00018  */
00019 
00020 #ifndef _CONSTELLATIONMGR_HPP_
00021 #define _CONSTELLATIONMGR_HPP_
00022 
00023 #include <vector>
00024 #include <QString>
00025 #include <QStringList>
00026 
00027 #include "StelObjectType.hpp"
00028 #include "StelObjectModule.hpp"
00029 #include "StelProjectorType.hpp"
00030 
00031 class StelToneReproducer;
00032 class StarMgr;
00033 class Constellation;
00034 class StelProjector;
00035 class StelNavigator;
00036 class StelFont;
00037 class StelPainter;
00038 
00043 class ConstellationMgr : public StelObjectModule
00044 {
00045     Q_OBJECT
00046     
00047 public:
00049     ConstellationMgr(StarMgr *stars);
00051     virtual ~ConstellationMgr();
00052 
00054     // Methods defined in the StelModule class
00058     virtual void init();
00059     
00061     virtual void draw(StelCore* core); 
00062     
00064     virtual void update(double deltaTime);
00065     
00070     virtual void updateI18n();
00071     
00074     virtual void updateSkyCulture(const QString& skyCultureDir);
00075     
00080     virtual void selectedObjectChangeCallBack(StelModuleSelectAction action = StelModule::ReplaceSelection);
00081     
00083     virtual void setStelStyle(const StelStyle& style);
00084     
00088     virtual double getCallOrder(StelModuleActionName actionName) const;
00089     
00091     // Methods defined in StelObjectManager class
00092     virtual QList<StelObjectP> searchAround(const Vec3d& v, double limitFov, const StelCore* core) const;
00093     
00096     virtual StelObjectP searchByNameI18n(const QString& nameI18n) const;
00097     
00100     virtual StelObjectP searchByName(const QString& name) const;
00101 
00106     virtual QStringList listMatchingObjectsI18n(const QString& objPrefix, int maxNbItem=5) const;
00107     
00109     // Properties setters and getters
00110 public slots:
00112     void setArtFadeDuration(float duration);
00114     float getArtFadeDuration() const {return artFadeDuration;}
00115         
00117     void setArtIntensity(double d);
00119     double getArtIntensity() const {return artMaxIntensity;}
00120     
00122     void setFlagArt(bool b);
00124     bool getFlagArt(void) const {return flagArt;}
00125     
00127     void setFlagLines(bool b);
00129     bool getFlagLines(void) const {return flagLines;}
00130     
00132     void setFlagBoundaries(bool b);
00134     bool getFlagBoundaries(void) const {return flagBoundaries;}
00135     
00137     void setFlagLabels(bool b);
00139     bool getFlagLabels(void) const {return flagNames;}
00140     
00142     void setFlagIsolateSelected(bool s) { isolateSelected = s; }
00144     bool getFlagIsolateSelected(void) const { return isolateSelected;}
00145     
00147     void setLinesColor(const Vec3f& c);
00149     Vec3f getLinesColor() const;
00150     
00152     void setBoundariesColor(const Vec3f& c);
00154     Vec3f getBoundariesColor() const;
00155         
00157     void setLabelsColor(const Vec3f& c);
00159     Vec3f getLabelsColor() const;
00160     
00162     void setFontSize(double newFontSize);
00164     double getFontSize() const;
00165     
00166 private:
00169     void loadNames(const QString& namesFile);
00170     
00175     void loadLinesAndArt(const QString& fileName, const QString& artfileName, const QString& cultureName);
00176     
00190     bool loadBoundaries(const QString& conCatFile);
00192     void drawLines(const StelPainter& sPainter, const StelNavigator* nav) const;
00194     void drawArt(const StelProjectorP& prj, const StelNavigator * nav) const;
00196     void drawNames(const StelPainter& sPainter) const;
00198     void drawBoundaries(const StelProjectorP& prj) const;   
00200     void setSelectedConst(Constellation* c);
00202     void unsetSelectedConst(Constellation* c);
00204     void setSelected(const QString& abbreviation);
00206     StelObjectP setSelectedStar(const QString& abbreviation);
00208     void setSelected(const StelObject* s) {if (!s) setSelectedConst(NULL); else setSelectedConst(isStarIn(s));}
00210     void deselect() {setSelected(NULL);}
00214     StelObject* getSelected(void) const;
00215     
00216     std::vector<Constellation*> selected; // More than one can be selected at a time
00217     
00218     Constellation* isStarIn(const StelObject *s) const;
00219     Constellation* findFromAbbreviation(const QString& abbreviation) const;     
00220     std::vector<Constellation*> asterisms;
00221     double fontSize;
00222     StelFont* asterFont;
00223     StarMgr* hipStarMgr;
00224 
00225     bool isolateSelected;
00226     std::vector<std::vector<Vec3f> *> allBoundarySegments;
00227 
00228     QString lastLoadedSkyCulture;   // Store the last loaded sky culture directory name
00229     
00230     // These are THE master settings - individual constellation settings can vary based on selection status
00231     bool flagNames;
00232     bool flagLines;
00233     bool flagArt;
00234     bool flagBoundaries;
00235     float artFadeDuration;
00236     float artMaxIntensity;
00237 };
00238 
00239 #endif // _CONSTELLATIONMGR_HPP_

Generated on Mon Mar 9 16:16:16 2009 for Stellarium by  doxygen 1.5.5