AE添加设置点要素,并添加,简化

上一篇是照书上抄的,看了半天,发现好多都没用,出书的太不负责任了,呵呵,现在把简化的给大家分享,并添加了注释。

void CAoEx1View::OnMouseDownMapcontrol1(long button, long shift, long X, long Y, double mapX, double mapY)
{
 IActiveViewPtr iActiveView(m_ipMap);
  IPointPtr ipoint(CLSID_Point);
 if(ipoint == NULL) return;
 ipoint->PutCoords(mapX,mapY);
 switch(operateStyle)
 {
 case 1:
  {
 IGeometryPtr pGeometry(ipoint);
 AddCreateElement(pGeometry,iActiveView);
 iActiveView->Refresh();
  }
  break;
 }
}

void CAoEx1View::OnTestMarkerStyle()
{
 ISymbolSelectorPtr pSymbolSelector(CLSID_SymbolSelector);//symbol select
 ISimpleMarkerSymbolPtr psimpleMarksb(CLSID_SimpleMarkerSymbol);//simple marker
 VARIANT_BOOL bOK;
 if(pSymbolSelector == NULL) return;
  pSymbolSelector->AddSymbol((ISymbolPtr)psimpleMarksb,&bOK);//将simple marker添加到symbol select中
 HRESULT hr;
 hr = pSymbolSelector->SelectSymbol(0,&bOK);
 if(FAILED(hr)) return;
 if(bOK)
  pSymbolSelector->GetSymbolAt(0,&m_isymbol);

}

void CAoEx1View::AddCreateElement(IGeometryPtr pgeomln, IActiveViewPtr iactiveview)
{
 IGraphicsContainerPtr pgracont(iactiveview);


 IMarkerElementPtr pmarkerelem(CLSID_MarkerElement);//创建element对象,是element
 if(pmarkerelem == NULL) return;
 IMarkerSymbolPtr imarkerSymbol(m_isymbol);//用m_isymbol初始化imarkerSymbol,是symbol
 pmarkerelem->put_Symbol(imarkerSymbol);//将symbol添加到element
 ((IElementPtr)pmarkerelem)->put_Geometry(pgeomln);
 pgracont->AddElement((IElementPtr)pmarkerelem,0);

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值