Stellarium 0.12.4
Main Page
Namespaces
Classes
Coding Style
Scripting
Plugins
Renderer
File Structure
File List
File Members
core
modules
StarWrapper.hpp
1
/*
2
* The big star catalogue extension to Stellarium:
3
* Author and Copyright: Johannes Gajdosik, 2006, 2007
4
*
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
18
*/
19
20
#ifndef _STARWRAPPER_HPP_
21
#define _STARWRAPPER_HPP_
22
23
#include <QString>
24
#include "StelObject.hpp"
25
#include "StelApp.hpp"
26
#include "StelCore.hpp"
27
#include "StarMgr.hpp"
28
#include "Star.hpp"
29
#include "StelSkyDrawer.hpp"
30
31
namespace
BigStarCatalogExtension {
32
33
template
<
class
Star>
class
SpecialZoneArray;
34
template
<
class
Star>
struct
SpecialZoneData;
35
36
44
class
StarWrapperBase
:
public
StelObject
45
{
46
protected
:
47
StarWrapperBase
(
void
) : ref_count(0) {;}
48
virtual
~
StarWrapperBase
(
void
) {;}
49
QString
getType
(
void
)
const
{
return
"Star"
;}
50
51
QString
getEnglishName
(
void
)
const
{
return
""
;}
52
QString
getNameI18n
(
void
)
const
= 0;
53
64
QString
getInfoString
(
const
StelCore
*core,
const
InfoStringGroup& flags)
const
;
65
virtual
float
getBV(
void
)
const
= 0;
66
67
private
:
68
int
ref_count;
69
};
70
71
template
<
class
Star>
class
StarWrapper
:
public
StarWrapperBase
72
{
73
protected
:
74
StarWrapper
(
const
SpecialZoneArray<Star>
*a,
75
const
SpecialZoneData<Star>
*z,
76
const
Star *s) : a(a), z(z), s(s) {;}
77
Vec3d
getJ2000EquatorialPos
(
const
StelCore
* core)
const
78
{
79
static
const
double
d2000 = 2451545.0;
80
Vec3f
v;
81
s->getJ2000Pos(z, (M_PI/180.)*(0.0001/3600.) * ((core->
getJDay
()-d2000)/365.25) / a->star_position_scale, v);
82
return
Vec3d
(v[0], v[1], v[2]);
83
}
84
Vec3f
getInfoColor
(
void
)
const
85
{
86
return
StelApp::getInstance
().
getVisionModeNight
() ?
Vec3f
(0.8, 0.0, 0.0) :
StelSkyDrawer::indexToColor
(s->bV);
87
}
88
float
getVMagnitude
(
const
StelCore
* core,
bool
withExtinction=
false
)
const
89
{
90
float
extinctionMag=0.0;
// track magnitude loss
91
if
(withExtinction && core->getSkyDrawer()->
getFlagHasAtmosphere
())
92
{
93
double
alt=
getAltAzPosApparent
(core)[2];
94
core->getSkyDrawer()->
getExtinction
().
forward
(&alt, &extinctionMag);
95
}
96
97
return
0.001f*a->
mag_min
+ s->mag*(0.001f*a->
mag_range
)/a->
mag_steps
+ extinctionMag;
98
}
99
float
getSelectPriority
(
const
StelCore
* core)
const
{
return
getVMagnitude
(core,
false
);}
100
float
getBV(
void
)
const
{
return
s->getBV();}
101
QString
getEnglishName
(
void
)
const
{
return
QString();}
102
QString
getNameI18n
(
void
)
const
{
return
s->getNameI18n();}
103
virtual
double
getAngularSize
(
const
StelCore
*)
const
{
return
0.;}
104
protected
:
105
const
SpecialZoneArray<Star>
*
const
a;
106
const
SpecialZoneData<Star>
*
const
z;
107
const
Star *
const
s;
108
};
109
110
111
class
StarWrapper1
:
public
StarWrapper
<Star1>
112
{
113
public
:
114
StarWrapper1
(
const
SpecialZoneArray<Star1>
*a,
115
const
SpecialZoneData<Star1>
*z,
116
const
Star1
*s) :
StarWrapper<Star1>
(a,z,s) {;}
117
132
QString
getInfoString
(
const
StelCore
*core,
const
InfoStringGroup& flags)
const
;
133
QString
getEnglishName
(
void
)
const
;
134
};
135
136
class
StarWrapper2
:
public
StarWrapper
<Star2>
137
{
138
public
:
139
StarWrapper2
(
const
SpecialZoneArray<Star2>
*a,
140
const
SpecialZoneData<Star2>
*z,
141
const
Star2
*s) :
StarWrapper<Star2>
(a,z,s) {;}
142
};
143
144
class
StarWrapper3
:
public
StarWrapper
<Star3>
145
{
146
public
:
147
StarWrapper3
(
const
SpecialZoneArray<Star3>
*a,
148
const
SpecialZoneData<Star3>
*z,
149
const
Star3
*s) :
StarWrapper<Star3>
(a,z,s) {;}
150
};
151
152
}
// namespace BigStarCatalogExtension
153
154
#endif // _STARWRAPPER_HPP_
Generated on Wed Sep 25 2013 22:30:30 for Stellarium by
1.8.3.1