This commit is contained in:
fan 2020-08-20 16:57:58 +08:00
commit 428d547a25
9 changed files with 245 additions and 53 deletions

View File

@ -409,7 +409,7 @@ class SkinCode extends defaultStyle {
// 延续保护计时 // 延续保护计时
this[deviceType.OverAp] = { this[deviceType.OverAp] = {
show: false show: true
}; };
this[deviceType.Switch] = { this[deviceType.Switch] = {

View File

@ -421,7 +421,7 @@ class SkinCode extends defaultStyle {
}; };
// 延续保护计时 // 延续保护计时
this[deviceType.OverAp] = { this[deviceType.OverAp] = {
show: true show: false
}; };
this[deviceType.Switch] = { this[deviceType.Switch] = {

View File

@ -133,7 +133,11 @@ class SkinCode extends defaultStyle {
blockGlint: true // 区段封锁闪烁显示 blockGlint: true // 区段封锁闪烁显示
}, },
trainPosition:{ trainPosition:{
display: false // 列车实时位置显示 display: true, // 列车实时位置显示
specialShow: true, // 列车特殊显示
specialBackground: 'rgba(36, 219, 219, 0.8)',
specialRectWidth: 14,
stopTrainRectWidth: 7
} }
}; };
@ -219,7 +223,11 @@ class SkinCode extends defaultStyle {
text: { text: {
fontSize: 11, // 字体大小 fontSize: 11, // 字体大小
fontWeight: 'normal', // 字体粗细 fontWeight: 'normal', // 字体粗细
distance: 5 // 灯跟文字距离 distance: 5, // 灯跟文字距离
borderShow: true,
borderColor: '#000',
textPadding: [3, 20],
textBorderWidth: 2
}, },
lamp: { lamp: {
radiusR: 6, // 控制灯大小 radiusR: 6, // 控制灯大小
@ -616,12 +624,12 @@ class SkinCode extends defaultStyle {
], // 特殊列车类型需设置显示格式 ], // 特殊列车类型需设置显示格式
lrPadding: 4, // 两边间隔 lrPadding: 4, // 两边间隔
upPadding: 4, // 上边距离 upPadding: 4, // 上边距离
trainSidelineColor: '#ABFE9B', trainSidelineColor: 'rgba(0,0,0,0)',
trainBodyFillColor: '#A388B1', // 列车车身填充颜色 trainBodyFillColor: 'rgba(0,0,0,0)', // 列车车身填充颜色
trainNameFormat: 'serviceNumber:tripNumber:targetCode'// 列车显示格式 trainNameFormat: 'serviceNumber:tripNumber:targetCode'// 列车显示格式
}, },
directionArrow: { directionArrow: {
hasArrow: true, hasArrow: false,
width: 6, width: 6,
radiusR: 4, radiusR: 4,
fillColor: '#00FF00', fillColor: '#00FF00',
@ -640,6 +648,8 @@ class SkinCode extends defaultStyle {
trainNumber: { trainNumber: {
targetCodePrefix: '00', // 目的地码前缀 targetCodePrefix: '00', // 目的地码前缀
defaultTargetCode: 'DD', // 默认目的地码 defaultTargetCode: 'DD', // 默认目的地码
fontColor: '#000',
fontSize: 10,
trainTargetTextAlign: 'left', // 目的地码文字显示位置 trainTargetTextAlign: 'left', // 目的地码文字显示位置
trainNumberOffset: { x: 36, y: 4 }, // 目的地码偏移量 trainNumberOffset: { x: 36, y: 4 }, // 目的地码偏移量
headTypeColor: '#1CBAFD', // 头码车目的地号显示颜色 headTypeColor: '#1CBAFD', // 头码车目的地号显示颜色
@ -647,12 +657,16 @@ class SkinCode extends defaultStyle {
}, },
trainServer: { trainServer: {
serviceNumberPrefix: '000', // 服务号(表号)前缀 serviceNumberPrefix: '000', // 服务号(表号)前缀
fontColor: '#000',
fontSize: 10,
defaultServiceNumber: 'TTT', // 默认服务号(表号) defaultServiceNumber: 'TTT', // 默认服务号(表号)
defaultServerNoColor: '#FFFFFF', // 默认服务号状态显示颜色 defaultServerNoColor: '#000', // 默认服务号状态显示颜色
trainServerOffset: { x: 4, y: 4 } // 列车服务号偏移 trainServerOffset: { x: 4, y: 4 } // 列车服务号偏移
}, },
trainTarget: { trainTarget: {
tripNumberPrefix: '00', // 车次号前缀 tripNumberPrefix: '00', // 车次号前缀
fontColor: '#000',
fontSize: 10,
defaultTripNumber: 'DD', // 默认车次号2 defaultTripNumber: 'DD', // 默认车次号2
trainTargetOffset: { x: 24, y: 4 }, // 列车车次号偏移 trainTargetOffset: { x: 24, y: 4 }, // 列车车次号偏移
trainTargetTextAlign: 'right' // 车次号文字显示位置 trainTargetTextAlign: 'right' // 车次号文字显示位置
@ -666,13 +680,13 @@ class SkinCode extends defaultStyle {
maskText: '0' // 车组号遮罩 maskText: '0' // 车组号遮罩
}, },
trainHead: { trainHead: {
trainConntWidth: 2, // 列车竖杠的宽度 trainConntWidth: 0, // 列车竖杠的宽度
trainHeadFillColor: '#000000', // 列车车头矩形填充颜色 trainHeadFillColor: '#000000', // 列车车头矩形填充颜色
trainHeadRectHeight: 20, // 列车车头矩形高度 trainHeadRectHeight: 20, // 列车车头矩形高度
directionStopType:'normal', // special 西安二号线 停车 列车方向图标不消失 normal 正常 directionStopType:'normal', // special 西安二号线 停车 列车方向图标不消失 normal 正常
trainHeadHeight: 'trainBox', // 列车车头高度取决于trainBox高度 trainHeadHeight: 'trainBox', // 列车车头高度取决于trainBox高度
trainHeadArrowWidth: 5, // 列车车头三角宽度 trainHeadArrowWidth: 0, // 列车车头三角宽度
trainHeadArrowOffsetX: 4 // 列车车头三角偏移 trainHeadArrowOffsetX: 0 // 列车车头三角偏移
}, },
common: { common: {
trainHeight: 20, // 列车高度 trainHeight: 20, // 列车高度
@ -680,7 +694,7 @@ class SkinCode extends defaultStyle {
trainWidth: 70, // 列车长度 trainWidth: 70, // 列车长度
trainTextFontSize: 16, // 列车字号 trainTextFontSize: 16, // 列车字号
fontFamily: 'consolas', // 默认字体 族类 fontFamily: 'consolas', // 默认字体 族类
haveTextHSDA: true, // 是否需创建textHSDA对象 haveTextHSDA: false, // 是否需创建textHSDA对象
haveArrowText: true, // 是否需创建arrowText对象 haveArrowText: true, // 是否需创建arrowText对象
textOffset: 4, // 字体偏移(用以控制字体据车头的距离) textOffset: 4, // 字体偏移(用以控制字体据车头的距离)
trainWidthMoreText: 8, // 计算列车长度时--列车长比text多出尺寸 trainWidthMoreText: 8, // 计算列车长度时--列车长比text多出尺寸
@ -689,7 +703,7 @@ class SkinCode extends defaultStyle {
trainTip:false // 鼠标悬停列车状态信息框是否显示 trainTip:false // 鼠标悬停列车状态信息框是否显示
}, },
mouseOverStyle:{ mouseOverStyle:{
borderLineColor: '#FFFFFF', borderLineColor: 'rgba(0,0,0,0)',
borderLineDash: [3, 3], borderLineDash: [3, 3],
leftOffset:30, leftOffset:30,
rightOffset:30 rightOffset:30

View File

@ -52,9 +52,9 @@ export default class Station extends Group {
if (style.Station.text.borderShow) { // 哈尔滨线路单独显示 if (style.Station.text.borderShow) { // 哈尔滨线路单独显示
this.stationText.attr({ this.stationText.attr({
style: { style: {
textPadding: [2, 6], textPadding: style.Station.text.textPadding || [2, 6],
textBorderColor: model.nameFontColor, textBorderColor: style.Station.text.borderColor || model.nameFontColor,
textBorderWidth: 1 textBorderWidth: style.Station.text.textBorderWidth || 1
} }
}); });
} }

View File

@ -82,10 +82,10 @@ class EMouse extends Group {
z: this.device.model.z + 10, z: this.device.model.z + 10,
silent: true, silent: true,
shape: { shape: {
x:rect.x - 30, x: rect.x - 30,
y:rect.y, y: rect.y,
width:rect.width + 60, width: rect.width + 60,
height:rect.height height: rect.height
}, },
style: { style: {
lineDash: [3, 3], lineDash: [3, 3],

View File

@ -1,5 +1,6 @@
import Group from 'zrender/src/container/Group'; import Group from 'zrender/src/container/Group';
import Polygon from 'zrender/src/graphic/shape/Polygon'; import Polygon from 'zrender/src/graphic/shape/Polygon';
import Rect from 'zrender/src/graphic/shape/Rect';
/** 创建三角形*/ /** 创建三角形*/
export default class ETriangle extends Group { export default class ETriangle extends Group {
@ -7,6 +8,7 @@ export default class ETriangle extends Group {
super(); super();
this.model = model; this.model = model;
this.zlevel = model.zlevel; this.zlevel = model.zlevel;
this.style = model.style;
this.z = model.z; this.z = model.z;
this.create(model); this.create(model);
} }
@ -14,38 +16,153 @@ export default class ETriangle extends Group {
create(model) { create(model) {
if (model && model.point) { if (model && model.point) {
const right = model.right == 1 ? 1 : -1; const right = model.right == 1 ? 1 : -1;
this.angle = new Polygon({ if (this.style.Section.trainPosition.specialShow) {
zlevel: model.zlevel, this.stopRect = new Rect({ // 停车标识
z: model.z, zlevel: model.zlevel,
shape: { z: model.z,
points:[[model.point.x + 10 * right, model.point.y], [model.point.x, model.point.y - 6], [model.point.x, model.point.y + 6]] shape: {
}, x: model.point.x - this.style.Section.trainPosition.stopTrainRectWidth,
style: { y: model.point.y - this.style.Section.line.width / 4,
stroke:'#00FF00', width: this.style.Section.trainPosition.stopTrainRectWidth,
lineWidth: 0.5, height: this.style.Section.line.width - 2
fill: '#00FF00' },
} style: {
}); lineWidth: 0,
this.add(this.angle); fill: 'rgba(26, 54, 88, 0.7)'
}
});
this.angle1 = new Rect({
zlevel: model.zlevel,
z: model.z,
shape: {
x: model.point.x - this.style.Section.trainPosition.specialRectWidth,
y: model.point.y - this.style.Section.line.width / 2,
width: this.style.Section.trainPosition.specialRectWidth,
height: this.style.Section.line.width + 2
},
style: {
lineWidth: 0,
fill: this.style.Section.trainPosition.specialBackground
},
cursor: 'pointer'
});
this.angle = new Polygon({
zlevel: model.zlevel,
z: model.z,
shape: {
points:[
[model.point.x + 5 * right, model.point.y + 1],
[model.point.x, model.point.y - this.style.Section.line.width / 2],
[model.point.x, model.point.y + this.style.Section.line.width / 2 + 2]
]
},
style: {
// stroke:'#00FF00',
lineWidth: 0,
fill: this.style.Section.trainPosition.specialBackground
}
});
this.add(this.angle1);
this.add(this.angle);
this.add(this.stopRect);
this.stopRect.hide();
} else {
this.angle = new Polygon({
zlevel: model.zlevel,
z: model.z,
shape: {
points:[[model.point.x + 10 * right, model.point.y], [model.point.x, model.point.y - 6], [model.point.x, model.point.y + 6]]
},
style: {
stroke:'#00FF00',
lineWidth: 0.5,
fill: '#00FF00'
}
});
this.add(this.angle);
}
} }
} }
updateTriangle(model, right) { updateTriangle(model, right, trainB) {
const trainRight = right == 1 ? 1 : -1; if (this.angle) {
const data = [[model.x + 10 * trainRight, model.y], [model.x, model.y - 6], [model.x, model.y + 6]]; const trainRight = right == 1 ? 1 : -1;
// this.angle.shape.points.push([model.x + 10 * trainRight, model.y]); let data = [
// this.angle.attr('shape', { points: this.angle.shape.points }); [model.x + 10 * trainRight, model.y],
this.angle.attr({ [model.x, model.y - 6],
shape: { [model.x, model.y + 6]
points:data ];
if (this.style.Section.trainPosition.specialShow) {
data = [
[model.x + 5 * trainRight, model.y + 1],
[model.x, model.y - this.style.Section.line.width / 2],
[model.x, model.y + this.style.Section.line.width / 2 + 2]
];
} }
}); this.angle.attr({
this.angle.animateTo({ shape: {
shape: { points:data
points:data }
});
this.angle.animateTo({
shape: {
points:data
}
}, 10, 0, 'elasticOut', function () {
});
this.angle.dirty();
}
if (this.angle1) {
let trainRight = model.x;
if (right == 1) {
trainRight = model.x - this.style.Section.trainPosition.specialRectWidth;
} }
}, 10, 0, 'elasticOut', function () { const pointsData = {
}); x: trainRight,
this.dirty(); y: model.y - this.style.Section.line.width / 2,
width: this.style.Section.trainPosition.specialRectWidth,
height: this.style.Section.line.width + 2
};
this.angle1.attr({
shape: pointsData
});
this.angle1.animateTo({
shape: pointsData
}, 10, 0, 'elasticOut', function () {
});
this.angle1.dirty();
}
if (this.stopRect) {
const offset = (this.style.Section.trainPosition.specialRectWidth - this.style.Section.trainPosition.stopTrainRectWidth) / 2;
let trainRight = model.x + offset;
if (right == 1) {
trainRight = model.x - offset - this.style.Section.trainPosition.stopTrainRectWidth;
}
const pointsData = {
x: trainRight,
y: model.y - this.style.Section.line.width / 4,
width: this.style.Section.trainPosition.stopTrainRectWidth,
height: this.style.Section.line.width - 2
};
this.stopRect.attr({
shape: pointsData
});
this.stopRect.animateTo({
shape: pointsData
}, 10, 0, 'elasticOut', function () {
});
this.stopRect.dirty();
}
if (this.style.Section.trainPosition.specialShow) {
trainB.setPositionText(model, right);
}
}
setStopShow(flag) {
if (flag) {
this.stopRect && this.stopRect.show();
} else {
this.stopRect && this.stopRect.hide();
}
} }
} }

View File

@ -53,7 +53,7 @@ export default class TrainBody extends Group {
y: parseInt(model.point.y + style.Train.trainServer.trainServerOffset.y), y: parseInt(model.point.y + style.Train.trainServer.trainServerOffset.y),
text: serviceNumber.substring(serviceNumber.length - style.Train.trainServer.serviceNumberPrefix.length), text: serviceNumber.substring(serviceNumber.length - style.Train.trainServer.serviceNumberPrefix.length),
textFill: model.style.Train.trainServer.fontColor || style.trainTextColor, textFill: model.style.Train.trainServer.fontColor || style.trainTextColor,
fontSize: model.fontSize, fontSize: model.style.Train.trainServer.fontSize || model.fontSize,
fontFamily: style.Train.common.fontFamily, fontFamily: style.Train.common.fontFamily,
textAlign: 'left', textAlign: 'left',
textVerticalAlign: 'top' textVerticalAlign: 'top'
@ -66,7 +66,7 @@ export default class TrainBody extends Group {
y: parseInt(model.point.y + model.style.Train.trainTarget.trainTargetOffset.y), y: parseInt(model.point.y + model.style.Train.trainTarget.trainTargetOffset.y),
text: tripNumber.substring(tripNumber.length - style.Train.trainTarget.tripNumberPrefix.length), text: tripNumber.substring(tripNumber.length - style.Train.trainTarget.tripNumberPrefix.length),
textFill: model.style.Train.trainTarget.fontColor || style.trainTextColor, textFill: model.style.Train.trainTarget.fontColor || style.trainTextColor,
fontSize: model.fontSize, fontSize: model.style.Train.trainTarget.fontSize || model.fontSize,
fontFamily: style.Train.common.fontFamily, fontFamily: style.Train.common.fontFamily,
textAlign: 'left', textAlign: 'left',
textVerticalAlign: 'top' textVerticalAlign: 'top'
@ -80,7 +80,7 @@ export default class TrainBody extends Group {
textFill: model.style.Train.trainNumber.fontColor || style.trainTextColor, textFill: model.style.Train.trainNumber.fontColor || style.trainTextColor,
textStroke: style.trainTextColor, textStroke: style.trainTextColor,
textStrokeWidth: 0, textStrokeWidth: 0,
fontSize: model.fontSize, fontSize: model.style.Train.trainNumber.fontSize || model.fontSize,
fontFamily: style.Train.common.fontFamily, fontFamily: style.Train.common.fontFamily,
textAlign: 'left', textAlign: 'left',
textVerticalAlign: 'top' textVerticalAlign: 'top'
@ -401,4 +401,61 @@ export default class TrainBody extends Group {
} }
} }
} }
setPositionText(model, right) {
let widthText = 0;
let point = {
x: model.x - 10,
y: model.y
};
if (right == 1) {
point = {
x: model.x - 20,
y: model.y
};
}
if (this.textTrainTarget) {
this.textTrainTarget.attr({
style: {
x: parseInt(point.x + widthText),
y: parseInt(point.y - this.style.Section.line.width),
textVerticalAlign: 'middle'
}
});
widthText += this.textTrainTarget.getBoundingRect().width;
this.textTrainTarget.dirty();
}
if (this.textTrainServer) {
this.textTrainServer.attr({
style: {
x: parseInt(point.x + widthText),
y: parseInt(point.y - this.style.Section.line.width),
textVerticalAlign: 'middle'
}
});
widthText += this.textTrainServer.getBoundingRect().width;
this.textTrainServer.dirty();
}
if (this.textTrainTrip) {
this.textTrainTrip.attr({
style: {
x: parseInt(point.x + widthText),
y: parseInt(point.y - this.style.Section.line.width),
textVerticalAlign: 'middle'
}
});
widthText += this.textTrainTrip.getBoundingRect().width;
this.textTrainTrip.dirty();
}
if (this.textTrainGroup) {
this.textTrainGroup.attr({
style: {
x: parseInt(point.x + widthText),
y: parseInt(point.y - this.style.Section.line.width),
textVerticalAlign: 'middle'
}
});
widthText += this.textTrainGroup.getBoundingRect().width;
this.textTrainGroup.dirty();
}
}
} }

View File

@ -1,6 +1,6 @@
import Group from 'zrender/src/container/Group'; import Group from 'zrender/src/container/Group';
import Rect from 'zrender/src/graphic/shape/Rect'; import Rect from 'zrender/src/graphic/shape/Rect';
import BoundingRect from 'zrender/src/core/BoundingRect'; // import BoundingRect from 'zrender/src/core/BoundingRect';
export default class TrainBodyBox extends Group { export default class TrainBodyBox extends Group {
constructor(model) { constructor(model) {

View File

@ -60,6 +60,7 @@ export default class Train extends Group {
this._computed(); this._computed();
const model = this.model; const model = this.model;
const style = this.style; const style = this.style;
if (this.point) { if (this.point) {
this.trainB = new TrainBody({ this.trainB = new TrainBody({
zlevel: this.zlevel, zlevel: this.zlevel,
@ -153,6 +154,7 @@ export default class Train extends Group {
right: this.model.right, right: this.model.right,
point: { x: this.startX, y: this.startY } point: { x: this.startX, y: this.startY }
}); });
this.add(this.triangle); this.add(this.triangle);
} }
@ -193,7 +195,7 @@ export default class Train extends Group {
}); });
const point = { x: this.startX, y: this.startY }; const point = { x: this.startX, y: this.startY };
this.triangle.point = point; this.triangle.point = point;
this.triangle.updateTriangle(point, train.right); this.triangle.updateTriangle(point, train.right, this.trainB);
this.triangle.dirty(); this.triangle.dirty();
} }
} }
@ -230,6 +232,7 @@ export default class Train extends Group {
this.trainL && this.trainL.setArrowShow(arrowLShow); this.trainL && this.trainL.setArrowShow(arrowLShow);
this.trainR && this.trainR.setLineShow(lineRShow); this.trainR && this.trainR.setLineShow(lineRShow);
this.trainR && this.trainR.setArrowShow(arrowRShow); this.trainR && this.trainR.setArrowShow(arrowRShow);
this.triangle && this.triangle.setStopShow(false); // 运行
return true; return true;
} }
}); });
@ -246,6 +249,7 @@ export default class Train extends Group {
} else { } else {
this.trainL && this.trainL.setLineShow(item.lineLShow); this.trainL && this.trainL.setLineShow(item.lineLShow);
this.trainR && this.trainR.setLineShow(item.lineRShow); this.trainR && this.trainR.setLineShow(item.lineRShow);
this.triangle && this.triangle.setStopShow(true); // 停车
} }
return true; return true;
} }