Stellarium 0.15.2
List of all members | Public Types | Public Slots | Signals | Public Member Functions
SolarSystemEditor Class Reference

Main class of the Solar System Editor plug-in. More...

#include <SolarSystemEditor.hpp>

+ Inheritance diagram for SolarSystemEditor:
+ Collaboration diagram for SolarSystemEditor:

Public Types

enum  UpdateFlag { UpdateNameAndNumber = 0x01, UpdateType = 0x02, UpdateOrbitalElements = 0x04, UpdateMagnitudeParameters = 0x08 }
 Flags to control the updateSolarSystemConfigurationFile() function. 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 resetSolarSystemToDefault ()
 Resets the Solar System configuration file and reloads the Solar System. More...
 

Signals

void solarSystemChanged ()
 

Public Member Functions

virtual void init ()
 called when the plug-in is loaded. More...
 
virtual void deinit ()
 called before the plug-in is un-loaded. More...
 
virtual void update (double deltaTime)
 Update the module with respect to the time. More...
 
virtual void draw (StelCore *core)
 draws on the view port. More...
 
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 bool configureGui (bool show)
 called when the "configure" button in the "Plugins" tab is pressed More...
 
SsoElements readMpcOneLineCometElements (QString oneLineElements)
 Reads a single comet's orbital elements from a string. More...
 
SsoElements readMpcOneLineMinorPlanetElements (QString oneLineElements)
 Reads a single minor planet's orbital elements from a string. More...
 
SsoElements readXEphemOneLineElements (QString oneLineElements)
 Reads a single object's orbital elements from a string. More...
 
QList< SsoElements > readMpcOneLineCometElementsFromFile (QString filePath)
 Reads a list of comet orbital elements from a file. More...
 
QList< SsoElements > readMpcOneLineMinorPlanetElementsFromFile (QString filePath)
 Reads a list of minor planet orbital elements from a file. More...
 
QList< SsoElements > readXEphemOneLineElementsFromFile (QString filePath)
 Reads a list of Solar System object orbital elements from a file. More...
 
bool appendToSolarSystemConfigurationFile (SsoElements object)
 Adds a new entry at the end of the user solar system configuration file. More...
 
bool appendToSolarSystemConfigurationFile (QList< SsoElements >)
 Adds new entries at the end of the user solar system configuration file. More...
 
bool updateSolarSystemConfigurationFile (QList< SsoElements > objects, UpdateFlags flags)
 Updates entries in the user solar system configuration file. More...
 
QHash< QString, QString > getDefaultSsoIdentifiers ()
 Returns the names of the objects listed in the default ssystem.ini. More...
 
QHash< QString, QString > listAllLoadedSsoIdentifiers ()
 Lists the objects listed in the current user ssystem.ini. More...
 
bool removeSsoWithName (QString name)
 Removes an object from the user Solar System configuration file. More...
 
bool copySolarSystemConfigurationFileTo (QString filePath)
 
bool replaceSolarSystemConfigurationFileWith (QString filePath)
 
QString getCustomSolarSystemFilePath () const
 returns the path 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...
 

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 Solar System Editor plug-in.

Author
Bogdan Marinov

Solar System bodies are identified by their names in Stellarium, but entries in the configuration file are identified by their group (section) names. This makes more difficult the detection of duplicates.

Definition at line 59 of file SolarSystemEditor.hpp.

Member Enumeration Documentation

Flags to control the updateSolarSystemConfigurationFile() function.

Enumerator
UpdateNameAndNumber 

Update the name and minor planet number, if any.

UpdateType 

Update objects that lack the "type" parameter.

UpdateOrbitalElements 

Update the orbital elements, including the orbit function.

UpdateMagnitudeParameters 

Update the values in the two parameter system, or add them if they are missing and the type allows.

Definition at line 181 of file SolarSystemEditor.hpp.

Member Function Documentation

bool SolarSystemEditor::appendToSolarSystemConfigurationFile ( SsoElements  object)

Adds a new entry at the end of the user solar system configuration file.

This function writes directly to the file. See the note on why QSettings was not used in the description of appendToSolarSystemConfigurationFile(QList<SsoElements>) Duplicates are removed: If any section in the file matches the "section_name" value of the inserted entry, it is removed.

bool SolarSystemEditor::appendToSolarSystemConfigurationFile ( QList< SsoElements >  )

Adds new entries at the end of the user solar system configuration file.

This function writes directly to the file. QSettings was not used, as:

  • Using QSettings with QSettings::IniFormat causes the list in the "color" field (e.g. "1.0, 1.0, 1.0") to be wrapped in double quotation marks (Stellarium requires no quotation marks).
  • Using QSettings with StelIniFormat causes unaccepptable append times when the file grows (>~40 entries). This most probably happens because StelIniParser uses QMap internally for the entry list. QMap orders its keys (in the case of strings - alphabetically) and it has to find the appropriate place in the ordering for every new key, which takes more and more time as the list grows.

Duplicates are removed: If any section in the file matches the "section_name" value of a new entry, it is removed. Invalid entries in the list (that don't contain a value for "section_name" or it is an empty string) are skipped and the processing continues from the next entry.

virtual bool SolarSystemEditor::configureGui ( bool  show)
virtual

called when the "configure" button in the "Plugins" tab is pressed

Reimplemented from StelModule.

virtual void SolarSystemEditor::deinit ( )
virtual

called before the plug-in is un-loaded.

Useful for stopping processes, unloading textures, etc.

Reimplemented from StelModule.

virtual void SolarSystemEditor::draw ( StelCore core)
virtual

draws on the view port.

Dialog windows don't need explicit drawing, it's done automatically. If a plug-in draws on the screen, it should be able to respect the night vision mode.

Reimplemented from StelModule.

virtual double SolarSystemEditor::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.

QString SolarSystemEditor::getCustomSolarSystemFilePath ( ) const
inline

returns the path

Definition at line 218 of file SolarSystemEditor.hpp.

QHash<QString,QString> SolarSystemEditor::getDefaultSsoIdentifiers ( )
inline

Returns the names of the objects listed in the default ssystem.ini.

The default solar system configuration file is assumed to be the one in the installation directory.

Definition at line 198 of file SolarSystemEditor.hpp.

virtual void SolarSystemEditor::init ( )
virtual

called when the plug-in is loaded.

All initializations should be done here.

Implements StelModule.

QHash<QString,QString> SolarSystemEditor::listAllLoadedSsoIdentifiers ( )

Lists the objects listed in the current user ssystem.ini.

As the name suggests, the list is compiled when the function is run.

SsoElements SolarSystemEditor::readMpcOneLineCometElements ( QString  oneLineElements)

Reads a single comet's orbital elements from a string.

This function converts a line of comet orbital elements in MPC format to a hash in Stellarium's ssystem.ini format. The MPC's one-line orbital elements format for comets is described on their website: http://www.minorplanetcenter.org/iau/info/CometOrbitFormat.html

Returns
an empty hash if there is an error or the source string is not a valid line in MPC format.
QList<SsoElements> SolarSystemEditor::readMpcOneLineCometElementsFromFile ( QString  filePath)

Reads a list of comet orbital elements from a file.

This function reads a list of comet orbital elements in MPC's one-line format from a file (one comet per line) and converts it to a list of hashes in Stellarium's ssystem.ini format. Example source file is the list of observable comets on the MPC's site: http://www.minorplanetcenter.org/iau/Ephemerides/Comets/Soft00Cmt.txt readMpcOneLineCometElements() is used internally to parse each line.

SsoElements SolarSystemEditor::readMpcOneLineMinorPlanetElements ( QString  oneLineElements)

Reads a single minor planet's orbital elements from a string.

This function converts a line of minor planet orbital elements in MPC format to a hash in Stellarium's ssystem.ini format. The MPC's one-line orbital elements format for minor planets is described on their website: http://www.minorplanetcenter.org/iau/info/MPOrbitFormat.html

Returns
an empty hash if there is an error or the source string is not a valid line in MPC format.
QList<SsoElements> SolarSystemEditor::readMpcOneLineMinorPlanetElementsFromFile ( QString  filePath)

Reads a list of minor planet orbital elements from a file.

This function reads a list of minor planets orbital elements in MPC's one-line format from a file (one comet per line) and converts it to a list of hashes in Stellarium's ssystem.ini format. Example source file is the list of bright asteroids on the MPC's site: http://www.minorplanetcenter.org/iau/Ephemerides/Bright/2010/Soft00Bright.txt readMpcOneLineMinorPlanetElements() is used internally to parse each line.

SsoElements SolarSystemEditor::readXEphemOneLineElements ( QString  oneLineElements)

Reads a single object's orbital elements from a string.

This function converts a line of orbital elements in XEphem format to a hash in Stellarium's ssystem.ini format. http://www.clearskyinstitute.com/xephem/help/xephem.html#mozTocId468501 It recognises only the 'e', 'h' and 'p' types of orbits in XEphem's format (comets and minor planets). It is used in handling on-line search queries to the MPC's Minor Planet and Comet Ephemeris System, as using the MPC format causes long object names to be truncated due to the fixed width of the columns. An object's type (comet or asteroid) is determined based on its name.

QList<SsoElements> SolarSystemEditor::readXEphemOneLineElementsFromFile ( QString  filePath)

Reads a list of Solar System object orbital elements from a file.

This function reads a list of Solar System object orbital elements in XEphem's one-line format (one object per line, comment lines starting with # are skipped) and converts it to a list of hashes in Stellarium's ssystem.ini format. XEphem's file format is described in its manual: http://www.clearskyinstitute.com/xephem/help/xephem.html#mozTocId468501 Example source file can be any of the lists of objects on the MPC site: http://www.minorplanetcenter.org/iau/Ephemerides/Comets/Soft03Cmt.txt http://www.minorplanetcenter.org/iau/Ephemerides/Bright/2010/Soft03Bright.txt readXEphemOneLineElements() is used internally to parse each line.

bool SolarSystemEditor::removeSsoWithName ( QString  name)

Removes an object from the user Solar System configuration file.

Reloads the Solar System on successfull removal.

  • name true name of the object ("name" parameter in the configuration file)
    Returns
    true if the entry has been removed successfully or there is no such entry
    false if there was an error
void SolarSystemEditor::resetSolarSystemToDefault ( )
slot

Resets the Solar System configuration file and reloads the Solar System.

virtual void SolarSystemEditor::update ( double  deltaTime)
virtual

Update the module with respect to the time.

Parameters
deltaTimethe time increment in second since last call.

Implements StelModule.

bool SolarSystemEditor::updateSolarSystemConfigurationFile ( QList< SsoElements >  objects,
UpdateFlags  flags 
)

Updates entries in the user solar system configuration file.

Parameters
objectsa list of data for already existing objects (non-existing ones are skipped);
flagsflags controlling what is being updated. See UpdateFlag.
Returns
false if the operation has failed completely for some reason.

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