时间: 2021-07-31 作者:daque
1、本步调实行从下列表中采用一个节点,并以此节点为重心进前进行定位的功效(范例以第一层rtuname属性的值举行查问)
private sub command1_click() dim findobj as mapxlib.find dim foundfeature as findfeature '从要查问的rtu图层天生find东西,并为这个东西树立要查问的finddataset、findfield属性 set findobj = form1.map1.layers.item(1).find set findobj.finddataset = form1.map1.datasets("rtu节点" & " dataset") set findobj.findfield = findobj.finddataset.fields("rtuname") set foundfeature = findobj.search(combo1.text) me.hide ' 关掉autoredraw是由于centerx(y)的变换就要革新图层,autoredraw翻开的话会形成二次革新 form1.map1.autoredraw = false form1.map1.centerx = foundfeature.centerx form1.map1.centery = foundfeature.centery form1.show end sub
2、把上头的步调略微改写一下,实行依照用户输出的字段举行查问定位的功效:
private sub command2_click()
dim findobj as mapxlib.find dim foundfeature as findfeature '从要查问的rtu图层天生find东西,并为这个东西树立要查问的finddataset、findfield属性 set findobj = form1.map1.layers.item(1).find set findobj.finddataset = form1.map1.datasets("rtu节点" & " dataset") set findobj.findfield = findobj.finddataset.fields("rtuname") set foundfeature = findobj.search(text1.text) if foundfeature.findrc mod 10 = 1 or foundfeature.findrc mod 10 = 2 then me.hide ' 关掉autoredraw是由于centerx(y)的变换就要革新图层,autoredraw翻开的话会形成二次革新 form1.map1.autoredraw = false form1.map1.centerx = foundfeature.centerx form1.map1.centery = foundfeature.centery form1.show else msgbox "不生存该rtu节点!" end if end sub