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

Main class of the Satellites plugin. More...

#include <Satellites.hpp>

+ Inheritance diagram for Satellites:
+ Collaboration diagram for Satellites:

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 Types inherited from StelModule
enum  StelModuleSelectAction { AddToSelection, ReplaceSelection, RemoveFromSelection }
 Enum used when selecting objects to define whether to add to, replace, or remove from the existing selection list. More...
 
enum  StelModuleActionName {
  ActionDraw, ActionUpdate, ActionHandleMouseClicks, ActionHandleMouseMoves,
  ActionHandleKeys
}
 Define the possible action for which an order is defined. 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 hintsVisibleChanged (bool b)
 
void labelsVisibleChanged (bool b)
 
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 ()
 Initialize itself. More...
 
virtual void deinit ()
 Called before the module will be delete, and before the openGL context is suppressed. More...
 
virtual void update (double deltaTime)
 Update the module with respect to the time. More...
 
virtual void draw (StelCore *core)
 Execute all the drawing functions for this module. More...
 
virtual void drawPointer (StelCore *core, StelPainter &painter)
 
virtual double getCallOrder (StelModuleActionName actionName) const
 Return the value defining the order of call for the given action For example if stars.callOrder[ActionDraw] == 10 and constellation.callOrder[ActionDraw] == 11, the stars module will be drawn before the constellations. More...
 
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 listMatchingObjects (const QString &objPrefix, int maxNbItem=5, bool useStartOfWords=false, bool inEnglish=false) const
 Find and return the list of at most maxNbItem objects auto-completing the passed object name. More...
 
virtual QStringList listAllObjects (bool inEnglish) const
 List all StelObjects. More...
 
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 ()
 
- Public Member Functions inherited from StelObjectModule
virtual QStringList listAllObjectsByType (const QString &objType, bool inEnglish) const
 List all StelObjects by type. More...
 
bool matchObjectName (const QString &objName, const QString &objPrefix, bool useStartOfWords) const
 Auxiliary method of listMatchingObjects() More...
 
- Public Member Functions inherited from StelModule
virtual QString getModuleVersion () const
 Get the version of the module, default is stellarium main version. More...
 
virtual QString getAuthorName () const
 Get the name of the module author. More...
 
virtual QString getAuthorEmail () const
 Get the email adress of the module author. More...
 
virtual void handleMouseClicks (class QMouseEvent *)
 Handle mouse clicks. More...
 
virtual void handleMouseWheel (class QWheelEvent *)
 Handle mouse wheel. More...
 
virtual bool handleMouseMoves (int x, int y, Qt::MouseButtons b)
 Handle mouse moves. More...
 
virtual void handleKeys (class QKeyEvent *e)
 Handle key events. More...
 
virtual bool handlePinch (qreal scale, bool started)
 Handle pinch gesture events. More...
 

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...
 

Properties

bool hintsVisible
 
bool labelsVisible
 
bool realisticMode
 

Updater module

bool autoAddEnabled
 Flag enabling the automatic addition of new satellites on update. More...
 
bool autoRemoveEnabled
 Flag enabling the automatic removal of missing satellites on update. More...
 

Additional Inherited Members

- Protected Member Functions inherited from StelModule
class StelActionaddAction (const QString &id, const QString &groupId, const QString &text, QObject *target, const char *slot, const QString &shortcut="", const QString &altShortcut="")
 convenience methods to add an action (call to slot) to the StelActionMgr object. More...
 
class StelActionaddAction (const QString &id, const QString &groupId, const QString &text, const char *slot, const QString &shortcut="", const QString &altShortcut="")
 convenience methods to add an action (call to own slot) to the StelActionMgr object. More...
 

Detailed Description

Main class of the Satellites plugin.

Author
Matthew Gates
Bogdan Marinov

Definition at line 144 of file Satellites.hpp.

Member Enumeration Documentation

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

Definition at line 180 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 170 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.

Reimplemented from StelModule.

virtual void Satellites::deinit ( )
virtual

Called before the module will be delete, and before the openGL context is suppressed.

Deinitialize all openGL texture in this method.

Reimplemented from StelModule.

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.

virtual void Satellites::draw ( StelCore core)
virtual

Execute all the drawing functions for this module.

Parameters
corethe core to use for the drawing

Reimplemented from StelModule.

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).

virtual double Satellites::getCallOrder ( StelModuleActionName  actionName) const
virtual

Return the value defining the order of call for the given action For example if stars.callOrder[ActionDraw] == 10 and constellation.callOrder[ActionDraw] == 11, the stars module will be drawn before the constellations.

Parameters
actionNamethe name of the action for which we want the call order
Returns
the value defining the order. The closer to 0 the earlier the module's action will be called

Reimplemented from StelModule.

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 364 of file Satellites.hpp.

QDateTime Satellites::getLastUpdate ( void  )
inline

get the date and time the TLE elements were updated

Definition at line 288 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 305 of file Satellites.hpp.

int Satellites::getUpdateFrequencyHours ( void  )
inline

get the update frequency in hours

Definition at line 291 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 285 of file Satellites.hpp.

UpdateState Satellites::getUpdateState ( void  )
inline

get the update frequency in hours

Get the current updateState

Definition at line 300 of file Satellites.hpp.

void Satellites::hideMessages ( )
slot

Hide all messages.

virtual void Satellites::init ( )
virtual

Initialize itself.

If the initialization takes significant time, the progress should be displayed on the loading bar.

Implements StelModule.

QStringList Satellites::listAllIds ( )

Returns a list of all satellite IDs.

virtual QStringList Satellites::listAllObjects ( bool  inEnglish) const
virtual

List all StelObjects.

Parameters
inEnglishlist names in English (true) or translated (false)
Returns
a list of matching object name by order of relevance, or an empty list if nothing matches

Implements StelObjectModule.

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

Find and return the list of at most maxNbItem objects auto-completing the passed object 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

Reimplemented from 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).
virtual void Satellites::update ( double  deltaTime)
virtual

Update the module with respect to the time.

Parameters
deltaTimethe time increment in second since last call.

Implements StelModule.

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.

Property Documentation

bool Satellites::autoAddEnabled
readwrite

Flag enabling the automatic addition of new satellites on update.

This will apply only for the selected update sources.

Definition at line 158 of file Satellites.hpp.

bool Satellites::autoRemoveEnabled
readwrite

Flag enabling the automatic removal of missing satellites on update.

Definition at line 162 of file Satellites.hpp.


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