>>> 您现在的位置: 中国交通技术网 >> 资料文库 >> 3S技术 >> GIS >> 正文

MAPX中SearchWithin 和 SelectByRegion 方法的使用

更新时间:2007-8-27  来源:tranbbs  作者:佚名  人气:  [ 投稿 ] [投稿帮助
  

下列代码演示了SearchWithin 和 SelectByRegion 方法的使用。

Private Sub cmdQuit_Click()
End
End Sub


Private Sub Command1_Click()
Dim ftr As Feature
Dim ftrs As Features
If Map1.Layers.Item("regions").Selection.Count = 0 Then
MsgBox "Select a yellow region 1st"
Exit Sub
End If
Set ftr = Map1.Layers.Item("regions").Selection.Item(1)
'SearchType: SearchType is miSearchTypeCentroidWithin, miSearchTypePartiallyWithin, or miSearchTypeEntirelyWithin.
Set ftrs = Map1.Layers.Item("pieces").SearchWithinFeature(ftr, miSearchTypePartiallyWithin)
Map1.Layers.Item("pieces").Selection.Add ftrs
Map1.Layers.Item("regions").Selection.ClearSelection
MsgBox ftrs.Count
End Sub


Private Sub Command2_Click()
Dim ftr As Feature
Dim ftrs As Features
Dim lyr As Layer
If Map1.Layers.Item("regions").Selection.Count = 0 Then
MsgBox "Select a yellow region 1st"
Exit Sub
End If
Set lyr = Map1.Layers.Item("regions")
Set ftr = lyr.Selection.Item(1)
'A feature is considered to be within "within" the region if and only if its centroid is within the radius. If more control is needed over selection criteria, use the Layer object's SearchWithinFeature method.
Map1.Layers.Item("pieces").Selection.SelectByRegion lyr, ftr.FeatureID, miSelectionNew
Map1.Layers.Item("regions").Selection.ClearSelection
MsgBox Map1.Layers.Item("pieces").Selection.Count
End Sub


Private Sub Form_Load()
'Add the layer
Map1.Layers.RemoveAll
Map1.Layers.Add App.Path & "\regions.tab"
Map1.Layers.Add App.Path & "\pieces.tab"
Map1.CurrentTool = miSelectTool
'make the map look nice for the sample data
Map1.DisplayCoordSys = Map1.NumericCoordSys
Map1.Title.Visible = False
Map1.Bounds = Map1.Layers.Item("regions").Bounds
End Sub

  特别声明:本站除部分特别声明禁止转载的专稿外的其他文章可以自由转载,但请务必注明出处和原始作者。文章版权归文章原始作者所有。对于被本站转载文章的个人和网站,我们表示深深的谢意。如果本站转载的文章有版权问题请联系编辑人员,我们尽快予以更正。本站所有技术文章、专业软件资料仅供技术人员、高校师生学习交流之用,目的旨在促进与提高中国的交通技术水平;用户获取后不得用于商业目的,否则,所产生的法律责任本站概不负责。
责任编辑:七星
发表评论】【加入收藏】【打印此文
相关内容
Mapbasic参考手册索引(转载)
mapx基本学习教程
MAPX确定两区域间叠加部分面积大小
MAPX地图与数据库中有一字段相同,将它们关联起来
MAPX查找最近的实体[转帖]
>>> 热点资料
·治理交通拥堵需改变传统方式
·上海市交通信息中心及上海市道路交通信息化简况
·2010年上海世博会交通方案
·中国射频识别(RFID)技术政策白皮书
·上海市无障碍设施建设规划(2003-2006)
·美国公路设计理念和典型案例介绍
·收费公路市场结构与定价机制研究
·控制航空公司运营成本的营销策略研究
·国外公交导向开发研究的启示
·TransCAD论文集
>>> 推荐资料
·中国射频识别(RFID)技术政策白皮书
·伦敦市道路拥挤收费政策解析
·香港地铁屏蔽门系统考察研究
·我国城市轨道交通主要投融资模式及创新思路
·加拿大留学申请程序
·国家地理信息标准化“十一五”规划
·美国地方政府的规划实践(1)
·北京市2000年以来交通管理相关数字
·北京道路交通管理史上的“第一”(二十世纪七十年
·磁浮技术与发展
>>> 交通图库

土耳其交通游(4)

土耳其交通游(3)

土耳其交通游(2)

土耳其交通游(1)
>>> 博客交通
·中国射频识别(RFID)技术政策白皮书
·伦敦市道路拥挤收费政策解析
·香港地铁屏蔽门系统考察研究
·我国城市轨道交通主要投融资模式及创新思路
·加拿大留学申请程序
·国家地理信息标准化“十一五”规划
·美国地方政府的规划实践(1)
·北京市2000年以来交通管理相关数字
·北京道路交通管理史上的“第一”(二十世纪七十年
·磁浮技术与发展
网友评论:(评论内容只代表网友观点,与本站立场无关!)
  请遵守《互联网电子公告服务管理规定》及中华人民共和国其他各项有关法律法规。