Stellarium 0.14.3
List of all members | Public Types | Public Slots | Signals | Public Member Functions | Static Public Member Functions
Satellites Class Reference

Main class of the Satellites plugin. More...

#include <Satellites.hpp>

Public Types

enum  UpdateState {
  Updating, CompleteNoUpdates, CompleteUpdates, DownloadError,
  OtherError
}
 Used for keeping track of the download/update status. More...
 
enum  Status {
  Visible, NotVisible, Both, NewlyAdded,
  OrbitError
}
 Flags used to filter the satellites list according to their status. More...
 

Public Slots

void enableInternetUpdates (bool enabled=true)
 Set whether the plugin will try to download updates from the Internet. More...
 
void enableAutoAdd (bool enabled=true)
 Emits settingsChanged() if the value changes. More...
 
void enableAutoRemove (bool enabled=true)
 Emits settingsChanged() if the value changes. More...
 
void setFlagHints (bool b)
 Set whether satellite position hints (icons) should be displayed. More...
 
void setFlagLabels (bool b)
 Set whether text labels should be displayed next to satellite hints. More...
 
void setFlagRelisticMode (bool b)
 Emits settingsChanged() if the value changes. More...
 
void setLabelFontSize (int size)
 set the label font size. More...
 
void setUpdateFrequencyHours (int hours)
 Set the Internet update frequency. More...
 
void updateFromOnlineSources ()
 Start an Internet update. More...
 
void setOrbitLinesFlag (bool b)
 Choose whether or not to draw orbit lines. More...
 
void recalculateOrbitLines (void)
 
void displayMessage (const QString &message, const QString hexColor="#999999")
 Display a message on the screen for a few seconds. More...
 
void hideMessages ()
 Hide all messages. More...
 
void saveCatalog (QString path=QString())
 Save the current satellite catalog to disk. More...
 

Signals

void settingsChanged ()
 Emitted when some of the plugin settings have been changed. More...
 
void updateStateChanged (Satellites::UpdateState state)
 emitted when the update status changes, e.g. More...
 
void tleUpdateComplete (int updated, int total, int added, int missing)
 Emitted after an update has run. More...
 

Public Member Functions

virtual void init ()
 
virtual void deinit ()
 
virtual void update (double deltaTime)
 
virtual void draw (StelCore *core)
 
virtual void drawPointer (StelCore *core, StelPainter &painter)
 
virtual double getCallOrder (StelModuleActionName actionName) const
 
virtual QList< StelObjectPsearchAround (const Vec3d &v, double limitFov, const StelCore *core) const
 Used to get a list of objects which are near to some position. More...
 
virtual StelObjectP searchByNameI18n (const QString &nameI18n) const
 Return the matching satellite object's pointer if exists or NULL. More...
 
virtual StelObjectP searchByName (const QString &name) const
 Return the matching satellite if exists or NULL. More...
 
StelObjectP searchByNoradNumber (const QString &noradNumber) const
 Return the satellite with the given catalog number. More...
 
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. More...
 
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. More...
 
virtual QStringList listAllObjects (bool inEnglish) const
 
virtual QStringList listAllObjectsByType (const QString &objType, bool inEnglish) const
 
virtual QString getName () const
 
virtual bool configureGui (bool show=true)
 Implment this to tell the main Stellarium GUi that there is a GUI element to configure this plugin. More...
 
void restoreDefaults (void)
 Set up the plugin with default values. More...
 
void loadSettings ()
 Read (or re-read) the plugin's settings from the configuration file. More...
 
void saveSettings ()
 Save the plugin's settings to the main configuration file. More...
 
QSet< QString > getGroups () const
 Get the groups used in the currently loaded satellite collection. More...
 
QStringList getGroupIdList () const
 Get a sorted list of group names. More...
 
void addGroup (const QString &groupId)
 Add this group to the global list. More...
 
QHash< QString, QString > getSatellites (const QString &group=QString(), Status vis=Both)
 get satellite objects filtered by group. More...
 
SatellitesListModelgetSatellitesListModel ()
 Get a model representing the list of satellites. More...
 
SatelliteP getById (const QString &id)
 Get a satellite object by its identifier (i.e. NORAD number). More...
 
QStringList listAllIds ()
 Returns a list of all satellite IDs. More...
 
void add (const TleDataList &newSatellites)
 Add to the current collection the satellites described by the data list. More...
 
void remove (const QStringList &idList)
 Remove the selected satellites. More...
 
bool getUpdatesEnabled (void)
 get whether or not the plugin will try to update TLE data from the internet More...
 
QDateTime getLastUpdate (void)
 get the date and time the TLE elements were updated More...
 
int getUpdateFrequencyHours (void)
 get the update frequency in hours More...
 
int getSecondsToUpdate (void)
 get the number of seconds till the next update More...
 
UpdateState getUpdateState (void)
 get the update frequency in hours More...
 
QStringList getTleSources (void)
 Get a list of URLs which are sources of TLE data. More...
 
void setTleSources (QStringList tleSources)
 Set the list of URLs which are sources of TLE data. More...
 
void saveTleSources (const QStringList &urls)
 Saves the current list of update URLs to the configuration file. More...
 
void updateFromFiles (QStringList paths, bool deleteFiles=false)
 Reads update file(s) in celestrak's .txt format, and updates the TLE elements for exisiting satellites from them. More...
 
void updateSatellites (TleDataHash &newTleSets)
 Updates the loaded satellite collection from the provided data. More...
 
void parseQSMagFile (QString qsMagFile)
 Reads qs.mag file and its parsing for getting id and standard magnitude for satellites. More...
 
bool getFlagHints ()
 
int getLabelFontSize ()
 get the label font size. More...
 
bool getFlagLabels ()
 
bool getFlagRealisticMode ()
 
bool getOrbitLinesFlag ()
 Get the current status of the orbit line rendering flag. More...
 
bool isAutoAddEnabled () const
 
bool isAutoRemoveEnabled () const
 
IridiumFlaresPredictionList getIridiumFlaresPrediction ()
 

Static Public Member Functions

static void parseTleFile (QFile &openFile, TleDataHash &tleList, bool addFlagValue=false)
 Reads a TLE list from a file to the supplied hash. More...
 

Detailed Description

Main class of the Satellites plugin.

Author
Matthew Gates
Bogdan Marinov

Definition at line 143 of file Satellites.hpp.

Member Enumeration Documentation

Flags used to filter the satellites list according to their status.

Definition at line 177 of file Satellites.hpp.

Used for keeping track of the download/update status.

Enumerator
Updating 

Update in progress.

CompleteNoUpdates 

Update completed, there we no updates.

CompleteUpdates 

Update completed, there were updates.

DownloadError 

Error during download phase.

OtherError 

Other error.

Definition at line 167 of file Satellites.hpp.

Member Function Documentation

void Satellites::add ( const TleDataList &  newSatellites)

Add to the current collection the satellites described by the data list.

The changes are not saved to file. Calls add(TleData).

void Satellites::addGroup ( const QString &  groupId)

Add this group to the global list.

virtual bool Satellites::configureGui ( bool  show = true)
virtual

Implment this to tell the main Stellarium GUi that there is a GUI element to configure this plugin.

void Satellites::displayMessage ( const QString &  message,
const QString  hexColor = "#999999" 
)
slot

Display a message on the screen for a few seconds.

This is used for plugin-specific warnings and such.

void Satellites::enableAutoAdd ( bool  enabled = true)
slot

Emits settingsChanged() if the value changes.

void Satellites::enableAutoRemove ( bool  enabled = true)
slot

Emits settingsChanged() if the value changes.

void Satellites::enableInternetUpdates ( bool  enabled = true)
slot

Set whether the plugin will try to download updates from the Internet.

Emits settingsChanged() if the value changes.

Parameters
bif true, updates will be enabled, else they will be disabled.
SatelliteP Satellites::getById ( const QString &  id)

Get a satellite object by its identifier (i.e. NORAD number).

QStringList Satellites::getGroupIdList ( ) const

Get a sorted list of group names.

See groups for details. Use getGroups() if you don't need a list.

QSet<QString> Satellites::getGroups ( ) const

Get the groups used in the currently loaded satellite collection.

See groups for details. Use getGroupIdList() if you need a list.

int Satellites::getLabelFontSize ( )
inline

get the label font size.

Returns
the pixel size of the font

Definition at line 369 of file Satellites.hpp.

QDateTime Satellites::getLastUpdate ( void  )
inline

get the date and time the TLE elements were updated

Definition at line 293 of file Satellites.hpp.

bool Satellites::getOrbitLinesFlag ( )

Get the current status of the orbit line rendering flag.

QHash<QString,QString> Satellites::getSatellites ( const QString &  group = QString(),
Status  vis = Both 
)

get satellite objects filtered by group.

If an empty string is used for the group name, return all satallites

SatellitesListModel* Satellites::getSatellitesListModel ( )

Get a model representing the list of satellites.

int Satellites::getSecondsToUpdate ( void  )

get the number of seconds till the next update

QStringList Satellites::getTleSources ( void  )
inline

Get a list of URLs which are sources of TLE data.

Returns
a list of URL strings, some with prefixes - see #updateUrls for details.

Definition at line 310 of file Satellites.hpp.

int Satellites::getUpdateFrequencyHours ( void  )
inline

get the update frequency in hours

Definition at line 296 of file Satellites.hpp.

bool Satellites::getUpdatesEnabled ( void  )
inline

get whether or not the plugin will try to update TLE data from the internet

Returns
true if updates are set to be done, false otherwise

Definition at line 290 of file Satellites.hpp.

UpdateState Satellites::getUpdateState ( void  )
inline

get the update frequency in hours

Get the current updateState

Definition at line 305 of file Satellites.hpp.

void Satellites::hideMessages ( )
slot

Hide all messages.

QStringList Satellites::listAllIds ( )

Returns a list of all satellite IDs.

virtual QStringList Satellites::listMatchingObjects ( const QString &  objPrefix,
int  maxNbItem = 5,
bool  useStartOfWords = false 
) const
virtual

Find and return the list of at most maxNbItem objects auto-completing the passed object English name.

Parameters
objPrefixthe case insensitive first letters of the searched object
maxNbItemthe maximum number of returned object names
useStartOfWordsthe autofill mode for returned objects names
Returns
a list of matching object name by order of relevance, or an empty list if nothing match

Implements StelObjectModule.

virtual QStringList Satellites::listMatchingObjectsI18n ( const QString &  objPrefix,
int  maxNbItem = 5,
bool  useStartOfWords = false 
) const
virtual

Find and return the list of at most maxNbItem objects auto-completing the passed object I18n name.

Parameters
objPrefixthe case insensitive first letters of the searched object
maxNbItemthe maximum number of returned object names
useStartOfWordsthe autofill mode for returned objects names
Returns
a list of matching object name by order of relevance, or an empty list if nothing match

Implements StelObjectModule.

void Satellites::loadSettings ( )

Read (or re-read) the plugin's settings from the configuration file.

This will be called from init() and also when restoring defaults (i.e. from the configuration dialog / restore defaults button).

void Satellites::parseQSMagFile ( QString  qsMagFile)

Reads qs.mag file and its parsing for getting id and standard magnitude for satellites.

Note
We are having permissions for use this file from Mike McCants.
Parameters
nameof file
static void Satellites::parseTleFile ( QFile &  openFile,
TleDataHash &  tleList,
bool  addFlagValue = false 
)
static

Reads a TLE list from a file to the supplied hash.

If an entry with the same ID exists in the given hash, its contents are overwritten with the new values.

Parameters
openFilea reference to an open file.
[in,out]tleLista hash with satellite IDs as keys.
[in]addFlagValuevalue to be set to TleData::addThis for all.
void Satellites::remove ( const QStringList &  idList)

Remove the selected satellites.

The changes are not saved to file.

void Satellites::restoreDefaults ( void  )

Set up the plugin with default values.

This means clearing out the Satellites section in the main config.ini (if one already exists), and populating it with default values. It also creates the default satellites.json file from the resource embedded in the plugin lib/dll file.

void Satellites::saveCatalog ( QString  path = QString())
slot

Save the current satellite catalog to disk.

void Satellites::saveSettings ( )

Save the plugin's settings to the main configuration file.

void Satellites::saveTleSources ( const QStringList &  urls)

Saves the current list of update URLs to the configuration file.

virtual QList<StelObjectP> Satellites::searchAround ( const Vec3d &  v,
double  limitFov,
const StelCore core 
) const
virtual

Used to get a list of objects which are near to some position.

Parameters
va vector representing the position in th sky around which to search for nebulae.
limitFovthe field of view around the position v in which to search for satellites.
corethe StelCore to use for computations.
Returns
an list containing the satellites located inside the limitFov circle around position v.

Implements StelObjectModule.

virtual StelObjectP Satellites::searchByName ( const QString &  name) const
virtual

Return the matching satellite if exists or NULL.

Parameters
nameThe case in-sensistive standard program name

Implements StelObjectModule.

virtual StelObjectP Satellites::searchByNameI18n ( const QString &  nameI18n) const
virtual

Return the matching satellite object's pointer if exists or NULL.

Parameters
nameI18nThe case in-sensistive satellite name

Implements StelObjectModule.

StelObjectP Satellites::searchByNoradNumber ( const QString &  noradNumber) const

Return the satellite with the given catalog number.

Used as a helper function by searchByName() and searchByNameI18n().

Parameters
noradNumbersearch string in the format "NORAD XXXX".
Returns
a null pointer if no such satellite is found.
void Satellites::setFlagHints ( bool  b)
slot

Set whether satellite position hints (icons) should be displayed.

Note that hint visibility also applies to satellite labels. Emits settingsChanged() if the value changes.

void Satellites::setFlagLabels ( bool  b)
slot

Set whether text labels should be displayed next to satellite hints.

Emits settingsChanged() if the value changes.

void Satellites::setFlagRelisticMode ( bool  b)
slot

Emits settingsChanged() if the value changes.

void Satellites::setLabelFontSize ( int  size)
slot

set the label font size.

Parameters
sizethe pixel size of the font Emits settingsChanged() if the value changes.
void Satellites::setOrbitLinesFlag ( bool  b)
slot

Choose whether or not to draw orbit lines.

Each satellite has its own setting as well, but this can be used to turn on/off all those satellites which elect to have orbit lines all in one go.

Parameters
b- true to turn on orbit lines, false to turn off
void Satellites::settingsChanged ( )
signal

Emitted when some of the plugin settings have been changed.

Used to communicate with the configuration window.

void Satellites::setTleSources ( QStringList  tleSources)

Set the list of URLs which are sources of TLE data.

In addition to replacing the current list of sources, it also saves them to the configuration file. Allows marking sources for auto-addition by adding a prefix to the URL string.

See also
updateUrls
Parameters
tleSourcesa list of valid URLs (http://, ftp://, file://), allowed prefixes are "0,", "1," or no prefix.
void Satellites::setUpdateFrequencyHours ( int  hours)
slot

Set the Internet update frequency.

Emits settingsChanged() if the value changes.

void Satellites::tleUpdateComplete ( int  updated,
int  total,
int  added,
int  missing 
)
signal

Emitted after an update has run.

Parameters
updatedthe number of updated satellites;
totalthe total number of satellites in the catalog;
addedthe number of newly added satellites;
missingthe number of satellites that were not found in the update source(s) (and were removed, if autoRemoveEnabled is set).
void Satellites::updateFromFiles ( QStringList  paths,
bool  deleteFiles = false 
)

Reads update file(s) in celestrak's .txt format, and updates the TLE elements for exisiting satellites from them.

Indirectly emits signals updateStateChanged() and tleUpdateComplete(), as it calls updateSatellites(). See updateFromOnlineSources() for the other kind of update operation.

Parameters
pathsa list of paths to update files
deleteFilesif set, the update files are deleted after they are used, else they are left alone
void Satellites::updateFromOnlineSources ( )
slot

Start an Internet update.

This method starts the process of an Internet update: it tries to download TLE lists from online recources and then use them to update the orbital data (and names, etc.) of the included satellites. This only initialized the download. The rest of the work is done by saveDownloadedUpdate() and updateSatellites(). Update sources are described in updateUrls (see for accessor details). If autoAddEnabled is true when this function is called, new satellites in the chosen update sources will be added during the update. If autoRemoveEnabled is true when this function is called, any existing satellite that can't be found in the downloaded update lists will be removed. See updateFromFiles() for the other type of update operation.

void Satellites::updateSatellites ( TleDataHash &  newTleSets)

Updates the loaded satellite collection from the provided data.

Worker function called by updateFromFiles() and saveDownloadedUpdate(). (Respecitvely, user-initiated update from file(s) and user- or auto- initiated update from online source(s).) Emits updateStateChanged() and tleUpdateComplete().

Note
Instead of splitting this method off updateFromFiles() and passing the auto-add flag through data structures, another possiblity was to modify updateFromFiles to use the same prefix trick (adding "1," to file paths). I decided against it because I thought it would be more complex. :) –BM
Parameters
[in,out]newTleSetsa hash with satellite IDs as keys; it's modified by the method!
void Satellites::updateStateChanged ( Satellites::UpdateState  state)
signal

emitted when the update status changes, e.g.

when an update starts, completes and so on. Note that on completion of an update, tleUpdateComplete is also emitted with the number of updates done.

Parameters
statethe new update state.

The documentation for this class was generated from the following file: