how can i use GoogleMaps with SB ?

Just starting out? Need help? Post your questions and find answers here.
skinkairewalker
Posts: 120
Joined: Tue Jun 14, 2016 7:17 pm

how can i use GoogleMaps with SB ?

Post by skinkairewalker »

hi everyone !
someone know how can i use google maps with SB ?
pf shadoko
Posts: 74
Joined: Thu May 26, 2016 11:09 am

Re: how can i use GoogleMaps with SB ?

Post by pf shadoko »

Code: Select all

Procedure.i ObjectElement(objectid)
    !if (typeof(v_objectid.element)=="undefined") {return v_objectid.div} else {return v_objectid.element};
EndProcedure

Procedure LoadScript(Script.s, *OnLoadFunction)
    !$.getScript(v_script,p_onloadfunction);
EndProcedure 

;========================================================================================================================

Global divmap

Procedure affiche(llat.f, llng.f, zoom.f,type)      
    If type>=0 ;---------------------------type de carte
        !var mpid="";
        !switch (v_type) {
        !  case 0: mpid = google.maps.MapTypeId.ROADMAP; break;
        !  case 1: mpid = google.maps.MapTypeId.SATELLITE; break;
        !  case 2: mpid = google.maps.MapTypeId.HYBRID; break;
        !  case 3: mpid = google.maps.MapTypeId.TERRAIN; break;
        !}
        !v_gmap.setMapTypeId(mpid); 
    EndIf       
    If zoom>=0 ;---------------------------zoom
        !v_gmap.setZoom(v_zoom); 
    EndIf       
    If llat>=0 ;---------------------------position
        !v_gmap.setCenter({lat: v_llat, lng: v_llng}); 
    EndIf    
EndProcedure

Procedure position()
    affiche(45,0,6,0)
EndProcedure

Procedure ScriptLoaded(script.s, status.s, jqxhr) 
    If status<>"success" : Debug status :ProcedureReturn: EndIf 
    
    divmap=ObjectElement(WindowID(0))
    !var mapProp = {mapTypeControl:true, mapTypeControlOptions: {style:google.maps.MapTypeControlStyle.DROPDOWN_MENU}};
    !v_gmap=new google.maps.Map(v_divmap, mapProp);  
    !marker = new google.maps.Marker({map: v_gmap, title: 'Hello World!'});
    affiche(45,0,6,0)
EndProcedure


OpenWindow(0, 0, 0, 600, 600, "",#PB_Window_Background) 

LoadScript("http://maps.googleapis.com/maps/api/js", @ ScriptLoaded())
skinkairewalker
Posts: 120
Joined: Tue Jun 14, 2016 7:17 pm

Re: how can i use GoogleMaps with SB ?

Post by skinkairewalker »

thanks you very much pf shadoko :D you safe my life
Post Reply