Quantcast
Channel: DotSpatial
Viewing all articles
Browse latest Browse all 3973

New Post: how to centre mapwindow around a certain coordinate?

$
0
0
I have a working application which primarly now converts database data to shapes and projects them in the dutch coordinate system on the mapwindow.

Now i made a button which looks up a certain ID-point in de database and I would like to jump to this point on the mapwindow where this point is in the centre....

Below u see the part of the code where here
            Dim XRekenpunt As Object = dtSwungRekenpunt.Rows.Item(0).Item("X")
            Dim YRekenpunt As Object = dtSwungRekenpunt.Rows.Item(0).Item("Y")
I succesfully managed to retrieve the coordinates.... so how to centre the window on this point...? Can anyone give me ideas?

Thx Joska
    Private Sub btnZoekMachine_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnZoekMachine.Click
        Dim strPadFile As String
        Dim ZoekRekenpunt As Long

        strPadFile = ""
        Try
            If DMC_DatabaseType = "SWUNG" Then
                strPadFile = lblPadFileSwung.Text
            ElseIf DMC_DatabaseType = "BOOGIE" Then
                strPadFile = lblPadFileBoogie.Text
            End If
            ZoekRekenpunt = Val(txtRekenpunt.Text)
            '--------------------------------------------------------------------------------------------
            'ZOEK DE SWUNG REKENPUNT in de database
            If DMC_DatabaseType = "SWUNG" And rbtZoekrekenpunt.Checked = True Then
                'Maak een nieuwe datatabel voor eventueel gevonden rekenpunten
                Dim dtSwungRekenpunt As New DataTable()
                'Maak een connectie met de database en vul de tabel
                Dim conSwungDatabase As New System.Data.OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & strPadFile & ";Persist Security Info=False;User Id=admin;Password=;")
                conSwungDatabase.Open()
                Using cmd As New System.Data.OleDb.OleDbCommand()
                    cmd.Connection = conSwungDatabase
                    cmd.CommandText = "SELECT tblWaarneempunten.ID, tblWaarneempunten.X, tblWaarneempunten.Y " _
                    & "FROM tblWaarneempunten " _
                    & "WHERE (((tblWaarneempunten.ID)= " & ZoekRekenpunt & "));"
                    Dim rdrR As System.Data.OleDb.OleDbDataReader = cmd.ExecuteReader()
                    dtSwungRekenpunt.Load(rdrR)
                End Using
                'Sluit de connectie
                conSwungDatabase.Close()
                Dim XRekenpunt As Object = dtSwungRekenpunt.Rows.Item(0).Item("X")
                Dim YRekenpunt As Object = dtSwungRekenpunt.Rows.Item(0).Item("Y")

              SO WHAT MUST GET HERE TO MAKE THE WINDOW CENTRE AROUND THIS POINT POSSIBLE?

            End If

        Catch ex As Exception
            MsgBox(ex.ToString, MsgBoxStyle.Critical, "Fout in btnZoekMachine_Click")
            Return
        End Try
    End Sub

Viewing all articles
Browse latest Browse all 3973

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>