import Group from 'zrender/src/container/Group'; import Rect from 'zrender/src/graphic/shape/Rect'; 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; this.isShowShape = true; this.z = 0; this.create(); this.setState(model); this.setShowMode(); } 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) { if (!this.isShowShape) return; } // 设置显示模式 setShowMode() { const showMode = this.model.showMode; const showConditions = this.model.showConditions; if (showMode == '04') { this.box && this.box.hide(); return; } if (!showConditions || showConditions === '01' || showMode === showConditions) { this.box && this.box.show(); this.setState(this.model); } else { this.box && this.box.hide(); } } 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; } } screenShow() { this.box && this.box.hide(); } getAnchorPoint() { return { x: this.model.position.x - this.model.width / 2, y: this.model.position.y - this.model.height / 2 }; } }