|
@@ -63680,7 +63680,7 @@ void main() {
|
|
|
}
|
|
|
|
|
|
Potree.settings.sizeFitToLevel = true;//当type为衰减模式时自动根据level调节大小。每长一级,大小就除以2
|
|
|
- Potree.loadPointCloudScene = function(sceneCode, done){//对应4dkk的场景码
|
|
|
+ Potree.loadPointCloudScene = function(sceneCode, done, onError){//对应4dkk的场景码
|
|
|
Potree.loadDatasets((data)=>{
|
|
|
var originDataset = data.find(e=>e.sceneCode == sceneCode);//只加载初始数据集
|
|
|
var cloudPath = `${Potree.settings.urls.prefix}/${Potree.settings.webSite}/${sceneCode}/data/${sceneCode}/webcloud/cloud.js`;
|
|
@@ -63722,10 +63722,10 @@ void main() {
|
|
|
viewer.scene.add360Images(viewer.images360); */
|
|
|
viewer.dispatchEvent('allLoaded');
|
|
|
done(pointcloud);
|
|
|
- });
|
|
|
+ },onError);
|
|
|
|
|
|
|
|
|
- }, sceneCode);
|
|
|
+ }, sceneCode, onError);
|
|
|
|
|
|
|
|
|
};
|
|
@@ -63787,7 +63787,7 @@ void main() {
|
|
|
|
|
|
|
|
|
let modelType, modelEditing, MergeEditor = viewer.modules.MergeEditor;
|
|
|
- Potree.addModel = function(prop, done, onprogress){ //加载模型
|
|
|
+ Potree.addModel = function(prop, done, onProgress, onError){ //加载模型
|
|
|
let isFirstLoad = !prop.position; //在编辑时用户添加的
|
|
|
|
|
|
let loadDone = (model)=>{
|
|
@@ -63865,7 +63865,7 @@ void main() {
|
|
|
viewer.outlinePass.selectedObjects = []
|
|
|
}) */
|
|
|
|
|
|
- });
|
|
|
+ }, onError);
|
|
|
}else {
|
|
|
|
|
|
|
|
@@ -63922,7 +63922,7 @@ void main() {
|
|
|
info.objurl = prop.url;
|
|
|
info.mtlurl = prop.mtlurl;
|
|
|
}
|
|
|
- viewer.loadModel(info ,callback,onprogress);
|
|
|
+ viewer.loadModel(info , callback, onProgress, onError);
|
|
|
|
|
|
}
|
|
|
};
|
|
@@ -127301,7 +127301,7 @@ ENDSEC
|
|
|
}
|
|
|
*/
|
|
|
|
|
|
- loadModel(fileInfo, done, onProgress_){
|
|
|
+ loadModel(fileInfo, done, onProgress_, onError){
|
|
|
let boundingBox = new Box3();
|
|
|
if(!Potree.settings.boundAddObjs){
|
|
|
boundingBox.min.set(-0.5,-0.5,-0.5); boundingBox.max.set(0.5,0.5,0.5);
|
|
@@ -127392,7 +127392,8 @@ ENDSEC
|
|
|
console.log( item, loaded, total );
|
|
|
}; */
|
|
|
|
|
|
- let onError = function ( xhr ) {};
|
|
|
+ /* let onError = function ( xhr ) {
|
|
|
+ }; */
|
|
|
|
|
|
loaders.mtlLoader.load( fileInfo.mtlurl , (materials)=>{
|
|
|
materials.preload();
|
|
@@ -127400,14 +127401,14 @@ ENDSEC
|
|
|
loaders.objLoader.setMaterials( materials ).load(fileInfo.objurl, (object)=>{
|
|
|
loadDone(object);
|
|
|
});
|
|
|
- } , onProgress, /*onError */ );
|
|
|
+ } , onProgress, onError );
|
|
|
|
|
|
}else if(fileType == 'glb'){
|
|
|
loaders.glbLoader.load(fileInfo.glburl, ( gltf )=>{ //.setPath( Potree.resourcePath + '/models/glb/' );
|
|
|
|
|
|
console.log('loadGLTF', gltf);
|
|
|
loadDone(gltf.scene);
|
|
|
- }, onProgress);
|
|
|
+ }, onProgress, onError);
|
|
|
|
|
|
}
|
|
|
|
|
@@ -128186,24 +128187,29 @@ ENDSEC
|
|
|
|
|
|
|
|
|
|
|
|
- async function loadFile(path, callback){
|
|
|
+ async function loadFile(path, callback, onError){
|
|
|
if(Potree.fileServer){
|
|
|
Potree.fileServer.get(path).then(data=>{
|
|
|
callback && callback(data);
|
|
|
- });
|
|
|
+ }).fail(onError);
|
|
|
}else {
|
|
|
- let response = await fetch(path);
|
|
|
- let text = await response.text();
|
|
|
- var data = JSON.parse(text);
|
|
|
- if(data.data) data = data.data;
|
|
|
- callback && callback(data);
|
|
|
- return data
|
|
|
+ try{
|
|
|
+ let response = await fetch(path);
|
|
|
+ let text = await response.text();
|
|
|
+ var data = JSON.parse(text);
|
|
|
+ if(data.data) data = data.data;
|
|
|
+ callback && callback(data);
|
|
|
+ return data
|
|
|
+ }catch(e){
|
|
|
+ onError && onError(e);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
//查询: http://192.168.0.26:8080/doc.html#/default/filter-%E6%BC%AB%E6%B8%B8%E7%82%B9/filterUsingGET
|
|
|
}
|
|
|
|
|
|
- async function loadDatasets(callback,sceneCode){//之后直接把path写进来
|
|
|
+ async function loadDatasets(callback,sceneCode,onError){//之后直接把path写进来
|
|
|
let path;
|
|
|
sceneCode = sceneCode || Potree.settings.number;
|
|
|
if(Potree.fileServer){
|
|
@@ -128216,7 +128222,7 @@ ENDSEC
|
|
|
//path = `${Potree.scriptPath}/data/${sceneCode}/getDataSet.json`
|
|
|
|
|
|
}
|
|
|
- return loadFile(path, callback)
|
|
|
+ return loadFile(path, callback,onError)
|
|
|
|
|
|
}
|
|
|
|
|
@@ -128351,7 +128357,7 @@ ENDSEC
|
|
|
|
|
|
|
|
|
|
|
|
- function loadPointCloud$1(path, name, sceneCode, timeStamp, callback){
|
|
|
+ function loadPointCloud$1(path, name, sceneCode, timeStamp, callback, onError){
|
|
|
let loaded = function(e){
|
|
|
e.pointcloud.name = name;
|
|
|
e.pointcloud.sceneCode = sceneCode; //对应4dkk的场景码
|
|
@@ -128380,6 +128386,7 @@ ENDSEC
|
|
|
if (!geometry) {
|
|
|
//callback({type: 'loading_failed'});
|
|
|
console.error(new Error(`failed to load point cloud from URL: ${path}`));
|
|
|
+ onError && onError();
|
|
|
} else {
|
|
|
let pointcloud = new PointCloudOctree(geometry);
|
|
|
// loaded(pointcloud);
|