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;
107 typedef QList<TleData> TleDataList;
109 typedef QHash<QString, TleData> TleDataHash ;
126 typedef QList<TleSource> TleSourceList;
137 typedef QList<IridiumFlaresPrediction> IridiumFlaresPredictionList;
147 Q_PROPERTY(
bool hintsVisible
150 NOTIFY hintsVisibleChanged)
151 Q_PROPERTY(
bool labelsVisible
154 NOTIFY labelsVisibleChanged)
155 Q_PROPERTY(
bool autoAddEnabled
156 READ isAutoAddEnabled
158 NOTIFY settingsChanged)
159 Q_PROPERTY(
bool autoRemoveEnabled
160 READ isAutoRemoveEnabled
161 WRITE enableAutoRemove
162 NOTIFY settingsChanged)
163 Q_PROPERTY(
bool realisticMode
164 READ getFlagRealisticMode
165 WRITE setFlagRelisticMode)
195 virtual void deinit();
196 virtual void update(
double deltaTime);
208 virtual QList<StelObjectP> searchAround(
const Vec3d& v,
double limitFov,
const StelCore* core)
const;
212 virtual StelObjectP searchByNameI18n(
const QString& nameI18n)
const;
218 virtual StelObjectP searchByID(
const QString &
id)
const;
225 StelObjectP searchByNoradNumber(
const QString& noradNumber)
const;
232 virtual QStringList listMatchingObjects(
const QString& objPrefix,
int maxNbItem=5,
bool useStartOfWords=
false,
bool inEnglish=
false)
const;
234 virtual QStringList listAllObjects(
bool inEnglish)
const;
236 virtual QString
getName()
const {
return "Satellites"; }
241 virtual bool configureGui(
bool show=
true);
246 void restoreDefaults(
void);
258 QSet<QString> getGroups()
const;
261 QStringList getGroupIdList()
const;
263 void addGroup(
const QString& groupId);
267 QHash<QString,QString> getSatellites(
const QString& group=QString(),
Status vis=Both)
const;
272 SatelliteP getById(
const QString&
id)
const;
275 QStringList listAllIds()
const;
280 void add(
const TleDataList& newSatellites);
284 void remove(
const QStringList& idList);
297 int getSecondsToUpdate(
void);
317 void setTleSources(QStringList tleSources);
320 void saveTleSources(
const QStringList& urls);
330 void updateFromFiles(QStringList paths,
bool deleteFiles=
false);
344 void updateSatellites(TleDataHash& newTleSets);
354 static void parseTleFile(QFile& openFile,
355 TleDataHash& tleList,
356 bool addFlagValue =
false);
362 void parseQSMagFile(QString qsMagFile);
364 bool getFlagHints()
const {
return hintFader;}
368 bool getFlagLabels()
const;
369 bool getFlagRealisticMode()
const;
371 bool getOrbitLinesFlag()
const;
372 bool isAutoAddEnabled()
const {
return autoAddEnabled; }
373 bool isAutoRemoveEnabled()
const {
return autoRemoveEnabled; }
378 IridiumFlaresPredictionList getIridiumFlaresPrediction();
381 void hintsVisibleChanged(
bool b);
382 void labelsVisibleChanged(
bool b);
386 void settingsChanged();
401 void tleUpdateComplete(
int updated,
int total,
int added,
int missing);
409 void enableInternetUpdates(
bool enabled =
true);
412 void enableAutoAdd(
bool enabled =
true);
415 void enableAutoRemove(
bool enabled =
true);
420 void setFlagHints(
bool b);
425 void setFlagLabels(
bool b);
428 void setFlagRelisticMode(
bool b);
433 void setLabelFontSize(
int size);
437 void setUpdateFrequencyHours(
int hours);
452 void updateFromOnlineSources();
458 void setOrbitLinesFlag(
bool b);
460 void recalculateOrbitLines(
void);
464 void displayMessage(
const QString& message,
const QString hexColor=
"#999999");
469 void saveCatalog(QString path=QString());
483 bool add(
const TleData& tleData);
486 void restoreDefaultSettings();
488 void restoreDefaultCatalog();
496 bool backupCatalog(
bool deleteOriginal=
false);
499 const QString readCatalogVersion();
501 void restoreDefaultQSMagFile();
504 bool isValidRangeDates(
const StelCore* core)
const;
509 bool saveDataMap(
const QVariantMap& map, QString path=QString());
512 QVariantMap loadDataMap(QString path=QString());
514 void setDataMap(
const QVariantMap& map);
517 QVariantMap createDataMap();
520 void markLastUpdate();
524 bool checkJsonFileFormat();
530 static void translations();
533 QString qsMagFilePath;
542 QList<SatelliteP> satellites;
545 QHash<QString, double> qsMagList;
551 QSet<QString> groups;
561 QSharedPointer<Planet> earth;
562 Vec3f defaultHintColor;
563 Vec3f defaultOrbitColor;
569 QNetworkAccessManager* downloadMgr;
578 QStringList updateUrls;
584 TleSourceList updateSources;
586 int numberDownloadsComplete;
594 bool autoRemoveEnabled;
595 QDateTime lastUpdate;
596 int updateFrequencyHours;
601 QTimer* messageTimer;
602 QList<int> messageIDs;
605 int iridiumFlaresPredictionDepth;
614 void checkForUpdate(
void);
623 void saveDownloadedUpdate(QNetworkReply* reply);
630 #include "StelPluginInterface.hpp" 636 Q_PLUGIN_METADATA(IID StelPluginInterface_iid)
UpdateState getUpdateState(void) const
get the update frequency in hours
Main configuration window of the Satellites plugin.
Store the informations for a location on a planet.
Error during download phase.
QString id
NORAD catalog number, as extracted from the TLE set.
int getLabelFontSize() const
get the label font size.
Define the interface to implement when creating a plugin.
Status
Flags used to filter the satellites list according to their status.
QFile * file
The downloaded file, location set after finishing download.
int getUpdateFrequencyHours(void) const
get the update frequency in hours
Implementation of StelFader which implements a linear transition.
QDateTime getLastUpdate(void) const
get the date and time the TLE elements were updated
Main class for Stellarium core processing.
Update completed, there we no updates.
virtual QString getName() const
Gets a user-displayable name of the object category.
QStringList getTleSources(void) const
Get a list of URLs which are sources of TLE data.
Specialization of StelModule which manages a collection of StelObject.
void setIridiumFlaresPredictionDepth(int depth)
Set depth of prediction for Iridium flares.
bool getUpdatesEnabled(void) const
get whether or not the plugin will try to update TLE data from the internet
UpdateState
Used for keeping track of the download/update status.
Data structure containing unvalidated TLE set as read from a TLE list file.
QUrl url
URL from where the source list should be downloaded.
bool addNew
Flag indicating whether new satellites in this list should be added.
QString name
Human readable name, as extracted from the TLE title line.
int getIridiumFlaresPredictionDepth(void) const
Get depth of prediction for Iridium flares.
Provides functions for performing openGL drawing operations.
TLE update source, used only internally for now.
StelModuleActionName
Define the possible action for which an order is defined.
This class is used by Qt to manage a plug-in interface.
Maintain the state of a progress bar.
Update completed, there were updates.
virtual QObjectList getExtensionList() const
A mechanism to provide abitrary QObjects to the StelModuleMgr.
Main class of the Satellites plugin.
A model encapsulating a satellite list.
QSharedPointer< StelTexture > StelTextureSP
Use shared pointer to simplify memory managment.
virtual QString getStelObjectType() const
Returns the name that will be returned by StelObject::getType() for the objects this module manages...
This is the common base class for all the main components of stellarium.
Contains information about a Stellarium plugin.
bool addThis
Flag indicating whether this satellite should be added.