rt-graphic-component/components/Platform/PlatformTemplate.js
joylink_zhaoerwei 023058ebb0 测试站台
2024-01-03 09:30:56 +08:00

38 lines
1.2 KiB
JavaScript

import { JlGraphicTemplate } from 'jl-graphic';
import { JlPlatform } from './JlPlatform.js';
import { CategoryType } from './PlatformConfig.js';
import { XiAnPlatform } from './XiAnPlatform.js';
import { BeiJingPlatform } from './BeiJingPlatform.js';
class PlatformTemplate extends JlGraphicTemplate {
hasdoor;
direction;
categoryType;
constructor(dataTemplate, stateTemplate, categoryType) {
super(JlPlatform.Type, { dataTemplate, stateTemplate });
this.categoryType = categoryType;
switch (this.categoryType) {
case CategoryType.XiAn:
this.hasdoor = true;
this.direction = 'up';
break;
}
}
new() {
switch (this.categoryType) {
case CategoryType.BeiJing:
const BeiJing = new BeiJingPlatform();
BeiJing.loadData(this.datas);
BeiJing.loadState(this.states);
return BeiJing;
default:
const XiAn = new XiAnPlatform();
XiAn.loadData(this.datas);
XiAn.loadState(this.states);
return XiAn;
}
}
}
export { PlatformTemplate };