This commit is contained in:
zyy 2019-07-25 15:48:58 +08:00
commit 601d0e2d91
17 changed files with 1085 additions and 991 deletions

View File

@ -145,7 +145,7 @@ export default class DefaultSkin {
/** 车次窗颜色*/
this.trainWindowColor = '#fff';
/** 列车文字颜色*/
this.trainTextColor = '#ffffff';
/** 列车文字颜色*/
this.trainTextColor = '#ffffff';
}
}

View File

@ -1,31 +1,31 @@
import Group from "zrender/src/container/Group";
import Text from "zrender/src/graphic/Text";
import Group from 'zrender/src/container/Group';
import Text from 'zrender/src/graphic/Text';
/** 文字描述 */
class ArrowText extends Group{
constructor(model){
super();
this.model = model;
this._create();
}
_create(){
this.arrowText = new Text({
zlevel: this.model.zlevel,
z: this.model.z,
position: [0, 0],
style: {
x: this.model.x,
y: this.model.y,
text: this.model.text,
textFill: this.model.textFill,
textAlign: this.model.textAlign,
textFont: this.model.textFont,
textPadding: this.model.textPadding,
textBackgroundColor: this.model.tipBackgroundColor
}
});
// this.add(this.arrowText);
/*福州线特殊处理*/
/*const selectTrain = store.getters['map/trainDetails'];
class ArrowText extends Group {
constructor(model) {
super();
this.model = model;
this._create();
}
_create() {
this.arrowText = new Text({
zlevel: this.model.zlevel,
z: this.model.z,
position: [0, 0],
style: {
x: this.model.x,
y: this.model.y,
text: this.model.text,
textFill: this.model.textFill,
textAlign: this.model.textAlign,
textFont: this.model.textFont,
textPadding: this.model.textPadding,
textBackgroundColor: this.model.tipBackgroundColor
}
});
// this.add(this.arrowText);
/* 福州线特殊处理*/
/* const selectTrain = store.getters['map/trainDetails'];
if (selectTrain && selectTrain.model._code == model._code) {
this.add(this.arrowText);
this.arrowText.attr({
@ -35,6 +35,6 @@ class ArrowText extends Group{
}
});
}*/
}
}
}
export default ArrowText;

View File

@ -1,83 +1,83 @@
import Group from 'zrender/src/container/Group';
import Text from 'zrender/src/graphic/Text';
export default class TextHSDA extends Group{
constructor(model) {
super();
this.model = model;
this._create();
}
_create() {
const model = this.model;
this.textH = new Text({
zlevel: model.zlevel,
z: model.z,
style: {
x: parseInt(model.beginX + model.margin * 0),
y: parseInt(model.beginY),
text: 'H',
textFill: model.trainYellowColor,
textFont: model.TextFontHSDA,
textAlign: model.textAlign,
textVerticalAlign: model.textVerticalAlign
}
});
this.textS = new Text({
zlevel: model.zlevel,
z: model.z,
style: {
x: parseInt(model.beginX + model.margin * 1),
y: parseInt(model.beginY),
text: 'S',
textFill: model.trainBlueColor,
textFont: model.TextFontHSDA,
textAlign: model.textAlign,
textVerticalAlign: model.textVerticalAlign
}
});
export default class TextHSDA extends Group {
constructor(model) {
super();
this.model = model;
this._create();
}
_create() {
const model = this.model;
this.textH = new Text({
zlevel: model.zlevel,
z: model.z,
style: {
x: parseInt(model.beginX + model.margin * 0),
y: parseInt(model.beginY),
text: 'H',
textFill: model.trainYellowColor,
textFont: model.TextFontHSDA,
textAlign: model.textAlign,
textVerticalAlign: model.textVerticalAlign
}
});
this.textS = new Text({
zlevel: model.zlevel,
z: model.z,
style: {
x: parseInt(model.beginX + model.margin * 1),
y: parseInt(model.beginY),
text: 'S',
textFill: model.trainBlueColor,
textFont: model.TextFontHSDA,
textAlign: model.textAlign,
textVerticalAlign: model.textVerticalAlign
}
});
this.textD = new Text({
zlevel: model.zlevel,
z: model.z,
style: {
x: parseInt(model.beginX + model.margin * 2),
y: parseInt(model.beginY),
text: 'D',
textFill: model.trainGreenColor,
textFont: model.TextFontHSDA,
textAlign: model.textAlign,
textVerticalAlign: model.textVerticalAlign
}
});
this.textD = new Text({
zlevel: model.zlevel,
z: model.z,
style: {
x: parseInt(model.beginX + model.margin * 2),
y: parseInt(model.beginY),
text: 'D',
textFill: model.trainGreenColor,
textFont: model.TextFontHSDA,
textAlign: model.textAlign,
textVerticalAlign: model.textVerticalAlign
}
});
this.textA = new Text({
zlevel: model.zlevel,
z: model.z,
style: {
x: parseInt(model.beginX + model.margin * 3),
y: parseInt(model.beginY),
text: 'A',
textFill: model.trainRedColor,
textFont: model.TextFontHSDA,
textAlign: model.textAlign,
textVerticalAlign: model.textVerticalAlign
}
});
this.add(this.textH);
this.add(this.textS);
this.add(this.textD);
this.add(this.textA);
}
setHShow(isShow) {
isShow ? this.textH.show() : this.textH.hide();
}
setSShow(isShow) {
isShow ? this.textS.show() : this.textS.hide();
}
setDShow(isShow) {
isShow ? this.textD.show() : this.textD.hide();
}
setAShow(isShow) {
isShow ? this.textA.show() : this.textA.hide();
}
this.textA = new Text({
zlevel: model.zlevel,
z: model.z,
style: {
x: parseInt(model.beginX + model.margin * 3),
y: parseInt(model.beginY),
text: 'A',
textFill: model.trainRedColor,
textFont: model.TextFontHSDA,
textAlign: model.textAlign,
textVerticalAlign: model.textVerticalAlign
}
});
this.add(this.textH);
this.add(this.textS);
this.add(this.textD);
this.add(this.textA);
}
setHShow(isShow) {
isShow ? this.textH.show() : this.textH.hide();
}
setSShow(isShow) {
isShow ? this.textS.show() : this.textS.hide();
}
setDShow(isShow) {
isShow ? this.textD.show() : this.textD.hide();
}
setAShow(isShow) {
isShow ? this.textA.show() : this.textA.hide();
}
}

View File

@ -1,46 +1,46 @@
import Group from "zrender/src/container/Group";
import Text from "zrender/src/graphic/Text";
import Group from 'zrender/src/container/Group';
import Text from 'zrender/src/graphic/Text';
/** 目的码 */
export default class TextTrainNumber extends Group{
constructor(model) {
super();
this.model = model;
this._create();
}
_create() {
const model = this.model;
this.textTrainNumber = new Text({
zlevel: model.zlevel,
z: model.z,
style: {
x: parseInt(model.point.x + model.lrPadding),
y: parseInt(model.point.y + model.upPadding),
text: model.targetCode.substring(model.targetCode.length - 3),
textFill: model.trainTextColor,
textStroke: model.trainTextColor,
fontWeight: 400,
textStrokeWidth: 0,
textFont: model.textFont,
textAlign: 'left',
textVerticalAlign: 'top',
},
cursor: 'pointer',
onmouseover: this.onMouseOver(),
onmouseout: this.onMouseOut(),
});
this.add(this.textTrainNumber);
};
setShapeStyle(key, style) {
this.textTrainNumber.setStyle(key, style);
};
onMouseOver() {
if (this.model.trainBodyOnMouseOver.textTrainNumber) {
this.add(this.model.arrowText);
}
}
onMouseOut() {
if (this.model.trainBodyOnMouseOut.textTrainNumber){
this.remove(this.model.arrowText);
}
}
export default class TextTrainNumber extends Group {
constructor(model) {
super();
this.model = model;
this._create();
}
_create() {
const model = this.model;
this.textTrainNumber = new Text({
zlevel: model.zlevel,
z: model.z,
style: {
x: parseInt(model.point.x + model.lrPadding),
y: parseInt(model.point.y + model.upPadding),
text: model.targetCode.substring(model.targetCode.length - 3),
textFill: model.trainTextColor,
textStroke: model.trainTextColor,
fontWeight: 400,
textStrokeWidth: 0,
textFont: model.textFont,
textAlign: 'left',
textVerticalAlign: 'top'
},
cursor: 'pointer',
onmouseover: this.onMouseOver(),
onmouseout: this.onMouseOut()
});
this.add(this.textTrainNumber);
}
setShapeStyle(key, style) {
this.textTrainNumber.setStyle(key, style);
}
onMouseOver() {
if (this.model.trainBodyOnMouseOver.textTrainNumber) {
this.add(this.model.arrowText);
}
}
onMouseOut() {
if (this.model.trainBodyOnMouseOut.textTrainNumber) {
this.remove(this.model.arrowText);
}
}
}

View File

@ -1,45 +1,45 @@
import Group from "zrender/src/container/Group";
import Text from "zrender/src/graphic/Text";
import Group from 'zrender/src/container/Group';
import Text from 'zrender/src/graphic/Text';
/** 服务号、表号 */
export default class TextTrainServer extends Group{
constructor(model){
super();
this.model = model;
this._create();
}
_create() {
this.textTrainServer = new Text({
zlevel: this.model.zlevel,
z: this.model.z+1,
style: {
x: parseInt(this.model.point.x + this.model.lrPadding),
y: parseInt(this.model.point.y + this.model.upPadding),
text: this.model.serviceNumber.substring(this.model.serviceNumber.length - 2),
textFill: this.model.trainBrownColor,
textFont: this.model.textFont,
textAlign: 'left',
textVerticalAlign: 'top'
},
cursor: 'pointer',
onmouseover: this.onMouseOver(),
onmouseout: this.onMouseOut(),
});
this.add(this.textTrainServer);
};
setColor(key,color) {
this.textTrainServer.setStyle(key,color);
};
setShapeStyle(key, style) {
this.textTrainServer.setStyle(key, style);
};
onMouseOver() {
if (this.model.trainBodyOnMouseOver.textTrainServer) {
this.add(this.model.arrowText);
}
}
onMouseOut() {
if (this.model.trainBodyOnMouseOut.textTrainServer){
this.remove(this.model.arrowText);
}
}
export default class TextTrainServer extends Group {
constructor(model) {
super();
this.model = model;
this._create();
}
_create() {
this.textTrainServer = new Text({
zlevel: this.model.zlevel,
z: this.model.z+1,
style: {
x: parseInt(this.model.point.x + this.model.lrPadding),
y: parseInt(this.model.point.y + this.model.upPadding),
text: this.model.serviceNumber.substring(this.model.serviceNumber.length - 2),
textFill: this.model.trainBrownColor,
textFont: this.model.textFont,
textAlign: 'left',
textVerticalAlign: 'top'
},
cursor: 'pointer',
onmouseover: this.onMouseOver(),
onmouseout: this.onMouseOut()
});
this.add(this.textTrainServer);
}
setColor(key, color) {
this.textTrainServer.setStyle(key, color);
}
setShapeStyle(key, style) {
this.textTrainServer.setStyle(key, style);
}
onMouseOver() {
if (this.model.trainBodyOnMouseOver.textTrainServer) {
this.add(this.model.arrowText);
}
}
onMouseOut() {
if (this.model.trainBodyOnMouseOut.textTrainServer) {
this.remove(this.model.arrowText);
}
}
}

View File

@ -1,45 +1,45 @@
import Group from "zrender/src/container/Group";
import Text from "zrender/src/graphic/Text";
import Group from 'zrender/src/container/Group';
import Text from 'zrender/src/graphic/Text';
export default class TextTrainTarget extends Group{
constructor(model){
super();
this.model = model;
this._create();
}
_create() {
this.textTrainTarget = new Text({
zlevel: this.model.zlevel,
z: this.model.z+1,
style: {
x: parseInt(this.model.point.x + this.model.trainWidth - this.model.lrPadding),
y: parseInt(this.model.point.y + this.model.upPadding),
text: this.model.tripNumber.substring(this.model.tripNumber.length - 3),
textFill: this.model.trainYellowColor,
textFont: this.model.textFont,
textAlign: 'right',
textVerticalAlign: 'top'
},
cursor: 'pointer',
onmouseover: this.onMouseOver(),
onmouseout: this.onMouseOut(),
});
this.add(this.textTrainTarget);
};
setColor(key, color) {
this.textTrainTarget.setStyle(key, color);
};
setShapeStyle(key, style) {
this.textTrainTarget.setStyle(key, style);
};
onMouseOver() {
if (this.model.trainBodyOnMouseOver.textTrainTarget) {
this.add(this.model.arrowText);
}
}
onMouseOut() {
if (this.model.trainBodyOnMouseOut.textTrainTarget){
this.remove(this.model.arrowText);
}
}
export default class TextTrainTarget extends Group {
constructor(model) {
super();
this.model = model;
this._create();
}
_create() {
this.textTrainTarget = new Text({
zlevel: this.model.zlevel,
z: this.model.z+1,
style: {
x: parseInt(this.model.point.x + this.model.trainWidth - this.model.lrPadding),
y: parseInt(this.model.point.y + this.model.upPadding),
text: this.model.tripNumber.substring(this.model.tripNumber.length - 3),
textFill: this.model.trainYellowColor,
textFont: this.model.textFont,
textAlign: 'right',
textVerticalAlign: 'top'
},
cursor: 'pointer',
onmouseover: this.onMouseOver(),
onmouseout: this.onMouseOut()
});
this.add(this.textTrainTarget);
}
setColor(key, color) {
this.textTrainTarget.setStyle(key, color);
}
setShapeStyle(key, style) {
this.textTrainTarget.setStyle(key, style);
}
onMouseOver() {
if (this.model.trainBodyOnMouseOver.textTrainTarget) {
this.add(this.model.arrowText);
}
}
onMouseOut() {
if (this.model.trainBodyOnMouseOut.textTrainTarget) {
this.remove(this.model.arrowText);
}
}
}

View File

@ -1,45 +1,45 @@
import Group from "zrender/src/container/Group";
import Text from "zrender/src/graphic/Text";
import Group from 'zrender/src/container/Group';
import Text from 'zrender/src/graphic/Text';
/** 车组号 */
export default class TextTrainTargetNumber extends Group{
constructor(model){
super();
this.model = model;
this._create();
}
_create() {
const model = this.model;
this.textTrainTargetNumber = new Text({
zlevel: model.zlevel,
z: model.z,
style: {
x: parseInt(model.point.x - model.lrPadding),
y: parseInt(model.point.y + model.upPadding),
text: model.groupNumber.substring(model.groupNumber.length - 3),
textFill: model.trainTextColor,
textStroke: model.trainTextColor,
textStrokeWidth: 0,
textFont: model.textFont,
textAlign: 'left',
textVerticalAlign: 'top',
},
cursor: 'pointer',
onmouseover: this.onMouseOver(),
onmouseout: this.onMouseOut(),
});
this.add(this.textTrainTargetNumber);
}
setShapeStyle(key, style) {
this.textTrainTargetNumber.setStyle(key, style);
};
onMouseOver() {
if (this.model.trainBodyOnMouseOver.textTrainTargetNumber) {
this.add(this.model.arrowText);
}
}
onMouseOut() {
if (this.model.trainBodyOnMouseOut.textTrainTargetNumber){
this.remove(this.model.arrowText);
}
}
export default class TextTrainTargetNumber extends Group {
constructor(model) {
super();
this.model = model;
this._create();
}
_create() {
const model = this.model;
this.textTrainTargetNumber = new Text({
zlevel: model.zlevel,
z: model.z,
style: {
x: parseInt(model.point.x - model.lrPadding),
y: parseInt(model.point.y + model.upPadding),
text: model.groupNumber.substring(model.groupNumber.length - 3),
textFill: model.trainTextColor,
textStroke: model.trainTextColor,
textStrokeWidth: 0,
textFont: model.textFont,
textAlign: 'left',
textVerticalAlign: 'top'
},
cursor: 'pointer',
onmouseover: this.onMouseOver(),
onmouseout: this.onMouseOut()
});
this.add(this.textTrainTargetNumber);
}
setShapeStyle(key, style) {
this.textTrainTargetNumber.setStyle(key, style);
}
onMouseOver() {
if (this.model.trainBodyOnMouseOver.textTrainTargetNumber) {
this.add(this.model.arrowText);
}
}
onMouseOut() {
if (this.model.trainBodyOnMouseOut.textTrainTargetNumber) {
this.remove(this.model.arrowText);
}
}
}

View File

@ -1,31 +1,30 @@
import Group from "zrender/src/container/Group";
import Rect from "zrender/src/graphic/shape/Rect";
import Group from 'zrender/src/container/Group';
import Rect from 'zrender/src/graphic/shape/Rect';
import store from '@/store';
export default class Train extends Group{
constructor(model){
super();
this.model = model;
this._create();
}
_create() {
const model = this.model;
this.train = new Rect({
zlevel: model.zlevel,
z: model.z,
shape: model.shape,
style: model.style,
cursor: model.cursor,
onmouseover: this.onMouseOver(),
onmouseout: this.onMouseOut(),
});
this.add(this.train);
}
onMouseOver() {
if (this.model.trainBodyOnMouseOver.train) {
this.add(this.model.arrowText);
/*store.dispatch('map/setTrainDetails', model);
export default class Train extends Group {
constructor(model) {
super();
this.model = model;
this._create();
}
_create() {
const model = this.model;
this.train = new Rect({
zlevel: model.zlevel,
z: model.z,
shape: model.shape,
style: model.style,
cursor: model.cursor,
onmouseover: this.onMouseOver(),
onmouseout: this.onMouseOut()
});
this.add(this.train);
}
onMouseOver() {
if (this.model.trainBodyOnMouseOver.train) {
this.add(this.model.arrowText);
/* store.dispatch('map/setTrainDetails', model);
this.details = store.state.map.trainDetails;
this.add(this.model.arrowText);
this.model.arrowText.attr({
@ -34,15 +33,15 @@ export default class Train extends Group{
y: this.details.point.y + 25,
}
});*/
}
}
onMouseOut() {
if (this.model.trainBodyOnMouseOut.train){
this.remove(this.model.arrowText);
// store.dispatch('map/setTrainDetails', null);
}
}
setColor(key, color) {
this.train.setStyle(key, color);
}
}
}
onMouseOut() {
if (this.model.trainBodyOnMouseOut.train) {
this.remove(this.model.arrowText);
// store.dispatch('map/setTrainDetails', null);
}
}
setColor(key, color) {
this.train.setStyle(key, color);
}
}

View File

@ -1,68 +1,68 @@
import Group from "zrender/src/container/Group";
import ArrowText from "./ArrowText";
import Train from "./Train";
import "../../StationStand/EDetain";
import TextHSDA from "./TextHSDA";
import TextTrainServer from "./TextTrainServer";
import TextTrainTarget from "./TextTrainTarget";
import TextTrainNumber from "./TextTrainNumber";
import TextTrainTargetNumber from "./TextTrainTargetNumber";
import Group from 'zrender/src/container/Group';
import ArrowText from './ArrowText';
import Train from './Train';
import '../../StationStand/EDetain';
import TextHSDA from './TextHSDA';
import TextTrainServer from './TextTrainServer';
import TextTrainTarget from './TextTrainTarget';
import TextTrainNumber from './TextTrainNumber';
import TextTrainTargetNumber from './TextTrainTargetNumber';
/** 车身*/
export default class TrainBody extends Group {
constructor(model) {
super();
this.model = model;
this._create();
}
constructor(model) {
super();
this.model = model;
this._create();
}
_create() {
const model = this.model;
const style = this.model.style;
const textFont = style.Train.trainTextFontSize + 'px ' + style.Train.textFontFormat;
const TextFontHSDA = style.Train.trainHSDATextFontSize + 'px ' + style.Train.textFontFormat;
_create() {
const model = this.model;
const style = this.model.style;
const textFont = style.Train.trainTextFontSize + 'px ' + style.Train.textFontFormat;
const TextFontHSDA = style.Train.trainHSDATextFontSize + 'px ' + style.Train.textFontFormat;
let destinationText = '';
switch (model.destinationStatus) {
case '01': destinationText = '准点'; break;
case '02': destinationText = '早点'; break;
case '03': destinationText = '严重早点'; break;
case '04': destinationText = '晚点'; break;
case '05': destinationText = '严重晚点'; break;
default: destinationText = '未知'; break;
}
const textContain = `列车类型: 计划车\n\0\0\0\0号: ${model.serviceNumber}\n\0\0号: ${model.tripNumber}\n目的地号: ${model.targetCode ? model.targetCode : ''}\n\0\0号: ${model.groupNumber}\n\0\0点: ${destinationText}\n运行方向: ${model.directionType == '02' ? '上行' : '下行'}\n乘务组号: \n起点站名: \n终点站名: \n占用轨道: ${model.sectionModel ? model.sectionModel.trackName : ''}\n所在车站: \n车地通信: 正常\n运行等级: 4\n扣车状态: ${model.runControlStatus == '01' ? '正常' : model.runControlStatus == '03' ? '跳停' : '扣车'}\n停稳状态: ${model.runStatus == '02' ? '未停稳' : '停稳'}\n阻塞状态: 无\n列车速度: ${model.speed || 0} km/h\n列车移动授权距离: ${model.maLen || 0} m`;
this.arrowText = style.Train.haveArrowText ? new ArrowText({
zlevel: model.zlevel,
z: model.z,
x: model.point.x+50,
y: model.point.y+25,
text: textContain,
textFill: '#000',
textAlign: 'left',
textFont: 10 + 'px consolas',
textPadding: 3,
textBackgroundColor: style.tipBackgroundColor
}) : '';
this.train = new Train({
zlevel: model.zlevel,
z: model.z,
shape: {
x: model.point.x,
y: model.point.y,
width: style.Train.trainWidth,
height: style.Train.trainHeight
},
style: {
lineWidth: style.Train.trainBodyLineWidth,
stroke: style.trainSidelineColor,
fill: style.Train.trainBodyFillColor
},
cursor: 'pointer',
trainBodyOnMouseOver: style.Train.trainBodyOnMouseOver,
trainBodyOnMouseOut: style.Train.trainBodyOnMouseOut,
arrowText: this.arrowText,
});
/*let selectTrain = store.getters['map/trainDetails'];
let destinationText = '';
switch (model.destinationStatus) {
case '01': destinationText = '准点'; break;
case '02': destinationText = '早点'; break;
case '03': destinationText = '严重早点'; break;
case '04': destinationText = '晚点'; break;
case '05': destinationText = '严重晚点'; break;
default: destinationText = '未知'; break;
}
const textContain = `列车类型: 计划车\n\0\0\0\0号: ${model.serviceNumber}\n\0\0号: ${model.tripNumber}\n目的地号: ${model.targetCode ? model.targetCode : ''}\n\0\0号: ${model.groupNumber}\n\0\0点: ${destinationText}\n运行方向: ${model.directionType == '02' ? '上行' : '下行'}\n乘务组号: \n起点站名: \n终点站名: \n占用轨道: ${model.sectionModel ? model.sectionModel.trackName : ''}\n所在车站: \n车地通信: 正常\n运行等级: 4\n扣车状态: ${model.runControlStatus == '01' ? '正常' : model.runControlStatus == '03' ? '跳停' : '扣车'}\n停稳状态: ${model.runStatus == '02' ? '未停稳' : '停稳'}\n阻塞状态: 无\n列车速度: ${model.speed || 0} km/h\n列车移动授权距离: ${model.maLen || 0} m`;
this.arrowText = style.Train.haveArrowText ? new ArrowText({
zlevel: model.zlevel,
z: model.z,
x: model.point.x+50,
y: model.point.y+25,
text: textContain,
textFill: '#000',
textAlign: 'left',
textFont: 10 + 'px consolas',
textPadding: 3,
textBackgroundColor: style.tipBackgroundColor
}) : '';
this.train = new Train({
zlevel: model.zlevel,
z: model.z,
shape: {
x: model.point.x,
y: model.point.y,
width: style.Train.trainWidth,
height: style.Train.trainHeight
},
style: {
lineWidth: style.Train.trainBodyLineWidth,
stroke: style.trainSidelineColor,
fill: style.Train.trainBodyFillColor
},
cursor: 'pointer',
trainBodyOnMouseOver: style.Train.trainBodyOnMouseOver,
trainBodyOnMouseOut: style.Train.trainBodyOnMouseOut,
arrowText: this.arrowText
});
/* let selectTrain = store.getters['map/trainDetails'];
if (selectTrain && selectTrain.model._code == model.model._code) {
this.add(this.arrowText);
this.arrowText.attr({
@ -72,104 +72,104 @@ export default class TrainBody extends Group {
}
});
}*/
const beginX = (model.point.x + style.Train.lrPadding);
const beginY = (model.point.y - style.Train.trainHSDATextFontSize - style.Train.upPaddingHSDA);
const margin = (style.Train.trainWidth - style.Train.lrPaddingHSDA * 2) / 4;
this.textHSDA = style.Train.haveTextHSDA ? new TextHSDA({
zlevel: model.zlevel,
z: model.z,
beginX: beginX,
beginY: beginY,
margin: margin,
trainYellowColor: style.trainYellowColor,
trainBlueColor: style.trainBlueColor,
textFontHSDA: TextFontHSDA,
textAlign: 'middle',
textVerticalAlign: 'top'
}) : '';
const beginX = (model.point.x + style.Train.lrPadding);
const beginY = (model.point.y - style.Train.trainHSDATextFontSize - style.Train.upPaddingHSDA);
const margin = (style.Train.trainWidth - style.Train.lrPaddingHSDA * 2) / 4;
this.textHSDA = style.Train.haveTextHSDA ? new TextHSDA({
zlevel: model.zlevel,
z: model.z,
beginX: beginX,
beginY: beginY,
margin: margin,
trainYellowColor: style.trainYellowColor,
trainBlueColor: style.trainBlueColor,
textFontHSDA: TextFontHSDA,
textAlign: 'middle',
textVerticalAlign: 'top'
}) : '';
let serviceNumber = style.Train.serviceNumberPrefix + (model.serviceNumber || style.Train.defaultServiceNumber) + '';// 服务号(表号)
let tripNumber = style.Train.tripNumberPrefix + (style.Train.defaultDirectionCode?
(model.directionCode||style.Train.defaultDirectionCode) + (model.tripNumber || style.Train.defaultTripNumber)
:model.tripNumber || style.Train.defaultTripNumber) + ''; // 车次号
let targetCode = style.Train.targetCodePrefix + (model.targetCode || style.Train.defaultTargetCode) + ''; // 目的地码
let groupNumber = style.Train.groupNumberPrefix + (model.groupNumber || style.Train.defaultGroupNumber) + ''; // 车组号
let serviceNumber = style.Train.serviceNumberPrefix + (model.serviceNumber || style.Train.defaultServiceNumber) + '';// 服务号(表号)
const tripNumber = style.Train.tripNumberPrefix + (style.Train.defaultDirectionCode
?(model.directionCode||style.Train.defaultDirectionCode) + (model.tripNumber || style.Train.defaultTripNumber)
:model.tripNumber || style.Train.defaultTripNumber) + ''; // 车次号
const targetCode = style.Train.targetCodePrefix + (model.targetCode || style.Train.defaultTargetCode) + ''; // 目的地码
const groupNumber = style.Train.groupNumberPrefix + (model.groupNumber || style.Train.defaultGroupNumber) + ''; // 车组号
this.textTrainServer = new TextTrainServer({
zlevel: model.zlevel,
z: model.z,
point: model.point,
lrPadding: style.Train.lrPadding,
upPadding: style.Train.upPadding,
serviceNumber: serviceNumber,
trainBrownColor: style.trainTextColor,
textFont: textFont,
trainBodyOnMouseOver: style.Train.trainBodyOnMouseOver,
trainBodyOnMouseOut: style.Train.trainBodyOnMouseOut,
});
this.textTrainServer = new TextTrainServer({
zlevel: model.zlevel,
z: model.z,
point: model.point,
lrPadding: style.Train.lrPadding,
upPadding: style.Train.upPadding,
serviceNumber: serviceNumber,
trainBrownColor: style.trainTextColor,
textFont: textFont,
trainBodyOnMouseOver: style.Train.trainBodyOnMouseOver,
trainBodyOnMouseOut: style.Train.trainBodyOnMouseOut
});
this.textTrainTarget = new TextTrainTarget({
zlevel: model.zlevel,
z: model.z,
point: model.point,
trainWidth: model.style.Train.trainWidth,
lrPadding: style.Train.lrPadding,
upPadding: style.Train.upPadding,
tripNumber: tripNumber,
trainYellowColor: style.trainTextColor,
textFont: textFont,
trainBodyOnMouseOver: style.Train.trainBodyOnMouseOver,
trainBodyOnMouseOut: style.Train.trainBodyOnMouseOut,
});
this.textTrainTarget = new TextTrainTarget({
zlevel: model.zlevel,
z: model.z,
point: model.point,
trainWidth: model.style.Train.trainWidth,
lrPadding: style.Train.lrPadding,
upPadding: style.Train.upPadding,
tripNumber: tripNumber,
trainYellowColor: style.trainTextColor,
textFont: textFont,
trainBodyOnMouseOver: style.Train.trainBodyOnMouseOver,
trainBodyOnMouseOut: style.Train.trainBodyOnMouseOut
});
this.textTrainNumber = new TextTrainNumber({
zlevel: model.zlevel,
z: model.z,
point: model.point,
lrPadding: style.Train.lrPadding,
upPadding: style.Train.upPadding,
targetCode: targetCode,
trainTextColor: style.trainTextColor,
textFont: textFont,
trainBodyOnMouseOver: style.Train.trainBodyOnMouseOver,
trainBodyOnMouseOut: style.Train.trainBodyOnMouseOut,
});
this.textTrainNumber = new TextTrainNumber({
zlevel: model.zlevel,
z: model.z,
point: model.point,
lrPadding: style.Train.lrPadding,
upPadding: style.Train.upPadding,
targetCode: targetCode,
trainTextColor: style.trainTextColor,
textFont: textFont,
trainBodyOnMouseOver: style.Train.trainBodyOnMouseOver,
trainBodyOnMouseOut: style.Train.trainBodyOnMouseOut
});
this.textTrainTargetNumber = new TextTrainTargetNumber({
zlevel: model.zlevel,
z: model.z,
point: model.point,
lrPadding: style.Train.lrPadding,
upPadding: style.Train.upPadding,
groupNumber: groupNumber,
trainTextColor: style.trainTextColor,
textFont: textFont,
trainBodyOnMouseOver: style.Train.trainBodyOnMouseOver,
trainBodyOnMouseOut: style.Train.trainBodyOnMouseOut,
});
// 根据列车类型设置显示格式
if( style.Train.specialTrainType.length > 0){
style.Train.specialTrainType.forEach((item) =>{
if (model.type === item.type) {
serviceNumber = item.serviceNumber;
model.nameFormat = item.nameFormat;
}
})
}
if ( style.Train.dynamicLoadingDisplay ){
this.formatChangePosition(model,style)
}else {
this.add(this.textTrainServer);
this.add(this.textTrainTarget);
this.add(this.textHSDA);
}
this.add(this.train);
this.textTrainTargetNumber = new TextTrainTargetNumber({
zlevel: model.zlevel,
z: model.z,
point: model.point,
lrPadding: style.Train.lrPadding,
upPadding: style.Train.upPadding,
groupNumber: groupNumber,
trainTextColor: style.trainTextColor,
textFont: textFont,
trainBodyOnMouseOver: style.Train.trainBodyOnMouseOver,
trainBodyOnMouseOut: style.Train.trainBodyOnMouseOut
});
// 根据列车类型设置显示格式
if ( style.Train.specialTrainType.length > 0) {
style.Train.specialTrainType.forEach((item) =>{
if (model.type === item.type) {
serviceNumber = item.serviceNumber;
model.nameFormat = item.nameFormat;
}
});
}
if ( style.Train.dynamicLoadingDisplay ) {
this.formatChangePosition(model, style);
} else {
this.add(this.textTrainServer);
this.add(this.textTrainTarget);
this.add(this.textHSDA);
}
this.add(this.train);
}
setMouseOver() {
// store.dispatch('map/setTrainDetails', this.model);
// this.details = store.state.map.trainDetails;
/*
}
setMouseOver() {
// store.dispatch('map/setTrainDetails', this.model);
// this.details = store.state.map.trainDetails;
/*
this.add(this.arrowText);
this.arrowText.attr({
style: {
@ -178,84 +178,84 @@ export default class TrainBody extends Group {
}
});
*/
}
setMouseOut() {
this.remove(this.arrowText);
// store.dispatch('map/setTrainDetails', null);
}
removeTrainDetail() {
this.remove(this.arrowText);
// store.dispatch('map/setTrainDetails', null);
}
setTrainColor(color) {
this.train && this.train.setColor('fill', color);
}
setTextTrainServerColor(color) {
this.textTrainServer.setColor('textFill', color);
this.textTrainServer.setColor('textStroke', color);
}
setTextTrainTargetColor(color) {
this.textTrainTarget.setColor('textFill', color);
this.textTrainTarget.setColor('textStroke', color);
}
setHShow(isShow) {
this.textHSDA && this.textHSDA.setHShow(isShow);
}
setSShow(isShow) {
this.textHSDA && this.textHSDA.setSShow(isShow);
}
setDShow(isShow) {
this.textHSDA && this.textHSDA.setDShow(isShow);
}
setAShow(isShow) {
this.textHSDA && this.textHSDA.setAShow(isShow);
}
formatChangePosition(model, style){
if (model.nameFormat) {
let arr = model.nameFormat.split(':');
arr.forEach(ele => {
if (ele == 'targetCode') {
this.add(this.textTrainNumber);
} else if (ele == 'serviceNumber') {
let show = arr.includes('targetCode');
if (show) {
this.textTrainServer.setShapeStyle('x', parseInt(model.point.x + (3 * model.fontSize * (2 / 3)) - 3 - style.Train.lrPadding));
}
this.add(this.textTrainServer);
} else if (ele == 'tripNumber') {
let show = arr.includes('targetCode');
let serverNoShow = arr.includes('serviceNumber');
if (show) {
this.textTrainTarget.setStsetShapeStyleyle('x', parseInt(model.point.x + (3 * model.fontSize * (2 / 3)) - 3 - style.Train.lrPadding));
}
if (serverNoShow) {
this.textTrainTarget.setShapeStyle('x', parseInt(model.point.x + (2 * model.fontSize * (2 / 3)) - 3 - style.Train.lrPadding));
}
if (serverNoShow && show) {
this.textTrainTarget.setShapeStyle('x', parseInt(model.point.x + (5 * model.fontSize * (2 / 3)) - 6.5 - style.Train.lrPadding));
}
this.add(this.textTrainTarget);
} else if (ele == 'groupNumber') {
let show = arr.includes('targetCode');
let serverNoShow = arr.includes('serviceNumber');
if (show) {
this.textTrainTargetNumber.setShapeStyle('x', parseInt(model.point.x + (3 * model.fontSize * (2 / 3)) - 3 - style.Train.lrPadding));
}
if (serverNoShow) {
this.textTrainTargetNumber.setShapeStyle('x', parseInt(model.point.x + (2 * model.fontSize * (2 / 3)) - 3 - style.Train.lrPadding));
}
if (serverNoShow && show) {
this.textTrainTargetNumber.setShapeStyle('x', parseInt(model.point.x + (5 * model.fontSize * (2 / 3)) - 6.5 - style.Train.lrPadding));
}
this.add(this.textTrainTargetNumber);
}
});
} else {
this.textTrainServer.setStyle('x', parseInt(model.point.x + 27 - style.Train.lrPadding));
this.textTrainTarget.setStyle('x', parseInt(model.point.x + 43 - style.Train.lrPadding));
this.add(this.textTrainServer);
this.add(this.textTrainTarget);
this.add(this.textTrainNumber);
}
}
}
setMouseOut() {
this.remove(this.arrowText);
// store.dispatch('map/setTrainDetails', null);
}
removeTrainDetail() {
this.remove(this.arrowText);
// store.dispatch('map/setTrainDetails', null);
}
setTrainColor(color) {
this.train && this.train.setColor('fill', color);
}
setTextTrainServerColor(color) {
this.textTrainServer.setColor('textFill', color);
this.textTrainServer.setColor('textStroke', color);
}
setTextTrainTargetColor(color) {
this.textTrainTarget.setColor('textFill', color);
this.textTrainTarget.setColor('textStroke', color);
}
setHShow(isShow) {
this.textHSDA && this.textHSDA.setHShow(isShow);
}
setSShow(isShow) {
this.textHSDA && this.textHSDA.setSShow(isShow);
}
setDShow(isShow) {
this.textHSDA && this.textHSDA.setDShow(isShow);
}
setAShow(isShow) {
this.textHSDA && this.textHSDA.setAShow(isShow);
}
formatChangePosition(model, style) {
if (model.nameFormat) {
const arr = model.nameFormat.split(':');
arr.forEach(ele => {
if (ele == 'targetCode') {
this.add(this.textTrainNumber);
} else if (ele == 'serviceNumber') {
const show = arr.includes('targetCode');
if (show) {
this.textTrainServer.setShapeStyle('x', parseInt(model.point.x + (3 * model.fontSize * (2 / 3)) - 3 - style.Train.lrPadding));
}
this.add(this.textTrainServer);
} else if (ele == 'tripNumber') {
const show = arr.includes('targetCode');
const serverNoShow = arr.includes('serviceNumber');
if (show) {
this.textTrainTarget.setShapeStyle('x', parseInt(model.point.x + (3 * model.fontSize * (2 / 3)) - 3 - style.Train.lrPadding));
}
if (serverNoShow) {
this.textTrainTarget.setShapeStyle('x', parseInt(model.point.x + (2 * model.fontSize * (2 / 3)) - 3 - style.Train.lrPadding));
}
if (serverNoShow && show) {
this.textTrainTarget.setShapeStyle('x', parseInt(model.point.x + (5 * model.fontSize * (2 / 3)) - 6.5 - style.Train.lrPadding));
}
this.add(this.textTrainTarget);
} else if (ele == 'groupNumber') {
const show = arr.includes('targetCode');
const serverNoShow = arr.includes('serviceNumber');
if (show) {
this.textTrainTargetNumber.setShapeStyle('x', parseInt(model.point.x + (3 * model.fontSize * (2 / 3)) - 3 - style.Train.lrPadding));
}
if (serverNoShow) {
this.textTrainTargetNumber.setShapeStyle('x', parseInt(model.point.x + (2 * model.fontSize * (2 / 3)) - 3 - style.Train.lrPadding));
}
if (serverNoShow && show) {
this.textTrainTargetNumber.setShapeStyle('x', parseInt(model.point.x + (5 * model.fontSize * (2 / 3)) - 6.5 - style.Train.lrPadding));
}
this.add(this.textTrainTargetNumber);
}
});
} else {
this.textTrainServer.setShapeStyle('x', parseInt(model.point.x + 27 - style.Train.lrPadding));
this.textTrainTarget.setShapeStyle('x', parseInt(model.point.x + 43 - style.Train.lrPadding));
this.add(this.textTrainServer);
this.add(this.textTrainTarget);
this.add(this.textTrainNumber);
}
}
}

View File

@ -1,66 +1,66 @@
import Group from "zrender/src/container/Group";
import Rect from "zrender/src/graphic/shape/Rect";
import Polygon from "zrender/src/graphic/shape/Polygon";
import Group from 'zrender/src/container/Group';
import Rect from 'zrender/src/graphic/shape/Rect';
import Polygon from 'zrender/src/graphic/shape/Polygon';
/** 车头*/
export default class TrainHead extends Group {
constructor(model) {
super();
this.model = model;
this._create();
}
_create() {
const model = this.model;
const style = this.model.style;
const baseMargin = (model.drect === -1 ? 1 : 0);
this.line = new Rect({
zlevel: model.zlevel,
z: model.z,
shape: {
x: model.point.x - baseMargin * (style.trainConntWidth),
y: model.point.y,
width: style.trainConntWidth * model.scale,
height: style.Train.trainHeadRectHeight,
},
style: {
lineWidth: 0.1,
stroke: style.trainSidelineColor,
fill: style.Train.trainHeadFillColor
}
});
this.arrow = new Polygon({
zlevel: model.zlevel,
z: model.z,
shape: {
points: [
[model.point.x + model.drect * (style.Train.trainHeadTriangleFirst.x), model.point.y + style.Train.trainHeadTriangleFirst.y],
[model.point.x + model.drect * (style.Train.trainHeadTriangleSecond.x), model.point.y + style.Train.trainHeadTriangleSecond.y],
[model.point.x + model.drect * (style.Train.trainHeadTriangleThird.x), model.point.y + style.Train.trainHeadTriangleThird.y]
],
},
style: {
lineWidth: 0.1,
stroke: style.trainSidelineColor,
fill: style.Train.trainHeadFillColor
}
});
constructor(model) {
super();
this.model = model;
this._create();
}
_create() {
const model = this.model;
const style = this.model.style;
const baseMargin = (model.drect === -1 ? 1 : 0);
this.line = new Rect({
zlevel: model.zlevel,
z: model.z,
shape: {
x: model.point.x - baseMargin * (style.trainConntWidth),
y: model.point.y,
width: style.trainConntWidth * model.scale,
height: style.Train.trainHeadRectHeight
},
style: {
lineWidth: 0.1,
stroke: style.trainSidelineColor,
fill: style.Train.trainHeadFillColor
}
});
this.arrow = new Polygon({
zlevel: model.zlevel,
z: model.z,
shape: {
points: [
[model.point.x + model.drect * (style.Train.trainHeadTriangleFirst.x), model.point.y + style.Train.trainHeadTriangleFirst.y],
[model.point.x + model.drect * (style.Train.trainHeadTriangleSecond.x), model.point.y + style.Train.trainHeadTriangleSecond.y],
[model.point.x + model.drect * (style.Train.trainHeadTriangleThird.x), model.point.y + style.Train.trainHeadTriangleThird.y]
]
},
style: {
lineWidth: 0.1,
stroke: style.trainSidelineColor,
fill: style.Train.trainHeadFillColor
}
});
this.add(this.line);
this.add(this.arrow);
}
setColor(color) {
this.line && this.line.setStyle('fill', color);
this.arrow && this.arrow.setStyle('fill', color);
}
setLineShow(isShow) {
isShow ? this.line.show() : this.line.hide();
}
setArrowShow(isShow) {
isShow ? this.arrow.show() : this.arrow.hide();
}
setInvisible(invisible) {
this.eachChild((child) => {
child.attr('invisible', invisible);
});
}
this.add(this.line);
this.add(this.arrow);
}
setColor(color) {
this.line && this.line.setStyle('fill', color);
this.arrow && this.arrow.setStyle('fill', color);
}
setLineShow(isShow) {
isShow ? this.line.show() : this.line.hide();
}
setArrowShow(isShow) {
isShow ? this.arrow.show() : this.arrow.hide();
}
setInvisible(invisible) {
this.eachChild((child) => {
child.attr('invisible', invisible);
});
}
}

View File

@ -1,7 +1,8 @@
import Group from 'zrender/src/container/Group';
import BoundingRect from 'zrender/src/core/BoundingRect';
import TrainHead from './TrainHead/index';
import TrainBody from './TrainBody/index';
import BoundingRect from 'zrender/src/core/BoundingRect';
import Rect from 'zrender/src/graphic/shape/Rect';
/** 列车 */
export default class Train extends Group {
@ -99,6 +100,9 @@ export default class Train extends Group {
this.add(this.trainL);
this.add(this.trainR);
}
if (style.Train.haveTrainBorder) {
this.createTrainBorder();
}
}
// 获取设备提示坐标
@ -124,13 +128,13 @@ export default class Train extends Group {
// 设置服务号状态类型
setServerNoType(type) {
if (this.style.Train.serverNoType.length>0) {
const flag = this.style.Train.serverNoType.some((item) =>{
if (type === item.type) {
const flag = this.style.Train.serverNoType.some((item) =>{
if (type === item.type) {
this.trainB.setTextTrainServerColor(item.showColor);
return true;
}
});
if (this.style.Train.defaultServerNoColor && !flag) {
if (this.style.Train.defaultServerNoColor && !flag) {
this.trainB.setTextTrainServerColor(this.style.this.style.Train.defaultServerNoColor);
}
}
@ -139,14 +143,14 @@ export default class Train extends Group {
// 设置目的地状态
setDestinationStatus(status) {
if (this.style.Train.destinationStatus.length>0) {
const flag = this.style.Train.destinationStatus.some((item) =>{
if (status === item.status) {
this.trainB.setTextTrainTargetColor(item.showColor);
return true;
const flag = this.style.Train.destinationStatus.some((item) =>{
if (status === item.status) {
this.trainB.setTextTrainTargetColor(item.showColor);
return true;
}
});
if (this.style.Train.defaultDestinationColor && !flag) {
this.trainB.setTextTrainTargetColor(this.style.Train.defaultDestinationColor);
if (this.style.Train.defaultDestinationColor && !flag) {
this.trainB.setTextTrainTargetColor(this.style.Train.defaultDestinationColor);
}
}
}
@ -154,8 +158,8 @@ export default class Train extends Group {
// 设置运行方向状态类型
setDirectionType(type) {
if (this.style.Train.directionType.length > 0) {
this.style.Train.directionType.some((item) => {
if (type === item.type) {
this.style.Train.directionType.some((item) => {
if (type === item.type) {
this.trainL.setLineShow(item.lineLShow);
this.trainL.setArrowShow(item.arrowLShow);
this.trainR.setLineShow(item.lineRShow);
@ -168,11 +172,11 @@ export default class Train extends Group {
// 设置列车停止方向类型
setDirectionStopType(type) {
if (this.style.Train.directionStopType.length > 0) {
this.style.Train.directionStopType.some((item) => {
if (type === item.type) {
this.trainL.setLineShow(item.lineLShow);
this.trainR.setLineShow(item.lineRShow);
return true;
this.style.Train.directionStopType.some((item) => {
if (type === item.type) {
this.trainL.setLineShow(item.lineLShow);
this.trainR.setLineShow(item.lineRShow);
return true;
}
});
}
@ -191,57 +195,57 @@ export default class Train extends Group {
}
// 设置运行模式
setRunMode(status) {
if (this.style.Train.runModeStatus.length > 0) {
this.style.Train.runModeStatus.some((item) => {
if (status === item.status) {
this.trainL.setColor(item.trainLColor);
this.trainR.setColor(item.trainRColor);
return true;
if (this.style.Train.runModeStatus.length > 0) {
this.style.Train.runModeStatus.some((item) => {
if (status === item.status) {
this.trainL.setColor(item.trainLColor);
this.trainR.setColor(item.trainRColor);
return true;
}
});
}
}
// 设置运行控制状态类型
setRunControlStatus(status) {
if (this.style.Train.runControlStatus.length > 0) {
this.style.Train.runControlStatus.some((item) => {
if (status === item.status) {
this.trainB.setHShow(item.hShow);
this.trainB.setSShow(item.sShow);
return true;
if (this.style.Train.runControlStatus.length > 0) {
this.style.Train.runControlStatus.some((item) => {
if (status === item.status) {
this.trainB.setHShow(item.hShow);
this.trainB.setSShow(item.sShow);
return true;
}
});
}
}
// 设置车门状态类型
setDoorStatus(status) {
if (this.style.Train.doorStatus.length > 0) {
this.style.Train.doorStatus.some((item) => {
if (status === item.status) {
this.trainB.setDShow(item.dShow);
return true;
if (this.style.Train.doorStatus.length > 0) {
this.style.Train.doorStatus.some((item) => {
if (status === item.status) {
this.trainB.setDShow(item.dShow);
return true;
}
});
}
}
// 设置通信状态类型
setCommunicationStatus() {
if (this.style.Train.communicationStatus.length > 0) {
this.style.Train.doorStatus.some((item) => {
if (status === item.status) {
this.trainB.setTrainColor(item.trainColor);
return true;
if (this.style.Train.communicationStatus.length > 0) {
this.style.Train.doorStatus.some((item) => {
if (status === item.status) {
this.trainB.setTrainColor(item.trainColor);
return true;
}
});
}
}
// 设置报警状态
setAlarmStatus(status) {
if (this.style.Train.alarmStatus.length >0) {
this.style.Train.alarmStatus.some((item) => {
if (status === item.status) {
this.trainB.setAShow(item.aShow);
return true;
if (this.style.Train.alarmStatus.length >0) {
this.style.Train.alarmStatus.some((item) => {
if (status === item.status) {
this.trainB.setAShow(item.aShow);
return true;
}
});
}
@ -295,4 +299,46 @@ export default class Train extends Group {
removeTrainDetail() {
this.trainB.removeTrainDetail();
}
getBoundingRect() {
const list = [this.trainB, this.trainL, this.trainR];
let rect = null;
list.forEach(elem => {
if (elem) {
const tempRect = elem.getBoundingRect();
if (tempRect.x && tempRect.y && tempRect.width && tempRect.height) {
if (rect) {
rect.union(tempRect);
} else {
rect = tempRect;
}
}
}
});
return rect || new BoundingRect(0, 0, 0, 0);
}
createTrainBorder() {
const rect = Object.assign({}, this.getBoundingRect());
rect.x -= this.style.Train.trainWidth / 2;
rect.y -= 5;
rect.width += this.style.Train.trainWidth;
rect.height += 10;
this.trainBorder = new Rect({
zlevel: this.zlevel,
z: this.z,
silent: true,
shape: rect,
style: {
lineDash: [3, 3],
stroke: this.style.borderColor,
fill: this.style.transparentColor
}
});
this.add(this.trainBorder);
this.mouseStatusRecover();
}
}

View File

@ -13,12 +13,15 @@ class TrainWindow extends Group {
this.style = style;
this.z = 1;
this._create(model);
this.setState(state);
this.setStatus(state);
}
_create(model) {
const prdType = '02';// store.state.map.prdType;
if (prdType !== '01') {
this.createTrainWindow();
this.setTrainWindowEventShow(model.trainWindowShow);
this.setStatus(model);
this.mouseStatusRecover();
}
}
@ -31,7 +34,7 @@ class TrainWindow extends Group {
zlevel: this.zlevel - 1,
z: this.z,
shape: {
smooth: 0.01,
smooth: this.style.TrainWindow.trainWindowSmooth,
points: [
[point.x - model.width / 2, point.y],
[point.x + model.width / 2, point.y],
@ -40,9 +43,9 @@ class TrainWindow extends Group {
]
},
style: {
lineDash: [3, 3],
lineWidth: 1,
stroke: this.style.trainWindowColor,
lineDash: this.style.TrainWindow.trainWindowLineDash,
lineWidth: this.style.TrainWindow.trainWindowLineWidth,
stroke: this.style.TrainWindow.trainWindowColor,
fill: this.style.transparentColor
}
});
@ -59,8 +62,15 @@ class TrainWindow extends Group {
}
// 设置状态
setState(state) {
this.trainRect.hide();
setStatus() {
}
setTrainWindowEventShow(show) {
const lineWidth = show ? 1 : 0;
this.trainRect && this.trainRect.setStyle('lineWidth', lineWidth);
}
mouseStatusRecover(e) {
this.setTrainWindowEventShow(false);
// this.setSectionEventShow(e, false);
}
}

View File

@ -242,110 +242,120 @@ class Batong extends defaultSkin {
switchMonolockColor: '#870E10'
};
this[deviceType.Train] = {
/** 车身line宽 */
trainBodyLineWidth: 0,
/** 车身鼠标悬浮事件 */
trainBodyOnMouseOver: {train: true, textTrainNumber: true, textTrainServer: true, textTrainTarget: true, textTrainTargetNumber: true},
/** 车身鼠标移出事件 */
trainBodyOnMouseOut: {train: true, textTrainNumber: true, textTrainServer: true, textTrainTarget: true, textTrainTargetNumber: true},
/** 目的地码前缀*/
targetCodePrefix: '000',
/** 默认目的地码 */
defaultTargetCode: 'AAA',
/** 服务号(表号)前缀 */
serviceNumberPrefix: '00',
/** 默认服务号(表号) */
defaultServiceNumber: 'BB',
/** 车次号前缀 */
tripNumberPrefix: '0000',
/** 默认车次号1 */
defaultDirectionCode: 'D',
/** 默认车次号2 */
defaultTripNumber: 'CCC',
/** 车组号前缀 */
groupNumberPrefix: '000',
/** 默认车组号 */
defaultGroupNumber: 'EEE',
/** 列车车头比车身高出的长度,上下相比车体伸出去的边框*/
trainMoreLength: 1,
/** 列车车头三角坐标1偏移量 */
trainHeadTriangleFirst: { x: 0,y: 0},
/** 列车车头三角坐标2偏移量 */
trainHeadTriangleSecond: { x: 4, y: 8.5},
/** 列车车头三角坐标3偏移量 */
trainHeadTriangleThird: { x: 0, y: 15},
/** 列车高度*/
trainHeight: 17,
/** 列车和车头之间的间距*/
trainHeadDistance: 2,
/** 列车车头矩形高度 */
trainHeadRectHeight: 15,
/** 列车长度*/
trainWidth: 76,
/** 列车竖杠的宽度*/
trainConntWidth: 4,
/** 是否根据车身上车组号、服务号、车次号、目的地码显示情况改变列车长度 */
changeTrainWidth: true,
/** 是否根据nameFormat去动态加载车组号、服务号、车次号、目的地码 */
dynamicLoadingDisplay: true,
/** 特殊列车类型需设置显示格式 */
specialTrainType: [],
/** 两边间隔 */
lrPadding: 1,
/** 上边距离 */
upPadding: 1,
/** 列车字号*/
trainTextFontSize: 15,
/** 目的地状态 01准点 02早点 03严重早点 04晚点 05严重晚点 06头码车 07ATP切除 */
destinationStatus: [
{status: '01',showColor: '#FFFFFF'},
{status: '02',showColor: '#00FF00'},
{status: '03',showColor: '#3265FF'},
{status: '04',showColor: '#9B4A09'},
{status: '05',showColor: '#EF0C08'},
{status: '06',showColor: '#FFFFFF'},
{status: '07',showColor: '#FFFF00'},
],
/** 默认字体 族类*/
textFontFormat: '宋体',
/** 列车HDSA字号*/
trainHSDATextFontSize: 8,
/** 服务号状态类型 eg:{type: '01', showColor: '#FFFFFF'} */
serverNoType: [],
/** 运行方向状态类型对应车头显示状态 01未知方向 02从左往右 上行 03从右往左 下行*/
directionType: [
{type: '01', lineLShow: false, lineRShow: false, arrowLShow: false, arrowRShow: false },
{type: '02', lineLShow: false, lineRShow: false, arrowLShow: false, arrowRShow: true },
{type: '03', lineLShow: false, lineRShow: false, arrowLShow: true, arrowRShow: false }
],
/** 列车停止方向类型对应车头显示状态 01未知方向 02从左往右 上行 03从右往左 下行 */
directionStopType: [
{type: '01', lineLShow: false, lineRShow: false},
{type: '02', lineLShow: false, lineRShow: true},
{type: '03', lineLShow: true, lineRShow: false}
],
/** 01 02 ATOAM 03 ATPCM
/** 车身line宽 */
trainBodyLineWidth: 0,
/** 车身鼠标悬浮事件 */
trainBodyOnMouseOver: {train: true, textTrainNumber: true, textTrainServer: true, textTrainTarget: true, textTrainTargetNumber: true},
/** 车身鼠标移出事件 */
trainBodyOnMouseOut: {train: true, textTrainNumber: true, textTrainServer: true, textTrainTarget: true, textTrainTargetNumber: true},
/** 目的地码前缀*/
targetCodePrefix: '000',
/** 默认目的地码 */
defaultTargetCode: 'AAA',
/** 服务号(表号)前缀 */
serviceNumberPrefix: '00',
/** 默认服务号(表号) */
defaultServiceNumber: 'BB',
/** 车次号前缀 */
tripNumberPrefix: '0000',
/** 默认车次号1 */
defaultDirectionCode: 'D',
/** 默认车次号2 */
defaultTripNumber: 'CCC',
/** 车组号前缀 */
groupNumberPrefix: '000',
/** 默认车组号 */
defaultGroupNumber: 'EEE',
/** 列车车头比车身高出的长度,上下相比车体伸出去的边框*/
trainMoreLength: 1,
/** 列车车头三角坐标1偏移量 */
trainHeadTriangleFirst: { x: 0, y: 0},
/** 列车车头三角坐标2偏移量 */
trainHeadTriangleSecond: { x: 4, y: 8.5},
/** 列车车头三角坐标3偏移量 */
trainHeadTriangleThird: { x: 0, y: 15},
/** 列车高度*/
trainHeight: 17,
/** 列车和车头之间的间距*/
trainHeadDistance: 2,
/** 列车车头矩形高度 */
trainHeadRectHeight: 15,
/** 列车长度*/
trainWidth: 76,
/** 列车竖杠的宽度*/
trainConntWidth: 4,
/** 是否根据车身上车组号、服务号、车次号、目的地码显示情况改变列车长度 */
changeTrainWidth: true,
/** 是否根据nameFormat去动态加载车组号、服务号、车次号、目的地码 */
dynamicLoadingDisplay: true,
/** 特殊列车类型需设置显示格式 */
specialTrainType: [],
/** 两边间隔 */
lrPadding: 1,
/** 上边距离 */
upPadding: 1,
/** 列车字号*/
trainTextFontSize: 15,
/** 目的地状态 01准点 02早点 03严重早点 04晚点 05严重晚点 06头码车 07ATP切除 */
destinationStatus: [
{status: '01', showColor: '#FFFFFF'},
{status: '02', showColor: '#00FF00'},
{status: '03', showColor: '#3265FF'},
{status: '04', showColor: '#9B4A09'},
{status: '05', showColor: '#EF0C08'},
{status: '06', showColor: '#FFFFFF'},
{status: '07', showColor: '#FFFF00'}
],
/** 默认字体 族类*/
textFontFormat: '宋体',
/** 列车HDSA字号*/
trainHSDATextFontSize: 8,
/** 服务号状态类型 eg:{type: '01', showColor: '#FFFFFF'} */
serverNoType: [],
/** 运行方向状态类型对应车头显示状态 01未知方向 02从左往右 上行 03从右往左 下行*/
directionType: [
{type: '01', lineLShow: false, lineRShow: false, arrowLShow: false, arrowRShow: false },
{type: '02', lineLShow: false, lineRShow: false, arrowLShow: false, arrowRShow: true },
{type: '03', lineLShow: false, lineRShow: false, arrowLShow: true, arrowRShow: false }
],
/** 列车停止方向类型对应车头显示状态 01未知方向 02从左往右 上行 03从右往左 下行 */
directionStopType: [
{type: '01', lineLShow: false, lineRShow: false},
{type: '02', lineLShow: false, lineRShow: true},
{type: '03', lineLShow: true, lineRShow: false}
],
/** 01 02 ATOAM 03 ATPCM
* 04 限制人工驾驶模式RM 05 非限制人工驾驶模式RM*/
runModeStatus: [
{status: '01', trainLColor: '#EF0C08', trainRColor: '#EF0C08'},
{status: '01', trainLColor: '#00FF00', trainRColor: '#00FF00'},
{status: '01', trainLColor: '#FFFF00', trainRColor: '#FFFF00'},
{status: '01', trainLColor: '#EA700D', trainRColor: '#EA700D'},
{status: '01', trainLColor: '#A0522D', trainRColor: '#A0522D'}
],
/** 设置运行控制状态类型 eg:{status: '01', hShow: false, sShow: false}, */
runControlStatus: [],
/** 设置车门状态类型 eg:{status: '01', dShow: false}, */
doorStatus: [],
/** 设置通信状态 eg:{status: '01', trainColor:'#725A64'}, */
communicationStatus: [],
/** 设置报警状态 eg:{status: '01', aShow: false}, */
alarmStatus: [],
/** 列车车头矩形填充颜色 */
trainHeadFillColor: '#EF0C08',
/** 列车车身填充颜色 */
trainBodyFillColor: '#000000',
};
runModeStatus: [
{status: '01', trainLColor: '#EF0C08', trainRColor: '#EF0C08'},
{status: '01', trainLColor: '#00FF00', trainRColor: '#00FF00'},
{status: '01', trainLColor: '#FFFF00', trainRColor: '#FFFF00'},
{status: '01', trainLColor: '#EA700D', trainRColor: '#EA700D'},
{status: '01', trainLColor: '#A0522D', trainRColor: '#A0522D'}
],
/** 设置运行控制状态类型 eg:{status: '01', hShow: false, sShow: false}, */
runControlStatus: [],
/** 设置车门状态类型 eg:{status: '01', dShow: false}, */
doorStatus: [],
/** 设置通信状态 eg:{status: '01', trainColor:'#725A64'}, */
communicationStatus: [],
/** 设置报警状态 eg:{status: '01', aShow: false}, */
alarmStatus: [],
/** 列车车头矩形填充颜色 */
trainHeadFillColor: '#EF0C08',
/** 列车车身填充颜色 */
trainBodyFillColor: '#000000'
};
this[deviceType.TrainWindow] = {
/** 车次窗颜色*/
trainWindowColor: '#4DD43F',
/** 车次窗虚线间隔 */
trainWindowLineDash: null,
/** 车次窗线宽 */
trainWindowLineWidth: 1.5,
/** 车次窗矩形圆滑程度 */
trainWindowSmooth: 0
};
}
}

View File

@ -407,6 +407,16 @@ class Beijing extends defaultSkin {
/** 是否需创建trainBorder对象 */
haveTrainBorder: true
};
this[deviceType.TrainWindow] = {
/** 车次窗颜色*/
trainWindowColor: '#FFF',
/** 车次窗虚线间隔 */
lineDash: [3, 3],
/** 车次窗线宽 */
trainWindowLineWidth: 1,
/** 车次窗矩形圆滑程度 */
trainWindowSmooth: 0.01
};
}
}

View File

@ -245,114 +245,130 @@ class Beijing extends defaultSkin {
switchMonolockColor: '#FFFFFF'
};
this[deviceType.Train] = {
/** 车身line宽 */
trainBodyLineWidth: 0.5,
/** 车身鼠标悬浮事件 */
trainBodyOnMouseOver: {train: false, textTrainNumber: false, textTrainServer: false, textTrainTarget: false, textTrainTargetNumber: false},
/** 车身鼠标移出事件 */
trainBodyOnMouseOut: {train: false, textTrainNumber: false, textTrainServer: false, textTrainTarget: false, textTrainTargetNumber: false},
/** 服务号(表号)前缀 */
serviceNumberPrefix: '00',
/** 默认服务号(表号) */
defaultServiceNumber: 'AA',
/** 车次号前缀 */
tripNumberPrefix: '000',
/** 默认车次号2 */
defaultTripNumber: 'DDD',
/** 列车车头比车身高出的长度,上下相比车体伸出去的边框*/
trainMoreLength: 1,
/** 列车车头三角坐标1偏移量 */
trainHeadTriangleFirst: { x: 4, y: 0},
/** 列车车头三角坐标2偏移量 */
trainHeadTriangleSecond: { x: 10, y: 9.5},
/** 列车车头三角坐标3偏移量 */
trainHeadTriangleThird: { x: 4, y: 18},
/** 列车高度*/
trainHeight: 18,
/** 列车和车头之间的间距*/
trainHeadDistance: 2,
/** 列车车头矩形高度 */
trainHeadRectHeight: 18,
/** 列车长度*/
trainWidth: 60,
/** 列车竖杠的宽度*/
trainConntWidth: 2,
/** 是否根据车身上车组号、服务号、车次号、目的地码显示情况改变列车长度 */
changeTrainWidth: false,
/** 是否根据nameFormat去动态加载车组号、服务号、车次号、目的地码 */
dynamicLoadingDisplay: false,
/** 特殊列车类型需设置显示格式 */
specialTrainType: [],
/** 两边间隔 */
lrPadding: 4,
/** 上边距离 */
upPadding: 4,
/** HSDA两边间隔 */
lrPaddingHSDA: 4,
/** HSDA上边距离 */
upPaddingHSDA: 4,
/** 列车字号*/
trainTextFontSize: 12,
/** 目的地状态 eg:{status: '01',showColor: '#FFFFFF'} */
destinationStatus: [],
/** 默认字体 族类*/
textFontFormat: 'consolas',
/** 列车HDSA字号*/
trainHSDATextFontSize: 9,
/** 服务号状态类型 eg:{type: '01', showColor: '#FFFFFF'} */
serverNoType: [],
/** 列车运行方向状态类型对应车头显示状态 01未知方向 02从左往右 上行 03从右往左 下行*/
directionType: [
{type: '01', lineLShow: true, lineRShow: true, arrowLShow: false, arrowRShow: false },
{type: '02', lineLShow: false, lineRShow: true, arrowLShow: false, arrowRShow: true },
{type: '03', lineLShow: true, lineRShow: false, arrowLShow: true, arrowRShow: false }
],
/** 列车停止方向类型对应车头显示状态 01未知方向 02从左往右 上行 03从右往左 下行 */
directionStopType: [
{type: '01', lineLShow: false, lineRShow: false},
{type: '02', lineLShow: false, lineRShow: true},
{type: '03', lineLShow: true, lineRShow: false}
],
/** 01 02 ATOAM 03 ATPCM
/** 车身line宽 */
trainBodyLineWidth: 0.5,
/** 车身鼠标悬浮事件 */
trainBodyOnMouseOver: {train: false, textTrainNumber: false, textTrainServer: false, textTrainTarget: false, textTrainTargetNumber: false},
/** 车身鼠标移出事件 */
trainBodyOnMouseOut: {train: false, textTrainNumber: false, textTrainServer: false, textTrainTarget: false, textTrainTargetNumber: false},
/** 服务号(表号)前缀 */
serviceNumberPrefix: '00',
/** 默认服务号(表号) */
defaultServiceNumber: 'AA',
/** 车次号前缀 */
tripNumberPrefix: '000',
/** 默认车次号2 */
defaultTripNumber: 'DDD',
/** 列车车头比车身高出的长度,上下相比车体伸出去的边框*/
trainMoreLength: 1,
/** 列车车头三角坐标1偏移量 */
trainHeadTriangleFirst: { x: 4, y: 0},
/** 列车车头三角坐标2偏移量 */
trainHeadTriangleSecond: { x: 10, y: 9.5},
/** 列车车头三角坐标3偏移量 */
trainHeadTriangleThird: { x: 4, y: 18},
/** 列车高度*/
trainHeight: 18,
/** 列车和车头之间的间距*/
trainHeadDistance: 2,
/** 列车车头矩形高度 */
trainHeadRectHeight: 18,
/** 列车长度*/
trainWidth: 60,
/** 列车竖杠的宽度*/
trainConntWidth: 2,
/** 是否根据车身上车组号、服务号、车次号、目的地码显示情况改变列车长度 */
changeTrainWidth: false,
/** 是否根据nameFormat去动态加载车组号、服务号、车次号、目的地码 */
dynamicLoadingDisplay: false,
/** 特殊列车类型需设置显示格式 */
specialTrainType: [],
/** 两边间隔 */
lrPadding: 4,
/** 上边距离 */
upPadding: 4,
/** HSDA两边间隔 */
lrPaddingHSDA: 4,
/** HSDA上边距离 */
upPaddingHSDA: 4,
/** 列车字号*/
trainTextFontSize: 12,
/** 目的地状态 eg:{status: '01',showColor: '#FFFFFF'} */
destinationStatus: [],
/** 默认字体 族类*/
textFontFormat: 'consolas',
/** 列车HDSA字号*/
trainHSDATextFontSize: 9,
/** 服务号状态类型 eg:{type: '01', showColor: '#FFFFFF'} */
serverNoType: [],
/** 列车运行方向状态类型对应车头显示状态 01未知方向 02从左往右 上行 03从右往左 下行*/
directionType: [
{type: '01', lineLShow: true, lineRShow: true, arrowLShow: false, arrowRShow: false },
{type: '02', lineLShow: false, lineRShow: true, arrowLShow: false, arrowRShow: true },
{type: '03', lineLShow: true, lineRShow: false, arrowLShow: true, arrowRShow: false }
],
/** 列车停止方向类型对应车头显示状态 01未知方向 02从左往右 上行 03从右往左 下行 */
directionStopType: [
{type: '01', lineLShow: false, lineRShow: false},
{type: '02', lineLShow: false, lineRShow: true},
{type: '03', lineLShow: true, lineRShow: false}
],
/** 01 02 ATOAM 03 ATPCM
* 04 限制人工驾驶模式RM 05 非限制人工驾驶模式RM*/
runModeStatus: [
{status: '01', trainLColor: '#FFFFFF', trainRColor: '#FFFFFF'},
{status: '01', trainLColor: '#00FF00', trainRColor: '#00FF00'},
{status: '01', trainLColor: '#FFFF00', trainRColor: '#FFFF00'},
{status: '01', trainLColor: '#A0522D', trainRColor: '#A0522D'},
{status: '01', trainLColor: '#A0522D', trainRColor: '#A0522D'}
],
/** 设置运行控制状态类型 01正常 02扣车 03停跳 */
runControlStatus: [
{status: '01', hShow: false, sShow: false},
{status: '02', hShow: true, sShow: false},
{status: '03', hShow: false, sShow: true}
],
/** 设置车门状态类型 01关门 02开门 */
doorStatus: [
{status: '01', dShow: false},
{status: '02', dShow: true}
],
/** 设置通信状态 eg:{status: '01', trainColor:'#725A64'}, */
communicationStatus: [],
/** 设置报警状态 01不报警 02报警 */
alarmStatus: [
{status: '01', aShow: false},
{status: '02', aShow: true}
],
/** 列车车头矩形填充颜色 */
trainHeadFillColor: '#000000',
/** 列车车身填充颜色 */
trainBodyFillColor: '#3265FF',
/** textH文本 */
textHContent: '扣',
/** textS文本 */
textSContent: '跳',
/** textD文本 */
textDContent: '门',
/** textA文本 */
textAContent: '警',
}
runModeStatus: [
{status: '01', trainLColor: '#FFFFFF', trainRColor: '#FFFFFF'},
{status: '01', trainLColor: '#00FF00', trainRColor: '#00FF00'},
{status: '01', trainLColor: '#FFFF00', trainRColor: '#FFFF00'},
{status: '01', trainLColor: '#A0522D', trainRColor: '#A0522D'},
{status: '01', trainLColor: '#A0522D', trainRColor: '#A0522D'}
],
/** 设置运行控制状态类型 01正常 02扣车 03停跳 */
runControlStatus: [
{status: '01', hShow: false, sShow: false},
{status: '02', hShow: true, sShow: false},
{status: '03', hShow: false, sShow: true}
],
/** 设置车门状态类型 01关门 02开门 */
doorStatus: [
{status: '01', dShow: false},
{status: '02', dShow: true}
],
/** 设置通信状态 eg:{status: '01', trainColor:'#725A64'}, */
communicationStatus: [],
/** 设置报警状态 01不报警 02报警 */
alarmStatus: [
{status: '01', aShow: false},
{status: '02', aShow: true}
],
/** 列车车头矩形填充颜色 */
trainHeadFillColor: '#000000',
/** 列车车身填充颜色 */
trainBodyFillColor: '#3265FF',
/** textH文本 */
textHContent: '扣',
/** textS文本 */
textSContent: '跳',
/** textD文本 */
textDContent: '门',
/** textA文本 */
textAContent: '警',
/** 是否需创建textHSDA对象 */
haveTextHSDA: true,
/** 是否需创建arrowText对象 */
haveArrowText: false,
/** 是否需创建trainBorder对象 */
haveTrainBorder: true
};
this[deviceType.TrainWindow] = {
/** 车次窗颜色*/
trainWindowColor: '#C0C0C0',
/** 车次窗虚线间隔 */
lineDash: [3, 3],
/** 车次窗线宽 */
trainWindowLineWidth: 1,
/** 车次窗矩形圆滑程度 */
trainWindowSmooth: 0.01
};
}
}

View File

@ -240,111 +240,121 @@ class Fuzhou extends defaultSkin {
switchLen: 6
}
};
this[deviceType.Train] = {
/** 车身line宽 */
trainBodyLineWidth: 0,
/** 车身鼠标悬浮事件 */
trainBodyOnMouseOver: {train: true, textTrainNumber: false, textTrainServer: true, textTrainTarget: false, textTrainTargetNumber: false},
/** 车身鼠标移出事件 */
trainBodyOnMouseOut: {train: true, textTrainNumber: false, textTrainServer: true, textTrainTarget: false, textTrainTargetNumber: false},
/** 目的地码前缀*/
targetCodePrefix: '000',
/** 默认目的地码 */
defaultTargetCode: 'AAA',
/** 服务号(表号)前缀 */
serviceNumberPrefix: '00',
/** 默认服务号(表号) */
defaultServiceNumber: 'BB',
/** 车次号前缀 */
tripNumberPrefix: '0000',
/** 默认车次号1 */
defaultDirectionCode: 'D',
/** 默认车次号2 */
defaultTripNumber: 'CCC',
/** 车组号前缀 */
groupNumberPrefix: '000',
/** 默认车组号 */
defaultGroupNumber: 'EEE',
/** 列车车头比车身高出的长度,上下相比车体伸出去的边框*/
trainMoreLength: 1,
/** 列车车头三角坐标1偏移量 */
trainHeadTriangleFirst: { x: 0,y: 0},
/** 列车车头三角坐标2偏移量 */
trainHeadTriangleSecond: { x: 4, y: 8.5},
/** 列车车头三角坐标3偏移量 */
trainHeadTriangleThird: { x: 0, y: 15},
/** 列车高度*/
trainHeight: 17,
/** 列车和车头之间的间距*/
trainHeadDistance: 2,
/** 列车车头矩形高度 */
trainHeadRectHeight: 15,
/** 列车长度*/
trainWidth: 76,
/** 列车竖杠的宽度*/
trainConntWidth: 4,
/** 是否根据车身上车组号、服务号、车次号、目的地码显示情况改变列车长度 */
changeTrainWidth: true,
/** 是否根据nameFormat去动态加载车组号、服务号、车次号、目的地码 */
dynamicLoadingDisplay: true,
/** 特殊列车类型需设置显示格式 */
specialTrainType: [{ type: '03', serviceNumber: 'MM', nameFormat: 'serviceNumber:groupNumber'}],
/** 两边间隔 */
lrPadding: 1,
/** 上边距离 */
upPadding: 1,
/** 列车字号*/
trainTextFontSize: 15,
/** 目的地状态 01准点 02早点 03严重早点 04晚点 05严重晚点 06头码车 07ATP切除 */
destinationStatus: [
{status: '01',showColor: '#FFFFFF'},
{status: '02',showColor: '#00FF00'},
{status: '03',showColor: '#3265FF'},
{status: '04',showColor: '#9B4A09'},
{status: '05',showColor: '#EF0C08'},
{status: '06',showColor: '#FFFFFF'},
{status: '07',showColor: '#FFFF00'},
],
/** 默认字体 族类*/
textFontFormat: '宋体',
/** 列车HDSA字号*/
trainHSDATextFontSize: 8,
/** 服务号状态类型 eg:{type: '01', showColor: '#FFFFFF'} */
serverNoType: [],
/** 运行方向状态类型对应车头显示状态 01未知方向 02从左往右 上行 03从右往左 下行*/
directionType: [
{type: '01', lineLShow: false, lineRShow: false, arrowLShow: false, arrowRShow: false },
{type: '02', lineLShow: false, lineRShow: false, arrowLShow: false, arrowRShow: true },
{type: '03', lineLShow: false, lineRShow: false, arrowLShow: true, arrowRShow: false }
],
/** 列车停止方向类型对应车头显示状态 01未知方向 02从左往右 上行 03从右往左 下行 */
directionStopType: [
{type: '01', lineLShow: false, lineRShow: false},
{type: '02', lineLShow: false, lineRShow: true},
{type: '03', lineLShow: true, lineRShow: false}
],
/** 01 02 ATOAM 03 ATPCM
this[deviceType.Train] = {
/** 车身line宽 */
trainBodyLineWidth: 0,
/** 车身鼠标悬浮事件 */
trainBodyOnMouseOver: {train: true, textTrainNumber: false, textTrainServer: true, textTrainTarget: false, textTrainTargetNumber: false},
/** 车身鼠标移出事件 */
trainBodyOnMouseOut: {train: true, textTrainNumber: false, textTrainServer: true, textTrainTarget: false, textTrainTargetNumber: false},
/** 目的地码前缀*/
targetCodePrefix: '000',
/** 默认目的地码 */
defaultTargetCode: 'AAA',
/** 服务号(表号)前缀 */
serviceNumberPrefix: '00',
/** 默认服务号(表号) */
defaultServiceNumber: 'BB',
/** 车次号前缀 */
tripNumberPrefix: '0000',
/** 默认车次号1 */
defaultDirectionCode: 'D',
/** 默认车次号2 */
defaultTripNumber: 'CCC',
/** 车组号前缀 */
groupNumberPrefix: '000',
/** 默认车组号 */
defaultGroupNumber: 'EEE',
/** 列车车头比车身高出的长度,上下相比车体伸出去的边框*/
trainMoreLength: 1,
/** 列车车头三角坐标1偏移量 */
trainHeadTriangleFirst: { x: 0, y: 0},
/** 列车车头三角坐标2偏移量 */
trainHeadTriangleSecond: { x: 4, y: 8.5},
/** 列车车头三角坐标3偏移量 */
trainHeadTriangleThird: { x: 0, y: 15},
/** 列车高度*/
trainHeight: 17,
/** 列车和车头之间的间距*/
trainHeadDistance: 2,
/** 列车车头矩形高度 */
trainHeadRectHeight: 15,
/** 列车长度*/
trainWidth: 76,
/** 列车竖杠的宽度*/
trainConntWidth: 4,
/** 是否根据车身上车组号、服务号、车次号、目的地码显示情况改变列车长度 */
changeTrainWidth: true,
/** 是否根据nameFormat去动态加载车组号、服务号、车次号、目的地码 */
dynamicLoadingDisplay: true,
/** 特殊列车类型需设置显示格式 */
specialTrainType: [{ type: '03', serviceNumber: 'MM', nameFormat: 'serviceNumber:groupNumber'}],
/** 两边间隔 */
lrPadding: 1,
/** 上边距离 */
upPadding: 1,
/** 列车字号*/
trainTextFontSize: 15,
/** 目的地状态 01准点 02早点 03严重早点 04晚点 05严重晚点 06头码车 07ATP切除 */
destinationStatus: [
{status: '01', showColor: '#FFFFFF'},
{status: '02', showColor: '#00FF00'},
{status: '03', showColor: '#3265FF'},
{status: '04', showColor: '#9B4A09'},
{status: '05', showColor: '#EF0C08'},
{status: '06', showColor: '#FFFFFF'},
{status: '07', showColor: '#FFFF00'}
],
/** 默认字体 族类*/
textFontFormat: '宋体',
/** 列车HDSA字号*/
trainHSDATextFontSize: 8,
/** 服务号状态类型 eg:{type: '01', showColor: '#FFFFFF'} */
serverNoType: [],
/** 运行方向状态类型对应车头显示状态 01未知方向 02从左往右 上行 03从右往左 下行*/
directionType: [
{type: '01', lineLShow: false, lineRShow: false, arrowLShow: false, arrowRShow: false },
{type: '02', lineLShow: false, lineRShow: false, arrowLShow: false, arrowRShow: true },
{type: '03', lineLShow: false, lineRShow: false, arrowLShow: true, arrowRShow: false }
],
/** 列车停止方向类型对应车头显示状态 01未知方向 02从左往右 上行 03从右往左 下行 */
directionStopType: [
{type: '01', lineLShow: false, lineRShow: false},
{type: '02', lineLShow: false, lineRShow: true},
{type: '03', lineLShow: true, lineRShow: false}
],
/** 01 02 ATOAM 03 ATPCM
* 04 限制人工驾驶模式RM 05 非限制人工驾驶模式RM*/
runModeStatus: [
{status: '01', trainLColor: '#EF0C08', trainRColor: '#EF0C08'},
{status: '01', trainLColor: '#00FF00', trainRColor: '#00FF00'},
{status: '01', trainLColor: '#FFFF00', trainRColor: '#FFFF00'},
{status: '01', trainLColor: '#EA700D', trainRColor: '#EA700D'},
{status: '01', trainLColor: '#A0522D', trainRColor: '#A0522D'}
],
/** 设置运行控制状态类型 eg:{status: '01', hShow: false, sShow: false}, */
runControlStatus: [],
/** 设置车门状态类型 eg:{status: '01', dShow: false}, */
doorStatus: [],
/** 设置通信状态 eg:{status: '01', trainColor:'#725A64'}, */
communicationStatus: [],
/** 设置报警状态 eg:{status: '01', aShow: false}, */
alarmStatus: [],
/** 列车车头矩形填充颜色 */
trainHeadFillColor: '#EF0C08',
/** 列车车身填充颜色 */
trainBodyFillColor: '#000000',
}
runModeStatus: [
{status: '01', trainLColor: '#EF0C08', trainRColor: '#EF0C08'},
{status: '01', trainLColor: '#00FF00', trainRColor: '#00FF00'},
{status: '01', trainLColor: '#FFFF00', trainRColor: '#FFFF00'},
{status: '01', trainLColor: '#EA700D', trainRColor: '#EA700D'},
{status: '01', trainLColor: '#A0522D', trainRColor: '#A0522D'}
],
/** 设置运行控制状态类型 eg:{status: '01', hShow: false, sShow: false}, */
runControlStatus: [],
/** 设置车门状态类型 eg:{status: '01', dShow: false}, */
doorStatus: [],
/** 设置通信状态 eg:{status: '01', trainColor:'#725A64'}, */
communicationStatus: [],
/** 设置报警状态 eg:{status: '01', aShow: false}, */
alarmStatus: [],
/** 列车车头矩形填充颜色 */
trainHeadFillColor: '#EF0C08',
/** 列车车身填充颜色 */
trainBodyFillColor: '#000000'
};
this[deviceType.TrainWindow] = {
/** 车次窗颜色*/
trainWindowColor: '#4DD43F',
/** 车次窗虚线间隔 */
lineDash: null,
/** 车次窗线宽 */
trainWindowLineWidth: 1.5,
/** 车次窗矩形圆滑程度 */
trainWindowSmooth: 0
};
}
}

View File

@ -181,30 +181,23 @@ export default {
},
//
setShowLevel(level) {
if (this.$jlmap) {
console.log('设置显示图层');
// this.$jlmap.setShowLevel(level);
}
console.log(level);
console.log('设置显示图层');
// this.$jlmap && this.$jlmap.setShowLevel(level);
},
// Level
setShowLogicalLevel(levels) {
if (this.$jlmap) {
console.log('设置逻辑视图Level');
// this.$jlmap.setShowLogicalLevel(levels);
}
console.log('设置逻辑视图Level');
// this.$jlmap && this.$jlmap.setShowLogicalLevel(levels);
},
// Level
setShowPhysicalLevel(levels) {
if (this.$jlmap) {
console.log('设置物理视图Level');
// this.$jlmap.setShowPhysicalLevel(levels);
}
console.log('设置物理视图Level');
// this$jlmap && this.$jlmap.setShowPhysicalLevel(levels);
},
//
setShowCenter(deviceCode) {
if (this.$jlmap) {
this.$jlmap.setCenter(deviceCode);
}
this.$jlmap && this.$jlmap.setCenter(deviceCode);
},
//
onDataZoom(dataZoom) {