rt-sim-training-client/src/jmapNew/shape/SaidLamp/EAxle.js

77 lines
2.3 KiB
JavaScript
Raw Normal View History

import Group from 'zrender/src/container/Group';
import Arc from 'zrender/src/graphic/shape/Arc';
import Line from 'zrender/src/graphic/shape/Line';
export default class EAxle extends Group {
constructor(model) {
super();
this.model = model;
this.zlevel = model.zlevel;
this._subType = model._subType;
this.z = model.z;
this.create(model);
}
create(model) {
this.line1 = new Line({
zlevel: this.zlevel,
z: this.z,
shape: {
x1: model.x,
y1: model.y,
2020-04-14 15:45:13 +08:00
x2: model.x + model.style.Axle.lineLength,
y2: model.y
},
style: {
2020-04-14 15:45:13 +08:00
lineWidth: model.style.Axle.lineWidth,
stroke: model.style.Axle.strokeColor
}
});
this.arc1 = new Arc({
zlevel: this.zlevel,
z: this.z,
shape: {
2020-04-14 15:45:13 +08:00
cx: model.x + model.style.Axle.distance,
cy: model.y,
2020-04-14 15:45:13 +08:00
r: model.style.Axle.radiusR
},
style: {
lineWidth: 0,
2020-04-14 15:45:13 +08:00
fill: model.style.Axle.fillColor,
stroke: model.style.Axle.strokeColor
}
});
this.line2 = new Line({
zlevel: this.zlevel,
z: this.z,
shape: {
2020-04-14 15:45:13 +08:00
x1: model.x + model.style.Axle.lineLength + model.style.Axle.distance,
y1: model.y,
2020-04-14 15:45:13 +08:00
x2: model.x + model.style.Axle.lineLength * 2 + model.style.Axle.distance,
y2: model.y
},
style: {
2020-04-14 15:45:13 +08:00
lineWidth: model.style.Axle.lineWidth,
stroke: model.style.Axle.strokeColor
}
});
this.arc2 = new Arc({
zlevel: this.zlevel,
z: this.z,
shape: {
2020-04-14 15:45:13 +08:00
cx: model.x + model.style.Axle.lineLength * 2,
cy: model.y,
2020-04-14 15:45:13 +08:00
r: model.style.Axle.radiusR
},
style: {
lineWidth: 0,
2020-04-14 15:45:13 +08:00
fill: model.style.Axle.fillColor,
stroke: model.style.Axle.strokeColor
}
});
this.add(this.line1);
this.add(this.line2);
this.add(this.arc1);
this.add(this.arc2);
}
}