#ifndef MAINWINDOW_H #define MAINWINDOW_H #include #include namespace Ui { class MainWindow; } #include #include #include #include "./SQLite3/SQLite3Manager.h" #include "JSonDealer.h" #include "DataParser.h" #include "DeviceStatusPanel.h" #include "AlgorithmParamsPanel.h" #include "WaterfallChart.h" typedef struct tagKeyNodeInfo { int nNum; double dLng; double dLat; double dDistance; } KeyNodeInfo; class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); private slots: void OnGetKeyNodeIndex(); void OnUpdateLastKeyNodeIndex(int nLastKeyNodeIndex); void OnGetKeyNodeDistance(int nKeyNodeIndex); void OnResetDB(); void OnLoadDB(); void OnUpdateDB(const QString& strMarkerInfo); void OnAddMarker(int nNum, double dLng, double dLat); void OnDeleteMarker(int nNum, double dLng, double dLat); void OnUpdateMarker(int nNum, double dLng, double dLat); void OnButtonClicked(); private: bool GetKeyNodeIndex(int& nKeyNodeIndex); int UpdateLastKeyNodeIndex(int nLastKeyNodeIndex); double GetKeyNodeDistance(int nKeyNodeIndex); bool ResetDB(bool bReset); bool LoadDB(); bool UpdateDB(const QString& strMarkerInfo); bool AddMarker(int nNum, double dLng, double dLat); bool DetletMarker(int nKeyNodeIndex); bool UpdateMarker(int nKeyNodeIndex, double dLng, double dLat); private: bool Distance2Coordination(double& dLng, double& dLat, double dDistance); private: typedef void (MainWindow::*ThreadRunFunPtr)(); static void ThreadEntry(ThreadRunFunPtr pRunFun, void* pOwner); void ThreadFun_CalcKeyNodeDistance(); bool StartThread_CalcKeyNodeDistance(); void StopThread_CalcKeyNodeDistance(); bool CalcKeyNodeDistance(); private: Ui::MainWindow* ui; QWebEngineView* m_pWebEngineView; SQLite3Manager* m_pSQLite3Manager; JSonDealer m_varJSonDealer; DataParser m_varDataParser; DeviceStatusPanel* m_pDeviceStatusPanel; AlgorithmParamsPanel* m_pAlgorithmParamsPanel; WaterfallChart* m_pWaterfallChart; // bool m_bCalcKeyNodeDistance; bool m_bThreadRunning_CalcKeyNodeDistance; std::thread* m_ptrThread_CalcKeyNodeDistance; std::map m_mapKeyNodeInfo; std::mutex m_mutexKeyNodeInfo; }; #endif // MAINWINDOW_H