File indexing completed on 2024-04-28 03:50:24

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2011 Guillaume Martres <smarter@ubuntu.com>
0004 //
0005 
0006 #ifndef MARBLE_SATELLITESMODEL_H
0007 #define MARBLE_SATELLITESMODEL_H
0008 
0009 #include <QStringList>
0010 #include <QVector>
0011 
0012 #include "TrackerPluginModel.h"
0013 
0014 class QVariant;
0015 
0016 namespace Marble {
0017 
0018 class MarbleClock;
0019 
0020 /**
0021  * The model for satellites.
0022  */
0023 class SatellitesModel : public TrackerPluginModel
0024 {
0025     Q_OBJECT
0026 public:
0027     SatellitesModel( GeoDataTreeModel *treeModel,
0028                      const MarbleClock *clock );
0029 
0030     void loadSettings( const QHash<QString, QVariant> &settings );
0031     void setPlanet( const QString &lcPlanet );
0032     void updateVisibility();
0033 
0034     void parseFile( const QString &id, const QByteArray &file ) override;
0035 
0036 protected:
0037     /**
0038      * Parse the Marble Satellite Catalog @p id with content @p data.
0039      * A description of the Marble Satellites Catalog format can be found at:
0040      * https://techbase.kde.org/Projects/Marble/SatelliteCatalogFormat
0041      */
0042     void parseCatalog( const QString &id, const QByteArray &data );
0043     /**
0044      * Parse the two line elements set file @p id with content @p data.
0045      */
0046     void parseTLE( const QString &id, const QByteArray &data );
0047 
0048 private:
0049     void setupColors();
0050     QColor nextColor();
0051 
0052 private:
0053     const MarbleClock *m_clock;
0054     QStringList m_enabledIds;
0055     QString m_lcPlanet;
0056     QVector<QColor> m_colorList;
0057     int m_currentColorIndex;
0058 };
0059 
0060 } // namespace Marble
0061 
0062 #endif // MARBLE_SATELLITESMODEL_H