annotations, save/load, ...
This commit is contained in:
parent
1a023c99a8
commit
d5abfdb256
@ -21,6 +21,7 @@
|
||||
"area_measurement": "Area measurement",
|
||||
"volume_measurement": "Volume measurement",
|
||||
"height_profile": "Height profile",
|
||||
"annotation": "Annotation",
|
||||
"clip_volume": "Volume clip",
|
||||
"clip_polygon": "Polygon clip",
|
||||
"screen_clip_box": "Draw a selection box. Requires you to be in orthographic camera mode!",
|
||||
|
||||
@ -8,18 +8,11 @@ export class Annotation extends EventDispatcher {
|
||||
constructor (args = {}) {
|
||||
super();
|
||||
|
||||
let valueOrDefault = (a, b) => {
|
||||
if(a === null || a === undefined){
|
||||
return b;
|
||||
}else{
|
||||
return a;
|
||||
}
|
||||
};
|
||||
|
||||
this.scene = null;
|
||||
this._title = args.title || 'No Title';
|
||||
this._description = args.description || '';
|
||||
this.offset = new THREE.Vector3();
|
||||
this.uuid = THREE.Math.generateUUID();
|
||||
|
||||
if (!args.position) {
|
||||
this.position = null;
|
||||
@ -352,6 +345,11 @@ export class Annotation extends EventDispatcher {
|
||||
this._title = title;
|
||||
this.elTitle.empty();
|
||||
this.elTitle.append(this._title);
|
||||
|
||||
this.dispatchEvent({
|
||||
type: "annotation_changed",
|
||||
annotation: this,
|
||||
});
|
||||
}
|
||||
|
||||
get description () {
|
||||
@ -368,6 +366,11 @@ export class Annotation extends EventDispatcher {
|
||||
const elDescriptionContent = this.elDescription.find(".annotation-description-content");
|
||||
elDescriptionContent.empty();
|
||||
elDescriptionContent.append(this._description);
|
||||
|
||||
this.dispatchEvent({
|
||||
type: "annotation_changed",
|
||||
annotation: this,
|
||||
});
|
||||
}
|
||||
|
||||
add (annotation) {
|
||||
@ -531,32 +534,6 @@ export class Annotation extends EventDispatcher {
|
||||
let endPosition = this.cameraPosition;
|
||||
|
||||
Utils.moveTo(this.scene, endPosition, endTarget);
|
||||
|
||||
//{ // animate camera position
|
||||
// let tween = new TWEEN.Tween(view.position).to(endPosition, animationDuration);
|
||||
// tween.easing(easing);
|
||||
// tween.start();
|
||||
//}
|
||||
|
||||
//{ // animate camera target
|
||||
// let camTargetDistance = camera.position.distanceTo(endTarget);
|
||||
// let target = new THREE.Vector3().addVectors(
|
||||
// camera.position,
|
||||
// camera.getWorldDirection().clone().multiplyScalar(camTargetDistance)
|
||||
// );
|
||||
// let tween = new TWEEN.Tween(target).to(endTarget, animationDuration);
|
||||
// tween.easing(easing);
|
||||
// tween.onUpdate(() => {
|
||||
// view.lookAt(target);
|
||||
// });
|
||||
// tween.onComplete(() => {
|
||||
// view.lookAt(target);
|
||||
// this.dispatchEvent({type: 'focusing_finished', target: this});
|
||||
// });
|
||||
|
||||
// this.dispatchEvent({type: 'focusing_started', target: this});
|
||||
// tween.start();
|
||||
//}
|
||||
} else if (this.radius) {
|
||||
let direction = view.direction;
|
||||
let endPosition = endTarget.clone().add(direction.multiplyScalar(-this.radius));
|
||||
|
||||
@ -68,19 +68,19 @@ export class PointCloudEptGeometry {
|
||||
|
||||
let hierarchyType = info.hierarchyType || 'json';
|
||||
|
||||
const dataType = info.dataType;
|
||||
if (dataType == 'laszip') {
|
||||
this.loader = new Potree.EptLaszipLoader();
|
||||
}
|
||||
else if (dataType == 'binary') {
|
||||
const dataType = info.dataType;
|
||||
if (dataType == 'laszip') {
|
||||
this.loader = new Potree.EptLaszipLoader();
|
||||
}
|
||||
else if (dataType == 'binary') {
|
||||
this.loader = new Potree.EptBinaryLoader();
|
||||
}
|
||||
else if (dataType == 'zstandard') {
|
||||
this.loader = new Potree.EptZstandardLoader();
|
||||
}
|
||||
else {
|
||||
throw new Error('Could not read data type: ' + dataType);
|
||||
}
|
||||
}
|
||||
else if (dataType == 'zstandard') {
|
||||
this.loader = new Potree.EptZstandardLoader();
|
||||
}
|
||||
else {
|
||||
throw new Error('Could not read data type: ' + dataType);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -18,6 +18,8 @@ export class OrientedImageControls extends EventDispatcher{
|
||||
return this.shearCam.projectionMatrix;
|
||||
};
|
||||
|
||||
this.image = null;
|
||||
|
||||
this.fadeFactor = 20;
|
||||
this.fovDelta = 0;
|
||||
|
||||
@ -34,7 +36,7 @@ export class OrientedImageControls extends EventDispatcher{
|
||||
this.elExit = $(`<input type="button" value="Back to 3D view" style="position: absolute; bottom: 10px; right: 10px; z-index: 1000" />`);
|
||||
|
||||
this.elExit.click( () => {
|
||||
this.backTo3DView();
|
||||
this.release();
|
||||
});
|
||||
|
||||
this.elUp.click(() => {
|
||||
@ -72,20 +74,17 @@ export class OrientedImageControls extends EventDispatcher{
|
||||
//this.addEventListener("mousemove", onMove);
|
||||
}
|
||||
|
||||
backTo3DView(){
|
||||
this.viewer.scene.overrideCamera = null;
|
||||
|
||||
this.elUp.remove();
|
||||
this.elRight.remove();
|
||||
this.elDown.remove();
|
||||
this.elLeft.remove();
|
||||
this.elExit.remove();
|
||||
|
||||
this.viewer.setFOV(this.originalFOV);
|
||||
this.viewer.setControls(this.originalControls);
|
||||
hasSomethingCaptured(){
|
||||
return this.image !== null;
|
||||
}
|
||||
|
||||
hijackCamera(){
|
||||
capture(image){
|
||||
if(this.hasSomethingCaptured()){
|
||||
return;
|
||||
}
|
||||
|
||||
this.image = image;
|
||||
|
||||
this.originalFOV = this.viewer.getFOV();
|
||||
this.originalControls = this.viewer.getControls();
|
||||
|
||||
@ -95,13 +94,29 @@ export class OrientedImageControls extends EventDispatcher{
|
||||
const elCanvas = this.viewer.renderer.domElement;
|
||||
const elRoot = $(elCanvas.parentElement);
|
||||
|
||||
this.shear = [0, 0];
|
||||
|
||||
|
||||
elRoot.append(this.elUp);
|
||||
elRoot.append(this.elRight);
|
||||
elRoot.append(this.elDown);
|
||||
elRoot.append(this.elLeft);
|
||||
elRoot.append(this.elExit);
|
||||
}
|
||||
|
||||
|
||||
release(){
|
||||
this.image = null;
|
||||
|
||||
this.viewer.scene.overrideCamera = null;
|
||||
|
||||
this.elUp.detach();
|
||||
this.elRight.detach();
|
||||
this.elDown.detach();
|
||||
this.elLeft.detach();
|
||||
this.elExit.detach();
|
||||
|
||||
this.viewer.setFOV(this.originalFOV);
|
||||
this.viewer.setControls(this.originalControls);
|
||||
}
|
||||
|
||||
setScene (scene) {
|
||||
@ -188,13 +203,6 @@ export class OrientedImageControls extends EventDispatcher{
|
||||
|
||||
let total = shearCam.projectionMatrix.elements.reduce( (a, i) => a + i, 0);
|
||||
|
||||
if(total !== prevTotal){
|
||||
console.log(this.shearCam.projectionMatrix.elements);
|
||||
}
|
||||
|
||||
|
||||
//console.log(this.fovDelta);
|
||||
|
||||
this.fovDelta *= attenuation;
|
||||
}
|
||||
};
|
||||
|
||||
@ -276,11 +276,14 @@ export class OrientedImages{
|
||||
};
|
||||
|
||||
const onMouseClick = (evt) => {
|
||||
|
||||
if(orientedImageControls.hasSomethingCaptured()){
|
||||
return;
|
||||
}
|
||||
|
||||
if(hoveredElement){
|
||||
console.log("move to image " + hoveredElement.params.id);
|
||||
|
||||
//viewer.setControls(orientedImageControls);
|
||||
|
||||
const mesh = hoveredElement.mesh;
|
||||
const newCamPos = new THREE.Vector3(
|
||||
hoveredElement.params.x,
|
||||
@ -290,7 +293,7 @@ export class OrientedImages{
|
||||
const newCamTarget = mesh.position.clone();
|
||||
|
||||
viewer.scene.view.setView(newCamPos, newCamTarget, 500, () => {
|
||||
orientedImageControls.hijackCamera();
|
||||
orientedImageControls.capture(hoveredElement.params);
|
||||
});
|
||||
|
||||
if(hoveredElement.texture === null){
|
||||
|
||||
@ -1,14 +1,31 @@
|
||||
|
||||
|
||||
import {Annotation} from "../Annotation.js";
|
||||
import {Measure} from "../utils/Measure.js";
|
||||
|
||||
function loadPointCloud(viewer, data){
|
||||
Potree.loadPointCloud(data.url, data.name, () => {
|
||||
|
||||
const names = viewer.scene.pointclouds.map(p => p.name);
|
||||
const alreadyExists = names.includes(data.name);
|
||||
|
||||
if(alreadyExists){
|
||||
return;
|
||||
}
|
||||
|
||||
Potree.loadPointCloud(data.url, data.name, (e) => {
|
||||
const {pointcloud} = e;
|
||||
|
||||
pointcloud.position.set(...data.position);
|
||||
pointcloud.rotation.set(...data.rotation);
|
||||
pointcloud.scale.set(...data.scale);
|
||||
|
||||
viewer.scene.addPointCloud(pointcloud);
|
||||
});
|
||||
}
|
||||
|
||||
function loadMeasurement(viewer, data){
|
||||
|
||||
const measure = new Potree.Measure();
|
||||
const measure = new Measure();
|
||||
|
||||
measure.name = data.name;
|
||||
measure.showDistances = data.showDistances;
|
||||
@ -54,6 +71,34 @@ function loadSettings(viewer, data){
|
||||
|
||||
}
|
||||
|
||||
function loadView(viewer, view){
|
||||
viewer.scene.view.position.set(...view.position);
|
||||
viewer.scene.view.lookAt(...view.target);
|
||||
}
|
||||
|
||||
function loadAnnotationItem(item){
|
||||
const annotation = new Annotation({
|
||||
position: item.position,
|
||||
title: item.title,
|
||||
});
|
||||
|
||||
annotation.offset.set(...item.offset);
|
||||
|
||||
return annotation;
|
||||
}
|
||||
|
||||
function loadAnnotations(viewer, data){
|
||||
|
||||
const {items, hierarchy} = data;
|
||||
|
||||
const annotations = items.map(loadAnnotationItem);
|
||||
|
||||
for(const annotation of annotations){
|
||||
viewer.scene.annotations.add(annotation);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
export function loadSaveData(viewer, data){
|
||||
|
||||
@ -64,6 +109,12 @@ export function loadSaveData(viewer, data){
|
||||
|
||||
loadSettings(viewer, data.settings);
|
||||
|
||||
loadView(viewer, data.view);
|
||||
|
||||
for(const pointcloud of data.pointclouds){
|
||||
loadPointCloud(viewer, pointcloud);
|
||||
}
|
||||
|
||||
for(const measure of data.measurements){
|
||||
loadMeasurement(viewer, measure);
|
||||
}
|
||||
@ -76,4 +127,6 @@ export function loadSaveData(viewer, data){
|
||||
loadProfile(viewer, profile);
|
||||
}
|
||||
|
||||
loadAnnotations(viewer, data.annotations);
|
||||
|
||||
}
|
||||
91
src/viewer/PropertyPanels/AnnotationPanel.js
Normal file
91
src/viewer/PropertyPanels/AnnotationPanel.js
Normal file
@ -0,0 +1,91 @@
|
||||
|
||||
import {Utils} from "../../utils.js";
|
||||
|
||||
export class AnnotationPanel{
|
||||
constructor(viewer, propertiesPanel, annotation){
|
||||
this.viewer = viewer;
|
||||
this.propertiesPanel = propertiesPanel;
|
||||
this.annotation = annotation;
|
||||
|
||||
this._update = () => { this.update(); };
|
||||
|
||||
let copyIconPath = `${Potree.resourcePath}/icons/copy.svg`;
|
||||
this.elContent = $(`
|
||||
<div class="propertypanel_content">
|
||||
<table>
|
||||
<tr>
|
||||
<th colspan="3">position</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center" id="annotation_position_x" style="width: 25%"></td>
|
||||
<td align="center" id="annotation_position_y" style="width: 25%"></td>
|
||||
<td align="center" id="annotation_position_z" style="width: 25%"></td>
|
||||
<td align="right" id="copy_annotation_position" style="width: 25%">
|
||||
<img name="copyPosition" title="copy" class="button-icon" src="${copyIconPath}" style="width: 16px; height: 16px"/>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<div>
|
||||
|
||||
<div class="heading">Title</div>
|
||||
<div id="annotation_title" contenteditable="true">
|
||||
Annotation Title
|
||||
</div>
|
||||
|
||||
<div class="heading">Description</div>
|
||||
<div id="annotation_description" contenteditable="true">
|
||||
A longer description of this annotation.
|
||||
Can be multiple lines long. TODO: the user should be able
|
||||
to modify title and description.
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
`);
|
||||
|
||||
this.elCopyPosition = this.elContent.find("img[name=copyPosition]");
|
||||
this.elCopyPosition.click( () => {
|
||||
let pos = this.annotation.position.toArray();
|
||||
let msg = pos.map(c => c.toFixed(3)).join(", ");
|
||||
Utils.clipboardCopy(msg);
|
||||
|
||||
this.viewer.postMessage(
|
||||
`Copied value to clipboard: <br>'${msg}'`,
|
||||
{duration: 3000});
|
||||
});
|
||||
|
||||
this.elTitle = this.elContent.find("#annotation_title").html(annotation.title);
|
||||
this.elDescription = this.elContent.find("#annotation_description").html(annotation.description);
|
||||
|
||||
this.elTitle[0].addEventListener("input", () => {
|
||||
const title = this.elTitle.html();
|
||||
annotation.title = title;
|
||||
|
||||
}, false);
|
||||
|
||||
this.elDescription[0].addEventListener("input", () => {
|
||||
const description = this.elDescription.html();
|
||||
annotation.description = description;
|
||||
}, false);
|
||||
|
||||
this.update();
|
||||
}
|
||||
|
||||
update(){
|
||||
const {annotation, elContent, elTitle, elDescription} = this;
|
||||
|
||||
let pos = annotation.position.toArray().map(c => Utils.addCommas(c.toFixed(3)));
|
||||
elContent.find("#annotation_position_x").html(pos[0]);
|
||||
elContent.find("#annotation_position_y").html(pos[1]);
|
||||
elContent.find("#annotation_position_z").html(pos[2]);
|
||||
|
||||
elTitle.html(annotation.title);
|
||||
elDescription.html(annotation.description);
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
import {Utils} from "../../utils.js";
|
||||
import {PointCloudTree} from "../../PointCloudTree.js";
|
||||
import {Annotation} from "../../Annotation.js";
|
||||
import {Measure} from "../../utils/Measure.js";
|
||||
import {Profile} from "../../utils/Profile.js";
|
||||
import {Volume, BoxVolume, SphereVolume} from "../../utils/Volume.js";
|
||||
@ -17,6 +18,7 @@ import {HeightPanel} from "./HeightPanel.js";
|
||||
import {VolumePanel} from "./VolumePanel.js";
|
||||
import {ProfilePanel} from "./ProfilePanel.js";
|
||||
import {CameraPanel} from "./CameraPanel.js";
|
||||
import {AnnotationPanel} from "./AnnotationPanel.js";
|
||||
|
||||
export class PropertiesPanel{
|
||||
|
||||
@ -51,6 +53,8 @@ export class PropertiesPanel{
|
||||
this.setMeasurement(object);
|
||||
}else if(object instanceof THREE.Camera){
|
||||
this.setCamera(object);
|
||||
}else if(object instanceof Annotation){
|
||||
this.setAnnotation(object);
|
||||
}
|
||||
|
||||
}
|
||||
@ -838,4 +842,9 @@ export class PropertiesPanel{
|
||||
this.container.append(panel.elContent);
|
||||
}
|
||||
|
||||
setAnnotation(annotation){
|
||||
let panel = new AnnotationPanel(this.viewer, this, annotation);
|
||||
this.container.append(panel.elContent);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -5,6 +5,10 @@ function createPointcloudData(pointcloud) {
|
||||
const pcdata = {
|
||||
name: pointcloud.name,
|
||||
url: pointcloud.pcoGeometry.url,
|
||||
position: pointcloud.position.toArray(),
|
||||
rotation: pointcloud.rotation.toArray(),
|
||||
scale: pointcloud.scale.toArray(),
|
||||
activeAttributeName: pointcloud.material.activeAttributeName,
|
||||
};
|
||||
|
||||
return pcdata;
|
||||
|
||||
@ -767,7 +767,7 @@ body{
|
||||
|
||||
|
||||
::-webkit-scrollbar {
|
||||
width: 6px;
|
||||
width: 6px;
|
||||
background-color: var(--bg-color);
|
||||
}
|
||||
|
||||
@ -777,4 +777,10 @@ body{
|
||||
|
||||
::-webkit-scrollbar-thumb {
|
||||
background-color: var(--color-1);
|
||||
}
|
||||
|
||||
.propertypanel_content .heading{
|
||||
font-weight: bold;
|
||||
padding-top: 0.6em;
|
||||
padding-bottom: 0.1em;
|
||||
}
|
||||
@ -566,9 +566,18 @@ export class ProfileWindow extends EventDispatcher {
|
||||
let sg = new THREE.SphereGeometry(1, 16, 16);
|
||||
let sm = new THREE.MeshNormalMaterial();
|
||||
this.pickSphere = new THREE.Mesh(sg, sm);
|
||||
//this.pickSphere.visible = false;
|
||||
this.scene.add(this.pickSphere);
|
||||
|
||||
{
|
||||
const sg = new THREE.SphereGeometry(2);
|
||||
const sm = new THREE.MeshNormalMaterial();
|
||||
const s = new THREE.Mesh(sg, sm);
|
||||
|
||||
s.position.set(589530.450, 231398.860, 769.735);
|
||||
|
||||
this.scene.add(s);
|
||||
}
|
||||
|
||||
this.viewerPickSphere = new THREE.Mesh(sg, sm);
|
||||
|
||||
this.pointCloudRoot = new THREE.Object3D();
|
||||
|
||||
@ -12,10 +12,6 @@ import {CameraMode, ClipTask, ClipMethod} from "../defines.js"
|
||||
import {ScreenBoxSelectTool} from "../utils/ScreenBoxSelectTool.js"
|
||||
import {Utils} from "../utils.js"
|
||||
|
||||
import {EarthControls} from "../navigation/EarthControls.js"
|
||||
import {FirstPersonControls} from "../navigation/FirstPersonControls.js"
|
||||
import {OrbitControls} from "../navigation/OrbitControls.js"
|
||||
|
||||
import {ZoomableSlider} from "./ZoomableSlider.js"
|
||||
|
||||
export class Sidebar{
|
||||
@ -205,6 +201,21 @@ export class Sidebar{
|
||||
}
|
||||
));
|
||||
|
||||
// ANNOTATION
|
||||
elToolbar.append(this.createToolIcon(
|
||||
Potree.resourcePath + '/icons/annotation.svg',
|
||||
'[title]tt.annotation',
|
||||
() => {
|
||||
$('#menu_measurements').next().slideDown(); ;
|
||||
let annotation = this.viewer.annotationTool.startInsertion();
|
||||
|
||||
let annotationsRoot = $("#jstree_scene").jstree().get_json("annotations");
|
||||
let jsonNode = annotationsRoot.children.find(child => child.data.uuid === annotation.uuid);
|
||||
$.jstree.reference(jsonNode.id).deselect_all();
|
||||
$.jstree.reference(jsonNode.id).select_node(jsonNode.id);
|
||||
}
|
||||
));
|
||||
|
||||
// REMOVE ALL
|
||||
elToolbar.append(this.createToolIcon(
|
||||
Potree.resourcePath + '/icons/reset_tools.svg',
|
||||
@ -515,8 +526,15 @@ export class Sidebar{
|
||||
let annotationID = createNode(parentID, annotation.title, annotationIcon, annotation);
|
||||
this.annotationMapping.set(annotation, annotationID);
|
||||
|
||||
//let node = createNode(annotationsID, annotation.name, icon, volume);
|
||||
//oldScene.annotations.removeEventListener('annotation_added', this.onAnnotationAdded);
|
||||
annotation.addEventListener("annotation_changed", (e) => {
|
||||
let annotationsRoot = $("#jstree_scene").jstree().get_json("annotations");
|
||||
let jsonNode = annotationsRoot.children.find(child => child.data.uuid === annotation.uuid);
|
||||
|
||||
//let tree = $(`<div id="jstree_scene"></div>`);
|
||||
//tree.jstree("rename_node", jsonNode.id, annotation.title);
|
||||
|
||||
$.jstree.reference(jsonNode.id).rename_node(jsonNode.id, annotation.title);
|
||||
});
|
||||
};
|
||||
|
||||
this.viewer.scene.addEventListener("pointcloud_added", onPointCloudAdded);
|
||||
|
||||
79
wip/annotations.html
Normal file
79
wip/annotations.html
Normal file
@ -0,0 +1,79 @@
|
||||
<!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/three.js/build/three.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: 0px; top: 0px; ">
|
||||
<div id="potree_render_area"></div>
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(1*1000*1000);
|
||||
viewer.loadSettingsFromURL();
|
||||
|
||||
viewer.setDescription("Point cloud courtesy of <a target='_blank' href='https://www.sigeom.ch/'>sigeom sa</a>");
|
||||
|
||||
viewer.loadGUI(() => {
|
||||
viewer.setLanguage('en');
|
||||
$("#menu_tools").next().show();
|
||||
$("#menu_scene").next().show();
|
||||
viewer.toggleSidebar();
|
||||
});
|
||||
|
||||
// Load and add point cloud to scene
|
||||
Potree.loadPointCloud("../pointclouds/vol_total/cloud.js", "sigeom.sa", e => {
|
||||
let scene = viewer.scene;
|
||||
let pointcloud = e.pointcloud;
|
||||
|
||||
let material = pointcloud.material;
|
||||
material.size = 1;
|
||||
material.pointSizeType = Potree.PointSizeType.ADAPTIVE;
|
||||
material.shape = Potree.PointShape.SQUARE;
|
||||
|
||||
scene.addPointCloud(pointcloud);
|
||||
|
||||
//scene.view.position.set(589974.341, 231698.397, 986.146);
|
||||
//scene.view.lookAt(new THREE.Vector3(589851.587, 231428.213, 715.634));
|
||||
viewer.fitToScreen();
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
101
wip/viewer.html
Normal file
101
wip/viewer.html
Normal file
@ -0,0 +1,101 @@
|
||||
<!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/three.js/build/three.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: 0px; top: 0px; ">
|
||||
<div id="potree_render_area"></div>
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(1*1000*1000);
|
||||
viewer.loadSettingsFromURL();
|
||||
|
||||
viewer.setDescription("Point cloud courtesy of <a target='_blank' href='https://www.sigeom.ch/'>sigeom sa</a>");
|
||||
|
||||
viewer.loadGUI(() => {
|
||||
viewer.setLanguage('en');
|
||||
$("#menu_tools").next().show();
|
||||
$("#menu_clipping").next().show();
|
||||
viewer.toggleSidebar();
|
||||
});
|
||||
|
||||
// Load and add point cloud to scene
|
||||
Potree.loadPointCloud("../pointclouds/vol_total/cloud.js", "sigeom.sa", e => {
|
||||
let scene = viewer.scene;
|
||||
let pointcloud = e.pointcloud;
|
||||
|
||||
let material = pointcloud.material;
|
||||
material.size = 1;
|
||||
material.pointSizeType = Potree.PointSizeType.ADAPTIVE;
|
||||
material.shape = Potree.PointShape.SQUARE;
|
||||
|
||||
scene.addPointCloud(pointcloud);
|
||||
|
||||
scene.view.position.set(589687.750, 231536.881, 907.277);
|
||||
scene.view.lookAt(589526.044, 231432.479, 770.907);
|
||||
//viewer.fitToScreen();
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
||||
let profile = new Potree.Profile();
|
||||
profile.name = "Elevation Profile";
|
||||
profile.setWidth(6)
|
||||
profile.addMarker(new THREE.Vector3(589522.400, 231307.640, 775.695));
|
||||
profile.addMarker(new THREE.Vector3(589538.360, 231487.780, 779.185));
|
||||
|
||||
viewer.scene.addProfile(profile);
|
||||
|
||||
|
||||
const sg = new THREE.SphereGeometry(2);
|
||||
const sm = new THREE.MeshNormalMaterial();
|
||||
const s = new THREE.Mesh(sg, sm);
|
||||
|
||||
s.position.set(589530.450, 231398.860, 769.735);
|
||||
|
||||
viewer.scene.scene.add(s);
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Loading…
x
Reference in New Issue
Block a user