|
130 | 130 | //FIREFIGHTER
|
131 | 131 | //*retrieve elevation data from Samsung Gear
|
132 | 132 | //level = elevation / level_height
|
133 |
| - var fLvl = 1; |
| 133 | + var fLvl1 = 1; |
134 | 134 | //*retrieve latitude and longitude from Samsung Gear
|
135 |
| - var fLat = 34.056025; |
136 |
| - var fLong = -117.195750; |
| 135 | + var fLat1 = 34.056102774043914 |
| 136 | + var fLong1 = -117.19569445234714 |
| 137 | + var fLvl2 = 1; |
| 138 | + //*retrieve latitude and longitude from Samsung Gear |
| 139 | + var fLat2 = 34.056102774043914 |
| 140 | + var fLong2 = -117.19569445234714 |
| 141 | + var fLvl3 = 1; |
| 142 | + //*retrieve latitude and longitude from Samsung Gear |
| 143 | + var fLat3 = 34.056102774043914 |
| 144 | + var fLong3 = -117.19569445234714 |
137 | 145 | /*
|
138 | 146 | var fLat = [34.056166050304356, 34.05604351028498, 34.0560324451615]
|
139 | 147 | var fLong = [-117.19569956078443, -117.1957325361164, -117.19569938406546]
|
|
154 | 162 | geometry: ffpoint,
|
155 | 163 | symbol: markerSymbol
|
156 | 164 | });
|
157 |
| - ffpoint["z"] += 1.5 |
| 165 | + ffpoint["z"] += 1.5; |
158 | 166 | var ffpointText = new Graphic({
|
159 | 167 | geometry: ffpoint,
|
160 | 168 | symbol: {
|
161 | 169 | type: "text",
|
162 | 170 | text: "#01"
|
163 | 171 | }
|
164 | 172 | });
|
165 |
| - ffpoint["z"] -= 1.5 |
| 173 | + ffpoint["z"] -= 1.5; |
| 174 | + |
| 175 | + ffgraphicsLayer.add(ffpointGraphic); |
| 176 | + ffgraphicsLayer.add(ffpointText); |
| 177 | + |
| 178 | + var deleteold = setTimeout(del_f, 499); |
| 179 | + |
| 180 | + function del_f() { |
| 181 | + ffgraphicsLayer.remove(ffpointGraphic); |
| 182 | + ffgraphicsLayer.remove(ffpointText); |
| 183 | + } |
| 184 | + } |
| 185 | + |
| 186 | + |
| 187 | + function f2(lvl, lat, long) { |
| 188 | + var ffpoint = { |
| 189 | + type: "point", // autocasts as new Point() |
| 190 | + latitude: lat, |
| 191 | + longitude: long, |
| 192 | + z: human_height + (lvl - 1) * level_height |
| 193 | + }; |
| 194 | + markerSymbol = { |
| 195 | + type: "simple-marker", // autocasts as new SimpleMarkerSymbol() |
| 196 | + color: fcolor |
| 197 | + }; |
| 198 | + var ffpointGraphic = new Graphic({ |
| 199 | + geometry: ffpoint, |
| 200 | + symbol: markerSymbol |
| 201 | + }); |
| 202 | + ffpoint["z"] += 1.5; |
| 203 | + var ffpointText = new Graphic({ |
| 204 | + geometry: ffpoint, |
| 205 | + symbol: { |
| 206 | + type: "text", |
| 207 | + text: "#02" |
| 208 | + } |
| 209 | + }); |
| 210 | + ffpoint["z"] -= 1.5; |
| 211 | + |
| 212 | + ffgraphicsLayer.add(ffpointGraphic); |
| 213 | + ffgraphicsLayer.add(ffpointText); |
| 214 | + |
| 215 | + var deleteold = setTimeout(del_f, 499); |
| 216 | + |
| 217 | + function del_f() { |
| 218 | + ffgraphicsLayer.remove(ffpointGraphic); |
| 219 | + ffgraphicsLayer.remove(ffpointText); |
| 220 | + } |
| 221 | + } |
| 222 | + |
| 223 | + function f3(lvl, lat, long) { |
| 224 | + var ffpoint = { |
| 225 | + type: "point", // autocasts as new Point() |
| 226 | + latitude: lat, |
| 227 | + longitude: long, |
| 228 | + z: human_height + (lvl - 1) * level_height |
| 229 | + }; |
| 230 | + markerSymbol = { |
| 231 | + type: "simple-marker", // autocasts as new SimpleMarkerSymbol() |
| 232 | + color: fcolor |
| 233 | + }; |
| 234 | + var ffpointGraphic = new Graphic({ |
| 235 | + geometry: ffpoint, |
| 236 | + symbol: markerSymbol |
| 237 | + }); |
| 238 | + ffpoint["z"] += 1.5; |
| 239 | + var ffpointText = new Graphic({ |
| 240 | + geometry: ffpoint, |
| 241 | + symbol: { |
| 242 | + type: "text", |
| 243 | + text: "#03" |
| 244 | + } |
| 245 | + }); |
| 246 | + ffpoint["z"] -= 1.5; |
| 247 | + |
| 248 | + ffgraphicsLayer.add(ffpointGraphic); |
| 249 | + ffgraphicsLayer.add(ffpointText); |
| 250 | + |
| 251 | + var deleteold = setTimeout(del_f, 499); |
| 252 | + |
| 253 | + function del_f() { |
| 254 | + ffgraphicsLayer.remove(ffpointGraphic); |
| 255 | + ffgraphicsLayer.remove(ffpointText); |
| 256 | + } |
| 257 | + } |
| 258 | + |
| 259 | + function f3_change_v(lvl, lat, long) { |
| 260 | + var ffpoint = { |
| 261 | + type: "point", // autocasts as new Point() |
| 262 | + latitude: lat, |
| 263 | + longitude: long, |
| 264 | + z: human_height + (lvl - 1) * level_height |
| 265 | + }; |
| 266 | + markerSymbol = { |
| 267 | + type: "simple-marker", // autocasts as new SimpleMarkerSymbol() |
| 268 | + color: vcolor |
| 269 | + }; |
| 270 | + var ffpointGraphic = new Graphic({ |
| 271 | + geometry: ffpoint, |
| 272 | + symbol: markerSymbol |
| 273 | + }); |
| 274 | + ffpoint["z"] += 1.5; |
| 275 | + var ffpointText = new Graphic({ |
| 276 | + geometry: ffpoint, |
| 277 | + symbol: { |
| 278 | + type: "text", |
| 279 | + text: "#03" |
| 280 | + } |
| 281 | + }); |
| 282 | + ffpoint["z"] -= 1.5; |
166 | 283 |
|
167 | 284 | ffgraphicsLayer.add(ffpointGraphic);
|
168 | 285 | ffgraphicsLayer.add(ffpointText);
|
|
175 | 292 | }
|
176 | 293 | }
|
177 | 294 |
|
| 295 | + function f3_change_crit(lvl, lat, long) { |
| 296 | + var ffpoint = { |
| 297 | + type: "point", // autocasts as new Point() |
| 298 | + latitude: lat, |
| 299 | + longitude: long, |
| 300 | + z: human_height + (lvl - 1) * level_height |
| 301 | + }; |
| 302 | + markerSymbol = { |
| 303 | + type: "simple-marker", // autocasts as new SimpleMarkerSymbol() |
| 304 | + color: critvcolor |
| 305 | + }; |
| 306 | + var ffpointGraphic = new Graphic({ |
| 307 | + geometry: ffpoint, |
| 308 | + symbol: markerSymbol |
| 309 | + }); |
| 310 | + ffpoint["z"] += 1.5; |
| 311 | + var ffpointText = new Graphic({ |
| 312 | + geometry: ffpoint, |
| 313 | + symbol: { |
| 314 | + type: "text", |
| 315 | + text: "#03" |
| 316 | + } |
| 317 | + }); |
| 318 | + ffpoint["z"] -= 1.5; |
| 319 | + |
| 320 | + ffgraphicsLayer.add(ffpointGraphic); |
| 321 | + ffgraphicsLayer.add(ffpointText); |
| 322 | + |
| 323 | + var deleteold = setTimeout(del_f, 499); |
| 324 | + |
| 325 | + function del_f() { |
| 326 | + ffgraphicsLayer.remove(ffpointGraphic); |
| 327 | + ffgraphicsLayer.remove(ffpointText); |
| 328 | + } |
| 329 | + } |
| 330 | + |
| 331 | + |
| 332 | + |
| 333 | + // monitoring the health condition of the victim |
178 | 334 | var vpoint2_changed = {
|
179 | 335 | type: "point", // autocasts as new Point()
|
180 | 336 | latitude: 34.05607,
|
|
190 | 346 | symbol: markerSymbol
|
191 | 347 | });
|
192 | 348 |
|
193 |
| - // monitoring the health condition of the victim |
194 | 349 | function v_change_health() {
|
195 | 350 |
|
196 | 351 | vgraphicsLayer.remove(vpointGraphic2);
|
|
201 | 356 |
|
202 | 357 | //refresh firefighter position every second
|
203 | 358 |
|
204 |
| - var update = setInterval(fmovement1, 500); |
| 359 | + var update = setInterval(fmovement, 500); |
205 | 360 | var steps1 = [false, false, false, false, false, false]
|
206 | 361 |
|
207 |
| - function fmovement1() { |
| 362 | + var steps2 = [false, false, false, false] |
| 363 | + var steps3 = [false, false, false, false] |
| 364 | + |
| 365 | + function fmovement() { |
208 | 366 | if (!steps1[0]){
|
209 |
| - fLat = fLat + 0.000002; |
210 |
| - f(fLvl, fLat, fLong); |
211 |
| - if (fLat > 34.05605633804347){ |
| 367 | + fLat1 = fLat1 + 0.000001; |
| 368 | + f(fLvl1, fLat1, fLong1); |
| 369 | + if (fLat1 > 34.05605633804347){ |
212 | 370 | steps1[0] = true;
|
213 | 371 | }
|
214 | 372 | } else if (!steps1[1]) {
|
215 |
| - fLvl = fLvl + 0.05; |
216 |
| - f(fLvl, fLat, fLong); |
217 |
| - if (fLvl > 1.90) { |
| 373 | + fLvl1 = fLvl1 + 0.05; |
| 374 | + f(fLvl1, fLat1, fLong1); |
| 375 | + if (fLvl1 > 1.90) { |
218 | 376 | steps1[1] = true;
|
219 | 377 | }
|
220 | 378 | } else if (!steps1[2]) {
|
221 |
| - fLong = fLong + -0.00002; |
222 |
| - f(fLvl, fLat, fLong); |
223 |
| - if (fLong < -117.19582414483669){ |
| 379 | + fLong1 = fLong1 + -0.00002; |
| 380 | + f(fLvl1, fLat1, fLong1); |
| 381 | + if (fLong1 < -117.19582414483669){ |
224 | 382 | steps1[2] = true;
|
225 | 383 | vgraphicsLayer.remove(vpointGraphic1); // save the first victim
|
226 | 384 | }
|
227 | 385 | } else if (!steps1[3]) {
|
228 |
| - fLong = fLong + 0.00002; |
229 |
| - f(fLvl, fLat, fLong); |
230 |
| - if (fLong > -117.195750){ |
231 |
| - steps[3] = true; |
| 386 | + fLong1 = fLong1 + 0.00002; |
| 387 | + f(fLvl1, fLat1, fLong1); |
| 388 | + if (fLong1 > -117.195750){ |
| 389 | + steps1[3] = true; |
232 | 390 | }
|
233 | 391 | } else if (!steps1[4]) {
|
234 |
| - fLvl = fLvl + 0.05; |
235 |
| - f(fLvl, fLat, fLong); |
236 |
| - if (fLvl > 2.90) { |
237 |
| - steps[4] = true; |
| 392 | + fLvl1 = fLvl1 + 0.05; |
| 393 | + f(fLvl1, fLat1, fLong1); |
| 394 | + if (fLvl1 > 2.90) { |
| 395 | + steps1[4] = true; |
238 | 396 | }
|
239 | 397 | } else if (!steps1[5]) {
|
240 |
| - fLong = fLong - 0.00002; |
241 |
| - console.log(fLong); |
242 |
| - f(fLvl, fLat, fLong); |
243 |
| - if (fLong < -117.19589000000005) { |
244 |
| - steps[5] = true; |
| 398 | + fLong1 = fLong1 - 0.00002; |
| 399 | + f(fLvl1, fLat1, fLong1); |
| 400 | + if (fLong1 < -117.19589000000005) { |
| 401 | + steps1[5] = true; |
245 | 402 | vgraphicsLayer.remove(vpointGraphic2_changed); // save the second victim
|
246 | 403 | clearInterval(health_change);
|
247 | 404 | }
|
248 | 405 |
|
249 | 406 | }
|
| 407 | + |
| 408 | + if (!steps2[0]){ |
| 409 | + fLat2 = fLat2 + 0.000001; |
| 410 | + fLat3 = fLat3 + 0.000001; |
| 411 | + f2(fLvl2, fLat2, fLong2); |
| 412 | + f3(fLvl3, fLat3, fLong3); |
| 413 | + if (fLat2 > 34.05605633804347){ |
| 414 | + steps2[0] = true; |
| 415 | + } |
| 416 | + } else if (!steps2[1]) { |
| 417 | + fLvl2 = fLvl2 + 0.05; |
| 418 | + f2(fLvl2, fLat2, fLong2); |
| 419 | + fLong3 = fLong3 - 0.00001; |
| 420 | + f3(fLvl3, fLat3, fLong3); |
| 421 | + if (fLvl2 > 1.90) { |
| 422 | + steps2[1] = true; |
| 423 | + } |
| 424 | + } else if (!steps2[2]) { |
| 425 | + fLvl2 = fLvl2 - 0.05; |
| 426 | + f2(fLvl2, fLat2, fLong2); |
| 427 | + f3_change_v(fLvl3, fLat3, fLong3); |
| 428 | + if (fLvl2 <1) { |
| 429 | + steps2[2] = true; |
| 430 | + } |
| 431 | + } else if (!steps2[3]) { |
| 432 | + fLong2 = fLong2- 0.00001; |
| 433 | + f2(fLvl2, fLat2, fLong2); |
| 434 | + f3_change_crit(fLvl3, fLat3, fLong3); |
| 435 | + if (fLong2 < fLong3) { |
| 436 | + steps2[3] = true; |
| 437 | + } |
| 438 | + } |
| 439 | + |
250 | 440 | }
|
251 | 441 |
|
252 | 442 |
|
|
326 | 516 | <input class="checkbox" type="checkbox">1st Floor</input><br>
|
327 | 517 | <input class="checkbox" type="checkbox">2nd Floor</input><br>
|
328 | 518 | <input class="checkbox" type="checkbox">3rd Floor</input>
|
| 519 | + |
329 | 520 | </div>
|
330 | 521 | </body>
|
331 | 522 |
|
|
0 commit comments