Satellite.hpp   Satellite.hpp 
skipping to change at line 23 skipping to change at line 23
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*/ */
#ifndef _SATELLITE_HPP_ #ifndef _SATELLITE_HPP_
#define _SATELLITE_HPP_ 1 #define _SATELLITE_HPP_ 1
#include <QVariant> #include <QDateTime>
#include <QString>
#include <QStringList>
#include <QFont> #include <QFont>
#include <QList> #include <QList>
#include <QDateTime> #include <QSharedPointer>
#include <QString>
#include <QStringList>
#include <QVariant>
#include "StelObject.hpp" #include "StelObject.hpp"
#include "StelSphereGeometry.hpp" #include "StelSphereGeometry.hpp"
#include "StelProjectorType.hpp" #include "StelProjectorType.hpp"
#include "gSatWrapper.hpp" #include "gSatWrapper.hpp"
class StelLocation; class StelLocation;
//! Radio communication channel properties.
typedef struct typedef struct
{ {
double frequency; double frequency; //!< Channel frequency in MHz.
QString modulation; QString modulation; //!< Signal modulation mode.
QString description; QString description; //!< Channel description.
} commLink; } CommLink;
//! Description of the data roles used in SatellitesListModel.
enum SatelliteDataRole {
SatIdRole = Qt::UserRole,
SatDescriptionRole,
SatFlagsRole,
SatGroupsRole,
FirstLineRole,
SecondLineRole
};
//! Type for sets of satellite group IDs.
typedef QSet<QString> GroupSet;
//! Flag type reflecting internal flags of Satellite.
enum SatFlag
{
SatNoFlags = 0x0,
SatDisplayed = 0x1,
SatNotDisplayed = 0x2,
SatUser = 0x4,
SatOrbit = 0x8,
SatNew = 0x10,
SatError = 0x20
};
typedef QFlags<SatFlag> SatFlags;
Q_DECLARE_OPERATORS_FOR_FLAGS(SatFlags)
// Allows the type to be used by QVariant
Q_DECLARE_METATYPE(GroupSet)
Q_DECLARE_METATYPE(SatFlags)
//! @class Satellite //! @class Satellite
//! A Satellite object represents one satellite in Earth orbit. //! A representation of a satellite in Earth orbit.
//! Details about the satellite are passed using a QVariant which contains //! Details about the satellite are passed with a JSON-representation struc
//! a map of data from the json file. ture
//! that contains a @ref satcat "satellite catalog" entry.
//!
//! Thanks to operator<() overloading, container classes (QList, QMap, etc)
//! with Satellite or SatelliteP objects can be sorted by satellite name/ID
.
class Satellite : public StelObject class Satellite : public StelObject
{ {
friend class Satellites; friend class Satellites;
friend class SatellitesDialog; friend class SatellitesDialog;
friend class SatellitesListModel;
public: public:
//! \param identifier unique identifier (currently the Catalog Numbe r) //! \param identifier unique identifier (currently the Catalog Numbe r)
//! \param data a QMap which contains the details of the satellite //! \param data a QMap which contains the details of the satellite
//! (TLE set, description etc.) //! (TLE set, description etc.)
Satellite(const QString& identifier, const QVariantMap& data); Satellite(const QString& identifier, const QVariantMap& data);
~Satellite(); ~Satellite();
//! Get a QVariantMap which describes the satellite. Could be used to //! Get a QVariantMap which describes the satellite. Could be used to
//! create a duplicate. //! create a duplicate.
QVariantMap getMap(void); QVariantMap getMap(void);
virtual QString getType(void) const virtual QString getType(void) const
{ {
return "Satellite"; return "Satellite";
} }
virtual float getSelectPriority(const StelCore* core) const; virtual float getSelectPriority(const StelCore* core) const;
//! Get an HTML string to describe the object //! Get an HTML string to describe the object
//! @param core A pointer to the core //! @param core A pointer to the core
//! @flags a set of flags with information types to include. //! @param flags a set of flags with information types to include.
//! Supported types for Satellite objects: //! Supported types for Satellite objects:
//! - Name: designation in large type with the description underneat h //! - Name: designation in large type with the description underneat h
//! - RaDecJ2000, RaDecOfDate, HourAngle, AltAzi //! - RaDecJ2000, RaDecOfDate, HourAngle, AltAzi
//! - Extra1: range, rage rate and altitude of satellite above the E arth //! - Extra1: range, rage rate and altitude of satellite above the E arth
//! - Extra2: Comms frequencies, modulation types and so on. //! - Extra2: Comms frequencies, modulation types and so on.
virtual QString getInfoString(const StelCore *core, const InfoString Group& flags) const; virtual QString getInfoString(const StelCore *core, const InfoString Group& flags) const;
virtual Vec3f getInfoColor(void) const; virtual Vec3f getInfoColor(void) const;
virtual Vec3d getJ2000EquatorialPos(const StelCore*) const; virtual Vec3d getJ2000EquatorialPos(const StelCore*) const;
virtual float getVMagnitude(const StelCore* core=NULL, bool withExti nction=false) const; virtual float getVMagnitude(const StelCore* core=NULL, bool withExti nction=false) const;
virtual double getAngularSize(const StelCore* core) const; virtual double getAngularSize(const StelCore* core) const;
skipping to change at line 111 skipping to change at line 149
double getDoppler(double freq) const; double getDoppler(double freq) const;
static float showLabels; static float showLabels;
static double roundToDp(float n, int dp); static double roundToDp(float n, int dp);
// when the observer location changes we need to // when the observer location changes we need to
void recalculateOrbitLines(void); void recalculateOrbitLines(void);
void setNew() {newlyAdded = true;} void setNew() {newlyAdded = true;}
bool isNew() const {return newlyAdded;} bool isNew() const {return newlyAdded;}
static QString extractInternationalDesignator(const QString& tle1); //! Get internal flags as a single value.
static int extractLaunchYear(const QString& tle1); SatFlags getFlags();
//! Sets the internal flags in one operation (only display flags)!
public: void setFlags(const SatFlags& flags);
void enableDrawOrbit(bool b);
//! Parse TLE line to extract International Designator and launch ye
ar.
//! Sets #internationalDesignator and #jdLaunchYearJan1.
void parseInternationalDesignator(const QString& tle1);
//! Needed for sorting lists (if this ever happens...).
//! Compares #name fields. If equal, #id fields, which can't be.
bool operator<(const Satellite& another) const;
private: private:
//draw orbits methods //draw orbits methods
void computeOrbitPoints(); void computeOrbitPoints();
void drawOrbit(class StelRenderer* renderer, StelProjectorP projecto r); void drawOrbit(class StelRenderer* renderer, StelProjectorP projecto r);
//! returns 0 - 1.0 for the DRAWORBIT_FADE_NUMBER segments at //! returns 0 - 1.0 for the DRAWORBIT_FADE_NUMBER segments at
//! each end of an orbit, with 1 in the middle. //! each end of an orbit, with 1 in the middle.
float calculateOrbitSegmentIntensity(int segNum); float calculateOrbitSegmentIntensity(int segNum);
void setNightColors(bool night); void setNightColors(bool night);
private: private:
bool initialized; bool initialized;
bool visible; //! Flag indicating whether the satellite should be displayed.
bool orbitVisible; // draw orbit enabled/disabled //! Should not be confused with the pedicted visibility of the
//! actual satellite to the observer.
bool displayed;
//! Flag indicating whether an orbit section should be displayed.
bool orbitDisplayed; // draw orbit enabled/disabled
//! Flag indicating that the satellite is user-defined.
//! This means that its TLE set shouldn't be updated and the satelli
te
//! itself shouldn't be removed if auto-remove is enabled.
bool userDefined;
//! Flag indicating that the satellite was added during the current
session.
bool newlyAdded; bool newlyAdded;
bool orbitValid; bool orbitValid;
//! Identifier of the satellite, must be unique within the list. //! Identifier of the satellite, must be unique within the list.
//! Currently, the Satellite Catalog Number is used. It is contained //! Currently, the Satellite Catalog Number/NORAD Number is used,
in both //! as it is unique and it is contained in both lines of TLE sets.
//! numbered lines of TLE sets.
QString id; QString id;
//! Human-readable name of the satellite. //! Human-readable name of the satellite.
//! Usually the string in the "Title line" of TLE sets. //! Usually the string in the "Title line" of TLE sets.
QString name; QString name;
//! Longer description of the satellite. //! Longer description of the satellite.
QString description; QString description;
//! International Designator / COSPAR designation / NSSDC ID //! International Designator / COSPAR designation / NSSDC ID.
QString internationalDesignator; QString internationalDesignator;
//! JD for Jan 1st of launch year, extracted from TLE (will be for 1 //! Julian date of Jan 1st of the launch year.
957-1-1 if extraction fails). Used to hide objects before launch year. //! Used to hide satellites before their launch date.
//! Extracted from TLE set with parseInternationalDesignator().
//! It defaults to 1 Jan 1957 if extraction fails.
double jdLaunchYearJan1; double jdLaunchYearJan1;
//! Contains the J2000 position //! Contains the J2000 position.
Vec3d XYZ; Vec3d XYZ;
QPair< QByteArray, QByteArray > tleElements; QPair< QByteArray, QByteArray > tleElements;
double height, range, rangeRate; double height, range, rangeRate;
QList<commLink> comms; QList<CommLink> comms;
Vec3f hintColor; Vec3f hintColor;
QStringList groupIDs; //! Identifiers of the groups to which the satellite belongs.
//! See @ref groups.
GroupSet groups;
QDateTime lastUpdated; QDateTime lastUpdated;
static SphericalCap viewportHalfspace; static SphericalCap viewportHalfspace;
static float hintBrightness; static float hintBrightness;
static float hintScale; static float hintScale;
static int orbitLineSegments; static int orbitLineSegments;
static int orbitLineFadeSegments; static int orbitLineFadeSegments;
static int orbitLineSegmentDuration; //measured in seconds static int orbitLineSegmentDuration; //measured in seconds
static bool orbitLinesFlag; static bool orbitLinesFlag;
//! Mask controlling which info display flags should be honored.
static StelObject::InfoStringGroupFlags flagsMask;
void draw(const StelCore* core, class StelRenderer* renderer, void draw(const StelCore* core, class StelRenderer* renderer,
StelProjectorP projector, class StelTextureNew* hintTextur e); StelProjectorP projector, class StelTextureNew* hintTextur e);
//Satellite Orbit Position calculation //Satellite Orbit Position calculation
gSatWrapper *pSatWrapper; gSatWrapper *pSatWrapper;
Vec3d position; Vec3d position;
Vec3d velocity; Vec3d velocity;
Vec3d latLongSubPointPosition; Vec3d latLongSubPointPosition;
Vec3d elAzPosition; Vec3d elAzPosition;
int visibility; int visibility;
//Satellite Orbit Draw //Satellite Orbit Draw
QFont font; QFont font;
Vec3f orbitColorNormal; Vec3f orbitColorNormal;
Vec3f orbitColorNight; Vec3f orbitColorNight;
Vec3f* orbitColor; Vec3f* orbitColor;
double lastEpochCompForOrbit; //measured in Julian Days double lastEpochCompForOrbit; //measured in Julian Days
double epochTime; //measured in Julian Days double epochTime; //measured in Julian Days
QList<Vec3d> orbitPoints; //orbit points represented by ElAzPos vect ors QList<Vec3d> orbitPoints; //orbit points represented by ElAzPos vect ors
}; };
typedef QSharedPointer<Satellite> SatelliteP;
bool operator<(const SatelliteP& left, const SatelliteP& right);
#endif // _SATELLITE_HPP_ #endif // _SATELLITE_HPP_
 End of changes. 18 change blocks. 
29 lines changed or deleted 95 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/