diff --git a/src/jmap/config/defaultStyle.js b/src/jmap/config/defaultStyle.js index 55f10343d..61d9b0ae9 100644 --- a/src/jmap/config/defaultStyle.js +++ b/src/jmap/config/defaultStyle.js @@ -24,15 +24,6 @@ export default class defaultStyle { /** 默认字体阴影颜色*/ this.textShadowColor = '#FFFF00'; - /** 默认border文字背景色*/ - this.borderContextBackgroundColor = '#00FFFF'; - - /** 默认border颜色*/ - this.borderColor = '#fff'; - - /** 默认border线宽*/ - this.borderWidth = 1; - /** 默认名称和设备的距离*/ this.nameDistance = 2; diff --git a/src/jmap/config/deviceStyle.js b/src/jmap/config/deviceStyle.js index 207dcb820..11821bb6b 100644 --- a/src/jmap/config/deviceStyle.js +++ b/src/jmap/config/deviceStyle.js @@ -1,7 +1,7 @@ const mapDeviceStyle = { '02': 'fuzhou_01', - '03': 'bejing_01', - '04': 'chengdu_03', + // '03': 'bejing_01', + '03': 'chengdu_03', '05': 'batong_01' }; diff --git a/src/jmap/config/skinStyle/bejing_01.js b/src/jmap/config/skinStyle/bejing_01.js index dab085194..8d2079a66 100644 --- a/src/jmap/config/skinStyle/bejing_01.js +++ b/src/jmap/config/skinStyle/bejing_01.js @@ -75,24 +75,30 @@ class SkinStyle extends defaultStyle { signalLampStandardWidth: 1.5 }, text: { + /** 文字和灯杆的距离*/ + distance: 3, /** 是否禁止旋转*/ isNoRotation: true, + /** 信号字体对其方式*/ + isAlignCenter: false, /** 信号机名称字体大小*/ signalTextFontSize: 10, /** 信号灯字体默认色*/ signalDefaultTextColor: '#C0C0C0', /** 信号灯字体锁定颜色*/ - signalTextBlockColor: '#EF0C08' + signalTextBlockColor: '#EF0C08', + /** 信号字体*/ + signalTextblock: '#00FF00' }, lamp: { /** 禁止线宽度*/ signalStopWidth: 2, /** 信号灯边框线宽度*/ - signalBorderWidth: 0.5, + signalBorderWidth: 1, /** 信号灯边框线颜色*/ signalBorderColor: '#3149C3', /** 信号机宽度 */ - signalR: 6, + signalR: 5, /** 信号灯锁闭*/ signalBlockColor: '#EF0C08', /** 信号灯灰色*/ @@ -145,6 +151,13 @@ class SkinStyle extends defaultStyle { signalButtonColor: 'darkgreen', /** 信号灯按钮闪烁颜色*/ signalButtonLightenColor: '#E4EF50' + }, + mouseEvent: true, + mouse: { + borderLineColor: '#FFFFFF', + borderLineDash: [3, 3], + nameBackgroundColor: '#22DFDF', + lampBorderLineColor: '#22DFDF' } }; @@ -194,6 +207,11 @@ class SkinStyle extends defaultStyle { direction: 1, // 运行等级方向 offset: {x: -8, y: 22}, // 运行等级偏移量 textColor: '#FFFFFF' // 停站等级字体颜色 + }, + mouseEvent: true, + mouse: { + borderLineColor: '#FFFFFF', + borderLineDash: [3, 3] } }; diff --git a/src/jmap/config/skinStyle/chengdu_03.js b/src/jmap/config/skinStyle/chengdu_03.js index 521c1e353..11037d119 100644 --- a/src/jmap/config/skinStyle/chengdu_03.js +++ b/src/jmap/config/skinStyle/chengdu_03.js @@ -7,209 +7,212 @@ class SkinStyle extends defaultStyle { 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: '#C0C0C0', // 尽头分隔符颜色 - /** 区段侵入颜色*/ - sectionInvadeColor: '#C00808', - /** 限速线颜色*/ - sectionSpeedLimitColor: '#C0C000', - /** 逻辑区段颜色*/ - sectionLogicalBackgroundColor: '#C0C000', - /** 区段计轴颜色*/ - sectionAxleColor: '#C0C0C0', - /** 区段边界符颜色*/ - sectionSeparatorColor: '#C0C0C0', - /** 区段空闲颜色*/ - sectionSpareColor: '#5B5893', - /** 逻辑区段名称颜色*/ - sectionLogicalTextColor: '#FFFFFF', - /** 区段通信车占用颜色**/ - sectionCommunicationOccupiedColor: '#FF00FF', - /** 区段非通讯车占用颜色*/ - sectionUnCommunicationOccupiedColor: '#DE310C', - /** 区段路由锁定颜色*/ - sectionRouteLockColor: '#00FF00', - /** 区段故障锁定颜色*/ - sectionFaultLockColor: '#FFFFFF', - /** 区段未定义颜色*/ - sectionUndefinedColor: '#0071C1', - /** 保护区段锁闭*/ - sectionProtectionSectionLockedColor: '#00FF00', - /** 区段计轴预复位*/ - sectionAxleResetColor: '#00FFFF', - /** 区段封锁颜色*/ - sectionBlockColor: '#00FFFF', - /** 区段atc切除颜色*/ - sectionAtcExcisionColor: '#A0522D', - /** 区段ats切除颜色*/ - sectionAtsExcisionColor: '#A0522D', - /** 区段延时释放颜色*/ - sectionTimeReleaseColor: '#3F3F3F', - /** 区段保护锁闭*/ - sectionProtectiveLockColor: '#00C957', - /** 区段保护延时解锁*/ - sectionProtectiveTimeReleaseColor: '#0071C1', - /** 计轴失效*/ - sectionAxleFailure: '#B18F38' + text: { // 区段文字属性 + fontSize: 10, // 字体大小 + fontFormat: 'consolas', // 字体族类 + fontColor: '#FFFFFF', // 字体颜色 + textAlign: 'center', // 水平对齐方式 + textPosition: 'inside', // 文字位置 + textVerticalAlign: 'middle', // 文字垂直对齐方式 + position: 1 // 区段名称位置 1 上面 -1 下面 0 默认 + }, + line: { + width: 5, // 区段宽度 + beyondWidth: 0, // 区段宽超出宽度 + invadeColor: '#FFFFFF', // 区段侵入颜色 + spareColor: '#5578B6', // 区段空闲颜色 + communicationOccupiedColor: '#FF00FF', // 区段通信车占用颜色 + unCommunicationOccupiedColor: '#DE310C', // 区段非通讯车占用颜色 + routeLockColor: '#FFFFFF', // 区段路由锁定颜色 + faultLockColor: '#006400', // 区段故障锁定颜色 + undefinedColor: '#0071C1', // 区段未定义颜色 + protectionLockedColor: '#FFFFFF', // 保护区段锁闭 + blockColor: '#00FF00', // 区段封锁颜色 + 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: '#FFFFFF', // 尽头分隔符颜色 + color: '#FFFFFF' // 区段边界符颜色 + } }; this[deviceType.Signal] = { - /** 信号机宽度 */ - signalR: 6.5, - /** 自动信号宽度*/ - signalAutoWidth: 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: '#C0C0C0', - /** 信号灯按钮颜色*/ - signalButtonColor: 'darkgreen', - /** 信号灯按钮闪烁颜色*/ - signalButtonLightenColor: '#E4EF50', - /** 信号灯字体颜色*/ - signalTextRed: '#EF0C08', - /** 信号机字体绿色*/ - signalTextGreen: '#00FF00', - /** 信号灯灯柱颜色*/ - signalLampStandardColor: '#FFFFFF', - /** 信号灯锁闭*/ - signalBlockColor: '#EF0C08', - /** 信号灯灰色*/ - signalLampGrayColor: '#7F7F7F', - /** 信号灯红色*/ - signalLampRedColor: '#FF0000', - /** 信号灯绿色*/ - signalLampGreenColor: '#00FF00', - /** 信号灯黄色*/ - signalLampYellowColor: '#FFFF00', - /** 信号灯白色*/ - signalLampWhiteColor: '#FFFFFF', - /** 信号灯蓝色*/ - signalLampBlueColor: '#0000FF' + signalDistance: 10, + post: { + signalLampStandardColor: '#FFFFFF', + signalLampStandardWidth: 2 + }, + text: { + /** 文字和灯杆的距离*/ + distance: 0, + /** 是否禁止旋转*/ + isNoRotation: true, + /** 信号字体对其方式*/ + isAlignCenter: false, + /** 信号机名称字体大小*/ + signalTextFontSize: 10, + /** 信号灯字体默认色*/ + signalDefaultTextColor: '#FFFFFF', + /** 信号灯字体锁定颜色*/ + signalTextBlockColor: '#EF0C08', + /** 信号字体*/ + signalTextblock: '#00FF00' + }, + lamp: { + /** 禁止线宽度*/ + signalStopWidth: 2, + /** 信号灯边框线宽度*/ + signalBorderWidth: 2, + /** 信号灯边框线颜色*/ + 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}, + /** 人工控制*/ + signalManual: '#FFFF00', + /** 自动进路*/ + signalAutoRoute: '#00FF00', + /** 自动触发*/ + signalAutoTrigger: '#FFFF00', + /** 出车冲突*/ + signalConflict: '#C00808' + }, + delay: { + /** 延迟解锁字体大小*/ + signalDelayTextFontSize: 9, + /** 延时解锁方向*/ + signalDelayDirection: true, + /** 延时解锁偏移量*/ + signalDelayOffset: { x: 15, y: -10}, + /** 延迟解锁颜色*/ + signalDelayTextColor: '#C00808' + }, + button: { + /** 信号灯按钮距离区段的距离*/ + signalButtonDistance: 5, + /** 信号灯按钮边线*/ + signalButtonDashColor: '#FFFFFF', + /** 信号灯按钮颜色*/ + signalButtonColor: 'darkgreen', + /** 信号灯按钮闪烁颜色*/ + signalButtonLightenColor: '#E4EF50' + } }; this[deviceType.StationStand] = { - /** 站台和屏蔽门之间的距离*/ - standDistance: 1.5, - /** 站台屏蔽门高度*/ - standSafeHeight: 4, - /** 站台首端字体大小*/ - standHeadFontSize: 8, - /** 站台默认字体大小*/ - standTextFontSize: 8, - /** 站台紧急关闭半径*/ - standEmergentR: 4, - /** 站台紧急关闭偏移量*/ - standEmergentOffset: {x: 0, y: -15}, - /** 扣车方向*/ - standDetainDirection: -1, - /** 扣车偏移量*/ - standDetainOffset: {x: -12, y: -20}, - /** 运行时间方向*/ - standTimeDirection: 1, - /** 运行时间偏移量*/ - standTimeOffset: {x: -12, y: 5}, - /** 运行等级方向*/ - standLevelDirection: 1, - /** 运行等级偏移量*/ - standLevelOffset: {x: -12, y: 20}, - /** 折返方向*/ - standReentryDirection: 0, - /** 折返偏移量*/ - standReentryOffset: {x: -16, y: 18}, - /** 扣车显示内容*/ - standDetainText: '扣', - /** 跳停显示内容*/ - standJumpText: '跳', - /** 站台无人折返*/ - 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: 3, - stationOffset: {x: 20, y: 0}, - arrowsShow: false, // 控制模式箭头显隐 + text: { + fontSize: 10, + fontFormat: 'consolas', + fontColor: '#ffffff', + fontWeight: 'normal', + textAlign: 'middle', + textVerticalAlign: 'top' + }, + singleControlNum: 2, + stationOffset: {x: 0, y: 0}, + arrowsShow: true, // 控制模式箭头显隐 /** 控制模式字体大小*/ stationControlTextSize: 10, /** 控制模式灯的半径 */ @@ -226,86 +229,136 @@ class SkinStyle extends defaultStyle { stationControlYellowColor: '#FFFF00' }; this[deviceType.Station] = { - kilometerPosition: 'down' // 公里标位置 + kilometerPosition: 'up' }; this[deviceType.Switch] = { - /** 道岔单边长度 */ - switchLen: 6, - /** 道岔名称与区段距离*/ - switchNameDistance: 2, - /** 道岔边框颜色*/ - switchTextBorderColor: '#FE0000', - /** 道岔失去颜色*/ - switchTextLossColor: '#C00808', - /** 道岔定位颜色*/ - switchTextLocateColor: '#08C008', - /** 道岔反位颜色*/ - switchInversionColor: '#C0C000', - /** 道岔单锁颜色*/ - switchMonolockColor: '#FFFFFF' + text: { + /** 道岔名称与区段距离*/ + switchNameDistance: 2, + /** 道岔边框颜色*/ + switchTextBorderColor: '#FE0000', + /** 道岔失去颜色*/ + switchTextLossColor: '#C00808', + /** 道岔定位颜色*/ + switchTextLocateColor: '#00FF00', + /** 道岔反位颜色*/ + switchInversionColor: '#FFFF00', + /** 道岔单锁颜色*/ + switchMonolockColor: '#FFFFFF' + }, + core: { + /** 道岔单边长度 */ + switchLen: 6 + } + }; + this[deviceType.LcControl] = { + text: { + fontSize: 10, + distance: 5 // 灯跟文字距离 + }, + lamp: { + radiusR: 6, + controlColor: '#FFFF00' + } + }; + this[deviceType.ZcControl] = { + text: { + fontSize: 10, + distance: 5 // 灯跟文字距离 + }, + lamp: { + radiusR: 6, + controlColor: '#00FF00' + } + }; + this[deviceType.LimitControl] = { + text: { + fontSize: 10, + distance: 5 // 灯跟文字距离 + }, + lamp: { + radiusR: 6, + controlColor: '#ECE9D8' + } }; this[deviceType.Train] = { /** 车身line宽 */ - trainBodyLineWidth: 0.5, + trainBodyLineWidth: 0, /** 车身鼠标悬浮事件 */ - trainBodyOnMouseOver: {train: false, textTrainNumber: false, textTrainServer: false, textTrainTarget: false, textTrainTargetNumber: false}, + trainBodyOnMouseOver: {train: true, textTrainNumber: false, textTrainServer: false, textTrainTarget: false, textTrainTargetNumber: false}, /** 车身鼠标移出事件 */ - trainBodyOnMouseOut: {train: false, textTrainNumber: false, textTrainServer: false, textTrainTarget: false, textTrainTargetNumber: false}, + trainBodyOnMouseOut: {train: true, textTrainNumber: false, textTrainServer: false, textTrainTarget: false, textTrainTargetNumber: false}, + /** 目的地码前缀*/ + targetCodePrefix: '000', + /** 默认目的地码 */ + defaultTargetCode: 'AAA', /** 服务号(表号)前缀 */ serviceNumberPrefix: '00', /** 默认服务号(表号) */ - defaultServiceNumber: 'AA', + defaultServiceNumber: 'BB', /** 车次号前缀 */ - tripNumberPrefix: '000', + tripNumberPrefix: '0000', + /** 默认车次号1 */ + defaultDirectionCode: 'D', /** 默认车次号2 */ - defaultTripNumber: 'DDD', + defaultTripNumber: 'CCC', + /** 车组号前缀 */ + groupNumberPrefix: '000', + /** 默认车组号 */ + defaultGroupNumber: 'EEE', /** 列车车头比车身高出的长度,上下相比车体伸出去的边框*/ trainMoreLength: 1, /** 列车车头三角坐标1偏移量 */ - trainHeadTriangleFirst: { x: 4, y: 0}, + trainHeadTriangleFirst: { x: 0, y: 0}, /** 列车车头三角坐标2偏移量 */ - trainHeadTriangleSecond: { x: 10, y: 9.5}, + trainHeadTriangleSecond: { x: 4, y: 8.5}, /** 列车车头三角坐标3偏移量 */ - trainHeadTriangleThird: { x: 4, y: 18}, + trainHeadTriangleThird: { x: 0, y: 15}, /** 列车高度*/ - trainHeight: 18, + trainHeight: 17, /** 列车和车头之间的间距*/ trainHeadDistance: 2, /** 列车车头矩形高度 */ - trainHeadRectHeight: 18, + trainHeadRectHeight: 15, /** 列车长度*/ - trainWidth: 60, + trainWidth: 76, /** 列车竖杠的宽度*/ - trainConntWidth: 2, + trainConntWidth: 4, /** 是否根据车身上车组号、服务号、车次号、目的地码显示情况改变列车长度 */ - changeTrainWidth: false, + changeTrainWidth: true, /** 是否根据nameFormat去动态加载车组号、服务号、车次号、目的地码 */ - dynamicLoadingDisplay: false, + dynamicLoadingDisplay: true, /** 特殊列车类型需设置显示格式 */ - specialTrainType: [], + specialTrainType: [{ type: '03', serviceNumber: 'MM', nameFormat: 'serviceNumber:groupNumber'}], /** 两边间隔 */ - lrPadding: 4, + lrPadding: 1, /** 上边距离 */ - upPadding: 4, - /** HSDA两边间隔 */ - lrPaddingHSDA: 4, - /** HSDA上边距离 */ - upPaddingHSDA: 4, + upPadding: 1, /** 列车字号*/ - trainTextFontSize: 12, - /** 目的地状态 eg:{status: '01',showColor: '#FFFFFF'} */ - destinationStatus: [], + trainTextFontSize: 15, + /** 目的地状态 01准点 02早点 03严重早点 04晚点 05严重晚点 06头码车 07ATP切除 */ + destinationStatus: [ + {status: '01', showColor: '#FFFFFF'}, + {status: '02', showColor: '#00FF00'}, + {status: '03', showColor: '#3265FF'}, + {status: '04', showColor: '#9B4A09'}, + {status: '05', showColor: '#EF0C08'}, + {status: '06', showColor: '#FFFFFF'}, + {status: '07', showColor: '#FFFF00'} + ], + /** 目的地状态设置的对应哪个text的颜色 */ + destinationStatusSetText: 'trainServer', /** 默认字体 族类*/ - textFontFormat: 'consolas', + textFontFormat: '宋体', /** 列车HDSA字号*/ - trainHSDATextFontSize: 9, + trainHSDATextFontSize: 8, /** 服务号状态类型 eg:{type: '01', showColor: '#FFFFFF'} */ serverNoType: [], - /** 列车运行方向状态类型对应车头显示状态 01未知方向 02从左往右 上行 03从右往左 下行*/ + /** 运行方向状态类型对应车头显示状态 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 } + {type: '01', lineLShow: false, lineRShow: false, arrowLShow: false, arrowRShow: false }, + {type: '02', lineLShow: false, lineRShow: false, arrowLShow: false, arrowRShow: true }, + {type: '03', lineLShow: false, lineRShow: false, arrowLShow: true, arrowRShow: false } ], /** 列车停止方向类型对应车头显示状态 01未知方向 02从左往右 上行 03从右往左 下行 */ directionStopType: [ @@ -313,67 +366,56 @@ class SkinStyle extends defaultStyle { {type: '02', lineLShow: false, lineRShow: true}, {type: '03', lineLShow: true, lineRShow: false} ], - /** 列车运行模式对应车头颜色 01未知 02 ATO自动驾驶模式AM 03 ATP监控下的人工驾驶模式CM + /** 列车运行模式对应车头颜色 01信号中断 02 ATO自动驾驶模式AM 03 ATP监控下的人工驾驶模式CM * 04 限制人工驾驶模式RM 05 非限制人工驾驶模式RM*/ runModeStatus: [ - {status: '01', trainLColor: '#FFFFFF', trainRColor: '#FFFFFF'}, + {status: '01', trainLColor: '#EF0C08', trainRColor: '#EF0C08'}, {status: '02', trainLColor: '#00FF00', trainRColor: '#00FF00'}, {status: '03', trainLColor: '#FFFF00', trainRColor: '#FFFF00'}, - {status: '04', trainLColor: '#A0522D', trainRColor: '#A0522D'}, + {status: '04', trainLColor: '#EA700D', trainRColor: '#EA700D'}, {status: '05', trainLColor: '#A0522D', trainRColor: '#A0522D'} ], - /** 设置运行控制状态类型 01正常 02扣车 03停跳 */ - runControlStatus: [ - {status: '01', hShow: false, sShow: false}, - {status: '02', hShow: true, sShow: false}, - {status: '03', hShow: false, sShow: true} - ], - /** 设置车门状态类型 01关门 02开门 */ - doorStatus: [ - {status: '01', dShow: false}, - {status: '02', dShow: true} - ], + /** 设置运行控制状态类型 eg:{status: '01', hShow: false, sShow: false}, */ + runControlStatus: [], + /** 设置车门状态类型 eg:{status: '01', dShow: false}, */ + doorStatus: [], /** 设置通信状态 eg:{status: '01', trainColor:'#725A64'}, */ communicationStatus: [], - /** 设置报警状态 01不报警 02报警 */ - alarmStatus: [ - {status: '01', aShow: false}, - {status: '02', aShow: true} - ], + /** 设置报警状态 eg:{status: '01', aShow: false}, */ + alarmStatus: [], /** 列车车头矩形填充颜色 */ - trainHeadFillColor: '#000000', + trainHeadFillColor: '#EF0C08', /** 列车车身填充颜色 */ - trainBodyFillColor: '#3265FF', - /** textH文本 */ - textHContent: '扣', - /** textS文本 */ - textSContent: '跳', - /** textD文本 */ - textDContent: '门', - /** textA文本 */ - textAContent: '警', - /** 是否需创建textHSDA对象 */ - haveTextHSDA: true, - /** 是否需创建arrowText对象 */ - haveArrowText: false, - /** 是否需创建trainBorder对象 */ - haveTrainBorder: false, + trainBodyFillColor: '#000000', /** 列车服务号偏移 */ - trainServerOffset: { x: 4, y: 4}, + trainServerOffset: { x: -1, y: 1}, /** 列车车次号偏移 */ - trainTargetOffset: { x: 56, y: 4}, + trainTargetOffset: { x: -1, y: 1}, + /** 列车显示格式 */ + trainNameFormat: 'targetCode:serviceNumber:tripNumber', + /** 字体大小 */ + nameFontSize: 10, /** 目的地码文字显示位置 */ - trainTargetTextAlign: 'right' + trainTargetTextAlign: 'left', + /** 是否需创建textHSDA对象 */ + haveTextHSDA: false, + /** 是否需创建arrowText对象 */ + haveArrowText: true, + /** 是否需创建trainBorder对象 */ + haveTrainBorder: false }; this[deviceType.TrainWindow] = { /** 车次窗颜色*/ - trainWindowColor: '#C0C0C0', + trainWindowColor: '#4DD43F', /** 车次窗虚线间隔 */ - lineDash: [3, 3], + lineDash: null, /** 车次窗线宽 */ - trainWindowLineWidth: 1, + trainWindowLineWidth: 1.5, /** 车次窗矩形圆滑程度 */ - trainWindowSmooth: 0.01 + trainWindowSmooth: 0 + }; + this[deviceType.Line] = { + lineColor: '#FFFFFF' }; } } diff --git a/src/jmap/config/skinStyle/fuzhou_01.js b/src/jmap/config/skinStyle/fuzhou_01.js index 17391285b..d320ab0de 100644 --- a/src/jmap/config/skinStyle/fuzhou_01.js +++ b/src/jmap/config/skinStyle/fuzhou_01.js @@ -70,14 +70,20 @@ class SkinStyle extends defaultStyle { signalLampStandardWidth: 2 }, text: { + /** 文字和灯杆的距离*/ + distance: 0, /** 是否禁止旋转*/ isNoRotation: true, + /** 信号字体对其方式*/ + isAlignCenter: true, /** 信号机名称字体大小*/ signalTextFontSize: 10, /** 信号灯字体默认色*/ signalDefaultTextColor: '#FFFFFF', /** 信号灯字体锁定颜色*/ - signalTextBlockColor: '#EF0C08' + signalTextBlockColor: '#EF0C08', + /** 信号字体*/ + signalTextblock: '#00FF00' }, lamp: { /** 禁止线宽度*/ diff --git a/src/jmap/map.js b/src/jmap/map.js index 8aaca87b2..cc929072f 100644 --- a/src/jmap/map.js +++ b/src/jmap/map.js @@ -8,7 +8,6 @@ import deviceState from './constant/deviceState'; import deviceType from './constant/deviceType'; import { selectSkinStyle } from './config/deviceStyle'; import { parser, deviceFactory, createBoundingRect, calculateDCenter } from './utils/parser'; -import Theme from './theme/factory'; const renderer = 'canvas'; const devicePixelRatio = 1; @@ -30,9 +29,6 @@ class Jlmap { // 皮肤风格 this.style = this.loadStyle(); - // 地图主题 - this.theme = this.loadTheme(); - // 设备数据 this.mapDevice = {}; @@ -67,10 +63,6 @@ class Jlmap { return selectSkinStyle(skinStyle); } - loadTheme(skinStyle) { - return new Theme(skinStyle); - } - loadDefaultState() { const defaultStateDict = {}; @@ -96,9 +88,6 @@ class Jlmap { // 加载对应皮肤 this.style = this.loadStyle(this.skinStyle); - // 主题模块 - this.theme = this.loadTheme(this.skinStyle); - // 解析地图数据 this.mapDevice = parser(map, this); diff --git a/src/jmap/shape/ImageControl/index.js b/src/jmap/shape/ImageControl/index.js index 3aaf705f5..724a63e33 100644 --- a/src/jmap/shape/ImageControl/index.js +++ b/src/jmap/shape/ImageControl/index.js @@ -13,10 +13,10 @@ export default class ImageControl extends Group { this.model = model; this.style = style; this.z = model.zIndex || 1; - this._create(); + this.create(); } - _create() { + create() { const model = this.model; this.image = new Image({ zlevel: this.zlevel, @@ -42,6 +42,7 @@ export default class ImageControl extends Group { } setState(model) { + this.model = model; } // 整体图片 diff --git a/src/jmap/shape/LcControl/index.js b/src/jmap/shape/LcControl/index.js index a78bd7c15..cb7c059c5 100644 --- a/src/jmap/shape/LcControl/index.js +++ b/src/jmap/shape/LcControl/index.js @@ -13,10 +13,10 @@ export default class LcControl extends Group { this.zlevel = model.zlevel; this.model = model; this.style = style; - this._create(); + this.create(); } - _create() { + create() { const model = this.model; this.control = new EControl({ zlevel: this.zlevel, @@ -50,7 +50,9 @@ export default class LcControl extends Group { } // 设置状态 - setState(model) {} + setState(model) { + this.model = model; + } getShapeTipPoint() { if (this.control) { diff --git a/src/jmap/shape/LimitControl/index.js b/src/jmap/shape/LimitControl/index.js index 884850537..46d2404de 100644 --- a/src/jmap/shape/LimitControl/index.js +++ b/src/jmap/shape/LimitControl/index.js @@ -14,10 +14,10 @@ export default class LimitControl extends Group { this.model = model; this.style = style; this.z = 20; - this._create(model); + this.create(model); } - _create(model) { + create(model) { this.control = new EControl({ zlevel: this.zlevel, z: this.z, @@ -51,6 +51,7 @@ export default class LimitControl extends Group { // 设置状态 setState(model) { + this.model = model; } getShapeTipPoint() { diff --git a/src/jmap/shape/Line/index.js b/src/jmap/shape/Line/index.js index 40ca835a1..eca8c0cdc 100644 --- a/src/jmap/shape/Line/index.js +++ b/src/jmap/shape/Line/index.js @@ -10,11 +10,11 @@ export default class Line2 extends Group { this.z = 0; this.model = model; this.style = style; - this._create(); + this.create(); this.setState(model); } - _create() { + create() { const model = this.model; const style = this.style; if (model && model.points.length > 1) { @@ -49,6 +49,7 @@ export default class Line2 extends Group { } setState(model) { + this.model = model; this.setLineType(model.type); } } diff --git a/src/jmap/shape/Link/index.js b/src/jmap/shape/Link/index.js index b2962e75a..e09c61599 100644 --- a/src/jmap/shape/Link/index.js +++ b/src/jmap/shape/Link/index.js @@ -46,6 +46,7 @@ class Link extends Group { } setState(model) { + this.model = model; } tipBasePoint() { diff --git a/src/jmap/shape/Section/EAxle.js b/src/jmap/shape/Section/EAxle.js index 99527d79a..17e404671 100644 --- a/src/jmap/shape/Section/EAxle.js +++ b/src/jmap/shape/Section/EAxle.js @@ -38,10 +38,10 @@ export const EAxle = Path.extend({ // this.model = model; // this.zlevel = model.zlevel; // this.z = 5; -// this._create(model); +// this.create(model); // } -// _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)); diff --git a/src/jmap/shape/Section/ELimitLines.js b/src/jmap/shape/Section/ELimitLines.js index b7c78b52e..40ec936c3 100644 --- a/src/jmap/shape/Section/ELimitLines.js +++ b/src/jmap/shape/Section/ELimitLines.js @@ -81,10 +81,10 @@ export default class ELimitLines extends Group { this.model = model; this.zlevel = model.zlevel; this.z = model.z; - this._create(model); + this.create(model); } - _create(model) { + create(model) { /** 创建区段*/ if (model && model.points.length > 1) { if (model.isCurve) { diff --git a/src/jmap/shape/Section/ELines.js b/src/jmap/shape/Section/ELines.js index 89adbcbce..8d4b80c8b 100644 --- a/src/jmap/shape/Section/ELines.js +++ b/src/jmap/shape/Section/ELines.js @@ -9,10 +9,10 @@ export default class ELines extends Group { this.model = model; this.zlevel = model.zlevel; this.z = model.z; - this._create(model); + this.create(model); } - _create(model) { + create(model) { /** 创建区段*/ if (model && model.points.length > 1) { if (model.isCurve) { diff --git a/src/jmap/shape/Section/ERelease.js b/src/jmap/shape/Section/ERelease.js index efda4b174..d71c886c2 100644 --- a/src/jmap/shape/Section/ERelease.js +++ b/src/jmap/shape/Section/ERelease.js @@ -10,7 +10,7 @@ export default class ERelease extends Group { } - _create() { + create() { if (!this.isNew) { const model = this.model; @@ -30,23 +30,23 @@ export default class ERelease extends Group { } setStyle(model) { - this._create(); + this.create(); this.lines.setStyle(model); } hide() { - this._create(); + this.create(); this.lines.hide(); } show() { - this._create(); + this.create(); this.lines.show(); } // 开始动画 animateStyle(loop, animates) { - this._create(); + this.create(); if (animates && animates.length) { this.eachChild((child) => { if (child.animateStyle) { @@ -62,7 +62,7 @@ export default class ERelease extends Group { // 结束动画 stopAnimation(flag) { - this._create(); + this.create(); this.eachChild((child) => { if (child.stopAnimation) { child.stopAnimation(flag); diff --git a/src/jmap/shape/Section/index.js b/src/jmap/shape/Section/index.js index 809a7d09d..0391cfc91 100644 --- a/src/jmap/shape/Section/index.js +++ b/src/jmap/shape/Section/index.js @@ -20,11 +20,11 @@ export default class Section extends Group { this.model = model; this.selected = false; this.style = style; - this._create(); this.createMouseEvent(); + this.create(); } - _create() { + create() { const model = this.model; // 01:物理区段;02逻辑区段;03道岔区段 this.createSectionText(); // 创建区段文字 @@ -609,11 +609,13 @@ export default class Section extends Group { /** 区段切除*/ sectionCutOff() { 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 } } - ]); + if (this.section) { + this.section.animateStyle(true, [ + { time: 0, styles: { lineWidth: lineWidth } }, + { time: 1000, styles: { stroke: this.style.backgroundColor } }, + { time: 2000, styles: { lineWidth: lineWidth } } + ]); + } } /** 设置限速*/ @@ -646,6 +648,7 @@ export default class Section extends Group { /** 设置状态*/ setState(model) { + this.model = model; this.recover(); switch (model.status) { case '00': /** 未定义*/ diff --git a/src/jmap/shape/Signal/EMouse.js b/src/jmap/shape/Signal/EMouse.js new file mode 100644 index 000000000..7920adb2e --- /dev/null +++ b/src/jmap/shape/Signal/EMouse.js @@ -0,0 +1,59 @@ +import Group from 'zrender/src/container/Group'; +import Rect from 'zrender/src/graphic/shape/Rect'; + +export default class EMouse extends Group { + constructor(device) { + super(); + this.device = device; + this.zlevel = device.zlevel; + this.style = device.style; + this.down = true; + this.create(); + } + + create() { + this.lampRect = new Rect({ + silent: true, + zlevel: this.zlevel, + z: 6, + shape: this.device.getBoundingRect(), + style: { + lineDash: this.style.Signal.mouse.borderLineDash, + stroke: this.style.Signal.mouse.borderLineColor, + fill: this.style.transparentColor + } + }); + + this.nameRect = new Rect({ + silent: true, + zlevel: this.zlevel, + z: 5, + shape: this.device.sigName.getBoundingRect(), + style: { + lineDash: this.style.Signal.mouse.borderLineDash, + stroke: this.style.Signal.mouse.borderLineColor, + fill: this.style.Signal.mouse.nameBackgroundColor + } + }); + + this.lampRect.hide(); + this.nameRect.hide(); + this.add(this.lampRect); + this.add(this.nameRect); + } + + mouseover(e) { + this.nameRect.show(); + this.lampRect.show(); + this.device.lamps.forEach(elem => { + elem.setBorderColor(this.style.Signal.mouse.lampBorderLineColor); + }); + this.device.sigName.setColor(this.style.backgroundColor); + } + + mouseout(e) { + this.nameRect.hide(); + this.lampRect.hide(); + this.device.setState(this.device.model); + } +} diff --git a/src/jmap/shape/Signal/ESigAuto.js b/src/jmap/shape/Signal/ESigAuto.js index ffb55db8a..d8e736860 100644 --- a/src/jmap/shape/Signal/ESigAuto.js +++ b/src/jmap/shape/Signal/ESigAuto.js @@ -9,7 +9,7 @@ class ESigPass extends Group { this.isNew = false; } - _create() { + create() { if (!this.isNew) { const model = this.model; const style = this.model.style; @@ -36,19 +36,19 @@ class ESigPass extends Group { // 停止动画 animationRecover() { - this._create(); + this.create(); this.arrows.stopAnimation(false); } // 箭头颜色 setColor(color) { - this._create(); + this.create(); this.arrows.setStyle('fill', color); } // 箭头闪烁 arrowsAnimation() { - this._create(); + this.create(); const style = this.model.style; const fill = this.arrows.style.Signal.fill; @@ -63,13 +63,13 @@ class ESigPass extends Group { // 隐藏 hide() { - this._create(); + this.create(); this.arrows.hide(); } // 显示 show() { - this._create(); + this.create(); this.arrows.show(); } } diff --git a/src/jmap/shape/Signal/ESigButton.js b/src/jmap/shape/Signal/ESigButton.js index 2f7e69227..9507bbf9b 100644 --- a/src/jmap/shape/Signal/ESigButton.js +++ b/src/jmap/shape/Signal/ESigButton.js @@ -11,7 +11,7 @@ class ESigButton extends Group { this.isNew = false; } - _create() { + create() { if (!this.isNew) { const model = this.model; const style = this.model.style; @@ -98,13 +98,13 @@ class ESigButton extends Group { } hide() { - this._create(); + this.create(); this.sigNormalButtom.hide(); this.sigReentryButton.hide(); } show() { - this._create(); + 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 133b3702d..00daeff35 100644 --- a/src/jmap/shape/Signal/ESigDelay.js +++ b/src/jmap/shape/Signal/ESigDelay.js @@ -8,7 +8,7 @@ class ESigDelay extends Group { this.isNew = false; } - _create() { + create() { if (!this.isNew) { const model = this.model; @@ -36,22 +36,22 @@ class ESigDelay extends Group { } setStyle(model) { - this._create(); + this.create(); this.name.setStyle(model); } setColor(color) { - this._create(); + this.create(); this.name.setStyle('textFill', color); } hide() { - this._create(); + this.create(); this.name.hide(); } show() { - this._create(); + this.create(); this.name.show(); } } diff --git a/src/jmap/shape/Signal/ESigLamp.js b/src/jmap/shape/Signal/ESigLamp.js index ee0143783..d55043681 100644 --- a/src/jmap/shape/Signal/ESigLamp.js +++ b/src/jmap/shape/Signal/ESigLamp.js @@ -6,10 +6,10 @@ class ESigLamp extends Group { constructor(model) { super(); this.model = model; - this._create(); + this.create(); } - _create() { + create() { const model = this.model; const style = this.model.style; @@ -78,7 +78,11 @@ class ESigLamp extends Group { } setColor(color) { - this.lamp.setStyle({fill: color}); + this.lamp.setStyle({ stroke: color, fill: color }); + } + + setBorderColor(color) { + this.lamp.setStyle({stroke: color}); } setStop(has) { @@ -90,6 +94,10 @@ class ESigLamp extends Group { this.rstop.hide(); } } + + getBoundingRect() { + return this.lamp.getBoundingRect(); + } } export default ESigLamp; diff --git a/src/jmap/shape/Signal/ESigName.js b/src/jmap/shape/Signal/ESigName.js index 9124244f4..8e1a9ebc7 100644 --- a/src/jmap/shape/Signal/ESigName.js +++ b/src/jmap/shape/Signal/ESigName.js @@ -5,10 +5,10 @@ class ESigName extends Group { constructor(model) { super(); this.model = model; - this._create(); + this.create(); } - _create() { + create() { const model = this.model; this.name = new Text({ _subType: 'SignalLamp', diff --git a/src/jmap/shape/Signal/ESigPost.js b/src/jmap/shape/Signal/ESigPost.js index 6fcdfe515..3ab6cabd3 100644 --- a/src/jmap/shape/Signal/ESigPost.js +++ b/src/jmap/shape/Signal/ESigPost.js @@ -5,10 +5,10 @@ class ESigPost extends Group { constructor(model) { super(); this.model = model; - this._create(); + this.create(); } - _create() { + create() { const model = this.model; const style = this.model.style; diff --git a/src/jmap/shape/Signal/ESigRoute.js b/src/jmap/shape/Signal/ESigRoute.js index 797e8ee9a..1ecc10ff4 100644 --- a/src/jmap/shape/Signal/ESigRoute.js +++ b/src/jmap/shape/Signal/ESigRoute.js @@ -9,7 +9,7 @@ class ESigDrict extends Group { this.isNew = false; } - _create() { + create() { if (!this.isNew) { const model = this.model; const style = this.model.style; @@ -34,13 +34,13 @@ class ESigDrict extends Group { // 隐藏 hide() { - this._create(); + this.create(); this.sigDrict.hide(); } // 显示 show() { - this._create(); + this.create(); this.sigDrict.show(); } } diff --git a/src/jmap/shape/Signal/index.js b/src/jmap/shape/Signal/index.js index a848e20d4..71e5bdced 100644 --- a/src/jmap/shape/Signal/index.js +++ b/src/jmap/shape/Signal/index.js @@ -9,6 +9,7 @@ import ESigRoute from './ESigRoute'; import ESigButton from './ESigButton'; import ESigDelay from './ESigDelay'; import ESigName from './ESigName'; +import EMouse from './EMouse'; import Group from 'zrender/src/container/Group'; import BoundingRect from 'zrender/src/core/BoundingRect'; @@ -24,6 +25,7 @@ class Signal extends Group { this.zlevel = model.zlevel; this.z = 7; this.create(); + this.createMouseEvent(); this.transformRotation(this); this.setState(model); } @@ -65,8 +67,10 @@ class Signal extends Group { } // 信号机名称 - const sigNameX = model.position.x + model.namePosition.x; - const sigNameY = model.position.y + posit * (style.Signal.signalDistance + style.Section.line.width + style.Signal.lamp.signalR * 2 + model.namePosition.y); + const sigNameX = model.position.x - drict * (style.Signal.post.signalLampStandardWidth) + model.namePosition.x; + const sigNameY = model.position.y + posit * (style.Signal.signalDistance + style.Section.line.width + style.Signal.lamp.signalR * 2 + model.namePosition.y + style.Signal.text.distance); + const textAlign = style.Signal.text.isAlignCenter ? 'middle': this.model.directionType == '01'? 'right': 'left'; + const textVerticalAlign = posit == 1 ? 'top' : 'bottom'; this.sigName = new ESigName({ zlevel: this.zlevel, z: this.z, @@ -80,8 +84,8 @@ class Signal extends Group { fontSize: style.Signal.text.signalTextFontSize, fontFamily: style.textFontFormat, textFill: style.Signal.text.signalDefaultTextColor, - textAlign: 'middle', - textVerticalAlign: posit == 1 ? 'top' : 'bottom' + textAlign: textAlign, + textVerticalAlign: textVerticalAlign }); // 自动进路 @@ -154,6 +158,19 @@ class Signal extends Group { // this.add(this.sigButton); } + createMouseEvent() { + if (this.style.Signal.mouseEvent) { + this.mouseEvent = new EMouse(this); + this.add(this.mouseEvent); + this.onmouseover = (e) => { + this.mouseEvent.mouseover(e); + }; + this.onmouseout = (e) => { + this.mouseEvent.mouseout(e); + }; + } + } + // 整体旋转信号灯 transformRotation(device) { if (this.model.rotate) { @@ -321,7 +338,7 @@ class Signal extends Group { this.lamps[0].setColor(this.style.Signal.lamp.signalLampRedColor); // this.siglamp.setNameBorder(1) } - this.sigName.setColor(this.style.Signal.signalTextBlockColor); + this.sigName.setColor(this.style.Signal.text.signalTextBlockColor); } // 功能封锁 @@ -336,7 +353,7 @@ class Signal extends Group { signalblock() { if (this.count == 1) { this.lamps[0].setColor(this.style.Signal.lamp.signalLampRedColor); - this.sigName.setColor(this.style.Signal.lamp.signalLampGreenColor); + this.sigName.setColor(this.style.Signal.text.signalTextblock); } } @@ -416,6 +433,7 @@ class Signal extends Group { } setState(model) { + this.model = model; this.recover(); /** 设置状态 (点灯类型)*/ switch (model.status) { @@ -463,7 +481,11 @@ class Signal extends Group { } getBoundingRect() { - return this.sigPost.getBoundingRect(); + const rect = this.sigPost.getBoundingRect(); + this.lamps.forEach(elem => { + rect.union(elem.getBoundingRect()); + }); + return rect; } getShapeTipPoint(opts) { diff --git a/src/jmap/shape/Station/index.js b/src/jmap/shape/Station/index.js index 7e29b1f66..f7027b80c 100644 --- a/src/jmap/shape/Station/index.js +++ b/src/jmap/shape/Station/index.js @@ -13,10 +13,10 @@ export default class Station extends Group { this.z = 40; this.model = model; this.style = style; - this._create(); + this.create(); } - _create() { + create() { const model = this.model; const style = this.style; @@ -72,6 +72,7 @@ export default class Station extends Group { // eslint-disable-next-line no-unused-vars setState(model) { + this.model = model; } getShapeTipPoint() { diff --git a/src/jmap/shape/StationControl/EArrow.js b/src/jmap/shape/StationControl/EArrow.js index 303ee782e..18ad74628 100644 --- a/src/jmap/shape/StationControl/EArrow.js +++ b/src/jmap/shape/StationControl/EArrow.js @@ -5,10 +5,10 @@ class ESigAuto extends Group { constructor(model) { super(); this.model = model; - this._create(); + this.create(); } - _create() { + create() { const model = this.model; this.arrows = new Polygon({ diff --git a/src/jmap/shape/StationControl/ESingleControl.js b/src/jmap/shape/StationControl/ESingleControl.js index a30d8ef90..c3ad696fc 100644 --- a/src/jmap/shape/StationControl/ESingleControl.js +++ b/src/jmap/shape/StationControl/ESingleControl.js @@ -10,10 +10,10 @@ export default class ESingleControl extends Group { this.zlevel = model.zlevel; this._subType = model._subType; this.z = 20; - this._create(model); + this.create(model); } - _create(model) { + create(model) { var _subType = 'ControlSignal'; var _val = '0'; if (model.pop) { diff --git a/src/jmap/shape/StationControl/index.js b/src/jmap/shape/StationControl/index.js index bdff06e36..ffb7b4e58 100644 --- a/src/jmap/shape/StationControl/index.js +++ b/src/jmap/shape/StationControl/index.js @@ -16,11 +16,11 @@ export default class StationControl extends Group { this.zlevel = model.zlevel; this.model = model; this.style = style; - this._create(); + this.create(); this.setState(model); } - _create() { + create() { const model = this.model; this.emergencyControl = new ESingleControl({ _subType: 'emergency', @@ -86,6 +86,7 @@ export default class StationControl extends Group { // 设置状态 setState(model) { + this.model = model; switch (model.status) { case '00': // 无状态 this.emergencyControl.setColor(this.style.StationControl.stationControlGrayColor); diff --git a/src/jmap/shape/StationCounter/index.js b/src/jmap/shape/StationCounter/index.js index 4529746d4..f737c46c4 100644 --- a/src/jmap/shape/StationCounter/index.js +++ b/src/jmap/shape/StationCounter/index.js @@ -14,11 +14,11 @@ export default class StationCounter extends Group { this.style = style; this.zlevel = model.zlevel; this.z = 30; - this._create(); + this.create(); this.setState(model); } - _create() { + create() { const model = this.model; const style = this.style; this.counter = new Text({ @@ -81,6 +81,7 @@ export default class StationCounter extends Group { } setState(model) { + this.model = model; } getShapeTipPoint() { diff --git a/src/jmap/shape/StationDelayUnlock/index.js b/src/jmap/shape/StationDelayUnlock/index.js index bccba3f35..d41840cff 100644 --- a/src/jmap/shape/StationDelayUnlock/index.js +++ b/src/jmap/shape/StationDelayUnlock/index.js @@ -14,11 +14,11 @@ export default class StationDelayUnlock extends Group { this.style = style; this.zlevel = model.zlevel; this.z = 1; - this._create(); + this.create(); this.setState(model); } - _create() { + create() { const model = this.model; const style = this.style; this.text = new Text({ @@ -95,6 +95,7 @@ export default class StationDelayUnlock extends Group { } setState(model) { + this.model = model; switch (model.status) { case '01': this.delayClose(); break; // 关闭 case '02': this.delayUnlock(); break; // 延迟解锁 diff --git a/src/jmap/shape/StationStand/EDetain.js b/src/jmap/shape/StationStand/EDetain.js index 629286219..81cb2d93f 100644 --- a/src/jmap/shape/StationStand/EDetain.js +++ b/src/jmap/shape/StationStand/EDetain.js @@ -8,7 +8,7 @@ class EDetain extends Group { this.isNew = false; } - _create() { + create() { if (!this.isNew) { const model = this.model; const style = this.model.style; @@ -35,17 +35,17 @@ class EDetain extends Group { } setColor(color) { - this._create(); + this.create(); this.detain.setStyle('textFill', color); } hide() { - this._create(); + this.create(); this.detain.hide(); } show() { - this._create(); + this.create(); this.detain.show(); } } diff --git a/src/jmap/shape/StationStand/EJump.js b/src/jmap/shape/StationStand/EJump.js index ef1f97cde..c2823ed7a 100644 --- a/src/jmap/shape/StationStand/EJump.js +++ b/src/jmap/shape/StationStand/EJump.js @@ -8,7 +8,7 @@ class EJump extends Group { this.isNew = false; } - _create() { + create() { if (!this.isNew) { const model = this.model; const style = this.model.style; @@ -34,22 +34,22 @@ class EJump extends Group { } setName(val) { - this._create(); + this.create(); this.jump.setStyle('text', val); } setColor(color) { - this._create(); + this.create(); this.jump.setStyle('textFill', color); } hide() { - this._create(); + this.create(); this.jump.hide(); } show() { - this._create(); + this.create(); this.jump.show(); } } diff --git a/src/jmap/shape/StationStand/ELevel.js b/src/jmap/shape/StationStand/ELevel.js index e346f4093..8acd6c276 100644 --- a/src/jmap/shape/StationStand/ELevel.js +++ b/src/jmap/shape/StationStand/ELevel.js @@ -8,7 +8,7 @@ class ELevel extends Group { this.isNew = false; } - _create() { + create() { if (!this.isNew) { const model = this.model; const style = this.model.style; @@ -34,22 +34,22 @@ class ELevel extends Group { } setName(val) { - this._create(); + this.create(); this.level.setStyle('text', val); } setColor(color) { - this._create(); + this.create(); this.level.setStyle('textFill', color); } hide() { - this._create(); + this.create(); this.level.hide(); } show() { - this._create(); + this.create(); this.level.show(); } } diff --git a/src/jmap/shape/StationStand/EMouse.js b/src/jmap/shape/StationStand/EMouse.js new file mode 100644 index 000000000..586ef2506 --- /dev/null +++ b/src/jmap/shape/StationStand/EMouse.js @@ -0,0 +1,37 @@ +import Group from 'zrender/src/container/Group'; +import Rect from 'zrender/src/graphic/shape/Rect'; + +export default class EMouse extends Group { + constructor(device) { + super(); + this.device = device; + this.zlevel = device.zlevel; + this.style = device.style; + this.down = true; + this.create(); + } + + create() { + this.border = new Rect({ + silent: true, + zlevel: this.zlevel, + z: 0, + shape: this.device.getBoundingRect(), + style: { + lineDash: this.style.StationStand.mouse.borderLineDash, + stroke: this.style.StationStand.mouse.borderLineColor, + fill: this.style.transparentColor + } + }); + this.border.hide(); + this.add(this.border); + } + + mouseover(e) { + this.border.show(); + } + + mouseout(e) { + this.border.hide(); + } +} diff --git a/src/jmap/shape/StationStand/EReentry.js b/src/jmap/shape/StationStand/EReentry.js index c66534306..1c32388b9 100644 --- a/src/jmap/shape/StationStand/EReentry.js +++ b/src/jmap/shape/StationStand/EReentry.js @@ -9,7 +9,7 @@ class EReentry extends Group { this.isNew = false; } - _create() { + create() { if (!this.isNew) { const model = this.model; @@ -31,17 +31,17 @@ class EReentry extends Group { } setColor(color) { - this._create(); + this.create(); this.reentry.setStyle('textFill', color); } hide() { - this._create(); + this.create(); this.reentry.hide(); } show() { - this._create(); + this.create(); this.reentry.show(); } } diff --git a/src/jmap/shape/StationStand/ESafeDoor.js b/src/jmap/shape/StationStand/ESafeDoor.js index 265b7602b..7e51251f7 100644 --- a/src/jmap/shape/StationStand/ESafeDoor.js +++ b/src/jmap/shape/StationStand/ESafeDoor.js @@ -5,10 +5,10 @@ class ESafeDoor extends Group { constructor(model) { super(); this.model = model; - this._create(); + this.create(); } - _create() { + create() { const model = this.model; const style = this.model.style; const padding = 0.1; diff --git a/src/jmap/shape/StationStand/ESafeEmergent.js b/src/jmap/shape/StationStand/ESafeEmergent.js index f6a829c4f..350398f51 100644 --- a/src/jmap/shape/StationStand/ESafeEmergent.js +++ b/src/jmap/shape/StationStand/ESafeEmergent.js @@ -8,7 +8,7 @@ class ESafeEmergent extends Group { this.isNew = false; } - _create() { + create() { if (!this.isNew) { const model = this.model; const style = this.model.style; @@ -35,12 +35,12 @@ class ESafeEmergent extends Group { } hide() { - this._create(); + this.create(); this.emergent.hide(); } show() { - this._create(); + this.create(); this.emergent.show(); } } diff --git a/src/jmap/shape/StationStand/ESafeStand.js b/src/jmap/shape/StationStand/ESafeStand.js index 57834a850..d9b6d7e91 100644 --- a/src/jmap/shape/StationStand/ESafeStand.js +++ b/src/jmap/shape/StationStand/ESafeStand.js @@ -5,10 +5,10 @@ class ESafeStand extends Group { constructor(model) { super(); this.model = model; - this._create(); + this.create(); } - _create() { + create() { const model = this.model; const style = this.model.style; diff --git a/src/jmap/shape/StationStand/ETime.js b/src/jmap/shape/StationStand/ETime.js index c7127a029..c8921b387 100644 --- a/src/jmap/shape/StationStand/ETime.js +++ b/src/jmap/shape/StationStand/ETime.js @@ -8,7 +8,7 @@ class ETime extends Group { this.isNew = false; } - _create() { + create() { if (!this.isNew) { const model = this.model; const style = this.model.style; @@ -34,22 +34,22 @@ class ETime extends Group { } setName(val) { - this._create(); + this.create(); this.time.setStyle('text', val); } setColor(color) { - this._create(); + this.create(); this.time.setStyle('textFill', color); } hide() { - this._create(); + this.create(); this.time.hide(); } show() { - this._create(); + this.create(); this.time.show(); } } diff --git a/src/jmap/shape/StationStand/index.js b/src/jmap/shape/StationStand/index.js index f6bdbf366..e4b1e8ea7 100644 --- a/src/jmap/shape/StationStand/index.js +++ b/src/jmap/shape/StationStand/index.js @@ -7,6 +7,7 @@ import EDetain from './EDetain'; import ESafeDoor from './ESafeDoor'; import ESafeStand from './ESafeStand'; import ESafeEmergent from './ESafeEmergent'; +import EMouse from './EMouse'; class StationStand extends Group { constructor(model, style) { @@ -18,11 +19,12 @@ class StationStand extends Group { this.zlevel = model.zlevel; this.z = 1; this.doors = new Group(); - this._create(); + this.create(); + this.createMouseEvent(); this.setVisible(model.visible); this.setState(model); } - _create() { + create() { const model = this.model; const style = this.style; const drict = model.doorLocationType == '01' ? 1 : -1; @@ -137,6 +139,19 @@ class StationStand extends Group { this.add(this.level); } + createMouseEvent() { + if (this.style.StationStand.mouseEvent) { + this.mouseEvent = new EMouse(this); + this.add(this.mouseEvent); + this.onmouseover = (e) => { + this.mouseEvent.mouseover(e); + }; + this.onmouseout = (e) => { + this.mouseEvent.mouseout(e); + }; + } + } + setVisible(visible) { if (visible) { this.eachChild(elem => { elem.show(); }); @@ -262,6 +277,7 @@ class StationStand extends Group { } setState(model) { + this.model = model; this.recover(); switch (model.status) { case '01': /** 空闲*/ @@ -352,12 +368,13 @@ class StationStand extends Group { } getBoundingRect() { - return this.safeStand.getBoundingRect(); + const rect = this.safeStand.getBoundingRect(); + rect.union(this.safeDoor.getBoundingRect()); + return rect; } getShapeTipPoint() { - const rect = this.safeStand.getBoundingRect(); - rect.union(this.safeDoor.getBoundingRect()); + const rect = this.getBoundingRect(); if (rect) { return { x: rect.x + rect.width / 2, diff --git a/src/jmap/shape/Switch/ESwCore.js b/src/jmap/shape/Switch/ESwCore.js index dfbe35a21..7c7f86e2a 100644 --- a/src/jmap/shape/Switch/ESwCore.js +++ b/src/jmap/shape/Switch/ESwCore.js @@ -5,10 +5,10 @@ class ESwCore extends Group { constructor(model) { super(); this.model = model; - this._create(); + this.create(); } - _create() { + create() { const model = this.model; const style = this.model.style; this.skewLine = new Line({ diff --git a/src/jmap/shape/Switch/ESwLnversion.js b/src/jmap/shape/Switch/ESwLnversion.js index ec065c312..8cbc78f9c 100644 --- a/src/jmap/shape/Switch/ESwLnversion.js +++ b/src/jmap/shape/Switch/ESwLnversion.js @@ -5,10 +5,10 @@ class ESwLnversion extends Group { constructor(model) { super(); this.model = model; - this._create(); + this.create(); } - _create() { + create() { const model = this.model; const style = this.model.style; this.relocShelter = new Polygon({ diff --git a/src/jmap/shape/Switch/ESwLocal.js b/src/jmap/shape/Switch/ESwLocal.js index 97957aa5e..9541d68cd 100644 --- a/src/jmap/shape/Switch/ESwLocal.js +++ b/src/jmap/shape/Switch/ESwLocal.js @@ -5,10 +5,10 @@ class ESwLocal extends Group { constructor(model) { super(); this.model = model; - this._create(); + this.create(); } - _create() { + create() { const model = this.model; const style = this.model.style; diff --git a/src/jmap/shape/Switch/ESwName.js b/src/jmap/shape/Switch/ESwName.js index 0fd81072a..419edc0d6 100644 --- a/src/jmap/shape/Switch/ESwName.js +++ b/src/jmap/shape/Switch/ESwName.js @@ -6,10 +6,10 @@ class ESwName extends Group { constructor(model) { super(); this.model = model; - this._create(); + this.create(); } - _create() { + create() { const model = this.model; const style = this.model.style; @@ -26,7 +26,7 @@ class ESwName extends Group { // textAlign: model.triangle.drictx === 1 ? 'left' : 'right', textAlign: 'center', textVerticalAlign: model.triangle.dricty === 1 ? 'top' : 'bottom', - textFill: style.Switch.text.switchTextLossColor + textFill: style.textFontColor } }); diff --git a/src/jmap/shape/Switch/index.js b/src/jmap/shape/Switch/index.js index 826901948..1e19f91d6 100644 --- a/src/jmap/shape/Switch/index.js +++ b/src/jmap/shape/Switch/index.js @@ -366,6 +366,7 @@ export default class Switch extends Group { } setState(model) { + this.model = model; this.setLocateType(model); switch (model.status) { case '01': diff --git a/src/jmap/shape/Text/index.js b/src/jmap/shape/Text/index.js index 4e216f614..d3388e9ec 100644 --- a/src/jmap/shape/Text/index.js +++ b/src/jmap/shape/Text/index.js @@ -11,11 +11,11 @@ export default class Text2 extends Group { this.model = model; this.style = style; this.z = 6; - this._create(); + this.create(); this.setState(model); } - _create() { + create() { var model = this.model; var [direction, content] = model.content.split('::'); if (direction == 'V') { @@ -40,5 +40,6 @@ export default class Text2 extends Group { } setState(model) { + this.model = model; } } diff --git a/src/jmap/shape/Train/TrainBody/ArrowText.js b/src/jmap/shape/Train/TrainBody/ArrowText.js index 64da6e8e0..517bff0b1 100644 --- a/src/jmap/shape/Train/TrainBody/ArrowText.js +++ b/src/jmap/shape/Train/TrainBody/ArrowText.js @@ -5,9 +5,9 @@ class ArrowText extends Group { constructor(model) { super(); this.model = model; - this._create(); + this.create(); } - _create() { + create() { this.arrowText = new Text({ zlevel: this.model.zlevel, z: this.model.z+1, diff --git a/src/jmap/shape/Train/TrainBody/TextHSDA.js b/src/jmap/shape/Train/TrainBody/TextHSDA.js index 5b016720c..aee827b01 100644 --- a/src/jmap/shape/Train/TrainBody/TextHSDA.js +++ b/src/jmap/shape/Train/TrainBody/TextHSDA.js @@ -5,9 +5,9 @@ export default class TextHSDA extends Group { constructor(model) { super(); this.model = model; - this._create(); + this.create(); } - _create() { + create() { const model = this.model; this.textH = new Text({ zlevel: model.zlevel, diff --git a/src/jmap/shape/Train/TrainBody/TextTrainNumber.js b/src/jmap/shape/Train/TrainBody/TextTrainNumber.js index bcc2a4dd6..0e5f19a66 100644 --- a/src/jmap/shape/Train/TrainBody/TextTrainNumber.js +++ b/src/jmap/shape/Train/TrainBody/TextTrainNumber.js @@ -5,9 +5,9 @@ export default class TextTrainNumber extends Group { constructor(model) { super(); this.model = model; - this._create(); + this.create(); } - _create() { + create() { const model = this.model; this.textTrainNumber = new Text({ zlevel: model.zlevel+1, diff --git a/src/jmap/shape/Train/TrainBody/TextTrainServer.js b/src/jmap/shape/Train/TrainBody/TextTrainServer.js index 2912c85e8..cb15279f3 100644 --- a/src/jmap/shape/Train/TrainBody/TextTrainServer.js +++ b/src/jmap/shape/Train/TrainBody/TextTrainServer.js @@ -5,9 +5,9 @@ export default class TextTrainServer extends Group { constructor(model) { super(); this.model = model; - this._create(); + this.create(); } - _create() { + create() { this.textTrainServer = new Text({ zlevel: this.model.zlevel, z: this.model.z+1, diff --git a/src/jmap/shape/Train/TrainBody/TextTrainTarget.js b/src/jmap/shape/Train/TrainBody/TextTrainTarget.js index 9cfb12636..53dbd0afe 100644 --- a/src/jmap/shape/Train/TrainBody/TextTrainTarget.js +++ b/src/jmap/shape/Train/TrainBody/TextTrainTarget.js @@ -5,9 +5,9 @@ export default class TextTrainTarget extends Group { constructor(model) { super(); this.model = model; - this._create(); + this.create(); } - _create() { + create() { this.textTrainTarget = new Text({ zlevel: this.model.zlevel, z: this.model.z+1, diff --git a/src/jmap/shape/Train/TrainBody/TextTrainTargetNumber.js b/src/jmap/shape/Train/TrainBody/TextTrainTargetNumber.js index d8e2082a7..ad1d06980 100644 --- a/src/jmap/shape/Train/TrainBody/TextTrainTargetNumber.js +++ b/src/jmap/shape/Train/TrainBody/TextTrainTargetNumber.js @@ -5,9 +5,9 @@ export default class TextTrainTargetNumber extends Group { constructor(model) { super(); this.model = model; - this._create(); + this.create(); } - _create() { + create() { const model = this.model; this.textTrainTargetNumber = new Text({ zlevel: model.zlevel, diff --git a/src/jmap/shape/Train/TrainBody/Train.js b/src/jmap/shape/Train/TrainBody/Train.js index 08db37aa6..32ed968b4 100644 --- a/src/jmap/shape/Train/TrainBody/Train.js +++ b/src/jmap/shape/Train/TrainBody/Train.js @@ -6,9 +6,9 @@ export default class Train extends Group { constructor(model) { super(); this.model = model; - this._create(); + this.create(); } - _create() { + create() { const model = this.model; this.train = new Rect({ zlevel: model.zlevel, diff --git a/src/jmap/shape/Train/TrainBody/index.js b/src/jmap/shape/Train/TrainBody/index.js index 2d5e1e9a8..3b18016f9 100644 --- a/src/jmap/shape/Train/TrainBody/index.js +++ b/src/jmap/shape/Train/TrainBody/index.js @@ -12,10 +12,10 @@ export default class TrainBody extends Group { constructor(model) { super(); this.model = model; - this._create(); + this.create(); } - _create() { + create() { const model = this.model; const style = this.model.style; const textFont = model.fontSize + 'px ' + style.Train.textFontFormat; diff --git a/src/jmap/shape/Train/TrainHead/index.js b/src/jmap/shape/Train/TrainHead/index.js index 2825b0a52..80cbae964 100644 --- a/src/jmap/shape/Train/TrainHead/index.js +++ b/src/jmap/shape/Train/TrainHead/index.js @@ -7,9 +7,9 @@ export default class TrainHead extends Group { constructor(model) { super(); this.model = model; - this._create(); + this.create(); } - _create() { + create() { const model = this.model; const style = this.model.style; const baseMargin = (model.drect === -1 ? 1 : 0); diff --git a/src/jmap/shape/Train/index.js b/src/jmap/shape/Train/index.js index 01942a650..ee379aee9 100644 --- a/src/jmap/shape/Train/index.js +++ b/src/jmap/shape/Train/index.js @@ -14,10 +14,11 @@ export default class Train extends Group { this.model = model; this.style = style; this.z = 40; + this.size = 0; this.section = null; this.fontSize = style.Train.nameFontSize || style.Train.trainTextFontSize; this.newScale = this.fontSize / style.Train.trainTextFontSize; - this._create(); + this.create(); this.setState(model); } @@ -46,7 +47,7 @@ export default class Train extends Group { this.traingle = null; } } - _create() { + create() { this._computed(); this.isChangeTrainWidth(this.model, this.style); const model = this.model; @@ -270,6 +271,7 @@ export default class Train extends Group { // 设置状态 setState(model) { + this.model = model; if (model) { this.recover(); this.setServerNoType(model.serverNoType); // 设置服务号状态类型 @@ -285,8 +287,8 @@ export default class Train extends Group { // 是否根据车身上车组号、服务号、车次号、目的地码显示情况改变列车长度 isChangeTrainWidth(model, style) { if (!style.Train.changeTrainWidth) { return; } - if (model.nameFormat) { - const arr = model.nameFormat.split(':'); + if (style.Train.trainNameFormat) { + const arr = style.Train.trainNameFormat.split(':'); arr.forEach(ele => { switch (ele) { case 'targetCode': { diff --git a/src/jmap/shape/TrainWindow/index.js b/src/jmap/shape/TrainWindow/index.js index 32b6e91d7..9a896ed78 100644 --- a/src/jmap/shape/TrainWindow/index.js +++ b/src/jmap/shape/TrainWindow/index.js @@ -13,10 +13,10 @@ class TrainWindow extends Group { this.style = style; this.z = 1; this.prdType = store.state.training.prdType; - this._create(model); + this.create(model); this.setState(model); } - _create(model) { + create(model) { if (this.prdType !== '01') { this.createTrainWindow(); } @@ -62,6 +62,7 @@ class TrainWindow extends Group { // 设置状态 setState(model) { + this.model = model; this.setTrainWindowEventShow(model.trainWindowShow); } setTrainWindowEventShow(show) { diff --git a/src/jmap/shape/ZcControl/index.js b/src/jmap/shape/ZcControl/index.js index ec43b2f9b..81cd3b81e 100644 --- a/src/jmap/shape/ZcControl/index.js +++ b/src/jmap/shape/ZcControl/index.js @@ -13,11 +13,11 @@ export default class ZcControl extends Group { this.zlevel = model.zlevel; this.model = model; this.style = style; - this._create(model); + this.create(model); this.setState(model); } - _create(model) { + create(model) { this.control = new EControl({ zlevel: this.zlevel, z: this.z, @@ -50,7 +50,7 @@ export default class ZcControl extends Group { // 设置状态 setState(model) { - + this.model = model; } getShapeTipPoint() { diff --git a/src/jmap/shape/element/EControl.js b/src/jmap/shape/element/EControl.js index 337f3d944..ddef10c79 100644 --- a/src/jmap/shape/element/EControl.js +++ b/src/jmap/shape/element/EControl.js @@ -12,10 +12,10 @@ export default class EControl extends Group { this.style = model.style; this.textStyle = model.text; this.arcStyle = model.arc; - this._create(); + this.create(); } - _create() { + create() { this.control = new Arc({ _subType: 'Control', zlevel: this.zlevel, diff --git a/src/jmap/shape/element/ETextName.js b/src/jmap/shape/element/ETextName.js index 031fe66d1..99043cf6f 100644 --- a/src/jmap/shape/element/ETextName.js +++ b/src/jmap/shape/element/ETextName.js @@ -29,10 +29,10 @@ export default function ETextName(model) { // this.model = model; // this.zlevel = model.zlevel; // this.z = model.z; -// this._create(); +// this.create(); // } -// _create() { +// create() { // this.TextName = new Text({ // _subType: this.model._subType, // zlevel: this.zlevel, diff --git a/src/views/jlmap/index.vue b/src/views/jlmap/index.vue index 5d1125312..54ca03faf 100644 --- a/src/views/jlmap/index.vue +++ b/src/views/jlmap/index.vue @@ -118,6 +118,7 @@ export default { if (this.$jlmap) { this.$jlmap.dispose(); } + this.$store.dispatch('training/setPrdType', null); }, methods: { // 初始化jlmap @@ -191,7 +192,9 @@ export default { // 地图视图加载完成 handleViewLoaded() { this.$store.dispatch('map/mapViewLoaded'); - this.mapViewLoaded(false); + if (!this.$store.state.training.prdType) { + this.mapViewLoaded(false); + } }, // 地图状态加载完成 handleStateLoaded() { @@ -205,7 +208,6 @@ export default { }, // 视图参数改变 handleOptionsUpdate(options) { - console.log('optionsUpdate'); }, // 视图缩放事假 onDataZoom(dataZoom) {