您的位置:首页 > 其它

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

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

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);

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: