代码名称:MapXtreme+ASP在图层上添加线图元

作者/收集者:cxm9724

开发环境:MapXtreme for Windows

代码:

创建线图元 
function lineobj(x1,y1,x2,y2,byref obj) 
dim pts 
dim style 
dim bresult 
dim mapx1,mapy1,mapx2,mapy2 
set style=Session(SESN_COURIER).CreateMapXStyle 
mapx1=x1 
mapy1=y1 
mapx2=x2 
mapy2=y2 
set pts=Session(SESN_COURIER).createmapxpoints 
pts.addxy mapx1,mapy1,1 
pts.addxy mapx2,mapy2,2 
set obj=Session(SESN_MAPPER).FeatureFactory.createline (pts,style) 
end function

将线图元添加到图层
sub addline(x1,y1,x2,y2,layername) 
46
dim f 
dim bresult 
bresult=lineobj(x1,y1,x2,y2,f) 
Session(SESN_MAPPER).Layers(layername).addfeature f 
end sub