Google Map Sample

Friday, 18 March 2011 01:31 administrator
Print

This is a little but interesting sample, load a map into a window of your aplicattion

Este es un ejemplo simple pero interesante , incluir un mapa en una ventana de su aplicacion

 

 

 

This sample and .mip file was made in Linux , but you can try it in windows with a few minor modifications ( mapa.html file path , etc etc )

Este ejemplo y su archivo .mip fueron creados en Linux , pero ud puede probarlo en windows con pequeñas modificaciones ( path de mapa.html , etc etc )

 

Download of .rar file , with complete code and .mip file to compile in marinas-ide

Descarga del archivo .rar  con el codigo completo y su archivo .mip para poder compilarlo en marinas-ide

Download :  googlemaps.rar

 

Sample Marinas-GUI code

Codigo Marinas-Gui Sample

 

gmaps.prg sample
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include "marinas-gui.ch"
 
Function main()
 
CREATE WINDOW d_window
ROW 0
COL 0
WIDTH 820
HEIGHT 680
CAPTION "Marinas-GUI Google Maps Sample"
ICON "marinas-gui_png"
MAIN .T.
 
CREATE NAVIGATOR Navigator_1
ROW 10
COL 10
WIDTH 800
HEIGHT 640
URL "file:///home/bruno/marinas-ide_01_70_0004/marinas/gui/samples/googlemaps/mapa.html"
// URL "http://www.harbour-project.org/"
// URL "http://doc.qt.nokia.com/4.5/qurl.html#details"
// URL "http://doc.qt.nokia.com/4.5/qurl.html"
TOOLTIP "Navigator ToolTip"
// ONCHANGE mg_Set( "d_window" , "Navigator_1Image2" , "picture" , "../resource/d_modified.png" )
// ONGOTFOCUS mg_Set( "d_window" , "Navigator_1Image" , "picture" , "../resource/d_focus_on.png" )
// ONLOSTFOCUS mg_Set( "d_window" , "Navigator_1Image" , "picture" , "../resource/d_focus_off.png" )
 
CREATE CONTEXT MENU
 
CREATE ITEM "Item 1 from Navigator"
ONCLICK { || mg_MsgInfo( "Item 1 from Navigator" ) }
PICTURE "../resource/d_test.png"
END ITEM
 
CREATE ITEM "Item 2 from Navigator"
ONCLICK { || mg_MsgInfo( "Item 2 from Navigator" ) }
PICTURE "../resource/d_test.png"
END ITEM
 
END MENU
 
END NAVIGATOR
 
END WINDOW
 
mg_Do( "d_window" , "center" )
mg_Do( "d_window" , "activate" )
 
Return .T.
 

 

mapa.html sample code

Ejemplo de codigo mapa.html

 

mapa.html sample file
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0px; padding: 0px }
#map_canvas { height: 100% }
</style>
<title>Google Maps JavaScript API v3 Example: Map Simple</title>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
function initialize() {
var myLatlng = new google.maps.LatLng(-33.0,-60.0);
var myOptions = {
zoom: 5,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
}
</script>
</head>
<body onload="initialize()">
<div id="map_canvas"></div>
 
</body>
</html>
Last Updated on Friday, 18 March 2011 02:46