Browse Source

添加输油管线展示属性

dev
刘向辉 3 years ago
parent
commit
a07fda0434
  1. 28
      src/app/babylon/game.ts
  2. 11
      src/app/babylon/model/data/institution/facility/property-data/in/property-data-sygx.ts
  3. 15
      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;
// }());

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

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

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

@ -136,6 +136,9 @@ export class BabylonTool {
console.log("异步加载模型" + path + sceneFilename);
let modelPath = path + sceneFilename;
LoadTool.add(modelPath, tag);
let isSuccess = false;
let plugin =
SceneLoader.ImportMeshAsync(
meshNames,
path,
@ -144,11 +147,23 @@ export class BabylonTool {
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