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

MAPX查找最近的实体[转帖]

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

Private Sub Command1_Click()
Map1.CurrentTool = 101
End Sub


Private Sub cmdQuit_Click()
End
End Sub


Public Function Nearest(ByVal objMap As Map, ByVal strSearchLayer As String, _
ByVal dblX As Double, ByVal dblY As Double, ByVal sngRadius As Single, _
strItemName As String, X1 As Double, Y1 As Double, X2 As Double, Y2 As Double) As Integer
' Returns the name and location of the closest item from the search layer.
' objMap: the MapX object containing the search layer
' strSearchLayer: The layer being searched
' dblX,dblY: Coordinates of where to center the search
' sngRadius: the initial size ring in km MapX will select from within
' strItemName: Name of closest feature item
' x1,y1,x2,y2: Coordinates of closest feature item
Dim sngLowestDist As Single, sngTemp As Single
Dim iTimesThrough As Integer
Dim ft As New MapXlib.Feature
Dim rect As New MapXlib.Rectangle
Dim first As Integer

'Select all of the objects within Radius km of dblX,Y
'If there's nothing there, double the radius and try again.
'Repeat until something is found, or we ran through this 10 times
iTimesThrough = 1
Do
'execute the SelectByRadius method of MapX
objMap.Layers(strSearchLayer).Selection.SelectByRadius dblX, dblY, sngRadius, miSelectionNew
'Double the radius for the next search (if needed)
sngRadius = sngRadius * 2
'Increment our counter
iTimesThrough = iTimesThrough + 1

Loop Until objMap.Layers(strSearchLayer).Selection.Count > 0 Or iTimesThrough > 10
'Test to see if there was anything selected
If objMap.Layers(strSearchLayer).Selection.Count = 0 Then
Nearest = False
Exit Function
End If
'Find closest feature in selection collection
first = True
For Each ft In objMap.Layers(strSearchLayer).Selection
'get the distance to the selected object
sngTemp = objMap.Distance(dblX, dblY, ft.CenterX, ft.CenterY)
'is thi

[1] [2] 下一页

  特别声明:本站除部分特别声明禁止转载的专稿外的其他文章可以自由转载,但请务必注明出处和原始作者。文章版权归文章原始作者所有。对于被本站转载文章的个人和网站,我们表示深深的谢意。如果本站转载的文章有版权问题请联系编辑人员,我们尽快予以更正。本站所有技术文章、专业软件资料仅供技术人员、高校师生学习交流之用,目的旨在促进与提高中国的交通技术水平;用户获取后不得用于商业目的,否则,所产生的法律责任本站概不负责。
责任编辑:七星
发表评论】【加入收藏】【打印此文
相关内容
Mapbasic参考手册索引(转载)
mapx基本学习教程
MAPX中SearchWithin 和 SelectByRegion 方法的使用
MAPX确定两区域间叠加部分面积大小
MAPX地图与数据库中有一字段相同,将它们关联起来
>>> 热点资料
·徐州市主城区轨道线网规划
·智能交通电子警察与城市道路监控系统
·哈尔滨市举办2009年大冬会交通规划探讨
·公交智能化整体方案(大量实际效果图)
·微观交通仿真并行化方法与策略_
·安蒙德机动车视频电子警察系统解决方案--纯视频机
·中小城市交通特性与交通模式研究
·DynaCHINA动态网络交通分析与实时路况预测软件介
·长沙市城区道路交通拥堵的特点、成因及对策
·试论大型活动的交通保卫与交通组织
>>> 推荐资料
·区域停车诱导系统解决方案
·哈尔滨市举办2009年大冬会交通规划探讨
·DynaCHINA动态网络交通分析与实时路况预测软件介
·中国射频识别(RFID)技术政策白皮书
·伦敦市道路拥挤收费政策解析
·香港地铁屏蔽门系统考察研究
·我国城市轨道交通主要投融资模式及创新思路
·加拿大留学申请程序
·国家地理信息标准化“十一五”规划
·美国地方政府的规划实践(1)
>>> 交通图库

四层车道桥,你还见过更高的吗?

太阳能急转标志牌

太阳能施工导向车(推拉式)

太阳能施工导向牌
>>> 博客交通
·区域停车诱导系统解决方案
·哈尔滨市举办2009年大冬会交通规划探讨
·DynaCHINA动态网络交通分析与实时路况预测软件介
·中国射频识别(RFID)技术政策白皮书
·伦敦市道路拥挤收费政策解析
·香港地铁屏蔽门系统考察研究
·我国城市轨道交通主要投融资模式及创新思路
·加拿大留学申请程序
·国家地理信息标准化“十一五”规划
·美国地方政府的规划实践(1)
网友评论:(评论内容只代表网友观点,与本站立场无关!)
  请遵守《互联网电子公告服务管理规定》及中华人民共和国其他各项有关法律法规。