20 #ifndef _SATELLITES_HPP_
21 #define _SATELLITES_HPP_ 1
23 #include "StelObjectModule.hpp"
24 #include "Satellite.hpp"
25 #include "StelFader.hpp"
26 #include "StelGui.hpp"
27 #include "StelDialog.hpp"
28 #include "StelLocation.hpp"
34 #include <QVariantMap>
38 class QNetworkAccessManager;
106 typedef QList<TleData> TleDataList;
108 typedef QHash<QString, TleData> TleDataHash ;
125 typedef QList<TleSource> TleSourceList;
136 typedef QList<IridiumFlaresPrediction> IridiumFlaresPredictionList;
146 Q_PROPERTY(
bool hintsVisible
149 Q_PROPERTY(
bool labelsVisible
152 Q_PROPERTY(
bool autoAddEnabled
153 READ isAutoAddEnabled
156 Q_PROPERTY(
bool autoRemoveEnabled
157 READ isAutoRemoveEnabled
159 NOTIFY settingsChanged)
160 Q_PROPERTY(
bool realisticMode
161 READ getFlagRealisticMode
192 virtual void deinit();
193 virtual void update(
double deltaTime);
196 virtual double getCallOrder(StelModuleActionName actionName)
const;
205 virtual QList<StelObjectP>
searchAround(
const Vec3d& v,
double limitFov,
const StelCore* core)
const;
227 virtual QStringList
listMatchingObjectsI18n(
const QString& objPrefix,
int maxNbItem=5,
bool useStartOfWords=
false)
const;
234 virtual QStringList
listMatchingObjects(
const QString& objPrefix,
int maxNbItem=5,
bool useStartOfWords=
false)
const;
236 virtual QStringList listAllObjects(
bool inEnglish)
const;
237 virtual QStringList listAllObjectsByType(
const QString& objType,
bool inEnglish)
const { Q_UNUSED(objType) Q_UNUSED(inEnglish) return QStringList(); }
239 virtual QString getName()
const {
return "Satellites"; }
265 void addGroup(
const QString& groupId);
274 SatelliteP
getById(
const QString&
id);
282 void add(
const TleDataList& newSatellites);
286 void remove(
const QStringList& idList);
357 TleDataHash& tleList,
358 bool addFlagValue =
false);
366 bool getFlagHints() {
return hintFader;}
370 bool getFlagLabels();
371 bool getFlagRealisticMode();
374 bool isAutoAddEnabled()
const {
return autoAddEnabled; }
375 bool isAutoRemoveEnabled()
const {
return autoRemoveEnabled; }
377 IridiumFlaresPredictionList getIridiumFlaresPrediction();
456 void recalculateOrbitLines(
void);
460 void displayMessage(
const QString& message,
const QString hexColor=
"#999999");
478 void restoreDefaultSettings();
480 void restoreDefaultCatalog();
488 bool backupCatalog(
bool deleteOriginal=
false);
491 const QString readCatalogVersion();
493 void restoreDefaultQSMagFile();
496 bool isValidRangeDates()
const;
501 bool saveDataMap(
const QVariantMap& map, QString path=QString());
504 QVariantMap loadDataMap(QString path=QString());
506 void setDataMap(
const QVariantMap& map);
509 QVariantMap createDataMap();
512 void markLastUpdate();
516 bool checkJsonFileFormat();
522 static void translations();
525 QString qsMagFilePath;
534 QList<SatelliteP> satellites;
537 QHash<QString, double> qsMagList;
543 QSet<QString> groups;
553 QSharedPointer<Planet> earth;
554 Vec3f defaultHintColor;
555 Vec3f defaultOrbitColor;
561 QNetworkAccessManager* downloadMgr;
570 QStringList updateUrls;
576 TleSourceList updateSources;
578 int numberDownloadsComplete;
586 bool autoRemoveEnabled;
587 QDateTime lastUpdate;
588 int updateFrequencyHours;
593 QTimer* messageTimer;
594 QList<int> messageIDs;
604 void checkForUpdate(
void);
613 void saveDownloadedUpdate(QNetworkReply* reply);
620 #include "StelPluginInterface.hpp"
626 Q_PLUGIN_METADATA(IID StelPluginInterface_iid)
Main configuration window of the Satellites plugin.
void setUpdateFrequencyHours(int hours)
Set the Internet update frequency.
bool getOrbitLinesFlag()
Get the current status of the orbit line rendering flag.
Error during download phase.
QString id
NORAD catalog number, as extracted from the TLE set.
static void parseTleFile(QFile &openFile, TleDataHash &tleList, bool addFlagValue=false)
Reads a TLE list from a file to the supplied hash.
Status
Flags used to filter the satellites list according to their status.
virtual bool configureGui(bool show=true)
Implment this to tell the main Stellarium GUi that there is a GUI element to configure this plugin...
QFile * file
The downloaded file, location set after finishing download.
virtual QStringList listMatchingObjectsI18n(const QString &objPrefix, int maxNbItem=5, bool useStartOfWords=false) const
Find and return the list of at most maxNbItem objects auto-completing the passed object I18n name...
void restoreDefaults(void)
Set up the plugin with default values.
void saveCatalog(QString path=QString())
Save the current satellite catalog to disk.
QDateTime getLastUpdate(void)
get the date and time the TLE elements were updated
QSet< QString > getGroups() const
Get the groups used in the currently loaded satellite collection.
UpdateState getUpdateState(void)
get the update frequency in hours
void saveTleSources(const QStringList &urls)
Saves the current list of update URLs to the configuration file.
void setFlagLabels(bool b)
Set whether text labels should be displayed next to satellite hints.
void settingsChanged()
Emitted when some of the plugin settings have been changed.
Update completed, there we no updates.
SatellitesListModel * getSatellitesListModel()
Get a model representing the list of satellites.
StelObjectP searchByNoradNumber(const QString &noradNumber) const
Return the satellite with the given catalog number.
void setTleSources(QStringList tleSources)
Set the list of URLs which are sources of TLE data.
void loadSettings()
Read (or re-read) the plugin's settings from the configuration file.
void setOrbitLinesFlag(bool b)
Choose whether or not to draw orbit lines.
void setFlagRelisticMode(bool b)
Emits settingsChanged() if the value changes.
void enableInternetUpdates(bool enabled=true)
Set whether the plugin will try to download updates from the Internet.
void parseQSMagFile(QString qsMagFile)
Reads qs.mag file and its parsing for getting id and standard magnitude for satellites.
int getSecondsToUpdate(void)
get the number of seconds till the next update
UpdateState
Used for keeping track of the download/update status.
Data structure containing unvalidated TLE set as read from a TLE list file.
void tleUpdateComplete(int updated, int total, int added, int missing)
Emitted after an update has run.
void setFlagHints(bool b)
Set whether satellite position hints (icons) should be displayed.
int getLabelFontSize()
get the label font size.
QUrl url
URL from where the source list should be downloaded.
bool addNew
Flag indicating whether new satellites in this list should be added.
virtual QStringList listMatchingObjects(const QString &objPrefix, int maxNbItem=5, bool useStartOfWords=false) const
Find and return the list of at most maxNbItem objects auto-completing the passed object English name...
void updateFromFiles(QStringList paths, bool deleteFiles=false)
Reads update file(s) in celestrak's .txt format, and updates the TLE elements for exisiting satellite...
QString name
Human readable name, as extracted from the TLE title line.
void saveSettings()
Save the plugin's settings to the main configuration file.
void displayMessage(const QString &message, const QString hexColor="#999999")
Display a message on the screen for a few seconds.
QHash< QString, QString > getSatellites(const QString &group=QString(), Status vis=Both)
get satellite objects filtered by group.
TLE update source, used only internally for now.
QStringList getGroupIdList() const
Get a sorted list of group names.
QStringList getTleSources(void)
Get a list of URLs which are sources of TLE data.
int getUpdateFrequencyHours(void)
get the update frequency in hours
void addGroup(const QString &groupId)
Add this group to the global list.
virtual QList< StelObjectP > searchAround(const Vec3d &v, double limitFov, const StelCore *core) const
Used to get a list of objects which are near to some position.
SatelliteP getById(const QString &id)
Get a satellite object by its identifier (i.e. NORAD number).
This class is used by Qt to manage a plug-in interface.
Update completed, there were updates.
void enableAutoRemove(bool enabled=true)
Emits settingsChanged() if the value changes.
void setLabelFontSize(int size)
set the label font size.
Main class of the Satellites plugin.
void updateStateChanged(Satellites::UpdateState state)
emitted when the update status changes, e.g.
QStringList listAllIds()
Returns a list of all satellite IDs.
virtual StelObjectP searchByNameI18n(const QString &nameI18n) const
Return the matching satellite object's pointer if exists or NULL.
void enableAutoAdd(bool enabled=true)
Emits settingsChanged() if the value changes.
A model encapsulating a satellite list.
void add(const TleDataList &newSatellites)
Add to the current collection the satellites described by the data list.
bool getUpdatesEnabled(void)
get whether or not the plugin will try to update TLE data from the internet
QSharedPointer< StelTexture > StelTextureSP
void updateSatellites(TleDataHash &newTleSets)
Updates the loaded satellite collection from the provided data.
virtual StelObjectP searchByName(const QString &name) const
Return the matching satellite if exists or NULL.
void updateFromOnlineSources()
Start an Internet update.
void hideMessages()
Hide all messages.
bool addThis
Flag indicating whether this satellite should be added.