Browse Source

添加输油管线展示属性

dev
刘向辉 3 years ago
parent
commit
a07fda0434
  1. 28
      src/app/babylon/game.ts
  2. 37
      src/app/babylon/model/data/institution/facility/property-data/in/property-data-sygx.ts
  3. 39
      src/app/babylon/tool/babylon-tool.ts

28
src/app/babylon/game.ts

@ -15,6 +15,10 @@ export class Game {
//初始化引擎和画布
public init(canvas: HTMLCanvasElement) {
// FileTools.DefaultRetryStrategy = MyRetryStrategy.ExponentialBackoff(2, 1000);
// FileTools.DefaultRetryStrategy = RetryStrategy.ExponentialBackoff(2, 1000);
Game.instance = this;
this.canvas = canvas;
this.engine = new Engine(canvas, null, { stencil: true });
@ -66,3 +70,27 @@ export class Game {
}
// /**
// * 重试策略
// */
// var MyRetryStrategy = /** @class */ (function () {
// function RetryStrategy() {
// }
// /**
// * Function used to defines an exponential back off strategy
// * @param maxRetries defines the maximum number of retries (3 by default)
// * @param baseInterval defines the interval between retries
// * @returns the strategy function to use
// */
// MyRetryStrategy.ExponentialBackoff = function (maxRetries, baseInterval) {
// if (maxRetries === void 0) { maxRetries = 3; }
// if (baseInterval === void 0) { baseInterval = 500; }
// return function (url, request, retryIndex) {
// if (request.status !== 0 || retryIndex >= maxRetries || url.indexOf("file:") !== -1) {
// return -1;
// }
// return Math.pow(2, retryIndex) * baseInterval;
// };
// };
// return MyRetryStrategy;
// }());

37
src/app/babylon/model/data/institution/facility/property-data/in/property-data-sygx.ts

@ -8,19 +8,30 @@ import { PropertyData_Base } from "../property-data-base";
*/
export class PropertyData_SYGX extends PropertyData_Base_IMG {
constructor(key: string) {
super(key, "", "", "", FacilityType.JY_SYGX);
this.name = "未命名";
}
/**
*
*/
linkJYJ: string;
/**
*
*/
linkYG: string;
clone(key: string) {
let result = new PropertyData_SYGX(key);
result.name = this.name;
result.img = this.img;
result.pos = this.pos;
result.info = this.info,
result.is360 = this.is360;
return result;
}
constructor(key: string) {
super(key, "", "", "", FacilityType.JY_SYGX);
this.name = "未命名";
}
clone(key: string) {
let result = new PropertyData_SYGX(key);
result.name = this.name;
result.img = this.img;
result.pos = this.pos;
result.info = this.info,
result.is360 = this.is360;
result.linkJYJ = this.linkJYJ;
result.linkYG = this.linkYG;
return result;
}
}

39
src/app/babylon/tool/babylon-tool.ts

@ -136,19 +136,34 @@ export class BabylonTool {
console.log("异步加载模型" + path + sceneFilename);
let modelPath = path + sceneFilename;
LoadTool.add(modelPath, tag);
SceneLoader.ImportMeshAsync(
meshNames,
path,
sceneFilename,
scene,
onProgress,
).then(function (result) {
LoadTool.remove(modelPath);
onSuccess(result.meshes, result.particleSystems, result.skeletons, result.animationGroups);
}).catch(function (result) {
onError(scene, "load error", result);
});
let isSuccess = false;
let plugin =
SceneLoader.ImportMeshAsync(
meshNames,
path,
sceneFilename,
scene,
onProgress,
).then(function (result) {
LoadTool.remove(modelPath);
isSuccess = true;
onSuccess(result.meshes, result.particleSystems, result.skeletons, result.animationGroups);
}).catch(function (result) {
onError(scene, "load error", result);
});
// setTimeout(() => {
// if (isSuccess == false) {
// (plugin as any)?.onDisposeObservable?.notifyObservers(plugin);
// }
// }, 1000);
}
/**

Loading…
Cancel
Save