#include-once #include #include #include #include #include #Region Header #cs Title: Google Maps v2 UDF Library for AutoIt3 Filename: Google Maps v2.au3 Description: A collection of functions for creating and controlling a Google Maps control in AutoIT Author: seangriffin/Igor Kerekeš Version: V2.1 Last Update: 2013-11-23 Requirements: AutoIt3 3.2 or higher Changelog: N/A #ce #EndRegion Header #Region Global Variables and Constants Global $gmap, $geocode_line, $bounds Global $country = False, $address_is_latlng = False #EndRegion Global Variables and Constants #Region Core functions #region _GUICtrlGoogleMap_GetLatLng() ; #FUNCTION# ;=============================================================================== ; Name...........: _GUICtrlGoogleMap_GetLatLng() ; Description ...: Converts an address into a latitude and longitude array. ; Syntax.........: _GUICtrlGoogleMap_GetLatLng($address) ; Parameters ....: $address - the address (either a location or latitude and longitude) to convert ; ie. both "Sydney, New South Wales, Australia" and "-34.397, 150.644" are valid. ; Return values .: On Success - Returns an array with the latitude and longitude of the address. ; On Failure - Returns False. ; Author ........: seangriffin ; Modified.......: Igor Kerekeš ; Remarks .......: ; Related .......: ; Link ..........: ; ;========================================================================================== func _GUICtrlGoogleMap_GetLatLng($address) Local $latlng[2], $latlng_search = 0, $address_part, $oHTTP, $HTMLSource $address_part = StringSplit($address, ",") _ArrayDelete($address_part, 0) ; if the geocode is a lat long if UBound($address_part) = 2 and IsNumber($address_part[0]) = True and IsNumber($address_part[1]) = True Then $address_is_latlng = True $latlng[0] = StringStripWS($address_part[0], 3) $latlng[1] = StringStripWS($address_part[1], 3) Else ; convert the address to a lat long $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("GET","http://maps.google.com/maps/api/geocode/json?address=" & $address & "&sensor=false&") $oHTTP.Send() $HTMLSource = $oHTTP.Responsetext $geocode_line = StringSplit($HTMLSource, @LF, 1) ;_ArrayDisplay($geocode_line) For $latlng_search = 1 To $geocode_line[0] If StringInStr($geocode_line[$latlng_search], """location"" : {") Then $latlng[0] = $geocode_line[$latlng_search + 1] $latlng[0] = StringStripWS(StringReplace(StringReplace($latlng[0], """lat"" :", ""), ",", ""), 3) $latlng[1] = $geocode_line[$latlng_search + 2] $latlng[1] = StringStripWS(StringReplace(StringReplace($latlng[1], """lng"" :", ""), ",", ""), 3) EndIf ;if location is country... If StringInStr($geocode_line[$geocode_line[0] - 5], " ""types"" : [ ""country"", ""political"" ]") Then $country = True ;~ $bounds[0] = $geocode_line[$geocode_line[0] - 25] ;~ $bounds[0] = StringStripWS(StringReplace(StringReplace($bounds[0], """lat"" :", ""), ",", ""), 3); <== SW lat ;~ $bounds[1] = $geocode_line[$geocode_line[0] - 24] ;~ $bounds[1] = StringStripWS(StringReplace(StringReplace($bounds[1], """lng"" :", ""), ",", ""), 3); <== SW lng ;~ $bounds[2] = $geocode_line[$geocode_line[0] - 29] ;~ $bounds[2] = StringStripWS(StringReplace(StringReplace($bounds[2], """lat"" :", ""), ",", ""), 3); <== NE lat ;~ $bounds[3] = $geocode_line[$geocode_line[0] - 28] ;~ $bounds[3] = StringStripWS(StringReplace(StringReplace($bounds[3], """lng"" :", ""), ",", ""), 3); <== NE lng EndIf Next EndIf Return $latlng EndFunc #endregion #region _GUICtrlGoogleMap_Create() ; #FUNCTION# ;=============================================================================== ; Name...........: _GUICtrlGoogleMap_Create() ; Description ...: Creates a Google Map control. ; Syntax.........: _GUICtrlGoogleMap_Create(ByRef $gmap, $left, $top, $width, $height, $address, $zoom = 8, $marker = 1, $streetview = True, $overview_map = false, _ ; $map_type = 0, $navigation_style = 0, $zoom_style = 0, $map_type_style = 0, $scale = 0, $lang = "en", $weather_unit = "C") ; Parameters ....: $gmap - The embedded Google Map object, required by the _GUICtrlGoogleMap functions below. ; $left - The left side of the control. ; $top - The top of the control. ; $width - The width of the control. ; $height - The height of the control. ; $address - An address (either a location or latitude and longitude) to center the map on ; ie. both "Sydney, New South Wales, Australia" and "-34.397, 150.644" are valid. ; $zoom - An initial map zoom level. ; $marker - 0 = Disable the marker for the above address ; 1 = Enable the marker for the above address ; $streetview - A boolean indicating whether a streetview control is Enabled or Disabled. ; $overview_map - A boolean indicating whether a small overview map is Enabled or Disabled ; $map_type - 0 = Sets the map type to standard ; 1 = Sets the map type to satellite ; 2 = Sets the map type to hybrid ; 3 = Sets the map type to terrain ; $navigation_style - 0 = Disable the Navigation control ; 1 = Enable the Navigation control with a small style ; 2 = Enable the Navigation control with a zoom pan style ; 3 = Enable the Navigation control with a android style ; 4 = Enable the Navigation control with a default style ; $zoom_style - 0 = Disable the Zoom control ; 1 = Enable the Zoom control with a small style ; 2 = Enable the Zoom control with a large style ; 3 = Enable the Zoom control with a default style ; $map_type_style - 0 = Disable the MapType control ; 1 = Enable the MapType control with a horizontal bar style ; 2 = Enable the MapType control with a dropdown menu style ; 3 = Enable the MapType control with a default style ; $scale - 0 = Disable the Scale control ; 1 = Enable the Scale control ; $lang - (Optional) ; Sets the language for Google Maps controls, directions and labels localization. ; For available languages see: http://code.google.com/intl/sk/apis/maps/faq.html#languagesupport ; Default language = en ; $weather_unit - Unit for displaying weather conditions ; Default = C (C=CELSIUS, F=FAHRENHEIT) ; Return values .: On Success - Returns the identifier (controlID) of the new control. ; On Failure - Returns False. ; Author ........: seangriffin ; Modified.......: Igor Kerekeš ; Remarks .......: This function must be used before any other function in the UDF is used. ; Related .......: ; Link ..........: ; ;========================================================================================== Func _GUICtrlGoogleMap_Create(ByRef $gmap, $left, $top, $width, $height, $address, $zoom = 8, $marker = 1, $streetview = True, $overview_map = False, $map_type = 0, _ $navigation_style = 0, $zoom_style = 0, $map_type_style = 0, $scale = 0, $lang = "en", $weather_unit = "C") Local $gmap_ctrl, $onload_marker_options, $weather_unit_options If $marker = 1 Then $onload_marker_options = _ " marker = new google.maps.Marker({" & @CRLF & _ " position: latlng, " & @CRLF & _ " map: map," & @CRLF & _ " clickable: false" & @CRLF & _ " });" & @CRLF & _ "// markersArray.push(marker);" Else $onload_marker_options = "" EndIf If $weather_unit = "C" Then $weather_unit_options = "CELSIUS" ElseIf $weather_unit = "F" Then $weather_unit_options = "FAHRENHEIT" EndIf If $address_is_latlng = True Then $bounds = "" Else $bounds = _ " var geocoder = new google.maps.Geocoder();" & @CRLF & _ " geocoder.geocode({""address"": """ & $address & """}, function (results, status) {" & @CRLF & _ " var ne = results[0].geometry.viewport.getNorthEast();" & @CRLF & _ " var sw = results[0].geometry.viewport.getSouthWest();" & @CRLF & _ " map.fitBounds(results[0].geometry.viewport);" & @CRLF & _ " });" EndIf Local Const $navigation_style_html[5] = [ _ "navigationControl: false, ", _ "navigationControl: true, navigationControlOptions: {style: google.maps.NavigationControlStyle.SMALL}, ", _ "navigationControl: true, navigationControlOptions: {style: google.maps.NavigationControlStyle.ZOOM_PAN}, ", _ "navigationControl: true, navigationControlOptions: {style: google.maps.NavigationControlStyle.ANDROID}, ", _ "navigationControl: true, navigationControlOptions: {style: google.maps.NavigationControlStyle.DEFAULT}, "] Local Const $zoom_style_html[4] = [ _ "zoomControl: false, ", _ "zoomControl: true, zoomControlOptions: {style: google.maps.ZoomControlStyle.SMALL}, ", _ "zoomControl: true, zoomControlOptions: {style: google.maps.ZoomControlStyle.LARGE}, ", _ "zoomControl: true, zoomControlOptions: {style: google.maps.ZoomControlStyle.DEFAULT}, "] Local Const $map_type_style_html[4] = [ _ "mapTypeControl: true, ", _ "mapTypeControl: true, mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR}, ", _ "mapTypeControl: true, mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU}, ", _ "mapTypeControl: true, mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DEFAULT}, "] Local Const $map_type_html[4] = [ _ "mapTypeId: google.maps.MapTypeId.ROADMAP", _ "mapTypeId: google.maps.MapTypeId.SATELLITE", _ "mapTypeId: google.maps.MapTypeId.HYBRID", _ "mapTypeId: google.maps.MapTypeId.TERRAIN"] Local Const $scale_html[2] = [ _ "scaleControl: false, ", _ "scaleControl: true, "] Local $latlng[2] $latlng = _GUICtrlGoogleMap_GetLatLng($address) Local $html1a = _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ " Google Maps JavaScript API v3: Directions Draggable" & @CRLF & _ " " & @CRLF & _ " " & @CRLF & _ " " & @CRLF & _ " " & @CRLF & _ " " & @CRLF & _ " " & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "
" & @CRLF & _ "" & @CRLF & _ "" Dim $html = $html1a & $html1b & $html1c & $html1d $gmap = _IECreateEmbedded() $gmap_ctrl = GUICtrlCreateObj($gmap, $left, $top, $width, $height) _IENavigate($gmap, "about:blank", 0) _IEDocWriteHTML($gmap, $html) _IEAction ($gmap, "refresh") Return $gmap_ctrl EndFunc #endregion #region _GUICtrlGoogleMap_ViewLocation() ; #FUNCTION# ;=============================================================================== ; Name...........: _GUICtrlGoogleMap_ViewLocation() ; Description ...: Sets the center of a Google Map to a new address. ; Syntax.........: _GUICtrlGoogleMap_ViewLocation($gmap, $address, $zoom) ; Parameters ....: $gmap - The Google Map object from the function "_GUICtrlGoogleMap_Create". ; $address - An address (either a location or latitude and longitude) to center the map on ; ie. both "Sydney, New South Wales, Australia" and "-34.397, 150.644" are valid. ; $zoom - Map zoom level ; (Optional) [Default = 12] ; Return values .: On Success - Returns True. ; On Failure - Returns False. ; Author ........: seangriffin ; Modified.......: Igor Kerekeš ; Remarks .......: Not the exact location if GPS Coordinates are entered, location is binded to an existing address. ; Related .......: ; Link ..........: ; ;========================================================================================== func _GUICtrlGoogleMap_ViewLocation($gmap, $address, $zoom = 12, $location_marker = 1) $gmap.document.parentWindow.execScript("move_map(""" & $address & """, " & $zoom & ", " & $location_marker & ");") Return True EndFunc #endregion #region _GUICtrlGoogleMap_ViewCoordinates() ; #FUNCTION# ;=============================================================================== ; Name...........: _GUICtrlGoogleMap_ViewCoordinates() ; Description ...: Sets the center of a Google Map to coordinates. ; Syntax.........: _GUICtrlGoogleMap_ViewCoordinates($gmap, $lat, $lng, $zoom) ; Parameters ....: $gmap - The Google Map object from the function "_GUICtrlGoogleMap_Create". ; $lat - Latitude to center the map on ; $lat - Longitude to center the map on ; $zoom - Map zoom level ; (Optional) [Default = 12] ; Return values .: On Success - Returns True. ; On Failure - Returns False. ; Author ........: Igor Kerekeš ; Modified.......: ; Remarks .......: Shows the exact location from GPS coordinates. ; Related .......: ; Link ..........: ; ;========================================================================================== func _GUICtrlGoogleMap_ViewCoordinates($gmap, $lat, $lng, $zoom = 12) $gmap.document.parentWindow.execScript("showCoordinates(" & $lat & ", " & $lng & ", " & $zoom & ");") Return True EndFunc #endregion #region _GUICtrlGoogleMap_ZoomView() ; #FUNCTION# ;=============================================================================== ; Name...........: _GUICtrlGoogleMap_ZoomView() ; Description ...: Zooms the center of a Google Map to a new level. ; Syntax.........: _GUICtrlGoogleMap_ZoomView($gmap, $scale) ; Parameters ....: $gmap - The Google Map object from the function "_GUICtrlGoogleMap_Create". ; $zoom - The level to zoom the view to. ; Return values .: On Success - Returns True. ; On Failure - Returns False. ; Author ........: seangriffin ; Modified.......: Igor Kerekeš ; Remarks .......: ; Related .......: ; Link ..........: ; ;========================================================================================== Func _GUICtrlGoogleMap_ZoomView($gmap, $zoom) $gmap.document.parentWindow.execScript("zoom_map(" & $zoom & ");") Return True EndFunc #endregion #region _GUICtrlGoogleMap_GetMapZoom() ; #FUNCTION# ;=============================================================================== ; Name...........: _GUICtrlGoogleMap_GetMapZoom() ; Description ...: Get the zoom level of the displayed map. ; Syntax.........: _GUICtrlGoogleMap_GetMapZoom($gmap, $get_zoom_level) ; Parameters ....: $gmap - The Google Map object from the function "_GUICtrlGoogleMap_Create". ; $zoom_level - The zoom level of the map. ; Return values .: On Success - Returns zoom level of the map. ; On Failure - Returns False. ; Author ........: Igor Kerekeš ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........: ; ;========================================================================================== Func _GUICtrlGoogleMap_GetMapZoom($gmap) Local $actual_zoom_level $actual_zoom_level = $gmap.document.parentWindow.eval("getMapZoomLevel();") Return $actual_zoom_level EndFunc #endregion #region _GUICtrlGoogleMap_AddMarker() ; #FUNCTION# ;=============================================================================== ; Name...........: _GUICtrlGoogleMap_AddMarker() ; Description ...: Adds a marker to a Google Map. ; Syntax.........: _GUICtrlGoogleMap_AddMarker($gmap, $address) ; Parameters ....: $gmap - The Google Map object from the function "_GUICtrlGoogleMap_Create". ; $address - An address (either a location or latitude and longitude) to add the marker to ; ie. both "Sydney, New South Wales, Australia" and "-34.397, 150.644" are valid. ; $icon_url - (Optional) A URL to an image that will be used for the icon of the marker. ; Return values .: On Success - Returns True. ; On Failure - Returns False. ; Author ........: seangriffin ; Modified.......: ; Remarks .......: This function must be used before any other function in the UDF is used. ; There is currently a clipping problem with the control, where the video ; is overdrawn by any other window that overlaps it. There is no known ; solution at this time. ; ; Related .......: ; Link ..........: ; ;========================================================================================== Func _GUICtrlGoogleMap_AddMarker($gmap, $address, $icon_url = "") Local $latlng[2] $latlng = _GUICtrlGoogleMap_GetLatLng($address) $gmap.document.parentWindow.execScript("addMarker(" & $latlng[0] & "," & $latlng[1] & ",'" & $icon_url & "');") Return True EndFunc #endregion #region _GUICtrlGoogleMap_HideAllMarkers() ; #FUNCTION# ;=============================================================================== ; Name...........: _GUICtrlGoogleMap_HideAllMarkers() ; Description ...: Hides all the markers on a Google Map (previously created by the function "_GUICtrlGoogleMap_AddMarker"). ; Syntax.........: _GUICtrlGoogleMap_HideAllMarkers($gmap) ; Parameters ....: $gmap - The Google Map object from the function "_GUICtrlGoogleMap_Create". ; Return values .: On Success - Returns True. ; On Failure - Returns False. ; Author ........: seangriffin ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........: ; ;========================================================================================== Func _GUICtrlGoogleMap_HideAllMarkers($gmap) $gmap.document.parentWindow.execScript("clearMarkers();") Return True EndFunc #endregion #region _GUICtrlGoogleMap_ShowAllMarkers() ; #FUNCTION# ;=============================================================================== ; Name...........: _GUICtrlGoogleMap_ShowAllMarkers() ; Description ...: Shows all the markers on a Google Map (previously hidden by the function "_GUICtrlGoogleMap_HideAllMarkers"). ; Syntax.........: _GUICtrlGoogleMap_ShowAllMarkers($gmap) ; Parameters ....: $gmap - The Google Map object from the function "_GUICtrlGoogleMap_Create". ; Return values .: On Success - Returns True. ; On Failure - Returns False. ; Author ........: seangriffin ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........: ; ;========================================================================================== Func _GUICtrlGoogleMap_ShowAllMarkers($gmap) $gmap.document.parentWindow.execScript("showMarkers();") Return True EndFunc #endregion #region _GUICtrlGoogleMap_DeleteAllMarkers() ; #FUNCTION# ;=============================================================================== ; Name...........: _GUICtrlGoogleMap_DeleteAllMarkers() ; Description ...: Deletes all the markers on a Google Map (previously created by the function "_GUICtrlGoogleMap_AddMarker"). ; Syntax.........: _GUICtrlGoogleMap_DeleteAllMarkers($gmap) ; Parameters ....: $gmap - The Google Map object from the function "_GUICtrlGoogleMap_Create". ; Return values .: On Success - Returns True. ; On Failure - Returns False. ; Author ........: seangriffin ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........: ; ;========================================================================================== Func _GUICtrlGoogleMap_DeleteAllMarkers($gmap) $gmap.document.parentWindow.execScript("deleteMarkers();") Return True EndFunc #endregion #region _GUICtrlGoogleMap_ViewAllMarkers() ; #FUNCTION# ;=============================================================================== ; Name...........: _GUICtrlGoogleMap_ViewAllMarkers() ; Description ...: Sets the view of a Google Map to fit all the markers (previously created by the function "_GUICtrlGoogleMap_AddMarker").. ; Syntax.........: _GUICtrlGoogleMap_ViewAllMarkers($gmap) ; Parameters ....: $gmap - The Google Map object from the function "_GUICtrlGoogleMap_Create". ; Return values .: On Success - Returns True. ; On Failure - Returns False. ; Author ........: seangriffin ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........: ; ;========================================================================================== Func _GUICtrlGoogleMap_ViewAllMarkers($gmap) $gmap.document.parentWindow.execScript("viewMarkers();") Return True EndFunc #endregion #region _GUICtrlGoogleMap_SetMapType() ; #FUNCTION# ;=============================================================================== ; Name...........: _GUICtrlGoogleMap_SetMapType() ; Description ...: Sets the type of map displayed. ; Syntax.........: _GUICtrlGoogleMap_SetMapType($gmap, $map_type) ; Parameters ....: $gmap - The Google Map object from the function "_GUICtrlGoogleMap_Create". ; $map_type - 0 = Sets the map type to standard ; 1 = Sets the map type to satellite ; 2 = Sets the map type to hybrid ; 3 = Sets the map type to terrain ; Return values .: On Success - Returns True. ; On Failure - Returns False. ; Author ........: seangriffin ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........: ; ;========================================================================================== Func _GUICtrlGoogleMap_SetMapType($gmap, $map_type) Local Const $map_type_html[4] = [ _ "google.maps.MapTypeId.ROADMAP", _ "google.maps.MapTypeId.SATELLITE", _ "google.maps.MapTypeId.HYBRID", _ "google.maps.MapTypeId.TERRAIN"] $gmap.document.parentWindow.execScript("map.setMapTypeId(" & $map_type_html[$map_type] & ");") Return True EndFunc #endregion #region _GUICtrlGoogleMap_AddRoute() ; #FUNCTION# ;=============================================================================== ; Name...........: _GUICtrlGoogleMap_AddRoute() ; Description ...: Adds a route (visually) to the map. ; Syntax.........: _GUICtrlGoogleMap_AddRoute($gmap, $start_location, $end_location, $travel_mode = 0, $wp1 = " ", $wp2 = " ", $wp3 = " ", $wp4 = " ") ; Parameters ....: $gmap - The Google Map object from the function "_GUICtrlGoogleMap_Create". ; $start_location - The starting location of the route. ; Expressed as an address (ie. both "Sydney, New South Wales, Australia"). ; $end_location - The ending location of the route. ; Expressed as an address (ie. both "Sydney, New South Wales, Australia"). ; $travel_mode - 0 = Uses a travel mode of DRIVING ; 1 = Uses a travel mode of WALKING ; 2 = Uses a travel mode of BICYCLING ; $wp1 - (Optional) ; Sets first Waypoint ; Expressed as an address (ie. both "Sydney, New South Wales, Australia"). ; $wp2 - (Optional) ; Sets second Waypoint ; Expressed as an address (ie. both "Sydney, New South Wales, Australia"). ; $wp3 - (Optional) ; Sets third Waypoint ; Expressed as an address (ie. both "Sydney, New South Wales, Australia"). ; $wp4 - (Optional) ; Sets fourth Waypoint ; Expressed as an address (ie. both "Sydney, New South Wales, Australia"). ; Return values .: On Success - Returns True. ; On Failure - Returns False. ; Author ........: seangriffin ; Modified.......: Igor Kerekeš ; Remarks .......: Route is draggable. ; Related .......: ; Link ..........: ; ;========================================================================================== func _GUICtrlGoogleMap_AddRoute($gmap, $start_location, $end_location, $travel_mode = 0, $wp1 = " ", $wp2 = " ", $wp3 = " ", $wp4 = " ") $gmap.document.parentWindow.eval("calcRoute(""" & $start_location & """, """ & $end_location & """, " & $travel_mode & ", """ & $wp1 & """, """ & $wp2 & """, """ & $wp3 & """, """ & $wp4 & """)") Return True EndFunc #endregion ;directionsDisplay.setMap(null); #region _GUICtrlGoogleMap_DeleteRoute() ; #FUNCTION# ;=============================================================================== ; Name...........: _GUICtrlGoogleMap_GetRouteDetails() ; Description ...: Gets the directions of a route. ; Syntax.........: _GUICtrlGoogleMap_GetRouteDetails($gmap) ; Parameters ....: $gmap - The Google Map object from the function "_GUICtrlGoogleMap_Create". ; Return values .: On Success - Returns route details (duration, distance, start, end and directions. ; On Failure - Returns ???. ; Author ........: Igor Kerekeš ; Modified.......: ; Remarks .......: Contains directions steps and distance in meters. ; Related .......: ; Link ..........: ; ;========================================================================================== Func _GUICtrlGoogleMap_DeleteRoute($gmap) ;Local $routeDetails $gmap.document.parentWindow.eval("directionsDisplay.setMap(null);") ;Return $routeDetails EndFunc #endregion #region _GUICtrlGoogleMap_GetRouteDetails() ; #FUNCTION# ;=============================================================================== ; Name...........: _GUICtrlGoogleMap_GetRouteDetails() ; Description ...: Gets the directions of a route. ; Syntax.........: _GUICtrlGoogleMap_GetRouteDetails($gmap) ; Parameters ....: $gmap - The Google Map object from the function "_GUICtrlGoogleMap_Create". ; Return values .: On Success - Returns route details (duration, distance, start, end and directions. ; On Failure - Returns ???. ; Author ........: Igor Kerekeš ; Modified.......: ; Remarks .......: Contains directions steps and distance in meters. ; Related .......: ; Link ..........: ; ;========================================================================================== Func _GUICtrlGoogleMap_GetRouteDetails($gmap) Local $routeDetails $routeDetails = $gmap.document.parentWindow.eval("routeDetails()") Return $routeDetails EndFunc #endregion #region _GUICtrlGoogleMap_GetPosition() ; #FUNCTION# ;=============================================================================== ; Name...........: _GUICtrlGoogleMap_GetPosition() ; Description ...: Gets the position of marker. ; Syntax.........: _GUICtrlGoogleMap_GetPosition($gmap) ; Parameters ....: $gmap - The Google Map object from the function "_GUICtrlGoogleMap_Create". ; Return values .: On Success - Returns True. ; On Failure - Returns False. ; Author ........: Igor Kerekeš ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........: ; ;========================================================================================== Func _GUICtrlGoogleMap_GetPosition($gmap) Local $positionDetails[3], $position_details, $details, $posLAT, $posLNG, $posADR $posLAT = "" $posLNG = "" $posADR = "" $position_details = $gmap.document.parentWindow.eval("updatePosition()") $details = StringSplit($position_details, "~", 1) $posLAT = $details[1] $posLNG = $details[2] $posADR = $details[3] $positionDetails[0] = $posLAT $positionDetails[1] = $posLNG $positionDetails[2] = $posADR Return $positionDetails EndFunc #endregion #region _GUICtrlGoogleMap_Weather() ; #FUNCTION# ;=============================================================================== ; Name...........: _GUICtrlGoogleMap_Weather() ; Description ...: Enable or Disable the Weather Service ; Syntax.........: _GUICtrlGoogleMap_Weather($gmap, $status, $unit) ; Parameters ....: $gmap - The Google Map object from the function "_GUICtrlGoogleMap_Create". ; $status - Enable/Disable ; Return values .: On Success - Returns True. ; On Failure - Returns False. ; Author ........: Igor Kerekeš ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........: ; ;========================================================================================== Func _GUICtrlGoogleMap_Weather($gmap, $status = 0) $gmap.document.parentWindow.execScript("weather(" & $status & ");") Return True EndFunc #endregion #cs #region _GUICtrlGoogleMap_GetRouteDetails() ; #FUNCTION# ;=============================================================================== ; Name...........: _GUICtrlGoogleMap_GetRouteDetails() ; Description ...: Gets the details of a route. ; Syntax.........: _GUICtrlGoogleMap_GetRouteDetails($gmap) ; Parameters ....: $gmap - The Google Map object from the function "_GUICtrlGoogleMap_Create". ; Return values .: On Success - Returns array of values. ; On Failure - Returns ???. ; Author ........: seangriffin ; Modified.......: Igor Kerekeš ; Remarks .......: Distance in meters and duration in seconds. ; Related .......: ; Link ..........: ; ;========================================================================================== Func _GUICtrlGoogleMap_GetRouteDetails($gmap) Local $routeDetails[2], $route_details, $details, $distance, $duration $distance = "" $duration = "" $route_details = $gmap.document.parentWindow.eval("routeDetails()") $details = StringSplit($route_details, "~", 1) $distance = $details[1] $duration = $details[2] $routeDetails[0] = $distance $routeDetails[1] = $duration Return $routeDetails EndFunc #endregion #ce