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

core/modules/Constellation.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 _CONSTELLATION_HPP_
00021 #define _CONSTELLATION_HPP_
00022 
00023 #include <vector>
00024 #include <QString>
00025 #include <QFont>
00026 
00027 #include "StelObject.hpp"
00028 #include "StelUtils.hpp"
00029 #include "StelFader.hpp"
00030 #include "StelTextureTypes.hpp"
00031 #include "StelSphereGeometry.hpp"
00032 
00033 class StarMgr;
00034 class StelPainter;
00035 
00041 class Constellation : public StelObject
00042 {
00043     friend class ConstellationMgr;
00044 private:
00045     Constellation();
00046     ~Constellation();
00047 
00048     // StelObject method to override
00055     virtual QString getInfoString(const StelCore*, const InfoStringGroup& flags) const
00056     {
00057         if (flags&Name) return getNameI18n() + "(" + getShortName() + ")";
00058         else return "";
00059     }
00060 
00063     virtual QString getType() const {return "Constellation";}
00064 
00066     virtual Vec3d getJ2000EquatorialPos(const StelNavigator*) const {return XYZname;}
00067 
00068     virtual double getAngularSize(const StelCore*) const {Q_ASSERT(0); return 0;} // TODO
00069 
00077     bool read(const QString& record, StarMgr *starMgr);
00078 
00080     void drawName(StelPainter& sPainter) const;
00082     void drawArt(StelPainter& sPainter) const;
00084     void drawBoundaryOptim(StelPainter& sPainter) const;
00085 
00091     const Constellation* isStarIn(const StelObject*) const;
00092 
00097     StelObjectP getBrightestStarInConstellation(void) const;
00098 
00100     QString getNameI18n() const {return nameI18;}
00102     QString getEnglishName() const {return abbreviation;}
00104     QString getShortName() const {return abbreviation;}
00108     void drawOptim(StelPainter& sPainter, const StelNavigator* nav, const SphericalCap& viewportHalfspace) const;
00110     void drawArtOptim(StelPainter& sPainter, const SphericalRegion& region) const;
00112     void update(int deltaTime);
00115     void setFlagLines(bool b) {lineFader=b;}
00118     void setFlagBoundaries(bool b) {boundaryFader=b;}
00121     void setFlagName(bool b) {nameFader=b;}
00124     void setFlagArt(bool b) {artFader=b;}
00127     bool getFlagLines() const {return lineFader;}
00130     bool getFlagBoundaries() const {return boundaryFader;}
00133     bool getFlagName() const {return nameFader;}
00136     bool getFlagArt() const {return artFader;}
00137 
00139     QString nameI18;
00141     QString englishName;
00143     QString nativeName;
00145     QString abbreviation;
00147     Vec3d XYZname;
00148     Vec3d XYname;
00150     unsigned int numberOfSegments;
00152     StelObjectP* asterism;
00153 
00154     StelTextureSP artTexture;
00155     StelVertexArray artPolygon;
00156     SphericalCap boundingCap;
00157 
00159     LinearFader artFader, lineFader, nameFader, boundaryFader;
00160     std::vector<std::vector<Vec3f> *> isolatedBoundarySegments;
00161     std::vector<std::vector<Vec3f> *> sharedBoundarySegments;
00162 
00164     static Vec3f lineColor;
00165     static Vec3f labelColor;
00166     static Vec3f boundaryColor;
00167 
00168     static bool singleSelected;
00169 };
00170 
00171 #endif // _CONSTELLATION_HPP_