StarWrapper.hpp   StarWrapper.hpp 
skipping to change at line 36 skipping to change at line 36
#include "StelNavigator.hpp" #include "StelNavigator.hpp"
#include "StarMgr.hpp" #include "StarMgr.hpp"
#include "Star.hpp" #include "Star.hpp"
#include "StelSkyDrawer.hpp" #include "StelSkyDrawer.hpp"
namespace BigStarCatalogExtension { namespace BigStarCatalogExtension {
template <class Star> struct SpecialZoneArray; template <class Star> struct SpecialZoneArray;
template <class Star> struct SpecialZoneData; template <class Star> struct SpecialZoneData;
// A Star (Star1,Star2,Star3,...) cannot be a StelObject. The additional //! @class StarWrapperBase
// overhead of having a dynamic type would simply be too much. //! A Star (Star1,Star2,Star3,...) cannot be a StelObject. The additional
// Therefore the StarWrapper is needed when returning Stars as StelObjects, //! overhead of having a dynamic type would simply be too much.
// e.g. for searching, and for constellations. //! Therefore the StarWrapper is needed when returning Stars as StelObjects
// The StarWrapper is destroyed when it is not needed anymore, by utilizing , e.g. for searching, and for constellations.
// reference counting and boost::intrusive_ptr. So there is no chance that //! The StarWrapper is destroyed when it is not needed anymore, by utilizin
// more than a few hundreds of StarWrappers are alive simultanousely. g reference counting and boost::intrusive_ptr.
// Another reason for having the StarWrapper is to encapsulate the differen //! So there is no chance that more than a few hundreds of StarWrappers are
ces alive simultanousely.
// between the different kinds of Stars (Star1,Star2,Star3). //! Another reason for having the StarWrapper is to encapsulate the differe
nces between the different kinds of Stars (Star1,Star2,Star3).
class StarWrapperBase : public StelObject { class StarWrapperBase : public StelObject
{
protected: protected:
StarWrapperBase(void) : ref_count(0) {} StarWrapperBase(void) : ref_count(0) {;}
virtual ~StarWrapperBase(void) {} virtual ~StarWrapperBase(void) {;}
QString getType(void) const {return "Star";} QString getType(void) const {return "Star";}
QString getEnglishName(void) const {return "";} QString getEnglishName(void) const {return "";}
QString getNameI18n(void) const = 0; QString getNameI18n(void) const = 0;
//! StarWrapperBase supports the following InfoStringGroup flags: //! StarWrapperBase supports the following InfoStringGroup flags <ul
//! - Name >
//! - Magnitude //! <li> Name
//! - RaDecJ2000 //! <li> Magnitude
//! - RaDec //! <li> RaDecJ2000
//! - AltAzi //! <li> RaDec
//! - PlainText //! <li> AltAzi
//! @param core the StelCore object //! <li> PlainText </ul>
//! @param flags a set of InfoStringGroup items to include in the return //! @param core the StelCore object
value. //! @param flags a set of InfoStringGroup items to include in the re
//! @return a QString containing an HMTL encoded description of the StarW turn value.
rapperBase. //! @return a QString containing an HMTL encoded description of the
//! is included in the return value. StarWrapperBase.
QString getInfoString(const StelCore *core, const InfoStringGroup& flags) QString getInfoString(const StelCore *core, const InfoStringGroup& f
const; lags) const;
virtual float getBV(void) const = 0; virtual float getBV(void) const = 0;
private: private:
int ref_count; int ref_count;
void retain(void) {Q_ASSERT(ref_count>=0);ref_count++;} void retain(void) {Q_ASSERT(ref_count>=0);++ref_count;}
void release(void) {Q_ASSERT(ref_count>0);if (--ref_count==0) delete this void release(void) {Q_ASSERT(ref_count>0);if (--ref_count==0) delete
;} this;}
}; };
template <class Star> template <class Star> class StarWrapper : public StarWrapperBase
class StarWrapper : public StarWrapperBase { {
protected: protected:
StarWrapper(const SpecialZoneArray<Star> *a, StarWrapper(const SpecialZoneArray<Star> *a,
const SpecialZoneData<Star> *z, const SpecialZoneData<Star> *z,
const Star *s) : a(a),z(z),s(s) {} const Star *s) : a(a), z(z), s(s) {;}
Vec3d getJ2000EquatorialPos(const StelNavigator*) const { Vec3d getJ2000EquatorialPos(const StelNavigator* nav) const
const double d2000 = 2451545.0; {
return s->getJ2000Pos(z, const double d2000 = 2451545.0;
(M_PI/180)*(0.0001/3600) return s->getJ2000Pos(z, (M_PI/180.)*(0.0001/3600.) * ((
* ((StarMgr::getCurrentJDay()-d2000)/365.25) nav->getJDay()-d2000)/365.25) / a->star_position_scale);
/ a->star_position_scale }
); Vec3f getInfoColor(void) const
} {
Vec3f getInfoColor(void) const {return StelApp::getInstance().getVisionMo return StelApp::getInstance().getVisionModeNight() ? Vec3f(0
deNight() ? Vec3f(0.8, 0.2, 0.2) : StelSkyDrawer::indexToColor(s->bV);} .8, 0.2, 0.2) : StelSkyDrawer::indexToColor(s->bV);
float getVMagnitude(const StelNavigator *nav) const }
{return 0.001f*a->mag_min + s->mag*(0.001f*a->mag_range)/a->mag_steps;} float getVMagnitude(const StelNavigator *nav) const
float getSelectPriority(const StelNavigator *nav) const {
{ return 0.001f*a->mag_min + s->mag*(0.001f*a->mag_range)/a->m
return getVMagnitude(nav); ag_steps;
} }
float getBV(void) const {return s->getBV();} float getSelectPriority(const StelNavigator *nav) const {return getV
QString getEnglishName(void) const { Magnitude(nav);}
return ""; float getBV(void) const {return s->getBV();}
} QString getEnglishName(void) const {return QString();}
QString getNameI18n(void) const { QString getNameI18n(void) const {return s->getNameI18n();}
return s->getNameI18n(); virtual double getAngularSize(const StelCore* core) const {return 0.
} ;}
virtual double getAngularSize(const StelCore* core) const {return 0.;}
protected: protected:
const SpecialZoneArray<Star> *const a; const SpecialZoneArray<Star> *const a;
const SpecialZoneData<Star> *const z; const SpecialZoneData<Star> *const z;
const Star *const s; const Star *const s;
}; };
class StarWrapper1 : public StarWrapper<Star1> { class StarWrapper1 : public StarWrapper<Star1>
{
public: public:
StarWrapper1(const SpecialZoneArray<Star1> *a, StarWrapper1(const SpecialZoneArray<Star1> *a,
const SpecialZoneData<Star1> *z, const SpecialZoneData<Star1> *z,
const Star1 *s) : StarWrapper<Star1>(a,z,s) {} const Star1 *s) : StarWrapper<Star1>(a,z,s) {;}
//! StarWrapper1 supports the following InfoStringGroup flags:
//! - Name //! StarWrapper1 supports the following InfoStringGroup flags: <ul>
//! - CatalogNumber //! <li> Name
//! - Magnitude //! <li> CatalogNumber
//! - RaDecJ2000 //! <li> Magnitude
//! - RaDec //! <li> RaDecJ2000
//! - AltAzi //! <li> RaDec
//! - Extra1 (spectral type) //! <li> AltAzi
//! - Distance //! <li> Extra1 (spectral type)
//! - Extra2 (parallax) //! <li> Distance
//! - PlainText //! <li> Extra2 (parallax)
//! @param core the StelCore object //! <li> PlainText </ul>
//! @param flags a set of InfoStringGroup items to include in the return //! @param core the StelCore object.
value. //! @param flags a set of InfoStringGroup items to include in the re
//! @return a QString containing an HMTL encoded description of the StarW turn value.
rapper1. //! @return a QString containing an HMTL encoded description of the
QString getInfoString(const StelCore *core, const InfoStringGroup& flags) StarWrapper1.
const; QString getInfoString(const StelCore *core, const InfoStringGroup& f
QString getEnglishName(void) const; lags) const;
QString getEnglishName(void) const;
}; };
class StarWrapper2 : public StarWrapper<Star2> { class StarWrapper2 : public StarWrapper<Star2>
{
public: public:
StarWrapper2(const SpecialZoneArray<Star2> *a, StarWrapper2(const SpecialZoneArray<Star2> *a,
const SpecialZoneData<Star2> *z, const SpecialZoneData<Star2> *z,
const Star2 *s) : StarWrapper<Star2>(a,z,s) {} const Star2 *s) : StarWrapper<Star2>(a,z,s) {;}
}; };
class StarWrapper3 : public StarWrapper<Star3> { class StarWrapper3 : public StarWrapper<Star3>
{
public: public:
StarWrapper3(const SpecialZoneArray<Star3> *a, StarWrapper3(const SpecialZoneArray<Star3> *a,
const SpecialZoneData<Star3> *z, const SpecialZoneData<Star3> *z,
const Star3 *s) : StarWrapper<Star3>(a,z,s) {} const Star3 *s) : StarWrapper<Star3>(a,z,s) {;}
}; };
} // namespace BigStarCatalogExtension } // namespace BigStarCatalogExtension
#endif // _STARWRAPPER_HPP_ #endif // _STARWRAPPER_HPP_
 End of changes. 14 change blocks. 
100 lines changed or deleted 105 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/