85 lines
2.8 KiB
C++
85 lines
2.8 KiB
C++
#pragma once
|
|
|
|
#include "SatelliteData.h"
|
|
|
|
#include <QElapsedTimer>
|
|
#include <QImage>
|
|
#include <QPoint>
|
|
#include <QPixmap>
|
|
#include <QSet>
|
|
#include <QTimer>
|
|
#include <QWidget>
|
|
|
|
class GlobeWidget : public QWidget {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit GlobeWidget(QWidget *parent = nullptr);
|
|
|
|
void setSatellites(const QVector<SatellitePosition> &satellites);
|
|
void setSatelliteMotion(const QVector<SatellitePosition> ¤t,
|
|
const QVector<SatellitePosition> &next,
|
|
int durationMs);
|
|
void setObservedPrns(const QSet<QString> &prns);
|
|
void setReceiverLocation(double latitude, double longitude);
|
|
void clearReceiverLocation();
|
|
void setRinexStatus(const QString &status, bool error);
|
|
[[nodiscard]] QSet<QString> observedPrns() const { return m_observedPrns; }
|
|
|
|
public slots:
|
|
void setElevationMask(double degrees);
|
|
|
|
protected:
|
|
void paintEvent(QPaintEvent *event) override;
|
|
void mousePressEvent(QMouseEvent *event) override;
|
|
void mouseMoveEvent(QMouseEvent *event) override;
|
|
void mouseReleaseEvent(QMouseEvent *event) override;
|
|
void wheelEvent(QWheelEvent *event) override;
|
|
|
|
private:
|
|
struct ProjectedPoint {
|
|
QPointF point;
|
|
double depth = 0.0;
|
|
};
|
|
|
|
ProjectedPoint project(double x, double y, double z, double radius) const;
|
|
void drawStars(QPainter &painter) const;
|
|
void drawOrbit(QPainter &painter, double inclination, double node) const;
|
|
void drawContinents(QPainter &painter) const;
|
|
void drawVisibilityCone(QPainter &painter) const;
|
|
void drawGraticule(QPainter &painter) const;
|
|
void drawReceiver(QPainter &painter) const;
|
|
int drawSatellites(QPainter &painter) const;
|
|
double satelliteElevation(const SatellitePosition &satellite) const;
|
|
void updateSatelliteAnimation();
|
|
void rebuildStaticLayer();
|
|
|
|
QVector<SatellitePosition> m_satellites;
|
|
QVector<SatellitePosition> m_satelliteMotionStart;
|
|
QVector<SatellitePosition> m_satelliteMotionTarget;
|
|
QElapsedTimer m_satelliteMotionClock;
|
|
QTimer m_satelliteAnimationTimer;
|
|
int m_satelliteMotionDurationMs = 0;
|
|
mutable QImage m_landTexture;
|
|
mutable double m_landTextureYaw = 0.0;
|
|
mutable double m_landTexturePitch = 0.0;
|
|
QPixmap m_staticLayer;
|
|
QSize m_staticLayerSize;
|
|
qreal m_staticLayerDevicePixelRatio = 0.0;
|
|
double m_staticLayerYaw = 0.0;
|
|
double m_staticLayerPitch = 0.0;
|
|
double m_staticLayerZoom = 0.0;
|
|
QSet<QString> m_observedPrns;
|
|
QString m_status = QStringLiteral("Konum bekleniyor");
|
|
bool m_statusError = false;
|
|
bool m_hasReceiver = false;
|
|
double m_receiverLatitude = 0.0;
|
|
double m_receiverLongitude = 0.0;
|
|
double m_yaw = -0.55;
|
|
double m_pitch = -0.28;
|
|
double m_zoom = 1.0;
|
|
double m_elevationMaskDegrees = 10.0;
|
|
bool m_dragging = false;
|
|
QPoint m_lastMousePosition;
|
|
};
|