MapX画线画点代码

CString ctring; ctring.Format(_T("距离: %.2fm"), ant.gpqss.top()); CClientDC dc(this); CSize sz = dc.GetTextExtent(ctring); ((CMainFrame*)AfxGetMainWnd())->m_wndStatusBar.SetPaneInfo(1, NULL, SBPS_NORMAL, sz.cx); ((CMainFrame*)AfxGetMainWnd())->m_wndStatusBar.SetPaneText(1, ctring); if (HaveLine==true) { Layer.DeleteFeature(feat); Layer.Refresh(); HaveLine = false; } if (HaveLine==false) { CMapXPoints Pnts; Pnts.CreateDispatch(Pnts.GetClsid()); FeaFac = m_ctrlMapX.GetFeatureFactory(); for (int i = 0; i < ant.spqss.top().vectorGo.size(); i++) { iter = g.vertexMap.find(ant.spqss.top().vectorGo[i]); Pnts.AddXY(iter->second->X, iter->second->Y); } ////////////////////////显示轨迹//////////////////////////////////////////// COleVariant vtPoints; vtPoints.vt = VT_DISPATCH; vtPoints.pdispVal = Pnts.m_lpDispatch; vtPoints.pdispVal->AddRef(); Feature = FeaFac.CreateLine(vtPoints); Style = Feature.GetStyle(); Style.SetLineColor(miColorRed); Style.SetLineWidth(4); Style.SetLineStyle(65); Feature.SetStyle(Style.m_lpDispatch); feat = Layer.AddFeature(Feature); feat.Update(); Pnts.RemoveAll(); HaveLine = true; } ////////////////////////显示必经城市//////////////////////////////////////////// float screenX, screenY; double mapX, mapY; CMapXPoint point; point.CreateDispatch(point.GetClsid()); for (int i = 0; i < ant.vectorGone4.size(); i++) { iter = g.vertexMap.find(ant.vectorGone4[i]); point.Set(iter->second->X, iter->second->Y); CMapXStyle style; style.CreateDispatch(style.GetClsid()); style.SetSymbolType(miSymbolTypeBitmap); style.SetSymbolBitmapSize(7); style.SetSymbolBitmapColor(RGB(255, 125, 210)); style.SetSymbolBitmapName(_T("camera.bmp")); m_ctrlMapX.SetAutoRedraw(FALSE); Layer.SetEditable(TRUE); VARIANT varPoint, varStyle; varPoint.vt = VT_DISPATCH; varPoint.pdispVal = point; varStyle.vt = VT_DISPATCH; varStyle.pdispVal = style; CMapXFeatureFactory factory = m_ctrlMapX.GetFeatureFactory(); CMapXFeature feature = factory.CreateSymbol(varPoint, varStyle); Layer.AddFeature(feature); Layer.Refresh(); m_ctrlMapX.SetAutoRedraw(TRUE); Layer.SetEditable(FALSE); } }

你可能感兴趣的:(null,float)