📄 clock.cls
字号:
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "CLock"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Private nFilterMode As Integer
Private oTarget As New CTarget
Private i As Long
Private oMapLayer As MapLayer
Private m_strRoadLayer As String
Private yyy As Long
Private m_lLockedLine As Long
Private Temp_jd2 As Double
Private Temp_wd2 As Double
Public Function LockStree(ByVal Temp_jd As Double, ByVal Temp_wd As Double) As Boolean
Dim j As Long
Dim oTarget As New CTarget
Dim oRecord As New CRecord
Dim i As Long
Dim nnn As Long
''ReDim yyy(Road) As Long
yyy = 1000000
oRecord.fLongitude = Temp_jd
oRecord.fLatitude = Temp_wd
For j = 1 To Road
m_strRoadLayer = CStr(100 + j)
For i = 1 To MDIMainForm.oTargetManager.GetCount
Set oTarget = MDIMainForm.oTargetManager.GetTargetByIndex(i)
oTarget.SetFilterMode nFilterMode
oTarget.SetMaxStepDistance Val("1000")
oTarget.SetMinStepDistance Val("0")
oTarget.SetLlx ("0")
oTarget.SetLly ("0")
oTarget.SetUrx ("0")
oTarget.SetUry ("0")
oTarget.SetRoadLayer (m_strRoadLayer)
Next
GetFilterRecord oRecord, j 'Temp_jd, Temp_wd
Next
''nnn = yyy
Temp_jd1 = Temp_jd2
Temp_wd1 = Temp_wd2
'MDIMainForm.Caption = CStr(nnn)
If yyy < Howlong Then
LockStree = True
Else
LockStree = False
End If
If yyy = 0 Then
LockStree = False
End If
End Function
Private Function GetFilterRecord(ByVal oRecord As CRecord, ByVal j As Long)
Dim oFilterRecord As New CRecord
''Dim m_lLockedLine(Road) As Long
''Dim Temp_jd2(Road) As Double
''Dim Temp_wd2(Road) As Double
Dim uuu As Long
oFilterRecord.CopyRecord oRecord
Dim oMapLayer As MapLayer
Dim oShapePoint As New ShapePoint
Dim oShapeLine As New ShapeLine
Dim oShape1 As New ShapePoint
oShapePoint.X = oRecord.fLongitude
oShapePoint.Y = oRecord.fLatitude
oShape1.X = oRecord.fLongitude
oShape1.Y = oRecord.fLatitude
Dim oEntity As Entity
Set oMapLayer = MDIMainForm.oSpaDB.MapLayers(m_strRoadLayer)
Set oEntity = MDIMainForm.oSpaDB.Entities(0)
If oMapLayer.IsValid Then
If oEntity.Load(m_lLockedLine) Then
If oEntity.DistanceToShape(oShapePoint) > 100 Then
Set oEntity = oMapLayer.SelectNearest(oShapePoint, meShapeLine)
End If
Else
Set oEntity = oMapLayer.SelectNearest(oShapePoint, meShapeLine)
End If
If oEntity.IsValid Then
m_lLockedLine = oEntity.GetOID
Set oShapeLine = oEntity.Shape
Set oShapePoint = oShapeLine.ClosestPoint(oShapePoint.X, oShapePoint.Y)
oFilterRecord.fLongitude = oShapePoint.X
oFilterRecord.fLatitude = oShapePoint.Y
uuu = MonitorForm.oCompoundMap.Distance(oShape1, oShapePoint)
If yyy > uuu Then
yyy = uuu
Temp_wd2 = oFilterRecord.fLatitude
Temp_jd2 = oFilterRecord.fLongitude
End If
End If
End If
Set oMapLayer = Nothing
Set oEntity = Nothing
Set oShapeLine = Nothing
Set oShapePoint = Nothing
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -