Set searchlayer =
Map1.Layers(nodelayerindex)
Set curfeatures =
searchlayer.SearchAtPoint(pt)
Map1.Layers(nodelayerindex).Selection.Add curfeatures
Set pt = Nothing
Set curfeatures = Nothing
Set obj = Nothing
Case Else
End Select
ptcount = Map1.Layers(nodelayerindex).
Selection.Count
If ptcount = 2 Then MsgBox ("已经指定起点、终点了,请进行最短路径查询!")
End Sub
Private Sub searchshortestpath_Click()
'查询最短路径
Dim i As Integer
ReDim yjdb(1 To nNode) As Boolean,
ReDim distvector(1 To nNode) As Double
tempstartno = StartNo: tempendno = EndNo
For i = 1 To nNode
'初始化永久标号标志yjdb()
If i = tempstartno Then
yjdb(i) = True '让起点获得永久标号
Else
yjdb(i) = False
End If
Next i
distvector(tempstartno) = 0 '起点距离赋0
For i = 1 To nNode
'初始化每个节点与起点的距离
If flagMatrix(tempstartno, i) = True Then
distvector(i) = distmatrix(tempstartno, i) Else
distvector(i) = 1E+38
End If
Next i
isall = isallyjdb
Do While (isall = False) '对应算法步骤4
Call minnode '算法步骤2
Call gbdb '算法步骤3
isall = isallyjdb
If isall = True Then '节点都获得永久标号
shortestdist = distvector(EndNo)
txtresultlength.Text = shortestdist
End If
|