2
* The big star catalogue extension to Stellarium:
3
* Author and Copyright: Johannes Gajdosik, 2006, 2007
5
* Thanks go to Nigel Kerr for ideas and testing of BE/LE star repacking
7
* This program is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU General Public License
9
* as published by the Free Software Foundation; either version 2
10
* of the License, or (at your option) any later version.
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License
18
* along with this program; if not, write to the Free Software
19
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25
#include "ZoneData.hpp"
27
#include <boost/intrusive_ptr.hpp>
34
namespace BigStarCatalogExtension {
37
typedef unsigned int Uint32;
38
typedef short int Int16;
39
typedef unsigned short int Uint16;
42
template <class Star> struct SpecialZoneArray;
43
template <class Star> struct SpecialZoneData;
46
// structs for storing the stars in binary form. The idea is
47
// to store much data for bright stars (Star1), but only little or even
48
// very little data for faints stars (Star3). Using only 6 bytes for Star3
49
// makes it feasable to store hundreds of millions of them in main memory.
53
static inline float IndexToBV(unsigned char b_v) {
54
return (float)b_v*(4.f/127.f)-0.5f;
57
#if (defined(__sgi) && defined(_COMPILER_VERSION) && !defined(__GNUC__))
60
struct Star1 { // 28 byte
61
int hip:24; // 17 bits needed
62
unsigned char component_ids; // 5 bits needed
63
Int32 x0; // 32 bits needed
64
Int32 x1; // 32 bits needed
65
unsigned char b_v; // 7 bits needed
66
unsigned char mag; // 8 bits needed
67
Uint16 sp_int; // 14 bits needed
69
enum {max_pos_val=0x7FFFFFFF};
70
boost::intrusive_ptr<StelObject>
71
createStelObject(const SpecialZoneArray<Star1> *a,
72
const SpecialZoneData<Star1> *z) const;
73
Vec3d getJ2000Pos(const ZoneData *z,double movement_factor) const {
75
+ (x0+movement_factor*dx0)*z->axis0
76
+ (x1+movement_factor*dx1)*z->axis1;
80
float getBV(void) const {return IndexToBV(b_v);}
81
std::wstring getNameI18n(void) const;
82
void repack(bool from_be);
86
__attribute__ ((__packed__))
89
#if (defined(__sgi) && defined(_COMPILER_VERSION) && !defined(__GNUC__))
94
#if (defined(__sgi) && defined(_COMPILER_VERSION) && !defined(__GNUC__))
97
struct Star2 { // 10 byte
104
enum {max_pos_val=((1<<19)-1)};
105
boost::intrusive_ptr<StelObject>
106
createStelObject(const SpecialZoneArray<Star2> *a,
107
const SpecialZoneData<Star2> *z) const;
108
Vec3d getJ2000Pos(const ZoneData *z,double movement_factor) const {
109
Vec3d pos = z->center
110
+ (x0+movement_factor*dx0)*z->axis0
111
+ (x1+movement_factor*dx1)*z->axis1;
115
float getBV(void) const {return IndexToBV(b_v);}
116
std::wstring getNameI18n(void) const {return L"";}
117
void repack(bool from_be);
120
#if defined(__GNUC__)
121
__attribute__ ((__packed__))
124
#if (defined(__sgi) && defined(_COMPILER_VERSION) && !defined(__GNUC__))
129
#if (defined(__sgi) && defined(_COMPILER_VERSION) && !defined(__GNUC__))
132
struct Star3 { // 6 byte
137
enum {max_pos_val=((1<<17)-1)};
138
boost::intrusive_ptr<StelObject>
139
createStelObject(const SpecialZoneArray<Star3> *a,
140
const SpecialZoneData<Star3> *z) const;
141
Vec3d getJ2000Pos(const ZoneData *z,double) const {
142
Vec3d pos = z->center + (double)(x0)*z->axis0 + (double)(x1)*z->axis1;
146
float getBV(void) const {return IndexToBV(b_v);}
147
std::wstring getNameI18n(void) const {return L"";}
148
void repack(bool from_be);
151
#if defined(__GNUC__)
152
__attribute__ ((__packed__))
155
#if (defined(__sgi) && defined(_COMPILER_VERSION) && !defined(__GNUC__))
159
} // namespace BigStarCatalogExtension