Merge pull request #178 from potree/refactoring_viewer_example
Refactoring viewer example
This commit is contained in:
commit
b82be77992
@ -883,36 +883,39 @@ Potree.Shaders["blur.fs"] = [
|
||||
|
||||
THREE.PerspectiveCamera.prototype.zoomTo = function( node, factor ){
|
||||
|
||||
if ( !node.geometry && !node.boundingSphere) {
|
||||
|
||||
if ( !node.geometry && !node.boundingSphere && !node.boundingBox) {
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if ( node.geometry && node.geometry.boundingSphere === null ) {
|
||||
|
||||
node.geometry.computeBoundingSphere();
|
||||
|
||||
}
|
||||
|
||||
node.updateMatrixWorld();
|
||||
|
||||
var bs;
|
||||
|
||||
if(node.boundingSphere){
|
||||
bs = node.boundingSphere;
|
||||
}else if(node.geometry && node.geometry.boundingSphere){
|
||||
bs = node.geometry.boundingSphere;
|
||||
}else{
|
||||
bs = node.boundingBox.getBoundingSphere();
|
||||
}
|
||||
|
||||
var _factor = factor || 1;
|
||||
var bs = node.boundingSphere || node.geometry.boundingSphere;
|
||||
|
||||
bs = bs.clone().applyMatrix4(node.matrixWorld);
|
||||
var radius = bs.radius;
|
||||
var fovr = this.fov * Math.PI / 180;
|
||||
|
||||
if( this.aspect < 1 ){
|
||||
|
||||
fovr = fovr * this.aspect;
|
||||
|
||||
}
|
||||
|
||||
var distanceFactor = Math.abs( radius / Math.sin( fovr / 2 ) ) * _factor ;
|
||||
|
||||
var dir = new THREE.Vector3( 0, 0, -1 ).applyQuaternion( this.quaternion );
|
||||
var offset = dir.multiplyScalar( -distanceFactor );
|
||||
var offset = this.getWorldDirection().multiplyScalar( -distanceFactor );
|
||||
this.position.copy(bs.center.clone().add( offset ));
|
||||
|
||||
};
|
||||
@ -4069,6 +4072,8 @@ LRU.prototype.disposeDescendants = function(node){
|
||||
while(stack.length > 0){
|
||||
var current = stack.pop();
|
||||
|
||||
//console.log(current);
|
||||
|
||||
current.dispose();
|
||||
this.remove(current);
|
||||
|
||||
@ -4082,17 +4087,488 @@ LRU.prototype.disposeDescendants = function(node){
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Potree.ProfileRequest = function(){
|
||||
this.queue = [];
|
||||
Potree.Annotation = function(viewer, args){
|
||||
var scope = this;
|
||||
|
||||
Potree.Annotation.counter++;
|
||||
|
||||
this.viewer = viewer;
|
||||
this.ordinal = args.ordinal || Potree.Annotation.counter;
|
||||
this.title = args.title || "No Title";
|
||||
this.description = args.description || "";
|
||||
this.scene = args.scene || null;
|
||||
this.position = args.position || new THREE.Vector3(0,0,0);
|
||||
this.cameraPosition = args.cameraPosition;
|
||||
this.cameraTarget = args.cameraTarget || this.position;
|
||||
this.view = args.view || null;
|
||||
this.keepOpen = false;
|
||||
|
||||
this.domElement = document.createElement("div");
|
||||
this.domElement.style.position = "fixed";
|
||||
this.domElement.style.opacity = "0.5";
|
||||
this.domElement.className = "annotation";
|
||||
|
||||
this.elOrdinal = document.createElement("div");
|
||||
this.elOrdinal.style.position = "absolute";
|
||||
this.elOrdinal.style.width = "1.5em";
|
||||
this.elOrdinal.style.height = "1.5em";
|
||||
this.elOrdinal.style.color = "white";
|
||||
this.elOrdinal.style.backgroundColor = "black";
|
||||
this.elOrdinal.style.borderRadius = "1.5em";
|
||||
this.elOrdinal.style.fontSize = "1em";
|
||||
this.elOrdinal.style.opacity = "1";
|
||||
this.elOrdinal.style.zIndex = "100";
|
||||
this.domElement.appendChild(this.elOrdinal);
|
||||
this.elOrdinal.onmouseenter = function(){
|
||||
//scope.openBar();
|
||||
};
|
||||
this.elOrdinal.onmouseleave = function(){
|
||||
|
||||
};
|
||||
this.elOrdinal.onclick = function(){
|
||||
scope.moveHere(scope.viewer.camera);
|
||||
//scope.openBar();
|
||||
//scope.keepOpen = true;
|
||||
};
|
||||
this.domElement.onmouseleave = function(){
|
||||
//scope.closeBar();
|
||||
};
|
||||
|
||||
|
||||
this.elOrdinalText = document.createElement("span");
|
||||
this.elOrdinalText.style.display = "inline-block";
|
||||
this.elOrdinalText.style.verticalAlign = "middle";
|
||||
this.elOrdinalText.style.lineHeight = "1.5em";
|
||||
this.elOrdinalText.style.textAlign = "center";
|
||||
this.elOrdinalText.style.width = "100%";
|
||||
//this.elOrdinalText.style.fontWeight = "bold";
|
||||
this.elOrdinalText.style.fontFamily = "Arial";
|
||||
this.elOrdinalText.style.cursor = "default";
|
||||
this.elOrdinalText.innerHTML = this.ordinal;
|
||||
this.elOrdinalText.userSelect = "none";
|
||||
this.elOrdinal.appendChild(this.elOrdinalText);
|
||||
|
||||
|
||||
this.elButtons = document.createElement("div");
|
||||
this.elButtons.style.position = "absolute";
|
||||
this.elButtons.style.display = "block";
|
||||
this.elButtons.style.height = "1.5em";
|
||||
this.elButtons.style.backgroundColor = "#333333";
|
||||
this.elButtons.style.zIndex = "50";
|
||||
this.elButtons.style.borderRadius = "1.5em 1.5em 1.5em 1.5em";
|
||||
this.elButtons.style.cursor = "default";
|
||||
this.elButtons.style.padding = "0.0em 0.0em 0em 1.5em";
|
||||
this.elButtons.style.whiteSpace = "nowrap";
|
||||
this.domElement.appendChild(this.elButtons);
|
||||
|
||||
|
||||
if(this.description){
|
||||
this.elButtonsInfo = document.createElement("img");
|
||||
this.elButtonsInfo.src = "../resources/icons/info_32x32.png";
|
||||
this.elButtonsInfo.style.width = "1.5em";
|
||||
this.elButtonsInfo.style.padding = "0em 0em 0em 0.2em";
|
||||
this.elButtons.appendChild(this.elButtonsInfo);
|
||||
this.elButtonsInfo.onclick = function(){
|
||||
scope.openDescriptionWindow();
|
||||
};
|
||||
}
|
||||
|
||||
if(this.scene){
|
||||
this.elButtonsScene = document.createElement("img");
|
||||
this.elButtonsScene.src = "../resources/icons/goto_32x32.png";
|
||||
this.elButtonsScene.style.width = "1.5em";
|
||||
this.elButtonsScene.style.padding = "0em 0em 0em 0.2em";
|
||||
this.elButtonsScene.onclick = function(){loadScene(scope.scene)};
|
||||
|
||||
this.elButtons.appendChild(this.elButtonsScene);
|
||||
}
|
||||
|
||||
this.domElement.onmouseenter = function(){
|
||||
scope.domElement.style.opacity = "0.8";
|
||||
};
|
||||
this.domElement.onmouseleave = function(){
|
||||
scope.domElement.style.opacity = "0.5";
|
||||
};
|
||||
|
||||
this.openBar = function(){
|
||||
scope.elOrdinal.style.opacity = 0.8;
|
||||
scope.elButtons.style.display = "block";
|
||||
};
|
||||
|
||||
this.closeBar = function(){
|
||||
if(!this.keepOpen){
|
||||
scope.elOrdinal.style.opacity = 0.5;
|
||||
scope.elButtons.style.display = "none";
|
||||
}
|
||||
};
|
||||
|
||||
this.openDescriptionWindow = function(){
|
||||
if(this.elDescription){
|
||||
this.elDescription.style.display = "block";
|
||||
}else{
|
||||
this.elDescription = document.createElement("div");
|
||||
this.elDescription.className = "description";
|
||||
|
||||
this.elDescriptionHeader = document.createElement("div");
|
||||
this.elDescriptionHeader.className = "description-header";
|
||||
this.elDescription.appendChild(this.elDescriptionHeader);
|
||||
|
||||
this.elDescriptionTitle = document.createElement("span");
|
||||
this.elDescriptionTitle.className = "description-title";
|
||||
this.elDescriptionTitle.innerHTML = scope.title;
|
||||
this.elDescriptionHeader.appendChild(this.elDescriptionTitle);
|
||||
|
||||
this.elDescriptionButtons = document.createElement("span");
|
||||
this.elDescriptionButtons.className = "description-buttons";
|
||||
this.elDescriptionHeader.appendChild(this.elDescriptionButtons);
|
||||
|
||||
this.elDescriptionClose = document.createElement("img");
|
||||
this.elDescriptionClose.src = "../resources/icons/close_32x32_black.png";
|
||||
this.elDescriptionClose.onmouseenter = function(){this.src = '../resources/icons/close_32x32_black_shadow.png'};
|
||||
this.elDescriptionClose.onmouseleave = function(){this.src = '../resources/icons/close_32x32_black.png'};
|
||||
this.elDescriptionClose.style.height = "1.5em";
|
||||
this.elDescriptionClose.onclick = function(){
|
||||
scope.elDescription.style.display = "none";
|
||||
};
|
||||
this.elDescriptionButtons.appendChild(this.elDescriptionClose);
|
||||
|
||||
this.elDescriptionContent = document.createElement("div");
|
||||
this.elDescriptionContent.className = "description-content";
|
||||
this.elDescriptionContent.innerHTML = this.description;
|
||||
this.elDescription.appendChild(this.elDescriptionContent);
|
||||
|
||||
document.body.appendChild(this.elDescription);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
this.moveHere = function(camera){
|
||||
var animationDuration = 800;
|
||||
var easing = TWEEN.Easing.Quartic.Out;
|
||||
|
||||
// animate camera position
|
||||
var tween = new TWEEN.Tween(camera.position).to(scope.cameraPosition, animationDuration);
|
||||
tween.easing(easing);
|
||||
tween.start();
|
||||
|
||||
// animate camera target
|
||||
var camTargetDistance = camera.position.distanceTo(scope.cameraTarget);
|
||||
var target = new THREE.Vector3().addVectors(
|
||||
camera.position,
|
||||
camera.getWorldDirection().clone().multiplyScalar(camTargetDistance)
|
||||
);
|
||||
var tween = new TWEEN.Tween(target).to(scope.cameraTarget, animationDuration);
|
||||
tween.easing(easing);
|
||||
tween.onUpdate(function(){
|
||||
camera.lookAt(target);
|
||||
scope.viewer.orbitControls.target.copy(target);
|
||||
});
|
||||
tween.onComplete(function(){
|
||||
camera.lookAt(target);
|
||||
scope.viewer.orbitControls.target.copy(target);
|
||||
});
|
||||
|
||||
tween.start();
|
||||
};
|
||||
|
||||
this.dispose = function(){
|
||||
if(this.descriptionDialog){
|
||||
var id = "annotation_description_" + scope.ordinal;
|
||||
$( ("#" + id) ).dialog('destroy');
|
||||
}
|
||||
|
||||
if(this.domElement.parentElement){
|
||||
this.domElement.parentElement.removeChild(this.domElement);
|
||||
}
|
||||
|
||||
if(this.elDescription){
|
||||
if(this.elDescription.parentElement){
|
||||
this.elDescription.parentElement.removeChild(this.elDescription);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
Potree.Annotation.counter = 0;
|
||||
|
||||
Potree.ProfileData = function(profile){
|
||||
this.profile = profile;
|
||||
|
||||
this.segments = [];
|
||||
this.boundingBox = new THREE.Box3();
|
||||
this.projectedBoundingBox = new THREE.Box2();
|
||||
|
||||
var mileage = new THREE.Vector3();
|
||||
for(var i = 0; i < profile.points.length - 1; i++){
|
||||
var start = profile.points[i];
|
||||
var end = profile.points[i+1];
|
||||
|
||||
var center = new THREE.Vector3().addVectors(end, start).multiplyScalar(0.5);
|
||||
var length = new THREE.Vector3(start.x, 0, start.z).distanceTo(new THREE.Vector3(end.x, 0, end.z));
|
||||
var side = new THREE.Vector3().subVectors(end, start).normalize();
|
||||
var up = new THREE.Vector3(0, 1, 0);
|
||||
var forward = new THREE.Vector3().crossVectors(side, up).normalize();
|
||||
var N = forward;
|
||||
var cutPlane = new THREE.Plane().setFromNormalAndCoplanarPoint(N, start);
|
||||
var halfPlane = new THREE.Plane().setFromNormalAndCoplanarPoint(side, center);
|
||||
|
||||
var project = function(_start, _end, _mileage){
|
||||
var start = _start;
|
||||
var end = _end;
|
||||
var mileage = _mileage;
|
||||
|
||||
var xAxis = new THREE.Vector3(1,0,0);
|
||||
var dir = new THREE.Vector3().subVectors(end, start);
|
||||
dir.y = 0;
|
||||
dir.normalize();
|
||||
var alpha = Math.acos(xAxis.dot(dir));
|
||||
if(dir.z > 0){
|
||||
alpha = -alpha;
|
||||
}
|
||||
|
||||
|
||||
return function(position){
|
||||
var toOrigin = new THREE.Matrix4().makeTranslation(-start.x, 0, -start.z);
|
||||
var alignWithX = new THREE.Matrix4().makeRotationY(-alpha);
|
||||
var applyMileage = new THREE.Matrix4().makeTranslation(mileage.x, 0, 0);
|
||||
|
||||
var pos = position.clone();
|
||||
pos.applyMatrix4(toOrigin);
|
||||
pos.applyMatrix4(alignWithX);
|
||||
pos.applyMatrix4(applyMileage);
|
||||
|
||||
return pos;
|
||||
};
|
||||
|
||||
}(start, end, mileage.clone());
|
||||
|
||||
var segment = {
|
||||
start: start,
|
||||
end: end,
|
||||
cutPlane: cutPlane,
|
||||
halfPlane: halfPlane,
|
||||
length: length,
|
||||
points: null,
|
||||
project: project
|
||||
};
|
||||
|
||||
this.segments.push(segment);
|
||||
|
||||
mileage.x += new THREE.Vector3(start.x, 0, start.z).distanceTo(new THREE.Vector3(end.x, 0, end.z));
|
||||
mileage.y += end.y - start.y;
|
||||
}
|
||||
|
||||
this.projectedBoundingBox.min.x = 0;
|
||||
this.projectedBoundingBox.min.y = Number.POSITIVE_INFINITY;
|
||||
this.projectedBoundingBox.max.x = mileage.x;
|
||||
this.projectedBoundingBox.max.y = Number.NEGATIVE_INFINITY;
|
||||
|
||||
this.size = function(){
|
||||
var size = 0;
|
||||
for(var i = 0; i < this.segments.length; i++){
|
||||
if(this.segments[i].points){
|
||||
size += this.segments[i].points.numPoints;
|
||||
}
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Potree.ProfileRequest = function(pointcloud, profile, maxDepth, callback){
|
||||
|
||||
this.pointcloud = pointcloud;
|
||||
this.profile = profile;
|
||||
this.maxDepth = maxDepth || Number.MAX_VALUE;
|
||||
this.callback = callback;
|
||||
this.temporaryResult = new Potree.ProfileData(this.profile);
|
||||
this.pointsServed = 0;
|
||||
|
||||
this.priorityQueue = new BinaryHeap(function(x){return 1 / x.weight;});
|
||||
|
||||
this.initialize = function(){
|
||||
this.priorityQueue.push({node: pointcloud.pcoGeometry.root, weight: 1});
|
||||
this.traverse(pointcloud.pcoGeometry.root);
|
||||
};
|
||||
|
||||
// traverse the node and add intersecting descendants to queue
|
||||
this.traverse = function(node){
|
||||
|
||||
var stack = [];
|
||||
for(var i = 0; i < 8; i++){
|
||||
var child = node.children[i];
|
||||
if(child && pointcloud.nodeIntersectsProfile(child, this.profile)){
|
||||
stack.push(child);
|
||||
}
|
||||
}
|
||||
|
||||
while(stack.length > 0){
|
||||
var node = stack.pop();
|
||||
var weight = node.boundingSphere.radius;
|
||||
|
||||
this.priorityQueue.push({node: node, weight: weight});
|
||||
|
||||
// add children that intersect the cutting plane
|
||||
if(node.level < this.maxDepth){
|
||||
for(var i = 0; i < 8; i++){
|
||||
var child = node.children[i];
|
||||
if(child && pointcloud.nodeIntersectsProfile(child, this.profile)){
|
||||
stack.push(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.update = function(){
|
||||
|
||||
// load nodes in queue
|
||||
// if hierarchy expands, also load nodes from expanded hierarchy
|
||||
// once loaded, add data to this.points and remove node from queue
|
||||
// only evaluate 1-50 nodes per frame to maintain responsiveness
|
||||
|
||||
var intersectedNodes = [];
|
||||
|
||||
for(var i = 0; i < Math.min(2, this.priorityQueue.size()); i++){
|
||||
var element = this.priorityQueue.pop();
|
||||
var node = element.node;
|
||||
|
||||
|
||||
if(node.loaded){
|
||||
// add points to result
|
||||
intersectedNodes.push(node);
|
||||
Potree.PointCloudOctree.lru.touch(node);
|
||||
|
||||
if((node.level % node.pcoGeometry.hierarchyStepSize) === 0 && node.hasChildren){
|
||||
this.traverse(node);
|
||||
}
|
||||
}else{
|
||||
node.load();
|
||||
this.priorityQueue.push(element);
|
||||
}
|
||||
}
|
||||
|
||||
if(intersectedNodes.length > 0){
|
||||
this.getPointsInsideProfile(intersectedNodes, this.temporaryResult);
|
||||
if(this.temporaryResult.size() > 100){
|
||||
this.pointsServed += this.temporaryResult.size();
|
||||
callback.onProgress({request: this, points: this.temporaryResult});
|
||||
this.temporaryResult = new Potree.ProfileData(this.profile);
|
||||
}
|
||||
}
|
||||
|
||||
if(this.priorityQueue.size() === 0){
|
||||
// we're done! inform callback and remove from pending requests
|
||||
|
||||
if(this.temporaryResult.size() > 0){
|
||||
this.pointsServed += this.temporaryResult.size();
|
||||
callback.onProgress({request: this, points: this.temporaryResult});
|
||||
this.temporaryResult = new Potree.ProfileData(this.profile);
|
||||
}
|
||||
|
||||
callback.onFinish({request: this});
|
||||
|
||||
var index = pointcloud.profileRequests.indexOf(this);
|
||||
if(index >= 0){
|
||||
pointcloud.profileRequests.splice(index, 1);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.getPointsInsideProfile = function(nodes, target){
|
||||
|
||||
for(var pi = 0; pi < target.segments.length; pi++){
|
||||
var segment = target.segments[pi];
|
||||
|
||||
for(var ni = 0; ni < nodes.length; ni++){
|
||||
var node = nodes[ni];
|
||||
|
||||
var geometry = node.geometry;
|
||||
var positions = geometry.attributes.position;
|
||||
var p = positions.array;
|
||||
var numPoints = node.numPoints;
|
||||
|
||||
if(!segment.points){
|
||||
segment.points = {};
|
||||
segment.points.boundingBox = new THREE.Box3();
|
||||
|
||||
for (var property in geometry.attributes) {
|
||||
if (geometry.attributes.hasOwnProperty(property)) {
|
||||
if(property === "indices"){
|
||||
|
||||
}else{
|
||||
segment.points[property] = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(var i = 0; i < numPoints; i++){
|
||||
var pos = new THREE.Vector3(p[3*i], p[3*i+1], p[3*i+2]);
|
||||
pos.applyMatrix4(pointcloud.matrixWorld);
|
||||
var distance = Math.abs(segment.cutPlane.distanceToPoint(pos));
|
||||
var centerDistance = Math.abs(segment.halfPlane.distanceToPoint(pos));
|
||||
|
||||
if(distance < profile.width / 2 && centerDistance < segment.length / 2){
|
||||
segment.points.boundingBox.expandByPoint(pos);
|
||||
|
||||
for (var property in geometry.attributes) {
|
||||
if (geometry.attributes.hasOwnProperty(property)) {
|
||||
|
||||
if(property === "position"){
|
||||
segment.points[property].push(pos);
|
||||
}else if(property === "indices"){
|
||||
// skip indices
|
||||
}else{
|
||||
var values = geometry.attributes[property];
|
||||
if(values.itemSize === 1){
|
||||
segment.points[property].push(values.array[i + j]);
|
||||
}else{
|
||||
var value = [];
|
||||
for(var j = 0; j < values.itemSize; j++){
|
||||
value.push(values.array[i*values.itemSize + j]);
|
||||
}
|
||||
segment.points[property].push(value);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
segment.points.numPoints = segment.points.position.length;
|
||||
|
||||
if(segment.points.numPoints > 0){
|
||||
target.boundingBox.expandByPoint(segment.points.boundingBox.min);
|
||||
target.boundingBox.expandByPoint(segment.points.boundingBox.max);
|
||||
|
||||
target.projectedBoundingBox.expandByPoint(new THREE.Vector2(0, target.boundingBox.min.y));
|
||||
target.projectedBoundingBox.expandByPoint(new THREE.Vector2(0, target.boundingBox.max.y));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.cancel = function(){
|
||||
callback.onCancel();
|
||||
|
||||
this.priorityQueue = new BinaryHeap(function(x){return 1 / x.weight;});
|
||||
|
||||
var index = pointcloud.profileRequests.indexOf(this);
|
||||
if(index >= 0){
|
||||
pointcloud.profileRequests.splice(index, 1);
|
||||
}
|
||||
};
|
||||
|
||||
this.initialize();
|
||||
|
||||
};
|
||||
|
||||
Potree.PointCloudOctreeNode = function(){
|
||||
this.children = {};
|
||||
this.sceneNode = null;
|
||||
this.octree = null;
|
||||
};
|
||||
|
||||
|
||||
@ -4119,6 +4595,7 @@ Potree.PointCloudOctree = function(geometry, material){
|
||||
this.visibleGeometry = [];
|
||||
this.pickTarget = null;
|
||||
this.generateDEM = false;
|
||||
this.profileRequests = [];
|
||||
|
||||
this.root = this.pcoGeometry.root;
|
||||
};
|
||||
@ -4174,6 +4651,13 @@ Potree.PointCloudOctree.prototype.updateVisibility = function(camera, renderer){
|
||||
var visible = insideFrustum;
|
||||
visible = visible && !(this.numVisiblePoints + node.numPoints > this.visiblePointsTarget);
|
||||
|
||||
//if(node instanceof Potree.PointCloudOctreeNode && viewer.profileTool.profiles.length > 0){
|
||||
// var profile = viewer.profileTool.profiles[0];
|
||||
// visible = this.nodeIntersectsProfile(node, profile);
|
||||
//}
|
||||
|
||||
//visible = "r06642222234".indexOf(node.name) >= 0;
|
||||
|
||||
if(!visible){
|
||||
continue;
|
||||
}
|
||||
@ -4191,6 +4675,7 @@ Potree.PointCloudOctree.prototype.updateVisibility = function(camera, renderer){
|
||||
var sceneNode = new THREE.PointCloud(geometry, this.material);
|
||||
sceneNode.visible = false;
|
||||
|
||||
pcoNode.octree = this;
|
||||
pcoNode.name = geometryNode.name;
|
||||
pcoNode.level = geometryNode.level;
|
||||
pcoNode.numPoints = geometryNode.numPoints;
|
||||
@ -4199,7 +4684,11 @@ Potree.PointCloudOctree.prototype.updateVisibility = function(camera, renderer){
|
||||
pcoNode.boundingSphere = pcoNode.boundingBox.getBoundingSphere();
|
||||
pcoNode.geometryNode = geometryNode;
|
||||
pcoNode.parent = parent;
|
||||
pcoNode.children = geometryNode.children;
|
||||
pcoNode.children = {};
|
||||
for(var key in geometryNode.children){
|
||||
pcoNode.children[key] = geometryNode.children[key];
|
||||
}
|
||||
|
||||
sceneNode.boundingBox = pcoNode.boundingBox;
|
||||
sceneNode.boundingSphere = pcoNode.boundingSphere;
|
||||
sceneNode.numPoints = pcoNode.numPoints;
|
||||
@ -4220,6 +4709,18 @@ Potree.PointCloudOctree.prototype.updateVisibility = function(camera, renderer){
|
||||
sceneNode.matrixWorld.multiplyMatrices( parent.sceneNode.matrixWorld, sceneNode.matrix );
|
||||
}
|
||||
|
||||
// when a PointCloudOctreeGeometryNode is disposed,
|
||||
// then replace reference to PointCloudOctreeNode with PointCloudOctreeGeometryNode
|
||||
// as it was before it was loaded
|
||||
var disposeListener = function(parent, pcoNode, geometryNode){
|
||||
return function(){
|
||||
var childIndex = parseInt(pcoNode.name[pcoNode.name.length - 1]);
|
||||
parent.sceneNode.remove(pcoNode.sceneNode);
|
||||
parent.children[childIndex] = geometryNode;
|
||||
}
|
||||
}(parent, pcoNode, node);
|
||||
pcoNode.geometryNode.oneTimeDisposeHandlers.push(disposeListener);
|
||||
|
||||
node = pcoNode;
|
||||
}
|
||||
|
||||
@ -4354,6 +4855,10 @@ Potree.PointCloudOctree.prototype.updateMaterial = function(material, visibleNod
|
||||
};
|
||||
|
||||
Potree.PointCloudOctree.prototype.update = function(camera, renderer){
|
||||
|
||||
for(var i = 0; i < this.profileRequests.length; i++){
|
||||
this.profileRequests[i].update();
|
||||
}
|
||||
|
||||
this.updateVisibility(camera, renderer);
|
||||
|
||||
@ -4364,8 +4869,6 @@ Potree.PointCloudOctree.prototype.update = function(camera, renderer){
|
||||
Potree.PointCloudOctree.lru.freeMemory();
|
||||
|
||||
// TODO bounds
|
||||
// TODO free memory
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -4429,13 +4932,44 @@ Potree.PointCloudOctree.prototype.updateVisibilityTexture = function(material, v
|
||||
texture.needsUpdate = true;
|
||||
};
|
||||
|
||||
Potree.PointCloudOctree.prototype.nodeIntersectsProfile = function(node, profile){
|
||||
var bbWorld = node.boundingBox.clone().applyMatrix4(this.matrixWorld);
|
||||
var bsWorld = bbWorld.getBoundingSphere();
|
||||
|
||||
for(var i = 0; i < profile.points.length - 1; i++){
|
||||
var start = new THREE.Vector3(profile.points[i].x, bsWorld.center.y, profile.points[i].z);
|
||||
var end = new THREE.Vector3(profile.points[i+1].x, bsWorld.center.y, profile.points[i+1].z);
|
||||
|
||||
var ray1 = new THREE.Ray(start, new THREE.Vector3().subVectors(end, start).normalize());
|
||||
var ray2 = new THREE.Ray(end, new THREE.Vector3().subVectors(start, end).normalize());
|
||||
|
||||
if(ray1.isIntersectionSphere(bsWorld) && ray2.isIntersectionSphere(bsWorld)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//Potree.PointCloudOctreeNode.prototype.intersectsProfile = function(profile){
|
||||
// var bbWorld = this.boundingBox.clone().applyMatrix4(this.octree.matrixWorld);
|
||||
// var bsWorld = bbWorld.getBoundingSphere();
|
||||
//
|
||||
// for(var i = 0; i < profile.points.length - 1; i++){
|
||||
// var start = new THREE.Vector3(profile.points[i].x, bsWorld.center.y, profile.points[i].z);
|
||||
// var end = new THREE.Vector3(profile.points[i+1].x, bsWorld.center.y, profile.points[i+1].z);
|
||||
//
|
||||
// var ray1 = new THREE.Ray(start, new THREE.Vector3().subVectors(end, start).normalize());
|
||||
// var ray2 = new THREE.Ray(end, new THREE.Vector3().subVectors(start, end).normalize());
|
||||
//
|
||||
// if(ray1.isIntersectionSphere(bsWorld) && ray2.isIntersectionSphere(bsWorld)){
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return false;
|
||||
//};
|
||||
|
||||
|
||||
|
||||
@ -4565,7 +5099,15 @@ Potree.PointCloudOctree.prototype.getBoundingBoxWorld = function(){
|
||||
*
|
||||
*
|
||||
*/
|
||||
Potree.PointCloudOctree.prototype.getPointsInProfile = function(profile, maxDepth){
|
||||
Potree.PointCloudOctree.prototype.getPointsInProfile = function(profile, maxDepth, callback){
|
||||
|
||||
if(callback){
|
||||
var request = new Potree.ProfileRequest(this, profile, maxDepth, callback);
|
||||
this.profileRequests.push(request);
|
||||
|
||||
return request;
|
||||
}
|
||||
|
||||
var points = {
|
||||
segments: [],
|
||||
boundingBox: new THREE.Box3(),
|
||||
@ -4657,7 +5199,8 @@ Potree.PointCloudOctree.prototype.getPointsInProfile = function(profile, maxDept
|
||||
*/
|
||||
Potree.PointCloudOctree.prototype.getProfile = function(start, end, width, depth, callback){
|
||||
if(callback !== undefined){
|
||||
this.profileRequests.push(new Potree.ProfileRequest(start, end, width, depth, callback));
|
||||
var request = new Potree.ProfileRequest(start, end, width, depth, callback);
|
||||
this.profileRequests.push(request);
|
||||
}else{
|
||||
var stack = [];
|
||||
stack.push(this);
|
||||
@ -5371,6 +5914,8 @@ Potree.PointCloudOctreeGeometryNode = function(name, pcoGeometry, boundingBox){
|
||||
this.children = {};
|
||||
this.numPoints = 0;
|
||||
this.level = null;
|
||||
this.loaded = false;
|
||||
this.oneTimeDisposeHandlers = [];
|
||||
};
|
||||
|
||||
Potree.PointCloudOctreeGeometryNode.IDCount = 0;
|
||||
@ -5413,7 +5958,7 @@ Potree.PointCloudOctreeGeometryNode.prototype.addChild = function(child){
|
||||
};
|
||||
|
||||
Potree.PointCloudOctreeGeometryNode.prototype.load = function(){
|
||||
if(this.loading === true || this.pcoGeometry.numNodesLoading > 3){
|
||||
if(this.loading === true || this.loaded === true ||this.pcoGeometry.numNodesLoading > 3){
|
||||
return;
|
||||
}
|
||||
|
||||
@ -5547,14 +6092,21 @@ Potree.PointCloudOctreeGeometryNode.prototype.loadHierachyThenPoints = function(
|
||||
|
||||
|
||||
Potree.PointCloudOctreeGeometryNode.prototype.dispose = function(){
|
||||
if(this.geometry){
|
||||
if(this.geometry && this.parent != null){
|
||||
this.geometry.dispose();
|
||||
this.geometry = null;
|
||||
this.loaded = false;
|
||||
|
||||
//this.dispatchEvent( { type: 'dispose' } );
|
||||
for(var i = 0; i < this.oneTimeDisposeHandlers.length; i++){
|
||||
var handler = this.oneTimeDisposeHandlers[i];
|
||||
handler();
|
||||
}
|
||||
this.oneTimeDisposeHandlers = [];
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
THREE.EventDispatcher.prototype.apply( Potree.PointCloudOctreeGeometryNode.prototype );
|
||||
|
||||
Potree.utils = function(){
|
||||
|
||||
@ -5783,53 +6335,29 @@ function projectedRadius(radius, fov, distance, screenHeight){
|
||||
};
|
||||
|
||||
|
||||
Potree.utils.topView = function(camera, controls, pointcloud){
|
||||
Potree.utils.topView = function(camera, node){
|
||||
camera.position.set(0, 1, 0);
|
||||
camera.rotation.set(-Math.PI / 2, 0, 0);
|
||||
camera.zoomTo(pointcloud, 1);
|
||||
|
||||
if(controls.target){
|
||||
var sg = pointcloud.boundingSphere.clone().applyMatrix4(pointcloud.matrixWorld);
|
||||
var target = new THREE.Vector3(camera.position.x, sg.center.y, camera.position.z);
|
||||
controls.target.copy(target);
|
||||
}
|
||||
camera.zoomTo(node, 1);
|
||||
};
|
||||
|
||||
Potree.utils.frontView = function(camera, controls, pointcloud){
|
||||
Potree.utils.frontView = function(camera, node){
|
||||
camera.position.set(0, 0, 1);
|
||||
camera.rotation.set(0, 0, 0);
|
||||
camera.zoomTo(pointcloud, 1);
|
||||
|
||||
if(controls.target){
|
||||
var sg = pointcloud.boundingSphere.clone().applyMatrix4(pointcloud.matrixWorld);
|
||||
var target = new THREE.Vector3(camera.position.x, camera.position.y, sg.center.z);
|
||||
controls.target.copy(target);
|
||||
}
|
||||
camera.zoomTo(node, 1);
|
||||
};
|
||||
|
||||
|
||||
Potree.utils.leftView = function(camera, controls, pointcloud){
|
||||
Potree.utils.leftView = function(camera, node){
|
||||
camera.position.set(-1, 0, 0);
|
||||
camera.rotation.set(0, -Math.PI / 2, 0);
|
||||
camera.zoomTo(pointcloud, 1);
|
||||
|
||||
if(controls.target){
|
||||
var sg = pointcloud.boundingSphere.clone().applyMatrix4(pointcloud.matrixWorld);
|
||||
var target = new THREE.Vector3(sg.center.x, camera.position.y, camera.position.z);
|
||||
controls.target.copy(target);
|
||||
}
|
||||
camera.zoomTo(node, 1);
|
||||
};
|
||||
|
||||
Potree.utils.rightView = function(camera, controls, pointcloud){
|
||||
Potree.utils.rightView = function(camera, node){
|
||||
camera.position.set(1, 0, 0);
|
||||
camera.rotation.set(0, Math.PI / 2, 0);
|
||||
camera.zoomTo(pointcloud, 1);
|
||||
|
||||
if(controls.target){
|
||||
var sg = pointcloud.boundingSphere.clone().applyMatrix4(pointcloud.matrixWorld);
|
||||
var target = new THREE.Vector3(sg.center.x, camera.position.y, camera.position.z);
|
||||
controls.target.copy(target);
|
||||
}
|
||||
camera.zoomTo(node, 1);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -5992,8 +6520,11 @@ Potree.TextSprite = function(text){
|
||||
var texture = new THREE.Texture();
|
||||
texture.minFilter = THREE.LinearFilter;
|
||||
texture.magFilter = THREE.LinearFilter;
|
||||
var spriteMaterial = new THREE.SpriteMaterial(
|
||||
{ map: texture, useScreenCoordinates: false} );
|
||||
var spriteMaterial = new THREE.SpriteMaterial( {
|
||||
map: texture,
|
||||
useScreenCoordinates: false,
|
||||
depthTest: false,
|
||||
depthWrite: false} );
|
||||
|
||||
this.material = spriteMaterial;
|
||||
this.sprite = new THREE.Sprite(spriteMaterial);
|
||||
@ -6208,7 +6739,7 @@ Potree.Measure = function(){
|
||||
scope.setPosition(index, I);
|
||||
}
|
||||
|
||||
//event.event.stopImmediatePropagation();
|
||||
event.event.stopImmediatePropagation();
|
||||
};
|
||||
|
||||
var dropEvent = function(event){
|
||||
@ -7018,6 +7549,13 @@ Potree.HeightProfile = function(){
|
||||
this.setWidth = function(width){
|
||||
this.width = width;
|
||||
|
||||
var event = {
|
||||
type: 'width_changed',
|
||||
profile: this,
|
||||
width: width
|
||||
};
|
||||
this.dispatchEvent(event);
|
||||
|
||||
this.update();
|
||||
};
|
||||
|
||||
@ -8204,6 +8742,10 @@ Potree.TransformationTool = function(scene, camera, renderer){
|
||||
this.rotationNode.visible = true;
|
||||
};
|
||||
|
||||
this.reset = function(){
|
||||
this.setTargets([]);
|
||||
};
|
||||
|
||||
this.buildTranslationNode();
|
||||
this.buildScaleNode();
|
||||
this.buildRotationNode();
|
||||
@ -8260,7 +8802,12 @@ Potree.Volume = function(args){
|
||||
boxFrameGeometry.vertices.push(new THREE.Vector3(-0.5, 0.5, -0.5));
|
||||
|
||||
this.dimension = new THREE.Vector3(1,1,1);
|
||||
var material = new THREE.MeshBasicMaterial( {color: 0x00ff00, transparent: true, opacity: 0.3} );
|
||||
var material = new THREE.MeshBasicMaterial( {
|
||||
color: 0x00ff00,
|
||||
transparent: true,
|
||||
opacity: 0.3,
|
||||
depthTest: true,
|
||||
depthWrite: true} );
|
||||
this.box = new THREE.Mesh( boxGeometry, material);
|
||||
this.box.geometry.computeBoundingBox();
|
||||
this.boundingBox = this.box.geometry.boundingBox;
|
||||
@ -8274,6 +8821,8 @@ Potree.Volume = function(args){
|
||||
this.label.setBorderColor({r:0, g:255, b:0, a:0.0});
|
||||
this.label.setBackgroundColor({r:0, g:255, b:0, a:0.0});
|
||||
this.label.material.depthTest = false;
|
||||
this.label.material.depthWrite = false;
|
||||
this.label.material.transparent = true;
|
||||
this.label.position.y -= 0.5;
|
||||
this.add(this.label);
|
||||
|
||||
@ -8304,6 +8853,7 @@ Potree.Volume = function(args){
|
||||
|
||||
this.update = function(){
|
||||
this.boundingBox = this.box.geometry.boundingBox;
|
||||
this.boundingSphere = this.boundingBox.getBoundingSphere();
|
||||
|
||||
if(this._clip){
|
||||
this.box.visible = false;
|
||||
@ -8360,7 +8910,7 @@ Object.defineProperty(Potree.Volume.prototype, "modifiable", {
|
||||
});
|
||||
|
||||
|
||||
Potree.VolumeTool = function(scene, camera, renderer){
|
||||
Potree.VolumeTool = function(scene, camera, renderer, transformationTool){
|
||||
|
||||
var scope = this;
|
||||
this.enabled = false;
|
||||
@ -8369,7 +8919,8 @@ Potree.VolumeTool = function(scene, camera, renderer){
|
||||
this.sceneVolume = new THREE.Scene();
|
||||
this.camera = camera;
|
||||
this.renderer = renderer;
|
||||
this.domElement = renderer.domElement;
|
||||
this.transformationTool = transformationTool;
|
||||
this.domElement = this.renderer.domElement;
|
||||
this.mouse = {x: 0, y: 0};
|
||||
|
||||
this.volumes = [];
|
||||
@ -8414,7 +8965,7 @@ Potree.VolumeTool = function(scene, camera, renderer){
|
||||
var I = getHoveredElement();
|
||||
|
||||
if(I && I.object.modifiable){
|
||||
transformationTool.setTargets([I.object]);
|
||||
scope.transformationTool.setTargets([I.object]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -8540,7 +9091,7 @@ Potree.VolumeTool = function(scene, camera, renderer){
|
||||
label.setText(msg);
|
||||
|
||||
var distance = scope.camera.position.distanceTo(label.getWorldPosition());
|
||||
var pr = projectedRadius(1, scope.camera.fov * Math.PI / 180, distance, renderer.domElement.clientHeight);
|
||||
var pr = projectedRadius(1, scope.camera.fov * Math.PI / 180, distance, scope.renderer.domElement.clientHeight);
|
||||
var scale = (70 / pr);
|
||||
label.scale.set(scale, scale, scale);
|
||||
}
|
||||
@ -8560,7 +9111,7 @@ Potree.VolumeTool = function(scene, camera, renderer){
|
||||
};
|
||||
|
||||
this.finishInsertion = function(){
|
||||
transformationTool.setTargets([this.activeVolume]);
|
||||
scope.transformationTool.setTargets([this.activeVolume]);
|
||||
|
||||
var event = {
|
||||
type: "insertion_finished",
|
||||
@ -8593,9 +9144,9 @@ Potree.VolumeTool = function(scene, camera, renderer){
|
||||
};
|
||||
|
||||
|
||||
this.render = function(){
|
||||
|
||||
renderer.render(this.sceneVolume, this.camera);
|
||||
this.render = function(target){
|
||||
|
||||
scope.renderer.render(this.sceneVolume, this.camera, target);
|
||||
|
||||
};
|
||||
|
||||
|
||||
12
build/js/potree.min.js
vendored
12
build/js/potree.min.js
vendored
File diff suppressed because one or more lines are too long
84
examples/annotations.html
Normal file
84
examples/annotations.html
Normal file
@ -0,0 +1,84 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title>Potree Viewer</title>
|
||||
<!--<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">-->
|
||||
<link rel="stylesheet" type="text/css" href="css/potree.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<script src="../libs/three.js/build/three.js"></script>
|
||||
<script src="../libs/other/stats.min.js"></script>
|
||||
<script src="../libs/other/dat.gui.min.js"></script>
|
||||
<script src="../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../libs/tween/tween.min.js"></script>
|
||||
|
||||
<script src="../build/js/potree.js"></script>
|
||||
<script src="./js/viewer.js"></script>
|
||||
<script src="./js/ProgressBar.js"></script>
|
||||
|
||||
<div id="renderArea" style="position: absolute; width: 100%; height: 100%; overflow: hidden;">
|
||||
|
||||
<!-- HEADING -->
|
||||
<div class="info" style="position: absolute; left: 300px; right: 300px; top: 10px; text-align: center;">
|
||||
<a href="http://potree.org" target="_blank">potree.org</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
var settings = {
|
||||
path: "../resources/pointclouds/lion_takanawa/cloud.js",
|
||||
cameraPosition: [4.55, 5.55, 5.32],
|
||||
cameraTarget: [0, 2, 0],
|
||||
sizeType: "Adaptive", // options: "Fixed", "Attenuated", "Adaptive"
|
||||
quality: "Squares", // options: "Squares", "Circles", "Interpolation", "Splats"
|
||||
fov: 50, // field of view in degree
|
||||
material: "RGB", // options: "RGB", "Height", "Intensity", "Classification"
|
||||
pointLimit: 1, // max number of points in millions
|
||||
navigation: "Orbit", // options: "Earth", "Orbit", "Flight"
|
||||
pointSize: 1,
|
||||
useEDL: true, // eye-dome-lighting, especially useful for point clouds without normals
|
||||
};
|
||||
|
||||
var onPointCloudLoaded = function(event){
|
||||
|
||||
viewer.addAnnotation(new THREE.Vector3(-0.14, 4.9, 0.25), {
|
||||
"cameraTarget": new THREE.Vector3(0, 2, 0),
|
||||
"cameraPosition": new THREE.Vector3(7.34, 3.24, 6.35)
|
||||
});
|
||||
|
||||
viewer.addAnnotation(new THREE.Vector3(-0.09, 4.13, 1.5), {
|
||||
"cameraTarget": new THREE.Vector3(-0.09, 3.9, 1),
|
||||
"cameraPosition": new THREE.Vector3(0.74, 4.23, 3)
|
||||
});
|
||||
|
||||
viewer.addAnnotation(new THREE.Vector3(0.46, 2.2, 1.07), {
|
||||
"cameraTarget": new THREE.Vector3(0.46, 2.2, 1.07),
|
||||
"cameraPosition": new THREE.Vector3(1.63, 3.27, 2.32)
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
viewer = new Potree.Viewer(document.getElementById("renderArea"), settings, {
|
||||
"onPointCloudLoaded": onPointCloudLoaded
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
#renderArea{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.info{
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title>Potree Viewer</title>
|
||||
<!--<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">-->
|
||||
<link rel="stylesheet" type="text/css" href="css/potree.css">
|
||||
</head>
|
||||
<body>
|
||||
@ -10,121 +11,208 @@
|
||||
<script src="../libs/other/stats.min.js"></script>
|
||||
<script src="../libs/other/dat.gui.min.js"></script>
|
||||
<script src="../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../libs/tween/tween.min.js"></script>
|
||||
|
||||
<script src="../build/js/potree.js"></script>
|
||||
<script src="./js/viewer.js"></script>
|
||||
<script src="./js/ProgressBar.js"></script>
|
||||
|
||||
<!-- uncomment this to debug changes to the individual js files -->
|
||||
|
||||
<script src="../src/PointCloudOctree.js"></script>
|
||||
<script src="../src/PointCloudOctreeGeometry.js"></script>
|
||||
<script src="../src/loader/POCLoader.js"></script>
|
||||
<script src="../src/loader/BinaryLoader.js"></script>
|
||||
<script src="../src/loader/LasLazLoader.js"></script>
|
||||
<script src="../src/materials/PointCloudMaterial.js"></script>
|
||||
<script src="../src/materials/EyeDomeLightingMaterial.js"></script>
|
||||
<script src="../src/EarthControls.js"></script>
|
||||
<script src="../src/OrbitControls.js"></script>
|
||||
<script src="../src/FirstPersonControls.js"></script>
|
||||
<script src="../src/utils/ProfileTool.js"></script>
|
||||
<script src="../src/utils/MeasuringTool.js"></script>
|
||||
<script src="../src/utils/TransformationTool.js"></script>
|
||||
<script src="../src/utils/VolumeTool.js"></script>
|
||||
<script src="../src/utils.js"></script>
|
||||
<script src="../src/LRU.js"></script>
|
||||
<script src="../src/Annotation.js"></script>
|
||||
<script src="../src/TextSprite.js"></script>
|
||||
<script src="../src/Features.js"></script>
|
||||
<script src="../src/extensions/PerspectiveCamera.js"></script>
|
||||
<script src="../src/arena4d/PointCloudArena4D.js"></script>
|
||||
<script src="../src/arena4d/PointCloudArena4DGeometry.js"></script>
|
||||
|
||||
<!-- INCLUDE ADDITIONAL DEPENDENCIES HERE -->
|
||||
<!-- INCLUDE SETTINGS HERE -->
|
||||
<!--<script src="../libs/plasio/js/laslaz.js"></script>
|
||||
<script src="../libs/plasio/js/laslaz.js"></script>
|
||||
<script src="../libs/plasio/vendor/bluebird.js"></script>
|
||||
<script src="../build/js/laslaz.js"></script>-->
|
||||
<script src="../build/js/laslaz.js"></script>
|
||||
|
||||
<!-- HEADING -->
|
||||
<div class="info" style="position: absolute; left: 300px; right: 300px; top: 10px; text-align: center;">
|
||||
<a href="http://potree.org" target="_blank">potree.org</a><br>
|
||||
Point cloud courtesy of <a href="http://www.sigeom.ch/" target="_blank">sigeom sa</a><br>
|
||||
<div id="renderArea" style="position: absolute; width: 100%; height: 100%; overflow: hidden;">
|
||||
|
||||
<!-- HEADING -->
|
||||
<div class="info" style="position: absolute; left: 300px; right: 300px; top: 10px; text-align: center;">
|
||||
<a href="http://potree.org" target="_blank">potree.org</a><br>
|
||||
Profile markers are Drag and Droppable. Holding ctrl while dragging modifies the profile width.
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- INFOS / STATS -->
|
||||
<div id="lblNumVisibleNodes" class="info" style="position: absolute; left: 10px; top: 80px; width: 400px; color:white"></div>
|
||||
<div id="lblNumVisiblePoints" class="info" style="position: absolute; left: 10px; top: 100px; width: 400px; color:white"></div>
|
||||
<div id="lblMessage" class="info" style="position: absolute; left: 10px; bottom: 0px; width: 400px; color:white"></div>
|
||||
|
||||
<div id="renderArea"></div>
|
||||
<canvas id="cHeightProfile" width="600" height="300"
|
||||
style="position: absolute; width: 600px; height: 300px; left: 10px; bottom: 10px; border: 1px solid black; pointer-events: none"></canvas>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
var sceneProperties = {
|
||||
path: "http://5.9.65.151/mschuetz/potree/resources/pointclouds/pix4d/matterhorn/cloud.js",
|
||||
path: "http://5.9.65.151/mschuetz/potree/test/cloud.js",
|
||||
// profile will be drawn into this canvas
|
||||
var canvas = document.getElementById("cHeightProfile"),
|
||||
context = canvas.getContext("2d");
|
||||
context.fillStyle = "#000000";
|
||||
context.fillRect(0, 0, 600, 300);
|
||||
|
||||
var settings = {
|
||||
path: "../resources/pointclouds/lion_takanawa/cloud.js",
|
||||
path: "http://localhost/temp/test/cloud.js",
|
||||
path: "http://5.9.65.151/mschuetz/potree/test/cloud.js",
|
||||
path: "../resources/pointclouds/vol_total/cloud.js",
|
||||
cameraPosition: null,
|
||||
cameraTarget: null,
|
||||
sizeType: "Fixed", // options: "Fixed", "Attenuated", "Adaptive"
|
||||
quality: "Squares", // options: "Squares", "Circles", "Interpolation", "Splats"
|
||||
fov: 75, // field of view in degree
|
||||
material: "RGB", // options: "RGB", "Height", "Intensity", "Classification"
|
||||
pointLimit: 1, // max number of points in millions
|
||||
navigation: "Orbit", // options: "Earth", "Orbit", "Flight"
|
||||
pointSize: 2,
|
||||
useEDL: false, // eye-dome-lighting, especially usefull for point clouds without normals
|
||||
sizeType: "Adaptive", // options: "Fixed", "Attenuated", "Adaptive"
|
||||
quality: "Squares", // options: "Squares", "Circles", "Interpolation", "Splats"
|
||||
fov: 75, // field of view in degree
|
||||
material: "RGB", // options: "RGB", "Height", "Intensity", "Classification"
|
||||
pointLimit: 1, // max number of points in millions
|
||||
navigation: "Orbit", // options: "Earth", "Orbit", "Flight"
|
||||
pointSize: 1,
|
||||
useEDL: true, // eye-dome-lighting, especially useful for point clouds without normals
|
||||
};
|
||||
</script>
|
||||
<script src="./js/viewer.js"></script>
|
||||
|
||||
<canvas id="cHeightProfile" width="300" height="300"
|
||||
style="position: absolute; width: 300px; height: 300px; left: 10px; bottom: 10px; border: 1px solid black; pointer-events: none"></canvas>
|
||||
|
||||
<script>
|
||||
|
||||
// create a profile with 3 markers / 2 segments
|
||||
var profile = new Potree.HeightProfile();
|
||||
profile.addMarker(new THREE.Vector3(-294, 59, 95));
|
||||
profile.addMarker(new THREE.Vector3(-179, 55, -1));
|
||||
profile.addMarker(new THREE.Vector3(-69,33,-39));
|
||||
profile.setWidth(3);
|
||||
profileTool.addProfile(profile);
|
||||
|
||||
// profile will be drawn into this canvas
|
||||
var canvas = document.getElementById("cHeightProfile"),
|
||||
context = canvas.getContext("2d");
|
||||
context.fillStyle = "#000000";
|
||||
context.fillRect(0, 0, 300, 300);
|
||||
|
||||
function update2DProfile(){
|
||||
|
||||
// clear canvas
|
||||
context.clearRect(0, 0, 300, 300);
|
||||
context.fillStyle = "#000000";
|
||||
context.fillRect(0, 0, 300, 300);
|
||||
|
||||
// set origin to bottom left
|
||||
context.setTransform(1, 0, 0, 1, 0, 0);
|
||||
context.translate(0, 300);
|
||||
context.scale(1, -1);
|
||||
|
||||
var result = pointcloud.getPointsInProfile(profile, 2);
|
||||
var segments = result.segments;
|
||||
|
||||
// iterate through all segments of the profile
|
||||
for(var i = 0; i < segments.length; i++){
|
||||
var segment = segments[i];
|
||||
|
||||
for(var j = 0; j < segment.points.numPoints; j++){
|
||||
var position = segment.points.position[j];
|
||||
position = segment.project(position);
|
||||
var color = segment.points.color[j];
|
||||
|
||||
var x = (position.x / result.projectedBoundingBox.max.x) * 300;
|
||||
var y = (position.y / result.projectedBoundingBox.max.x) * 300;
|
||||
|
||||
var r = parseInt(color[0]*255);
|
||||
var g = parseInt(color[1]*255);
|
||||
var b = parseInt(color[2]*255);
|
||||
|
||||
context.fillStyle = "rgb(" + r + ", " + g + " , " + b + " )";
|
||||
context.fillRect(x, y, 2, 2);
|
||||
}
|
||||
}
|
||||
|
||||
setTimeout(update2DProfile, 1000);
|
||||
}
|
||||
|
||||
// uncommenting this updates the profile view every time one of the markers moves
|
||||
//profile.addEventListener("marker_moved", function(event){
|
||||
// update2DProfile();
|
||||
//});
|
||||
|
||||
// update profile view every 1000ms
|
||||
setTimeout(update2DProfile, 1000);
|
||||
|
||||
|
||||
var latestRequest = null;
|
||||
var projectedBoundingBox = null;
|
||||
var toFrame = null;
|
||||
|
||||
var makeProfileRequest = function(){
|
||||
if(latestRequest){
|
||||
latestRequest.cancel();
|
||||
}
|
||||
|
||||
var canvas = document.getElementById("cHeightProfile");
|
||||
|
||||
projectedBoundingBox = null;
|
||||
toFrame = null;
|
||||
context.fillStyle = "#000000";
|
||||
context.fillRect(0, 0, canvas.width, canvas.height);
|
||||
|
||||
latestRequest = viewer.pointcloud.getPointsInProfile(viewer.profileTool.profiles[0], null, {
|
||||
"onProgress": function(event){
|
||||
|
||||
var request = event.request;
|
||||
var points = event.points;
|
||||
var segments = points.segments;
|
||||
|
||||
if(!projectedBoundingBox){
|
||||
projectedBoundingBox = points.projectedBoundingBox;
|
||||
|
||||
toFrame = function(x, y){
|
||||
var scale = ( 1 / projectedBoundingBox.size().x) * (canvas.width - 100);
|
||||
|
||||
return {
|
||||
x: 50 + (x * scale),
|
||||
y: canvas.height - (y - projectedBoundingBox.min.y) * scale - 35
|
||||
};
|
||||
};
|
||||
|
||||
context.fillStyle = "rgb(100, 100, 100)";
|
||||
context.fillRect(50, canvas.height - 15 - 250, 1, 250);
|
||||
context.fillRect(50, canvas.height - 35, 500, 1);
|
||||
|
||||
context.font="bold 1em Arial";
|
||||
context.fillText(projectedBoundingBox.min.y.toFixed(1), 10, canvas.height - 35);
|
||||
context.fillText(projectedBoundingBox.max.y.toFixed(1), 10, toFrame(0, projectedBoundingBox.max.y).y);
|
||||
|
||||
context.fillStyle = "rgb(255, 0, 0)";
|
||||
var mileage = 0;
|
||||
for(var i = 0; i < segments.length; i++){
|
||||
var segment = segments[i];
|
||||
context.fillRect(toFrame(mileage, 0).x, canvas.height - 35, 4,8);
|
||||
context.fillText(mileage.toFixed(1), toFrame(mileage, 0).x - 10, canvas.height - 10);
|
||||
|
||||
mileage += segment.length;
|
||||
}
|
||||
context.fillRect(toFrame(mileage, 0).x, canvas.height - 35, 4, 8);
|
||||
context.fillText(mileage.toFixed(1), toFrame(mileage, 0).x - 15, canvas.height - 10);
|
||||
}
|
||||
|
||||
// iterate through all segments of the profile
|
||||
for(var i = 0; i < segments.length; i++){
|
||||
var segment = segments[i];
|
||||
|
||||
for(var j = 0; j < segment.points.numPoints; j++){
|
||||
var position = segment.points.position[j];
|
||||
position = segment.project(position);
|
||||
position = toFrame(position.x, position.y);
|
||||
|
||||
var color = segment.points.color[j];
|
||||
|
||||
var r = parseInt(color[0]*255);
|
||||
var g = parseInt(color[1]*255);
|
||||
var b = parseInt(color[2]*255);
|
||||
|
||||
context.fillStyle = "rgb(" + r + ", " + g + " , " + b + " )";
|
||||
context.fillRect(position.x, position.y, 1,1);
|
||||
}
|
||||
}
|
||||
|
||||
// stop profile request after fetching a certain number of points
|
||||
if(request.pointsServed > 20000){
|
||||
request.cancel();
|
||||
}
|
||||
},
|
||||
"onCancel": function(){
|
||||
console.log("canceled");
|
||||
},
|
||||
"onFinish": function(event){
|
||||
|
||||
var request = event.request;
|
||||
|
||||
console.log("finished loading profile data!");
|
||||
console.log("pointsServed: " + request.pointsServed);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var onPointCloudLoaded = function(event){
|
||||
var profile = new Potree.HeightProfile();
|
||||
profile.addMarker(new THREE.Vector3( -235.29000091552734, 52.45999908452405, 90.1893768310547));
|
||||
profile.addMarker(new THREE.Vector3(-283.07999992370605, 54.68999862676038, 108.33937454223634));
|
||||
profile.addMarker(new THREE.Vector3(-297.9300000667572, 50.95999908452406, 64.04937744140626));
|
||||
profile.setWidth(4);
|
||||
|
||||
profile.addEventListener("marker_moved", makeProfileRequest);
|
||||
profile.addEventListener("width_changed", makeProfileRequest);
|
||||
|
||||
viewer.profileTool.addProfile(profile);
|
||||
|
||||
makeProfileRequest();
|
||||
};
|
||||
|
||||
viewer = new Potree.Viewer(document.getElementById("renderArea"), settings, {
|
||||
"onPointCloudLoaded": onPointCloudLoaded
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -2,6 +2,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title>Potree Viewer</title>
|
||||
<!--<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">-->
|
||||
<link rel="stylesheet" type="text/css" href="css/potree.css">
|
||||
</head>
|
||||
<body>
|
||||
@ -10,17 +11,19 @@
|
||||
<script src="../libs/other/stats.min.js"></script>
|
||||
<script src="../libs/other/dat.gui.min.js"></script>
|
||||
<script src="../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../libs/tween/tween.min.js"></script>
|
||||
|
||||
<script src="../build/js/potree.js"></script>
|
||||
<script src="./js/viewer.js"></script>
|
||||
<script src="./js/ProgressBar.js"></script>
|
||||
|
||||
|
||||
<!-- uncomment this to debug changes to the individual js files -->
|
||||
<!--
|
||||
|
||||
<script src="../src/PointCloudOctree.js"></script>
|
||||
<script src="../src/PointCloudOctreeGeometry.js"></script>
|
||||
<script src="../src/loader/POCLoader.js"></script>
|
||||
<script src="../src/loader/BinaryLoader.js"></script>
|
||||
<script src="../src/loader/LasLazLoader.js"></script>
|
||||
<script src="../src/materials/PointCloudMaterial.js"></script>
|
||||
<script src="../src/materials/EyeDomeLightingMaterial.js"></script>
|
||||
<script src="../src/EarthControls.js"></script>
|
||||
@ -32,65 +35,70 @@
|
||||
<script src="../src/utils/VolumeTool.js"></script>
|
||||
<script src="../src/utils.js"></script>
|
||||
<script src="../src/LRU.js"></script>
|
||||
<script src="../src/Annotation.js"></script>
|
||||
<script src="../src/TextSprite.js"></script>
|
||||
<script src="../src/Features.js"></script>
|
||||
<script src="../src/extensions/PerspectiveCamera.js"></script>
|
||||
<script src="../src/arena4d/PointCloudArena4D.js"></script>
|
||||
<script src="../src/arena4d/PointCloudArena4DGeometry.js"></script>
|
||||
-->
|
||||
|
||||
|
||||
|
||||
<!-- INCLUDE ADDITIONAL DEPENDENCIES HERE -->
|
||||
<!-- INCLUDE SETTINGS HERE -->
|
||||
<!--<script src="../libs/plasio/js/laslaz.js"></script>
|
||||
<script src="../libs/plasio/js/laslaz.js"></script>
|
||||
<script src="../libs/plasio/vendor/bluebird.js"></script>
|
||||
<script src="../build/js/laslaz.js"></script>
|
||||
-->
|
||||
|
||||
<!-- HEADING -->
|
||||
<div class="info" style="position: absolute; left: 300px; right: 300px; top: 10px; text-align: center;">
|
||||
<a href="http://potree.org" target="_blank">potree.org</a>
|
||||
</div>
|
||||
|
||||
<!-- INFOS / STATS -->
|
||||
<div id="lblNumVisibleNodes" class="info" style="position: absolute; left: 10px; top: 80px; width: 400px; color:white"></div>
|
||||
<div id="lblNumVisiblePoints" class="info" style="position: absolute; left: 10px; top: 100px; width: 400px; color:white"></div>
|
||||
<div id="lblMessage" class="info" style="position: absolute; left: 10px; bottom: 0px; width: 400px; color:white"></div>
|
||||
|
||||
<!-- TOOLS -->
|
||||
<div id="tools" style="position: fixed; width: 400px; bottom: 10px; right: 10px">
|
||||
<img src="../resources/icons/earth_controls_1.png" onclick="useEarthControls()" title="Earth Controls"/>
|
||||
<img src="../resources/icons/fps_controls.png" onclick="useFPSControls()" title="Fly Camera"/>
|
||||
<img src="../resources/icons/orbit_controls.png" onclick="useOrbitControls()" title="Orbit Controls"/>
|
||||
<img src="../resources/icons/focus.png" onclick="camera.zoomTo(pointcloud)" title="focus on pointcloud"/>
|
||||
<img src="../resources/icons/flip_y_z.png" onclick="flipYZ()" title="flip y and z coordinates"/>
|
||||
<img src="../resources/icons/angle.png" onclick="measuringTool.startInsertion({showDistances: false, showAngles: true, showArea: false, closed: true, maxMarkers: 3})" title="angle measurements"/>
|
||||
<img src="../resources/icons/distance.png" onclick="measuringTool.startInsertion({showDistances: true, showArea: false, closed: false})" title="distance measurements"/>
|
||||
<img src="../resources/icons/area.png" onclick="measuringTool.startInsertion({showDistances: true, showArea: true, closed: true})" title="area measurements"/>
|
||||
<img src="../resources/icons/volume.png" onclick="volumeTool.startInsertion()" title="volume measurements"/>
|
||||
<img src="../resources/icons/profile.png" onclick="profileTool.startInsertion({width: pointcloud.boundingSphere.radius / 100})" title="height profiles"/>
|
||||
<img src="../resources/icons/clip_volume.png" onclick="volumeTool.startInsertion({clip: true})" title="clipping volumes"/>
|
||||
</div>
|
||||
|
||||
<div id="renderArea"></div>
|
||||
|
||||
<script>
|
||||
<div id="renderArea" style="position: absolute; width: 100%; height: 100%; overflow: hidden;">
|
||||
|
||||
<!-- HEADING -->
|
||||
<div class="info" style="position: absolute; left: 300px; right: 300px; top: 10px; text-align: center;">
|
||||
<a href="http://potree.org" target="_blank">potree.org</a>
|
||||
</div>
|
||||
|
||||
var sceneProperties = {
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
var settings = {
|
||||
path: "../resources/pointclouds/lion_takanawa/cloud.js",
|
||||
cameraPosition: null,
|
||||
cameraTarget: null,
|
||||
sizeType: "Adaptive", // options: "Fixed", "Attenuated", "Adaptive"
|
||||
quality: "Interpolation", // options: "Squares", "Circles", "Interpolation", "Splats"
|
||||
fov: 75, // field of view in degree
|
||||
material: "RGB", // options: "RGB", "Height", "Intensity", "Classification"
|
||||
pointLimit: 1, // max number of points in millions
|
||||
navigation: "Orbit", // options: "Earth", "Orbit", "Flight"
|
||||
pointSize: 1.2,
|
||||
useEDL: false, // eye-dome-lighting, especially usefull for point clouds without normals
|
||||
sizeType: "Adaptive", // options: "Fixed", "Attenuated", "Adaptive"
|
||||
quality: "Squares", // options: "Squares", "Circles", "Interpolation", "Splats"
|
||||
fov: 75, // field of view in degree
|
||||
material: "RGB", // options: "RGB", "Height", "Intensity", "Classification"
|
||||
pointLimit: 1, // max number of points in millions
|
||||
navigation: "Orbit", // options: "Earth", "Orbit", "Flight"
|
||||
pointSize: 1,
|
||||
useEDL: true, // eye-dome-lighting, especially useful for point clouds without normals
|
||||
};
|
||||
|
||||
var onPointCloudLoaded = function(event){
|
||||
// do stuff here that should be executed once the point cloud has been loaded.
|
||||
// event.pointcloud returns the point cloud object
|
||||
|
||||
};
|
||||
|
||||
viewer = new Potree.Viewer(document.getElementById("renderArea"), settings, {
|
||||
"onPointCloudLoaded": onPointCloudLoaded
|
||||
});
|
||||
|
||||
</script>
|
||||
<script src="./js/viewer.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title>Potree Viewer</title>
|
||||
<!--<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">-->
|
||||
<link rel="stylesheet" type="text/css" href="css/potree.css">
|
||||
</head>
|
||||
<body>
|
||||
@ -10,17 +11,19 @@
|
||||
<script src="../libs/other/stats.min.js"></script>
|
||||
<script src="../libs/other/dat.gui.min.js"></script>
|
||||
<script src="../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../libs/tween/tween.min.js"></script>
|
||||
|
||||
<script src="../build/js/potree.js"></script>
|
||||
<script src="./js/viewer.js"></script>
|
||||
<script src="./js/ProgressBar.js"></script>
|
||||
|
||||
|
||||
<!-- uncomment this to debug changes to the individual js files -->
|
||||
<!--
|
||||
|
||||
<script src="../src/PointCloudOctree.js"></script>
|
||||
<script src="../src/PointCloudOctreeGeometry.js"></script>
|
||||
<script src="../src/loader/POCLoader.js"></script>
|
||||
<script src="../src/loader/BinaryLoader.js"></script>
|
||||
<script src="../src/loader/LasLazLoader.js"></script>
|
||||
<script src="../src/materials/PointCloudMaterial.js"></script>
|
||||
<script src="../src/materials/EyeDomeLightingMaterial.js"></script>
|
||||
<script src="../src/EarthControls.js"></script>
|
||||
@ -32,13 +35,12 @@
|
||||
<script src="../src/utils/VolumeTool.js"></script>
|
||||
<script src="../src/utils.js"></script>
|
||||
<script src="../src/LRU.js"></script>
|
||||
<script src="../src/Annotation.js"></script>
|
||||
<script src="../src/TextSprite.js"></script>
|
||||
<script src="../src/Features.js"></script>
|
||||
<script src="../src/extensions/PerspectiveCamera.js"></script>
|
||||
<script src="../src/arena4d/PointCloudArena4D.js"></script>
|
||||
<script src="../src/arena4d/PointCloudArena4DGeometry.js"></script>
|
||||
-->
|
||||
|
||||
|
||||
|
||||
<!-- INCLUDE ADDITIONAL DEPENDENCIES HERE -->
|
||||
<!-- INCLUDE SETTINGS HERE -->
|
||||
@ -46,51 +48,57 @@
|
||||
<script src="../libs/plasio/vendor/bluebird.js"></script>
|
||||
<script src="../build/js/laslaz.js"></script>
|
||||
|
||||
|
||||
<!-- HEADING -->
|
||||
<div class="info" style="position: absolute; left: 300px; right: 300px; top: 10px; text-align: center;">
|
||||
<a href="http://potree.org" target="_blank">potree.org</a>
|
||||
</div>
|
||||
|
||||
<!-- INFOS / STATS -->
|
||||
<div id="lblNumVisibleNodes" class="info" style="position: absolute; left: 10px; top: 80px; width: 400px; color:white"></div>
|
||||
<div id="lblNumVisiblePoints" class="info" style="position: absolute; left: 10px; top: 100px; width: 400px; color:white"></div>
|
||||
<div id="lblMessage" class="info" style="position: absolute; left: 10px; bottom: 0px; width: 400px; color:white"></div>
|
||||
|
||||
<!-- TOOLS -->
|
||||
<div id="tools" style="position: fixed; width: 400px; bottom: 10px; right: 10px">
|
||||
<img src="../resources/icons/earth_controls_1.png" onclick="useEarthControls()" title="Earth Controls"/>
|
||||
<img src="../resources/icons/fps_controls.png" onclick="useFPSControls()" title="Fly Camera"/>
|
||||
<img src="../resources/icons/orbit_controls.png" onclick="useOrbitControls()" title="Orbit Controls"/>
|
||||
<img src="../resources/icons/focus.png" onclick="camera.zoomTo(pointcloud)" title="focus on pointcloud"/>
|
||||
<img src="../resources/icons/flip_y_z.png" onclick="flipYZ()" title="flip y and z coordinates"/>
|
||||
<img src="../resources/icons/angle.png" onclick="measuringTool.startInsertion({showDistances: false, showAngles: true, showArea: false, closed: true, maxMarkers: 3})" title="angle measurements"/>
|
||||
<img src="../resources/icons/distance.png" onclick="measuringTool.startInsertion({showDistances: true, showArea: false, closed: false})" title="distance measurements"/>
|
||||
<img src="../resources/icons/area.png" onclick="measuringTool.startInsertion({showDistances: true, showArea: true, closed: true})" title="area measurements"/>
|
||||
<img src="../resources/icons/volume.png" onclick="volumeTool.startInsertion()" title="volume measurements"/>
|
||||
<img src="../resources/icons/profile.png" onclick="profileTool.startInsertion({width: pointcloud.boundingSphere.radius / 100})" title="height profiles"/>
|
||||
<img src="../resources/icons/clip_volume.png" onclick="volumeTool.startInsertion({clip: true})" title="clipping volumes"/>
|
||||
</div>
|
||||
|
||||
<div id="renderArea"></div>
|
||||
|
||||
<script>
|
||||
<div id="renderArea" style="position: absolute; width: 100%; height: 100%; overflow: hidden;">
|
||||
|
||||
<!-- HEADING -->
|
||||
<div class="info" style="position: absolute; left: 300px; right: 300px; top: 10px; text-align: center;">
|
||||
<a href="http://potree.org" target="_blank">potree.org</a>
|
||||
</div>
|
||||
|
||||
var sceneProperties = {
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
var settings = {
|
||||
path: "../resources/pointclouds/lion_takanawa_las/cloud.js",
|
||||
cameraPosition: null,
|
||||
cameraTarget: null,
|
||||
sizeType: "Adaptive", // options: "Fixed", "Attenuated", "Adaptive"
|
||||
quality: "Interpolation", // options: "Squares", "Circles", "Interpolation", "Splats"
|
||||
fov: 75, // field of view in degree
|
||||
material: "RGB", // options: "RGB", "Height", "Intensity", "Classification"
|
||||
pointLimit: 1, // max number of points in millions
|
||||
navigation: "Orbit", // options: "Earth", "Orbit", "Flight"
|
||||
pointSize: 1.2,
|
||||
useEDL: false, // eye-dome-lighting, especially usefull for point clouds without normals
|
||||
sizeType: "Adaptive", // options: "Fixed", "Attenuated", "Adaptive"
|
||||
quality: "Squares", // options: "Squares", "Circles", "Interpolation", "Splats"
|
||||
fov: 75, // field of view in degree
|
||||
material: "RGB", // options: "RGB", "Height", "Intensity", "Classification"
|
||||
pointLimit: 1, // max number of points in millions
|
||||
navigation: "Orbit", // options: "Earth", "Orbit", "Flight"
|
||||
pointSize: 1,
|
||||
useEDL: true, // eye-dome-lighting, especially useful for point clouds without normals
|
||||
};
|
||||
|
||||
var onPointCloudLoaded = function(event){
|
||||
// do stuff here that should be executed once the point cloud has been loaded.
|
||||
// event.pointcloud returns the point cloud object
|
||||
|
||||
};
|
||||
|
||||
viewer = new Potree.Viewer(document.getElementById("renderArea"), settings, {
|
||||
"onPointCloudLoaded": onPointCloudLoaded
|
||||
});
|
||||
|
||||
</script>
|
||||
<script src="./js/viewer.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title>Potree Viewer</title>
|
||||
<!--<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">-->
|
||||
<link rel="stylesheet" type="text/css" href="css/potree.css">
|
||||
</head>
|
||||
<body>
|
||||
@ -10,17 +11,19 @@
|
||||
<script src="../libs/other/stats.min.js"></script>
|
||||
<script src="../libs/other/dat.gui.min.js"></script>
|
||||
<script src="../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../libs/tween/tween.min.js"></script>
|
||||
|
||||
<script src="../build/js/potree.js"></script>
|
||||
<script src="./js/viewer.js"></script>
|
||||
<script src="./js/ProgressBar.js"></script>
|
||||
|
||||
|
||||
<!-- uncomment this to debug changes to the individual js files -->
|
||||
<!--
|
||||
|
||||
<script src="../src/PointCloudOctree.js"></script>
|
||||
<script src="../src/PointCloudOctreeGeometry.js"></script>
|
||||
<script src="../src/loader/POCLoader.js"></script>
|
||||
<script src="../src/loader/BinaryLoader.js"></script>
|
||||
<script src="../src/loader/LasLazLoader.js"></script>
|
||||
<script src="../src/materials/PointCloudMaterial.js"></script>
|
||||
<script src="../src/materials/EyeDomeLightingMaterial.js"></script>
|
||||
<script src="../src/EarthControls.js"></script>
|
||||
@ -32,13 +35,12 @@
|
||||
<script src="../src/utils/VolumeTool.js"></script>
|
||||
<script src="../src/utils.js"></script>
|
||||
<script src="../src/LRU.js"></script>
|
||||
<script src="../src/Annotation.js"></script>
|
||||
<script src="../src/TextSprite.js"></script>
|
||||
<script src="../src/Features.js"></script>
|
||||
<script src="../src/extensions/PerspectiveCamera.js"></script>
|
||||
<script src="../src/arena4d/PointCloudArena4D.js"></script>
|
||||
<script src="../src/arena4d/PointCloudArena4DGeometry.js"></script>
|
||||
-->
|
||||
|
||||
|
||||
|
||||
<!-- INCLUDE ADDITIONAL DEPENDENCIES HERE -->
|
||||
<!-- INCLUDE SETTINGS HERE -->
|
||||
@ -46,51 +48,57 @@
|
||||
<script src="../libs/plasio/vendor/bluebird.js"></script>
|
||||
<script src="../build/js/laslaz.js"></script>
|
||||
|
||||
|
||||
<!-- HEADING -->
|
||||
<div class="info" style="position: absolute; left: 300px; right: 300px; top: 10px; text-align: center;">
|
||||
<a href="http://potree.org" target="_blank">potree.org</a>
|
||||
</div>
|
||||
|
||||
<!-- INFOS / STATS -->
|
||||
<div id="lblNumVisibleNodes" class="info" style="position: absolute; left: 10px; top: 80px; width: 400px; color:white"></div>
|
||||
<div id="lblNumVisiblePoints" class="info" style="position: absolute; left: 10px; top: 100px; width: 400px; color:white"></div>
|
||||
<div id="lblMessage" class="info" style="position: absolute; left: 10px; bottom: 0px; width: 400px; color:white"></div>
|
||||
|
||||
<!-- TOOLS -->
|
||||
<div id="tools" style="position: fixed; width: 400px; bottom: 10px; right: 10px">
|
||||
<img src="../resources/icons/earth_controls_1.png" onclick="useEarthControls()" title="Earth Controls"/>
|
||||
<img src="../resources/icons/fps_controls.png" onclick="useFPSControls()" title="Fly Camera"/>
|
||||
<img src="../resources/icons/orbit_controls.png" onclick="useOrbitControls()" title="Orbit Controls"/>
|
||||
<img src="../resources/icons/focus.png" onclick="camera.zoomTo(pointcloud)" title="focus on pointcloud"/>
|
||||
<img src="../resources/icons/flip_y_z.png" onclick="flipYZ()" title="flip y and z coordinates"/>
|
||||
<img src="../resources/icons/angle.png" onclick="measuringTool.startInsertion({showDistances: false, showAngles: true, showArea: false, closed: true, maxMarkers: 3})" title="angle measurements"/>
|
||||
<img src="../resources/icons/distance.png" onclick="measuringTool.startInsertion({showDistances: true, showArea: false, closed: false})" title="distance measurements"/>
|
||||
<img src="../resources/icons/area.png" onclick="measuringTool.startInsertion({showDistances: true, showArea: true, closed: true})" title="area measurements"/>
|
||||
<img src="../resources/icons/volume.png" onclick="volumeTool.startInsertion()" title="volume measurements"/>
|
||||
<img src="../resources/icons/profile.png" onclick="profileTool.startInsertion({width: pointcloud.boundingSphere.radius / 100})" title="height profiles"/>
|
||||
<img src="../resources/icons/clip_volume.png" onclick="volumeTool.startInsertion({clip: true})" title="clipping volumes"/>
|
||||
</div>
|
||||
|
||||
<div id="renderArea"></div>
|
||||
|
||||
<script>
|
||||
<div id="renderArea" style="position: absolute; width: 100%; height: 100%; overflow: hidden;">
|
||||
|
||||
<!-- HEADING -->
|
||||
<div class="info" style="position: absolute; left: 300px; right: 300px; top: 10px; text-align: center;">
|
||||
<a href="http://potree.org" target="_blank">potree.org</a>
|
||||
</div>
|
||||
|
||||
var sceneProperties = {
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
var settings = {
|
||||
path: "../resources/pointclouds/lion_takanawa_laz/cloud.js",
|
||||
cameraPosition: null,
|
||||
cameraTarget: null,
|
||||
sizeType: "Adaptive", // options: "Fixed", "Attenuated", "Adaptive"
|
||||
quality: "Interpolation", // options: "Squares", "Circles", "Interpolation", "Splats"
|
||||
fov: 75, // field of view in degree
|
||||
material: "RGB", // options: "RGB", "Height", "Intensity", "Classification"
|
||||
pointLimit: 1, // max number of points in millions
|
||||
navigation: "Orbit", // options: "Earth", "Orbit", "Flight"
|
||||
pointSize: 1.2,
|
||||
useEDL: false, // eye-dome-lighting, especially usefull for point clouds without normals
|
||||
sizeType: "Adaptive", // options: "Fixed", "Attenuated", "Adaptive"
|
||||
quality: "Squares", // options: "Squares", "Circles", "Interpolation", "Splats"
|
||||
fov: 75, // field of view in degree
|
||||
material: "RGB", // options: "RGB", "Height", "Intensity", "Classification"
|
||||
pointLimit: 1, // max number of points in millions
|
||||
navigation: "Orbit", // options: "Earth", "Orbit", "Flight"
|
||||
pointSize: 1,
|
||||
useEDL: true, // eye-dome-lighting, especially useful for point clouds without normals
|
||||
};
|
||||
|
||||
var onPointCloudLoaded = function(event){
|
||||
// do stuff here that should be executed once the point cloud has been loaded.
|
||||
// event.pointcloud returns the point cloud object
|
||||
|
||||
};
|
||||
|
||||
viewer = new Potree.Viewer(document.getElementById("renderArea"), settings, {
|
||||
"onPointCloudLoaded": onPointCloudLoaded
|
||||
});
|
||||
|
||||
</script>
|
||||
<script src="./js/viewer.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title>Potree Viewer</title>
|
||||
<!--<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">-->
|
||||
<link rel="stylesheet" type="text/css" href="css/potree.css">
|
||||
</head>
|
||||
<body>
|
||||
@ -10,95 +11,114 @@
|
||||
<script src="../libs/other/stats.min.js"></script>
|
||||
<script src="../libs/other/dat.gui.min.js"></script>
|
||||
<script src="../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../libs/tween/tween.min.js"></script>
|
||||
|
||||
<script src="../build/js/potree.js"></script>
|
||||
<script src="./js/viewer.js"></script>
|
||||
<script src="./js/ProgressBar.js"></script>
|
||||
|
||||
<!-- uncomment this to debug changes to the individual js files -->
|
||||
<!--
|
||||
<script src="../src/PointCloudOctree.js"></script>
|
||||
<script src="../src/PointCloudOctreeGeometry.js"></script>
|
||||
<script src="../src/loader/POCLoader.js"></script>
|
||||
<script src="../src/loader/BinaryLoader.js"></script>
|
||||
<script src="../src/loader/LasLazLoader.js"></script>
|
||||
<script src="../src/materials/PointCloudMaterial.js"></script>
|
||||
<script src="../src/materials/EyeDomeLightingMaterial.js"></script>
|
||||
<script src="../src/EarthControls.js"></script>
|
||||
<script src="../src/OrbitControls.js"></script>
|
||||
<script src="../src/FirstPersonControls.js"></script>
|
||||
<script src="../src/utils/ProfileTool.js"></script>
|
||||
<script src="../src/utils/MeasuringTool.js"></script>
|
||||
<script src="../src/utils/TransformationTool.js"></script>
|
||||
<script src="../src/utils/VolumeTool.js"></script>
|
||||
<script src="../src/utils.js"></script>
|
||||
<script src="../src/LRU.js"></script>
|
||||
<script src="../src/Annotation.js"></script>
|
||||
<script src="../src/TextSprite.js"></script>
|
||||
<script src="../src/Features.js"></script>
|
||||
<script src="../src/extensions/PerspectiveCamera.js"></script>
|
||||
<script src="../src/arena4d/PointCloudArena4D.js"></script>
|
||||
<script src="../src/arena4d/PointCloudArena4DGeometry.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>
|
||||
<script src="../build/js/laslaz.js"></script>-->
|
||||
|
||||
<!-- HEADING -->
|
||||
<div class="info" style="position: absolute; left: 300px; right: 300px; top: 10px; text-align: center;">
|
||||
<a href="http://potree.org" target="_blank">potree.org</a><br>
|
||||
Point cloud courtesy of <a href="http://www.sigeom.ch/" target="_blank">sigeom sa</a><br>
|
||||
</div>
|
||||
|
||||
<!-- INFOS / STATS -->
|
||||
<div id="lblNumVisibleNodes" class="info" style="position: absolute; left: 10px; top: 80px; width: 400px; color:white"></div>
|
||||
<div id="lblNumVisiblePoints" class="info" style="position: absolute; left: 10px; top: 100px; width: 400px; color:white"></div>
|
||||
<div id="lblMessage" class="info" style="position: absolute; left: 10px; bottom: 0px; width: 400px; color:white"></div>
|
||||
|
||||
<div id="renderArea"></div>
|
||||
|
||||
<!-- TOOLS -->
|
||||
<div id="tools" style="position: fixed; width: 400px; bottom: 10px; right: 10px">
|
||||
<img src="../resources/icons/earth_controls_1.png" onclick="useEarthControls()" title="Earth Controls"/>
|
||||
<img src="../resources/icons/fps_controls.png" onclick="useFPSControls()" title="Fly Camera"/>
|
||||
<img src="../resources/icons/orbit_controls.png" onclick="useOrbitControls()" title="Orbit Controls"/>
|
||||
<img src="../resources/icons/focus.png" onclick="camera.zoomTo(pointcloud)" title="focus on pointcloud"/>
|
||||
<img src="../resources/icons/flip_y_z.png" onclick="flipYZ()" title="flip y and z coordinates"/>
|
||||
<img src="../resources/icons/angle.png" onclick="measuringTool.startInsertion({showDistances: false, showAngles: true, showArea: false, closed: true, maxMarkers: 3})" title="angle measurements"/>
|
||||
<img src="../resources/icons/distance.png" onclick="measuringTool.startInsertion({showDistances: true, showArea: false, closed: false})" title="distance measurements"/>
|
||||
<img src="../resources/icons/area.png" onclick="measuringTool.startInsertion({showDistances: true, showArea: true, closed: true})" title="area measurements"/>
|
||||
<img src="../resources/icons/volume.png" onclick="volumeTool.startInsertion()" title="volume measurements"/>
|
||||
<img src="../resources/icons/profile.png" onclick="profileTool.startInsertion({width: pointcloud.boundingSphere.radius / 100})" title="height profiles"/>
|
||||
<img src="../resources/icons/clip_volume.png" onclick="volumeTool.startInsertion({clip: true})" title="clipping volumes"/>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<div id="renderArea" style="position: absolute; width: 100%; height: 100%; overflow: hidden;">
|
||||
|
||||
<!-- HEADING -->
|
||||
<div class="info" style="position: absolute; left: 300px; right: 300px; top: 10px; text-align: center;">
|
||||
<a href="http://potree.org" target="_blank">potree.org</a><br>
|
||||
Point cloud courtesy of <a href="http://www.sigeom.ch/" target="_blank">sigeom sa</a><br>
|
||||
</div>
|
||||
|
||||
var sceneProperties = {
|
||||
path: "http://5.9.65.151/mschuetz/potree/resources/pointclouds/pix4d/matterhorn/cloud.js",
|
||||
path: "http://5.9.65.151/mschuetz/potree/test/cloud.js",
|
||||
path: "../resources/pointclouds/lion_takanawa/cloud.js",
|
||||
path: "http://localhost/temp/test/cloud.js",
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
var settings = {
|
||||
path: "../resources/pointclouds/vol_total/cloud.js",
|
||||
cameraPosition: null,
|
||||
cameraTarget: null,
|
||||
sizeType: "Fixed", // options: "Fixed", "Attenuated", "Adaptive"
|
||||
quality: "Squares", // options: "Squares", "Circles", "Interpolation", "Splats"
|
||||
fov: 75, // field of view in degree
|
||||
material: "RGB", // options: "RGB", "Height", "Intensity", "Classification"
|
||||
pointLimit: 1, // max number of points in millions
|
||||
navigation: "Orbit", // options: "Earth", "Orbit", "Flight"
|
||||
pointSize: 2,
|
||||
useEDL: false, // eye-dome-lighting, especially usefull for point clouds without normals
|
||||
sizeType: "Adaptive", // options: "Fixed", "Attenuated", "Adaptive"
|
||||
quality: "Squares", // options: "Squares", "Circles", "Interpolation", "Splats"
|
||||
fov: 75, // field of view in degree
|
||||
material: "RGB", // options: "RGB", "Height", "Intensity", "Classification"
|
||||
pointLimit: 1, // max number of points in millions
|
||||
navigation: "Orbit", // options: "Earth", "Orbit", "Flight"
|
||||
pointSize: 1,
|
||||
useEDL: true, // eye-dome-lighting, especially useful for point clouds without normals
|
||||
};
|
||||
|
||||
var onPointCloudLoaded = function(event){
|
||||
var distanceMeasurement = new Potree.Measure();
|
||||
distanceMeasurement.addMarker(new THREE.Vector3(-294, 59, 95));
|
||||
distanceMeasurement.addMarker(new THREE.Vector3(-179, 55, -1));
|
||||
distanceMeasurement.addMarker(new THREE.Vector3(-69,33,-39));
|
||||
distanceMeasurement.showDistances = true;
|
||||
distanceMeasurement.showArea = false;
|
||||
distanceMeasurement.showAngles = false;
|
||||
distanceMeasurement.closed = false;
|
||||
viewer.measuringTool.addMeasurement(distanceMeasurement);
|
||||
|
||||
|
||||
var areaMeasurement = new Potree.Measure();
|
||||
areaMeasurement.addMarker(new THREE.Vector3(108.04, 6.46, -36.70));
|
||||
areaMeasurement.addMarker(new THREE.Vector3(58.27, 17.01, 72.32 ));
|
||||
areaMeasurement.addMarker(new THREE.Vector3(67.35, 18.50, 95.41 ));
|
||||
areaMeasurement.addMarker(new THREE.Vector3(92.06, 20.68, 97.29 ));
|
||||
areaMeasurement.addMarker(new THREE.Vector3(186.39, 17.83, 8.16 ));
|
||||
areaMeasurement.showDistances = true;
|
||||
areaMeasurement.showArea = true;
|
||||
areaMeasurement.showAngles = false;
|
||||
areaMeasurement.closed = true;
|
||||
viewer.measuringTool.addMeasurement(areaMeasurement);
|
||||
|
||||
};
|
||||
|
||||
viewer = new Potree.Viewer(document.getElementById("renderArea"), settings, {
|
||||
"onPointCloudLoaded": onPointCloudLoaded
|
||||
});
|
||||
|
||||
</script>
|
||||
<script src="./js/viewer.js"></script>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
var distanceMeasurement = new Potree.Measure();
|
||||
distanceMeasurement.addMarker(new THREE.Vector3(-294, 59, 95));
|
||||
distanceMeasurement.addMarker(new THREE.Vector3(-179, 55, -1));
|
||||
distanceMeasurement.addMarker(new THREE.Vector3(-69,33,-39));
|
||||
distanceMeasurement.showDistances = true;
|
||||
distanceMeasurement.showArea = false;
|
||||
distanceMeasurement.showAngles = false;
|
||||
distanceMeasurement.closed = false;
|
||||
measuringTool.addMeasurement(distanceMeasurement);
|
||||
|
||||
|
||||
var areaMeasurement = new Potree.Measure();
|
||||
areaMeasurement.addMarker(new THREE.Vector3(108.04, 6.46, -36.70));
|
||||
areaMeasurement.addMarker(new THREE.Vector3(58.27, 17.01, 72.32 ));
|
||||
areaMeasurement.addMarker(new THREE.Vector3(67.35, 18.50, 95.41 ));
|
||||
areaMeasurement.addMarker(new THREE.Vector3(92.06, 20.68, 97.29 ));
|
||||
areaMeasurement.addMarker(new THREE.Vector3(186.39, 17.83, 8.16 ));
|
||||
areaMeasurement.showDistances = true;
|
||||
areaMeasurement.showArea = true;
|
||||
areaMeasurement.showAngles = false;
|
||||
areaMeasurement.closed = true;
|
||||
measuringTool.addMeasurement(areaMeasurement);
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -11,12 +11,14 @@
|
||||
<script src="../libs/other/stats.min.js"></script>
|
||||
<script src="../libs/other/dat.gui.min.js"></script>
|
||||
<script src="../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../libs/tween/tween.min.js"></script>
|
||||
|
||||
<script src="../build/js/potree.js"></script>
|
||||
<script src="./js/viewer.js"></script>
|
||||
<script src="./js/ProgressBar.js"></script>
|
||||
|
||||
<!-- uncomment this to debug changes to the individual js files -->
|
||||
|
||||
<!--
|
||||
<script src="../src/PointCloudOctree.js"></script>
|
||||
<script src="../src/PointCloudOctreeGeometry.js"></script>
|
||||
<script src="../src/loader/POCLoader.js"></script>
|
||||
@ -33,69 +35,74 @@
|
||||
<script src="../src/utils/VolumeTool.js"></script>
|
||||
<script src="../src/utils.js"></script>
|
||||
<script src="../src/LRU.js"></script>
|
||||
<script src="../src/Annotation.js"></script>
|
||||
<script src="../src/TextSprite.js"></script>
|
||||
<script src="../src/Features.js"></script>
|
||||
<script src="../src/extensions/PerspectiveCamera.js"></script>
|
||||
<script src="../src/arena4d/PointCloudArena4D.js"></script>
|
||||
<script src="../src/arena4d/PointCloudArena4DGeometry.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>
|
||||
<script src="../build/js/laslaz.js"></script>
|
||||
-->
|
||||
<script src="../build/js/laslaz.js"></script>-->
|
||||
|
||||
<!-- HEADING -->
|
||||
<div class="info" style="position: absolute; left: 300px; right: 300px; top: 10px; text-align: center;">
|
||||
<a href="http://potree.org" target="_blank">potree.org</a><br>
|
||||
Point cloud courtesy of <a href="http://www.sigeom.ch/" target="_blank">sigeom sa</a><br>
|
||||
</div>
|
||||
|
||||
<!-- INFOS / STATS -->
|
||||
<div id="lblNumVisibleNodes" class="info" style="position: absolute; left: 10px; top: 80px; width: 400px; color:white"></div>
|
||||
<div id="lblNumVisiblePoints" class="info" style="position: absolute; left: 10px; top: 100px; width: 400px; color:white"></div>
|
||||
<div id="lblMessage" class="info" style="position: absolute; left: 10px; bottom: 0px; width: 400px; color:white"></div>
|
||||
|
||||
<!-- TOOLS -->
|
||||
<div id="tools" style="position: fixed; width: 400px; bottom: 10px; right: 10px">
|
||||
<img src="../resources/icons/earth_controls_1.png" onclick="useEarthControls()" title="Earth Controls"/>
|
||||
<img src="../resources/icons/fps_controls.png" onclick="useFPSControls()" title="Fly Camera"/>
|
||||
<img src="../resources/icons/orbit_controls.png" onclick="useOrbitControls()" title="Orbit Controls"/>
|
||||
<img src="../resources/icons/focus.png" onclick="camera.zoomTo(pointcloud)" title="focus on pointcloud"/>
|
||||
<img src="../resources/icons/flip_y_z.png" onclick="flipYZ()" title="flip y and z coordinates"/>
|
||||
<img src="../resources/icons/angle.png" onclick="measuringTool.startInsertion({showDistances: false, showAngles: true, showArea: false, closed: true, maxMarkers: 3})" title="angle measurements"/>
|
||||
<img src="../resources/icons/distance.png" onclick="measuringTool.startInsertion({showDistances: true, showArea: false, closed: false})" title="distance measurements"/>
|
||||
<img src="../resources/icons/area.png" onclick="measuringTool.startInsertion({showDistances: true, showArea: true, closed: true})" title="area measurements"/>
|
||||
<img src="../resources/icons/volume.png" onclick="volumeTool.startInsertion()" title="volume measurements"/>
|
||||
<img src="../resources/icons/profile.png" onclick="profileTool.startInsertion({width: pointcloud.boundingSphere.radius / 100})" title="height profiles"/>
|
||||
<img src="../resources/icons/clip_volume.png" onclick="volumeTool.startInsertion({clip: true})" title="clipping volumes"/>
|
||||
</div>
|
||||
|
||||
<div id="renderArea"></div>
|
||||
|
||||
<script>
|
||||
<div id="renderArea" style="position: absolute; width: 100%; height: 100%; overflow: hidden;">
|
||||
|
||||
<!-- HEADING -->
|
||||
<div class="info" style="position: absolute; left: 300px; right: 300px; top: 10px; text-align: center;">
|
||||
<a href="http://potree.org" target="_blank">potree.org</a><br>
|
||||
Point cloud courtesy of <a href="http://www.sigeom.ch/" target="_blank">sigeom sa</a><br>
|
||||
</div>
|
||||
|
||||
var sceneProperties = {
|
||||
path: "http://5.9.65.151/mschuetz/potree/resources/pointclouds/pix4d/matterhorn/cloud.js",
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
var settings = {
|
||||
path: "../resources/pointclouds/lion_takanawa/cloud.js",
|
||||
path: "http://5.9.65.151/mschuetz/potree/resources/pointclouds/vermessung_zh_ch/zuerich/cloud.js",
|
||||
path: "http://localhost/dev/pointclouds/opentopography/CA13_SAN_SIM/selection_converted/cloud.js",
|
||||
path: "http://5.9.65.151/mschuetz/potree/test/cloud.js",
|
||||
path: "http://localhost/temp/test/cloud.js",
|
||||
path: "../resources/pointclouds/vol_total/cloud.js",
|
||||
cameraPosition: null,
|
||||
cameraTarget: null,
|
||||
sizeType: "Adaptive", // options: "Fixed", "Attenuated", "Adaptive"
|
||||
quality: "Squares", // options: "Squares", "Circles", "Interpolation", "Splats"
|
||||
fov: 75, // field of view in degree
|
||||
material: "RGB", // options: "RGB", "Height", "Intensity", "Classification"
|
||||
pointLimit: 1, // max number of points in millions
|
||||
navigation: "Orbit", // options: "Earth", "Orbit", "Flight"
|
||||
pointSize: 1,
|
||||
useEDL: false, // eye-dome-lighting, especially usefull for point clouds without normals
|
||||
sizeType: "Adaptive", // options: "Fixed", "Attenuated", "Adaptive"
|
||||
quality: "Squares", // options: "Squares", "Circles", "Interpolation", "Splats"
|
||||
fov: 75, // field of view in degree
|
||||
material: "RGB", // options: "RGB", "Height", "Intensity", "Classification"
|
||||
pointLimit: 1, // max number of points in millions
|
||||
navigation: "Orbit", // options: "Earth", "Orbit", "Flight"
|
||||
pointSize: 1,
|
||||
useEDL: true, // eye-dome-lighting, especially useful for point clouds without normals
|
||||
};
|
||||
|
||||
var onPointCloudLoaded = function(event){
|
||||
// do stuff here that should be executed once the point cloud has been loaded.
|
||||
// event.pointcloud returns the point cloud object
|
||||
|
||||
};
|
||||
|
||||
viewer = new Potree.Viewer(document.getElementById("renderArea"), settings, {
|
||||
"onPointCloudLoaded": onPointCloudLoaded
|
||||
});
|
||||
|
||||
</script>
|
||||
<script src="./js/viewer.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -31,6 +31,7 @@ var paths = {
|
||||
"src/OrbitControls.js",
|
||||
"src/EarthControls.js",
|
||||
"src/LRU.js",
|
||||
"src/Annotation.js",
|
||||
"src/PointCloudOctree.js",
|
||||
"src/PointCloudOctreeGeometry.js",
|
||||
"src/utils.js",
|
||||
|
||||
203
src/Annotation.js
Normal file
203
src/Annotation.js
Normal file
@ -0,0 +1,203 @@
|
||||
Potree.Annotation = function(viewer, args){
|
||||
var scope = this;
|
||||
|
||||
Potree.Annotation.counter++;
|
||||
|
||||
this.viewer = viewer;
|
||||
this.ordinal = args.ordinal || Potree.Annotation.counter;
|
||||
this.title = args.title || "No Title";
|
||||
this.description = args.description || "";
|
||||
this.scene = args.scene || null;
|
||||
this.position = args.position || new THREE.Vector3(0,0,0);
|
||||
this.cameraPosition = args.cameraPosition;
|
||||
this.cameraTarget = args.cameraTarget || this.position;
|
||||
this.view = args.view || null;
|
||||
this.keepOpen = false;
|
||||
|
||||
this.domElement = document.createElement("div");
|
||||
this.domElement.style.position = "fixed";
|
||||
this.domElement.style.opacity = "0.5";
|
||||
this.domElement.className = "annotation";
|
||||
|
||||
this.elOrdinal = document.createElement("div");
|
||||
this.elOrdinal.style.position = "absolute";
|
||||
this.elOrdinal.style.width = "1.5em";
|
||||
this.elOrdinal.style.height = "1.5em";
|
||||
this.elOrdinal.style.color = "white";
|
||||
this.elOrdinal.style.backgroundColor = "black";
|
||||
this.elOrdinal.style.borderRadius = "1.5em";
|
||||
this.elOrdinal.style.fontSize = "1em";
|
||||
this.elOrdinal.style.opacity = "1";
|
||||
this.elOrdinal.style.zIndex = "100";
|
||||
this.domElement.appendChild(this.elOrdinal);
|
||||
this.elOrdinal.onmouseenter = function(){
|
||||
//scope.openBar();
|
||||
};
|
||||
this.elOrdinal.onmouseleave = function(){
|
||||
|
||||
};
|
||||
this.elOrdinal.onclick = function(){
|
||||
scope.moveHere(scope.viewer.camera);
|
||||
//scope.openBar();
|
||||
//scope.keepOpen = true;
|
||||
};
|
||||
this.domElement.onmouseleave = function(){
|
||||
//scope.closeBar();
|
||||
};
|
||||
|
||||
|
||||
this.elOrdinalText = document.createElement("span");
|
||||
this.elOrdinalText.style.display = "inline-block";
|
||||
this.elOrdinalText.style.verticalAlign = "middle";
|
||||
this.elOrdinalText.style.lineHeight = "1.5em";
|
||||
this.elOrdinalText.style.textAlign = "center";
|
||||
this.elOrdinalText.style.width = "100%";
|
||||
//this.elOrdinalText.style.fontWeight = "bold";
|
||||
this.elOrdinalText.style.fontFamily = "Arial";
|
||||
this.elOrdinalText.style.cursor = "default";
|
||||
this.elOrdinalText.innerHTML = this.ordinal;
|
||||
this.elOrdinalText.userSelect = "none";
|
||||
this.elOrdinal.appendChild(this.elOrdinalText);
|
||||
|
||||
|
||||
this.elButtons = document.createElement("div");
|
||||
this.elButtons.style.position = "absolute";
|
||||
this.elButtons.style.display = "block";
|
||||
this.elButtons.style.height = "1.5em";
|
||||
this.elButtons.style.backgroundColor = "#333333";
|
||||
this.elButtons.style.zIndex = "50";
|
||||
this.elButtons.style.borderRadius = "1.5em 1.5em 1.5em 1.5em";
|
||||
this.elButtons.style.cursor = "default";
|
||||
this.elButtons.style.padding = "0.0em 0.0em 0em 1.5em";
|
||||
this.elButtons.style.whiteSpace = "nowrap";
|
||||
this.domElement.appendChild(this.elButtons);
|
||||
|
||||
|
||||
if(this.description){
|
||||
this.elButtonsInfo = document.createElement("img");
|
||||
this.elButtonsInfo.src = "../resources/icons/info_32x32.png";
|
||||
this.elButtonsInfo.style.width = "1.5em";
|
||||
this.elButtonsInfo.style.padding = "0em 0em 0em 0.2em";
|
||||
this.elButtons.appendChild(this.elButtonsInfo);
|
||||
this.elButtonsInfo.onclick = function(){
|
||||
scope.openDescriptionWindow();
|
||||
};
|
||||
}
|
||||
|
||||
if(this.scene){
|
||||
this.elButtonsScene = document.createElement("img");
|
||||
this.elButtonsScene.src = "../resources/icons/goto_32x32.png";
|
||||
this.elButtonsScene.style.width = "1.5em";
|
||||
this.elButtonsScene.style.padding = "0em 0em 0em 0.2em";
|
||||
this.elButtonsScene.onclick = function(){loadScene(scope.scene)};
|
||||
|
||||
this.elButtons.appendChild(this.elButtonsScene);
|
||||
}
|
||||
|
||||
this.domElement.onmouseenter = function(){
|
||||
scope.domElement.style.opacity = "0.8";
|
||||
};
|
||||
this.domElement.onmouseleave = function(){
|
||||
scope.domElement.style.opacity = "0.5";
|
||||
};
|
||||
|
||||
this.openBar = function(){
|
||||
scope.elOrdinal.style.opacity = 0.8;
|
||||
scope.elButtons.style.display = "block";
|
||||
};
|
||||
|
||||
this.closeBar = function(){
|
||||
if(!this.keepOpen){
|
||||
scope.elOrdinal.style.opacity = 0.5;
|
||||
scope.elButtons.style.display = "none";
|
||||
}
|
||||
};
|
||||
|
||||
this.openDescriptionWindow = function(){
|
||||
if(this.elDescription){
|
||||
this.elDescription.style.display = "block";
|
||||
}else{
|
||||
this.elDescription = document.createElement("div");
|
||||
this.elDescription.className = "description";
|
||||
|
||||
this.elDescriptionHeader = document.createElement("div");
|
||||
this.elDescriptionHeader.className = "description-header";
|
||||
this.elDescription.appendChild(this.elDescriptionHeader);
|
||||
|
||||
this.elDescriptionTitle = document.createElement("span");
|
||||
this.elDescriptionTitle.className = "description-title";
|
||||
this.elDescriptionTitle.innerHTML = scope.title;
|
||||
this.elDescriptionHeader.appendChild(this.elDescriptionTitle);
|
||||
|
||||
this.elDescriptionButtons = document.createElement("span");
|
||||
this.elDescriptionButtons.className = "description-buttons";
|
||||
this.elDescriptionHeader.appendChild(this.elDescriptionButtons);
|
||||
|
||||
this.elDescriptionClose = document.createElement("img");
|
||||
this.elDescriptionClose.src = "../resources/icons/close_32x32_black.png";
|
||||
this.elDescriptionClose.onmouseenter = function(){this.src = '../resources/icons/close_32x32_black_shadow.png'};
|
||||
this.elDescriptionClose.onmouseleave = function(){this.src = '../resources/icons/close_32x32_black.png'};
|
||||
this.elDescriptionClose.style.height = "1.5em";
|
||||
this.elDescriptionClose.onclick = function(){
|
||||
scope.elDescription.style.display = "none";
|
||||
};
|
||||
this.elDescriptionButtons.appendChild(this.elDescriptionClose);
|
||||
|
||||
this.elDescriptionContent = document.createElement("div");
|
||||
this.elDescriptionContent.className = "description-content";
|
||||
this.elDescriptionContent.innerHTML = this.description;
|
||||
this.elDescription.appendChild(this.elDescriptionContent);
|
||||
|
||||
document.body.appendChild(this.elDescription);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
this.moveHere = function(camera){
|
||||
var animationDuration = 800;
|
||||
var easing = TWEEN.Easing.Quartic.Out;
|
||||
|
||||
// animate camera position
|
||||
var tween = new TWEEN.Tween(camera.position).to(scope.cameraPosition, animationDuration);
|
||||
tween.easing(easing);
|
||||
tween.start();
|
||||
|
||||
// animate camera target
|
||||
var camTargetDistance = camera.position.distanceTo(scope.cameraTarget);
|
||||
var target = new THREE.Vector3().addVectors(
|
||||
camera.position,
|
||||
camera.getWorldDirection().clone().multiplyScalar(camTargetDistance)
|
||||
);
|
||||
var tween = new TWEEN.Tween(target).to(scope.cameraTarget, animationDuration);
|
||||
tween.easing(easing);
|
||||
tween.onUpdate(function(){
|
||||
camera.lookAt(target);
|
||||
scope.viewer.orbitControls.target.copy(target);
|
||||
});
|
||||
tween.onComplete(function(){
|
||||
camera.lookAt(target);
|
||||
scope.viewer.orbitControls.target.copy(target);
|
||||
});
|
||||
|
||||
tween.start();
|
||||
};
|
||||
|
||||
this.dispose = function(){
|
||||
if(this.descriptionDialog){
|
||||
var id = "annotation_description_" + scope.ordinal;
|
||||
$( ("#" + id) ).dialog('destroy');
|
||||
}
|
||||
|
||||
if(this.domElement.parentElement){
|
||||
this.domElement.parentElement.removeChild(this.domElement);
|
||||
}
|
||||
|
||||
if(this.elDescription){
|
||||
if(this.elDescription.parentElement){
|
||||
this.elDescription.parentElement.removeChild(this.elDescription);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
Potree.Annotation.counter = 0;
|
||||
@ -195,6 +195,8 @@ LRU.prototype.disposeDescendants = function(node){
|
||||
while(stack.length > 0){
|
||||
var current = stack.pop();
|
||||
|
||||
//console.log(current);
|
||||
|
||||
current.dispose();
|
||||
this.remove(current);
|
||||
|
||||
|
||||
@ -1,14 +1,282 @@
|
||||
|
||||
|
||||
Potree.ProfileRequest = function(){
|
||||
this.queue = [];
|
||||
Potree.ProfileData = function(profile){
|
||||
this.profile = profile;
|
||||
|
||||
this.segments = [];
|
||||
this.boundingBox = new THREE.Box3();
|
||||
this.projectedBoundingBox = new THREE.Box2();
|
||||
|
||||
var mileage = new THREE.Vector3();
|
||||
for(var i = 0; i < profile.points.length - 1; i++){
|
||||
var start = profile.points[i];
|
||||
var end = profile.points[i+1];
|
||||
|
||||
var center = new THREE.Vector3().addVectors(end, start).multiplyScalar(0.5);
|
||||
var length = new THREE.Vector3(start.x, 0, start.z).distanceTo(new THREE.Vector3(end.x, 0, end.z));
|
||||
var side = new THREE.Vector3().subVectors(end, start).normalize();
|
||||
var up = new THREE.Vector3(0, 1, 0);
|
||||
var forward = new THREE.Vector3().crossVectors(side, up).normalize();
|
||||
var N = forward;
|
||||
var cutPlane = new THREE.Plane().setFromNormalAndCoplanarPoint(N, start);
|
||||
var halfPlane = new THREE.Plane().setFromNormalAndCoplanarPoint(side, center);
|
||||
|
||||
var project = function(_start, _end, _mileage){
|
||||
var start = _start;
|
||||
var end = _end;
|
||||
var mileage = _mileage;
|
||||
|
||||
var xAxis = new THREE.Vector3(1,0,0);
|
||||
var dir = new THREE.Vector3().subVectors(end, start);
|
||||
dir.y = 0;
|
||||
dir.normalize();
|
||||
var alpha = Math.acos(xAxis.dot(dir));
|
||||
if(dir.z > 0){
|
||||
alpha = -alpha;
|
||||
}
|
||||
|
||||
|
||||
return function(position){
|
||||
var toOrigin = new THREE.Matrix4().makeTranslation(-start.x, 0, -start.z);
|
||||
var alignWithX = new THREE.Matrix4().makeRotationY(-alpha);
|
||||
var applyMileage = new THREE.Matrix4().makeTranslation(mileage.x, 0, 0);
|
||||
|
||||
var pos = position.clone();
|
||||
pos.applyMatrix4(toOrigin);
|
||||
pos.applyMatrix4(alignWithX);
|
||||
pos.applyMatrix4(applyMileage);
|
||||
|
||||
return pos;
|
||||
};
|
||||
|
||||
}(start, end, mileage.clone());
|
||||
|
||||
var segment = {
|
||||
start: start,
|
||||
end: end,
|
||||
cutPlane: cutPlane,
|
||||
halfPlane: halfPlane,
|
||||
length: length,
|
||||
points: null,
|
||||
project: project
|
||||
};
|
||||
|
||||
this.segments.push(segment);
|
||||
|
||||
mileage.x += new THREE.Vector3(start.x, 0, start.z).distanceTo(new THREE.Vector3(end.x, 0, end.z));
|
||||
mileage.y += end.y - start.y;
|
||||
}
|
||||
|
||||
this.projectedBoundingBox.min.x = 0;
|
||||
this.projectedBoundingBox.min.y = Number.POSITIVE_INFINITY;
|
||||
this.projectedBoundingBox.max.x = mileage.x;
|
||||
this.projectedBoundingBox.max.y = Number.NEGATIVE_INFINITY;
|
||||
|
||||
this.size = function(){
|
||||
var size = 0;
|
||||
for(var i = 0; i < this.segments.length; i++){
|
||||
if(this.segments[i].points){
|
||||
size += this.segments[i].points.numPoints;
|
||||
}
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Potree.ProfileRequest = function(pointcloud, profile, maxDepth, callback){
|
||||
|
||||
this.pointcloud = pointcloud;
|
||||
this.profile = profile;
|
||||
this.maxDepth = maxDepth || Number.MAX_VALUE;
|
||||
this.callback = callback;
|
||||
this.temporaryResult = new Potree.ProfileData(this.profile);
|
||||
this.pointsServed = 0;
|
||||
|
||||
this.priorityQueue = new BinaryHeap(function(x){return 1 / x.weight;});
|
||||
|
||||
this.initialize = function(){
|
||||
this.priorityQueue.push({node: pointcloud.pcoGeometry.root, weight: 1});
|
||||
this.traverse(pointcloud.pcoGeometry.root);
|
||||
};
|
||||
|
||||
// traverse the node and add intersecting descendants to queue
|
||||
this.traverse = function(node){
|
||||
|
||||
var stack = [];
|
||||
for(var i = 0; i < 8; i++){
|
||||
var child = node.children[i];
|
||||
if(child && pointcloud.nodeIntersectsProfile(child, this.profile)){
|
||||
stack.push(child);
|
||||
}
|
||||
}
|
||||
|
||||
while(stack.length > 0){
|
||||
var node = stack.pop();
|
||||
var weight = node.boundingSphere.radius;
|
||||
|
||||
this.priorityQueue.push({node: node, weight: weight});
|
||||
|
||||
// add children that intersect the cutting plane
|
||||
if(node.level < this.maxDepth){
|
||||
for(var i = 0; i < 8; i++){
|
||||
var child = node.children[i];
|
||||
if(child && pointcloud.nodeIntersectsProfile(child, this.profile)){
|
||||
stack.push(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.update = function(){
|
||||
|
||||
// load nodes in queue
|
||||
// if hierarchy expands, also load nodes from expanded hierarchy
|
||||
// once loaded, add data to this.points and remove node from queue
|
||||
// only evaluate 1-50 nodes per frame to maintain responsiveness
|
||||
|
||||
var intersectedNodes = [];
|
||||
|
||||
for(var i = 0; i < Math.min(2, this.priorityQueue.size()); i++){
|
||||
var element = this.priorityQueue.pop();
|
||||
var node = element.node;
|
||||
|
||||
|
||||
if(node.loaded){
|
||||
// add points to result
|
||||
intersectedNodes.push(node);
|
||||
Potree.PointCloudOctree.lru.touch(node);
|
||||
|
||||
if((node.level % node.pcoGeometry.hierarchyStepSize) === 0 && node.hasChildren){
|
||||
this.traverse(node);
|
||||
}
|
||||
}else{
|
||||
node.load();
|
||||
this.priorityQueue.push(element);
|
||||
}
|
||||
}
|
||||
|
||||
if(intersectedNodes.length > 0){
|
||||
this.getPointsInsideProfile(intersectedNodes, this.temporaryResult);
|
||||
if(this.temporaryResult.size() > 100){
|
||||
this.pointsServed += this.temporaryResult.size();
|
||||
callback.onProgress({request: this, points: this.temporaryResult});
|
||||
this.temporaryResult = new Potree.ProfileData(this.profile);
|
||||
}
|
||||
}
|
||||
|
||||
if(this.priorityQueue.size() === 0){
|
||||
// we're done! inform callback and remove from pending requests
|
||||
|
||||
if(this.temporaryResult.size() > 0){
|
||||
this.pointsServed += this.temporaryResult.size();
|
||||
callback.onProgress({request: this, points: this.temporaryResult});
|
||||
this.temporaryResult = new Potree.ProfileData(this.profile);
|
||||
}
|
||||
|
||||
callback.onFinish({request: this});
|
||||
|
||||
var index = pointcloud.profileRequests.indexOf(this);
|
||||
if(index >= 0){
|
||||
pointcloud.profileRequests.splice(index, 1);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.getPointsInsideProfile = function(nodes, target){
|
||||
|
||||
for(var pi = 0; pi < target.segments.length; pi++){
|
||||
var segment = target.segments[pi];
|
||||
|
||||
for(var ni = 0; ni < nodes.length; ni++){
|
||||
var node = nodes[ni];
|
||||
|
||||
var geometry = node.geometry;
|
||||
var positions = geometry.attributes.position;
|
||||
var p = positions.array;
|
||||
var numPoints = node.numPoints;
|
||||
|
||||
if(!segment.points){
|
||||
segment.points = {};
|
||||
segment.points.boundingBox = new THREE.Box3();
|
||||
|
||||
for (var property in geometry.attributes) {
|
||||
if (geometry.attributes.hasOwnProperty(property)) {
|
||||
if(property === "indices"){
|
||||
|
||||
}else{
|
||||
segment.points[property] = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(var i = 0; i < numPoints; i++){
|
||||
var pos = new THREE.Vector3(p[3*i], p[3*i+1], p[3*i+2]);
|
||||
pos.applyMatrix4(pointcloud.matrixWorld);
|
||||
var distance = Math.abs(segment.cutPlane.distanceToPoint(pos));
|
||||
var centerDistance = Math.abs(segment.halfPlane.distanceToPoint(pos));
|
||||
|
||||
if(distance < profile.width / 2 && centerDistance < segment.length / 2){
|
||||
segment.points.boundingBox.expandByPoint(pos);
|
||||
|
||||
for (var property in geometry.attributes) {
|
||||
if (geometry.attributes.hasOwnProperty(property)) {
|
||||
|
||||
if(property === "position"){
|
||||
segment.points[property].push(pos);
|
||||
}else if(property === "indices"){
|
||||
// skip indices
|
||||
}else{
|
||||
var values = geometry.attributes[property];
|
||||
if(values.itemSize === 1){
|
||||
segment.points[property].push(values.array[i + j]);
|
||||
}else{
|
||||
var value = [];
|
||||
for(var j = 0; j < values.itemSize; j++){
|
||||
value.push(values.array[i*values.itemSize + j]);
|
||||
}
|
||||
segment.points[property].push(value);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
segment.points.numPoints = segment.points.position.length;
|
||||
|
||||
if(segment.points.numPoints > 0){
|
||||
target.boundingBox.expandByPoint(segment.points.boundingBox.min);
|
||||
target.boundingBox.expandByPoint(segment.points.boundingBox.max);
|
||||
|
||||
target.projectedBoundingBox.expandByPoint(new THREE.Vector2(0, target.boundingBox.min.y));
|
||||
target.projectedBoundingBox.expandByPoint(new THREE.Vector2(0, target.boundingBox.max.y));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.cancel = function(){
|
||||
callback.onCancel();
|
||||
|
||||
this.priorityQueue = new BinaryHeap(function(x){return 1 / x.weight;});
|
||||
|
||||
var index = pointcloud.profileRequests.indexOf(this);
|
||||
if(index >= 0){
|
||||
pointcloud.profileRequests.splice(index, 1);
|
||||
}
|
||||
};
|
||||
|
||||
this.initialize();
|
||||
|
||||
};
|
||||
|
||||
Potree.PointCloudOctreeNode = function(){
|
||||
this.children = {};
|
||||
this.sceneNode = null;
|
||||
this.octree = null;
|
||||
};
|
||||
|
||||
|
||||
@ -35,6 +303,7 @@ Potree.PointCloudOctree = function(geometry, material){
|
||||
this.visibleGeometry = [];
|
||||
this.pickTarget = null;
|
||||
this.generateDEM = false;
|
||||
this.profileRequests = [];
|
||||
|
||||
this.root = this.pcoGeometry.root;
|
||||
};
|
||||
@ -90,6 +359,13 @@ Potree.PointCloudOctree.prototype.updateVisibility = function(camera, renderer){
|
||||
var visible = insideFrustum;
|
||||
visible = visible && !(this.numVisiblePoints + node.numPoints > this.visiblePointsTarget);
|
||||
|
||||
//if(node instanceof Potree.PointCloudOctreeNode && viewer.profileTool.profiles.length > 0){
|
||||
// var profile = viewer.profileTool.profiles[0];
|
||||
// visible = this.nodeIntersectsProfile(node, profile);
|
||||
//}
|
||||
|
||||
//visible = "r06642222234".indexOf(node.name) >= 0;
|
||||
|
||||
if(!visible){
|
||||
continue;
|
||||
}
|
||||
@ -107,6 +383,7 @@ Potree.PointCloudOctree.prototype.updateVisibility = function(camera, renderer){
|
||||
var sceneNode = new THREE.PointCloud(geometry, this.material);
|
||||
sceneNode.visible = false;
|
||||
|
||||
pcoNode.octree = this;
|
||||
pcoNode.name = geometryNode.name;
|
||||
pcoNode.level = geometryNode.level;
|
||||
pcoNode.numPoints = geometryNode.numPoints;
|
||||
@ -115,7 +392,11 @@ Potree.PointCloudOctree.prototype.updateVisibility = function(camera, renderer){
|
||||
pcoNode.boundingSphere = pcoNode.boundingBox.getBoundingSphere();
|
||||
pcoNode.geometryNode = geometryNode;
|
||||
pcoNode.parent = parent;
|
||||
pcoNode.children = geometryNode.children;
|
||||
pcoNode.children = {};
|
||||
for(var key in geometryNode.children){
|
||||
pcoNode.children[key] = geometryNode.children[key];
|
||||
}
|
||||
|
||||
sceneNode.boundingBox = pcoNode.boundingBox;
|
||||
sceneNode.boundingSphere = pcoNode.boundingSphere;
|
||||
sceneNode.numPoints = pcoNode.numPoints;
|
||||
@ -136,6 +417,18 @@ Potree.PointCloudOctree.prototype.updateVisibility = function(camera, renderer){
|
||||
sceneNode.matrixWorld.multiplyMatrices( parent.sceneNode.matrixWorld, sceneNode.matrix );
|
||||
}
|
||||
|
||||
// when a PointCloudOctreeGeometryNode is disposed,
|
||||
// then replace reference to PointCloudOctreeNode with PointCloudOctreeGeometryNode
|
||||
// as it was before it was loaded
|
||||
var disposeListener = function(parent, pcoNode, geometryNode){
|
||||
return function(){
|
||||
var childIndex = parseInt(pcoNode.name[pcoNode.name.length - 1]);
|
||||
parent.sceneNode.remove(pcoNode.sceneNode);
|
||||
parent.children[childIndex] = geometryNode;
|
||||
}
|
||||
}(parent, pcoNode, node);
|
||||
pcoNode.geometryNode.oneTimeDisposeHandlers.push(disposeListener);
|
||||
|
||||
node = pcoNode;
|
||||
}
|
||||
|
||||
@ -270,6 +563,10 @@ Potree.PointCloudOctree.prototype.updateMaterial = function(material, visibleNod
|
||||
};
|
||||
|
||||
Potree.PointCloudOctree.prototype.update = function(camera, renderer){
|
||||
|
||||
for(var i = 0; i < this.profileRequests.length; i++){
|
||||
this.profileRequests[i].update();
|
||||
}
|
||||
|
||||
this.updateVisibility(camera, renderer);
|
||||
|
||||
@ -280,8 +577,6 @@ Potree.PointCloudOctree.prototype.update = function(camera, renderer){
|
||||
Potree.PointCloudOctree.lru.freeMemory();
|
||||
|
||||
// TODO bounds
|
||||
// TODO free memory
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -345,13 +640,44 @@ Potree.PointCloudOctree.prototype.updateVisibilityTexture = function(material, v
|
||||
texture.needsUpdate = true;
|
||||
};
|
||||
|
||||
Potree.PointCloudOctree.prototype.nodeIntersectsProfile = function(node, profile){
|
||||
var bbWorld = node.boundingBox.clone().applyMatrix4(this.matrixWorld);
|
||||
var bsWorld = bbWorld.getBoundingSphere();
|
||||
|
||||
for(var i = 0; i < profile.points.length - 1; i++){
|
||||
var start = new THREE.Vector3(profile.points[i].x, bsWorld.center.y, profile.points[i].z);
|
||||
var end = new THREE.Vector3(profile.points[i+1].x, bsWorld.center.y, profile.points[i+1].z);
|
||||
|
||||
var ray1 = new THREE.Ray(start, new THREE.Vector3().subVectors(end, start).normalize());
|
||||
var ray2 = new THREE.Ray(end, new THREE.Vector3().subVectors(start, end).normalize());
|
||||
|
||||
if(ray1.isIntersectionSphere(bsWorld) && ray2.isIntersectionSphere(bsWorld)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//Potree.PointCloudOctreeNode.prototype.intersectsProfile = function(profile){
|
||||
// var bbWorld = this.boundingBox.clone().applyMatrix4(this.octree.matrixWorld);
|
||||
// var bsWorld = bbWorld.getBoundingSphere();
|
||||
//
|
||||
// for(var i = 0; i < profile.points.length - 1; i++){
|
||||
// var start = new THREE.Vector3(profile.points[i].x, bsWorld.center.y, profile.points[i].z);
|
||||
// var end = new THREE.Vector3(profile.points[i+1].x, bsWorld.center.y, profile.points[i+1].z);
|
||||
//
|
||||
// var ray1 = new THREE.Ray(start, new THREE.Vector3().subVectors(end, start).normalize());
|
||||
// var ray2 = new THREE.Ray(end, new THREE.Vector3().subVectors(start, end).normalize());
|
||||
//
|
||||
// if(ray1.isIntersectionSphere(bsWorld) && ray2.isIntersectionSphere(bsWorld)){
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return false;
|
||||
//};
|
||||
|
||||
|
||||
|
||||
@ -481,7 +807,15 @@ Potree.PointCloudOctree.prototype.getBoundingBoxWorld = function(){
|
||||
*
|
||||
*
|
||||
*/
|
||||
Potree.PointCloudOctree.prototype.getPointsInProfile = function(profile, maxDepth){
|
||||
Potree.PointCloudOctree.prototype.getPointsInProfile = function(profile, maxDepth, callback){
|
||||
|
||||
if(callback){
|
||||
var request = new Potree.ProfileRequest(this, profile, maxDepth, callback);
|
||||
this.profileRequests.push(request);
|
||||
|
||||
return request;
|
||||
}
|
||||
|
||||
var points = {
|
||||
segments: [],
|
||||
boundingBox: new THREE.Box3(),
|
||||
@ -573,7 +907,8 @@ Potree.PointCloudOctree.prototype.getPointsInProfile = function(profile, maxDept
|
||||
*/
|
||||
Potree.PointCloudOctree.prototype.getProfile = function(start, end, width, depth, callback){
|
||||
if(callback !== undefined){
|
||||
this.profileRequests.push(new Potree.ProfileRequest(start, end, width, depth, callback));
|
||||
var request = new Potree.ProfileRequest(start, end, width, depth, callback);
|
||||
this.profileRequests.push(request);
|
||||
}else{
|
||||
var stack = [];
|
||||
stack.push(this);
|
||||
|
||||
@ -27,6 +27,8 @@ Potree.PointCloudOctreeGeometryNode = function(name, pcoGeometry, boundingBox){
|
||||
this.children = {};
|
||||
this.numPoints = 0;
|
||||
this.level = null;
|
||||
this.loaded = false;
|
||||
this.oneTimeDisposeHandlers = [];
|
||||
};
|
||||
|
||||
Potree.PointCloudOctreeGeometryNode.IDCount = 0;
|
||||
@ -69,7 +71,7 @@ Potree.PointCloudOctreeGeometryNode.prototype.addChild = function(child){
|
||||
};
|
||||
|
||||
Potree.PointCloudOctreeGeometryNode.prototype.load = function(){
|
||||
if(this.loading === true || this.pcoGeometry.numNodesLoading > 3){
|
||||
if(this.loading === true || this.loaded === true ||this.pcoGeometry.numNodesLoading > 3){
|
||||
return;
|
||||
}
|
||||
|
||||
@ -203,10 +205,18 @@ Potree.PointCloudOctreeGeometryNode.prototype.loadHierachyThenPoints = function(
|
||||
|
||||
|
||||
Potree.PointCloudOctreeGeometryNode.prototype.dispose = function(){
|
||||
if(this.geometry){
|
||||
if(this.geometry && this.parent != null){
|
||||
this.geometry.dispose();
|
||||
this.geometry = null;
|
||||
this.loaded = false;
|
||||
|
||||
//this.dispatchEvent( { type: 'dispose' } );
|
||||
for(var i = 0; i < this.oneTimeDisposeHandlers.length; i++){
|
||||
var handler = this.oneTimeDisposeHandlers[i];
|
||||
handler();
|
||||
}
|
||||
this.oneTimeDisposeHandlers = [];
|
||||
}
|
||||
};
|
||||
|
||||
THREE.EventDispatcher.prototype.apply( Potree.PointCloudOctreeGeometryNode.prototype );
|
||||
@ -9,8 +9,11 @@ Potree.TextSprite = function(text){
|
||||
var texture = new THREE.Texture();
|
||||
texture.minFilter = THREE.LinearFilter;
|
||||
texture.magFilter = THREE.LinearFilter;
|
||||
var spriteMaterial = new THREE.SpriteMaterial(
|
||||
{ map: texture, useScreenCoordinates: false} );
|
||||
var spriteMaterial = new THREE.SpriteMaterial( {
|
||||
map: texture,
|
||||
useScreenCoordinates: false,
|
||||
depthTest: false,
|
||||
depthWrite: false} );
|
||||
|
||||
this.material = spriteMaterial;
|
||||
this.sprite = new THREE.Sprite(spriteMaterial);
|
||||
|
||||
@ -2,36 +2,39 @@
|
||||
|
||||
THREE.PerspectiveCamera.prototype.zoomTo = function( node, factor ){
|
||||
|
||||
if ( !node.geometry && !node.boundingSphere) {
|
||||
|
||||
if ( !node.geometry && !node.boundingSphere && !node.boundingBox) {
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if ( node.geometry && node.geometry.boundingSphere === null ) {
|
||||
|
||||
node.geometry.computeBoundingSphere();
|
||||
|
||||
}
|
||||
|
||||
node.updateMatrixWorld();
|
||||
|
||||
var bs;
|
||||
|
||||
if(node.boundingSphere){
|
||||
bs = node.boundingSphere;
|
||||
}else if(node.geometry && node.geometry.boundingSphere){
|
||||
bs = node.geometry.boundingSphere;
|
||||
}else{
|
||||
bs = node.boundingBox.getBoundingSphere();
|
||||
}
|
||||
|
||||
var _factor = factor || 1;
|
||||
var bs = node.boundingSphere || node.geometry.boundingSphere;
|
||||
|
||||
bs = bs.clone().applyMatrix4(node.matrixWorld);
|
||||
var radius = bs.radius;
|
||||
var fovr = this.fov * Math.PI / 180;
|
||||
|
||||
if( this.aspect < 1 ){
|
||||
|
||||
fovr = fovr * this.aspect;
|
||||
|
||||
}
|
||||
|
||||
var distanceFactor = Math.abs( radius / Math.sin( fovr / 2 ) ) * _factor ;
|
||||
|
||||
var dir = new THREE.Vector3( 0, 0, -1 ).applyQuaternion( this.quaternion );
|
||||
var offset = dir.multiplyScalar( -distanceFactor );
|
||||
var offset = this.getWorldDirection().multiplyScalar( -distanceFactor );
|
||||
this.position.copy(bs.center.clone().add( offset ));
|
||||
|
||||
};
|
||||
|
||||
40
src/utils.js
40
src/utils.js
@ -226,53 +226,29 @@ function projectedRadius(radius, fov, distance, screenHeight){
|
||||
};
|
||||
|
||||
|
||||
Potree.utils.topView = function(camera, controls, pointcloud){
|
||||
Potree.utils.topView = function(camera, node){
|
||||
camera.position.set(0, 1, 0);
|
||||
camera.rotation.set(-Math.PI / 2, 0, 0);
|
||||
camera.zoomTo(pointcloud, 1);
|
||||
|
||||
if(controls.target){
|
||||
var sg = pointcloud.boundingSphere.clone().applyMatrix4(pointcloud.matrixWorld);
|
||||
var target = new THREE.Vector3(camera.position.x, sg.center.y, camera.position.z);
|
||||
controls.target.copy(target);
|
||||
}
|
||||
camera.zoomTo(node, 1);
|
||||
};
|
||||
|
||||
Potree.utils.frontView = function(camera, controls, pointcloud){
|
||||
Potree.utils.frontView = function(camera, node){
|
||||
camera.position.set(0, 0, 1);
|
||||
camera.rotation.set(0, 0, 0);
|
||||
camera.zoomTo(pointcloud, 1);
|
||||
|
||||
if(controls.target){
|
||||
var sg = pointcloud.boundingSphere.clone().applyMatrix4(pointcloud.matrixWorld);
|
||||
var target = new THREE.Vector3(camera.position.x, camera.position.y, sg.center.z);
|
||||
controls.target.copy(target);
|
||||
}
|
||||
camera.zoomTo(node, 1);
|
||||
};
|
||||
|
||||
|
||||
Potree.utils.leftView = function(camera, controls, pointcloud){
|
||||
Potree.utils.leftView = function(camera, node){
|
||||
camera.position.set(-1, 0, 0);
|
||||
camera.rotation.set(0, -Math.PI / 2, 0);
|
||||
camera.zoomTo(pointcloud, 1);
|
||||
|
||||
if(controls.target){
|
||||
var sg = pointcloud.boundingSphere.clone().applyMatrix4(pointcloud.matrixWorld);
|
||||
var target = new THREE.Vector3(sg.center.x, camera.position.y, camera.position.z);
|
||||
controls.target.copy(target);
|
||||
}
|
||||
camera.zoomTo(node, 1);
|
||||
};
|
||||
|
||||
Potree.utils.rightView = function(camera, controls, pointcloud){
|
||||
Potree.utils.rightView = function(camera, node){
|
||||
camera.position.set(1, 0, 0);
|
||||
camera.rotation.set(0, Math.PI / 2, 0);
|
||||
camera.zoomTo(pointcloud, 1);
|
||||
|
||||
if(controls.target){
|
||||
var sg = pointcloud.boundingSphere.clone().applyMatrix4(pointcloud.matrixWorld);
|
||||
var target = new THREE.Vector3(sg.center.x, camera.position.y, camera.position.z);
|
||||
controls.target.copy(target);
|
||||
}
|
||||
camera.zoomTo(node, 1);
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@ -59,7 +59,7 @@ Potree.Measure = function(){
|
||||
scope.setPosition(index, I);
|
||||
}
|
||||
|
||||
//event.event.stopImmediatePropagation();
|
||||
event.event.stopImmediatePropagation();
|
||||
};
|
||||
|
||||
var dropEvent = function(event){
|
||||
|
||||
@ -182,6 +182,13 @@ Potree.HeightProfile = function(){
|
||||
this.setWidth = function(width){
|
||||
this.width = width;
|
||||
|
||||
var event = {
|
||||
type: 'width_changed',
|
||||
profile: this,
|
||||
width: width
|
||||
};
|
||||
this.dispatchEvent(event);
|
||||
|
||||
this.update();
|
||||
};
|
||||
|
||||
|
||||
@ -716,6 +716,10 @@ Potree.TransformationTool = function(scene, camera, renderer){
|
||||
this.rotationNode.visible = true;
|
||||
};
|
||||
|
||||
this.reset = function(){
|
||||
this.setTargets([]);
|
||||
};
|
||||
|
||||
this.buildTranslationNode();
|
||||
this.buildScaleNode();
|
||||
this.buildRotationNode();
|
||||
|
||||
@ -40,7 +40,12 @@ Potree.Volume = function(args){
|
||||
boxFrameGeometry.vertices.push(new THREE.Vector3(-0.5, 0.5, -0.5));
|
||||
|
||||
this.dimension = new THREE.Vector3(1,1,1);
|
||||
var material = new THREE.MeshBasicMaterial( {color: 0x00ff00, transparent: true, opacity: 0.3} );
|
||||
var material = new THREE.MeshBasicMaterial( {
|
||||
color: 0x00ff00,
|
||||
transparent: true,
|
||||
opacity: 0.3,
|
||||
depthTest: true,
|
||||
depthWrite: true} );
|
||||
this.box = new THREE.Mesh( boxGeometry, material);
|
||||
this.box.geometry.computeBoundingBox();
|
||||
this.boundingBox = this.box.geometry.boundingBox;
|
||||
@ -54,6 +59,8 @@ Potree.Volume = function(args){
|
||||
this.label.setBorderColor({r:0, g:255, b:0, a:0.0});
|
||||
this.label.setBackgroundColor({r:0, g:255, b:0, a:0.0});
|
||||
this.label.material.depthTest = false;
|
||||
this.label.material.depthWrite = false;
|
||||
this.label.material.transparent = true;
|
||||
this.label.position.y -= 0.5;
|
||||
this.add(this.label);
|
||||
|
||||
@ -84,6 +91,7 @@ Potree.Volume = function(args){
|
||||
|
||||
this.update = function(){
|
||||
this.boundingBox = this.box.geometry.boundingBox;
|
||||
this.boundingSphere = this.boundingBox.getBoundingSphere();
|
||||
|
||||
if(this._clip){
|
||||
this.box.visible = false;
|
||||
@ -140,7 +148,7 @@ Object.defineProperty(Potree.Volume.prototype, "modifiable", {
|
||||
});
|
||||
|
||||
|
||||
Potree.VolumeTool = function(scene, camera, renderer){
|
||||
Potree.VolumeTool = function(scene, camera, renderer, transformationTool){
|
||||
|
||||
var scope = this;
|
||||
this.enabled = false;
|
||||
@ -149,7 +157,8 @@ Potree.VolumeTool = function(scene, camera, renderer){
|
||||
this.sceneVolume = new THREE.Scene();
|
||||
this.camera = camera;
|
||||
this.renderer = renderer;
|
||||
this.domElement = renderer.domElement;
|
||||
this.transformationTool = transformationTool;
|
||||
this.domElement = this.renderer.domElement;
|
||||
this.mouse = {x: 0, y: 0};
|
||||
|
||||
this.volumes = [];
|
||||
@ -194,7 +203,7 @@ Potree.VolumeTool = function(scene, camera, renderer){
|
||||
var I = getHoveredElement();
|
||||
|
||||
if(I && I.object.modifiable){
|
||||
transformationTool.setTargets([I.object]);
|
||||
scope.transformationTool.setTargets([I.object]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -320,7 +329,7 @@ Potree.VolumeTool = function(scene, camera, renderer){
|
||||
label.setText(msg);
|
||||
|
||||
var distance = scope.camera.position.distanceTo(label.getWorldPosition());
|
||||
var pr = projectedRadius(1, scope.camera.fov * Math.PI / 180, distance, renderer.domElement.clientHeight);
|
||||
var pr = projectedRadius(1, scope.camera.fov * Math.PI / 180, distance, scope.renderer.domElement.clientHeight);
|
||||
var scale = (70 / pr);
|
||||
label.scale.set(scale, scale, scale);
|
||||
}
|
||||
@ -340,7 +349,7 @@ Potree.VolumeTool = function(scene, camera, renderer){
|
||||
};
|
||||
|
||||
this.finishInsertion = function(){
|
||||
transformationTool.setTargets([this.activeVolume]);
|
||||
scope.transformationTool.setTargets([this.activeVolume]);
|
||||
|
||||
var event = {
|
||||
type: "insertion_finished",
|
||||
@ -373,9 +382,9 @@ Potree.VolumeTool = function(scene, camera, renderer){
|
||||
};
|
||||
|
||||
|
||||
this.render = function(){
|
||||
|
||||
renderer.render(this.sceneVolume, this.camera);
|
||||
this.render = function(target){
|
||||
|
||||
scope.renderer.render(this.sceneVolume, this.camera, target);
|
||||
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user