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_SATELLITESTLEITEM_H
0007 #define MARBLE_SATELLITESTLEITEM_H
0008 
0009 #include "TrackerPluginItem.h"
0010 
0011 #include <sgp4unit.h>
0012 
0013 class QColor;
0014 class QDateTime;
0015 
0016 namespace Marble {
0017 
0018 class GeoDataCoordinates;
0019 class GeoDataTrack;
0020 class MarbleClock;
0021 
0022 /**
0023  * An instance SatellitesTLEItem represents an item of a two-line-elements
0024  * set catalog.
0025  */
0026 class SatellitesTLEItem : public TrackerPluginItem
0027 {
0028 public:
0029     SatellitesTLEItem( const QString &name,
0030                        elsetrec satrec,
0031                        const MarbleClock *clock );
0032 
0033     void update() override;
0034 
0035 private:
0036     double m_earthSemiMajorAxis; // in km
0037     elsetrec m_satrec;
0038 
0039     GeoDataTrack *m_track;
0040 
0041     const MarbleClock *m_clock;
0042 
0043     void setDescription();
0044 
0045     /**
0046      * Add a point in the GeoDataTrack geometry of the placemark with time
0047      * dateTime and coordinates of the satellite determined from m_satrec.
0048      */
0049     void addPointAt( const QDateTime &dateTime );
0050 
0051     /**
0052      * Create a GeoDataCoordinates object from the cartesian coordinates
0053      * @p x, @p y and @p z in km in the Earth-centered inertial frame known
0054      * as TEME (True equator, Mean equinox) with Greenwich Mean Sidereal Time
0055      * @p gmst in radians at time of observation.
0056      */
0057     GeoDataCoordinates fromTEME( double x, double y, double z, double gmst ) const;
0058 
0059     /**
0060      * @return The time at the satellite epoch determined from m_satrec
0061      */
0062     QDateTime timeAtEpoch() const;
0063 
0064     /**
0065      * @return The orbital period of the satellite in seconds
0066      */
0067     double period() const;
0068 
0069     /**
0070      * @return The apogee of the satellite in km
0071      */
0072     double apogee() const;
0073     /**
0074      * @return The perigee of the satellite in km
0075      */
0076     double perigee() const;
0077     /**
0078      * @return The semi-major axis in km
0079      */
0080     double semiMajorAxis() const;
0081 
0082     /**
0083      * @return The inclination in degrees
0084      */
0085     double inclination() const;
0086 
0087     /**
0088      * Returns the Greenwich Mean Sideral Time in radians, @p minutes
0089      * after the epoch.
0090      */
0091     double gmst( double minutes ) const;
0092 
0093     /**
0094      * @return The square of @p x
0095      */
0096     static double square( double x );
0097 };
0098 
0099 } // namespace Marble
0100 
0101 #endif // MARBLE_SATELLITESTLEITEM_H