-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathErftShowcase-MultiplePointClouds.html
465 lines (388 loc) · 20.1 KB
/
ErftShowcase-MultiplePointClouds.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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="description" content="">
<meta name="author" content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<!-- The "viewport" meta tag specifies the initial
scale and dimensions of the webpage's viewport. This is important for optimizing
the page's display on different devices, such as desktops and mobile devices. -->
<title>Potree Viewer</title>
<!--The following five lines define links to various stylesheets used by the webpage.
Each <link> element specifies the type of resource (stylesheet in this case), the path to the resource,
and the stylesheet's type. The stylesheet paths are relative to the location of the current webpage.
(./ = look in the current folder ./ = look in the folder before)
These stylesheets are used to define the appearance and behavior of various UI components used by the webpage.-->
<link rel="stylesheet" type="text/css" href="../libs/potree/potree.css">
<link rel="stylesheet" type="text/css" href="../libs/jquery-ui/jquery-ui.min.css">
<link rel="stylesheet" type="text/css" href="../libs/openlayers3/ol.css">
<link rel="stylesheet" type="text/css" href="../libs/spectrum/spectrum.css">
<link rel="stylesheet" type="text/css" href="../libs/jstree/themes/mixed/style.css">
<link rel="stylesheet" type="text/css" href="../libs/Cesium/Widgets/CesiumWidget/CesiumWidget.css">
</head>
<body>
<!-- This code in the body of an HTML document contains several <script> tags that reference external
JavaScript files. The src attribute of each <script> tag specifies the path to the JavaScript
file that should be loaded and executed in the browser. -->
<script src="../libs/jquery/jquery-3.1.1.min.js"></script>
<script src="../libs/spectrum/spectrum.js"></script>
<script src="../libs/jquery-ui/jquery-ui.min.js"></script>
<script src="../libs/other/BinaryHeap.js"></script>
<script src="../libs/tween/tween.min.js"></script>
<script src="../libs/d3/d3.js"></script>
<script src="../libs/proj4/proj4.js"></script>
<script src="../libs/openlayers3/ol.js"></script>
<script src="../libs/i18next/i18next.js"></script>
<script src="../libs/jstree/jstree.js"></script>
<script src="../libs/potree/potree.js"></script>
<script src="../libs/plasio/js/laslaz.js"></script>
<script src="../libs/shapefile/shapefile.js"></script>
<!-- INCLUDE ADDITIONAL DEPENDENCIES HERE -->
<script src="../libs/Cesium/Cesium.js"></script>
<!-- Cesium is a JavaScript library for creating 3D globes and maps in the browser, and it provides
a range of features for visualizing and interacting with geospatial data. By importing the library using this script tag,
the Cesium library becomes available for use in the rest of the HTML document, and the functions and classes provided by the
library can be called and used in the JavaScript code. -->
<!-- INCLUDE SETTINGS HERE -->
<div class="potree_container" style="position: absolute; width: 100%; height: 100%; left: 0px; top: 0px; ">
<!-- This line creates a new div element with the class attribute set to potree_container. The style attribute
sets the position, width, height, left and top CSS properties to position this element as a full-screen container. -->
<div id="potree_render_area" style="background-image: url('../build/potree/resources/images/background.jpg');">
<div id="cesiumContainer" style="position: absolute; width: 100%; height: 100%; background-color:green"></div>
<!-- Another div with an id "cesiumContainer" is also included inside the "potree_render_area" div. This div is
used to hold the CesiumJS 3D globe. It is positioned absolutely with a width and height of 100% and has a
green background color. -->
</div>
<!-- This line creates a child div element with the id attribute set to potree_render_area. This is the main rendering
area where the point cloud data is displayed. The style attribute sets the background image of the div element to a
background.jpg -->
<div id="potree_sidebar_container"> </div>
<!-- This line creates a child div element with the id attribute set to potree_sidebar_container. This is the sidebar container
where the user interface controls are displayed, including the various menus and options of the Potree viewer. -->
</div>
<!--The <script> tag in HTML is used to define a section of JavaScript code that can be executed by the browser.
It is an element that allows developers to embed scripts in HTML pages, and is typically placed in the <head> or
<body> section of an HTML document.-->
<script type="module">
// This is a JavaScript code block with the type="module" attribute, indicating that it contains ECMAScript modules.
import * as THREE from "../libs/three.js/build/three.module.js";
window.cesiumViewer = new Cesium.Viewer('cesiumContainer', {
useDefaultRenderLoop: false,
animation: false,
baseLayerPicker : false,
fullscreenButton: false,
geocoder: false,
homeButton: false,
infoBox: false,
sceneModePicker: false,
selectionIndicator: false,
timeline: false,
navigationHelpButton: false,
imageryProvider : Cesium.createOpenStreetMapImageryProvider({url : 'https://a.tile.openstreetmap.org/'}),
terrainShadows: Cesium.ShadowMode.DISABLED,
});
let cp = new Cesium.Cartesian3(4303414.154026048, 552161.235598733, 4660771.704035539);
cesiumViewer.camera.setView({
destination : cp,
orientation: {
heading : 10,
pitch : -Cesium.Math.PI_OVER_TWO * 0.5,
roll : 0.0
}
});
window.potreeViewer = new Potree.Viewer(document.getElementById("potree_render_area"), {
useDefaultRenderLoop: false
});
potreeViewer.setEDLEnabled(true);
potreeViewer.setFOV(60);
potreeViewer.setPointBudget(3_000_000);
potreeViewer.loadSettingsFromURL();
potreeViewer.setMinNodeSize(50);
potreeViewer.loadSettingsFromURL();
potreeViewer.setBackground(null);
potreeViewer.useHQ = true;
potreeViewer.setDescription(`Erft Neuss-Gnadental, Point cloud courtesy of <a href="https://www.zumbroich.com/de/home">Planungsbüro Zumbroich</a> and Dr. Georg Lamberty.`);
potreeViewer.loadGUI(() => {
potreeViewer.setLanguage('en');
$("#menu_appearance").next().show();
$("#menu_tools").next().show();
$("#menu_scene").next().show();
potreeViewer.toggleSidebar();
//I got this navigation aid section from the (https://sitn.ne.ch/lidar/) (Third Party Showcases)
let section = $(`
<h3 id="menu_meta" class="accordion-header ui-widget"><span>Navigation aid</span></h3>
<div class="accordion-content ui-widget"></div>
`);
let content = section.last();
content.html(`
<img src="../resources/images/mouse.png" alt="mouse" width="100%">
`);
section.first().click(() => content.slideToggle());
section.insertBefore($('#menu_about'));
});
potreeViewer.scene.view.setView(
[343595.292, 5669855.389, 2974.723],
[341187.858, 5671969.144, -61.967],
);
// Pointclouds
async function loadDatasets(){
let scene = potreeViewer.scene;//
{// SommerFlight
let summer = await Potree.loadPointCloud("../pointclouds/SommerFlightClassified/metadata.json");
let pointcloud = summer.pointcloud;
let material = pointcloud.material;
pointcloud.name = "SommerFlight 10.08.2022";
pointcloud.position.setZ(0);
// material configuration
material.size = 0.8;
// material.pointSizeType = Potree.PointSizeType.FIXED;
material.pointSizeType = Potree.PointSizeType.ADAPTIVE;
material.elevationRange = [0, 70];
material.opacity = 0.1;
material.weightRGB = 1.0;
material.weightElevation = 1.0;
material.activeAttributeName = "rgba";
// material.shape = Potree.PointShape.CIRCLE; //What is this?
scene.addPointCloud(pointcloud);
// viewer.fitToScreen();
pointcloud.visible = true;
// for the hierarchy example the projection is obtained from here
// This point cloud projection is UTM zone 32 "obtained from ODM"
let pointcloudProjection = "+proj=utm +zone=32N +ellps=WGS84 +datum=WGS84 +units=m +no_defs";
// In the Retz example the projection is directly assigned, how do I find out my projection?
let mapProjection = proj4.defs("WGS84");
window.toMap = proj4(pointcloudProjection, mapProjection);
window.toScene = proj4(mapProjection, pointcloudProjection);
{
let bb = potreeViewer.getBoundingBox();
let minWGS84 = proj4(pointcloudProjection, mapProjection, bb.min.toArray());
let maxWGS84 = proj4(pointcloudProjection, mapProjection, bb.max.toArray());
}
}
{// WinterFlight
let winter = await Potree.loadPointCloud("../pointclouds/WinterFlight_Potree/metadata.json");
let pointcloud = winter.pointcloud;
let material = pointcloud.material;
pointcloud.name = "WinterFlight 04.04.2023";
pointcloud.position.setZ(0);
// material configuration
material.size = 0.8;
material.pointSizeType = Potree.PointSizeType.ADAPTIVE;
material.elevationRange = [0, 70];
material.weightRGB = 1.0;
material.weightElevation = 1.0;
// material.activeAttributeName = "classification";
// material.shape = Potree.PointShape.CIRCLE; //What is this?
scene.addPointCloud(pointcloud);
// viewer.fitToScreen();
pointcloud.visible = false;
// for the hierarchy example the projection is obtained from here
let pointcloudProjection = "+proj=utm +zone=32N +ellps=WGS84 +datum=WGS84 +units=m +no_defs";
// In the Retz example the projection is directly assigned, how do I find out my projection?
let mapProjection = proj4.defs("WGS84");
window.toMap = proj4(pointcloudProjection, mapProjection);
window.toScene = proj4(mapProjection, pointcloudProjection);
{
let bb = potreeViewer.getBoundingBox();
let minWGS84 = proj4(pointcloudProjection, mapProjection, bb.min.toArray());
let maxWGS84 = proj4(pointcloudProjection, mapProjection, bb.max.toArray());
}
}
{// DTM_1m_NRW
//Cloud obtained from https://www.opengeodata.nrw.de/produkte/geobasis/hm/dgm1_xyz/dgm1_xyz/ and converted to LAZ with CloudCompare
let nrw = await Potree.loadPointCloud("../pointclouds/DTM_1m_nrw/metadata.json");
let pointcloud = nrw.pointcloud;
let material = pointcloud.material;
pointcloud.name = "DTM NRW 2020";
pointcloud.position.setZ(0);
// material configuration
material.size = 0.8;
material.pointSizeType = Potree.PointSizeType.FIXED;
material.elevationRange = [0, 70];
material.weightRGB = 1.0;
material.weightElevation = 1.0;
// material.activeAttributeName = "classification";
// material.shape = Potree.PointShape.CIRCLE; //What is this?
scene.addPointCloud(pointcloud);
// viewer.fitToScreen();
pointcloud.visible = false;
// for the hierarchy example the projection is obtained from here
let pointcloudProjection = "+proj=utm +zone=32N +ellps=WGS84 +datum=WGS84 +units=m +no_defs";
// In the Retz example the projection is directly assigned, how do I find out my projection?
let mapProjection = proj4.defs("WGS84");
window.toMap = proj4(pointcloudProjection, mapProjection);
window.toScene = proj4(mapProjection, pointcloudProjection);
{
let bb = potreeViewer.getBoundingBox();
let minWGS84 = proj4(pointcloudProjection, mapProjection, bb.min.toArray());
let maxWGS84 = proj4(pointcloudProjection, mapProjection, bb.max.toArray());
}
}
{ // ANNOTATIONS
let aRoot = potreeViewer.scene.annotations;
let Erft_Neuss_Gnadental = $(`
<span>
Erft Neuss Gnadental
<img src="${Potree.resourcePath}/icons/goto.svg"
name="action_set_scene"
class="annotation-action-icon"
style="filter: invert(1);" />
</span>
`);
Erft_Neuss_Gnadental.find("img[name=action_set_scene]").click((event) => {
window.open('https://www.erftverband.de/gewaesserprojekt-neuss-gnadental/', '_blank');
});
let aErft = new Potree.Annotation({
title: Erft_Neuss_Gnadental,
position: [341064.480, 5671961.420, 200],
cameraPosition: [342116.980, 5671178.684, 664.915],
cameraTarget: [340978.511, 5672043.827, -55.662],
description: `<div style="overflow:scroll ; height:350px">
The restoration project is the first segment of a comprehensive 23-segment plan,
covering an area of approximately 0.36 km2. It aligns with the overarching objective of
ecologically enhancing the Erft river. The project encompasses various measures aimed at achieving
goals such as adapting to future discharge conditions, restoring the Erft floodplain's biotope network,
revitalizing the primary floodplain, and enabling self-dynamic development by abandoning bank
stabilisation practices. Commencing in October 2021, the construction concluded successfully in August 2022.
One notable outcome was a substantial increase in the stream's length, expanding from 0.6 km to 1.8 km <br>
<img src="../resources/images/start.png" alt="general image" style="width:450px;height:350px;"></div>`
// ``
});
aRoot.add(aErft);
let aPlaces = new Potree.Annotation({
title: "Synthetic Field",
position: [341577.813, 5672068.003, 27.040],
cameraPosition: [341590.459, 5672032.653, 187.476],
cameraTarget: [341557.679, 5672077.437, -75.333],
});
aErft.add(aPlaces);
let aStructure = new Potree.Annotation({
title: "Structure",
position: [340829.433, 5671776.053, 15.070],
cameraPosition: [340860.319, 5671753.511, 70.244],
cameraTarget: [340812.159, 5671804.855, -44.185],
});
aErft.add(aStructure);
let aRamp = new Potree.Annotation({
title: "Slide",
position: [341458.833, 5672050.483, 20.190],
cameraPosition: [341404.982, 5672063.890, 82.182],
cameraTarget: [341506.279, 5672012.575, -39.899],
description: `<div style="overflow:scroll ; height:350px"><img src="../resources/images/ramp.png"
alt="a picture of the slide" style="width:450px;height:350px;"><br>A river bottom slide
is a standard structure of river engineering lying below the water level transversely to the current,
which is intended to limit the deep erosion of the water bed.
It also makes it easier for migratory fish such as salmon and eel, which naturally occur in the Erft,
to climb out of the Rhine. Here rest zones alternate with short sprint distances for the fish.<br>
<img src="../resources/images/RampSection.png" alt="Ramp" style="width:450px;height:350px;">
<br>
<img src="../resources/images/RampPlanView.png" alt="Ramp" style="width:600px;height:350px;">
</div>`
});
aErft.add(aRamp);
let aBuhne = new Potree.Annotation({
title: "Other Interventions",
position: [341070.870, 5671947.240, 12.490],
cameraPosition: [341049.058, 5671858.869, 64.545],
cameraTarget: [341081.398, 5671968.874, -34.584],
description: `<div style="overflow:scroll ; height:350px">
Groynes can be used as part of water body renaturation.
In this case, they are arranged in such a way that new meanders,
scours and bank erosion are created in a straightened course of water .
These groynes are often implemented using biological engineering methods, for example deadwood or boulders are used as groynes.
<img src="../resources/images/Reference.png" alt="reference Image" style="width:450px;height:350px;">
<br>How exactly the shoreline areas look in the end is decided by nature itself.
The planners only give space and building material. Heaps of gravel, for example,
are gradually removed and the river decides where to carry the stones.
In some places, a small flood has already created new bank erosion and the current has also already made the
bottom clearly visible.<br>
<img src="../resources/images/Legend.png" alt="Ramp" style="width:300px;height:300px;">
<br>
<img src="../resources/images/Interventions.png" alt="Ramp" style="width:500px;height:550px;">
</div>`
});
aErft.add(aBuhne);
}
{ // Attribute Selector Annotation
// Create title element with jquery
let elTitle = $(`
<span>
Attribute:
<img title="Elevation" name="action_elevation" src="${Potree.resourcePath}/icons/profile.svg" class="annotation-action-icon"/>
<img title="RGB and Elevation" name="action_both" src="${Potree.resourcePath}/icons/rgb_elevation.png" class="annotation-action-icon"/>
<img title="RGB" name="action_rgb" src="${Potree.resourcePath}/icons/rgb.svg" class="annotation-action-icon"/>
<img title="classification" name="action_classification" src="${Potree.resourcePath}/icons/area.svg" class="annotation-action-icon"/>
</span>`);
elTitle.find("img[name=action_elevation]").click( () => {
scene.pointclouds.forEach( pc => pc.material.activeAttributeName = "elevation" );
});
elTitle.find("img[name=action_rgb]").click( () => {
scene.pointclouds.forEach( pc => pc.material.activeAttributeName = "rgba" );
});
elTitle.find("img[name=action_both]").click( () => {
scene.pointclouds.forEach( pc => pc.material.activeAttributeName = "composite" );
});
elTitle.find("img[name=action_classification]").click( () => {
scene.pointclouds.forEach( pc => pc.material.activeAttributeName = "classification" );
});
// Give the annotation a meaningful string representation for the sidebar
elTitle.toString = () => "Color Setting";
// Same as with other annotations, except title is a jquery object this time.
let aActions = new Potree.Annotation({
position: [340711.140, 5671734.390, 100],
title: elTitle
});
scene.annotations.add(aActions);
}
};
loadDatasets();
function loop(timestamp){
requestAnimationFrame(loop);
potreeViewer.update(potreeViewer.clock.getDelta(), timestamp);
potreeViewer.render();
if(window.toMap !== undefined){
{
let camera = potreeViewer.scene.getActiveCamera();
let pPos = new THREE.Vector3(0, 0, 0).applyMatrix4(camera.matrixWorld);
let pRight = new THREE.Vector3(600, 0, 0).applyMatrix4(camera.matrixWorld);
let pUp = new THREE.Vector3(0, 600, 0).applyMatrix4(camera.matrixWorld);
let pTarget = potreeViewer.scene.view.getPivot();
let toCes = (pos) => {
let xy = [pos.x, pos.y];
let height = pos.z;
let deg = toMap.forward(xy);
let cPos = Cesium.Cartesian3.fromDegrees(...deg, height);
return cPos;
};
let cPos = toCes(pPos);
let cUpTarget = toCes(pUp);
let cTarget = toCes(pTarget);
let cDir = Cesium.Cartesian3.subtract(cTarget, cPos, new Cesium.Cartesian3());
let cUp = Cesium.Cartesian3.subtract(cUpTarget, cPos, new Cesium.Cartesian3());
cDir = Cesium.Cartesian3.normalize(cDir, new Cesium.Cartesian3());
cUp = Cesium.Cartesian3.normalize(cUp, new Cesium.Cartesian3());
cesiumViewer.camera.setView({
destination : cPos,
orientation : {
direction : cDir,
up : cUp
}
});
}
let aspect = potreeViewer.scene.getActiveCamera().aspect;
if(aspect < 1){
let fovy = Math.PI * (potreeViewer.scene.getActiveCamera().fov / 180);
cesiumViewer.camera.frustum.fov = fovy;
}else{
let fovy = Math.PI * (potreeViewer.scene.getActiveCamera().fov / 180);
let fovx = Math.atan(Math.tan(0.5 * fovy) * aspect) * 2
cesiumViewer.camera.frustum.fov = fovx;
}
}
cesiumViewer.render();
}
requestAnimationFrame(loop);
</script>
</body>
</html>