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 dotSize;
|
---|
18 | var dotColor;
|
---|
19 | var traceIcon;
|
---|
20 |
|
---|
21 | function initialize(lat, lon, mapWinDotSize, mapWinDotColor) {
|
---|
22 | dotSize = mapWinDotSize;
|
---|
23 | dotColor = mapWinDotColor;
|
---|
24 | if (dotSize > 10) dotSize = 10;
|
---|
25 |
|
---|
26 | var myOptions = {
|
---|
27 | center: new google.maps.LatLng(lat, lon),
|
---|
28 | zoom: 3,
|
---|
29 | mapTypeId: google.maps.MapTypeId.SATELLITE,
|
---|
30 | panControl: true
|
---|
31 | };
|
---|
32 |
|
---|
33 | map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
|
---|
34 | zoom = 0;
|
---|
35 |
|
---|
36 | var image = new google.maps.MarkerImage("qrc:///map/crosshair.png",
|
---|
37 | null,
|
---|
38 | null,
|
---|
39 | new google.maps.Point(20, 20),
|
---|
40 | new google.maps.Size(40,40)
|
---|
41 | );
|
---|
42 |
|
---|
43 | if (dotColor == 1) {
|
---|
44 | traceIcon = new google.maps.MarkerImage("qrc:///map/reddot.png",
|
---|
45 | null,
|
---|
46 | null,
|
---|
47 | new google.maps.Point(dotSize/2, dotSize/2),
|
---|
48 | new google.maps.Size(dotSize, dotSize)
|
---|
49 | );
|
---|
50 | }
|
---|
51 |
|
---|
52 |
|
---|
53 | if (dotColor == 2) {
|
---|
54 | traceIcon = new google.maps.MarkerImage("qrc:///map/yellowdot.png",
|
---|
55 | null,
|
---|
56 | null,
|
---|
57 | new google.maps.Point(dotSize/2, dotSize/2),
|
---|
58 | new google.maps.Size(dotSize, dotSize)
|
---|
59 | );
|
---|
60 | }
|
---|
61 |
|
---|
62 | marker = new google.maps.Marker({
|
---|
63 | map: map,
|
---|
64 | position: new google.maps.LatLng(lat, lon),
|
---|
65 | icon: image,
|
---|
66 | });
|
---|
67 | }
|
---|
68 |
|
---|
69 | function gotoLocation(lat, lon) {
|
---|
70 | if (zoom == 0) {
|
---|
71 | zoom = 17;
|
---|
72 | map.setZoom(zoom);
|
---|
73 | }
|
---|
74 | var position = new google.maps.LatLng(lat, lon);
|
---|
75 | map.setCenter(position);
|
---|
76 | marker.setPosition(position);
|
---|
77 |
|
---|
78 | if (dotSize > 0) {
|
---|
79 | var trace = new google.maps.Marker({
|
---|
80 | map: map,
|
---|
81 | position: position,
|
---|
82 | icon: traceIcon,
|
---|
83 | });
|
---|
84 | }
|
---|
85 | }
|
---|
86 | </script>
|
---|
87 |
|
---|
88 | <script type="text/javascript"
|
---|
89 | src="http://maps.googleapis.com/maps/api/js?sensor=false">
|
---|
90 | </script>
|
---|
91 |
|
---|
92 | </head>
|
---|
93 | <body>
|
---|
94 | <div id="map_canvas">Waiting for data...</div>
|
---|
95 | </body>
|
---|
96 | </html>
|
---|