fix deletion of point cloud

This commit is contained in:
Tim Wundenberg
2021-08-10 21:01:15 +02:00
parent 97c84bbd23
commit 5769b91229
2 changed files with 23 additions and 4 deletions

View File

@@ -79578,6 +79578,10 @@ ENDSEC
tree.jstree('uncheck_node', node);
}
});
pointcloud.addEventListener("remove", () => {
const nodeObj = tree.jstree(true).get_node(node);
tree.jstree(true).delete_node(nodeObj);
});
};
let onMeasurementAdded = (e) => {

View File

@@ -88,10 +88,25 @@
loadByPc(pointClouds[i])
}
}
let notFound = [...loadedPointClouds.filter(pc => pointClouds.find(ipc => ipc.id === pc.id) === null)];
for (let entry in notFound) {
// entry.pointCloud
//TODO: Remove from Potree
for (let entry in loadedPointClouds) {
if (pointClouds.find(ipc => ipc.id === loadedPointClouds[entry].id))
continue;
const index = viewer.scene.pointclouds.indexOf(loadedPointClouds[entry].pointCloud);
if (index > -1) {
window.viewer.scene.pointclouds.forEach(function (layer) {
if (layer === loadedPointClouds[entry].pointCloud)
window.viewer.scene.scenePointCloud.remove(layer);
});
viewer.scene.pointclouds.splice(index, 1);
loadedPointClouds[entry].pointCloud.dispatchEvent({
type: "remove"
});
loadedPointClouds.splice(entry, 1);
}
}
}