|
@@ -34,7 +34,13 @@ class ModelContext {
|
|
|
// optional implementation
|
|
|
}
|
|
|
|
|
|
- /** 设置模型类型并切换,不同的类型通常对应不同的具体模型,在模型总控制器下的具体模型会根据传入的参数彼此交互、切换 */
|
|
|
+ /**
|
|
|
+ * 设置模型类型并切换,不同的类型通常对应不同的具体模型,在模型总控制器下的具体模型会根据传入的参数彼此交互、切换
|
|
|
+ *
|
|
|
+ * 本模型分为外侧(右侧)风机、内侧(左侧)风机,用户选择一个风机后,详情参数的框需要高亮,风机之间需要联动形成风流
|
|
|
+ *
|
|
|
+ * @param data 风机数据,第一项应为外侧(右侧)风机,第二项为内侧(左侧)
|
|
|
+ */
|
|
|
setModelType(modelType: 'inner' | 'outer' | string, data: any[]) {
|
|
|
const fanOuter1Run = get<string>(data[0], 'Fan1StartStatus', '0') == '1';
|
|
|
const fanInner1Run = get<string>(data[1], 'Fan1StartStatus', '0') == '1';
|
|
@@ -58,7 +64,7 @@ class ModelContext {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- execute(cmdname: string) {
|
|
|
+ private execute(cmdname: string) {
|
|
|
this.modules.forEach(({ name, context, behavior }) => {
|
|
|
if (name === cmdname) {
|
|
|
behavior(context);
|
|
@@ -71,6 +77,7 @@ class ModelContext {
|
|
|
this.model.setGLTFModel([this.modelName]).then(async (gltf) => {
|
|
|
this.group = gltf[0];
|
|
|
if (this.group) {
|
|
|
+ // 将管道由黑色不透光的材质修改为半透明材质
|
|
|
const material = new THREE.MeshBasicMaterial({
|
|
|
color: '#000',
|
|
|
transparent: true,
|
|
@@ -165,19 +172,71 @@ class ModelContext {
|
|
|
async initModules() {
|
|
|
if (this.elements.length > 0) return;
|
|
|
// 右侧风机-主风机进风
|
|
|
- const curveFan1Right = this.generateSmokePath(['dian', 'dian1', 'dian2', 'dian3', 'dian4', 'dian5', 'dian6', 'dian7', 'dian8'], true);
|
|
|
+ const curveFan1Right = this.generateSmokePath(
|
|
|
+ [
|
|
|
+ new THREE.Vector3(-85.69, 2.18, 51.89),
|
|
|
+ new THREE.Vector3(-85.69, 2.18, 41.89),
|
|
|
+ new THREE.Vector3(-85.69, 2.18, 35.32),
|
|
|
+ new THREE.Vector3(-85.69, 0.78, 33.08),
|
|
|
+ new THREE.Vector3(-85.69, 0.78, 27.84),
|
|
|
+ new THREE.Vector3(-85.69, 4.72, 21.56),
|
|
|
+ new THREE.Vector3(-85.69, 4.72, -13),
|
|
|
+ new THREE.Vector3(-26.2, 4.72, -13.24),
|
|
|
+ new THREE.Vector3(-25.61, 4.72, -47.03),
|
|
|
+ new THREE.Vector3(80.03, 4.72, -47.03),
|
|
|
+ ],
|
|
|
+ true
|
|
|
+ );
|
|
|
// 右侧风机-备风机进风
|
|
|
- const curveFan2Right = this.generateSmokePath(['dian9', 'dian10', 'dian2', 'dian3', 'dian4', 'dian5', 'dian6', 'dian7', 'dian8'], true);
|
|
|
+ const curveFan2Right = this.generateSmokePath(
|
|
|
+ [
|
|
|
+ new THREE.Vector3(-85.69, -0.53, 51.89),
|
|
|
+ new THREE.Vector3(-85.69, -0.53, 41.89),
|
|
|
+ new THREE.Vector3(-85.69, -0.51, 35.32),
|
|
|
+ new THREE.Vector3(-85.69, 0.78, 33.08),
|
|
|
+ new THREE.Vector3(-85.69, 0.78, 27.84),
|
|
|
+ new THREE.Vector3(-85.69, 4.72, 21.56),
|
|
|
+ new THREE.Vector3(-85.69, 4.72, -13),
|
|
|
+ new THREE.Vector3(-26.2, 4.72, -13.24),
|
|
|
+ new THREE.Vector3(-25.61, 4.72, -47.03),
|
|
|
+ new THREE.Vector3(80.03, 4.72, -47.03),
|
|
|
+ ],
|
|
|
+ true
|
|
|
+ );
|
|
|
// 左侧风机-主风机进风
|
|
|
- const curveFan1Left = this.generateSmokePath(['dian11', 'dian12', 'dian15', 'dian16', 'dian17'], true);
|
|
|
+ const curveFan1Left = this.generateSmokePath(
|
|
|
+ [
|
|
|
+ new THREE.Vector3(-85.69, 2.18, 12.72),
|
|
|
+ new THREE.Vector3(-85.69, 2.18, 2.72),
|
|
|
+ new THREE.Vector3(-85.69, 2.18, -3.85),
|
|
|
+ new THREE.Vector3(-85.69, 0.78, -6.09),
|
|
|
+ new THREE.Vector3(-85.69, 0.78, -12.92),
|
|
|
+ new THREE.Vector3(80.25, 0.78, -12.92),
|
|
|
+ ],
|
|
|
+ true
|
|
|
+ );
|
|
|
// 左侧风机-备风机进风
|
|
|
- const curveFan2Left = this.generateSmokePath(['dian14', 'dian13', 'dian15', 'dian16', 'dian17'], true);
|
|
|
+ const curveFan2Left = this.generateSmokePath(
|
|
|
+ [
|
|
|
+ new THREE.Vector3(-85.69, -0.53, 12.72),
|
|
|
+ new THREE.Vector3(-85.69, -0.53, 2.72),
|
|
|
+ new THREE.Vector3(-85.69, -0.51, -3.85),
|
|
|
+ new THREE.Vector3(-85.69, 0.78, -6.09),
|
|
|
+ new THREE.Vector3(-85.69, 0.78, -12.92),
|
|
|
+ new THREE.Vector3(80.25, 0.78, -12.92),
|
|
|
+ ],
|
|
|
+ true
|
|
|
+ );
|
|
|
// 右侧巷道-回风前段
|
|
|
- const curveTunnelRight = this.generateSmokePath(['dian18', 'dian19', 'dian20']);
|
|
|
+ const curveTunnelRight = this.generateSmokePath([
|
|
|
+ new THREE.Vector3(86.67, 0.78, -16.57),
|
|
|
+ new THREE.Vector3(30.11, 0.78, -16.57),
|
|
|
+ new THREE.Vector3(30.11, 0.78, -50.39),
|
|
|
+ ]);
|
|
|
// 左侧巷道-回风前段
|
|
|
- const curveTunnelLeft = this.generateSmokePath(['dian20', 'dian22']);
|
|
|
+ const curveTunnelLeft = this.generateSmokePath([new THREE.Vector3(30.11, 0.78, -50.39), new THREE.Vector3(-72.58, 0.78, -50.17)]);
|
|
|
// 左侧巷道-回风全长
|
|
|
- const curveTunnelMajor = this.generateSmokePath(['dian21', 'dian22']);
|
|
|
+ const curveTunnelMajor = this.generateSmokePath([new THREE.Vector3(86.55, 0.78, -50.39), new THREE.Vector3(-72.58, 0.78, -50.17)]);
|
|
|
|
|
|
const group1 = new THREE.Group();
|
|
|
const smokeFan1Right = new Smoke('/model/img/texture-smoke.png', '#ffffff', 1, 0.75, 0.5, 600);
|
|
@@ -379,13 +438,9 @@ class ModelContext {
|
|
|
}
|
|
|
|
|
|
/** 生成适用于 Smoke 的曲线数据,输入途径点,输出路径,如果是进风类型,首个线段将有扩散效果,出风则是末尾线段有扩散效果 */
|
|
|
- generateSmokePath(namelist: string[], airIn?: boolean, airOut?: boolean) {
|
|
|
+ generateSmokePath(points: THREE.Vector3[], airIn?: boolean, airOut?: boolean) {
|
|
|
if (!this.group) return;
|
|
|
const result: any[] = [];
|
|
|
- const points: THREE.Vector3[] = namelist.map((name) => {
|
|
|
- const obj = this.group?.getObjectByName(name);
|
|
|
- return obj?.position as THREE.Vector3;
|
|
|
- });
|
|
|
for (let index = 1; index < points.length; index++) {
|
|
|
const path0 = points[index - 1];
|
|
|
const path1 = points[index];
|
|
@@ -394,17 +449,17 @@ class ModelContext {
|
|
|
path1,
|
|
|
isSpread: false,
|
|
|
spreadDirection: 0,
|
|
|
- spreadRang: -10,
|
|
|
+ // spreadRang: -10,
|
|
|
};
|
|
|
- if (airIn) {
|
|
|
+ if (airIn && index === 1) {
|
|
|
// 首个线段需要扩散,由大变小
|
|
|
- path.isSpread = index === 1;
|
|
|
- path.spreadDirection = 0;
|
|
|
+ path.isSpread = true;
|
|
|
+ path.spreadDirection = -1;
|
|
|
}
|
|
|
- if (airOut) {
|
|
|
- // 首个线段需要扩散,由小变大
|
|
|
- path.isSpread = index === points.length - 1;
|
|
|
- path.spreadDirection = 0;
|
|
|
+ if (airOut && index === points.length - 1) {
|
|
|
+ // 末个线段需要扩散,由小变大
|
|
|
+ path.isSpread = false;
|
|
|
+ path.spreadDirection = 1;
|
|
|
}
|
|
|
if (!airIn && !airOut) {
|
|
|
path.isSpread = false;
|