diff --git a/src/jmapNew/map.js b/src/jmapNew/map.js index 8dc448198..d7e2b81c3 100644 --- a/src/jmapNew/map.js +++ b/src/jmapNew/map.js @@ -415,15 +415,17 @@ class Jlmap { updatePicture(list = []) { list.forEach(item => { const device = this.mapDevice[item]; - if (device) { + if (device && device._type !== deviceType.Switch && device._type !== deviceType.Train) { const pictureDevice = store.getters['map/getPictureDeviceByCode'](item); device._dispose = pictureDevice ? pictureDevice.pictureHide : false; this.$painter.updatePicture(device); - if (device._type === deviceType.Section && device.type === '03') { - this.computedSwitch(device.switch); - this.mapDevice[device.switch.code]._dispose = pictureDevice ? pictureDevice.pictureHide : false; - this.$painter.updatePicture(this.mapDevice[device.switch.code]); - } + try { + if (device._type === deviceType.Section && device.type === '03') { + this.mapDevice[device.switch.code]._dispose = pictureDevice ? pictureDevice.pictureHide : false; + this.computedSwitch(device.switch); + this.$painter.updatePicture(this.mapDevice[device.switch.code]); + } + } catch (e) { console.error(e); } } }); } @@ -437,20 +439,22 @@ class Jlmap { if (cnodeSection && lnodeSection && rnodeSection) { let sectionCStar, sectionCEnd; + const rnodeSectionPoint = rnodeSection.instance ? rnodeSection.instance.computedPoints : rnodeSection.points; + const cnodeSectionPoint = cnodeSection.instance ? cnodeSection.instance.computedPoints : cnodeSection.points; if (this.handleResetPoint(rnodeSection.points)) { - sectionCStar = rnodeSection.instance.computedPoints[rnodeSection.points.length - 2]; - sectionCEnd = rnodeSection.instance.computedPoints[1]; + sectionCStar = rnodeSectionPoint[rnodeSectionPoint.length - 2]; + sectionCEnd = rnodeSectionPoint[1]; } else { - sectionCStar = rnodeSection.instance.computedPoints[1]; - sectionCEnd = rnodeSection.instance.computedPoints[rnodeSection.points.length - 2]; + sectionCStar = rnodeSectionPoint[1]; + sectionCEnd = rnodeSectionPoint[rnodeSectionPoint.length - 2]; } let intersectionStar, intersectionEnd; if (this.handleResetPoint(cnodeSection.points)) { - intersectionStar = cnodeSection.instance.computedPoints[0]; - intersectionEnd = cnodeSection.instance.computedPoints[cnodeSection.points.length - 1]; + intersectionStar = cnodeSectionPoint[0]; + intersectionEnd = cnodeSectionPoint[cnodeSectionPoint.length - 1]; } else { - intersectionStar = cnodeSection.instance.computedPoints[cnodeSection.points.length - 1]; - intersectionEnd = cnodeSection.instance.computedPoints[0]; + intersectionStar = cnodeSectionPoint[cnodeSectionPoint.length - 1]; + intersectionEnd = cnodeSectionPoint[0]; } if (cnodeSection.points[0].x == lnodeSection.points[lnodeSection.points.length - 1].x && cnodeSection.points[0].y == lnodeSection.points[lnodeSection.points.length - 1].y) { this.mapDevice[switchDevice.code].intersection = { diff --git a/src/jmapNew/shape/graph/Switch/index.js b/src/jmapNew/shape/graph/Switch/index.js index 679838233..c624de3ba 100644 --- a/src/jmapNew/shape/graph/Switch/index.js +++ b/src/jmapNew/shape/graph/Switch/index.js @@ -55,32 +55,35 @@ export default class Switch extends Group { const directy = this.triangle.dricty; const switchWidth1 = style.Section.line.width / 2; let directxA = 1; - let sectionATriangle = new JTriangle(sectionAModel.instance.computedPoints[0], sectionAModel.instance.computedPoints[1]); - let sectionBTriangle = new JTriangle(sectionBModel.instance.computedPoints[0], sectionBModel.instance.computedPoints[1]); - let sectionCTriangle = new JTriangle(sectionCModel.instance.computedPoints[0], sectionCModel.instance.computedPoints[1]); + const sectionAPoints = sectionAModel.instance ? sectionAModel.instance.computedPoints : sectionAModel.points; + const sectionBPoints = sectionBModel.instance ? sectionBModel.instance.computedPoints : sectionBModel.points; + const sectionCPoints = sectionCModel.instance ? sectionCModel.instance.computedPoints : sectionCModel.points; + let sectionATriangle = new JTriangle(sectionAPoints[0], sectionAPoints[1]); + let sectionBTriangle = new JTriangle(sectionBPoints[0], sectionBPoints[1]); + let sectionCTriangle = new JTriangle(sectionCPoints[0], sectionCPoints[1]); const sectionAPoint = { x: model.intersection.x, y: model.intersection.y }; - if (sectionAModel.instance.computedPoints[0].x == model.intersection.x && sectionAModel.instance.computedPoints[0].y == model.intersection.y) { - sectionATriangle = new JTriangle(sectionAModel.instance.computedPoints[0], sectionAModel.instance.computedPoints[1]); + if (sectionAPoints[0].x == model.intersection.x && sectionAPoints[0].y == model.intersection.y) { + sectionATriangle = new JTriangle(sectionAPoints[0], sectionAPoints[1]); directxA = 1; } - if (sectionAModel.instance.computedPoints[sectionAModel.instance.computedPoints.length - 1].x == model.intersection.x && sectionAModel.instance.computedPoints[sectionAModel.instance.computedPoints.length - 1].y == model.intersection.y) { - sectionATriangle = new JTriangle(sectionAModel.instance.computedPoints[sectionAModel.instance.computedPoints.length - 2], sectionAModel.instance.computedPoints[sectionAModel.instance.computedPoints.length - 1]); + if (sectionAPoints[sectionAPoints.length - 1].x == model.intersection.x && sectionAPoints[sectionAPoints.length - 1].y == model.intersection.y) { + sectionATriangle = new JTriangle(sectionAPoints[sectionAPoints.length - 2], sectionAPoints[sectionAPoints.length - 1]); directxA = -1; } - if (sectionBModel.instance.computedPoints[0].x == model.intersection.x && sectionBModel.instance.computedPoints[0].y == model.intersection.y) { - sectionBTriangle = new JTriangle(sectionBModel.instance.computedPoints[0], sectionBModel.instance.computedPoints[1]); + if (sectionBPoints[0].x == model.intersection.x && sectionBPoints[0].y == model.intersection.y) { + sectionBTriangle = new JTriangle(sectionBPoints[0], sectionBPoints[1]); } - if (sectionBModel.instance.computedPoints[sectionBModel.instance.computedPoints.length - 1].x == model.intersection.x && sectionBModel.instance.computedPoints[sectionBModel.instance.computedPoints.length - 1].y == model.intersection.y) { - sectionBTriangle = new JTriangle(sectionBModel.instance.computedPoints[sectionBModel.instance.computedPoints.length - 2], sectionBModel.instance.computedPoints[sectionBModel.instance.computedPoints.length - 1]); + if (sectionBPoints[sectionBPoints.length - 1].x == model.intersection.x && sectionBPoints[sectionBPoints.length - 1].y == model.intersection.y) { + sectionBTriangle = new JTriangle(sectionBPoints[sectionBPoints.length - 2], sectionBPoints[sectionBPoints.length - 1]); } - if (sectionCModel.instance.computedPoints[0].x == model.intersection.x && sectionCModel.instance.computedPoints[0].y == model.intersection.y) { - sectionCTriangle = new JTriangle(sectionCModel.instance.computedPoints[0], sectionCModel.instance.computedPoints[1]); + if (sectionCPoints[0].x == model.intersection.x && sectionCPoints[0].y == model.intersection.y) { + sectionCTriangle = new JTriangle(sectionCPoints[0], sectionCPoints[1]); } - if (sectionCModel.instance.computedPoints[sectionCModel.instance.computedPoints.length - 1].x == model.intersection.x && sectionCModel.instance.computedPoints[sectionCModel.instance.computedPoints.length - 1].y == model.intersection.y) { - sectionCTriangle = new JTriangle(sectionCModel.instance.computedPoints[sectionCModel.instance.computedPoints.length - 2], sectionCModel.instance.computedPoints[sectionCModel.instance.computedPoints.length - 1]); + if (sectionCPoints[sectionCPoints.length - 1].x == model.intersection.x && sectionCPoints[sectionCPoints.length - 1].y == model.intersection.y) { + sectionCTriangle = new JTriangle(sectionCPoints[sectionCPoints.length - 2], sectionCPoints[sectionCPoints.length - 1]); } const swPadding = rateOpen diff --git a/src/store/modules/map.js b/src/store/modules/map.js index 3d7c4b393..7cea94ac6 100644 --- a/src/store/modules/map.js +++ b/src/store/modules/map.js @@ -1023,7 +1023,6 @@ const map = { state.version = version; }, setShowCentralizedStationCode: (state, stationCode) => { - console.log(stationCode, '=========='); state.showCentralizedStationCode = stationCode; }, setShowCentralizedStationNum: state => { diff --git a/src/views/newMap/mapDraftPicture/index.vue b/src/views/newMap/mapDraftPicture/index.vue index 52b6260c0..f2bf01eff 100644 --- a/src/views/newMap/mapDraftPicture/index.vue +++ b/src/views/newMap/mapDraftPicture/index.vue @@ -452,7 +452,7 @@ export default { deviceList.push(deviceCode); } this.$jlmap.updatePicture(deviceList); - this.$jlmap.updateTransform(pictureModel.scaling, pictureModel.origin); + this.$jlmap.updateTransform(pictureModel.scaling || '1', pictureModel.origin); }, deletePicture() { if (!this.pictureName) { diff --git a/src/views/newMap/mapDraftPicture/mapoperate/multiSelect.vue b/src/views/newMap/mapDraftPicture/mapoperate/multiSelect.vue index 72abebfbe..3c9e879d0 100644 --- a/src/views/newMap/mapDraftPicture/mapoperate/multiSelect.vue +++ b/src/views/newMap/mapDraftPicture/mapoperate/multiSelect.vue @@ -69,14 +69,14 @@ export default { } }, mouseenter(model) { - if (model._type == 'Section') { - model.instance.mouseover(); - } + // if (model._type == 'Section') { + // model.instance.mouseover(); + // } }, mouseleave(model) { - if (model._type == 'Section') { - model.instance.mouseout(); - } + // if (model._type == 'Section') { + // model.instance.mouseout(); + // } }, // 删除当前选中 delList(model, list) {