This commit is contained in:
zyy 2019-07-24 11:12:21 +08:00
commit 886c51259d
20 changed files with 438 additions and 742 deletions

View File

@ -32,7 +32,7 @@ import JTriangle from '../../utils/JTriangle';
// ctx.bezierCurveTo(shape[`cpx1`], shape[`cpy1`], shape[`cpx2`], shape[`cpy2`], shape[`x2`], shape[`y2`]);
// }
// } else {
// const swPadding = model.style.Switch.switchLen; // 定位和反位时区段距离岔芯的距离
// const swPadding = model.style.Switch.core.switchLen; // 定位和反位时区段距离岔芯的距离
// var switchWidth = model.style.Section.line.width + model.style.Section.line.beyondWidth; // 道岔宽度
// const beg = Object.assign({}, model.points[0]);
// const end = Object.assign({}, model.points[model.points.length - 1]);
@ -117,7 +117,7 @@ export default class ELimitLines extends Group {
// const beg = Object.assign({}, model.points[0]);
// const end = Object.assign({}, model.points[model.points.length - 1]);
const swPadding = model.style.Switch.switchLen; // 定位和反位时区段距离岔芯的距离
const swPadding = model.style.Switch.core.switchLen; // 定位和反位时区段距离岔芯的距离
var switchWidth = model.style.Section.line.width + model.style.Section.line.beyondWidth; // 道岔宽度
const beg = Object.assign({}, model.points[0]);
const end = Object.assign({}, model.points[model.points.length - 1]);

View File

@ -6,44 +6,53 @@ class ESigPass extends Group {
constructor(model) {
super();
this.model = model;
this._create();
this.isNew = false;
}
_create() {
const model = this.model;
const style = this.model.style;
const rotation = model.drict != 1? 0 : Math.PI;
const point = arrows(model.x, model.y, style.Signal.signalAutoWidth, style.Signal.lamp.signalR * 0.8);
this.arrows = new Polygon({
zlevel: model.zlevel,
z: model.z,
rotation: rotation,
shape: {
points: point
},
style: {
stroke: model.stroke,
lineWidth: model.lineWidth,
fill: model.fill
}
});
this.add(this.arrows);
if (!this.isNew) {
const model = this.model;
const style = this.model.style;
const rotation = model.drict != 1? 0 : Math.PI;
const point = arrows(model.x, model.y, style.Signal.signalAutoWidth, style.Signal.lamp.signalR * 0.8);
this.isNew = true;
this.arrows = new Polygon({
zlevel: model.zlevel,
z: model.z,
rotation: rotation,
shape: {
points: point
},
style: {
stroke: model.stroke,
lineWidth: model.lineWidth,
fill: model.fill
}
});
this.add(this.arrows);
}
}
// 停止动画
animationRecover() {
this._create();
this.arrows.stopAnimation(false);
}
// 箭头颜色
setColor(color) {
this._create();
this.arrows.setStyle('fill', color);
}
// 箭头闪烁
arrowsAnimation() {
this._create();
const style = this.model.style;
const fill = this.arrows.style.Signal.fill;
this.arrows.animate(true)
.when(1000, { fill: style.backgroundColor, stroke: style.style.backgroundColor })
.when(2000, { fill: fill, stroke: style.style.Signal.sidelineColor })
@ -54,11 +63,13 @@ class ESigPass extends Group {
// 隐藏
hide() {
this._create();
this.arrows.hide();
}
// 显示
show() {
this._create();
this.arrows.show();
}
}

View File

@ -8,97 +8,99 @@ class ESigButton extends Group {
constructor(model) {
super();
this.model = model;
this._create();
this.isNew = false;
}
_create() {
const model = this.model;
const style = this.model.style;
const padding = 1;
const r = style.Signal.lamp.signalR * 0.8;
if (!this.isNew) {
const model = this.model;
const style = this.model.style;
const padding = 1;
const r = style.Signal.lamp.signalR * 0.8;
this.style = style;
this._subType = 'SignalButton';
this.isNew = true;
this.sigNormalButtom = new Rect({
zlevel: model.zlevel,
z: model.z,
_subType: 'SignalButton',
_val: '1',
shape: {
x: model.x - style.Signal.lamp.signalR,
y: model.y - r + r * model.posit,
width: style.Signal.lamp.signalR * 2,
height: style.Signal.lamp.signalR * 2
},
style: {
lineWidth: 0.2,
stroke: style.Signal.button.signalButtonDashColor,
fill: style.Signal.button.signalButtonColor
}
});
this.sigNormalButtom = new Rect({
zlevel: model.zlevel,
z: model.z,
_subType: this._subType,
_val: '1',
shape: {
x: model.x - style.Signal.lamp.signalR,
y: model.y - r + r * model.posit,
width: style.Signal.lamp.signalR * 2,
height: style.Signal.lamp.signalR * 2
},
style: {
lineWidth: 0.2,
stroke: style.Signal.button.signalButtonDashColor,
fill: style.Signal.button.signalButtonColor
}
});
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.signalR
},
style: {
lineWidth: 0.2,
stroke: style.Signal.button.signalButtonDashColor,
fill: style.Signal.button.signalButtonColor
}
});
this.sigReentryButton = new Circle({
zlevel: model.zlevel,
z: model.z,
_subType: this._subType,
_val: '2', // 折返按钮
shape: {
cx: model.x,
cy: model.y - 5 / 2 * r * model.posit,
r: style.Signal.lamp.signalR
},
style: {
lineWidth: 0.2,
stroke: style.Signal.button.signalButtonDashColor,
fill: style.Signal.button.signalButtonColor
}
});
this.sigNormalButtomDown = new Polyline({
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.sigNormalButtomDown = new Polyline({
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.sigReentryButtonDown = new Arc({
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.sigReentryButtonDown = new Arc({
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();
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();
}

View File

@ -5,43 +5,51 @@ class ESigDelay extends Group {
constructor(model) {
super();
this.model = model;
this._create();
this.isNew = false;
}
_create() {
const model = this.model;
this.name = new Text({
_subType: model._subType,
zlevel: model.zlevel,
z: model.z,
silent: model.silent || false,
style: {
x: model.x,
y: model.y,
text: model.text,
textFont: model.textFont,
textFill: model.textFill,
textAlign: model.textAlign,
textPosition: model.textPosition || 'inside',
textVerticalAlign: model.textVerticalAlign || null
}
});
this.add(this.name);
if (!this.isNew) {
const model = this.model;
this.isNew = true;
this.name = new Text({
_subType: model._subType,
zlevel: model.zlevel,
z: model.z,
silent: model.silent || false,
style: {
x: model.x,
y: model.y,
text: model.text,
textFont: model.textFont,
textFill: model.textFill,
textAlign: model.textAlign,
textPosition: model.textPosition || 'inside',
textVerticalAlign: model.textVerticalAlign || null
}
});
this.add(this.name);
}
}
setStyle(model) {
this._create();
this.name.setStyle(model);
}
setColor(color) {
this._create();
this.name.setStyle('textFill', color);
}
hide() {
this._create();
this.name.hide();
}
show() {
this._create();
this.name.show();
}
}

View File

@ -6,34 +6,41 @@ class ESigDrict extends Group {
constructor(model) {
super();
this.model = model;
this._create();
this.isNew = false;
}
_create() {
const model = this.model;
const style = this.model.style;
this.sigDrict = new Polygon({
zlevel: model.zlevel,
z: model.z,
shape: {
points: triangular(model.x, model.y, model.drict, style.Signal.lamp.signalR)
},
style: {
stroke: style.backgroundColor,
lineWidth: 0.5,
fill: style.Signal.route.signalRouteColor
}
});
this.add(this.sigDrict);
if (!this.isNew) {
const model = this.model;
const style = this.model.style;
this.isNew = true;
this.sigDrict = new Polygon({
zlevel: model.zlevel,
z: model.z,
shape: {
points: triangular(model.x, model.y, model.drict, style.Signal.lamp.signalR)
},
style: {
stroke: style.backgroundColor,
lineWidth: 0.5,
fill: style.Signal.route.signalRouteColor
}
});
this.add(this.sigDrict);
}
}
// 隐藏
hide() {
this._create();
this.sigDrict.hide();
}
// 显示
show() {
this._create();
this.sigDrict.show();
}
}

View File

@ -76,7 +76,7 @@ class Signal extends Group {
y: sigNameY,
text: model.name,
textFont: `bold ${style.Signal.text.signalTextFontSize} px ${style.textFontFormat}`,
textFill: style.Signal.text.signalTextGreen,
textFill: style.Signal.text.signalDefaultTextColor,
textAlign: 'middle',
textVerticalAlign: posit == 1 ? 'top' : 'bottom'
});
@ -214,7 +214,7 @@ class Signal extends Group {
// 封锁
block() {
this.lamps[0] && this.lamps[0].setColor(this.style.Signal.lamp.signalLampRedColor);
this.sigName.setColor(this.style.Signal.sectionBlockTextColor);
this.sigName.setColor(this.style.Signal.signalTextBlockColor);
}
// 功能封锁
@ -290,7 +290,7 @@ class Signal extends Group {
recover() {
this.sigDelay.hide();
this.sigAuto.animationRecover();
this.sigName.setColor(this.style.Signal.text.signalTextGreen);
this.sigName.setColor(this.style.Signal.text.signalDefaultTextColor);
}
setState(state) {

View File

@ -5,40 +5,47 @@ class EDetain extends Group {
constructor(model) {
super();
this.model = model;
this._create();
this.isNew = false;
}
_create() {
const model = this.model;
const style = this.model.style;
this.detain = new Text({
zlevel: model.zlevel,
z: model.z,
position: [0, 0],
style: {
x: model.x,
y: model.y,
text: style.StationStand.detainCar.text,
textAlign: model.textAlign,
textVerticalAlign: model.textVerticalAlign,
fontSize: `${style.StationStand.stand.headFontSize} px ${style.textFontFormat}`,
textFill: style.StationStand.detainCar.centerTrainColor,
textStroke: style.backgroundColor
}
});
if (!this.isNew) {
const model = this.model;
const style = this.model.style;
this.add(this.detain);
this.isNew = true;
this.detain = new Text({
zlevel: model.zlevel,
z: model.z,
position: [0, 0],
style: {
x: model.x,
y: model.y,
text: style.StationStand.detainCar.text,
textAlign: model.textAlign,
textVerticalAlign: model.textVerticalAlign,
fontSize: `${style.StationStand.stand.headFontSize} px ${style.textFontFormat}`,
textFill: style.StationStand.detainCar.centerTrainColor,
textStroke: style.backgroundColor
}
});
this.add(this.detain);
}
}
setColor(color) {
this._create();
this.detain.setStyle('textFill', color);
}
hide() {
this._create();
this.detain.hide();
}
show() {
this._create();
this.detain.show();
}
}

View File

@ -5,46 +5,49 @@ class EJump extends Group {
constructor(model) {
super();
this.model = model;
this._create();
this.isNew = false;
}
_create() {
const model = this.model;
const style = this.model.style;
if (!this.isNew) {
const model = this.model;
const style = this.model.style;
this.jump = new Text({
zlevel: model.zlevel,
z: model.z,
style: {
x: model.x,
y: model.y,
text: model.name,
textFill: style.StationStand.level.textColor,
textAlign: 'middle',
textFont: `${style.StationStand.common.textFontSize} px ${style.textFontFormat}`
}
});
this.isNew = true;
this.jump = new Text({
zlevel: model.zlevel,
z: model.z,
style: {
x: model.x,
y: model.y,
text: model.name,
textFill: style.StationStand.level.textColor,
textAlign: 'middle',
textFont: `${style.StationStand.common.textFontSize} px ${style.textFontFormat}`
}
});
this.add(this.jump);
this.add(this.jump);
}
}
setName(val) {
this.jump.attr({
style: {
text: val
}
});
this._create();
this.jump.setStyle('text', val);
}
setColor(color) {
this._create();
this.jump.setStyle('textFill', color);
}
hide() {
this._create();
this.jump.hide();
}
show() {
this._create();
this.jump.show();
}
}

View File

@ -5,46 +5,49 @@ class ELevel extends Group {
constructor(model) {
super();
this.model = model;
this._create();
this.isNew = false;
}
_create() {
const model = this.model;
const style = this.model.style;
if (!this.isNew) {
const model = this.model;
const style = this.model.style;
this.level = new Text({
zlevel: model.zlevel,
z: model.z,
style: {
x: model.x,
y: model.y,
text: model.name,
textFill: style.StationStand.level.textColor,
textAlign: 'middle',
textFont: `${style.StationStand.common.textFontSize} px ${style.textFontFormat}`
}
});
this.isNew = true;
this.level = new Text({
zlevel: model.zlevel,
z: model.z,
style: {
x: model.x,
y: model.y,
text: model.name,
textFill: style.StationStand.level.textColor,
textAlign: 'middle',
textFont: `${style.StationStand.common.textFontSize} px ${style.textFontFormat}`
}
});
this.add(this.level);
this.add(this.level);
}
}
setName(val) {
this.level.attr({
style: {
text: val
}
});
this._create();
this.level.setStyle('text', val);
}
setColor(color) {
this._create();
this.level.setStyle('textFill', color);
}
hide() {
this._create();
this.level.hide();
}
show() {
this._create();
this.level.show();
}
}

View File

@ -6,36 +6,42 @@ class EReentry extends Group {
constructor(model) {
super();
this.model = model;
this._create();
this.isNew = false;
}
_create() {
const model = this.model;
if (!this.isNew) {
const model = this.model;
this.reentry = new Polygon({
zlevel: model.zlevel,
z: model.z,
shape: {
points: flashlight(model.x, model.y, model.drict, 10, 5, 0, 0, 4)
},
style: {
lineWidth: model.lineWidth,
fill: model.fill
}
});
this.isNew = true;
this.reentry = new Polygon({
zlevel: model.zlevel,
z: model.z,
shape: {
points: flashlight(model.x, model.y, model.drict, 10, 5, 0, 0, 4)
},
style: {
lineWidth: model.lineWidth,
fill: model.fill
}
});
this.add(this.reentry);
this.add(this.reentry);
}
}
setColor(color) {
this._create();
this.reentry.setStyle('textFill', color);
}
hide() {
this._create();
this.reentry.hide();
}
show() {
this._create();
this.reentry.show();
}
}

View File

@ -5,37 +5,42 @@ class ESafeEmergent extends Group {
constructor(model) {
super();
this.model = model;
this._create();
this.isNew = false;
}
_create() {
const model = this.model;
const style = this.model.style;
if (!this.isNew) {
const model = this.model;
const style = this.model.style;
this.emergent = new Isogon({
zlevel: model.zlevel,
z: model.z,
shape: {
x: model.x,
y: model.y,
r: model.r,
n: model.n
},
style: {
lineWidth: 0,
stroke: style.StationStand.standEmergent.closeColor,
fill: style.StationStand.standEmergent.closeColor
}
});
this.isNew = true;
this.emergent = new Isogon({
zlevel: model.zlevel,
z: model.z,
shape: {
x: model.x,
y: model.y,
r: model.r,
n: model.n
},
style: {
lineWidth: 0,
stroke: style.StationStand.standEmergent.closeColor,
fill: style.StationStand.standEmergent.closeColor
}
});
this.add(this.emergent);
this.add(this.emergent);
}
}
hide() {
this._create();
this.emergent.hide();
}
show() {
this._create();
this.emergent.show();
}
}

View File

@ -5,46 +5,49 @@ class ETime extends Group {
constructor(model) {
super();
this.model = model;
this._create();
this.isNew = false;
}
_create() {
const model = this.model;
const style = this.model.style;
if (!this.isNew) {
const model = this.model;
const style = this.model.style;
this.time = new Text({
zlevel: model.zlevel,
z: model.z,
style: {
x: model.x,
y: model.y,
text: model.name,
textFill: style.StationStand.stopTime.textColor,
textAlign: 'middle',
textFont: `${style.StationStand.common.textFontSize} px ${style.textFontFormat}`
}
});
this.isNew = true;
this.time = new Text({
zlevel: model.zlevel,
z: model.z,
style: {
x: model.x,
y: model.y,
text: model.name,
textFill: style.StationStand.stopTime.textColor,
textAlign: 'middle',
textFont: `${style.StationStand.common.textFontSize} px ${style.textFontFormat}`
}
});
this.add(this.time);
this.add(this.time);
}
}
setName(val) {
this.time.attr({
style: {
text: val
}
});
this._create();
this.time.setStyle('text', val);
}
setColor(color) {
this._create();
this.time.setStyle('textFill', color);
}
hide() {
this._create();
this.time.hide();
}
show() {
this._create();
this.time.show();
}
}

View File

@ -23,7 +23,7 @@ class ESwName extends Group {
textAlign: model.triangle.drictx === 1 ? 'left' : 'right',
textVerticalAlign: model.triangle.dricty === 1 ? 'top' : 'bottom',
textFont: style.textFontSize + 'px ' + style.textFontFormat,
textFill: style.Switch.switchTextLossColor
textFill: style.Switch.text.switchTextLossColor
}
});
@ -47,7 +47,7 @@ class ESwName extends Group {
style: {
lineWidth: 0,
lineDash: [3, 3],
stroke: style.Switch.switchTextBorderColor,
stroke: style.Switch.text.switchTextBorderColor,
fill: style.transparentColor
}
});

View File

@ -1,398 +0,0 @@
/*
* 道岔
*/
import Line from 'zrender/src/graphic/shape/Line';
import Group from 'zrender/src/container/Group';
import Polygon from 'zrender/src/graphic/shape/Polygon';
import JTriangle from '../../utils/JTriangle';
import ESwName from './ESwName.js';
import ESwCore from './ESwCore.js';
export default class Switch extends Group {
constructor({ _code, _type, zlevel, model, state }, style, jmap) {
super();
this._code = _code;
this._type = _type;
this.model = model;
this.state = state;
this.style = style;
this.jmap = jmap;
this.selected = false;
this.zlevel = zlevel;
this.z = 8;
this._create();
this.setState(state);
}
_create() {
const model = this.model;
const style = this.style;
this.triangle = new JTriangle(model.intersection, model.skew);
let halfWidth = style.Section.line.width / 2;
const switchWidth = style.Section.line.width + style.Section.line.beyondWidth*2 + 0.8;
const swPadding = style.Switch.switchLen;
const directx = this.triangle.drictx;
const directy = this.triangle.dricty;
const direct = -this.triangle.drictx * this.triangle.dricty;
const coverLength = switchWidth * 1.5;
this.swCore = new ESwCore({
zlevel: this.zlevel,
z: this.z,
style: style,
intersectionX: model.intersection.x,
intersectionY: model.intersection.y,
coverLength: coverLength,
lineWidth: switchWidth,
triangle: this.triangle
});
halfWidth += 0.3;
const point1 = [model.intersection.x - directx * halfWidth, model.intersection.y + directy * halfWidth];
const point2 = [point1[0] + directx * switchWidth / this.triangle.getSinRate(), point1[1]];
const point3 = [point2[0] + directx * this.triangle.getCotRate() * swPadding, point2[1] + directy * swPadding];
const point4 = [point3[0] + direct * this.triangle.getSin(switchWidth), point3[1] - direct * this.triangle.getCos(switchWidth)];
this.locShelter = new Polygon({
zlevel: this.zlevel,
z: this.z,
shape: {
points: [
point1, point2, point3, point4
]
},
style: {
fill: style.backgroundColor
},
cursor: 'pointer',
onmouseover: () => { this.name.getArrowText().show(); },
onmouseout: () => { this.name.getArrowText().hide(); }
});
const lpx = Math.abs(this.triangle.getCos(1));
this.locShelter.position = [directx * lpx, -directy * 0.2];
this.locShelter.show();
const slen = switchWidth / this.triangle.getSinRate();
const rpoint1 = [model.intersection.x + directx * halfWidth, model.intersection.y - directy * halfWidth];
const rpoint2 = [rpoint1[0] + directx * (swPadding + switchWidth * this.triangle.getCotRate()), rpoint1[1]];
const rpoint3 = [rpoint2[0], rpoint2[1] + directy * switchWidth];
const rpoint4 = [rpoint1[0] + this.triangle.getCos(slen), rpoint1[1] + this.triangle.getSin(slen)];
this.relocShelter = new Polygon({
zlevel: this.zlevel,
z: this.z,
shape: {
points: [
rpoint1, rpoint2, rpoint3, rpoint4
]
},
style: {
fill: style.backgroundColor
},
cursor: 'pointer',
onmouseover: () => { this.name.getArrowText().show(); },
onmouseout: () => { this.name.getArrowText().hide(); }
});
const rpx = Math.abs(this.triangle.getCos(halfWidth)) + 0.2;
this.relocShelter.position = [-directx * rpx, -directy * 0.2];
this.relocShelter.hide();
const sinX = style.Section.line.width / this.triangle.getSinRate();
const switchWidth1 = style.Section.line.width / 2;
const width1 = switchWidth1 * this.triangle.getSinRate();
const height1 = switchWidth1 * this.triangle.getCosRate();
const width2 = (height1 + switchWidth1) / this.triangle.getTanRate();
const width3 = sinX - width2 - width1;
const switchPoint1 = [model.intersection.x + directx * width3, model.intersection.y - directy * switchWidth1];
const switchPoint2 = [switchPoint1[0] - directx * (width2 + width1) - directx * width3, switchPoint1[1]];
const switchPoint3 = [model.intersection.x - directx * width3, model.intersection.y + directy * switchWidth1];
const switchPoint4 = [switchPoint1[0] + directx * (width2 + width1) - directx * width3, switchPoint3[1]];
this.reserveSection = new Polygon({
zlevel: this.zlevel,
shape: {
points: [
switchPoint1, switchPoint2, switchPoint3, switchPoint4
]
},
style: {
fill: style.Section.line.spareColor
},
cursor: 'pointer',
onmouseover: () => { this.name.getArrowText().show(); },
onmouseout: () => { this.name.getArrowText().hide(); }
});
this.reserveSection.hide();
this.releaseBackground = new Line({
zlevel: this.zlevel,
z: this.z,
shape: {
x1: model.intersection.x - (coverLength * this.triangle.getCotRate()),
y1: model.intersection.y,
x2: model.intersection.x + (coverLength * this.triangle.getCotRate()),
y2: model.intersection.y
},
style: {
lineWidth: style.Section.line.width + style.Section.line.beyondWidth + 1,
stroke: style.backgroundColor
}
});
const arrowTextX = model.intersection.x + 10;
const arrowTextY = model.intersection.y + 15;
const nameTextX = model.namePosition.x + model.intersection.x + this.triangle.drictx * (style.Section.line.width * 3 + style.Switch.switchNameDistance) * this.triangle.getCotRate();
const nameTextY = model.namePosition.y + model.intersection.y + this.triangle.dricty * (style.Switch.switchNameDistance);
this.name = new ESwName({
zlevel: this.zlevel,
z: this.z,
style: style,
arrowTextX: arrowTextX,
arrowTextY: arrowTextY,
nameTextX: nameTextX,
nameTextY: nameTextY,
sectionName: model.sectionName,
name: model.name,
nameShow: model.nameShow,
triangle: this.triangle
});
this.add(this.swCore);
this.add(this.locShelter);
this.add(this.relocShelter);
this.add(this.reserveSection);
this.add(this.releaseBackground);
this.add(this.name);
}
/** 名称动画*/
nameTextAnimation() {
this.name.getNameText().animateStyle(true)
.when(0, { textFill: this.style.backgroundColor })
.when(1000, { textFill: this.style.Switch.switchTextLossColor })
.when(2000, { textFill: this.style.backgroundColor })
.start();
this.name.getTextRect().animateStyle(true)
.when(0, { textFill: this.style.backgroundColor })
.when(1000, { textFill: this.style.Switch.switchTextBorderColor })
.when(2000, { textFill: this.style.backgroundColor })
.start();
}
/** 设置岔芯是否隐藏*/
setSwitchCoreInvisible(invisible) {
if (invisible) {
this.swCore.hide();
} else {
this.swCore.show();
}
}
/** 设置岔芯颜色*/
setSwitchCoreColor(color) {
this.swCore.setColor(color);
}
/** 设置道岔文字颜色*/
setTextColor(color) {
this.name.getNameText().setStyle('textFill', color);
}
/** 设置道岔文字边框颜色 */
setHasTextBorder(width) {
this.name.getTextRect().setStyle('lineWidth', width);
}
/** 恢复状态*/
recover() {
this.setSwitchCoreColor(this.style.backgroundColor);
this.name.getNameText().stopAnimation(false);
this.reserveSection.stopAnimation(false);
this.swCore.stopAnimation(false);
this.relocShelter.hide();
this.releaseBackground.hide();
this.setHasTextBorder(0);
switch (this.state.locateType) {
case '01':
this.setTextColor(this.style.Switch.switchLocateTextColor);
break;
case '02':
this.setTextColor(this.style.Switch.switchInversionColor);
break;
default:
this.setTextColor(this.style.Switch.switchTextLossColor);
break;
}
}
/** 定位*/
setLocationAction() {
this.recover();
this.setSwitchCoreInvisible(true);
this.locShelter.show();
this.relocShelter.hide();
this.reserveSection.hide();
}
/** 反位*/
setInversionAction() {
this.recover();
this.setSwitchCoreInvisible(true);
this.locShelter.hide();
this.relocShelter.show();
this.reserveSection.show();
}
/** 失去*/
setLossAction(nameFlicker) {
this.recover();
this.locShelter.hide();
this.relocShelter.hide();
this.reserveSection.hide();
this.setSwitchCoreInvisible(false);
nameFlicker && this.nameTextAnimation();
}
/** 挤叉*/
setForkAction() {
this.setLossAction(true);
this.swCore.animateStyle(item => {
item.animateStyle(true)
.when(0, { stroke: this.style.backgroundColor })
.when(1000, { stroke: 'red' })
.when(2000, { stroke: this.style.backgroundColor })
.start();
});
}
/** 空闲*/
spare() {
}
/** 单锁*/
setMonolock() {
this.setTextColor(this.style.Switch.switchMonolockColor);
}
/** 封锁 */
block() {
this.setHasTextBorder(1);
}
/** 延时释放*/
timeRelease() {
this.setSwitchCoreInvisible(true);
this.releaseBackground.show();
}
/** 设置道岔切除*/
setSwitchCutOff() {
this.setSwitchCoreInvisible(true);
switch (this.model.locateType) {
case '01':
this.releaseBackground.hide();
this.setSectionState(this.release, 'stroke', this.model.sectionAstatus);
break;
case '02':
this.reserveSection.animateStyle(true)
.when(1000, { fill: this.style.backgroundColor })
.start();
break;
}
}
setSectionState(section, style, state) {
if (section) {
switch (state) {
case '00': break;
case '01': /** 空闲*/
section.setStyle(style, this.style.Section.line.spareColor);
break;
case '02': /** 通信车占用*/
section.setStyle(style, this.style.Section.line.communicationOccupiedColor);
break;
case '03': /** 非通信车占用*/
section.setStyle(style, this.style.Section.line.unCommunicationOccupiedColor);
break;
case '04': /** 进路锁闭*/
section.setStyle(style, this.style.Section.line.routeLockColor);
break;
case '05': /** 故障锁闭*/
section.setStyle(style, this.style.Section.line.faultLockColor);
break;
case '06': /** 封锁*/
section.setStyle(style, this.style.Section.line.blockColor);
break;
case '07': /** ATC切除*/
section.setStyle(style, this.style.Section.line.atcExcisionColor);
break;
case '08': /** ATS切除*/
section.setStyle(style, this.style.Section.line.atsExcisionColor);
section.animateStyle(true)
.when(1000, { fill: this.style.backgroundColor })
.when(2000, { fill: this.style.Section.line.atsExcisionColor })
.start();
break;
case '09': /** 进路延续保护 */
section.setStyle(style, this.style.Section.line.protectiveLockColor);
break;
}
}
}
setLocateType(state) {
this.setSectionState(this.reserveSection, 'fill', this.model.sectionCstatus);
switch (state.locateType) {
case '01':
this.setLocationAction(); /** 定位*/
break;
case '02':
this.setInversionAction(); /** 反位*/
break;
case '03':
this.setLossAction(true); /** 失去*/
break;
case '04':
this.setForkAction(); /** 挤岔*/
break;
}
}
setState(state) {
this.setLocateType(state);
switch (state.status) {
case '01':
this.spare(); /** 空闲*/
break;
case '10':
this.setMonolock(); /** 单锁*/
break;
case '13':
this.timeRelease(); /** 延时释放*/
break;
case '14':
this.block(); /** 封锁*/
break;
}
/** 区段切除*/
if (state.cutOff) {
this.setSwitchCutOff();
}
}
getShapeTipPoint() {
let rect = null;
rect = this.name.getNameText().getBoundingRect();
if (rect) {
return {
x: rect.x + rect.width / 2,
y: rect.y
};
}
return null;
}
}

View File

@ -34,7 +34,7 @@ export default class Switch extends Group {
let halfWidth = style.Section.line.width / 2;
const switchWidth = style.Section.line.width + style.Section.line.beyondWidth*2 + 0.8;
const swPadding = style.Switch.switchLen;
const swPadding = style.Switch.core.switchLen;
const directx = this.triangle.drictx;
const directy = this.triangle.dricty;
const direct = -this.triangle.drictx * this.triangle.dricty;
@ -113,8 +113,8 @@ export default class Switch extends Group {
const arrowTextX = model.intersection.x + 10;
const arrowTextY = model.intersection.y + 15;
const nameTextX = model.namePosition.x + model.intersection.x + this.triangle.drictx * (style.Section.line.width * 3 + style.Switch.switchNameDistance) * this.triangle.getCotRate();
const nameTextY = model.namePosition.y + model.intersection.y + this.triangle.dricty * (style.Switch.switchNameDistance);
const nameTextX = model.namePosition.x + model.intersection.x + this.triangle.drictx * (style.Section.line.width * 3 + style.Switch.text.switchNameDistance) * this.triangle.getCotRate();
const nameTextY = model.namePosition.y + model.intersection.y + this.triangle.dricty * (style.Switch.text.switchNameDistance);
this.name = new ESwName({
zlevel: this.zlevel,
z: this.z,
@ -140,13 +140,13 @@ export default class Switch extends Group {
nameTextAnimation() {
this.name.getNameText().animateStyle(true)
.when(0, { textFill: this.style.backgroundColor })
.when(1000, { textFill: this.style.Switch.switchTextLossColor })
.when(1000, { textFill: this.style.Switch.text.switchTextLossColor })
.when(2000, { textFill: this.style.backgroundColor })
.start();
this.name.getTextRect().animateStyle(true)
.when(0, { textFill: this.style.backgroundColor })
.when(1000, { textFill: this.style.Switch.switchTextBorderColor })
.when(1000, { textFill: this.style.Switch.text.switchTextBorderColor })
.when(2000, { textFill: this.style.backgroundColor })
.start();
}
@ -187,13 +187,13 @@ export default class Switch extends Group {
this.setHasTextBorder(0);
switch (this.state.locateType) {
case '01':
this.setTextColor(this.style.Switch.switchLocateTextColor);
this.setTextColor(this.style.Switch.text.switchTextLocateColor);
break;
case '02':
this.setTextColor(this.style.Switch.switchInversionColor);
this.setTextColor(this.style.Switch.text.switchTextInversionColor);
break;
default:
this.setTextColor(this.style.Switch.switchTextLossColor);
this.setTextColor(this.style.Switch.text.switchTextLossColor);
break;
}
}

View File

@ -235,7 +235,7 @@ class Batong extends defaultSkin {
/** 道岔失去颜色*/
switchTextLossColor: '#FFFFFF',
/** 道岔定位颜色*/
switchLocateTextColor: '#00FF00',
switchTextLocateColor: '#00FF00',
/** 道岔反位颜色*/
switchInversionColor: '#9C9D09',
/** 道岔单锁颜色*/

View File

@ -17,6 +17,7 @@ class Beijing extends defaultSkin {
/** link 字体颜色*/
linkTextColor: '#FFFFFF'
};
this[deviceType.Section] = {
text: { // 区段文字属性
fontSize: 10, // 字体大小
@ -66,60 +67,87 @@ class Beijing extends defaultSkin {
color: '#7F7F7F' // 区段边界符颜色
}
};
this[deviceType.Signal] = {
/** 信号机宽度 */
signalR: 7,
/** 自动信号宽度*/
signalAutoWidth: 5,
/** 延迟解锁字体大小*/
signalDelayTextFontSize: 10,
/** 信号机名称字体大小*/
signalTextFontSize: 12,
/** 灯柱宽度*/
signalLampStandardWidth: 1.2,
/** 设备距离区段的距离*/
signalDistance: 0,
/** 信号灯按钮距离区段的距离*/
signalButtonDistance: 5,
/** 自动进路方向*/
signalSigRouteDirection: false,
/** 自动进路偏移量*/
signalSigRouteOffset: { x: 4, y: -2 },
/** 自动通过方向*/
signalSigPassDirection: true,
/** 自动通过偏移量*/
signalSigPassOffset: { x: 4, y: 0},
/** 延时解锁方向*/
signalSigDelayDirection: false,
/** 延时解锁偏移量*/
signalSigDelayOffset: { x: 0, y: -5},
/** 信号灯按钮边线*/
signalButtonDashColor: '#FFFFFF',
/** 信号灯按钮颜色*/
signalButtonColor: 'darkgreen',
/** 信号灯按钮闪烁颜色*/
signalButtonLightenColor: '#E4EF50',
/** 信号灯字体颜色*/
signalTextRed: '#EF0C08',
/** 信号机字体绿色*/
signalTextGreen: '#4DD43F',
/** 信号灯灯柱颜色*/
signalLampStandardColor: '#5578B6',
/** 信号灯锁闭*/
signalBlockColor: '#EF0C08',
/** 信号灯灰色*/
signalLampGrayColor: '#7F7F7F',
/** 信号灯红色*/
signalLampRedColor: '#FF0000',
/** 信号灯绿色*/
signalLampGreenColor: '#00FF00',
/** 信号灯黄色*/
signalLampYellowColor: '#FFFF00',
/** 信号灯白色*/
signalLampWhiteColor: '#FFFFFF',
/** 信号灯蓝色*/
signalLampBlueColor: '#0070C0'
post: {
/** 信号灯灯柱颜色*/
signalLampStandardColor: '#5578B6',
signalLampStandardWidth: 1.5
},
text: {
/** 信号机名称字体大小*/
signalTextFontSize: 12,
/** 信号灯字体默认色*/
signalDefaultTextColor: '#C0C0C0',
/** 信号灯字体锁定颜色*/
signalTextBlockColor: '#EF0C08'
},
lamp: {
/** 禁止线宽度*/
signalStopWidth: 2,
/** 信号灯边框线宽度*/
signalBorderWidth: 0.5,
/** 信号灯边框线颜色*/
signalBorderColor: '#3149C3',
/** 信号机宽度 */
signalR: 7,
/** 信号灯锁闭*/
signalBlockColor: '#EF0C08',
/** 信号灯灰色*/
signalLampGrayColor: '#7F7F7F',
/** 信号灯红色*/
signalLampRedColor: '#FF0000',
/** 信号灯绿色*/
signalLampGreenColor: '#00FF00',
/** 信号灯黄色*/
signalLampYellowColor: '#FFFF00',
/** 信号灯白色*/
signalLampWhiteColor: '#FFFFFF',
/** 信号灯蓝色*/
signalLampBlueColor: '#0070C0'
},
route: {
/** 自动进路方向*/
signalRouteDirection: false,
/** 自动进路偏移量*/
signalRouteOffset: { x: 4, y: -2 },
/** 自动进路*/
signalRouteColor: '#00FF00'
},
auto: {
/** 自动通过方向*/
signalAutoDirection: true,
/** 自动通过偏移量*/
signalAutoOffset: { x: 4, y: 0},
/** 自动进路*/
signalAutoRoute: '#00FF00',
/** 自动触发*/
signalAutoTrigger: '#FFFF00'
},
delay: {
/** 延迟解锁字体大小*/
signalDelayTextFontSize: 9,
/** 延时解锁方向*/
signalDelayDirection: false,
/** 延时解锁偏移量*/
signalDelayOffset: { x: 0, y: -5},
/** 延迟解锁颜色*/
signalDelayTextColor: '#FF0000'
},
button: {
/** 信号灯按钮距离区段的距离*/
signalButtonDistance: 5,
/** 信号灯按钮边线*/
signalButtonDashColor: '#FFFFFF',
/** 信号灯按钮颜色*/
signalButtonColor: 'darkgreen',
/** 信号灯按钮闪烁颜色*/
signalButtonLightenColor: '#E4EF50'
}
};
this[deviceType.StationStand] = {
common: { // 通用属性
textFontSize: 8 // 站台默认字体大小
@ -168,6 +196,7 @@ class Beijing extends defaultSkin {
textColor: '#FFFFFF' // 停站等级字体颜色
}
};
this[deviceType.StationControl] = {
singleControlNum: 3,
stationOffset: {x: 20, y: 0},
@ -187,24 +216,30 @@ class Beijing extends defaultSkin {
/** 控制模式黄色*/
stationControlYellowColor: '#FFFF00'
};
this[deviceType.Station] = {
kilometerPosition: 'down' // 公里标位置
};
this[deviceType.Switch] = {
/** 道岔单边长度 */
switchLen: 6,
/** 道岔名称与区段距离*/
switchNameDistance: 2,
/** 道岔边框颜色*/
switchTextBorderColor: '#FE0000',
/** 道岔失去颜色*/
switchTextLossColor: '#FFFFFF',
/** 道岔定位颜色*/
switchLocateTextColor: '#00FF00',
/** 道岔反位颜色*/
switchInversionColor: '#9C9D09',
/** 道岔单锁颜色*/
switchMonolockColor: '#870E10'
text: {
/** 道岔名称与区段距离*/
switchNameDistance: 2,
/** 道岔边框颜色*/
switchTextBorderColor: '#FE0000',
/** 道岔失去颜色*/
switchTextLossColor: '#FFFFFF',
/** 道岔定位颜色*/
switchTextLocateColor: '#00FF00',
/** 道岔反位颜色*/
switchInversionColor: '#9C9D09',
/** 道岔单锁颜色*/
switchMonolockColor: '#870E10'
},
core: {
/** 道岔单边长度 */
switchLen: 6
}
};
}
}

View File

@ -238,7 +238,7 @@ class Beijing extends defaultSkin {
/** 道岔失去颜色*/
switchTextLossColor: '#C00808',
/** 道岔定位颜色*/
switchLocateTextColor: '#08C008',
switchTextLocateColor: '#08C008',
/** 道岔反位颜色*/
switchInversionColor: '#C0C000',
/** 道岔单锁颜色*/

View File

@ -73,10 +73,10 @@ class Fuzhou extends defaultSkin {
text: {
/** 信号机名称字体大小*/
signalTextFontSize: 8,
/** 信号灯字体色*/
signalTextRed: '#EF0C08',
/** 信号机字体绿色*/
signalTextGreen: '#4DD43F'
/** 信号灯字体默认色*/
signalDefaultTextColor: '#FFFFFF',
/** 信号灯字体锁定颜色*/
signalTextBlockColor: '#EF0C08'
},
lamp: {
/** 禁止线宽度*/
@ -212,20 +212,24 @@ class Fuzhou extends defaultSkin {
kilometerPosition: 'up'
};
this[deviceType.Switch] = {
/** 道岔单边长度 */
switchLen: 6,
/** 道岔名称与区段距离*/
switchNameDistance: 2,
/** 道岔边框颜色*/
switchTextBorderColor: '#FE0000',
/** 道岔失去颜色*/
switchTextLossColor: '#FFFFFF',
/** 道岔定位颜色*/
switchLocateTextColor: '#00FF00',
/** 道岔反位颜色*/
switchInversionColor: '#9C9D09',
/** 道岔单锁颜色*/
switchMonolockColor: '#870E10'
text: {
/** 道岔名称与区段距离*/
switchNameDistance: 2,
/** 道岔边框颜色*/
switchTextBorderColor: '#FE0000',
/** 道岔失去颜色*/
switchTextLossColor: '#FFFFFF',
/** 道岔定位颜色*/
switchTextLocateColor: '#00FF00',
/** 道岔反位颜色*/
switchInversionColor: '#9C9D09',
/** 道岔单锁颜色*/
switchMonolockColor: '#870E10'
},
core: {
/** 道岔单边长度 */
switchLen: 6
}
};
}
}

View File

@ -58,7 +58,7 @@ export default {
// this.jmap.load({ skinVO: { code: '02' }, linkList: list });
getPublishMapDetail('02').then(resp => {
getPublishMapDetail('03').then(resp => {
this.jmap.setLevelVisible([deviceType.Link], false);
this.jmap.load(resp.data);
// this.jmap.setDefaultState();