don't render invisible point clouds in 2d profile; add pointcloud.setName() method and display name in scene panel
This commit is contained in:
parent
322a5977a8
commit
f33381b948
@ -5361,6 +5361,7 @@ Potree.PointCloudOctree = function(geometry, material){
|
||||
this.pickTarget = null;
|
||||
this.generateDEM = false;
|
||||
this.profileRequests = [];
|
||||
this.name = "";
|
||||
|
||||
// TODO read projection from file instead
|
||||
this.projection = geometry.projection;
|
||||
@ -5370,6 +5371,17 @@ Potree.PointCloudOctree = function(geometry, material){
|
||||
|
||||
Potree.PointCloudOctree.prototype = Object.create(Potree.PointCloudTree.prototype);
|
||||
|
||||
Potree.PointCloudOctree.prototype.setName = function(name){
|
||||
if(this.name !== name){
|
||||
this.name = name;
|
||||
this.dispatchEvent({type: "name_changed", name: name, pointcloud: this});
|
||||
}
|
||||
};
|
||||
|
||||
Potree.PointCloudOctree.prototype.getName = function(){
|
||||
return this.name;
|
||||
};
|
||||
|
||||
Potree.PointCloudOctree.prototype.toTreeNode = function(geometryNode, parent){
|
||||
var node = new Potree.PointCloudOctreeNode();
|
||||
var sceneNode = new THREE.PointCloud(geometryNode.geometry, pointcloud.material);
|
||||
@ -10074,6 +10086,7 @@ Potree.PointCloudArena4D = function(geometry){
|
||||
this.material.sizeType = Potree.PointSizeType.ATTENUATED;
|
||||
this.material.size = 0.05;
|
||||
this.profileRequests = [];
|
||||
this.name = "";
|
||||
|
||||
this.pickTarget;
|
||||
this.pickMaterial;
|
||||
@ -10083,6 +10096,17 @@ Potree.PointCloudArena4D = function(geometry){
|
||||
|
||||
Potree.PointCloudArena4D.prototype = new Potree.PointCloudTree();
|
||||
|
||||
Potree.PointCloudOctree.prototype.setName = function(name){
|
||||
if(this.name !== name){
|
||||
this.name = name;
|
||||
this.dispatchEvent({type: "name_changed", name: name, pointcloud: this});
|
||||
}
|
||||
};
|
||||
|
||||
Potree.PointCloudOctree.prototype.getName = function(){
|
||||
return this.name;
|
||||
};
|
||||
|
||||
Potree.PointCloudArena4D.prototype.toTreeNode = function(geometryNode, parent){
|
||||
var node = new Potree.PointCloudArena4DNode();
|
||||
var sceneNode = new THREE.PointCloud(geometryNode.geometry, pointcloud.material);
|
||||
@ -11426,15 +11450,15 @@ Potree.Viewer = function(domElement, args){
|
||||
};
|
||||
|
||||
this.disableAnnotations = function(){
|
||||
for(var i = 0; i < viewer.annotations.length; i++){
|
||||
var annotation = viewer.annotations[i];
|
||||
for(var i = 0; i < scope.annotations.length; i++){
|
||||
var annotation = scope.annotations[i];
|
||||
annotation.domElement.style.pointerEvents = "none";
|
||||
};
|
||||
};
|
||||
|
||||
this.enableAnnotations = function(){
|
||||
for(var i = 0; i < viewer.annotations.length; i++){
|
||||
var annotation = viewer.annotations[i];
|
||||
for(var i = 0; i < scope.annotations.length; i++){
|
||||
var annotation = scope.annotations[i];
|
||||
annotation.domElement.style.pointerEvents = "auto";
|
||||
};
|
||||
};
|
||||
@ -12375,9 +12399,9 @@ Potree.Viewer = function(domElement, args){
|
||||
|
||||
if(scope.showDebugInfos){
|
||||
scope.infos.set("camera.position", "camera.position: " +
|
||||
viewer.camera.position.x.toFixed(2)
|
||||
+ ", " + viewer.camera.position.y.toFixed(2)
|
||||
+ ", " + viewer.camera.position.z.toFixed(2)
|
||||
scope.camera.position.x.toFixed(2)
|
||||
+ ", " + scope.camera.position.y.toFixed(2)
|
||||
+ ", " + scope.camera.position.z.toFixed(2)
|
||||
);
|
||||
}
|
||||
|
||||
@ -13320,7 +13344,6 @@ Potree.Viewer.Profile = function(viewer, element){
|
||||
};
|
||||
|
||||
this.draw = function(profile){
|
||||
// TODO handle all pointclouds
|
||||
// TODO are the used closures safe for garbage collection?
|
||||
|
||||
if(!scope.enabled){
|
||||
@ -13551,6 +13574,11 @@ Potree.Viewer.Profile = function(viewer, element){
|
||||
|
||||
for(var i = 0; i < scope.viewer.pointclouds.length; i++){
|
||||
var pointcloud = scope.viewer.pointclouds[i];
|
||||
|
||||
if(!pointcloud.visible){
|
||||
continue;
|
||||
}
|
||||
|
||||
var request = pointcloud.getPointsInProfile(profile, null, {
|
||||
"onProgress": function(event){
|
||||
if(!scope.enabled){
|
||||
|
||||
10
build/potree/potree.min.js
vendored
10
build/potree/potree.min.js
vendored
File diff suppressed because one or more lines are too long
@ -990,28 +990,44 @@ function initSceneList(){
|
||||
var scenelist = $('#sceneList');
|
||||
|
||||
var id = 0;
|
||||
// this works but it looks so wrong. any better way to create a closure around pointcloud?
|
||||
var addPointcloud = function(pointcloud){
|
||||
var elLi = $('<li>');
|
||||
var elLabel = $('<label>');
|
||||
var elInput = $('<input type="checkbox">');
|
||||
|
||||
elInput[0].checked = true;
|
||||
elInput[0].id = "scene_list_item_pointcloud_" + id;
|
||||
elLabel[0].id = "scene_list_item_label_pointcloud_" + id;
|
||||
elLabel[0].htmlFor = "scene_list_item_pointcloud_" + id;
|
||||
elLabel.addClass("menu-item");
|
||||
elInput.click(function(event){
|
||||
pointcloud.visible = event.target.checked;
|
||||
});
|
||||
|
||||
elLi.append(elLabel);
|
||||
elLabel.append(elInput);
|
||||
elLabel.append(document.createTextNode(" point cloud " + id));
|
||||
|
||||
scenelist.append(elLi);
|
||||
|
||||
id++;
|
||||
}
|
||||
(function(pointcloud){
|
||||
var elLi = $('<li>');
|
||||
var elLabel = $('<label>');
|
||||
var elInput = $('<input type="checkbox">');
|
||||
|
||||
elInput[0].checked = true;
|
||||
elInput[0].id = "scene_list_item_pointcloud_" + id;
|
||||
elLabel[0].id = "scene_list_item_label_pointcloud_" + id;
|
||||
elLabel[0].htmlFor = "scene_list_item_pointcloud_" + id;
|
||||
elLabel.addClass("menu-item");
|
||||
elInput.click(function(event){
|
||||
pointcloud.visible = event.target.checked;
|
||||
if(viewer._2dprofile){
|
||||
viewer._2dprofile.redraw();
|
||||
}
|
||||
});
|
||||
|
||||
elLi.append(elLabel);
|
||||
elLabel.append(elInput);
|
||||
var pointcloudName = " " + (pointcloud.name ? pointcloud.name : "point cloud " + id);
|
||||
var elPointCloudName = document.createTextNode(pointcloudName);
|
||||
elLabel.append(elPointCloudName);
|
||||
|
||||
scenelist.append(elLi);
|
||||
|
||||
pointcloud.addEventListener("name_changed", function(e){
|
||||
if(e.name){
|
||||
elPointCloudName.textContent = " " + e.name;
|
||||
}else{
|
||||
elPointCloudName.textContent = " point cloud " + id;
|
||||
}
|
||||
});
|
||||
|
||||
id++;
|
||||
})(pointcloud);
|
||||
};
|
||||
|
||||
for(var i = 0; i < viewer.pointclouds.length; i++){
|
||||
var pointcloud = viewer.pointclouds[i];
|
||||
|
||||
@ -350,6 +350,7 @@ Potree.PointCloudOctree = function(geometry, material){
|
||||
this.pickTarget = null;
|
||||
this.generateDEM = false;
|
||||
this.profileRequests = [];
|
||||
this.name = "";
|
||||
|
||||
// TODO read projection from file instead
|
||||
this.projection = geometry.projection;
|
||||
@ -359,6 +360,17 @@ Potree.PointCloudOctree = function(geometry, material){
|
||||
|
||||
Potree.PointCloudOctree.prototype = Object.create(Potree.PointCloudTree.prototype);
|
||||
|
||||
Potree.PointCloudOctree.prototype.setName = function(name){
|
||||
if(this.name !== name){
|
||||
this.name = name;
|
||||
this.dispatchEvent({type: "name_changed", name: name, pointcloud: this});
|
||||
}
|
||||
};
|
||||
|
||||
Potree.PointCloudOctree.prototype.getName = function(){
|
||||
return this.name;
|
||||
};
|
||||
|
||||
Potree.PointCloudOctree.prototype.toTreeNode = function(geometryNode, parent){
|
||||
var node = new Potree.PointCloudOctreeNode();
|
||||
var sceneNode = new THREE.PointCloud(geometryNode.geometry, pointcloud.material);
|
||||
|
||||
@ -111,6 +111,7 @@ Potree.PointCloudArena4D = function(geometry){
|
||||
this.material.sizeType = Potree.PointSizeType.ATTENUATED;
|
||||
this.material.size = 0.05;
|
||||
this.profileRequests = [];
|
||||
this.name = "";
|
||||
|
||||
this.pickTarget;
|
||||
this.pickMaterial;
|
||||
@ -120,6 +121,17 @@ Potree.PointCloudArena4D = function(geometry){
|
||||
|
||||
Potree.PointCloudArena4D.prototype = new Potree.PointCloudTree();
|
||||
|
||||
Potree.PointCloudOctree.prototype.setName = function(name){
|
||||
if(this.name !== name){
|
||||
this.name = name;
|
||||
this.dispatchEvent({type: "name_changed", name: name, pointcloud: this});
|
||||
}
|
||||
};
|
||||
|
||||
Potree.PointCloudOctree.prototype.getName = function(){
|
||||
return this.name;
|
||||
};
|
||||
|
||||
Potree.PointCloudArena4D.prototype.toTreeNode = function(geometryNode, parent){
|
||||
var node = new Potree.PointCloudArena4DNode();
|
||||
var sceneNode = new THREE.PointCloud(geometryNode.geometry, pointcloud.material);
|
||||
|
||||
@ -417,7 +417,6 @@ Potree.Viewer.Profile = function(viewer, element){
|
||||
};
|
||||
|
||||
this.draw = function(profile){
|
||||
// TODO handle all pointclouds
|
||||
// TODO are the used closures safe for garbage collection?
|
||||
|
||||
if(!scope.enabled){
|
||||
@ -648,6 +647,11 @@ Potree.Viewer.Profile = function(viewer, element){
|
||||
|
||||
for(var i = 0; i < scope.viewer.pointclouds.length; i++){
|
||||
var pointcloud = scope.viewer.pointclouds[i];
|
||||
|
||||
if(!pointcloud.visible){
|
||||
continue;
|
||||
}
|
||||
|
||||
var request = pointcloud.getPointsInProfile(profile, null, {
|
||||
"onProgress": function(event){
|
||||
if(!scope.enabled){
|
||||
|
||||
@ -990,28 +990,44 @@ function initSceneList(){
|
||||
var scenelist = $('#sceneList');
|
||||
|
||||
var id = 0;
|
||||
// this works but it looks so wrong. any better way to create a closure around pointcloud?
|
||||
var addPointcloud = function(pointcloud){
|
||||
var elLi = $('<li>');
|
||||
var elLabel = $('<label>');
|
||||
var elInput = $('<input type="checkbox">');
|
||||
|
||||
elInput[0].checked = true;
|
||||
elInput[0].id = "scene_list_item_pointcloud_" + id;
|
||||
elLabel[0].id = "scene_list_item_label_pointcloud_" + id;
|
||||
elLabel[0].htmlFor = "scene_list_item_pointcloud_" + id;
|
||||
elLabel.addClass("menu-item");
|
||||
elInput.click(function(event){
|
||||
pointcloud.visible = event.target.checked;
|
||||
});
|
||||
|
||||
elLi.append(elLabel);
|
||||
elLabel.append(elInput);
|
||||
elLabel.append(document.createTextNode(" point cloud " + id));
|
||||
|
||||
scenelist.append(elLi);
|
||||
|
||||
id++;
|
||||
}
|
||||
(function(pointcloud){
|
||||
var elLi = $('<li>');
|
||||
var elLabel = $('<label>');
|
||||
var elInput = $('<input type="checkbox">');
|
||||
|
||||
elInput[0].checked = true;
|
||||
elInput[0].id = "scene_list_item_pointcloud_" + id;
|
||||
elLabel[0].id = "scene_list_item_label_pointcloud_" + id;
|
||||
elLabel[0].htmlFor = "scene_list_item_pointcloud_" + id;
|
||||
elLabel.addClass("menu-item");
|
||||
elInput.click(function(event){
|
||||
pointcloud.visible = event.target.checked;
|
||||
if(viewer._2dprofile){
|
||||
viewer._2dprofile.redraw();
|
||||
}
|
||||
});
|
||||
|
||||
elLi.append(elLabel);
|
||||
elLabel.append(elInput);
|
||||
var pointcloudName = " " + (pointcloud.name ? pointcloud.name : "point cloud " + id);
|
||||
var elPointCloudName = document.createTextNode(pointcloudName);
|
||||
elLabel.append(elPointCloudName);
|
||||
|
||||
scenelist.append(elLi);
|
||||
|
||||
pointcloud.addEventListener("name_changed", function(e){
|
||||
if(e.name){
|
||||
elPointCloudName.textContent = " " + e.name;
|
||||
}else{
|
||||
elPointCloudName.textContent = " point cloud " + id;
|
||||
}
|
||||
});
|
||||
|
||||
id++;
|
||||
})(pointcloud);
|
||||
};
|
||||
|
||||
for(var i = 0; i < viewer.pointclouds.length; i++){
|
||||
var pointcloud = viewer.pointclouds[i];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user