rt-graphic-component/components/packages/Station/StationTemplate.js

39 lines
1.2 KiB
JavaScript
Raw Normal View History

2024-01-03 13:35:59 +08:00
import { JlGraphicTemplate } from 'jl-graphic';
import { JlStation } from './JlStation.js';
import { XiAnStation } from './XiAnStation.js';
import { BeiJingStation } from './BeiJingStation.js';
import { CategoryType } from '../Platform/PlatformConfig.js';
class StationTemplate extends JlGraphicTemplate {
hasControl;
categoryType;
constructor(dataTemplate, stateTemplate, categoryType) {
super(JlStation.Type, {
dataTemplate,
stateTemplate,
});
this.categoryType = categoryType;
switch (this.categoryType) {
case CategoryType.XiAn:
this.hasControl = true;
break;
}
}
new() {
switch (this.categoryType) {
case CategoryType.BeiJing:
const BeiJing = new BeiJingStation();
BeiJing.loadData(this.datas);
BeiJing.loadState(this.states);
return BeiJing;
default:
const XiAn = new XiAnStation();
XiAn.loadData(this.datas);
XiAn.loadState(this.states);
return XiAn;
}
}
}
export { StationTemplate };