Files
fmviewer3/project/fm_viewer/ui/rm_dialog_map.h
2026-02-21 17:11:31 +09:00

157 lines
3.5 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#ifndef RM_DIALOG_MAP_H
#define RM_DIALOG_MAP_H
#if !(DO_NOT_USE_MAP)
#if !(USE_WEBVIEW2)
#include <QDialog>
#include <QVBoxLayout>
#include <QMap>
#include "../rm_app.h"
#include "../fm_event_types.h"
//#include "../core/rm_player_base.h"
#include <QMainWindow>
#if (TEST_MAP_MOVE_THREAD)
#include "rm_map_thread.h"
#endif
class RMVideoItem;
class RMSensorData;
// 전체 경로를 그리는 방식이라 무조건 처음부터 사용해야함...
class TitleWidget;
class RMWidgetDrag;
class RMWidgetMap;
#if (KMH_MPH_TOGGLE)
class RMSpeedLabel;
#endif
class RMDialogMap : public QDialog
{
Q_OBJECT
friend class RMExcelReport;
public:
//static void start(); // show
static RMDialogMap* instance(QWidget* parent = nullptr);
//#if (TOGGLE_PLAYER)
// ~RMDialogMap();
//#endif
bool isHiddenReal();
bool isGPSExist();
static double distance(double slat, double slon, double dlat, double dlon)
{
double R = 6378137; // Earths mean radius in meter
double dLat = (dlat - slat) * 0.0174533; // degree to radian
double dLong = (dlon - slon) * 0.0174533;
double a = sin(dLat / 2) * sin(dLat / 2) +
cos(slat * 0.0174533) * cos(dlat * 0.0174533) *
sin(dLong / 2) * sin(dLong / 2);
double c = 2 * atan2(sqrt(a), sqrt(1 - a));
double d = R * c;
return d;
}
#if (TOGGLE_PLAYER || USE_MAXIMIZE)
void snapTo(QWidget* target);
#endif
#if (USE_HTML_MAP)
void removeHtml();
#endif
#if (KMH_MPH_TOGGLE)
#if (MODEL_BBVIEWER)
RMSpeedLabel* speedLabel;
#endif
void refreshSpeedBarUnit();
#endif
void runScript(QString script);
private:
double lonX;
double latY;
double speed;
RMSensorData* sensor;
// 기존 위치 확인해서 2초 이상 점프시 라인 그리지 않는다 SEEK
qint64 _lastPosition;
// 연속 그리기 방지
QMap<QString,bool> _drawList;
QString _packLine(double lon1, double lat1, double lon2, double lat2);
bool _bFirst;
bool _bHTMLLoaded;
explicit RMDialogMap(QWidget *parent = nullptr);
bool _hideOnFullScreen;
void initHtml();
#if (USE_RM_KEYBOARD_EVENT)
void keyPressEvent(QKeyEvent *event);
void keyReleaseEvent(QKeyEvent *event);
#endif
#if (TOGGLE_PLAYER)
QWidget* snapTarget;
#endif
#if !(TOGGLE_PLAYER)
QLabel* highLable; // 고속 MPH 의 경우 변경하기 위해
QLabel* lowLable;
#endif
protected:
#if !(TOGGLE_PLAYER)
TitleWidget* _title;
#endif
QVBoxLayout* _layout;
RMWidgetMap* _map;
#if !(TOGGLE_PLAYER)
RMWidgetDrag* _drag;
#endif
void moveTo(double lon, double lat, double speed, bool drawLine);
#if (TEST_MAP_MOVE_THREAD)
RMMapUpdater updater;
#endif
#if (LIVE_LANGUAGE_CHANGE && MODEL_STANDARD)
void refreshLanguage();
#endif
//#if (TOGGLE_PLAYER)
// // SNAP
// bool eventFilter(QObject *o, QEvent *e) override;
//#endif
signals:
public slots:
void onClose();
void onAppEvent(RMApp::Event event,int param);
void activexEventHandler(const QString &name, int argc, void *argv);
#if (TEST_MAP_MOVE_THREAD)
void onMoveToProcess(double lon, double lat, double speed, bool drawLine);
#endif
void onPlayEvent(PLAY_EVENT event,RMVideoItem* item);
void onPositionChanged(qint64 position,qint64 duration);
#if (KMH_MPH_TOGGLE)
void onSpeedUnitChange();
#endif
#if (LIVE_LANGUAGE_CHANGE)
void onLanguageChange(RMLanguage::LANGUAGE_TYPE language);
#endif
};
#endif // #if !(USE_WEBVIEW2)
#endif // #if !(DO_NOT_USE_MAP)
#endif // RM_DIALOG_MAP_H