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