forked from FirstNetHack/comWebApp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathswiftrescue.html
More file actions
164 lines (145 loc) · 5.16 KB
/
Copy pathswiftrescue.html
File metadata and controls
164 lines (145 loc) · 5.16 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
<!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/dom",
"dojo/domReady!"
], function(
SceneView, LayerList, WebScene, GraphicsLayer, Graphic
) {
// CREATE WEBSCENE
var scene = new WebScene({
portalItem: { // autocasts as new PortalItem()
id: "65f45cdfd7a04dbb9b0863880fe8c921"
}
});
var view = new SceneView({
container: "viewDiv",
map: scene
});
// 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
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 graphicsLayer = new GraphicsLayer();
scene.add(graphicsLayer);
//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
//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;
function f(lvl, lat, long){
var point = {
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 pointGraphic = new Graphic({
geometry: point,
symbol: markerSymbol
});
graphicsLayer.add(pointGraphic);
var deleteold = setTimeout(del_f, 499);
function del_f() {
graphicsLayer.remove(pointGraphic);
}
}
//refresh firefighter position every second
var update = setInterval(fmovement, 500);
function fmovement() {
fLat = fLat+0.000002;
f(fLvl,fLat,fLong);
}
// VICTIM
var lvl = 2
var point = {
type: "point", // autocasts as new Point()
latitude: 34.056238,
longitude: -117.195945,
z: human_height + (lvl-1)*level_height
};
markerSymbol = {
type: "simple-marker", // autocasts as new SimpleMarkerSymbol()
color: vcolor
};
var pointGraphic = new Graphic({
geometry: point,
symbol: markerSymbol
});
graphicsLayer.add(pointGraphic);
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");
});
});
</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;
}
</style>
</head>
<body>
<div id="viewDiv">
<div id="titleDiv"></div>
</div>
</body>
</html>