如何進行空間查詢

2021-04-15 21:52:56 字數 2128 閱讀 9273

如何進行空間查詢

要點

通過rubberpolygon類來實現介面irubberband介面物件,用irubberband.tracknew方法在圖層上畫出polygon,然後定義igeometry獲得該polygon,建立ispatialfilter介面物件實現過濾功能,通過ilayer介面例項獲得ifeatureselection介面,呼叫ifeatureselection.selectfeatures方法將結果高亮顯示。

程式說明

過程uitoolcontrol1_mousedown是實現模組。

**

option explicit

private function uitoolcontrol1_deactivate() as boolean

uitoolcontrol1_deactivate = true

end function

private sub uitoolcontrol1_mousedown(byval button as long, byval shift as long, _

byval x as long, byval y as long)

dim pmxdoc as imxdocument

dim pactiveview as iactiveview

dim pscreendisplay as iscreendisplay

dim prubberpolygon as irubberband

dim pfillsymbol as i******fillsymbol

dim prgbcolor as irgbcolor

dim ppolygon as ipolygon

dim pgeometry as igeometry

dim pfeatselect as ifeatureselection

dim pspatialfilter as ispatialfilter

on error goto errorhandler:

set pmxdoc = thisdocument

set pactiveview = pmxdoc.focu**ap

'draw polygon

set pscreendisplay = pactiveview.screendisplay

set prubberpolygon = new rubberpolygon

set pfillsymbol = new ******fillsymbol

set prgbcolor = new rgbcolor

prgbcolor.nullcolor = true

pfillsymbol.color = prgbcolor

set ppolygon = prubberpolygon.tracknew(pscreendisplay, pfillsymbol)

with pscreendisplay

.startdrawing pscreendisplay.hdc, esrinoscreencache

.setsymbol pfillsymbol

.drawpolygon ppolygon

.finishdrawing

end with

'set up pfilter

set pgeometry = ppolygon

set pspatialfilter = new spatialfilter

with pspatialfilter

set .geometry = pgeometry

.spatialrel = esrispatialrelintersects

end with

'select

set pfeatselect = pmxdoc.focu**ap.layer(0)

pfeatselect.selectfeatures pspatialfilter, esriselectionresultnew, false

pfeatselect.selectionset.**

pmxdoc.activeview.**

exit sub

errorhandler:

msgbox err.description

end sub

如何進行多表查詢

a.多表查詢 查詢分數在80 90分的學生的學號 姓名 分數 select student info.學號,student info.姓名,grade.分數 from student info,grade where grade.分數 between 80 and 90 查詢學習了 c語言 課程的學...

Oracle如何進行分頁查詢

在學習mysql時,我們對於查詢結果顯示可以使用limit來達到顯示前幾條資料或者分頁的效果,例如查詢員工表中編號前10的員工為 select from emp e order by e.id limit 0,10 注意0是開始index,10代表顯示10條 所以在實際應用中應該是這樣用的 sele...

wps如何進行查詢替換

wps進行查詢替換的方法 首先開啟文件 然後在開始工具欄中找到查詢替換,或者直接快捷鍵 ctrl f 最後點選查詢或替換即可。wps進行查詢替換的方法 1 首先,將wps軟體開啟,輸入一段文字或者直接開啟乙個編輯好的wps文件。2 在開始工具欄中找到查詢替換,或者直接快捷鍵ctrl f 查詢 ctr...