multiple_pointclouds.html 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="description" content="">
  6. <meta name="author" content="">
  7. <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
  8. <title>Potree Viewer</title>
  9. <link rel="stylesheet" type="text/css" href="../build/potree/potree.css">
  10. <link rel="stylesheet" type="text/css" href="../libs/jquery-ui/jquery-ui.min.css">
  11. <link rel="stylesheet" type="text/css" href="../libs/openlayers3/ol.css">
  12. <link rel="stylesheet" type="text/css" href="../libs/spectrum/spectrum.css">
  13. <link rel="stylesheet" type="text/css" href="../libs/jstree/themes/mixed/style.css">
  14. </head>
  15. <body>
  16. <script src="../libs/jquery/jquery-3.1.1.min.js"></script>
  17. <script src="../libs/spectrum/spectrum.js"></script>
  18. <script src="../libs/jquery-ui/jquery-ui.min.js"></script>
  19. <script src="../libs/other/BinaryHeap.js"></script>
  20. <script src="../libs/tween/tween.min.js"></script>
  21. <script src="../libs/d3/d3.js"></script>
  22. <script src="../libs/proj4/proj4.js"></script>
  23. <script src="../libs/openlayers3/ol.js"></script>
  24. <script src="../libs/i18next/i18next.js"></script>
  25. <script src="../libs/jstree/jstree.js"></script>
  26. <script src="../build/potree/potree.js"></script>
  27. <script src="../libs/plasio/js/laslaz.js"></script>
  28. <!-- INCLUDE ADDITIONAL DEPENDENCIES HERE -->
  29. <!-- INCLUDE SETTINGS HERE -->
  30. <div class="potree_container" style="position: absolute; width: 100%; height: 100%; left: 0px; top: 0px; ">
  31. <div id="potree_render_area" style="background-image: url('../build/potree/resources/images/background.jpg');"></div>
  32. <div id="potree_sidebar_container"> </div>
  33. </div>
  34. <script type="module">
  35. import * as THREE from "../libs/three.js/build/three.module.js";
  36. window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
  37. viewer.setEDLEnabled(true);
  38. viewer.setFOV(60);
  39. viewer.setPointBudget(1_000_000);
  40. viewer.setMinNodeSize(10);
  41. viewer.loadSettingsFromURL();
  42. viewer.setDescription(`Sorvilier point cloud courtesy of <a target='_blank' href='https://www.sigeom.ch/'>sigeom sa</a>`);
  43. viewer.loadGUI(() => {
  44. viewer.setLanguage('en');
  45. $("#menu_scene").next().show();
  46. $("#menu_tools").next().show();
  47. viewer.toggleSidebar();
  48. });
  49. // wrap load code into an async function so that we can use "await"
  50. async function load(){
  51. // specify point clouds that are to be loaded and callbacks to invoke
  52. let pointclouds = [
  53. {
  54. url: "../pointclouds/vol_total/cloud.js",
  55. callback: (pointcloud) => {
  56. pointcloud.name = "sorvilier";
  57. let material = pointcloud.material;
  58. material.size = 1;
  59. material.pointSizeType = Potree.PointSizeType.ADAPTIVE;
  60. },
  61. },{
  62. url: "../pointclouds/lion_takanawa/cloud.js",
  63. callback: (pointcloud) => {
  64. pointcloud.name = "lion 1";
  65. let material = pointcloud.material;
  66. material.pointSizeType = Potree.PointSizeType.ADAPTIVE;
  67. pointcloud.position.set(589927.44, 231479.04, 726.87);
  68. pointcloud.scale.set(10, 10, 10);
  69. pointcloud.rotation.set(0, 0, 0.8 * Math.PI);
  70. },
  71. },{
  72. url: "../pointclouds/lion_takanawa/cloud.js",
  73. callback: (pointcloud) => {
  74. pointcloud.name = "lion 2";
  75. let material = pointcloud.material;
  76. material.size = 1;
  77. material.pointSizeType = Potree.PointSizeType.ADAPTIVE;
  78. material.activeAttributeName = "elevation";
  79. material.heightMin = 720;
  80. material.heightMax = 780;
  81. pointcloud.position.set(589997.44, 231479.04, 726.87);
  82. pointcloud.scale.set(10, 10, 10);
  83. pointcloud.rotation.set(0, 0, 0.8 * Math.PI);
  84. },
  85. },{
  86. url: "../pointclouds/lion_takanawa/cloud.js",
  87. callback: (pointcloud) => {
  88. pointcloud.name = "lion 3";
  89. let material = pointcloud.material;
  90. material.pointSizeType = Potree.PointSizeType.ADAPTIVE;
  91. material.color = new THREE.Color().setRGB(0.4, 0.6, 0.7);
  92. pointcloud.position.set(589927.44 -70, 231479.04, 726.87);
  93. pointcloud.scale.set(10, 10, 10);
  94. pointcloud.rotation.set(0, 0, 0.8 * Math.PI);
  95. },
  96. },{
  97. url: "http://5.9.65.151/mschuetz/potree/resources/pointclouds/archpro/heidentor/cloud.js",
  98. callback: (pointcloud) => {
  99. pointcloud.name = "Heidentor";
  100. pointcloud.position.set(589817.920, 231358.010, 744.865);
  101. pointcloud.scale.set(6, 6, 6);
  102. pointcloud.rotation.z = -1.9;
  103. },
  104. }
  105. ];
  106. // start loading all point clouds asynchronously, get a promise for each one that resolves when it's loaded
  107. let promises = pointclouds.map(p => Potree.loadPointCloud(p.url));
  108. // now iterate over all promises in order
  109. for(let i = 0; i < promises.length; i++){
  110. // wait until this point cloud is loaded before processing the next one
  111. let pointcloud = (await promises[i]).pointcloud;
  112. pointclouds[i].callback(pointcloud);
  113. viewer.scene.addPointCloud(pointcloud);
  114. }
  115. viewer.scene.view.setView(
  116. [589974.341, 231698.397, 986.146],
  117. [589851.587, 231428.213, 715.634],
  118. );
  119. }
  120. load();
  121. </script>
  122. </body>
  123. </html>