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);
}
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);
}
相关文章推荐
- AE添加设置点要素,并添加
- AE添加设置线要素,并添加
- AE CreateFeatureClass 创建shp. 删除shp. 向shp中添加要素
- AE CreateFeatureClass 创建shp. 删除shp. 向shp中添加要素
- AE CreateFeatureClass 创建shp. 删除shp. 向shp中添加要素
- AE基础(8)PageLayout属性设置和添加元素
- AE 向已存在的要素类中添加字段
- AE CreateFeatureClass 创建shp. 删除shp. 向shp中添加要素
- Windows Store apps开发[20]添加应用设置(SettingsPane)
- CentOS 7.x设置自定义开机启动,添加自定义系统服务
- Linux_.bashrc设置_添加目录、当前文件、光标所在行、总行数及字符数信息
- mysql "email"字段 的属性项没有设置成UNSIGNED,但是添加'0'到email字段报错:#1062 –Duplicate entry '1' for key 'email',求解
- ArcGIS数据编辑——要素概括(简化)/平滑
- 在linux中添加ftp用户,并设置相应的权限
- Windows如何在cmd命令行中查看、修改、删除与添加、设置环境变量
- github设置添加SSH
- 在android settings.db数据库中添加一项新的设置
- Spring实现动态数据源,支持动态添加、删除和设置权重及读写分离
- 动态添加XtraTabControl详细设置
- 为什么无法发起qq临时会话,必须添加好友?如何设置才能临时会话?