|
|
|
|
// DlgLightRegion.cpp : ʵ<><CAB5><EFBFBD>ļ<EFBFBD>
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
#include "stdafx.h"
|
|
|
|
|
#include "DlgLightRegion.h"
|
|
|
|
|
#include "afxdialogex.h"
|
|
|
|
|
|
|
|
|
|
#include "MapElevation.h"
|
|
|
|
|
#include<io.h>
|
|
|
|
|
|
|
|
|
|
MapElevation m_mapElevation2;
|
|
|
|
|
|
|
|
|
|
HWND g_hwndDlgLight = nullptr;
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>ʣ<EFBFBD><CAA3>ٶ<EFBFBD><D9B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Բ<EFBFBD>ģ<EFBFBD>
|
|
|
|
|
double CalSlopeBetweenTwoPoint(const double fromPtLon, const double fromPtLat, const float fromPtAlt, const double endPtLon, const double endPtLat, const float endPtAlt)
|
|
|
|
|
{
|
|
|
|
|
double _distance = 0.0;
|
|
|
|
|
CalculateTwoPtsDistance(_distance,fromPtLon,fromPtLat,endPtLon,endPtLat,3);
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD>Ǵ<EFBFBD><C7B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><EFBFBD><F2A3ACB5><EFBFBD><EFBFBD>뾶<EFBFBD><EBBEB6><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>4/3<><33><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>Ч<EFBFBD>뾶
|
|
|
|
|
double _radiusEarth = 6371137.0 * 4/3;
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͶӰ<CDB6><D3B0><EFBFBD><EFBFBD><EFBFBD>ɵĻ<C9B5><C4BB>߶<EFBFBD>Ӧ<EFBFBD><D3A6>Բ<EFBFBD>Ľǣ<C4BD><C7A3><EFBFBD>λΪ<CEBB><CEAA><EFBFBD><EFBFBD>
|
|
|
|
|
double _centralAngle = _distance/_radiusEarth;
|
|
|
|
|
|
|
|
|
|
double _slope = 0.0,d1 = 0.0, d2 = 0.0;
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ʼ<EFBFBD>㴦ˮƽ<CBAE><C6BD><EFBFBD><EFBFBD><EFBFBD>յ㴦<D5B5><E3B4A6><EFBFBD>ܿ<EFBFBD><DCBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD><D5B5>ĸ߶<C4B8>
|
|
|
|
|
double _compareAlt = ((_radiusEarth + fromPtAlt)/cos(_centralAngle) - _radiusEarth);
|
|
|
|
|
|
|
|
|
|
//б<><D0B1>Ϊ<EFBFBD><CEAA>
|
|
|
|
|
if ( _compareAlt < endPtAlt)
|
|
|
|
|
{
|
|
|
|
|
_compareAlt = endPtAlt - _compareAlt;
|
|
|
|
|
|
|
|
|
|
d1 = _compareAlt * cos(_centralAngle);
|
|
|
|
|
|
|
|
|
|
d2 = (_radiusEarth + fromPtAlt) * tan(_centralAngle) + _compareAlt * sin(_centralAngle);
|
|
|
|
|
|
|
|
|
|
_slope = d1/d2;
|
|
|
|
|
}
|
|
|
|
|
else //б<><D0B1>Ϊ<EFBFBD><CEAA>
|
|
|
|
|
{
|
|
|
|
|
_compareAlt = _compareAlt - endPtAlt;
|
|
|
|
|
|
|
|
|
|
d1 = _compareAlt * cos(_centralAngle);
|
|
|
|
|
|
|
|
|
|
d2 = (_radiusEarth + fromPtAlt) * tan(_centralAngle) - _compareAlt * sin(_centralAngle);
|
|
|
|
|
|
|
|
|
|
_slope = -d1/d2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return _slope;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><>֪<EFBFBD><D6AA><EFBFBD><EFBFBD>A<EFBFBD>㾭γ<E3BEAD>ȸߣ<C8B8><DFA3>Լ<EFBFBD>B<EFBFBD><42><EFBFBD><EFBFBD>A<EFBFBD><41><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮƽ<CBAE><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>ʣ<EFBFBD><CAA3><EFBFBD>B<EFBFBD><42><EFBFBD>ĸ߶<C4B8>
|
|
|
|
|
double CalAltFromSlope(const double fromPtLon, const double fromPtLat, const float fromPtAlt, const double endPtLon, const double endPtLat,const double slope)
|
|
|
|
|
{
|
|
|
|
|
double _distance = 0.0;
|
|
|
|
|
CalculateTwoPtsDistance(_distance,fromPtLon,fromPtLat,endPtLon,endPtLat,3);
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD>Ǵ<EFBFBD><C7B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><EFBFBD><F2A3ACB5><EFBFBD><EFBFBD>뾶<EFBFBD><EBBEB6><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>4/3<><33><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>Ч<EFBFBD>뾶
|
|
|
|
|
double _radiusEarth = 6371137.0 * 4/3;
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͶӰ<CDB6><D3B0><EFBFBD><EFBFBD><EFBFBD>ɵĻ<C9B5><C4BB>߶<EFBFBD>Ӧ<EFBFBD><D3A6>Բ<EFBFBD>Ľǣ<C4BD><C7A3><EFBFBD>λΪ<CEBB><CEAA><EFBFBD><EFBFBD>
|
|
|
|
|
double _centralAngle = _distance/_radiusEarth;
|
|
|
|
|
|
|
|
|
|
double endPtAlt = 0.0;
|
|
|
|
|
|
|
|
|
|
if (slope > 0.0)
|
|
|
|
|
{
|
|
|
|
|
endPtAlt = (_radiusEarth + fromPtAlt) * tan(_centralAngle) * slope / (cos(_centralAngle)-(sin(_centralAngle)*slope));
|
|
|
|
|
|
|
|
|
|
endPtAlt = ((_radiusEarth + fromPtAlt)/cos(_centralAngle) - _radiusEarth) + endPtAlt;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
endPtAlt = (_radiusEarth + fromPtAlt) * tan(_centralAngle) * (-slope) / (cos(_centralAngle)+(sin(_centralAngle)*(-slope)));
|
|
|
|
|
endPtAlt = ((_radiusEarth + fromPtAlt)/cos(_centralAngle) - _radiusEarth) - endPtAlt;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return endPtAlt;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------------------------------------------
|
|
|
|
|
˵<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
-------------------------------------------------------------------------------------------------------------*/
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߳̿<DFB3><CCBF><EFBFBD><EFBFBD><EFBFBD>־
|
|
|
|
|
volatile bool m_bRunRegion = false;
|
|
|
|
|
|
|
|
|
|
double g_dGroundLonTemp = 0.0; //<2F><><EFBFBD><EFBFBD>վ<EFBFBD><D5BE><EFBFBD><EFBFBD>
|
|
|
|
|
double g_dGroundLatTemp = 0.0; //<2F><><EFBFBD><EFBFBD>վγ<D5BE><CEB3>
|
|
|
|
|
float g_fGroundAltTemp = 0.0; //<2F><><EFBFBD><EFBFBD>վ<EFBFBD>߶<EFBFBD>
|
|
|
|
|
int g_iFlightAlt = 0; //<2F><><EFBFBD>и߶<D0B8>
|
|
|
|
|
int g_iRegionRadius = 0; //<2F><><EFBFBD><EFBFBD><EFBFBD>뾶
|
|
|
|
|
int g_iAnalysisStep = 0; //<2F><><EFBFBD><EFBFBD><EFBFBD>Ƕ<EFBFBD>
|
|
|
|
|
|
|
|
|
|
//<2F>̺߳<DFB3><CCBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
void ThreadFuncLightRegion()
|
|
|
|
|
{
|
|
|
|
|
while(m_bRunRegion)
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɵ<EFBFBD><C9B5><EFBFBD>վ0~360<36>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD>ӷ<EFBFBD><D3B7><EFBFBD><EFBFBD><EFBFBD>ÿִ<C3BF><D6B4>һ<EFBFBD>Σ<EFBFBD><CEA3><EFBFBD><EFBFBD><EFBFBD>1<EFBFBD><31>
|
|
|
|
|
if ((g_iAnalysisStep >= 0) && (g_iAnalysisStep < 360))
|
|
|
|
|
{
|
|
|
|
|
if (false == AnalysisLightRegion(g_iAnalysisStep,g_iRegionRadius))
|
|
|
|
|
{
|
|
|
|
|
//<2F>߳<EFBFBD><DFB3><EFBFBD>Ϣ<EFBFBD><CFA2>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD>ֹ<EFBFBD><D6B9><EFBFBD><EFBFBD>
|
|
|
|
|
g_iAnalysisStep = -1;
|
|
|
|
|
|
|
|
|
|
m_bRunRegion = false;
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD>߳<EFBFBD><DFB3><EFBFBD>Ϣ<EFBFBD><CFA2>ȫ
|
|
|
|
|
::PostMessage(g_hwndDlgLight,WM_SEND_UPDATEDIALOG,(WPARAM)1,(LPARAM)-1);
|
|
|
|
|
|
|
|
|
|
continue ;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD>Ի<EFBFBD><D4BB><EFBFBD><F2A3ACB8>¿<EFBFBD><C2BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
::PostMessage(g_hwndDlgLight,WM_SEND_UPDATEDIALOG,(WPARAM)1,(LPARAM)g_iAnalysisStep);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_iAnalysisStep++;
|
|
|
|
|
}
|
|
|
|
|
else if (360 == g_iAnalysisStep)
|
|
|
|
|
{
|
|
|
|
|
//<2F><>ֹ<EFBFBD><D6B9><EFBFBD><EFBFBD>
|
|
|
|
|
g_iAnalysisStep = -1;
|
|
|
|
|
|
|
|
|
|
g_structPointNotVisible[360] = g_structPointNotVisible[0];
|
|
|
|
|
|
|
|
|
|
//ͨ<>ӷ<EFBFBD><D3B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Բ<EFBFBD><D4B2>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>벻<EFBFBD><EBB2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD>㣬<EFBFBD><E3A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>γ<EFBFBD>һ<EFBFBD><D2BB><EFBFBD>պϵIJ<CFB5><C4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
for (int i=360;i>=0;i--)
|
|
|
|
|
{
|
|
|
|
|
structPoint _structPoint;
|
|
|
|
|
CalculatePtCoordinate(_structPoint.lon,_structPoint.lat,g_dGroundLonTemp,g_dGroundLatTemp,i,g_iRegionRadius*1000,3);
|
|
|
|
|
|
|
|
|
|
g_structPointNotVisible[720 - i + 1] = _structPoint;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD>͵<EFBFBD><CDB5><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD>ƿ<EFBFBD><C6BF><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
::PostMessage(g_mapHwnd,WM_SHOW_NOTVISIBLE,0,0);
|
|
|
|
|
::PostMessage(g_mapHwnd,WM_SHOW_ISVISIBLE,0,0);
|
|
|
|
|
|
|
|
|
|
m_bRunRegion = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Sleep(10);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>и߶ȣ<DFB6><C8A3><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD>ӷ<EFBFBD><D3B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD>ͼ<EFBFBD>ϱ<EFBFBD><CFB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>iAngle <20>Ƕȣ<C7B6>iRadius <20><><EFBFBD><EFBFBD>
|
|
|
|
|
bool AnalysisLightRegion(int iAngle, int iRadius)
|
|
|
|
|
{
|
|
|
|
|
double dTanMaxAngle = 0.0; //<2F><>Сͨ<D0A1>ӽǶ<D3BD>
|
|
|
|
|
double fMinLightAlt = 0.0; //<2F><>Сͨ<D0A1>Ӹ߶<D3B8>
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
|
|
|
|
double interPolLon = 0.0, interPolLat = 0.0;
|
|
|
|
|
float interPolHight = 0.0;
|
|
|
|
|
|
|
|
|
|
//<2F>м<EFBFBD><D0BC><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
double _tempAngle = 0.0; //<2F><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>վ<EFBFBD><D5BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ˮƽ<CBAE><C6BD><EFBFBD><EFBFBD><EFBFBD>ļн<C4BC>
|
|
|
|
|
structPoint _structPoint;
|
|
|
|
|
|
|
|
|
|
//<2F><>60Ϊ<30><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>࣬<EFBFBD><E0A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>
|
|
|
|
|
int interPolDis = 60;
|
|
|
|
|
int interPolNum = (iRadius*1000)/interPolDis;
|
|
|
|
|
|
|
|
|
|
for(int i = 1; i <= interPolNum; i++)
|
|
|
|
|
{
|
|
|
|
|
CalculatePtCoordinate(interPolLon, interPolLat, g_dGroundLonTemp, g_dGroundLatTemp, iAngle, i*interPolDis, 3);
|
|
|
|
|
|
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĸ߳<C4B8>
|
|
|
|
|
if(!m_mapElevation2.getElevation(interPolHight, interPolLon, interPolLat))
|
|
|
|
|
{
|
|
|
|
|
//δ<><CEB4>ȡ<EFBFBD><C8A1><EFBFBD>߳<EFBFBD>ֵ
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_tempAngle = CalSlopeBetweenTwoPoint(g_dGroundLonTemp, g_dGroundLatTemp, g_fGroundAltTemp, interPolLon, interPolLat, interPolHight);
|
|
|
|
|
|
|
|
|
|
dTanMaxAngle = max(_tempAngle,dTanMaxAngle);
|
|
|
|
|
|
|
|
|
|
fMinLightAlt = (float)CalAltFromSlope(g_dGroundLonTemp, g_dGroundLatTemp, g_fGroundAltTemp, interPolLon, interPolLat, dTanMaxAngle);
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>и߶ȣ<DFB6><C8A3>ж<EFBFBD><D0B6>Ƿ<EFBFBD><C7B7><EFBFBD>ͨ<EFBFBD>ӣ<EFBFBD><D3A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>ͨ<EFBFBD>ӵĵ㣬<C4B5><E3A3AC>Ϊ<EFBFBD>˵<EFBFBD><CBB5><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD>벻ͨ<EBB2BB>ӵķָ<C4B7><D6B8>㣬ֱ<E3A3AC>ӷ<EFBFBD><D3B7><EFBFBD>
|
|
|
|
|
if (g_iFlightAlt < fMinLightAlt)
|
|
|
|
|
{
|
|
|
|
|
_structPoint.lon = interPolLon;
|
|
|
|
|
_structPoint.lat = interPolLat;
|
|
|
|
|
|
|
|
|
|
g_structPointVisible[iAngle] = _structPoint;
|
|
|
|
|
g_structPointNotVisible[iAngle] = _structPoint;
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CalculatePtCoordinate(_structPoint.lon,_structPoint.lat,g_dGroundLonTemp,g_dGroundLatTemp,iAngle,g_iRegionRadius*1000,3);
|
|
|
|
|
|
|
|
|
|
g_structPointVisible[iAngle] = _structPoint;
|
|
|
|
|
g_structPointNotVisible[iAngle] = _structPoint;
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------------------------------------------
|
|
|
|
|
˵<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵʱͨ<EFBFBD>Ӽ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
-------------------------------------------------------------------------------------------------------------*/
|
|
|
|
|
//ʵʱͨ<CAB1>Ӽ<EFBFBD><D3BC><EFBFBD><EFBFBD>߳̿<DFB3><CCBF><EFBFBD><EFBFBD><EFBFBD>־
|
|
|
|
|
volatile bool m_bRunDetect = false;
|
|
|
|
|
|
|
|
|
|
double g_dRealTime_GCSlon = 0.0; //<2F><><EFBFBD><EFBFBD>վ<EFBFBD><D5BE><EFBFBD><EFBFBD>
|
|
|
|
|
double g_dRealTime_GCSlat = 0.0; //<2F><><EFBFBD><EFBFBD>վγ<D5BE><CEB3>
|
|
|
|
|
float g_fRealTime_GCSalt = 0.0f; //<2F><><EFBFBD><EFBFBD>վ<EFBFBD>߶<EFBFBD>
|
|
|
|
|
double g_dRealTime_UavAlt = 0.0; //<2F><><EFBFBD>˻<EFBFBD><CBBB>߶<EFBFBD>
|
|
|
|
|
double g_dRealTime_AngToGCS = 0.0; //<2F><><EFBFBD><EFBFBD>վ-<2D>ɻ<EFBFBD><C9BB><EFBFBD>λ
|
|
|
|
|
double g_dRealTime_DisToGCS = 0.0; //<2F><><EFBFBD><EFBFBD>վ-<2D>ɻ<EFBFBD><C9BB><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
double g_dRealTime_MinAngle = 0.0;
|
|
|
|
|
double g_dRealTime_AngleDiff = 0.0;
|
|
|
|
|
int g_iRealTime_CurStep = -1;
|
|
|
|
|
int g_iPointNumInLayer = 0; //ʵʱͨ<CAB1>Ӽ<EFBFBD><D3BC><EFBFBD><EFBFBD>з<EFBFBD><D0B7><EFBFBD><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD>
|
|
|
|
|
|
|
|
|
|
//<2F>̺߳<DFB3><CCBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵʱͨ<CAB1>Ӽ<EFBFBD><D3BC><EFBFBD>
|
|
|
|
|
void ThreadFuncRealTimeDetection()
|
|
|
|
|
{
|
|
|
|
|
while(m_bRunDetect)
|
|
|
|
|
{
|
|
|
|
|
if (-1 == g_iRealTime_CurStep)
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (g_iRealTime_CurStep <= 12)
|
|
|
|
|
{
|
|
|
|
|
if (false == AnalysisVisiArea(g_dRealTime_UavAlt, g_dRealTime_MinAngle+g_iRealTime_CurStep*g_dRealTime_AngleDiff, g_dRealTime_DisToGCS-3000, g_dRealTime_DisToGCS+3000, g_dRealTime_GCSlon, g_dRealTime_GCSlat))
|
|
|
|
|
{
|
|
|
|
|
g_iRealTime_CurStep = -1;
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD>߳<EFBFBD><DFB3><EFBFBD>Ϣ<EFBFBD><CFA2>ȫ
|
|
|
|
|
::PostMessage(g_hwndDlgLight,WM_SEND_UPDATEDIALOG,(WPARAM)2,(LPARAM)-1);
|
|
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_iRealTime_CurStep++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (g_iRealTime_CurStep == (12 + 1))
|
|
|
|
|
{
|
|
|
|
|
g_iRealTime_CurStep++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (g_iRealTime_CurStep == (12 + 2))
|
|
|
|
|
{
|
|
|
|
|
for (int i=0; i<=12;i++)
|
|
|
|
|
{
|
|
|
|
|
g_iPointNumInLayer++;
|
|
|
|
|
|
|
|
|
|
structPoint _structPoint;
|
|
|
|
|
|
|
|
|
|
CalculatePtCoordinate(_structPoint.lon, _structPoint.lat, g_dRealTime_GCSlon, g_dRealTime_GCSlat, g_dRealTime_MinAngle+(12-i)*g_dRealTime_AngleDiff, g_dRealTime_DisToGCS-3000, 3);
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>
|
|
|
|
|
g_structPointVisiReal[g_iPointNumInLayer] = _structPoint;
|
|
|
|
|
|
|
|
|
|
CalculatePtCoordinate(_structPoint.lon, _structPoint.lat, g_dRealTime_GCSlon, g_dRealTime_GCSlat, g_dRealTime_MinAngle+(12-i)*g_dRealTime_AngleDiff, g_dRealTime_DisToGCS+3000, 3);
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD>벻<EFBFBD><EBB2BB><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>
|
|
|
|
|
g_structPointNotVisiReal[g_iPointNumInLayer] = _structPoint;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_iRealTime_CurStep++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (g_iRealTime_CurStep == (12 + 3))
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ʵʱ<CAB5><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>
|
|
|
|
|
::PostMessage(g_mapHwnd,WM_SHOW_VISI_DELETE,0,0);
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ʵʱ<CAB5><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>
|
|
|
|
|
::PostMessage(g_mapHwnd,WM_SHOW_NOTVISI_REALTIME,(WPARAM)g_iPointNumInLayer,0);
|
|
|
|
|
|
|
|
|
|
g_iRealTime_CurStep++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (g_iRealTime_CurStep == (12 + 4))
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ʵʱ<CAB5><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>
|
|
|
|
|
::PostMessage(g_mapHwnd,WM_SHOW_VISI_REALTIME,(WPARAM)g_iPointNumInLayer,0);
|
|
|
|
|
|
|
|
|
|
g_iRealTime_CurStep = -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Sleep(10);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ǶȺ;<C8BA><CDBE>뷶Χ<EBB7B6><CEA7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD>Ӽ<EFBFBD><D3BC><EFBFBD>
|
|
|
|
|
bool AnalysisVisiArea(double uavAlt, double dAngle, double dDistanceMin, double dDistanceMax, double lonGCS, double latGCS)
|
|
|
|
|
{
|
|
|
|
|
double dTanMaxAngle = 0.0; //<2F><>Сͨ<D0A1>ӽǶ<D3BD>
|
|
|
|
|
double fMinLightAlt = 0.0; //<2F><>Сͨ<D0A1>Ӹ߶<D3B8>
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
|
|
|
|
double interPolLon = 0.0, interPolLat = 0.0;
|
|
|
|
|
float interPolHight = 0.0;
|
|
|
|
|
|
|
|
|
|
//<2F>м<EFBFBD><D0BC><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
double _tempAngle = 0.0; //<2F><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>վ<EFBFBD><D5BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ˮƽ<CBAE><C6BD><EFBFBD><EFBFBD><EFBFBD>ļн<C4BC>
|
|
|
|
|
structPoint _structPoint;
|
|
|
|
|
|
|
|
|
|
//<2F><>30Ϊ<30><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>࣬<EFBFBD><E0A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>
|
|
|
|
|
int interPolDis = 30;
|
|
|
|
|
int interPolNum = (int)(floor((double)(dDistanceMax/interPolDis)));
|
|
|
|
|
|
|
|
|
|
for(int i = 1; i <= interPolNum; i++)
|
|
|
|
|
{
|
|
|
|
|
CalculatePtCoordinate(interPolLon, interPolLat, lonGCS, latGCS, dAngle, i*interPolDis, 3);
|
|
|
|
|
|
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĸ߳<C4B8>
|
|
|
|
|
if(!m_mapElevation2.getElevation(interPolHight, interPolLon, interPolLat))
|
|
|
|
|
{
|
|
|
|
|
//δ<><CEB4>ȡ<EFBFBD><C8A1><EFBFBD>߳<EFBFBD>ֵ
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_tempAngle = CalSlopeBetweenTwoPoint(lonGCS, latGCS, g_fRealTime_GCSalt, interPolLon, interPolLat, interPolHight);
|
|
|
|
|
|
|
|
|
|
dTanMaxAngle = max(_tempAngle,dTanMaxAngle);
|
|
|
|
|
|
|
|
|
|
fMinLightAlt = (float)CalAltFromSlope(lonGCS, latGCS, g_fRealTime_GCSalt, interPolLon, interPolLat, dTanMaxAngle);
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>и߶ȣ<DFB6><C8A3>ж<EFBFBD><D0B6>Ƿ<EFBFBD><C7B7><EFBFBD>ͨ<EFBFBD>ӣ<EFBFBD><D3A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>ͨ<EFBFBD>ӵĵ㣬<C4B5><E3A3AC>Ϊ<EFBFBD>˵<EFBFBD><CBB5><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD>벻ͨ<EBB2BB>ӵķָ<C4B7><D6B8>㣬ֱ<E3A3AC>ӷ<EFBFBD><D3B7><EFBFBD>
|
|
|
|
|
if (uavAlt < fMinLightAlt)
|
|
|
|
|
{
|
|
|
|
|
if ((i*interPolDis) < dDistanceMin)
|
|
|
|
|
{
|
|
|
|
|
CalculatePtCoordinate(interPolLon, interPolLat, lonGCS, latGCS, dAngle, dDistanceMin, 3);
|
|
|
|
|
|
|
|
|
|
_structPoint.lon = interPolLon;
|
|
|
|
|
_structPoint.lat = interPolLat;
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>벻<EFBFBD><EBB2BB><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>
|
|
|
|
|
g_iPointNumInLayer++;
|
|
|
|
|
g_structPointVisiReal[g_iPointNumInLayer] = _structPoint;
|
|
|
|
|
g_structPointNotVisiReal[g_iPointNumInLayer] = _structPoint;
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
_structPoint.lon = interPolLon;
|
|
|
|
|
_structPoint.lat = interPolLat;
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>벻<EFBFBD><EBB2BB><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>
|
|
|
|
|
g_iPointNumInLayer++;
|
|
|
|
|
g_structPointVisiReal[g_iPointNumInLayer] = _structPoint;
|
|
|
|
|
g_structPointNotVisiReal[g_iPointNumInLayer] = _structPoint;
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CalculatePtCoordinate(interPolLon, interPolLat, lonGCS, latGCS, dAngle, dDistanceMax, 3);
|
|
|
|
|
|
|
|
|
|
_structPoint.lon = interPolLon;
|
|
|
|
|
_structPoint.lat = interPolLat;
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>벻<EFBFBD><EBB2BB><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>
|
|
|
|
|
g_iPointNumInLayer++;
|
|
|
|
|
g_structPointVisiReal[g_iPointNumInLayer] = _structPoint;
|
|
|
|
|
g_structPointNotVisiReal[g_iPointNumInLayer] = _structPoint;
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------------------------------------------
|
|
|
|
|
˵<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵʱ<EFBFBD><EFBFBD>ײ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
-------------------------------------------------------------------------------------------------------------*/
|
|
|
|
|
//ʵʱ<CAB5><CAB1>ײ<EFBFBD><D7B2><EFBFBD><EFBFBD><EFBFBD>߳̿<DFB3><CCBF><EFBFBD><EFBFBD><EFBFBD>־
|
|
|
|
|
volatile bool m_bRunCrash = false;
|
|
|
|
|
|
|
|
|
|
bool g_bCrashDetection = false;
|
|
|
|
|
double g_dCrashUavLon = 0.0;
|
|
|
|
|
double g_dCrashUavLat = 0.0;
|
|
|
|
|
float g_fCrashUavAlt = 0.0f;
|
|
|
|
|
|
|
|
|
|
//<2F>̺߳<DFB3><CCBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵʱ<CAB5><CAB1>ײ<EFBFBD><D7B2><EFBFBD><EFBFBD>
|
|
|
|
|
void ThreadFuncRealTimeCrash()
|
|
|
|
|
{
|
|
|
|
|
while(m_bRunCrash)
|
|
|
|
|
{
|
|
|
|
|
if (true == g_bCrashDetection)
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
|
|
|
|
double interPolLon = 0.0, interPolLat = 0.0;
|
|
|
|
|
float interPolHight = 0.0;
|
|
|
|
|
|
|
|
|
|
//0<><30>360<36><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>η<EFBFBD><CEB7><EFBFBD><EFBFBD>ɻ<EFBFBD><C9BB>뾶Ϊ3km<6B>ڵĸ߳<C4B8><DFB3><EFBFBD>Ϣ
|
|
|
|
|
for (int i=0;i<360;i++)
|
|
|
|
|
{
|
|
|
|
|
for (int j=0;j<=20;j++)
|
|
|
|
|
{
|
|
|
|
|
CalculatePtCoordinate(interPolLon, interPolLat, g_dCrashUavLon, g_dCrashUavLat, i, j*150, 3);
|
|
|
|
|
|
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĸ߳<C4B8>
|
|
|
|
|
if(!m_mapElevation2.getElevation(interPolHight, interPolLon, interPolLat))
|
|
|
|
|
{
|
|
|
|
|
//δ<><CEB4>ȡ<EFBFBD><C8A1><EFBFBD>߳<EFBFBD>ֵ
|
|
|
|
|
g_bCrashDetection = false;
|
|
|
|
|
m_bRunCrash = false;
|
|
|
|
|
|
|
|
|
|
BCGPMessageBox(_T("<EFBFBD>߳<EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>ȫ<EFBFBD><EFBFBD>"));
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((20 == j) || (interPolHight > (g_fCrashUavAlt - 200))) //200<30><30>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>GPS<50>߶<EFBFBD><DFB6><EFBFBD>DEM<45>̲߳<DFB3><CCB2><EFBFBD>֮<EFBFBD><D6AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
g_structPointCrashReal[i].lon = interPolLon;
|
|
|
|
|
g_structPointCrashReal[i].lat = interPolLat;
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Ϊ<><CEAA><EFBFBD><EFBFBD><EFBFBD>ر<EFBFBD><D8B1>߳<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>߳<EFBFBD><DFB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>δִ<CEB4><D6B4><EFBFBD>꣬<EFBFBD>Ӷ<EFBFBD>ֹͣ<CDA3><D6B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȼ<EFBFBD><C8BB>ִ<EFBFBD>е<EFBFBD><D0B5>˴<EFBFBD>
|
|
|
|
|
if (true == g_bCrashDetection)
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ײ<EFBFBD><D7B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ľ<EFBFBD><C4BD><EFBFBD>
|
|
|
|
|
::PostMessage(g_mapHwnd,WM_SHOW_CRASH_REALTIME,1,0);
|
|
|
|
|
|
|
|
|
|
g_bCrashDetection = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------------------------------------------
|
|
|
|
|
˵<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD>ӷ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
-------------------------------------------------------------------------------------------------------------*/
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ͨ<EFBFBD>ӷ<EFBFBD><D3B7><EFBFBD><EFBFBD>߳̿<DFB3><CCBF><EFBFBD><EFBFBD><EFBFBD>־
|
|
|
|
|
volatile bool m_bRunRoute = false;
|
|
|
|
|
|
|
|
|
|
double g_dRoute_GCSlon = 0.0; //<2F><><EFBFBD><EFBFBD>վ<EFBFBD><D5BE><EFBFBD><EFBFBD>
|
|
|
|
|
double g_dRoute_GCSlat = 0.0; //<2F><><EFBFBD><EFBFBD>վγ<D5BE><CEB3>
|
|
|
|
|
float g_fRoute_GCSalt = 0.0f; //<2F><><EFBFBD><EFBFBD>վ<EFBFBD>߶<EFBFBD>
|
|
|
|
|
|
|
|
|
|
#pragma pack(1)
|
|
|
|
|
typedef struct _PTSTRUCT
|
|
|
|
|
{
|
|
|
|
|
unsigned char/*BYTE*/ lineID; //<2F><><EFBFBD>ߺ<EFBFBD>
|
|
|
|
|
unsigned char/*BYTE*/ ptID; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
double lon; //<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
double lat; //γ<><CEB3>
|
|
|
|
|
short alt; //<2F>߶<EFBFBD>
|
|
|
|
|
|
|
|
|
|
unsigned char/*BYTE*/ speed; //<2F>ٶ<EFBFBD>
|
|
|
|
|
|
|
|
|
|
char taskCharacter; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
char lineCharacter; //<2F><>·<EFBFBD><C2B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
}PtStruct;
|
|
|
|
|
#pragma pack()
|
|
|
|
|
|
|
|
|
|
PtStruct pts[257]; //<2F><><EFBFBD>ߵĺ<DFB5><C4BA><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|
|
|
|
int g_iWayPointNum; //<2F><><EFBFBD>ߵĺ<DFB5><C4BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
int g_iCurWaypoint; //<2F><>ǰ<EFBFBD>ڷ<EFBFBD><DAB7><EFBFBD><EFBFBD>ĺ<EFBFBD><C4BA><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
int g_iTotalInterNum = 0; //<2F><><EFBFBD><EFBFBD><EFBFBD>еIJ<D0B5>ֵ<EFBFBD>ܵ<EFBFBD><DCB5><EFBFBD>
|
|
|
|
|
int g_totalLinePtNum; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѷ<EFBFBD><D1B7><EFBFBD><EFBFBD>IJ<EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
int g_iInterNumSec = 0; //<2F><><EFBFBD><EFBFBD><EFBFBD>еIJ<D0B5>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
double *g_ptrArraySeries1 = nullptr; //<2F><><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD>ĸ߳<C4B8>ֵ
|
|
|
|
|
double *g_ptrArraySeries2 = nullptr; //<2F><><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Сͨ<D0A1>Ӹ߶<D3B8>
|
|
|
|
|
int *g_ptrArraySeries3 = nullptr; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õĸ߶<C4B8>
|
|
|
|
|
|
|
|
|
|
//<2F>̺߳<DFB3><CCBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD>ӷ<EFBFBD><D3B7><EFBFBD>
|
|
|
|
|
void ThreadFuncAnalysisRoute()
|
|
|
|
|
{
|
|
|
|
|
while (m_bRunRoute)
|
|
|
|
|
{
|
|
|
|
|
for (int i=0;i<(g_iWayPointNum-1);i++)
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>
|
|
|
|
|
g_ptrArraySeries3[i] = g_totalLinePtNum;
|
|
|
|
|
|
|
|
|
|
double _dLineSecDis, _dLineSecDir; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ľ<EFBFBD><C4BE><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD>
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD>㺽<EFBFBD><E3BABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD><D5B5><EFBFBD>ˮƽ<CBAE><C6BD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD>λ<EFBFBD><CEBB>
|
|
|
|
|
CalculateTwoPtsDistanceAzimuth(_dLineSecDis, _dLineSecDir, pts[i].lon, pts[i].lat, pts[i+1].lon,pts[i+1].lat, 3);
|
|
|
|
|
|
|
|
|
|
//<2F><>100<30><30>Ϊ<EFBFBD><CEAA><EFBFBD>࣬<EFBFBD><E0A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>
|
|
|
|
|
g_iInterNumSec = (int)(floor(_dLineSecDis/100));
|
|
|
|
|
|
|
|
|
|
for (int j=0;j<=g_iInterNumSec;j++)
|
|
|
|
|
{
|
|
|
|
|
//<2F><>ֵ<EFBFBD><D6B5>λ<EFBFBD><CEBB>
|
|
|
|
|
double interPolLon = 0.0, interPolLat = 0.0;
|
|
|
|
|
float interPolHight = 0.0;
|
|
|
|
|
|
|
|
|
|
CalculatePtCoordinate(interPolLon, interPolLat, pts[i].lon, pts[i].lat, _dLineSecDir, j*100, 3);
|
|
|
|
|
|
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1>ֵ<EFBFBD><D6B5><EFBFBD>ĸ߳<C4B8>
|
|
|
|
|
if(!m_mapElevation2.getElevation(interPolHight, interPolLon, interPolLat))
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD>߳<EFBFBD><DFB3><EFBFBD>Ϣ<EFBFBD><CFA2>ȫ
|
|
|
|
|
::PostMessage(g_hwndDlgLight,WM_SEND_UPDATEDIALOG,(WPARAM)3,(LPARAM)-1);
|
|
|
|
|
|
|
|
|
|
//<2F>ر<EFBFBD><D8B1>߳<EFBFBD>
|
|
|
|
|
m_bRunRoute = false;
|
|
|
|
|
|
|
|
|
|
g_iInterNumSec = 0;
|
|
|
|
|
g_iWayPointNum = 0;
|
|
|
|
|
g_iCurWaypoint = 0;
|
|
|
|
|
g_iTotalInterNum = 0;
|
|
|
|
|
g_totalLinePtNum = 0;
|
|
|
|
|
|
|
|
|
|
continue ;
|
|
|
|
|
}
|
|
|
|
|
g_ptrArraySeries1[g_totalLinePtNum] = interPolHight;
|
|
|
|
|
|
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1>Сͨ<D0A1>Ӹ߶<D3B8>
|
|
|
|
|
float _minVisiAlt = CalculateVisibleAlt(interPolLon, interPolLat);
|
|
|
|
|
if (_minVisiAlt > 0.1f)
|
|
|
|
|
{
|
|
|
|
|
g_ptrArraySeries2[g_totalLinePtNum] = _minVisiAlt;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//<2F>ر<EFBFBD><D8B1>߳<EFBFBD>
|
|
|
|
|
m_bRunRoute = false;
|
|
|
|
|
|
|
|
|
|
g_iInterNumSec = 0;
|
|
|
|
|
g_iWayPointNum = 0;
|
|
|
|
|
g_iCurWaypoint = 0;
|
|
|
|
|
g_iTotalInterNum = 0;
|
|
|
|
|
g_totalLinePtNum = 0;
|
|
|
|
|
|
|
|
|
|
continue ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_totalLinePtNum++;
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD>Ի<EFBFBD><D4BB><EFBFBD><F2A3ACB8>·<EFBFBD><C2B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
::PostMessage(g_hwndDlgLight,WM_SEND_UPDATEDIALOG,(WPARAM)3,(LPARAM)1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (true == m_bRunRoute)
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>
|
|
|
|
|
g_ptrArraySeries3[g_iWayPointNum-1] = g_totalLinePtNum-1;
|
|
|
|
|
|
|
|
|
|
//<2F>ر<EFBFBD><D8B1>߳<EFBFBD>
|
|
|
|
|
m_bRunRoute = false;
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD>ɺ<EFBFBD><C9BA>߷<EFBFBD><DFB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD>Ի<EFBFBD><D4BB><EFBFBD><F2A3ACBB>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
::PostMessage(g_hwndDlgLight,WM_SEND_UPDATEDIALOG,(WPARAM)3,(LPARAM)-2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ij<EFBFBD><C4B3><EFBFBD>ľ<EFBFBD><C4BE>ȡ<EFBFBD>γ<EFBFBD>ȣ<EFBFBD><C8A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>վ<EFBFBD><D5BE><EFBFBD><EFBFBD>Сͨ<D0A1>Ӹ߶<D3B8>
|
|
|
|
|
float CalculateVisibleAlt(const double& lon, const double& lat)
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮƽ<CBAE><C6BD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD>λ<EFBFBD><CEBB>
|
|
|
|
|
double dis = 0.0, angle = 0.0;
|
|
|
|
|
CalculateTwoPtsDistanceAzimuth(dis, angle, g_dRoute_GCSlon, g_dRoute_GCSlat, lon, lat, 3);
|
|
|
|
|
|
|
|
|
|
//<2F><>30<33><30>Ϊ<EFBFBD><CEAA><EFBFBD>࣬<EFBFBD><E0A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>
|
|
|
|
|
int interPolDis = 30;
|
|
|
|
|
int interPolNum = (int)floor(dis/interPolDis);
|
|
|
|
|
|
|
|
|
|
//<2F><>ֵ<EFBFBD><D6B5>λ<EFBFBD>ü<EFBFBD><C3BC><EFBFBD>
|
|
|
|
|
double interPolLon = 0.0, interPolLat = 0.0;
|
|
|
|
|
float interPolHight = 0.0;
|
|
|
|
|
|
|
|
|
|
double _dTanMaxAngle = 0.0;
|
|
|
|
|
float _fMinLightAlt = 0.0f;
|
|
|
|
|
|
|
|
|
|
double _tempAngle = 0.0;
|
|
|
|
|
|
|
|
|
|
for(int i = 1; i <= interPolNum; i++)
|
|
|
|
|
{
|
|
|
|
|
CalculatePtCoordinate(interPolLon, interPolLat, g_dRoute_GCSlon, g_dRoute_GCSlat, angle, i*interPolDis, 3);
|
|
|
|
|
|
|
|
|
|
if(!m_mapElevation2.getElevation(interPolHight, interPolLon, interPolLat))
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD>߳<EFBFBD><DFB3><EFBFBD>Ϣ<EFBFBD><CFA2>ȫ
|
|
|
|
|
::PostMessage(g_hwndDlgLight,WM_SEND_UPDATEDIALOG,(WPARAM)3,(LPARAM)-1);
|
|
|
|
|
|
|
|
|
|
return 0.0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_tempAngle = CalSlopeBetweenTwoPoint(g_dRoute_GCSlon, g_dRoute_GCSlat, g_fRoute_GCSalt, interPolLon, interPolLat, interPolHight);
|
|
|
|
|
|
|
|
|
|
_dTanMaxAngle = max(_tempAngle,_dTanMaxAngle);
|
|
|
|
|
|
|
|
|
|
_fMinLightAlt = (float)CalAltFromSlope(g_dRoute_GCSlon, g_dRoute_GCSlat, g_fRoute_GCSalt, interPolLon, interPolLat, _dTanMaxAngle);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return _fMinLightAlt;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------------------------------------------
|
|
|
|
|
˵<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD>ӷ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
-------------------------------------------------------------------------------------------------------------*/
|
|
|
|
|
//ʵʱ<CAB5><CAB1><EFBFBD><EFBFBD>ͨ<EFBFBD>ӷ<EFBFBD><D3B7><EFBFBD><EFBFBD>߳̿<DFB3><CCBF><EFBFBD><EFBFBD><EFBFBD>־
|
|
|
|
|
volatile bool m_bRunRealTimeLOS = false;
|
|
|
|
|
|
|
|
|
|
bool g_bHandlingLOS = false;
|
|
|
|
|
|
|
|
|
|
double *g_ptrArrayLight1 = nullptr;
|
|
|
|
|
double *g_ptrArrayLight2 = nullptr;
|
|
|
|
|
int g_iTotalAnalyNum = 0;
|
|
|
|
|
|
|
|
|
|
double g_dLightGCSlon; //<2F><><EFBFBD><EFBFBD>վ<EFBFBD><D5BE><EFBFBD><EFBFBD>
|
|
|
|
|
double g_dLightGCSlat; //<2F><><EFBFBD><EFBFBD>վγ<D5BE><CEB3>
|
|
|
|
|
float g_fLightGCSAlt; //<2F><><EFBFBD><EFBFBD>վ<EFBFBD>߶ȣ<DFB6><C8A3><EFBFBD><EFBFBD><EFBFBD>վ<EFBFBD><D5BE><EFBFBD>ĸ̼߳<DFB3><CCBC>Ϸ<EFBFBD><CFB7>ո߶ȣ<DFB6>
|
|
|
|
|
double g_dLightAngle; //<2F><><EFBFBD><EFBFBD>վ-<2D>ɻ<EFBFBD><C9BB><EFBFBD>λ
|
|
|
|
|
double g_dLightDis; //<2F><><EFBFBD><EFBFBD>վ-<2D>ɻ<EFBFBD><C9BB><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
double g_dLightUavAlt; //<2F>ɻ<EFBFBD><C9BB>߶<EFBFBD>
|
|
|
|
|
float g_fUavLosAlt; //<2F>ɻ<EFBFBD><C9BB><EFBFBD><EFBFBD>봦<EFBFBD><EBB4A6>ͨ<EFBFBD>Ӹ߶<D3B8>
|
|
|
|
|
|
|
|
|
|
//<2F>̺߳<DFB3><CCBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵʱ<CAB5><CAB1><EFBFBD><EFBFBD>ͨ<EFBFBD>ӷ<EFBFBD><D3B7><EFBFBD>
|
|
|
|
|
void ThreadFuncAnalysisLOS()
|
|
|
|
|
{
|
|
|
|
|
while(m_bRunRealTimeLOS)
|
|
|
|
|
{
|
|
|
|
|
if (true == g_bHandlingLOS)
|
|
|
|
|
{
|
|
|
|
|
//<2F><>ֵ<EFBFBD><D6B5>λ<EFBFBD><CEBB>
|
|
|
|
|
double interPolLon = 0.0, interPolLat = 0.0;
|
|
|
|
|
float interPolHight = 0.0f;
|
|
|
|
|
|
|
|
|
|
g_iTotalAnalyNum = (int)(g_dLightDis/30);
|
|
|
|
|
|
|
|
|
|
if (g_ptrArrayLight1 != nullptr)
|
|
|
|
|
{
|
|
|
|
|
delete[] g_ptrArrayLight1;
|
|
|
|
|
g_ptrArrayLight1 = nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_ptrArrayLight1 = new double[g_iTotalAnalyNum + 1];
|
|
|
|
|
g_ptrArrayLight2 = new double[g_iTotalAnalyNum + 1];
|
|
|
|
|
|
|
|
|
|
memset(g_ptrArrayLight1, 0, sizeof(double) * (g_iTotalAnalyNum + 1));
|
|
|
|
|
memset(g_ptrArrayLight2, 0, sizeof(double) * (g_iTotalAnalyNum + 1));
|
|
|
|
|
|
|
|
|
|
g_ptrArrayLight1[0] = g_fLightGCSAlt;
|
|
|
|
|
g_ptrArrayLight2[0] = g_fLightGCSAlt;
|
|
|
|
|
|
|
|
|
|
double _dTanMaxSlope = -1000.0; //<2F><><EFBFBD><EFBFBD>б<EFBFBD><D0B1>
|
|
|
|
|
float _fMinLOSAlt = 0.0; //<2F><>Сͨ<D0A1>Ӹ߶<D3B8>
|
|
|
|
|
double _tempSlope = 0.0; //<2F><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>վ<EFBFBD><D5BE><EFBFBD><EFBFBD><EFBFBD>ߵ<EFBFBD>б<EFBFBD><D0B1>
|
|
|
|
|
|
|
|
|
|
for (int i=1;i<=g_iTotalAnalyNum;i++)
|
|
|
|
|
{
|
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1>ֵ<EFBFBD>㾭γ<E3BEAD><CEB3>
|
|
|
|
|
CalculatePtCoordinate(interPolLon, interPolLat, g_dLightGCSlon, g_dLightGCSlat, g_dLightAngle, i*30, 3);
|
|
|
|
|
|
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1>ֵ<EFBFBD><D6B5><EFBFBD>߳<EFBFBD>ֵ
|
|
|
|
|
if(!m_mapElevation2.getElevation(interPolHight, interPolLon, interPolLat))
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD>߳<EFBFBD><DFB3><EFBFBD>Ϣ<EFBFBD><CFA2>ȫ
|
|
|
|
|
::PostMessage(g_hwndDlgLight,WM_SEND_UPDATEDIALOG,(WPARAM)4,(LPARAM)-1);
|
|
|
|
|
|
|
|
|
|
//<2F>ر<EFBFBD><D8B1>߳<EFBFBD>
|
|
|
|
|
m_bRunRealTimeLOS = false;
|
|
|
|
|
|
|
|
|
|
continue ;
|
|
|
|
|
}
|
|
|
|
|
g_ptrArrayLight1[i] = interPolHight;
|
|
|
|
|
|
|
|
|
|
_tempSlope = CalSlopeBetweenTwoPoint(g_dLightGCSlon, g_dLightGCSlat, g_fLightGCSAlt, interPolLon, interPolLat, interPolHight);
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0>-<2D><><EFBFBD><EFBFBD>վ<EFBFBD><D5BE>б<EFBFBD>ʣ<EFBFBD>С<EFBFBD><D0A1>֮ǰ<D6AE><C7B0><EFBFBD>е<EFBFBD><D0B5>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0>-<2D><><EFBFBD><EFBFBD>վ<EFBFBD><D5BE><EFBFBD><EFBFBD>ͨ<EFBFBD>ӵ<EFBFBD>б<EFBFBD><D0B1>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ֵ
|
|
|
|
|
_dTanMaxSlope = max(_tempSlope,_dTanMaxSlope);
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD>㵱ǰ<E3B5B1><C7B0>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD>ӵ<EFBFBD><D3B5><EFBFBD>С<EFBFBD>߶<EFBFBD>
|
|
|
|
|
_fMinLOSAlt = (float)CalAltFromSlope(g_dLightGCSlon, g_dLightGCSlat, g_fLightGCSAlt, interPolLon, interPolLat, _dTanMaxSlope);
|
|
|
|
|
|
|
|
|
|
g_ptrArrayLight2[i] = _fMinLOSAlt;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_fUavLosAlt = _fMinLOSAlt;
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ʵʱͨ<CAB1>ӷ<EFBFBD><D3B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD>Ի<EFBFBD><D4BB><EFBFBD><F2A3ACBB>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
::SendMessage(g_hwndDlgLight,WM_SEND_UPDATEDIALOG,(WPARAM)4,(LPARAM)-2);
|
|
|
|
|
|
|
|
|
|
g_bHandlingLOS = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------------------------------------------
|
|
|
|
|
˵<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD>ӵȸ<EFBFBD><EFBFBD>߷<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
-------------------------------------------------------------------------------------------------------------*/
|
|
|
|
|
//ͨ<>ӵȸ<D3B5><C8B8>߷<EFBFBD><DFB7><EFBFBD><EFBFBD>߳̿<DFB3><CCBF><EFBFBD><EFBFBD><EFBFBD>־
|
|
|
|
|
volatile bool m_bRunContour = false;
|
|
|
|
|
|
|
|
|
|
double g_dGroundLonCountour = 0.0; //<2F><><EFBFBD><EFBFBD>վ<EFBFBD><D5BE><EFBFBD><EFBFBD>
|
|
|
|
|
double g_dGroundLatCountour = 0.0; //<2F><><EFBFBD><EFBFBD>վγ<D5BE><CEB3>
|
|
|
|
|
float g_fGroundAltCountour = 0.0; //<2F><><EFBFBD><EFBFBD>վ<EFBFBD>߶<EFBFBD>
|
|
|
|
|
|
|
|
|
|
float g_fLastLightAlt = 0.0f;
|
|
|
|
|
|
|
|
|
|
int g_iMaxLosAlt = 8000;
|
|
|
|
|
|
|
|
|
|
//<2F>̺߳<DFB3><CCBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD>ӵȸ<D3B5><C8B8>߷<EFBFBD><DFB7><EFBFBD>
|
|
|
|
|
void ThreadFuncAnalysisContour()
|
|
|
|
|
{
|
|
|
|
|
while (m_bRunContour)
|
|
|
|
|
{
|
|
|
|
|
for (int i=0;i<360;i++)
|
|
|
|
|
{
|
|
|
|
|
g_fLastLightAlt = g_fGroundAltCountour;
|
|
|
|
|
|
|
|
|
|
if (false == AnalysisContourLine(i))
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD>߳<EFBFBD><DFB3><EFBFBD>Ϣ<EFBFBD><CFA2>ȫ
|
|
|
|
|
::PostMessage(g_hwndDlgLight,WM_SEND_UPDATEDIALOG,(WPARAM)5,(LPARAM)-1);
|
|
|
|
|
|
|
|
|
|
//<2F><>ֹ<EFBFBD>߳<EFBFBD>
|
|
|
|
|
m_bRunContour = false;
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
|
|
|
|
|
::PostMessage(g_hwndDlgLight,WM_SEND_UPDATEDIALOG,(WPARAM)5,(LPARAM)i);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F>߳<EFBFBD><DFB3><EFBFBD><EFBFBD><EFBFBD>ֹ
|
|
|
|
|
if (false == m_bRunContour)
|
|
|
|
|
{
|
|
|
|
|
::PostMessage(g_hwndDlgLight,WM_SEND_UPDATEDIALOG,(WPARAM)5,(LPARAM)-3);
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (true == m_bRunContour)
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
::PostMessage(g_hwndDlgLight,WM_SEND_UPDATEDIALOG,(WPARAM)5,(LPARAM)-2);
|
|
|
|
|
|
|
|
|
|
//<2F><>ֹ<EFBFBD>߳<EFBFBD>
|
|
|
|
|
m_bRunContour = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//ͨ<>ӵȸ<D3B5><C8B8>߷<EFBFBD><DFB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD>ͼ<EFBFBD>ϱ<EFBFBD><CFB1><EFBFBD><EFBFBD>ȸ<EFBFBD><C8B8>ߣ<EFBFBD>iAngle <20>Ƕ<EFBFBD>
|
|
|
|
|
bool AnalysisContourLine(int iAngle)
|
|
|
|
|
{
|
|
|
|
|
double _dTanMaxAngle = 0.0; //<2F><>Сͨ<D0A1>ӽǶ<D3BD>
|
|
|
|
|
float _fMinLightAlt = 0.0; //<2F><>Сͨ<D0A1>Ӹ߶<D3B8>
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
|
|
|
|
double interPolLon = 0.0, interPolLat = 0.0;
|
|
|
|
|
float interPolHight = 0.0;
|
|
|
|
|
|
|
|
|
|
//<2F>м<EFBFBD><D0BC><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
double _tempAngle = 0.0; //<2F><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>վ<EFBFBD><D5BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ˮƽ<CBAE><C6BD><EFBFBD><EFBFBD><EFBFBD>ļн<C4BC>
|
|
|
|
|
|
|
|
|
|
int _iStep = 1;
|
|
|
|
|
|
|
|
|
|
while (_fMinLightAlt < g_iMaxLosAlt)
|
|
|
|
|
{
|
|
|
|
|
CalculatePtCoordinate(interPolLon, interPolLat, g_dGroundLonCountour, g_dGroundLatCountour, iAngle, _iStep*30, 3); //30Ϊ<30><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĸ߳<C4B8>
|
|
|
|
|
if(!m_mapElevation2.getElevation(interPolHight, interPolLon, interPolLat))
|
|
|
|
|
{
|
|
|
|
|
//δ<><CEB4>ȡ<EFBFBD><C8A1><EFBFBD>߳<EFBFBD>ֵ
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_tempAngle = CalSlopeBetweenTwoPoint(g_dGroundLonCountour, g_dGroundLatCountour, g_fGroundAltCountour, interPolLon, interPolLat, interPolHight);
|
|
|
|
|
|
|
|
|
|
_dTanMaxAngle = max(_tempAngle,_dTanMaxAngle);
|
|
|
|
|
|
|
|
|
|
_fMinLightAlt = (float)CalAltFromSlope(g_dGroundLonCountour, g_dGroundLatCountour, g_fGroundAltCountour, interPolLon, interPolLat, _dTanMaxAngle);
|
|
|
|
|
|
|
|
|
|
if (true == m_bRunContour)
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD>ӵ㵽ͨ<E3B5BD>ӵȸ<D3B5><C8B8><EFBFBD>ͼ<EFBFBD><CDBC>
|
|
|
|
|
InsertPtToContourLine(_fMinLightAlt, interPolLon, interPolLat);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_iStep++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD>ӵ㵽ͨ<E3B5BD>ӵȸ<D3B5><C8B8><EFBFBD>ͼ<EFBFBD><CDBC>
|
|
|
|
|
void InsertPtToContourLine(float _fLightAlt, double _dPtLon, double _dPtLat)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 1;i<=20;i++)
|
|
|
|
|
{
|
|
|
|
|
if ((g_fLastLightAlt < (500*i)) && (_fLightAlt > (500*i)))
|
|
|
|
|
{
|
|
|
|
|
structPoint _pt;
|
|
|
|
|
_pt.lon = _dPtLon;
|
|
|
|
|
_pt.lat = _dPtLat;
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD>ӵ㵽ͨ<E3B5BD>ӵȸ<D3B5><C8B8><EFBFBD>ͼ<EFBFBD><CDBC>
|
|
|
|
|
::SendMessage(g_mapHwnd,WM_ADD_LINELAYER,WPARAM(&_pt),LPARAM(i));
|
|
|
|
|
|
|
|
|
|
g_fLastLightAlt = _fLightAlt;
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// CDlgLightRegion <20>Ի<EFBFBD><D4BB><EFBFBD>
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_DYNAMIC(CDlgLightRegion, CBCGPDialog)
|
|
|
|
|
|
|
|
|
|
CDlgLightRegion::CDlgLightRegion(CWnd* pParent /*=NULL*/)
|
|
|
|
|
: CBCGPDialog(CDlgLightRegion::IDD, pParent)
|
|
|
|
|
{
|
|
|
|
|
EnableVisualManagerStyle(TRUE, TRUE);
|
|
|
|
|
|
|
|
|
|
m_dGroundLon = 107.4203869;
|
|
|
|
|
m_dGroundLat = 37.8544731;
|
|
|
|
|
m_fGroudAlt = 0.0f;
|
|
|
|
|
m_dCabinHgt = 4.0;
|
|
|
|
|
|
|
|
|
|
m_iFlightAlt = 3500;
|
|
|
|
|
m_iRegionRadius = 30;
|
|
|
|
|
|
|
|
|
|
m_bRTlight = FALSE;
|
|
|
|
|
|
|
|
|
|
m_pLine1 = nullptr;
|
|
|
|
|
m_strokeStyle.SetDashStyle(CBCGPStrokeStyle::BCGP_DASH_STYLE_DOT);
|
|
|
|
|
|
|
|
|
|
m_pTextTip = nullptr;
|
|
|
|
|
|
|
|
|
|
m_bRealTime_Visi = FALSE;
|
|
|
|
|
m_bRealTime_Crash = FALSE;
|
|
|
|
|
m_iMaxLosAlt = 8000;
|
|
|
|
|
m_iFightRegion = 280;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CDlgLightRegion::~CDlgLightRegion()
|
|
|
|
|
{
|
|
|
|
|
m_bRunRegion = false;
|
|
|
|
|
m_bRunDetect = false;
|
|
|
|
|
m_bRunRoute = false;
|
|
|
|
|
m_bRunRealTimeLOS = false;
|
|
|
|
|
m_bRunCrash = false;
|
|
|
|
|
|
|
|
|
|
if (g_ptrArraySeries1 != nullptr)
|
|
|
|
|
{
|
|
|
|
|
delete[] g_ptrArraySeries1;
|
|
|
|
|
g_ptrArraySeries1 = nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (g_ptrArraySeries2 != nullptr)
|
|
|
|
|
{
|
|
|
|
|
delete[] g_ptrArraySeries2;
|
|
|
|
|
g_ptrArraySeries2 = nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (g_ptrArraySeries3 != nullptr)
|
|
|
|
|
{
|
|
|
|
|
delete[] g_ptrArraySeries3;
|
|
|
|
|
g_ptrArraySeries3 = nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (g_ptrArrayLight1 != nullptr)
|
|
|
|
|
{
|
|
|
|
|
delete[] g_ptrArrayLight1;
|
|
|
|
|
g_ptrArrayLight1 = nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (g_ptrArrayLight2 != nullptr)
|
|
|
|
|
{
|
|
|
|
|
delete[] g_ptrArrayLight2;
|
|
|
|
|
g_ptrArrayLight2 = nullptr;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CDlgLightRegion::DoDataExchange(CDataExchange* pDX)
|
|
|
|
|
{
|
|
|
|
|
CBCGPDialog::DoDataExchange(pDX);
|
|
|
|
|
DDX_Control(pDX, IDC_CONTAINER_ALTCHART, m_wndChart);
|
|
|
|
|
DDX_Text(pDX, IDC_EDIT_GROUND_LON, m_dGroundLon);
|
|
|
|
|
DDX_Text(pDX, IDC_EDIT_GROUND_LAT, m_dGroundLat);
|
|
|
|
|
DDX_Text(pDX, IDC_EDIT_BASEALT, m_iFlightAlt);
|
|
|
|
|
DDX_Text(pDX, IDC_EDIT_REGIONRADIUS, m_iRegionRadius);
|
|
|
|
|
DDX_Check(pDX, IDC_CHECK_REALTIME, m_bRealTime_Visi);
|
|
|
|
|
DDX_Check(pDX, IDC_CHECK_RT_DETECTION, m_bRealTime_Crash);
|
|
|
|
|
DDX_Text(pDX, IDC_EDIT_CABINALT, m_dCabinHgt);
|
|
|
|
|
DDX_Check(pDX, IDC_CHECK_RT_LIGHT, m_bRTlight);
|
|
|
|
|
DDX_Control(pDX, IDC_GAUGE_PROMPT_LINE, m_LineTextContainer);
|
|
|
|
|
DDX_Control(pDX, IDC_GAUGE_PROMPT_REGION, m_RegionTextContainer);
|
|
|
|
|
DDX_Control(pDX, IDC_GAUGE_PROMPT_CONTOUR, m_ContourTextContainer);
|
|
|
|
|
DDX_Text(pDX, IDC_EDIT_MAXLOSALT, m_iMaxLosAlt);
|
|
|
|
|
DDX_Text(pDX, IDC_EDIT_FIGHTRADIUS, m_iFightRegion);
|
|
|
|
|
DDV_MinMaxInt(pDX, m_iFightRegion, 0, 500);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CDlgLightRegion, CBCGPDialog)
|
|
|
|
|
ON_WM_TIMER()
|
|
|
|
|
ON_WM_SIZE()
|
|
|
|
|
ON_BN_CLICKED(IDC_BUTTON_DRAWPOINT, &CDlgLightRegion::OnBnClickedButtonDrawPoint)
|
|
|
|
|
ON_BN_CLICKED(IDC_BUTTON_REGIONANAYLSIS, &CDlgLightRegion::OnBnClickedButtonRegionAnaylsis)
|
|
|
|
|
ON_BN_CLICKED(IDC_CHECK_REALTIME, &CDlgLightRegion::OnBnClickedCheckRealtime)
|
|
|
|
|
ON_BN_CLICKED(IDC_BUTTON_REGIONDELETE, &CDlgLightRegion::OnBnClickedButtonRegionDelete)
|
|
|
|
|
ON_BN_CLICKED(IDC_CHECK_RT_LIGHT, &CDlgLightRegion::OnBnClickedCheckRtLight)
|
|
|
|
|
ON_BN_CLICKED(IDC_BUTTON_LOADROUTE, &CDlgLightRegion::OnBnClickedButtonLoadRoute)
|
|
|
|
|
ON_BN_CLICKED(IDC_BUTTON_SAVEIMAGE, &CDlgLightRegion::OnBnClickedButtonSaveImage)
|
|
|
|
|
ON_BN_CLICKED(IDC_BUTTON_STOPROUTE, &CDlgLightRegion::OnBnClickedButtonStopRoute)
|
|
|
|
|
ON_BN_CLICKED(IDC_BUTTON_CONTOURLINE, &CDlgLightRegion::OnBnClickedButtonContourline)
|
|
|
|
|
ON_BN_CLICKED(IDC_BUTTON_CONTOURDELETE, &CDlgLightRegion::OnBnClickedButtonContourDelete)
|
|
|
|
|
ON_MESSAGE(WM_SEND_UPDATEDIALOG, &CDlgLightRegion::OnSendUpdateDialog)
|
|
|
|
|
ON_BN_CLICKED(IDC_BUTTON_SELECTPTINMAP, &CDlgLightRegion::OnBnClickedButtonSelectPtInMap)
|
|
|
|
|
ON_BN_CLICKED(IDC_BUTTON_CLEARLINELAYER, &CDlgLightRegion::OnBnClickedButtonClearLineLayer)
|
|
|
|
|
ON_BN_CLICKED(IDC_BUTTON_GETALTVALUE, &CDlgLightRegion::OnBnClickedButtonGetAltValue)
|
|
|
|
|
ON_BN_CLICKED(IDC_BUTTON_REVERSE, &CDlgLightRegion::OnBnClickedButtonReverse)
|
|
|
|
|
ON_REGISTERED_MESSAGE(BCGM_ON_CHART_MOUSE_DOWN, OnMouseDown)
|
|
|
|
|
ON_BN_CLICKED(IDC_BUTTON_CLEARRESULT, &CDlgLightRegion::OnBnClickedButtonClearResult)
|
|
|
|
|
ON_BN_CLICKED(IDC_CHECK_RT_DETECTION, &CDlgLightRegion::OnBnClickedCheckRtDetection)
|
|
|
|
|
ON_BN_CLICKED(IDC_BUTTON_DRAWFIGHT, &CDlgLightRegion::OnBnClickedButtonDrawFight)
|
|
|
|
|
ON_BN_CLICKED(IDC_BUTTON_DELETEFIGHT, &CDlgLightRegion::OnBnClickedButtonDeleteFight)
|
|
|
|
|
ON_BN_CLICKED(IDC_BUTTON_GETDEMREGION, &CDlgLightRegion::OnBnClickedButtonGetDemRegion)
|
|
|
|
|
END_MESSAGE_MAP()
|
|
|
|
|
|
|
|
|
|
// CDlgLightRegion <20><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
BOOL CDlgLightRegion::OnInitDialog()
|
|
|
|
|
{
|
|
|
|
|
CBCGPDialog::OnInitDialog();
|
|
|
|
|
|
|
|
|
|
g_hwndDlgLight = this->GetSafeHwnd();
|
|
|
|
|
|
|
|
|
|
CenterWindow();
|
|
|
|
|
|
|
|
|
|
pChart = m_wndChart.GetChart();
|
|
|
|
|
ASSERT_VALID(pChart);
|
|
|
|
|
|
|
|
|
|
//Releaseģʽ<C4A3>£<EFBFBD><C2A3><EFBFBD><EFBFBD>߱<EFBFBD><DFB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ף<EFBFBD><D7A3>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
|
//pChart->SetColors(CBCGPChartTheme::CT_DEFAULT);
|
|
|
|
|
#else
|
|
|
|
|
pChart->SetColors(CBCGPChartTheme::CT_DEFAULT, TRUE);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD>÷Ŵ<C3B7><C5B4><EFBFBD>С<EFBFBD><D0A1>ʽ
|
|
|
|
|
pChart->SetZoomScrollConfig(BCGPChartMouseConfig::ZSO_WHEEL_PAN, BCGPChartFormatSelection::ST_VERT_AXIS_ONLY);
|
|
|
|
|
pChart->SetSelectionType(BCGPChartFormatSelection::ST_VERT_AXIS_ONLY);
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
pChart->EnableMouseTrackingMode(
|
|
|
|
|
BCGPChartHitInfo::HIT_DATA_POINT |
|
|
|
|
|
BCGPChartHitInfo::HIT_DATA_LABEL |
|
|
|
|
|
BCGPChartHitInfo::HIT_AXIS |
|
|
|
|
|
BCGPChartHitInfo::HIT_AXIS_NAME |
|
|
|
|
|
BCGPChartHitInfo::HIT_CHART_AREA |
|
|
|
|
|
BCGPChartHitInfo::HIT_LEGEND |
|
|
|
|
|
BCGPChartHitInfo::HIT_TITLE |
|
|
|
|
|
BCGPChartHitInfo::HIT_DIAGRAM |
|
|
|
|
|
BCGPChartHitInfo::HIT_DATA_TABLE |
|
|
|
|
|
BCGPChartHitInfo::HIT_ALL_ELEMENTS);
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD>ã<EFBFBD><C3A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϣ<EFBFBD><CFA3><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|
|
|
|
CBCGPInfoTipOptions infoTipOptions;
|
|
|
|
|
infoTipOptions.m_StemLocation = CBCGPPopupWindow::BCGPPopupWindowStemLocation_BottomCenter;
|
|
|
|
|
m_wndChart.EnableInfoTip(TRUE, &infoTipOptions);
|
|
|
|
|
|
|
|
|
|
pXAxis = pChart->GetChartAxis(BCGP_CHART_X_PRIMARY_AXIS);
|
|
|
|
|
pYAxis = pChart->GetChartAxis(BCGP_CHART_Y_PRIMARY_AXIS);
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1<EFBFBD><31><EFBFBD><EFBFBD><EFBFBD>Ƹ߳<C6B8><DFB3><EFBFBD>Ϣ
|
|
|
|
|
pSeries1 = pChart->CreateSeries(_T("DEM Alt"), CBCGPColor(), BCGP_CT_DEFAULT, BCGPChartArea);
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2<EFBFBD><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Сͨ<D0A1>Ӹ߶<D3B8>
|
|
|
|
|
pSeries2 = pChart->CreateSeries(_T("LOS Alt"), CBCGPColor(CBCGPColor::OrangeRed), BCGP_CT_DEFAULT, BCGPChartLine);
|
|
|
|
|
pSeries2->SetSeriesLineWidth(2);
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>3<EFBFBD><33><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD>λ<EFBFBD><CEBB>
|
|
|
|
|
pSeries3 = pChart->CreateSeries(_T("UAV Alt"), CBCGPColor(CBCGPColor::LimeGreen), BCGP_CT_DEFAULT, BCGPChartLine);
|
|
|
|
|
BCGPChartFormatSeries style = pSeries3->GetSeriesFormat();
|
|
|
|
|
style.m_curveType = BCGPChartFormatSeries::CCT_NO_LINE;
|
|
|
|
|
pSeries3->SetSeriesFormat(style);
|
|
|
|
|
|
|
|
|
|
pSeries3->ShowMarker(TRUE, 0);
|
|
|
|
|
pSeries3->SetMarkerSize(4, 0);
|
|
|
|
|
|
|
|
|
|
/*pSeries3->ShowDataLabel(TRUE,0);
|
|
|
|
|
pSeries3->SetDataLabelAngle(60, 0);
|
|
|
|
|
pSeries3->SetDataLabelDataFormat(_T("%.1f"),0);*/
|
|
|
|
|
|
|
|
|
|
pChart->SetDirty(TRUE, TRUE);
|
|
|
|
|
m_wndChart.RedrawWindow();
|
|
|
|
|
|
|
|
|
|
//<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD>DZ<EFBFBD>
|
|
|
|
|
InitRegionTextContainer();
|
|
|
|
|
|
|
|
|
|
//<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD>ӷ<EFBFBD><D3B7><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD>DZ<EFBFBD>
|
|
|
|
|
InitLineTextContainer();
|
|
|
|
|
|
|
|
|
|
//<2F><>ʼ<EFBFBD><CABC>ͨ<EFBFBD>ӵȸ<D3B5><C8B8>߷<EFBFBD><DFB7><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD>DZ<EFBFBD>
|
|
|
|
|
InitContourTextContainer();
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CDlgLightRegion::OnSize(UINT nType, int cx, int cy)
|
|
|
|
|
{
|
|
|
|
|
CBCGPDialog::OnSize(nType, cx, cy);
|
|
|
|
|
|
|
|
|
|
//ͼ<><CDBC><EFBFBD>ؼ<EFBFBD><D8BC><EFBFBD><EFBFBD>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD>仯<EFBFBD><E4BBAF><EFBFBD>仯
|
|
|
|
|
if (m_wndChart.GetSafeHwnd())
|
|
|
|
|
{
|
|
|
|
|
CRect rect;
|
|
|
|
|
GetClientRect(&rect);
|
|
|
|
|
|
|
|
|
|
CRect rectChart;
|
|
|
|
|
m_wndChart.GetWindowRect(rectChart);
|
|
|
|
|
|
|
|
|
|
ScreenToClient(rectChart);
|
|
|
|
|
|
|
|
|
|
rectChart.right = rect.right - 5;
|
|
|
|
|
rectChart.bottom = rect.bottom - 5;
|
|
|
|
|
|
|
|
|
|
m_wndChart.MoveWindow(&rectChart,TRUE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD>DZ<EFBFBD>
|
|
|
|
|
void CDlgLightRegion::InitRegionTextContainer()
|
|
|
|
|
{
|
|
|
|
|
CBCGPVisualContainer* pContainer = m_RegionTextContainer.GetVisualContainer();
|
|
|
|
|
ASSERT_VALID(pContainer);
|
|
|
|
|
|
|
|
|
|
pContainer->SetFillBrush(CBCGPBrush());
|
|
|
|
|
pContainer->SetOutlineBrush(CBCGPBrush());
|
|
|
|
|
|
|
|
|
|
CBCGPBrush m_arBrushes(CBCGPColor::AliceBlue);
|
|
|
|
|
m_pRegionTTextIndicator = new CBCGPTextGaugeImpl(_T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ"), m_arBrushes, pContainer);
|
|
|
|
|
|
|
|
|
|
CBCGPTextFormat m_TextFormat = m_pRegionTTextIndicator->GetTextFormat();
|
|
|
|
|
m_TextFormat.SetFontSize(15);
|
|
|
|
|
m_TextFormat.SetTextAlignment(CBCGPTextFormat::BCGP_TEXT_ALIGNMENT_CENTER);
|
|
|
|
|
m_TextFormat.SetTextVerticalAlignment(CBCGPTextFormat::BCGP_TEXT_ALIGNMENT_CENTER);
|
|
|
|
|
m_pRegionTTextIndicator->SetTextFormat(m_TextFormat);
|
|
|
|
|
|
|
|
|
|
CBCGPRect rect = pContainer->GetRect();
|
|
|
|
|
m_pRegionTTextIndicator->SetRect(rect);
|
|
|
|
|
|
|
|
|
|
m_RegionTextContainer.RedrawWindow();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD>ӷ<EFBFBD><D3B7><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD>DZ<EFBFBD>
|
|
|
|
|
void CDlgLightRegion::InitLineTextContainer()
|
|
|
|
|
{
|
|
|
|
|
CBCGPVisualContainer* pContainer = m_LineTextContainer.GetVisualContainer();
|
|
|
|
|
ASSERT_VALID(pContainer);
|
|
|
|
|
|
|
|
|
|
pContainer->SetFillBrush(CBCGPBrush());
|
|
|
|
|
pContainer->SetOutlineBrush(CBCGPBrush());
|
|
|
|
|
|
|
|
|
|
CBCGPBrush m_arBrushes(CBCGPColor::AliceBlue);
|
|
|
|
|
m_pLineTextIndicator = new CBCGPTextGaugeImpl(_T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ"), m_arBrushes, pContainer);
|
|
|
|
|
|
|
|
|
|
CBCGPTextFormat m_TextFormat = m_pLineTextIndicator->GetTextFormat();
|
|
|
|
|
m_TextFormat.SetFontSize(15);
|
|
|
|
|
m_TextFormat.SetTextAlignment(CBCGPTextFormat::BCGP_TEXT_ALIGNMENT_CENTER);
|
|
|
|
|
m_TextFormat.SetTextVerticalAlignment(CBCGPTextFormat::BCGP_TEXT_ALIGNMENT_CENTER);
|
|
|
|
|
m_pLineTextIndicator->SetTextFormat(m_TextFormat);
|
|
|
|
|
|
|
|
|
|
CBCGPRect rect = pContainer->GetRect();
|
|
|
|
|
m_pLineTextIndicator->SetRect(rect);
|
|
|
|
|
|
|
|
|
|
m_LineTextContainer.RedrawWindow();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><>ʼ<EFBFBD><CABC>ͨ<EFBFBD>ӵȸ<D3B5><C8B8>߷<EFBFBD><DFB7><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD>DZ<EFBFBD>
|
|
|
|
|
void CDlgLightRegion::InitContourTextContainer()
|
|
|
|
|
{
|
|
|
|
|
CBCGPVisualContainer* pContainer = m_ContourTextContainer.GetVisualContainer();
|
|
|
|
|
ASSERT_VALID(pContainer);
|
|
|
|
|
|
|
|
|
|
pContainer->SetFillBrush(CBCGPBrush());
|
|
|
|
|
pContainer->SetOutlineBrush(CBCGPBrush());
|
|
|
|
|
|
|
|
|
|
CBCGPBrush m_arBrushes(CBCGPColor::AliceBlue);
|
|
|
|
|
m_pContourTextIndicator = new CBCGPTextGaugeImpl(_T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ"), m_arBrushes, pContainer);
|
|
|
|
|
|
|
|
|
|
CBCGPTextFormat m_TextFormat = m_pContourTextIndicator->GetTextFormat();
|
|
|
|
|
m_TextFormat.SetFontSize(15);
|
|
|
|
|
m_TextFormat.SetTextAlignment(CBCGPTextFormat::BCGP_TEXT_ALIGNMENT_CENTER);
|
|
|
|
|
m_TextFormat.SetTextVerticalAlignment(CBCGPTextFormat::BCGP_TEXT_ALIGNMENT_CENTER);
|
|
|
|
|
m_pContourTextIndicator->SetTextFormat(m_TextFormat);
|
|
|
|
|
|
|
|
|
|
CBCGPRect rect = pContainer->GetRect();
|
|
|
|
|
m_pContourTextIndicator->SetRect(rect);
|
|
|
|
|
|
|
|
|
|
m_ContourTextContainer.RedrawWindow();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD><DFB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD>¶Ի<C2B6><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
afx_msg LRESULT CDlgLightRegion::OnSendUpdateDialog(WPARAM wParam, LPARAM lParam)
|
|
|
|
|
{
|
|
|
|
|
if (1 == (int)wParam) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
if (-1 == int(lParam))
|
|
|
|
|
{
|
|
|
|
|
m_pRegionTTextIndicator->SetText(_T("<EFBFBD>̲߳<EFBFBD>ȫ<EFBFBD><EFBFBD>"));
|
|
|
|
|
m_RegionTextContainer.RedrawWindow();
|
|
|
|
|
|
|
|
|
|
GetDlgItem(IDC_BUTTON_REGIONANAYLSIS)->EnableWindow(TRUE);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
CString str;
|
|
|
|
|
str.Format(_T("%d%%"),(int)(((int)lParam+1) * 100 / 360));
|
|
|
|
|
|
|
|
|
|
m_pRegionTTextIndicator->SetText(str);
|
|
|
|
|
m_RegionTextContainer.RedrawWindow();
|
|
|
|
|
|
|
|
|
|
if (359 == int(lParam))
|
|
|
|
|
{
|
|
|
|
|
GetDlgItem(IDC_BUTTON_REGIONANAYLSIS)->EnableWindow(TRUE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (2 == (int)wParam) //ʵʱͨ<CAB1>Ӽ<EFBFBD><D3BC><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
if (-1 == int(lParam))
|
|
|
|
|
{
|
|
|
|
|
BCGPMessageBox(_T("<EFBFBD>߳<EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>ȫ<EFBFBD><EFBFBD>"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (3 == (int)wParam) //<2F><><EFBFBD><EFBFBD>ͨ<EFBFBD>ӷ<EFBFBD><D3B7><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
if (-1 == int(lParam))
|
|
|
|
|
{
|
|
|
|
|
//δ<><CEB4>ȡ<EFBFBD><C8A1><EFBFBD>߳<EFBFBD>ֵ
|
|
|
|
|
m_pLineTextIndicator->SetText(_T("<EFBFBD>̲߳<EFBFBD>ȫ<EFBFBD><EFBFBD>"));
|
|
|
|
|
m_LineTextContainer.RedrawWindow();
|
|
|
|
|
}
|
|
|
|
|
else if (-2 == int(lParam))
|
|
|
|
|
{
|
|
|
|
|
for (int i=0;i<g_iTotalInterNum;i++)
|
|
|
|
|
{
|
|
|
|
|
pSeries1->AddDataPoint(g_ptrArraySeries1[i],i);
|
|
|
|
|
pSeries2->AddDataPoint(g_ptrArraySeries2[i],i);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ĸ߳<C4B8>
|
|
|
|
|
for (int i=0;i<g_iWayPointNum;i++)
|
|
|
|
|
{
|
|
|
|
|
pSeries3->AddDataPoint(pts[i].alt,g_ptrArraySeries3[i]);
|
|
|
|
|
|
|
|
|
|
pSeries1->ShowDataLabel(TRUE,g_ptrArraySeries3[i]);
|
|
|
|
|
pSeries1->SetDataLabelAngle(0, g_ptrArraySeries3[i]);
|
|
|
|
|
pSeries1->ShowMarker(TRUE, g_ptrArraySeries3[i]);
|
|
|
|
|
pSeries1->SetMarkerSize(4, g_ptrArraySeries3[i]);
|
|
|
|
|
|
|
|
|
|
CString str;
|
|
|
|
|
str.Format(_T("%d-%d"),pts[i].lineID,pts[i].ptID);
|
|
|
|
|
pSeries1->SetDataLabelDataFormat(str,g_ptrArraySeries3[i]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pChart->SetAutoDisplayRange(TRUE, TRUE);
|
|
|
|
|
pChart->SetDirty(TRUE, TRUE);
|
|
|
|
|
m_wndChart.RedrawWindow();
|
|
|
|
|
|
|
|
|
|
m_pLineTextIndicator->SetText(_T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>"));
|
|
|
|
|
m_LineTextContainer.RedrawWindow();
|
|
|
|
|
}
|
|
|
|
|
else if (1 == int(lParam))
|
|
|
|
|
{
|
|
|
|
|
if (g_iTotalInterNum > 0)
|
|
|
|
|
{
|
|
|
|
|
CString str;
|
|
|
|
|
str.Format(_T("%d%%"),(g_totalLinePtNum)*100/g_iTotalInterNum);
|
|
|
|
|
|
|
|
|
|
m_pLineTextIndicator->SetText(str);
|
|
|
|
|
m_LineTextContainer.RedrawWindow();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (4 == (int)wParam) //ʵʱ<CAB5><CAB1><EFBFBD>߷<EFBFBD><DFB7><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
if (-1 == int(lParam)) //δ<><CEB4>ȡ<EFBFBD><C8A1><EFBFBD>߳<EFBFBD>ֵ
|
|
|
|
|
{
|
|
|
|
|
m_bRTlight = FALSE;
|
|
|
|
|
UpdateData(FALSE);
|
|
|
|
|
|
|
|
|
|
GetDlgItem(IDC_BUTTON_LOADROUTE)->EnableWindow(TRUE);
|
|
|
|
|
|
|
|
|
|
BCGPMessageBox(_T("<EFBFBD>߳<EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>ȫ<EFBFBD><EFBFBD>"));
|
|
|
|
|
}
|
|
|
|
|
else if (-2 == int(lParam)) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
pSeries1->AddDataPoint(g_ptrArrayLight1[0],0.0);
|
|
|
|
|
pSeries2->AddDataPoint(g_ptrArrayLight2[0],0.0);
|
|
|
|
|
|
|
|
|
|
for (int i=1;i<=g_iTotalAnalyNum;i++)
|
|
|
|
|
{
|
|
|
|
|
pSeries1->AddDataPoint(g_ptrArrayLight1[i],i*30);
|
|
|
|
|
pSeries2->AddDataPoint(g_ptrArrayLight2[i],i*30);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><>Chart<72>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD><CBBB><EFBFBD>λ<EFBFBD>ã<EFBFBD><C3A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߶ȣ<DFB6>
|
|
|
|
|
pSeries3->AddDataPoint(g_dLightUavAlt,30*g_iTotalAnalyNum);
|
|
|
|
|
pSeries3->ShowMarker(TRUE, 30*g_iTotalAnalyNum);
|
|
|
|
|
pSeries3->SetMarkerSize(4, 30*g_iTotalAnalyNum);
|
|
|
|
|
|
|
|
|
|
pChart->RemoveAllChartObjects();
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD><CBBB>߶Ⱥ<DFB6><C8BA><EFBFBD>Сͨ<D0A1>Ӹ߶<D3B8>
|
|
|
|
|
m_pLine1 = pChart->AddChartLineObject(30*g_iTotalAnalyNum, g_dLightUavAlt, 30*g_iTotalAnalyNum, g_fUavLosAlt, CBCGPBrush(CBCGPColor::Tomato), 1.5, &m_strokeStyle);
|
|
|
|
|
|
|
|
|
|
CString str;
|
|
|
|
|
str.Format(_T("%.1fm"),g_dLightUavAlt - g_fUavLosAlt);
|
|
|
|
|
|
|
|
|
|
//<2F><>ʾ<EFBFBD><CABE><EFBFBD>˻<EFBFBD><CBBB>߶Ⱥ<DFB6><C8BA><EFBFBD>Сͨ<D0A1>Ӹ߶ȵIJ<C8B5>ֵ
|
|
|
|
|
m_pTextTip = nullptr;
|
|
|
|
|
m_pTextTip = new CBCGPChartTextObject(pChart, str, 30*g_iTotalAnalyNum, min(g_dLightUavAlt,g_fUavLosAlt) + abs(g_dLightUavAlt - g_fUavLosAlt)/2,
|
|
|
|
|
CBCGPBrush(CBCGPColor::White), CBCGPBrush(), CBCGPBrush(CBCGPColor::Tomato), 30, 90, TRUE);
|
|
|
|
|
pChart->AddChartObject(m_pTextTip);
|
|
|
|
|
|
|
|
|
|
pChart->SetAutoDisplayRange(TRUE, TRUE);
|
|
|
|
|
pChart->SetDirty(TRUE, TRUE);
|
|
|
|
|
m_wndChart.RedrawWindow();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (5 == (int)wParam) //ͨ<>ӵȸ<D3B5><C8B8>߷<EFBFBD><DFB7><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
if (int(lParam) >= 0)
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
|
|
|
|
CString str;
|
|
|
|
|
str.Format(_T("%d%%"),(int)((int(lParam)+1) * 100 / 360));
|
|
|
|
|
|
|
|
|
|
m_pContourTextIndicator->SetText(str);
|
|
|
|
|
m_ContourTextContainer.RedrawWindow();
|
|
|
|
|
}
|
|
|
|
|
else if (-1 == int(lParam)) //δ<><CEB4>ȡ<EFBFBD><C8A1><EFBFBD>߳<EFBFBD>ֵ
|
|
|
|
|
{
|
|
|
|
|
m_pContourTextIndicator->SetText(_T("<EFBFBD>߳<EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>ȫ<EFBFBD><EFBFBD>"));
|
|
|
|
|
m_ContourTextContainer.RedrawWindow();
|
|
|
|
|
|
|
|
|
|
GetDlgItem(IDC_BUTTON_CONTOURLINE)->EnableWindow(TRUE);
|
|
|
|
|
}
|
|
|
|
|
else if (-2 == int(lParam))
|
|
|
|
|
{
|
|
|
|
|
m_pContourTextIndicator->SetText(_T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>"));
|
|
|
|
|
m_ContourTextContainer.RedrawWindow();
|
|
|
|
|
|
|
|
|
|
GetDlgItem(IDC_BUTTON_CONTOURLINE)->EnableWindow(TRUE);
|
|
|
|
|
}
|
|
|
|
|
else if (-3 == int(lParam))
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ͨ<EFBFBD>ӵȸ<D3B5><C8B8>߷<EFBFBD><DFB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
OnBnClickedButtonContourDelete();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F>ڵ<EFBFBD>ͼ<EFBFBD>ϱ<EFBFBD><CFB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>վλ<D5BE><CEBB>
|
|
|
|
|
void CDlgLightRegion::OnBnClickedButtonDrawPoint()
|
|
|
|
|
{
|
|
|
|
|
UpdateData(TRUE);
|
|
|
|
|
|
|
|
|
|
::SendMessage(g_mapHwnd,WM_SHOW_POINTINMAP,0,0);
|
|
|
|
|
|
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>վ<EFBFBD>ĸ߳<C4B8><DFB3><EFBFBD>Ϣ
|
|
|
|
|
float ptAlt = 0.0f;
|
|
|
|
|
if(!m_mapElevation2.getElevation(ptAlt, m_dGroundLon, m_dGroundLat))
|
|
|
|
|
{
|
|
|
|
|
ptAlt = 0.0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CString str;
|
|
|
|
|
str.Format(_T("%.1f"),ptAlt);
|
|
|
|
|
GetDlgItem(IDC_EDIT_GROUND_ALT)->SetWindowText(str);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------------------------------------------
|
|
|
|
|
˵<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
-------------------------------------------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ť
|
|
|
|
|
void CDlgLightRegion::OnBnClickedButtonRegionAnaylsis()
|
|
|
|
|
{
|
|
|
|
|
UpdateData(TRUE);
|
|
|
|
|
|
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>վ<EFBFBD>߳<EFBFBD><DFB3><EFBFBD>Ϣ
|
|
|
|
|
if(!m_mapElevation2.getElevation(g_fGroundAltTemp, m_dGroundLon, m_dGroundLat))
|
|
|
|
|
{
|
|
|
|
|
//δ<><CEB4>ȡ<EFBFBD><C8A1><EFBFBD>߳<EFBFBD>ֵ
|
|
|
|
|
BCGPMessageBox(_T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>վ<EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>"));
|
|
|
|
|
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>վλ<D5BE>õĸ߶<C4B8><DFB6>ڵ<EFBFBD><DAB5><EFBFBD>վ<EFBFBD>̵߳Ļ<CCB5><C4BB><EFBFBD><EFBFBD>ϼ<EFBFBD><CFBC>Ϸ<EFBFBD><CFB7>ո߶<D5B8>
|
|
|
|
|
g_fGroundAltTemp += (float)m_dCabinHgt;
|
|
|
|
|
|
|
|
|
|
if (g_fGroundAltTemp > m_iFlightAlt)
|
|
|
|
|
{
|
|
|
|
|
BCGPMessageBox(_T("<EFBFBD><EFBFBD><EFBFBD>и߶<EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><EFBFBD><EFBFBD>վ<EFBFBD>߶ȣ<EFBFBD>"));
|
|
|
|
|
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>
|
|
|
|
|
::SendMessage(g_mapHwnd,WM_SEND_CLEARSHAPE,0,0);
|
|
|
|
|
|
|
|
|
|
GetDlgItem(IDC_BUTTON_REGIONANAYLSIS)->EnableWindow(FALSE);
|
|
|
|
|
|
|
|
|
|
g_dGroundLonTemp = m_dGroundLon;
|
|
|
|
|
g_dGroundLatTemp = m_dGroundLat;
|
|
|
|
|
g_iFlightAlt = m_iFlightAlt;
|
|
|
|
|
g_iRegionRadius = m_iRegionRadius;
|
|
|
|
|
g_iAnalysisStep = 0;
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>
|
|
|
|
|
hThreadRegion = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)ThreadFuncLightRegion, NULL, 0, &ThreadIDRegion);
|
|
|
|
|
|
|
|
|
|
m_bRunRegion = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
void CDlgLightRegion::OnBnClickedButtonRegionDelete()
|
|
|
|
|
{
|
|
|
|
|
//<2F>ر<EFBFBD><D8B1>߳<EFBFBD>
|
|
|
|
|
m_bRunRegion = false;
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>
|
|
|
|
|
::SendMessage(g_mapHwnd,WM_SEND_CLEARSHAPE,0,0);
|
|
|
|
|
|
|
|
|
|
GetDlgItem(IDC_BUTTON_REGIONANAYLSIS)->EnableWindow(TRUE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*------------------------------------------------------------------------------------------------------------
|
|
|
|
|
˵<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵʱͨ<EFBFBD>Ӽ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
-------------------------------------------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
//ѡ<><D1A1>ʵʱͨ<CAB1>Ӽ<EFBFBD><D3BC><EFBFBD>
|
|
|
|
|
void CDlgLightRegion::OnBnClickedCheckRealtime()
|
|
|
|
|
{
|
|
|
|
|
UpdateData(TRUE);
|
|
|
|
|
|
|
|
|
|
if (TRUE == m_bRealTime_Visi)
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ʵʱ<CAB5><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>
|
|
|
|
|
::SendMessage(g_mapHwnd,WM_SHOW_VISI_DELETE,0,0);
|
|
|
|
|
|
|
|
|
|
g_iRealTime_CurStep = -1;
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>
|
|
|
|
|
hThreadDetect = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)ThreadFuncRealTimeDetection, NULL, 0, &ThreadIDDetect);
|
|
|
|
|
|
|
|
|
|
m_bRunDetect = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//<2F>ر<EFBFBD><D8B1>߳<EFBFBD>
|
|
|
|
|
m_bRunDetect = false;
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ʵʱ<CAB5><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>
|
|
|
|
|
::SendMessage(g_mapHwnd,WM_SHOW_VISI_DELETE,0,0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><>ͼ<EFBFBD><CDBC>ʵʱ<CAB5><CAB1><EFBFBD>Ƽ<EFBFBD><C6BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
void CDlgLightRegion::DrawVisiAreaRealTime(double uavAlt, double distanceToGCS, double angleToGCS, double lonGCS, double latGCS)
|
|
|
|
|
{
|
|
|
|
|
//<2F><>δѡ<CEB4><D1A1>ʵʱͨ<CAB1>Ӽ<EFBFBD><D3BC><EFBFBD>
|
|
|
|
|
if (FALSE == m_bRealTime_Visi)
|
|
|
|
|
{
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><>ʵʱ<CAB5><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹ
|
|
|
|
|
if (-1 == g_iRealTime_CurStep)
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>վ-<2D>ɻ<EFBFBD><C9BB><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><D0A1>5km<6B><6D><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵʱ<CAB5><CAB1><EFBFBD><EFBFBD>
|
|
|
|
|
if (distanceToGCS < 5000.0)
|
|
|
|
|
{
|
|
|
|
|
m_bRealTime_Visi = FALSE;
|
|
|
|
|
UpdateData(FALSE);
|
|
|
|
|
|
|
|
|
|
//<2F>ر<EFBFBD><D8B1>߳<EFBFBD>
|
|
|
|
|
m_bRunDetect = false;
|
|
|
|
|
|
|
|
|
|
BCGPMessageBox(_T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>վ-<2D>ɻ<EFBFBD><C9BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̣<EFBFBD>"));
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ʵʱ<CAB5><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>
|
|
|
|
|
::SendMessage(g_mapHwnd,WM_SHOW_VISI_DELETE,0,0);
|
|
|
|
|
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>վ<EFBFBD>߳<EFBFBD><DFB3><EFBFBD>Ϣ
|
|
|
|
|
if(!m_mapElevation2.getElevation(g_fRealTime_GCSalt, lonGCS, latGCS))
|
|
|
|
|
{
|
|
|
|
|
m_bRealTime_Visi = FALSE;
|
|
|
|
|
UpdateData(FALSE);
|
|
|
|
|
|
|
|
|
|
//<2F>ر<EFBFBD><D8B1>߳<EFBFBD>
|
|
|
|
|
m_bRunDetect = false;
|
|
|
|
|
|
|
|
|
|
//δ<><CEB4>ȡ<EFBFBD><C8A1><EFBFBD>߳<EFBFBD>ֵ
|
|
|
|
|
BCGPMessageBox(_T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>վ<EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>"));
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ʵʱ<CAB5><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>
|
|
|
|
|
::SendMessage(g_mapHwnd,WM_SHOW_VISI_DELETE,0,0);
|
|
|
|
|
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>վλ<D5BE>õĸ߶<C4B8><DFB6>ڵ<EFBFBD><DAB5><EFBFBD>վ<EFBFBD>̵߳Ļ<CCB5><C4BB><EFBFBD><EFBFBD>ϼ<EFBFBD><CFBC>Ϸ<EFBFBD><CFB7>ո߶<D5B8>
|
|
|
|
|
g_fRealTime_GCSalt += (float)m_dCabinHgt;
|
|
|
|
|
|
|
|
|
|
double _tempAngle = (asin(3000.0/distanceToGCS) * 57.295779513082322864647721871733665466308593750000);
|
|
|
|
|
|
|
|
|
|
double _tempMinAngle = angleToGCS - _tempAngle;
|
|
|
|
|
|
|
|
|
|
if (_tempMinAngle < 0)
|
|
|
|
|
{
|
|
|
|
|
_tempMinAngle += 360.0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_dRealTime_GCSlon = lonGCS;
|
|
|
|
|
g_dRealTime_GCSlat = latGCS;
|
|
|
|
|
g_dRealTime_UavAlt = uavAlt;
|
|
|
|
|
g_dRealTime_AngToGCS = angleToGCS;
|
|
|
|
|
g_dRealTime_DisToGCS = distanceToGCS;
|
|
|
|
|
g_dRealTime_MinAngle = _tempMinAngle;
|
|
|
|
|
g_dRealTime_AngleDiff = _tempAngle/6.0;
|
|
|
|
|
|
|
|
|
|
//<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>ʵʱ<CAB5><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
g_iRealTime_CurStep = 0;
|
|
|
|
|
|
|
|
|
|
g_iPointNumInLayer = -1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*------------------------------------------------------------------------------------------------------------
|
|
|
|
|
˵<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵʱ<EFBFBD><EFBFBD>ײ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
-------------------------------------------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
//ѡ<><D1A1>ʵʱ<CAB5><CAB1>ײ<EFBFBD><D7B2><EFBFBD><EFBFBD>
|
|
|
|
|
void CDlgLightRegion::OnBnClickedCheckRtDetection()
|
|
|
|
|
{
|
|
|
|
|
UpdateData(TRUE);
|
|
|
|
|
|
|
|
|
|
if (TRUE == m_bRealTime_Crash)
|
|
|
|
|
{
|
|
|
|
|
g_bCrashDetection = false;
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>
|
|
|
|
|
hThreadCrash = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)ThreadFuncRealTimeCrash, NULL, 0, &ThreadIDCrash);
|
|
|
|
|
|
|
|
|
|
m_bRunCrash = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
g_bCrashDetection = false;
|
|
|
|
|
|
|
|
|
|
//<2F>ر<EFBFBD><D8B1>߳<EFBFBD>
|
|
|
|
|
m_bRunCrash = false;
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ײ<EFBFBD><D7B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ľ<EFBFBD><C4BD><EFBFBD>
|
|
|
|
|
::PostMessage(g_mapHwnd,WM_SHOW_CRASH_REALTIME,0,0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><>ͼ<EFBFBD><CDBC>ʵʱ<CAB5><CAB1><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD><CBBB>ܱ<DCB1><DFBC><EFBFBD><EFBFBD>߳<EFBFBD>
|
|
|
|
|
void CDlgLightRegion::DrawCrashAreaRealTime(double uavAlt, double uavLon, double uavLat)
|
|
|
|
|
{
|
|
|
|
|
//<2F><>δѡ<CEB4><D1A1>ʵʱ<CAB5><CAB1>ײ<EFBFBD><D7B2><EFBFBD><EFBFBD>
|
|
|
|
|
if (FALSE == m_bRealTime_Crash)
|
|
|
|
|
{
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (false == g_bCrashDetection)
|
|
|
|
|
{
|
|
|
|
|
g_dCrashUavLon = uavLon;
|
|
|
|
|
g_dCrashUavLat = uavLat;
|
|
|
|
|
g_fCrashUavAlt = (float)uavAlt;
|
|
|
|
|
|
|
|
|
|
g_bCrashDetection = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*------------------------------------------------------------------------------------------------------------
|
|
|
|
|
˵<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵʱ<EFBFBD><EFBFBD><EFBFBD>߷<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
-------------------------------------------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
//ѡ<><D1A1>ʵʱ<CAB5><CAB1><EFBFBD>߷<EFBFBD><DFB7><EFBFBD>
|
|
|
|
|
void CDlgLightRegion::OnBnClickedCheckRtLight()
|
|
|
|
|
{
|
|
|
|
|
UpdateData(TRUE);
|
|
|
|
|
|
|
|
|
|
if (TRUE == m_bRTlight)
|
|
|
|
|
{
|
|
|
|
|
GetDlgItem(IDC_BUTTON_LOADROUTE)->EnableWindow(FALSE);
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ͨ<EFBFBD>ӷ<EFBFBD><D3B7><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>pSeries3<73><33>ʵʱ<CAB5><CAB1><EFBFBD>߷<EFBFBD><DFB7><EFBFBD>ʱ<EFBFBD><CAB1>Ҫ<EFBFBD><D2AA>ʾ
|
|
|
|
|
pChart->ShowSeries(TRUE, 2);
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>3<EFBFBD><33><EFBFBD><EFBFBD>ΪNO_LINE
|
|
|
|
|
BCGPChartFormatSeries style = pSeries3->GetSeriesFormat();
|
|
|
|
|
style.m_curveType = BCGPChartFormatSeries::CCT_NO_LINE;
|
|
|
|
|
pSeries3->SetSeriesFormat(style);
|
|
|
|
|
|
|
|
|
|
pSeries3->ShowMarker(TRUE, 0);
|
|
|
|
|
pSeries3->SetMarkerSize(4, 0);
|
|
|
|
|
|
|
|
|
|
pSeries3->m_strSeriesName = _T("UAV Alt");
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>
|
|
|
|
|
hThreadLight = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)ThreadFuncAnalysisLOS, NULL, 0, &ThreadIDLight);
|
|
|
|
|
|
|
|
|
|
m_bRunRealTimeLOS = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
g_bHandlingLOS = false;
|
|
|
|
|
|
|
|
|
|
//<2F>ر<EFBFBD><D8B1>߳<EFBFBD>
|
|
|
|
|
m_bRunRealTimeLOS = false;
|
|
|
|
|
|
|
|
|
|
pSeries1->RemoveAllDataPoints();
|
|
|
|
|
pSeries2->RemoveAllDataPoints();
|
|
|
|
|
pSeries3->RemoveAllDataPoints();
|
|
|
|
|
pChart->RemoveAllChartObjects();
|
|
|
|
|
|
|
|
|
|
pChart->SetDirty(TRUE, TRUE);
|
|
|
|
|
m_wndChart.RedrawWindow();
|
|
|
|
|
|
|
|
|
|
GetDlgItem(IDC_BUTTON_LOADROUTE)->EnableWindow(TRUE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//ʵʱ<CAB5><CAB1><EFBFBD>߷<EFBFBD><DFB7><EFBFBD>,<2C><><EFBFBD><EFBFBD>վ-<2D>ɻ<EFBFBD><C9BB><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>
|
|
|
|
|
void CDlgLightRegion::AnalysisRealTime(double uavAlt, double distanceToGCS, double angleToGCS, double lonGCS, double latGCS)
|
|
|
|
|
{
|
|
|
|
|
//<2F><>δѡ<CEB4><D1A1>ʵʱ<CAB5><CAB1><EFBFBD>߷<EFBFBD><DFB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if (FALSE == m_bRTlight)
|
|
|
|
|
{
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (false == g_bHandlingLOS)
|
|
|
|
|
{
|
|
|
|
|
pSeries1->RemoveAllDataPoints();
|
|
|
|
|
pSeries2->RemoveAllDataPoints();
|
|
|
|
|
pSeries3->RemoveAllDataPoints();
|
|
|
|
|
|
|
|
|
|
g_dLightGCSlon = lonGCS; //<2F><><EFBFBD><EFBFBD>վ<EFBFBD><D5BE><EFBFBD><EFBFBD>
|
|
|
|
|
g_dLightGCSlat = latGCS; //<2F><><EFBFBD><EFBFBD>վγ<D5BE><CEB3>
|
|
|
|
|
g_dLightAngle = angleToGCS; //<2F><><EFBFBD><EFBFBD>վ-<2D>ɻ<EFBFBD><C9BB><EFBFBD>λ
|
|
|
|
|
g_dLightDis = distanceToGCS; //<2F><><EFBFBD><EFBFBD>վ-<2D>ɻ<EFBFBD><C9BB><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
g_dLightUavAlt = uavAlt; //<2F>ɻ<EFBFBD><C9BB>߶<EFBFBD>
|
|
|
|
|
|
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>վ<EFBFBD><D5BE><EFBFBD><EFBFBD>λ<EFBFBD>ø߳<C3B8>ֵ
|
|
|
|
|
if(!m_mapElevation2.getElevation(g_fLightGCSAlt, g_dLightGCSlon, g_dLightGCSlat))
|
|
|
|
|
{
|
|
|
|
|
//δ<><CEB4>ȡ<EFBFBD><C8A1><EFBFBD>߳<EFBFBD>ֵ<EFBFBD><D6B5>ȡ<EFBFBD><C8A1>ʵʱ<CAB5><CAB1><EFBFBD>߷<EFBFBD><DFB7><EFBFBD>
|
|
|
|
|
m_bRTlight = FALSE;
|
|
|
|
|
UpdateData(FALSE);
|
|
|
|
|
|
|
|
|
|
//<2F>ر<EFBFBD><D8B1>߳<EFBFBD>
|
|
|
|
|
m_bRunRealTimeLOS = false;
|
|
|
|
|
|
|
|
|
|
GetDlgItem(IDC_BUTTON_LOADROUTE)->EnableWindow(TRUE);
|
|
|
|
|
|
|
|
|
|
BCGPMessageBox(_T("<EFBFBD>߳<EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>ȫ<EFBFBD><EFBFBD>"));
|
|
|
|
|
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>վλ<D5BE>õĸ߶<C4B8><DFB6>ڵ<EFBFBD><DAB5><EFBFBD>վ<EFBFBD>̵߳Ļ<CCB5><C4BB><EFBFBD><EFBFBD>ϼ<EFBFBD><CFBC>Ϸ<EFBFBD><CFB7>յĸ߶<C4B8>
|
|
|
|
|
g_fLightGCSAlt += (float)m_dCabinHgt;
|
|
|
|
|
|
|
|
|
|
g_bHandlingLOS = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------------------------------------------
|
|
|
|
|
˵<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD>ӷ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
-------------------------------------------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD>غ<EFBFBD><D8BA><EFBFBD>
|
|
|
|
|
void CDlgLightRegion::OnBnClickedButtonLoadRoute()
|
|
|
|
|
{
|
|
|
|
|
UpdateData(TRUE);
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC>Ի<EFBFBD><D4BB><EFBFBD>
|
|
|
|
|
CFileDialog dlg(true, NULL, NULL,OFN_HIDEREADONLY, _T("(*.txt)|*.txt||"), NULL);
|
|
|
|
|
|
|
|
|
|
if (dlg.DoModal() == IDOK)
|
|
|
|
|
{
|
|
|
|
|
CString strFile = dlg.GetPathName();
|
|
|
|
|
|
|
|
|
|
int ptNum = 0;
|
|
|
|
|
|
|
|
|
|
//<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>ߵĺ<DFB5><C4BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
memset(pts, 0, sizeof(PtStruct)*257);
|
|
|
|
|
|
|
|
|
|
FILE *fpReadFlyLine;
|
|
|
|
|
int err;
|
|
|
|
|
err = fopen_s(&fpReadFlyLine,strFile.GetBuffer(), "r");
|
|
|
|
|
strFile.ReleaseBuffer();
|
|
|
|
|
|
|
|
|
|
if (fpReadFlyLine != NULL)
|
|
|
|
|
{
|
|
|
|
|
while (!feof(fpReadFlyLine))
|
|
|
|
|
{
|
|
|
|
|
//<2F><>·<EFBFBD>ļ<EFBFBD><C4BC>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD>ı<EFBFBD>ʶ
|
|
|
|
|
int redFlag = fscanf_s(fpReadFlyLine, "%d, %d, %lf, %lf, %d, %d, %02X, %02X\n", &pts[ptNum].lineID,&pts[ptNum].ptID,
|
|
|
|
|
&pts[ptNum].lon, &pts[ptNum].lat, &pts[ptNum].alt, &pts[ptNum].speed, &pts[ptNum].taskCharacter, &pts[ptNum].lineCharacter);
|
|
|
|
|
|
|
|
|
|
if (redFlag != 8) //<2F><>·<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>ԣ<EFBFBD><D4A3><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
//<2F>ر<EFBFBD><D8B1>ļ<EFBFBD>
|
|
|
|
|
fclose(fpReadFlyLine);
|
|
|
|
|
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (0 != pts[ptNum].ptID)
|
|
|
|
|
{
|
|
|
|
|
ptNum ++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F>ر<EFBFBD><D8B1>ļ<EFBFBD>
|
|
|
|
|
fclose(fpReadFlyLine);
|
|
|
|
|
|
|
|
|
|
//<2F><>·<EFBFBD><C2B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7>ΧΪ[0,255]<5D><>256<35><36>
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7>ΧΪ<CEA7><CEAA>2,256<35><36>
|
|
|
|
|
if ((ptNum>257) || (ptNum<2))
|
|
|
|
|
{
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F>Ե<EFBFBD><D4B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݽ<EFBFBD><DDBD>м<EFBFBD><D0BC><EFBFBD>
|
|
|
|
|
for (int i=0; i<ptNum; i++)
|
|
|
|
|
{
|
|
|
|
|
if ( (pts[i].ptID<0) || (pts[i].ptID>255)
|
|
|
|
|
|| (pts[i].lon<-180) || (pts[i].lon>180)
|
|
|
|
|
|| (pts[i].lat<-90) || (pts[i].lat>90)
|
|
|
|
|
|| (pts[i].alt<-500) || (pts[i].alt>10000)
|
|
|
|
|
|| (pts[i].speed<0) || (pts[i].speed>100)
|
|
|
|
|
|| (pts[i].taskCharacter<0) || (pts[i].taskCharacter>255)
|
|
|
|
|
|| (pts[i].lineCharacter<0) || (pts[i].lineCharacter>255) )
|
|
|
|
|
{
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F>Ժ<EFBFBD><D4BA><EFBFBD><EFBFBD>ĺ<EFBFBD><C4BA>߱<EFBFBD><DFB1>Ž<EFBFBD><C5BD><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ں<EFBFBD><DABA>߱<EFBFBD><DFB1>Ų<EFBFBD>һ<EFBFBD><D2BB>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>false
|
|
|
|
|
int ptLineID = pts[0].lineID;
|
|
|
|
|
for (int i=1; i<ptNum; i++)
|
|
|
|
|
{
|
|
|
|
|
if (ptLineID != pts[i].lineID)
|
|
|
|
|
{
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F>Ժ<EFBFBD><D4BA>ߵĺ<DFB5><C4BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ž<EFBFBD><C5BD><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD>飬<EFBFBD>жϹ<D0B6><CFB9><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ1<CEAA><31><EFBFBD><EFBFBD><EFBFBD>ε<EFBFBD><CEB5><EFBFBD>1
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ں<EFBFBD><DABA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD><EFBFBD>Ϲ<EFBFBD><CFB9><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if (pts[0].ptID != 1)
|
|
|
|
|
{
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
int toComparePtId = pts[0].ptID + 1;
|
|
|
|
|
for (int i=1; i<ptNum; i++)
|
|
|
|
|
{
|
|
|
|
|
if (pts[i].ptID != toComparePtId)
|
|
|
|
|
{
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
toComparePtId++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
|
|
|
|
|
//::SendMessage(g_mapHwnd, WM_SHOW_LINE, pts[0].lineID, 0);
|
|
|
|
|
|
|
|
|
|
pts[ptNum] = pts[0];
|
|
|
|
|
g_iWayPointNum = ptNum + 1;
|
|
|
|
|
g_totalLinePtNum = 0;
|
|
|
|
|
|
|
|
|
|
pSeries1->RemoveAllDataPoints();
|
|
|
|
|
pSeries2->RemoveAllDataPoints();
|
|
|
|
|
pSeries3->RemoveAllDataPoints();
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ͨ<EFBFBD>ӷ<EFBFBD><D3B7><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>pSeries3<73><33><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD>ӷ<EFBFBD><D3B7><EFBFBD>ʱ<EFBFBD><CAB1>Ҫ<EFBFBD><D2AA>ʾ
|
|
|
|
|
pChart->ShowSeries(TRUE, 2);
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>3<EFBFBD><33><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>
|
|
|
|
|
BCGPChartFormatSeries style = pSeries3->GetSeriesFormat();
|
|
|
|
|
style.m_curveType = BCGPChartFormatSeries::CCT_LINE;
|
|
|
|
|
pSeries3->SetSeriesFormat(style);
|
|
|
|
|
|
|
|
|
|
pSeries3->m_strSeriesName = _T("Pt Alt");
|
|
|
|
|
|
|
|
|
|
pSeries3->ShowMarker(FALSE);
|
|
|
|
|
|
|
|
|
|
m_pLineTextIndicator->SetText(_T("<EFBFBD><EFBFBD><EFBFBD>ڷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
|
|
|
|
m_LineTextContainer.RedrawWindow();
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD>㺽<EFBFBD>߷<EFBFBD><DFB7><EFBFBD>ʱ<EFBFBD>ܹ<EFBFBD><DCB9><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD>
|
|
|
|
|
g_iTotalInterNum = 0;
|
|
|
|
|
for (int i=0;i<ptNum;i++)
|
|
|
|
|
{
|
|
|
|
|
double _dis;
|
|
|
|
|
if (i != (ptNum-1))
|
|
|
|
|
{
|
|
|
|
|
CalculateTwoPtsDistance(_dis, pts[i].lon, pts[i].lat, pts[i+1].lon, pts[i+1].lat, 3);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
CalculateTwoPtsDistance(_dis, pts[i].lon, pts[i].lat, pts[0].lon, pts[0].lat, 3);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_iTotalInterNum += (int)(_dis/100) + 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (g_ptrArraySeries1 != nullptr)
|
|
|
|
|
{
|
|
|
|
|
delete[] g_ptrArraySeries1;
|
|
|
|
|
g_ptrArraySeries1 = nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_ptrArraySeries1 = new double[g_iTotalInterNum];
|
|
|
|
|
memset(g_ptrArraySeries1,0,sizeof(double) * g_iTotalInterNum);
|
|
|
|
|
|
|
|
|
|
if (g_ptrArraySeries2 != nullptr)
|
|
|
|
|
{
|
|
|
|
|
delete[] g_ptrArraySeries2;
|
|
|
|
|
g_ptrArraySeries2 = nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_ptrArraySeries2 = new double[g_iTotalInterNum];
|
|
|
|
|
memset(g_ptrArraySeries2,0,sizeof(double) * g_iTotalInterNum);
|
|
|
|
|
|
|
|
|
|
if (g_ptrArraySeries3 != nullptr)
|
|
|
|
|
{
|
|
|
|
|
delete[] g_ptrArraySeries3;
|
|
|
|
|
g_ptrArraySeries3 = nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_ptrArraySeries3 = new int[g_iWayPointNum];
|
|
|
|
|
memset(g_ptrArraySeries3,0,sizeof(int) * g_iWayPointNum);
|
|
|
|
|
|
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>վλ<D5BE><CEBB>
|
|
|
|
|
g_dRoute_GCSlon = m_dGroundLon; //<2F><><EFBFBD><EFBFBD>վ<EFBFBD><D5BE><EFBFBD><EFBFBD>
|
|
|
|
|
g_dRoute_GCSlat = m_dGroundLat; //<2F><><EFBFBD><EFBFBD>վγ<D5BE><CEB3>
|
|
|
|
|
|
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1>ֵ<EFBFBD><D6B5><EFBFBD>ĸ߳<C4B8>
|
|
|
|
|
if(!m_mapElevation2.getElevation(g_fRoute_GCSalt, g_dRoute_GCSlon, g_dRoute_GCSlat))
|
|
|
|
|
{
|
|
|
|
|
//δ<><CEB4>ȡ<EFBFBD><C8A1><EFBFBD>߳<EFBFBD>ֵ
|
|
|
|
|
BCGPMessageBox(_T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>վ<EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>"));
|
|
|
|
|
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>վλ<D5BE>õĸ߶<C4B8><DFB6>ڵ<EFBFBD><DAB5><EFBFBD>վ<EFBFBD>̵߳Ļ<CCB5><C4BB><EFBFBD><EFBFBD>ϼ<EFBFBD><CFBC>Ϸ<EFBFBD><CFB7>ո߶<D5B8>
|
|
|
|
|
g_fRoute_GCSalt += (float)m_dCabinHgt;
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>
|
|
|
|
|
hThreadRoute = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)ThreadFuncAnalysisRoute, NULL, 0, &ThreadIDRoute);
|
|
|
|
|
|
|
|
|
|
m_bRunRoute = true;
|
|
|
|
|
}
|
|
|
|
|
else //<2F><><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ0
|
|
|
|
|
{
|
|
|
|
|
BCGPMessageBox(_T( "<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>" ));
|
|
|
|
|
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//ֹͣ<CDA3><D6B9><EFBFBD>߷<EFBFBD><DFB7><EFBFBD>
|
|
|
|
|
void CDlgLightRegion::OnBnClickedButtonStopRoute()
|
|
|
|
|
{
|
|
|
|
|
//<2F>ر<EFBFBD><D8B1>߳<EFBFBD>
|
|
|
|
|
m_bRunRoute = false;
|
|
|
|
|
|
|
|
|
|
g_iInterNumSec = 0;
|
|
|
|
|
g_iWayPointNum = 0;
|
|
|
|
|
g_iCurWaypoint = 0;
|
|
|
|
|
g_iTotalInterNum = 0;
|
|
|
|
|
g_totalLinePtNum = 0;
|
|
|
|
|
|
|
|
|
|
m_pLineTextIndicator->SetText(_T(""));
|
|
|
|
|
m_LineTextContainer.RedrawWindow();
|
|
|
|
|
|
|
|
|
|
pSeries1->RemoveAllDataPoints();
|
|
|
|
|
pSeries2->RemoveAllDataPoints();
|
|
|
|
|
pSeries3->RemoveAllDataPoints();
|
|
|
|
|
|
|
|
|
|
pChart->SetDirty(TRUE, TRUE);
|
|
|
|
|
m_wndChart.RedrawWindow();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD>溽<EFBFBD><E6BABD>ͨ<EFBFBD>ӷ<EFBFBD><D3B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
void CDlgLightRegion::OnBnClickedButtonSaveImage()
|
|
|
|
|
{
|
|
|
|
|
CFileDialog dlg (FALSE, _T("bmp"), _T(""), OFN_HIDEREADONLY,
|
|
|
|
|
_T("Bitmap Files (*.bmp)|*.bmp|Png Files (*.png)|*.png|All Files (*.*)|*.*||"), this);
|
|
|
|
|
if (dlg.DoModal () == IDOK)
|
|
|
|
|
{
|
|
|
|
|
m_wndChart.ExportToFile(dlg.GetPathName ());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD>ӷ<EFBFBD><D3B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
void CDlgLightRegion::OnBnClickedButtonClearResult()
|
|
|
|
|
{
|
|
|
|
|
//<2F>ر<EFBFBD><D8B1>߳<EFBFBD>
|
|
|
|
|
m_bRunRoute = false;
|
|
|
|
|
|
|
|
|
|
g_iInterNumSec = 0;
|
|
|
|
|
g_iWayPointNum = 0;
|
|
|
|
|
g_iCurWaypoint = 0;
|
|
|
|
|
g_iTotalInterNum = 0;
|
|
|
|
|
g_totalLinePtNum = 0;
|
|
|
|
|
|
|
|
|
|
m_pLineTextIndicator->SetText(_T(""));
|
|
|
|
|
m_LineTextContainer.RedrawWindow();
|
|
|
|
|
|
|
|
|
|
pSeries1->RemoveAllDataPoints();
|
|
|
|
|
pSeries2->RemoveAllDataPoints();
|
|
|
|
|
pSeries3->RemoveAllDataPoints();
|
|
|
|
|
|
|
|
|
|
pChart->SetDirty(TRUE, TRUE);
|
|
|
|
|
m_wndChart.RedrawWindow();
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵĵ<CFB5><C4B5>ı<EFBFBD><C4B1><EFBFBD>ͼ<EFBFBD><CDBC>
|
|
|
|
|
::SendMessage(g_mapHwnd, WM_DRAW_LINEPOINT, 0, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LRESULT CDlgLightRegion::OnMouseDown(WPARAM /*wp*/, LPARAM lp)
|
|
|
|
|
{
|
|
|
|
|
BCGPChartHitInfo* pHitInfo = (BCGPChartHitInfo*)lp;
|
|
|
|
|
|
|
|
|
|
switch (pHitInfo->m_hitInfo)
|
|
|
|
|
{
|
|
|
|
|
case BCGPChartHitInfo::HIT_DIAGRAM:
|
|
|
|
|
CBCGPPoint pt = pHitInfo->m_ptHit;
|
|
|
|
|
|
|
|
|
|
double dblX = pXAxis->ValueFromPoint(pt);
|
|
|
|
|
double dblY = pYAxis->ValueFromPoint(pt);
|
|
|
|
|
|
|
|
|
|
if (g_ptrArraySeries3 != nullptr && g_iWayPointNum > 2)
|
|
|
|
|
{
|
|
|
|
|
for (int i=0;i<(g_iWayPointNum-1);i++)
|
|
|
|
|
{
|
|
|
|
|
if ((dblX >= g_ptrArraySeries3[i]) && (dblX < g_ptrArraySeries3[i+1]))
|
|
|
|
|
{
|
|
|
|
|
double azAngle = 0;
|
|
|
|
|
CalculateTwoPtsAzimuth(azAngle,pts[i].lon, pts[i].lat,pts[i+1].lon,pts[i+1].lat,3);
|
|
|
|
|
|
|
|
|
|
structPoint _structPoint;
|
|
|
|
|
CalculatePtCoordinate(_structPoint.lon, _structPoint.lat, pts[i].lon, pts[i].lat, azAngle, (dblX-g_ptrArraySeries3[i]) * 100, 3);
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD>͵<EFBFBD><CDB5><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵĵ<CFB5><C4B5>ڵ<EFBFBD>ͼ<EFBFBD>϶<EFBFBD>Ӧ<EFBFBD>ĵ<EFBFBD>
|
|
|
|
|
::SendMessage(g_mapHwnd, WM_DRAW_LINEPOINT, (WPARAM)&_structPoint, 1);
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------------------------------------------
|
|
|
|
|
˵<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD>ӵȸ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
-------------------------------------------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
//ͨ<>ӵȸ<D3B5><C8B8>߷<EFBFBD><DFB7><EFBFBD>
|
|
|
|
|
void CDlgLightRegion::OnBnClickedButtonContourline()
|
|
|
|
|
{
|
|
|
|
|
UpdateData(TRUE);
|
|
|
|
|
|
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>վ<EFBFBD>߳<EFBFBD><DFB3><EFBFBD>Ϣ
|
|
|
|
|
if(!m_mapElevation2.getElevation(m_fGroudAlt, m_dGroundLon, m_dGroundLat))
|
|
|
|
|
{
|
|
|
|
|
//δ<><CEB4>ȡ<EFBFBD><C8A1><EFBFBD>߳<EFBFBD>ֵ
|
|
|
|
|
BCGPMessageBox(_T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>վ<EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>"));
|
|
|
|
|
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>վλ<D5BE>õĸ߶<C4B8><DFB6>ڵ<EFBFBD><DAB5><EFBFBD>վ<EFBFBD>̵߳Ļ<CCB5><C4BB><EFBFBD><EFBFBD>ϼ<EFBFBD><CFBC>Ϸ<EFBFBD><CFB7>ո߶<D5B8>
|
|
|
|
|
m_fGroudAlt += (float)m_dCabinHgt;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_dGroundLonCountour = m_dGroundLon;
|
|
|
|
|
g_dGroundLatCountour = m_dGroundLat;
|
|
|
|
|
g_fGroundAltCountour = m_fGroudAlt;
|
|
|
|
|
|
|
|
|
|
if (m_iMaxLosAlt < m_fGroudAlt)
|
|
|
|
|
{
|
|
|
|
|
BCGPMessageBox(_T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߶Ȳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD>ڵ<EFBFBD><EFBFBD><EFBFBD>վ<EFBFBD>߶ȣ<EFBFBD>"));
|
|
|
|
|
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (m_iMaxLosAlt > 10000)
|
|
|
|
|
{
|
|
|
|
|
BCGPMessageBox(_T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߶Ȳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>10000<EFBFBD><EFBFBD>"));
|
|
|
|
|
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_iMaxLosAlt = m_iMaxLosAlt;
|
|
|
|
|
|
|
|
|
|
GetDlgItem(IDC_BUTTON_CONTOURLINE)->EnableWindow(FALSE);
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ͨ<EFBFBD>ӵȸ<D3B5><C8B8><EFBFBD><DFBB><EFBFBD>ͼ<EFBFBD><CDBC>
|
|
|
|
|
::SendMessage(g_mapHwnd,WM_DEL_LINELAYER,0,0);
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>
|
|
|
|
|
hThreadContour = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)ThreadFuncAnalysisContour, NULL, 0, &ThreadIDContour);
|
|
|
|
|
|
|
|
|
|
m_bRunContour = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ͨ<EFBFBD>ӵȸ<D3B5><C8B8><EFBFBD>
|
|
|
|
|
void CDlgLightRegion::OnBnClickedButtonContourDelete()
|
|
|
|
|
{
|
|
|
|
|
//<2F>ر<EFBFBD><D8B1>߳<EFBFBD>
|
|
|
|
|
m_bRunContour = false;
|
|
|
|
|
|
|
|
|
|
::SendMessage(g_mapHwnd,WM_DEL_LINELAYER,0,0);
|
|
|
|
|
|
|
|
|
|
GetDlgItem(IDC_BUTTON_CONTOURLINE)->EnableWindow(TRUE);
|
|
|
|
|
|
|
|
|
|
m_pContourTextIndicator->SetText(_T(""));
|
|
|
|
|
m_ContourTextContainer.RedrawWindow();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------------------------------------------
|
|
|
|
|
˵<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD>ӷ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
-------------------------------------------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ľ<EFBFBD>γ<EFBFBD>Ȼ<EFBFBD>ȡ<EFBFBD>̼߳<DFB3>ͨ<EFBFBD>Ӹ߶<D3B8>
|
|
|
|
|
void CDlgLightRegion::OnBnClickedButtonGetAltValue()
|
|
|
|
|
{
|
|
|
|
|
CString str;
|
|
|
|
|
double _ptLon = 0.0, _ptLat = 0.0;
|
|
|
|
|
|
|
|
|
|
//<2F><>ȡĿ<C8A1><C4BF><EFBFBD><EFBFBD><EFBFBD>ľ<EFBFBD><C4BE>Ⱥ<EFBFBD>γ<EFBFBD><CEB3>
|
|
|
|
|
GetDlgItem(IDC_EDIT_POINT_LON)->GetWindowText(str);
|
|
|
|
|
_ptLon = atof(str);
|
|
|
|
|
|
|
|
|
|
GetDlgItem(IDC_EDIT_POINT_LAT)->GetWindowText(str);
|
|
|
|
|
_ptLat = atof(str);
|
|
|
|
|
|
|
|
|
|
if ((_ptLon == 0) || (_ptLat == 0) || (_ptLon > 180) || (_ptLon < -180) || (_ptLat > 90) || (_ptLat < -90))
|
|
|
|
|
{
|
|
|
|
|
BCGPMessageBox(_T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><EFBFBD>"));
|
|
|
|
|
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><>ȡ<EFBFBD>߳<EFBFBD>
|
|
|
|
|
float ptAlt = 0.0f;
|
|
|
|
|
if(!m_mapElevation2.getElevation(ptAlt, _ptLon, _ptLat))
|
|
|
|
|
{
|
|
|
|
|
ptAlt = 0.0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
str.Format(_T("%.1f"),ptAlt);
|
|
|
|
|
GetDlgItem(IDC_EDIT_POINT_ALT)->SetWindowText(str);
|
|
|
|
|
|
|
|
|
|
structPoint _tempPoint;
|
|
|
|
|
_tempPoint.lon = _ptLon;
|
|
|
|
|
_tempPoint.lat = _ptLat;
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD>͵<EFBFBD><CDB5><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD>
|
|
|
|
|
::SendMessage(g_mapHwnd,WM_SEND_REGIONTOGIS,(WPARAM)3,(LPARAM)&_tempPoint);
|
|
|
|
|
|
|
|
|
|
//ͨ<>ӷ<EFBFBD><D3B7><EFBFBD>
|
|
|
|
|
LosBetweenTwoPoints();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F>ڵ<EFBFBD>ͼ<EFBFBD><CDBC>ѡ<EFBFBD>㣬<EFBFBD><E3A3AC>ȡ<EFBFBD>̲߳<DFB3><CCB2><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD>ӷ<EFBFBD><D3B7><EFBFBD>
|
|
|
|
|
void CDlgLightRegion::OnBnClickedButtonSelectPtInMap()
|
|
|
|
|
{
|
|
|
|
|
::SendMessage(g_mapHwnd,WM_SEND_REGIONTOGIS,(WPARAM)1,0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F>ڶԻ<DAB6><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾѡ<CABE><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߳<CDB8>
|
|
|
|
|
void CDlgLightRegion::ShowPointPosition(double ptLon, double ptLat)
|
|
|
|
|
{
|
|
|
|
|
CString str;
|
|
|
|
|
|
|
|
|
|
str.Format(_T("%.7f"),ptLon);
|
|
|
|
|
GetDlgItem(IDC_EDIT_POINT_LON)->SetWindowText(str);
|
|
|
|
|
|
|
|
|
|
str.Format(_T("%.7f"),ptLat);
|
|
|
|
|
GetDlgItem(IDC_EDIT_POINT_LAT)->SetWindowText(str);
|
|
|
|
|
|
|
|
|
|
//<2F><>ȡ<EFBFBD>߳<EFBFBD>
|
|
|
|
|
float ptAlt = 0.0f;
|
|
|
|
|
if(!m_mapElevation2.getElevation(ptAlt, ptLon, ptLat))
|
|
|
|
|
{
|
|
|
|
|
ptAlt = 0.0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
str.Format(_T("%.1f"),ptAlt);
|
|
|
|
|
GetDlgItem(IDC_EDIT_POINT_ALT)->SetWindowText(str);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD>ӷ<EFBFBD><D3B7><EFBFBD>
|
|
|
|
|
void CDlgLightRegion::LosBetweenTwoPoints()
|
|
|
|
|
{
|
|
|
|
|
UpdateData(TRUE);
|
|
|
|
|
|
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>վ<EFBFBD>ĸ߳<C4B8>
|
|
|
|
|
float _fGroundAlt = 0.0f;
|
|
|
|
|
if(!m_mapElevation2.getElevation(_fGroundAlt, m_dGroundLon, m_dGroundLat))
|
|
|
|
|
{
|
|
|
|
|
//δ<><CEB4>ȡ<EFBFBD><C8A1><EFBFBD>߳<EFBFBD>ֵ
|
|
|
|
|
BCGPMessageBox(_T("<EFBFBD>߳<EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>ȫ<EFBFBD><EFBFBD>"));
|
|
|
|
|
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>վλ<D5BE>õĸ߶<C4B8><DFB6>ڵ<EFBFBD><DAB5><EFBFBD>վ<EFBFBD>̵߳Ļ<CCB5><C4BB><EFBFBD><EFBFBD>ϼ<EFBFBD><CFBC>Ϸ<EFBFBD><CFB7>ո߶<D5B8>
|
|
|
|
|
_fGroundAlt += (float)m_dCabinHgt;
|
|
|
|
|
|
|
|
|
|
pChart->ShowSeries(FALSE,2);
|
|
|
|
|
pSeries1->RemoveAllDataPoints();
|
|
|
|
|
pSeries2->RemoveAllDataPoints();
|
|
|
|
|
|
|
|
|
|
CString str;
|
|
|
|
|
double _ptLon = 0.0, _ptLat = 0.0;
|
|
|
|
|
|
|
|
|
|
//<2F><>ȡĿ<C8A1><C4BF><EFBFBD><EFBFBD><EFBFBD>ľ<EFBFBD><C4BE>Ⱥ<EFBFBD>γ<EFBFBD><CEB3>
|
|
|
|
|
GetDlgItem(IDC_EDIT_POINT_LON)->GetWindowText(str);
|
|
|
|
|
_ptLon = atof(str);
|
|
|
|
|
|
|
|
|
|
GetDlgItem(IDC_EDIT_POINT_LAT)->GetWindowText(str);
|
|
|
|
|
_ptLat = atof(str);
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>վ<EFBFBD><D5BE>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD>ľ<EFBFBD><C4BE><EFBFBD><EFBFBD>ͷ<EFBFBD>λ
|
|
|
|
|
double dis = 0.0,angle = 0.0;
|
|
|
|
|
CalculateTwoPtsDistanceAzimuth(dis, angle, m_dGroundLon, m_dGroundLat, _ptLon, _ptLat, 3);
|
|
|
|
|
|
|
|
|
|
double _dTanMaxSlope = -1000.0; //<2F><><EFBFBD><EFBFBD>б<EFBFBD><D0B1>
|
|
|
|
|
double _fMinLOSAlt = 0.0; //<2F><>Сͨ<D0A1>Ӹ߶<D3B8>
|
|
|
|
|
double _tempSlope = 0.0; //<2F><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>վ<EFBFBD><D5BE><EFBFBD><EFBFBD><EFBFBD>ߵ<EFBFBD>б<EFBFBD><D0B1>
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
|
|
|
|
double interPolLon = 0.0, interPolLat = 0.0;
|
|
|
|
|
float interPolHight = 0.0;
|
|
|
|
|
|
|
|
|
|
//<2F><>30Ϊ<30><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>࣬<EFBFBD><E0A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>
|
|
|
|
|
int interPolDis = 30;
|
|
|
|
|
int interPolNum = (int)(dis/interPolDis);
|
|
|
|
|
|
|
|
|
|
for(int i = 0; i <= interPolNum; i++)
|
|
|
|
|
{
|
|
|
|
|
CalculatePtCoordinate(interPolLon, interPolLat, m_dGroundLon, m_dGroundLat, angle, i*interPolDis, 3);
|
|
|
|
|
|
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĸ߳<C4B8>
|
|
|
|
|
if(!m_mapElevation2.getElevation(interPolHight, interPolLon, interPolLat))
|
|
|
|
|
{
|
|
|
|
|
//δ<><CEB4>ȡ<EFBFBD><C8A1><EFBFBD>߳<EFBFBD>ֵ
|
|
|
|
|
BCGPMessageBox(_T("<EFBFBD>߳<EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>ȫ<EFBFBD><EFBFBD>"));
|
|
|
|
|
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>վ<EFBFBD><D5BE><EFBFBD>ߵ<EFBFBD>б<EFBFBD><D0B1>
|
|
|
|
|
_tempSlope = CalSlopeBetweenTwoPoint(m_dGroundLon, m_dGroundLat, _fGroundAlt, interPolLon, interPolLat, interPolHight);
|
|
|
|
|
|
|
|
|
|
//<2F><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>ʱȽϣ<C8BD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ֵ
|
|
|
|
|
_dTanMaxSlope = max(_tempSlope,_dTanMaxSlope);
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD>Сͨ<D0A1>Ӹ߶<D3B8>
|
|
|
|
|
_fMinLOSAlt = (float)CalAltFromSlope(m_dGroundLon, m_dGroundLat, _fGroundAlt, interPolLon, interPolLat, _dTanMaxSlope);
|
|
|
|
|
|
|
|
|
|
pSeries1->AddDataPoint(interPolHight,i*interPolDis);
|
|
|
|
|
pSeries2->AddDataPoint(_fMinLOSAlt,i*interPolDis);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pChart->SetAutoDisplayRange(TRUE, TRUE);
|
|
|
|
|
pChart->SetDirty(TRUE, TRUE);
|
|
|
|
|
m_wndChart.RedrawWindow();
|
|
|
|
|
|
|
|
|
|
//<2F><>ʾ<EFBFBD><CABE>Сͨ<D0A1>Ӹ߶<D3B8>
|
|
|
|
|
str.Format(_T("%.1f"),_fMinLOSAlt);
|
|
|
|
|
GetDlgItem(IDC_EDIT_POINT_LOS)->SetWindowText(str);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>վ<EFBFBD><D5BE>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ߣ<EFBFBD><DFA3>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
void CDlgLightRegion::OnBnClickedButtonClearLineLayer()
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>
|
|
|
|
|
::SendMessage(g_mapHwnd,WM_SEND_REGIONTOGIS,(WPARAM)2,0);
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>
|
|
|
|
|
pSeries1->RemoveAllDataPoints();
|
|
|
|
|
pSeries2->RemoveAllDataPoints();
|
|
|
|
|
pSeries3->RemoveAllDataPoints();
|
|
|
|
|
m_wndChart.RedrawWindow();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ͨ<EFBFBD>ӷ<EFBFBD><D3B7><EFBFBD>
|
|
|
|
|
void CDlgLightRegion::OnBnClickedButtonReverse()
|
|
|
|
|
{
|
|
|
|
|
UpdateData(TRUE);
|
|
|
|
|
|
|
|
|
|
CString str;
|
|
|
|
|
double _ptLon = 0.0, _ptLat = 0.0;
|
|
|
|
|
|
|
|
|
|
//<2F><>ȡĿ<C8A1><C4BF><EFBFBD><EFBFBD><EFBFBD>ľ<EFBFBD><C4BE>Ⱥ<EFBFBD>γ<EFBFBD><CEB3>
|
|
|
|
|
GetDlgItem(IDC_EDIT_POINT_LON)->GetWindowText(str);
|
|
|
|
|
_ptLon = atof(str);
|
|
|
|
|
|
|
|
|
|
GetDlgItem(IDC_EDIT_POINT_LAT)->GetWindowText(str);
|
|
|
|
|
_ptLat = atof(str);
|
|
|
|
|
|
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>վ<EFBFBD>ĸ߳<C4B8>
|
|
|
|
|
float _fGroundAlt = 0.0f;
|
|
|
|
|
if(!m_mapElevation2.getElevation(_fGroundAlt, _ptLon, _ptLat))
|
|
|
|
|
{
|
|
|
|
|
//δ<><CEB4>ȡ<EFBFBD><C8A1><EFBFBD>߳<EFBFBD>ֵ
|
|
|
|
|
BCGPMessageBox(_T("<EFBFBD>߳<EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>ȫ<EFBFBD><EFBFBD>"));
|
|
|
|
|
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>վλ<D5BE>õĸ߶<C4B8><DFB6>ڵ<EFBFBD><DAB5><EFBFBD>վ<EFBFBD>̵߳Ļ<CCB5><C4BB><EFBFBD><EFBFBD>ϼ<EFBFBD><CFBC>Ϸ<EFBFBD><CFB7>ո߶<D5B8>
|
|
|
|
|
_fGroundAlt += (float)m_dCabinHgt;
|
|
|
|
|
|
|
|
|
|
pChart->ShowSeries(FALSE,2);
|
|
|
|
|
pSeries1->RemoveAllDataPoints();
|
|
|
|
|
pSeries2->RemoveAllDataPoints();
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>վ<EFBFBD><D5BE>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD>ľ<EFBFBD><C4BE><EFBFBD><EFBFBD>ͷ<EFBFBD>λ
|
|
|
|
|
double dis = 0.0,angle = 0.0;
|
|
|
|
|
CalculateTwoPtsDistanceAzimuth(dis, angle, _ptLon, _ptLat, m_dGroundLon, m_dGroundLat, 3);
|
|
|
|
|
|
|
|
|
|
double _dTanMaxSlope = -1000.0; //<2F><><EFBFBD><EFBFBD>б<EFBFBD><D0B1>
|
|
|
|
|
double _fMinLOSAlt = 0.0; //<2F><>Сͨ<D0A1>Ӹ߶<D3B8>
|
|
|
|
|
double _tempSlope = 0.0; //<2F><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>վ<EFBFBD><D5BE><EFBFBD><EFBFBD><EFBFBD>ߵ<EFBFBD>б<EFBFBD><D0B1>
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
|
|
|
|
double interPolLon = 0.0, interPolLat = 0.0;
|
|
|
|
|
float interPolHight = 0.0;
|
|
|
|
|
|
|
|
|
|
//<2F><>30Ϊ<30><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>࣬<EFBFBD><E0A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>
|
|
|
|
|
int interPolDis = 30;
|
|
|
|
|
int interPolNum = (int)(dis/interPolDis);
|
|
|
|
|
|
|
|
|
|
for(int i = 0; i <= interPolNum; i++)
|
|
|
|
|
{
|
|
|
|
|
CalculatePtCoordinate(interPolLon, interPolLat, _ptLon, _ptLat, angle, i*interPolDis, 3);
|
|
|
|
|
|
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĸ߳<C4B8>
|
|
|
|
|
if(!m_mapElevation2.getElevation(interPolHight, interPolLon, interPolLat))
|
|
|
|
|
{
|
|
|
|
|
//δ<><CEB4>ȡ<EFBFBD><C8A1><EFBFBD>߳<EFBFBD>ֵ
|
|
|
|
|
BCGPMessageBox(_T("<EFBFBD>߳<EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>ȫ<EFBFBD><EFBFBD>"));
|
|
|
|
|
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>վ<EFBFBD><D5BE><EFBFBD>ߵ<EFBFBD>б<EFBFBD><D0B1>
|
|
|
|
|
_tempSlope = CalSlopeBetweenTwoPoint(_ptLon, _ptLat, _fGroundAlt, interPolLon, interPolLat, interPolHight);
|
|
|
|
|
|
|
|
|
|
//<2F><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>ʱȽϣ<C8BD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ֵ
|
|
|
|
|
_dTanMaxSlope = max(_tempSlope,_dTanMaxSlope);
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD>Сͨ<D0A1>Ӹ߶<D3B8>
|
|
|
|
|
_fMinLOSAlt = (float)CalAltFromSlope(_ptLon, _ptLat, _fGroundAlt, interPolLon, interPolLat, _dTanMaxSlope);
|
|
|
|
|
|
|
|
|
|
pSeries1->AddDataPoint(interPolHight,i*interPolDis);
|
|
|
|
|
pSeries2->AddDataPoint(_fMinLOSAlt,i*interPolDis);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pChart->SetAutoDisplayRange(TRUE, TRUE);
|
|
|
|
|
pChart->SetDirty(TRUE, TRUE);
|
|
|
|
|
m_wndChart.RedrawWindow();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ս<EFBFBD><D5BD>Χ
|
|
|
|
|
void CDlgLightRegion::OnBnClickedButtonDrawFight()
|
|
|
|
|
{
|
|
|
|
|
UpdateData(TRUE);
|
|
|
|
|
|
|
|
|
|
structPoint _structPoint;
|
|
|
|
|
|
|
|
|
|
_structPoint.lon = m_dGroundLon;
|
|
|
|
|
_structPoint.lat = m_dGroundLat;
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD>͵<EFBFBD><CDB5><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ս<EFBFBD><D5BD>Χ
|
|
|
|
|
::SendMessage(g_mapHwnd, WM_SEND_DRAWFIGHT, WPARAM(&_structPoint), LPARAM(m_iFightRegion*1000));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ս<EFBFBD><D5BD>Χ
|
|
|
|
|
void CDlgLightRegion::OnBnClickedButtonDeleteFight()
|
|
|
|
|
{
|
|
|
|
|
::SendMessage(g_mapHwnd, WM_SEND_DRAWFIGHT, 0, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD><DFB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
void CDlgLightRegion::OnBnClickedButtonGetDemRegion()
|
|
|
|
|
{
|
|
|
|
|
CString _DEMpath = GetSoftwareCurrentDirectory() + _T("\\ElevationData");
|
|
|
|
|
|
|
|
|
|
//<2F>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
long hFile = 0;
|
|
|
|
|
//<2F>ļ<EFBFBD><C4BC><EFBFBD>Ϣ
|
|
|
|
|
struct _finddata_t fileinfo;
|
|
|
|
|
string p;
|
|
|
|
|
if((hFile = _findfirst(p.assign(_DEMpath.GetBuffer()).append("\\*").c_str(),&fileinfo)) != -1)
|
|
|
|
|
{
|
|
|
|
|
int _fileNum = 0;
|
|
|
|
|
char fileName[3];
|
|
|
|
|
structPoint _structPoint;
|
|
|
|
|
|
|
|
|
|
char _flag;
|
|
|
|
|
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
if((fileinfo.attrib & _A_SUBDIR))
|
|
|
|
|
{
|
|
|
|
|
;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
|
|
|
|
|
memset(fileName,0,3);
|
|
|
|
|
memset(&_structPoint,0,sizeof(structPoint));
|
|
|
|
|
|
|
|
|
|
//γ<><CEB3>
|
|
|
|
|
memcpy(fileName, fileinfo.name+8, 2);
|
|
|
|
|
_structPoint.lat = atof(fileName);
|
|
|
|
|
|
|
|
|
|
memcpy(&_flag, fileinfo.name+7, 1);
|
|
|
|
|
if ('S' == _flag)
|
|
|
|
|
{
|
|
|
|
|
_structPoint.lat = 0 - _structPoint.lat;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
memcpy(fileName, fileinfo.name+11, 3);
|
|
|
|
|
_structPoint.lon = atof(fileName);
|
|
|
|
|
|
|
|
|
|
memcpy(&_flag, fileinfo.name+10, 1);
|
|
|
|
|
if ('W' == _flag)
|
|
|
|
|
{
|
|
|
|
|
_structPoint.lon = 0 - _structPoint.lon;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_fileNum++;
|
|
|
|
|
::SendMessage(g_mapHwnd, WM_SEND_DRAWDEMREGION, WPARAM(&_structPoint), LPARAM(_fileNum));
|
|
|
|
|
}
|
|
|
|
|
}while(_findnext(hFile, &fileinfo) == 0);
|
|
|
|
|
_findclose(hFile);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_DEMpath.ReleaseBuffer();
|
|
|
|
|
}
|