-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
523 lines (462 loc) · 17.7 KB
/
index.html
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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
<title>Commander's Screen</title>
<link rel="stylesheet" href="https://js.arcgis.com/4.6/esri/css/main.css">
<script src="https://js.arcgis.com/4.6/"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script src="index.js"></script>
<script>
require([
"esri/views/SceneView",
"esri/widgets/LayerList",
"esri/WebScene",
"esri/layers/GraphicsLayer",
"esri/Graphic",
"dojo/domReady!",
"esri/PopupTemplate"
], function(
SceneView, LayerList, WebScene, GraphicsLayer, Graphic
) {
// CREATE WEBSCENE
var scene = new WebScene({
portalItem: { // autocasts as new PortalItem()
id: "96e6fa021c2c4e89b9cb08d2da4ba1cf"
}
});
var view = new SceneView({
container: "viewDiv",
map: scene
});
view.then(function() {
// SceneView is now ready for display and can be used. Here we will
// use goTo to view a particular location at a given zoom level, camera
// heading and tilt.
view.goTo({
center: [-117.19567374569843, 34.056143337645516],
zoom: 20,
heading: 30,
tilt: 60
})
})
.otherwise(function(err) {
// A rejected view indicates a fatal error making it unable to display,
// this usually means that WebGL is not available, or too old.
console.error("SceneView rejected:", err);
});
// RETRIEVE COORDINATES / MODIFY POPUP
view.on("click", function(event) {
event.stopPropagation();
// Get the coordinates of the click on the view
// around the decimals to 3 decimals
console.log(event.mapPoint)
view.popup.open({
// Set the popup's title to the coordinates of the clicked location
title: event.mapPoint["z"],
location: event.mapPoint // Set the location of the popup to the clicked location
});
});
//PEOPLE ONSITE - GRAPHIC POINTS
var ffgraphicsLayer = new GraphicsLayer({
title: "Firefighters"
});
scene.add(ffgraphicsLayer);
var vgraphicsLayer = new GraphicsLayer({
title: "Victims"
});
scene.add(vgraphicsLayer);
//display layerlist
view.when(function() {
var layerList = new LayerList({
view: view
});
// Add widget to the top right corner of the view
view.ui.add(layerList, "top-right");
});
//z-axis parameters - z-axis units
var human_height = 2.38;
var level_height = 4.777;
//LEGEND COLOR
var fcolor = [0, 225, 0, 0.75]; //green pts for firefighters
var vcolor = [225, 225, 0, 0.75]; //yellow pt for victim
var critvcolor = [225, 0, 0, 0.75]; //red pt for victims in critical condition
// victim 1 & 2
var vpoint1 = {
type: "point", // autocasts as new Point()
latitude: 34.05607,
longitude: -117.19583,
z: 7
};
markerSymbol = {
type: "simple-marker", // autocasts as new SimpleMarkerSymbol()
color: critvcolor
};
var vpointGraphic1 = new Graphic({
geometry: vpoint1,
symbol: markerSymbol
});
vgraphicsLayer.add(vpointGraphic1);
var vpoint2 = {
type: "point", // autocasts as new Point()
latitude: 34.05607,
longitude: -117.19591,
z: 11.5
};
markerSymbol = {
type: "simple-marker", // autocasts as new SimpleMarkerSymbol()
color: vcolor
};
var vpointGraphic2 = new Graphic({
geometry: vpoint2,
symbol: markerSymbol
});
vgraphicsLayer.add(vpointGraphic2);
//FIREFIGHTER
//*retrieve elevation data from Samsung Gear
//level = elevation / level_height
var fLvl1 = 1;
//*retrieve latitude and longitude from Samsung Gear
var fLat1 = 34.056102774043914
var fLong1 = -117.19569445234714
var fLvl2 = 1;
//*retrieve latitude and longitude from Samsung Gear
var fLat2 = 34.056102774043914
var fLong2 = -117.19569445234714
var fLvl3 = 1;
//*retrieve latitude and longitude from Samsung Gear
var fLat3 = 34.056102774043914
var fLong3 = -117.19569445234714
/*
var fLat = [34.056166050304356, 34.05604351028498, 34.0560324451615]
var fLong = [-117.19569956078443, -117.1957325361164, -117.19569938406546]
*/
// firefighters
function f(lvl, lat, long) {
var ffpoint = {
type: "point", // autocasts as new Point()
latitude: lat,
longitude: long,
z: human_height + (lvl - 1) * level_height
};
markerSymbol = {
type: "simple-marker", // autocasts as new SimpleMarkerSymbol()
color: fcolor
};
var ffpointGraphic = new Graphic({
geometry: ffpoint,
symbol: markerSymbol
});
ffpoint["z"] += 1.5;
var ffpointText = new Graphic({
geometry: ffpoint,
symbol: {
type: "text",
text: "#01"
}
});
ffpoint["z"] -= 1.5;
ffgraphicsLayer.add(ffpointGraphic);
ffgraphicsLayer.add(ffpointText);
var deleteold = setTimeout(del_f, 499);
function del_f() {
ffgraphicsLayer.remove(ffpointGraphic);
ffgraphicsLayer.remove(ffpointText);
}
}
function f2(lvl, lat, long) {
var ffpoint = {
type: "point", // autocasts as new Point()
latitude: lat,
longitude: long,
z: human_height + (lvl - 1) * level_height
};
markerSymbol = {
type: "simple-marker", // autocasts as new SimpleMarkerSymbol()
color: fcolor
};
var ffpointGraphic = new Graphic({
geometry: ffpoint,
symbol: markerSymbol
});
ffpoint["z"] += 1.5;
var ffpointText = new Graphic({
geometry: ffpoint,
symbol: {
type: "text",
text: "#02"
}
});
ffpoint["z"] -= 1.5;
ffgraphicsLayer.add(ffpointGraphic);
ffgraphicsLayer.add(ffpointText);
var deleteold = setTimeout(del_f, 499);
function del_f() {
ffgraphicsLayer.remove(ffpointGraphic);
ffgraphicsLayer.remove(ffpointText);
}
}
function f3(lvl, lat, long) {
var ffpoint = {
type: "point", // autocasts as new Point()
latitude: lat,
longitude: long,
z: human_height + (lvl - 1) * level_height
};
markerSymbol = {
type: "simple-marker", // autocasts as new SimpleMarkerSymbol()
color: fcolor
};
var ffpointGraphic = new Graphic({
geometry: ffpoint,
symbol: markerSymbol
});
ffpoint["z"] += 1.5;
var ffpointText = new Graphic({
geometry: ffpoint,
symbol: {
type: "text",
text: "#03"
}
});
ffpoint["z"] -= 1.5;
ffgraphicsLayer.add(ffpointGraphic);
ffgraphicsLayer.add(ffpointText);
var deleteold = setTimeout(del_f, 499);
function del_f() {
ffgraphicsLayer.remove(ffpointGraphic);
ffgraphicsLayer.remove(ffpointText);
}
}
function f3_change_v(lvl, lat, long) {
var ffpoint = {
type: "point", // autocasts as new Point()
latitude: lat,
longitude: long,
z: human_height + (lvl - 1) * level_height
};
markerSymbol = {
type: "simple-marker", // autocasts as new SimpleMarkerSymbol()
color: vcolor
};
var ffpointGraphic = new Graphic({
geometry: ffpoint,
symbol: markerSymbol
});
ffpoint["z"] += 1.5;
var ffpointText = new Graphic({
geometry: ffpoint,
symbol: {
type: "text",
text: "#03"
}
});
ffpoint["z"] -= 1.5;
ffgraphicsLayer.add(ffpointGraphic);
ffgraphicsLayer.add(ffpointText);
var deleteold = setTimeout(del_f, 499);
function del_f() {
ffgraphicsLayer.remove(ffpointGraphic);
ffgraphicsLayer.remove(ffpointText);
}
}
function f3_change_crit(lvl, lat, long) {
var ffpoint = {
type: "point", // autocasts as new Point()
latitude: lat,
longitude: long,
z: human_height + (lvl - 1) * level_height
};
markerSymbol = {
type: "simple-marker", // autocasts as new SimpleMarkerSymbol()
color: critvcolor
};
var ffpointGraphic = new Graphic({
geometry: ffpoint,
symbol: markerSymbol
});
ffpoint["z"] += 1.5;
var ffpointText = new Graphic({
geometry: ffpoint,
symbol: {
type: "text",
text: "#03"
}
});
ffpoint["z"] -= 1.5;
ffgraphicsLayer.add(ffpointGraphic);
ffgraphicsLayer.add(ffpointText);
var deleteold = setTimeout(del_f, 499);
function del_f() {
ffgraphicsLayer.remove(ffpointGraphic);
ffgraphicsLayer.remove(ffpointText);
}
}
// monitoring the health condition of the victim
var vpoint2_changed = {
type: "point", // autocasts as new Point()
latitude: 34.05607,
longitude: -117.19591,
z: 11.5
};
markerSymbol = {
type: "simple-marker", // autocasts as new SimpleMarkerSymbol()
color: critvcolor
};
var vpointGraphic2_changed = new Graphic({
geometry: vpoint2_changed,
symbol: markerSymbol
});
function v_change_health() {
vgraphicsLayer.remove(vpointGraphic2);
vgraphicsLayer.add(vpointGraphic2_changed);
}
var health_change = setInterval(v_change_health, 20500);
//refresh firefighter position every second
var update = setInterval(fmovement, 500);
var steps1 = [false, false, false, false, false, false]
var steps2 = [false, false, false, false]
var steps3 = [false, false, false, false]
function fmovement() {
if (!steps1[0]){
fLat1 = fLat1 + 0.000001;
f(fLvl1, fLat1, fLong1);
if (fLat1 > 34.05605633804347){
steps1[0] = true;
}
} else if (!steps1[1]) {
fLvl1 = fLvl1 + 0.05;
f(fLvl1, fLat1, fLong1);
if (fLvl1 > 1.90) {
steps1[1] = true;
}
} else if (!steps1[2]) {
fLong1 = fLong1 + -0.00002;
f(fLvl1, fLat1, fLong1);
if (fLong1 < -117.19582414483669){
steps1[2] = true;
vgraphicsLayer.remove(vpointGraphic1); // save the first victim
}
} else if (!steps1[3]) {
fLong1 = fLong1 + 0.00002;
f(fLvl1, fLat1, fLong1);
if (fLong1 > -117.195750){
steps1[3] = true;
}
} else if (!steps1[4]) {
fLvl1 = fLvl1 + 0.05;
f(fLvl1, fLat1, fLong1);
if (fLvl1 > 2.90) {
steps1[4] = true;
}
} else if (!steps1[5]) {
fLong1 = fLong1 - 0.00002;
f(fLvl1, fLat1, fLong1);
if (fLong1 < -117.19589000000005) {
steps1[5] = true;
vgraphicsLayer.remove(vpointGraphic2_changed); // save the second victim
clearInterval(health_change);
}
}
if (!steps2[0]){
fLat2 = fLat2 + 0.000001;
fLat3 = fLat3 + 0.000001;
f2(fLvl2, fLat2, fLong2);
f3(fLvl3, fLat3, fLong3);
if (fLat2 > 34.05605633804347){
steps2[0] = true;
}
} else if (!steps2[1]) {
fLvl2 = fLvl2 + 0.05;
f2(fLvl2, fLat2, fLong2);
fLong3 = fLong3 - 0.00001;
f3(fLvl3, fLat3, fLong3);
if (fLvl2 > 1.90) {
steps2[1] = true;
}
} else if (!steps2[2]) {
fLvl2 = fLvl2 - 0.05;
f2(fLvl2, fLat2, fLong2);
f3_change_v(fLvl3, fLat3, fLong3);
if (fLvl2 <1) {
steps2[2] = true;
}
} else if (!steps2[3]) {
fLong2 = fLong2- 0.00001;
f2(fLvl2, fLat2, fLong2);
f3_change_crit(fLvl3, fLat3, fLong3);
if (fLong2 < fLong3) {
steps2[3] = true;
}
}
}
});
</script>
<style>
html,
body,
#viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
#titleDiv {
background-color: lightgray;
color: black;
padding: 5px;
position: absolute;
z-index: 2;
top: 0;
right: 0;
font-size: 20pt;
font-weight: bolder;
width: 100%;
height: 30px;
text-align: center;
opacity: 0.75;
}
.progress {
position: fixed;
right: 50px;
top: 500px;
background-color: white;
border: 1px solid black;
padding: 10px 30px 10px 10px;
}
progress {
margin: auto;
-webkit-appearance: none;
}
::-webkit-progress-bar {
border: 1px solid black;
background-color: white;
color: red;
}
::-webkit-progress-value {
background-image: -webkit-linear-gradient(-45deg,
transparent 33%, rgba(0, 0, 0, .1) 33%,
rgba(0, 0, 0, .1) 66%, transparent 66%),
-webkit-linear-gradient(top,
rgba(255, 255, 255, .25),
rgba(0, 0, 0, .25)),
-webkit-linear-gradient(left, #f44, #008000);
border-radius: 2px;
background-size: 35px 20px, 100% 100%, 100% 100%;
}
</style>
</head>
<body>
<div id="viewDiv">
<div id="titleDiv"></div>
</div>
<div class="progress">
Progress: <br>
<progress max="100" value="0"></progress><br>
<input class="checkbox" type="checkbox">1st Floor</input><br>
<input class="checkbox" type="checkbox">2nd Floor</input><br>
<input class="checkbox" type="checkbox">3rd Floor</input>
</div>
</body>
</html>