~ubuntu-branches/debian/jessie/stellarium/jessie

« back to all changes in this revision

Viewing changes to plugins/Quasars/src/Quasars.hpp

  • Committer: Package Import Robot
  • Author(s): Tomasz Buchert
  • Date: 2012-05-18 13:26:18 UTC
  • mfrom: (1.2.7)
  • Revision ID: package-import@ubuntu.com-20120518132618-3uso09fo68c218cx
Tags: 0.11.2-1
* Imported Upstream version 0.11.1 and then 0.11.2 (Closes: #658431)
* Change maintainer (Closes: #668916)
* Machine-readable copyright file
* Bump Standards-Version to 3.9.3
* Update debhelper compat to 9
* Fix lintian duplicate-font-file warning
* Fix copyright-refers-to-symlink-license lintian tag
* Add lintian override for embedded-library error

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2011 Alexander Wolf
 
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 _QUASARS_HPP_
 
20
#define _QUASARS_HPP_
 
21
 
 
22
#include "StelObjectModule.hpp"
 
23
#include "StelObject.hpp"
 
24
#include "StelTextureTypes.hpp"
 
25
#include "StelPainter.hpp"
 
26
#include "Quasar.hpp"
 
27
#include <QFont>
 
28
#include <QVariantMap>
 
29
#include <QDateTime>
 
30
#include <QList>
 
31
#include <QSharedPointer>
 
32
 
 
33
class StelPainter;
 
34
 
 
35
typedef QSharedPointer<Quasar> QuasarP;
 
36
 
 
37
//! This is an example of a plug-in which can be dynamically loaded into stellarium
 
38
class Quasars : public StelObjectModule
 
39
{
 
40
public: 
 
41
        Quasars();
 
42
        virtual ~Quasars();
 
43
 
 
44
        ///////////////////////////////////////////////////////////////////////////
 
45
        // Methods defined in the StelModule class
 
46
        virtual void init();
 
47
        virtual void deinit();
 
48
        virtual void update(double) {;}
 
49
        virtual void draw(StelCore* core);
 
50
        virtual void drawPointer(StelCore* core, StelPainter& painter);
 
51
        virtual double getCallOrder(StelModuleActionName actionName) const;
 
52
 
 
53
        ///////////////////////////////////////////////////////////////////////////
 
54
        // Methods defined in StelObjectManager class
 
55
        //! Used to get a list of objects which are near to some position.
 
56
        //! @param v a vector representing the position in th sky around which to search for nebulae.
 
57
        //! @param limitFov the field of view around the position v in which to search for satellites.
 
58
        //! @param core the StelCore to use for computations.
 
59
        //! @return an list containing the satellites located inside the limitFov circle around position v.
 
60
        virtual QList<StelObjectP> searchAround(const Vec3d& v, double limitFov, const StelCore* core) const;
 
61
 
 
62
        //! Return the matching satellite object's pointer if exists or NULL.
 
63
        //! @param nameI18n The case in-sensistive satellite name
 
64
        virtual StelObjectP searchByNameI18n(const QString& nameI18n) const;
 
65
 
 
66
        //! Return the matching satellite if exists or NULL.
 
67
        //! @param name The case in-sensistive standard program name
 
68
        virtual StelObjectP searchByName(const QString& name) const;
 
69
 
 
70
        //! Find and return the list of at most maxNbItem objects auto-completing the passed object I18n name.
 
71
        //! @param objPrefix the case insensitive first letters of the searched object
 
72
        //! @param maxNbItem the maximum number of returned object names
 
73
        //! @return a list of matching object name by order of relevance, or an empty list if nothing match
 
74
        virtual QStringList listMatchingObjectsI18n(const QString& objPrefix, int maxNbItem=5) const;
 
75
 
 
76
        //! get a Quasar object by identifier
 
77
        QuasarP getByID(const QString& id);
 
78
 
 
79
private:
 
80
        // Font used for displaying our text
 
81
        QFont font;
 
82
 
 
83
        //! replace the json file with the default from the compiled-in resource
 
84
        void restoreDefaultJsonFile(void);
 
85
 
 
86
        //! read the json file and create list of quasars.
 
87
        void readJsonFile(void);
 
88
 
 
89
        //! Creates a backup of the catalog.json file called catalog.json.old
 
90
        //! @param deleteOriginal if true, the original file is removed, else not
 
91
        //! @return true on OK, false on failure
 
92
        bool backupJsonFile(bool deleteOriginal=false);
 
93
 
 
94
        //! Get the version from the "version" value in the catalog.json file
 
95
        //! @return version string, e.g. "0.2.1"
 
96
        const QString getJsonFileVersion(void);
 
97
 
 
98
        //! parse JSON file and load quasars to map
 
99
        QVariantMap loadQSOMap(QString path=QString());
 
100
 
 
101
        //! set items for list of struct from data map
 
102
        void setQSOMap(const QVariantMap& map);
 
103
 
 
104
        QString catalogJsonPath;
 
105
 
 
106
        StelTextureSP texPointer;
 
107
        QList<QuasarP> QSO;
 
108
 
 
109
};
 
110
 
 
111
 
 
112
#include "fixx11h.h"
 
113
#include <QObject>
 
114
#include "StelPluginInterface.hpp"
 
115
 
 
116
//! This class is used by Qt to manage a plug-in interface
 
117
class QuasarsStelPluginInterface : public QObject, public StelPluginInterface
 
118
{
 
119
        Q_OBJECT
 
120
        Q_INTERFACES(StelPluginInterface)
 
121
public:
 
122
        virtual StelModule* getStelModule() const;
 
123
        virtual StelPluginInfo getPluginInfo() const;
 
124
};
 
125
 
 
126
#endif /*_QUASARS_HPP_*/