Merge remote-tracking branch 'origin/test'

This commit is contained in:
fan 2022-07-14 18:15:52 +08:00
commit d2cf5489b3
219 changed files with 21968 additions and 1538 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -10,10 +10,12 @@ export default {
const sty = dragDom.currentStyle || window.getComputedStyle(dragDom, null);
dialogHeaderEl.onmousedown = (e) => {
e.stopPropagation();
e.stopPropagation();
/** 鼠标按下,计算当前元素距离可视区的距离*/
const disX = e.clientX - dialogHeaderEl.offsetLeft;
const disY = e.clientY - dialogHeaderEl.offsetTop;
const oY = e.offsetY;
const bY = dialogHeaderEl.offsetHeight - e.offsetY;
/** 获取到的值带px 正则匹配替换*/
let styL, styT;
@ -31,10 +33,18 @@ export default {
}
document.onmousemove = function (e) {
e.stopPropagation();
e.preventDefault();
e.stopPropagation();
let cY = e.clientY;
if (cY < oY) {
cY = oY;
}
if (cY > document.body.clientHeight - bY) {
cY = document.body.clientHeight - bY;
}
/** 通过事件委托,计算移动的距离*/
const l = e.clientX - disX;
const t = e.clientY - disY;
const t = cY - disY;
/** 移动当前元素*/
dragDom.style.left = `${l + styL}px`;
@ -48,7 +58,7 @@ export default {
};
document.onmouseup = function () {
e.stopPropagation();
e.stopPropagation();
document.onmousemove = null;
document.onmouseup = null;
};

View File

@ -88,8 +88,8 @@ class SkinCode extends defaultStyle {
communicationOccupiedColor: '#FF0000', // 区段通信车占用颜色 (红色)
unCommunicationOccupiedColor: '#FF0000', // 区段非通讯车占用颜色 (红色)
routeLockColor: '#FFFFFF', // 区段进路锁定颜色 (白色)
faultLockColor: '#006400', // 区段故障锁定颜色
routeLockColor: '#FFFFFF', // 区段进路锁定颜色 (白色)<------
faultLockColor: '#FF0000', // 区段故障锁定颜色 <----
undefinedColor: '#0071C1', // 区段未定义颜色
blockColor: '#00FF00', // 区段封锁颜色
@ -533,7 +533,7 @@ class SkinCode extends defaultStyle {
},
jointImg: { // 道岔 A B C D四元素属性配置
trapezoidLength: 8, // 直角梯形元素默认长度
faultStatus: true, // 挤岔表示
faultStatus: false, // 挤岔表示
fork: true, // 挤岔专用(如有挤岔操作 变为true
forKColor: 'red' // 挤岔颜色 配合挤岔专用
},
@ -546,17 +546,22 @@ class SkinCode extends defaultStyle {
rectLock: { // 矩形封锁框图形
rectWidth: 18, // 矩形框 宽高
rectBorderColor: '#fff', // 矩形边框颜色
block: true, // 封锁显示
block: false, // 封锁显示
blockColor: 'red', // 封锁颜色
followName: true // 位置跟随名称确定
},
arcBlcok: { // 圆形封锁图形
show: true, // 显示
show: false, // 显示
shapeR: 10,
arcBorderColor: 'red', // 默认边框颜色
locationColor: 'red', // 定位封锁颜色
inversionColor: 'red' // 反位封锁颜色
}
inversionColor: 'red' // 反位封锁颜色
},
switchDot: { // 岔心小圆点
show: true,
monoLockColor: '#ff0000', // 单锁 红色
lockColor: '#0000ff' // 单封 蓝色
},
};
this[deviceType.LcControl] = {

View File

@ -51,15 +51,15 @@ const deviceType = {
DirectionRod: 'DirectionRod',
Responder: 'Responder',
SignalButton: 'SignalButton',
PickArrow: 'PickArrow',
DepartArrow: 'DepartArrow',
Occlusion: 'Occlusion',
Accident: 'Accident',
Recovery: 'Recovery',
PickAssist: 'PickAssist',
DepartAssist: 'DepartAssist',
TotalAssist: 'TotalAssist',
AssistStatus: 'AssistStatus',
SectionOccupied: 'SectionOccupied'
PickArrow: 'PickArrow',
DepartArrow: 'DepartArrow',
Occlusion: 'Occlusion',
Accident: 'Accident',
Recovery: 'Recovery',
PickAssist: 'PickAssist',
DepartAssist: 'DepartAssist',
TotalAssist: 'TotalAssist',
AssistStatus: 'AssistStatus',
SectionOccupied: 'SectionOccupied'
};
export default deviceType;

View File

@ -13,6 +13,7 @@ import { deepAssign } from '@/utils/index';
import * as adapter from '@/jmapNew/utils/adapter';
import store from '@/store/index';
import Vue from 'vue';
// import {createDevice} from './parser/parser-graph';
const renderer = 'canvas';
const devicePixelRatio = 1;
@ -95,7 +96,12 @@ class Jlmap {
return defaultStateDict;
}
updateTransform(scaling, origin) {
this.$options.scaleRate = scaling;
this.$options.offsetX = origin ? origin.x : 0;
this.$options.offsetY = origin ? origin.y : 0;
this.$painter.updateTransform({ scaleRate: scaling, offsetX: origin ? origin.x : 0, offsetY: origin ? origin.y : 0 });
}
setMap(map, mapDevice, logicData) {
// 保存皮肤类型
if (map.skinVO) {
@ -406,6 +412,71 @@ class Jlmap {
});
this.$painter.$transformHandle.revisibleAll();
}
updatePicture(list = []) {
list.forEach(item => {
const device = this.mapDevice[item];
if (device && device._type !== deviceType.Switch && device._type !== deviceType.Train) {
const pictureDevice = store.getters['map/getPictureDeviceByCode'](item);
device._dispose = pictureDevice ? pictureDevice.pictureHide : false;
this.$painter.updatePicture(device);
try {
if (device._type === deviceType.Section && device.type === '03') {
this.mapDevice[device.switch.code]._dispose = pictureDevice ? pictureDevice.pictureHide : false;
this.computedSwitch(device.switch);
this.$painter.updatePicture(this.mapDevice[device.switch.code]);
}
} catch (e) { console.error(e); }
}
});
}
handleResetPoint(points) {
return (points[points.length - 1].x >= points[0].x);
}
computedSwitch(switchDevice) {
const cnodeSection = this.mapDevice[switchDevice.sectionACode];
const lnodeSection = this.mapDevice[switchDevice.sectionBCode];
const rnodeSection = this.mapDevice[switchDevice.sectionCCode];
if (cnodeSection && lnodeSection && rnodeSection) {
let sectionCStar, sectionCEnd;
const rnodeSectionPoint = rnodeSection.instance ? rnodeSection.instance.computedPoints : rnodeSection.points;
const cnodeSectionPoint = cnodeSection.instance ? cnodeSection.instance.computedPoints : cnodeSection.points;
if (this.handleResetPoint(rnodeSection.points)) {
sectionCStar = rnodeSectionPoint[rnodeSectionPoint.length - 2];
sectionCEnd = rnodeSectionPoint[1];
} else {
sectionCStar = rnodeSectionPoint[1];
sectionCEnd = rnodeSectionPoint[rnodeSectionPoint.length - 2];
}
let intersectionStar, intersectionEnd;
if (this.handleResetPoint(cnodeSection.points)) {
intersectionStar = cnodeSectionPoint[0];
intersectionEnd = cnodeSectionPoint[cnodeSectionPoint.length - 1];
} else {
intersectionStar = cnodeSectionPoint[cnodeSectionPoint.length - 1];
intersectionEnd = cnodeSectionPoint[0];
}
if (cnodeSection.points[0].x == lnodeSection.points[lnodeSection.points.length - 1].x && cnodeSection.points[0].y == lnodeSection.points[lnodeSection.points.length - 1].y) {
this.mapDevice[switchDevice.code].intersection = {
x: intersectionStar.x,
y: intersectionStar.y
};
this.mapDevice[switchDevice.code].skew = {
x: sectionCStar.x,
y: sectionCStar.y
};
} else if (cnodeSection.points[cnodeSection.points.length - 1].x == lnodeSection.points[0].x && cnodeSection.points[cnodeSection.points.length - 1].y == lnodeSection.points[0].y) {
this.mapDevice[switchDevice.code].intersection = {
x: intersectionEnd.x,
y: intersectionEnd.y
};
this.mapDevice[switchDevice.code].skew = {
x: sectionCEnd.x,
y: sectionCEnd.y
};
}
}
}
update(list = [], fetch = true) {
this.setUpdateMapDevice(list, fetch); // 增加一个 前数据 处理 为了在区段中 获取全部的 道岔信息

View File

@ -106,7 +106,6 @@ class MouseController extends Eventful {
this._x = e.offsetX;
this._y = e.offsetY;
if (e.which == 1) {
this._preventDefaultMouseMove && eventTool.stop(e.event);
this.trigger(this.events.__Pan, { dx, dy, oldX, oldY, newX: this._x, newY: this._y });
@ -251,11 +250,12 @@ class MouseController extends Eventful {
if (item.instance && item.instance._type == deviceType.Section) {
let deviceBoundingRect = {};
if (item.type == '04') {
const rect = item.instance.getNameBoundingRect();
deviceBoundingRect = {
x1: item.namePosition.x,
y1: item.namePosition.y,
x2: item.namePosition.x,
y2: item.namePosition.y
x1: rect.x,
y1: rect.y,
x2: rect.x + rect.width,
y2:rect.y + rect.height
};
} else if (item.type == '05') {
const rect = item.instance.getBoundingRect();
@ -267,10 +267,10 @@ class MouseController extends Eventful {
};
} else {
deviceBoundingRect = {
x1: item.points[0].x,
y1: item.points[0].y,
x2: item.points[item.points.length - 1].x,
y2: item.points[item.points.length - 1].y
x1: item.instance.computedPoints[0].x,
y1: item.instance.computedPoints[0].y,
x2: item.instance.computedPoints[item.points.length - 1].x,
y2: item.instance.computedPoints[item.points.length - 1].y
};
}
if (this.whetherInclude(boundingRect, deviceBoundingRect )) {
@ -288,25 +288,25 @@ class MouseController extends Eventful {
}
} else if (item.instance && item.instance._type == deviceType.Signal) {
const deviceBoundingRect = {
x1: item.position.x,
y1: item.position.y,
x2: item.position.x,
y2: item.position.y
x1: item.instance.computedPosition.x,
y1: item.instance.computedPosition.y,
x2: item.instance.computedPosition.x,
y2: item.instance.computedPosition.y
};
if (this.whetherInclude(boundingRect, deviceBoundingRect )) {
includeDeviceList.push(item);
}
} else if (item.instance && item.instance._type == deviceType.Psd) {
const deviceBoundingRect = {
x1: item.position.x,
y1: item.position.y,
x2: item.position.x,
y2: item.position.y
x1: item.instance.computedPosition.x,
y1: item.instance.computedPosition.y,
x2: item.instance.computedPosition.x,
y2: item.instance.computedPosition.y
};
if (this.whetherInclude(boundingRect, deviceBoundingRect )) {
includeDeviceList.push(item);
}
} else if (item.instance && item.instance._type !== deviceType.TrainWindow && item.instance._type !== deviceType.CheckBox && item.instance._type !== deviceType.Train) {
} // item.instance._type !== deviceType.TrainWindow &&
} else if (item.instance && item.instance._type !== deviceType.CheckBox && item.instance._type !== deviceType.Train) {
const rect = item.instance.getBoundingRect();
const deviceBoundingRect = {
x1: rect.x,

View File

@ -2,7 +2,7 @@ class Options {
constructor(opts, trigger) {
this.scaleIndex = 0;
this.scaleList = [
0.2, 0.4, 0.6, 0.8, 0.9,
0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9,
1, 1.2, 1.4, 1.6, 1.8,
2, 2.2, 2.4, 2.6, 2.8,
3, 3.2, 3.4, 3.6, 3.8,

View File

@ -162,7 +162,22 @@ class Painter {
this.$transformHandleScreen.transformView(device.instance);
}
}
/** 画面更新 */
updatePicture(device) {
if (device) {
try {
if (device._dispose) {
this.delete(device);
} else {
device.instance && this.mapInstanceLevel[device._type].remove(device.instance);
device.instance = null;
this.add(device);
}
} catch (err) {
console.error(err);
}
}
}
/**
* 更新视图
* @param {*} device
@ -182,6 +197,7 @@ class Painter {
}
} catch (err) {
console.error(err);
console.log(device, 'device');
}
}
}

View File

@ -194,7 +194,6 @@ export function parser(data, skinCode, showConfig) {
// y: rnodeSection.points[1].y
};
}
const section = mapDevice[cnodeSection.parentCode];
if (section) {
mapDevice[elem.code].sectionName = section.name;
@ -350,16 +349,16 @@ export function updateMapData(state, model) {
case deviceType.Axle: updateForList(model, state, 'indicatorLightList'); break;
case deviceType.SwitchFault: updateForList(model, state, 'indicatorLightList'); break;
case deviceType.IndicatorLight: updateForList(model, state, 'indicatorLightList'); break;
case deviceType.PickArrow: updateForList(model, state, 'indicatorLightList');break;
case deviceType.DepartArrow: updateForList(model, state, 'indicatorLightList'); break;
case deviceType.Occlusion: updateForList(model, state, 'indicatorLightList'); break;
case deviceType.Accident: updateForList(model, state, 'indicatorLightList'); break;
case deviceType.Recovery: updateForList(model, state, 'indicatorLightList'); break;
case deviceType.PickAssist: updateForList(model, state, 'indicatorLightList'); break;
case deviceType.DepartAssist: updateForList(model, state, 'indicatorLightList'); break;
case deviceType.TotalAssist: updateForList(model, state, 'indicatorLightList'); break;
case deviceType.AssistStatus: updateForList(model, state, 'indicatorLightList'); break;
case deviceType.SectionOccupied: updateForList(model, state, 'indicatorLightList'); break;
case deviceType.PickArrow: updateForList(model, state, 'indicatorLightList'); break;
case deviceType.DepartArrow: updateForList(model, state, 'indicatorLightList'); break;
case deviceType.Occlusion: updateForList(model, state, 'indicatorLightList'); break;
case deviceType.Accident: updateForList(model, state, 'indicatorLightList'); break;
case deviceType.Recovery: updateForList(model, state, 'indicatorLightList'); break;
case deviceType.PickAssist: updateForList(model, state, 'indicatorLightList'); break;
case deviceType.DepartAssist: updateForList(model, state, 'indicatorLightList'); break;
case deviceType.TotalAssist: updateForList(model, state, 'indicatorLightList'); break;
case deviceType.AssistStatus: updateForList(model, state, 'indicatorLightList'); break;
case deviceType.SectionOccupied: updateForList(model, state, 'indicatorLightList'); break;
case deviceType.SplitStation: updateForList(model, state, 'splitStationList'); break;
case deviceType.Arrow: updateForList(model, state, 'arrowList'); break;
case deviceType.Power: updateForList(model, state, 'powerLineList'); break;

View File

@ -8,6 +8,12 @@ export default class Arrow extends Group {
this._code = model.code;
this._type = model._type;
this.zlevel = model.zlevel;
const pictureDevice = store.getters['map/getPictureDeviceByCode'](model.code);
if (pictureDevice) {
this.computedPosition = pictureDevice.position;
} else {
this.computedPosition = model.position;
}
this.z = 0;
this.model = model;
// this.style = style;
@ -22,13 +28,13 @@ export default class Arrow extends Group {
z: this.z,
shape: {
points: [
[model.position.x, model.position.y],
[model.position.x + model.triangleLength, model.position.y - model.triangleHeight / 2],
[model.position.x + model.triangleLength, model.position.y - model.lineWidth / 2],
[model.position.x + model.length, model.position.y - model.lineWidth / 2],
[model.position.x + model.length, model.position.y + model.lineWidth / 2],
[model.position.x + model.triangleLength, model.position.y + model.lineWidth / 2],
[model.position.x + model.triangleLength, model.position.y + model.triangleHeight / 2]
[this.computedPosition.x, this.computedPosition.y],
[this.computedPosition.x + model.triangleLength, this.computedPosition.y - model.triangleHeight / 2],
[this.computedPosition.x + model.triangleLength, this.computedPosition.y - model.lineWidth / 2],
[this.computedPosition.x + model.length, this.computedPosition.y - model.lineWidth / 2],
[this.computedPosition.x + model.length, this.computedPosition.y + model.lineWidth / 2],
[this.computedPosition.x + model.triangleLength, this.computedPosition.y + model.lineWidth / 2],
[this.computedPosition.x + model.triangleLength, this.computedPosition.y + model.triangleHeight / 2]
]
},
style: {

View File

@ -13,8 +13,8 @@ export default class EMouse extends Group {
z: this.device.z + 1,
position: [0, 0],
style: {
x: this.device.model.position.x,
y: this.device.model.position.y + this.device.style.LcControl.lamp.radiusR + this.device.style.LcControl.text.distance - 30,
x: this.device.computedPosition.x,
y: this.device.computedPosition.y + this.device.style.LcControl.lamp.radiusR + this.device.style.LcControl.text.distance - 30,
fontWeight: 'normal',
fontSize: this.device.style.LcControl.mouseOverStyle.fontSize,
fontFamily: this.device.style.fontFamily,

View File

@ -16,6 +16,12 @@ export default class AutoTurnBack extends Group {
this._code = model.code;
this._type = model._type;
this.zlevel = model.zlevel;
const pictureDevice = store.getters['map/getPictureDeviceByCode'](model.code);
if (pictureDevice) {
this.computedPosition = pictureDevice.position;
} else {
this.computedPosition = model.position;
}
this.model = model;
this.style = style;
this.isBigScreen = false;
@ -31,8 +37,8 @@ export default class AutoTurnBack extends Group {
zlevel: this.zlevel,
z: this.z + 1,
shape: {
cx: model.position.x,
cy: model.position.y,
cx: this.computedPosition.x,
cy: this.computedPosition.y,
r: this.style.AutoTurnBack.lamp.radiusR
},
style: {
@ -47,8 +53,8 @@ export default class AutoTurnBack extends Group {
z: this.z + 1,
position: [0, 0],
style: {
x: model.position.x,
y: model.position.y + this.style.AutoTurnBack.lamp.radiusR + this.style.AutoTurnBack.text.distance,
x: this.computedPosition.x,
y: this.computedPosition.y + this.style.AutoTurnBack.lamp.radiusR + this.style.AutoTurnBack.text.distance,
fontWeight: this.style.AutoTurnBack.text.fontWeight,
fontSize: this.style.AutoTurnBack.text.fontSize,
fontFamily: this.style.fontFamily,
@ -66,8 +72,8 @@ export default class AutoTurnBack extends Group {
z: this.z,
position: [0, 0],
style: {
x: model.position.x,
y: model.position.y + this.style.AutoTurnBack.lamp.radiusR + this.style.AutoTurnBack.subtitleText.distance,
x: this.computedPosition.x,
y: this.computedPosition.y + this.style.AutoTurnBack.lamp.radiusR + this.style.AutoTurnBack.subtitleText.distance,
fontWeight: this.style.AutoTurnBack.subtitleText.fontWeight,
fontSize: this.style.AutoTurnBack.subtitleText.fontSize,
fontFamily: this.style.fontFamily,
@ -185,6 +191,6 @@ export default class AutoTurnBack extends Group {
this.hideMode();
}
getAnchorPoint() {
return this.model.position;
return this.computedPosition;
}
}

View File

@ -13,8 +13,8 @@ export default class EMouse extends Group {
z: this.device.z + 1,
position: [0, 0],
style: {
x: this.device.model.position.x,
y: this.device.model.position.y + this.device.style.LcControl.lamp.radiusR + this.device.style.LcControl.text.distance - 30,
x: this.device.computedPosition.x,
y: this.device.computedPosition.y + this.device.style.LcControl.lamp.radiusR + this.device.style.LcControl.text.distance - 30,
fontWeight: 'normal',
fontSize: this.device.style.LcControl.mouseOverStyle.fontSize,
fontFamily: this.device.style.fontFamily,

View File

@ -15,6 +15,12 @@ export default class AutomacticRoute extends Group {
this._code = model.code;
this._type = model._type;
this.zlevel = model.zlevel;
const pictureDevice = store.getters['map/getPictureDeviceByCode'](model.code);
if (pictureDevice) {
this.computedPosition = pictureDevice.position;
} else {
this.computedPosition = model.position;
}
this.model = model;
this.style = style;
this.isShowShape = true;
@ -30,8 +36,8 @@ export default class AutomacticRoute extends Group {
zlevel: this.zlevel,
z: this.z,
shape: {
cx: model.position.x,
cy: model.position.y,
cx: this.computedPosition.x,
cy: this.computedPosition.y,
r: this.style.AutomaticRoute.lamp.radiusR
},
style: {
@ -46,8 +52,8 @@ export default class AutomacticRoute extends Group {
z: this.z,
position: [0, 0],
style: {
x: model.position.x,
y: model.position.y + this.style.AutomaticRoute.lamp.radiusR + this.style.AutomaticRoute.text.distance,
x: this.computedPosition.x,
y: this.computedPosition.y + this.style.AutomaticRoute.lamp.radiusR + this.style.AutomaticRoute.text.distance,
fontWeight: this.style.AutomaticRoute.text.fontWeight,
fontSize: this.style.AutomaticRoute.text.fontSize,
fontFamily: this.style.fontFamily,
@ -65,8 +71,8 @@ export default class AutomacticRoute extends Group {
z: this.z,
position: [0, 0],
style: {
x: model.position.x,
y: model.position.y + this.style.AutomaticRoute.lamp.radiusR + this.style.AutomaticRoute.subtitleText.distance,
x: this.computedPosition.x,
y: this.computedPosition.y + this.style.AutomaticRoute.lamp.radiusR + this.style.AutomaticRoute.subtitleText.distance,
fontWeight: this.style.AutomaticRoute.subtitleText.fontWeight,
fontSize: this.style.AutomaticRoute.subtitleText.fontSize,
fontFamily: this.style.fontFamily,
@ -140,6 +146,6 @@ export default class AutomacticRoute extends Group {
this.subtitleText && this.subtitleText.show();
}
getAnchorPoint() {
return this.model.position;
return this.computedPosition;
}
}

View File

@ -13,8 +13,8 @@ export default class EMouse extends Group {
z: this.device.z + 1,
position: [0, 0],
style: {
x: this.device.model.position.x,
y: this.device.model.position.y + this.device.style.LcControl.lamp.radiusR + this.device.style.LcControl.text.distance - 30,
x: this.device.computedPosition.x,
y: this.device.computedPosition.y + this.device.style.LcControl.lamp.radiusR + this.device.style.LcControl.text.distance - 30,
fontWeight: 'normal',
fontSize: this.device.style.LcControl.mouseOverStyle.fontSize,
fontFamily: this.device.style.fontFamily,

View File

@ -15,6 +15,12 @@ export default class AxleReset extends Group {
this._code = model.code;
this._type = model._type;
this.zlevel = model.zlevel;
const pictureDevice = store.getters['map/getPictureDeviceByCode'](model.code);
if (pictureDevice) {
this.computedPosition = pictureDevice.position;
} else {
this.computedPosition = model.position;
}
this.model = model;
this.style = style;
this.isShowShape = true;
@ -30,8 +36,8 @@ export default class AxleReset extends Group {
zlevel: this.zlevel,
z: this.z,
shape: {
cx: model.position.x,
cy: model.position.y,
cx: this.computedPosition.x,
cy: this.computedPosition.y,
r: this.style.AxleReset.lamp.radiusR
},
style: {
@ -47,8 +53,8 @@ export default class AxleReset extends Group {
z: this.z,
position: [0, 0],
style: {
x: model.position.x,
y: model.position.y + this.style.AxleReset.lamp.radiusR + this.style.AxleReset.text.distance,
x: this.computedPosition.x,
y: this.computedPosition.y + this.style.AxleReset.lamp.radiusR + this.style.AxleReset.text.distance,
fontWeight: this.style.AxleReset.text.fontWeight,
fontSize: this.style.AxleReset.text.fontSize,
fontFamily: this.style.fontFamily,
@ -66,8 +72,8 @@ export default class AxleReset extends Group {
z: this.z,
position: [0, 0],
style: {
x: model.position.x,
y: model.position.y + this.style.AxleReset.lamp.radiusR + this.style.AxleReset.subtitleText.distance,
x: this.computedPosition.x,
y: this.computedPosition.y + this.style.AxleReset.lamp.radiusR + this.style.AxleReset.subtitleText.distance,
fontWeight: this.style.AxleReset.subtitleText.fontWeight,
fontSize: this.style.AxleReset.subtitleText.fontSize,
fontFamily: this.style.fontFamily,
@ -141,6 +147,6 @@ export default class AxleReset extends Group {
}
}
getAnchorPoint() {
return this.model.position;
return this.computedPosition;
}
}

View File

@ -10,6 +10,12 @@ export default class DirectionRod extends Group {
this._code = model.code;
this._type = model._type;
this.zlevel = model.zlevel;
const pictureDevice = store.getters['map/getPictureDeviceByCode'](model.code);
if (pictureDevice) {
this.computedPosition = pictureDevice.position;
} else {
this.computedPosition = model.position;
}
this.model = model;
this.style = style;
// this.isShowShape = true;
@ -23,17 +29,17 @@ export default class DirectionRod extends Group {
this.rod = new Polygon({
zlevel: this.zlevel,
z: this.z,
origin: [model.position.x + (style.DirectionRod.rodLength / 2), model.position.y],
origin: [this.computedPosition.x + (style.DirectionRod.rodLength / 2), this.computedPosition.y],
rotation: model.right ? Math.PI : 0,
shape: {
points: [
[model.position.x, model.position.y],
[model.position.x + style.DirectionRod.triangleLength, model.position.y + (style.DirectionRod.triangleHeight / 2)],
[model.position.x + style.DirectionRod.triangleLength, model.position.y + (style.DirectionRod.rodHeight / 2)],
[model.position.x + style.DirectionRod.rodLength, model.position.y + (style.DirectionRod.rodHeight / 2)],
[model.position.x + style.DirectionRod.rodLength, model.position.y - (style.DirectionRod.rodHeight / 2)],
[model.position.x + style.DirectionRod.triangleLength, model.position.y - (style.DirectionRod.rodHeight / 2)],
[model.position.x + style.DirectionRod.triangleLength, model.position.y - (style.DirectionRod.triangleHeight / 2)]
[this.computedPosition.x, this.computedPosition.y],
[this.computedPosition.x + style.DirectionRod.triangleLength, this.computedPosition.y + (style.DirectionRod.triangleHeight / 2)],
[this.computedPosition.x + style.DirectionRod.triangleLength, this.computedPosition.y + (style.DirectionRod.rodHeight / 2)],
[this.computedPosition.x + style.DirectionRod.rodLength, this.computedPosition.y + (style.DirectionRod.rodHeight / 2)],
[this.computedPosition.x + style.DirectionRod.rodLength, this.computedPosition.y - (style.DirectionRod.rodHeight / 2)],
[this.computedPosition.x + style.DirectionRod.triangleLength, this.computedPosition.y - (style.DirectionRod.rodHeight / 2)],
[this.computedPosition.x + style.DirectionRod.triangleLength, this.computedPosition.y - (style.DirectionRod.triangleHeight / 2)]
]
},
style: {
@ -44,8 +50,8 @@ export default class DirectionRod extends Group {
zlevel: this.zlevel,
z: this.z,
style: {
x: model.position.x + style.DirectionRod.fontOffsetX,
y: model.position.y + style.DirectionRod.fontOffsetY,
x: this.computedPosition.x + style.DirectionRod.fontOffsetX,
y: this.computedPosition.y + style.DirectionRod.fontOffsetY,
fontWeight: 'normal',
fontSize: style.DirectionRod.fontSize,
fontFamily: this.style.fontFamily,

View File

@ -12,6 +12,12 @@ export default class FloodGate extends Group {
this._code = model.code;
this._type = model._type;
this.zlevel = model.zlevel;
const pictureDevice = store.getters['map/getPictureDeviceByCode'](model.code);
if (pictureDevice) {
this.computedPosition = pictureDevice.position;
} else {
this.computedPosition = model.position;
}
this.z = model.z;
this.model = model;
this.style = style;
@ -26,8 +32,8 @@ export default class FloodGate extends Group {
zlevel: this.zlevel,
z: this.z,
shape: {
x: this.model.position.x,
y: this.model.position.y,
x: this.computedPosition.x,
y: this.computedPosition.y,
width: this.model.width,
height: this.model.height
},
@ -55,6 +61,6 @@ export default class FloodGate extends Group {
createMouseEvent() {
}
getAnchorPoint() {
return this.model.position;
return this.computedPosition;
}
}

View File

@ -13,8 +13,8 @@ export default class EMouse extends Group {
z: this.device.z + 1,
position: [0, 0],
style: {
x: this.device.model.position.x,
y: this.device.model.position.y + this.device.style.LcControl.lamp.radiusR + this.device.style.LcControl.text.distance - 30,
x: this.device.computedPosition.x,
y: this.device.computedPosition.y + this.device.style.LcControl.lamp.radiusR + this.device.style.LcControl.text.distance - 30,
fontWeight: 'normal',
fontSize: this.device.style.LcControl.mouseOverStyle.fontSize,
fontFamily: this.device.style.fontFamily,

View File

@ -15,6 +15,12 @@ export default class GuideLock extends Group {
this._code = model.code;
this._type = model._type;
this.zlevel = model.zlevel;
const pictureDevice = store.getters['map/getPictureDeviceByCode'](model.code);
if (pictureDevice) {
this.computedPosition = pictureDevice.position;
} else {
this.computedPosition = model.position;
}
this.model = model;
this.style = style;
this.create();
@ -29,8 +35,8 @@ export default class GuideLock extends Group {
zlevel: this.zlevel,
z: this.z,
shape: {
cx: model.position.x,
cy: model.position.y,
cx: this.computedPosition.x,
cy: this.computedPosition.y,
r: this.style.GuideLock.lamp.radiusR
},
style: {
@ -45,8 +51,8 @@ export default class GuideLock extends Group {
z: this.z,
position: [0, 0],
style: {
x: model.position.x,
y: model.position.y + this.style.GuideLock.lamp.radiusR + this.style.GuideLock.text.distance,
x: this.computedPosition.x,
y: this.computedPosition.y + this.style.GuideLock.lamp.radiusR + this.style.GuideLock.text.distance,
fontWeight: this.style.GuideLock.text.fontWeight,
fontSize: this.style.GuideLock.text.fontSize,
fontFamily: this.style.fontFamily,
@ -64,8 +70,8 @@ export default class GuideLock extends Group {
z: this.z,
position: [0, 0],
style: {
x: model.position.x,
y: model.position.y + this.style.GuideLock.lamp.radiusR + this.style.GuideLock.subtitleText.distance,
x: this.computedPosition.x,
y: this.computedPosition.y + this.style.GuideLock.lamp.radiusR + this.style.GuideLock.subtitleText.distance,
fontWeight: this.style.GuideLock.subtitleText.fontWeight,
fontSize: this.style.GuideLock.subtitleText.fontSize,
fontFamily: this.style.fontFamily,
@ -146,6 +152,6 @@ export default class GuideLock extends Group {
}
}
getAnchorPoint() {
return this.model.position;
return this.computedPosition;
}
}

View File

@ -13,8 +13,8 @@ export default class EMouse extends Group {
z: this.device.z + 1,
position: [0, 0],
style: {
x: this.device.model.position.x,
y: this.device.model.position.y + this.device.style.LcControl.lamp.radiusR + this.device.style.LcControl.text.distance - 30,
x: this.device.computedPosition.x,
y: this.device.computedPosition.y + this.device.style.LcControl.lamp.radiusR + this.device.style.LcControl.text.distance - 30,
fontWeight: 'normal',
fontSize: this.device.style.LcControl.mouseOverStyle.fontSize,
fontFamily: this.device.style.fontFamily,

View File

@ -13,6 +13,12 @@ export default class LcControl extends Group {
this._code = model.code;
this._type = model._type;
this.zlevel = model.zlevel;
const pictureDevice = store.getters['map/getPictureDeviceByCode'](model.code);
if (pictureDevice) {
this.computedPosition = pictureDevice.position;
} else {
this.computedPosition = model.position;
}
this.model = model;
this.style = style;
this.create();
@ -27,8 +33,8 @@ export default class LcControl extends Group {
z: this.z,
arc: {
shape: {
cx: model.position.x,
cy: model.position.y,
cx: this.computedPosition.x,
cy: this.computedPosition.y,
r: this.style.LcControl.lamp.radiusR
},
subType: 'Control',
@ -37,8 +43,8 @@ export default class LcControl extends Group {
},
text: {
position: [0, 0],
x: model.position.x,
y: model.position.y + this.style.LcControl.lamp.radiusR + this.style.LcControl.text.distance,
x: this.computedPosition.x,
y: this.computedPosition.y + this.style.LcControl.lamp.radiusR + this.style.LcControl.text.distance,
fontWeight: this.style.LcControl.text.fontWeight,
fontSize: this.style.LcControl.text.fontSize,
fontFamily: this.style.fontFamily,
@ -91,6 +97,6 @@ export default class LcControl extends Group {
return null;
}
getAnchorPoint() {
return this.model.position;
return this.computedPosition;
}
}

View File

@ -14,8 +14,8 @@ export default class EMouse extends Group {
z: this.device.z + 1,
position: [0, 0],
style: {
x: this.device.model.position.x,
y: this.device.model.position.y + this.device.style.LimitControl.lamp.radiusR + this.device.style.LimitControl.text.distance - 30,
x: this.device.computedPosition.x,
y: this.device.computedPosition.y + this.device.style.LimitControl.lamp.radiusR + this.device.style.LimitControl.text.distance - 30,
fontWeight: this.device.style.LimitControl.mouseOverStyle.fontWeight,
fontSize: this.device.style.LimitControl.mouseOverStyle.fontSize,
fontFamily: this.device.style.fontFormat,

View File

@ -13,6 +13,12 @@ export default class LimitControl extends Group {
this._code = model.code;
this._type = model._type;
this.zlevel = model.zlevel;
const pictureDevice = store.getters['map/getPictureDeviceByCode'](model.code);
if (pictureDevice) {
this.computedPosition = pictureDevice.position;
} else {
this.computedPosition = model.position;
}
this.model = model;
this.style = style;
this.z = 20;
@ -27,8 +33,8 @@ export default class LimitControl extends Group {
z: this.z,
arc: {
shape: {
cx: model.position.x,
cy: model.position.y,
cx: this.computedPosition.x,
cy: this.computedPosition.y,
r: this.style.LimitControl.lamp.radiusR
},
subType: 'Control',
@ -39,8 +45,8 @@ export default class LimitControl extends Group {
},
text: {
position: [0, 0],
x: model.position.x,
y: model.position.y + this.style.LimitControl.lamp.radiusR + this.style.LimitControl.text.distance,
x: this.computedPosition.x,
y: this.computedPosition.y + this.style.LimitControl.lamp.radiusR + this.style.LimitControl.text.distance,
fontWeight: this.style.LimitControl.text.fontWeight,
fontSize: this.style.LimitControl.text.fontSize,
fontFamily: this.style.fontFamily,
@ -95,6 +101,6 @@ export default class LimitControl extends Group {
return null;
}
getAnchorPoint() {
return this.model.position;
return this.computedPosition;
}
}

View File

@ -8,6 +8,18 @@ export default class Line2 extends Group {
this._code = model.code;
this._type = model._type;
this.zlevel = model.zlevel;
const pictureDevice = store.getters['map/getPictureDeviceByCode'](model.code);
if (pictureDevice) {
const points = [];
const offsetX = pictureDevice.position.x - model.points[0].x;
const offsetY = pictureDevice.position.y - model.points[0].y;
model.points.forEach(point => {
points.push({x: point.x + offsetX, y: point.y + offsetY});
});
this.computePoints = points;
} else {
this.computePoints = model.points;
}
this.z = 0;
this.model = model;
this.style = style.Line;
@ -17,10 +29,10 @@ export default class Line2 extends Group {
create() {
const model = this.model;
if (model && model.points.length > 1) {
if (this.computePoints.length > 1) {
const points = [];
const vicePoints = [];
const modelPoints = model.points;
const modelPoints = this.computePoints;
const length = modelPoints.length;
const path = window.location.href;
if (model.type === '03' && !path.includes('/map/draw')) {

View File

@ -9,6 +9,12 @@ export default class OutFrame extends Group {
this._type = model._type;
this._code = model.code;
this.style = style;
const pictureDevice = store.getters['map/getPictureDeviceByCode'](model.code);
if (pictureDevice) {
this.computedPosition = pictureDevice.position;
} else {
this.computedPosition = model.position;
}
this.zlevel = model.zlevel;
this.isBigScreen = false;
this.z = 0;
@ -22,8 +28,8 @@ export default class OutFrame extends Group {
zlevel: this.zlevel,
z: this.z,
shape: {
x: model.position.x - model.width / 2,
y: model.position.y - model.height / 2,
x: this.computedPosition.x - model.width / 2,
y: this.computedPosition.y - model.height / 2,
width: model.width,
height: model.height
},
@ -55,8 +61,8 @@ export default class OutFrame extends Group {
}
getAnchorPoint() {
return {
x: this.model.position.x - this.model.width / 2,
y: this.model.position.y - this.model.height / 2
x: this.computedPosition.x - this.model.width / 2,
y: this.computedPosition.y - this.model.height / 2
};
}
}

View File

@ -9,6 +9,12 @@ export default class OverAp extends Group {
this._code = model.code;
this._type = model._type;
this.zlevel = model.zlevel;
const pictureDevice = store.getters['map/getPictureDeviceByCode'](model.code);
if (pictureDevice) {
this.computedPoints = pictureDevice.position;
} else {
this.computedPoints = model.position;
}
this.model = model;
this.style = style;
this.z = 6;
@ -19,14 +25,14 @@ export default class OverAp extends Group {
create() {
const model = this.model;
const style = this.style;
if (model.points && style && style.Section) {
if (this.computedPoints && style && style.Section) {
this.text = new ETextName({
zlevel: this.zlevel,
z: this.z + 2,
style: this.style,
silent: false,
x: model.points.x + 30,
y: model.points.y - style.Section.line.width * 2,
x: this.computedPoints.x + 30,
y: this.computedPoints.y - style.Section.line.width * 2,
fontWeight: style.Section.name.fontWeight,
text: model.remainTime || 30,
textPosition: style.Section.name.textPosition,
@ -59,8 +65,8 @@ export default class OverAp extends Group {
this.text && this.text.attr({
style: {
text: model.remainTime,
x: model.points.x + offset,
y: model.points.y - this.style.Section.line.width * 2
x: this.computedPoints.x + offset,
y: this.computedPoints.y - this.style.Section.line.width * 2
}
});
}

View File

@ -10,6 +10,18 @@ export default class Line2 extends Group {
this._code = model.code;
this._type = model._type;
this.zlevel = model.zlevel;
const pictureDevice = store.getters['map/getPictureDeviceByCode'](model.code);
if (pictureDevice) {
const points = [];
const offsetX = pictureDevice.position.x - model.points[0].x;
const offsetY = pictureDevice.position.y - model.points[0].y;
model.points.forEach(point => {
points.push({x: point.x + offsetX, y: point.y + offsetY});
});
this.computPoints = points;
} else {
this.computPoints = model.points;
}
this.z = 0;
this.model = model;
this.style = style;
@ -22,10 +34,10 @@ export default class Line2 extends Group {
create() {
const model = this.model;
const style = this.style;
if (model && model.points.length > 1) {
if (this.computPoints > 1) {
const points = [];
for (let i = 0; i < model.points.length; i++) {
points.push([model.points[i].x, model.points[i].y]);
for (let i = 0; i < this.computPoints.length; i++) {
points.push([this.computPoints[i].x, this.computPoints[i].y]);
}
this.line = new Polyline({
zlevel: this.zlevel,
@ -47,7 +59,7 @@ export default class Line2 extends Group {
const model = this.model;
const style = this.style;
if (model && model.leftTerminal) { // 左端点
const traingle = new JTriangle(model.points[0], model.points[1]);
const traingle = new JTriangle(this.computPoints[0], this.computPoints[1]);
this.leftTerminal = new ESeparator({
style: style,
zlevel: this.zlevel,
@ -56,14 +68,14 @@ export default class Line2 extends Group {
width: model.width,
stroke: style.Power.noElectricStrokeColor,
point: {
x: model.points[0].x,
y: model.points[0].y
x: this.computPoints[0].x,
y: this.computPoints[0].y
}
});
this.add(this.leftTerminal);
}
if (model && model.rightTerminal) { // 右端点
const traingle = new JTriangle(model.points[model.points.length - 2], model.points[model.points.length - 1]);
const traingle = new JTriangle(this.computPoints[this.computPoints.length - 2], this.computPoints[this.computPoints.length - 1]);
this.rightTerminal = new ESeparator({
style: style,
zlevel: this.zlevel,
@ -72,8 +84,8 @@ export default class Line2 extends Group {
width: model.width,
stroke: style.Power.noElectricStrokeColor,
point: {
x: model.points[model.points.length - 1].x,
y: model.points[model.points.length - 1].y
x: this.computPoints[this.computPoints.length - 1].x,
y: this.computPoints[this.computPoints.length - 1].y
}
});
this.add(this.rightTerminal);

View File

@ -20,8 +20,8 @@ class EHorizontal2Door extends Group {
zlevel: this.model.zlevel,
z: this.model.z,
shape: {
x: model.position.x - model.width / 4,
y: model.position.y - (model.height / 2),
x: model.computedPosition.x - model.width / 4,
y: model.computedPosition.y - (model.height / 2),
width: model.width / 4 - 2,
height: model.height
},
@ -35,8 +35,8 @@ class EHorizontal2Door extends Group {
zlevel: this.model.zlevel,
z: this.model.z,
shape: {
x: model.position.x,
y: model.position.y - (model.height / 2),
x: model.computedPosition.x,
y: model.computedPosition.y - (model.height / 2),
width: model.width / 4 - 2,
height: model.height
},

View File

@ -17,8 +17,8 @@ class ERect2Door extends Group {
zlevel: this.model.zlevel,
z: this.model.z,
shape: {
x: stand.position.x - (stand.width / 2) - 5,
y: stand.position.y - (stand.height / 2) - 5,
x: stand.computedPosition.x - (stand.width / 2) - 5,
y: stand.computedPosition.y - (stand.height / 2) - 5,
width: stand.width + 10,
height: stand.height + 10
},

View File

@ -21,8 +21,8 @@ class ESafeDoor extends Group {
zlevel: this.model.zlevel,
z: this.model.z,
shape: {
x: model.position.x - model.width / 2 - padding,
y: model.position.y - (model.height / 2),
x: model.computedPosition.x - model.width / 2 - padding,
y: model.computedPosition.y - (model.height / 2),
width: model.width,
height: model.height
},
@ -37,8 +37,8 @@ class ESafeDoor extends Group {
zlevel: this.model.zlevel,
z: this.model.z + 1,
shape: {
x: model.position.x - model.width / 4 - padding,
y: model.position.y - (model.height / 2) - 1,
x: model.computedPosition.x - model.width / 4 - padding,
y: model.computedPosition.y - (model.height / 2) - 1,
width: model.width / 2 + padding * 2,
height: model.height + 2
},

View File

@ -26,10 +26,10 @@ class EVertical2Door extends Group {
zlevel: this.model.zlevel,
z: this.model.z,
shape: {
x1:model.position.x - model.width / 2,
y1:model.position.y - (model.height / 2) + (1 + offesetY ) / 2 * (2 + (model.height)),
x2:model.position.x + model.width / 2,
y2:model.position.y - (model.height / 2) + (1 + offesetY ) / 2 * (2 + (model.height))
x1:model.computedPosition.x - model.width / 2,
y1:model.computedPosition.y - (model.height / 2) + (1 + offesetY ) / 2 * (2 + (model.height)),
x2:model.computedPosition.x + model.width / 2,
y2:model.computedPosition.y - (model.height / 2) + (1 + offesetY ) / 2 * (2 + (model.height))
},
style: {
lineWidth: (model.height),
@ -42,10 +42,10 @@ class EVertical2Door extends Group {
zlevel: this.model.zlevel,
z: this.model.z,
shape: {
x1:model.position.x - model.width / 2,
y1:model.position.y - (model.height / 2) + (1 - offesetY) / 2 * ((model.height) + 2),
x2:model.position.x + model.width / 2,
y2:model.position.y - (model.height / 2) + (1 - offesetY) / 2 * ((model.height) + 2)
x1:model.computedPosition.x - model.width / 2,
y1:model.computedPosition.y - (model.height / 2) + (1 - offesetY) / 2 * ((model.height) + 2),
x2:model.computedPosition.x + model.width / 2,
y2:model.computedPosition.y - (model.height / 2) + (1 - offesetY) / 2 * ((model.height) + 2)
},
style: {
lineWidth: (model.height),

View File

@ -13,6 +13,12 @@ export default class Line2 extends Group {
this._code = model.code;
this._type = model._type;
this.zlevel = model.zlevel;
const pictureDevice = store.getters['map/getPictureDeviceByCode'](model.code);
if (pictureDevice) {
this.computedPosition = pictureDevice.position;
} else {
this.computedPosition = model.position;
}
this.z = 1;
this.model = model;
this.style = style;
@ -24,6 +30,7 @@ export default class Line2 extends Group {
create() {
/** 屏蔽门*/
const model = this.model;
model.computedPosition = this.computedPosition;
const style = this.style;
// 站台所有的绘图元素
const elementTypeList = {
@ -85,6 +92,6 @@ export default class Line2 extends Group {
}
}
getAnchorPoint() {
return this.model.position;
return this.computedPosition;
}
}

View File

@ -11,6 +11,12 @@ export default class Resource extends Group {
this._code = model.code;
this._type = model._type;
this.zlevel = model.zlevel;
const pictureDevice = store.getters['map/getPictureDeviceByCode'](model.code);
if (pictureDevice) {
this.computedPosition = pictureDevice.position;
} else {
this.computedPosition = model.position;
}
this.model = model;
this.style = style;
this.z = model.zIndex || 1;
@ -23,14 +29,14 @@ export default class Resource extends Group {
zlevel: this.zlevel,
z: this.z,
origin: {
x: model.position.x,
y: model.position.y
x: this.computedPosition.x,
y: this.computedPosition.y
},
rotation: -Math.PI / 180 * model.rotate,
style: {
image: model.url,
x: model.position.x,
y: model.position.y,
x: this.computedPosition.x,
y: this.computedPosition.y,
width: model.width,
height: model.height
}
@ -55,7 +61,7 @@ export default class Resource extends Group {
// 整体图片
transformRotation(item) {
if (this.model.rotate) {
const origin = [this.model.position.x, this.model.position.y];
const origin = [this.computedPosition.x, this.computedPosition.y];
const rotation = -Math.PI / 180 * Number(this.model.rotate);
item.origin = origin;
item.rotation = rotation;
@ -75,6 +81,6 @@ export default class Resource extends Group {
return null;
}
getAnchorPoint() {
return this.model.position;
return this.computedPosition;
}
}

View File

@ -30,6 +30,12 @@ export default class Responder extends Group {
this._code = model.code;
this._type = model._type;
this.zlevel = model.zlevel;
const pictureDevice = store.getters['map/getPictureDeviceByCode'](model.code);
if (pictureDevice) {
this.computedPosition = pictureDevice.position;
} else {
this.computedPosition = model.position;
}
this.model = model;
this.style = style;
this.anchorPoint = {x: 0, y: 0};
@ -50,8 +56,8 @@ export default class Responder extends Group {
const blockWidth = responderStyle.block.width || 5;
const blockHeight = responderStyle.block.height || 12;
const blockStyle = responderStyle.block.mapStyle[model.type] || { fill: '#fff'};
const blockX = model.position.x - blockWidth / 2 - distanceX;
const blockY = model.position.y - blockHeight / 2 - distanceY;
const blockX = this.computedPosition.x - blockWidth / 2 - distanceX;
const blockY = this.computedPosition.y - blockHeight / 2 - distanceY;
this.anchorPoint = {x:blockX, y:blockY};
const textRadian = -Math.PI / 180 * Number(180 - model.textRotate);
const textDistanceX = model.textOffset.y * Math.sin(textRadian) + model.textOffset.x * Math.cos(textRadian);
@ -60,7 +66,7 @@ export default class Responder extends Group {
const textY = blockY + textDistanceY;
const textName = `${model.type}-${model.name}`;
const textFill = responderStyle.text.textFill;
const origin = [model.position.x, model.position.y];
const origin = [this.computedPosition.x, this.computedPosition.y];
const deltaFill = responderStyle.delta.fill;
const padding = 1.2;

View File

@ -13,8 +13,8 @@ export default class EMouse extends Group {
z: this.device.z + 1,
position: [0, 0],
style: {
x: this.device.model.position.x,
y: this.device.model.position.y + this.device.deviceStyle.lamp.radiusR + this.device.deviceStyle.text.distance - 30,
x: this.device.computedPosition.x,
y: this.device.computedPosition.y + this.device.deviceStyle.lamp.radiusR + this.device.deviceStyle.text.distance - 30,
fontWeight: 'normal',
fontSize: this.device.deviceStyle.mouseOverStyle.fontSize,
fontFamily: this.device.style.fontFamily,

View File

@ -20,6 +20,12 @@ export default class SaidLamp extends Group {
this._code = model.code;
this._type = model._type;
this.zlevel = model.zlevel;
const pictureDevice = store.getters['map/getPictureDeviceByCode'](model.code);
if (pictureDevice) {
this.computedPosition = pictureDevice.position;
} else {
this.computedPosition = model.position;
}
this.model = model;
this.style = style;
this.deviceStyle = style[model._type];
@ -41,8 +47,8 @@ export default class SaidLamp extends Group {
z: this.z,
arc: {
shape: {
cx: model.position.x,
cy: model.position.y,
cx: this.computedPosition.x,
cy: this.computedPosition.y,
r: this.deviceStyle.lamp.radiusR
},
subType: 'Control',
@ -52,8 +58,8 @@ export default class SaidLamp extends Group {
},
text: {
position: [0, 0],
x: model.position.x,
y: model.position.y + this.deviceStyle.lamp.radiusR + this.deviceStyle.text.distance,
x: this.computedPosition.x,
y: this.computedPosition.y + this.deviceStyle.lamp.radiusR + this.deviceStyle.text.distance,
fontWeight: this.deviceStyle.text.fontWeight,
fontSize: this.deviceStyle.text.fontSize,
fontFamily: this.style.fontFamily,
@ -69,8 +75,8 @@ export default class SaidLamp extends Group {
this.control = new ELampFilament({
zlevel: this.zlevel,
z: this.z,
x: model.position.x,
y: model.position.y,
x: this.computedPosition.x,
y: this.computedPosition.y,
_subType: 'LampFilament',
width: this.deviceStyle.width,
fill: this.deviceStyle.defaultColor
@ -80,8 +86,8 @@ export default class SaidLamp extends Group {
this.control = new EControlSwitch({
zlevel: this.zlevel,
z: this.z,
x: model.position.x,
y: model.position.y,
x: this.computedPosition.x,
y: this.computedPosition.y,
_subType: 'ControlSwitch',
width: this.deviceStyle.width,
fill: this.deviceStyle.defaultColor
@ -91,8 +97,8 @@ export default class SaidLamp extends Group {
this.control = new EDeviceStatus({
zlevel: this.zlevel,
z: this.z,
x: model.position.x,
y: model.position.y,
x: this.computedPosition.x,
y: this.computedPosition.y,
mfNum: model.mfNum,
pfNum: model.pfNum,
style: this.style
@ -102,8 +108,8 @@ export default class SaidLamp extends Group {
this.control = new EFoldbackMode({
zlevel: this.zlevel,
z: this.z,
x: model.position.x,
y: model.position.y,
x: this.computedPosition.x,
y: this.computedPosition.y,
width: this.deviceStyle.rectWidth,
style: this.style
});
@ -112,8 +118,8 @@ export default class SaidLamp extends Group {
this.control = new EModeStatus({
zlevel: this.zlevel,
z: this.z,
x: model.position.x,
y: model.position.y,
x: this.computedPosition.x,
y: this.computedPosition.y,
style: this.style
});
this.add(this.control);
@ -121,8 +127,8 @@ export default class SaidLamp extends Group {
this.control = new EAxle({
zlevel: this.zlevel,
z: this.z,
x: model.position.x,
y: model.position.y,
x: this.computedPosition.x,
y: this.computedPosition.y,
style: this.style
});
this.add(this.control);
@ -131,8 +137,8 @@ export default class SaidLamp extends Group {
this.control = new EUnmanned({
zlevel: this.zlevel,
z: this.z,
x: model.position.x,
y: model.position.y,
x: this.computedPosition.x,
y: this.computedPosition.y,
_subType: 'Unmanned',
width: this.style.NoOneReturn.width,
fill: this.style.NoOneReturn.defaultColor
@ -144,8 +150,8 @@ export default class SaidLamp extends Group {
z: this.z,
arc: {
shape: {
cx: model.position.x,
cy: model.position.y,
cx: this.computedPosition.x,
cy: this.computedPosition.y,
r: this.deviceStyle.lamp.radiusR
},
subType: 'Control',
@ -154,8 +160,8 @@ export default class SaidLamp extends Group {
},
text: {
position: [0, 0],
x: model.position.x,
y: model.position.y + this.deviceStyle.lamp.radiusR + this.deviceStyle.text.distance,
x: this.computedPosition.x,
y: this.computedPosition.y + this.deviceStyle.lamp.radiusR + this.deviceStyle.text.distance,
fontWeight: this.deviceStyle.text.fontWeight,
fontSize: this.deviceStyle.text.fontSize,
fontFamily: this.style.fontFamily,
@ -172,19 +178,19 @@ export default class SaidLamp extends Group {
this.control = new EIndicatorLight({
zlevel: this.zlevel,
z: this.z,
x: model.position.x,
y: model.position.y,
x: this.computedPosition.x,
y: this.computedPosition.y,
text: model.name,
style: this.style,
_subType: 'IndicatorLight'
});
this.add(this.control);
} else if (this._type === 'PickArrow' || this._type === 'DepartArrow') {
this.control = new EPickOrDepartArrow({
this.control = new EPickOrDepartArrow({
zlevel: this.zlevel,
z: this.z,
x: model.position.x,
y: model.position.y,
x: this.computedPosition.x,
y: this.computedPosition.y,
text: model.name,
right: model.right,
style: this.style,

View File

@ -24,14 +24,14 @@ export default class EAxle extends Group {
createAxleLeft() {
const model = this.model.modelData;
const traingle = new JTriangle(model.points[0], model.points[1]);
const computedPoints = this.model.computedPoints;
const traingle = new JTriangle(computedPoints[0], computedPoints[1]);
const drictx = 1;
const dricty = model.leftAxlePosition === 1 || model.leftAxlePosition === 2 ? 1 : -1;
const isSpecial = model.leftAxlePosition === -2 || model.leftAxlePosition === 2;
const difference = model.points[0].y - model.points[1].y;
const difference = computedPoints[0].y - computedPoints[1].y;
let point = {};
point = {x:model.points[0].x, y: model.points[0].y};
point = {x:computedPoints[0].x, y: computedPoints[0].y};
if (model.leftAxleOffset) {
point.x = point.x + model.leftAxleOffset.x || 0;
point.y = point.y + model.leftAxleOffset.y || 0;
@ -48,15 +48,16 @@ export default class EAxle extends Group {
createAxleRight() {
const model = this.model.modelData;
const length = model.points.length;
const traingle = new JTriangle(model.points[length - 2], model.points[length - 1]);
const computedPoints = this.model.computedPoints;
const length = computedPoints.length;
const traingle = new JTriangle(computedPoints[length - 2], computedPoints[length - 1]);
const drictx = -1;
const dricty = model.rightAxlePosition === 1 || model.rightAxlePosition === 2 ? 1 : -1;
const isSpecial = model.rightAxlePosition === -2 || model.rightAxlePosition === 2;
const difference = model.points[length - 2].y - model.points[length - 1].y;
const difference = computedPoints[length - 2].y - computedPoints[length - 1].y;
let point = {};
point = {x:model.points[length - 1].x, y: model.points[length - 1].y};
point = {x:computedPoints[length - 1].x, y: computedPoints[length - 1].y};
if (model.rightAxleOffset) {
point.x = point.x + model.rightAxleOffset.x || 0;
point.y = point.y + model.rightAxleOffset.y || 0;

View File

@ -19,16 +19,16 @@ export default class EBackArrowGroup extends Group {
const height = style.Section.line.width * 1;
const turnBackDistance = style.Section.shuttleBack.distance + radius * 4;
const points = model.points;
const computedPoints = this.model.computedPoints;
let x = -model.drict * width * 1.2;
let y = -turnBackDistance;
if (model.drict < 0) {
x += points[0].x;
y += points[0].y;
x += computedPoints[0].x;
y += computedPoints[0].y;
} else {
x += points[points.length - 1].x;
y += points[points.length - 1].y;
x += computedPoints[computedPoints.length - 1].x;
y += computedPoints[computedPoints.length - 1].y;
}
this.turnBack = new EBackArrow({

View File

@ -16,9 +16,10 @@ export default class EBadShunt extends Group {
// 分路不良
const model = this.model.modelData;
const style = this.model.style;
const computedPoints = this.model.computedPoints;
/** 创建区段*/
if (model && model.points.length > 1) {
const traingle = new JTriangle(model.points[0], model.points[model.points.length - 1]);
if (computedPoints.length > 1) {
const traingle = new JTriangle(computedPoints[0], computedPoints[computedPoints.length - 1]);
let x = traingle.drictx * (style.Section.badShunt.distance) * traingle.getSinRate();
let y = traingle.dricty * (style.Section.badShunt.distance) * traingle.getCosRate();
if (x == Infinity) { x = 0; }
@ -32,7 +33,7 @@ export default class EBadShunt extends Group {
isSwitchSection: model.switchSection,
relSwitchCode: model.relSwitchCode,
isCurve: model.curve, // 是否曲线
points: model.points
points: computedPoints
});
// 下侧临时限速线
const badShuntRight = this.createLimit({
@ -42,7 +43,7 @@ export default class EBadShunt extends Group {
isSwitchSection: model.switchSection,
relSwitchCode: model.relSwitchCode,
isCurve: model.curve, // 是否曲线
points: model.points
points: computedPoints
});
badShuntLeft.forEach(item => {
this.add(item);

View File

@ -1,85 +1,87 @@
import Group from "zrender/src/container/Group";
import Text from "zrender/src/graphic/Text";
import Polygon from "zrender/src/graphic/shape/Polygon";
import Group from 'zrender/src/container/Group';
import Text from 'zrender/src/graphic/Text';
import Polygon from 'zrender/src/graphic/shape/Polygon';
class EDerailer extends Group {
constructor(model) {
super();
this.zlevel = model.zlevel;
constructor(model) {
super();
this.zlevel = model.zlevel;
this.z = model.z;
this.style = model.style;
this.model = model;
this.create();
}
this.style = model.style;
this.model = model;
this.create();
}
create() {
this.createText();
this.createSymbol();
}
create() {
this.createText();
this.createSymbol();
}
createText() {
const style = this.model.style;
const model = this.model.modelData;
const length = model.points.length;
const offset = style.Section.derailer.text.offset||{};
const offsetX = offset.x||0;
const offsetY = offset.y||0;
const positionX = (model.points[0].x + model.points[length-1].x) / 2 + offsetX;
const positionY = (model.points[0].y + model.points[length-1].y) / 2 + offsetY;
createText() {
const style = this.model.style;
// const model = this.model.modelData;
const computedPoints = this.model.computedPoints;
const length = computedPoints.length;
const offset = style.Section.derailer.text.offset || {};
const offsetX = offset.x || 0;
const offsetY = offset.y || 0;
const positionX = (computedPoints[0].x + computedPoints[length - 1].x) / 2 + offsetX;
const positionY = (computedPoints[0].y + computedPoints[length - 1].y) / 2 + offsetY;
this.text = new Text({
zlevel: this.zlevel,
z: this.z,
style: {
x: positionX,
this.text = new Text({
zlevel: this.zlevel,
z: this.z,
style: {
x: positionX,
y: positionY,
text: 'T',
text: 'T',
fontWeight: style.fontWeight,
fontSize: style.fontSize,
fontFamily: style.fontFamily,
textFill: style.Section.derailer.text.color,
textPosition: 'inside',
textPosition: 'inside',
textAlign: 'center',
textVerticalAlign: 'center'
}
})
this.add(this.text);
}
}
});
this.add(this.text);
}
createSymbol() {
const style = this.model.style;
const model = this.model.modelData;
const length = model.points.length;
const offset = style.Section.derailer.symbol.offset||{};
const offsetX = offset.x||0;
const offsetY = offset.y||0;
const pointX = (model.points[0].x + model.points[length-1].x) / 2 + offsetX;
const pointY = (model.points[0].y + model.points[length-1].y) / 2 + offsetY;
createSymbol() {
const style = this.model.style;
// const model = this.model.modelData;
const length = this.model.computedPoints.length;
const computedPoints = this.model.computedPoints;
const offset = style.Section.derailer.symbol.offset || {};
const offsetX = offset.x || 0;
const offsetY = offset.y || 0;
const pointX = (computedPoints[0].x + computedPoints[length - 1].x) / 2 + offsetX;
const pointY = (computedPoints[0].y + computedPoints[length - 1].y) / 2 + offsetY;
this.symbol = new Polygon({
zlevel: this.zlevel,
z: this.z,
shape: {
points: [
[pointX-3, pointY],
[pointX, pointY-8],
[pointX+3, pointY]
]
},
style: {
fill: style.Section.derailer.symbol.color,
}
})
this.add(this.symbol);
}
this.symbol = new Polygon({
zlevel: this.zlevel,
z: this.z,
shape: {
points: [
[pointX - 3, pointY],
[pointX, pointY - 8],
[pointX + 3, pointY]
]
},
style: {
fill: style.Section.derailer.symbol.color
}
});
this.add(this.symbol);
}
setTextStyle(style) {
this.text && this.text.setStyle(style);
}
setTextStyle(style) {
this.text && this.text.setStyle(style);
}
setSymbolStyle(style) {
this.symbol && this.symbol.setStyle(style);
}
setSymbolStyle(style) {
this.symbol && this.symbol.setStyle(style);
}
}
export default EDerailer;

View File

@ -16,9 +16,10 @@ export default class ELimitLines extends Group {
create() {
const model = this.model.modelData;
const style = this.model.style;
const computedPoints = this.model.computedPoints;
/** 创建区段*/
if (model && model.points.length > 1) {
const traingle = new JTriangle(model.points[0], model.points[model.points.length - 1]);
if (computedPoints.length > 1) {
const traingle = new JTriangle(computedPoints[0], computedPoints[computedPoints.length - 1]);
let x = traingle.drictx * (style.Section.speedLimit.distance) * traingle.getSinRate();
let y = traingle.dricty * (style.Section.speedLimit.distance) * traingle.getCosRate();
if (x == Infinity) { x = 0; }
@ -32,7 +33,7 @@ export default class ELimitLines extends Group {
isSwitchSection: model.switchSection,
relSwitchCode: model.relSwitchCode,
isCurve: model.curve, // 是否曲线
points: model.points
points: computedPoints
});
// 下侧临时限速线
const speedLimitRight = this.createLimit({
@ -42,7 +43,7 @@ export default class ELimitLines extends Group {
isSwitchSection: model.switchSection,
relSwitchCode: model.relSwitchCode,
isCurve: model.curve, // 是否曲线
points: model.points
points: computedPoints
});
speedLimitLeft.forEach(item => {
this.add(item);

View File

@ -13,15 +13,15 @@ export default class ELimitName extends Group {
create() {
/** 创建区段*/
const model = this.model.modelData;
// const model = this.model.modelData;
const style = this.model.style;
const computedPoints = this.model.computedPoints;
const rectW = style.Section.speedLimitName.drogueWidth;
const rectH = style.Section.speedLimitName.drogueHeight;
const x1 = model.points[0].x;
const y1 = model.points[0].y + style.Section.speedLimitName.limitValueDistance;
const x2 = model.points[model.points.length - 1].x;
const y2 = model.points[model.points.length - 1].y + style.Section.speedLimitName.limitValueDistance;
const x1 = computedPoints[0].x;
const y1 = computedPoints[0].y + style.Section.speedLimitName.limitValueDistance;
const x2 = computedPoints[computedPoints.length - 1].x;
const y2 = computedPoints[computedPoints.length - 1].y + style.Section.speedLimitName.limitValueDistance;
if (style.Section.speedLimitName.leftName) {
const leftPoints = style.Section.speedLimitName.nameBackgroundIsRect ? [[x1, y1],
[x1 + rectW, y1],

View File

@ -35,10 +35,10 @@ export default class ELines extends Group {
const relateSectionList = model.relateSectionList;
const sectionA = store.getters['map/getDeviceByCode'](relateSectionList[0]);
const sectionB = store.getters['map/getDeviceByCode'](relateSectionList[1]);
const endPointA = sectionA.points[sectionA.points.length - 1];
const startPointA = sectionA.points[0];
const endPointB = sectionB.points[sectionB.points.length - 1];
const startPointB = sectionB.points[0];
const endPointA = sectionA.instance.computedPoints[sectionA.instance.computedPoints.length - 1];
const startPointA = sectionA.instance.computedPoints[0];
const endPointB = sectionB.instance.computedPoints[sectionB.instance.computedPoints.length - 1];
const startPointB = sectionB.instance.computedPoints[0];
const result = segmentsIntr(startPointA, endPointA, startPointB, endPointB);
// this.cross = new Polyline({
// zlevel: this.zlevel,
@ -167,10 +167,11 @@ export default class ELines extends Group {
createLine() {
const model = this.model.modelData;
const style = this.model.style;
const computedPoints = this.model.computedPoints; // 30
const Z = model.type == '02' ? this.z + 1 : this.z;
const modelPoints = model.type == '04' ? [model.namePosition, model.namePosition] : model.points;
const modelPoints = model.type == '04' ? [model.namePosition, model.namePosition] : computedPoints;
const isCurve = model.curve;
/** 创建区段*/
if (model && modelPoints.length > 1) {

View File

@ -77,23 +77,24 @@ class EMouse extends Group {
this.lineBorder.hide();
}
} else {
const model = this.device.model;
// const model = this.device.model;
const computedPoints = this.device.computedPoints;
let points = [];
const pointsReverse = [];
model.points.forEach((ele, index) => {
computedPoints.forEach((ele, index) => {
let flag = false;
if (index == model.points.length - 1) {
this.triangle = new JTriangle(model.points[index - 1], ele);
if (index == computedPoints.length - 1) {
this.triangle = new JTriangle(computedPoints[index - 1], ele);
} else {
this.triangle = new JTriangle(ele, model.points[index + 1]);
this.triangle = new JTriangle(ele, computedPoints[index + 1]);
}
const directy = this.triangle.dricty;
if (index > 0) {
if (model.points[index - 1].y == ele.y || index < model.points.length - 1 && model.points[index + 1].y == ele.y) {
if (computedPoints[index - 1].y == ele.y || index < computedPoints.length - 1 && computedPoints[index + 1].y == ele.y) {
flag = true;
}
} else {
if (model.points[index + 1].y == ele.y) {
if (computedPoints[index + 1].y == ele.y) {
flag = true;
}
}
@ -152,7 +153,7 @@ class EMouse extends Group {
this.TextName && this.TextName.show();
this.sectionTextBorder && this.sectionTextBorder.show();
if (this.device.model.type != '03') {
this.lineBorder && this.lineBorder.show();
this.lineBorder && this.lineBorder.show();
}
const instance = this.getInstanceByCode(this.device.model.trainWindowCode);
if (instance && instance.mouseEvent && instance.mouseEvent.mouseEnter) {

View File

@ -23,15 +23,16 @@ export default class ESeparator extends Group {
create() {
/** 创建区段*/
const model = this.model.modelData;
const computedPoints = this.model.computedPoints;
const style = this.model.style;
if (model && style && model.points && model.points.length > 1) {
if (model && style && computedPoints && computedPoints.length > 1) {
/** 创建左侧分隔符*/
const traingleLeft = new JTriangle(model.points[0], model.points[1]);
const traingleLeft = new JTriangle(computedPoints[0], computedPoints[1]);
this.lPartition = this.setType({
traingle: traingleLeft,
point: {
x: model.points[0].x,
y: model.points[0].y
x: computedPoints[0].x,
y: computedPoints[0].y
},
sepType: model.sepTypeLeft,
drict: -1, // 方向
@ -39,12 +40,12 @@ export default class ESeparator extends Group {
});
/** 创建右侧分隔符*/
const traingleRight = new JTriangle(model.points[model.points.length - 2], model.points[model.points.length - 1]);
const traingleRight = new JTriangle(computedPoints[computedPoints.length - 2], computedPoints[computedPoints.length - 1]);
this.rPartition = this.setType({
traingle: traingleRight,
point: {
x: model.points[model.points.length - 1].x,
y: model.points[model.points.length - 1].y
x: computedPoints[computedPoints.length - 1].x,
y: computedPoints[computedPoints.length - 1].y
},
sepType: model.sepTypeRight,
drict: 1, // 方向

View File

@ -16,7 +16,7 @@ export default class EStopRouteImg extends Group {
create() {
const model = this.model.modelData;
const style = this.model.style;
const modelPoints = model.points;
const modelPoints = this.model.computedPoints;
if (model.type !== '04') {
const image = new Image(5, 8);
image.src = Stop_Route;

View File

@ -13,15 +13,16 @@ class ETextName extends Group {
create() {
const model = this.model.modelData;
const styleModel = this.model.style.Section[this.model.type];
const computedPoints = this.model.computedPoints;
let styleX = '';
let styleY = '';
let styleName = '';
let isCreate = false;
// 计算区段坐标位置
const x = Math.min(model.points[0].x, model.points[model.points.length - 1].x) + Math.abs(model.points[model.points.length - 1].x - model.points[0].x) / 2;
const y = Math.min(model.points[0].y, model.points[model.points.length - 1].y) + Math.abs(model.points[model.points.length - 1].y - model.points[0].y) / 2;
const traingle = new JTriangle(model.points[0], model.points[model.points.length - 1]);
const x = Math.min(computedPoints[0].x, computedPoints[computedPoints.length - 1].x) + Math.abs(computedPoints[computedPoints.length - 1].x - computedPoints[0].x) / 2;
const y = Math.min(computedPoints[0].y, computedPoints[computedPoints.length - 1].y) + Math.abs(computedPoints[computedPoints.length - 1].y - computedPoints[0].y) / 2;
const traingle = new JTriangle(computedPoints[0], computedPoints[computedPoints.length - 1]);
const drict = model.trainPosType != '01' ? 1 : -1;
if (this.model.type == 'name') {
if (model.type == '01' && !model.parentCode) { // 物理区段名称

View File

@ -26,20 +26,20 @@ export default class ELines extends Group {
/** 创建区段*/
const model = this.model.modelData;
const style = this.model.style;
const computedPoints = this.model.computedPoints;
const isCurve = model.curve;
if (model && model.points.length > 1) {
if (computedPoints.length > 1) {
if (isCurve) { // 曲线 用贝塞尔曲线绘图 封锁 必须4个点来绘图
const shape = {};
for (let i = 1; i < (model.points.length - 1); i++) {
shape[`cpx${i}`] = model.points[i].x;
shape[`cpy${i}`] = model.points[i].y;
for (let i = 1; i < (computedPoints.length - 1); i++) {
shape[`cpx${i}`] = computedPoints[i].x;
shape[`cpy${i}`] = computedPoints[i].y;
}
shape[`x1`] = model.points[0].x;
shape[`y1`] = model.points[0].y;
shape[`x2`] = model.points[model.points.length - 1].x;
shape[`y2`] = model.points[model.points.length - 1].y;
shape[`x1`] = computedPoints[0].x;
shape[`y1`] = computedPoints[0].y;
shape[`x2`] = computedPoints[computedPoints.length - 1].x;
shape[`y2`] = computedPoints[computedPoints.length - 1].y;
this.section = new BezierCurve({
isLine: true,
zlevel: this.zlevel,
@ -55,19 +55,19 @@ export default class ELines extends Group {
});
this.add(this.section);
} else {
if (model.points.length == 2) {
const spaceX = (model.points[1].x - model.points[0].x) / 3;
const spaceY = (model.points[1].y - model.points[0].y) / 3;
if (computedPoints.length == 2) {
const spaceX = (computedPoints[1].x - computedPoints[0].x) / 3;
const spaceY = (computedPoints[1].y - computedPoints[0].y) / 3;
this.sectionM = new Line({
isLine: true,
zlevel: this.zlevel,
progressive: model.progressive,
z: this.z,
shape: {
x1: model.points[0].x + spaceX,
y1: model.points[0].y + spaceY,
x2: model.points[0].x + spaceX + spaceX,
y2: model.points[0].y + spaceY + spaceY
x1: computedPoints[0].x + spaceX,
y1: computedPoints[0].y + spaceY,
x2: computedPoints[0].x + spaceX + spaceX,
y2: computedPoints[0].y + spaceY + spaceY
},
style: {
lineWidth: style.Section.line.width,

View File

@ -58,8 +58,19 @@ export default class Section extends Group {
this._type = model._type;
this.zlevel = model.zlevel;
const amendData = store.getters['map/amendPoints'](this._code);
const pictureDevice = store.getters['map/getPictureDeviceByCode'](model.code);
if (amendData) {
model.points = amendData.points;
this.computedPoints = amendData.points;
} else if (pictureDevice) {
const points = [];
const offsetX = pictureDevice.position.x - model.points[0].x;
const offsetY = pictureDevice.position.y - model.points[0].y;
model.points.forEach(point => {
points.push({x: point.x + offsetX, y: point.y + offsetY});
});
this.computedPoints = points;
} else {
this.computedPoints = model.points;
}
this.z = 5 + parseInt(model.layer || 0);
this.model = model;
@ -116,6 +127,7 @@ export default class Section extends Group {
z: this.z + elementZ,
style: style,
type: element,
computedPoints: this.computedPoints,
modelData: model
});
this.add(this[element]);
@ -530,8 +542,8 @@ export default class Section extends Group {
}
}
// 分路不良
// model.shuntingTypeList.length > 0 &&
model.badShunt&& this.badShuntStatus();
// model.shuntingTypeList.length > 0 &&
model.badShunt && this.badShuntStatus();
}
}
@ -557,7 +569,11 @@ export default class Section extends Group {
return this.name.getBoundingRect();
}
}
getNameBoundingRect() {
if (this.name && this.name.getBoundingRect()) {
return this.name.getBoundingRect();
} else { return {}; }
}
createMouseEvent() { // 鼠标事件
if (this.style.Section.mouseOverStyle) {
this.mouseEvent = new EMouse(this, this.model.relSwitchCode);

View File

@ -190,9 +190,14 @@ class Signal extends Group {
this._code = model.code;
this._type = model._type;
const amendData = store.getters['map/amendPoints'](this._code);
const pictureDevice = store.getters['map/getPictureDeviceByCode'](model.code);
if (amendData) {
model.position = amendData.position;
model.rotate = amendData.rotate;
this.computedPosition = amendData.position;
} else if (pictureDevice) {
this.computedPosition = pictureDevice.position;
} else {
this.computedPosition = model.position;
}
this.model = model;
this.mapDevice = mapDevice;
@ -223,18 +228,19 @@ class Signal extends Group {
create() {
const model = this.model;
const style = this.style;
const computedPosition = this.computedPosition;
const drict = this.model.showRight ? 1 : -1; // 朝向 左:右
const posit = this.model.positionType == '01' ? -1 : 1; // 位置 上:下
// 信号机高柱矮柱 (信号机底座)
const sigPostY = model.position.y + model.positionPoint.y + posit * (style.Signal.distance + style.Section.line.width + style.Signal.lamp.radiusR);
const sigPostY = computedPosition.y + model.positionPoint.y + posit * (style.Signal.distance + style.Section.line.width + style.Signal.lamp.radiusR);
this.sigPost = new ESigPost({
zlevel: this.zlevel,
z: this.z,
style: style,
drict: drict,
type: model.lampPostType,
x: model.position.x + model.positionPoint.x,
x: computedPosition.x + model.positionPoint.x,
y: sigPostY
});
if (style.Signal.ciConfirm) {
@ -245,7 +251,7 @@ class Signal extends Group {
silent: false,
_subType: 'enabled', // 标识
style: {
x: model.position.x + model.positionPoint.x - drict * 25,
x: computedPosition.x + model.positionPoint.x - drict * 25,
y: sigPostY + posit * 11,
fontSize: style.Signal.ciConfirm.fontSize,
text: style.Signal.ciConfirm.defaultText,
@ -271,8 +277,8 @@ class Signal extends Group {
drict: drict,
x: endPoint.x + i * drict * style.Signal.lamp.radiusR * 2.3,
y: endPoint.y,
originX: model.position.x + model.positionPoint.x,
originY: model.position.y + model.positionPoint.y
originX: computedPosition.x + model.positionPoint.x,
originY: computedPosition.y + model.positionPoint.y
});
this.lamps.push(lamp);
}
@ -348,8 +354,8 @@ class Signal extends Group {
this.sigBack.hide();
}
// 信号机名称
const sigNameX = model.position.x + model.positionPoint.x - drict * (style.Signal.post.standardVerticalWidth) + model.namePosition.x;
const sigNameY = model.position.y + model.positionPoint.y + posit * (style.Signal.distance + style.Section.line.width + style.Signal.lamp.radiusR * 2 + model.namePosition.y + style.Signal.text.distance);
const sigNameX = computedPosition.x + model.positionPoint.x - drict * (style.Signal.post.standardVerticalWidth) + model.namePosition.x;
const sigNameY = computedPosition.y + model.positionPoint.y + posit * (style.Signal.distance + style.Section.line.width + style.Signal.lamp.radiusR * 2 + model.namePosition.y + style.Signal.text.distance);
const textAlign = style.Signal.text.isAlignCenter ? 'middle' : this.model.showRight ? 'left' : 'right';
const textVerticalAlign = posit == 1 ? 'top' : 'bottom';
this.sigName = new ESigName({
@ -368,7 +374,7 @@ class Signal extends Group {
textVerticalAlign: textVerticalAlign
});
const timeNameY = model.position.y + model.positionPoint.y - posit * 15;
const timeNameY = computedPosition.y + model.positionPoint.y - posit * 15;
this.remainTimeName = new ESigName({
zlevel: this.zlevel,
z: this.z,
@ -475,8 +481,8 @@ class Signal extends Group {
drict: drict,
x: endPoint.x,
y: endPoint.y,
originX: model.position.x + model.positionPoint.x,
originY: model.position.y + model.positionPoint.y
originX: computedPosition.x + model.positionPoint.x,
originY: computedPosition.y + model.positionPoint.y
});
this.add(this.virtualSignal); // 虚拟信号机 (哈尔滨线路)
} else {
@ -486,12 +492,13 @@ class Signal extends Group {
createTransmission() {
const model = this.model;
const style = this.style;
const computedPosition = this.computedPosition;
const drict = this.model.showRight ? 1 : -1; // 朝向 左:右
const posit = this.model.positionType == '01' ? -1 : 1; // 位置 上:下
// 信号机名称
const actual = this.mapDevice[model.linkSignalCode];
const sigNameX = model.position.x + model.positionPoint.x + drict * 0.433 * style.Signal.transmission.sideLength + model.namePosition.x;
const sigNameY = model.position.y + model.positionPoint.y + posit * (style.Signal.distance + style.Section.line.width + style.Signal.lamp.radiusR * 2 + model.namePosition.y + style.Signal.text.distance);
const sigNameX = computedPosition.x + model.positionPoint.x + drict * 0.433 * style.Signal.transmission.sideLength + model.namePosition.x;
const sigNameY = computedPosition.y + model.positionPoint.y + posit * (style.Signal.distance + style.Section.line.width + style.Signal.lamp.radiusR * 2 + model.namePosition.y + style.Signal.text.distance);
const textAlign = style.Signal.text.isAlignCenter ? 'middle' : this.model.showRight ? 'left' : 'right';
const textVerticalAlign = posit == 1 ? 'top' : 'bottom';
const fillColor = actual.virtual ? style.Signal.transmission.fillColorVirtual : style.Signal.transmission.fillColor;
@ -511,15 +518,15 @@ class Signal extends Group {
textVerticalAlign: textVerticalAlign
});
if (style.Signal.transmission) {
const sigPostY = model.position.y + model.positionPoint.y + posit * (style.Signal.distance + style.Section.line.width + style.Signal.lamp.radiusR);
const sigPostY = computedPosition.y + model.positionPoint.y + posit * (style.Signal.distance + style.Section.line.width + style.Signal.lamp.radiusR);
this.transmission = new Polygon({
zlevel: this.zlevel,
z: this.z,
shape: {
points: [
[model.position.x + model.positionPoint.x, sigPostY + style.Signal.transmission.sideLength / 2],
[model.position.x + model.positionPoint.x, sigPostY - style.Signal.transmission.sideLength / 2],
[model.position.x + model.positionPoint.x + drict * 0.866 * style.Signal.transmission.sideLength, sigPostY]
[computedPosition.x + model.positionPoint.x, sigPostY + style.Signal.transmission.sideLength / 2],
[computedPosition.x + model.positionPoint.x, sigPostY - style.Signal.transmission.sideLength / 2],
[computedPosition.x + model.positionPoint.x + drict * 0.866 * style.Signal.transmission.sideLength, sigPostY]
]
},
style: {
@ -549,7 +556,7 @@ class Signal extends Group {
this.transformRotation(item);
} else if (item) {
if (item._subType !== 'SignalName' || this.model.nameRotated) {
item.origin = [this.model.position.x + this.model.positionPoint.x, this.model.position.y + this.model.positionPoint.y];
item.origin = [this.computedPosition.x + this.model.positionPoint.x, this.computedPosition.y + this.model.positionPoint.y];
item.rotation = -Math.PI / 180 * Number(this.model.rotate);
item.dirty();
}
@ -698,11 +705,11 @@ class Signal extends Group {
}
}
// 双黄灯
doubleYellow() {
this.lamps[0] && this.lamps[0].setColor(this.style.Signal.lamp.yellowColor);
this.lamps[1] && this.lamps[1].setColor(this.style.Signal.lamp.yellowColor);
doubleYellow() {
this.lamps[0] && this.lamps[0].setColor(this.style.Signal.lamp.yellowColor);
this.lamps[1] && this.lamps[1].setColor(this.style.Signal.lamp.yellowColor);
}
redWhite() {
redWhite() {
this.lamps[0] && this.lamps[0].setColor(this.style.Signal.lamp.whiteColor);
this.lamps[1] && this.lamps[1].setColor(this.style.Signal.lamp.redColor);
}
@ -944,7 +951,7 @@ class Signal extends Group {
recover() {
this.sigName && this.sigName.show();
this.sigName && this.sigName.setAnimationEnd();
this.lamps && this.lamps.forEach(item=> { item.show(); item.setGuideSectorShowHide(false); item.setBorderColor(this.style.Signal.lamp.borderColor) });
this.lamps && this.lamps.forEach(item=> { item.show(); item.setGuideSectorShowHide(false); item.setBorderColor(this.style.Signal.lamp.borderColor); });
this.sigName.setStyle({ textBorderWidth: 0 });
this.sigName.setColor(this.style.Signal.text.defaultColor);
this.remainTimeName && this.remainTimeName.hide();
@ -1023,46 +1030,46 @@ class Signal extends Group {
/** 设置灯的颜色 */
switch (model.aspect) {
// 红
case 'R': {
this.close(model.logicLight); // 信号关闭
break;
}
// 绿
case 'G': {
this.openPositive(model.logicLight); // 信号正向开放
break;
}
// 黄
case 'Y': {
this.openLateral(model.logicLight); // 信号侧向开放
break;
}
// 红黄
case 'RY': {
this.guid(); // 引导信号显示
break;
}
case 'W': {
this.lampWhite();
break;
}
case 'B': {
this.lampBlue();
break;
}
case 'YY': {
this.doubleYellow();
break;
}
case 'RW': {
this.redWhite();
break;
}
default: {
this.close(model.logicLight); // 信号关闭
break;
}
// 红
case 'R': {
this.close(model.logicLight); // 信号关闭
break;
}
// 绿
case 'G': {
this.openPositive(model.logicLight); // 信号正向开放
break;
}
// 黄
case 'Y': {
this.openLateral(model.logicLight); // 信号侧向开放
break;
}
// 红黄
case 'RY': {
this.guid(); // 引导信号显示
break;
}
case 'W': {
this.lampWhite();
break;
}
case 'B': {
this.lampBlue();
break;
}
case 'YY': {
this.doubleYellow();
break;
}
case 'RW': {
this.redWhite();
break;
}
default: {
this.close(model.logicLight); // 信号关闭
break;
}
}
if (model.remainTime) {
@ -1287,8 +1294,8 @@ class Signal extends Group {
}
getAnchorPoint() {
return {
x:this.model.position.x + this.model.positionPoint.x,
y:this.model.position.y + this.model.positionPoint.y
x:this.computedPosition.x + this.model.positionPoint.x,
y:this.computedPosition.y + this.model.positionPoint.y
};
}
}

View File

@ -11,6 +11,12 @@ export default class SignalButton extends Group {
this._code = model.code;
this._type = model._type;
this.zlevel = model.zlevel;
const pictureDevice = store.getters['map/getPictureDeviceByCode'](model.code);
if (pictureDevice) {
this.computedPosition = pictureDevice.position;
} else {
this.computedPosition = model.position;
}
this.z = 0;
this.model = model;
this.style = style;
@ -21,55 +27,56 @@ export default class SignalButton extends Group {
create() {
const model = this.model;
const computedPosition = this.computedPosition;
const fillColor = this.getTypeColor();
const queryList = window.location.search.substring(1).split('&');
const queryCtc = queryList.find(item => {
return item.includes('ctc');
});
return item.includes('ctc');
});
const ctcArcList = ['OCCLUSION', 'RECOVERY', 'CHANGE_DIRECTION', 'ACCIDENT', 'DEPART_ASSIST', 'PICK_ASSIST', 'ASSIST'];
if (queryCtc && ctcArcList.includes(model.type)){
this.arcShape = new Arc({
zlevel: this.zlevel,
z: this.z,
shape: {
cx: this.model.position.x + 7,
cy: this.model.position.y + 7,
r: 7
},
style: {
stroke: '#69666E',
lineWidth: 1,
fill: fillColor
}
});
this.add(this.arcShape);
} else {
this.rectButton = new Rect({
zlevel: this.zlevel,
z: this.z,
shape: {
x: model.position.x,
y: model.position.y,
width: 14,
height: 14
},
style: {
lineDash: null,
stroke: '#69666E',
lineWidth:1,
fill: fillColor
}
});
this.add(this.rectButton);
}
if (queryCtc && ctcArcList.includes(model.type)) {
this.arcShape = new Arc({
zlevel: this.zlevel,
z: this.z,
shape: {
cx: computedPosition.x + 7,
cy: computedPosition.y + 7,
r: 7
},
style: {
stroke: '#69666E',
lineWidth: 1,
fill: fillColor
}
});
this.add(this.arcShape);
} else {
this.rectButton = new Rect({
zlevel: this.zlevel,
z: this.z,
shape: {
x: computedPosition.x,
y: computedPosition.y,
width: 14,
height: 14
},
style: {
lineDash: null,
stroke: '#69666E',
lineWidth:1,
fill: fillColor
}
});
this.add(this.rectButton);
}
this.leftLine = new Line({
zlevel: this.zlevel,
z: this.z + 1,
shape: {
x1: model.position.x + 1,
y1: model.position.y + 1,
x2: model.position.x + 13,
y2: model.position.y + 13
x1: computedPosition.x + 1,
y1: computedPosition.y + 1,
x2: computedPosition.x + 13,
y2: computedPosition.y + 13
},
style: {
lineWidth: 2,
@ -82,10 +89,10 @@ export default class SignalButton extends Group {
zlevel: this.zlevel,
z: this.z + 1,
shape: {
x1: model.position.x + 13,
y1: model.position.y + 1,
x2: model.position.x + 1,
y2: model.position.y + 13
x1: computedPosition.x + 13,
y1: computedPosition.y + 1,
x2: computedPosition.x + 1,
y2: computedPosition.y + 13
},
style: {
lineWidth: 2,
@ -98,10 +105,10 @@ export default class SignalButton extends Group {
zlevel: this.zlevel,
z: this.z + 1,
shape: {
x1: model.position.x - 1,
y1: model.position.y - 1,
x2: model.position.x - 1,
y2: model.position.y + 15
x1: computedPosition.x - 1,
y1: computedPosition.y - 1,
x2: computedPosition.x - 1,
y2: computedPosition.y + 15
},
style: {
lineWidth: 2,
@ -114,10 +121,10 @@ export default class SignalButton extends Group {
zlevel: this.zlevel,
z: this.z + 1,
shape: {
x1: model.position.x - 1,
y1: model.position.y - 1,
x2: model.position.x + 15,
y2: model.position.y - 1
x1: computedPosition.x - 1,
y1: computedPosition.y - 1,
x2: computedPosition.x + 15,
y2: computedPosition.y - 1
},
style: {
lineWidth: 2,
@ -130,10 +137,10 @@ export default class SignalButton extends Group {
zlevel: this.zlevel,
z: this.z + 1,
shape: {
x1: model.position.x + 15,
y1: model.position.y - 1,
x2: model.position.x + 15,
y2: model.position.y + 15
x1: computedPosition.x + 15,
y1: computedPosition.y - 1,
x2: computedPosition.x + 15,
y2: computedPosition.y + 15
},
style: {
lineWidth: 2,
@ -146,10 +153,10 @@ export default class SignalButton extends Group {
zlevel: this.zlevel,
z: this.z + 1,
shape: {
x1: model.position.x - 1,
y1: model.position.y + 15,
x2: model.position.x + 15,
y2: model.position.y + 15
x1: computedPosition.x - 1,
y1: computedPosition.y + 15,
x2: computedPosition.x + 15,
y2: computedPosition.y + 15
},
style: {
lineWidth: 2,
@ -164,8 +171,8 @@ export default class SignalButton extends Group {
zlevel: this.zlevel,
z: this.z,
style: {
x: model.position.x + model.nameOffset.x,
y: model.position.y + model.nameOffset.y,
x: computedPosition.x + model.nameOffset.x,
y: computedPosition.y + model.nameOffset.y,
fontWeight: '400',
fontSize: 10,
fontFamily: '',
@ -214,7 +221,7 @@ export default class SignalButton extends Group {
} else if (this.model.type === 'GUIDE') {
color = '#5050E1';
} else if (list.includes(this.model.type)) {
color = '#ccc';
color = '#ccc';
} else {
color = '#008000';
}
@ -223,11 +230,11 @@ export default class SignalButton extends Group {
recover() {
this.stopAnimation();
this.rectButton && this.rectButton.setStyle({ fill:this.getTypeColor() });
this.arcShape && this.arcShape.setStyle({ fill:this.getTypeColor() });
this.arcShape && this.arcShape.setStyle({ fill:this.getTypeColor() });
this.rightLine && this.rightLine.hide();
this.leftLine && this.leftLine.hide();
this.rectButton && this.rectButton.show();
this.arcShape && this.arcShape.show();
this.arcShape && this.arcShape.show();
this.buttonText && this.buttonText.show();
this.leftBoard && this.leftBoard.hide();
this.rightBoard && this.rightBoard.hide();

View File

@ -11,6 +11,12 @@ export default class SplitStation extends Group {
this._code = model.code;
this._type = model._type;
this.zlevel = model.zlevel;
const pictureDevice = store.getters['map/getPictureDeviceByCode'](model.code);
if (pictureDevice) {
this.computedPosition = pictureDevice.position;
} else {
this.computedPosition = model.position;
}
this.model = model;
this.isBigScreen = false;
this.style = style;
@ -19,6 +25,7 @@ export default class SplitStation extends Group {
create() {
const model = this.model;
const style = this.style;
const computedPosition = this.computedPosition;
if (!style.SplitStation) {
return;
}
@ -26,10 +33,10 @@ export default class SplitStation extends Group {
zlevel: this.zlevel,
z: this.z,
shape: {
x1: model.position.x,
y1: model.position.y,
x2: model.position.x,
y2: model.position.y + style.SplitStation.height
x1: computedPosition.x,
y1: computedPosition.y,
x2: computedPosition.x,
y2: computedPosition.y + style.SplitStation.height
},
style: {
lineWidth: style.SplitStation.lineWidth,
@ -41,17 +48,17 @@ export default class SplitStation extends Group {
z: this.z,
shape: {
points: [
[model.position.x, model.position.y + style.SplitStation.height - style.SplitStation.verticalDistance / 2],
[model.position.x - style.SplitStation.horizontalDistance, model.position.y + style.SplitStation.height - style.SplitStation.verticalDistance],
[model.position.x - style.SplitStation.horizontalDistance,
model.position.y + style.SplitStation.height - style.SplitStation.verticalDistance / 2 - style.SplitStation.lineWidth / 2],
[model.position.x - style.SplitStation.horizontalDistance - style.SplitStation.lineLength,
model.position.y + style.SplitStation.height - style.SplitStation.verticalDistance / 2 - style.SplitStation.lineWidth / 2],
[model.position.x - style.SplitStation.horizontalDistance - style.SplitStation.lineLength,
model.position.y + style.SplitStation.height - style.SplitStation.verticalDistance / 2 + style.SplitStation.lineWidth / 2],
[model.position.x - style.SplitStation.horizontalDistance,
model.position.y + style.SplitStation.height - style.SplitStation.verticalDistance / 2 + style.SplitStation.lineWidth / 2],
[model.position.x - style.SplitStation.horizontalDistance, model.position.y + style.SplitStation.height]
[computedPosition.x, computedPosition.y + style.SplitStation.height - style.SplitStation.verticalDistance / 2],
[computedPosition.x - style.SplitStation.horizontalDistance, computedPosition.y + style.SplitStation.height - style.SplitStation.verticalDistance],
[computedPosition.x - style.SplitStation.horizontalDistance,
computedPosition.y + style.SplitStation.height - style.SplitStation.verticalDistance / 2 - style.SplitStation.lineWidth / 2],
[computedPosition.x - style.SplitStation.horizontalDistance - style.SplitStation.lineLength,
computedPosition.y + style.SplitStation.height - style.SplitStation.verticalDistance / 2 - style.SplitStation.lineWidth / 2],
[computedPosition.x - style.SplitStation.horizontalDistance - style.SplitStation.lineLength,
computedPosition.y + style.SplitStation.height - style.SplitStation.verticalDistance / 2 + style.SplitStation.lineWidth / 2],
[computedPosition.x - style.SplitStation.horizontalDistance,
computedPosition.y + style.SplitStation.height - style.SplitStation.verticalDistance / 2 + style.SplitStation.lineWidth / 2],
[computedPosition.x - style.SplitStation.horizontalDistance, computedPosition.y + style.SplitStation.height]
]
},
style: {
@ -63,17 +70,17 @@ export default class SplitStation extends Group {
z: this.z,
shape: {
points: [
[model.position.x, model.position.y + style.SplitStation.height - style.SplitStation.verticalDistance / 2],
[model.position.x + style.SplitStation.horizontalDistance, model.position.y + style.SplitStation.height - style.SplitStation.verticalDistance],
[model.position.x + style.SplitStation.horizontalDistance,
model.position.y + style.SplitStation.height - style.SplitStation.verticalDistance / 2 - style.SplitStation.lineWidth / 2],
[model.position.x + style.SplitStation.horizontalDistance + style.SplitStation.lineLength,
model.position.y + style.SplitStation.height - style.SplitStation.verticalDistance / 2 - style.SplitStation.lineWidth / 2],
[model.position.x + style.SplitStation.horizontalDistance + style.SplitStation.lineLength,
model.position.y + style.SplitStation.height - style.SplitStation.verticalDistance / 2 + style.SplitStation.lineWidth / 2],
[model.position.x + style.SplitStation.horizontalDistance,
model.position.y + style.SplitStation.height - style.SplitStation.verticalDistance / 2 + style.SplitStation.lineWidth / 2],
[model.position.x + style.SplitStation.horizontalDistance, model.position.y + style.SplitStation.height]
[computedPosition.x, computedPosition.y + style.SplitStation.height - style.SplitStation.verticalDistance / 2],
[computedPosition.x + style.SplitStation.horizontalDistance, computedPosition.y + style.SplitStation.height - style.SplitStation.verticalDistance],
[computedPosition.x + style.SplitStation.horizontalDistance,
computedPosition.y + style.SplitStation.height - style.SplitStation.verticalDistance / 2 - style.SplitStation.lineWidth / 2],
[computedPosition.x + style.SplitStation.horizontalDistance + style.SplitStation.lineLength,
computedPosition.y + style.SplitStation.height - style.SplitStation.verticalDistance / 2 - style.SplitStation.lineWidth / 2],
[computedPosition.x + style.SplitStation.horizontalDistance + style.SplitStation.lineLength,
computedPosition.y + style.SplitStation.height - style.SplitStation.verticalDistance / 2 + style.SplitStation.lineWidth / 2],
[computedPosition.x + style.SplitStation.horizontalDistance,
computedPosition.y + style.SplitStation.height - style.SplitStation.verticalDistance / 2 + style.SplitStation.lineWidth / 2],
[computedPosition.x + style.SplitStation.horizontalDistance, computedPosition.y + style.SplitStation.height]
]
},
style: {
@ -85,7 +92,7 @@ export default class SplitStation extends Group {
z: this.z,
style: {
x: model.x,
y: model.position.y + style.SplitStation.height - style.SplitStation.verticalDistance / 2,
y: computedPosition.y + style.SplitStation.height - style.SplitStation.verticalDistance / 2,
fontWeight: style.textStyle.fontWeight,
fontSize: style.SplitStation.fontSize,
fontFamily: style.fontFamily,
@ -99,8 +106,8 @@ export default class SplitStation extends Group {
zlevel: this.zlevel,
z: this.z,
style: {
x: model.position.x + style.SplitStation.horizontalDistance + style.SplitStation.lineLength,
y: model.position.y + style.SplitStation.height - style.SplitStation.verticalDistance / 2,
x: computedPosition.x + style.SplitStation.horizontalDistance + style.SplitStation.lineLength,
y: computedPosition.y + style.SplitStation.height - style.SplitStation.verticalDistance / 2,
fontWeight: style.textStyle.fontWeight,
fontSize: style.SplitStation.fontSize,
fontFamily: style.fontFamily,
@ -112,8 +119,8 @@ export default class SplitStation extends Group {
});
const leftTextWidth = this.leftText.getBoundingRect().width;
const rightTextWidth = this.rightText.getBoundingRect().width;
this.leftText.setStyle('x', model.position.x - style.SplitStation.horizontalDistance - style.SplitStation.lineLength - leftTextWidth / 2);
this.rightText.setStyle('x', model.position.x + style.SplitStation.horizontalDistance + style.SplitStation.lineLength + rightTextWidth / 2);
this.leftText.setStyle('x', computedPosition.x - style.SplitStation.horizontalDistance - style.SplitStation.lineLength - leftTextWidth / 2);
this.rightText.setStyle('x', computedPosition.x + style.SplitStation.horizontalDistance + style.SplitStation.lineLength + rightTextWidth / 2);
this.add(this.verticalLine);
this.add(this.arrowLeft);
this.add(this.arrowRight);
@ -145,6 +152,6 @@ export default class SplitStation extends Group {
});
}
getAnchorPoint() {
return this.model.position;
return this.computedPosition;
}
}

View File

@ -15,7 +15,7 @@ export default class EMouse extends Group {
position: [0, 0],
style: {
x: 0,
y: this.device.model.position.y + this.device.style.Station.StationControl.lamp.radiusR + this.device.style.Station.StationControl.text.distance - 25,
y: this.device.computedPosition.y + this.device.style.Station.StationControl.lamp.radiusR + this.device.style.Station.StationControl.text.distance - 25,
fontWeight: this.device.style.Station.StationControl.mouseOverStyle.fontWeight,
fontSize: this.device.style.Station.StationControl.mouseOverStyle.fontSize,
fontFamily: this.device.style.fontFamily,
@ -32,7 +32,7 @@ export default class EMouse extends Group {
if (e.target &&
e.target.type == 'text' &&
e.target._subType == 'ControlSignal') {
this.text.setStyle({x: e.target.style.x});
this.text.setStyle({x: e.target.style.x});
this.text.show();
}
}

View File

@ -18,8 +18,8 @@ class EStationText extends Group {
z: this.model.z,
silent: !model.visible || false,
style: {
x: model.position.x,
y: model.position.y,
x: model.computedPosition.x,
y: model.computedPosition.y,
fontWeight: style.Station.stationText.fontWeight,
fontSize: isNaN(Number(model.nameFont)) ? 20 : Number(model.nameFont),
fontFamily: style.fontFamily,

View File

@ -42,41 +42,41 @@ export default class EThreeLamp extends Group {
}
});
this.control2 = new Arc({
pop: model.pop,
_subType: _subType,
_nameType: _nameType,
_val: _val,
zlevel: this.zlevel,
z: this.z,
shape: {
cx: model.point.x,
cy: model.point.y,
r: model.style.Station.StationControl.lamp.radiusR
},
style: {
lineWidth: model.style.Station.StationControl.lamp.lineWidth || 0,
fill: model.style.Station.StationControl.lamp.grayColor,
stroke: model.style.Station.StationControl.lamp.strokeColor
}
});
pop: model.pop,
_subType: _subType,
_nameType: _nameType,
_val: _val,
zlevel: this.zlevel,
z: this.z,
shape: {
cx: model.point.x,
cy: model.point.y,
r: model.style.Station.StationControl.lamp.radiusR
},
style: {
lineWidth: model.style.Station.StationControl.lamp.lineWidth || 0,
fill: model.style.Station.StationControl.lamp.grayColor,
stroke: model.style.Station.StationControl.lamp.strokeColor
}
});
this.control3 = new Arc({
pop: model.pop,
_subType: _subType,
_nameType: _nameType,
_val: _val,
zlevel: this.zlevel,
z: this.z,
shape: {
cx: model.point.x + model.style.Station.StationControl.lamp.radiusR * 3,
cy: model.point.y,
r: model.style.Station.StationControl.lamp.radiusR
},
style: {
lineWidth: model.style.Station.StationControl.lamp.lineWidth || 0,
fill: model.style.Station.StationControl.lamp.grayColor,
stroke: model.style.Station.StationControl.lamp.strokeColor
}
});
pop: model.pop,
_subType: _subType,
_nameType: _nameType,
_val: _val,
zlevel: this.zlevel,
z: this.z,
shape: {
cx: model.point.x + model.style.Station.StationControl.lamp.radiusR * 3,
cy: model.point.y,
r: model.style.Station.StationControl.lamp.radiusR
},
style: {
lineWidth: model.style.Station.StationControl.lamp.lineWidth || 0,
fill: model.style.Station.StationControl.lamp.grayColor,
stroke: model.style.Station.StationControl.lamp.strokeColor
}
});
this.text = new Text({
pop: model.pop,

View File

@ -25,6 +25,18 @@ export default class Station extends Group {
this._code = model.code;
this._type = model._type;
this.zlevel = model.zlevel;
const pictureDevice = store.getters['map/getPictureDeviceByCode'](model.code);
if (pictureDevice) {
const offsetX = pictureDevice.position.x - model.position.x;
const offsetY = pictureDevice.position.y - model.position.y;
this.computedPosition = pictureDevice.position;
this.computedTurnBackPoint = { x: model.turnBackPoint ? model.turnBackPoint.x + offsetX : 0, y: model.turnBackPoint ? model.turnBackPoint.y + offsetY : 0 };
this.computedControlModePoint = { x: model.controlModePoint.x + offsetX, y: model.controlModePoint.y + offsetY };
} else {
this.computedPosition = model.position;
this.computedTurnBackPoint = model.turnBackPoint;
this.computedControlModePoint = model.controlModePoint;
}
this.z = 40;
this.model = model;
this.style = style;
@ -44,11 +56,12 @@ export default class Station extends Group {
const elementTypeList = {
'stationText': EStationText // 车站名称 (普通站台样式)
};
model.computedPosition = this.computedPosition;
// 遍历当前线路下的绘图元素 组合模式
traverseLineElements(style.Station, elementTypeList, model, style, this);
const path = window.location.href;
const computedPosition = this.computedPosition;
if (style.Station.kmPostShow || path.includes('/map/draw')) { // 公里标是否显示
let direction = 1;
if (this.style.Station.kilometerPosition == 'up') {
@ -63,8 +76,8 @@ export default class Station extends Group {
zlevel: this.zlevel,
z: this.z,
position: [0, 0],
x: model.position.x + offset.x,
y: model.position.y + ((parseInt(model.nameFont) + 2) * direction) + offset.y,
x: computedPosition.x + offset.x,
y: computedPosition.y + ((parseInt(model.nameFont) + 2) * direction) + offset.y,
fontWeight: model.fontWeight,
fontSize: model.kmPostFont || 18,
fontFamily: style.fontFamily,
@ -87,6 +100,7 @@ export default class Station extends Group {
}
createTurnBack() { // 创建按图折返
const model = this.model;
const computedTurnBackPoint = this.computedTurnBackPoint;
const style = this.style;
if (model.visible && model.createTurnBack) {
this.turnBacks = [];
@ -96,8 +110,8 @@ export default class Station extends Group {
z: this.z,
position: [0, 0],
style: {
x: model.turnBackPoint.x,
y: model.turnBackPoint.y - style.Station.lamp.radiusR - style.Station.turnBack.toptextDistance,
x: computedTurnBackPoint.x,
y: computedTurnBackPoint.y - style.Station.lamp.radiusR - style.Station.turnBack.toptextDistance,
fontWeight: style.Station.text.fontWeight,
fontSize: style.Station.text.fontSize,
fontFamily: style.fontFamily,
@ -115,8 +129,8 @@ export default class Station extends Group {
z: this.z,
arc: {
shape: {
cx: model.turnBackPoint.x + style.Station.turnBack.lampSpace * index,
cy: model.turnBackPoint.y,
cx: computedTurnBackPoint.x + style.Station.turnBack.lampSpace * index,
cy: computedTurnBackPoint.y,
r: style.Station.lamp.radiusR
},
lineWidth: 0,
@ -125,8 +139,8 @@ export default class Station extends Group {
},
text: {
position: [0, 0],
x: model.turnBackPoint.x + style.Station.turnBack.lampSpace * index,
y: model.turnBackPoint.y + style.Station.lamp.radiusR + style.Station.StationControl.text.distance,
x: computedTurnBackPoint.x + style.Station.turnBack.lampSpace * index,
y: computedTurnBackPoint.y + style.Station.lamp.radiusR + style.Station.StationControl.text.distance,
fontWeight: style.Station.text.fontWeight,
fontSize: style.Station.text.fontSize,
fontFamily: style.fontFamily,
@ -176,8 +190,9 @@ export default class Station extends Group {
this.setState(model);
}
createCtcControlMode() { // 大铁
// 非常站控
const model = this.model;
// 非常站控
// const model = this.model;
const computedControlModePoint = this.computedControlModePoint;
// 分散自律
this.selfDisciplineThree = new EThreeLamp({
_subType: 'veryControl',
@ -185,8 +200,8 @@ export default class Station extends Group {
zlevel: this.zlevel,
z: this.z,
point: {
x: model.controlModePoint.x - this.style.Station.StationControl.lamp.distance * 2 + this.style.Station.StationControl.selfDisciplineThree.offset.x,
y: model.controlModePoint.y + this.style.Station.StationControl.selfDisciplineThree.offset.y
x: computedControlModePoint.x - this.style.Station.StationControl.lamp.distance * 2 + this.style.Station.StationControl.selfDisciplineThree.offset.x,
y: computedControlModePoint.y + this.style.Station.StationControl.selfDisciplineThree.offset.y
},
context: this.style.Station.StationControl.selfDisciplineThree.text,
pop: false
@ -199,8 +214,8 @@ export default class Station extends Group {
zlevel: this.zlevel,
z: this.z,
point: {
x: model.controlModePoint.x - this.style.Station.StationControl.lamp.distance * 2 / 3 + this.style.Station.StationControl.veryControl.offset.x,
y: model.controlModePoint.y + this.style.Station.StationControl.veryControl.offset.y
x: computedControlModePoint.x - this.style.Station.StationControl.lamp.distance * 2 / 3 + this.style.Station.StationControl.veryControl.offset.x,
y: computedControlModePoint.y + this.style.Station.StationControl.veryControl.offset.y
},
context: this.style.Station.StationControl.veryControl.text,
pop: false
@ -213,8 +228,8 @@ export default class Station extends Group {
zlevel: this.zlevel,
z: this.z,
point: {
x: model.controlModePoint.x + this.style.Station.StationControl.lamp.distance * 2 / 3 + this.style.Station.StationControl.graphRoad.offset.x,
y: model.controlModePoint.y + this.style.Station.StationControl.graphRoad.offset.y
x: computedControlModePoint.x + this.style.Station.StationControl.lamp.distance * 2 / 3 + this.style.Station.StationControl.graphRoad.offset.x,
y: computedControlModePoint.y + this.style.Station.StationControl.graphRoad.offset.y
},
context: this.style.Station.StationControl.graphRoad.text,
pop: false
@ -227,8 +242,8 @@ export default class Station extends Group {
zlevel: this.zlevel,
z: this.z,
point: {
x: model.controlModePoint.x + this.style.Station.StationControl.lamp.distance * 2 + this.style.Station.StationControl.planControl.offset.x,
y: model.controlModePoint.y + this.style.Station.StationControl.planControl.offset.y
x: computedControlModePoint.x + this.style.Station.StationControl.lamp.distance * 2 + this.style.Station.StationControl.planControl.offset.x,
y: computedControlModePoint.y + this.style.Station.StationControl.planControl.offset.y
},
context: this.style.Station.StationControl.planControl.text,
pop: false
@ -241,8 +256,8 @@ export default class Station extends Group {
zlevel: this.zlevel,
z: this.z,
point: {
x: model.controlModePoint.x - this.style.Station.StationControl.lamp.distance * 2 + this.style.Station.StationControl.centerCommunication.offset.x,
y: model.controlModePoint.y + this.style.Station.StationControl.centerCommunication.offset.y
x: computedControlModePoint.x - this.style.Station.StationControl.lamp.distance * 2 + this.style.Station.StationControl.centerCommunication.offset.x,
y: computedControlModePoint.y + this.style.Station.StationControl.centerCommunication.offset.y
},
context: this.style.Station.StationControl.centerCommunication.text,
pop: false
@ -255,8 +270,8 @@ export default class Station extends Group {
zlevel: this.zlevel,
z: this.z,
point: {
x: model.controlModePoint.x - this.style.Station.StationControl.lamp.distance * 2 / 3 + this.style.Station.StationControl.selfDisciplineCommunication.offset.x,
y: model.controlModePoint.y + this.style.Station.StationControl.selfDisciplineCommunication.offset.y
x: computedControlModePoint.x - this.style.Station.StationControl.lamp.distance * 2 / 3 + this.style.Station.StationControl.selfDisciplineCommunication.offset.x,
y: computedControlModePoint.y + this.style.Station.StationControl.selfDisciplineCommunication.offset.y
},
context: this.style.Station.StationControl.selfDisciplineCommunication.text,
pop: false
@ -269,8 +284,8 @@ export default class Station extends Group {
zlevel: this.zlevel,
z: this.z,
point: {
x: model.controlModePoint.x + this.style.Station.StationControl.lamp.distance * 2 / 3 + this.style.Station.StationControl.allowedTurnBack.offset.x,
y: model.controlModePoint.y + this.style.Station.StationControl.allowedTurnBack.offset.y
x: computedControlModePoint.x + this.style.Station.StationControl.lamp.distance * 2 / 3 + this.style.Station.StationControl.allowedTurnBack.offset.x,
y: computedControlModePoint.y + this.style.Station.StationControl.allowedTurnBack.offset.y
},
context: this.style.Station.StationControl.allowedTurnBack.text,
pop: false
@ -283,8 +298,8 @@ export default class Station extends Group {
zlevel: this.zlevel,
z: this.z,
point: {
x: model.controlModePoint.x + this.style.Station.StationControl.lamp.distance * 2 + this.style.Station.StationControl.trainControl.offset.x,
y: model.controlModePoint.y + this.style.Station.StationControl.trainControl.offset.y
x: computedControlModePoint.x + this.style.Station.StationControl.lamp.distance * 2 + this.style.Station.StationControl.trainControl.offset.x,
y: computedControlModePoint.y + this.style.Station.StationControl.trainControl.offset.y
},
context: this.style.Station.StationControl.trainControl.text,
pop: false
@ -292,13 +307,14 @@ export default class Station extends Group {
this.add(this.trainControl);
}
createControlModeAU() { // 西安二
const model = this.model;
// const model = this.model;
const computedControlModePoint = this.computedControlModePoint;
this.stationControlAU = new Text({
zlevel: this.zlevel,
z: this.z,
style: {
x: model.controlModePoint.x + this.style.Station.StationControl.text.offsetX * -1,
y: model.controlModePoint.y + this.style.Station.StationControl.text.offsetY,
x: computedControlModePoint.x + this.style.Station.StationControl.text.offsetX * -1,
y: computedControlModePoint.y + this.style.Station.StationControl.text.offsetY,
fontWeight: this.style.Station.StationControl.text.fontWeight,
fontSize: this.style.Station.StationControl.text.fontSize,
fontFamily: this.style.fontFamily,
@ -311,15 +327,16 @@ export default class Station extends Group {
this.add(this.stationControlAU);
}
createTroButton() {
const model = this.model;
// const model = this.model;
const computedPosition = this.computedPosition;
const rect = this.stationText.getBoundingRect();
this.troButton = new Rect({
zlevel: this.zlevel,
z: this.z,
_subType: 'troButton',
shape: {
x: model.position.x + rect.width / 2 + 5,
y: model.position.y,
x: computedPosition.x + rect.width / 2 + 5,
y: computedPosition.y,
width: 25,
height: 25
},
@ -332,13 +349,14 @@ export default class Station extends Group {
this.add(this.troButton);
}
createControlModeCC() { // 西安二
const model = this.model;
// const model = this.model;
const computedControlModePoint = this.computedControlModePoint;
this.stationControlCC = new Text({
zlevel: this.zlevel,
z: this.z,
style: {
x: model.controlModePoint.x + this.style.Station.StationControl.text.offsetX * 0,
y: model.controlModePoint.y + this.style.Station.StationControl.text.offsetY,
x: computedControlModePoint.x + this.style.Station.StationControl.text.offsetX * 0,
y: computedControlModePoint.y + this.style.Station.StationControl.text.offsetY,
fontWeight: this.style.Station.StationControl.text.fontWeight,
fontSize: this.style.Station.StationControl.text.fontSize,
fontFamily: this.style.fontFamily,
@ -352,13 +370,14 @@ export default class Station extends Group {
}
createControlModeCL() { // 西安二
const model = this.model;
// const model = this.model;
const computedControlModePoint = this.computedControlModePoint;
this.stationControlCL = new Text({
zlevel: this.zlevel,
z: this.z,
style: {
x: model.controlModePoint.x + this.style.Station.StationControl.text.offsetX * 1,
y: model.controlModePoint.y + this.style.Station.StationControl.text.offsetY,
x: computedControlModePoint.x + this.style.Station.StationControl.text.offsetX * 1,
y: computedControlModePoint.y + this.style.Station.StationControl.text.offsetY,
fontWeight: this.style.Station.StationControl.text.fontWeight,
fontSize: this.style.Station.StationControl.text.fontSize,
fontFamily: this.style.fontFamily,
@ -372,13 +391,14 @@ export default class Station extends Group {
}
createControlModeVA() { // 西安二
const model = this.model;
// const model = this.model;
const computedControlModePoint = this.computedControlModePoint;
this.stationControlVA = new Text({
zlevel: this.zlevel,
z: this.z,
style: {
x: model.controlModePoint.x + this.style.Station.StationControl.text.offsetX * 2,
y: model.controlModePoint.y + this.style.Station.StationControl.text.offsetY,
x: computedControlModePoint.x + this.style.Station.StationControl.text.offsetX * 2,
y: computedControlModePoint.y + this.style.Station.StationControl.text.offsetY,
fontWeight: this.style.Station.StationControl.text.fontWeight,
fontSize: this.style.Station.StationControl.text.fontSize,
fontFamily: this.style.fontFamily,
@ -392,7 +412,8 @@ export default class Station extends Group {
}
createEmergencyControl() { // 紧急站控
const model = this.model;
// const model = this.model;
const computedControlModePoint = this.computedControlModePoint;
if (this.style.Station.StationControl.emergencyControl.show) {
this.emergencyControl = new ESingleControl({
_subType: 'emergency',
@ -400,16 +421,16 @@ export default class Station extends Group {
zlevel: this.zlevel,
z: this.z,
point: {
x: model.controlModePoint.x - this.style.Station.StationControl.lamp.distance * 3 / 2 + this.style.Station.StationControl.emergencyControl.offset.x,
y: model.controlModePoint.y + this.style.Station.StationControl.emergencyControl.offset.y
x: computedControlModePoint.x - this.style.Station.StationControl.lamp.distance * 3 / 2 + this.style.Station.StationControl.emergencyControl.offset.x,
y: computedControlModePoint.y + this.style.Station.StationControl.emergencyControl.offset.y
},
context: this.style.Station.StationControl.emergencyControl.text,
pop: false
});
this.add(this.emergencyControl);
if (this.style.Station.StationControl.emergencyControl.arrowShow) {
const x = model.controlModePoint.x - this.style.Station.StationControl.lamp.distance * 2 + this.style.Station.StationControl.emergencyControl.offset.x;
const y = model.controlModePoint.y + this.style.Station.StationControl.emergencyControl.offset.y;
const x = computedControlModePoint.x - this.style.Station.StationControl.lamp.distance * 2 + this.style.Station.StationControl.emergencyControl.offset.x;
const y = computedControlModePoint.y + this.style.Station.StationControl.emergencyControl.offset.y;
const point = arrow(x, y + this.style.Station.StationControl.lamp.radiusR / 2, this.style.Station.StationControl.lamp.distance / 6, this.style.Station.StationControl.lamp.radiusR * 0.8);
this.emergencyArrowsControl = new EArrow({
zlevel: this.zlevel,
@ -418,8 +439,8 @@ export default class Station extends Group {
count: this.count,
drict: 1,
point: point,
x: model.controlModePoint.x + this.style.Station.StationControl.lamp.offset.x,
y: model.controlModePoint.y + this.style.Station.StationControl.lamp.radiusR / 2 + this.style.Station.StationControl.lamp.offset.y,
x: computedControlModePoint.x + this.style.Station.StationControl.lamp.offset.x,
y: computedControlModePoint.y + this.style.Station.StationControl.lamp.radiusR / 2 + this.style.Station.StationControl.lamp.offset.y,
fill: this.style.Station.StationControl.emergencyControl.grayColor,
lineWidth: 1,
stroke: this.style.sidelineColor
@ -429,63 +450,65 @@ export default class Station extends Group {
}
}
createSelfDiscipline() {
const model = this.model;
if (this.style.Station.StationControl.selfDiscipline) {
this.selfDiscipline = new ESingleControl({
// const model = this.model;
const computedControlModePoint = this.computedControlModePoint;
if (this.style.Station.StationControl.selfDiscipline) {
this.selfDiscipline = new ESingleControl({
_subType: 'self_discipline',
style: this.style,
zlevel: this.zlevel,
z: this.z,
point: {
x: model.controlModePoint.x - this.style.Station.StationControl.lamp.distance * 3 / 2 + this.style.Station.StationControl.selfDiscipline.offset.x,
y: model.controlModePoint.y + this.style.Station.StationControl.selfDiscipline.offset.y
x: computedControlModePoint.x - this.style.Station.StationControl.lamp.distance * 3 / 2 + this.style.Station.StationControl.selfDiscipline.offset.x,
y: computedControlModePoint.y + this.style.Station.StationControl.selfDiscipline.offset.y
},
context: this.style.Station.StationControl.selfDiscipline.text,
pop: false
});
this.add(this.selfDiscipline);
this.add(this.selfDiscipline);
}
if (this.style.Station.StationControl.selfDisciplineControl) {
this.selfDisciplineControl = new ESingleControl({
if (this.style.Station.StationControl.selfDisciplineControl) {
this.selfDisciplineControl = new ESingleControl({
_subType: 'self_discipline_control',
style: this.style,
zlevel: this.zlevel,
z: this.z,
point: {
x: model.controlModePoint.x - this.style.Station.StationControl.lamp.distance / 2 + this.style.Station.StationControl.selfDisciplineControl.offset.x,
y: model.controlModePoint.y + this.style.Station.StationControl.selfDisciplineControl.offset.y
x: computedControlModePoint.x - this.style.Station.StationControl.lamp.distance / 2 + this.style.Station.StationControl.selfDisciplineControl.offset.x,
y: computedControlModePoint.y + this.style.Station.StationControl.selfDisciplineControl.offset.y
},
context: this.style.Station.StationControl.selfDisciplineControl.text,
pop: false
});
this.add(this.selfDisciplineControl);
this.add(this.selfDisciplineControl);
}
}
createVeryControl() {
const model = this.model;
if (this.style.Station.StationControl.veryControl) {
this.veryControl = new ESingleControl({
// const model = this.model;
const computedControlModePoint = this.computedControlModePoint;
if (this.style.Station.StationControl.veryControl) {
this.veryControl = new ESingleControl({
_subType: 'very',
style: this.style,
zlevel: this.zlevel,
z: this.z,
point: {
x: model.controlModePoint.x + this.style.Station.StationControl.lamp.distance / 2 + this.style.Station.StationControl.veryControl.offset.x,
y: model.controlModePoint.y + this.style.Station.StationControl.centerControl.offset.y
x: computedControlModePoint.x + this.style.Station.StationControl.lamp.distance / 2 + this.style.Station.StationControl.veryControl.offset.x,
y: computedControlModePoint.y + this.style.Station.StationControl.centerControl.offset.y
},
context: this.style.Station.StationControl.veryControl.text,
pop: false
});
this.add(this.veryControl);
this.add(this.veryControl);
}
if (this.style.Station.StationControl.veryControlButton) {
this.veryControlButton = new Rect({
if (this.style.Station.StationControl.veryControlButton) {
this.veryControlButton = new Rect({
zlevel: this.zlevel,
z: this.z,
_subType: 'veryControlButton',
shape: {
x: model.controlModePoint.x + this.style.Station.StationControl.lamp.distance * 3 / 2 + this.style.Station.StationControl.veryControlButton.offset.x - this.style.Station.StationControl.lamp.radiusR,
y: model.controlModePoint.y + this.style.Station.StationControl.veryControlButton.offset.y - this.style.Station.StationControl.lamp.radiusR,
x: computedControlModePoint.x + this.style.Station.StationControl.lamp.distance * 3 / 2 + this.style.Station.StationControl.veryControlButton.offset.x - this.style.Station.StationControl.lamp.radiusR,
y: computedControlModePoint.y + this.style.Station.StationControl.veryControlButton.offset.y - this.style.Station.StationControl.lamp.radiusR,
width: this.style.Station.StationControl.lamp.radiusR * 2,
height: this.style.Station.StationControl.lamp.radiusR * 2
},
@ -495,15 +518,15 @@ export default class Station extends Group {
fill: this.style.Station.StationControl.veryControlButton.defaultColor
}
});
this.add(this.veryControlButton);
this.veryControlButtonText = new Text({
this.add(this.veryControlButton);
this.veryControlButtonText = new Text({
zlevel: this.zlevel,
z: this.z,
_subType: 'veryControlButtonText',
position: [0, 0],
style: {
x: model.controlModePoint.x + this.style.Station.StationControl.lamp.distance * 3 / 2 + this.style.Station.StationControl.veryControlButton.offset.y,
y: model.controlModePoint.y + this.style.Station.StationControl.veryControlButton.offset.y + this.style.Station.StationControl.lamp.radiusR + this.style.Station.StationControl.text.distance,
x: computedControlModePoint.x + this.style.Station.StationControl.lamp.distance * 3 / 2 + this.style.Station.StationControl.veryControlButton.offset.y,
y: computedControlModePoint.y + this.style.Station.StationControl.veryControlButton.offset.y + this.style.Station.StationControl.lamp.radiusR + this.style.Station.StationControl.text.distance,
fontWeight: this.style.Station.StationControl.text.fontWeight,
fontSize: this.style.Station.StationControl.text.fontSize,
fontFamily: this.style.fontFamily,
@ -514,11 +537,12 @@ export default class Station extends Group {
},
pop: false
});
this.add(this.veryControlButtonText);
this.add(this.veryControlButtonText);
}
}
createCenterControl() { // 中控按钮
const model = this.model;
// const model = this.model;
const computedControlModePoint = this.computedControlModePoint;
if (this.style.Station.StationControl.centerControl.show) {
this.centerControl = new ESingleControl({
_subType: 'center',
@ -526,16 +550,16 @@ export default class Station extends Group {
zlevel: this.zlevel,
z: this.z,
point: {
x: model.controlModePoint.x - this.style.Station.StationControl.lamp.distance / 2 + this.style.Station.StationControl.centerControl.offset.x,
y: model.controlModePoint.y + this.style.Station.StationControl.centerControl.offset.y
x: computedControlModePoint.x - this.style.Station.StationControl.lamp.distance / 2 + this.style.Station.StationControl.centerControl.offset.x,
y: computedControlModePoint.y + this.style.Station.StationControl.centerControl.offset.y
},
context: this.style.Station.StationControl.centerControl.text,
pop: false
});
this.add(this.centerControl);
if (this.style.Station.StationControl.centerControl.arrowShow) {
const x = model.controlModePoint.x - this.style.Station.StationControl.lamp.distance * 3 / 2 + this.style.Station.StationControl.emergencyControl.offset.x;
const y = model.controlModePoint.y + this.style.Station.StationControl.emergencyControl.offset.y;
const x = computedControlModePoint.x - this.style.Station.StationControl.lamp.distance * 3 / 2 + this.style.Station.StationControl.emergencyControl.offset.x;
const y = computedControlModePoint.y + this.style.Station.StationControl.emergencyControl.offset.y;
const point = arrow(x, y + this.style.Station.StationControl.lamp.radiusR / 2, this.style.Station.StationControl.lamp.distance / 6, this.style.Station.StationControl.lamp.radiusR * 0.8);
this.centerArrowsControl = new EArrow({
zlevel: this.zlevel,
@ -544,8 +568,8 @@ export default class Station extends Group {
count: this.count,
drict: 1,
point: point,
x: model.controlModePoint.x + this.style.Station.StationControl.lamp.offset.x,
y: model.controlModePoint.y + this.style.Station.StationControl.lamp.radiusR / 2 + this.style.Station.StationControl.lamp.offset.y,
x: computedControlModePoint.x + this.style.Station.StationControl.lamp.offset.x,
y: computedControlModePoint.y + this.style.Station.StationControl.lamp.radiusR / 2 + this.style.Station.StationControl.lamp.offset.y,
fill: this.style.Station.StationControl.centerControl.grayColor,
lineWidth: 1,
stroke: this.style.sidelineColor
@ -561,8 +585,8 @@ export default class Station extends Group {
zlevel: this.zlevel,
z: this.z + 1,
point: {
x: model.controlModePoint.x + this.style.Station.StationControl.lamp.distance * 3 / 2 + this.style.Station.StationControl.lamp.offset.x,
y: model.controlModePoint.y + this.style.Station.StationControl.lamp.offset.y
x: computedControlModePoint.x + this.style.Station.StationControl.lamp.distance * 3 / 2 + this.style.Station.StationControl.lamp.offset.x,
y: computedControlModePoint.y + this.style.Station.StationControl.lamp.offset.y
},
context: this.style.Station.StationControl.centerControl.buttonText,
pop: false
@ -589,8 +613,8 @@ export default class Station extends Group {
zlevel: this.zlevel,
z: this.z + 1,
point: {
x: model.controlModePoint.x + this.style.Station.StationControl.lamp.distance * 9 / 2 + this.style.Station.StationControl.lamp.offset.x,
y: model.controlModePoint.y + this.style.Station.StationControl.lamp.offset.y
x: computedControlModePoint.x + this.style.Station.StationControl.lamp.distance * 9 / 2 + this.style.Station.StationControl.lamp.offset.x,
y: computedControlModePoint.y + this.style.Station.StationControl.lamp.offset.y
},
context: this.style.Station.StationControl.centerControl.lightText,
pop: false
@ -617,8 +641,8 @@ export default class Station extends Group {
zlevel: this.zlevel,
z: this.z + 1,
point: {
x: model.controlModePoint.x + this.style.Station.StationControl.lamp.distance * 3 + this.style.Station.StationControl.lamp.offset.x,
y: model.controlModePoint.y + this.style.Station.StationControl.lamp.offset.y
x: computedControlModePoint.x + this.style.Station.StationControl.lamp.distance * 3 + this.style.Station.StationControl.lamp.offset.x,
y: computedControlModePoint.y + this.style.Station.StationControl.lamp.offset.y
},
context: this.style.Station.StationControl.centerControl.preResetText,
pop: false
@ -641,7 +665,8 @@ export default class Station extends Group {
}
createSubstationControl() { // 站控按钮
const model = this.model;
// const model = this.model;
const computedControlModePoint = this.computedControlModePoint;
if (this.style.Station.StationControl.substationControl.show) {
this.substationControl = new ESingleControl({
_subType: 'substation',
@ -649,16 +674,16 @@ export default class Station extends Group {
zlevel: this.zlevel,
z: this.z,
point: {
x: model.controlModePoint.x + this.style.Station.StationControl.lamp.distance / 2 + this.style.Station.StationControl.substationControl.offset.x,
y: model.controlModePoint.y + this.style.Station.StationControl.substationControl.offset.y
x: computedControlModePoint.x + this.style.Station.StationControl.lamp.distance / 2 + this.style.Station.StationControl.substationControl.offset.x,
y: computedControlModePoint.y + this.style.Station.StationControl.substationControl.offset.y
},
context: this.style.Station.StationControl.substationControl.text,
pop: false
});
this.add(this.substationControl);
if (this.style.Station.StationControl.substationControl.arrowShow) {
const x = this.model.controlModePoint.x + this.style.Station.StationControl.substationControl.offset.x;
const y = this.model.controlModePoint.y + this.style.Station.StationControl.substationControl.offset.y;
const x = computedControlModePoint.x + this.style.Station.StationControl.substationControl.offset.x;
const y = computedControlModePoint.y + this.style.Station.StationControl.substationControl.offset.y;
const point = arrow(x, y + this.style.Station.StationControl.lamp.radiusR / 2, this.style.Station.StationControl.lamp.distance / 6, this.style.Station.StationControl.lamp.radiusR * 0.8);
this.substationArrowsControl = new EArrow({
zlevel: this.zlevel,
@ -667,8 +692,8 @@ export default class Station extends Group {
count: this.count,
drict: 1,
point: point,
x: model.controlModePoint.x + this.style.Station.StationControl.lamp.offset.x,
y: model.controlModePoint.y + this.style.Station.StationControl.lamp.radiusR / 2 + this.style.Station.StationControl.lamp.offset.y,
x: computedControlModePoint.x + this.style.Station.StationControl.lamp.offset.x,
y: computedControlModePoint.y + this.style.Station.StationControl.lamp.radiusR / 2 + this.style.Station.StationControl.lamp.offset.y,
fill: this.style.Station.StationControl.substationControl.grayColor,
lineWidth: 1,
stroke: this.style.sidelineColor
@ -679,7 +704,8 @@ export default class Station extends Group {
}
createInterconnectedControl() { // 联锁控
const model = this.model;
// const model = this.model;
const computedControlModePoint = this.computedControlModePoint;
if (this.style.Station.StationControl.interconnectedControl.show) { // 成都三会显示
this.interconnectedControl = new ESingleControl({
_subType: 'interconnected',
@ -687,8 +713,8 @@ export default class Station extends Group {
zlevel: this.zlevel,
z: this.z,
point: {
x: model.controlModePoint.x + this.style.Station.StationControl.lamp.distance * 3 / 2 + this.style.Station.StationControl.interconnectedControl.offset.x,
y: model.controlModePoint.y + this.style.Station.StationControl.interconnectedControl.offset.y
x: computedControlModePoint.x + this.style.Station.StationControl.lamp.distance * 3 / 2 + this.style.Station.StationControl.interconnectedControl.offset.x,
y: computedControlModePoint.y + this.style.Station.StationControl.interconnectedControl.offset.y
},
context: this.style.Station.StationControl.interconnectedControl.text || '联锁控',
pop: false
@ -821,7 +847,7 @@ export default class Station extends Group {
} else if (!store.getters['map/checkDeviceShow'](this._code)) {
this.eachChild(item => { item.hide(); });
} else {
store.getters['map/checkStationGuideMaster'](this._code, model.sguideMasterLock, model.xguideMasterLock);
store.getters['map/checkStationGuideMaster'](this._code, model.sguideMasterLock, model.xguideMasterLock);
model.controlMode && this['handle' + model.controlMode]();
model.preResetValidDuration && this.handlePreResetLamp();
model.controller && this.handleComplexControl(model.controller);
@ -1003,6 +1029,6 @@ export default class Station extends Group {
}
}
getAnchorPoint() {
return this.model.position;
return this.computedPosition;
}
}

View File

@ -11,6 +11,12 @@ export default class StationCounter extends Group {
super();
this._code = model.code;
this._type = model._type;
const pictureDevice = store.getters['map/getPictureDeviceByCode'](model.code);
if (pictureDevice) {
this.computedPosition = pictureDevice.position;
} else {
this.computedPosition = model.position;
}
this.model = model;
this.style = style;
this.zlevel = model.zlevel;
@ -21,14 +27,15 @@ export default class StationCounter extends Group {
create() {
const model = this.model;
const computedPosition = this.computedPosition;
const style = this.style;
this.counter = new Text({
zlevel: this.zlevel,
z: this.z,
position: [0, 0],
style: {
x: model.position.x,
y: model.position.y,
x: computedPosition.x,
y: computedPosition.y,
fontWeight: 'normal',
fontSize: style.textFontSize,
fontFamily: style.fontFamily,
@ -64,8 +71,8 @@ export default class StationCounter extends Group {
z: this.z,
position: [0, 0],
style: {
x: model.position.x,
y: model.position.y + this.rect.width + this.vPadding + style.textFontSize + style.StationCounter.text.distance,
x: computedPosition.x,
y: computedPosition.y + this.rect.width + this.vPadding + style.textFontSize + style.StationCounter.text.distance,
fontWeight: 'bold',
fontSize: style.textFontSize,
fontFamily: style.fontFamily,
@ -99,7 +106,7 @@ export default class StationCounter extends Group {
return null;
}
getAnchorPoint() {
return this.model.position;
return this.computedPosition;
}
}

View File

@ -11,6 +11,12 @@ export default class StationDelayUnlock extends Group {
super();
this._code = model.code;
this._type = model._type;
const pictureDevice = store.getters['map/getPictureDeviceByCode'](model.code);
if (pictureDevice) {
this.computedPosition = pictureDevice.position;
} else {
this.computedPosition = model.position;
}
this.model = model;
this.style = style;
this.zlevel = model.zlevel;
@ -21,14 +27,15 @@ export default class StationDelayUnlock extends Group {
create() {
const model = this.model;
const computedPosition = this.computedPosition;
const style = this.style;
this.text = new Text({
zlevel: this.zlevel,
z: this.z,
position: [0, 0],
style: {
x: model.position.x,
y: model.position.y,
x: computedPosition.x,
y: computedPosition.y,
fontWeight: 'normal',
fontSize: model.textFont,
fontFamily: style.fontFamily,
@ -45,8 +52,8 @@ export default class StationDelayUnlock extends Group {
z: this.z,
position: [0, 0],
style: {
x: model.position.x,
y: model.position.y + fontSize + style.StationDelayUnlock.text.distance,
x: computedPosition.x,
y: computedPosition.y + fontSize + style.StationDelayUnlock.text.distance,
fontWeight: 'normal',
fontSize: model.textFont,
fontFamily: style.fontFamily,
@ -69,8 +76,8 @@ export default class StationDelayUnlock extends Group {
zlevel: this.zlevel,
z: this.z - 1,
shape: {
x: model.position.x - this.lPadding,
y: model.position.y - this.vPadding,
x: computedPosition.x - this.lPadding,
y: computedPosition.y - this.vPadding,
width: this.rect.width + this.lPadding * 2,
height: this.rect.height + this.vPadding * 2
},
@ -119,6 +126,6 @@ export default class StationDelayUnlock extends Group {
this.time && this.time.show();
}
getAnchorPoint() {
return this.model.position;
return this.computedPosition;
}
}

View File

@ -12,13 +12,14 @@ class EEarlyStart extends Group {
create(deviceParam) {
if (!this.isNew) {
const model = this.model.modelData;
const computedPosition = this.model.modelData.computedPosition;
const style = this.model.style;
this.isNew = true;
/** 提前发车*/
const startD = model.right ? 1 : -1;
const startX = model.position.x - startD * (deviceParam.offset.x - model.width / 2);
const startY = model.position.y + startD * (deviceParam.offset.y - model.height / 2);
const startX = computedPosition.x - startD * (deviceParam.offset.x - model.width / 2);
const startY = computedPosition.y + startD * (deviceParam.offset.y - model.height / 2);
this.earlyStart = new Text({
zlevel: this.model.zlevel,

View File

@ -12,13 +12,14 @@ class ELevel extends Group {
create() {
if (!this.isNew) {
const model = this.model.modelData;
const computedPosition = this.model.modelData.computedPosition;
const style = this.model.style;
this.isNew = true;
const levelDrict = model.right ? 1 : -1;
const levelX = model.position.x - levelDrict * (style.StationStand.level.offset.x - model.width / 2);
const levelY = model.position.y + levelDrict * (style.StationStand.level.offset.y);
const levelX = computedPosition.x - levelDrict * (style.StationStand.level.offset.x - model.width / 2);
const levelY = computedPosition.y + levelDrict * (style.StationStand.level.offset.y);
this.level = new Text({
zlevel: this.model.zlevel,

View File

@ -15,12 +15,12 @@ export default class EMouse extends Group {
silent: true,
zlevel: this.zlevel,
z: 0,
shape: {
x: 0,
y: 0,
width: 0,
height: 0
},
shape: {
x: 0,
y: 0,
width: 0,
height: 0
},
style: {
lineDash: this.style.StationStand.mouseOverStyle.borderLineDash,
stroke: this.style.StationStand.mouseOverStyle.borderLineColor,
@ -33,34 +33,34 @@ export default class EMouse extends Group {
}
mouseover(e) {
const model = this.device.model;
const mapDevice = this.device.mapDevice;
const psdModel = mapDevice[model.psdCode];
const rect = this.device.getBoundingRect().clone();
const model = this.device.model;
const mapDevice = this.device.mapDevice;
const psdModel = mapDevice[model.psdCode];
const rect = this.device.getBoundingRect().clone();
if (psdModel && psdModel.instance) {
rect.union( psdModel.instance.getBoundingRect());
}
if (psdModel && psdModel.instance) {
rect.union( psdModel.instance.getBoundingRect());
}
if (this.style.StationStand.mouseOverStyle.standBackgroundColor) {
this.device.solidStand && this.device.solidStand.removeHover();
this.device.solidStand && this.device.solidStand.addHover({
fill: this.device.__over
? this.style.StationStand.mouseOverStyle.standBackgroundColorOver
: this.style.StationStand.mouseOverStyle.standBackgroundColor
});
}
if (this.style.StationStand.mouseOverStyle.standBackgroundColor) {
this.device.solidStand && this.device.solidStand.removeHover();
this.device.solidStand && this.device.solidStand.addHover({
fill: this.device.__over
? this.style.StationStand.mouseOverStyle.standBackgroundColorOver
: this.style.StationStand.mouseOverStyle.standBackgroundColor
});
}
this.border.setShape(rect);
this.border.setShape(rect);
this.border.show();
}
mouseout(e) {
if (!this.device.__down) {
if (this.style.StationStand.mouseOverStyle.standBackgroundColor) {
this.device.solidStand && this.device.solidStand.removeHover();
}
this.border.hide();
if (this.style.StationStand.mouseOverStyle.standBackgroundColor) {
this.device.solidStand && this.device.solidStand.removeHover();
}
this.border.hide();
}
}
}

View File

@ -10,6 +10,7 @@ class EPatternFilter extends Group {
create() {
const model = this.model.modelData;
const computedPosition = this.model.modelData.computedPosition;
const style = this.model.style;
let direction = -1;
if ((model.right && model.inside) || (!model.right && !model.inside)) {
@ -17,17 +18,17 @@ class EPatternFilter extends Group {
}
const startX = (model.width / 2 + style.StationStand.patternFilter.offset.x);
const startY = model.position.y + (model.height / 2 + style.StationStand.patternFilter.offset.y) * direction + (1 + direction) / 2 * 14;
const startY = computedPosition.y + (model.height / 2 + style.StationStand.patternFilter.offset.y) * direction + (1 + direction) / 2 * 14;
this.patternFilter1 = new Polygon({
zlevel: this.model.zlevel,
z: this.model.z,
shape: {
points:[
[model.position.x - startX, startY],
[model.position.x - startX, startY - 14],
[model.position.x - startX - 14, startY - 14],
[model.position.x - startX - 14 - 10 * 0.866, startY - 7],
[model.position.x - startX - 14, startY]
[computedPosition.x - startX, startY],
[computedPosition.x - startX, startY - 14],
[computedPosition.x - startX - 14, startY - 14],
[computedPosition.x - startX - 14 - 10 * 0.866, startY - 7],
[computedPosition.x - startX - 14, startY]
]
},
style: {
@ -39,11 +40,11 @@ class EPatternFilter extends Group {
z: this.model.z,
shape: {
points:[
[model.position.x + startX, startY],
[model.position.x + startX, startY - 14],
[model.position.x + startX + 14, startY - 14],
[model.position.x + startX + 14 + 10 * 0.866, startY - 7],
[model.position.x + startX + 14, startY]
[computedPosition.x + startX, startY],
[computedPosition.x + startX, startY - 14],
[computedPosition.x + startX + 14, startY - 14],
[computedPosition.x + startX + 14 + 10 * 0.866, startY - 7],
[computedPosition.x + startX + 14, startY]
]
},
style: {

View File

@ -12,13 +12,14 @@ class EReentry extends Group {
create() {
if (!this.isNew) {
const model = this.model.modelData;
const computedPosition = this.model.modelData.computedPosition;
const style = this.model.style;
this.isNew = true;
const reentryH = style.StationStand.reentry.mergentR;
const isRight = model.right ? -1 : 1;
const reentryX = model.position.x - (style.StationStand.reentry.position || isRight) * (style.StationStand.reentry.offset.x - model.width / 2);
const reentryY = model.position.y + (style.StationStand.reentry.position || isRight) * (style.StationStand.reentry.offset.y) + isRight * reentryH;
const reentryX = computedPosition.x - (style.StationStand.reentry.position || isRight) * (style.StationStand.reentry.offset.x - model.width / 2);
const reentryY = computedPosition.y + (style.StationStand.reentry.position || isRight) * (style.StationStand.reentry.offset.y) + isRight * reentryH;
this.reentry = new Polygon({
zlevel: this.model.zlevel,

View File

@ -11,13 +11,14 @@ class EStationPlatform extends Group {
create() {
const model = this.model.modelData;
const computedPosition = this.model.modelData.computedPosition;
const style = this.model.style;
const buttonD = model.right ? 1 : -1;
const platFormOffset = model.inside ? style.StationStand.stationPlatform.insideOffset : style.StationStand.stationPlatform.outsideOffset;
const buttonX = model.position.x - buttonD * ( model.width / 2 - 20);
const buttonX = computedPosition.x - buttonD * ( model.width / 2 - 20);
// platFormOffset.x -
const buttonY = model.position.y + buttonD * (platFormOffset.y + buttonD * model.height / 2);
const buttonY = computedPosition.y + buttonD * (platFormOffset.y + buttonD * model.height / 2);
this.stationPlatform = new Polygon({
zlevel: this.model.zlevel,
z: this.model.z,

View File

@ -11,11 +11,12 @@ class ETime extends Group {
create() {
if (!this.isNew) {
const model = this.model.modelData;
const computedPosition = this.model.modelData.computedPosition;
const style = this.model.style;
const timeDrict = model.right ? 1 : -1;
const timeX = model.position.x + style.StationStand.stopTime.position * timeDrict * (style.StationStand.stopTime.offset.x - model.width / 2);
const timeY = model.position.y + timeDrict * (style.StationStand.stopTime.offset.y - model.height / 2);
const timeX = computedPosition.x + style.StationStand.stopTime.position * timeDrict * (style.StationStand.stopTime.offset.x - model.width / 2);
const timeY = computedPosition.y + timeDrict * (style.StationStand.stopTime.offset.y - model.height / 2);
this.isNew = true;
this.time = new Text({

View File

@ -10,12 +10,13 @@ class ETrainDepart extends Group {
create() {
const model = this.model.modelData;
const computedPosition = this.model.modelData.computedPosition;
const style = this.model.style;
const trainDepartOffset = model.inside ? style.StationStand.trainDepart.insideOffset : style.StationStand.trainDepart.outsideOffset;
const trainDepartH = model.right ? 1 : -1;
const departX = model.position.x + trainDepartH * trainDepartOffset.x;
const departY = model.position.y + trainDepartH * trainDepartOffset.y;
const departX = computedPosition.x + trainDepartH * trainDepartOffset.x;
const departY = computedPosition.y + trainDepartH * trainDepartOffset.y;
this.trainDepart = new Text({
zlevel: this.model.zlevel,

View File

@ -11,11 +11,12 @@ class ETrainSetButton extends Group {
create() {
const model = this.model.modelData;
const computedPosition = this.model.modelData.computedPosition;
const style = this.model.style;
const buttonD = model.right ? 1 : -1;
const buttonX = model.position.x - buttonD * (style.StationStand.trainSetButton.offset.x - model.width / 2);
const buttonY = model.position.y + buttonD * (style.StationStand.trainSetButton.offset.y - model.height / 2);
const buttonX = computedPosition.x - buttonD * (style.StationStand.trainSetButton.offset.x - model.width / 2);
const buttonY = computedPosition.y + buttonD * (style.StationStand.trainSetButton.offset.y - model.height / 2);
this.trainSetButton = new Text({
zlevel: this.model.zlevel,

View File

@ -11,13 +11,14 @@ class ETrainStop extends Group {
create() {
if (!this.isNew) {
const model = this.model.modelData;
const computedPosition = this.model.modelData.computedPosition;
const style = this.model.style;
this.isNew = true;
const stopTrainOffset = model.inside ? style.StationStand.trainStop.insideOffset : style.StationStand.trainStop.outsideOffset;
const stopTrainH = model.right ? 1 : -1;
const stopX = model.position.x + stopTrainH * stopTrainOffset.x;
const stopY = model.position.y + stopTrainH * stopTrainOffset.y;
const stopX = computedPosition.x + stopTrainH * stopTrainOffset.x;
const stopY = computedPosition.y + stopTrainH * stopTrainOffset.y;
this.trainStop = new Arc({
zlevel: this.model.zlevel,

View File

@ -12,14 +12,15 @@ class EDetain extends Group {
create(deviceParam) {
if (!this.isNew) {
const model = this.model.modelData;
const computedPosition = this.model.modelData.computedPosition;
const style = this.model.style;
this.isNew = true;
/** 站台扣车*/
const detainOffset = model.inside ? deviceParam.insideOffset : deviceParam.outsideOffset;
const detainD = model.right ? 1 : -1;
const detainX = model.position.x - detainD * (detainOffset.x - model.width / 2);
const detainY = model.position.y + detainD * (detainOffset.y - model.height / 2);
const detainX = computedPosition.x - detainD * (detainOffset.x - model.width / 2);
const detainY = computedPosition.y + detainD * (detainOffset.y - model.height / 2);
this.detain = new Text({
zlevel: this.model.zlevel,
@ -43,7 +44,7 @@ class EDetain extends Group {
if (deviceParam.special) {
//, 'textPadding':[1, 3], 'textBorderColor':'#fff', 'textBorderWidth':1
this.detain.setStyle({x:model.position.x - detainD * (model.width / 2 + detainOffset.x), y: model.position.y - detainD * 10});
this.detain.setStyle({x:computedPosition.x - detainD * (model.width / 2 + detainOffset.x), y: computedPosition.y - detainD * 10});
}
}
}

View File

@ -12,11 +12,11 @@ class EDetainCircle extends Group {
create() {
const model = this.model.modelData;
const style = this.model.style;
const computedPosition = this.model.modelData.computedPosition;
const detainD = model.right ? 1 : -1;
const x = model.position.x + (model.width / 2) * detainD + detainD * style.StationStand.detainCircle.offset.x + detainD * style.StationStand.detainCircle.circleWidth / 2;
const y = model.position.y;
const x = computedPosition.x + (model.width / 2) * detainD + detainD * style.StationStand.detainCircle.offset.x + detainD * style.StationStand.detainCircle.circleWidth / 2;
const y = computedPosition.y;
const radius = style.StationStand.detainCircle.circleWidth / 2;
this.detainCircle = new Circle({

View File

@ -10,12 +10,13 @@ class EDetainHollow extends EDetain {
create() {
const model = this.model.modelData;
const computedPosition = this.model.modelData.computedPosition;
const style = this.model.style;
/** 站台扣车*/
const detainOffset = model.inside ? style.StationStand.detainHollow.insideOffset : style.StationStand.detainHollow.outsideOffset;
const detainD = model.right ? 1 : -1;
const detainX = model.position.x - detainD * (detainOffset.x - model.width / 2);
const detainY = model.position.y + detainD * (detainOffset.y - model.height / 2);
const detainX = computedPosition.x - detainD * (detainOffset.x - model.width / 2);
const detainY = computedPosition.y + detainD * (detainOffset.y - model.height / 2);
if (!this.isNew) {
super.create(style.StationStand.detainHollow);
const offsetX = model.right ? 8 : -8;

View File

@ -10,10 +10,11 @@ class EDetainCircle extends Group {
create() {
const model = this.model.modelData;
const computedPosition = this.model.modelData.computedPosition;
const style = this.model.style;
const standX = model.position.x - model.width / 2;
const standY = model.position.y - model.height / 2;
const standX = computedPosition.x - model.width / 2;
const standY = computedPosition.y - model.height / 2;
let y1;
let y2;

View File

@ -13,12 +13,13 @@ class EEmergentArrow extends Group {
create() {
if (!this.isNew) {
const model = this.model.modelData;
const computedPosition = this.model.modelData.computedPosition;
const style = this.model.style;
const emergentOffset = model.inside ? style.StationStand.emergentArrow.insideOffset : style.StationStand.emergentArrow.outsideOffset;
const emergentH = model.right ? 1 : -1;
const emergentX = model.position.x + emergentH * emergentOffset.x;
const emergentY = model.position.y + emergentH * emergentOffset.y;
const emergentX = computedPosition.x + emergentH * emergentOffset.x;
const emergentY = computedPosition.y + emergentH * emergentOffset.y;
const rotation = model.right == 1 ? Math.PI / 2 : Math.PI * 3 / 2;
this.emergent = new Polygon({

View File

@ -12,12 +12,13 @@ class EEmergentCross extends Group {
create() {
const model = this.model.modelData;
const computedPosition = this.model.modelData.computedPosition;
const style = this.model.style;
const emergentOffset = model.inside ? style.StationStand.emergentCross.insideOffset : style.StationStand.emergentCross.outsideOffset;
const emergentH = model.right ? 1 : -1;
const emergentX = model.position.x + emergentH * emergentOffset.x;
const emergentY = model.position.y + emergentH * emergentOffset.y;
const emergentX = computedPosition.x + emergentH * emergentOffset.x;
const emergentY = computedPosition.y + emergentH * emergentOffset.y;
model.r = style.StationStand.emergentCross.mergentR;
model.n = style.StationStand.emergentCross.mergentN;

View File

@ -11,12 +11,13 @@ class EEmergentRhombus extends Group {
create() {
if (!this.isNew) {
const model = this.model.modelData;
const computedPosition = this.model.modelData.computedPosition;
const style = this.model.style;
const emergentOffset = model.inside ? style.StationStand.emergentRhombus.insideOffset : style.StationStand.emergentRhombus.outsideOffset;
const emergentH = model.right ? 1 : -1;
const emergentX = model.position.x + emergentH * emergentOffset.x;
const emergentY = model.position.y + emergentH * emergentOffset.y;
const emergentX = computedPosition.x + emergentH * emergentOffset.x;
const emergentY = computedPosition.y + emergentH * emergentOffset.y;
model.r = style.StationStand.emergentRhombus.mergentR;
model.n = style.StationStand.emergentRhombus.mergentN;

View File

@ -45,6 +45,12 @@ class StationStand extends Group {
super();
this._code = model.code;
this._type = model._type;
const pictureDevice = store.getters['map/getPictureDeviceByCode'](model.code);
if (pictureDevice) {
this.computedPosition = pictureDevice.position;
} else {
this.computedPosition = model.position;
}
this.model = model;
this.style = style;
this.zlevel = model.zlevel;
@ -59,7 +65,7 @@ class StationStand extends Group {
// 加载皮肤控制的元素
const model = this.model;
const style = this.style;
model.computedPosition = this.computedPosition;
// // 站台所有的绘图元素
const elementTypeList = {
'solidStand':ESolidStand, // 矩形实心站台 (普通站台样式)
@ -248,7 +254,7 @@ class StationStand extends Group {
this.highlight && this.highlight.drawSelected(selected);
}
getAnchorPoint() {
return this.model.position;
return this.computedPosition;
}
}
export default StationStand;

View File

@ -10,13 +10,14 @@ class EJump extends Group {
create(deviceParam) {
if (!this.isNew) {
const model = this.model.modelData;
const computedPosition = this.model.modelData.computedPosition;
const style = this.model.style;
this.isNew = true;
const jumpDirct = model.right ? -1 : 1;
const jumpOffsetY = model.inside ? -1 : 1;
const jumpX = model.position.x - jumpDirct * (deviceParam.offset.x - model.width / 2);
const jumpY = model.position.y + jumpDirct * jumpOffsetY * deviceParam.offset.y;
const jumpX = computedPosition.x - jumpDirct * (deviceParam.offset.x - model.width / 2);
const jumpY = computedPosition.y + jumpDirct * jumpOffsetY * deviceParam.offset.y;
if (deviceParam.special) {
this.jump = new Text({
@ -24,7 +25,7 @@ class EJump extends Group {
z: this.model.z,
style: {
x: jumpX,
y: model.position.y + jumpDirct * jumpOffsetY * deviceParam.offset.y,
y: computedPosition.y + jumpDirct * jumpOffsetY * deviceParam.offset.y,
fontWeight: deviceParam.fontWeight,
fontSize: deviceParam.fontSize,
fontFamily: style.fontFamily,

View File

@ -9,11 +9,12 @@ class EJumpCircle extends EJump {
}
create() {
const model = this.model.modelData;
const computedPosition = this.model.modelData.computedPosition;
const style = this.model.style;
const jumpDirct = model.right ? -1 : 1;
const jumpCX = model.position.x - jumpDirct * (style.StationStand.jumpCircle.offset.x - model.width / 2);
const jumpCY = model.position.y + jumpDirct * style.StationStand.jumpCircle.offset.y;
const jumpCX = computedPosition.x - jumpDirct * (style.StationStand.jumpCircle.offset.x - model.width / 2);
const jumpCY = computedPosition.y + jumpDirct * style.StationStand.jumpCircle.offset.y;
if (!this.isNew) {
super.create(style.StationStand.jumpCircle);

View File

@ -12,9 +12,10 @@ class EGapStand extends Group {
create() {
const model = this.model.modelData;
const computedPosition = this.model.modelData.computedPosition;
const style = this.model.style;
const standX = model.position.x - model.width / 2;
const standY = model.position.y - model.height / 2;
const standX = computedPosition.x - model.width / 2;
const standY = computedPosition.y - model.height / 2;
this.stand1 = new Rect({
zlevel: this.model.zlevel,

View File

@ -10,9 +10,10 @@ class EHollowStand extends Group {
create() {
const model = this.model.modelData;
const computedPosition = this.model.modelData.computedPosition;
const style = this.model.style;
const standX = model.position.x - model.width / 2;
const standY = model.position.y - model.height / 2;
const standX = computedPosition.x - model.width / 2;
const standY = computedPosition.y - model.height / 2;
this.stand = new Rect({
zlevel: this.model.zlevel,

View File

@ -12,9 +12,10 @@ class ESolidStand extends Group {
create() {
const model = this.model.modelData;
const computedPosition = this.model.modelData.computedPosition;
const style = this.model.style;
const standX = model.position.x - model.width / 2;
const standY = model.position.y - model.height / 2;
const standX = computedPosition.x - model.width / 2;
const standY = computedPosition.y - model.height / 2;
const direction = model.right ? 1 : -1;
this.stand = new Polyline({

View File

@ -11,9 +11,10 @@ class ESolidStand extends Group {
create() {
const model = this.model.modelData;
const computedPosition = this.model.modelData.computedPosition;
const style = this.model.style;
const standX = model.position.x - model.width / 2;
const standY = model.position.y - model.height / 2;
const standX = computedPosition.x - model.width / 2;
const standY = computedPosition.y - model.height / 2;
this.stand = new Rect({
zlevel: this.model.zlevel,
@ -58,8 +59,8 @@ class ESolidStand extends Group {
zlevel: this.model.zlevel,
z: this.model.z + 10,
style: {
x: model.position.x + 35,
y: model.position.y - 20,
x: computedPosition.x + 35,
y: computedPosition.y - 20,
text: `${'站台人数: ' + model.num ? model.num : 0}`,
textFill: '#000',
textAlign: 'left',

View File

@ -13,8 +13,8 @@ export default class EMouse extends Group {
z: this.device.z + 1,
position: [0, 0],
style: {
x: this.device.model.position.x,
y: this.device.model.position.y + this.device.style.LcControl.lamp.radiusR + this.device.style.LcControl.text.distance - 30,
x: this.device.computedPosition.x,
y: this.device.computedPosition.y + this.device.style.LcControl.lamp.radiusR + this.device.style.LcControl.text.distance - 30,
fontWeight: 'normal',
fontSize: this.device.style.LcControl.mouseOverStyle.fontSize,
fontFamily: this.device.style.fontFamily,

View File

@ -12,6 +12,12 @@ export default class StationTurnBack extends Group {
this._code = model.code;
this._type = model._type;
this.zlevel = model.zlevel;
const pictureDevice = store.getters['map/getPictureDeviceByCode'](model.code);
if (pictureDevice) {
this.computedPosition = pictureDevice.position;
} else {
this.computedPosition = model.position;
}
this.z = 40;
this.model = model;
this.style = style;
@ -23,14 +29,15 @@ export default class StationTurnBack extends Group {
create() {
const model = this.model;
const style = this.style;
const computedPosition = this.computedPosition;
if (model.show && !style.StationTurnBack.spliceShow) {
this.control = new Circle({
zlevel: this.zlevel,
z: this.z,
shape: {
cx: model.position.x,
cy: model.position.y,
cx: computedPosition.x,
cy: computedPosition.y,
r: style.StationTurnBack.lamp.radiusR
},
style: {
@ -43,8 +50,8 @@ export default class StationTurnBack extends Group {
zlevel: this.zlevel,
z: this.z,
shape: {
x: model.position.x - style.StationTurnBack.lamp.radiusR - style.StationTurnBack.rect.padding / 2,
y: model.position.y - style.StationTurnBack.lamp.radiusR - style.StationTurnBack.rect.padding / 2,
x: computedPosition.x - style.StationTurnBack.lamp.radiusR - style.StationTurnBack.rect.padding / 2,
y: computedPosition.y - style.StationTurnBack.lamp.radiusR - style.StationTurnBack.rect.padding / 2,
width: style.StationTurnBack.lamp.radiusR * 2 + style.StationTurnBack.rect.padding,
height: style.StationTurnBack.lamp.radiusR * 2 + style.StationTurnBack.rect.padding
},
@ -63,8 +70,8 @@ export default class StationTurnBack extends Group {
z: this.z,
position: [0, 0],
style: {
x: model.position.x,
y: model.position.y - style.StationTurnBack.lamp.radiusR - style.StationTurnBack.text.distance,
x: computedPosition.x,
y: computedPosition.y - style.StationTurnBack.lamp.radiusR - style.StationTurnBack.text.distance,
fontWeight: style.StationTurnBack.text.fontWeight,
fontSize: style.StationTurnBack.text.fontSize,
fontFamily: style.fontFamily,
@ -86,8 +93,8 @@ export default class StationTurnBack extends Group {
z: this.z,
position: [0, 0],
style: {
x: model.position.x,
y: model.position.y + style.StationTurnBack.lamp.radiusR + style.StationTurnBack.text.distance,
x: computedPosition.x,
y: computedPosition.y + style.StationTurnBack.lamp.radiusR + style.StationTurnBack.text.distance,
fontWeight: style.StationTurnBack.text.fontWeight,
fontSize: style.StationTurnBack.text.fontSize,
fontFamily: style.fontFamily,
@ -104,8 +111,8 @@ export default class StationTurnBack extends Group {
this.control = new EFoldbackMode({
zlevel: this.zlevel,
z: this.z,
x: model.position.x,
y: model.position.y,
x: computedPosition.x,
y: computedPosition.y,
width: style.ReturnModeGroup.rectWidth,
style: style
});
@ -196,7 +203,7 @@ export default class StationTurnBack extends Group {
};
}
getAnchorPoint() {
return this.model.position;
return this.computedPosition;
}
getBoundingRect() {

View File

@ -0,0 +1,35 @@
import Group from 'zrender/src/container/Group'
import Circle from 'zrender/src/graphic/shape/Circle'
class ESwDot extends Group {
constructor(model, drictx, dricty) {
super()
this.model = model
this.dricty = dricty > 0
this.drictx = drictx > 0
this.create()
}
create() {
const { model } = this
this.dot = new Circle({
zlevel: model.zlevel,
z: model.z || 0 + 12,
shape: {
cx: model.intersection.x + (this.drictx ? 12 : -12),
cy: model.intersection.y + (this.dricty ? 8 : -8),
r: 2
},
style: {
fill: '#FF0000'
}
})
this.add(this.dot)
}
setColor(color) {
console.log(this.dot)
console.log(color)
this.dot.setStyle({ fill: color })
}
}
export default ESwDot

View File

@ -13,6 +13,7 @@ import EMouse from './EMouse';
import EHighlight from '../element/EHighlight';
import ETriangle from './ETriangle';
import store from '@/store/index';
import ESwDot from './ESwDot';
export default class Switch extends Group {
constructor(model, {style, mapDevice}) {
@ -53,34 +54,36 @@ export default class Switch extends Group {
const directx = this.triangle.drictx;
const directy = this.triangle.dricty;
const switchWidth1 = style.Section.line.width / 2;
let directxA = 1;
let sectionATriangle = new JTriangle(sectionAModel.points[0], sectionAModel.points[1]);
let sectionBTriangle = new JTriangle(sectionBModel.points[0], sectionBModel.points[1]);
let sectionCTriangle = new JTriangle(sectionCModel.points[0], sectionCModel.points[1]);
const sectionAPoints = sectionAModel.instance ? sectionAModel.instance.computedPoints : sectionAModel.points;
const sectionBPoints = sectionBModel.instance ? sectionBModel.instance.computedPoints : sectionBModel.points;
const sectionCPoints = sectionCModel.instance ? sectionCModel.instance.computedPoints : sectionCModel.points;
let sectionATriangle = new JTriangle(sectionAPoints[0], sectionAPoints[1]);
let sectionBTriangle = new JTriangle(sectionBPoints[0], sectionBPoints[1]);
let sectionCTriangle = new JTriangle(sectionCPoints[0], sectionCPoints[1]);
const sectionAPoint = { x: model.intersection.x, y: model.intersection.y };
if (sectionAModel.points[0].x == model.intersection.x && sectionAModel.points[0].y == model.intersection.y) {
sectionATriangle = new JTriangle(sectionAModel.points[0], sectionAModel.points[1]);
if (sectionAPoints[0].x == model.intersection.x && sectionAPoints[0].y == model.intersection.y) {
sectionATriangle = new JTriangle(sectionAPoints[0], sectionAPoints[1]);
directxA = 1;
}
if (sectionAModel.points[sectionAModel.points.length - 1].x == model.intersection.x && sectionAModel.points[sectionAModel.points.length - 1].y == model.intersection.y) {
sectionATriangle = new JTriangle(sectionAModel.points[sectionAModel.points.length - 2], sectionAModel.points[sectionAModel.points.length - 1]);
if (sectionAPoints[sectionAPoints.length - 1].x == model.intersection.x && sectionAPoints[sectionAPoints.length - 1].y == model.intersection.y) {
sectionATriangle = new JTriangle(sectionAPoints[sectionAPoints.length - 2], sectionAPoints[sectionAPoints.length - 1]);
directxA = -1;
}
if (sectionBModel.points[0].x == model.intersection.x && sectionBModel.points[0].y == model.intersection.y) {
sectionBTriangle = new JTriangle(sectionBModel.points[0], sectionBModel.points[1]);
if (sectionBPoints[0].x == model.intersection.x && sectionBPoints[0].y == model.intersection.y) {
sectionBTriangle = new JTriangle(sectionBPoints[0], sectionBPoints[1]);
}
if (sectionBModel.points[sectionBModel.points.length - 1].x == model.intersection.x && sectionBModel.points[sectionBModel.points.length - 1].y == model.intersection.y) {
sectionBTriangle = new JTriangle(sectionBModel.points[sectionBModel.points.length - 2], sectionBModel.points[sectionBModel.points.length - 1]);
if (sectionBPoints[sectionBPoints.length - 1].x == model.intersection.x && sectionBPoints[sectionBPoints.length - 1].y == model.intersection.y) {
sectionBTriangle = new JTriangle(sectionBPoints[sectionBPoints.length - 2], sectionBPoints[sectionBPoints.length - 1]);
}
if (sectionCModel.points[0].x == model.intersection.x && sectionCModel.points[0].y == model.intersection.y) {
sectionCTriangle = new JTriangle(sectionCModel.points[0], sectionCModel.points[1]);
if (sectionCPoints[0].x == model.intersection.x && sectionCPoints[0].y == model.intersection.y) {
sectionCTriangle = new JTriangle(sectionCPoints[0], sectionCPoints[1]);
}
if (sectionCModel.points[sectionCModel.points.length - 1].x == model.intersection.x && sectionCModel.points[sectionCModel.points.length - 1].y == model.intersection.y) {
sectionCTriangle = new JTriangle(sectionCModel.points[sectionCModel.points.length - 2], sectionCModel.points[sectionCModel.points.length - 1]);
if (sectionCPoints[sectionCPoints.length - 1].x == model.intersection.x && sectionCPoints[sectionCPoints.length - 1].y == model.intersection.y) {
sectionCTriangle = new JTriangle(sectionCPoints[sectionCPoints.length - 2], sectionCPoints[sectionCPoints.length - 1]);
}
const swPadding = rateOpen
@ -212,12 +215,19 @@ export default class Switch extends Group {
}
});
if (this.style.Switch.switchDot && this.style.Switch.switchDot.show) {
const { drictx, dricty } = this.triangle;
this.dot = new ESwDot(model, drictx, dricty);
this.add(this.dot);
}
this.add(this.shapeModelA);
this.add(this.shapeModelB);
this.add(this.shapeModelC);
this.add(this.shapeBlockCover);
this.add(this.name);
this.add(this.enabledName);
style.Switch.text.show && model.nameShow ? this.name.show() : this.name.hide();
}
@ -343,6 +353,7 @@ export default class Switch extends Group {
this.artificialArc && this.artificialArc.hide();
this.name && this.name.show();
this.limitName && this.limitName.show();
this.dot && this.dot.hide();
}
/** 定位*/
@ -434,28 +445,20 @@ export default class Switch extends Group {
.start();
}
// N-定位 R-反位 NO-无(失表) EX-挤叉
setSwitchFault(fault, pos) {
if (this.style.Switch.jointImg.faultStatus && fault && (pos == 'NO' || pos == 'EX') ) { // 宁波线失表状态
this.setForkAction(fault); // 道岔挤岔
} else if (this.style.Switch.faultNoHandle ) {
this.shapeModelA.hide();
this.shapeModelB.hide();
this.shapeModelC.hide();
} else {
const faultList = ['SPLIT', 'SQUEEZE', 'NORMAL_SPLIT', 'REVERSE_SPLIT', 'SPLIT_1'];
// (fault === 'SPLIT' || fault === 'SQUEEZE' || (fault === 'NORMAL_SPLIT' && !reversePosition) || (fault === 'REVERSE_SPLIT' && !normalPosition))
if (this.model.switchFaultCode && fault && faultList.includes(fault) ) {
const switchFault = this.mapDevice[this.model.switchFaultCode];
switchFault.instance.setControlColor('#F00', true);
} else if (this.model.switchFaultCode) {
const switchFault = this.mapDevice[this.model.switchFaultCode];
switchFault.instance.setControlColor(this.style.backgroundColor, false);
}
// stopAnimation
this.shapeModelB.stopAnimation(false);
this.shapeModelC.stopAnimation(false);
this.shapeModelA.stopAnimation(false);
setSwitchFault(fault) {
const faultList = ['SPLIT', 'SQUEEZE', 'NORMAL_SPLIT', 'REVERSE_SPLIT', 'SPLIT_1'];
// (fault === 'SPLIT' || fault === 'SQUEEZE' || (fault === 'NORMAL_SPLIT' && !reversePosition) || (fault === 'REVERSE_SPLIT' && !normalPosition))
if (this.model.switchFaultCode && fault && faultList.includes(fault) ) {
const switchFault = this.mapDevice[this.model.switchFaultCode];
switchFault.instance.setControlColor('#F00', true);
} else if (this.model.switchFaultCode) {
const switchFault = this.mapDevice[this.model.switchFaultCode];
switchFault.instance.setControlColor(this.style.backgroundColor, false);
}
// stopAnimation
this.shapeModelB.stopAnimation(false);
this.shapeModelC.stopAnimation(false);
this.shapeModelA.stopAnimation(false);
}
/** 挤叉*/
setForkAction(fault) {
@ -514,6 +517,10 @@ export default class Switch extends Group {
this.lockArc.setStyle({ stroke: this.style.Switch.arcBlcok.inversionColor });
}
}
if (this.style.Switch.switchDot && this.style.Switch.switchDot.show) {
this.dot.show();
this.dot.setColor(this.style.Switch.switchDot.monoLockColor);
}
this.setTextColor(this.style.Switch.text.monolockLocationColor);
}
@ -567,6 +574,10 @@ export default class Switch extends Group {
this.lockRect.setStyle({ stroke: this.style.Switch.rectLock.blockColor, fill: this.style.Switch.rectLock.blockFillColor });
}
}
if (this.style.Switch.switchDot && this.style.Switch.switchDot.show) {
this.dot.show();
this.dot.setColor(this.style.Switch.switchDot.lockColor);
}
// if (this.style.Switch.coverBlock && this.style.Switch.coverBlock.show) {
// this.shapeBlockCover.show();
@ -706,7 +717,7 @@ export default class Switch extends Group {
this.setAshShow();
}
} else {
this.setSwitchFault(model.fault, model.pos);
this.setSwitchFault(model.fault);
// model.pos == 'NO' || model.pos == 'EX';
// N-定位 R-反位 NO-无(失表) EX-挤叉
@ -718,14 +729,23 @@ export default class Switch extends Group {
this.switchPosition = 'reverse';
this.setInversionAction(model); /** 反位*/
} else if (model.pos == 'NO') {
this.setLossAction(model.fault); // 失去
// 宁波线失表
if (this.style.Switch.jointImg.faultStatus && model.fault) {
this.setForkAction(model.fault);
} else if (this.style.Switch.faultNoHandle) {
this.shapeModelA.hide();
this.shapeModelB.hide();
this.shapeModelC.hide();
} else {
this.setLossAction(model.fault); // 失去
}
} else if (model.pos == 'EX') {
this.setForkAction(model.fault); // 挤岔
}
model.isCiConfirm && this.setCiConfirm(); // 道岔使能显示
model.singleLock && this.setMonolock(model.pos); // 道岔单锁
model.guideMasterLock && this.setMonolock(model.pos); // 引导总锁
model.guideMasterLock && this.setMonolock(model.pos); // 引导总锁
model.blockade && this.block(model.pos); // 道岔封锁
model.singleLock && model.blockade && this.blockMonolock(); // 单锁&锁闭状态
const path = window.location.href;

View File

@ -10,6 +10,12 @@ export default class Text2 extends Group {
this._type = model._type;
this.name = model.code;
this.zlevel = model.zlevel;
const pictureDevice = store.getters['map/getPictureDeviceByCode'](model.code);
if (pictureDevice) {
this.computedPosition = pictureDevice.position;
} else {
this.computedPosition = model.position;
}
this.model = model;
this.style = style;
this.z = 6;
@ -21,6 +27,7 @@ export default class Text2 extends Group {
create() {
var model = this.model;
const computedPosition = this.computedPosition;
var [direction, content] = model.content.split('::');
if (direction == 'V') {
content = content.split('').join('\n');
@ -32,8 +39,8 @@ export default class Text2 extends Group {
zlevel: this.zlevel,
z: this.z,
style: {
x: model.position.x,
y: model.position.y,
x: computedPosition.x,
y: computedPosition.y,
text: content,
fontFamily: this.style.fontFamily,
fontSize: Number(model.font),
@ -58,7 +65,7 @@ export default class Text2 extends Group {
if (this.text) {
return this.text.getBoundingRect().clone();
} else {
return new BoundingRect(this.model.position.x, this.model.position.y, 0, 0);
return new BoundingRect(this.computedPosition.x, this.computedPosition.y, 0, 0);
}
}
screenShow() {
@ -70,6 +77,6 @@ export default class Text2 extends Group {
}
}
getAnchorPoint() {
return this.model.position;
return this.computedPosition;
}
}

View File

@ -41,12 +41,12 @@ export default class Train extends Group {
if (model.trainWindowModel) {
const amendData = store.getters['map/amendPoints'](model.trainWindowModel.code);
if (amendData) {
model.trainWindowModel.point = amendData.position;
model.trainWindowModel.instance.computedPoint = amendData.position;
model.trainWindowModel.reversal = amendData.reversal;
}
this.point = {
x: model.trainWindowModel.point.x,
y: model.trainWindowModel.point.y
x: model.trainWindowModel.instance.computedPoint.x,
y: model.trainWindowModel.instance.computedPoint.y
};
if (model.right) {
this.point.x = this.point.x - style.Train.trainHead.trainConntWidth * this.newScale - style.Train.common.trainWidth / 2;
@ -178,8 +178,8 @@ export default class Train extends Group {
if (style.Train.directionArrow.hasArrow) { // 列车运行上下方箭头eg:宁波yi
const arrowPoint = { x: 0, y: 0 };
if (model.trainWindowModel) {
arrowPoint.x = model.trainWindowModel.point.x;
arrowPoint.y = model.right ? model.trainWindowModel.point.y + style.Train.directionArrow.distanceBottom : model.trainWindowModel.point.y - style.Train.directionArrow.distanceTop;
arrowPoint.x = model.trainWindowModel.instance.computedPoint.x;
arrowPoint.y = model.right ? model.trainWindowModel.instance.computedPoint.y + style.Train.directionArrow.distanceBottom : model.trainWindowModel.instance.computedPoint.y - style.Train.directionArrow.distanceTop;
}
this.directionArrow = new EDirection({
zlevel: this.zlevel,

View File

@ -11,9 +11,14 @@ class TrainWindow extends Group {
this._type = model._type;
this.zlevel = model.zlevel;
const amendData = store.getters['map/amendPoints'](this._code);
const pictureDevice = store.getters['map/getPictureDeviceByCode'](model.code);
if (amendData) {
model.point = amendData.position;
model.reversal = amendData.reversal;
this.computedPoint = amendData.position;
} else if (pictureDevice) {
this.computedPoint = pictureDevice.position;
} else {
this.computedPoint = model.point;
}
this.model = model;
this.style = style;
@ -40,7 +45,7 @@ class TrainWindow extends Group {
/** 创建车次窗*/
createTrainWindow() {
const model = this.model;
const point = model.point || model.position;
const point = this.computedPoint;
this.trainRect = new Polygon({
_subType: 'TrainWindow',
zlevel: this.zlevel,
@ -94,7 +99,7 @@ class TrainWindow extends Group {
return (store.getters['map/getDeviceByCode'](code) || {}).instance;
}
getAnchorPoint() {
return this.model.point || this.model.position;
return this.computedPoint;
}
}

View File

@ -14,8 +14,8 @@ export default class EMouse extends Group {
z: this.device.z + 1,
position: [0, 0],
style: {
x: this.device.model.position.x,
y: this.device.model.position.y + this.device.style.ZcControl.lamp.radiusR + this.device.style.ZcControl.text.distance - 30,
x: this.device.computedPosition.x,
y: this.device.computedPosition.y + this.device.style.ZcControl.lamp.radiusR + this.device.style.ZcControl.text.distance - 30,
fontWeight: this.device.style.ZcControl.mouseOverStyle.fontWeight,
fontSize: this.device.style.ZcControl.mouseOverStyle.fontSize,
fontFamily: this.device.style.fontFamily,

View File

@ -13,6 +13,12 @@ export default class ZcControl extends Group {
this._code = model.code;
this._type = model._type;
this.zlevel = model.zlevel;
const pictureDevice = store.getters['map/getPictureDeviceByCode'](model.code);
if (pictureDevice) {
this.computedPosition = pictureDevice.position;
} else {
this.computedPosition = model.position;
}
this.model = model;
this.style = style;
this.isShowShape = true;
@ -29,8 +35,8 @@ export default class ZcControl extends Group {
z: this.z,
arc: {
shape: {
cx: model.position.x,
cy: model.position.y,
cx: this.computedPosition.x,
cy: this.computedPosition.y,
r: this.style.ZcControl.lamp.radiusR
},
subType: 'Control',
@ -41,8 +47,8 @@ export default class ZcControl extends Group {
},
text: {
position: [0, 0],
x: model.position.x,
y: model.position.y + this.style.ZcControl.lamp.radiusR + this.style.ZcControl.text.distance,
x: this.computedPosition.x,
y: this.computedPosition.y + this.style.ZcControl.lamp.radiusR + this.style.ZcControl.text.distance,
fontWeight: this.style.ZcControl.text.fontWeight,
fontSize: this.style.ZcControl.text.fontSize,
fontFamily: this.style.fontFamily,

View File

@ -30,4 +30,5 @@ export default class checkBox extends Group {
});
this.add(this.box);
}
setState() {}
}

View File

@ -564,15 +564,45 @@ export const menuOperate = {
operation: OperationEvent.CTCCommand.autoTrigger.menu.operation,
cmdType: CMD.CTC.CTC_AUTO_TRIGGER
},
// 批量修改股道
batchModifyTrackSection:{
operation: OperationEvent.CTCCommand.batchModifyTrackSection.menu.operation,
cmdType: CMD.CTC.CTC_BATCH_MODIFY_RUN_PLAN
// // 批量修改股道
// batchModifyTrackSection:{
// operation: OperationEvent.CTCCommand.batchModifyTrackSection.menu.operation,
// cmdType: CMD.CTC.CTC_BATCH_MODIFY_RUN_PLAN
// },
// 修改股道
modifyTrackSection:{
operation: OperationEvent.CTCCommand.modifyTrackSection.menu.operation,
cmdType: CMD.CTC.CTC_MODIFY_SECTION
},
// 移除行车日志
deleteRunplan:{
operation: OperationEvent.CTCCommand.deleteRunplan.menu.operation,
cmdType: CMD.CTC.CTC_REMOVE_RUN_PLAN
// 车站发送计划
stationSendRunplan:{
operation: OperationEvent.CTCCommand.stationSendRunplan.menu.operation,
cmdType: CMD.CTC.CTC_STATION_SEND_OUT_RUN_PLAN
},
// 车站取消红闪
stationCancleTwinkle:{
operation: OperationEvent.CTCCommand.stationCancleTwinkle.menu.operation,
cmdType: CMD.CTC.CTC_CANCEL_TWINKLE
},
// // 移除行车日志
// deleteRunplan:{
// operation: OperationEvent.CTCCommand.deleteRunplan.menu.operation,
// cmdType: CMD.CTC.CTC_REMOVE_RUN_PLAN
// },
// 设置删除标识
setDeleteRunplanLabel:{
operation: OperationEvent.CTCCommand.setDeleteRunplanLabel.menu.operation,
cmdType: CMD.CTC.CTC_LOG_SET_DELETE_LABEL
},
// 设置超限
setTransfinite:{
operation: OperationEvent.CTCCommand.setTransfinite.menu.operation,
cmdType: CMD.CTC.CTC_LOG_SET_TRANSFINITE
},
// 行车日志保存运行计划
logSaveRunplan:{
operation: OperationEvent.CTCCommand.logSaveRunplan.menu.operation,
cmdType: CMD.CTC.CTC_LOG_SAVE_RUN_PLAN
},
// 修改行车计划的邻站信息
modifyAdjacentStation:{
@ -594,6 +624,47 @@ export const menuOperate = {
operation: OperationEvent.CTCCommand.agreeNotcie.menu.operation,
cmdType: CMD.CTC.CTC_AGREE_NOTICE
},
// 取消到达
cancleArrive:{
operation: OperationEvent.CTCCommand.cancleArrive.menu.operation,
cmdType: CMD.CTC.CTC_LOG_CANCEL_ARRIVE
},
// 取消出发
cancleDepature:{
operation: OperationEvent.CTCCommand.cancleDepature.menu.operation,
cmdType: CMD.CTC.CTC_LOG_CANCEL_DEPARTURE
},
// 取消闭塞
cancleBlock:{
operation: OperationEvent.CTCCommand.cancleBlock.menu.operation,
cmdType: CMD.CTC.CTC_LOG_CANCEL_BLOCK
},
// 设置重点列车
setKeyTrains:{
operation: OperationEvent.CTCCommand.setKeyTrains.menu.operation,
cmdType: CMD.CTC.CTC_LOG_SET_KEY_TRAINS
},
// 设置允许出入口与基本路径不一致
setEntryOutDiscordant:{
operation: OperationEvent.CTCCommand.setEntryOutDiscordant.menu.operation,
cmdType: CMD.CTC.CTC_LOG_SET_ENTRY_OUT_DISCORDANT
},
// 设置允许股道与基本路径不一致
setTrackDiscordant:{
operation: OperationEvent.CTCCommand.setTrackDiscordant.menu.operation,
cmdType: CMD.CTC.CTC_LOG_SET_TRACK_DISCORDANT
},
// 设置始发
setStartRunplan:{
operation: OperationEvent.CTCCommand.setStartRunplan.menu.operation,
cmdType: CMD.CTC.CTC_LOG_SET_START_RUN_PLAN
},
// 设置终到
setEndRunplan:{
operation: OperationEvent.CTCCommand.setEndRunplan.menu.operation,
cmdType: CMD.CTC.CTC_LOG_SET_END_RUN_PLAN
},
// 增加列车固定径路
addTrainFixedPath:{
operation: OperationEvent.CTCCommand.addTrainFixedPath.menu.operation,
@ -642,6 +713,16 @@ export const menuOperate = {
modifyDispatcherLogerRpSection:{
operation: OperationEvent.CTCCommand.modifyDispatcherLogerRpSection.menu.operation,
cmdType: CMD.CTC.CTC_ZONE_SAVE_TRACK_SECTION
},
// 调度台行车计划修改时间
modifyDispatcherLogerRpPlanTime:{
operation: OperationEvent.CTCCommand.modifyDispatcherLogerRpSection.menu.operation,
cmdType: CMD.CTC.CTC_ZONE_SAVE_PLAN_TIME
},
// 调度台行车计划修改出入口
modifyDispatcherLogerRpDirection:{
operation: OperationEvent.CTCCommand.modifyDispatcherLogerRpSection.menu.operation,
cmdType: CMD.CTC.CTC_ZONE_SAVE_DIRECTION
}
},
Rail: {
@ -653,6 +734,10 @@ export const menuOperate = {
operation: OperationEvent.RailCommand.railQueryTicket.menu.operation,
cmdType: CMD.RAIL.CMD_RAIL_QUERY_TICKET
},
railGiveTicketTo: {
operation: OperationEvent.RailCommand.railGiveTicketTo.menu.operation,
cmdType: CMD.RAIL.CMD_RAIL_GIVE_TICKET_TO
},
railFillInRegister: {
operation: OperationEvent.RailCommand.railFillInRegister.menu.operation,
cmdType: CMD.RAIL.CMD_RAIL_FILL_IN_REGISTER

View File

@ -157,6 +157,10 @@ export default {
const offset = val ? 162 : 0;
EventBus.$emit('setMenuButtonPosition', offset);
},
'$store.state.socket.simulationReset': function (val) {
this.sequenceMap = {};
this.sequenceList = [];
},
'$store.state.socket.railCtcStatusMsg': function (val) {
if (val && val.length) {
val.forEach(item => {
@ -169,6 +173,11 @@ export default {
}
});
}
if (item && item.routeSequence && item.routeSequence.deletedLineIds && item.routeSequence.deletedLineIds.length) {
item.routeSequence.deletedLineIds.forEach(elem => {
delete this.sequenceMap[elem];
});
}
});
this.sequenceList = [];
for (const key in this.sequenceMap) {

View File

@ -46,7 +46,8 @@ export default {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
},
domIdConfirm() {
return this.dialogShow ? OperationEvent.CTCCommand.deleteRunplan.menu.domId : '';
// deleteRunplan
return this.dialogShow ? OperationEvent.CTCCommand.setDeleteRunplanLabel.menu.domId : '';
},
title() {
return '警告';
@ -69,7 +70,9 @@ export default {
},
commit() {
this.loading = true;
commitOperate(menuOperate.CTC.deleteRunplan, this.model, 2).then(({valid})=>{
//
// deleteRunplan;
commitOperate(menuOperate.CTC.setDeleteRunplanLabel, this.model, 2).then(({valid})=>{
this.loading = false;
this.$emit('clearRpRow');
if (valid) {

View File

@ -134,9 +134,9 @@ export default {
tableData1:[],
tableData2:[],
addModel:{
stationCode:'',
planParamList:[],
force:1
stationCode:''
// planParamList:[],
// force:1
}
};
},
@ -148,15 +148,15 @@ export default {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
},
domIdConfirm() {
return this.dialogShow ? OperationEvent.CTCCommand.batchModifyTrackSection.menu.domId : '';
return this.dialogShow ? OperationEvent.CTCCommand.stationSendRunplan.menu.domId : '';
},
title() {
return '发送计划';
}
},
methods:{
doShow(tableData, activeDepartRunPlan, activeArriveRunPlan, filterSectionList) {
this.addModel.planParamList = [];
doShow(tableData, filterSectionList) {
// this.addModel.planParamList = [];
this.tableData1 = [];
tableData.forEach(element => {
if (element.arriveRunPlan && element.arriveRunPlan.sectionCode) {
@ -171,24 +171,24 @@ export default {
});
// filterSectionList
this.addModel.stationCode = this.$store.state.training.roleDeviceCode;
const activeDepartRunPlanList = Object.values(activeDepartRunPlan).filter(activeDepart=>{ return activeDepart.changeSectionCode && activeDepart.changeSectionCode != activeDepart.sectionCode; });
if (activeDepartRunPlanList.length > 0) {
activeDepartRunPlanList.forEach(depart=>{
this.addModel.planParamList.push({
runPlanCode:depart.code,
departSectionCode:depart.changeSectionCode
});
});
}
const activeArriveRunPlanList = Object.values(activeArriveRunPlan).filter(activeArrive=>{ return activeArrive.changeSectionCode && activeArrive.changeSectionCode != activeArrive.sectionCode; });
if (activeArriveRunPlanList.length > 0) {
activeArriveRunPlanList.forEach(arrive=>{
this.addModel.planParamList.push({
runPlanCode:arrive.code,
arriveSectionCode:arrive.changeSectionCode
});
});
}
// const activeDepartRunPlanList = Object.values(activeDepartRunPlan).filter(activeDepart=>{ return activeDepart.changeSectionCode && activeDepart.changeSectionCode != activeDepart.sectionCode; });
// if (activeDepartRunPlanList.length > 0) {
// activeDepartRunPlanList.forEach(depart=>{
// this.addModel.planParamList.push({
// runPlanCode:depart.code,
// departSectionCode:depart.changeSectionCode
// });
// });
// }
// const activeArriveRunPlanList = Object.values(activeArriveRunPlan).filter(activeArrive=>{ return activeArrive.changeSectionCode && activeArrive.changeSectionCode != activeArrive.sectionCode; });
// if (activeArriveRunPlanList.length > 0) {
// activeArriveRunPlanList.forEach(arrive=>{
// this.addModel.planParamList.push({
// runPlanCode:arrive.code,
// arriveSectionCode:arrive.changeSectionCode
// });
// });
// }
this.dialogShow = true;
this.$nextTick(function () {
this.$store.dispatch('training/emitTipFresh');
@ -200,21 +200,21 @@ export default {
this.$store.dispatch('training/emitTipFresh');
},
commit() {
if (this.addModel.planParamList.length > 0) {
const params = this.addModel;
this.loading = true;
commitOperate(menuOperate.CTC.batchModifyTrackSection, params, 3).then(({valid})=>{
this.loading = false;
if (valid) {
this.$emit('closeFlash');
this.doClose();
}
}).catch(() => {
this.loading = false;
// if (this.addModel.planParamList.length > 0) {
const params = this.addModel;
this.loading = true;
commitOperate(menuOperate.CTC.stationSendRunplan, params, 3).then(({valid})=>{
this.loading = false;
if (valid) {
// this.$emit('closeFlash');
this.doClose();
this.$emit('noticeInfo');
});
}
}
}).catch(() => {
this.loading = false;
this.doClose();
this.$emit('noticeInfo');
});
// }
// * @param stationCode
// * @param runPlanCode

View File

@ -53,9 +53,12 @@
width="100"
>
<template slot-scope="scope">
<div v-if="scope.row.status==-1">删除</div>
<div v-else-if="scope.row.status==1">{{ sectionMap[scope.row.arriveSectionCode] }}</div>
<div v-else-if="scope.row.arriveSectionCode">{{ sectionMap[scope.row.arriveSectionCode]+'['+sectionMap[scope.row.oldArriveSectionCode]+']' }}</div>
<div v-if="scope.row.arriveSectionCode">
<div v-if="scope.row.status==-1">删除</div>
<!-- scope.row.status==1||( -->
<div v-else-if="scope.row.arriveSectionCode&&!scope.row.oldArriveSectionCode">{{ sectionMap[scope.row.arriveSectionCode] }}</div>
<div v-else>{{ sectionMap[scope.row.arriveSectionCode]+'['+sectionMap[scope.row.oldArriveSectionCode]+']' }}</div>
</div>
</template>
</el-table-column>
<el-table-column
@ -64,8 +67,10 @@
width="170"
>
<template slot-scope="scope">
<div v-if="scope.row.status==-1">删除</div>
<div v-else>{{ scope.row.arrivePlanTime }}</div>
<div v-if="scope.row.arrivePlanTime">
<div v-if="scope.row.status==-1">删除</div>
<div v-else>{{ scope.row.arrivePlanTime }}</div>
</div>
</template>
</el-table-column>
<el-table-column
@ -74,10 +79,13 @@
width="100"
>
<template slot-scope="scope">
<div v-if="scope.row.status==-1">删除</div>
<!-- {{ sectionMap }} -->
<div v-else-if="scope.row.status==1">{{ sectionMap[scope.row.departSectionCode] }}</div>
<div v-else-if="scope.row.departSectionCode">{{ sectionMap[scope.row.departSectionCode]+'['+sectionMap[scope.row.oldDepartSectionCode]+']' }}</div>
<div v-if="scope.row.departSectionCode">
<div v-if="scope.row.status==-1">删除</div>
<!-- {{ sectionMap }} -->
<!-- scope.row.status==1 -->
<div v-else-if="scope.row.departSectionCode&&!scope.row.oldDepartSectionCode">{{ sectionMap[scope.row.departSectionCode] }}</div>
<div v-else>{{ sectionMap[scope.row.departSectionCode]+'['+sectionMap[scope.row.oldDepartSectionCode]+']' }}</div>
</div>
</template>
</el-table-column>
<el-table-column
@ -86,8 +94,10 @@
width="170"
>
<template slot-scope="scope">
<div v-if="scope.row.status==-1">删除</div>
<div v-else>{{ scope.row.departPlanTime }}</div>
<div v-if="scope.row.departPlanTime">
<div v-if="scope.row.status==-1">删除</div>
<div v-else>{{ scope.row.departPlanTime }}</div>
</div>
</template>
</el-table-column>
</el-table>

View File

@ -0,0 +1,446 @@
<template>
<el-dialog
v-dialogDrag
class="chengdou-03__systerm train-set-plan"
:title="title"
:visible.sync="show"
width="670px"
:before-close="doClose"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
>
<el-form id="AddTrainRunplanForm" ref="form" :model="model" label-width="80px" :rules="rules">
<el-form-item label="车站:" prop="stationCode" style="width: 100%;">
<el-select v-model="model.stationCode" placeholder="" style="width:180px" disabled>
<el-option
v-for="item in stationList"
:key="item.code"
:label="item.name"
:value="item.code"
/>
</el-select>
</el-form-item>
<el-form-item label="到达车次:" prop="arriveTripNumber">
<el-input v-model="model.arriveTripNumber" style="width:160px" :disabled="model.startRunPlan" />
</el-form-item>
<el-form-item label="出发车次:" prop="departTripNumber" style="margin-left: 66px;">
<el-input v-model="model.departTripNumber" style="width:160px" :disabled="model.endRunPlan" />
</el-form-item>
<el-form-item label="列车类型:" prop="trainType">
<el-select v-model="model.trainType" placeholder="" style="width:180px" popper-class="trainRpSelect">
<el-option
v-for="item in trainTypeList"
:key="item.code"
:label="item.name"
:value="item.code"
/>
</el-select>
</el-form-item>
<el-form-item label="运行类型:" prop="runType" style="margin-left: 45px;">
<el-select v-model="model.runType" placeholder="" style="width:180px" popper-class="trainRpSelect">
<el-option
v-for="item in runTypeList"
:key="item.code"
:label="item.name"
:value="item.code"
/>
</el-select>
</el-form-item>
<el-form-item label="到达超限:" prop="arriveTransfinite">
<el-select v-model="model.arriveTransfinite" placeholder="" style="width:180px" :disabled="model.startRunPlan" popper-class="trainRpSelect">
<el-option
v-for="item in transfiniteList"
:key="item.code"
:label="item.name"
:value="item.code"
/>
</el-select>
</el-form-item>
<el-form-item label="出发超限:" prop="departTransfinite" style="margin-left: 45px;">
<el-select v-model="model.departTransfinite" placeholder="" style="width:180px" :disabled="model.endRunPlan" popper-class="trainRpSelect">
<el-option
v-for="item in transfiniteList"
:key="item.code"
:label="item.name"
:value="item.code"
/>
</el-select>
</el-form-item>
<el-form-item label="接车口:" prop="arriveDirectionCode">
<el-select v-model="model.arriveDirectionCode" placeholder="" style="width:180px" :disabled="model.startRunPlan" popper-class="trainRpSelect">
<el-option
v-for="item in mapStationDirectionList"
:key="item.code"
:label="item.name"
:value="item.code"
/>
</el-select>
</el-form-item>
<el-form-item label="发车口:" prop="departDirectionCode" style="margin-left:45px;">
<el-select v-model="model.departDirectionCode" placeholder="" style="width:180px" :disabled="model.endRunPlan" popper-class="trainRpSelect">
<el-option
v-for="item in mapStationDirectionList"
:key="item.code"
:label="item.name"
:value="item.code"
/>
</el-select>
</el-form-item>
<el-form-item label="接车股道:" prop="arriveSectionCode">
<el-select v-model="model.arriveSectionCode" placeholder="" style="width:160px" :disabled="model.startRunPlan" popper-class="trainRpSelect">
<el-option
v-for="item in filterSectionList"
:key="item.code"
:label="item.name"
:value="item.code"
/>
</el-select>
</el-form-item>
<el-form-item label="发车股道:" prop="departSectionCode" style="margin-left: 67px;">
<el-select v-model="model.departSectionCode" placeholder="" style="width:160px" :disabled="model.endRunPlan" popper-class="trainRpSelect">
<el-option
v-for="item in filterSectionList"
:key="item.code"
:label="item.name"
:value="item.code"
/>
</el-select>
</el-form-item>
<el-form-item label="到达时间:" prop="arrivePlanTime">
<el-date-picker v-model="model.arrivePlanTime" type="datetime" :disabled="model.startRunPlan" value-format="yyyy-MM-dd HH:mm" format="yyyy-MM-dd HH:mm" style="width:160px" />
</el-form-item>
<el-form-item label="" prop="startRunPlan" class="noMargin" style="margin-left:10px;">
<el-checkbox v-model="model.startRunPlan" @change="changeStartRp">始发</el-checkbox>
</el-form-item>
<el-form-item label="出发时间:" prop="departPlanTime" style="margin-left:10px;">
<el-date-picker v-model="model.departPlanTime" type="datetime" :disabled="model.endRunPlan" value-format="yyyy-MM-dd HH:mm" format="yyyy-MM-dd HH:mm" style="width:160px" />
</el-form-item>
<el-form-item label="" prop="endRunPlan" class="noMargin" style="margin-left:10px;">
<el-checkbox v-model="model.endRunPlan" @change="changeEndRp">终到</el-checkbox>
</el-form-item>
<div>
<el-form-item label="" prop="arriveElectrical" class="noMargin" style="margin-left:80px;margin-bottom: 0px;">
<el-checkbox v-model="model.arriveElectrical" :disabled="model.startRunPlan">到达电力</el-checkbox>
</el-form-item>
<el-form-item label="" prop="departElectrical" class="noMargin" style="margin-left:80px;">
<el-checkbox v-model="model.departElectrical" :disabled="model.endRunPlan">出发电力</el-checkbox>
</el-form-item>
</div>
<el-form-item label="" prop="passenger" class="noMargin" style="margin-left:30px;">
<el-checkbox v-model="model.passenger">办理客运</el-checkbox>
</el-form-item>
<el-form-item label="" prop="keyTrains" class="noMargin" style="margin-left:50px;">
<el-checkbox v-model="model.keyTrains">重点列车</el-checkbox>
</el-form-item>
<el-form-item label="" prop="military" class="noMargin" style="margin-left:50px;">
<el-checkbox v-model="model.military">军用</el-checkbox>
</el-form-item>
<br>
<el-form-item label="" prop="trackDiscordant" style="margin-left:80px;width: 220px;" class="noMargin">
<el-checkbox v-model="model.trackDiscordant">运行股道与基本径路不一致</el-checkbox>
</el-form-item>
<el-form-item label="" prop="entryOutDiscordant" style="margin-left:90px;width: 220px;" class="noMargin">
<el-checkbox v-model="model.entryOutDiscordant">出入口与基本径路不一致</el-checkbox>
</el-form-item>
</el-form>
<el-row justify="center" style="margin-top:10px">
<el-col :span="7" :offset="5">
<el-button :id="domIdConfirm" type="primary" :loading="loading" @click="commit">确定</el-button>
</el-col>
<el-col :span="7" :offset="2">
<el-button :id="domIdCancel" @click="cancel"> </el-button>
</el-col>
</el-row>
</el-dialog>
</template>
<script>
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import {menuOperate, commitOperate} from '@/jmapNew/theme/components/utils/menuOperate';
import { mapGetters } from 'vuex';
export default {
name: 'TrainRunplan',
data() {
var validateTripNumber = (rule, value, callback) => {
if (value) {
const judge = /^[a-zA-Z0-9]*[\d]$/.test(value);
if (judge) {
if (value.toString().length > 6 || value.toString().length < 2) {
callback('车次长度2-6位');
} else {
callback();
}
} else {
callback('字母+数字,最后一位数字');
}
} else {
// callback('');
callback();
}
};
return {
dialogShow: false,
loading: false,
title:'',
mapStationDirectionList:[],
filterSectionList:[],
trainTypeList:[
//
{name:'管内特快旅客列车', code:'LOCAL_EXPRESS_PASSENGER_TRAIN' },
{name:'管内快速旅客列车', code:'LOCAL_FAST_PASSENGER_TRAIN' },
{name:'管内普通旅客快车', code:'LOCAL_PASSENGER_TRAIN' },
{name:'管内普通旅客慢车', code:'LOCAL_SLOW_PASSENGER_TRAIN' },
{name:'管内临时旅客列车', code:'LOCAL_TEMPORARY_PASSENGER_TRAIN' },
{name:'管内临时旅游列车', code:'LOCAL_TEMPORARY_TOURIST_TRAIN' },
//
{name:'跨局快速旅客列车', code:'FAST_PASSENGER_TRAIN' },
{name:'跨局临时旅游列车', code:'TEMPORARY_TOURIST_TRAIN' },
{name:'跨两局普通旅客快车', code:'TWO_PASSENGER_TRAIN' },
{name:'跨两局普通旅客慢车', code:'TWO_SLOW_PASSENGER_TRAIN' },
{name:'跨两局临时旅客列车', code:'TWO_TEMPORARY_PASSENGER_TRAIN' },
{name:'跨三局及其以上普通旅客快车', code:'MORE_PASSENGER_TRAIN' },
//
{name:'回送出入厂客车底列车', code:'BACK_FACTORY_PASSENGER_TRAIN' },
{name:'因故折返旅客列车', code:'FAULT_TRUE_BACK_PASSENGER_TRAIN' }
],
runTypeList:[
{name:'快速旅客列车', code:'FAST_PASSENGER_TRAIN' }
],
transfiniteList:[
{name:'不超限', code:'NO' },
{name:'超级超限', code:'TRANSFINITE_SUPER' },
{name:'一级超限', code:'TRANSFINITE_ONE_LEVEL' },
{name:'二级超限', code:'TRANSFINITE_TWO_LEVEL' }
],
model:{
runPlanCode:'', //
stationCode:'', //
trainType:'', //
runType:'', //
arriveSectionCode:'', //
arrivePlanTime:'', //
arriveTripNumber:'', //
arriveDirectionCode:'', //
arriveTransfinite:null, //
arriveElectrical:false, //
departSectionCode:'', //
departPlanTime:'', //
departTripNumber:'', //
departDirectionCode:'', //
departTransfinite:null, //
departElectrical:false, //
startRunPlan:false, // true,false
endRunPlan:false, // true,false
passenger:false, // true,false
keyTrains:false, // true,false
military:false, // true,false
trackDiscordant:false, //
entryOutDiscordant:false //
},
rules: {
arriveTripNumber:[
{ required: true, validator: validateTripNumber, trigger: 'blur' }
],
departTripNumber:[
{ required: true, validator: validateTripNumber, trigger: 'blur' }
]
}
};
},
computed: {
...mapGetters('map', [
'stationList'
]),
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
},
domIdCancel() {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
},
domIdConfirm() {
return this.dialogShow ? OperationEvent.CTCCommand.addDispatcherLogerRp.menu.domId : '';
}
},
methods: {
doShow(row, filterSectionList) {
const stationCode = this.$store.state.training.roleDeviceCode;
this.mapStationDirectionList = Object.values(this.$store.state.map.mapStationDirectionData).filter(each=>{ return each.stationCode == stationCode; });
this.filterSectionList = filterSectionList;
this.dialogShow = true;
if (row.code) {
this.title = '修改列车信息';
this.model = {
runPlanCode:row.code, //
stationCode:row.stationCode, //
trainType:row.trainType, //
runType:row.runType, //
startRunPlan:row.startRunPlan, // true,false
endRunPlan:row.endRunPlan, // true,false
passenger:row.passenger == 'PASSENGER', // true,false
keyTrains:row.keyTrains, // true,false
military:row.military, // true,false
trackDiscordant:row.trackDiscordant, //
entryOutDiscordant:row.entryOutDiscordant//
};
//
if (row.arriveRunPlan) {
this.model.arriveSectionCode = row.arriveRunPlan.sectionCode;
// debugger;
this.model.arrivePlanTime = row.arriveRunPlan.planTime;
this.model.arriveTripNumber = row.arriveRunPlan.tripNumber;
this.model.arriveDirectionCode = row.arriveRunPlan.accessName; //
this.model.arriveTransfinite = row.arriveRunPlan.transfinite; //
this.model.arriveElectrical = row.arriveRunPlan.electrical; //
}
//
if (row.departRunPlan) {
this.model.departSectionCode = row.departRunPlan.planTime;
this.model.departPlanTime = row.departRunPlan.planTime;
this.model.departTripNumber = row.departRunPlan.tripNumber;
this.model.departDirectionCode = row.departRunPlan.accessName;
this.model.departTransfinite = row.departRunPlan.transfinite;
this.model.departElectrical = row.departRunPlan.electrical;
}
} else {
this.title = '新增列车信息';
this.model.stationCode = row.stationCode;
this.model.trainType = 'LOCAL_EXPRESS_PASSENGER_TRAIN'; //
this.model.runType = 'FAST_PASSENGER_TRAIN'; //
}
this.$nextTick(function () {
this.$store.dispatch('training/emitTipFresh');
});
},
changeEndRp(data) {
if (data) {
this.model.departSectionCode = '';
this.model.departPlanTime = '';
this.model.departTripNumber = '';
this.model.departDirectionCode = '';
this.model.departTransfinite = null;
this.model.departElectrical = false;
}
},
changeStartRp(data) {
if (data) {
this.model.arriveSectionCode = '';
this.model.arrivePlanTime = '';
this.model.arriveTripNumber = '';
this.model.arriveDirectionCode = '';
this.model.arriveTransfinite = null;
this.model.arriveElectrical = false;
}
},
doClose() {
this.loading = false;
this.dialogShow = false;
this.model = {
runPlanCode:'', //
stationCode:'', //
trainType:'', //
runType:'', //
arriveSectionCode:'', //
arrivePlanTime:'', //
arriveTripNumber:'', //
arriveDirectionCode:'', //
arriveTransfinite:null, //
arriveElectrical:false, //
departSectionCode:'', //
departPlanTime:'', //
departTripNumber:'', //
departDirectionCode:'', //
departTransfinite:null, //
departElectrical:false, //
startRunPlan:false, // true,false
endRunPlan:false, // true,false
passenger:false, // true,false
keyTrains:false, // true,false
military:false, // true,false
trackDiscordant:false, //
entryOutDiscordant:false //
};
this.$store.dispatch('training/emitTipFresh');
},
//
commit() {
this.$refs.form.validate((valid) => {
if (valid) {
this.loading = true;
if (!this.model.runPlanCode) { delete this.model.runPlanCode; }
const stationCode = this.$store.state.training.roleDeviceCode;
commitOperate(menuOperate.CTC.logSaveRunplan, {stationCode:stationCode, runPlanParam:this.model, force:1}, 3).then(({valid, response})=>{
if (valid) {
// this.$emit('addDisLoger', response.data);
this.$emit('clearRpRow');
this.doClose();
}
}).catch(() => {
this.$emit('clearRpRow');
this.doClose();
this.$emit('noticeInfo');
});
}
});
},
cancel() {
const operate = {
operation: OperationEvent.Command.cancel.menu.operation
};
this.$emit('clearRpRow');
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) {
this.doClose();
}
}).catch(() => { this.doClose(); });
}
}
};
</script>
<style lang="scss">
.chengdou-03__systerm .el-dialog #AddTrainRunplanForm .el-form-item label{
padding-right:5px;
line-height:30px;
}
.chengdou-03__systerm .el-dialog #AddTrainRunplanForm .el-form-item{
margin-bottom:20px;
}
#AddTrainRunplanForm .el-form-item__content{
line-height:30px;
}
#AddTrainRunplanForm{
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
#AddTrainRunplanForm .el-input__inner {
height: 22px !important;
line-height: 22px !important;
}
#AddTrainRunplanForm span.el-input__suffix .el-input__icon{
height:22px;
line-height:22px;
}
#AddTrainRunplanForm span.el-input__prefix .el-input__icon{
line-height:22px;
display:none;
}
#AddTrainRunplanForm .el-form-item.noMargin .el-form-item__content{
margin-left:0px !important;
}
#AddTrainRunplanForm .el-form-item.noMargin .el-checkbox__label{
padding-left: 5px;
vertical-align: top;
line-height: 30px;
}
#AddTrainRunplanForm .el-input--prefix .el-input__inner{
padding-left:10px;
padding-right: 26px;
}
.trainRpSelect {z-index:2014 !important;}
</style>

View File

@ -4,8 +4,8 @@
<menu-bar v-if="isShowBar" ref="menuBar" :date-strin="dateString1" :selected="selected" />
<div v-if="isCtc" style="position: absolute; top: 64px;z-index: 10;background: #F0F0F0;padding: 2px;height: 65px;width: 100%;">
<div style="display: flex;">
<img :src="ctcBarIcon1" class="img-box">
<img :src="ctcBarIcon2" class="img-box">
<img :src="ctcBarIcon1" class="img-box" @click="zhanjiantouming">
<img :src="ctcBarIcon2" class="img-box" @click="danzhanxianshi">
<img :src="ctcBarIcon3" class="img-box">
<img :src="ctcBarIcon4" class="img-box">
<img :src="ctcBarIcon5" class="img-box">
@ -140,6 +140,7 @@ export default {
data() {
return {
currentRailwaySimulationRunplan:{},
showCentralizedStationCode: '',
alarmMessages: [
{ id: 1, message: '这是告警信息一' },
{ id: 2, message: '这是告警信息二' },
@ -244,6 +245,7 @@ export default {
},
beforeDestroy() {
window.onclick = function (e) {};
this.$store.dispatch('map/setPictureDeviceMap', {});
},
methods: {
changeSignedStatus(info) {
@ -260,6 +262,41 @@ export default {
this.$refs.cmdManage.doShow();
}
},
zhanjiantouming() {
this.$store.dispatch('map/setPictureDeviceMap', {});
this.showCentralizedStationCode = this.$store.state.map.showCentralizedStationCode || this.showCentralizedStationCode;
const mapDevice = this.$store.state.map.mapDevice;
const list = [];
for (const key in mapDevice) {
list.push(mapDevice[key]);
}
if (this.$store.state.map.map && this.$store.state.map.map.pictureList) {
const picture = this.$store.state.map.map.pictureList.find(picture => picture.stationCode === this.showCentralizedStationCode && picture.type === 'lucency');
if (picture) {
this.$jlmap.updateShowStation(list, '');
this.$store.dispatch('map/setPictureDeviceMap', picture.deviceMap);
const deviceList = [];
const mapDevice = this.$store.state.map.mapDevice;
for (const deviceCode in mapDevice) {
deviceList.push(deviceCode);
}
this.$jlmap.updatePicture(deviceList);
this.$jlmap.updateTransform(picture.scaling, picture.origin);
}
}
},
danzhanxianshi() {
this.$store.dispatch('map/setPictureDeviceMap', {});
const mapDevice = this.$store.state.map.mapDevice;
const map = this.$store.state.map.map;
const list = [];
for (const key in mapDevice) {
list.push(mapDevice[key]);
}
this.$jlmap.updateShowStation(list, this.$store.state.map.showCentralizedStationCode || this.showCentralizedStationCode);
this.$jlmap.setCenter(this.$store.state.map.showCentralizedStationCode || this.showCentralizedStationCode);
this.$jlmap.updateTransform(map.scaling, map.origin);
},
getRailwaySimulationRunplanSend() {
const stationCode = this.$store.state.training.roleDeviceCode;
const railwaySimulationRunplanSendMap = this.$store.state.socket.railwaySimulationRunplanSendMap;

Some files were not shown because too many files have changed in this diff Show More