drone_view 3.0.12 → 3.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drone_view",
3
- "version": "3.0.12",
3
+ "version": "3.0.14",
4
4
  "main": "dist/droneView.js",
5
5
  "license": "MIT",
6
6
  "scripts": {
package/public/crane.png DELETED
Binary file
package/public/icon.png DELETED
Binary file
package/public/icons8.png DELETED
Binary file
package/public/index.html DELETED
@@ -1,562 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta http-equiv="X-UA-Compatible" content="IE=edge" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
- <script
8
- src="https://kit.fontawesome.com/6d6937278c.js"
9
- crossorigin="anonymous"
10
- ></script>
11
- <script src="https://cdn.plot.ly/plotly-2.20.0.min.js"></script>
12
- <link rel="stylesheet" href="../dist/Widgets/widgets.css" />
13
- <title>Document</title>
14
- <style>
15
- body {
16
- margin: 0;
17
- padding: 0;
18
- }
19
-
20
- .drawBox {
21
- position: fixed;
22
- top: 0;
23
- left: 0;
24
- z-index: 10000;
25
- }
26
-
27
- .drawContainer {
28
- border: 1.5px solid white;
29
- background-color: rgba(245, 245, 245, 0.473);
30
- margin: 15px;
31
- }
32
-
33
- .drawContainer:hover {
34
- border: 1.5px solid rgb(5, 5, 5);
35
- background-color: rgba(146, 146, 146, 0.473);
36
- cursor: pointer;
37
- }
38
-
39
- .drawIcon {
40
- font-size: 20px;
41
- color: rgb(0, 0, 0);
42
- margin: 10px;
43
- display: block;
44
- }
45
- </style>
46
- </head>
47
-
48
- <body>
49
- <div id="cesiumContainer" class="fullSize"></div>
50
- <div class="drawBox">
51
- <div id="pointer" class="drawContainer pointer">
52
- <i class="fa-solid fa-arrow-pointer drawIcon"></i>
53
- </div>
54
- <div id="location" class="drawContainer polygon">
55
- <i class="fa-solid fa-map-marker drawIcon"></i>
56
- </div>
57
- <div id="polygon" class="drawContainer polygon">
58
- <i class="fa-solid fa-draw-polygon drawIcon"></i>
59
- </div>
60
- <div id="lineString" class="drawContainer lineString">
61
- <i class="fa-solid fa-chart-line drawIcon"></i>
62
- </div>
63
- <div id="measurement" class="drawContainer lineString">
64
- Measurement
65
- </div>
66
- <div id="layers" class="drawContainer layers">
67
- Load Drawings
68
- </div>
69
- <a class="btn btn-light btn-sm" href="javascript://" id="deficiency" data-toggle = "tooltip" title = "Create Deficiency">
70
- <span class="fa-solid fa-triangle-exclamation" style="color: #FFD43B;"></span>
71
- </a>
72
- <div id="cross" class="drawContainer lineString">Height Graph</div>
73
- <div id="position" class="drawContainer lineString">Position Change</div>
74
- <div id="visibility" class="drawContainer lineString">Visibility</div>
75
- <div id="opacity" class="drawContainer lineString">Opacity</div>
76
- <div class="">
77
- <div id="rotate" class="drawContainer rotate">
78
- Rotate
79
- </div>
80
-
81
- <div id="position" class="drawContainer">
82
- Position
83
- <div>
84
- <button class="height height-plus"> UP </button>
85
- <button class="height height-minus"> Down </button>
86
- </div>
87
- </div>
88
- <div>
89
- <button id="toggleglobe"> toggle Globe </button>
90
- </div>
91
- </div>
92
- <div id="origin" class="drawContainer position">
93
- Origin
94
- <div>
95
- <button class="origin lat-plus"> North </button>
96
- <button class="origin lat-minus"> South </button>
97
- <button class="origin lng-minus"> West </button>
98
- <button class="origin lng-plus"> East </button>
99
- </div>
100
- </div>
101
-
102
- <div id="save" class="drawContainer">
103
- <div>
104
- <button id="save-site-model"> Save </button>
105
- </div>
106
- </div>
107
- </div>
108
- <div id="getCenter" class="drawContainer lineString">Get Center</div>
109
- <div id="setCenter" class="drawContainer lineString">set Center</div>
110
- <div id="startCompare" class="drawContainer lineString">
111
- Start Compare
112
- </div>
113
- <div id="stopCompare" class="drawContainer lineString">Stop Compare</div>
114
- </div>
115
-
116
- <div
117
- id="plot"
118
- style="
119
- width: 600px;
120
- height: 300px;
121
- position: absolute;
122
- bottom: 0;
123
- right: 0;
124
- z-index: 100000;
125
- "
126
- ></div>
127
-
128
- <script src="../dist/droneView.js"></script>
129
- <script>
130
- const CesiumView = DroneView.default;
131
- const center = [-75.80011188888888, 48.60825886111112];
132
- let viewer = new CesiumView({
133
- center: center,
134
- mapElementId: "cesiumContainer",
135
- token:
136
- "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI1NzI5N2M3ZS1mNDBkLTQ1NTktYjU5MC1mMDlhNzY0Y2Q0YmEiLCJpZCI6MTE1MTUxLCJpYXQiOjE3MTQ2NjIzOTF9.Z7m91kd9g-eMfj0ST4MOE_ETlBbUM6LK5TTEDxGq7Es",
137
- });
138
-
139
- viewer.init();
140
- let polygon = [
141
- {
142
- points: [
143
- [6.16305874919769, 48.60817695763424, 0],
144
- [6.163108478013089, 48.60819720521929, 0],
145
- [6.163111072002854, 48.60819977147443, 0],
146
- [6.163057488073359, 48.60818639169656, 0]
147
- ],
148
- properties: { id: "as1", color: "#00ff00", label: "testing2", clamp: false },
149
- },
150
- {
151
- points: [
152
- [6.162857491593727, 48.6080934029662, 5.912426975326382],
153
- [6.162908397175465, 48.6081146398778, 5.934964504171266],
154
- [6.16290843788737, 48.60811455477322, 3.272762631421164],
155
- [6.1628706023275495, 48.6080989685312, 2.813801646136673],
156
- [6.162842533195286, 48.608087438688024, 3.882614197318671]
157
- ],
158
- properties: { id: "as1", color: "#00ff00", label: "testing1", clamp: false },
159
- },
160
- {
161
- points: [
162
- [6.162967581670718, 48.608230997978, 6.868057683919937],
163
- [6.163035923706803, 48.608248874262195, 6.845579863241482],
164
- [6.1630578292255, 48.60821904904267, 6.745910666207763],
165
- [6.163004594883557, 48.60819004647759, 6.73241478412424],
166
- [6.1629555793978605, 48.60819920247807, 6.799143351030009]
167
- ],
168
- properties: { id: "as1", color: "#00ff00", label: "testing3", clamp: false },
169
- },
170
- ];
171
-
172
- let projectCenter;
173
-
174
- const line = [
175
- {
176
- points: [
177
- [-68.18948335495492, 49.227354888313435, 7.005152851493904],
178
- [-68.18933666835923, 49.22736699237485, 6.839571495786576],
179
- [-68.18932111915565, 49.227312893969795, 6.692243150896516],
180
- [-68.1894216553971, 49.22727894709573, 6.726892532674433],
181
- ],
182
- properties: { id: "as" },
183
- },
184
- ];
185
-
186
- const annotation = [
187
- {
188
- point:
189
- [6.162727802826702, 48.608254317491706, 6.700286152434376],
190
- properties: { icon: "red_1.gltf" },
191
- },
192
- {
193
- point: [
194
- 6.162808587642154, 48.6081948417796, 6.89108411291631,
195
- ],
196
- properties: { icon: "s2" },
197
- },
198
- ];
199
-
200
- const points = [
201
- // {
202
- // point: [-68.18920471492368, 49.227350449848245, 6.67595448919169],
203
- // properties: { icon: "red_1.gltf" },
204
- // },
205
- // {
206
- // point: [
207
- // -68.18933844169058, 49.22747609005213, -1.00014559372759030554,
208
- // ],
209
- // properties: { icon: "red_1.gltf" },
210
- // },
211
-
212
- {
213
- point: [-68.18920471492368, 49.227350449848245, 6.67595448919169],
214
- properties: { icon: "location", name: "Crack", color: "#aa0000" },
215
- },
216
- {
217
- point: [
218
- -68.18933844169058, 49.22747609005213, -1.00014559372759030554,
219
- ],
220
- properties: { icon: "location", name: "Delamination", color: "#0000bb" },
221
- },
222
-
223
- // {
224
- // point: [-68.1891187585888, 49.22730352580637, -0.0005596126514712139],
225
- // properties: { icon: "location" },
226
- // },
227
- // {
228
- // point: [-68.18904403029545, 49.22724369592092, -0.000565366476219466],
229
- // properties: { icon: "location" },
230
- // },
231
- // {
232
- // point: [-68.18907135191886, 49.22720973501134, -0.000572014595979508],
233
- // properties: { icon: "crane" },
234
- // },
235
- ];
236
-
237
- let option = {
238
- setBounds: true,
239
- onClick: function (e) {
240
- console.log(e);
241
- },
242
- onHover: function (e, jj) {
243
- console.log(e);
244
- },
245
- clearHover: function (e) {
246
- console.log("unhovered")
247
- console.log(e);
248
- },
249
- icons: [
250
- {
251
- name: "location",
252
- src: "location.png",
253
- options: { pixelRatio: 2 },
254
- },
255
- {
256
- name: "s1",
257
- src: "/service/3d/white_exclamation/s1.png",
258
- options: { pixelRatio: 6, deficiency: true },
259
- },
260
- {
261
- name: "s2",
262
- src: "/service/3d/white_exclamation/s2.png",
263
- options: { pixelRatio: 6, deficiency: true },
264
- },
265
- {
266
- name: "s3",
267
- src: "/service/3d/white_exclamation/s3.png",
268
- options: { pixelRatio: 6, deficiency: true },
269
- },
270
- {
271
- name: "s4",
272
- src: "/service/3d/white_exclamation/s4.png",
273
- options: { pixelRatio: 6, deficiency: true },
274
- }
275
- ],
276
- };
277
-
278
- let model = {
279
- url: "tile/tileset.json",
280
- center: {
281
- lat: 48.6083015,
282
- long: 6.1629131500000005,
283
- height: 25,
284
- },
285
- rotationX: 0,
286
- rotationY: 0,
287
- rotationZ: 0,
288
- };
289
-
290
- let model2 = {
291
- url: "15038/tileset.json",
292
- center: {
293
- lat: 49.22747609005213,
294
- long: -68.18933844169058,
295
- height: 5,
296
- },
297
- rotationX: 0,
298
- rotationY: 0,
299
- rotationZ: 0,
300
- };
301
-
302
- let droneImagedata = {
303
- jsonUrl: "tile2.json",
304
- };
305
-
306
- let orthoData = {
307
- url: "https://dev.droneviewpro.com/uploads/ortho_images/attachment/57/tiles/{z}/{x}/{y}.png",
308
- };
309
- viewer.addLayer("model", "model-layer", model, {});
310
-
311
- setTimeout(() => {
312
- // viewer.addLayer("editPoint", "marker-layer", points[0], {onDragEnd : (e)=>{
313
- // console.log(e);
314
- // }});
315
-
316
- viewer.addLayer("annotation", "marker-layer", points, option);
317
-
318
- // viewer.startCompare().then(() => {
319
- // viewer.addLayer("model", "model-layer", model, {}, "all");
320
- // });
321
- }, 1000);
322
-
323
- document.getElementById("deficiency").addEventListener("click", () => {
324
- drawingType = "Deficiency";
325
- viewer.enableDrawing({ type: "Point" });
326
- })
327
-
328
- document.getElementById("startCompare").addEventListener("click", () => {
329
- viewer.startCompare().then(() => {
330
- viewer.addLayer("model", "model-layer", model, {}, "compare");
331
- viewer.addLayer("model", "model-layer", model2, {}, "default");
332
- });
333
- });
334
-
335
- document.getElementById("stopCompare").addEventListener("click", () => {
336
- viewer.stopCompare();
337
- });
338
- // viewer.addLayer("droneImage", "droneImage-layer", droneImagedata, {
339
- // onClick: function (e) {
340
- // console.log(e);
341
- // },
342
- // });
343
-
344
- // viewer.addLayer("polygon", "polygon-layer", [polygon[1]], {
345
- // onClick: function (e) {},
346
- // setBounds: false,
347
- // isNoListener : true
348
- // });
349
- // viewer.addLayer("editPolygon", "polygon-edit-layer", polygon[0], {});
350
-
351
- // viewer.addLayer("ortho", "ortho-layer", orthoData, {});
352
- // setTimeout(() => {
353
- // viewer.addLayer("line", "line-layer", line, {
354
- // onClick: function (e) {
355
- // console.log(e);
356
- // cust2(e.features[0].properties.id);
357
- // },
358
- // });
359
-
360
- let id1;
361
- const cust = (id) => {
362
- id1 = id;
363
- let tempPolygon = [];
364
- let editPolygon;
365
- polygon.forEach((p, i) => {
366
- if (p.properties.id === id) {
367
- editPolygon = p;
368
- } else {
369
- tempPolygon.push(p);
370
- }
371
- });
372
-
373
- viewer.addLayer("polygon", "polygon-layer", tempPolygon, {
374
- onClick: function (e) {},
375
- setBounds: false,
376
- isNoListener: true,
377
- });
378
- viewer.addLayer("editPolygon", "polygon-edit-layer", editPolygon, {
379
- onPinchEnd: function (e) {
380
- console.log(e)
381
- }
382
- });
383
- };
384
-
385
- // 4 polgon loaded
386
- // 4 remove
387
- // 1 - edit add
388
- // 3 polygon add
389
- // 1 edit
390
- // 4 polygon layer
391
-
392
- // viewer.addLayer("editPolygon", "polygon-layer", polygon[0], {
393
- // onClick: function (e) {
394
- // console.log(e);
395
- // },
396
- // });
397
- // }, 2000);
398
-
399
- let isVisible = false;
400
- document.getElementById("visibility").addEventListener("click", () => {
401
- console.log(isVisible);
402
- if (!isVisible) {
403
- //viewer.hideLayer("model", "model-layer");
404
- viewer.hideLayer("droneImage", "droneImage-layer");
405
- } else {
406
- viewer.showLayer("droneImage", "droneImage-layer");
407
- //viewer.showLayer("model", "model-layer");
408
- }
409
- isVisible = !isVisible;
410
- });
411
-
412
- document.getElementById("getCenter").addEventListener("click", () => {
413
- projectCenter = viewer.getCenter();
414
- });
415
-
416
- document.getElementById("setCenter").addEventListener("click", () => {
417
- viewer.setCenter(
418
- projectCenter.latitude,
419
- projectCenter.longitude,
420
- projectCenter.height,
421
- projectCenter.angle
422
- );
423
- });
424
- document.getElementById("toggleglobe").addEventListener("click",()=>{
425
- viewer.toggleGlobe()
426
- })
427
- document.getElementById("pointer").addEventListener("click", () => {
428
- viewer.disableDrawing();
429
- if (id1) {
430
- console.log(id1);
431
- const res = viewer.getLayerData("editPolygon", "polygon-edit-layer");
432
- polygon.map((p, i) => {
433
- if (p.properties.id === id1) {
434
- p.points = res.points;
435
- }
436
- });
437
-
438
- viewer.removeLayer("editPolygon", "polygon-edit-layer");
439
- viewer.addLayer("polygon", "polygon-layer", polygon, {
440
- onClick: (e) => {},
441
- setBounds: false,
442
- });
443
- }
444
-
445
- if (id2) {
446
- const res = viewer.getLayerData("editLine", "polyLine-edit-layer");
447
- console.log(res);
448
- line.map((p, i) => {
449
- if (p.properties.id === id2) {
450
- p.points = res.points;
451
- }
452
- });
453
-
454
- viewer.removeLayer("editLine", "polyLine-edit-layer");
455
- viewer.addLayer("line", "line-layer", line, {
456
- onClick: (e) => {
457
- cust2(e.features[0].properties.id);
458
- },
459
- setBounds: false,
460
- });
461
- }
462
- viewer.removeLayer("editPoint", "marker-layer");
463
- viewer.toggleBaseMap();
464
- });
465
-
466
- document.getElementById("polygon").addEventListener("click", () => {
467
- viewer.enableDrawing({ type: "Polygon", clamp: false });
468
- });
469
-
470
- document.getElementById("lineString").addEventListener("click", () => {
471
- viewer.enableDrawing({ type: "LineString", clamp: false, measurement: true });
472
- });
473
-
474
- document.getElementById("measurement").addEventListener("click", () => {
475
- viewer.enableDrawing({ type: "LineString", clamp: false, measurement: false });
476
- });
477
-
478
- document.getElementById("cross").addEventListener("click", () => {
479
- viewer.enableDrawing({ type: "Cross-Section", clamp: true });
480
- });
481
-
482
- document.getElementById("location").addEventListener("click", () => {
483
- viewer.enableDrawing({ type: "Point" });
484
- });
485
-
486
- document.getElementById("opacity").addEventListener("click", () => {
487
- viewer.setLayerOpacity("model", "model-layer", 0.5);
488
- });
489
-
490
- document.getElementById("layers").addEventListener("click", () => {
491
- // Load Polygon
492
- viewer.addLayer("polygon", "polygon-layer", polygon, {
493
- onClick: (e) => {
494
- cust(e.features[0].properties.id);
495
- viewer.removeLayer("polygon", "polygon-layer");
496
- },
497
- setBounds : false
498
- });
499
-
500
- // Load Height Graph
501
- // viewer.addLayer("line", "line-layer", line, {
502
- // onClick: function (e) {
503
- // console.log(e);
504
- // },
505
- // });
506
-
507
- // Load Tag
508
- viewer.addLayer("marker3d", "marker-layer", points, {
509
- onClick: function (e) {
510
- debugger;
511
- console.log("Printed")
512
- },
513
- onHover: function (e, eventObject) {
514
- console.log("properties", e)
515
- console.log("eventObject", eventObject)
516
- console.log("Hovered on 3d")
517
- },
518
- clearHover: function (e) {
519
- console.log("unhovered")
520
- console.log(e);
521
- }
522
- });
523
- });
524
- let rotationX = 0;
525
- document.getElementById("rotate").addEventListener("click", () => {
526
- rotationX += 30;
527
- viewer.setLayerRotation("model", "model-layer", { rotationX });
528
- });
529
- // viewer.enableDrawing({ type: "LineString", clamp: true });
530
-
531
- let height = 0;
532
- document.getElementById("position").addEventListener("click", () => {
533
- height += 10;
534
- console.log("h");
535
- viewer.setLayerPosition("model", "model-layer", {
536
- lat: 45.56,
537
- long: 55.45,
538
- height: height,
539
- });
540
- });
541
-
542
- viewer.onDraw((d) => {
543
- console.log(d);
544
- var trace1 = {
545
- x: [],
546
- y: [],
547
- type: "scatter",
548
- };
549
-
550
- const fets = d.object.features[0].geometry.coordinates;
551
- fets.forEach((element, i) => {
552
- trace1.y.push(element[2]);
553
- trace1.x.push(i * 0.5);
554
- });
555
-
556
- Plotly.newPlot("plot", [trace1], {
557
- margin: { t: 5, b: 5, pad: 5 },
558
- });
559
- });
560
- </script>
561
- </body>
562
- </html>