删除信号机多余元素

This commit is contained in:
zyy 2020-03-20 18:14:42 +08:00
parent 788737369a
commit 9280651ed4
3 changed files with 3 additions and 135 deletions

View File

@ -10,7 +10,7 @@ class ELowButton extends Group {
create() {
const model = this.model;
const style = this.model.style;
const style = this.model.style;
this.button = new Rect({
zlevel: model.zlevel,
z: model.z,

View File

@ -1,113 +0,0 @@
import Polyline from 'zrender/src/graphic/shape/Polyline';
import Circle from 'zrender/src/graphic/shape/Circle';
import Arc from 'zrender/src/graphic/shape/Arc';
import Rect from 'zrender/src/graphic/shape/Rect';
import Group from 'zrender/src/container/Group';
class ESigButton extends Group {
constructor(model) {
super();
this.model = model;
this.isNew = false;
}
create() {
if (!this.isNew) {
const model = this.model;
const style = this.model.style;
const padding = 1;
const r = style.Signal.lamp.radiusR * 0.8;
this.isNew = true;
this.sigNormalButtom = new Rect({
zlevel: model.zlevel,
z: model.z,
_subType: 'SignalButton',
_val: '1',
shape: {
x: model.x - style.Signal.lamp.radiusR,
y: model.y - r + r * model.posit,
width: style.Signal.lamp.radiusR * 2,
height: style.Signal.lamp.radiusR * 2
},
style: {
lineWidth: 0.2,
stroke: style.Signal.button.borderDashColor,
fill: style.Signal.button.buttonColor
}
});
this.sigNormalButtomDown = new Polyline({
_subType: 'SignalButton',
_val: '1',
zlevel: model.zlevel,
z: model.z,
silent: true,
shape: { points: [
[model.x - padding + r, this.sigNormalButtom.shape.y + padding],
[model.x + padding - r, this.sigNormalButtom.shape.y + padding],
[model.x + padding - r, this.sigNormalButtom.shape.y + padding * 2 + r]
] },
style: {
lineWidth: 0.8,
stroke: style.backgroundColor
}
});
this.sigReentryButton = new Circle({
zlevel: model.zlevel,
z: model.z,
_subType: 'SignalButton',
_val: '2', // 折返按钮
shape: {
cx: model.x,
cy: model.y - 5 / 2 * r * model.posit,
r: style.Signal.lamp.radiusR
},
style: {
lineWidth: 0.2,
stroke: style.Signal.button.borderDashColor,
fill: style.Signal.button.buttonColor
}
});
this.sigReentryButtonDown = new Arc({
_subType: 'SignalButton',
_val: '2', // 折返按钮
zlevel: model.zlevel,
z: model.z,
silent: true,
shape: {
cx: this.sigReentryButton.shape.cx,
cy: this.sigReentryButton.shape.cy,
r: this.sigReentryButton.shape.r - padding,
startAngle: Math.PI * 8 / 5,
endAngle: Math.PI * 4 / 5,
clockwise: false
},
style: {
lineWidth: 0.8,
stroke: style.backgroundColor
}
});
this.add(this.sigNormalButtom);
this.add(this.sigReentryButton);
this.hide();
}
}
hide() {
this.create();
this.sigNormalButtom.hide();
this.sigReentryButton.hide();
}
show() {
this.create();
this.sigNormalButtom.show();
this.sigReentryButton.show();
}
}
export default ESigButton;

View File

@ -5,12 +5,10 @@ import ESigPost from './ESigPost';
import ESigLamp from './ESigLamp';
import ESigAuto from './ESigAuto';
import ESigRoute from './ESigRoute';
import ESigButton from './ESigButton';
import ESigDelay from './ESigDelay';
import ESigName from './ESigName';
import EMouse from './EMouse';
import Group from 'zrender/src/container/Group';
import BoundingRect from 'zrender/src/core/BoundingRect';
import EHighlight from '../element/EHighlight';
import EVirtualSignal from './EVirtualSignal';
import ELowButton from './ELowButton';
@ -160,17 +158,6 @@ class Signal extends Group {
textVerticalAlign: 'middle'
});
// 信号灯按钮
this.sigButton = new ESigButton({
zlevel: this.zlevel,
z: this.z,
style: style,
posit: posit,
show: model.buttonShow,
x: model.buttonPosition.x,
y: model.buttonPosition.y - posit * (style.Signal.button.distance + style.Signal.lamp.radiusR * 2)
});
if (isShowThePrdType(model.prdType, '03') && this.style.Signal.lowButton.display) {
// 北京一号线现地 信号机点击按钮
const lowButtonH = this.count * style.Signal.lamp.radiusR * 2;
@ -195,7 +182,6 @@ class Signal extends Group {
} else {
this.lamps.forEach(lamp => { this.add(lamp); });
}
// this.add(this.sigButton);
}
createMouseEvent() {
@ -459,15 +445,10 @@ class Signal extends Group {
return rect;
}
getShapeTipPoint(opts) {
var rect = new BoundingRect(0, 0, 0, 0);
getShapeTipPoint(opts) { // 判断第一步 或 第二部步骤 获取元素包围框
var drict = this.model.right ? 1 : -1; // 朝向 右:左
var offsetY = this.model.positionType == '01' ? this.style.Signal.text.fontSize : 0; // 位置 上:下
if (opts.val == '1' || opts.val == '2') {
rect = this.sigButton.getBoundingRect();
} else {
rect = this.sigPost.getBoundingRect();
}
const rect = this.sigPost.getBoundingRect();
return {
x: rect.x + drict * this.style.Signal.post.standardWidth,