2
* Copyright (C) 2011 Alexander Wolf
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.
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.
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.
22
#include "StelObjectModule.hpp"
23
#include "StelObject.hpp"
24
#include "StelTextureTypes.hpp"
25
#include "StelPainter.hpp"
28
#include <QVariantMap>
31
#include <QSharedPointer>
35
typedef QSharedPointer<Quasar> QuasarP;
37
//! This is an example of a plug-in which can be dynamically loaded into stellarium
38
class Quasars : public StelObjectModule
44
///////////////////////////////////////////////////////////////////////////
45
// Methods defined in the StelModule class
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;
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;
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;
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;
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;
76
//! get a Quasar object by identifier
77
QuasarP getByID(const QString& id);
80
// Font used for displaying our text
83
//! replace the json file with the default from the compiled-in resource
84
void restoreDefaultJsonFile(void);
86
//! read the json file and create list of quasars.
87
void readJsonFile(void);
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);
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);
98
//! parse JSON file and load quasars to map
99
QVariantMap loadQSOMap(QString path=QString());
101
//! set items for list of struct from data map
102
void setQSOMap(const QVariantMap& map);
104
QString catalogJsonPath;
106
StelTextureSP texPointer;
114
#include "StelPluginInterface.hpp"
116
//! This class is used by Qt to manage a plug-in interface
117
class QuasarsStelPluginInterface : public QObject, public StelPluginInterface
120
Q_INTERFACES(StelPluginInterface)
122
virtual StelModule* getStelModule() const;
123
virtual StelPluginInfo getPluginInfo() const;
126
#endif /*_QUASARS_HPP_*/