![]() |
Home · All Namespaces · All Classes · Functions · Coding Style · Plugins · File Structure |
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 00073 virtual void updateSkyCulture(); 00074 00079 virtual void selectedObjectChangeCallBack(StelModuleSelectAction action = StelModule::ReplaceSelection); 00080 00082 virtual void setStelStyle(const StelStyle& style); 00083 00087 virtual double getCallOrder(StelModuleActionName actionName) const; 00088 00090 // Methods defined in StelObjectManager class 00091 virtual QList<StelObjectP> searchAround(const Vec3d& v, double limitFov, const StelCore* core) const; 00092 00095 virtual StelObjectP searchByNameI18n(const QString& nameI18n) const; 00096 00099 virtual StelObjectP searchByName(const QString& name) const; 00100 00105 virtual QStringList listMatchingObjectsI18n(const QString& objPrefix, int maxNbItem=5) const; 00106 00108 // Properties setters and getters 00109 public slots: 00111 void setArtFadeDuration(float duration); 00113 float getArtFadeDuration() const {return artFadeDuration;} 00114 00116 void setArtIntensity(double d); 00118 double getArtIntensity() const {return artMaxIntensity;} 00119 00121 void setFlagArt(bool b); 00123 bool getFlagArt(void) const {return flagArt;} 00124 00126 void setFlagLines(bool b); 00128 bool getFlagLines(void) const {return flagLines;} 00129 00131 void setFlagBoundaries(bool b); 00133 bool getFlagBoundaries(void) const {return flagBoundaries;} 00134 00136 void setFlagLabels(bool b); 00138 bool getFlagLabels(void) const {return flagNames;} 00139 00141 void setFlagIsolateSelected(bool s) { isolateSelected = s; } 00143 bool getFlagIsolateSelected(void) const { return isolateSelected;} 00144 00146 void setLinesColor(const Vec3f& c); 00148 Vec3f getLinesColor() const; 00149 00151 void setBoundariesColor(const Vec3f& c); 00153 Vec3f getBoundariesColor() const; 00154 00156 void setLabelsColor(const Vec3f& c); 00158 Vec3f getLabelsColor() const; 00159 00161 void setFontSize(double newFontSize); 00163 double getFontSize() const; 00164 00165 private: 00168 void loadNames(const QString& namesFile); 00169 00174 void loadLinesAndArt(const QString& fileName, const QString& artfileName, const QString& cultureName); 00175 00189 bool loadBoundaries(const QString& conCatFile); 00191 void drawLines(const StelProjectorP& prj) const; 00193 void drawArt(const StelProjectorP& prj, const StelNavigator * nav) const; 00195 void drawNames(const StelPainter& sPainter) const; 00197 void drawBoundaries(const StelProjectorP& prj) const; 00199 void setSelectedConst(Constellation* c); 00201 void unsetSelectedConst(Constellation* c); 00203 void setSelected(const QString& abbreviation); 00205 StelObjectP setSelectedStar(const QString& abbreviation); 00207 void setSelected(const StelObject* s) {if (!s) setSelectedConst(NULL); else setSelectedConst(isStarIn(s));} 00209 void deselect() {setSelected(NULL);} 00213 StelObject* getSelected(void) const; 00214 00215 std::vector<Constellation*> selected; // More than one can be selected at a time 00216 00217 Constellation* isStarIn(const StelObject *s) const; 00218 Constellation* findFromAbbreviation(const QString& abbreviation) const; 00219 std::vector<Constellation*> asterisms; 00220 double fontSize; 00221 StelFont* asterFont; 00222 StarMgr* hipStarMgr; 00223 00224 bool isolateSelected; 00225 std::vector<std::vector<Vec3f> *> allBoundarySegments; 00226 00227 QString lastLoadedSkyCulture; // Store the last loaded sky culture directory name 00228 00229 // These are THE master settings - individual constellation settings can vary based on selection status 00230 bool flagNames; 00231 bool flagLines; 00232 bool flagArt; 00233 bool flagBoundaries; 00234 float artFadeDuration; 00235 float artMaxIntensity; 00236 }; 00237 00238 #endif // _CONSTELLATIONMGR_HPP_