diff --git a/src/jmapNew/config/skinCode/bejing_01.js b/src/jmapNew/config/skinCode/bejing_01.js index 27ec1b65d..c9af34074 100644 --- a/src/jmapNew/config/skinCode/bejing_01.js +++ b/src/jmapNew/config/skinCode/bejing_01.js @@ -282,7 +282,6 @@ class SkinCode extends defaultStyle { detainCar: { // 扣车 text: 'H', // 扣车显示内容 offset: { x: -8, y: 13 }, // 扣车偏移量 - trainColor: '#E4EF50', // 车站扣车颜色 centerTrainColor: '#FFFFFF', // 中心扣车颜色 andCenterTrainColor: '#F61107', // 车站+中心扣车颜色 detainTrainTextColor: '#E4EF50', // 车站扣除文字颜色 @@ -290,9 +289,9 @@ class SkinCode extends defaultStyle { fontWeight: 'normal' }, stopTime: { // 停站时间 - position: 1, // 运行时间方向 offset: { x: -8, y: 3 }, // 运行时间偏移量 - textColor: '#FFFFFF' // 停站时间字体颜色 + textColor: '#FFFFFF', // 停站时间字体颜色 + textFontSize: 8 }, level: { // 运行等级 position: 1, // 运行等级方向 diff --git a/src/jmapNew/config/skinCode/chengdu_01.js b/src/jmapNew/config/skinCode/chengdu_01.js index 5d4e3137c..ea7c7dd31 100644 --- a/src/jmapNew/config/skinCode/chengdu_01.js +++ b/src/jmapNew/config/skinCode/chengdu_01.js @@ -231,7 +231,6 @@ class SkinCode extends defaultStyle { detainCar: { // 扣车 text: 'H', // 扣车显示内容 offset: {x: -8, y: 13}, // 扣车偏移量 - trainColor: 'yellow', // 车站扣车颜色 centerTrainColor: 'white', // 中心扣车颜色 andCenterTrainColor: 'red', // 车站+中心扣车颜色 detainTrainTextColor: '#E4EF50', // 车站扣除文字颜色 @@ -239,9 +238,9 @@ class SkinCode extends defaultStyle { fontWeight: 'normal' }, stopTime: { // 停站时间 - position: 1, // 运行时间方向 offset: {x: -8, y: -4}, // 运行时间偏移量 - textColor: 'white' // 停站时间字体颜色 + textColor: 'white', // 停站时间字体颜色 + textFontSize: 12 }, jump: { text: '跳', // 停跳显示内容 diff --git a/src/jmapNew/config/skinCode/chengdu_03.js b/src/jmapNew/config/skinCode/chengdu_03.js index bfcb2d4bf..88e0082a6 100644 --- a/src/jmapNew/config/skinCode/chengdu_03.js +++ b/src/jmapNew/config/skinCode/chengdu_03.js @@ -237,7 +237,6 @@ class SkinCode extends defaultStyle { detainCar: { // 扣车 text: '扣', // 扣车显示内容 offset: {x: -8, y: 13}, // 扣车偏移量 - trainColor: '#FFFF00', // 车站扣车颜色 centerTrainColor: '#C0C0C0', // 中心扣车颜色 andCenterTrainColor: '#C0C0C0', // 车站+中心扣车颜色 detainTrainTextColor: '#E4EF50', // 车站扣除文字颜色 @@ -245,10 +244,9 @@ class SkinCode extends defaultStyle { fontWeight: 'normal' }, stopTime: { // 停站时间 - position: 1, // 运行时间方向 offset: {x: -8, y: -4}, // 运行时间偏移量 textColor: '#C0C0C0', // 停站时间字体颜色 - textFontSize: 12 + textFontSize: 10 }, jump: { text: '跳', // 停跳显示内容 diff --git a/src/jmapNew/config/skinCode/foshan_01.js b/src/jmapNew/config/skinCode/foshan_01.js index 54fc377ac..d9b96adc3 100644 --- a/src/jmapNew/config/skinCode/foshan_01.js +++ b/src/jmapNew/config/skinCode/foshan_01.js @@ -227,7 +227,6 @@ class SkinCode extends defaultStyle { detainCar: { // 扣车 text: 'H', // 扣车显示内容 offset: {x: -8, y: 13}, // 扣车偏移量 - trainColor: '#E4EF50', // 车站扣车颜色 centerTrainColor: '#FFFFFF', // 中心扣车颜色 andCenterTrainColor: '#F61107', // 车站+中心扣车颜色 detainTrainTextColor: '#E4EF50', // 车站扣除文字颜色 @@ -235,10 +234,9 @@ class SkinCode extends defaultStyle { fontWeight: 'normal' }, stopTime: { // 停站时间 - position: 1, // 运行时间方向 offset: {x: -8, y: -4}, // 运行时间偏移量 textColor: '#C0C0C0', // 停站时间字体颜色 - textFontSize: 12 + textFontSize: 11 }, jump: { text: 'S', // 停跳显示内容 diff --git a/src/jmapNew/config/skinCode/haerbin_01.js b/src/jmapNew/config/skinCode/haerbin_01.js index 2f3e77d77..7ad30dda3 100644 --- a/src/jmapNew/config/skinCode/haerbin_01.js +++ b/src/jmapNew/config/skinCode/haerbin_01.js @@ -232,7 +232,6 @@ class SkinCode extends defaultStyle { text: 'H', // 扣车显示内容 fontSize: 18, // 扣车字体大小 offset: { x: 60, y: -20 }, // 扣车偏移量 - trainColor: '#E4EF50', // 车站扣车颜色 centerTrainColor: '#F61107', // 中心扣车颜色 andCenterTrainColor: '#F61107', // 车站+中心扣车颜色 detainTrainTextColor: '#E4EF50', // 车站扣除文字颜色 @@ -246,8 +245,6 @@ class SkinCode extends defaultStyle { fontSize: 18 }, stopTime: { // 停站时间 - offset: { x: -8, y: 26 }, // 运行时间偏移量 - textColor: '#FFFFFF' // 停站时间字体颜色 }, level: { // 运行等级 position: 1, // 运行等级方向 diff --git a/src/jmapNew/config/skinCode/ningbo_01.js b/src/jmapNew/config/skinCode/ningbo_01.js index 40ded2160..92de804a3 100644 --- a/src/jmapNew/config/skinCode/ningbo_01.js +++ b/src/jmapNew/config/skinCode/ningbo_01.js @@ -275,7 +275,6 @@ class SkinCode extends defaultStyle { detainCar: { // 扣车 text: 'H', // 扣车显示内容 offset: { x: -8, y: 0 }, // 扣车偏移量 - trainColor: 'yellow', // 车站扣车颜色 centerTrainColor: 'white', // 中心扣车颜色 andCenterTrainColor: 'red', // 车站+中心扣车颜色 detainTrainTextColor: '#E4EF50', // 车站扣除文字颜色 @@ -283,9 +282,9 @@ class SkinCode extends defaultStyle { fontWeight: 'normal' }, stopTime: { // 停站时间 - position: 1, // 运行时间方向 offset: { x: -8, y: -4 }, // 运行时间偏移量 - textColor: 'white' // 停站时间字体颜色 + textColor: 'white', // 停站时间字体颜色 + textFontSize: 10 // 停站时间字体大小 }, jump: {}, level: { // 运行等级 diff --git a/src/jmapNew/shape/StationStand/EDetain.js b/src/jmapNew/shape/StationStand/EDetain.js index 4db267204..ca90a91f2 100644 --- a/src/jmapNew/shape/StationStand/EDetain.js +++ b/src/jmapNew/shape/StationStand/EDetain.js @@ -6,39 +6,44 @@ class EDetain extends Group { super(); this.model = model; this.detain = null; - this.create(); + this.isNew = false; } create() { - const model = this.model; - const style = this.model.style; - this.detain = new Text({ - zlevel: model.zlevel, - z: model.z, - position: [0, 0], - style: { - x: model.x, - y: model.y, - text: style.StationStand.detainCar.text, - fontSize: `${style.StationStand.detainCar.fontSize} px ${style.fontFamily}`, - textFill: style.StationStand.detainCar.centerTrainColor, - textStroke: style.backgroundColor, - textAlign: style.textStyle.textAlign, - textVerticalAlign: style.textStyle.textVerticalAlign - } - }); - this.add(this.detain); + if (this.isNew) { + const model = this.model; + const style = this.model.style; + this.isNew = true; + this.detain = new Text({ + zlevel: model.zlevel, + z: model.z, + position: [0, 0], + style: { + x: model.x, + y: model.y, + text: style.StationStand.detainCar.text, + fontSize: `${style.StationStand.detainCar.fontSize} px ${style.fontFamily}`, + textFill: style.StationStand.detainCar.centerTrainColor, + textStroke: style.backgroundColor, + textAlign: style.textStyle.textAlign, + textVerticalAlign: style.textStyle.textVerticalAlign + } + }); + this.add(this.detain); + } } setColor(color) { + this.create(); this.detain.setStyle('textFill', color); } hide() { - this.detain.hide(); + this.detain && this.detain.hide(); } show() { + this.create(); this.detain.show(); } } diff --git a/src/jmapNew/shape/StationStand/EJump.js b/src/jmapNew/shape/StationStand/EJump.js index dbc4d26d5..8b9d3155d 100644 --- a/src/jmapNew/shape/StationStand/EJump.js +++ b/src/jmapNew/shape/StationStand/EJump.js @@ -6,56 +6,61 @@ class EJump extends Group { constructor(model) { super(); this.model = model; - this.create(); + this.isNew = false; } create() { - const model = this.model; - const style = this.model.style; - this.jump = new Text({ - zlevel: model.zlevel, - z: model.z, - style: { - x: model.x, - y: model.y, - fontWeight: style.StationStand.jump.fontWeight, - fontSize: style.StationStand.jump.fontSize, - fontFamily: style.fontFamily, - text: style.StationStand.jump.text, - textFill: style.StationStand.jump.textColor, - textAlign: style.textStyle.textAlign, - textVerticalAlign: style.textStyle.textVerticalAlign - } - }); - this.add(this.jump); - if (style.StationStand.jump.r) { - this.jumpArc = new Arc({ + if (this.isNew) { + const model = this.model; + const style = this.model.style; + this.isNew = true; + this.jump = new Text({ zlevel: model.zlevel, z: model.z, - shape: { - cx: model.cx, - cy: model.cy, - r: style.StationStand.jump.r - }, style: { - stroke: style.StationStand.jump.arcColor, - fill: style.StationStand.jump.fillColor + x: model.x, + y: model.y, + fontWeight: style.StationStand.jump.fontWeight, + fontSize: style.StationStand.jump.fontSize, + fontFamily: style.fontFamily, + text: style.StationStand.jump.text, + textFill: style.StationStand.jump.textColor, + textAlign: style.textStyle.textAlign, + textVerticalAlign: style.textStyle.textVerticalAlign } }); - this.add(this.jumpArc); - this.jumpArc.hide(); + this.add(this.jump); + if (style.StationStand.jump.r) { + this.jumpArc = new Arc({ + zlevel: model.zlevel, + z: model.z, + shape: { + cx: model.cx, + cy: model.cy, + r: style.StationStand.jump.r + }, + style: { + stroke: style.StationStand.jump.arcColor, + fill: style.StationStand.jump.fillColor + } + }); + this.add(this.jumpArc); + this.jumpArc.hide(); + } } } setColor(color) { + this.create(); this.jump.setStyle('textFill', color); } hide() { - this.jump.hide(); + this.jump && this.jump.hide(); this.jumpArc && this.jumpArc.hide(); } show(isAllJump) { + this.create(); if (isAllJump) { // 站台跳停 this.jump.show(); this.jumpArc && this.jumpArc.show(); diff --git a/src/jmapNew/shape/StationStand/ELevel.js b/src/jmapNew/shape/StationStand/ELevel.js index bc51b346f..985dcf2ef 100644 --- a/src/jmapNew/shape/StationStand/ELevel.js +++ b/src/jmapNew/shape/StationStand/ELevel.js @@ -5,6 +5,7 @@ class ELevel extends Group { constructor(model) { super(); this.model = model; + this.level = null; this.isNew = false; } @@ -20,16 +21,15 @@ class ELevel extends Group { style: { x: model.x, y: model.y, - fontWeight: 'normal', - fontSize: style.StationStand.stopTime.textFontSize || style.StationStand.common.textFontSize, + fontWeight: style.textStyle.fontWeight, + fontSize: style.StationStand.stopTime.textFontSize, fontFamily: style.fontFamily, text: model.name, textFill: style.StationStand.level.textColor, - textAlign: 'center', - textVerticalAlign: 'middle' + textAlign: style.textStyle.textAlign, + textVerticalAlign: style.textStyle.textVerticalAlign } }); - this.add(this.level); } } @@ -45,8 +45,7 @@ class ELevel extends Group { } hide() { - this.create(); - this.level.hide(); + this.level && this.level.hide(); } show() { diff --git a/src/jmapNew/shape/StationStand/EReentry.js b/src/jmapNew/shape/StationStand/EReentry.js index 1c32388b9..b98720e27 100644 --- a/src/jmapNew/shape/StationStand/EReentry.js +++ b/src/jmapNew/shape/StationStand/EReentry.js @@ -3,47 +3,45 @@ import Polygon from 'zrender/src/graphic/shape/Polygon'; import { flashlight } from '../utils/ShapePoints.js'; class EReentry extends Group { - constructor(model) { - super(); - this.model = model; - this.isNew = false; - } + constructor(model) { + super(); + this.model = model; + this.isNew = false; + } - create() { - if (!this.isNew) { - const model = this.model; + create() { + if (!this.isNew) { + const model = this.model; + this.isNew = true; + this.reentry = new Polygon({ + zlevel: model.zlevel, + z: model.z, + shape: { + points: flashlight(model.x, model.y, model.drict, 10, 5, 0, 0, 4) + }, + style: { + lineWidth: model.lineWidth, + fill: model.fill + } + }); - this.isNew = true; - this.reentry = new Polygon({ - zlevel: model.zlevel, - z: model.z, - shape: { - points: flashlight(model.x, model.y, model.drict, 10, 5, 0, 0, 4) - }, - style: { - lineWidth: model.lineWidth, - fill: model.fill - } - }); + this.add(this.reentry); + } + } - this.add(this.reentry); - } - } + setColor(color) { + this.create(); + this.reentry.setStyle('textFill', color); + } - setColor(color) { - this.create(); - this.reentry.setStyle('textFill', color); - } + hide() { + this.reentry && this.reentry.hide(); + } - hide() { - this.create(); - this.reentry.hide(); - } - - show() { - this.create(); - this.reentry.show(); - } + show() { + this.create(); + this.reentry.show(); + } } export default EReentry; diff --git a/src/jmapNew/shape/StationStand/index.js b/src/jmapNew/shape/StationStand/index.js index cdf3e7404..458eb8e8f 100644 --- a/src/jmapNew/shape/StationStand/index.js +++ b/src/jmapNew/shape/StationStand/index.js @@ -135,8 +135,8 @@ class StationStand extends Group { /** 站台扣车*/ const detainD = model.right ? 1 : -1; - const detainX = model.position.x - (style.StationStand.stopTime.position || detainD) * (style.StationStand.detainCar.offset.x - model.width / 2); - const detainY = model.position.y + (style.StationStand.stopTime.position || detainD) * (style.StationStand.detainCar.offset.y - model.height / 2); + const detainX = model.position.x - (detainD) * (style.StationStand.detainCar.offset.x - model.width / 2); + const detainY = model.position.y + (detainD) * (style.StationStand.detainCar.offset.y - model.height / 2); this.detain = new EDetain({ zlevel: this.zlevel, z: this.z, @@ -150,18 +150,20 @@ class StationStand extends Group { this.add(this.detain); /** 停站时间*/ - const timeDrict = model.right ? 1 : -1; - const timeX = model.position.x - timeDrict * (style.StationStand.stopTime.offset.x - model.width / 2); - const timeY = model.position.y + timeDrict * style.StationStand.stopTime.offset.y; - this.time = new ETime({ - zlevel: this.zlevel, - z: this.z + 1, - style: style, - x: timeX, - y: timeY, - name: model.parkingTime || '30' - }); - this.add(this.time); + if (style.StationStand.stopTime.offset) { + const timeDrict = model.right ? 1 : -1; + const timeX = model.position.x - timeDrict * (style.StationStand.stopTime.offset.x - model.width / 2); + const timeY = model.position.y + timeDrict * style.StationStand.stopTime.offset.y; + this.time = new ETime({ + zlevel: this.zlevel, + z: this.z + 1, + style: style, + x: timeX, + y: timeY, + name: model.parkingTime || '30' + }); + this.add(this.time); + } /** 运行等级*/ const levelDrict = model.right ? 1 : -1;