⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmcheckdestination.frm

📁 用VB开发的巡检系统基于MAPINFo用VB开发的巡检系统基于MAPINFo很好的
💻 FRM
📖 第 1 页 / 共 2 页
字号:
   End
   Begin VB.Label Label3 
      AutoSize        =   -1  'True
      Caption         =   "对象样式:"
      Height          =   180
      Left            =   5280
      TabIndex        =   15
      Top             =   1770
      Width           =   810
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      Caption         =   "目标图层:"
      Height          =   180
      Left            =   210
      TabIndex        =   8
      Top             =   180
      Width           =   900
   End
End
Attribute VB_Name = "frmCheckDestination"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

'展绘对象图形
Private Sub Command1_Click()
    Dim TableName As String
    Dim i As Integer, n As Integer
    Dim mX As Single, mY As Single
    Dim X() As Single, Y() As Single
    
    n = Me.VSFlexGrid1.Rows
    If Me.VSFlexGrid1.Rows = 1 Then Exit Sub
    
    '设置可编辑的图层
    i = CInt(MapInfo.Eval("MapperInfo(" & mapWinID & "," & MAPPER_INFO_EDIT_LAYER & ")"))
    
    If (i >= 0) Then '有可编辑图层
    
        TableName = MapInfo.Eval("LayerInfo(" & mapWinID & "," & i & ",1)")
        
        If UCase$(TableName) <> UCase$(Me.Combo2.Text) Then
        
            MsgBox "请设置图层[" & Me.Combo2.Text & "]为可编辑图层状态!", vbInformation, "提示"
            Exit Sub
        End If
    Else '无可编辑图层
        MsgBox "请设置图层[" & Me.Combo2.Text & "]为可编辑状态!", vbInformation, "提示"
        Exit Sub
    End If

    '对数据进行校验
    'CheckData
    If Me.Combo3.Text = "点" Then
    
        For i = 1 To n - 1
            mY = Val(Me.VSFlexGrid1.TextMatrix(i, 1)) '纬度
            mX = Val(Me.VSFlexGrid1.TextMatrix(i, 2)) '经度
            '展点
            CreatePoint mX, mY '参数为经度、纬度
        Next
        
    ElseIf Me.Combo3.Text = "线" Then
        ReDim X(n - 1) As Single, Y(n - 1) As Single
        For i = 1 To n - 1
            X(i) = Val(Me.VSFlexGrid1.TextMatrix(i, 1))
            Y(i) = Val(Me.VSFlexGrid1.TextMatrix(i, 2))
        Next
        '展多义线
        CreatePLine X, Y, n - 1, False
        
    ElseIf Me.Combo3.Text = "面" Then
        ReDim X(n - 1) As Single, Y(n - 1) As Single
        For i = 1 To n - 1
            X(i) = Val(Me.VSFlexGrid1.TextMatrix(i, 1))
            Y(i) = Val(Me.VSFlexGrid1.TextMatrix(i, 2))
        Next
        '展面
        CreateRegion X, Y, n - 1
        
    End If
    MsgBox "展绘目标对象完毕!"
End Sub

Private Sub Command2_Click()
    Unload Me
End Sub

Private Sub Command3_Click()
    Me.VSFlexGrid1.Rows = Me.VSFlexGrid1.Rows + 1
    Me.VSFlexGrid1.TextMatrix(Me.VSFlexGrid1.Rows - 1, 0) = Me.VSFlexGrid1.Rows - 1
End Sub

Private Sub Command4_Click()
    If Me.VSFlexGrid1.Rows = 1 Then Exit Sub
    Me.VSFlexGrid1.Rows = Me.VSFlexGrid1.Rows - 1
End Sub

Private Sub Command5_Click()
    '导入Garmin数据文件
    Dim strFile As String
    With Me.CommonDialog1
        .DialogTitle = "打开Garmin数据文件"
        .CancelError = False
        .Filter = "*.txt|*.txt"
        .InitDir = App.Path
        .FileName = ""
        .ShowOpen
        strFile = .FileName
    End With
    If strFile = "" Then Exit Sub
    If Dir$(strFile, vbDirectory) = "" Then Exit Sub
    DealWith_GarminData_Waypoint ByVal strFile
End Sub

Private Sub Form_Load()
    '获取图层
    GetLayerName Me.Combo2
    
    Me.Combo1.AddItem "WGS-84坐标系"
    'Me.Combo1.AddItem "54北京坐标系"
    'Me.Combo1.AddItem "80西安坐标系"
    Me.Combo1.Text = Me.Combo1.List(0)

    Me.Combo3.Text = Me.Combo3.List(0)
    
    With Me.VSFlexGrid1
        .Cols = 3
        .TextMatrix(0, 0) = "序号"
        .TextMatrix(0, 1) = "经度"
        .TextMatrix(0, 2) = "纬度"
        .ColAlignment(0) = flexAlignCenterCenter
        .ColAlignment(1) = flexAlignCenterCenter
        .ColAlignment(2) = flexAlignCenterCenter
        .ColWidth(0) = 800
        .ColWidth(1) = 1900
        .ColWidth(2) = 1900
        
        .Editable = flexEDKbdMouse
        
        '.Rows = 50
    End With
    
    Command5.Enabled = False '倒入数据按钮不可操作
    
'    Command4.Enabled = False '删除
'
'    Command1.Enabled = False '展绘
    
    '测试数据
'    With Me.VSFlexGrid1
'        .Rows = 6
'
'        .TextMatrix(1, 0) = "1"
'        .TextMatrix(1, 2) = "51.9676"
'        .TextMatrix(1, 1) = "123.896"
'
'        .TextMatrix(2, 0) = "2"
'        .TextMatrix(2, 2) = "51.8074"
'        .TextMatrix(2, 1) = "125.696"
'
'        .TextMatrix(3, 0) = "3"
'        .TextMatrix(3, 2) = "50.1335"
'        .TextMatrix(3, 1) = "126.609"
'
'        .TextMatrix(4, 0) = "4"
'        .TextMatrix(4, 2) = "48.9404"
'        .TextMatrix(4, 1) = "125.212"
'
'        .TextMatrix(5, 0) = "5"
'        .TextMatrix(5, 2) = "48.9047"
'        .TextMatrix(5, 1) = "127.926"
'
'    End With
End Sub

Private Sub Form_Resize()
    If Me.WindowState = 1 Then Exit Sub
    Me.Height = 6720
    Me.Width = 7080
End Sub

Private Sub Option1_Click(Index As Integer)
    If Index = 0 Then
        Command5.Enabled = False
    Else
        Command5.Enabled = True
    End If
End Sub

'//deal with garmin data file (wcs)处理garmin数据格式文件--waypoint
'//根据garmin的数据进行处理,然后在地图上实时移动目标
'//数据:hddd°mm.mmm'
'//参数:Garmin数据文件
Sub DealWith_GarminData_Waypoint(ByVal tmpFile As String)
    Dim strline As String, strHeadID As String, strChr() As String
    Dim lenStrLine As Integer, i As Integer, n As Integer, chrOne As String, cou As Integer
    Dim strPointID As String
    Dim dLatitude As Double, dLongitude As Double
    Dim iRow As Integer
    
    Open tmpFile For Input As #1
    Do Until EOF(1)
        Line Input #1, strline
        'Debug.Print strline
        strHeadID = Mid$(strline, 1, Len("Waypoint"))
        If UCase$(strHeadID) = UCase$("Waypoint") Then
             lenStrLine = Len(strline)
             For i = 1 To lenStrLine
                chrOne = Mid$(strline, i, 1)
                If Asc(chrOne) = vbKeyTab Then
                    If n > 0 Then
                        cou = cou + 1
                        ReDim Preserve strChr(cou)
                        strChr(cou - 1) = Trim(Mid$(strline, i - n, n))
                        'Debug.Print strChr(cou - 1)
                        n = 0
                    End If
                Else
                    n = n + 1
                End If
             Next
             cou = 0: n = 0
             '//Waypoint
             If UCase$(strChr(0)) = UCase$("Waypoint") Then
                strPointID = CStr(strChr(1)) '//点号
                dLatitude = GetLatOrLong(strChr(3), 0) 'latitude
                dLongitude = GetLatOrLong(strChr(3), 1) 'longitude
                'Debug.Print strPointID, dLatitude, dLongitude
                Me.VSFlexGrid1.Rows = Me.VSFlexGrid1.Rows + 1
                iRow = Me.VSFlexGrid1.Rows
                With VSFlexGrid1
                    .TextMatrix(iRow - 1, 0) = strPointID
                    .TextMatrix(iRow - 1, 1) = dLatitude
                    .TextMatrix(iRow - 1, 2) = dLongitude
                End With
             End If
        End If
    Loop
    Close #1
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -