2019-07-15 15:56:41 +08:00
|
|
|
/*
|
|
|
|
* lC区域控制模式
|
|
|
|
*/
|
|
|
|
import Group from 'zrender/src/container/Group';
|
2019-07-18 10:05:16 +08:00
|
|
|
import EControl from '../element/EControl';
|
2019-07-15 15:56:41 +08:00
|
|
|
|
|
|
|
export default class LcControl extends Group {
|
|
|
|
constructor({ _code, _type, zlevel, model, state }, style) {
|
2019-07-16 12:01:43 +08:00
|
|
|
super();
|
2019-07-15 15:56:41 +08:00
|
|
|
this.z = 20;
|
|
|
|
this._code = _code;
|
|
|
|
this._type = _type;
|
|
|
|
this.zlevel = zlevel;
|
|
|
|
this.model = model;
|
|
|
|
this.state = state;
|
|
|
|
this.style = style;
|
|
|
|
this._create();
|
|
|
|
}
|
|
|
|
|
|
|
|
_create() {
|
|
|
|
const model = this.model;
|
|
|
|
const state = this.state;
|
2019-07-17 09:08:23 +08:00
|
|
|
this.control = new EControl({
|
2019-07-15 15:56:41 +08:00
|
|
|
zlevel: this.zlevel,
|
|
|
|
z: this.z,
|
2019-07-17 09:08:23 +08:00
|
|
|
arc: {
|
|
|
|
shape: {
|
|
|
|
cx: model.position.x,
|
|
|
|
cy: model.position.y,
|
|
|
|
r: this.style.zcControlmodeR
|
|
|
|
},
|
2019-07-15 15:56:41 +08:00
|
|
|
lineWidth: 0,
|
2019-07-17 09:08:23 +08:00
|
|
|
fill: this.style.lcControlColor
|
|
|
|
},
|
|
|
|
text: {
|
|
|
|
position: [0, 0],
|
2019-07-15 15:56:41 +08:00
|
|
|
x: model.position.x,
|
|
|
|
y: model.position.y + this.style.zcControlmodeR + this.style.nameDistance,
|
2019-07-24 13:50:37 +08:00
|
|
|
fontWeight: 'normal',
|
|
|
|
fontSize: this.style.stationControlTextSize,
|
|
|
|
fontFamily: this.style.textFontFormat,
|
2019-07-15 15:56:41 +08:00
|
|
|
text: model.name,
|
2019-07-17 09:08:23 +08:00
|
|
|
textFill: '#fff',
|
2019-07-15 15:56:41 +08:00
|
|
|
textAlign: 'middle',
|
2019-07-24 13:50:37 +08:00
|
|
|
textVerticalAlign: 'top'
|
2019-07-17 09:08:23 +08:00
|
|
|
},
|
|
|
|
style: this.style
|
2019-07-15 15:56:41 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
this.add(this.control);
|
|
|
|
this.setState(state);
|
|
|
|
}
|
|
|
|
|
|
|
|
// 设置状态
|
|
|
|
setState(state) {}
|
|
|
|
|
|
|
|
getShapeTipPoint() {
|
|
|
|
if (this.control) {
|
|
|
|
var distance = 2;
|
|
|
|
var rect = this.control.getBoundingRect();
|
|
|
|
return {
|
|
|
|
x: rect.x + rect.width / 2,
|
|
|
|
y: rect.y - distance
|
|
|
|
};
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|