00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _STARWRAPPER_HPP_
00021 #define _STARWRAPPER_HPP_
00022
00023 #include <QString>
00024 #include "StelObject.hpp"
00025 #include "StelApp.hpp"
00026 #include "StelCore.hpp"
00027 #include "StarMgr.hpp"
00028 #include "Star.hpp"
00029 #include "StelSkyDrawer.hpp"
00030
00031 namespace BigStarCatalogExtension {
00032
00033 template <class Star> struct SpecialZoneArray;
00034 template <class Star> struct SpecialZoneData;
00035
00036
00044 class StarWrapperBase : public StelObject
00045 {
00046 protected:
00047 StarWrapperBase(void) : ref_count(0) {;}
00048 virtual ~StarWrapperBase(void) {;}
00049 QString getType(void) const {return "Star";}
00050
00051 QString getEnglishName(void) const {return "";}
00052 QString getNameI18n(void) const = 0;
00053
00064 QString getInfoString(const StelCore *core, const InfoStringGroup& flags) const;
00065 virtual float getBV(void) const = 0;
00066
00067 private:
00068 int ref_count;
00069 };
00070
00071 template <class Star> class StarWrapper : public StarWrapperBase
00072 {
00073 protected:
00074 StarWrapper(const SpecialZoneArray<Star> *a,
00075 const SpecialZoneData<Star> *z,
00076 const Star *s) : a(a), z(z), s(s) {;}
00077 Vec3d getJ2000EquatorialPos(const StelCore* core) const
00078 {
00079 static const double d2000 = 2451545.0;
00080 Vec3f v;
00081 s->getJ2000Pos(z, (M_PI/180.)*(0.0001/3600.) * ((core->getJDay()-d2000)/365.25) / a->star_position_scale, v);
00082 return Vec3d(v[0], v[1], v[2]);
00083 }
00084 Vec3f getInfoColor(void) const
00085 {
00086 return StelApp::getInstance().getVisionModeNight() ? Vec3f(0.8, 0.0, 0.0) : StelSkyDrawer::indexToColor(s->bV);
00087 }
00088 float getVMagnitude(const StelCore* core, bool withExtinction=false) const
00089 {
00090 float extinctionMag=0.0;
00091 if (withExtinction && core->getSkyDrawer()->getFlagHasAtmosphere())
00092 {
00093 double alt=getAltAzPosApparent(core)[2];
00094 core->getSkyDrawer()->getExtinction().forward(&alt, &extinctionMag);
00095 }
00096
00097 return 0.001f*a->mag_min + s->mag*(0.001f*a->mag_range)/a->mag_steps + extinctionMag;
00098 }
00099 float getSelectPriority(const StelCore* core) const {return getVMagnitude(core, false);}
00100 float getBV(void) const {return s->getBV();}
00101 QString getEnglishName(void) const {return QString();}
00102 QString getNameI18n(void) const {return s->getNameI18n();}
00103 virtual double getAngularSize(const StelCore*) const {return 0.;}
00104 protected:
00105 const SpecialZoneArray<Star> *const a;
00106 const SpecialZoneData<Star> *const z;
00107 const Star *const s;
00108 };
00109
00110
00111 class StarWrapper1 : public StarWrapper<Star1>
00112 {
00113 public:
00114 StarWrapper1(const SpecialZoneArray<Star1> *a,
00115 const SpecialZoneData<Star1> *z,
00116 const Star1 *s) : StarWrapper<Star1>(a,z,s) {;}
00117
00132 QString getInfoString(const StelCore *core, const InfoStringGroup& flags) const;
00133 QString getEnglishName(void) const;
00134 };
00135
00136 class StarWrapper2 : public StarWrapper<Star2>
00137 {
00138 public:
00139 StarWrapper2(const SpecialZoneArray<Star2> *a,
00140 const SpecialZoneData<Star2> *z,
00141 const Star2 *s) : StarWrapper<Star2>(a,z,s) {;}
00142 };
00143
00144 class StarWrapper3 : public StarWrapper<Star3>
00145 {
00146 public:
00147 StarWrapper3(const SpecialZoneArray<Star3> *a,
00148 const SpecialZoneData<Star3> *z,
00149 const Star3 *s) : StarWrapper<Star3>(a,z,s) {;}
00150 };
00151
00152 }
00153
00154 #endif // _STARWRAPPER_HPP_