rt-graphic-component/components/packages/Station/StationTemplate.js
2024-01-04 10:44:03 +08:00

39 lines
1.2 KiB
JavaScript

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 };