|
|
|
@ -187,6 +187,11 @@ CGISDlg::CGISDlg(CWnd* pParent /*=NULL*/)
|
|
|
|
|
m_designLinePointNum = 0; //当前航点个数
|
|
|
|
|
|
|
|
|
|
m_CircleGuideLayer = -1; //盘旋引导图层
|
|
|
|
|
|
|
|
|
|
/*******************************测绘航线********************************/
|
|
|
|
|
surveyRegionLayerID = -1;
|
|
|
|
|
tmpSurveyRegionLayerID = -1;
|
|
|
|
|
tmpSurveyLineLayerID = -1;
|
|
|
|
|
/*******************************新增限制区********************************/
|
|
|
|
|
//绘制禁飞区、限飞区
|
|
|
|
|
std::fill(noFlyZoneLayersID, noFlyZoneLayersID + 5, -1);//禁飞区
|
|
|
|
@ -434,6 +439,12 @@ CGISDlg::~CGISDlg()
|
|
|
|
|
m_gisManager->DestroyObject();
|
|
|
|
|
m_gisManager = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (designSurveyLineDlg != nullptr)
|
|
|
|
|
{
|
|
|
|
|
delete designSurveyLineDlg;
|
|
|
|
|
designSurveyLineDlg = nullptr;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -611,6 +622,10 @@ BEGIN_MESSAGE_MAP(CGISDlg, CBCGPDialog)
|
|
|
|
|
|
|
|
|
|
ON_COMMAND(IDM_BIND_ZONE,OnBindZone)
|
|
|
|
|
|
|
|
|
|
/*****************************测绘航线*******************************/
|
|
|
|
|
ON_MESSAGE(WM_SEND_SHOWSURVEYREGION, &CGISDlg::OnShowSurveyRegion) //显示测绘区域
|
|
|
|
|
ON_MESSAGE(WM_SEND_SHOWSURVEYLINE, &CGISDlg::OnShowSurveyRegion) //显示测绘航线
|
|
|
|
|
ON_MESSAGE(WM_CLEAR_TMPSURVEYFEATURE, &CGISDlg::OnClearTmpSurveyFeature) //显示测绘航线
|
|
|
|
|
|
|
|
|
|
END_MESSAGE_MAP()
|
|
|
|
|
|
|
|
|
@ -667,6 +682,10 @@ BOOL CGISDlg::OnInitDialog()
|
|
|
|
|
m_dlgMarker.Create(IDD_DIALOG_MARKER,this);
|
|
|
|
|
m_dlgMarker.MoveToGivenArea(m_gisAreaInScreen);
|
|
|
|
|
|
|
|
|
|
//创建航线航测对话框
|
|
|
|
|
designSurveyLineDlg = new DesignSurveyLineDlg();
|
|
|
|
|
designSurveyLineDlg->Create(IDD_DLG_DESIGNSURVEYLINE);
|
|
|
|
|
|
|
|
|
|
//地图显示区宽度、高度倒数
|
|
|
|
|
m_onePerWidth = 1.0/m_rcGISArea.Width();
|
|
|
|
|
m_onePerHeight = 1.0/m_rcGISArea.Height();
|
|
|
|
@ -990,6 +1009,13 @@ void CGISDlg::OnMapFullScreen()
|
|
|
|
|
m_bLDSetPoint = FALSE;
|
|
|
|
|
|
|
|
|
|
m_bSelectFeatureFlag = false;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
if (designSurveyLineDlg==nullptr)
|
|
|
|
|
{
|
|
|
|
|
designSurveyLineDlg = new DesignSurveyLineDlg();
|
|
|
|
|
}
|
|
|
|
|
designSurveyLineDlg->ShowWindow(true);*/
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1904,6 +1930,16 @@ void CGISDlg::MouseDownMap1(short Button, short Shift, long x, long y)
|
|
|
|
|
//TRACE(g_bSelectMarker);
|
|
|
|
|
// return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//绘制航测区域
|
|
|
|
|
if (designSurveyLineDlg != nullptr && designSurveyLineDlg->bDrawRegion && (Button == 1))
|
|
|
|
|
{
|
|
|
|
|
//像素坐标转换地理坐标
|
|
|
|
|
m_map.PixelToProj(x,y, &dX, &dY);
|
|
|
|
|
|
|
|
|
|
surveyRegionLons.push_back(dX);
|
|
|
|
|
surveyRegionLats.push_back(dY);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (m_bHaveShowDistanceDlg && (Button == 1))
|
|
|
|
|
{
|
|
|
|
@ -2695,6 +2731,28 @@ void CGISDlg::MouseDblClickMap1()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//结束绘制航测区
|
|
|
|
|
if (designSurveyLineDlg != nullptr && designSurveyLineDlg->bDrawRegion)
|
|
|
|
|
{
|
|
|
|
|
designSurveyLineDlg->bDrawRegion = false;
|
|
|
|
|
if (surveyRegionLons.size()<3) //多边形无效
|
|
|
|
|
{
|
|
|
|
|
surveyRegionLons.clear();
|
|
|
|
|
surveyRegionLats.clear();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
//添加原点闭合
|
|
|
|
|
surveyRegionLons.push_back(surveyRegionLons[0]);
|
|
|
|
|
surveyRegionLats.push_back(surveyRegionLats[0]);
|
|
|
|
|
//显示测绘区域
|
|
|
|
|
ShowSurveyRegion(tmpSurveyRegionLayerID,surveyRegionLons,surveyRegionLats);
|
|
|
|
|
m_map.Redraw();
|
|
|
|
|
designSurveyLineDlg->SetSurveyRegion(surveyRegionLons,surveyRegionLats);
|
|
|
|
|
|
|
|
|
|
surveyRegionLons.clear();
|
|
|
|
|
surveyRegionLats.clear();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CGISDlg::MouseMoveMap1(short Button, short Shift, long x, long y)
|
|
|
|
@ -2704,6 +2762,49 @@ void CGISDlg::MouseMoveMap1(short Button, short Shift, long x, long y)
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//绘制航测区域
|
|
|
|
|
if (designSurveyLineDlg!= nullptr && designSurveyLineDlg->bDrawRegion)
|
|
|
|
|
{
|
|
|
|
|
double dX = 0;
|
|
|
|
|
double dY = 0;
|
|
|
|
|
m_map.PixelToProj(x,y, &dX, &dY);
|
|
|
|
|
|
|
|
|
|
if ( 1 == surveyRegionLons.size()) //绘制直线
|
|
|
|
|
{
|
|
|
|
|
if (m_tempLayerID!=-1)
|
|
|
|
|
{
|
|
|
|
|
m_map.ClearDrawing(m_tempLayerID);
|
|
|
|
|
m_tempLayerID = -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_tempLayerID = m_map.NewDrawing(1);
|
|
|
|
|
m_map.DrawLineEx(m_tempLayerID,surveyRegionLons[0],surveyRegionLats[0],dX,dY,2,RGB(255,0,0));
|
|
|
|
|
m_map.Redraw();
|
|
|
|
|
}
|
|
|
|
|
if (2 <= surveyRegionLons.size()) //绘制多边形
|
|
|
|
|
{
|
|
|
|
|
/*
|
|
|
|
|
if ( 2 == surveyRegionLons.size())
|
|
|
|
|
{
|
|
|
|
|
//添加实时点绘制多边形
|
|
|
|
|
surveyRegionLons.push_back(dX);
|
|
|
|
|
surveyRegionLats.push_back(dY);
|
|
|
|
|
}*/
|
|
|
|
|
if (m_tempLayerID!=-1)
|
|
|
|
|
{
|
|
|
|
|
m_map.ClearDrawing(m_tempLayerID);
|
|
|
|
|
m_tempLayerID = -1;
|
|
|
|
|
}
|
|
|
|
|
surveyRegionLons.push_back(dX);
|
|
|
|
|
surveyRegionLats.push_back(dY);
|
|
|
|
|
ShowSurveyRegion(tmpSurveyRegionLayerID,surveyRegionLons,surveyRegionLats);
|
|
|
|
|
m_map.Redraw();
|
|
|
|
|
|
|
|
|
|
surveyRegionLons.pop_back();
|
|
|
|
|
surveyRegionLats.pop_back();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//显示经纬度坐标时(地图定位)
|
|
|
|
|
if (m_bHaveShowLonLatDlg && m_pLonLatDlg ->GetAutoEditStatus())
|
|
|
|
|
{
|
|
|
|
@ -3046,10 +3147,11 @@ void CGISDlg::MouseMoveMap1(short Button, short Shift, long x, long y)
|
|
|
|
|
void CGISDlg::AddTextToPointShapeLayer(long &drawLayerID, const double lon, const double lat, const CString strPtName, const CString strColor, unsigned long fontColor)
|
|
|
|
|
{
|
|
|
|
|
//判断点矢量图层是否已经存在,存在则删除
|
|
|
|
|
if (drawLayerID > 0)
|
|
|
|
|
if (drawLayerID >= 0)
|
|
|
|
|
{
|
|
|
|
|
//清除标绘的点矢量图层
|
|
|
|
|
ClearPointShape(drawLayerID);
|
|
|
|
|
drawLayerID = -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/////////////////////新建点矢量图层标绘点目标///////////////////////////////////
|
|
|
|
@ -3165,15 +3267,6 @@ void CGISDlg::DrawDistLabelEx(long drawLayerID, const double ptLon1, const doubl
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CLabels drawLabels = m_map.GetDrawingLabels(drawLayerID);
|
|
|
|
|
//drawLabels.SetAvoidCollisions(false);
|
|
|
|
|
/*
|
|
|
|
|
CLabelCategory labelCategory = drawLabels.AddCategory(_T("dist"));
|
|
|
|
|
labelCategory.SetFontName(_T("ºÚÌå"));
|
|
|
|
|
labelCategory.SetFontSize(12);
|
|
|
|
|
labelCategory.SetOffsetX(8);
|
|
|
|
|
labelCategory.SetFrameVisible(true);
|
|
|
|
|
labelCategory.SetFrameTransparency(180);
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
drawLabels.SetFontName(_T("黑体"));
|
|
|
|
|
//drawLabels.SetFontName(_T("Arial"));
|
|
|
|
@ -4975,8 +5068,36 @@ void CGISDlg::OnShowGivenLine(const CString strLineFileName)
|
|
|
|
|
BCGPMessageBox("航线号不正确!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int ch = lineDataGroup.linePts[lineDataGroup.pointNum-1].ch1;
|
|
|
|
|
/***************************测绘区域处理************************************/
|
|
|
|
|
if (ch == 0x03)
|
|
|
|
|
{
|
|
|
|
|
if (tmpSurveyRegionLayerID!=-1)
|
|
|
|
|
{
|
|
|
|
|
m_map.RemoveLayer(tmpSurveyRegionLayerID);
|
|
|
|
|
tmpSurveyRegionLayerID = -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
vector<double> regionLons;
|
|
|
|
|
vector<double> regionLats;
|
|
|
|
|
for (int i = 0;i<lineDataGroup.pointNum;++i)
|
|
|
|
|
{
|
|
|
|
|
regionLons.push_back(lineDataGroup.linePts[i].dX);
|
|
|
|
|
regionLats.push_back(lineDataGroup.linePts[i].dY);
|
|
|
|
|
}
|
|
|
|
|
//添加原点
|
|
|
|
|
regionLons.push_back(lineDataGroup.linePts[0].dX);
|
|
|
|
|
regionLats.push_back(lineDataGroup.linePts[0].dY);
|
|
|
|
|
if (designSurveyLineDlg!=nullptr)
|
|
|
|
|
{
|
|
|
|
|
designSurveyLineDlg->SetSurveyRegion(regionLons,regionLats);
|
|
|
|
|
}
|
|
|
|
|
ShowSurveyRegion(surveyRegionLayerID,regionLons,regionLats);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***************************限制区处理************************************/
|
|
|
|
|
if (ch==0x0D) //限飞区
|
|
|
|
|
{
|
|
|
|
|
//ClearZoneLayer(restrictedZoneLayersID[lineDataGroup.lineID-1]);
|
|
|
|
@ -5463,6 +5584,28 @@ void CGISDlg::OnEnddesign() //
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//批量航线设置
|
|
|
|
|
double azmuth,heightInterval,lineInterval,numLine;
|
|
|
|
|
bool bSaveMultiLine = false;
|
|
|
|
|
CString pathName;
|
|
|
|
|
if (g_b981AMulti && dlg.m_bCheckMultiLine)
|
|
|
|
|
{
|
|
|
|
|
SetMultiRouteDlg multiRouteDlg;
|
|
|
|
|
if (multiRouteDlg.DoModal() == IDOK )
|
|
|
|
|
{
|
|
|
|
|
azmuth = multiRouteDlg.azmuth;
|
|
|
|
|
heightInterval = multiRouteDlg.heightInterval;
|
|
|
|
|
lineInterval = multiRouteDlg.lineInterval;
|
|
|
|
|
numLine = multiRouteDlg.numLine;
|
|
|
|
|
bSaveMultiLine = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bSaveMultiLine = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//保存设置航线
|
|
|
|
|
CString strRouteFileDir = GetSoftwareCurrentDirectory() + _T("\\Route");
|
|
|
|
|
|
|
|
|
|
TCHAR s[10000];
|
|
|
|
@ -5479,7 +5622,7 @@ void CGISDlg::OnEnddesign() //
|
|
|
|
|
if (IDOK == dlgSave.DoModal())
|
|
|
|
|
{
|
|
|
|
|
strFlyLineName = dlgSave.GetPathName();
|
|
|
|
|
|
|
|
|
|
pathName = ExtractFileName(strFlyLineName);
|
|
|
|
|
|
|
|
|
|
////写出航线数据
|
|
|
|
|
FILE *fp = fopen(strFlyLineName, "w" );
|
|
|
|
@ -5493,25 +5636,29 @@ void CGISDlg::OnEnddesign() //
|
|
|
|
|
memset(&pt, 0, sizeof(PtStruct));
|
|
|
|
|
|
|
|
|
|
//原点数据写入
|
|
|
|
|
fprintf(fp, "%d, %d, %lf, %lf, %.2lf, %d, %02X, %02X\n", designLineID, 0, g_gcsLon, g_gcsLat, 0.0, 0, 0, 3);
|
|
|
|
|
fprintf(fp, "%d, %d, %.7f, %.7f, %.2f, %d, %02X, %02X\n", designLineID, 0, g_gcsLon, g_gcsLat, 0.0, 0, 0, 3);
|
|
|
|
|
|
|
|
|
|
//遍历航点集合数据
|
|
|
|
|
for ( int i = 0; i < m_designLinePointNum; i++ )
|
|
|
|
|
{
|
|
|
|
|
pt = m_pDesignLineStruct[i];
|
|
|
|
|
m_pDesignLineStruct[i].nL = designLineID;
|
|
|
|
|
m_pDesignLineStruct[i].nH = lineHeight;
|
|
|
|
|
|
|
|
|
|
//将除最后一个点的数据写入文件
|
|
|
|
|
if ( i < (m_designLinePointNum-1))
|
|
|
|
|
{
|
|
|
|
|
fprintf(fp, "%d, %d, %lf, %lf, %.2lf, %d, %02X, %02X\n", designLineID, pt.nPt, pt.dX, pt.dY, lineHeight, pt.nV, pt.ch1, 3);
|
|
|
|
|
fprintf(fp, "%d, %d, %.7f, %.7f, %.2f, %d, %02X, %02X\n", designLineID, pt.nPt, pt.dX, pt.dY, lineHeight, pt.nV, pt.ch1, 3);
|
|
|
|
|
}
|
|
|
|
|
else//将最后一个点的航段特征数据写入文件
|
|
|
|
|
{
|
|
|
|
|
fprintf(fp, "%d, %d, %lf, %lf, %.2lf, %d, %02X, %02X\n", designLineID, pt.nPt, pt.dX, pt.dY, lineHeight, pt.nV, designLineCE/*pt.ch1*/, lineProperty);
|
|
|
|
|
fprintf(fp, "%d, %d, %.7f, %.7f, %.2f, %d, %02X, %02X\n", designLineID, pt.nPt, pt.dX, pt.dY, lineHeight, pt.nV, designLineCE/*pt.ch1*/, lineProperty);
|
|
|
|
|
m_pDesignLineStruct[i].ch2 = designLineCE;
|
|
|
|
|
m_pDesignLineStruct[i].ch1 = lineProperty;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fclose( fp );
|
|
|
|
|
fclose( fp );
|
|
|
|
|
|
|
|
|
|
//弹出保存成功对话框
|
|
|
|
|
BCGPMessageBox(_T("航线文件保存成功!"));
|
|
|
|
@ -5519,6 +5666,14 @@ void CGISDlg::OnEnddesign() //
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//批量航线保存
|
|
|
|
|
if (g_b981AMulti && bSaveMultiLine)
|
|
|
|
|
{
|
|
|
|
|
vector<vector<PtStruct>> resultLines;
|
|
|
|
|
GetMultiRouteLine(azmuth,lineInterval,numLine,m_pDesignLineStruct,m_designLinePointNum,resultLines);
|
|
|
|
|
SaveMultiRouteLine(pathName,heightInterval,resultLines);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
memset(m_pDesignLineStruct, 0, sizeof(PtStruct)*m_lineMaxPointNum); //初始化新建一条航线
|
|
|
|
|
m_designLinePointNum = 0;
|
|
|
|
|
|
|
|
|
@ -8105,6 +8260,177 @@ void CGISDlg::OnBindZone()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//显示航测区域
|
|
|
|
|
void CGISDlg::ShowSurveyRegion(long& layerID,vector<double>& xPoints,vector<double>& yPoints)
|
|
|
|
|
{
|
|
|
|
|
if (layerID!=-1)
|
|
|
|
|
{
|
|
|
|
|
m_map.RemoveLayer(layerID);
|
|
|
|
|
layerID = -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mapWindow::IShapePtr shapePtr;
|
|
|
|
|
shapePtr.CreateInstance("MapWinGIS.Shape");
|
|
|
|
|
//创建面矢量shapfile
|
|
|
|
|
shapePtr->Create(mapWindow::SHP_POLYGON);
|
|
|
|
|
CreateEmptyShapfile(layerID,2,RGB(255,0,0));
|
|
|
|
|
int nPoints = xPoints.size();
|
|
|
|
|
for (long i=0; i<nPoints; i++)
|
|
|
|
|
{
|
|
|
|
|
mapWindow::IPointPtr pintPtr;
|
|
|
|
|
pintPtr.CreateInstance("MapWinGIS.Point");
|
|
|
|
|
|
|
|
|
|
//经度
|
|
|
|
|
pintPtr->x = xPoints[i];
|
|
|
|
|
//纬度
|
|
|
|
|
pintPtr->y = yPoints[i];
|
|
|
|
|
shapePtr->InsertPoint(pintPtr, &i);
|
|
|
|
|
|
|
|
|
|
//插入面矢量
|
|
|
|
|
(m_map.GetShapefile(layerID)).EditInsertShape(shapePtr, &i);
|
|
|
|
|
}
|
|
|
|
|
mapWindow::IShapeDrawingOptionsPtr pShapeDrawingOption;
|
|
|
|
|
pShapeDrawingOption.CreateInstance("MapWinGIS.ShapeDrawingOptions");
|
|
|
|
|
pShapeDrawingOption->LineColor = RGB(66,102,244);//RGB(212,212,252);
|
|
|
|
|
pShapeDrawingOption->FillColor = RGB(117,176,247);//RGB(0,255,255);//RGB(244,206,199);
|
|
|
|
|
|
|
|
|
|
pShapeDrawingOption->LineWidth = 2;
|
|
|
|
|
pShapeDrawingOption->FillTransparency = 40; //透明度
|
|
|
|
|
(m_map.GetShapefile(layerID)).SetDefaultDrawingOptions(pShapeDrawingOption);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//显示航测航线
|
|
|
|
|
void CGISDlg::ShowPolyline(long& layerID,vector<double>& xPoints,vector<double>& yPoints)
|
|
|
|
|
{
|
|
|
|
|
if (layerID!=-1)
|
|
|
|
|
{
|
|
|
|
|
m_map.RemoveLayer(layerID);
|
|
|
|
|
layerID = -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mapWindow::IShapePtr shapePtr;
|
|
|
|
|
shapePtr.CreateInstance("MapWinGIS.Shape");
|
|
|
|
|
//创建面矢量shapfile
|
|
|
|
|
shapePtr->Create(mapWindow::SHP_POLYLINE);
|
|
|
|
|
CreateEmptyShapfile(layerID,1,RGB(255,0,0));
|
|
|
|
|
int nPoints = xPoints.size();
|
|
|
|
|
for (long i=0; i<nPoints; i++)
|
|
|
|
|
{
|
|
|
|
|
mapWindow::IPointPtr pintPtr;
|
|
|
|
|
pintPtr.CreateInstance("MapWinGIS.Point");
|
|
|
|
|
|
|
|
|
|
//经度
|
|
|
|
|
pintPtr->x = xPoints[i];
|
|
|
|
|
//纬度
|
|
|
|
|
pintPtr->y = yPoints[i];
|
|
|
|
|
shapePtr->InsertPoint(pintPtr, &i);
|
|
|
|
|
|
|
|
|
|
//插入面矢量
|
|
|
|
|
(m_map.GetShapefile(layerID)).EditInsertShape(shapePtr, &i);
|
|
|
|
|
}
|
|
|
|
|
mapWindow::IShapeDrawingOptionsPtr pShapeDrawingOption;
|
|
|
|
|
pShapeDrawingOption.CreateInstance("MapWinGIS.ShapeDrawingOptions");
|
|
|
|
|
pShapeDrawingOption->LineColor = RGB(212,212,252);
|
|
|
|
|
|
|
|
|
|
pShapeDrawingOption->LineWidth = 2;
|
|
|
|
|
(m_map.GetShapefile(layerID)).SetDefaultDrawingOptions(pShapeDrawingOption);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//显示测绘区域
|
|
|
|
|
afx_msg LRESULT CGISDlg::OnShowSurveyRegion(WPARAM wParam, LPARAM lParam)
|
|
|
|
|
{
|
|
|
|
|
CString path = (char*)wParam;
|
|
|
|
|
OnShowGivenLine(path);
|
|
|
|
|
//ShowSurveyRegion(surveyRegionLayerID,designSurveyLineDlg->surveyRegionLons,designSurveyLineDlg->surveyRegionLats);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//显示测绘区域
|
|
|
|
|
afx_msg LRESULT CGISDlg::OnShowSurveyLine(WPARAM wParam, LPARAM lParam)
|
|
|
|
|
{
|
|
|
|
|
CString path = (char*)wParam;
|
|
|
|
|
OnShowGivenLine(path);
|
|
|
|
|
//ShowSurveyRegion(surveyRegionLayerID,designSurveyLineDlg->surveyRegionLons,designSurveyLineDlg->surveyRegionLats);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//显示测绘区域
|
|
|
|
|
afx_msg LRESULT CGISDlg::OnClearTmpSurveyFeature(WPARAM wParam, LPARAM lParam)
|
|
|
|
|
{
|
|
|
|
|
if (tmpSurveyRegionLayerID!=-1)
|
|
|
|
|
{
|
|
|
|
|
m_map.RemoveLayer(tmpSurveyRegionLayerID);
|
|
|
|
|
tmpSurveyRegionLayerID = -1;
|
|
|
|
|
}
|
|
|
|
|
m_map.Redraw();
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/****************************多机航线一键生成************************************/
|
|
|
|
|
void CGISDlg::GetMultiRouteLine(double azimuth,double lineInterval,int lineNumber,PtStruct* lineStruct,int nLinePts,vector<vector<PtStruct>>& resultLines)
|
|
|
|
|
{
|
|
|
|
|
GeoCompute geoComputer;
|
|
|
|
|
double tmpLon,tmpLat;
|
|
|
|
|
vector<PtStruct> line;
|
|
|
|
|
double dist = 0;
|
|
|
|
|
double lineAzimuth = 0;
|
|
|
|
|
for (int j=0;j< lineNumber;++j)
|
|
|
|
|
{
|
|
|
|
|
line.clear();
|
|
|
|
|
dist = lineInterval*(j+1);
|
|
|
|
|
tmpLon = lineStruct[0].dX;
|
|
|
|
|
tmpLat = lineStruct[0].dY;
|
|
|
|
|
lineAzimuth = azimuth;
|
|
|
|
|
for (int i=0;i< nLinePts;++i)
|
|
|
|
|
{
|
|
|
|
|
PtStruct line0 = lineStruct[i];
|
|
|
|
|
PtStruct line1 = lineStruct[i+1];
|
|
|
|
|
geoComputer.computeOffsetGeoPosition(tmpLon,tmpLat,lineAzimuth,dist/1000,tmpLon,tmpLat);
|
|
|
|
|
PtStruct pt;
|
|
|
|
|
pt.dX = tmpLon;
|
|
|
|
|
pt.dY = tmpLat;
|
|
|
|
|
pt.nH = lineStruct[i].nH;
|
|
|
|
|
pt.nL = lineStruct[i].nL;
|
|
|
|
|
pt.nPt = lineStruct[i].nPt;
|
|
|
|
|
pt.nV = lineStruct[i].nV;
|
|
|
|
|
pt.ch1 = lineStruct[i].ch1;
|
|
|
|
|
pt.ch2 = lineStruct[i].ch2;
|
|
|
|
|
line.push_back(pt);
|
|
|
|
|
|
|
|
|
|
//CalculateTwoPtsAzimuth(azimuth,lineStruct[i].dX,lineStruct[i].dY,lineStruct[i+1].dX,lineStruct[i+1].dY,3);
|
|
|
|
|
if (i+1<nLinePts)
|
|
|
|
|
{
|
|
|
|
|
CalculateTwoPtsDistanceAzimuth(dist,lineAzimuth,lineStruct[i].dX,lineStruct[i].dY,lineStruct[i+1].dX,lineStruct[i+1].dY,3);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//dist = geoComputer.VincentyDistance(lineStruct[i].dX,lineStruct[i].dY,lineStruct[i+1].dX,lineStruct[i+1].dY);
|
|
|
|
|
}
|
|
|
|
|
resultLines.push_back(line);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CGISDlg::SaveMultiRouteLine(CString pathDirName,double heightInterval,const vector<vector<PtStruct>>& resultLines)
|
|
|
|
|
{
|
|
|
|
|
CString saveFileName;
|
|
|
|
|
for (int i=0;i<resultLines.size();++i)
|
|
|
|
|
{
|
|
|
|
|
vector<PtStruct> line = resultLines[i];
|
|
|
|
|
CString tmp;
|
|
|
|
|
tmp.Format("-%d",i+2);
|
|
|
|
|
saveFileName = pathDirName + tmp + ".txt";
|
|
|
|
|
//保存文件
|
|
|
|
|
FILE* fp = fopen(saveFileName,"w");
|
|
|
|
|
fprintf(fp,"%d, 0, %.7f, %.7f, %.2f, 0, 00, 03\n", line[0].nL, 0.0, 0.0, 0.0);
|
|
|
|
|
int j = 0;
|
|
|
|
|
for (j;j<line.size()-1;++j)
|
|
|
|
|
{
|
|
|
|
|
fprintf(fp,"%d, %d, %.7f, %.7f, %.2f, 0, 00, 03\n", line[j].nL, j+1,line[j].dX, line[j].dY,line[j].nH + heightInterval*(i+1));
|
|
|
|
|
}
|
|
|
|
|
fprintf(fp,"%d, %d, %.7f, %.7f, %.2f, 0, %02X, 01\n", line[j].nL, j+1,line[j].dX, line[j].dY,line[j].nH + heightInterval*(i+1),line[j].ch2);
|
|
|
|
|
fclose(fp);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|