-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
392 lines (352 loc) · 12.5 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
<!DOCTYPE html>
<html>
<head>
<title>Denali Overflight Cost-Distance Viewer</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
<script src="https://cdn.rawgit.com/angular-dragdrop/angular-dragdrop/master/draganddrop.js"></script>
<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600' rel='stylesheet' type='text/css'>
<script>
viewer = angular.module("LeastCostViewer", ["ang-drag-drop"])
.controller("main", function($scope, $http) {
var layers = ['agl_resis','bcmp_resis','bestp_resis','buffer_resis','camp_resis','hiker_resis','jets_resis','l50_resis','nfi_resis','riv_resis','roads_resis','sens_resis','straight_resis','travel_resis'];
$scope.layerInfo = {
'agl_resis': {
title: "Distance from ground",
info: "Distance from ground surface to elevation of 8000 feet. Following topographic lows is one of the best ways to reduce noise impact. White = highest cost."
},
'bcmp_resis': {
title: "BCMP zones",
info: "Sets standards for the amount and intensity of noise permissible in different areas of the park. Contains four zones: Low, Med, High, V. High. White = highest cost."
},
'bestp_resis': {
title: "FACA best practices",
info: "Areas the Overflights Advisory Council recommended avoiding, 2007-2012. Most notable is the 'purple polygon' along spine of the Alaska range. White = highest cost."
},
'buffer_resis': {
title: "Avoid DENA overflight",
info: "Entirely avoid flying inside the boundaries of the park. White = highest cost."
},
'camp_resis': {
title: "Campgrounds",
info: "Avoid flying near campgrounds to preserve quietude. Recognized by the FACA group as sound-sensitive areas, but not included on their map. White = highest cost."
},
'hiker_resis': {
title: "Hiker density",
info: "Avoid flying over areas of high day-hiker and backpacker density. White = highest cost."
},
'jets_resis': {
title: "Avoid low jet traffic",
info: "Preserve existing quietude by avoiding areas with low high-altitude jet traffic. White = highest cost."
},
'l50_resis': {
title: "Ambient noise level",
info: "Prefer flying over naturally louder areas, like streams. Based on modeling of median sound pressure level across the entire state. White = highest cost."
},
'nfi_resis': {
title: "Noise-free interval",
info: "Areas with the lowest 24-hour noise-free intervals should not be sacrificed. White = highest cost."
},
'riv_resis': {
title: "Rivers",
info: "Prefer to fly nearer to rivers, as they mask human noise. White = highest cost."
},
'roads_resis': {
title: "Road",
info: "Prefer flying over the road. This was an idea discussed and vetted by the FACA group. White = highest cost."
},
'sens_resis': {
title: "Sound-sensitive areas",
info: "FACA group \"sound sensitive areas\". White = highest cost."
},
'straight_resis': {
title: "Flight directness",
info: "Prefer straighter lines from each airport to the Denali massif. White = highest cost."
},
'travel_resis': {
title: "Hiking distance",
info: "Perfer flying over areas that are easier to hike to. The desire for solitude is often correlated with the energy expended to find it. White = highest cost."
}
};
var weightsAvailable = [8, 2, 0];
$scope.layerMasks = {
'agl_resis' : 1,
'bcmp_resis' : 1,
'bestp_resis' : 1,
'buffer_resis' : 0,
'camp_resis' : 0,
'hiker_resis' : 1,
'jets_resis' : 0,
'l50_resis' : 1,
'nfi_resis' : 0,
'riv_resis' : 0,
'roads_resis' : 0,
'sens_resis' : 0,
'straight_resis' : 1,
'travel_resis' : 1
}
$scope.imgpath = window.location.host == "" ? "http://localhost:8000/" : "https://s3.amazonaws.com/denali-overflights/Results/Images/primary_colors_fixed/";
$scope.basemap = {
'hillshade': "Viewer/layers/hillshade.png",
'airports': "Viewer/layers/airports.png",
'dena': "Viewer/layers/DENA_outline.png",
'roads': "Viewer/layers/Roads.png",
'lcp': "Viewer/layers/LCP.png",
'current': "Viewer/layers/Current_routes.png"
};
$scope.about = "Set the importance of different routing factors by dragging them between weight bins, and see how the optimal paths change. Save interesting scenarios to revisit them later. Created by Gabe Joseph and the Denali National Park Physical Sciences Divsion.";
$scope.layers = layers;
$scope.weightsAvailable = weightsAvailable;
$scope.layersAvailable = layers.filter(function(layer) {
return $scope.layerMasks[layer]
});
$scope.weights = {};
$scope.scenarios = [];
$scope.i = {}; // encapsulate global interface params in an object so they can be modified inside scopes of ng-repeat, etc
$scope.i.soloCostRaster = null;
$scope.i.info = '';
var scenariosCounter = 0;
angular.forEach(layers, function(layer) {
$scope.weights[layer] = 0;
});
$scope.saveScenario = function() {
$scope.scenarios.push({
name: "Scenario " + ++scenariosCounter,
weights: angular.copy($scope.weights)
});
};
$scope.loadScenario = function(i) {
console.log("loading", $scope.scenarios[i]);
$scope.weights = angular.copy( $scope.scenarios[i].weights );
$scope.backupWeights = null;
};
$scope.deleteScenario = function(i) {
console.log("deleting", $scope.scenarios[i]);
$scope.scenarios.splice(i, 1);
};
$scope.previewScenario = function(i) {
console.log("previewing", $scope.scenarios[i]);
$scope.backupWeights = $scope.weights;
$scope.weights = $scope.scenarios[i].weights;
};
$scope.clearPreview = function() {
if ($scope.backupWeights) {
console.log("clear previewing");
$scope.weights = $scope.backupWeights;
$scope.backupWeights = null;
}
};
$scope.weightCode = function() {
var weights = layers.map(function(layer) {
return $scope.weights[layer]
});
return weights.join("");
};
$scope.soloWeightCode = function() {
var weights = layers.map(function() {return 0});
if ($scope.i.soloCostRaster) {
var i = layers.indexOf($scope.i.soloCostRaster);
weights[i] = weightsAvailable[0];
}
return weights.join("");
};
})
.directive('onEnter', function() {
// Evaluate the expression when the user presses enter on the element
return {
restrict: 'A',
replace: true,
link: function(scope, elem, attrs) {
elem.bind('keydown keypress', function(event) {
if (event.keyCode == 13) {
scope.$apply(attrs.onEnter);
event.preventDefault();
}
});
}
}
})
;
</script>
<style>
html, body {
/*background: radial-gradient(ellipse at center, #313338 0%,#282828 100%);*/
width: 100%;
height: 100%;
margin: 0;
padding: 0;
display: flex;
font-family: 'Source Sans Pro', sans-serif;
}
h1,h2,h3,h4 {
color: #34495e;
}
h1 {
color: #42b983;
}
.sidebar {
flex: 1;
max-width: 250px;
/*height: 100%;*/
/*margin: 2px;*/
padding: 15px;
box-shadow: 0 0px 5px rgba(0,0,0,0.9);
}
#content {
flex: 1;
height: 100%;
position: relative;
z-index: -1;
}
#left {
/*border-right: 1px solid darkgray;*/
}
#right {
/*border-left: 1px solid darkgray;*/
max-width: 200px;
display: flex;
flex-direction: column;
}
#scenarios {
flex: 2;
overflow: hidden;
}
#info {
flex: 1;
border-top: 1px solid #DADADA;
}
.map-center {
display: flex;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
margin: 0;
justify-content: center;
align-items: center;
overflow: hidden;
}
.map {
flex: 1;
width: 100%;
}
.weightsbox {
min-height: 36px;
border: 1px solid #DADADA;
box-shadow: 0 1px 1px rgba(0,0,0,0.1);
}
.weightsbox.on-drag-hover {
background-color: #f9f9f9;
}
.weight {
margin: 3px;
padding: 3px 5px;
display: inline-block;
border: 1px solid #DADADA;
background-color: #f0f0f0;
border-radius: 3px;
-webkit-user-select: none;
cursor: move;
transition: border-color .1s;
transition: background-color .1s;
color: #1A1A1A;
}
.weight:hover {
border-color: darkgray;
background-color: #f9f9f9;
}
.pinbottom {
position: absolute;
bottom: 0;
margin: 10px 0;
}
.scenario {
margin: 0;
padding: 12px 10px;
border: none;
border-top: 1px solid #DADADA;
cursor: pointer;
}
.scenario .name {
cursor: text;
}
.scenario .delete {
float: right;
color: inherit;
transition: color .08s;
}
.scenario .delete:hover {
color: rgb(226, 129, 0);
}
.scenario:hover {
background-color: #f9f9f9;
font-weight: bold;
}
</style>
</head>
<body ng-app="LeastCostViewer" ng-controller="main">
<div class="sidebar" id="left">
<h1>Routing Factors</h1>
<div class="weighting" ng-repeat="weight in weightsAvailable">
<h2>Weight: {{weight}}</h2>
<div class="weightsbox"
ui-on-drop="(weights[$data] = weight) + (i.soloCostRaster = null)"
ng-mouseleave="i.info = ''"
>
<span class="weight"
ng-repeat="layer in layersAvailable"
ng-if="weights[layer] == weight"
ui-draggable="true"
drag="layer"
ng-dblclick="(weights[layer] = (weights[layer] > 0 ? 0 : weightsAvailable[1])) + (i.soloCostRaster = null)"
ng-mouseenter="(i.soloCostRaster = layer) + (i.info = layerInfo[layer].info)"
ng-mouseleave="i.soloCostRaster = null"
>{{layerInfo[layer].title}}</span>
</div>
</div>
<div class="pinbottom">
<div>
<input type="checkbox" id="showCost" ng-model="showCostRaster"> <label for="showCost">Show cost raster</label>
</div>
<div>
<input type="checkbox" id="showCurrentRoutes" ng-model="showCurrentRoutes"> <label for="showCurrentRoutes">Show sample of current routes</label>
</div>
</div>
</div>
<div id="content">
<div class="map-center"><img class="map" ng-src="{{basemap.hillshade}}" alt="Whoops, there's no hillshade"/></div>
<div class="map-center"><img class="map" ng-src="{{imgpath + 'cost/' + weightCode() + '.png'}}" ng-if="showCostRaster" alt="Whoops, there's no cost raster rendered for that combination of weights"/></div>
<div class="map-center"><img class="map" ng-src="{{imgpath + 'cost/' + soloWeightCode() + '.png'}}" ng-if="showCostRaster && i.soloCostRaster" alt="Whoops, there's no cost raster rendered for that combination of weights"/></div>
<div class="map-center"><img class="map" ng-src="{{basemap.roads}}" alt="Whoops, there's no roads"/></div>
<div class="map-center"><img class="map" ng-src="{{basemap.dena}}" alt="Whoops, there's no dena"/></div>
<div class="map-center"><img class="map" ng-src="{{basemap.current}}" alt="Whoops, there's no current routes"/ ng-show="showCurrentRoutes"></div>
<div class="map-center"><img class="map" id="map" ng-src="{{imgpath + 'LCP/' + weightCode() + '.png'}}" alt="Whoops, there's no map rendered for that combination of weights"/></div>
<!-- <div class="map-center"><img class="map" id="map" ng-src="{{basemap.lcp}}" alt="Whoops, there's no map rendered for that combination of weights"/></div> -->
<div class="map-center"><img class="map" ng-src="{{basemap.airports}}" alt="Whoops, there's no airports"/></div>
</div>
<div class="sidebar" id="right">
<div id="scenarios">
<h1>Scenarios</h1>
<div class="scenario">
<a href="" ng-click="saveScenario()">Save current scenario</a>
</div>
<div class="scenario"
ng-repeat="scenario in scenarios"
ng-click="loadScenario($index)"
ng-mouseenter="previewScenario($index)"
ng-mouseleave="clearPreview()"
>
<span class="name" ng-show="!scenario.editing" ng-click="scenario.editing = true">{{scenario.name}}</span>
<input type="text" ng-model="scenario.name" class="name" ng-show="scenario.editing" on-enter="scenario.editing = false"/>
<span ng-click="deleteScenario($index)" class="delete">✖</span>
</div>
</div>
<div id="info">
<p>{{i.info}}</p>
<div class="pinbottom">
<a href="" ng-mouseenter="i.info = about" ng-mouseleave="i.info = ''">About</a>
</div>
</div>
</div>
</body>
</html>