标签:uav == ring else containe pac opacity todo 必须
1.与Google earth成图对比
2.生成的html文件代码
<!doctype html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width"> <title>MMCUAV </title> <link rel="stylesheet" href="https://cache.amap.com/lbs/static/main1119.css"/> <script src="https://webapi.amap.com/maps?v=1.4.8&key=0c6ae2eaf06b068e46fc1235194f6fb8"></script> <script type="text/javascript" src="https://cache.amap.com/lbs/static/addToolbar.js"></script> </head> <body> <div id="container"></div> <script> var map = new AMap.Map(‘container‘, { resizeEnable: true, center: [102.726118,25.056391], layers: [new AMap.TileLayer.Satellite()], zoom: 15 }); var lineArr = [ [102.726118,25.056391], [102.726118,25.056391], [102.726117,25.056391], [102.726117,25.056391], [102.726117,25.056391],
[102.729252,25.059681], [102.729252,25.059681] ]; var polyline = new AMap.Polyline({ path: lineArr, //设置线覆盖物路径 strokeColor: "#3366FF", //线颜色 strokeOpacity: 1, //线透明度 strokeOpacity: 1, //线透明度 strokeWeight: 5, //线宽 strokeStyle: "point", //线样式 strokeDasharray: [10, 5], //补充线样式 geodesic: true // 绘制大地线 }); polyline.setMap(map); </script> </body> </html>
3.c++,gga生成html代码
BOOL CAddBaiduMapDlg::OnInitDialog() { CDialogEx::OnInitDialog(); FILE *fp_html; fp_html = fopen("text.html","w"); fclose(fp_html); fp_html = fopen("text.html","a+"); // 将“关于...”菜单项添加到系统菜单中。 // IDM_ABOUTBOX 必须在系统命令范围内。 ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); ASSERT(IDM_ABOUTBOX < 0xF000); CMenu* pSysMenu = GetSystemMenu(FALSE); if (pSysMenu != NULL) { BOOL bNameValid; CString strAboutMenu; bNameValid = strAboutMenu.LoadString(IDS_ABOUTBOX); ASSERT(bNameValid); if (!strAboutMenu.IsEmpty()) { pSysMenu->AppendMenu(MF_SEPARATOR); pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu); } } CString N,E; int i = 0; FILE *fp = fopen("rtkresult.txt","r") ; WriteHead(fp_html,L"name"); while(!feof(fp)) { char str[100] ; fgets(str,100,fp);//从输入文件读取一行字符串 CString kk(str); //kk.Format("%s",str); int successgga = ParseGGA(kk,&N,&E); if (i == 0 && successgga ==1) { WriteHead2(fp_html,L"name",E,N); i++; } else if(i>0 && successgga == 1) { WritePosition(fp_html, L"name",E,N); i++; } //ShowPoint(N, E); } WritePosition2(fp_html, L"name",E,N); WriteEnd(fp_html); // 设置此对话框的图标。当应用程序主窗口不是对话框时,框架将自动 // 执行此操作 fclose(fp_html); // TODO: 在此添加额外的初始化代码 SetIcon(m_hIcon, TRUE); // 设置大图标 SetIcon(m_hIcon, FALSE); // 设置小图标 //显示百度地图 //m_webbrowser.Navigate(_T("file:///G:/康帕斯导航项目-2019年/AddBaiduMap/AddBaiduMap/AddBaiduMap/geodemo.htm"), NULL, NULL, NULL, NULL); m_webbrowser.Navigate(_T("file:///G:/康帕斯导航项目-2019年/AddBaiduMap/AddBaiduMap/AddBaiduMap/text.html"), NULL, NULL, NULL, NULL); //m_webpage.SetDocument(m_webbrowser.get_Document()); fclose(fp); return TRUE; // 除非将焦点设置到控件,否则返回 TRUE }
void CAddBaiduMapDlg::WriteHead(FILE *fp, CString Name) { if (fp != NULL) { fprintf(fp, "<!doctype html>\n"); fprintf(fp, "<html>\n"); fprintf(fp, "<head>\n"); fprintf(fp, "<meta charset=\"utf-8\">\n"); fprintf(fp, "<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n"); fprintf(fp, "<meta name=\"viewport\" content=\"initial-scale=1.0, user-scalable=no, width=device-width\">\n"); fprintf(fp, "<title>MMCUAV </title>\n"); fprintf(fp, "<link rel=\"stylesheet\" href=\"https://cache.amap.com/lbs/static/main1119.css\"/>\n"); fprintf(fp, "<script src=\"https://webapi.amap.com/maps?v=1.4.8&key=0c6ae2eaf06b068e46fc1235194f6fb8\"></script>\n"); fprintf(fp, "<script type=\"text/javascript\" src=\"https://cache.amap.com/lbs/static/addToolbar.js\"></script>\n"); fprintf(fp, "</head>\n"); fprintf(fp, "<body>\n"); fprintf(fp, "<div id=\"container\"></div>\n"); fprintf(fp, "<script>\n"); fprintf(fp, "var map = new AMap.Map(\‘container\‘, {\n"); fprintf(fp, "resizeEnable: true,\n"); //fclose(fp); } } void CAddBaiduMapDlg::WriteHead2(FILE *fp, CString Name,CString L,CString B) { if (fp != NULL) { CString str; char buffer[30] = {‘\0‘}; str.Format(_T("%s,%s"),L,B); WideCharToMultiByte(CP_ACP, 0, str.GetBuffer(0), str.GetLength(), buffer, 30, 0, 0); fprintf(fp, "center: ["); fprintf(fp, "%s",buffer); str.ReleaseBuffer(); //fprintf(fp, "%s,s",L,B); //fclose(fp); fprintf(fp, "],\n"); fprintf(fp, "layers: [new AMap.TileLayer.Satellite()],\n"); fprintf(fp, "zoom: 15\n"); fprintf(fp, "});\n"); fprintf(fp, "var lineArr = [\n"); } } void CAddBaiduMapDlg::WritePosition(FILE *fp, CString name,CString L,CString B) { if (fp != NULL) { CString str; char buffer[30] = {‘\0‘}; str.Format(_T("%s,%s"),L,B); WideCharToMultiByte(CP_ACP, 0, str.GetBuffer(0), str.GetLength(), buffer, 30, 0, 0); fprintf(fp, "["); fprintf(fp, "%s",buffer); str.ReleaseBuffer(); fprintf(fp, "],\n"); } } void CAddBaiduMapDlg::WritePosition2(FILE *fp, CString name,CString L,CString B) { if (fp != NULL) { CString str; char buffer[30] = {‘\0‘}; str.Format(_T("%s,%s"),L,B); WideCharToMultiByte(CP_ACP, 0, str.GetBuffer(0), str.GetLength(), buffer, 30, 0, 0); fprintf(fp, "["); fprintf(fp, "%s",buffer); str.ReleaseBuffer(); fprintf(fp, "]\n"); } } void CAddBaiduMapDlg::WriteEnd(FILE *fp) { fprintf(fp, "];\n"); fprintf(fp, "var polyline = new AMap.Polyline({\n"); fprintf(fp, "path: lineArr, //设置线覆盖物路径\n"); fprintf(fp, "strokeColor: \"#3366FF\", //线颜色\n"); fprintf(fp, "strokeOpacity: 1, //线透明度\n"); fprintf(fp, "strokeOpacity: 1, //线透明度\n"); fprintf(fp, "strokeWeight: 5, //线宽\n"); fprintf(fp, "strokeStyle: \"point\", //线样式\n"); fprintf(fp, "strokeDasharray: [10, 5], //补充线样式\n"); fprintf(fp, "geodesic: true // 绘制大地线\n"); fprintf(fp, " });\n"); fprintf(fp, " polyline.setMap(map);\n"); //fprintf(fp, " var polygonArr = new Array();//多边形覆盖物节点坐标数组\n"); //fprintf(fp, " polygonArr.push([116.403322, 39.920255]);\n"); //fprintf(fp, " polygonArr.push([116.410703, 39.897555]);\n"); //fprintf(fp, " polygonArr.push([116.402292, 39.892353]);\n"); //fprintf(fp, " polygonArr.push([116.389846, 39.891365]);\n"); //fprintf(fp, " var polygon = new AMap.Polygon({\n"); //fprintf(fp, "path: polygonArr,//设置多边形边界路径\n"); //fprintf(fp, "strokeColor: \"#FF33FF\", //线颜色\n"); //fprintf(fp, "strokeOpacity: 0.2, //线透明度\n"); //fprintf(fp, "strokeWeight: 3, //线宽\n"); //fprintf(fp, "fillColor: \"#1791fc\", //填充色\n"); //fprintf(fp, "fillOpacity: 0.35//填充透明度\n"); //fprintf(fp, " });\n"); //fprintf(fp, " polygon.setMap(map);\n"); //fprintf(fp, " var circle = new AMap.Circle({\n"); //fprintf(fp, "center: new AMap.LngLat(\"116.403322\",\ "39.920255\"),// 圆心位置\n"); //fprintf(fp, "radius: 1000, //半径\n"); //fprintf(fp, "strokeColor: \"#F33\", //线颜色\n"); //fprintf(fp, "strokeOpacity: 1, //线透明度\n"); //fprintf(fp, "strokeWeight: 3, //线粗细度\n"); //fprintf(fp, "fillColor: \"#ee2200\", //填充颜色\n"); //fprintf(fp, "fillOpacity: 0.35//填充透明度\n"); //fprintf(fp, "});\n"); //fprintf(fp, "circle.setMap(map);\n"); fprintf(fp, "</script>\n"); fprintf(fp, "</body>\n"); fprintf(fp, "</html>\n"); fclose(fp); }
标签:uav == ring else containe pac opacity todo 必须
原文地址:https://www.cnblogs.com/liuliwei-leo/p/10878136.html