Textured model display, cleanup, error handling, miscellaneous cleanup

pull/128/head
Piero Toffanin 2017-03-23 09:30:53 -04:00
rodzic b2e0a9b1b2
commit a2f146b725
3 zmienionych plików z 24 dodań i 20 usunięć

Wyświetl plik

@ -89,22 +89,17 @@ class ModelView extends React.Component {
// Sigeom // Sigeom
Potree.loadPointCloud(this.potreeFilePath(), "", e => { Potree.loadPointCloud(this.potreeFilePath(), "", e => {
if (e.type == "loading_failed"){
this.setState({error: "Could not load point cloud. This task doesn't seem to have one. Try processing the task again."});
return;
}
let scene = viewer.scene; let scene = viewer.scene;
scene.addPointCloud(e.pointcloud); scene.addPointCloud(e.pointcloud);
this.pointCloud = e.pointcloud; this.pointCloud = e.pointcloud;
//scene.view.position.set(589974.341, 231698.397, 986.146); viewer.fitToScreen();
//scene.view.lookAt(new THREE.Vector3(589851.587, 231428.213, 715.634)); });
viewer.fitToScreen();
});
// if (error){
// console.log(error);
// this.setState({error: "Could not load point cloud. This task doesn't seem to have one. Try processing the task again."});
// return;
// }
} }
toggleTexturedModel(e){ toggleTexturedModel(e){
@ -149,7 +144,9 @@ class ModelView extends React.Component {
viewer.scene.scene.add(object); viewer.scene.scene.add(object);
this.modelReference = object; this.modelReference = object;
this.pointCloud.visible = false;
this.viewerOpacity = viewer.getOpacity();
viewer.setOpacity(0);
this.setState({ this.setState({
initializingModel: false, initializingModel: false,
@ -159,11 +156,14 @@ class ModelView extends React.Component {
}else{ }else{
// Already initialized // Already initialized
this.modelReference.visible = true; this.modelReference.visible = true;
this.pointCloud.visible = false;
this.viewerOpacity = viewer.getOpacity();
viewer.setOpacity(0);
} }
}else{ }else{
this.modelReference.visible = false; this.modelReference.visible = false;
this.pointCloud.visible = true;
viewer.setOpacity(this.viewerOpacity);
} }
} }

Wyświetl plik

@ -2,11 +2,11 @@
@import '../vendor/potree/js/jquery-ui.css'; @import '../vendor/potree/js/jquery-ui.css';
[data-modelview]{ [data-modelview]{
height: 100%; height: 90%;
} }
.model-view{ .model-view{
position: relative; position: relative;
height: 80%; height: 100%;
canvas{ canvas{
width: 100% !important; width: 100% !important;
@ -36,7 +36,7 @@
} }
} }
} }
input[type="checkbox"]{ input[type="checkbox"]{
position: relative; position: relative;
top: 2px; top: 2px;

Wyświetl plik

@ -1849,6 +1849,10 @@ Potree.POCLoader.load = function load(url, callback) {
callback(pco); callback(pco);
} }
}; };
xhr.onloadend = function() {
if(xhr.status == 404) callback();
};
xhr.send(null); xhr.send(null);
}catch(e){ }catch(e){
@ -12641,8 +12645,8 @@ Potree.Scene = class extends THREE.EventDispatcher{
var light = new THREE.AmbientLight( 0x555555 ); // soft white light var light = new THREE.AmbientLight( 0x555555 ); // soft white light
this.scenePointCloud.add( light ); this.scenePointCloud.add( light );
let grid = Potree.utils.createGrid(5, 5, 2); // let grid = Potree.utils.createGrid(5, 5, 2);
this.scene.add(grid); // this.scene.add(grid);
{// background {// background
// var texture = THREE.ImageUtils.loadTexture( Potree.resourcePath + '/textures/background.gif' ); // var texture = THREE.ImageUtils.loadTexture( Potree.resourcePath + '/textures/background.gif' );