|
|
#ifndef MAINWINDOW_H
|
|
|
#define MAINWINDOW_H
|
|
|
|
|
|
//MSVC编译器界面显示乱码问题
|
|
|
#if _MSC_VER >= 1600
|
|
|
#pragma execution_character_set("utf-8")
|
|
|
#endif
|
|
|
|
|
|
#include <QMainWindow>
|
|
|
#include <QStackedWidget>
|
|
|
#include <QProgressDialog>
|
|
|
#include <QString>
|
|
|
#include <QMutex>
|
|
|
#include <QWidgetAction>
|
|
|
|
|
|
//子窗口头文件
|
|
|
#include "saveroutedialog.h"
|
|
|
#include "bindroutedialog.h"
|
|
|
#include "flysimulateddlg.h"
|
|
|
#include "computeoffsetpositiondialog.h"
|
|
|
#include "QNotify/NotifyManager.h"
|
|
|
|
|
|
//supermap
|
|
|
#include <Workspace/UGWorkspace.h>
|
|
|
#include <Engine/UGDataset.h>
|
|
|
#include "Map/UGLayer.h"
|
|
|
#include "scenecontrol.h"
|
|
|
#include "sceneview.h"
|
|
|
|
|
|
#include "realtimepositioninfothread.h"
|
|
|
#include "collisiondetectionthread.h"
|
|
|
#include "geofileparser.h"
|
|
|
#include "global.h"
|
|
|
|
|
|
namespace UGC
|
|
|
{
|
|
|
class UGWorkspace;
|
|
|
class UGImage;
|
|
|
class UGGraphics;
|
|
|
class UGDataset;
|
|
|
class UGDataSource;
|
|
|
class UGLayer;
|
|
|
class UGMap;
|
|
|
class UGDatasetVector;
|
|
|
// class UGMapEditorWnd;
|
|
|
}
|
|
|
using namespace UGC;
|
|
|
using namespace std;
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
namespace Ui { class MainWindow; }
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
class QMapControl; //声明所依赖的QMapControl类
|
|
|
|
|
|
class MainWindow : public QMainWindow
|
|
|
{
|
|
|
Q_OBJECT
|
|
|
|
|
|
public:
|
|
|
enum RBtnMenuType
|
|
|
{
|
|
|
DefaultMenu,
|
|
|
AttributeMenu,
|
|
|
EditMenu
|
|
|
};
|
|
|
Q_ENUM(RBtnMenuType);
|
|
|
|
|
|
enum MapType
|
|
|
{
|
|
|
Map2D,
|
|
|
Map3D,
|
|
|
};
|
|
|
Q_ENUM(MapType);
|
|
|
|
|
|
MainWindow(QWidget *parent = nullptr);
|
|
|
~MainWindow();
|
|
|
|
|
|
private:
|
|
|
void setupUI(QMainWindow* mainWindow);//声明搭建界面的函数
|
|
|
|
|
|
void initNotifyManager();//全局消息通知对象初始化设置
|
|
|
|
|
|
void initWorkSpace();//工作空间初始化
|
|
|
|
|
|
void initMapControl(); //二维地图容器初始化
|
|
|
|
|
|
void initMenu(QMainWindow* mainWindow); //Map菜单初始化
|
|
|
|
|
|
void initMainToolBar(QMainWindow* mainWindow); //工具条初始化
|
|
|
|
|
|
void addMapAction(QMainWindow *mainWindow);//声明界面上各元素的行为函数
|
|
|
|
|
|
void addMapMenuAction();//声明Map右键菜单的行为函数
|
|
|
|
|
|
void addEditToolAction();//声明编辑条的行为行数
|
|
|
|
|
|
void addMapConnect();//声明Map连接信号和槽的函数
|
|
|
|
|
|
void addEditConnect();//声明edit连接信号和槽的函数
|
|
|
|
|
|
void initSceneControl(QWidget* parent); //三维场景容器初始化
|
|
|
|
|
|
void initSceneMene(); //场景菜单初始化
|
|
|
|
|
|
void addSceneMenuAction();//声明Scene右键菜单的行为函数
|
|
|
|
|
|
void addSceneActionConnect(); //声明Scene QAction连接信号和槽的函数
|
|
|
|
|
|
void addSceneConnect();//声明Scene连接信号和槽的函数
|
|
|
|
|
|
UGbool DirExist(QString fullPath); //判断文件夹是否存在
|
|
|
|
|
|
void importKMLData(); //导入KML,仅用于二维地图
|
|
|
|
|
|
void importKML3DData(); //导入KML,仅用于三维地图
|
|
|
|
|
|
void exportKMLFile(); //导出KML文件
|
|
|
|
|
|
//加载模型文件
|
|
|
void loadModelData();
|
|
|
|
|
|
protected:
|
|
|
// 如果窗口设置了 Qt::DefaultContextMenu 策略,
|
|
|
// 点击鼠标右键该函数被Qt框架调用
|
|
|
void contextMenuEvent(QContextMenuEvent *event);
|
|
|
public:
|
|
|
//启动|关闭接收实时位置数据总线程
|
|
|
void startReceiveRealTimePositionInfoThread();
|
|
|
void closeReceiveRealTimePositionInfoThread();
|
|
|
//启动|关闭碰撞检测子线程
|
|
|
void startCollisionDetectThread(int ms=1000);
|
|
|
void closeCollisionDetectThread();
|
|
|
|
|
|
private:
|
|
|
Ui::MainWindow *ui;
|
|
|
QStackedWidget* stackedWidget;
|
|
|
QProgressDialog* progressDlg;
|
|
|
|
|
|
NotifyManager* notifyManager;//全局消息通知管理对象
|
|
|
//线程对象
|
|
|
QThread* receiveRealTimePositionInfoThread;//接收外部实时数据线程对象
|
|
|
RealTimePositionInfoThread* receiveRealTimePositionInfoTask;//接收外部实时数据线程任务对象
|
|
|
QThread* collisionThread; //碰撞检测线程对象
|
|
|
CollisionDetectionThread* collisionDetectionTask;//碰撞检测线程任务对象
|
|
|
|
|
|
RBtnMenuType rMenuType;
|
|
|
MapType mapType;
|
|
|
|
|
|
ComputeOffsetPositionDialog* inputPosDlg;
|
|
|
saveRouteDialog *saveRouteDlg;
|
|
|
bindRouteDialog *bindRouteDlg;
|
|
|
FlySimulatedDlg *flySimulatedDlg;
|
|
|
|
|
|
GeoFileParser geoFileParser;
|
|
|
|
|
|
QMapControl* qMapControl;//声明一个地图窗口对象,QMapControl类对象
|
|
|
|
|
|
SceneControl* pSceneControl; //三维场景对象
|
|
|
SceneView* pSceneView;
|
|
|
|
|
|
UGWorkspace* m_pWorkspace; //声明一个工作空间对象
|
|
|
|
|
|
QMenu* mapRBtnMenu;//声明一个地图右键菜单对象
|
|
|
//声明右键菜单各按钮对象
|
|
|
QAction* actionShowRoute; //显示航线
|
|
|
QAction* actionBindRoute;//装订航线
|
|
|
QAction* actionImportRoute; //导入航线
|
|
|
|
|
|
QMenu* attributeRBtnMenu; //声明属性右键菜单对象
|
|
|
QAction* actionAttribute; //属性
|
|
|
QAction* actionExportFile; //文件导出
|
|
|
QAction* actionRouteAnalyse; //航线分析
|
|
|
|
|
|
QMenu* EditRBtnMenu; //编辑右键菜单
|
|
|
QAction* saveRoute;//保存航线
|
|
|
QAction* cancelRoute;//取消航线
|
|
|
|
|
|
/*******************场景菜单对象*******************/
|
|
|
QMenu* sceneRBtnMenu;//声明一个场景右键菜单对象
|
|
|
//声明场景右键菜单各按钮对象
|
|
|
QAction* actionSceneShowRoute; //显示航线
|
|
|
QAction* actionSceneBindRoute;//装订航线
|
|
|
QAction* actionSceneImportRoute; //导入航线
|
|
|
|
|
|
//声明界面上工具条对象
|
|
|
QToolBar *mainToolBar;
|
|
|
|
|
|
//声明工具条上各个按钮对象
|
|
|
QAction *actionOpen;
|
|
|
|
|
|
QAction *actionOpenDEM;
|
|
|
|
|
|
QAction *actionZoomout;
|
|
|
|
|
|
QAction *actionZoomin;
|
|
|
|
|
|
QAction *actionPan;
|
|
|
|
|
|
QAction *actionViewEntire;
|
|
|
|
|
|
QAction *actionCalcLength;
|
|
|
|
|
|
QAction *actionCalcArea;
|
|
|
|
|
|
QAction *actionCalcAngle;
|
|
|
|
|
|
QAction *actionSelect;
|
|
|
|
|
|
QAction *actionDrawPoint;
|
|
|
|
|
|
QAction *actionDrawLine;
|
|
|
|
|
|
QAction *actionDrawPolygon;
|
|
|
|
|
|
QAction *actionInputPoint;
|
|
|
|
|
|
QAction *actionOnlineMap;
|
|
|
|
|
|
QAction *actionMapLocation;
|
|
|
|
|
|
QAction *actionTransformMap;
|
|
|
|
|
|
QAction *actionImportData;
|
|
|
|
|
|
QAction *actionEdit;
|
|
|
|
|
|
QAction *actionFlySimulated;
|
|
|
|
|
|
QWidgetAction* wactionEdit;
|
|
|
|
|
|
//声明编辑工具条对象
|
|
|
QMenu *editToolMenu;
|
|
|
QToolBar *editToolBar;
|
|
|
|
|
|
//工具条上各对象
|
|
|
QAction *actionStartEdit;
|
|
|
QAction *actionEditNode;
|
|
|
// QAction *actionAddNode;
|
|
|
// QAction *actionDeleteNode;
|
|
|
|
|
|
//绘制模式
|
|
|
qint16 drawMode;
|
|
|
|
|
|
//
|
|
|
// QStringList imageDataList;
|
|
|
// QStringList terrainDataList;
|
|
|
// int imageDataCount;
|
|
|
// int terrainDataCount;
|
|
|
|
|
|
QMutex m_mutex;
|
|
|
|
|
|
// QThread* loadSceneDataThread;
|
|
|
|
|
|
/**************************Test**************************/
|
|
|
QAction *actionTest;
|
|
|
|
|
|
signals:
|
|
|
void sendAddRouteState(int addState);// 航线是否添加成功信号
|
|
|
|
|
|
void sendSceneDataList(SceneControl* pSceneControl,UGDataSource* pDataSource,QStringList imagePathList,QStringList terrianPathList);
|
|
|
|
|
|
// void closedProgressDialog();
|
|
|
/******************************Test signal************************************/
|
|
|
void testEnd();
|
|
|
void startReceiveData();
|
|
|
void startGenerate();
|
|
|
void stopGenerate();
|
|
|
void sendPositionData1(QList<double> lon,QList<double> lat,QList<double> heading);
|
|
|
void startCollisionDetect(int ms);
|
|
|
void closeCollisionDetect();
|
|
|
|
|
|
private:
|
|
|
bool testFlag = false;
|
|
|
QPointF pt;
|
|
|
QList<double> lon, lat, heading,speed,relativeAlititude;
|
|
|
GeoComputation geoComputation;
|
|
|
// QThread* receiveRealTimePositionInfoThread;
|
|
|
|
|
|
public slots:
|
|
|
void test();//仅用于测试
|
|
|
void showNotify(QString title,QString body,QVariantMap data);
|
|
|
|
|
|
void openRasterMap(); //声明槽函数openRasterMap(打开地图操作)
|
|
|
|
|
|
void addRasterDEM(); //声明添加高程地图槽函数
|
|
|
|
|
|
void zoomIn();//声明槽函数zoomIn(放大地图操作)
|
|
|
|
|
|
void zoomOut();//声明槽函数zoomOut(缩小地图操作)
|
|
|
|
|
|
void viewEntire();//声明槽函数viewEntire(全幅显示地图)
|
|
|
|
|
|
void pan();//声明槽函数pan(平移浏览地图)
|
|
|
|
|
|
void calcLength();//声明槽函数calcLength(量算距离)
|
|
|
|
|
|
void calcArea();//声明槽函数calcArea(量算面积)
|
|
|
|
|
|
void calcAngle();//声明槽函数calcAngle(量算角度)
|
|
|
|
|
|
void Select(); //声明槽函数Select
|
|
|
|
|
|
void Edit(); //声明槽函数Edit
|
|
|
|
|
|
void drawPoint();//声明槽函数drawPoint(绘制点)
|
|
|
|
|
|
void drawLine();//声明槽函数drawLine(绘制线)
|
|
|
|
|
|
void drawPolygon();//声明槽函数drawPolygon(绘制多边形)
|
|
|
|
|
|
void showBindRouteDialog(); //显示航线装订弹窗
|
|
|
|
|
|
void showComputeOffsetPosition(); //显示坐标点输入坐标弹窗
|
|
|
|
|
|
void showOnlineMapDialog(); //显示在线地图选择弹窗
|
|
|
|
|
|
void showAttributeMenu(); //显示属性右键菜单
|
|
|
|
|
|
void showRouteAnalysisDlg(); //显示航线分析对话框
|
|
|
|
|
|
void transformMap(); //二三维地图切换
|
|
|
|
|
|
void importSceneData(QStringList imagePathList,QStringList terrianPathList); //导入场景数据
|
|
|
|
|
|
void showFlySimulatedDlg(); //显示模拟飞行对话框
|
|
|
|
|
|
void closedProgressDialog(QString taskName); //关闭进度条
|
|
|
|
|
|
void showSettingFlightPoint3DDialog(); //显示航高设置对话框
|
|
|
|
|
|
void showSaveRoute3DDialog(UGGeometry* pGeometry); //显示三维航线保存对话框
|
|
|
|
|
|
void highLightKMLGeometry(int currentGeometryID,int lastGeometryID); //高亮当前导入的KML 3D几何对象
|
|
|
|
|
|
/********************以下用于测试***********************/
|
|
|
public:
|
|
|
UGGeoPoint3D* geoPt;
|
|
|
void moveGeoPoint3D();
|
|
|
};
|
|
|
#endif // MAINWINDOW_H
|