2020-03-05 15:48:51 +08:00
|
|
|
import Group from 'zrender/src/container/Group';
|
|
|
|
import Rect from 'zrender/src/graphic/shape/Rect';
|
2020-03-11 15:10:08 +08:00
|
|
|
import {isShowThePrdType} from '../../utils/handlePath';
|
2020-03-05 15:48:51 +08:00
|
|
|
|
|
|
|
export default class OutFrame extends Group {
|
|
|
|
constructor(model, style) {
|
|
|
|
super();
|
|
|
|
this.model = model;
|
|
|
|
this._type = model._type;
|
|
|
|
this._code = model.code;
|
|
|
|
this.style = style;
|
|
|
|
this.zlevel = model.zlevel;
|
2020-03-13 13:01:58 +08:00
|
|
|
this.isShowShape = true;
|
2020-03-05 15:48:51 +08:00
|
|
|
this.z = 0;
|
2020-03-11 15:10:08 +08:00
|
|
|
if (isShowThePrdType(model.prdType, model.showConditions) || model.previewOrMapDraw) {
|
2020-03-10 09:49:05 +08:00
|
|
|
this.create();
|
|
|
|
this.setState(model);
|
|
|
|
}
|
2020-03-11 15:10:08 +08:00
|
|
|
if (model.previewOrMapDraw) {
|
|
|
|
this.setShowMode();
|
|
|
|
}
|
2020-03-05 15:48:51 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
create() {
|
|
|
|
const model = this.model;
|
|
|
|
this.box = new Rect({
|
|
|
|
zlevel: this.zlevel,
|
|
|
|
z: this.z,
|
|
|
|
shape: {
|
|
|
|
x: model.position.x - model.width / 2,
|
|
|
|
y: model.position.y - model.height / 2,
|
|
|
|
width: model.width,
|
|
|
|
height: model.height
|
|
|
|
},
|
|
|
|
style: {
|
|
|
|
lineDash: null,
|
|
|
|
stroke: '#fff',
|
|
|
|
lineWidth: 1,
|
|
|
|
fill: 'rgb(135,206,250,0)'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
this.add(this.box);
|
|
|
|
}
|
|
|
|
|
|
|
|
// 设置状态
|
|
|
|
setState(model) {
|
2020-03-13 13:01:58 +08:00
|
|
|
if (!this.isShowShape) return;
|
2020-03-05 15:48:51 +08:00
|
|
|
}
|
2020-03-11 15:10:08 +08:00
|
|
|
// 设置显示模式
|
|
|
|
setShowMode() {
|
|
|
|
const showMode = this.model.showMode;
|
|
|
|
const showConditions = this.model.showConditions;
|
2020-05-12 16:45:45 +08:00
|
|
|
if (showMode == '04') {
|
|
|
|
this.box && this.box.hide();
|
|
|
|
return;
|
2020-12-09 17:08:36 +08:00
|
|
|
}
|
2020-03-11 15:10:08 +08:00
|
|
|
if (!showConditions || showConditions === '01' || showMode === showConditions) {
|
|
|
|
this.box && this.box.show();
|
2020-03-13 13:01:58 +08:00
|
|
|
this.setState(this.model);
|
2020-03-11 15:10:08 +08:00
|
|
|
} else {
|
|
|
|
this.box && this.box.hide();
|
|
|
|
}
|
|
|
|
}
|
2020-03-13 13:01:58 +08:00
|
|
|
setShowStation(stationCode) {
|
|
|
|
if (!stationCode || this.model.stationCode === stationCode) {
|
|
|
|
this.box && this.box.show();
|
|
|
|
this.isShowShape = true;
|
|
|
|
this.setState(this.model);
|
|
|
|
} else {
|
|
|
|
this.box && this.box.hide();
|
|
|
|
this.isShowShape = false;
|
|
|
|
}
|
|
|
|
}
|
2020-05-13 15:31:12 +08:00
|
|
|
screenShow() {
|
|
|
|
this.box && this.box.hide();
|
|
|
|
}
|
2020-03-05 15:48:51 +08:00
|
|
|
}
|