223 lines
8.2 KiB
HTML
223 lines
8.2 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
|
|
<title>Potree Cesium</title>
|
|
<style>
|
|
@import url(../libs/Cesium/Widgets/widgets.css);
|
|
html, body, #cesiumContainer {
|
|
width: 100%; height: 100%; margin: 0; padding: 0; overflow: hidden;
|
|
}
|
|
</style>
|
|
<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/perfect-scrollbar/css/perfect-scrollbar.css">
|
|
<link rel="stylesheet" href="../libs/openlayers3/ol.css" type="text/css">
|
|
<link rel="stylesheet" href="../libs/spectrum/spectrum.css" type="text/css">
|
|
</head>
|
|
<body>
|
|
|
|
<script src="../libs/jquery/jquery-3.1.1.js"></script>
|
|
<script src="../libs/spectrum/spectrum.js"></script>
|
|
|
|
<!--<script src="../libs/other/webgl-debug.js"></script>-->
|
|
<script src="../libs/perfect-scrollbar/js/perfect-scrollbar.jquery.js"></script>
|
|
<script src="../libs/jquery-ui/jquery-ui.min.js"></script>
|
|
<script src="../libs/three.js/build/three.js"></script>
|
|
<script src="../libs/other/stats.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/Cesium/Cesium.js"></script>
|
|
|
|
<script src="../build/potree/potree.js"></script>
|
|
<!--<script src="../src/viewer/sidebar.js"></script>-->
|
|
|
|
<!-- INCLUDE ADDITIONAL DEPENDENCIES HERE -->
|
|
<!-- INCLUDE SETTINGS HERE -->
|
|
|
|
<script src="../libs/plasio/js/laslaz.js"></script>
|
|
<script src="../libs/plasio/vendor/bluebird.js"></script>
|
|
|
|
<div class="potree_container" style="position: absolute; width: 100vw; height: 100vh; left: 0px; top: 0px; ">
|
|
|
|
|
|
|
|
<div id="potree_render_area">
|
|
|
|
<div id="cesiumContainer" style="position: absolute; width: 100%; height: 100%; background-color:green"></div>
|
|
|
|
<div id="potree_map" class="mapBox" style="position: absolute; left: 50px; top: 50px; width: 400px; height: 400px; display: none">
|
|
<div id="potree_map_header" style="position: absolute; width: 100%; height: 25px; top: 0px; background-color: rgba(0,0,0,0.5); z-index: 1000; border-top-left-radius: 3px; border-top-right-radius: 3px;">
|
|
</div>
|
|
<div id="potree_map_content" class="map" style="position: absolute; z-index: 100; top: 25px; width: 100%; height: calc(100% - 25px); border: 2px solid rgba(0,0,0,0.5); box-sizing: border-box;"></div>
|
|
</div>
|
|
|
|
<div id="potree_description" class="potree_info_text"></div>
|
|
</div>
|
|
|
|
<div id="potree_sidebar_container"> </div>
|
|
</div>
|
|
|
|
|
|
<script>
|
|
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/'}),
|
|
});
|
|
|
|
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(2000*1000);
|
|
potreeViewer.setMinNodeSize(0);
|
|
potreeViewer.loadSettingsFromURL();
|
|
potreeViewer.setBackground(null);
|
|
|
|
potreeViewer.loadGUI(() => {
|
|
potreeViewer.setLanguage('en');
|
|
$("#menu_appearance").next().show();
|
|
//viewer.toggleSidebar();
|
|
});
|
|
|
|
//Potree.loadPointCloud("http://5.9.65.151/mschuetz/potree/resources/pointclouds/archpro/heidentor/cloud.js", "Heidentor", function(e){
|
|
Potree.loadPointCloud("../pointclouds/vol_total/cloud.js", "sigeom.sa", e => {
|
|
potreeViewer.scene.addPointCloud(e.pointcloud);
|
|
e.pointcloud.position.z = 0;
|
|
let material = e.pointcloud.material;
|
|
material.pointSizeType = Potree.PointSizeType.ADAPTIVE;
|
|
|
|
potreeViewer.scene.view.position.set(590096.63, 231923.89, 509.60);
|
|
potreeViewer.scene.view.lookAt(new THREE.Vector3(589807.61, 231393.30, 25.07));
|
|
|
|
Potree.measureTimings = true;
|
|
|
|
|
|
let pointcloudProjection = e.pointcloud.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());
|
|
|
|
let entity = {
|
|
name : 'Sorvilier',
|
|
polygon : {
|
|
hierarchy : Cesium.Cartesian3.fromDegreesArray([
|
|
minWGS84[0], minWGS84[1],
|
|
maxWGS84[0], minWGS84[1],
|
|
maxWGS84[0], maxWGS84[1],
|
|
minWGS84[0], maxWGS84[1],
|
|
]),
|
|
material : Cesium.Color.RED.withAlpha(0.5)
|
|
}
|
|
};
|
|
|
|
let sorvilier = cesiumViewer.entities.add(entity);
|
|
}
|
|
|
|
|
|
});
|
|
|
|
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>
|