129 lines
4.6 KiB
HTML
129 lines
4.6 KiB
HTML
<!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">
|
|
<title>Potree Viewer</title>
|
|
|
|
<link rel="stylesheet" type="text/css" href="../build/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">
|
|
</head>
|
|
|
|
<body>
|
|
<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="../build/potree/potree.js"></script>
|
|
<script src="../libs/plasio/js/laslaz.js"></script>
|
|
|
|
<!-- INCLUDE ADDITIONAL DEPENDENCIES HERE -->
|
|
<!-- INCLUDE SETTINGS HERE -->
|
|
|
|
<div class="potree_container" style="position: absolute; width: 100%; height: 100%; left: 0; top: 0; ">
|
|
<div id="potree_sidebar_container"></div>
|
|
<div id="potree_render_area"></div>
|
|
</div>
|
|
|
|
<script>
|
|
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
|
|
|
viewer.setEDLEnabled(true);
|
|
viewer.setFOV(60);
|
|
viewer.setPointBudget(1_000_000);
|
|
viewer.setMinNodeSize(10);
|
|
viewer.loadSettingsFromURL();
|
|
|
|
viewer.loadGUI(() => {
|
|
viewer.setLanguage('en');
|
|
$("#menu_scene").next().show();
|
|
$("#menu_tools").next().show();
|
|
// viewer.toggleSidebar();
|
|
});
|
|
|
|
|
|
let loadedPointClouds = [];
|
|
|
|
async function loadByPc(pointCloud) {
|
|
let doLoadPc = Potree.loadPointCloud("../pointclouds/generated/" + pointCloud.id + "/metadata.json");
|
|
|
|
let pc = (await doLoadPc).pointcloud;
|
|
|
|
|
|
pc.name = pointCloud.name;//(' ' + pointCloud.name).slice(1);
|
|
|
|
viewer.scene.addPointCloud(pc);
|
|
|
|
// let material = pc.material;
|
|
// material.size = 1;
|
|
// material.pointSizeType = Potree.PointSizeType.ADAPTIVE;
|
|
|
|
pc.rotation.set(pointCloud.rotation.x, pointCloud.rotation.y, pointCloud.rotation.z);
|
|
pc.position.set(pointCloud.transformation.x, pointCloud.transformation.y, pointCloud.transformation.z);
|
|
|
|
loadedPointClouds.push({id: pointCloud.id, pointCloud: pc})
|
|
}
|
|
|
|
window.loadFromArray = function (pointClouds) {
|
|
for (const i in pointClouds) {
|
|
let entry = loadedPointClouds.find(pc => pc.id === pointClouds[i].id)
|
|
if (entry != null) {
|
|
entry.pointCloud.name = pointClouds[i].name;
|
|
if (entry.pointCloud.visible !== pointClouds[i].visible)
|
|
entry.pointCloud.visible = pointClouds[i].visible;
|
|
else {
|
|
entry.pointCloud.visible = !entry.pointCloud.visible;
|
|
entry.pointCloud.visible = !entry.pointCloud.visible;
|
|
}
|
|
entry.pointCloud.rotation.set(pointClouds[i].rotation.x, pointClouds[i].rotation.y, pointClouds[i].rotation.z);
|
|
entry.pointCloud.position.set(pointClouds[i].transformation.x, pointClouds[i].transformation.y, pointClouds[i].transformation.z);
|
|
} else {
|
|
loadByPc(pointClouds[i])
|
|
}
|
|
}
|
|
|
|
for (let entry in loadedPointClouds) {
|
|
if (pointClouds.find(ipc => ipc.id === loadedPointClouds[entry].id))
|
|
continue;
|
|
|
|
const index = viewer.scene.pointclouds.indexOf(loadedPointClouds[entry].pointCloud);
|
|
if (index > -1) {
|
|
window.viewer.scene.pointclouds.forEach(function (layer) {
|
|
if (layer === loadedPointClouds[entry].pointCloud)
|
|
window.viewer.scene.scenePointCloud.remove(layer);
|
|
});
|
|
viewer.scene.pointclouds.splice(index, 1);
|
|
|
|
loadedPointClouds[entry].pointCloud.dispatchEvent({
|
|
type: "remove"
|
|
});
|
|
|
|
loadedPointClouds.splice(entry, 1);
|
|
}
|
|
}
|
|
}
|
|
|
|
window.setVisible = function (targetId, val) {
|
|
let entry = loadedPointClouds.find(pc => pc.id === targetId)
|
|
entry.visible = val;
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
</body>
|
|
</html>
|