-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
508 lines (453 loc) · 24.1 KB
/
index.html
File metadata and controls
508 lines (453 loc) · 24.1 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
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
<!DOCTYPE html>
<html dir="ltr">
<!-- Created on 23/May/2018 for displaying and updating progress of strip in a Road network by Arun Prasad @GeoDevs -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no" />
<title>GeoDevs Basic</title>
<link rel="icon" href="images/geoLogo.png" type="image/png" /> <!-- Title Image of the Page // to be changed -->
<link rel="stylesheet" href="https://js.arcgis.com/3.24/esri/themes/calcite/dijit/calcite.css">
<link rel="stylesheet" href="https://js.arcgis.com/3.24/esri/themes/calcite/esri/esri.css">
<link rel="stylesheet" href="layout.css"><!-- Custom style sheet created on 23/May/2018 -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<style>
html,
body,
#map {
height: 100%;
width: 100%;
margin: 0;
padding: 0;
}
#search {
display: block;
position: absolute;
z-index: 2;
top: 80px;
left: 30px;
}
.esriSimpleSliderTL {
top: 80px !important;
left: 30px !important;
}
.HomeButton .home {
display: block;
position: absolute;
z-index: 2;
top: 210px;
left: 30px;
}
</style>
<script src="https://js.arcgis.com/3.24/"></script>
<script>
var map;
var identifyStatus = false;
var navOptions = {"zoomIn":{"cursor":"zoom-in", "name":"zoomIn"},
"zoomOut":{"cursor":"zoom-out", "name":"zoomOut"},
"prevExt":{"cursor":"default", "name":"prevExt"},
"nxtExt":{"cursor":"default", "name":"nxtExt"},
"pan":{"cursor":"-webkit-grab", "name":"pan"},
"deactivate":{"cursor":"default", "name":"deactivate"},
"info":{"cursor":"help", "name":"deactivate"}
};
require([
"esri/map",
"esri/dijit/Search",
"esri/dijit/HomeButton",
"esri/toolbars/navigation",
"esri/dijit/BasemapGallery",
"esri/layers/ImageParameters",
"esri/layers/ArcGISDynamicMapServiceLayer",
"esri/tasks/IdentifyTask",
"esri/tasks/IdentifyParameters",
"esri/InfoTemplate",
"esri/dijit/Legend",
"esri/dijit/Measurement",
"esri/units",
"dojo/_base/array",
"dojo/domReady!"
], function (Map, Search, HomeButton, Navigation,BasemapGallery, ImageParameters, ArcGISDynamicMapServiceLayer, IdentifyTask, IdentifyParameters, InfoTemplate,Legend, Measurement,Units, arrayUtils) {
map = new Map("map", {
basemap: "dark-gray",
// center: [-120.435, 46.159], // lon, lat
center:[-118.274232, 34.037714],
zoom: 10
});
var search = new Search({
map: map
}, "search");
search.startup();
var homeButton = new HomeButton({
theme: "HomeButton",
map: map,
extent: null,
visible: true
}, "home");
homeButton.startup();
/* Basemap gallery widget created on 24/May/2018 */
var basemapGallery = new BasemapGallery({
showArcGISBasemaps: true,
map: map,
defaultAreaUnit: Units.SQUARE_MILES,
defaultLengthUnit: Units.KILOMETERS
}, "basemapGallery");
basemapGallery.startup();
var measureWidget = new Measurement({
map:map
},"measureWidget");
measureWidget.startup();
var progressList = {none:"none", basemap:"toogleBasemap", legend:"legendList", measure:"measureTool"};
var containerIds = {basemap:"#toogleBasemapColumn", legend:"#legendColumn", measure:"#measureColumn"};
var currentProgress = progressList.none;
/* Legend Content -- **START** */
map.on("load", function (evt) {
map.setZoom(map.getZoom()+1);
// var legendLayers = [];
// legendLayers.push({
// layer:mapService,
// title:" ",
// // hideLayers:[config.others.legend.duplicateActivityLayerId]
// });
// var legendDijit = new Legend({
// map: map,
// layerInfos:legendLayers
// }, "legendContent");
// legendDijit.startup();
});
/* Legend Content -- **END** */
/* Navigation Toolbar Code - **START** */
// Create navigation tools
navToolbar = new Navigation(map);
$(document).ready(function(){
$("#zoomIn").click(function(){
navToolbar.activate(Navigation.ZOOM_IN);
changeOptions(navOptions.zoomIn); // To change the cursor as per user interaction
});
$("#zoomOut").click(function(){
navToolbar.activate(Navigation.ZOOM_OUT);
changeOptions(navOptions.zoomOut);
});
$("#prevExt").click(function(){
navToolbar.zoomToPrevExtent();
changeOptions(navOptions.prevExt);
});
$("#nxtExt").click(function(){
navToolbar.zoomToNextExtent();
changeOptions(navOptions.nxtExt);
});
$("#pan").click(function(){
navToolbar.activate(Navigation.PAN);
changeOptions(navOptions.pan);
});
$("#deactivate").click(function(){
navToolbar.deactivate();
changeOptions(navOptions.deactivate);
});
$("#info").click(function(){
navToolbar.deactivate();
changeOptions(navOptions.info);
});
});
function changeOptions(navOption) {
if(navOption == navOptions.zoomIn) {
map.setMapCursor(navOptions.zoomIn.cursor);
identifyStatus = false;
$("#zoomIn").css("background", "#a5a1a1");
$("#zoomOut").css("background", "white");
$("#prevExt").css("background", "white");
$("#nxtExt").css("background", "white");
$("#pan").css("background", "white");
$("#info").css("background", "white");
} else if(navOption == navOptions.zoomOut) {
map.setMapCursor(navOptions.zoomOut.cursor);
identifyStatus = false;
$("#zoomIn").css("background", "white");
$("#zoomOut").css("background", "#a5a1a1");
$("#prevExt").css("background", "white");
$("#nxtExt").css("background", "white");
$("#pan").css("background", "white");
$("#info").css("background", "white");
} else if(navOption == navOptions.prevExt) {
map.setMapCursor(navOptions.prevExt.cursor);
navToolbar.deactivate();
identifyStatus = false;
$("#zoomIn").css("background", "white");
$("#zoomOut").css("background", "white");
$("#prevExt").css("background", "white");
$("#nxtExt").css("background", "white");
$("#pan").css("background", "white");
$("#info").css("background", "white");
} else if(navOption == navOptions.nxtExt) {
map.setMapCursor(navOptions.nxtExt.cursor);
navToolbar.deactivate();
identifyStatus = false;
$("#zoomIn").css("background", "white");
$("#zoomOut").css("background", "white");
$("#prevExt").css("background", "white");
$("#nxtExt").css("background", "white");
$("#pan").css("background", "white");
$("#info").css("background", "white");
} else if(navOption == navOptions.pan) {
map.setMapCursor(navOptions.pan.cursor);
identifyStatus = false;
$("#zoomIn").css("background", "white");
$("#zoomOut").css("background", "white");
$("#prevExt").css("background", "white");
$("#nxtExt").css("background", "white");
$("#pan").css("background", "#a5a1a1");
$("#info").css("background", "white");
} else if(navOption == navOptions.deactivate) {
map.setMapCursor(navOptions.deactivate.cursor);
identifyStatus = false;
$("#zoomIn").css("background", "white");
$("#zoomOut").css("background", "white");
$("#prevExt").css("background", "white");
$("#nxtExt").css("background", "white");
$("#pan").css("background", "white");
$("#info").css("background", "white");
} else if(navOption == navOptions.info) {
map.setMapCursor(navOptions.info.cursor);
identifyStatus = true;
$("#zoomIn").css("background", "white");
$("#zoomOut").css("background", "white");
$("#prevExt").css("background", "white");
$("#nxtExt").css("background", "white");
$("#pan").css("background", "white");
$("#info").css("background", "#a5a1a1");
}
}
/* Identify option created on 29/May/2018 */
map.on("click", function(evt) {
if(identifyStatus == true) {
executeIdentifyTask(evt);
}
});
function identifyOption(){
if(identifyStatus == false) {
identifyStatus = true;
identifyButton.style.borderStyle = 'inset';
identifyListener = map.on("click", function(evt) {
if(identifyStatus == true) {
executeIdentifyTask(evt);
}
});
}
else if(identifyStatus == true) {
identifyStatus = false;
identifyButton.style.borderStyle = '';
}
}
function executeIdentifyTask(event) {
var visible = [];
var identifyTask, identifyParams;
identifyTask = new IdentifyTask(config.mapService.layerUrl);
identifyParams = new IdentifyParameters();
identifyParams.tolerance = 1;
identifyParams.returnGeometry = true;
identifyParams.layerIds = visible;
identifyParams.layerOption = IdentifyParameters.LAYER_OPTION_TOP;
identifyParams.width = map.width;
identifyParams.height = map.height;
identifyParams.geometry = event.mapPoint;
identifyParams.mapExtent = map.extent;
var deferred = identifyTask.execute(identifyParams).addCallback(function (response) {
// var response = $.grep(response, function(e){ /* for removing the duplicate layer added for symbology from identify task */
// return e.layerId != config.dublicateLayerId; /* duplicate layerId defined in config.json*/
// });
return arrayUtils.map(response, function (result) {
var feature = result.feature;
var layerName = result.layerName;
feature.attributes.layerName = layerName;
var infoTemplate = new InfoTemplate(layerName, "${*}");
infoTemplate.setContent(get_content);
feature.setInfoTemplate(infoTemplate);
return feature;
});
});
map.infoWindow.setFeatures([deferred]);
map.infoWindow.show(event.mapPoint);
}
function get_content(graphic) {
var attrib = graphic.attributes;
return CreateTableFromJSON(attrib);
}
function CreateTableFromJSON(myResults) {
var skip_flds = ["OBJECTID", "Shape", "layerName", "Shape.STLength()","SHAPE.STLength()","SHAPE"];
// var ord_flds = ["GIS ID", "Project Code", "WBS", "Building ID", "Sub Segment", "Pile No", "Activity", "Completed", "Completion Date", "Easting (Local)", "Northing (Local)", "Remarks"];
var all_flds = Object.keys(myResults);
ord_flds = all_flds.filter( function( el ) {
if(skip_flds.indexOf(el) == -1){
return el;
}
// return !skip_flds.includes( el );
} );
// CREATE DYNAMIC TABLE.
var table = document.createElement("table");
// table.style.borderStyle = "dotted";
table.innerHTML = "";
// CREATE HTML TABLE HEADER ROW USING THE EXTRACTED HEADERS ABOVE.
var tr = table.insertRow(-1); // TABLE ROW.
// ADD JSON DATA TO THE TABLE AS ROWS.
var row_bunch = [];
for (var el in ord_flds)
{
var key = ord_flds[el];
// if (skip_flds.indexOf(key) >= 0) {
// //Skips the flds
// }
// else {
var tr = table.insertRow(-1);
// tr.style.borderStyle = "dotted";
var tabCell = tr.insertCell(-1);
tabCell.innerHTML = key;//myResults[i][col[j]];
var tabCell2 = tr.insertCell(-1);
tabCell.style.borderWidth = "1px";
tabCell2.style.borderWidth = "1px";
if (el == (ord_flds.length - 1))
{
//tabCell.style.borderStyle = "dotted none dotted dotted";
//tabCell2.style.borderStyle = "dotted dotted dotted dotted";
tabCell.style.borderStyle = "solid none solid solid";
tabCell2.style.borderStyle = "solid solid solid solid";
}
else
{
////tabCell.style.borderStyle = "dotted none none dotted";
////tabCell2.style.borderStyle = "dotted dotted none dotted";
tabCell.style.borderStyle = "solid none none solid";
tabCell2.style.borderStyle = "solid solid none solid";
}
tabCell2.innerHTML = myResults[key];//myResults[i][col[j]];
if (key == "Completion Date")
{
if (myResults[key] != "Null") {
var completeDate = locale.format(new Date(myResults[key]), {
selector: 'date',
datePattern: 'dd/MMM/yyyy'
});
tabCell2.innerHTML = completeDate;
}
}
// }
}
return table;//.innerHTML;
}
/* Navigation Toolbar Code - **END** */
/*Progress Toolbar Code -- **START** created on 24/May/2018*/
$(".progressButton").click(function(){ // change the progress Button on click
showProgressForm(this.id);
});
$(".closeImage").click(function(){ // close a progress button
var closedContainerID = returnContainerId(currentProgress);
currentProgress = progressList.none;
$(closedContainerID).css("display", "none");
});
function showProgressForm(pressedButton){ // show the current form clicked
var selectedContainerID = returnContainerId(pressedButton);
if (pressedButton == progressList.none) {
// show selected progress
currentProgress = pressedButton;
$(selectedContainerID).css("display", "flex");
} else if (pressedButton == currentProgress) {
// show selected progress
currentProgress = progressList.none;
$(selectedContainerID).css("display", "none");
} else {
// close cureent progress and show current progress
var currentContainerID = returnContainerId(currentProgress);
currentProgress = pressedButton;
$(currentContainerID).css("display", "none");
$(selectedContainerID).css("display", "flex");
/* refreshing the progress table once clicked */
if(currentProgress == progressList.table) {
if(currentTableTab == tableList.overview) {
updateOverviewTab(); /* updating the overview tab when the progress table button is pressed */
} else if(currentTableTab == tableList.summary) {
// update the summarty tab
}
}
}
}
function returnContainerId(pressedButton) { // return the form id for the selected progress
if(pressedButton == progressList.basemap) {
return containerIds.basemap;
} else if(pressedButton == progressList.legend) {
return containerIds.legend;
} else if(pressedButton == progressList.measure) {
return containerIds.measure;
}
}
/*Progress Toolbar Code -- **END**/
});
</script>
</head>
<body class="calcite" >
<div class="siteHeader">
<div class="logoLeft">
<img src="images/Logo.png" width="40" alt = "">
</div>
<div class="siteHeading">
Navigation Model
</div>
<div class="logoRight">
<img src="images/geoLogo.png" width="40" alt = "">
</div>
</div>
<div id="search"></div>
<div id="home"></div>
<div id="toolBar">
<div id="zoomIn" title="Zoom In">
<img src="images/zoomIn.png" style="width: 20px;" alt = "">
</div>
<div id="zoomOut" title="Zoom Out">
<img src="images/zoomOut.png" style="width: 20px;" alt = "">
</div>
<div id="prevExt" title="Previous Extent">
<img src="images/prev.png" style="width: 20px;" alt = "">
</div>
<div id="nxtExt" title="Next Extent">
<img src="images/next.png" style="width: 20px;" alt = "">
</div>
<div id="pan" title="Pan">
<img src="images/pan.png" style="width: 20px;" alt = "">
</div>
<div id="deactivate" title="Deactivate">
<img src="images/deactivate.png" style="width: 20px;" alt = "">
</div>
<div id="info" title="Identify">
<img src="images/info.png" style="width: 20px;" alt = "">
</div>
</div>
<div id="progressBar">
<div id="toogleBasemap" class = "progressButton" title="Basemap">
<img src="images/basemap.png" style="width: 30px;" alt = "">
</div>
<div id="measureTool" class = "progressButton" title="Legend">
<img src="images/measure.png" style="width: 30px;" alt = "">
</div>
<!-- <div id="legendList" class = "progressButton" title="Legend">
<img src="images/summary.png" style="width: 30px;" alt = "">
</div> -->
</div>
<div id="toogleBasemapColumn" class="progressColumn">
<div class = "progressHeader"><a class="progressHeading">Change Basemap</a><img title = "Close" src="images/close.png" class="closeImage" alt = ""></div>
<div class = "progressContent" id="basemapContent"> <!-- basemapContent css defined seperatly to limit large size ocuurence -->
<div id="basemapGallery"></div>
</div>
</div>
<div id="measureColumn" class="progressColumn">
<div class = "progressHeader" ><a class="progressHeading">Measurement</a><img title = "Close" src="images/close.png" class="closeImage" alt = ""></div>
<div class = "progressContent" id="measureContent">
<div id="measureWidget"></div>
</div>
</div>
<div id="legendColumn" class="progressColumn">
<div class = "progressHeader" ><a class="progressHeading">Legends</a><img title = "Close" src="images/close.png" class="closeImage" alt = ""></div>
<div class = "progressContent" id="legendContent">
</div>
</div>
<div id="map" class="map"></div>
<div class="siteFooter">© Basic Map - <span><a>Geo Devs</a></span> - 2019</div>
<div data-dojo-type="dijit/layout/ContentPane" id="EditorToolDiv" style="width:30%;display: none;" data-dojo-props="region:'left', splitter:true"></div>
</body>
</html>