阅读:1753回复:2
如何进行矩形选择
在MO中,如何进行类似于MapInfo的矩形选择呢?多谢支持!
|
|
1楼#
发布于:2003-10-29 08:42
多谢了,我搞定了。
|
|
2楼#
发布于:2003-10-28 15:52
从例子里扒了一段下来,你可以看mo自己带的离子,有个空间查找的例子,实现了多边形,矩形等多种选择。
Dim fr As MapObjects2.Rectangle Set fr = Map1.TrackRectangle Set g_searchSet = Map1.Layers(searchLayer).SearchShape(fr, moEdgeTouchOrAreaIntersect, "") Set g_searchBounds = GetRecordsetBounds(g_searchSet) Set g_searchShape = Nothing ExecuteSearch Sub ExecuteSearch() ' ' We're either searching with a single shape or a ' record set. The search routines don't care so, ' put the search shape(s) in a single variable ' called shapes. ' Dim shapes As Object Set shapes = Nothing If Not g_searchShape Is Nothing Then Set shapes = g_searchShape If Not g_searchSet Is Nothing Then Set shapes = g_searchSet If shapes Is Nothing Then Exit Sub ' reset the selection and execute the search Screen.MousePointer = 11 Set g_selectedFeatures = Nothing If StrComp(List1.List(List1.ListIndex), "Search By Distance") = 0 Then ' Execute the SearchByDistance method on selected layer Set g_selectedFeatures = Map1.Layers(Combo2.ListIndex).SearchByDistance(shapes, Text1.Text, "") Else ' Execute the selected SearchByShape method on selected layer Set g_selectedFeatures = Map1.Layers(Combo2.ListIndex).SearchShape(shapes, List1.ListIndex, "") End If Set g_selectedBounds = GetRecordsetBounds(g_selectedFeatures) Map1.TrackingLayer.Refresh True Screen.MousePointer = 0 End Sub |
|
|