Satellites.hpp   Satellites.hpp 
/* /*
* Copyright (C) 2009 Matthew Gates * Copyright (C) 2009, 2012 Matthew Gates
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, U SA. * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*/ */
#ifndef _SATELLITES_HPP_ #ifndef _SATELLITES_HPP_
#define _SATELLITES_HPP_ 1 #define _SATELLITES_HPP_ 1
#include "StelObjectModule.hpp" #include "StelObjectModule.hpp"
#include "Satellite.hpp" #include "Satellite.hpp"
#include "StelFader.hpp" #include "StelFader.hpp"
#include "StelGui.hpp" #include "StelGui.hpp"
#include "StelDialog.hpp" #include "StelDialog.hpp"
skipping to change at line 45 skipping to change at line 45
class QNetworkAccessManager; class QNetworkAccessManager;
class QNetworkReply; class QNetworkReply;
class QPixmap; class QPixmap;
class QProgressBar; class QProgressBar;
class QSettings; class QSettings;
class QTimer; class QTimer;
class SatellitesDialog; class SatellitesDialog;
typedef QSharedPointer<Satellite> SatelliteP; typedef QSharedPointer<Satellite> SatelliteP;
//! Data structure containing unvalidated TLE set as read from a TLE list f
ile.
struct TleData
{
//! NORAD catalog number, as extracted from the TLE set.
QString id;
//! Human readable name, as extracted from the TLE title line.
QString name;
QString first;
QString second;
};
typedef QList<TleData> TleDataList;
typedef QHash<QString, TleData> TleDataHash ;
//! @class Satellites //! @class Satellites
//! Satellites in low Earth orbit require different orbital calculations fr om planets, the moon //! Satellites in low Earth orbit require different orbital calculations fr om planets, the moon
//! and so on. This plugin implements the SGP4/SDP4 algorithms in Stellari um, allowing accurate //! and so on. This plugin implements the SGP4/SDP4 algorithms in Stellari um, allowing accurate
//! prediction of the position of artificial satellites. //! prediction of the position of artificial satellites.
class Satellites : public StelObjectModule class Satellites : public StelObjectModule
{ {
Q_OBJECT Q_OBJECT
public: public:
//! @enum UpdateState //! @enum UpdateState
//! Used for keeping track of the download/update status //! Used for keeping track of the download/update status
enum UpdateState enum UpdateState
{ {
Updating, //!< Update in progress Updating, //!< Update in progress
CompleteNoUpdates, //!< Update completed, there we no upd ates CompleteNoUpdates, //!< Update completed, there we no upd ates
CompleteUpdates, //!< Update completed, there were upda tes CompleteUpdates, //!< Update completed, there were upda tes
DownloadError, //!< Error during download phase DownloadError, //!< Error during download phase
OtherError //!< Other error OtherError //!< Other error
}; };
enum Visibility enum Status
{ {
Visible, Visible,
NotVisible, NotVisible,
Both Both,
NewlyAdded,
OrbitError
}; };
Satellites(); Satellites();
virtual ~Satellites(); virtual ~Satellites();
//////////////////////////////////////////////////////////////////// /////// //////////////////////////////////////////////////////////////////// ///////
// Methods defined in the StelModule class // Methods defined in the StelModule class
virtual void init(); virtual void init();
virtual void deinit(); virtual void deinit();
virtual void update(double deltaTime); virtual void update(double deltaTime);
skipping to change at line 129 skipping to change at line 145
//! Save the settings to the main configuration file. //! Save the settings to the main configuration file.
void saveSettingsToConfig(void); void saveSettingsToConfig(void);
//! Get a list of satellite group names. A Satellite may be long to one or more group //! Get a list of satellite group names. A Satellite may be long to one or more group
//! e.g. "amateur" and "navigation". Group names are arbitrary stri ngs defined in the //! e.g. "amateur" and "navigation". Group names are arbitrary stri ngs defined in the
//! json file. Think of them like tags. A satellite may not belong to any group at all. //! json file. Think of them like tags. A satellite may not belong to any group at all.
QStringList getGroups(void) const; QStringList getGroups(void) const;
//! get satellite objects filtered by group. If an empty string is used for the //! get satellite objects filtered by group. If an empty string is used for the
//! group name, return all satallites //! group name, return all satallites
QStringList getSatellites(const QString& group=QString(), Visibility vis=Both); QHash<QString,QString> getSatellites(const QString& group=QString(), Status vis=Both);
//! get a satellite object by identifier //! get a satellite object by identifier
SatelliteP getByID(const QString& id); SatelliteP getByID(const QString& id);
//! Returns a list of all satellite IDs.
QStringList getAllIDs();
//! Add the given satellites.
//! The changes are not saved to file.
void add(const TleDataList& newSatellites);
//! Remove the selected satellites.
//! The changes are not saved to file.
void remove(const QStringList& idList);
//! get whether or not the plugin will try to update TLE data from t he internet //! get whether or not the plugin will try to update TLE data from t he internet
//! @return true if updates are set to be done, false otherwise //! @return true if updates are set to be done, false otherwise
bool getUpdatesEnabled(void) {return updatesEnabled;} bool getUpdatesEnabled(void) {return updatesEnabled;}
//! set whether or not the plugin will try to update TLE data from t he internet //! set whether or not the plugin will try to update TLE data from t he internet
//! @param b if true, updates will be enabled, else they will be dis abled //! @param b if true, updates will be enabled, else they will be dis abled
void setUpdatesEnabled(bool b) {updatesEnabled=b;} void setUpdatesEnabled(bool b) {updatesEnabled=b;}
//! get the date and time the TLE elements were updated //! get the date and time the TLE elements were updated
QDateTime getLastUpdate(void) {return lastUpdate;} QDateTime getLastUpdate(void) {return lastUpdate;}
skipping to change at line 175 skipping to change at line 202
const StelStyle getModuleStyleSheet(const StelStyle& style); const StelStyle getModuleStyleSheet(const StelStyle& style);
//! Reads update file(s) in celestrak's .txt format, and updates //! Reads update file(s) in celestrak's .txt format, and updates
//! the TLE elements for exisiting satellites from them. //! the TLE elements for exisiting satellites from them.
//! emits signals updateStateChanged and tleUpdateComplete //! emits signals updateStateChanged and tleUpdateComplete
//! @param paths a list of paths to update files //! @param paths a list of paths to update files
//! @param deleteFiles if set, the update files are deleted after //! @param deleteFiles if set, the update files are deleted after
//! they are used, else they are left alone //! they are used, else they are left alone
void updateFromFiles(QStringList paths, bool deleteFiles=false); void updateFromFiles(QStringList paths, bool deleteFiles=false);
//! Reads a TLE list from a file to the supplied hash.
//! If an entry with the same ID exists in the given hash, its conte
nts
//! are overwritten with the new values.
//! \param openFile a reference to an \b open file.
//! \param tleList a hash with satellite IDs (catalog numbers) as ke
ys.
static void parseTleFile(QFile& openFile, TleDataHash& tleList);
signals: signals:
//! emitted when the update status changes, e.g. when //! emitted when the update status changes, e.g. when
//! an update starts, completes and so on. Note that //! an update starts, completes and so on. Note that
//! on completion of an update, tleUpdateComplete is also //! on completion of an update, tleUpdateComplete is also
//! emitted with the number of updates done. //! emitted with the number of updates done.
//! @param state the new update state. //! @param state the new update state.
void updateStateChanged(Satellites::UpdateState state); void updateStateChanged(Satellites::UpdateState state);
//! emitted after a TLE update has run. //! emitted after a TLE update has run.
//! @param updates the number of satellites updated. //! @param updates the number of satellites updated.
skipping to change at line 230 skipping to change at line 264
void displayMessage(const QString& message, const QString hexColor=" #999999"); void displayMessage(const QString& message, const QString hexColor=" #999999");
void messageTimeout(void); void messageTimeout(void);
//! Save the current TLE data to the default json file location. //! Save the current TLE data to the default json file location.
void saveTleData(QString path=QString()); void saveTleData(QString path=QString());
private slots: private slots:
void setStelStyle(const QString& section); void setStelStyle(const QString& section);
private: private:
// if existing, delete Satellites section in main config.ini, then c reate with default values //! if existing, delete Satellites section in main config.ini, then create with default values
void restoreDefaultConfigIni(void); void restoreDefaultConfigIni(void);
// replace the json file with the default from the compiled-in resou rce //! replace the json file with the default from the compiled-in reso urce
void restoreDefaultJsonFile(void); void restoreDefaultJsonFile(void);
// read the json file and create the satellites. Removes existing s //! read the json file and create the satellites. Removes existing
atellites first if there are any satellites first if there are any
// this will be done once at init, and also if the defaults are rese //! this will be done once at init, and also if the defaults are res
t. et.
void readJsonFile(void); void readJsonFile(void);
//! Creates a backup of the satellites.json file called satellites.j son.old //! Creates a backup of the satellites.json file called satellites.j son.old
//! @param deleteOriginal if true, the original file is removed, els e not //! @param deleteOriginal if true, the original file is removed, els e not
//! @return true on OK, false on failure //! @return true on OK, false on failure
bool backupJsonFile(bool deleteOriginal=false); bool backupJsonFile(bool deleteOriginal=false);
//! Get the version from the "creator" value in the satellites.json file //! Get the version from the "creator" value in the satellites.json file
//! @return version string, e.g. "0.6.1" //! @return version string, e.g. "0.6.1"
const QString getJsonFileVersion(void); const QString getJsonFileVersion(void);
bool saveTleMap(const QVariantMap& map, QString path=QString()); bool saveTleMap(const QVariantMap& map, QString path=QString());
QVariantMap loadTleMap(QString path=QString()); QVariantMap loadTleMap(QString path=QString());
void setTleMap(const QVariantMap& map); void setTleMap(const QVariantMap& map);
QVariantMap getTleMap(void); //! Generates a QMap that contains all the data on satellites.
QVariantMap getTleMap();
QString satellitesJsonPath; QString satellitesJsonPath;
QList<SatelliteP> satellites; QList<SatelliteP> satellites;
LinearFader hintFader; LinearFader hintFader;
StelTextureSP texPointer; StelTextureSP texPointer;
QPixmap* pxmapGlow; QPixmap* pxmapGlow;
QPixmap* pxmapOnIcon; QPixmap* pxmapOnIcon;
QPixmap* pxmapOffIcon; QPixmap* pxmapOffIcon;
StelButton* toolbarButton; StelButton* toolbarButton;
QSharedPointer<Planet> earth; QSharedPointer<Planet> earth;
 End of changes. 12 change blocks. 
12 lines changed or deleted 50 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/