rt-sim-training-client/src/jmapNew/shape/StationStand/EDetainCircle.js
2020-04-17 18:42:58 +08:00

68 lines
1.9 KiB
JavaScript

import Group from 'zrender/src/container/Group';
import Circle from 'zrender/src/graphic/shape/Circle';
import Line from 'zrender/src/graphic/shape/Line';
class EDetainCircle extends Group {
constructor(model) {
super();
this.model = model;
this.create();
}
create() {
const model = this.model;
const style = this.model.style;
this.detainCircle = new Circle({
zlevel: model.zlevel,
z: model.z,
shape: {
cx: model.x,
cy: model.y,
r: model.radius
},
style:{
lineWidth:2,
stroke:style.StationStand.detainCar.defaultColor
}
});
this.line1 = new Line({
zlevel: model.zlevel,
z: model.z,
shape:{
x1:model.x - model.radius * 0.7,
y1:model.y - model.radius * 0.7,
x2:model.x + model.radius * 0.7,
y2:model.y + model.radius * 0.7
},
style:{
lineWidth:2,
stroke:style.StationStand.detainCar.defaultColor
}
});
this.line2 = new Line({
zlevel: model.zlevel,
z: model.z,
shape:{
x1:model.x - model.radius * 0.7,
y1:model.y + model.radius * 0.7,
x2:model.x + model.radius * 0.7,
y2:model.y - model.radius * 0.7
},
style:{
lineWidth:2,
stroke:style.StationStand.detainCar.defaultColor
}
});
this.add(this.detainCircle);
this.add(this.line1);
this.add(this.line2);
}
setColor(color) {
this.detainCircle.setStyle('stroke', color);
this.line1.setStyle('stroke', color);
}
}
export default EDetainCircle;