GPS应用论文 第8页

GPS应用的论文
     主窗体地图查询代码
-----------------------------------------------------------------------------------
Public Class FormMap
    Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click
        Dim strSql As String = "select * from street_crossing "
        Dim strSql1 As String
        Dim jing1 As Single
        Dim wei1 As Single
        Dim jing2 As Single
        Dim wei2 As Single
        Dim ds As New DataSet
        Dim dbobj As New ConnSqlServer.db
        Dim dr As System.Data.SqlClient.SqlDataReader
        If txtJingdu.Text = "" Or txtWeidu.Text = "" Then
            MessageBox.Show("经度或纬度不能为空!")
            Exit Sub
        End If
        dr = dbobj.DataReader(strSql)
        While (dr.Read)
            jing1 = dr("j1") - txtJingdu.Text
            wei1 = dr("w1") - txtWeidu.Text
            jing2 = txtJingdu.Text - dr("j2")
            wei2 = txtWeidu.Text - dr("w2")
            If (jing1 * wei2 = jing2 * wei1 And jing1 * jing2 >= 0) Then
                strSql1 = "select street_name from street_crossing where id =" & dr("id") & ""
                dr = dbobj.DataReader(strSql1)
                dr.Read()
                labStreet.Text = dr("street_name")
              Exit Sub
            End If
        End While
        MessageBox.Show("此处不在任何街道上!")

    End Sub

    Private Sub txtJingdu_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtJingdu.KeyPress
        If e.KeyChar >= "0" And e.KeyChar <= "9" Or e.KeyChar = Chr(Keys.Back) Or e.KeyChar = Chr(46) Then
            e.Handled = False
        Else
            e.Handled = True
        End If
    End Sub

    Private Sub txtWeidu_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtWeidu.KeyPress
        If e.KeyChar >= "0" And e.KeyChar <= "9" Or e.KeyChar = Chr(Keys.Back) Or e.KeyChar = Chr(46) Then
            e.Handled = False
        Else
            e.Handled = True
        End If
    End Sub

    Private Sub btnMin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMin.Click
        If txtStreet.Text = txtEnd.Text And txtEnd.Text <> "" Then
            MessageBox.Show("起点和中点不能相同!")
            Exit Sub
        ElseIf txtEnd.Text = "" Or txtStreet.Text = "" Then
            MessageBox.Show("街道名不能为空")
            Exit Sub
        End If
        Dim strSql As String = "select * from road "
        Dim strSql1 As String
        Dim strSql2 As String
        Dim i As Integer
        Dim j As Integer
        Dim p As Integer
        Dim wm As Integer
        Dim k As Integer
        Dim n As Integer
        Dim dr1 As System.Data.SqlClient.SqlDataReader
        Dim ds As New DataSet
        Dim dbobj As New ConnSqlServer.db
        Dim dr As System.Data.SqlClient.SqlDataReader
        dr = dbobj.DataReader(strSql)
        While (dr.Read)
            n = n + 1
        End While
        n = n + 1
751com.cn
            For j = 0 To n
                If g(i, j) = 0 Then
                    g(i, j) = 10000
                End If
            Next
        Next
        For i = 0 To n
            For j = 0 To n
                If i = j Then
                    g(i, j) = 0
                End If
            Next
        Next
        strSql1 = "select * from road where street_name =" & txtStreet.Text & ""
        dr = dbobj.DataReader(strSql1)
        If dr.Read Then
            k = dr("e1id")
        Else
            MessageBox.Show("无此街道!")

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]  ... 下一页  >> 

  • 上一篇文章:
  • 下一篇文章:
  • Copyright © 2007-2012 www.chuibin.com 六维论文网 版权所有