VC+MapX 在临时图层中添加点图元

//创建点图元
    CMapXPoint point;
    point.CreateDispatch(point.GetClsid());
    point.Set(m_dMapXX,m_dMapXY);
   
//创建图元样式
    CMapXStyle style;
    style.CreateDispatch(style.GetClsid());
    style.SetSymbolType(miSymbolTypeBitmap);
    style.SetSymbolBitmapSize(
10);
    style.SetSymbolBitmapName(_T(
"camera.bmp"));
   
//设置MapX不进行自动更新
    m_ctrlMapX.SetAutoRedraw(FALSE);
   
//设置图层可写
    pLayer->SetEditable(TRUE);
   
//创建特征对象
    VARIANT varPoint;
    VARIANT 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);
   
//添加到图层
    pLayer->AddFeature(feature);
    pLayer
->Refresh();
   
//设置MapX进行自动更新
    m_ctrlMapX.SetAutoRedraw(TRUE);
   
//设置图层不可写
    pLayer->SetEditable(FALSE);

你可能感兴趣的:(VC+MapX 在临时图层中添加点图元)