Jump to content
Fivewin Brasil

Posicionar Clientes no Mapa


marcioe

Recommended Posts

Function VerRotaVisitadas(aDd)  // aDd = Nome, Endereco, Bairro, Cidade, Estado
Local cHtml:="", oOle, x1:=0, nD1 := 1

     *oOle:= CreateObject("InternetExplorer.Application")
     *oOle:Visible    := .t.   // Apresenta o Browser
     *oOle:ToolBar    := .f.   // Desativa a barra de ferramentas
     *oOle:StatusBar  := .f.   // Desativa a barra de status
     *oOle:MenuBar    := .f.   // desativa a barra de menu

        cHtml+='<head>'+CRLF
        cHtml+='<title>Mapeamento dos Clientes</title>'+CRLF
        cHtml+='<style type="text/css">'+CRLF
        cHtml+='#mapa{width:1200px;'+CRLF
        cHtml+='height:1000px}'+CRLF
        cHtml+='</style>'+CRLF
        cHtml+='<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>'+CRLF
        cHtml+='<script type="text/javascript">'+CRLF
        cHtml+='var map = null;'+CRLF
        cHtml+='function carregar(){'+CRLF
        cHtml+='var latlng = new google.maps.LatLng(-3.787522,-38.518066);'+CRLF
        cHtml+='var myOptions = {'+CRLF
        cHtml+='zoom: 14,'+CRLF
        cHtml+='center: latlng,'+CRLF
        cHtml+='mapTypeId: google.maps.MapTypeId.ROADMAP};'+CRLF
        cHtml+='map = new google.maps.Map(document.getElementById("mapa"), myOptions);'+CRLF
        *
        For nD1 := 1 To Len(aDd)
           cNome_Google		 := aDd[nD1,1]
			  cEndereco_Google := aDd[nD1,2]
			  cBairro_Google	 := aDd[nD1,3]
           cCidade_Google	 := aDd[nD1,4]
			  cEstado_Google	 := aDd[nD1,5]
			  x1++
           fBus	:= "Carro_1.JPG"  
           cHtml	+= ' '+CRLF
           cHtml	+= 'var endereco'+Alltrim(Str(x1))+'="'+Alltrim(cEndereco_Google)+' - '+Alltrim(cBairro_Google)+' - '+Alltrim(cCidade_Google)+' - '+AllTrim(cEstado_Google)+'";'+CRLF
           cHtml	+= 'geocoder = new google.maps.Geocoder();'+CRLF
           cHtml	+= 'geocoder.geocode({"address":endereco'+Alltrim(str(x1))+'}, function(results, status){ if( status = google.maps.GeocoderStatus.OK){ latlng = results[0].geometry.location;'+CRLF
           cHtml	+= 'markerInicio'+Alltrim(Str(x1))+' = new google.maps.Marker({position: latlng,map: map, title:"'+Alltrim(cNome_Google)+'", icon: "'+fBus+'"});'+CRLF
           cHtml	+= [var infowindow = new google.maps.InfoWindow({ content: '<strong>]+Alltrim(cNome_google)+[</strong><br>]+Alltrim(cEndereco_Google)+[, ]+Alltrim(cBairro_Google)+[ ]+Alltrim(cCidade_Google)+[ ]+Alltrim(cEstado_Google)+[<BR>]+['});]+CRLF
           cHtml	+= 'google.maps.event.addListener(markerInicio'+Alltrim(Str(x1))+', "click", function(event) { infowindow.open(map,markerInicio'+Alltrim(Str(x1))+');});'+CRLF
           cHtml	+= 'map.setCenter(latlng); } });'+CRLF
           cHtml	+= ' '+CRLF
           *
        Next nD1
        *
        cHtml+='}'+CRLF
        cHtml+='</script>'+CRLF
        cHtml+='</head>'+CRLF
        cHtml+='<body onload="carregar()">'+CRLF
        cHtml+='<div id="mapa"></div>'+CRLF
        cHtml+='</body>'+CRLF
        cHtml+='</html>'+CRLF

         MemoWrit("visitarota.html",chtml)  // uRegPath = "c:\test"

 			ShellExecute(GetActiveWindow(),"open",'visitarota.html')
 
        *oOle:Navigate2("visitarota.htm")

        *hWnd:=oOle:hWnd
        *BringWindowToTop(hWnd)

Return nil

tenho esse em meus arquivos aqui... não me lembro quem postou no forum...  vê se ajuda...

Ah! se tiver alguma melhoria ai, compartilha com gente... Vlw!!!!

eu ainda não usei, mas vá que uma hora a gente precisa... rsrsrsrsrsrsrs

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...