Code : Tout sélectionner
#include <Google Maps.au3>
Dim $gmap
; Setup Main GUI
$main_gui = GUICreate("BM'Géocodage", 800, 600, -1, -1, BitOR($WS_SIZEBOX, $WS_MAXIMIZEBOX))
$gmap_ctrl = _GUICtrlGoogleMap_Create($gmap, 0, 10, 800, 430, "Avignon, France", 15, True, 0, 2, 1, 1)
GUICtrlSetResizing($gmap_ctrl, $GUI_DOCKTOP)
Global $Group1 = GUICtrlCreateGroup(" Géocodage ", 70, 456, 316, 80)
Global $Label1 = GUICtrlCreateLabel("Adresse ", 78, 480, 45, 17)
Global $Input_adresse = GUICtrlCreateInput("", 126, 480, 249, 21)
Global $Btn_geocoder = GUICtrlCreateButton("Géocoder", 301, 504, 75, 25, $WS_GROUP)
Global $Label4 = GUICtrlCreateLabel("Ex. : Paris, France", 77, 508, 175, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
Global $Group2 = GUICtrlCreateGroup(" Coordonnées GPS ", 438, 456, 316, 104)
Global $Label2 = GUICtrlCreateLabel("Latitude", 446, 483, 42, 17)
Global $Label3 = GUICtrlCreateLabel("Longitude", 446, 503, 51, 17)
Global $Input_lat= GUICtrlCreateInput("", 508, 480, 121, 21)
Global $Input_long = GUICtrlCreateInput("", 508, 504, 121, 21)
Global $Btn_afficher = GUICtrlCreateButton("Afficher", 639, 529, 75, 25, $WS_GROUP)
Global $Label5 = GUICtrlCreateLabel("Ex. : 43.9486126", 635, 481, 67, 17)
Global $Label6 = GUICtrlCreateLabel("Ex. : 4.8059666", 639, 511, 67, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
GUISetAccelerators($main_gui)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Btn_geocoder
If GUICtrlRead($Input_adresse)="" Then
MsgBox(0,"","Merci de renseigner l'adresse")
ContinueLoop
EndIf
$Adresse_val=GUICtrlRead($Input_adresse)
$Tab_position=_GUICtrlGoogleMap_GetLatLng($Adresse_val)
_GUICtrlGoogleMap_AddMarker($gmap, $Adresse_val,"") ; Ajoute un marqueur
_GUICtrlGoogleMap_SetView($gmap, $Adresse_val) ; Affiche l'adresse
_GUICtrlGoogleMap_ZoomView($gmap, 15) ; Zoom : 15 > Quartier
; Affiche les coordonnées GPS
GUICtrlSetData($Input_lat,$Tab_position[0])
GUICtrlSetData($Input_long,$Tab_position[1])
Case $Btn_afficher
If GUICtrlRead($Input_lat)="" Then
MsgBox(0,"","Merci de renseigner la latitude")
ContinueLoop
EndIf
If GUICtrlRead($Input_long)="" Then
MsgBox(0,"","Merci de renseigner la longitude")
ContinueLoop
EndIf
$coordonnees=GUICtrlRead($Input_lat) & " " & GUICtrlRead($Input_long)
_GUICtrlGoogleMap_AddMarker($gmap, $coordonnees,"")
_GUICtrlGoogleMap_SetView($gmap, $coordonnees)
_GUICtrlGoogleMap_ZoomView($gmap, 15)
EndSwitch
Sleep(100)
WEnd