Документ взят из кэша поисковой машины. Адрес оригинального документа : http://astro.uni-altai.ru/~aw/stellarium/api/ZoneArray_8hpp_source.html
Дата изменения: Unknown
Дата индексирования: Fri Feb 28 07:37:01 2014
Кодировка:

Поисковые слова: п р п р п р п р п р р п п р п р п п р п
Stellarium: core/modules/ZoneArray.hpp Source File
Stellarium 0.12.3
ZoneArray.hpp
1 /*
2  * The big star catalogue extension to Stellarium:
3  * Author and Copyright: Johannes Gajdosik, 2006, 2007
4  * The implementation of SpecialZoneArray<Star>::draw is based on
5  * Stellarium, Copyright (C) 2002 Fabien Chereau,
6  * and therefore has shared copyright.
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
21  */
22 
23 #ifndef _ZONEARRAY_HPP_
24 #define _ZONEARRAY_HPP_
25 
26 #include <QString>
27 #include <QFile>
28 #include <QDebug>
29 
30 #include "ZoneData.hpp"
31 #include "Star.hpp"
32 
33 #include "StelCore.hpp"
34 #include "StarMgr.hpp"
35 #include "StelProjector.hpp"
36 #include "StelSkyDrawer.hpp"
37 
38 
39 #ifdef __OpenBSD__
40 #include <unistd.h>
41 #endif
42 
43 // Patch by Rainer Canavan for compilation on irix with mipspro compiler part 1
44 #ifndef MAP_NORESERVE
45 # ifdef MAP_AUTORESRV
46 # if (defined(__sgi) && defined(_COMPILER_VERSION))
47 # define MAP_NORESERVE MAP_AUTORESRV
48 # endif
49 # else
50 # define MAP_NORESERVE 0
51 # endif
52 #endif
53 
54 namespace BigStarCatalogExtension
55 {
56 
57 #define NR_OF_HIP 120416
58 #define FILE_MAGIC 0x835f040a
59 #define FILE_MAGIC_OTHER_ENDIAN 0x0a045f83
60 #define FILE_MAGIC_NATIVE 0x835f040b
61 #define MAX_MAJOR_FILE_VERSION 0
62 
67 {
68  const SpecialZoneArray<Star1> *a;
69  const SpecialZoneData<Star1> *z;
70  const Star1 *s;
71 };
72 
78 class ZoneArray
79 {
80 public:
87  static ZoneArray *create(const QString &extended_file_name, bool use_mmap);
88  virtual ~ZoneArray()
89  {
90  nr_of_zones = 0;
91  }
92 
94  unsigned int getNrOfStars() const { return nr_of_stars; }
95 
97  virtual void updateHipIndex(HipIndexStruct hipIndex[]) const {Q_UNUSED(hipIndex);}
98 
100  virtual void searchAround(const StelCore* core, int index,const Vec3d &v,double cosLimFov,
101  QList<StelObjectP> &result) = 0;
102 
104  virtual void draw(StelProjectorP projector, class StelRenderer* renderer, int index,
105  bool is_inside, const float *rcmag_table, StelCore* core,
106  unsigned int maxMagStarName,float names_brightness) const = 0;
107 
110  bool isInitialized(void) const { return (nr_of_zones>0); }
111 
113  void initTriangle(int index,
114  const Vec3f &c0,
115  const Vec3f &c1,
116  const Vec3f &c2);
117  virtual void scaleAxis(void) = 0;
118 
120  const QString fname;
121 
123  const int level;
124 
126  const int mag_min;
127 
129  const int mag_range;
130 
132  const int mag_steps;
133 
134  float star_position_scale;
135 
136 protected:
139  static bool readFile(QFile& file, void *data, qint64 size);
140 
142  ZoneArray(const QString& fname, QFile* file, int level, int mag_min, int mag_range, int mag_steps);
143  unsigned int nr_of_zones;
144  unsigned int nr_of_stars;
145  ZoneData *zones;
146  QFile* file;
147 };
148 
154 template<class Star>
155 class SpecialZoneArray : public ZoneArray
156 {
157 public:
166  SpecialZoneArray(QFile* file,bool byte_swap,bool use_mmap,int level,int mag_min,
167  int mag_range,int mag_steps);
168  ~SpecialZoneArray(void);
169 protected:
172  {
173  return static_cast<SpecialZoneData<Star>*>(zones);
174  }
175 
185  void draw(StelProjectorP projector, class StelRenderer* renderer, int index,
186  bool is_inside, const float *rcmag_table, StelCore* core,
187  unsigned int maxMagStarName,float names_brightness) const;
188 
189  void scaleAxis(void);
190  void searchAround(const StelCore* core, int index,const Vec3d &v,double cosLimFov,
191  QList<StelObjectP > &result);
192 
193  Star *stars;
194 private:
195  uchar *mmap_start;
196 };
197 
201 class HipZoneArray : public SpecialZoneArray<Star1>
202 {
203 public:
204  HipZoneArray(QFile* file,bool byte_swap,bool use_mmap,
205  int level,int mag_min,int mag_range,int mag_steps)
206  : SpecialZoneArray<Star1>(file,byte_swap,use_mmap,level,
208 
211  void updateHipIndex(HipIndexStruct hipIndex[]) const;
212 };
213 
214 } // namespace BigStarCatalogExtension
215 
216 #endif // _ZONEARRAY_HPP_