delphi - GMLib Simple directions sample -


someone give me simple sample how implement follow situation using gmlib: have address(street, number, city) e make route using google maps connecting of them. using delphi xe2. much!

you need twebbrowser, tgmmap , tgmdirection , connect components so:

tgmdirection.map -> tgmmap tgmmap.webbrowser -> twebbrowser

active tgmmap (active := true) , on afterpageloaded event put code:

procedure tmainfrm.gmmap1afterpageloaded(sender: tobject; first: boolean); begin   if first gmmap1.domap; end; 

now, need configure tgmdirection origin , destination address , call execute method:

// minimum config tgmdirection.directionsrequest.origin.address := 'origin address'; tgmdirection.directionsrequest.destination.address := 'destination address'; tgmdirection.execute; 

you need know call execute method create new item directionsresult array. array have count items (0 based). need know each result can return (if status = dsok) 1 or more results stored routes array (0 based too).

tgmdirection.directionsresult -> array request tgmdirection.directionsresult[x].routes -> array results of request if status = dsok 

regards


Comments