2020-04-13 17:12:33 +08:00
|
|
|
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,
|
2020-04-13 17:12:33 +08:00
|
|
|
y2: model.y
|
|
|
|
},
|
|
|
|
style: {
|
2020-04-14 15:45:13 +08:00
|
|
|
lineWidth: model.style.Axle.lineWidth,
|
|
|
|
stroke: model.style.Axle.strokeColor
|
2020-04-13 17:12:33 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
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,
|
2020-04-13 17:12:33 +08:00
|
|
|
cy: model.y,
|
2020-04-14 15:45:13 +08:00
|
|
|
r: model.style.Axle.radiusR
|
2020-04-13 17:12:33 +08:00
|
|
|
},
|
|
|
|
style: {
|
|
|
|
lineWidth: 0,
|
2020-04-14 15:45:13 +08:00
|
|
|
fill: model.style.Axle.fillColor,
|
|
|
|
stroke: model.style.Axle.strokeColor
|
2020-04-13 17:12:33 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
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,
|
2020-04-13 17:12:33 +08:00
|
|
|
y1: model.y,
|
2020-04-14 15:45:13 +08:00
|
|
|
x2: model.x + model.style.Axle.lineLength * 2 + model.style.Axle.distance,
|
2020-04-13 17:12:33 +08:00
|
|
|
y2: model.y
|
|
|
|
},
|
|
|
|
style: {
|
2020-04-14 15:45:13 +08:00
|
|
|
lineWidth: model.style.Axle.lineWidth,
|
|
|
|
stroke: model.style.Axle.strokeColor
|
2020-04-13 17:12:33 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
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,
|
2020-04-13 17:12:33 +08:00
|
|
|
cy: model.y,
|
2020-04-14 15:45:13 +08:00
|
|
|
r: model.style.Axle.radiusR
|
2020-04-13 17:12:33 +08:00
|
|
|
},
|
|
|
|
style: {
|
|
|
|
lineWidth: 0,
|
2020-04-14 15:45:13 +08:00
|
|
|
fill: model.style.Axle.fillColor,
|
|
|
|
stroke: model.style.Axle.strokeColor
|
2020-04-13 17:12:33 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
this.add(this.line1);
|
|
|
|
this.add(this.line2);
|
|
|
|
this.add(this.arc1);
|
|
|
|
this.add(this.arc2);
|
|
|
|
}
|
|
|
|
}
|