49 lines
898 B
JavaScript
49 lines
898 B
JavaScript
import Polygon from 'zrender/src/graphic/shape/Polygon';
|
|
import Group from 'zrender/src/container/Group';
|
|
import { triangular } from '../utils/ShapePoints';
|
|
|
|
class ESigDrict extends Group {
|
|
constructor(model) {
|
|
super();
|
|
this.model = model;
|
|
this.isNew = false;
|
|
}
|
|
|
|
_create() {
|
|
if (!this.isNew) {
|
|
const model = this.model;
|
|
const style = this.model.style;
|
|
|
|
this.isNew = true;
|
|
this.sigDrict = new Polygon({
|
|
zlevel: model.zlevel,
|
|
z: model.z,
|
|
shape: {
|
|
points: triangular(model.x, model.y, model.drict, style.Signal.lamp.signalR)
|
|
},
|
|
style: {
|
|
stroke: style.backgroundColor,
|
|
lineWidth: 0.5,
|
|
fill: style.Signal.route.signalRouteColor
|
|
}
|
|
});
|
|
|
|
this.add(this.sigDrict);
|
|
}
|
|
}
|
|
|
|
// 隐藏
|
|
hide() {
|
|
this._create();
|
|
this.sigDrict.hide();
|
|
}
|
|
|
|
// 显示
|
|
show() {
|
|
this._create();
|
|
this.sigDrict.show();
|
|
}
|
|
}
|
|
|
|
export default ESigDrict;
|