77 lines
2.3 KiB
JavaScript
77 lines
2.3 KiB
JavaScript
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,
|
|
x2: model.x + model.style.Axle.lineLength,
|
|
y2: model.y
|
|
},
|
|
style: {
|
|
lineWidth: model.style.Axle.lineWidth,
|
|
stroke: model.style.Axle.strokeColor
|
|
}
|
|
});
|
|
this.arc1 = new Arc({
|
|
zlevel: this.zlevel,
|
|
z: this.z,
|
|
shape: {
|
|
cx: model.x + model.style.Axle.distance,
|
|
cy: model.y,
|
|
r: model.style.Axle.radiusR
|
|
},
|
|
style: {
|
|
lineWidth: 0,
|
|
fill: model.style.Axle.fillColor,
|
|
stroke: model.style.Axle.strokeColor
|
|
}
|
|
});
|
|
this.line2 = new Line({
|
|
zlevel: this.zlevel,
|
|
z: this.z,
|
|
shape: {
|
|
x1: model.x + model.style.Axle.lineLength + model.style.Axle.distance,
|
|
y1: model.y,
|
|
x2: model.x + model.style.Axle.lineLength * 2 + model.style.Axle.distance,
|
|
y2: model.y
|
|
},
|
|
style: {
|
|
lineWidth: model.style.Axle.lineWidth,
|
|
stroke: model.style.Axle.strokeColor
|
|
}
|
|
});
|
|
this.arc2 = new Arc({
|
|
zlevel: this.zlevel,
|
|
z: this.z,
|
|
shape: {
|
|
cx: model.x + model.style.Axle.lineLength * 2,
|
|
cy: model.y,
|
|
r: model.style.Axle.radiusR
|
|
},
|
|
style: {
|
|
lineWidth: 0,
|
|
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);
|
|
}
|
|
}
|