Stellarium
24.3
|
Main class of the Solar System Editor plug-in which allows editing (add, delete, update) of the minor bodies. More...
#include <SolarSystemEditor.hpp>
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 | |
static QString | unpackMinorPlanetIAUDesignation (const QString &packedDesignation) |
Unpacks an MPC packed minor planet IAU designation. More... | |
static QString | unpackCometIAUDesignation (const QString &packedDesignation) |
Unpacks an MPC packed comet IAU designation. More... | |
void | resetSolarSystemToDefault () |
Resets the Solar System configuration file and reloads the Solar System. More... | |
Signals | |
void | solarSystemChanged () |
Public Member Functions | |
void | init () override |
called when the plug-in is loaded. More... | |
bool | configureGui (bool show) override |
called when the "configure" button in the "Plugins" tab is pressed | |
SsoElements | readMpcOneLineCometElements (const QString &oneLineElements) const |
Reads a single comet's orbital elements from a string. More... | |
SsoElements | readMpcOneLineMinorPlanetElements (const QString &oneLineElements) const |
Reads a single minor planet's orbital elements from a string. More... | |
QList< SsoElements > | readMpcOneLineCometElementsFromFile (const QString &filePath) const |
Reads a list of comet orbital elements from a file. More... | |
QList< SsoElements > | readMpcOneLineMinorPlanetElementsFromFile (const QString &filePath) const |
Reads a list of minor planet orbital elements from a file. More... | |
bool | appendToSolarSystemConfigurationFile (const SsoElements &object) |
Adds a new entry at the end of the user solar system configuration file. More... | |
bool | appendToSolarSystemConfigurationFile (const QList< SsoElements > &objectList) |
Adds new entries at the end of the user solar system configuration file. More... | |
bool | updateSolarSystemConfigurationFile (const QList< SsoElements > &objects, UpdateFlags flags) |
Updates entries in the user solar system configuration file. More... | |
QHash< QString, QString > | getDefaultSsoIdentifiers () const |
Returns the names of the objects listed in the default ssystem_major.ini. More... | |
QHash< QString, QString > | listAllLoadedSsoIdentifiers () const |
Lists the objects listed in the current user ssystem.ini. More... | |
bool | removeSsoWithName (const QString &name) |
Removes an object from the user Solar System configuration file. More... | |
bool | copySolarSystemConfigurationFileTo (const QString &filePath) |
Export current minor bodies file from user data directory (if it exists) to filePath. Return true on success. | |
bool | replaceSolarSystemConfigurationFileWith (const QString &filePath) |
Replace current minor bodies file in the user data directory. More... | |
bool | addFromSolarSystemConfigurationFile (const QString &filePath) |
(new 0.16) Loads all new objects from filePath (an .ini file), and updates existing objects Default proposal is ssystem_1000comets.ini in the installation dir. | |
QString | getCustomSolarSystemFilePath () const |
returns the path | |
Public Member Functions inherited from StelModule | |
StelModule () | |
Constructor. Every derived class MUST call setObjectName(className) in its constructor. | |
virtual void | deinit () |
Called before the module will be deleted, and before the OpenGL context is suppressed. More... | |
virtual QSettings * | getSettings () |
Return module-specific settings. More... | |
virtual void | draw (StelCore *core) |
Execute all the drawing functions for this module. More... | |
virtual void | update (double deltaTime) |
Update the module with respect to the time. More... | |
virtual QString | getModuleVersion () const |
Get the version of the module, default is stellarium main version. | |
virtual QString | getAuthorName () const |
Get the name of the module author. | |
virtual QString | getAuthorEmail () const |
Get the email address of the module author. | |
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... | |
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... | |
Static Public Member Functions | |
static int | unpackAlphanumericNumber (QChar prefix, int lastDigit) |
Converts a two-character number used in MPC packed IAU designations. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from StelModule | |
class StelAction * | addAction (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 StelAction * | addAction (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... | |
StelAction * | addAction (const QString &id, const QString &groupId, const QString &text, QObject *contextObject, std::function< void()> lambda, const QString &shortcut="", const QString &altShortcut="") |
convenience methods to add an action (call to Lambda functor) to the StelActionMgr object. More... | |
Main class of the Solar System Editor plug-in which allows editing (add, delete, update) of the minor bodies.
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 the detection of duplicates more difficult.
Flags to control the updateSolarSystemConfigurationFile() function.
bool SolarSystemEditor::appendToSolarSystemConfigurationFile | ( | const QList< SsoElements > & | objectList | ) |
Adds new entries at the end of the user solar system configuration file.
XXX Also updates existing objects (by removing and then appending) This function writes directly to the file. QSettings was not used, as:
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.
bool SolarSystemEditor::appendToSolarSystemConfigurationFile | ( | const 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.
|
inline |
Returns the names of the objects listed in the default ssystem_major.ini.
The default solar system configuration file is assumed to be the one in the installation directory.
|
overridevirtual |
QHash<QString,QString> SolarSystemEditor::listAllLoadedSsoIdentifiers | ( | ) | const |
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 | ( | const QString & | oneLineElements | ) | const |
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
QList<SsoElements> SolarSystemEditor::readMpcOneLineCometElementsFromFile | ( | const QString & | filePath | ) | const |
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 | ( | const QString & | oneLineElements | ) | const |
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
QList<SsoElements> SolarSystemEditor::readMpcOneLineMinorPlanetElementsFromFile | ( | const QString & | filePath | ) | const |
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.
bool SolarSystemEditor::removeSsoWithName | ( | const QString & | name | ) |
Removes an object from the user Solar System configuration file.
Reloads the Solar System on successful removal.
bool SolarSystemEditor::replaceSolarSystemConfigurationFileWith | ( | const QString & | filePath | ) |
Replace current minor bodies file in the user data directory.
Writes warning to logfile and returns false in case of problems.
|
slot |
Resets the Solar System configuration file and reloads the Solar System.
|
static |
Converts a two-character number used in MPC packed IAU designations.
See http://www.minorplanetcenter.org/iau/info/PackedDes.html This function is used for both asteroid and comet designations.
|
staticslot |
Unpacks an MPC packed comet IAU designation.
(7-letter variant only) See https://www.minorplanetcenter.org/iau/info/PackedDes.html
|
staticslot |
Unpacks an MPC packed minor planet IAU designation.
See https://www.minorplanetcenter.org/iau/info/PackedDes.html
bool SolarSystemEditor::updateSolarSystemConfigurationFile | ( | const QList< SsoElements > & | objects, |
UpdateFlags | flags | ||
) |
Updates entries in the user solar system configuration file.
objects | a list of data for already existing objects (non-existing ones are skipped); |
flags | flags controlling what is being updated. See UpdateFlag. |