forked from FirstNetHack/comWebApp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsrescue.html
More file actions
275 lines (246 loc) · 9.05 KB
/
Copy pathsrescue.html
File metadata and controls
275 lines (246 loc) · 9.05 KB
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
<!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.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.05604,
longitude: -117.196,
z: 7
};
markerSymbol = {
type: "simple-marker", // autocasts as new SimpleMarkerSymbol()
color: vcolor
};
var vpointGraphic1 = new Graphic({
geometry: vpoint1,
symbol: markerSymbol
});
vgraphicsLayer.add(vpointGraphic1);
var vpoint2 = {
type: "point", // autocasts as new Point()
latitude: 34.05604,
longitude: -117.196,
z: 11.5
};
markerSymbol = {
type: "simple-marker", // autocasts as new SimpleMarkerSymbol()
color: critvcolor
};
var vpointGraphic2 = new Graphic({
geometry: vpoint2,
symbol: markerSymbol
});
vgraphicsLayer.add(vpointGraphic2);
//FIREFIGHTER
//*retrieve elevation data from Samsung Gear
//level = elevation / level_height
var fLvl = 1;
//*retrieve latitude and longitude from Samsung Gear
var fLat = 34.056025;
var fLong = -117.195750;
/*
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);
}
}
//refresh firefighter position every second
var update = setInterval(fmovement, 500);
function fmovement() {
fLat = fLat+0.000002;
f(fLvl,fLat,fLong);
}
/*
var i = 0;
var l = fLat.length;
var update = setTimeout(fmovement,4000);
function fmovement(){
f(fLvl,fLat[i],fLong[i]);
i+=1;
if(i<l){
}
}
*/
});
</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>