Документ взят из кэша поисковой машины. Адрес оригинального документа : http://astro.uni-altai.ru/~aw/stellarium/api/Oculars_8hpp_source.html
Дата изменения: Unknown
Дата индексирования: Fri Feb 28 07:32:09 2014
Кодировка:
Stellarium: /home/aw/devel/stellarium/trunk/plugins/Oculars/src/Oculars.hpp Source File
Stellarium 0.12.3
Oculars.hpp
1 /*
2  * Copyright (C) 2009 Timothy Reaves
3  * Copyright (C) 2011 Bogdan Marinov
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 _OCULARS_HPP_
21 #define _OCULARS_HPP_
22 
23 #include "VecMath.hpp"
24 #include "StelModule.hpp"
25 #include "OcularDialog.hpp"
26 #include "CCD.hpp"
27 #include "Ocular.hpp"
28 #include "Telescope.hpp"
29 #include "Lens.hpp"
30 
31 #include <QFont>
32 #include <QSettings>
33 
34 #define MIN_OCULARS_INI_VERSION 0.12
35 
36 QT_BEGIN_NAMESPACE
37 class QAction;
38 class QKeyEvent;
39 class QMenu;
40 class QMouseEvent;
41 class QPixmap;
42 class QSettings;
43 class QSignalMapper;
44 QT_END_NAMESPACE
45 
46 class StelButton;
47 
49 class Oculars : public StelModule
50 {
51  Q_OBJECT
52  //BM: Temporary, until the GUI is finalized and some other method of getting
53  //info from the main class is implemented.
54  friend class OcularsGuiPanel;
55 
56 public:
57  Oculars();
58  virtual ~Oculars();
59  static QSettings* appSettings();
60 
62  // Methods defined in the StelModule class
63  virtual void init();
64  virtual void deinit();
65  virtual bool configureGui(bool show=true);
66  virtual void draw(StelCore* core, class StelRenderer* renderer);
67  virtual double getCallOrder(StelModuleActionName actionName) const;
70  virtual const StelStyle getModuleStyleSheet(const StelStyle& style);
74  virtual void handleKeys(class QKeyEvent* event);
75  virtual void handleMouseClicks(class QMouseEvent* event);
76  virtual void update(double) {;}
77 
78  QString getDimensionsString(double fovX, double fovY) const;
79  QString getFOVString(double fov) const;
80 
81 public slots:
85  void updateLists();
86  void ccdRotationReset();
87  void decrementCCDIndex();
88  void decrementOcularIndex();
89  void decrementTelescopeIndex();
90  void decrementLensIndex();
91  void displayPopupMenu();
94  void enableOcular(bool b);
95  void incrementCCDIndex();
96  void incrementOcularIndex();
97  void incrementTelescopeIndex();
98  void incrementLensIndex();
99  void disableLens();
100  void rotateCCD(QString amount);
101  void selectCCDAtIndex(QString indexString);
102  void selectOcularAtIndex(QString indexString);
103  void selectTelescopeAtIndex(QString indexString);
104  void selectLensAtIndex(QString indexString);
105 
106  void toggleCCD(bool show);
108  void toggleCCD();
109  void toggleCrosshairs(bool show = true);
111  void toggleTelrad(bool show);
113  void toggleTelrad();
114  void enableGuiPanel(bool enable = true);
115 
116  void setFlagDecimalDegrees(const bool b);
117  bool getFlagDecimalDegrees(void) const;
118 
119 signals:
120  void selectedCCDChanged();
121  void selectedOcularChanged();
122  void selectedTelescopeChanged();
123  void selectedLensChanged();
124 
125 private slots:
127  void instrumentChanged();
128  void determineMaxEyepieceAngle();
129  void setRequireSelection(bool state);
130  void setScaleImageCircle(bool state);
131  void setScreenFOVForCCD();
132  void retranslateGui();
133  void setStelStyle(const QString& style);
134 
135 private:
137  void initializeActivationActions();
138 
140  bool isBinocularDefined();
141 
143  void paintCCDBounds(class StelRenderer* renderer);
145  void paintCrosshairs(class StelRenderer* renderer);
147  void paintOcularMask(class StelRenderer* renderer);
149  void paintTelrad(class StelRenderer* renderer);
150 
151 
154  void paintText(const StelCore* core, StelRenderer* renderer);
155 
157  void unzoomOcular();
158 
165  void validateAndLoadIniFile();
166 
170  void zoom(bool zoomedIn);
171 
173  void zoomOcular();
174 
175  void hideUsageMessageIfDisplayed();
176 
178  QMenu* addLensSubmenu(QMenu* parent);
179 
181  QMenu* addTelescopeSubmenu(QMenu* parent);
182 
184  Lens* selectedLens();
185 
187  QList<CCD *> ccds;
188  QList<Ocular *> oculars;
189  QList<Telescope *> telescopes;
190  QList<Lens *> lense;
191 
192  int selectedCCDIndex;
193  int selectedOcularIndex;
194  int selectedTelescopeIndex;
195  int selectedLensIndex;
196 
197  QFont font;
198  bool flagShowCCD;
199  bool flagShowOculars;
200  bool flagShowCrosshairs;
201  bool flagShowTelrad;
202  int usageMessageLabelID;
203 
204  bool flagAzimuthalGrid;
205  bool flagGalacticGrid;
206  bool flagEquatorGrid;
207  bool flagEquatorJ2000Grid;
208  bool flagEquatorLine;
209  bool flagEclipticLine;
210  bool flagEclipticJ2000Grid;
211  bool flagMeridianLine;
212  bool flagHorizonLine;
213  bool flagGalacticPlaneLine;
214  bool flagAdaptation;
215 
216  double ccdRotationAngle;
217  double maxEyepieceAngle;
218  bool requireSelection;
219  bool useMaxEyepieceAngle;
220 
221  bool guiPanelEnabled;
222  bool flagDecimalDegrees;
223 
224  QSignalMapper* ccdRotationSignalMapper;
225  QSignalMapper* ccdsSignalMapper;
226  QSignalMapper* ocularsSignalMapper;
227  QSignalMapper* telescopesSignalMapper;
228  QSignalMapper* lenseSignalMapper;
229 
230  // for toolbar button
231  QPixmap* pxmapGlow;
232  QPixmap* pxmapOnIcon;
233  QPixmap* pxmapOffIcon;
234  StelButton* toolbarButton;
235 
236  OcularDialog *ocularDialog;
237  bool ready;
238 
239  QAction* actionShowOcular;
240  QAction* actionShowCrosshairs;
241  QAction* actionShowSensor;
242  QAction* actionShowTelrad;
243  QAction* actionConfiguration;
244  QAction* actionMenu;
245  QAction* actionTelescopeIncrement;
246  QAction* actionTelescopeDecrement;
247  QAction* actionOcularIncrement;
248  QAction* actionOcularDecrement;
249 
250  class OcularsGuiPanel* guiPanel;
251 
252  //Styles
253  QByteArray normalStyleSheet;
254  QByteArray nightStyleSheet;
255 };
256 
257 
258 #include "fixx11h.h"
259 #include <QObject>
260 #include "StelPluginInterface.hpp"
261 
263 class OcularsStelPluginInterface : public QObject, public StelPluginInterface
264 {
265  Q_OBJECT
266  Q_INTERFACES(StelPluginInterface)
267 public:
268  virtual StelModule* getStelModule() const;
269  virtual StelPluginInfo getPluginInfo() const;
270 };
271 
272 #endif /*_OCULARS_HPP_*/