|
@@ -0,0 +1,74 @@
|
|
|
+//火灾 控制类
|
|
|
+import vtkUnstructuredDataReader from "../reader/UnstructuredDataReader.js";
|
|
|
+import velocityDataReader from "../reader/VelocityDataReader.js";
|
|
|
+import { request, uploadFile } from "@/utils/request";
|
|
|
+
|
|
|
+export class gassControl {
|
|
|
+ constructor() {
|
|
|
+ //事故编号
|
|
|
+ this.aid = 5;
|
|
|
+ //当前步数
|
|
|
+ this.step;
|
|
|
+ //总步数
|
|
|
+ this.stepsum;
|
|
|
+ //url
|
|
|
+ this._url = import.meta.env.VITE_BASE_URL + "/TransServlet?channelNo=service&clientToken=e47b87eec69545559d1e81e56626da68&userId=5f06c8bc77234f969d13e160b54c27e3&aid=";
|
|
|
+ //几何数据
|
|
|
+ this.polydata;
|
|
|
+ //Scalars 数据 array[setp]=Map(scalars,value[points]=array),
|
|
|
+ this.scalars = new Map();
|
|
|
+ this.scalar = new Map();
|
|
|
+ this.reader = vtkUnstructuredDataReader.newInstance();
|
|
|
+ }
|
|
|
+ //获取总步数
|
|
|
+ async getStepsum(aid) {
|
|
|
+ this.aid =aid;
|
|
|
+ const params = {
|
|
|
+ transCode: 'D40003',
|
|
|
+ aid: this.aid,
|
|
|
+ }
|
|
|
+ request(params).then((res) => {
|
|
|
+ this.stepsum=res.steps;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ //几何数据初始化
|
|
|
+ async initGemetry(aid) {
|
|
|
+ this.aid =aid;
|
|
|
+ const url = this._url + this.aid + "&transCode=D400001";
|
|
|
+ await this.reader.setUrl(url).then(() => {
|
|
|
+ this.polydata = this.reader.getOutputData(0);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ //获取第几步标量数据
|
|
|
+ async getScalrsByStep(step) {
|
|
|
+ this.step = step;
|
|
|
+ if (this.scalars.get(step)) {
|
|
|
+ this.scalar = this.scalars.get(step);
|
|
|
+ } else {
|
|
|
+ const url = this._url + this.aid + "&transCode=D40002&step=" + this.step;
|
|
|
+ await this.reader.setUrl(url).then(() => {
|
|
|
+ const scalarMap = this.reader.getOutputData(1);
|
|
|
+ scalarMap.forEach(function(scalarVarry, skey) {
|
|
|
+ const replacedNumbers = scalarVarry.map(
|
|
|
+ value => {
|
|
|
+ if(isNaN(value)){
|
|
|
+ return 0;
|
|
|
+ }else{
|
|
|
+ return value
|
|
|
+ }
|
|
|
+ }
|
|
|
+ );
|
|
|
+ scalarMap.set(skey,replacedNumbers);
|
|
|
+
|
|
|
+ });
|
|
|
+ this.scalar = scalarMap;
|
|
|
+ this.scalars.set(step, scalarMap);
|
|
|
+ // console.log("获取"+ this.scalar);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+export function createGassControl() {
|
|
|
+ return new gassControl();
|
|
|
+}
|