rt-sim-training-client/src/jmap/shape/Signal/ESigRoute.js
2019-07-24 10:13:01 +08:00

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;