MapXtreme+ASP在图层上选择图元

开发环境:MapXtreme for Windows

代码:

选中目标样式设置
function systemselectedstyle(byref style)
set style=Session(SESN_COURIER).CreateMapXStyle
style.RegionColor =12632256
style.LineColor =12632256
style.RegionPattern=2
set Session(SESN_MAPPER).SelectionStyle=style
end function

 点选择
sub singlepointsel(x1,y1,layername, SearchType)
dim fs
dim f
dim bresult
dim style
dim pt
session(SESN_MAPPER).Layers(layername).selection.ClearSelection
Session(SESN_MAPPER).ExportSelection=true
set pt=Session(SESN_COURIER).createmapxpoint
pt.set x1,y1
set fs=Session(SESN_MAPPER).layers(layername).Searchatpoint(pt)
bresult=systemselectedstyle(style)
if fs.count0 then
set f=fs.item(1)
Session(SESN_MAPPER).Layers(layername).selection.add f
end if
end sub

 圆形选择
sub SingleCirclesel(X1,Y1,X2,Y2,Layername, SearchType)
dim fs
dim style
dim f
dim pt
dim dblDistance
dim bresult
Session(SESN_MAPPER).ExportSelection=true
bresult=systemselectedstyle(style)
set pt=Session(SESN_COURIER).createmapxpoint
pt.set x1,y1
dblDistance = Session(SESN_MAPPER).Distance(x1,y1,x2,y2)
set f=Session(SESN_MAPPER).FeatureFactory.CreateCircularRegion( 1, Pt, dblDistance)
set fs=Session(SESN_MAPPER).layers(layername).SearchWithinFeature(f,SearchType)
for each f in fs
49
Session(SESN_MAPPER).Layers(layername).selection.add f
next
end sub

 矩形选择
function SingRectSel(X1,Y1,X2,Y2,Layername, SearchType)
dim fs
dim style
dim f
dim pts
dim bresult
Session(SESN_MAPPER).ExportSelection=true
bresult=systemselectedstyle(style)
bresult= ObjSelOnSingByRect(X1,Y1,X2,Y2,Layername,SearchType,fs)
Set pts = Session(SESN_COURIER).CreateMapXPoints
pts.addxy x1,y1,1
pts.addxy x2,y1,2
pts.addxy x2,y2,3
pts.addxy x1,y2,4
set f=Session(SESN_MAPPER).FeatureFactory.CreateRegion(pts,style)
set fs=Session(SESN_MAPPER).layers(layername).SearchWithinFeature(f,SearchType)
for each f in fs
Session(SESN_MAPPER).Layers(layername).selection.add f
next
end function  

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值