You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
GCS-GISControlDlg-for-981A-.../ExportQBGISCtrlClass.cpp

439 lines
9.8 KiB
C++

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#include "stdafx.h"
//#include "ExportQBGISCtrlClass.h"
#include "GISDlg.h"
#include "Resource.h"
//#include "FlyLineDataStruct.h"
CGISDlg g_mapShowDlg;
bool g_bCreateMap=false;
//显示GIS对话框
extern "C" BOOL WINAPI ShowGISDlg(const CRect rc, CWnd* pParent)//rc为GIS要显示的屏幕区域范围包括地图和工具条
{
AFX_MANAGE_STATE(AfxGetAppModuleState());
g_mapShowDlg.SetGISWindowArea(rc);
g_mapShowDlg.Create(IDD_DIALOG1, pParent);
g_mapShowDlg.MoveWindow(&rc, TRUE);
g_mapShowDlg.ShowWindow(SW_SHOW);
g_bCreateMap = true;
return g_bCreateMap;
}
//创建窗口
extern "C" BOOL WINAPI CreateWnd(CWnd* hParentWnd)
{
//zcw add code begin
AFX_MANAGE_STATE(AfxGetAppModuleState());
//g_mapShowDlg.SetGISWindowArea(rc);
//g_mapShowDlg.MoveWindow(&rc, TRUE);
//g_mapShowDlg.ShowWindow(SW_SHOW);
g_bCreateMap = g_mapShowDlg.Create(IDD_DIALOG1,hParentWnd);
return g_bCreateMap;
//zcw end
}
//销毁窗口
extern "C" BOOL WINAPI DeleteWnd()
{
//zcw add code begin
AFX_MANAGE_STATE(AfxGetAppModuleState());
g_bCreateMap = false;
//删除对话框
g_mapShowDlg.DestroyWindow();
//zcw end
return g_bCreateMap;
}
//获得窗口指针
extern "C" CWnd* WINAPI GetWnd()
{
//zcw add code begin
//::FromeHandle();
return g_mapShowDlg.FromHandle(g_mapShowDlg.GetSafeHwnd());
//zcw end
}
//函数功能:返回窗口句柄
extern "C" HWND WINAPI GetHWnd()
{
//zcw add code begin
return g_mapShowDlg.GetSafeHwnd();
//return NULL;
//zcw end
}
//函数功能:移动窗口
//int x,int y,int width,int height
extern "C" void WINAPI MoveWnd(int x,int y,int width,int height)
{
//zcw add code begin
g_mapShowDlg.SetWindowPos(NULL,x,y,width,height,1);
//zcw end
}
//函数功能:移动窗口
//LPCRECT lpRect
extern "C" void WINAPI MoveWnd2(const LPCRECT lpRect)
{
//zcw add code begin
//g_mapShowDlg.SetWindowPos(NULL,x,y,width,height,1);
g_mapShowDlg.MoveWindow(lpRect);
//zcw end
//zcw end
}
///函数功能:显示窗口
//BOOL
extern "C" void WINAPI ShowWnd(BOOL b)
{
//zcw add code begin
AFX_MANAGE_STATE(AfxGetAppModuleState());
if (g_bCreateMap)
{
g_mapShowDlg.ShowWindow(b);
}
//zcw end
}
//坐标转换函数
//double *lon, double *lat,enum_CS CS_Dest,enum_CS CS_Sour
extern "C" void WINAPI CS2CS(double *lon, double *lat,enum_CS CS_Dest,enum_CS CS_Sour)
{
//zcw add code begin
//zcw end
}
//航线读取函数
//int iLine ,PTLIST *pList
extern "C" BOOL WINAPI ReadLine(int iLine ,PTLIST *pList)
{
//zcw add code begin
AFX_MANAGE_STATE(AfxGetAppModuleState());
g_mapShowDlg.ReadLine(iLine, pList);
//g_mapShowDlg.SetRouteLine(iLine, pList);
return true;
//zcw end
}
//添加航迹点函数
//lon:经度,°为单位
//lat:维度,°为单位
//head:航向°为单位
//double *pIFOVExtent:视场范围8个元素的数字指针
extern "C" void WINAPI AddAirPt(int uavid,double lon,double lat,double alt,double head,double *pIFOVExtent,bool control)
{
//zcw add code begin
AFX_MANAGE_STATE(AfxGetAppModuleState());
if (g_bCreateMap)
{
g_mapShowDlg.AddFlyPoint(uavid,lon, lat, head,control);
}
//zcw end
}
extern "C" void WINAPI AddAirPt_ADS(const int uavNum, const int uavid, const double lon, const double lat, const double yaw, const bool control, const CString strPlaneName)
{
AFX_MANAGE_STATE(AfxGetAppModuleState());
if (g_bCreateMap)
{
g_mapShowDlg.AddFlyPoint_ADS(uavNum, uavid, lon, lat, yaw, control, strPlaneName);
}
}
//地图控件向内接口函数
//struMapIn mapIn
extern "C" BOOL WINAPI SetMap(struMapIn mapIn)
{
//zcw add code begin
return true;
//zcw end
}
//设置地图模块显示模式,用于飞控和载荷软件,
//b:TRUE:飞控模式FALSE载荷模式
extern "C" BOOL WINAPI SetMode(BOOL b)
{
//zcw add code begin
return true;
//zcw end
}
////用于显示航点号,航线号,侧偏距等信息
extern "C" BOOL WINAPI DRAW_FK( tagDRAWZK DrawZk)
{
//2015.11.19
AFX_MANAGE_STATE(AfxGetAppModuleState());
if (g_mapShowDlg && g_mapShowDlg.GetSafeHwnd())
{
g_mapShowDlg.m_DRAWZK = DrawZk;
::PostMessage(g_mapShowDlg.GetSafeHwnd(),MESSAGE_DRAWZK, 0, 0);
}
return false;
}
//1:航线1 2:航线2 3:航线3 4:航线4 5:航线5
//-1:操作失败;0:显示航线;1:隐藏航线
extern "C" int WINAPI ShowLine(int iLine)
{
AFX_MANAGE_STATE(AfxGetAppModuleState());
if (g_bCreateMap)
{
g_mapShowDlg.SetFlyLineShowStatus(iLine);
//return 1;
}
return g_mapShowDlg.m_pHaveDrawLineFlag[iLine-1];
}
//显示GMTI的函数体
//char*pData:数据内存
//int iLen数据长度
extern "C" BOOL WINAPI GMTI(char*pData,int iLen)
{
//zcw add code begin
return true;
//zcw end
}
//功能删除GIS对话框
extern "C" void WINAPI DeleteGISDlg()
{
AFX_MANAGE_STATE(AfxGetAppModuleState());
g_bCreateMap = false;
//删除对话框
g_mapShowDlg.DestroyWindow();
}
//功能:输入无人机的经纬度,标绘航迹
//输入经度lon以°为单位
// 纬度lat以°为单位
// 航向角yaw以°为单位
extern "C" void WINAPI SetUAVFlyCoordinate(int uavid,const double lon, const double lat, const double yaw,bool control)
{
AFX_MANAGE_STATE(AfxGetAppModuleState());
if (g_bCreateMap)
{
//增加无人机的飞行航点
g_mapShowDlg.AddFlyPoint(uavid,lon, lat, yaw,control);
}
}
//功能:定位到目标点
//输入经度lon纬度lat
extern "C" void WINAPI ZoomToLocation(double lon,double lat)
{
AFX_MANAGE_STATE(AfxGetAppModuleState());
if (g_bCreateMap)
{
//标绘目标点
g_mapShowDlg.ZoomToLocation(lon,lat);
}
}
//功能:增加目标点,在地图显示区标绘出来
//输入目标点号ptID经度lon纬度lat
extern "C" void WINAPI AddTarget(const int ptID, const double lon, const double lat)
{
AFX_MANAGE_STATE(AfxGetAppModuleState());
if (g_bCreateMap)
{
//标绘目标点
g_mapShowDlg.AddTargetPoint(ptID, lon, lat);
}
}
//功能删除给定ID号的目标点
//输入目标点号ptID
extern "C" void WINAPI DeleteTarget(const int ptID)
{
AFX_MANAGE_STATE(AfxGetAppModuleState());
if (g_bCreateMap)
{
//增加给定ID号的目标点
g_mapShowDlg.DeleteTarget(ptID);
}
}
//功能:删除所有目标点
extern "C" void WINAPI DeleteAllTargets()
{
AFX_MANAGE_STATE(AfxGetAppModuleState());
if (g_bCreateMap)
{
//增加无人机的飞行航点
g_mapShowDlg.DeleteAllTargets();
}
}
//功能:在地图显示区标绘出装订的飞行航线数据
//输入航线数据体集合linePtArray航线的航点个数ptNum
extern "C" void WINAPI DrawBindFlyLine(const PtStruct *linePtArray, const int ptNum)
{
AFX_MANAGE_STATE(AfxGetAppModuleState());
if (g_bCreateMap)
{
//绘制装订航线
g_mapShowDlg.DrawBindingLine(linePtArray, ptNum);
}
}
// 显示或隐藏dlg
//输入显示状态nCmdShow0为隐藏1为显示
//extern "C" void WINAPI ShowWnd(int nCmdShow)
//{
/*AFX_MANAGE_STATE(AfxGetAppModuleState());
if (g_bCreateMap)
{
g_mapShowDlg.ShowWindow(nCmdShow);
}*/
//}
//功能:设置地面站位置
//输入经度lon纬度lat高度alt
extern "C" void WINAPI SetGCSPosition(const double lon, const double lat, const double alt)
{
AFX_MANAGE_STATE(AfxGetAppModuleState());
if (g_bCreateMap)
{
g_mapShowDlg.SetGCSPosition(lon, lat, alt);
}
}
//功能:标绘导引点位置
//输入导引点类型guideMode1为导引飞行1,2为导引飞行2经度lon纬度lat
extern "C" void WINAPI DrawGuidePoint(const BYTE guideMode, const double lon, const double lat)
{
AFX_MANAGE_STATE(AfxGetAppModuleState());
if (g_bCreateMap)
{
//在地图显示区标绘导引点
g_mapShowDlg.DrawGuidePoint(guideMode, lon, lat);
}
}
//功能:显示给定名称的航线
//输入航线文件strFlyLineName
extern "C" void WINAPI DisplayFlyLine(const CString strFlyLineName)
{
AFX_MANAGE_STATE(AfxGetAppModuleState());
if (g_bCreateMap)
{
//在地图显示区标绘导引点
g_mapShowDlg.OnShowGivenLine(strFlyLineName);
}
}
// 功能:设置导引方式消息发送句柄及消息号
extern "C" void WINAPI SetMsgInfo(const HWND hwnd, const UINT msgID)
{
AFX_MANAGE_STATE(AfxGetAppModuleState());
g_mapShowDlg.SetMsgInfo(hwnd, msgID);
}
// 功能:设置装订航线消息发送句柄及消息号
extern "C" void WINAPI SetLoadLineMsgInfo(const HWND hwnd, const UINT msgID)
{
AFX_MANAGE_STATE(AfxGetAppModuleState());
g_mapShowDlg.SetLoadLineMsgInfo(hwnd, msgID);
}
//功能:标绘回收点位置
//输入导引点类型callbackMode1为回收点12为回收点2经度lon纬度lat
extern "C" void WINAPI DrawCallBackPoint(const BYTE callbackMode, const double lon, const double lat)
{
AFX_MANAGE_STATE(AfxGetAppModuleState());
if (g_bCreateMap)
{
//在地图显示区标绘回收点
g_mapShowDlg.DrawCallBackPoint(callbackMode, lon, lat);
}
}
// #ifdef _DEBUG
// #undef THIS_FILE
// static char THIS_FILE[]=__FILE__;
// #define new DEBUG_NEW
// #endif
extern "C" void WINAPI GetMouseWheel(short m_zDelta)
{
AFX_MANAGE_STATE(AfxGetAppModuleState());
if (g_bCreateMap)
{
g_mapShowDlg.MouseWheel(m_zDelta);
}
}
extern "C" void WINAPI UpdateDataInfo(int index,const char* key,double value )
{
AFX_MANAGE_STATE(AfxGetAppModuleState());
/*if (g_bCreateMap)
{
g_mapShowDlg.UpdateDataInfo(index,key,value);
}*/
}
//功能:目标追踪测试接口
//输入经纬度点的像素大小默认20
extern "C" void WINAPI OnShowTargetPoint(double lon, double lat, int pixelSize)
{
AFX_MANAGE_STATE(AfxGetAppModuleState());
if (g_bCreateMap)
{
g_mapShowDlg.OnShowTargetPoint(lon,lat,pixelSize);
}
}
//功能:显示自主着陆点与飞机的连线
//输入飞机ID飞机经纬度显示/清除bShow为false时uavLonuavLat随意设置无实际作用
extern "C" void WINAPI ShowLine14Ex(int uavID,double uavLon,double uavLat,bool bShow)
{
AFX_MANAGE_STATE(AfxGetAppModuleState());
if (g_bCreateMap)
{
g_mapShowDlg.ShowLine14Ex(uavID,uavLon,uavLat,bShow);
}
}
//功能:设置装订的自主着陆点坐标
//输入飞机ID自主着陆点经纬度
extern "C" void WINAPI SetBindLine14Coordinate(int uavID,double lon,double lat)
{
AFX_MANAGE_STATE(AfxGetAppModuleState());
if (g_bCreateMap)
{
g_mapShowDlg.SetBindLine14Coordinate(uavID,lon,lat);
}
}