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`]); // ctx.bezierCurveTo(shape[`cpx1`], shape[`cpy1`], shape[`cpx2`], shape[`cpy2`], shape[`x2`], shape[`y2`]);
// } // }
// } else { // } 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; // 道岔宽度 // var switchWidth = model.style.Section.line.width + model.style.Section.line.beyondWidth; // 道岔宽度
// const beg = Object.assign({}, model.points[0]); // const beg = Object.assign({}, model.points[0]);
// const end = Object.assign({}, model.points[model.points.length - 1]); // 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 beg = Object.assign({}, model.points[0]);
// const end = Object.assign({}, model.points[model.points.length - 1]); // 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; // 道岔宽度 var switchWidth = model.style.Section.line.width + model.style.Section.line.beyondWidth; // 道岔宽度
const beg = Object.assign({}, model.points[0]); const beg = Object.assign({}, model.points[0]);
const end = Object.assign({}, model.points[model.points.length - 1]); const end = Object.assign({}, model.points[model.points.length - 1]);

View File

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

View File

@ -8,22 +8,21 @@ class ESigButton extends Group {
constructor(model) { constructor(model) {
super(); super();
this.model = model; this.model = model;
this._create(); this.isNew = false;
} }
_create() { _create() {
if (!this.isNew) {
const model = this.model; const model = this.model;
const style = this.model.style; const style = this.model.style;
const padding = 1; const padding = 1;
const r = style.Signal.lamp.signalR * 0.8; const r = style.Signal.lamp.signalR * 0.8;
this.style = style; this.isNew = true;
this._subType = 'SignalButton';
this.sigNormalButtom = new Rect({ this.sigNormalButtom = new Rect({
zlevel: model.zlevel, zlevel: model.zlevel,
z: model.z, z: model.z,
_subType: this._subType, _subType: 'SignalButton',
_val: '1', _val: '1',
shape: { shape: {
x: model.x - style.Signal.lamp.signalR, x: model.x - style.Signal.lamp.signalR,
@ -41,7 +40,7 @@ class ESigButton extends Group {
this.sigReentryButton = new Circle({ this.sigReentryButton = new Circle({
zlevel: model.zlevel, zlevel: model.zlevel,
z: model.z, z: model.z,
_subType: this._subType, _subType: 'SignalButton',
_val: '2', // 折返按钮 _val: '2', // 折返按钮
shape: { shape: {
cx: model.x, cx: model.x,
@ -92,13 +91,16 @@ class ESigButton extends Group {
this.add(this.sigReentryButton); this.add(this.sigReentryButton);
this.hide(); this.hide();
} }
}
hide() { hide() {
this._create();
this.sigNormalButtom.hide(); this.sigNormalButtom.hide();
this.sigReentryButton.hide(); this.sigReentryButton.hide();
} }
show() { show() {
this._create();
this.sigNormalButtom.show(); this.sigNormalButtom.show();
this.sigReentryButton.show(); this.sigReentryButton.show();
} }

View File

@ -5,11 +5,14 @@ class ESigDelay extends Group {
constructor(model) { constructor(model) {
super(); super();
this.model = model; this.model = model;
this._create(); this.isNew = false;
} }
_create() { _create() {
if (!this.isNew) {
const model = this.model; const model = this.model;
this.isNew = true;
this.name = new Text({ this.name = new Text({
_subType: model._subType, _subType: model._subType,
zlevel: model.zlevel, zlevel: model.zlevel,
@ -28,20 +31,25 @@ class ESigDelay extends Group {
}); });
this.add(this.name); this.add(this.name);
} }
}
setStyle(model) { setStyle(model) {
this._create();
this.name.setStyle(model); this.name.setStyle(model);
} }
setColor(color) { setColor(color) {
this._create();
this.name.setStyle('textFill', color); this.name.setStyle('textFill', color);
} }
hide() { hide() {
this._create();
this.name.hide(); this.name.hide();
} }
show() { show() {
this._create();
this.name.show(); this.name.show();
} }
} }

View File

@ -6,12 +6,15 @@ class ESigDrict extends Group {
constructor(model) { constructor(model) {
super(); super();
this.model = model; this.model = model;
this._create(); this.isNew = false;
} }
_create() { _create() {
if (!this.isNew) {
const model = this.model; const model = this.model;
const style = this.model.style; const style = this.model.style;
this.isNew = true;
this.sigDrict = new Polygon({ this.sigDrict = new Polygon({
zlevel: model.zlevel, zlevel: model.zlevel,
z: model.z, z: model.z,
@ -24,16 +27,20 @@ class ESigDrict extends Group {
fill: style.Signal.route.signalRouteColor fill: style.Signal.route.signalRouteColor
} }
}); });
this.add(this.sigDrict); this.add(this.sigDrict);
} }
}
// 隐藏 // 隐藏
hide() { hide() {
this._create();
this.sigDrict.hide(); this.sigDrict.hide();
} }
// 显示 // 显示
show() { show() {
this._create();
this.sigDrict.show(); this.sigDrict.show();
} }
} }

View File

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

View File

@ -5,12 +5,15 @@ class EDetain extends Group {
constructor(model) { constructor(model) {
super(); super();
this.model = model; this.model = model;
this._create(); this.isNew = false;
} }
_create() { _create() {
if (!this.isNew) {
const model = this.model; const model = this.model;
const style = this.model.style; const style = this.model.style;
this.isNew = true;
this.detain = new Text({ this.detain = new Text({
zlevel: model.zlevel, zlevel: model.zlevel,
z: model.z, z: model.z,
@ -29,16 +32,20 @@ class EDetain extends Group {
this.add(this.detain); this.add(this.detain);
} }
}
setColor(color) { setColor(color) {
this._create();
this.detain.setStyle('textFill', color); this.detain.setStyle('textFill', color);
} }
hide() { hide() {
this._create();
this.detain.hide(); this.detain.hide();
} }
show() { show() {
this._create();
this.detain.show(); this.detain.show();
} }
} }

View File

@ -5,13 +5,15 @@ class EJump extends Group {
constructor(model) { constructor(model) {
super(); super();
this.model = model; this.model = model;
this._create(); this.isNew = false;
} }
_create() { _create() {
if (!this.isNew) {
const model = this.model; const model = this.model;
const style = this.model.style; const style = this.model.style;
this.isNew = true;
this.jump = new Text({ this.jump = new Text({
zlevel: model.zlevel, zlevel: model.zlevel,
z: model.z, z: model.z,
@ -27,24 +29,25 @@ class EJump extends Group {
this.add(this.jump); this.add(this.jump);
} }
}
setName(val) { setName(val) {
this.jump.attr({ this._create();
style: { this.jump.setStyle('text', val);
text: val
}
});
} }
setColor(color) { setColor(color) {
this._create();
this.jump.setStyle('textFill', color); this.jump.setStyle('textFill', color);
} }
hide() { hide() {
this._create();
this.jump.hide(); this.jump.hide();
} }
show() { show() {
this._create();
this.jump.show(); this.jump.show();
} }
} }

View File

@ -5,13 +5,15 @@ class ELevel extends Group {
constructor(model) { constructor(model) {
super(); super();
this.model = model; this.model = model;
this._create(); this.isNew = false;
} }
_create() { _create() {
if (!this.isNew) {
const model = this.model; const model = this.model;
const style = this.model.style; const style = this.model.style;
this.isNew = true;
this.level = new Text({ this.level = new Text({
zlevel: model.zlevel, zlevel: model.zlevel,
z: model.z, z: model.z,
@ -27,24 +29,25 @@ class ELevel extends Group {
this.add(this.level); this.add(this.level);
} }
}
setName(val) { setName(val) {
this.level.attr({ this._create();
style: { this.level.setStyle('text', val);
text: val
}
});
} }
setColor(color) { setColor(color) {
this._create();
this.level.setStyle('textFill', color); this.level.setStyle('textFill', color);
} }
hide() { hide() {
this._create();
this.level.hide(); this.level.hide();
} }
show() { show() {
this._create();
this.level.show(); this.level.show();
} }
} }

View File

@ -6,12 +6,14 @@ class EReentry extends Group {
constructor(model) { constructor(model) {
super(); super();
this.model = model; this.model = model;
this._create(); this.isNew = false;
} }
_create() { _create() {
if (!this.isNew) {
const model = this.model; const model = this.model;
this.isNew = true;
this.reentry = new Polygon({ this.reentry = new Polygon({
zlevel: model.zlevel, zlevel: model.zlevel,
z: model.z, z: model.z,
@ -26,16 +28,20 @@ class EReentry extends Group {
this.add(this.reentry); this.add(this.reentry);
} }
}
setColor(color) { setColor(color) {
this._create();
this.reentry.setStyle('textFill', color); this.reentry.setStyle('textFill', color);
} }
hide() { hide() {
this._create();
this.reentry.hide(); this.reentry.hide();
} }
show() { show() {
this._create();
this.reentry.show(); this.reentry.show();
} }
} }

View File

@ -5,13 +5,15 @@ class ESafeEmergent extends Group {
constructor(model) { constructor(model) {
super(); super();
this.model = model; this.model = model;
this._create(); this.isNew = false;
} }
_create() { _create() {
if (!this.isNew) {
const model = this.model; const model = this.model;
const style = this.model.style; const style = this.model.style;
this.isNew = true;
this.emergent = new Isogon({ this.emergent = new Isogon({
zlevel: model.zlevel, zlevel: model.zlevel,
z: model.z, z: model.z,
@ -30,12 +32,15 @@ class ESafeEmergent extends Group {
this.add(this.emergent); this.add(this.emergent);
} }
}
hide() { hide() {
this._create();
this.emergent.hide(); this.emergent.hide();
} }
show() { show() {
this._create();
this.emergent.show(); this.emergent.show();
} }
} }

View File

@ -5,13 +5,15 @@ class ETime extends Group {
constructor(model) { constructor(model) {
super(); super();
this.model = model; this.model = model;
this._create(); this.isNew = false;
} }
_create() { _create() {
if (!this.isNew) {
const model = this.model; const model = this.model;
const style = this.model.style; const style = this.model.style;
this.isNew = true;
this.time = new Text({ this.time = new Text({
zlevel: model.zlevel, zlevel: model.zlevel,
z: model.z, z: model.z,
@ -27,24 +29,25 @@ class ETime extends Group {
this.add(this.time); this.add(this.time);
} }
}
setName(val) { setName(val) {
this.time.attr({ this._create();
style: { this.time.setStyle('text', val);
text: val
}
});
} }
setColor(color) { setColor(color) {
this._create();
this.time.setStyle('textFill', color); this.time.setStyle('textFill', color);
} }
hide() { hide() {
this._create();
this.time.hide(); this.time.hide();
} }
show() { show() {
this._create();
this.time.show(); this.time.show();
} }
} }

View File

@ -23,7 +23,7 @@ class ESwName extends Group {
textAlign: model.triangle.drictx === 1 ? 'left' : 'right', textAlign: model.triangle.drictx === 1 ? 'left' : 'right',
textVerticalAlign: model.triangle.dricty === 1 ? 'top' : 'bottom', textVerticalAlign: model.triangle.dricty === 1 ? 'top' : 'bottom',
textFont: style.textFontSize + 'px ' + style.textFontFormat, textFont: style.textFontSize + 'px ' + style.textFontFormat,
textFill: style.Switch.switchTextLossColor textFill: style.Switch.text.switchTextLossColor
} }
}); });
@ -47,7 +47,7 @@ class ESwName extends Group {
style: { style: {
lineWidth: 0, lineWidth: 0,
lineDash: [3, 3], lineDash: [3, 3],
stroke: style.Switch.switchTextBorderColor, stroke: style.Switch.text.switchTextBorderColor,
fill: style.transparentColor 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; let halfWidth = style.Section.line.width / 2;
const switchWidth = style.Section.line.width + style.Section.line.beyondWidth*2 + 0.8; 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 directx = this.triangle.drictx;
const directy = this.triangle.dricty; const directy = this.triangle.dricty;
const direct = -this.triangle.drictx * 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 arrowTextX = model.intersection.x + 10;
const arrowTextY = model.intersection.y + 15; 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 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.switchNameDistance); const nameTextY = model.namePosition.y + model.intersection.y + this.triangle.dricty * (style.Switch.text.switchNameDistance);
this.name = new ESwName({ this.name = new ESwName({
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z, z: this.z,
@ -140,13 +140,13 @@ export default class Switch extends Group {
nameTextAnimation() { nameTextAnimation() {
this.name.getNameText().animateStyle(true) this.name.getNameText().animateStyle(true)
.when(0, { textFill: this.style.backgroundColor }) .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 }) .when(2000, { textFill: this.style.backgroundColor })
.start(); .start();
this.name.getTextRect().animateStyle(true) this.name.getTextRect().animateStyle(true)
.when(0, { textFill: this.style.backgroundColor }) .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 }) .when(2000, { textFill: this.style.backgroundColor })
.start(); .start();
} }
@ -187,13 +187,13 @@ export default class Switch extends Group {
this.setHasTextBorder(0); this.setHasTextBorder(0);
switch (this.state.locateType) { switch (this.state.locateType) {
case '01': case '01':
this.setTextColor(this.style.Switch.switchLocateTextColor); this.setTextColor(this.style.Switch.text.switchTextLocateColor);
break; break;
case '02': case '02':
this.setTextColor(this.style.Switch.switchInversionColor); this.setTextColor(this.style.Switch.text.switchTextInversionColor);
break; break;
default: default:
this.setTextColor(this.style.Switch.switchTextLossColor); this.setTextColor(this.style.Switch.text.switchTextLossColor);
break; break;
} }
} }

View File

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

View File

@ -17,6 +17,7 @@ class Beijing extends defaultSkin {
/** link 字体颜色*/ /** link 字体颜色*/
linkTextColor: '#FFFFFF' linkTextColor: '#FFFFFF'
}; };
this[deviceType.Section] = { this[deviceType.Section] = {
text: { // 区段文字属性 text: { // 区段文字属性
fontSize: 10, // 字体大小 fontSize: 10, // 字体大小
@ -66,45 +67,32 @@ class Beijing extends defaultSkin {
color: '#7F7F7F' // 区段边界符颜色 color: '#7F7F7F' // 区段边界符颜色
} }
}; };
this[deviceType.Signal] = { this[deviceType.Signal] = {
/** 信号机宽度 */
signalR: 7,
/** 自动信号宽度*/
signalAutoWidth: 5,
/** 延迟解锁字体大小*/
signalDelayTextFontSize: 10,
/** 信号机名称字体大小*/
signalTextFontSize: 12,
/** 灯柱宽度*/
signalLampStandardWidth: 1.2,
/** 设备距离区段的距离*/ /** 设备距离区段的距离*/
signalDistance: 0, signalDistance: 0,
/** 信号灯按钮距离区段的距离*/ post: {
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', signalLampStandardColor: '#5578B6',
signalLampStandardWidth: 1.5
},
text: {
/** 信号机名称字体大小*/
signalTextFontSize: 12,
/** 信号灯字体默认色*/
signalDefaultTextColor: '#C0C0C0',
/** 信号灯字体锁定颜色*/
signalTextBlockColor: '#EF0C08'
},
lamp: {
/** 禁止线宽度*/
signalStopWidth: 2,
/** 信号灯边框线宽度*/
signalBorderWidth: 0.5,
/** 信号灯边框线颜色*/
signalBorderColor: '#3149C3',
/** 信号机宽度 */
signalR: 7,
/** 信号灯锁闭*/ /** 信号灯锁闭*/
signalBlockColor: '#EF0C08', signalBlockColor: '#EF0C08',
/** 信号灯灰色*/ /** 信号灯灰色*/
@ -119,7 +107,47 @@ class Beijing extends defaultSkin {
signalLampWhiteColor: '#FFFFFF', signalLampWhiteColor: '#FFFFFF',
/** 信号灯蓝色*/ /** 信号灯蓝色*/
signalLampBlueColor: '#0070C0' 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] = { this[deviceType.StationStand] = {
common: { // 通用属性 common: { // 通用属性
textFontSize: 8 // 站台默认字体大小 textFontSize: 8 // 站台默认字体大小
@ -168,6 +196,7 @@ class Beijing extends defaultSkin {
textColor: '#FFFFFF' // 停站等级字体颜色 textColor: '#FFFFFF' // 停站等级字体颜色
} }
}; };
this[deviceType.StationControl] = { this[deviceType.StationControl] = {
singleControlNum: 3, singleControlNum: 3,
stationOffset: {x: 20, y: 0}, stationOffset: {x: 20, y: 0},
@ -187,12 +216,13 @@ class Beijing extends defaultSkin {
/** 控制模式黄色*/ /** 控制模式黄色*/
stationControlYellowColor: '#FFFF00' stationControlYellowColor: '#FFFF00'
}; };
this[deviceType.Station] = { this[deviceType.Station] = {
kilometerPosition: 'down' // 公里标位置 kilometerPosition: 'down' // 公里标位置
}; };
this[deviceType.Switch] = { this[deviceType.Switch] = {
/** 道岔单边长度 */ text: {
switchLen: 6,
/** 道岔名称与区段距离*/ /** 道岔名称与区段距离*/
switchNameDistance: 2, switchNameDistance: 2,
/** 道岔边框颜色*/ /** 道岔边框颜色*/
@ -200,11 +230,16 @@ class Beijing extends defaultSkin {
/** 道岔失去颜色*/ /** 道岔失去颜色*/
switchTextLossColor: '#FFFFFF', switchTextLossColor: '#FFFFFF',
/** 道岔定位颜色*/ /** 道岔定位颜色*/
switchLocateTextColor: '#00FF00', switchTextLocateColor: '#00FF00',
/** 道岔反位颜色*/ /** 道岔反位颜色*/
switchInversionColor: '#9C9D09', switchInversionColor: '#9C9D09',
/** 道岔单锁颜色*/ /** 道岔单锁颜色*/
switchMonolockColor: '#870E10' switchMonolockColor: '#870E10'
},
core: {
/** 道岔单边长度 */
switchLen: 6
}
}; };
} }
} }

View File

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

View File

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

View File

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