StarWrapper.hpp   StarWrapper.hpp 
skipping to change at line 40 skipping to change at line 40
namespace BigStarCatalogExtension { namespace BigStarCatalogExtension {
template <class Star> struct SpecialZoneArray; template <class Star> struct SpecialZoneArray;
template <class Star> struct SpecialZoneData; template <class Star> struct SpecialZoneData;
//! @class StarWrapperBase //! @class StarWrapperBase
//! A Star (Star1,Star2,Star3,...) cannot be a StelObject. The additional //! A Star (Star1,Star2,Star3,...) cannot be a StelObject. The additional
//! overhead of having a dynamic type would simply be too much. //! overhead of having a dynamic type would simply be too much.
//! Therefore the StarWrapper is needed when returning Stars as StelObjects , e.g. for searching, and for constellations. //! Therefore the StarWrapper is needed when returning Stars as StelObjects , e.g. for searching, and for constellations.
//! The StarWrapper is destroyed when it is not needed anymore, by utilizin g reference counting and boost::intrusive_ptr. //! The StarWrapper is destroyed when it is not needed anymore, by utilizin g reference counting.
//! So there is no chance that more than a few hundreds of StarWrappers are alive simultanousely. //! So there is no chance that more than a few hundreds of StarWrappers are alive simultanousely.
//! Another reason for having the StarWrapper is to encapsulate the differe nces 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 "";}
skipping to change at line 68 skipping to change at line 68
//! <li> AltAzi //! <li> AltAzi
//! <li> PlainText </ul> //! <li> PlainText </ul>
//! @param core the StelCore object //! @param core the StelCore object
//! @param flags a set of InfoStringGroup items to include in the re turn value. //! @param flags a set of InfoStringGroup items to include in the re turn value.
//! @return a QString containing an HMTL encoded description of the StarWrapperBase. //! @return a QString containing an HMTL encoded description of the StarWrapperBase.
QString getInfoString(const StelCore *core, const InfoStringGroup& f lags) const; QString getInfoString(const StelCore *core, const InfoStringGroup& f 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 release(void) {Q_ASSERT(ref_count>0);if (--ref_count==0) delete
this;}
}; };
template <class Star> class StarWrapper : public StarWrapperBase template <class Star> 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* nav) const Vec3d getJ2000EquatorialPos(const StelNavigator* nav) const
{ {
const double d2000 = 2451545.0; static const double d2000 = 2451545.0;
return s->getJ2000Pos(z, (M_PI/180.)*(0.0001/3600.) * (( Vec3d v;
nav->getJDay()-d2000)/365.25) / a->star_position_scale); s->getJ2000Pos(z, (M_PI/180.)*(0.0001/3600.) * ((nav->getJDa
y()-d2000)/365.25) / a->star_position_scale, v);
return v;
} }
Vec3f getInfoColor(void) const Vec3f getInfoColor(void) const
{ {
return StelApp::getInstance().getVisionModeNight() ? Vec3f(0 .8, 0.2, 0.2) : StelSkyDrawer::indexToColor(s->bV); return StelApp::getInstance().getVisionModeNight() ? Vec3f(0 .8, 0.2, 0.2) : StelSkyDrawer::indexToColor(s->bV);
} }
float getVMagnitude(const StelNavigator *nav) const float getVMagnitude(const StelNavigator *nav) const
{ {
return 0.001f*a->mag_min + s->mag*(0.001f*a->mag_range)/a->m ag_steps; return 0.001f*a->mag_min + s->mag*(0.001f*a->mag_range)/a->m ag_steps;
} }
float getSelectPriority(const StelNavigator *nav) const {return getV Magnitude(nav);} float getSelectPriority(const StelNavigator *nav) const {return getV Magnitude(nav);}
skipping to change at line 131 skipping to change at line 131
//! @param flags a set of InfoStringGroup items to include in the re turn value. //! @param flags a set of InfoStringGroup items to include in the re turn value.
//! @return a QString containing an HMTL encoded description of the StarWrapper1. //! @return a QString containing an HMTL encoded description of the StarWrapper1.
QString getInfoString(const StelCore *core, const InfoStringGroup& f lags) const; QString getInfoString(const StelCore *core, const InfoStringGroup& f lags) const;
QString getEnglishName(void) 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. 5 change blocks. 
11 lines changed or deleted 10 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/