140 lines
5.9 KiB
JavaScript
140 lines
5.9 KiB
JavaScript
import Group from 'zrender/src/container/Group';
|
|
import Text from 'zrender/src/graphic/Text';
|
|
|
|
export default class EDeviceStatus extends Group {
|
|
constructor(model) {
|
|
super();
|
|
this.model = model;
|
|
this.zlevel = model.zlevel;
|
|
this._subType = model._subType;
|
|
this.z = model.z;
|
|
this.create(model);
|
|
}
|
|
create(model) {
|
|
this.psd = new Text({
|
|
zlevel: this.zlevel,
|
|
z: this.z,
|
|
style: {
|
|
x: model.x,
|
|
y: model.y,
|
|
fontWeight: model.style.textStyle.fontWeight,
|
|
fontSize: model.style.FaultStatusGroup.fontSize,
|
|
fontFamily: model.style.fontFamily,
|
|
text: model.style.FaultStatusGroup.psd.text,
|
|
textFill: model.style.FaultStatusGroup.psd.defaultColor,
|
|
textAlign: model.style.textStyle.textAlign,
|
|
textVerticalAlign: model.style.textStyle.textVerticalAlign
|
|
}
|
|
});
|
|
this.mfList = [];
|
|
for (let i = 0; i < model.mfNum; i++) {
|
|
const mf = new Text({
|
|
zlevel: this.zlevel,
|
|
z: this.z,
|
|
style: {
|
|
x: model.x + model.style.FaultStatusGroup.distance * (i + 1),
|
|
y: model.y,
|
|
fontWeight: model.style.textStyle.fontWeight,
|
|
fontSize: model.style.FaultStatusGroup.fontSize,
|
|
fontFamily: model.style.fontFamily,
|
|
text: model.style.FaultStatusGroup.mf.text + String.fromCharCode((65 + i)),
|
|
textFill: model.style.FaultStatusGroup.mf.defaultColor,
|
|
textAlign: model.style.textStyle.textAlign,
|
|
textVerticalAlign: model.style.textStyle.textVerticalAlign
|
|
}
|
|
});
|
|
this.mfList.push(mf);
|
|
}
|
|
this.pfList = [];
|
|
for (let i = 0; i < model.pfNum; i++) {
|
|
const pf = new Text({
|
|
zlevel: this.zlevel,
|
|
z: this.z,
|
|
style: {
|
|
x: model.x + model.style.FaultStatusGroup.distance * (this.mfList.length + i + 1),
|
|
y: model.y,
|
|
fontWeight: model.style.textStyle.fontWeight,
|
|
fontSize: model.style.FaultStatusGroup.fontSize,
|
|
fontFamily: model.style.fontFamily,
|
|
text: model.style.FaultStatusGroup.pf.text + String.fromCharCode((65 + i)),
|
|
textFill: model.style.FaultStatusGroup.pf.defaultColor,
|
|
textAlign: model.style.textStyle.textAlign,
|
|
textVerticalAlign: model.style.textStyle.textVerticalAlign
|
|
}
|
|
});
|
|
this.pfList.push(pf);
|
|
}
|
|
this.mfList.forEach(item => {
|
|
this.add(item);
|
|
});
|
|
this.pfList.forEach(item => {
|
|
this.add(item);
|
|
});
|
|
// this.mfa = new Text({
|
|
// zlevel: this.zlevel,
|
|
// z: this.z,
|
|
// style: {
|
|
// x: model.x + model.style.FaultStatusGroup.distance,
|
|
// y: model.y,
|
|
// fontWeight: model.style.textStyle.fontWeight,
|
|
// fontSize: model.style.FaultStatusGroup.fontSize,
|
|
// fontFamily: model.style.fontFamily,
|
|
// text: model.style.FaultStatusGroup.mfa.text,
|
|
// textFill: model.style.FaultStatusGroup.mfa.defaultColor,
|
|
// textAlign: model.style.textStyle.textAlign,
|
|
// textVerticalAlign: model.style.textStyle.textVerticalAlign
|
|
// }
|
|
// });
|
|
// this.mfb = new Text({
|
|
// zlevel: this.zlevel,
|
|
// z: this.z,
|
|
// style: {
|
|
// x: model.x + model.style.FaultStatusGroup.distance * 2,
|
|
// y: model.y,
|
|
// fontWeight: model.style.textStyle.fontWeight,
|
|
// fontSize: model.style.FaultStatusGroup.fontSize,
|
|
// fontFamily: model.style.fontFamily,
|
|
// text: model.style.FaultStatusGroup.mfb.text,
|
|
// textFill: model.style.FaultStatusGroup.mfb.defaultColor,
|
|
// textAlign: model.style.textStyle.textAlign,
|
|
// textVerticalAlign: model.style.textStyle.textVerticalAlign
|
|
// }
|
|
// });
|
|
// this.pfa = new Text({
|
|
// zlevel: this.zlevel,
|
|
// z: this.z,
|
|
// style: {
|
|
// x: model.x + model.style.FaultStatusGroup.distance * 3,
|
|
// y: model.y,
|
|
// fontWeight: model.style.textStyle.fontWeight,
|
|
// fontSize: model.style.FaultStatusGroup.fontSize,
|
|
// fontFamily: model.style.fontFamily,
|
|
// text: model.style.FaultStatusGroup.pfa.text,
|
|
// textFill: model.style.FaultStatusGroup.pfa.defaultColor,
|
|
// textAlign: model.style.textStyle.textAlign,
|
|
// textVerticalAlign: model.style.textStyle.textVerticalAlign
|
|
// }
|
|
// });
|
|
// this.pfb = new Text({
|
|
// zlevel: this.zlevel,
|
|
// z: this.z,
|
|
// style: {
|
|
// x: model.x + model.style.FaultStatusGroup.distance * 4,
|
|
// y: model.y,
|
|
// fontWeight: model.style.textStyle.fontWeight,
|
|
// fontSize: model.style.FaultStatusGroup.fontSize,
|
|
// fontFamily: model.style.fontFamily,
|
|
// text: model.style.FaultStatusGroup.pfb.text,
|
|
// textFill: model.style.FaultStatusGroup.pfb.defaultColor,
|
|
// textAlign: model.style.textStyle.textAlign,
|
|
// textVerticalAlign: model.style.textStyle.textVerticalAlign
|
|
// }
|
|
// });
|
|
this.add(this.psd);
|
|
this.add(this.mfa);
|
|
this.add(this.mfb);
|
|
this.add(this.pfa);
|
|
this.add(this.pfb);
|
|
}
|
|
}
|