xjtuandrew
路人甲
路人甲
  • 注册日期2003-10-07
  • 发帖数56
  • QQ
  • 铜币264枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1629回复:2

如何进行矩形选择

楼主#
更多 发布于:2003-10-28 15:36
在MO中,如何进行类似于MapInfo的矩形选择呢?多谢支持!
喜欢0 评分0
gis
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15947
  • QQ554730525
  • 铜币25339枚
  • 威望15364点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
1楼#
发布于: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
举报 回复(0) 喜欢(0)     评分
xjtuandrew
路人甲
路人甲
  • 注册日期2003-10-07
  • 发帖数56
  • QQ
  • 铜币264枚
  • 威望0点
  • 贡献值0点
  • 银元0个
2楼#
发布于:2003-10-29 08:42
多谢了,我搞定了。
举报 回复(0) 喜欢(0)     评分
游客

返回顶部