Stellarium 0.15.2
Ocular.hpp
1 /*
2  * Copyright (C) 2009 Timothy Reaves
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
17  */
18 
19 #ifndef OCULAR_HPP_
20 #define OCULAR_HPP_
21 
22 #include <QDebug>
23 #include <QObject>
24 #include <QString>
25 #include <QSettings>
26 
27 class Telescope;
28 class Lens;
29 
31 class Ocular : public QObject
32 {
33  Q_OBJECT
34  Q_PROPERTY(bool binoculars READ isBinoculars WRITE setBinoculars)
35  Q_PROPERTY(bool permanentCrosshair READ hasPermanentCrosshair WRITE setPermanentCrosshair)
36  Q_PROPERTY(double appearentFOV READ appearentFOV WRITE setAppearentFOV)
37  Q_PROPERTY(double effectiveFocalLength READ effectiveFocalLength WRITE setEffectiveFocalLength)
38  Q_PROPERTY(double fieldStop READ fieldStop WRITE setFieldStop)
39  Q_PROPERTY(QString name READ name WRITE setName)
40  Q_PROPERTY(QString reticlePath READ reticlePath WRITE setReticlePath)
41 public:
42  Ocular();
43  Q_INVOKABLE Ocular(const QObject& other);
44  virtual ~Ocular();
45  static Ocular * ocularFromSettings(const QSettings * theSettings, const int ocularIndex);
46  void writeToSettings(QSettings * settings, const int index);
47  static Ocular * ocularModel(void);
48 
49  bool isBinoculars(void) const;
50  void setBinoculars(const bool flag);
51  bool hasPermanentCrosshair(void) const;
52  void setPermanentCrosshair(const bool flag);
53  double appearentFOV(void) const;
54  void setAppearentFOV(const double fov);
55  double effectiveFocalLength(void) const;
56  void setEffectiveFocalLength(const double fl);
57  double fieldStop(void) const;
58  void setFieldStop(const double fs);
59  QString name(void) const;
60  void setName(const QString aName);
61  QString reticlePath(void) const;
62  void setReticlePath(const QString path);
63 
64  double actualFOV(const Telescope * telescope, const Lens *lens) const;
65  double magnification(const Telescope * telescope, const Lens *lens) const;
66  QMap<int, QString> propertyMap(void);
67 
68 private:
69  bool m_binoculars;
70  bool m_permanetCrosshair;
71  double m_appearentFOV;
72  double m_effectiveFocalLength;
73  double m_fieldStop;
74  QString m_name;
75  QString m_reticlePath;
76 };
77 
78 
79 #endif /* OCULAR_HPP_ */
Definition: Lens.hpp:31