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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
| <!DOCTYPE html>
<html>
<head>
<title>Spotlight </title>
<meta charset="UTF-8">
<style>
header {font-family:Georgia,"Times New Roman",serif;
font-size:16px;
display:block; }
canvas {position:absolute; top: 165px; left:0px; z-index:100;}
#place {position:absolute; top: 165px; left: 0px; z-index:1;}
body {
background-color: orange;
background-size:100%;
}
</style>
<script type="text/javascript" charset="UTF-8" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" charset="UTF-8" src="coordinates(Kiel-Berlin).js"></script>
<script type="text/javascript" charset="UTF-8">
var locations = [
[54.31432029,10.10394573, "Kiel-Berlin"],
[54.31432029,10.10394573,"Kiel-Hamburg"],
[52.51925017,13.40353489,"Berlin-Lubeck"]
];
var positionopts;
positionopts = {
enableHighAccuracy: true} ;
var candiv;
var can;
var ctx;
var pl;
function init() {
var mylat;
var mylong;
candiv = document.createElement("div");
candiv.innerHTML = ("<canvas id='canvas' width='600' height='400'>No canvas </canvas>");
document.body.appendChild(candiv);
can = document.getElementById("canvas");
pl = document.getElementById("place");
ctx = can.getContext("2d");
can.onmousedown = function () { return false; } ; //prevents change of cursor to default
can.addEventListener('mousedown',pushcanvasunder,true);
can.addEventListener("mouseout",clearshadow,true);
mylat = locations[0][0];
mylong = locations[0][1];
makemap(mylat,mylong);
}
function pushcanvasunder(ev) {
can.style.zIndex = 1;
pl.style.zIndex = 100;
}
function clearshadow(ev) {
ctx.clearRect(0,0,600,400);
}
var listener;
var map;
var blatlng;
var myOptions;
var rxmarker = "x1.png";
function makemap(mylat,mylong) {
var marker;
blatlng = new google.maps.LatLng(mylat,mylong);
myOptions = {
zoom: 6,
center: blatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
//disableDefaultUI: true
};
map = new google.maps.Map(document.getElementById("place"), myOptions);
//mark center
marker = new google.maps.Marker({
position: blatlng,
title: "center",
icon: rxmarker,
map: map });
//CODE FOR MOVING THE CIRCLE
// Define the symbol, using one of the predefined paths ('CIRCLE')
// supplied by the Google Maps JavaScript API.
var lineSymbol = {
path: google.maps.SymbolPath.CIRCLE,
scale: 8,
strokeColor: '#11BDBA'
};
// Define the symbol, using one of the predefined paths ('CIRCLE')
// supplied by the Google Maps JavaScript API.
var lineSymbol = {
path: google.maps.SymbolPath.CIRCLE,
scale: 8,
strokeColor: '#3F35B0'
};
// Create the polyline and add the symbol to it via the 'icons' property.
line = new google.maps.Polyline({
path: lineCoordinates,
icons: [{
icon: lineSymbol,
offset: '100%'
}],
map: map
});
animateCircle();
}
// Use the DOM setInterval() function to change the offset of the symbol
// at fixed intervals.
function animateCircle() {
var count = 0;
window.setInterval(function() {
count = (count + 1) % 200;
var icons = line.get('icons');
icons[0].offset = (count / 2) + '%';
line.set('icons', icons);
}, 400);
}
function round (num,places) {
var factor = Math.pow(10,places);
var increment = 5/(factor*10);
return Math.floor((num+increment)*factor)/factor;
}
function changebase() {
var mylat;
var mylong;
for(var i=0;i<locations.length;i++) {
if (document.f.loc[i].checked) {
mylat = locations[i][0];
mylong = locations[i][1];
makemap(mylat,mylong);
document.getElementById("header").innerHTML = "Base location is set to the route "+locations[i][2];
}
}
return false;
}
</script>
</head>
<body onLoad="init();">
<header id="header">Base location (Kiel-Berlin by default)-Please change below: </header>
<div id="place" style="width:600px; height:400px"></div>
<div id="answer"></div>
Change base location: <br/>
<form name="f" onSubmit=" return changebase();">
<input type="radio" name="loc" /> Kiel-Berlin<br/>
<input type="radio" name="loc" /> Kiel-Hamburg<br/>
<input type="radio" name="loc" /> Berlin-Lubeck<br/>
<input type="submit" value="CHANGE">
</form>
</body>
</html> |