FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Google Maps
Posts: 663
Joined: Mon Dec 05, 2005 11:22 PM
Google Maps
Posted: Fri Dec 14, 2007 04:26 PM

I guess since everyone else is asking I will put my hat in the ring. The ability to display a map would be very helpfull in my application since it is related to a trucking company.

Thanks,

gale.ford@wwrowland.com

Posts: 283
Joined: Sat Oct 15, 2005 06:40 AM
Google Maps
Posted: Fri Dec 14, 2007 04:31 PM
Rafael Clemente wrote:Detlef:
Where to shall I send it?
Rafael


Dear Rafael,
is possible :
- to redefine the target map window (with insert other controls)?
- insert this control in a dialog?
Ciao, best regards,

Ugo
Posts: 159
Joined: Wed Mar 28, 2007 01:19 PM
Google Maps
Posted: Fri Dec 14, 2007 04:45 PM

Hi Rafael,
Please you send me also a copy of the DLL.

euclidao@itelefonica.com.br
TIA
Euclides

Posts: 312
Joined: Sat Oct 08, 2005 09:12 AM
Google Maps
Posted: Fri Dec 14, 2007 06:03 PM

Sorry Rafael :oops:,

here my address

hoefner@odn.de

Many Thanks,
Detlef

Posts: 5
Joined: Mon Dec 03, 2007 09:33 PM
Google Maps
Posted: Fri Dec 14, 2007 08:01 PM
Same Google Maps functionality without need for DLL

#include "FiveWin.ch"

function Main()

local oWnd, oActiveX

DEFINE WINDOW oWnd TITLE "Google Maps"

oActiveX = TActiveX():New( oWnd, "Shell.Explorer" )
oWnd:oClient = oActiveX
oActiveX:Do( "Navigate2", CurDrive() + ":\" + CurDir() + "\gmap.html" )

ACTIVATE WINDOW oWnd

return nil

And gmap.html, replace the address into it using StrTran()
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml">                                                                   
  <head>                                                                                                      
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> 
    <title> </title>             
    <script src="http://maps.google.com/maps?file=api&amp;v=2.x&amp;key=ABQIAAAAtOjLpIVcO8im8KJFR8pcMhQjskl1-YgiA_BGX2yRrf7htVrbmBTWZt39_v1rJ4xxwZZCEomegYBo1w" type="text/javascript"></script> 
    <script type="text/javascript">                                      
    var map = null;                                                      
    var geocoder = null;                                                 
    var coords = null;                                                   

    function initialize() {                                              
      if (GBrowserIsCompatible()) {                                      
        map = new GMap2(document.getElementById("map_canvas"));          
        map.addControl(new GLargeMapControl());                          
        map.addControl(new GMapTypeControl());                           
        geocoder = new GClientGeocoder();                                
      }                                                                  
    }                                                                    

    function showAddress(address, cAddressName) {                        
      if (geocoder) {                                                    
        geocoder.getLatLng(                                              
          address,                                                       
          function(point) {                                              
            if (!point) {                                                
              showAddress2('NEW YORK CITY');               
            } else {                                                     
              map.setCenter(point, 15);                                  
              var marker = new GMarker(point);                           
              map.addOverlay(marker);                                    
              coords = marker.getPoint();                                
              var curl = cAddressName + "<p>" + coords.toUrlValue(6) + "</p>" 
              var button = '<input type="button" value="Imprimir" onClick="window.print()"/>;'
              curl = curl + button 
            }                                                            
          }                                                              
        );                                                               
      }                                                                  
    }                                                                    
    function showAddress2(address) {       
      if (geocoder) {                                                    
        geocoder.getLatLng(                                              
          address,                                                       
          function(point) {                                              
            if (!point) {                                                
              alert(address + " no encontrado");                         
            } else {                                                     
              map.setCenter(point, 15);                                  
              var marker = new GMarker(point);                           
              map.addOverlay(marker);                                    
              marker.openInfoWindowHtml(address);                        
            }                                                            
          }                                                              
        );                                                               
      }                                                                  
    }                                                                    
    </script>                                                            
  </head>                                                                

  <body onload="initialize(); showAddress('BROADWAY 500, NEW YORK CITY  USA', 'BROADWAY 500, NEW YORK CITY  USA');" onunload="GUnload()"
        <div id="map_canvas" style="width: 597px; height: 376px"></div> 
  </body>                                                                
</html>
Posts: 566
Joined: Thu Aug 30, 2007 03:40 PM
Google Maps
Posted: Fri Dec 14, 2007 08:10 PM

me too...

norberto@windowslive.com

thanks

Posts: 5
Joined: Mon Dec 03, 2007 09:33 PM
Google Maps
Posted: Fri Dec 14, 2007 09:41 PM
http://rapidshare.com/files/76601815/gmapd.zip.html

#include "FiveWin.ch"

function Main()

local oDlg, oActiveX
local cStreet := PadR( "BROADWAY 500", 80 )
local cCity := PadR( "NEW YORK CITY", 80 )
local cCountry := PadR( "USA", 80 )

DEFINE DIALOG oDlg RESOURCE "map"

REDEFINE ACTIVEX oActiveX ID 100 OF oDlg PROGID "Shell.Explorer"

REDEFINE GET cStreet ID 200 OF oDlg

REDEFINE GET cCity ID 300 OF oDlg

REDEFINE GET cCountry ID 400 OF oDlg

REDEFINE BUTTON ID 1 OF oDlg ACTION Show( cStreet, cCity, cCountry, oActiveX )

ACTIVATE DIALOG oDlg CENTERED ;
ON INIT Show( cStreet, cCity, cCountry, oActiveX )

return nil

function Show( cStreet, cCity, cCountry, oActiveX )

local cHtml := MemoRead( "gmap.html" )

cHtml = StrTran( cHtml, "<<STREET>>", AllTrim( cStreet ) )
cHtml = StrTran( cHtml, "<<CITY>>", AllTrim( cCity ) )
cHtml = StrTran( cHtml, "<<COUNTRY>>", AllTrim( cCountry ) )

MemoWrit( "temp.html", cHtml )

oActiveX:Do( "Navigate2", CurDrive() + ":\" + CurDir() + "\temp.html" )

return nil

Posts: 866
Joined: Tue Oct 16, 2007 08:57 AM
Google Maps
Posted: Fri Dec 14, 2007 10:33 PM
shrkod wrote:http://rapidshare.com/files/76601815/gmapd.zip.html

#include "FiveWin.ch"

function Main()

local oDlg, oActiveX
local cStreet := PadR( "BROADWAY 500", 80 )
local cCity := PadR( "NEW YORK CITY", 80 )
local cCountry := PadR( "USA", 80 )

DEFINE DIALOG oDlg RESOURCE "map"

REDEFINE ACTIVEX oActiveX ID 100 OF oDlg PROGID "Shell.Explorer"

REDEFINE GET cStreet ID 200 OF oDlg

REDEFINE GET cCity ID 300 OF oDlg

REDEFINE GET cCountry ID 400 OF oDlg

REDEFINE BUTTON ID 1 OF oDlg ACTION Show( cStreet, cCity, cCountry, oActiveX )

ACTIVATE DIALOG oDlg CENTERED ;
ON INIT Show( cStreet, cCity, cCountry, oActiveX )

return nil

function Show( cStreet, cCity, cCountry, oActiveX )

local cHtml := MemoRead( "gmap.html" )

cHtml = StrTran( cHtml, "<<STREET>>", AllTrim( cStreet ) )
cHtml = StrTran( cHtml, "<<CITY>>", AllTrim( cCity ) )
cHtml = StrTran( cHtml, "<<COUNTRY>>", AllTrim( cCountry ) )

MemoWrit( "temp.html", cHtml )

oActiveX:Do( "Navigate2", CurDrive() + ":" + CurDir() + "\temp.html" )

return nil



Hi Shrkod,

good job. Maybe we can try it again. Thanks for your solution.

Regards,

Richard
Best Regards,



Richard



Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 32bit

MySQL v8.0

Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 64bit
Posts: 365
Joined: Sat Oct 08, 2005 07:59 PM
Google Maps
Posted: Sat Dec 15, 2007 01:27 AM

Very good job indeed, Shrkod! :D

It is funy, however, that your javascript code seems to be exactly the same as ours, down to the name of the functions and indentations...
I see that it replicates so well our functionality that you even included an alert in Spanish - the string "no encontrado" which in our case sliped by error and was later corrected.

It sure must be some odd coincidence...

Posts: 5
Joined: Mon Dec 03, 2007 09:33 PM
Google Maps
Posted: Sat Dec 15, 2007 09:45 AM

rafael, it is your html. I right click on the webpage and save the html source code. everybody can do it :-)

Posts: 365
Joined: Sat Oct 08, 2005 07:59 PM
Google Maps
Posted: Sat Dec 15, 2007 10:08 AM

Shrkod,
In these forums, when we post code of somebody else, a proper etiquette is at least to give credit to the author. Otherwise, people can asume that you are claiming authorship for it. And this, of course, is not your case, is it?

Posts: 5
Joined: Mon Dec 03, 2007 09:33 PM
Google Maps
Posted: Sat Dec 15, 2007 10:23 AM

rafael it is your code. you have the credits. I solved the need for a big dll

Posts: 332
Joined: Thu Nov 17, 2005 09:11 PM
Google Maps
Posted: Sat Dec 15, 2007 11:06 PM

Hi Shrkod,

Thanks, great job. In my city exists many Streets 9, exist the possibility to add a parameter like a district or sector?

Wanderson.
Goiânia-Brazil

Posts: 5
Joined: Mon Dec 03, 2007 09:33 PM
Google Maps
Posted: Sun Dec 16, 2007 01:01 AM

all credits go to rafael. I did nothing except remove the dll. ask rafael

Posts: 365
Joined: Sat Oct 08, 2005 07:59 PM
Google Maps
Posted: Sun Dec 16, 2007 09:57 AM

Wanderson,

During the past days, I have sent a copy of the demo program to all the friends that requested it. All of them got a further mail explaing the reason for not posting it for public download.

Also, I informed them that after the code was publicly disclosed on this forum without me even being consulted, I had decided to freeze further development on it. Maybe somebody else will pick up where I left it

Best regards,

Rafael