diff --git a/README-zh.md b/README-zh.md index 32243a46d..543b3fa20 100644 --- a/README-zh.md +++ b/README-zh.md @@ -1,96 +1,3 @@ -# vue-admin-template - -> 这是一个极简的 vue admin 管理后台。它只包含了 Element UI & axios & iconfont & permission control & lint,这些搭建后台必要的东西。 - -[线上地址](http://panjiachen.github.io/vue-admin-template) - -[国内访问](https://panjiachen.gitee.io/vue-admin-template) - -目前版本为 `v4.0+` 基于 `vue-cli` 进行构建,若你想使用旧版本,可以切换分支到[tag/3.11.0](https://github.com/PanJiaChen/vue-admin-template/tree/tag/3.11.0),它不依赖 `vue-cli`。 - -## Extra - -如果你想要根据用户角色来动态生成侧边栏和 router,你可以使用该分支[permission-control](https://github.com/PanJiaChen/vue-admin-template/tree/permission-control) - -## 相关项目 - -[vue-element-admin](https://github.com/PanJiaChen/vue-element-admin) - -[electron-vue-admin](https://github.com/PanJiaChen/electron-vue-admin) - -[vue-typescript-admin-template](https://github.com/Armour/vue-typescript-admin-template) - -写了一个系列的教程配套文章,如何从零构建后一个完整的后台项目: - -- [手摸手,带你用 vue 撸后台 系列一(基础篇)](https://juejin.im/post/59097cd7a22b9d0065fb61d2) -- [手摸手,带你用 vue 撸后台 系列二(登录权限篇)](https://juejin.im/post/591aa14f570c35006961acac) -- [手摸手,带你用 vue 撸后台 系列三 (实战篇)](https://juejin.im/post/593121aa0ce4630057f70d35) -- [手摸手,带你用 vue 撸后台 系列四(vueAdmin 一个极简的后台基础模板,专门针对本项目的文章,算作是一篇文档)](https://juejin.im/post/595b4d776fb9a06bbe7dba56) -- [手摸手,带你封装一个 vue component](https://segmentfault.com/a/1190000009090836) - -## Build Setup - -```bash -# 克隆项目 -git clone https://github.com/PanJiaChen/vue-admin-template.git - -# 进入项目目录 -cd vue-admin-template - -# 安装依赖 -npm install - -# 建议不要直接使用 cnpm 安装以来,会有各种诡异的 bug。可以通过如下操作解决 npm 下载速度慢的问题 -npm install --registry=https://registry.npm.taobao.org - -# 启动服务 -npm run dev -``` - -浏览器访问 [http://localhost:9528](http://localhost:9528) - -## 发布 - -```bash -# 构建测试环境 -npm run build:stage - -# 构建生产环境 -npm run build:prod -``` - -## 其它 - -```bash -# 预览发布环境效果 -npm run preview - -# 预览发布环境效果 + 静态资源分析 -npm run preview -- --report - -# 代码格式检查 -npm run lint - -# 代码格式检查并自动修复 -npm run lint -- --fix -``` - -更多信息请参考 [使用文档](https://panjiachen.github.io/vue-element-admin-site/zh/) - -## Demo - -![demo](https://github.com/PanJiaChen/PanJiaChen.github.io/blob/master/images/demo.gif) - -## Browsers support - -Modern browsers and Internet Explorer 10+. - -| [IE / Edge](http://godban.github.io/browsers-support-badges/)
IE / Edge | [Firefox](http://godban.github.io/browsers-support-badges/)
Firefox | [Chrome](http://godban.github.io/browsers-support-badges/)
Chrome | [Safari](http://godban.github.io/browsers-support-badges/)
Safari | -| --------- | --------- | --------- | --------- | -| IE10, IE11, Edge| last 2 versions| last 2 versions| last 2 versions - -## License - -[MIT](https://github.com/PanJiaChen/vue-admin-template/blob/master/LICENSE) license. +# jl-nclient Copyright (c) 2017-present PanJiaChen diff --git a/README.md b/README.md index bd3dbc87e..b0f0459af 100644 --- a/README.md +++ b/README.md @@ -1,89 +1,6 @@ -# vue-admin-template +# jl-nclient English | [简体中文](./README-zh.md) -> A minimal vue admin template with Element UI & axios & iconfont & permission control & lint - -**Live demo:** http://panjiachen.github.io/vue-admin-template - - -**The current version is `v4.0+` build on `vue-cli`. If you want to use the old version , you can switch branch to [tag/3.11.0](https://github.com/PanJiaChen/vue-admin-template/tree/tag/3.11.0), it does not rely on `vue-cli`** - -## Build Setup - - -```bash -# clone the project -git clone https://github.com/PanJiaChen/vue-element-admin.git - -# enter the project directory -cd vue-element-admin - -# install dependency -npm install - -# develop -npm run dev -``` - -This will automatically open http://localhost:9527 - -## Build - -```bash -# build for test environment -npm run build:stage - -# build for production environment -npm run build:prod -``` - -## Advanced - -```bash -# preview the release environment effect -npm run preview - -# preview the release environment effect + static resource analysis -npm run preview -- --report - -# code format check -npm run lint - -# code format check and auto fix -npm run lint -- --fix -``` - -Refer to [Documentation](https://panjiachen.github.io/vue-element-admin-site/guide/essentials/deploy.html) for more information - -## Demo - -![demo](https://github.com/PanJiaChen/PanJiaChen.github.io/blob/master/images/demo.gif) - -## Extra - -If you want router permission && generate menu by user roles , you can use this branch [permission-control](https://github.com/PanJiaChen/vue-admin-template/tree/permission-control) - -For `typescript` version, you can use [vue-typescript-admin-template](https://github.com/Armour/vue-typescript-admin-template) (Credits: [@Armour](https://github.com/Armour)) - -## Related Project - -[vue-element-admin](https://github.com/PanJiaChen/vue-element-admin) - -[electron-vue-admin](https://github.com/PanJiaChen/electron-vue-admin) - -[vue-typescript-admin-template](https://github.com/Armour/vue-typescript-admin-template) - -## Browsers support - -Modern browsers and Internet Explorer 10+. - -| [IE / Edge](http://godban.github.io/browsers-support-badges/)
IE / Edge | [Firefox](http://godban.github.io/browsers-support-badges/)
Firefox | [Chrome](http://godban.github.io/browsers-support-badges/)
Chrome | [Safari](http://godban.github.io/browsers-support-badges/)
Safari | -| --------- | --------- | --------- | --------- | -| IE10, IE11, Edge| last 2 versions| last 2 versions| last 2 versions - -## License - -[MIT](https://github.com/PanJiaChen/vue-admin-template/blob/master/LICENSE) license. Copyright (c) 2017-present PanJiaChen diff --git a/src/jmap/config/defaultSkin.js b/src/jmap/config/defaultSkin.js index 9497b9422..434247d38 100644 --- a/src/jmap/config/defaultSkin.js +++ b/src/jmap/config/defaultSkin.js @@ -14,6 +14,10 @@ export default class DefaultSkin { /** 默认字体 大小*/ this.textFontSize = 10; + + /** 默认字体 族类*/ + this.textFontFormat = 'consolas'; + /** 默认字体颜色*/ this.textFontColor = '#C0C0C0'; @@ -32,9 +36,43 @@ export default class DefaultSkin { /** 默认名称和设备的距离*/ this.nameDistance = 2; + /** 计数器字体颜色*/ + this.stationCounterTextColor = '#FFFFFF'; + /** 计数器边框颜色*/ + this.stationCounterBorderColor = '#E4EF50'; + /** 延迟解锁倒计时和设备文字之间的距离*/ + this.stationDelayUnlockDistance = 3; + /** 延时解锁字体颜色*/ + this.stationDelayUnlockTextColor = '#FFFFFF'; + /** 延迟解锁边框颜色*/ + this.stationDelayUnlockBorderColor = '#FFFFFF'; + /** 目的码字体颜色*/ this.destinationTextFontColor = 'yellow'; + /** 计数器字体颜色*/ + this.stationCounterTextColor = '#FFFFFF'; + /** 计数器边框颜色*/ + this.stationCounterBorderColor = '#E4EF50'; + /** 延迟解锁倒计时和设备文字之间的距离*/ + this.stationDelayUnlockDistance = 3; + /** 延时解锁字体颜色*/ + this.stationDelayUnlockTextColor = '#FFFFFF'; + /** 延迟解锁边框颜色*/ + this.stationDelayUnlockBorderColor = '#FFFFFF'; + + /** 列车长度*/ + this.trainWidth = 40; + + /** 列车高度*/ + this.trainHeight = 20; + + /** 列车字号*/ + this.trainTextFontSize = 12; + + /** 列车HDSA字号*/ + this.trainHSDATextFontSize = 9; + /** 列车信号的半径*/ this.trainConflictR = 3; @@ -44,6 +82,12 @@ export default class DefaultSkin { /** 列车车头比车身高出的长度;上下相比车体伸出去的边框*/ this.trainMoreLength = 0; + /** 列车和车头之间的间距*/ + this.trainHeadDistance = 4; + + /** 列车竖杠的宽度*/ + this.trainConntWidth = 3; + /** 列车竖杠和方向之间的间隔*/ this.trainPadding = 4; @@ -100,8 +144,5 @@ export default class DefaultSkin { /** 车次窗颜色*/ this.trainWindowColor = '#fff'; - - /** 列车文字颜色*/ - this.trainTextColor = '#ffffff'; } } diff --git a/src/jmap/shape/ImageControl/index.js b/src/jmap/shape/ImageControl/index.js index a13d6c94b..b8dcca88a 100644 --- a/src/jmap/shape/ImageControl/index.js +++ b/src/jmap/shape/ImageControl/index.js @@ -13,7 +13,7 @@ export default class ImageControl extends Group { this.model = model; this.state = state; this.style = style; - this.z = model.zIndex || 1; + this.z = model.zIndex || 1; // 默认5 this._create(); } diff --git a/src/jmap/shape/LcControl/index.js b/src/jmap/shape/LcControl/index.js index dee4483dc..c19f4dec7 100644 --- a/src/jmap/shape/LcControl/index.js +++ b/src/jmap/shape/LcControl/index.js @@ -36,11 +36,13 @@ export default class LcControl extends Group { position: [0, 0], x: model.position.x, y: model.position.y + this.style.zcControlmodeR + this.style.nameDistance, + fontWeight: 'normal', + fontSize: this.style.stationControlTextSize, + fontFamily: this.style.textFontFormat, text: model.name, textFill: '#fff', textAlign: 'middle', - textVerticalAlign: 'top', - textFont: this.style.stationControlTextSize + 'px ' + this.style.textFontFormat + textVerticalAlign: 'top' }, style: this.style }); diff --git a/src/jmap/shape/LimitControl/index.js b/src/jmap/shape/LimitControl/index.js index 911270fba..226dac902 100644 --- a/src/jmap/shape/LimitControl/index.js +++ b/src/jmap/shape/LimitControl/index.js @@ -35,11 +35,13 @@ export default class LimitControl extends Group { position: [0, 0], x: model.position.x, y: model.position.y + this.style.zcControlmodeR + this.style.nameDistance, + fontWeight: 'normal', + fontSize: this.style.stationControlTextSize, + fontFamily: this.style.textFontFormat, text: model.name, textFill: '#fff', textAlign: 'middle', - textVerticalAlign: 'top', - textFont: this.style.stationControlTextSize + 'px ' + this.style.textFontFormat + textVerticalAlign: 'top' }, style: this.style }); diff --git a/src/jmap/shape/Section/EAxle.js b/src/jmap/shape/Section/EAxle.js index 894f09003..99527d79a 100644 --- a/src/jmap/shape/Section/EAxle.js +++ b/src/jmap/shape/Section/EAxle.js @@ -1,56 +1,85 @@ -import Group from 'zrender/src/container/Group'; -import Line from 'zrender/src/graphic/shape/Line'; -import Circle from 'zrender/src/graphic/shape/Circle'; +// import Group from 'zrender/src/container/Group'; +// import Line from 'zrender/src/graphic/shape/Line'; +// import Circle from 'zrender/src/graphic/shape/Circle'; +import Path from 'zrender/src/graphic/Path'; -/** 计轴*/ -export default class EAxle extends Group { - constructor(model) { - super(); - this.model = model; - this.zlevel = model.zlevel; - this.z = 5; - this._create(model); - } - - _create(model) { +// 计轴 +export const EAxle = Path.extend({ + type: 'EAxle', + shape: { + point: null + }, + buildPath: function (ctx, model) { if (model && model.style && model.traingle) { - const axleLength = 2 * model.style.Section.sectionAxleR; + const axleLength = 2 * model.style.Section.axle.radius; const positionx = model.point.x + model.drictx * (model.traingle.getCos(axleLength)); const positiony = model.point.y + model.dricty * (model.traingle.getCos(axleLength)); + // 圆弧 + const arcX = positionx - model.dricty * model.traingle.getSin(axleLength); + const arcY = positiony + model.drictx * model.traingle.getSin(axleLength); + const arcR = model.style.Section.axle.radius; + ctx.arc(arcX, arcY, arcR, 0, 2 * Math.PI, false); + ctx.closePath(); - this.line = new Line({ - zlevel: this.zlevel, - z: this.z, - progressive: model.progressive, - shape: { - x1: positionx - model.traingle.getCos(axleLength) - model.dricty * model.traingle.getSin(axleLength), - y1: positiony + model.drictx * model.traingle.getSin(axleLength) - model.traingle.getSin(axleLength), - x2: positionx + model.traingle.getCos(axleLength) - model.dricty * model.traingle.getSin(axleLength), - y2: positiony + model.drictx * model.traingle.getSin(axleLength) + model.traingle.getSin(axleLength) - }, - style: { - GBaseLineWidth: 1, - stroke: model.style.Section.sectionAxleColor - } - }); - this.axle = new Circle({ - zlevel: this.zlevel, - z: this.z, - progressive: model.progressive, - shape: { - cx: positionx - model.dricty * model.traingle.getSin(axleLength), - cy: positiony + model.drictx * model.traingle.getSin(axleLength), - r: model.style.Section.sectionAxleR - }, - style: { - GBaseLineWidth: 1, - stroke: model.style.Section.sectionAxleColor, - fill: model.style.transparentColor - } - }); - - this.add(this.line); - this.add(this.axle); + const x1 = positionx - model.traingle.getCos(axleLength) - model.dricty * model.traingle.getSin(axleLength); + const y1 = positiony + model.drictx * model.traingle.getSin(axleLength) - model.traingle.getSin(axleLength); + const x2 = positionx + model.traingle.getCos(axleLength) - model.dricty * model.traingle.getSin(axleLength); + const y2 = positiony + model.drictx * model.traingle.getSin(axleLength) + model.traingle.getSin(axleLength); + ctx.moveTo(x1, y1); + ctx.lineTo(x2, y2); + ctx.closePath(); } } -} +}); + +// export default class EAxle extends Group { +// constructor(model) { +// super(); +// this.model = model; +// this.zlevel = model.zlevel; +// this.z = 5; +// this._create(model); +// } + +// _create(model) { +// if (model && model.style && model.traingle) { +// const axleLength = 2 * model.style.Section.axle.radius; +// const positionx = model.point.x + model.drictx * (model.traingle.getCos(axleLength)); +// const positiony = model.point.y + model.dricty * (model.traingle.getCos(axleLength)); + +// this.line = new Line({ +// zlevel: this.zlevel, +// z: this.z, +// progressive: model.progressive, +// shape: { +// x1: positionx - model.traingle.getCos(axleLength) - model.dricty * model.traingle.getSin(axleLength), +// y1: positiony + model.drictx * model.traingle.getSin(axleLength) - model.traingle.getSin(axleLength), +// x2: positionx + model.traingle.getCos(axleLength) - model.dricty * model.traingle.getSin(axleLength), +// y2: positiony + model.drictx * model.traingle.getSin(axleLength) + model.traingle.getSin(axleLength) +// }, +// style: { +// GBaseLineWidth: 1, +// stroke: model.style.Section.axle.color +// } +// }); +// this.axle = new Circle({ +// zlevel: this.zlevel, +// z: this.z, +// progressive: model.progressive, +// shape: { +// cx: positionx - model.dricty * model.traingle.getSin(axleLength), +// cy: positiony + model.drictx * model.traingle.getSin(axleLength), +// r: model.style.Section.axle.radius +// }, +// style: { +// GBaseLineWidth: 1, +// stroke: model.style.Section.axle.color, +// fill: model.style.transparentColor +// } +// }); + +// this.add(this.line); +// this.add(this.axle); +// } +// } +// } diff --git a/src/jmap/shape/Section/ELimitLines.js b/src/jmap/shape/Section/ELimitLines.js index 4d2ce9252..b7c78b52e 100644 --- a/src/jmap/shape/Section/ELimitLines.js +++ b/src/jmap/shape/Section/ELimitLines.js @@ -1,8 +1,80 @@ import Group from 'zrender/src/container/Group'; import BezierCurve from 'zrender/src/graphic/shape/BezierCurve'; import Line from 'zrender/src/graphic/shape/Line'; +import JTriangle from '../../utils/JTriangle'; +// import Path from 'zrender/src/graphic/Path'; + +// 创建区段限速限集合 +// export const ELimitLines = Path.extend({ +// type: 'ELimitLines', +// shape: { +// points: null +// }, +// buildPath: function (ctx, model) { +// /** 创建区段*/ +// if (model && model.points.length > 1) { +// if (model.isCurve) { +// ctx.beginPath(); +// const shape = {}; +// for (let i = 1; i < (model.points.length - 1); i++) { +// shape[`cpx${i}`] = model.points[i].x; +// shape[`cpy${i}`] = model.points[i].y; +// } +// shape[`x1`] = model.points[0].x; +// shape[`y1`] = model.points[0].y; +// shape[`x2`] = model.points[model.points.length - 1].x; +// shape[`y2`] = model.points[model.points.length - 1].y; + +// ctx.moveTo(shape[`x1`], shape[`y1`]); +// if (model.points.length <= 3) { +// ctx.quadraticCurveTo(shape[`cpx1`], shape[`cpy1`], shape[`x2`], shape[`y2`]); +// } else { +// ctx.bezierCurveTo(shape[`cpx1`], shape[`cpy1`], shape[`cpx2`], shape[`cpy2`], shape[`x2`], shape[`y2`]); +// } +// } else { +// const swPadding = model.style.Switch.core.switchLen; // 定位和反位时区段距离岔芯的距离 +// var switchWidth = model.style.Section.line.width + model.style.Section.line.beyondWidth; // 道岔宽度 +// const beg = Object.assign({}, model.points[0]); +// const end = Object.assign({}, model.points[model.points.length - 1]); +// if (model.isSwitchSection && beg.y !== end.y) { +// const swch = model.switch; +// if (swch) { +// const traingle = new JTriangle(swch.intersection, swch.skew); +// if ((swch.intersection.x === beg.x) && (swch.intersection.y === beg.y)) { +// beg.x = beg.x + traingle.drictx * (swPadding + switchWidth) * traingle.getCotRate(); +// beg.y = beg.y + traingle.dricty * (swPadding + switchWidth); +// } + +// if ((swch.intersection.x === end.x) && (swch.intersection.y === end.y)) { +// end.x = end.x + traingle.drictx * (swPadding + switchWidth) * traingle.getCotRate(); +// end.y = end.y + traingle.dricty * (swPadding + switchWidth); +// } +// } +// } + +// if (model.points.length == 2) { +// ctx.moveTo(beg.x, beg.y); +// ctx.lineTo(end.x, end.y); +// ctx.closePath(); +// } else { +// ctx.moveTo(beg.x, beg.y); +// ctx.lineTo(model.points[1].x, model.points[1].y); +// ctx.closePath(); + +// for (let i = 1; i < (model.points.length - 2); i++) { +// ctx.moveTo(model.points[i].x, model.points[i].y); +// ctx.lineTo(model.points[i + 1].x, model.points[i + 1].y); +// ctx.closePath(); +// } +// ctx.moveTo(model.points[model.points.length - 2].x, model.points[model.points.length - 2].y); +// ctx.lineTo(end.x, end.y); +// ctx.closePath(); +// } +// } +// } +// } +// }); -/** 创建区段限速限集合*/ export default class ELimitLines extends Group { constructor(model) { super(); @@ -36,14 +108,34 @@ export default class ELimitLines extends Group { shape: shape, position: model.position, style: { - lineWidth: model.style.Section.sectionSpeedLimitLinewidth, - stroke: model.style.Section.sectionSpeedLimitColor, + lineWidth: model.style.Section.speedLimit.width, + stroke: model.style.Section.speedLimit.lineColor, fillOpacity: 0 } })); } else { + // const beg = Object.assign({}, model.points[0]); + // const end = Object.assign({}, model.points[model.points.length - 1]); + + const swPadding = model.style.Switch.core.switchLen; // 定位和反位时区段距离岔芯的距离 + var switchWidth = model.style.Section.line.width + model.style.Section.line.beyondWidth; // 道岔宽度 const beg = Object.assign({}, model.points[0]); const end = Object.assign({}, model.points[model.points.length - 1]); + if (model.isSwitchSection && beg.y !== end.y) { + const swch = model.switch; + if (swch) { + const traingle = new JTriangle(swch.intersection, swch.skew); + if ((swch.intersection.x === beg.x) && (swch.intersection.y === beg.y)) { + beg.x = beg.x + traingle.drictx * (swPadding + switchWidth) * traingle.getCotRate(); + beg.y = beg.y + traingle.dricty * (swPadding + switchWidth); + } + + if ((swch.intersection.x === end.x) && (swch.intersection.y === end.y)) { + end.x = end.x + traingle.drictx * (swPadding + switchWidth) * traingle.getCotRate(); + end.y = end.y + traingle.dricty * (swPadding + switchWidth); + } + } + } if (model.points.length == 2) { this.add(new Line({ @@ -59,8 +151,8 @@ export default class ELimitLines extends Group { y2: end.y }, style: { - lineWidth: model.style.Section.sectionSpeedLimitLinewidth, - stroke: model.style.Section.sectionSpeedLimitColor + lineWidth: model.style.Section.speedLimit.width, + stroke: model.style.Section.speedLimit.lineColor } })); } else { @@ -77,8 +169,8 @@ export default class ELimitLines extends Group { y2: model.points[1].y }, style: { - lineWidth: model.style.Section.sectionSpeedLimitLinewidth, - stroke: model.style.Section.sectionSpeedLimitColor + lineWidth: model.style.Section.speedLimit.width, + stroke: model.style.Section.speedLimit.lineColor } })); @@ -96,8 +188,8 @@ export default class ELimitLines extends Group { y2: model.points[i + 1].y }, style: { - lineWidth: model.style.Section.sectionSpeedLimitLinewidth, - stroke: model.style.Section.sectionSpeedLimitColor + lineWidth: model.style.Section.speedLimit.width, + stroke: model.style.Section.speedLimit.lineColor } })); } @@ -115,8 +207,8 @@ export default class ELimitLines extends Group { y2: end.y }, style: { - lineWidth: model.style.Section.sectionSpeedLimitLinewidth, - stroke: model.style.Section.sectionSpeedLimitColor + lineWidth: model.style.Section.speedLimit.width, + stroke: model.style.Section.speedLimit.lineColor } })); } diff --git a/src/jmap/shape/Section/ELines.js b/src/jmap/shape/Section/ELines.js index fecaf5182..89adbcbce 100644 --- a/src/jmap/shape/Section/ELines.js +++ b/src/jmap/shape/Section/ELines.js @@ -35,8 +35,8 @@ export default class ELines extends Group { culling: true, shape: shape, style: { - lineWidth: model.style.Section.sectionWidth, - stroke: model.style.Section.sectionSpareColor, + lineWidth: model.style.Section.line.width, + stroke: model.style.Section.line.spareColor, fillOpacity: 0 } })); @@ -54,8 +54,8 @@ export default class ELines extends Group { y2: model.points[i + 1].y }, style: { - lineWidth: model.style.Section.sectionWidth, - stroke: model.style.Section.sectionSpareColor + lineWidth: model.style.Section.line.width, + stroke: model.style.Section.line.spareColor } })); } diff --git a/src/jmap/shape/Section/ERelease.js b/src/jmap/shape/Section/ERelease.js index fcefc7a65..efda4b174 100644 --- a/src/jmap/shape/Section/ERelease.js +++ b/src/jmap/shape/Section/ERelease.js @@ -6,43 +6,50 @@ export default class ERelease extends Group { constructor(model) { super(); this.model = model; - this.zlevel = model.zlevel; - this.z = model.z; - this._create(); + this.isNew = false; + } _create() { - const model = this.model; - this.Lines = new Line({ - zlevel: model.zlevel, - z: this.z, - shape: model.shape, - progressive: model.progressive, - style: { - lineWidth: model.lineWidth, - stroke: model.stroke - } - }); - this.add(this.Lines); + if (!this.isNew) { + const model = this.model; + + this.isNew = true; + this.lines = new Line({ + zlevel: model.zlevel, + z: model.z, + shape: model.shape, + progressive: model.progressive, + style: { + lineWidth: model.lineWidth, + stroke: model.stroke + } + }); + this.add(this.lines); + } } setStyle(model) { - this.Lines.setStyle(model); + this._create(); + this.lines.setStyle(model); } hide() { - this.Lines.hide(); + this._create(); + this.lines.hide(); } show() { - this.Lines.show(); + this._create(); + this.lines.show(); } // 开始动画 animateStyle(loop, animates) { + this._create(); if (animates && animates.length) { this.eachChild((child) => { - if (child.animateStyle && child.isLine) { + if (child.animateStyle) { let an = child.animateStyle(loop); animates.forEach(elem => { an = an.when(elem.time, elem.styles); @@ -55,8 +62,9 @@ export default class ERelease extends Group { // 结束动画 stopAnimation(flag) { + this._create(); this.eachChild((child) => { - if (child.stopAnimation && child.isLine) { + if (child.stopAnimation) { child.stopAnimation(flag); } }); diff --git a/src/jmap/shape/Section/ESeparator.js b/src/jmap/shape/Section/ESeparator.js index 30a757ffb..d2538fe68 100644 --- a/src/jmap/shape/Section/ESeparator.js +++ b/src/jmap/shape/Section/ESeparator.js @@ -10,23 +10,29 @@ export default class ESeparator extends Group { this.zlevel = model.zlevel; this.style = model.style; this.z = 6; - this._create(model); + this.setType(); } - _create(model) { + createModel(points, lineWidth = null, stroke = null) { + const model = this.model; this.partition = new Polyline({ zlevel: this.zlevel, progressive: model.progressive, z: this.z, shape: { - points: [] + points: points }, style: { - lineWidth: this.style.Section.sectionSeparatorWidth, - stroke: this.style.Section.sectionSeparatorColor + lineWidth: lineWidth || this.style.Section.separator.width, + stroke: stroke || this.style.Section.separator.color } }); + this.add(this.partition); + } + // 创建 侵限分隔符 + createCircle() { + const model = this.model; this.circle = new Circle({ zlevel: this.zlevel, z: this.z, @@ -34,53 +40,46 @@ export default class ESeparator extends Group { shape: { cx: model.point.x, cy: model.point.y, - r: this.style.Section.sectionWidth + r: this.style.Section.line.width }, style: { - stroke: this.style.Section.sectionInvadeColor, + stroke: this.style.Section.line.invadeColor, GBaseLineWidth: 0.5, fill: this.style.transparentColor } }); - - this.add(this.partition); - this.setType(); + this.add(this.circle); } setType() { const type = this.model.sepType; const model = this.model; if (model && this.style && model.traingle) { - this.remove(this.circle); - if (type === '00') { - this.partition.setShape('points', [ - [model.point.x, model.point.y], - [model.point.x, model.point.y] - ]); - } else if (type === '01') { - this.partition.setShape('points', [ - [model.point.x, model.point.y - (this.style.Section.sectionWidth)], - [model.point.x, model.point.y + (this.style.Section.sectionWidth)] - ]); - this.add(this.partition); - } else if (type === '02') { - this.partition.setShape('points', [ - [model.point.x + model.drict * (this.style.Section.sectionWidth), model.point.y - (this.style.Section.sectionWidth * 1.5)], - [model.point.x, model.point.y - (this.style.Section.sectionWidth * 1.5)], - [model.point.x, model.point.y + (this.style.Section.sectionWidth * 1.5)] - ]); - this.add(this.partition); - } else if (type === '03') { - this.partition.setShape('points', [ - [model.point.x + model.drict * (this.style.Section.sectionWidth) * 1.2, model.point.y - (this.style.Section.sectionWidth * 1.2)], - [model.point.x, model.point.y - (this.style.Section.sectionWidth * 1.2)], - [model.point.x, model.point.y + (this.style.Section.sectionWidth * 1.2)], - [model.point.x + model.drict * (this.style.Section.sectionWidth) * 1.2, model.point.y + (this.style.Section.sectionWidth * 1.2)] - ]); - this.add(this.partition); - this.partition.setStyle({'lineWidth': this.style.Section.sectionEndSeparatorWidth, 'stroke': this.style.Section.sectionEndSeparatorStroke }); - } else if (type === '04') { - this.add(this.circle); + if (type === '01') { // 普通分割 + const points = [ + [model.point.x, model.point.y - (this.style.Section.line.width)], + [model.point.x, model.point.y + (this.style.Section.line.width)] + ]; + this.createModel(points); + } else if (type === '02') { // 单侧分割符 + const points = [ + [model.point.x + model.drict * (this.style.Section.line.width), model.point.y - (this.style.Section.line.width * 1.5)], + [model.point.x, model.point.y - (this.style.Section.line.width * 1.5)], + [model.point.x, model.point.y + (this.style.Section.line.width * 1.5)] + ]; + this.createModel(points); + } else if (type === '03') { // 尽头分隔符 + const points = [ + [model.point.x + model.drict * (this.style.Section.line.width) * 1.2, model.point.y - (this.style.Section.line.width * 1.2)], + [model.point.x, model.point.y - (this.style.Section.line.width * 1.2)], + [model.point.x, model.point.y + (this.style.Section.line.width * 1.2)], + [model.point.x + model.drict * (this.style.Section.line.width) * 1.2, model.point.y + (this.style.Section.line.width * 1.2)] + ]; + const lineWidth = this.style.Section.separator.endWidth; + const stroke = this.style.Section.separator.endColor; + this.createModel(points, lineWidth, stroke); + } else if (type === '04') { // 侵限分隔符 + this.createCircle(); } } diff --git a/src/jmap/shape/Section/index.js b/src/jmap/shape/Section/index.js index da445c345..918478b97 100644 --- a/src/jmap/shape/Section/index.js +++ b/src/jmap/shape/Section/index.js @@ -4,7 +4,7 @@ import ERelease from './ERelease'; // 线段 (共有) import ELimitLines from './ELimitLines'; // 区段限速 (私有) import ELines from './ELines'; // 创建多线条 曲线 (私有) import ESeparator from './ESeparator'; // 分隔符 (私有) -import EAxle from './EAxle'; // 创建计轴 (私有) +import { EAxle } from './EAxle'; // 创建计轴 (私有) import JTriangle from '../../utils/JTriangle'; /** 区段*/ @@ -14,7 +14,7 @@ export default class Section extends Group { this._code = _code; this._type = _type; this.zlevel = zlevel; - this.z = model.layer || 5; + this.z = 5; this.model = model; this.state = state; this.style = style; @@ -32,6 +32,7 @@ export default class Section extends Group { model.logicSectionNum.length == 1 && model.logicSectionNum[0] == 0) || model.type === '02') { this.createSection(); // 创建区段 + this.creatRelease(); // 创建延时释放 this.createSeparator(); // 创建分隔符 if (model.type === '01') { this.createAxles(); // 创建计轴 @@ -49,19 +50,22 @@ export default class Section extends Group { this.section = new ELines({ zlevel: this.zlevel, z: this.z, - progressive: 1, isSwitchSection: model.isSwitchSection, isCurve: model.isCurve, points: model.points, style: style }); - // 创建延时释放 - const traingle = new JTriangle(model.points[0], model.points[model.points.length - 1]); + this.add(this.section); + } + // 创建延时释放 (需要在创建) + creatRelease() { + const model = this.model; + const style = this.style; + const traingle = new JTriangle(model.points[0], model.points[model.points.length - 1]); this.release = new ERelease({ - zlevel: model.zlevel, - progressive: 6, + zlevel: this.zlevel, z: this.z, shape: { x1: model.points[0].x + traingle.getCos(traingle.absz / 3), @@ -69,47 +73,51 @@ export default class Section extends Group { x2: model.points[0].x + traingle.getCos(traingle.absz / 3 * 2), y2: model.points[0].y + traingle.getSin(traingle.absz / 3 * 2) }, - lineWidth: style.Section.sectionWidth, - stroke: style.Section.sectionSpareColor + lineWidth: style.Section.line.width, + stroke: style.Section.line.spareColor }); - let x = traingle.drictx * (style.Section.sectionSpeedLimitDistance) * traingle.getSinRate(); - let y = traingle.dricty * (style.Section.sectionSpeedLimitDistance) * traingle.getCosRate(); + this.add(this.release); + } + + // 创建限速线 (需要在创建) + creatSpeedLimit() { + const model = this.model; + const style = this.style; + const traingle = new JTriangle(model.points[0], model.points[model.points.length - 1]); + let x = traingle.drictx * (style.Section.speedLimit.Distance) * traingle.getSinRate(); + let y = traingle.dricty * (style.Section.speedLimit.Distance) * traingle.getCosRate(); if (x == Infinity) { x = 0; } if (y == Infinity) { y = 0; } - - // 创建限速线 - this.speedLimitLeft = new ELimitLines({ - zlevel: this.zlevel, - z: this.z, - progressive: 5, - position: [x, -y], - isCurve: model.isCurve, - points: model.points, - isSwitchSection: model.isSwitchSection, - relSwitchCode: model.relSwitchCode, - style: style - }); - - this.speedLimitRight = new ELimitLines({ - zlevel: this.zlevel, - z: this.z, - progressive: 5, - position: [-x, y], - isCurve: model.isCurve, - points: model.points, - isSwitchSection: model.isSwitchSection, - relSwitchCode: model.relSwitchCode, - style: style - }); - - this.add(this.section); - this.add(this.release); + if (!this.speedLimitLeft && !this.speedLimitRight) { + this.speedLimitLeft = new ELimitLines({ + zlevel: this.zlevel, + z: this.z, + position: [x, -y], + style: style, + switch: model.switch, + isSwitchSection: model.isSwitchSection, + relSwitchCode: model.relSwitchCode, + isCurve: model.isCurve, // 是否曲线 + points: model.points + }); + this.speedLimitRight = new ELimitLines({ + zlevel: this.zlevel, + z: this.z, + position: [-x, y], + style: style, + switch: model.switch, + isSwitchSection: model.isSwitchSection, + relSwitchCode: model.relSwitchCode, + isCurve: model.isCurve, // 是否曲线 + points: model.points + }); + } this.add(this.speedLimitLeft); this.add(this.speedLimitRight); } - /** 创建区段名称*/ + // 创建区段名称 createSectionText() { const model = this.model; const style = this.style; @@ -123,22 +131,22 @@ export default class Section extends Group { let tempx = x; let tempy = y; - if (style.Section.sectionTextPosition == 1) { - tempy = tempy - style.textFontSize; - } else if (style.Section.sectionTextPosition == -1) { - tempy = tempy + style.textFontSize; - } else if (style.Section.sectionTextPosition == 0) { + if (style.Section.text.position == 1) { + tempy = tempy - style.Section.text.fontSize; + } else if (style.Section.text.position == -1) { + tempy = tempy + style.Section.text.fontSize; + } else if (style.Section.text.position == 0) { // 根据列车上下行进行坐标偏移 const traingle = new JTriangle(model.points[0], model.points[model.points.length - 1]); if (model.trainPosType === '01') { - tempy -= (style.Section.sectionWidth * 1.5); + tempy -= (style.Section.line.width * 1.5); if (model.type === '01') { - tempy += traingle.getCos(style.textFontSize * 0.8 + style.nameDistance) - style.textFontSize * 2; + tempy += traingle.getCos(style.Section.text.fontSize * 0.8 + style.nameDistance) - style.Section.text.fontSize * 2; } } else { - tempy += (style.Section.sectionWidth * 1.5); + tempy += (style.Section.line.width * 1.5); if (model.type === '01') { - tempy -= traingle.getCos(style.textFontSize * 0.8 + style.nameDistance) - style.textFontSize * 2; + tempy -= traingle.getCos(style.Section.text.fontSize * 0.8 + style.nameDistance) - style.Section.text.fontSize * 2; } } } @@ -148,25 +156,27 @@ export default class Section extends Group { // 如果不是逻辑区段,让名称和区段保持点距离 const traingle = new JTriangle(model.points[0], model.points[model.points.length - 1]); if (model.type === '01') { - tempx += traingle.getSin(style.textFontSize * 0.8 + style.nameDistance); + tempx += traingle.getSin(style.Section.text.fontSize * 0.8 + style.nameDistance); } } // 创建区段名称 - const fontSize = style.type == '02' ? style.textFontSize + 2 : style.textFontSize; + const fontSize = model.type == '02' ? style.Section.text.fontSize + 2: style.Section.text.fontSize; this.sectionText = new ETextName({ - _subType: 'Text', zlevel: this.zlevel, z: this.z + 6, + style: this.style, + silent: false, x: tempx, y: tempy, + fontWeight: 'bold', + fontSize: fontSize, + fontFamily: style.textFontFormat, text: model.name, - textFont: fontSize + 'px ' + style.textFontFormat, - textFill: style.textFontColor, - textAlign: 'center', - textPosition: 'inside', - textVerticalAlign: 'middle', - style: this.style + textFill: style.Section.text.fontColor, + textAlign: style.Section.text.textAlign, + textPosition: style.Section.text.textPosition, + textVerticalAlign: style.Section.text.textVerticalAlign }); this.add(this.sectionText); } @@ -187,11 +197,13 @@ export default class Section extends Group { z: 6, x: tempx + model.standTrackNamePosition.x, y: tempy + model.standTrackNamePosition.y, + fontWeight: 'bold', + fontSize: style.Section.text.fontSize, + fontFamily: style.textFontFormat, text: model.standTrackName, - textFont: style.textFontSize + 'px ' + style.textFontFormat, - textFill: style.textFontColor, - textAlign: 'center', - textPosition: 'inside', + textFill: style.Section.text.fontColor, + textAlign: style.Section.text.textAlign, + textPosition: style.Section.text.textPosition, style: this.style }); // 添加视图 @@ -205,12 +217,14 @@ export default class Section extends Group { zlevel: this.zlevel, z: 6, x: x + model.reentryTrackNamePosition.x, - y: y + model.reentryTrackNamePosition.y + style.nameDistance + style.textFontSize, + y: y + model.reentryTrackNamePosition.y + style.nameDistance + style.Section.text.fontSize, + fontWeight: 'bold', + fontSize: style.Section.text.fontSize, + fontFamily: style.textFontFormat, text: model.reentryTrackName, - textFont: style.textFontSize + 'px ' + style.textFontFormat, - textFill: style.textFontColor, - textAlign: 'center', - textPosition: 'inside', + textFill: style.Section.text.fontColor, + textAlign: style.Section.text.textAlign, + textPosition: style.Section.text.textPosition, style: this.style }); // 添加视图 @@ -224,12 +238,14 @@ export default class Section extends Group { zlevel: this.zlevel, z: 6, x: x + model.transferTrackNamePosition.x, - y: y + model.transferTrackNamePosition.y + style.nameDistance + style.textFontSize * 2, + y: y + model.transferTrackNamePosition.y + style.nameDistance + style.Section.text.fontSize * 2, + fontWeight: 'bold', + fontSize: style.Section.text.fontSize, + fontFamily: style.textFontFormat, text: model.transferTrackName, - textFont: style.textFontSize + 'px ' + style.textFontFormat, - textFill: style.textFontColor, - textAlign: 'center', - textPosition: 'inside', + textFill: style.Section.text.fontColor, + textAlign: style.Section.text.textAlign, + textPosition: style.Section.text.textPosition, style: this.style }); // 添加视图 @@ -244,11 +260,13 @@ export default class Section extends Group { z: 6, x: x + model.destinationCodePoint.x, y: y + model.destinationCodePoint.y, + fontWeight: 'bold', + fontSize: style.Section.text.fontSize, + fontFamily: style.textFontFormat, text: model.destinationCode, - textFont: style.textFontSize + 'px ' + style.textFontFormat, textFill: style.destinationTextFontColor, - textAlign: 'center', - textPosition: 'inside', + textAlign: style.Section.text.textAlign, + textPosition: style.Section.text.textPosition, style: this.style }); // 添加视图 @@ -257,7 +275,7 @@ export default class Section extends Group { } } - /** 创建计轴*/ + // 创建计轴 (需要在创建) createAxles() { const model = this.model; const style = this.style; @@ -267,54 +285,78 @@ export default class Section extends Group { if (model && style && model.axleShow && model.points && model.points.length > 1) { traingle = new JTriangle(model.points[0], model.points[1]); this.lUpAxle = new EAxle({ - style: style, - progressive: 4, zlevel: this.zlevel, - point: { - x: model.points[0].x, - y: model.points[0].y + z: this.z + 5, // 层级大于道岔z 否则会压住显示完整 + shape: { + point: { + x: model.points[0].x, + y: model.points[0].y + }, + drictx: 1, + dricty: -1, + traingle: traingle, + style: style }, - drictx: 1, - dricty: -1, - traingle: traingle + style: { + GBaseLineWidth: 1, + stroke: style.Section.axle.color + } }); this.lBottomAxle = new EAxle({ - style: style, - progressive: 4, zlevel: this.zlevel, - point: { - x: model.points[0].x, - y: model.points[0].y + z: this.z + 5, // 层级大于道岔z 否则会压住显示完整 + shape: { + point: { + x: model.points[0].x, + y: model.points[0].y + }, + drictx: 1, + dricty: 1, + traingle: traingle, + style: style }, - drictx: 1, - dricty: 1, - traingle: traingle + style: { + GBaseLineWidth: 1, + stroke: style.Section.axle.color + } }); traingle = new JTriangle(model.points[model.points.length - 2], model.points[model.points.length - 1]); this.rUpAxle = new EAxle({ - style: style, - progressive: 4, zlevel: this.zlevel, - point: { - x: model.points[model.points.length - 1].x, - y: model.points[model.points.length - 1].y + z: this.z + 5, // 层级大于道岔z 否则会压住显示完整 + shape: { + point: { + x: model.points[model.points.length - 1].x, + y: model.points[model.points.length - 1].y + }, + drictx: -1, + dricty: -1, + traingle: traingle, + style: style }, - drictx: -1, - dricty: -1, - traingle: traingle + style: { + GBaseLineWidth: 1, + stroke: style.Section.axle.color + } }); this.rBottomAxle = new EAxle({ - style: style, - progressive: 4, zlevel: this.zlevel, - point: { - x: model.points[model.points.length - 1].x, - y: model.points[model.points.length - 1].y + z: this.z + 5, // 层级大于道岔z 否则会压住显示完整 + shape: { + point: { + x: model.points[model.points.length - 1].x, + y: model.points[model.points.length - 1].y + }, + drictx: -1, + dricty: 1, + traingle: traingle, + style: style }, - drictx: -1, - dricty: 1, - traingle: traingle + style: { + GBaseLineWidth: 1, + stroke: style.Section.axle.color + } }); this.add(this.lUpAxle); @@ -324,7 +366,7 @@ export default class Section extends Group { } } - /** 创建分隔符*/ + // 创建分隔符 (内层需要在创建) createSeparator() { const model = this.model; const style = this.style; @@ -335,7 +377,6 @@ export default class Section extends Group { traingle = new JTriangle(model.points[0], model.points[1]); this.lPartition = new ESeparator({ style: style, - progressive: 2, zlevel: this.zlevel, traingle: traingle, point: { @@ -350,7 +391,6 @@ export default class Section extends Group { traingle = new JTriangle(model.points[model.points.length - 2], model.points[model.points.length - 1]); this.rPartition = new ESeparator({ style: style, - progressive: 2, zlevel: this.zlevel, traingle: traingle, point: { @@ -381,13 +421,17 @@ export default class Section extends Group { this.section.stopAnimation(true); this.section.setStyle({ fill: this.style.backgroundColor, - stroke: this.style.Section.sectionSpareColor, - lineWidth: this.style.Section.sectionWidth + stroke: this.style.Section.line.spareColor, + lineWidth: this.style.Section.line.width }); - this.release.hide(); - this.speedLimitLeft.hide(); - this.speedLimitRight.hide(); + if (this.release) { + this.release.hide(); + } + if (this.speedLimitLeft && this.speedLimitRight) { + this.remove(this.speedLimitLeft); + this.remove(this.speedLimitRight); + } } } @@ -395,8 +439,8 @@ export default class Section extends Group { undefine() { if (this.section) { this.section.setStyle({ - stroke: this.style.Section.sectionUndefinedColor, - lineWidth: this.style.Section.sectionWidth + stroke: this.style.Section.line.undefinedColor, + lineWidth: this.style.Section.line.width }); } } @@ -405,8 +449,8 @@ export default class Section extends Group { spare() { if (this.section) { this.section.setStyle({ - stroke: this.style.Section.sectionSpareColor, - lineWidth: this.style.Section.sectionWidth + stroke: this.style.Section.line.spareColor, + lineWidth: this.style.Section.line.width }); } } @@ -415,8 +459,8 @@ export default class Section extends Group { communicationOccupied() { if (this.section) { this.section.setStyle({ - stroke: this.style.Section.sectionCommunicationOccupiedColor, - lineWidth: this.style.Section.sectionWidth + this.style.Section.sectionBeyondWidth + stroke: this.style.Section.line.communicationOccupiedColor, + lineWidth: this.style.Section.line.width + this.style.Section.line.beyondWidth }); } } @@ -425,8 +469,8 @@ export default class Section extends Group { unCommunicationOccupied() { if (this.section) { this.section.setStyle({ - stroke: this.style.Section.sectionUnCommunicationOccupiedColor, - lineWidth: this.style.Section.sectionWidth + this.style.Section.sectionBeyondWidth + stroke: this.style.Section.line.unCommunicationOccupiedColor, + lineWidth: this.style.Section.line.width + this.style.Section.line.beyondWidth }); } } @@ -435,8 +479,8 @@ export default class Section extends Group { routeLock() { if (this.section) { this.section.setStyle({ - stroke: this.style.Section.sectionRouteLockColor, - lineWidth: this.style.Section.sectionWidth + this.style.Section.sectionBeyondWidth + stroke: this.style.Section.line.routeLockColor, + lineWidth: this.style.Section.line.width + this.style.Section.line.beyondWidth }); } } @@ -445,8 +489,8 @@ export default class Section extends Group { block() { if (this.section) { this.section.setStyle({ - stroke: this.style.Section.sectionBlockColor, - lineWidth: this.style.Section.sectionWidth + this.style.Section.sectionBeyondWidth + stroke: this.style.Section.line.blockColor, + lineWidth: this.style.Section.line.width + this.style.Section.line.beyondWidth }); } } @@ -455,8 +499,8 @@ export default class Section extends Group { faultLock() { if (this.section) { this.section.setStyle({ - stroke: this.style.Section.sectionFaultLockColor, - lineWidth: this.style.Section.sectionWidth + this.style.Section.sectionBeyondWidth + stroke: this.style.Section.line.faultLockColor, + lineWidth: this.style.Section.line.width + this.style.Section.line.beyondWidth }); } } @@ -465,8 +509,8 @@ export default class Section extends Group { atcExcision() { if (this.section) { this.section.setStyle({ - stroke: this.style.Section.sectionAtcExcisionColor, - lineWidth: this.style.Section.sectionWidth + this.style.Section.sectionBeyondWidth + stroke: this.style.Section.line.atcExcisionColor, + lineWidth: this.style.Section.line.width + this.style.Section.line.beyondWidth }); } } @@ -477,7 +521,7 @@ export default class Section extends Group { this.atcExcision(); this.section.animateStyle(true, [ { time: 1000, styles: { stroke: this.style.backgroundColor } }, - { time: 2000, styles: { stroke: this.style.Section.sectionAtsExcisionColor, lineWidth: this.style.Section.sectionWidth + this.style.Section.sectionBeyondWidth } } + { time: 2000, styles: { stroke: this.style.Section.line.atsExcisionColor, lineWidth: this.style.Section.line.width + this.style.Section.line.beyondWidth } } ]); } } @@ -486,63 +530,63 @@ export default class Section extends Group { protectiveLock() { if (this.section) { this.section.setStyle({ - stroke: this.style.Section.sectionProtectiveLockColor, - lineWidth: this.style.Section.sectionWidth + this.style.Section.sectionBeyondWidth + stroke: this.style.Section.line.protectiveLockColor, + lineWidth: this.style.Section.line.width + this.style.Section.line.beyondWidth }); } } /** 延时释放 10*/ - timeRelease() { + async timeRelease() { + this.section.setStyle({ + stroke: this.style.Section.line.routeLockColor, + lineWidth: this.style.Section.line.width + this.style.Section.line.beyondWidth + }); + if (this.release) { - this.section.setStyle({ - stroke: this.style.Section.sectionRouteLockColor, - lineWidth: this.style.Section.sectionWidth + this.style.Section.sectionBeyondWidth - }); this.release.show(); - this.release.setStyle('lineWidth', this.style.Section.sectionWidth + this.style.Section.sectionBeyondWidth); - this.release.setStyle('stroke', this.style.Section.sectionRouteLockColor); - this.release.animateStyle(true) - .when(1000, { stroke: this.style.Section.sectionRouteLockColor }) - .when(2000, { stroke: this.style.Section.sectionTimeReleaseColor }) - .start(); + this.release.setStyle({ + stroke: this.style.Section.line.routeLockColor, + lineWidth: this.style.Section.line.width + this.style.Section.line.beyondWidth + }); + this.release.animateStyle(true, [ + { time: 1000, styles: { stroke: this.style.Section.line.routeLockColor } }, + { time: 2000, styles: { stroke: this.style.Section.line.timeReleaseColor } } + ]); } } /** 保护区段延时解锁 11*/ protectiveTimeRelease() { - if (this.release) { - this.section.setStyle({ - stroke: this.style.Section.sectionProtectiveLockColor, - lineWidth: this.style.Section.sectionWidth + this.style.Section.sectionBeyondWidth - }); - this.release.show(); - this.release.setStyle('lineWidth', this.style.Section.sectionWidth + this.style.Section.sectionBeyondWidth); - this.release.setStyle('stroke', this.style.Section.sectionProtectiveLockColor); - this.release.animateStyle(true) - .when(1000, { stroke: this.style.Section.sectionProtectiveLockColor }) - .when(2000, { stroke: this.style.Section.sectionProtectiveTimeReleaseColor }) - .start(); - } + this.section.setStyle({ + stroke: this.style.Section.line.protectiveLockColor, + lineWidth: this.style.Section.line.width + this.style.Section.line.beyondWidth + }); + this.release && this.release.show(); + this.release && this.release.setStyle({ + stroke: this.style.Section.line.protectiveLockColor, + lineWidth: this.style.Section.line.width + this.style.Section.line.beyondWidth + }); + this.release && this.release.animateStyle(true, [ + { time: 1000, styles: { stroke: this.style.Section.line.protectiveLockColor } }, + { time: 2000, styles: { stroke: this.style.Section.line.protectiveTimeReleaseColor } } + ]); } /** 区段切除*/ sectionCutOff() { - if (this.release) { - const lineWidth = this.style.Section.sectionWidth + (this.model.status != '01' ? this.style.Section.sectionBeyondWidth : 0); - this.section.animateStyle(true, [ - { time: 0, styles: { lineWidth: lineWidth } }, - { time: 1000, styles: { stroke: this.style.backgroundColor } }, - { time: 2000, styles: { lineWidth: lineWidth } } - ]); - } + const lineWidth = this.style.Section.line.width + (this.model.status != '01' ? this.style.Section.line.beyondWidth : 0); + this.section.animateStyle(true, [ + { time: 0, styles: { lineWidth: lineWidth } }, + { time: 1000, styles: { stroke: this.style.backgroundColor } }, + { time: 2000, styles: { lineWidth: lineWidth } } + ]); } /** 设置限速*/ setSpeedUpperLimit() { if (this.section) { - this.speedLimitLeft.show(); - this.speedLimitRight.show(); + this.creatSpeedLimit(); } } @@ -550,8 +594,9 @@ export default class Section extends Group { axleReset() { if (this.release) { this.release.show(); - this.release.setStyle({ - stroke: this.style.Section.sectionAxleResetColor + this.release && this.release.setStyle({ + stroke: this.style.Section.axle.resetColor, + fill: 'green' }); } } @@ -560,8 +605,8 @@ export default class Section extends Group { alxeFailure() { if (this.section) { this.section.setStyle({ - stroke: this.style.Section.sectionAxleFailure, - lineWidth: this.style.Section.sectionWidth + this.style.Section.sectionBeyondWidth + stroke: this.style.Section.axle.Failure, + lineWidth: this.style.Section.line.width + this.style.Section.line.beyondWidth }); } } @@ -569,7 +614,6 @@ export default class Section extends Group { /** 设置状态*/ setState(state) { this.recover(); - // state.status = '02'; switch (state.status) { case '00': /** 未定义*/ this.undefine(); @@ -621,7 +665,6 @@ export default class Section extends Group { if (state.cutOff) { this.sectionCutOff(); } - /** 是否限速*/ if (state.speedUpperLimit >= 0) { this.setSpeedUpperLimit(); @@ -631,12 +674,12 @@ export default class Section extends Group { /** 计算提示位置*/ getShapeTipPoint() { let rect = this.getBoundingRect(); - let distance = this.style.Section.sectionWidth / 2; + let distance = this.style.Section.line.width / 2; if (this.section) { rect = this.section.getBoundingRect(); if (this.model.type !== '02' && this.model.nameShow) { if (this.model.trainPosType == '01') { - distance = distance + this.style.nameDistance + this.style.textFontSize; + distance = distance + this.style.nameDistance + this.style.Section.text.fontSize; } } } diff --git a/src/jmap/shape/Signal/ESigPass.js b/src/jmap/shape/Signal/ESigAuto.js similarity index 62% rename from src/jmap/shape/Signal/ESigPass.js rename to src/jmap/shape/Signal/ESigAuto.js index ca1f0eeeb..ffb55db8a 100644 --- a/src/jmap/shape/Signal/ESigPass.js +++ b/src/jmap/shape/Signal/ESigAuto.js @@ -6,44 +6,53 @@ class ESigPass extends Group { constructor(model) { super(); this.model = model; - this._create(); + this.isNew = false; } _create() { - const model = this.model; - const style = this.model.style; - const rotation = model.drict != 1? 0 : Math.PI; - const point = arrows(model.x, model.y, style.Signal.signalSigPassWidth, style.Signal.signalR * 0.8); - this.arrows = new Polygon({ - zlevel: model.zlevel, - z: model.z, - rotation: rotation, - shape: { - points: point - }, - style: { - stroke: model.stroke, - lineWidth: model.lineWidth, - fill: model.fill - } - }); - this.add(this.arrows); + if (!this.isNew) { + const model = this.model; + const style = this.model.style; + const rotation = model.drict != 1? 0 : Math.PI; + const point = arrows(model.x, model.y, style.Signal.signalAutoWidth, style.Signal.lamp.signalR * 0.8); + + this.isNew = true; + this.arrows = new Polygon({ + zlevel: model.zlevel, + z: model.z, + rotation: rotation, + shape: { + points: point + }, + style: { + stroke: model.stroke, + lineWidth: model.lineWidth, + fill: model.fill + } + }); + this.add(this.arrows); + } } // 停止动画 animationRecover() { + this._create(); this.arrows.stopAnimation(false); } // 箭头颜色 setColor(color) { + this._create(); this.arrows.setStyle('fill', color); } // 箭头闪烁 arrowsAnimation() { + this._create(); + const style = this.model.style; const fill = this.arrows.style.Signal.fill; + this.arrows.animate(true) .when(1000, { fill: style.backgroundColor, stroke: style.style.backgroundColor }) .when(2000, { fill: fill, stroke: style.style.Signal.sidelineColor }) @@ -54,11 +63,13 @@ class ESigPass extends Group { // 隐藏 hide() { + this._create(); this.arrows.hide(); } // 显示 show() { + this._create(); this.arrows.show(); } } diff --git a/src/jmap/shape/Signal/ESigButton.js b/src/jmap/shape/Signal/ESigButton.js index 10a172d6a..edf334cca 100644 --- a/src/jmap/shape/Signal/ESigButton.js +++ b/src/jmap/shape/Signal/ESigButton.js @@ -8,97 +8,99 @@ class ESigButton extends Group { constructor(model) { super(); this.model = model; - this._create(); + this.isNew = false; } _create() { - const model = this.model; - const style = this.model.style; - const padding = 1; - const r = style.Signal.signalR * 0.8; + if (!this.isNew) { + const model = this.model; + const style = this.model.style; + const padding = 1; + const r = style.Signal.lamp.signalR * 0.8; - this.style = style; - this._subType = 'SignalButton'; + this.isNew = true; + this.sigNormalButtom = new Rect({ + zlevel: model.zlevel, + z: model.z, + _subType: 'SignalButton', + _val: '1', + shape: { + x: model.x - style.Signal.lamp.signalR, + y: model.y - r + r * model.posit, + width: style.Signal.lamp.signalR * 2, + height: style.Signal.lamp.signalR * 2 + }, + style: { + lineWidth: 0.2, + stroke: style.Signal.button.signalButtonDashColor, + fill: style.Signal.button.signalButtonColor + } + }); - this.sigNormalButtom = new Rect({ - zlevel: model.zlevel, - z: model.z, - _subType: this._subType, - _val: '1', - shape: { - x: model.x - style.Signal.signalR, - y: model.y - r + r * model.posit, - width: style.Signal.signalR * 2, - height: style.Signal.signalR * 2 - }, - style: { - lineWidth: 0.2, - stroke: style.Signal.signalButtonDashColor, - fill: style.Signal.signalButtonColor - } - }); + this.sigReentryButton = new Circle({ + zlevel: model.zlevel, + z: model.z, + _subType: 'SignalButton', + _val: '2', // 折返按钮 + shape: { + cx: model.x, + cy: model.y - 5 / 2 * r * model.posit, + r: style.Signal.lamp.signalR + }, + style: { + lineWidth: 0.2, + stroke: style.Signal.button.signalButtonDashColor, + fill: style.Signal.button.signalButtonColor + } + }); - this.sigReentryButton = new Circle({ - zlevel: model.zlevel, - z: model.z, - _subType: this._subType, - _val: '2', // 折返按钮 - shape: { - cx: model.x, - cy: model.y - 5 / 2 * r * model.posit, - r: style.Signal.signalR - }, - style: { - lineWidth: 0.2, - stroke: style.Signal.signalButtonDashColor, - fill: style.Signal.signalButtonColor - } - }); + this.sigNormalButtomDown = new Polyline({ + zlevel: model.zlevel, + z: model.z, + silent: true, + shape: { points: [ + [model.x - padding + r, this.sigNormalButtom.shape.y + padding], + [model.x + padding - r, this.sigNormalButtom.shape.y + padding], + [model.x + padding - r, this.sigNormalButtom.shape.y + padding * 2 + r] + ] }, + style: { + lineWidth: 0.8, + stroke: style.backgroundColor + } + }); - this.sigNormalButtomDown = new Polyline({ - zlevel: model.zlevel, - z: model.z, - silent: true, - shape: { points: [ - [model.x - padding + r, this.sigNormalButtom.shape.y + padding], - [model.x + padding - r, this.sigNormalButtom.shape.y + padding], - [model.x + padding - r, this.sigNormalButtom.shape.y + padding * 2 + r] - ] }, - style: { - lineWidth: 0.8, - stroke: style.backgroundColor - } - }); + this.sigReentryButtonDown = new Arc({ + zlevel: model.zlevel, + z: model.z, + silent: true, + shape: { + cx: this.sigReentryButton.shape.cx, + cy: this.sigReentryButton.shape.cy, + r: this.sigReentryButton.shape.r - padding, + startAngle: Math.PI * 8 / 5, + endAngle: Math.PI * 4 / 5, + clockwise: false + }, + style: { + lineWidth: 0.8, + stroke: style.backgroundColor + } + }); - this.sigReentryButtonDown = new Arc({ - zlevel: model.zlevel, - z: model.z, - silent: true, - shape: { - cx: this.sigReentryButton.shape.cx, - cy: this.sigReentryButton.shape.cy, - r: this.sigReentryButton.shape.r - padding, - startAngle: Math.PI * 8 / 5, - endAngle: Math.PI * 4 / 5, - clockwise: false - }, - style: { - lineWidth: 0.8, - stroke: style.backgroundColor - } - }); - - this.add(this.sigNormalButtom); - this.add(this.sigReentryButton); - this.hide(); + this.add(this.sigNormalButtom); + this.add(this.sigReentryButton); + this.hide(); + } } hide() { + this._create(); this.sigNormalButtom.hide(); this.sigReentryButton.hide(); } show() { + this._create(); this.sigNormalButtom.show(); this.sigReentryButton.show(); } diff --git a/src/jmap/shape/Signal/ESigDelay.js b/src/jmap/shape/Signal/ESigDelay.js index 776603d0c..133b3702d 100644 --- a/src/jmap/shape/Signal/ESigDelay.js +++ b/src/jmap/shape/Signal/ESigDelay.js @@ -5,43 +5,53 @@ class ESigDelay extends Group { constructor(model) { super(); this.model = model; - this._create(); + this.isNew = false; } _create() { - const model = this.model; - this.name = new Text({ - _subType: model._subType, - zlevel: model.zlevel, - z: model.z, - silent: model.silent || false, - style: { - x: model.x, - y: model.y, - text: model.text, - textFont: model.textFont, - textFill: model.textFill, - textAlign: model.textAlign, - textPosition: model.textPosition || 'inside', - textVerticalAlign: model.textVerticalAlign || null - } - }); - this.add(this.name); + if (!this.isNew) { + const model = this.model; + + this.isNew = true; + this.name = new Text({ + _subType: model._subType, + zlevel: model.zlevel, + z: model.z, + silent: model.silent || false, + style: { + x: model.x, + y: model.y, + fontWeight: model.fontWeight, + fontSize: model.fontSize, + fontFamily: model.fontFamily, + text: model.text, + textFill: model.textFill, + textAlign: model.textAlign, + textPosition: model.textPosition || 'inside', + textVerticalAlign: model.textVerticalAlign || null + } + }); + this.add(this.name); + } } setStyle(model) { + this._create(); this.name.setStyle(model); } setColor(color) { + this._create(); this.name.setStyle('textFill', color); } hide() { + this._create(); this.name.hide(); } show() { + this._create(); this.name.show(); } } diff --git a/src/jmap/shape/Signal/ESigLmap.js b/src/jmap/shape/Signal/ESigLamp.js similarity index 55% rename from src/jmap/shape/Signal/ESigLmap.js rename to src/jmap/shape/Signal/ESigLamp.js index ac1f2dcab..0153055b4 100644 --- a/src/jmap/shape/Signal/ESigLmap.js +++ b/src/jmap/shape/Signal/ESigLamp.js @@ -2,7 +2,7 @@ import Line from 'zrender/src/graphic/shape/Line'; import Arc from 'zrender/src/graphic/shape/Arc'; import Group from 'zrender/src/container/Group'; -class ESigLmap extends Group { +class ESigLamp extends Group { constructor(model) { super(); this.model = model; @@ -20,12 +20,12 @@ class ESigLmap extends Group { shape: { cx: model.x, cy: model.y, - r: style.Signal.signalR + r: style.Signal.lamp.signalR }, style: { - lineWidth: 0.4, + lineWidth: style.Signal.lamp.signalBorderWidth, fill: style.backgroundColor, - stroke: style.Signal.signalLampStandardColor + stroke: style.Signal.post.signalLampStandardColor } }); @@ -37,13 +37,13 @@ class ESigLmap extends Group { y: model.originY }, shape: { - x1: model.x + (style.Signal.signalR + 1) * Math.cos(Math.PI / 4), - y1: model.y + (style.Signal.signalR + 1) * Math.sin(Math.PI / 4), - x2: model.x - (style.Signal.signalR + 1) * Math.cos(Math.PI / 4), - y2: model.y - (style.Signal.signalR + 1) * Math.sin(Math.PI / 4) + x1: model.x + (style.Signal.lamp.signalR + 1) * Math.cos(Math.PI / 4), + y1: model.y + (style.Signal.lamp.signalR + 1) * Math.sin(Math.PI / 4), + x2: model.x - (style.Signal.lamp.signalR + 1) * Math.cos(Math.PI / 4), + y2: model.y - (style.Signal.lamp.signalR + 1) * Math.sin(Math.PI / 4) }, style: { - lineWidth: 1.5, + lineWidth: style.Signal.lamp.signalStopWidth, stroke: style.backgroundColor } }); @@ -56,13 +56,13 @@ class ESigLmap extends Group { y: model.originY }, shape: { - x1: model.x + (style.Signal.signalR + 1) * Math.cos(Math.PI / 4), - y1: model.y + (style.Signal.signalR + 1) * (Math.sin(Math.PI / 4) - Math.sqrt(2)), - x2: model.x - (style.Signal.signalR + 1) * Math.cos(Math.PI / 4), - y2: model.y - (style.Signal.signalR + 1) * (Math.sin(Math.PI / 4) - Math.sqrt(2)) + x1: model.x + (style.Signal.lamp.signalR + 1) * Math.cos(Math.PI / 4), + y1: model.y + (style.Signal.lamp.signalR + 1) * (Math.sin(Math.PI / 4) - Math.sqrt(2)), + x2: model.x - (style.Signal.lamp.signalR + 1) * Math.cos(Math.PI / 4), + y2: model.y - (style.Signal.lamp.signalR + 1) * (Math.sin(Math.PI / 4) - Math.sqrt(2)) }, style: { - lineWidth: 1.5, + lineWidth: style.Signal.lamp.signalStopWidth, stroke: style.backgroundColor } }); @@ -86,4 +86,4 @@ class ESigLmap extends Group { } } -export default ESigLmap; +export default ESigLamp; diff --git a/src/jmap/shape/Signal/ESigName.js b/src/jmap/shape/Signal/ESigName.js index 785cf1aac..0466a0d4b 100644 --- a/src/jmap/shape/Signal/ESigName.js +++ b/src/jmap/shape/Signal/ESigName.js @@ -11,15 +11,16 @@ class ESigName extends Group { _create() { const model = this.model; this.name = new Text({ - _subType: model._subType, zlevel: model.zlevel, z: model.z, silent: model.silent, style: { x: model.x, y: model.y, + fontWeight: model.fontWeight, + fontSize: model.fontSize, + fontFamily: model.fontFamily, text: model.text, - textFont: model.textFont, textFill: model.textFill, textAlign: model.textAlign, textPosition: model.textPosition || 'inside', diff --git a/src/jmap/shape/Signal/ESigPost.js b/src/jmap/shape/Signal/ESigPost.js index 59eced36a..d844546b0 100644 --- a/src/jmap/shape/Signal/ESigPost.js +++ b/src/jmap/shape/Signal/ESigPost.js @@ -17,13 +17,13 @@ class ESigPost extends Group { z: model.z, shape: { points: [ - [model.x, model.y + style.Signal.signalR * 1.2], - [model.x, model.y - style.Signal.signalR * 1.2] + [model.x, model.y + style.Signal.lamp.signalR * 1.2], + [model.x, model.y - style.Signal.lamp.signalR * 1.2] ] }, style: { - lineWidth: style.Signal.signalLampStandardWidth, - stroke: style.Signal.signalLampStandardColor + lineWidth: style.Signal.post.signalLampStandardWidth, + stroke: style.Signal.post.signalLampStandardColor } }); @@ -33,12 +33,12 @@ class ESigPost extends Group { shape: { points: [ [model.x, model.y], - [model.x + model.drict * style.Signal.signalR * 1.2, model.y] + [model.x + model.drict * style.Signal.lamp.signalR * 1.2, model.y] ] }, style: { - lineWidth: style.Signal.signalLampStandardWidth, - stroke: style.Signal.signalLampStandardColor + lineWidth: style.Signal.post.signalLampStandardWidth, + stroke: style.Signal.post.signalLampStandardColor } }); @@ -53,12 +53,12 @@ class ESigPost extends Group { const style = this.model.style; if (type === '01') { return { - x: model.x + model.drict * style.Signal.signalR * 3 / 2, + x: model.x + model.drict * style.Signal.lamp.signalR * 3 / 2, y: model.y }; } else { return { - x: this.hor.shape.points[1][0] + model.drict * style.Signal.signalR, + x: this.hor.shape.points[1][0] + model.drict * style.Signal.lamp.signalR, y: this.hor.shape.points[1][1] }; } diff --git a/src/jmap/shape/Signal/ESigRoute.js b/src/jmap/shape/Signal/ESigRoute.js index 2321d6638..797e8ee9a 100644 --- a/src/jmap/shape/Signal/ESigRoute.js +++ b/src/jmap/shape/Signal/ESigRoute.js @@ -6,34 +6,41 @@ class ESigDrict extends Group { constructor(model) { super(); this.model = model; - this._create(); + this.isNew = false; } _create() { - const model = this.model; - const style = this.model.style; - this.sigDrict = new Polygon({ - zlevel: model.zlevel, - z: model.z, - shape: { - points: triangular(model.x, model.y, model.drict, style.Signal.signalR) - }, - style: { - stroke: style.backgroundColor, - lineWidth: 0.5, - fill: style.Signal.signalLampYellowColor - } - }); - this.add(this.sigDrict); + if (!this.isNew) { + const model = this.model; + const style = this.model.style; + + this.isNew = true; + this.sigDrict = new Polygon({ + zlevel: model.zlevel, + z: model.z, + shape: { + points: triangular(model.x, model.y, model.drict, style.Signal.lamp.signalR) + }, + style: { + stroke: style.backgroundColor, + lineWidth: 0.5, + fill: style.Signal.route.signalRouteColor + } + }); + + this.add(this.sigDrict); + } } // 隐藏 hide() { + this._create(); this.sigDrict.hide(); } // 显示 show() { + this._create(); this.sigDrict.show(); } } diff --git a/src/jmap/shape/Signal/index.js b/src/jmap/shape/Signal/index.js index 20596c112..21633b993 100644 --- a/src/jmap/shape/Signal/index.js +++ b/src/jmap/shape/Signal/index.js @@ -3,8 +3,8 @@ */ import ESigPost from './ESigPost'; -import ESigLmap from './ESigLmap'; -import ESigPass from './ESigPass'; +import ESigLamp from './ESigLamp'; +import ESigAuto from './ESigAuto'; import ESigRoute from './ESigRoute'; import ESigButton from './ESigButton'; import ESigDelay from './ESigDelay'; @@ -42,20 +42,20 @@ class Signal extends Group { drict: drict, type: model.lampPostType, x: model.position.x, - y: model.position.y + posit * (style.Signal.signalDistance + style.Section.sectionWidth + style.Signal.signalR) + y: model.position.y + posit * (style.Signal.signalDistance + style.Section.line.width + style.Signal.lamp.signalR) }); // 信号灯 const endPoint = this.sigPost.getLampPosition(model.lampPostType); this.lamps = []; for (let i = 0; i < this.count; i++) { - const lamp = new ESigLmap({ + const lamp = new ESigLamp({ zlevel: this.zlevel, z: this.z, style: style, index: i + 1, drict: drict, - x: endPoint.x + i * drict * style.Signal.signalR * 2, + x: endPoint.x + i * drict * style.Signal.lamp.signalR * 2, y: endPoint.y, originX: model.position.x, originY: model.position.y @@ -66,25 +66,28 @@ class Signal extends Group { // 信号机名称 const sigNameX = model.position.x + model.namePosition.x; - const sigNameY = model.position.y + posit * (style.Signal.signalDistance + style.Section.sectionWidth + style.Signal.signalR * 2 + model.namePosition.y); + const sigNameY = model.position.y + posit * (style.Signal.signalDistance + style.Section.line.width + style.Signal.lamp.signalR * 2 + model.namePosition.y); this.sigName = new ESigName({ zlevel: this.zlevel, z: this.z, silent: false, + isNoRotation: style.Signal.text.isNoRotation, style: style, x: sigNameX, y: sigNameY, text: model.name, - textFont: `bold ${style.Signal.signalTextFontSize} px ${style.textFontFormat}`, - textFill: style.Signal.signalTextGreen, + fontWeight: 'bold', + fontSize: style.Signal.text.signalTextFontSize, + fontFamily: style.textFontFormat, + textFill: style.Signal.text.signalDefaultTextColor, textAlign: 'middle', textVerticalAlign: posit == 1 ? 'top' : 'bottom' }); // 自动进路 - const sigRouteH = style.Signal.signalSigRouteDirection ? this.count * style.Signal.signalR * 2 : -style.Signal.signalR * 2; - const sigRouteX = endPoint.x + (style.Signal.signalSigRouteOffset.x + sigRouteH) * drict; - const sigRouteY = endPoint.y + (style.Signal.signalSigRouteOffset.y); + const sigRouteH = style.Signal.route.signalRouteDirection ? this.count * style.Signal.lamp.signalR * 2 : -style.Signal.lamp.signalR * 2; + const sigRouteX = endPoint.x + (style.Signal.route.signalRouteOffset.x + sigRouteH) * drict; + const sigRouteY = endPoint.y + (style.Signal.route.signalRouteOffset.y); this.sigRoute = new ESigRoute({ zlevel: this.zlevel, z: this.z, @@ -95,36 +98,38 @@ class Signal extends Group { }); // 自动通过 - const sigPassH = style.Signal.signalSigPassDirection ? this.count * style.Signal.signalR * 2 : -style.Signal.signalR * 2; - const sigPassX = endPoint.x + (style.Signal.signalSigPassOffset.x + sigPassH) * drict; - const sigPassY = endPoint.y + (style.Signal.signalSigPassOffset.y); - this.sigPass = new ESigPass({ + const sigAutoH = style.Signal.auto.signalAutoDirection ? this.count * style.Signal.lamp.signalR * 2 : -style.Signal.lamp.signalR * 2; + const sigAutoX = endPoint.x + (style.Signal.auto.signalAutoOffset.x + sigAutoH) * drict; + const sigAutoY = endPoint.y + (style.Signal.auto.signalAutoOffset.y); + this.sigAuto = new ESigAuto({ zlevel: this.zlevel, z: this.z, style: style, count: this.count, drict: drict, - x: sigPassX, - y: sigPassY, - width: style.Signal.signalSigPassWidth, - fill: style.Signal.signalLampGreenColor, + x: sigAutoX, + y: sigAutoY, + width: style.Signal.signalAutoWidth, + fill: style.Signal.lamp.signalAutoRoute, lineWidth: 0.6, stroke: style.sidelineColor }); // 延迟解锁 - const sigDelayH = style.Signal.signalSigDelayDirection ? this.count * style.Signal.signalR * 2 : -style.Signal.signalR * 2; - const sigDelayX = endPoint.x + (style.Signal.signalSigDelayOffset.x + sigDelayH) * drict; - const sigDelayY = endPoint.y - (style.Signal.signalSigDelayOffset.y) * posit; + const sigDelayH = style.Signal.delay.signalDelayDirection ? this.count * style.Signal.lamp.signalR * 2 : -style.Signal.lamp.signalR * 2; + const sigDelayX = endPoint.x + (style.Signal.delay.signalDelayOffset.x + sigDelayH) * drict; + const sigDelayY = endPoint.y - (style.Signal.delay.signalDelayOffset.y) * posit; this.sigDelay = new ESigDelay({ zlevel: this.zlevel, z: this.z, style: style, x: sigDelayX, y: sigDelayY, + fontWeight: 'bold', + fontSize: style.Signal.delay.signalDelayTextFontSize, + fontFamily: style.textFontFormat, text: this.state.delayCount || '0', - textFont: `bold ${style.Signal.signalDelayTextFontSize} px ${style.textFontFormat}`, - textFill: style.Signal.signalTextRed, + textFill: style.Signal.delay.signalDelayTextColor, textAlign: drict > 0 ? 'right' : 'left', textVerticalAlign: 'middle' }); @@ -137,13 +142,13 @@ class Signal extends Group { posit: posit, show: model.buttonShow, x: model.buttonPosition.x, - y: model.buttonPosition.y - posit * (style.Signal.signalButtonDistance + style.Signal.signalR * 2) + y: model.buttonPosition.y - posit * (style.Signal.button.signalButtonDistance + style.Signal.lamp.signalR * 2) }); this.add(this.sigPost); this.lamps.forEach(lamp => { this.add(lamp); }); this.add(this.sigName); - this.add(this.sigPass); + this.add(this.sigAuto); this.add(this.sigRoute); this.add(this.sigDelay); // this.add(this.sigButton); @@ -155,7 +160,7 @@ class Signal extends Group { device.eachChild(item => { if (item instanceof Group) { this.transformRotation(item); - } else { + } else if (item && item.model && item.model.isNoRotation) { item.origin = [this.model.position.x, this.model.position.y]; item.rotation = -Math.PI / 180 * Number(this.model.rotate); item.dirty(); @@ -169,13 +174,13 @@ class Signal extends Group { if (this.count === 1) { if (this.model.useType === '05') { /** 单灯 调车信号机*/ - this.lamps[0] && this.lamps[0].setColor(this.style.Signal.signalLampBlueColor); + this.lamps[0] && this.lamps[0].setColor(this.style.Signal.lamp.signalLampBlueColor); } else { /** 单灯 出站信号机 */ /** 单灯 阻挡信号机*/ /** 单灯 阻挡兼调车信号 */ /** 单灯 列兼调信号机 */ - this.lamps[0] && this.lamps[0].setColor(this.style.Signal.signalLampRedColor); + this.lamps[0] && this.lamps[0].setColor(this.style.Signal.lamp.signalLampRedColor); } } } @@ -185,7 +190,7 @@ class Signal extends Group { if (this.count === 1) { /** 单灯 出站信号机*/ /** 单灯 阻隔信号机*/ - this.lamps[0] && this.lamps[0].setColor(this.style.Signal.signalLampGreenColor); + this.lamps[0] && this.lamps[0].setColor(this.style.Signal.lamp.signalLampGreenColor); } } @@ -193,7 +198,7 @@ class Signal extends Group { trainRoute() { if (this.count === 1) { /** 单灯 列兼调信号*/ - this.lamps[0] && this.lamps[0].setColor(this.style.Signal.signalLampYellowColor); + this.lamps[0] && this.lamps[0].setColor(this.style.Signal.lamp.signalLampYellowColor); } } @@ -202,7 +207,7 @@ class Signal extends Group { if (this.count === 1) { /** 单灯 列兼调信号*/ /** 单灯 阻挡兼调车信号*/ - this.lamps[0] && this.lamps[0].setColor(this.style.Signal.signalLampWhiteColor); + this.lamps[0] && this.lamps[0].setColor(this.style.Signal.lamp.signalLampWhiteColor); } } @@ -213,8 +218,8 @@ class Signal extends Group { // 封锁 block() { - this.lamps[0] && this.lamps[0].setColor(this.style.Signal.signalLampRedColor); - this.sigName.setColor(this.style.Signal.sectionBlockTextColor); + this.lamps[0] && this.lamps[0].setColor(this.style.Signal.lamp.signalLampRedColor); + this.sigName.setColor(this.style.Signal.signalTextBlockColor); } // 功能封锁 @@ -243,25 +248,25 @@ class Signal extends Group { // 设置自动进路模式状态类型 setAutoRouteOpen() { if (this.model.linkageAutoRouteShow) { - this.sigPass.show(); + this.sigAuto.show(); } else { - this.sigPass.hide(); + this.sigAuto.hide(); } this.recover(); - this.sigPass.setColor(this.style.Signal.signalLampGreenColor); + this.sigAuto.setColor(this.style.Signal.auto.signalAutoRoute); } // 信号机进路自动触发模式状态类型 setAutoAccessOpen() { if (this.model.atsAutoTriggerShow) { - this.sigPass.show(); + this.sigAuto.show(); } else { - this.sigPass.hide(); + this.sigAuto.hide(); } this.recover(); - this.sigPass.setColor(this.style.Signal.signalLampYellowColor); + this.sigAuto.setColor(this.style.Signal.auto.signalAutoTrigger); } // 设置自动信号模式状态类型 @@ -271,14 +276,14 @@ class Signal extends Group { // 隐藏自动信号和自动进路 setAutoClose() { - this.sigPass.hide(); - this.sigPass.setColor(this.style.backgroundColor); + this.sigAuto.hide(); + this.sigAuto.setColor(this.style.backgroundColor); this.sigRoute.hide(); } // 自动信号和自动进路开始动画 setAutoFlicker() { - this.sigPass.arrowsAnimation(); + this.sigAuto.arrowsAnimation(); } // 设置延时解锁 @@ -289,8 +294,8 @@ class Signal extends Group { // 恢复状态 recover() { this.sigDelay.hide(); - this.sigPass.animationRecover(); - this.sigName.setColor(this.style.Signal.signalTextGreen); + this.sigAuto.animationRecover(); + this.sigName.setColor(this.style.Signal.text.signalDefaultTextColor); } setState(state) { diff --git a/src/jmap/shape/Station/index.js b/src/jmap/shape/Station/index.js index 1b1b3deda..f6d88f7de 100644 --- a/src/jmap/shape/Station/index.js +++ b/src/jmap/shape/Station/index.js @@ -29,10 +29,12 @@ export default class Station extends Group { position: [0, 0], x: model.position.x, y: model.position.y, + fontWeight: 'bold', + fontSize: model.nameFont || 18, + fontFamily: style.textFontFormat, text: model.name, textAlign: 'middle', textVerticalAlign: 'top', - textFont: model.nameFont || '18px ' + style.textFontFormat, textFill: model.nameFontColor }); let direction = 1; @@ -45,10 +47,12 @@ export default class Station extends Group { position: [0, 0], x: model.position.x, y: model.position.y + ((parseInt(model.nameFont) + 2) * direction), + fontWeight: 'bold', + fontSize: model.kmPostFont || 18, + fontFamily: style.textFontFormat, text: model.kmPost, textAlign: 'middle', textVerticalAlign: 'top', - textFont: model.kmPostFont || '18px ' + style.textFontFormat, textFill: model.kmPostFontColor }); diff --git a/src/jmap/shape/StationControl/EArrow.js b/src/jmap/shape/StationControl/EArrow.js index edd1828d4..72e675607 100644 --- a/src/jmap/shape/StationControl/EArrow.js +++ b/src/jmap/shape/StationControl/EArrow.js @@ -13,8 +13,8 @@ class ESigAuto extends Group { const model = this.model; const style = this.model.style; const rotation = model.drict != 1? 0 : Math.PI; - const x = model.x + model.drict * (model.count * style.Signal.signalR + style.Signal.signalLampStandardWidth) * 2; - const y = model.y - style.Signal.signalLampStandardWidth; + const x = model.x + model.drict * (model.count * style.Signal.lamp.signalR + style.Signal.post.signalLampStandardWidth) * 2; + const y = model.y - style.Signal.post.signalLampStandardWidth; this.arrows = new Polygon({ zlevel: model.zlevel, diff --git a/src/jmap/shape/StationControl/ESingleControl.js b/src/jmap/shape/StationControl/ESingleControl.js index 781511ef3..3c8f78cc1 100644 --- a/src/jmap/shape/StationControl/ESingleControl.js +++ b/src/jmap/shape/StationControl/ESingleControl.js @@ -48,9 +48,11 @@ export default class ESingleControl extends Group { style: { x: model.point.x, y: model.point.y + model.style.StationControl.stationControlmodeR + model.style.nameDistance, + fontWeight: 'normal', + fontSize: model.style.textFontSize, + fontFamily: model.style.textFontFormat, text: model.context, textFill: model.style.textFontColor, - textFont: model.style.textFontSize + 'px ' + model.style.textFontFormat, textAlign: 'middle', textVerticalAlign: 'top' } diff --git a/src/jmap/shape/StationCounter/index.js b/src/jmap/shape/StationCounter/index.js index 65c3cba98..61998e00a 100644 --- a/src/jmap/shape/StationCounter/index.js +++ b/src/jmap/shape/StationCounter/index.js @@ -29,11 +29,13 @@ export default class StationCounter extends Group { style: { x: model.position.x, y: model.position.y, + fontWeight: 'normal', + fontSize: style.textFontSize, + fontFamily: style.textFontFormat, text: model.val, textFill: style.stationCounterTextColor, textAlign: 'middle', - textStrokeWidth: 1, - textFont: style.textFontSize + 'px ' + style.textFontFormat + textStrokeWidth: 1 } }); @@ -64,12 +66,14 @@ export default class StationCounter extends Group { style: { x: model.position.x, y: model.position.y + this.rect.width + this.vPadding + style.textFontSize + style.nameDistance, + fontWeight: 'bold', + fontSize: style.textFontSize, + fontFamily: style.textFontFormat, text: model.name, textFill: style.stationCounterTextColor, textAlign: 'middle', textVerticalAlign: 'top', - textStrokeWidth: 1, - textFont: style.textFontSize + 'px ' + style.textFontFormat + textStrokeWidth: 1 } }); this.add(this.counterName); diff --git a/src/jmap/shape/StationDelayUnlock/index.js b/src/jmap/shape/StationDelayUnlock/index.js index f5e14ad1f..96ff6169f 100644 --- a/src/jmap/shape/StationDelayUnlock/index.js +++ b/src/jmap/shape/StationDelayUnlock/index.js @@ -29,10 +29,12 @@ export default class StationDelayUnlock extends Group { style: { x: model.position.x, y: model.position.y, + fontWeight: 'normal', + fontSize: model.textFont, + fontFamily: style.textFontFormat, text: model.deviceName + ' ', textFill: style.stationDelayUnlockTextColor, textStrokeWidth: 1, - textFont: model.textFont + 'px ' + style.textFontFormat, textAlign: 'left' } }); @@ -45,10 +47,12 @@ export default class StationDelayUnlock extends Group { style: { x: model.position.x, y: model.position.y + fontSize + style.stationDelayUnlockDistance, + fontWeight: 'normal', + fontSize: model.textFont, + fontFamily: style.textFontFormat, text: model.remainTime || '', textFill: style.stationDelayUnlockTextColor, textStrokeWidth: 1, - textFont: model.textFont + 'px ' + style.textFontFormat, textAlign: 'left' } }); diff --git a/src/jmap/shape/StationStand/EDetain.js b/src/jmap/shape/StationStand/EDetain.js index 9072e80f6..629286219 100644 --- a/src/jmap/shape/StationStand/EDetain.js +++ b/src/jmap/shape/StationStand/EDetain.js @@ -5,40 +5,47 @@ class EDetain extends Group { constructor(model) { super(); this.model = model; - 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.standDetainText, - textAlign: model.textAlign, - textVerticalAlign: model.textVerticalAlign, - fontSize: `${style.StationStand.standHeadFontSize} px ${style.textFontFormat}`, - textFill: style.StationStand.standCenterDetainTrainColor, - textStroke: style.backgroundColor - } - }); + if (!this.isNew) { + const model = this.model; + const style = this.model.style; - this.add(this.detain); + 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, + textAlign: model.textAlign, + textVerticalAlign: model.textVerticalAlign, + fontSize: `${style.StationStand.stand.headFontSize} px ${style.textFontFormat}`, + textFill: style.StationStand.detainCar.centerTrainColor, + textStroke: style.backgroundColor + } + }); + + this.add(this.detain); + } } setColor(color) { + this._create(); this.detain.setStyle('textFill', color); } hide() { + this._create(); this.detain.hide(); } show() { + this._create(); this.detain.show(); } } diff --git a/src/jmap/shape/StationStand/EJump.js b/src/jmap/shape/StationStand/EJump.js index fa3d09178..ef1f97cde 100644 --- a/src/jmap/shape/StationStand/EJump.js +++ b/src/jmap/shape/StationStand/EJump.js @@ -5,46 +5,51 @@ 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; + if (!this.isNew) { + 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, - text: model.name, - textFill: style.StationStand.standLevelTextColor, - textAlign: 'middle', - textFont: `${style.StationStand.standTextFontSize} px ${style.textFontFormat}` - } - }); + this.isNew = true; + this.jump = new Text({ + zlevel: model.zlevel, + z: model.z, + style: { + x: model.x, + y: model.y, + fontWeight: 'normal', + fontSize: style.StationStand.common.textFontSize, + fontFamily: style.textFontFormat, + text: model.name, + textFill: style.StationStand.level.textColor, + textAlign: 'middle' + } + }); - this.add(this.jump); + this.add(this.jump); + } } setName(val) { - this.jump.attr({ - style: { - text: val - } - }); + this._create(); + this.jump.setStyle('text', val); } setColor(color) { + this._create(); this.jump.setStyle('textFill', color); } hide() { + this._create(); this.jump.hide(); } show() { + this._create(); this.jump.show(); } } diff --git a/src/jmap/shape/StationStand/ELevel.js b/src/jmap/shape/StationStand/ELevel.js index b530633d1..e346f4093 100644 --- a/src/jmap/shape/StationStand/ELevel.js +++ b/src/jmap/shape/StationStand/ELevel.js @@ -5,46 +5,51 @@ class ELevel extends Group { constructor(model) { super(); this.model = model; - this._create(); + this.isNew = false; } _create() { - const model = this.model; - const style = this.model.style; + if (!this.isNew) { + const model = this.model; + const style = this.model.style; - this.level = new Text({ - zlevel: model.zlevel, - z: model.z, - style: { - x: model.x, - y: model.y, - text: model.name, - textFill: style.StationStand.standLevelTextColor, - textAlign: 'middle', - textFont: `${style.StationStand.standTextFontSize} px ${style.textFontFormat}` - } - }); + this.isNew = true; + this.level = new Text({ + zlevel: model.zlevel, + z: model.z, + style: { + x: model.x, + y: model.y, + fontWeight: 'normal', + fontSize: style.StationStand.common.textFontSize, + fontFamily: style.textFontFormat, + text: model.name, + textFill: style.StationStand.level.textColor, + textAlign: 'middle' + } + }); - this.add(this.level); + this.add(this.level); + } } setName(val) { - this.level.attr({ - style: { - text: val - } - }); + this._create(); + this.level.setStyle('text', val); } setColor(color) { + this._create(); this.level.setStyle('textFill', color); } hide() { + this._create(); this.level.hide(); } show() { + this._create(); this.level.show(); } } diff --git a/src/jmap/shape/StationStand/EReentry.js b/src/jmap/shape/StationStand/EReentry.js index 5c4007fe4..c66534306 100644 --- a/src/jmap/shape/StationStand/EReentry.js +++ b/src/jmap/shape/StationStand/EReentry.js @@ -6,36 +6,42 @@ class EReentry extends Group { constructor(model) { super(); this.model = model; - this._create(); + this.isNew = false; } _create() { - const model = this.model; + if (!this.isNew) { + const model = this.model; - 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); } hide() { + this._create(); this.reentry.hide(); } show() { + this._create(); this.reentry.show(); } } diff --git a/src/jmap/shape/StationStand/ESafeDoor.js b/src/jmap/shape/StationStand/ESafeDoor.js index ea187baa8..473139594 100644 --- a/src/jmap/shape/StationStand/ESafeDoor.js +++ b/src/jmap/shape/StationStand/ESafeDoor.js @@ -24,8 +24,8 @@ class ESafeDoor extends Group { }, style: { lineWidth: 0, - stroke: style.StationStand.standDoorDefaultColor, - fill: style.StationStand.standDoorDefaultColor + stroke: style.StationStand.safetyDoor.defaultColor, + fill: style.StationStand.safetyDoor.defaultColor } }); @@ -40,8 +40,8 @@ class ESafeDoor extends Group { }, style: { lineWidth: 0, - stroke: style.StationStand.standDoorDefaultColor, - fill: style.StationStand.standDoorDefaultColor + stroke: style.StationStand.safetyDoor.defaultColor, + fill: style.StationStand.safetyDoor.defaultColor } }); @@ -56,8 +56,8 @@ class ESafeDoor extends Group { }, style: { lineWidth: 0, - stroke: style.StationStand.standDoorDefaultColor, - fill: style.StationStand.standDoorDefaultColor + stroke: style.StationStand.safetyDoor.defaultColor, + fill: style.StationStand.safetyDoor.defaultColor } }); diff --git a/src/jmap/shape/StationStand/ESafeEmergent.js b/src/jmap/shape/StationStand/ESafeEmergent.js index cc2734de0..f6a829c4f 100644 --- a/src/jmap/shape/StationStand/ESafeEmergent.js +++ b/src/jmap/shape/StationStand/ESafeEmergent.js @@ -5,37 +5,42 @@ class ESafeEmergent extends Group { constructor(model) { super(); this.model = model; - this._create(); + this.isNew = false; } _create() { - const model = this.model; - const style = this.model.style; + if (!this.isNew) { + const model = this.model; + const style = this.model.style; - this.emergent = new Isogon({ - zlevel: model.zlevel, - z: model.z, - shape: { - x: model.x, - y: model.y, - r: model.r, - n: model.n - }, - style: { - lineWidth: 0, - stroke: style.StationStand.standEmergentCloseColor, - fill: style.StationStand.standEmergentCloseColor - } - }); + this.isNew = true; + this.emergent = new Isogon({ + zlevel: model.zlevel, + z: model.z, + shape: { + x: model.x, + y: model.y, + r: model.r, + n: model.n + }, + style: { + lineWidth: 0, + stroke: style.StationStand.standEmergent.closeColor, + fill: style.StationStand.standEmergent.closeColor + } + }); - this.add(this.emergent); + this.add(this.emergent); + } } hide() { + this._create(); this.emergent.hide(); } show() { + this._create(); this.emergent.show(); } } diff --git a/src/jmap/shape/StationStand/ESafeStand.js b/src/jmap/shape/StationStand/ESafeStand.js index 74f4ebfbf..57834a850 100644 --- a/src/jmap/shape/StationStand/ESafeStand.js +++ b/src/jmap/shape/StationStand/ESafeStand.js @@ -24,7 +24,7 @@ class ESafeStand extends Group { style: { lineWidth: 0, stroke: style.sidelineColor, - fill: style.StationStand.standSpareColor + fill: style.StationStand.stand.spareColor } }); diff --git a/src/jmap/shape/StationStand/ETime.js b/src/jmap/shape/StationStand/ETime.js index bfe80cf0f..c7127a029 100644 --- a/src/jmap/shape/StationStand/ETime.js +++ b/src/jmap/shape/StationStand/ETime.js @@ -5,46 +5,51 @@ class ETime extends Group { constructor(model) { super(); this.model = model; - this._create(); + this.isNew = false; } _create() { - const model = this.model; - const style = this.model.style; + if (!this.isNew) { + const model = this.model; + const style = this.model.style; - this.time = new Text({ - zlevel: model.zlevel, - z: model.z, - style: { - x: model.x, - y: model.y, - text: model.name, - textFill: style.StationStand.standTimeTextColor, - textAlign: 'middle', - textFont: `${style.StationStand.standTextFontSize} px ${style.textFontFormat}` - } - }); + this.isNew = true; + this.time = new Text({ + zlevel: model.zlevel, + z: model.z, + style: { + x: model.x, + y: model.y, + fontWeight: 'normal', + fontSize: style.StationStand.common.textFontSize, + fontFamily: style.textFontFormat, + text: model.name, + textFill: style.StationStand.stopTime.textColor, + textAlign: 'middle' + } + }); - this.add(this.time); + this.add(this.time); + } } setName(val) { - this.time.attr({ - style: { - text: val - } - }); + this._create(); + this.time.setStyle('text', val); } setColor(color) { + this._create(); this.time.setStyle('textFill', color); } hide() { + this._create(); this.time.hide(); } show() { + this._create(); this.time.show(); } } diff --git a/src/jmap/shape/StationStand/index.js b/src/jmap/shape/StationStand/index.js index fd5e3333e..2a19c6b3b 100644 --- a/src/jmap/shape/StationStand/index.js +++ b/src/jmap/shape/StationStand/index.js @@ -36,14 +36,14 @@ class StationStand extends Group { x: model.position.x, y: model.position.y, width: model.width, - height: style.StationStand.standSafeHeight, + height: style.StationStand.safetyDoor.height, show: model.hasDoor }); /** 列车站台*/ - const standH = drict > 0 ? style.StationStand.standSafeHeight : model.height; + const standH = drict > 0 ? style.StationStand.safetyDoor.height : model.height; const standX = model.position.x - model.width / 2; - const standY = model.position.y + drict * (style.StationStand.standDistance + standH); + const standY = model.position.y + drict * (style.StationStand.safetyDoor.distance + standH); this.safeStand = new ESafeStand({ zlevel: this.zlevel, z: this.z, @@ -55,24 +55,24 @@ class StationStand extends Group { }); /** 站台紧急关闭*/ - const emergentH = drict > 0 ? style.StationStand.standEmergentR + style.StationStand.standSafeHeight: style.StationStand.standEmergentR; - const emergentX = model.position.x + drict * (style.StationStand.standEmergentOffset.x); - const emergentY = model.position.y + drict * (style.StationStand.standEmergentOffset.y + emergentH); + const emergentH = drict > 0 ? style.StationStand.standEmergent.mergentR + style.StationStand.safetyDoor.height: style.StationStand.standEmergent.mergentR; + const emergentX = model.position.x + drict * (style.StationStand.standEmergent.offset.x); + const emergentY = model.position.y + drict * (style.StationStand.standEmergent.offset.y + emergentH); this.emergent = new ESafeEmergent({ zlevel: this.zlevel, z: this.z + 1, style: style, x: emergentX, y: emergentY, - r: style.StationStand.standEmergentR, + r: style.StationStand.standEmergent.mergentR, n: 4 }); /** 站台折返策略*/ - const reentryD = style.StationStand.standReentryDirection ? model.height + 6: -style.StationStand.standDistance - style.StationStand.standSafeHeight; - const reentryH = drict > 0 ? style.StationStand.standEmergentR : style.StationStand.standEmergentR + style.StationStand.standDistance + reentryD; - const reentryX = model.position.x - (style.StationStand.standReentryDirection || drict) * (style.StationStand.standReentryOffset.x - model.width / 2); - const reentryY = model.position.y + (style.StationStand.standReentryDirection || drict) * (style.StationStand.standReentryOffset.y) + drict * reentryH; + const reentryD = style.StationStand.reentry.direction ? model.height + 6: -style.StationStand.safetyDoor.distance - style.StationStand.safetyDoor.height; + const reentryH = drict > 0 ? style.StationStand.standEmergent.mergentR : style.StationStand.standEmergent.mergentR + style.StationStand.safetyDoor.distance + reentryD; + const reentryX = model.position.x - (style.StationStand.reentry.direction || drict) * (style.StationStand.reentry.offset.x - model.width / 2); + const reentryY = model.position.y + (style.StationStand.reentry.direction || drict) * (style.StationStand.reentry.offset.y) + drict * reentryH; this.reentry = new EReentry({ zlevel: this.zlevel, z: this.z + 1, @@ -81,16 +81,16 @@ class StationStand extends Group { x: reentryX, y: reentryY, lineWidth: 0, - fill: style.StationStand.standNoHumanReentryColor + fill: style.StationStand.reentry.noHumanColor }); - const distance = style.StationStand.standSafeHeight*2 - style.StationStand.standHeadFontSize/2 - 2; + const distance = style.StationStand.safetyDoor.height*2 - style.StationStand.stand.headFontSize/2 - 2; /** 站台扣车*/ - const detainD = style.StationStand.standDetainDirection ? model.height - distance: -style.StationStand.standSafeHeight; - const detainH = drict > 0 ? style.StationStand.standEmergentR : style.StationStand.standEmergentR + style.StationStand.standDistance + detainD; - const detainX = model.position.x - (style.StationStand.standDetainDirection || drict) * (style.StationStand.standDetainOffset.x - model.width / 2); - const detainY = model.position.y + (style.StationStand.standDetainDirection || drict) * (style.StationStand.standDetainOffset.y) + drict * detainH; + const detainD = style.StationStand.detainCar.direction ? model.height - distance: -style.StationStand.safetyDoor.height; + const detainH = drict > 0 ? style.StationStand.standEmergent.mergentR : style.StationStand.standEmergent.mergentR + style.StationStand.safetyDoor.distance + detainD; + const detainX = model.position.x - (style.StationStand.detainCar.direction || drict) * (style.StationStand.detainCar.offset.x - model.width / 2); + const detainY = model.position.y + (style.StationStand.detainCar.direction || drict) * (style.StationStand.detainCar.offset.y) + drict * detainH; this.detain = new EDetain({ zlevel: this.zlevel, z: this.z, @@ -102,10 +102,10 @@ class StationStand extends Group { }); /** 停站时间*/ - const timeD = style.StationStand.standTimeDirection ? model.height - distance: -style.StationStand.standSafeHeight; - const timeH = drict > 0 ? style.StationStand.standEmergentR : style.StationStand.standEmergentR + style.StationStand.standDistance + timeD; - const timeX = model.position.x - (style.StationStand.standTimeDirection || drict) * (style.StationStand.standTimeOffset.x - model.width / 2); - const timeY = model.position.y + (style.StationStand.standTimeDirection || drict) * (style.StationStand.standTimeOffset.y) + drict * timeH; + const timeD = style.StationStand.stopTime.direction ? model.height - distance: -style.StationStand.safetyDoor.height; + const timeH = drict > 0 ? style.StationStand.standEmergent.mergentR : style.StationStand.standEmergent.mergentR + style.StationStand.safetyDoor.distance + timeD; + const timeX = model.position.x - (style.StationStand.stopTime.direction || drict) * (style.StationStand.stopTime.offset.x - model.width / 2); + const timeY = model.position.y + (style.StationStand.stopTime.direction || drict) * (style.StationStand.stopTime.offset.y) + drict * timeH; this.time = new ETime({ zlevel: this.zlevel, z: this.z + 1, @@ -116,10 +116,10 @@ class StationStand extends Group { }); /** 运行等级*/ - const levelD = style.StationStand.standLevelDirection ? model.height - distance: -style.StationStand.standSafeHeight; - const levelH = drict > 0 ? style.StationStand.standEmergentR : style.StationStand.standEmergentR + style.StationStand.standDistance + levelD; - const levelX = model.position.x - (style.StationStand.standLevelDirection || drict) * (style.StationStand.standLevelOffset.x - model.width / 2); - const levelY = model.position.y + (style.StationStand.standLevelDirection || drict) * (style.StationStand.standLevelOffset.y) + drict * levelH; + const levelD = style.StationStand.level.direction ? model.height - distance: -style.StationStand.safetyDoor.height; + const levelH = drict > 0 ? style.StationStand.standEmergent.mergentR : style.StationStand.standEmergent.mergentR + style.StationStand.safetyDoor.distance + levelD; + const levelX = model.position.x - (style.StationStand.level.direction || drict) * (style.StationStand.level.offset.x - model.width / 2); + const levelY = model.position.y + (style.StationStand.level.direction || drict) * (style.StationStand.level.offset.y) + drict * levelH; this.level = new ELevel({ zlevel: this.zlevel, z: this.z + 1, @@ -154,27 +154,27 @@ class StationStand extends Group { this.reentry.hide(); this.emergent.hide(); if (this.model.visible) { this.safeDoor.hasDoor(true); } - this.safeDoor.setColor(this.style.StationStand.standDoorDefaultColor); + this.safeDoor.setColor(this.style.StationStand.safetyDoor.defaultColor); } /** 空闲*/ spare() { - this.safeStand.setColor(this.style.StationStand.standSpareColor); + this.safeStand.setColor(this.style.StationStand.stand.spareColor); } /** 列车停站*/ stop() { - this.safeStand.setColor(this.style.StationStand.standStopColor); + this.safeStand.setColor(this.style.StationStand.stand.stopColor); } /** 指定列车跳站*/ designatedJumpStop() { - this.safeStand.setColor(this.style.StationStand.standDesignatedJumpStopColor); + this.safeStand.setColor(this.style.StationStand.stand.designatedJumpStopColor); } /** 站台紧急关闭*/ emergentClose() { - this.safeStand.setColor(this.style.StationStand.standSpareColor); + this.safeStand.setColor(this.style.StationStand.stand.spareColor); this.emergent.show(); } @@ -184,7 +184,7 @@ class StationStand extends Group { /** 站台跳停*/ jumpStop() { - this.safeStand.setColor(this.style.StationStand.standJumpStopColor); + this.safeStand.setColor(this.style.StationStand.stand.jumpStopColor); } /** 未设置扣车*/ @@ -195,13 +195,13 @@ class StationStand extends Group { /** 车站扣车*/ standDetainTrain() { this.detain.show(); - this.detain.setColor(this.style.StationStand.standDetainTrainTextColor); + this.detain.setColor(this.style.StationStand.detainCar.detainTrainTextColor); } /** 中心扣车*/ centerDetainTrain() { this.detain.show(); - this.detain.setColor(this.style.StationStand.standCenterDetainTrainColor); + this.detain.setColor(this.style.StationStand.detainCar.centerTrainColor); } /** 中心+车站扣车*/ @@ -233,17 +233,17 @@ class StationStand extends Group { /** 屏蔽门正常*/ doorNormal() { - this.safeDoor.setColor(this.style.StationStand.standDoorDefaultColor); + this.safeDoor.setColor(this.style.StationStand.safetyDoor.defaultColor); } /** 屏蔽门故障*/ doorFault() { - this.safeDoor.setColor(this.style.StationStand.standSplitDoorColor); + this.safeDoor.setColor(this.style.StationStand.safetyDoor.splitDoorColor); } /** 屏蔽门切除*/ doorSplit() { - this.safeDoor.setColor(this.style.StationStand.standSplitDoorColor); + this.safeDoor.setColor(this.style.StationStand.safetyDoor.splitDoorColor); } /** 无折返(默认)*/ @@ -254,12 +254,12 @@ class StationStand extends Group { /** 无人折返*/ noHumanReentry() { this.reentry.show(); - this.reentry.setColor(this.style.StationStand.standNoHumanReentryColor); + this.reentry.setColor(this.style.StationStand.reentry.noHumanColor); } /** 自动换端*/ autoChangeEnds() { this.reentry.show(); - this.reentry.setColor(this.style.StationStand.standAutoChangeEndsColor); + this.reentry.setColor(this.style.StationStand.reentry.AutoChangeEndsColor); } setState(state) { diff --git a/src/jmap/shape/Switch/ESwLnversion.js b/src/jmap/shape/Switch/ESwLnversion.js index 5863a776c..2534fd762 100644 --- a/src/jmap/shape/Switch/ESwLnversion.js +++ b/src/jmap/shape/Switch/ESwLnversion.js @@ -34,7 +34,7 @@ class ESwLnversion extends Group { points: model.sectionPoints }, style: { - fill: style.Section.sectionSpareColor + fill: style.Section.line.spareColor }, cursor: model.cursor, onmouseover: model.onmouseover, diff --git a/src/jmap/shape/Switch/ESwName.js b/src/jmap/shape/Switch/ESwName.js index 66f37cf61..2cea8f83f 100644 --- a/src/jmap/shape/Switch/ESwName.js +++ b/src/jmap/shape/Switch/ESwName.js @@ -19,11 +19,13 @@ class ESwName extends Group { style: { x: model.nameTextX, y: model.nameTextY, + fontWeight: 'normal', + fontSize: style.textFontSize, + fontFamily: style.textFontFormat, text: model.name, textAlign: model.triangle.drictx === 1 ? 'left' : 'right', textVerticalAlign: model.triangle.dricty === 1 ? 'top' : 'bottom', - textFont: style.textFontSize + 'px ' + style.textFontFormat, - textFill: style.Switch.switchTextLossColor + textFill: style.Switch.text.switchTextLossColor } }); @@ -47,7 +49,7 @@ class ESwName extends Group { style: { lineWidth: 0, lineDash: [3, 3], - stroke: style.Switch.switchTextBorderColor, + stroke: style.Switch.text.switchTextBorderColor, fill: style.transparentColor } }); @@ -58,10 +60,12 @@ class ESwName extends Group { style: { x: model.arrowTextX, y: model.arrowTextY, + fontWeight: 'normal', + fontSize: 10, + fontFamily: style.textFontFormat, text: `道岔区段名称: ${model.sectionName}`, textFill: '#000', textAlign: 'letf', - textFont: 10 + 'px consolas', textPadding: 3, textBackgroundColor: style.tipBackgroundColor } diff --git a/src/jmap/shape/Switch/index copy.js b/src/jmap/shape/Switch/index copy.js deleted file mode 100644 index ac8b2af31..000000000 --- a/src/jmap/shape/Switch/index copy.js +++ /dev/null @@ -1,398 +0,0 @@ -/* -* 道岔 -*/ -import Line from 'zrender/src/graphic/shape/Line'; -import Group from 'zrender/src/container/Group'; -import Polygon from 'zrender/src/graphic/shape/Polygon'; -import JTriangle from '../../utils/JTriangle'; -import ESwName from './ESwName.js'; -import ESwCore from './ESwCore.js'; - -export default class Switch extends Group { - constructor({ _code, _type, zlevel, model, state }, style, jmap) { - super(); - this._code = _code; - this._type = _type; - this.model = model; - this.state = state; - this.style = style; - this.jmap = jmap; - this.selected = false; - this.zlevel = zlevel; - this.z = 8; - - this._create(); - this.setState(state); - } - - _create() { - const model = this.model; - const style = this.style; - - this.triangle = new JTriangle(model.intersection, model.skew); - - let halfWidth = style.Section.sectionWidth / 2; - const switchWidth = style.Section.sectionWidth + style.Section.sectionBeyondWidth*2 + 0.8; - const swPadding = style.Switch.switchLen; - const directx = this.triangle.drictx; - const directy = this.triangle.dricty; - const direct = -this.triangle.drictx * this.triangle.dricty; - const coverLength = switchWidth * 1.5; - - this.swCore = new ESwCore({ - zlevel: this.zlevel, - z: this.z, - style: style, - intersectionX: model.intersection.x, - intersectionY: model.intersection.y, - coverLength: coverLength, - lineWidth: switchWidth, - triangle: this.triangle - }); - - halfWidth += 0.3; - const point1 = [model.intersection.x - directx * halfWidth, model.intersection.y + directy * halfWidth]; - const point2 = [point1[0] + directx * switchWidth / this.triangle.getSinRate(), point1[1]]; - const point3 = [point2[0] + directx * this.triangle.getCotRate() * swPadding, point2[1] + directy * swPadding]; - const point4 = [point3[0] + direct * this.triangle.getSin(switchWidth), point3[1] - direct * this.triangle.getCos(switchWidth)]; - this.locShelter = new Polygon({ - zlevel: this.zlevel, - z: this.z, - shape: { - points: [ - point1, point2, point3, point4 - ] - }, - style: { - fill: style.backgroundColor - }, - cursor: 'pointer', - onmouseover: () => { this.name.getArrowText().show(); }, - onmouseout: () => { this.name.getArrowText().hide(); } - }); - const lpx = Math.abs(this.triangle.getCos(1)); - this.locShelter.position = [directx * lpx, -directy * 0.2]; - this.locShelter.show(); - - const slen = switchWidth / this.triangle.getSinRate(); - const rpoint1 = [model.intersection.x + directx * halfWidth, model.intersection.y - directy * halfWidth]; - const rpoint2 = [rpoint1[0] + directx * (swPadding + switchWidth * this.triangle.getCotRate()), rpoint1[1]]; - const rpoint3 = [rpoint2[0], rpoint2[1] + directy * switchWidth]; - const rpoint4 = [rpoint1[0] + this.triangle.getCos(slen), rpoint1[1] + this.triangle.getSin(slen)]; - this.relocShelter = new Polygon({ - zlevel: this.zlevel, - z: this.z, - shape: { - points: [ - rpoint1, rpoint2, rpoint3, rpoint4 - ] - }, - style: { - fill: style.backgroundColor - }, - cursor: 'pointer', - onmouseover: () => { this.name.getArrowText().show(); }, - onmouseout: () => { this.name.getArrowText().hide(); } - }); - const rpx = Math.abs(this.triangle.getCos(halfWidth)) + 0.2; - this.relocShelter.position = [-directx * rpx, -directy * 0.2]; - this.relocShelter.hide(); - - const sinX = style.Section.sectionWidth / this.triangle.getSinRate(); - const switchWidth1 = style.Section.sectionWidth / 2; - const width1 = switchWidth1 * this.triangle.getSinRate(); - const height1 = switchWidth1 * this.triangle.getCosRate(); - const width2 = (height1 + switchWidth1) / this.triangle.getTanRate(); - const width3 = sinX - width2 - width1; - const switchPoint1 = [model.intersection.x + directx * width3, model.intersection.y - directy * switchWidth1]; - const switchPoint2 = [switchPoint1[0] - directx * (width2 + width1) - directx * width3, switchPoint1[1]]; - const switchPoint3 = [model.intersection.x - directx * width3, model.intersection.y + directy * switchWidth1]; - const switchPoint4 = [switchPoint1[0] + directx * (width2 + width1) - directx * width3, switchPoint3[1]]; - this.reserveSection = new Polygon({ - zlevel: this.zlevel, - shape: { - points: [ - switchPoint1, switchPoint2, switchPoint3, switchPoint4 - ] - }, - style: { - fill: style.Section.sectionSpareColor - }, - cursor: 'pointer', - onmouseover: () => { this.name.getArrowText().show(); }, - onmouseout: () => { this.name.getArrowText().hide(); } - }); - this.reserveSection.hide(); - - this.releaseBackground = new Line({ - zlevel: this.zlevel, - z: this.z, - shape: { - x1: model.intersection.x - (coverLength * this.triangle.getCotRate()), - y1: model.intersection.y, - x2: model.intersection.x + (coverLength * this.triangle.getCotRate()), - y2: model.intersection.y - }, - style: { - lineWidth: style.Section.sectionWidth + style.Section.sectionBeyondWidth + 1, - stroke: style.backgroundColor - } - }); - - const arrowTextX = model.intersection.x + 10; - const arrowTextY = model.intersection.y + 15; - const nameTextX = model.namePosition.x + model.intersection.x + this.triangle.drictx * (style.Section.sectionWidth * 3 + style.Switch.switchNameDistance) * this.triangle.getCotRate(); - const nameTextY = model.namePosition.y + model.intersection.y + this.triangle.dricty * (style.Switch.switchNameDistance); - this.name = new ESwName({ - zlevel: this.zlevel, - z: this.z, - style: style, - arrowTextX: arrowTextX, - arrowTextY: arrowTextY, - nameTextX: nameTextX, - nameTextY: nameTextY, - sectionName: model.sectionName, - name: model.name, - nameShow: model.nameShow, - triangle: this.triangle - }); - - this.add(this.swCore); - this.add(this.locShelter); - this.add(this.relocShelter); - this.add(this.reserveSection); - this.add(this.releaseBackground); - this.add(this.name); - } - - /** 名称动画*/ - nameTextAnimation() { - this.name.getNameText().animateStyle(true) - .when(0, { textFill: this.style.backgroundColor }) - .when(1000, { textFill: this.style.Switch.switchTextLossColor }) - .when(2000, { textFill: this.style.backgroundColor }) - .start(); - - this.name.getTextRect().animateStyle(true) - .when(0, { textFill: this.style.backgroundColor }) - .when(1000, { textFill: this.style.Switch.switchTextBorderColor }) - .when(2000, { textFill: this.style.backgroundColor }) - .start(); - } - - /** 设置岔芯是否隐藏*/ - setSwitchCoreInvisible(invisible) { - if (invisible) { - this.swCore.hide(); - } else { - this.swCore.show(); - } - } - - /** 设置岔芯颜色*/ - setSwitchCoreColor(color) { - this.swCore.setColor(color); - } - - /** 设置道岔文字颜色*/ - setTextColor(color) { - this.name.getNameText().setStyle('textFill', color); - } - - /** 设置道岔文字边框颜色 */ - setHasTextBorder(width) { - this.name.getTextRect().setStyle('lineWidth', width); - } - - /** 恢复状态*/ - recover() { - this.setSwitchCoreColor(this.style.backgroundColor); - this.name.getNameText().stopAnimation(false); - this.reserveSection.stopAnimation(false); - this.swCore.stopAnimation(false); - - this.relocShelter.hide(); - this.releaseBackground.hide(); - - this.setHasTextBorder(0); - switch (this.state.locateType) { - case '01': - this.setTextColor(this.style.Switch.switchLocateTextColor); - break; - case '02': - this.setTextColor(this.style.Switch.switchInversionColor); - break; - default: - this.setTextColor(this.style.Switch.switchTextLossColor); - break; - } - } - - /** 定位*/ - setLocationAction() { - this.recover(); - this.setSwitchCoreInvisible(true); - this.locShelter.show(); - this.relocShelter.hide(); - this.reserveSection.hide(); - } - - /** 反位*/ - setInversionAction() { - this.recover(); - this.setSwitchCoreInvisible(true); - this.locShelter.hide(); - this.relocShelter.show(); - this.reserveSection.show(); - } - - /** 失去*/ - setLossAction(nameFlicker) { - this.recover(); - this.locShelter.hide(); - this.relocShelter.hide(); - this.reserveSection.hide(); - this.setSwitchCoreInvisible(false); - nameFlicker && this.nameTextAnimation(); - } - - /** 挤叉*/ - setForkAction() { - this.setLossAction(true); - this.swCore.animateStyle(item => { - item.animateStyle(true) - .when(0, { stroke: this.style.backgroundColor }) - .when(1000, { stroke: 'red' }) - .when(2000, { stroke: this.style.backgroundColor }) - .start(); - }); - } - - /** 空闲*/ - spare() { - } - - /** 单锁*/ - setMonolock() { - this.setTextColor(this.style.Switch.switchMonolockColor); - } - - /** 封锁 */ - block() { - this.setHasTextBorder(1); - } - - /** 延时释放*/ - timeRelease() { - this.setSwitchCoreInvisible(true); - this.releaseBackground.show(); - } - - /** 设置道岔切除*/ - setSwitchCutOff() { - this.setSwitchCoreInvisible(true); - switch (this.model.locateType) { - case '01': - this.releaseBackground.hide(); - this.setSectionState(this.release, 'stroke', this.model.sectionAstatus); - break; - case '02': - this.reserveSection.animateStyle(true) - .when(1000, { fill: this.style.backgroundColor }) - .start(); - break; - } - } - - setSectionState(section, style, state) { - if (section) { - switch (state) { - case '00': break; - case '01': /** 空闲*/ - section.setStyle(style, this.style.Section.sectionSpareColor); - break; - case '02': /** 通信车占用*/ - section.setStyle(style, this.style.Section.sectionCommunicationOccupiedColor); - break; - case '03': /** 非通信车占用*/ - section.setStyle(style, this.style.Section.sectionUnCommunicationOccupiedColor); - break; - case '04': /** 进路锁闭*/ - section.setStyle(style, this.style.Section.sectionRouteLockColor); - break; - case '05': /** 故障锁闭*/ - section.setStyle(style, this.style.Section.sectionFaultLockColor); - break; - case '06': /** 封锁*/ - section.setStyle(style, this.style.Section.sectionBlockColor); - break; - case '07': /** ATC切除*/ - section.setStyle(style, this.style.Section.sectionAtcExcisionColor); - break; - case '08': /** ATS切除*/ - section.setStyle(style, this.style.Section.sectionAtsExcisionColor); - section.animateStyle(true) - .when(1000, { fill: this.style.backgroundColor }) - .when(2000, { fill: this.style.Section.sectionAtsExcisionColor }) - .start(); - break; - case '09': /** 进路延续保护 */ - section.setStyle(style, this.style.Section.sectionProtectiveLockColor); - break; - } - } - } - - setLocateType(state) { - this.setSectionState(this.reserveSection, 'fill', this.model.sectionCstatus); - switch (state.locateType) { - case '01': - this.setLocationAction(); /** 定位*/ - break; - case '02': - this.setInversionAction(); /** 反位*/ - break; - case '03': - this.setLossAction(true); /** 失去*/ - break; - case '04': - this.setForkAction(); /** 挤岔*/ - break; - } - } - - setState(state) { - this.setLocateType(state); - switch (state.status) { - case '01': - this.spare(); /** 空闲*/ - break; - case '10': - this.setMonolock(); /** 单锁*/ - break; - case '13': - this.timeRelease(); /** 延时释放*/ - break; - case '14': - this.block(); /** 封锁*/ - break; - } - - /** 区段切除*/ - if (state.cutOff) { - this.setSwitchCutOff(); - } - } - - getShapeTipPoint() { - let rect = null; - rect = this.name.getNameText().getBoundingRect(); - if (rect) { - return { - x: rect.x + rect.width / 2, - y: rect.y - }; - } - return null; - } -} diff --git a/src/jmap/shape/Switch/index.js b/src/jmap/shape/Switch/index.js index 7cd9bc12f..354d0730c 100644 --- a/src/jmap/shape/Switch/index.js +++ b/src/jmap/shape/Switch/index.js @@ -20,7 +20,7 @@ export default class Switch extends Group { this.jmap = jmap; this.selected = false; this.zlevel = zlevel; - this.z = 8; + this.z = 6; this._create(); this.setState(state); @@ -32,9 +32,9 @@ export default class Switch extends Group { this.triangle = new JTriangle(model.intersection, model.skew); - let halfWidth = style.Section.sectionWidth / 2; - const switchWidth = style.Section.sectionWidth + style.Section.sectionBeyondWidth*2 + 0.8; - const swPadding = style.Switch.switchLen; + let halfWidth = style.Section.line.width / 2; + const switchWidth = style.Section.line.width + style.Section.line.beyondWidth*2 + 0.8; + const swPadding = style.Switch.core.switchLen; const directx = this.triangle.drictx; const directy = this.triangle.dricty; const direct = -this.triangle.drictx * this.triangle.dricty; @@ -73,11 +73,11 @@ export default class Switch extends Group { const rpoint3 = [rpoint2[0], rpoint2[1] + directy * switchWidth]; const rpoint4 = [rpoint1[0] + this.triangle.getCos(slen), rpoint1[1] + this.triangle.getSin(slen)]; - const switchWidth1 = style.Section.sectionWidth / 2; + const switchWidth1 = style.Section.line.width / 2; const width1 = switchWidth1 * this.triangle.getSinRate(); const height1 = switchWidth1 * this.triangle.getCosRate(); const width2 = (height1 + switchWidth1) / this.triangle.getTanRate(); - const width3 = (style.Section.sectionWidth / this.triangle.getSinRate()) - width2 - width1; + const width3 = (style.Section.line.width / this.triangle.getSinRate()) - width2 - width1; const spoint1 = [model.intersection.x + directx * width3, model.intersection.y - directy * switchWidth1]; const spoint2 = [spoint1[0] - directx * (width2 + width1) - directx * width3, spoint1[1]]; const spoint3 = [model.intersection.x - directx * width3, model.intersection.y + directy * switchWidth1]; @@ -106,15 +106,15 @@ export default class Switch extends Group { y2: model.intersection.y }, style: { - lineWidth: style.Section.sectionWidth + style.Section.sectionBeyondWidth + 1, + lineWidth: style.Section.line.width + style.Section.line.beyondWidth + 1, stroke: style.backgroundColor } }); const arrowTextX = model.intersection.x + 10; const arrowTextY = model.intersection.y + 15; - const nameTextX = model.namePosition.x + model.intersection.x + this.triangle.drictx * (style.Section.sectionWidth * 3 + style.Switch.switchNameDistance) * this.triangle.getCotRate(); - const nameTextY = model.namePosition.y + model.intersection.y + this.triangle.dricty * (style.Switch.switchNameDistance); + const nameTextX = model.namePosition.x + model.intersection.x + this.triangle.drictx * (style.Section.line.width * 3 + style.Switch.text.switchNameDistance) * this.triangle.getCotRate(); + const nameTextY = model.namePosition.y + model.intersection.y + this.triangle.dricty * (style.Switch.text.switchNameDistance); this.name = new ESwName({ zlevel: this.zlevel, z: this.z, @@ -140,13 +140,13 @@ export default class Switch extends Group { nameTextAnimation() { this.name.getNameText().animateStyle(true) .when(0, { textFill: this.style.backgroundColor }) - .when(1000, { textFill: this.style.Switch.switchTextLossColor }) + .when(1000, { textFill: this.style.Switch.text.switchTextLossColor }) .when(2000, { textFill: this.style.backgroundColor }) .start(); this.name.getTextRect().animateStyle(true) .when(0, { textFill: this.style.backgroundColor }) - .when(1000, { textFill: this.style.Switch.switchTextBorderColor }) + .when(1000, { textFill: this.style.Switch.text.switchTextBorderColor }) .when(2000, { textFill: this.style.backgroundColor }) .start(); } @@ -187,13 +187,13 @@ export default class Switch extends Group { this.setHasTextBorder(0); switch (this.state.locateType) { case '01': - this.setTextColor(this.style.Switch.switchLocateTextColor); + this.setTextColor(this.style.Switch.text.switchTextLocateColor); break; case '02': - this.setTextColor(this.style.Switch.switchInversionColor); + this.setTextColor(this.style.Switch.text.switchTextInversionColor); break; default: - this.setTextColor(this.style.Switch.switchTextLossColor); + this.setTextColor(this.style.Switch.text.switchTextLossColor); break; } } @@ -276,35 +276,35 @@ export default class Switch extends Group { switch (state) { case '00': break; case '01': /** 空闲*/ - section.setStyle(style, this.style.Section.sectionSpareColor); + section.setStyle(style, this.style.Section.line.spareColor); break; case '02': /** 通信车占用*/ - section.setStyle(style, this.style.Section.sectionCommunicationOccupiedColor); + section.setStyle(style, this.style.Section.line.communicationOccupiedColor); break; case '03': /** 非通信车占用*/ - section.setStyle(style, this.style.Section.sectionUnCommunicationOccupiedColor); + section.setStyle(style, this.style.Section.line.unCommunicationOccupiedColor); break; case '04': /** 进路锁闭*/ - section.setStyle(style, this.style.Section.sectionRouteLockColor); + section.setStyle(style, this.style.Section.line.routeLockColor); break; case '05': /** 故障锁闭*/ - section.setStyle(style, this.style.Section.sectionFaultLockColor); + section.setStyle(style, this.style.Section.line.faultLockColor); break; case '06': /** 封锁*/ - section.setStyle(style, this.style.Section.sectionBlockColor); + section.setStyle(style, this.style.Section.line.blockColor); break; case '07': /** ATC切除*/ - section.setStyle(style, this.style.Section.sectionAtcExcisionColor); + section.setStyle(style, this.style.Section.line.atcExcisionColor); break; case '08': /** ATS切除*/ - section.setStyle(style, this.style.Section.sectionAtsExcisionColor); + section.setStyle(style, this.style.Section.line.atsExcisionColor); section.animateStyle(true) .when(1000, { fill: this.style.backgroundColor }) - .when(2000, { fill: this.style.Section.sectionAtsExcisionColor }) + .when(2000, { fill: this.style.Section.line.atsExcisionColor }) .start(); break; case '09': /** 进路延续保护 */ - section.setStyle(style, this.style.Section.sectionProtectiveLockColor); + section.setStyle(style, this.style.Section.line.protectiveLockColor); break; } } diff --git a/src/jmap/shape/ZcControl/index.js b/src/jmap/shape/ZcControl/index.js index b18b4b2c3..1f3f337a4 100644 --- a/src/jmap/shape/ZcControl/index.js +++ b/src/jmap/shape/ZcControl/index.js @@ -34,11 +34,13 @@ export default class ZcControl extends Group { position: [0, 0], x: model.position.x, y: model.position.y + this.style.zcControlmodeR + this.style.nameDistance, + fontWeight: 'normal', + fontSize: this.style.stationControlTextSize, + fontFamily: this.style.textFontFormat, text: model.name, textFill: '#fff', textAlign: 'middle', - textVerticalAlign: 'top', - textFont: this.style.stationControlTextSize + 'px ' + this.style.textFontFormat + textVerticalAlign: 'top' }, style: this.style }); diff --git a/src/jmap/shape/element/EControl.js b/src/jmap/shape/element/EControl.js index 26634885b..337f3d944 100644 --- a/src/jmap/shape/element/EControl.js +++ b/src/jmap/shape/element/EControl.js @@ -35,11 +35,13 @@ export default class EControl extends Group { style: { x: this.textStyle.x, y: this.textStyle.y, + fontWeight: this.textStyle.fontWeight, + fontSize: this.textStyle.fontSize, + fontFamily: this.textStyle.fontFamily, text: this.textStyle.text, textFill: this.textStyle.textFill, textAlign: this.textStyle.textAlign, - textVerticalAlign: this.textStyle.textVerticalAlign, - textFont: this.textStyle.textFont + textVerticalAlign: this.textStyle.textVerticalAlign } }); diff --git a/src/jmap/shape/element/ETextName.js b/src/jmap/shape/element/ETextName.js index 6e229f491..8ac278413 100644 --- a/src/jmap/shape/element/ETextName.js +++ b/src/jmap/shape/element/ETextName.js @@ -4,15 +4,16 @@ import Text from 'zrender/src/graphic/Text'; /** 名称元素*/ export default function ETextName(model) { const TextName = new Text({ - _subType: model._subType, zlevel: model.zlevel, z: model.z, silent: model.silent || false, style: { x: model.x, y: model.y, + fontWeight: model.fontWeight, + fontSize: model.fontSize, + fontFamily: model.fontFamily, text: model.text, - textFont: model.textFont, textFill: model.textFill, textAlign: model.textAlign, textPosition: model.textPosition || 'inside', diff --git a/src/jmap/theme/batong.js b/src/jmap/theme/batong.js index 4abb5264c..a4f98a366 100644 --- a/src/jmap/theme/batong.js +++ b/src/jmap/theme/batong.js @@ -79,7 +79,7 @@ class Batong extends defaultSkin { /** 信号机宽度 */ signalR: 5, /** 自动信号宽度*/ - signalSigPassWidth: 6, + signalAutoWidth: 6, /** 延迟解锁字体大小*/ signalDelayTextFontSize: 10, /** 信号机名称字体大小*/ @@ -235,7 +235,7 @@ class Batong extends defaultSkin { /** 道岔失去颜色*/ switchTextLossColor: '#FFFFFF', /** 道岔定位颜色*/ - switchLocateTextColor: '#00FF00', + switchTextLocateColor: '#00FF00', /** 道岔反位颜色*/ switchInversionColor: '#9C9D09', /** 道岔单锁颜色*/ diff --git a/src/jmap/theme/bejing.js b/src/jmap/theme/bejing.js index 4c6f282f0..2350a6cc5 100644 --- a/src/jmap/theme/bejing.js +++ b/src/jmap/theme/bejing.js @@ -7,211 +7,201 @@ class Beijing extends defaultSkin { this[deviceType.Link] = { /** line 颜色*/ lineWidthColor: '#FFFFFF', - /** link 宽度*/ linkWidth: 4.4, - /** link 线条颜色*/ linkColor: '#3F3F3F', - /** link 字体颜色*/ linkTextColor: '#FFFFFF' }; this[deviceType.Section] = { - sectionTextPosition: 1, // 区段名称位置 1 上行 -1 下面 0 默认 - /** 区段 宽度*/ - sectionWidth: 5, - /** 区段宽超出宽度*/ - sectionBeyondWidth: 0, - /** 计轴 半径*/ - sectionAxleR: 3, - /** 计轴和区段之间的距离*/ - sectionAxleDistance: 5, - /** 限速线的宽度*/ - sectionSpeedLimitLinewidth: 1, - /** 限速线距离区段距离*/ - sectionSpeedLimitDistance: 5, - /** 分隔符宽度*/ - sectionSeparatorWidth: 1.2, - sectionEndSeparatorWidth: 1.2, // 尽头分隔符宽度 - sectionEndSeparatorStroke: '#7F7F7F', // 尽头分隔符颜色 - /** 区段侵入颜色*/ - sectionInvadeColor: '#EF0C08', - /** 限速线颜色*/ - sectionSpeedLimitColor: '#FFFF00', - /** 逻辑区段颜色*/ - sectionLogicalBackgroundColor: '#FFFF00', - /** 区段计轴颜色*/ - sectionAxleColor: '#C0C0C0', - /** 区段边界符颜色*/ - sectionSeparatorColor: '#7F7F7F', - /** 区段空闲颜色*/ - sectionSpareColor: '#606060', - /** 逻辑区段名称颜色*/ - sectionLogicalTextColor: '#C0C0C0', - /** 区段通信车占用颜色**/ - sectionCommunicationOccupiedColor: '#FF0000', - /** 区段非通讯车占用颜色*/ - sectionUnCommunicationOccupiedColor: '#800080', - /** 区段路由锁定颜色*/ - sectionRouteLockColor: '#FFFFFF', - /** 区段故障锁定颜色*/ - sectionFaultLockColor: '#006400', - /** 区段未定义颜色*/ - sectionUndefinedColor: '#0071C1', - /** 保护区段锁闭*/ - sectionProtectionSectionLockedColor: '#FEFF00', - /** 区段计轴预复位*/ - sectionAxleResetColor: '#00FFFF', - /** 区段封锁颜色*/ - sectionBlockColor: '#800080', - /** 区段atc切除颜色*/ - sectionAtcExcisionColor: '#A0522D', - /** 区段ats切除颜色*/ - sectionAtsExcisionColor: '#A0522D', - /** 区段延时释放颜色*/ - sectionTimeReleaseColor: '#3F3F3F', - /** 区段保护锁闭*/ - sectionProtectiveLockColor: '#FFFF00', - /** 区段保护延时解锁*/ - sectionProtectiveTimeReleaseColor: '#0071C1', - /** 计轴失效*/ - sectionAxleFailure: '#E6A23C' // #FFFF00 + text: { // 区段文字属性 + fontSize: 10, // 字体大小 + fontFormat: 'consolas', // 字体族类 + fontColor: '#C0C0C0', // 字体颜色 + textAlign: 'center', // 水平对齐方式 + textPosition: 'inside', // 文字位置 + textVerticalAlign: 'middle', // 文字垂直对齐方式 + position: 1 // 区段名称位置 1 上面 -1 下面 0 默认 + }, + line: { + width: 5, // 区段宽度 + beyondWidth: 0, // 区段宽超出宽度 + invadeColor: '#EF0C08', // 区段侵入颜色 + spareColor: '#606060', // 区段空闲颜色 + communicationOccupiedColor: '#FF0000', // 区段通信车占用颜色 + unCommunicationOccupiedColor: '#800080', // 区段非通讯车占用颜色 + routeLockColor: '#FFFFFF', // 区段路由锁定颜色 + faultLockColor: '#006400', // 区段故障锁定颜色 + undefinedColor: '#0071C1', // 区段未定义颜色 + protectionLockedColor: '#FEFF00', // 保护区段锁闭(未用) + blockColor: '#800080', // 区段封锁颜色 + atcExcisionColor: '#A0522D', // 区段atc切除颜色 + atsExcisionColor: '#A0522D', // 区段ats切除颜色 + timeReleaseColor: '#3F3F3F', // 区段延时释放颜色 + protectiveLockColor: '#FFFF00', // 区段保护锁闭 + protectiveTimeReleaseColor: '#0071C1', // 区段保护延时解锁 + logicalColor: '#FFFF00', // 逻辑区段颜色 (未用) + logicalTextColor: '#C0C0C0' // 逻辑区段名称颜色 (未用) + }, + axle: { + radius: 3, // 计轴 半径 + distance: 5, // 计轴和区段之间的距离 (未用) + color: '#C0C0C0', // 区段计轴颜色 + resetColor: '#00FFFF', // 区段计轴预复位颜色 + Failure: '#E6A23C' // #FFFF00 计轴失效 + }, + speedLimit: { // 限速元素 + width: 1, // 限速线的宽度 + Distance: 5, // 限速线距离区段距离 + lineColor: '#FFFF00' // 限速线颜色 + }, + separator: { + width: 1.5, // 分隔符宽度 + endWidth: 1.5, // 尽头分隔符宽度 + endColor: '#7F7F7F', // 尽头分隔符颜色 + color: '#7F7F7F' // 区段边界符颜色 + } }; this[deviceType.Signal] = { - /** 信号机宽度 */ - signalR: 7, - /** 自动信号宽度*/ - signalSigPassWidth: 5, - /** 延迟解锁字体大小*/ - signalDelayTextFontSize: 10, - /** 信号机名称字体大小*/ - signalTextFontSize: 12, - /** 灯柱宽度*/ - signalLampStandardWidth: 1.2, /** 设备距离区段的距离*/ signalDistance: 0, - /** 信号灯按钮距离区段的距离*/ - signalButtonDistance: 5, - /** 自动进路方向*/ - signalSigRouteDirection: false, - /** 自动进路偏移量*/ - signalSigRouteOffset: { x: 4, y: -2 }, - /** 自动通过方向*/ - signalSigPassDirection: true, - /** 自动通过偏移量*/ - signalSigPassOffset: { x: 4, y: 0}, - /** 延时解锁方向*/ - signalSigDelayDirection: false, - /** 延时解锁偏移量*/ - signalSigDelayOffset: { x: 0, y: -5}, - /** 信号灯按钮边线*/ - signalButtonDashColor: '#FFFFFF', - /** 信号灯按钮颜色*/ - signalButtonColor: 'darkgreen', - /** 信号灯按钮闪烁颜色*/ - signalButtonLightenColor: '#E4EF50', - /** 信号灯字体颜色*/ - signalTextRed: '#EF0C08', - /** 信号机字体绿色*/ - signalTextGreen: '#4DD43F', - /** 信号灯灯柱颜色*/ - signalLampStandardColor: '#5578B6', - /** 信号灯锁闭*/ - signalBlockColor: '#EF0C08', - /** 信号灯灰色*/ - signalLampGrayColor: '#7F7F7F', - /** 信号灯红色*/ - signalLampRedColor: '#FF0000', - /** 信号灯绿色*/ - signalLampGreenColor: '#00FF00', - /** 信号灯黄色*/ - signalLampYellowColor: '#FFFF00', - /** 信号灯白色*/ - signalLampWhiteColor: '#FFFFFF', - /** 信号灯蓝色*/ - signalLampBlueColor: '#0070C0' + post: { + /** 信号灯灯柱颜色*/ + signalLampStandardColor: '#5578B6', + signalLampStandardWidth: 1.5 + }, + text: { + /** 是否禁止旋转*/ + isNoRotation: true, + /** 信号机名称字体大小*/ + signalTextFontSize: 10, + /** 信号灯字体默认色*/ + signalDefaultTextColor: '#C0C0C0', + /** 信号灯字体锁定颜色*/ + signalTextBlockColor: '#EF0C08' + }, + lamp: { + /** 禁止线宽度*/ + signalStopWidth: 2, + /** 信号灯边框线宽度*/ + signalBorderWidth: 0.5, + /** 信号灯边框线颜色*/ + signalBorderColor: '#3149C3', + /** 信号机宽度 */ + signalR: 6, + /** 信号灯锁闭*/ + signalBlockColor: '#EF0C08', + /** 信号灯灰色*/ + signalLampGrayColor: '#7F7F7F', + /** 信号灯红色*/ + signalLampRedColor: '#FF0000', + /** 信号灯绿色*/ + signalLampGreenColor: '#00FF00', + /** 信号灯黄色*/ + signalLampYellowColor: '#FFFF00', + /** 信号灯白色*/ + signalLampWhiteColor: '#FFFFFF', + /** 信号灯蓝色*/ + signalLampBlueColor: '#0070C0' + }, + route: { + /** 自动进路方向*/ + signalRouteDirection: false, + /** 自动进路偏移量*/ + signalRouteOffset: { x: 4, y: -2 }, + /** 自动进路*/ + signalRouteColor: '#00FF00' + }, + auto: { + /** 自动通过方向*/ + signalAutoDirection: true, + /** 自动通过偏移量*/ + signalAutoOffset: { x: 4, y: 0}, + /** 自动进路*/ + signalAutoRoute: '#00FF00', + /** 自动触发*/ + signalAutoTrigger: '#FFFF00' + }, + delay: { + /** 延迟解锁字体大小*/ + signalDelayTextFontSize: 9, + /** 延时解锁方向*/ + signalDelayDirection: false, + /** 延时解锁偏移量*/ + signalDelayOffset: { x: 0, y: -5}, + /** 延迟解锁颜色*/ + signalDelayTextColor: '#FF0000' + }, + button: { + /** 信号灯按钮距离区段的距离*/ + signalButtonDistance: 5, + /** 信号灯按钮边线*/ + signalButtonDashColor: '#FFFFFF', + /** 信号灯按钮颜色*/ + signalButtonColor: 'darkgreen', + /** 信号灯按钮闪烁颜色*/ + signalButtonLightenColor: '#E4EF50' + } }; + this[deviceType.StationStand] = { - /** 站台和屏蔽门之间的距离*/ - standDistance: 9, - /** 站台屏蔽门高度*/ - standSafeHeight: 1.6, - /** 站台首端字体大小*/ - standHeadFontSize: 8, - /** 站台默认字体大小*/ - standTextFontSize: 8, - /** 站台紧急关闭半径*/ - standEmergentR: 4, - /** 站台紧急关闭偏移量*/ - standEmergentOffset: {x: 0, y: 0}, - /** 扣车方向*/ - standDetainDirection: 1, - /** 扣车偏移量*/ - standDetainOffset: {x: -8, y: 13}, - /** 运行时间方向*/ - standTimeDirection: 1, - /** 运行时间偏移量*/ - standTimeOffset: {x: -8, y: 3}, - /** 运行等级方向*/ - standLevelDirection: 1, - /** 运行等级偏移量*/ - standLevelOffset: {x: -8, y: 22}, - /** 折返方向*/ - standReentryDirection: 0, - /** 折返偏移量*/ - standReentryOffset: {x: -16, y: 18}, - /** 扣车显示内容*/ - standDetainText: 'H', - /** 站台无人折返*/ - standNoHumanReentryColor: '#0F16DA', - /** 站台自动换端*/ - standAutoChangeEndsColor: '#0BF400', - /** 站台空闲颜色*/ - standSpareColor: '#606060', - /** 站台列车停站颜色*/ - standStopColor: '#FEFE00', - /** 站台跳停颜色*/ - standJumpStopColor: '#9A99FF', - /** 站台指定列车跳停颜色*/ - standDesignatedJumpStopColor: 'lightSkyBlue', - /** 站台紧急关闭颜色*/ - standEmergentCloseColor: '#F61107', - /** 停站时间字体颜色*/ - standTimeTextColor: '#FFFFFF', - /** 停站等级字体颜色*/ - standLevelTextColor: '#FFFFFF', - /** 车站扣车颜色*/ - standDetainTrainColor: '#E4EF50', - /** 中心扣车颜色*/ - standCenterDetainTrainColor: '#FFFFFF', - /** 车站+中心扣车颜色*/ - standAndCenterDetainTrainColor: '#F61107', - /** 屏蔽门默认颜色*/ - standDoorDefaultColor: '#00FF00', - /** 屏蔽门切除颜色*/ - standSplitDoorColor: '#F61107', - /** 车站扣除文字颜色*/ - standDetainTrainTextColor: '#E4EF50', - /** 计数器字体颜色*/ - stationCounterTextColor: '#FFFFFF', - /** 计数器边框颜色*/ - stationCounterBorderColor: '#E4EF50', - /** 延迟解锁倒计时和设备文字之间的距离*/ - stationDelayUnlockDistance: 3, - /** 延时解锁字体颜色*/ - stationDelayUnlockTextColor: '#FFFFFF', - /** 延迟解锁边框颜色*/ - stationDelayUnlockBorderColor: '#FFFFFF' + common: { // 通用属性 + textFontSize: 8 // 站台默认字体大小 + }, + safetyDoor: { // 屏蔽门 + height: 1.6, // 站台屏蔽门高度 + distance: 9, // 站台和屏蔽门之间的距离 + defaultColor: '#00FF00', // 屏蔽门默认颜色 + splitDoorColor: '#F61107' // 屏蔽门切除颜色 + }, + stand: { // 站台 + headFontSize: 8, // 站台首端字体大小 + spareColor: '#606060', // 站台空闲颜色 + stopColor: '#FEFE00', // 站台列车停站颜色 + jumpStopColor: '#9A99FF', // 站台跳停颜色 + designatedJumpStopColor: 'lightSkyBlue' // 站台指定列车跳停颜色 + }, + standEmergent: { // 紧急关闭 + mergentR: 4, // 站台紧急关闭半径 + offset: {x: 0, y: 0}, // 站台紧急关闭偏移量 + closeColor: '#F61107' // 站台紧急关闭颜色 + }, + reentry: { // 站台折返策略 + direction: 0, // 折返方向 + offset: {x: -16, y: 18}, // 折返偏移量 + noHumanColor: '#0F16DA', // 站台无人折返 + AutoChangeEndsColor: '#0BF400' // 站台自动换端 + }, + detainCar: { // 扣车 + text: 'H', // 扣车显示内容 + direction: 1, // 扣车方向 + offset: {x: -8, y: 13}, // 扣车偏移量 + trainColor: '#E4EF50', // 车站扣车颜色 + centerTrainColor: '#FFFFFF', // 中心扣车颜色 + andCenterTrainColor: '#F61107', // 车站+中心扣车颜色 + detainTrainTextColor: '#E4EF50' // 车站扣除文字颜色 + }, + stopTime: { // 停站时间 + direction: 1, // 运行时间方向 + offset: {x: -8, y: 3}, // 运行时间偏移量 + textColor: '#FFFFFF' // 停站时间字体颜色 + }, + level: { // 运行等级 + direction: 1, // 运行等级方向 + offset: {x: -8, y: 22}, // 运行等级偏移量 + textColor: '#FFFFFF' // 停站等级字体颜色 + } }; + this[deviceType.StationControl] = { singleControlNum: 3, - stationOffset: {x: 20, y: 0}, + stationOffset: { x: 20, y: 0 }, arrowsShow: false, // 控制模式箭头显隐 /** 控制模式字体大小*/ stationControlTextSize: 10, /** 控制模式灯的半径 */ - stationControlmodeR: 4, + stationControlmodeR: 6, /** 控制模式之间灯之间的距离*/ stationControlDistance: 36, /** 控制模式灰色*/ @@ -223,155 +213,31 @@ class Beijing extends defaultSkin { /** 控制模式黄色*/ stationControlYellowColor: '#FFFF00' }; + this[deviceType.Station] = { kilometerPosition: 'down' // 公里标位置 }; + this[deviceType.Switch] = { - /** 道岔单边长度 */ - switchLen: 6, - /** 道岔名称与区段距离*/ - switchNameDistance: 2, - /** 道岔边框颜色*/ - switchTextBorderColor: '#FE0000', - /** 道岔失去颜色*/ - switchTextLossColor: '#FFFFFF', - /** 道岔定位颜色*/ - switchLocateTextColor: '#00FF00', - /** 道岔反位颜色*/ - switchInversionColor: '#9C9D09', - /** 道岔单锁颜色*/ - switchMonolockColor: '#870E10', + text: { + /** 道岔名称与区段距离*/ + switchNameDistance: 2, + /** 道岔边框颜色*/ + switchTextBorderColor: '#FE0000', + /** 道岔失去颜色*/ + switchTextLossColor: '#FFFFFF', + /** 道岔定位颜色*/ + switchTextLocateColor: '#00FF00', + /** 道岔反位颜色*/ + switchInversionColor: '#9C9D09', + /** 道岔单锁颜色*/ + switchMonolockColor: '#870E10' + }, + core: { + /** 道岔单边长度 */ + switchLen: 6 + } }; - this[deviceType.Train] = { - /** 车身line宽 */ - trainBodyLineWidth: 0.1, - /** 车身鼠标悬浮事件 */ - trainBodyOnMouseOver: {train: true, textTrainNumber: false, textTrainServer: false, textTrainTarget: false, textTrainTargetNumber: false}, - /** 车身鼠标移出事件 */ - trainBodyOnMouseOut: {train: true, textTrainNumber: false, textTrainServer: false, textTrainTarget: false, textTrainTargetNumber: false}, - /** 服务号(表号)前缀 */ - serviceNumberPrefix: '00', - /** 默认服务号(表号) */ - defaultServiceNumber: 'AA', - /** 车次号前缀 */ - tripNumberPrefix: '000', - /** 默认车次号2 */ - defaultTripNumber: 'DDD', - /** 列车车头比车身高出的长度,上下相比车体伸出去的边框*/ - trainMoreLength: 0, - /** 列车车头三角坐标1偏移量 */ - trainHeadTriangleFirst: { x: 7, y: 1}, - /** 列车车头三角坐标2偏移量 */ - trainHeadTriangleSecond: { x: 13, y: 10}, - /** 列车车头三角坐标3偏移量 */ - trainHeadTriangleThird: { x: 7, y: 19}, - /** 列车高度*/ - trainHeight: 20, - /** 列车和车头之间的间距*/ - trainHeadDistance: 4, - /** 列车车头矩形高度 */ - trainHeadRectHeight: 20, - /** 列车长度*/ - trainWidth: 40, - /** 列车竖杠的宽度*/ - trainConntWidth: 3, - /** 是否根据车身上车组号、服务号、车次号、目的地码显示情况改变列车长度 */ - changeTrainWidth: false, - /** 是否根据nameFormat去动态加载车组号、服务号、车次号、目的地码 */ - dynamicLoadingDisplay: false, - /** 特殊列车类型需设置显示格式 */ - specialTrainType: [], - /** 两边间隔 */ - lrPadding: 4, - /** 上边距离 */ - upPadding: 4, - /** HSDA两边间隔 */ - lrPaddingHSDA: 3, - /** HSDA上边距离 */ - upPaddingHSDA: 4, - /** 列车字号*/ - trainTextFontSize: 12, - /** 目的地状态 01准点 02早点 03晚点 04头码车 */ - destinationStatus: [ - {status: '01',showColor: '#FFFFFF'}, - {status: '02',showColor: '#00FF00'}, - {status: '03',showColor: '#A0522D'}, - {status: '04',showColor: '#FFFF00'}, - ], - /** 默认目的地状态显示颜色 */ - defaultDestinationColor: '#000000', - /** 默认字体 族类*/ - textFontFormat: 'consolas', - /** 列车HDSA字号*/ - trainHSDATextFontSize: 9, - /** 服务号状态类型 01显示服务号 计划车 02显示车组号: 头码车与人工车 */ - serverNoType: [ - {type: '01', showColor: '#FFFFFF'}, - {type: '01', showColor: '#FFFFFF'}, - ], - /** 默认服务号状态显示颜色 */ - defaultServerNoColor: '#000000', - /** 列车运行方向状态类型对应车头显示状态 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 ATO自动驾驶模式AM 03 ATP监控下的人工驾驶模式CM - * 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} - ], - /** 设置通信状态 01正常 02故障 */ - communicationStatus: [ - {status: '01', trainColor:'#725A64'}, - {status: '02', trainColor:'#C0C0C0'} - ], - /** 设置报警状态 01不报警 02报警 */ - alarmStatus: [ - {status: '01', aShow: false}, - {status: '02', aShow: true} - ], - /** 列车车头矩形填充颜色 */ - trainHeadFillColor: '#000000', - /** 列车车身填充颜色 */ - trainBodyFillColor: '#725A64', - /** textH文本 */ - textHContent: 'H', - /** textS文本 */ - textSContent: 'S', - /** textD文本 */ - textDContent: 'D', - /** textA文本 */ - textAContent: 'A', - /** 是否需创建textHSDA对象 */ - haveTextHSDA: true, - /** 是否需创建arrowText对象 */ - haveArrowText: true, - /** 是否需创建trainBorder对象 */ - haveTrainBorder: true, - } } } diff --git a/src/jmap/theme/chengdu.js b/src/jmap/theme/chengdu.js index b480035d1..5553c5581 100644 --- a/src/jmap/theme/chengdu.js +++ b/src/jmap/theme/chengdu.js @@ -82,7 +82,7 @@ class Beijing extends defaultSkin { /** 信号机宽度 */ signalR: 6.5, /** 自动信号宽度*/ - signalSigPassWidth: 5, + signalAutoWidth: 5, /** 延迟解锁字体大小*/ signalDelayTextFontSize: 10, /** 信号机名称字体大小*/ @@ -238,7 +238,7 @@ class Beijing extends defaultSkin { /** 道岔失去颜色*/ switchTextLossColor: '#C00808', /** 道岔定位颜色*/ - switchLocateTextColor: '#08C008', + switchTextLocateColor: '#08C008', /** 道岔反位颜色*/ switchInversionColor: '#C0C000', /** 道岔单锁颜色*/ diff --git a/src/jmap/theme/fuzhou.js b/src/jmap/theme/fuzhou.js index 42b095900..98f4a9261 100644 --- a/src/jmap/theme/fuzhou.js +++ b/src/jmap/theme/fuzhou.js @@ -7,199 +7,188 @@ class Fuzhou extends defaultSkin { this[deviceType.Link] = { /** line 颜色*/ lineWidthColor: '#FFFFFF', - /** link 宽度*/ linkWidth: 4.4, - /** link 线条颜色*/ linkColor: '#3F3F3F', - /** link 字体颜色*/ linkTextColor: '#FFFFFF' }; this[deviceType.Section] = { - sectionTextPosition: 0, // 区段名称位置 1 上行 -1 下面 0 默认 - /** 区段 宽度*/ - sectionWidth: 5, - /** 区段宽超出宽度*/ - sectionBeyondWidth: 1, - /** 计轴 半径*/ - sectionAxleR: 3, - /** 计轴和区段之间的距离*/ /** 需要添加*/ - sectionAxleDistance: 5, - /** 限速线的宽短*/ - sectionSpeedLimitLinewidth: 1, - /** 限速线距离区段距离*/ - sectionSpeedLimitDistance: 5, - sectionSeparatorWidth: 1.2, // 分隔符宽度 - sectionEndSeparatorWidth: 3.5, // 尽头分隔符宽度 - sectionEndSeparatorStroke: '#3F3F3F', // 尽头分隔符颜色 - /** 区段侵入颜色*/ - sectionInvadeColor: '#EF0C08', - /** 限速线颜色*/ - sectionSpeedLimitColor: '#FFFF00', - sectionLogicalBackgroundColor: '#FFFF00', // 逻辑区段颜色 - /** 区段计轴颜色*/ - sectionAxleColor: '#FFFFFF', - /** 区段边界符颜色*/ - sectionSeparatorColor: '#3149C3', - /** 区段空闲颜色*/ - sectionSpareColor: '#3F3F3F', - /** 逻辑区段名称颜色*/ - sectionLogicalTextColor: '#FFFFFF', - /** 区段通信车占用颜色**/ - sectionCommunicationOccupiedColor: '#FF329A', - /** 区段非通讯车占用颜色*/ - sectionUnCommunicationOccupiedColor: '#FE0000', - /** 区段路由锁定颜色*/ - sectionRouteLockColor: '#FFFFFF', - /** 区段故障锁定颜色*/ - sectionFaultLockColor: '#9B4A0A', - /** 区段未定义颜色*/ - sectionUndefinedColor: '#0071C1', - /** 保护区段锁闭*/ - sectionProtectionSectionLockedColor: '#FEFF00', - /** 区段计轴预复位*/ - sectionAxleResetColor: '#00FFFF', - /** 区段封锁颜色*/ - sectionBlockColor: '#800080', - /** 区段atc切除颜色*/ - sectionAtcExcisionColor: '#A0522D', - /** 区段ats切除颜色*/ - sectionAtsExcisionColor: '#A0522D', - /** 区段延时释放颜色*/ - sectionTimeReleaseColor: '#3F3F3F', - /** 区段保护锁闭*/ - sectionProtectiveLockColor: '#FFFF00', - /** 区段保护延时解锁*/ - sectionProtectiveTimeReleaseColor: '#0071C1', - sectionAxleFailure: '#E6A23C' // #FFFF00 计轴失效 + text: { // 区段文字属性 + fontSize: 10, // 字体大小 + fontColor: '#FFFFFF', // 字体颜色 + textAlign: 'center', // 水平对齐方式 + textPosition: 'inside', // 文字位置 + textVerticalAlign: 'middle', // 文字垂直对齐方式 + position: 0 // 区段名称位置 1 上行 -1 下面 0 默认 + }, + line: { + width: 5, // 区段宽度 + beyondWidth: 1, // 区段宽超出宽度 + invadeColor: '#EF0C08', // 区段侵入颜色 + spareColor: '#3F3F3F', // 区段空闲颜色 + communicationOccupiedColor: '#FF329A', // 区段通信车占用颜色 + unCommunicationOccupiedColor: '#FE0000', // 区段非通讯车占用颜色 + routeLockColor: '#FFFFFF', // 区段路由锁定颜色 + faultLockColor: '#9B4A0A', // 区段故障锁定颜色 + undefinedColor: '#0071C1', // 区段未定义颜色 + protectionLockedColor: '#FEFF00', // 保护区段锁闭(未用) + blockColor: '#800080', // 区段封锁颜色 + atcExcisionColor: '#A0522D', // 区段atc切除颜色 + atsExcisionColor: '#A0522D', // 区段ats切除颜色 + timeReleaseColor: '#3F3F3F', // 区段延时释放颜色 + protectiveLockColor: '#FFFF00', // 区段保护锁闭 + protectiveTimeReleaseColor: '#0071C1', // 区段保护延时解锁 + logicalColor: '#FFFF00', // 逻辑区段颜色 (未用) + logicalTextColor: '#FFFFFF' // 逻辑区段名称颜色 (未用) + }, + axle: { + radius: 3, // 计轴 半径 + distance: 5, // 计轴和区段之间的距离 (未用) + color: '#FFFFFF', // 区段计轴颜色 + resetColor: '#00FFFF', // 区段计轴预复位颜色 + Failure: '#E6A23C' // #FFFF00 计轴失效 + }, + speedLimit: { // 限速元素 + width: 1, // 限速线的宽短 + Distance: 5, // 限速线距离区段距离 + lineColor: '#FFFF00' // 限速线颜色 + }, + separator: { + width: 1.2, // 分隔符宽度 + endWidth: 3.5, // 尽头分隔符宽度 + endColor: '#3F3F3F', // 尽头分隔符颜色 + color: '#3149C3' // 区段边界符颜色 + } }; this[deviceType.Signal] = { - /** 信号机宽度 */ - signalR: 5, - /** 自动信号宽度*/ - signalSigPassWidth: 6, - /** 延迟解锁字体大小*/ - signalDelayTextFontSize: 9, - /** 信号机名称字体大小*/ - signalTextFontSize: 12, - /** 灯柱宽度*/ - signalLampStandardWidth: 1.2, /** 设备距离区段的距离*/ - signalDistance: 3, - /** 信号灯按钮距离区段的距离*/ - signalButtonDistance: 5, - /** 自动进路方向*/ - signalSigRouteDirection: false, - /** 自动进路偏移量*/ - signalSigRouteOffset: { x: -4, y: -2 }, - /** 自动通过方向*/ - signalSigPassDirection: false, - /** 自动通过偏移量*/ - signalSigPassOffset: { x: -12, y: 0}, - /** 延时解锁方向*/ - signalSigDelayDirection: true, - /** 延时解锁偏移量*/ - signalSigDelayOffset: { x: 15, y: -10}, - /** 信号灯按钮边线*/ - signalButtonDashColor: '#FFFFFF', - /** 信号灯按钮颜色*/ - signalButtonColor: 'darkgreen', - /** 信号灯按钮闪烁颜色*/ - signalButtonLightenColor: '#E4EF50', - /** 信号灯字体颜色*/ - signalTextRed: '#EF0C08', - /** 信号机字体绿色*/ - signalTextGreen: '#4DD43F', - /** 信号灯灯柱颜色*/ - signalLampStandardColor: '#3149C3', - /** 信号灯锁闭*/ - signalBlockColor: '#EF0C08', - /** 信号灯灰色*/ - signalLampGrayColor: '#7F7F7F', - /** 信号灯红色*/ - signalLampRedColor: '#FF0000', - /** 信号灯绿色*/ - signalLampGreenColor: '#00FF00', - /** 信号灯黄色*/ - signalLampYellowColor: '#FFFF00', - /** 信号灯白色*/ - signalLampWhiteColor: '#FFFFFF', - /** 信号灯蓝色*/ - signalLampBlueColor: '#0070C0' + signalDistance: 10, + post: { + signalLampStandardColor: '#3149C3', + signalLampStandardWidth: 2 + }, + text: { + /** 是否禁止旋转*/ + isNoRotation: true, + /** 信号机名称字体大小*/ + signalTextFontSize: 10, + /** 信号灯字体默认色*/ + signalDefaultTextColor: '#FFFFFF', + /** 信号灯字体锁定颜色*/ + signalTextBlockColor: '#EF0C08' + }, + lamp: { + /** 禁止线宽度*/ + signalStopWidth: 2, + /** 信号灯边框线宽度*/ + signalBorderWidth: 0.5, + /** 信号灯边框线颜色*/ + signalBorderColor: '#3149C3', + /** 信号灯半径*/ + signalR: 6, + /** 信号灯锁闭*/ + signalBlockColor: '#EF0C08', + /** 信号灯灰色*/ + signalLampGrayColor: '#7F7F7F', + /** 信号灯红色*/ + signalLampRedColor: '#FF0000', + /** 信号灯绿色*/ + signalLampGreenColor: '#00FF00', + /** 信号灯黄色*/ + signalLampYellowColor: '#FFFF00', + /** 信号灯白色*/ + signalLampWhiteColor: '#FFFFFF', + /** 信号灯蓝色*/ + signalLampBlueColor: '#0070C0' + }, + route: { + /** 自动进路方向*/ + signalRouteDirection: false, + /** 自动进路偏移量*/ + signalRouteOffset: { x: -4, y: 0 }, + /** 自动进路*/ + signalRouteColor: '#00FF00' + }, + auto: { + /** 自动通过方向*/ + signalAutoDirection: false, + /** 自动通过偏移量*/ + signalAutoOffset: { x: -4, y: 0}, + /** 自动进路*/ + signalAutoRoute: '#00FF00', + /** 自动触发*/ + signalAutoTrigger: '#FFFF00' + }, + delay: { + /** 延迟解锁字体大小*/ + signalDelayTextFontSize: 9, + /** 延时解锁方向*/ + signalDelayDirection: true, + /** 延时解锁偏移量*/ + signalDelayOffset: { x: 15, y: -10}, + /** 延迟解锁颜色*/ + signalDelayTextColor: '#FF0000' + }, + button: { + /** 信号灯按钮距离区段的距离*/ + signalButtonDistance: 5, + /** 信号灯按钮边线*/ + signalButtonDashColor: '#FFFFFF', + /** 信号灯按钮颜色*/ + signalButtonColor: 'darkgreen', + /** 信号灯按钮闪烁颜色*/ + signalButtonLightenColor: '#E4EF50' + } }; this[deviceType.StationStand] = { - /** 站台和屏蔽门之间的距离*/ - standDistance: 8, - /** 站台屏蔽门高度*/ - standSafeHeight: 3, - /** 站台首端字体大小*/ - standHeadFontSize: 10, - /** 站台默认字体大小*/ - standTextFontSize: 10, - /** 站台紧急关闭半径*/ - standEmergentR: 4, - /** 站台紧急关闭偏移量*/ - standEmergentOffset: {x: 0, y: 40}, - /** 扣车方向*/ - standDetainDirection: -1, - /** 扣车偏移量*/ - standDetainOffset: {x: -8, y: -6}, - /** 运行时间方向*/ - standTimeDirection: 1, - /** 运行时间偏移量*/ - standTimeOffset: {x: -8, y: 26}, - /** 运行等级方向*/ - standLevelDirection: 1, - /** 运行等级偏移量*/ - standLevelOffset: {x: -8, y: 6}, - /** 折返方向*/ - standReentryDirection: 0, - /** 折返偏移量*/ - standReentryOffset: {x: -16, y: 20}, - /** 扣车显示内容*/ - standDetainText: 'H', - /** 站台无人折返*/ - standNoHumanReentryColor: '#0F16DA', - /** 站台自动换端*/ - standAutoChangeEndsColor: '#0BF400', - /** 站台空闲颜色*/ - standSpareColor: '#606060', - /** 站台列车停站颜色*/ - standStopColor: '#FEFE00', - /** 站台跳停颜色*/ - standJumpStopColor: '#9A99FF', - /** 站台指定列车跳停颜色*/ - standDesignatedJumpStopColor: 'lightSkyBlue', - /** 站台紧急关闭颜色*/ - standEmergentCloseColor: '#F61107', - /** 停站时间字体颜色*/ - standTimeTextColor: '#FFFFFF', - /** 停站等级字体颜色*/ - standLevelTextColor: '#FFFFFF', - /** 车站扣车颜色*/ - standDetainTrainColor: '#E4EF50', - /** 中心扣车颜色*/ - standCenterDetainTrainColor: '#FFFFFF', - /** 车站+中心扣车颜色*/ - standAndCenterDetainTrainColor: '#F61107', - /** 屏蔽门默认颜色*/ - standDoorDefaultColor: '#00FF00', - /** 屏蔽门切除颜色*/ - standSplitDoorColor: '#F61107', - /** 车站扣除文字颜色*/ - standDetainTrainTextColor: '#E4EF50', - /** 计数器字体颜色*/ - stationCounterTextColor: '#FFFFFF', - /** 计数器边框颜色*/ - stationCounterBorderColor: '#E4EF50', - /** 延迟解锁倒计时和设备文字之间的距离*/ - stationDelayUnlockDistance: 3, - /** 延时解锁字体颜色*/ - stationDelayUnlockTextColor: '#FFFFFF', - /** 延迟解锁边框颜色*/ - stationDelayUnlockBorderColor: '#FFFFFF' + common: { // 通用属性 + textFontSize: 10 // 站台默认字体大小 + }, + safetyDoor: { // 屏蔽门 + height: 3, // 站台屏蔽门高度 + distance: 8, // 站台和屏蔽门之间的距离 + defaultColor: '#00FF00', // 屏蔽门默认颜色 + splitDoorColor: '#F61107' // 屏蔽门切除颜色 + }, + stand: { // 站台 + headFontSize: 10, // 站台首端字体大小 + spareColor: '#606060', // 站台空闲颜色 + stopColor: '#FEFE00', // 站台列车停站颜色 + jumpStopColor: '#9A99FF', // 站台跳停颜色 + designatedJumpStopColor: 'lightSkyBlue' // 站台指定列车跳停颜色 + }, + standEmergent: { // 紧急关闭 + mergentR: 4, // 站台紧急关闭半径 + offset: {x: 0, y: 40}, // 站台紧急关闭偏移量 + closeColor: '#F61107' // 站台紧急关闭颜色 + }, + reentry: { // 站台折返策略 + direction: 0, // 折返方向 + offset: {x: -16, y: 20}, // 折返偏移量 + noHumanColor: '#0F16DA', // 站台无人折返 + AutoChangeEndsColor: '#0BF400' // 站台自动换端 + }, + detainCar: { // 扣车 + text: 'H', // 扣车显示内容 + direction: -1, // 扣车方向 + offset: {x: -8, y: -6}, // 扣车偏移量 + trainColor: '#E4EF50', // 车站扣车颜色 + centerTrainColor: '#FFFFFF', // 中心扣车颜色 + andCenterTrainColor: '#F61107', // 车站+中心扣车颜色 + detainTrainTextColor: '#E4EF50' // 车站扣除文字颜色 + }, + stopTime: { // 停站时间 + direction: 1, // 运行时间方向 + offset: {x: -8, y: 26}, // 运行时间偏移量 + textColor: '#FFFFFF' // 停站时间字体颜色 + }, + level: { // 运行等级 + direction: 1, // 运行等级方向 + offset: {x: -8, y: 6}, // 运行等级偏移量 + textColor: '#FFFFFF' // 停站等级字体颜色 + } }; this[deviceType.StationControl] = { singleControlNum: 2, @@ -224,20 +213,24 @@ class Fuzhou extends defaultSkin { kilometerPosition: 'up' }; this[deviceType.Switch] = { - /** 道岔单边长度 */ - switchLen: 6, - /** 道岔名称与区段距离*/ - switchNameDistance: 2, - /** 道岔边框颜色*/ - switchTextBorderColor: '#FE0000', - /** 道岔失去颜色*/ - switchTextLossColor: '#FFFFFF', - /** 道岔定位颜色*/ - switchLocateTextColor: '#00FF00', - /** 道岔反位颜色*/ - switchInversionColor: '#9C9D09', - /** 道岔单锁颜色*/ - switchMonolockColor: '#870E10' + text: { + /** 道岔名称与区段距离*/ + switchNameDistance: 2, + /** 道岔边框颜色*/ + switchTextBorderColor: '#FE0000', + /** 道岔失去颜色*/ + switchTextLossColor: '#FFFFFF', + /** 道岔定位颜色*/ + switchTextLocateColor: '#00FF00', + /** 道岔反位颜色*/ + switchInversionColor: '#9C9D09', + /** 道岔单锁颜色*/ + switchMonolockColor: '#870E10' + }, + core: { + /** 道岔单边长度 */ + switchLen: 6 + } }; this[deviceType.Train] = { /** 车身line宽 */ diff --git a/src/jmap/utils/parser.js b/src/jmap/utils/parser.js index 613f10dbf..0cd850676 100644 --- a/src/jmap/utils/parser.js +++ b/src/jmap/utils/parser.js @@ -21,6 +21,7 @@ export function parser(data, jmap) { zrUtil.each(data.sectionList || [], elem => { mapDevice[elem.code] = deviceFactory(deviceType.Section, defaultStateDict, elem); + }, this); zrUtil.each(data.signalList || [], elem => { @@ -82,7 +83,10 @@ export function parser(data, jmap) { zrUtil.each(data.switchList || [], elem => { const cnodeSection = elem['sectionA'] = mapDevice[elem.sectionACode]; const lnodeSection = elem['sectionB'] = mapDevice[elem.sectionBCode]; - const rnodeSection = elem['sectionC'] =mapDevice[elem.sectionCCode]; + const rnodeSection = elem['sectionC'] = mapDevice[elem.sectionCCode]; + + cnodeSection.model['switch'] = lnodeSection.model['switch'] = rnodeSection.model['switch'] = elem; + if (cnodeSection && lnodeSection && rnodeSection) { const cnode = mapDevice[cnodeSection.model.linkCode]; if (cnode && cnode.model.leftFdCode === lnodeSection.model.linkCode && cnode.model.leftSdCode === rnodeSection.model.linkCode) { diff --git a/src/views/jmap/index.vue b/src/views/jmap/index.vue index 388b424df..3619c1577 100644 --- a/src/views/jmap/index.vue +++ b/src/views/jmap/index.vue @@ -58,7 +58,7 @@ export default { // this.jmap.load({ skinVO: { code: '02' }, linkList: list }); - getPublishMapDetail('02').then(resp => { + getPublishMapDetail('03').then(resp => { this.jmap.setLevelVisible([deviceType.Link], false); this.jmap.load(resp.data); // this.jmap.setDefaultState();