1 | <!DOCTYPE html>
|
---|
2 | <html>
|
---|
3 | <head>
|
---|
4 | <meta name="viewport" content="initial-scale=1.0, user-scalable=yes" />
|
---|
5 |
|
---|
6 | <style type="text/css">
|
---|
7 | * { margin: 0; padding: 0; }
|
---|
8 | html { width: 100%; height: 100%; }
|
---|
9 | body { width: 100%; height: 100%; }
|
---|
10 | #map_canvas { width: 100%; height: 100%; background-color: gray; }
|
---|
11 | </style>
|
---|
12 |
|
---|
13 | <script>
|
---|
14 | var map;
|
---|
15 | var marker;
|
---|
16 | var zoom;
|
---|
17 | var useTrace;
|
---|
18 | var traceIcon;
|
---|
19 |
|
---|
20 | function initialize(lat, lon, trace) {
|
---|
21 |
|
---|
22 | useTrace = trace;
|
---|
23 |
|
---|
24 | var myOptions = {
|
---|
25 | center: new google.maps.LatLng(lat, lon),
|
---|
26 | zoom: 3,
|
---|
27 | mapTypeId: google.maps.MapTypeId.SATELLITE,
|
---|
28 | panControl: true
|
---|
29 | };
|
---|
30 |
|
---|
31 | map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
|
---|
32 | zoom = 0;
|
---|
33 |
|
---|
34 | var image = new google.maps.MarkerImage("qrc:///map/crosshair.png",
|
---|
35 | null,
|
---|
36 | null,
|
---|
37 | new google.maps.Point(20, 20),
|
---|
38 | new google.maps.Size(40,40)
|
---|
39 | );
|
---|
40 |
|
---|
41 | traceIcon = new google.maps.MarkerImage("qrc:///map/reddot.png",
|
---|
42 | null,
|
---|
43 | null,
|
---|
44 | new google.maps.Point(2, 2),
|
---|
45 | new google.maps.Size(4,4)
|
---|
46 | );
|
---|
47 |
|
---|
48 | marker = new google.maps.Marker({
|
---|
49 | map: map,
|
---|
50 | position: new google.maps.LatLng(lat, lon),
|
---|
51 | icon: image,
|
---|
52 | });
|
---|
53 | }
|
---|
54 |
|
---|
55 | function gotoLocation(lat, lon) {
|
---|
56 | if (zoom == 0) {
|
---|
57 | zoom = 17;
|
---|
58 | map.setZoom(zoom);
|
---|
59 | }
|
---|
60 | var position = new google.maps.LatLng(lat, lon);
|
---|
61 | map.setCenter(position);
|
---|
62 | marker.setPosition(position);
|
---|
63 |
|
---|
64 | if (useTrace == 1) {
|
---|
65 | var trace = new google.maps.Marker({
|
---|
66 | map: map,
|
---|
67 | position: new google.maps.LatLng(lat, lon),
|
---|
68 | icon: traceIcon,
|
---|
69 | });
|
---|
70 | }
|
---|
71 | }
|
---|
72 | </script>
|
---|
73 |
|
---|
74 | <script type="text/javascript"
|
---|
75 | src="http://maps.googleapis.com/maps/api/js?sensor=false">
|
---|
76 | </script>
|
---|
77 |
|
---|
78 | </head>
|
---|
79 | <body>
|
---|
80 | <div id="map_canvas">Waiting for data...</div>
|
---|
81 | </body>
|
---|
82 | </html>
|
---|