diff --git a/src/jlmap3d/jl3ddevicetrain/component/jdqcontrol.js b/src/jlmap3d/jl3ddevicetrain/component/jdqcontrol.js index cd9b596f8..6610e3646 100644 --- a/src/jlmap3d/jl3ddevicetrain/component/jdqcontrol.js +++ b/src/jlmap3d/jl3ddevicetrain/component/jdqcontrol.js @@ -102,6 +102,41 @@ export function Jdqcontrol(){ part.msg = "绝缘轴用冻石瓷料制成,抗冲击强度足够。"; selectmodel.children[i].text = "绝缘轴"; } + if(selectmodel.children[i].name =="cichuihuqi"){ + part.text = "磁吹弧器"; + part.msg = "磁吹弧器。"; + selectmodel.children[i].text = "磁吹弧器"; + } + if(selectmodel.children[i].name =="jiaqiangdongjiediandanyuan"){ + part.text = "加强接点单元"; + part.msg = "加强接点单元。"; + selectmodel.children[i].text = "加强接点单元"; + } + if(selectmodel.children[i].name =="yunmugehupian"){ + part.text = "云母隔弧片"; + part.msg = "云母隔弧片。"; + selectmodel.children[i].text = "云母隔弧片"; + } + if(selectmodel.children[i].name =="yapian1"){ + part.text = "压片"; + part.msg = "压片。"; + selectmodel.children[i].text = "压片"; + } + if(selectmodel.children[i].name =="jiedian1"){ + part.text = "接点"; + part.msg = "接点。"; + selectmodel.children[i].text = "接点"; + } + if(selectmodel.children[i].name =="ccichuihuqi"){ + part.text = "磁吹弧器"; + part.msg = "磁吹弧器。"; + selectmodel.children[i].text = "磁吹弧器"; + } + + + // if(part.text == null){ + // console.log(selectmodel.children[i].name); + // } scope.devicelist.push(part); } diff --git a/src/jlmap3d/jl3ddevicetrain/component/moveanimate.js b/src/jlmap3d/jl3ddevicetrain/component/moveanimate.js index 7e8c7059a..71aa64a8d 100644 --- a/src/jlmap3d/jl3ddevicetrain/component/moveanimate.js +++ b/src/jlmap3d/jl3ddevicetrain/component/moveanimate.js @@ -1,185 +1,487 @@ -export function Moveanimate(){ +export function Moveanimate(main){ let scope = this; + this.helpbox = null; + this.textplane = null; //动画列表 this.animatelist = []; - + this.playlist = null; + this.playorder = 0; //动画播放器开关 this.enable = true; - + //动画开关状态 + this.status = true; + //当前动画模型 + this.nowmodelname = undefined; //定义所有继电器部件动画 - this.initlist = function(modellist){ - // let points = []; - // points.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); - // points.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); - // scope.initanimate(modellist[j].children[i],modellist[j].name+"select1",points,true); + // this.initlist = function(modellist){ + // + // for(let j=0,lenj=modellist.length;j=1){ - let point = scope.animatelist[k].curve.getPointAt(1); - //更新模型坐标 - scope.animatelist[k].connectmodel.position.x = point.x; - scope.animatelist[k].connectmodel.position.y = point.y; - scope.animatelist[k].connectmodel.position.z = point.z; - scope.animatelist[k].enable = false; - scope.animatelist[k].status = "end"; - scope.animatelist[k].progress = 0; - }else{ - //根据动画进度获取动画轨迹上点 + if(scope.playlist){ - let point = scope.animatelist[k].curve.getPointAt(scope.animatelist[k].progress); + for(let i=0;i=1){ + let point = scope.playlist[scope.playorder][i].curve.getPointAt(1); + //更新模型坐标 + scope.playlist[scope.playorder][i].connectmodel.position.x = point.x; + scope.playlist[scope.playorder][i].connectmodel.position.y = point.y; + scope.playlist[scope.playorder][i].connectmodel.position.z = point.z; + scope.playlist[scope.playorder][i].enable = false; + scope.playlist[scope.playorder][i].status = "end"; + scope.playlist[scope.playorder][i].progress = 0; - //判断模型转向 - if(scope.animatelist[k].directchange){ - let tangent = scope.animatelist[k].curve.getPointAt(scope.animatelist[k].progress+0.001); - // scope.animatelist[k] - tangent = null; + + console.log(scope.playorder); + if(i >= scope.playlist[scope.playorder].length-1){ + if(scope.playorder >= scope.playlist.length-1 ){ + scope.playlist = null; + scope.status = true; + scope.enable = false; + main.animationmsgshowoff(); + scope.nowmodelname = undefined; + scope.playorder = null; + break; + }else{ + scope.playorder += 1; } - //增加动画进度,释放点变量 - scope.animatelist[k].progress += scope.animatelist[k].speed; - point = null; - } + + }else{ + // console.log(scope.animatelist[k].connectmodel); + if(scope.nowmodelname != scope.playlist[scope.playorder][i].connectmodel.name){ + scope.nowmodelname = scope.playlist[scope.playorder][i].connectmodel.name; + main.animationmsgshowon(scope.playlist[scope.playorder][i].connectmodel); + } + //根据动画进度获取动画轨迹上点 + scope.status = false; + let point = scope.playlist[scope.playorder][i].curve.getPointAt(scope.playlist[scope.playorder][i].progress); + + //更新模型坐标 + scope.playlist[scope.playorder][i].connectmodel.position.x = point.x; + scope.playlist[scope.playorder][i].connectmodel.position.y = point.y; + scope.playlist[scope.playorder][i].connectmodel.position.z = point.z; + + if(scope.helpbox){ + scope.helpbox.update(); + } + if(scope.textplane){ + + scope.textplane.position.x = scope.playlist[scope.playorder][i].connectmodel.matrixWorld.elements[12]; + scope.textplane.position.y = scope.playlist[scope.playorder][i].connectmodel.matrixWorld.elements[13]+100; + scope.textplane.position.z = scope.playlist[scope.playorder][i].connectmodel.matrixWorld.elements[14]; + } + //判断模型转向 + if(scope.playlist[scope.playorder][i].directchange){ + let tangent = scope.playlist[scope.playorder][i].curve.getPointAt(scope.playlist[scope.playorder][i].progress+0.001); + // scope.animatelist[k] + tangent = null; + } + //增加动画进度,释放点变量 + scope.playlist[scope.playorder][i].progress += scope.playlist[scope.playorder][i].speed; + point = null; + + } + } + } } } diff --git a/src/jlmap3d/jl3ddevicetrain/jl3ddevicetrain.js b/src/jlmap3d/jl3ddevicetrain/jl3ddevicetrain.js index 9485b3259..cf171ea2e 100644 --- a/src/jlmap3d/jl3ddevicetrain/jl3ddevicetrain.js +++ b/src/jlmap3d/jl3ddevicetrain/jl3ddevicetrain.js @@ -7,6 +7,8 @@ import { ModelManager } from '@/jlmap3d/jl3ddevicetrain/loader.js'; import { Moveanimate } from '@/jlmap3d/jl3ddevicetrain/component/moveanimate.js'; import { Jdqcontrol } from '@/jlmap3d/jl3ddevicetrain/component/jdqcontrol.js'; +import { DragControls } from '@/jlmap3d/main/control/DragControls.js'; + import StompClient from '@/jlmap3d/jl3ddevicetrain/component/StompClient.js'; // import { Signallightload } from '@/jlmap3d/jl3ddevice/component/signallight.js'; @@ -31,27 +33,31 @@ export function Jl3ddevice(dom,serviceid) { this.animastats = false; //当前选中模型 this.selectmodel = null; - + //当前动画播放模型 + this.animationmodel = null; //初始化webgl渲染 - let renderer = new THREE.WebGLRenderer({ antialias: true,alpha: true }); + let renderer = new THREE.WebGLRenderer({ antialias: true }); renderer.setPixelRatio( window.devicePixelRatio ); renderer.setSize(dom.offsetWidth, dom.offsetHeight); + // renderer.shadowMap.enabled = true; // renderer.shadowMap.type = THREE.PCFSoftShadowMap; renderer.setClearColor( 0x000000, 0 ); this.dom.appendChild(renderer.domElement); //定义相机 - let camera = new THREE.PerspectiveCamera(70, dom.offsetWidth / dom.offsetHeight, 0.01, 5000); + let camera = new THREE.PerspectiveCamera(70, dom.offsetWidth / dom.offsetHeight, 0.01, 4000); camera.position.set(-1000, 1500, 0); camera.aspect = dom.offsetWidth / dom.offsetHeight; camera.updateProjectionMatrix(); //视角轨迹控制器 this.controls = new THREE.OrbitControls(camera, dom); + this.controls.enabled = true; this.controls.target = new THREE.Vector3(500,1000,0); this.controls.screenSpacePanning = true; this.controls.update(); + this.controls.maxDistance = 3000; //定义场景(渲染容器) let scene = new THREE.Scene(); @@ -72,8 +78,9 @@ export function Jl3ddevice(dom,serviceid) { // grid.material.transparent = true; // grid.position.x = 10000; // scene.add( grid ); - - + let objects = []; + let dragcontrol = new THREE.DragControls( objects, camera, scope.dom ); + dragcontrol.enabled = false; //菜单选中设备更新设备较少 this.updateselect = function(updata){ @@ -91,14 +98,12 @@ export function Jl3ddevice(dom,serviceid) { }; settext(updata.mesh,point) getdevicemsg(updata.mesh.name); - // moveanima.animatelist[scope.selectmodel.name+"select1"].enable = true; - // console.log(intersects[0].object); scene.add( helpbox ); } //返回设备选择 this.backselect = function(){ - move2(); + move3(); updatemenulist(scope.jdqcontrol.devicelist); scope.modelmanager.controllist[0].position.set(19,1270,-275); @@ -141,23 +146,47 @@ export function Jl3ddevice(dom,serviceid) { }; //设备分解、归位动画按钮 - this.disperdevice = function(){ + this.disperdevice1 = function(){ + if(scope.status == '1'){ - if(scope.animastats == false){ - scope.animastats = true; - move1(); - } else if(scope.animastats == true){ - scope.animastats = false; - move2(); + if(moveanima.status == true){ + if(scope.animastats == false){ + scope.animastats = true; + move1(); + } else if(scope.animastats == true){ + scope.animastats = false; + move2(); + } } + } }; + this.disperdevice2 = function(){ + + if(scope.status == '1'){ + if(moveanima.status == true){ + if(scope.animastats == false){ + scope.animastats = true; + moveanima.setplaylist(moveanima.animatelist[scope.selectmodel.code+"chaijie"],true); + } else if(scope.animastats == true){ + scope.animastats = false; + moveanima.setplaylist(moveanima.animatelist[scope.selectmodel.code+"fuwei"],true); + } + } + + + } + }; + + + // let stats = new Stats(); // dom.appendChild( stats.dom ); document.addEventListener( "mousedown", onselect, false ); + document.addEventListener( "mouseup", onmouseup, false ); document.addEventListener( "touchstart", ontouch, false ); window.onresize = function () { camera.aspect = scope.dom.offsetWidth / scope.dom.offsetHeight; @@ -167,12 +196,12 @@ export function Jl3ddevice(dom,serviceid) { this.jdqcontrol = new Jdqcontrol(); - let moveanima = new Moveanimate(); + let moveanima = new Moveanimate(scope); this.anime = null; this.modelmanager = new ModelManager(); this.modelmanager.loadpromise(Staticmodel, scope.mixers,scene).then(function (data) { - moveanima.initlist( scope.modelmanager.controllist); + moveanima.initlistnew( scope.modelmanager.controllist); connect = new StompClient(); // debugger connect.subscribe("/queue/simulation/"+serviceid,callback); @@ -195,6 +224,7 @@ export function Jl3ddevice(dom,serviceid) { connect.send("/app/topic/simulation/"+serviceid+"/relay/"+msg.id+"/control/"+msg.on,{}); } + this.upmodelaction = function(type,index){ if(type == "0"){ @@ -210,6 +240,23 @@ export function Jl3ddevice(dom,serviceid) { scope.modelmanager.actionlist[index].play(); } }; + + this.buttoncontrol = function(action){ + if("startstop"){ + moveanima.startstop(); + } + if("next"){ + moveanima.next(); + } + if("before"){ + moveanima.before(); + } + + }; + + this.resetmodel = function(){ + moveanima.setplaylist(moveanima.animatelist[scope.selectmodel.code+"fuwei"],true); + }; //循环渲染函数 let delta; let data; @@ -227,9 +274,12 @@ export function Jl3ddevice(dom,serviceid) { // scope.controls.update(); // stats.update(); delta = clock.getDelta(); + if(textplane){ + textplane.lookAt(camera.position); + } if (scope.mixers) { for (let i = 0; i < scope.mixers.length; i++) { - if (scope.mixers[i]) { + if (scope.mixers[i]._actions[0].isRunning()) { scope.mixers[i].update(delta); } } @@ -239,109 +289,17 @@ export function Jl3ddevice(dom,serviceid) { function move1(){ - for(let i=0,leni=scope.selectmodel.children.length;i0){ diff --git a/src/jlmap3d/main/control/DragControls.js b/src/jlmap3d/main/control/DragControls.js index a872e19a3..859c2a63b 100644 --- a/src/jlmap3d/main/control/DragControls.js +++ b/src/jlmap3d/main/control/DragControls.js @@ -6,6 +6,7 @@ THREE.DragControls = function ( _objects, _camera, _domElement ) { + if ( _objects instanceof THREE.Camera ) { console.warn( 'THREE.DragControls: Constructor now expects ( objects, camera, domElement )' ); @@ -27,7 +28,7 @@ THREE.DragControls = function ( _objects, _camera, _domElement ) { // var scope = this; - + this.nowobject = _objects; function activate() { _domElement.addEventListener( 'mousemove', onDocumentMouseMove, false ); @@ -84,32 +85,36 @@ THREE.DragControls = function ( _objects, _camera, _domElement ) { } _raycaster.setFromCamera( _mouse, _camera ); + if( scope.nowobject.parent){ + var intersects = _raycaster.intersectObjects( scope.nowobject.parent.children ); - var intersects = _raycaster.intersectObjects( _objects ); + if ( intersects.length > 0 ) { - if ( intersects.length > 0 ) { + var object = intersects[ 0 ].object; + if(scope.nowobject.raycastoff){ + object = intersects[ 0 ].object.parent; + } + _plane.setFromNormalAndCoplanarPoint( _camera.getWorldDirection( _plane.normal ), _worldPosition.setFromMatrixPosition( object.matrixWorld ) ); - var object = intersects[ 0 ].object; + if ( _hovered !== object ) { - _plane.setFromNormalAndCoplanarPoint( _camera.getWorldDirection( _plane.normal ), _worldPosition.setFromMatrixPosition( object.matrixWorld ) ); + scope.dispatchEvent( { type: 'hoveron', object: object } ); - if ( _hovered !== object ) { + _domElement.style.cursor = 'pointer'; + _hovered = object; - scope.dispatchEvent( { type: 'hoveron', object: object } ); + } - _domElement.style.cursor = 'pointer'; - _hovered = object; + } else { - } + if ( _hovered !== null ) { - } else { + scope.dispatchEvent( { type: 'hoveroff', object: _hovered } ); - if ( _hovered !== null ) { + _domElement.style.cursor = 'auto'; + _hovered = null; - scope.dispatchEvent( { type: 'hoveroff', object: _hovered } ); - - _domElement.style.cursor = 'auto'; - _hovered = null; + } } @@ -122,24 +127,29 @@ THREE.DragControls = function ( _objects, _camera, _domElement ) { event.preventDefault(); _raycaster.setFromCamera( _mouse, _camera ); + if( scope.nowobject.parent){ + var intersects = _raycaster.intersectObjects( scope.nowobject.parent.children ); - var intersects = _raycaster.intersectObjects( _objects ); + if ( intersects.length > 0 ) { + _selected = intersects[ 0 ].object; + if(scope.nowobject.raycastoff){ + _selected = intersects[ 0 ].object.parent; + } - if ( intersects.length > 0 ) { - _selected = intersects[ 0 ].object; + if ( _raycaster.ray.intersectPlane( _plane, _intersection ) ) { - if ( _raycaster.ray.intersectPlane( _plane, _intersection ) ) { + _inverseMatrix.getInverse( _selected.parent.matrixWorld ); + _offset.copy( _intersection ).sub( _worldPosition.setFromMatrixPosition( _selected.matrixWorld ) ); - _inverseMatrix.getInverse( _selected.parent.matrixWorld ); - _offset.copy( _intersection ).sub( _worldPosition.setFromMatrixPosition( _selected.matrixWorld ) ); + } + + _domElement.style.cursor = 'move'; + + scope.dispatchEvent( { type: 'dragstart', object: _selected } ); } - _domElement.style.cursor = 'move'; - - scope.dispatchEvent( { type: 'dragstart', object: _selected } ); - } @@ -200,26 +210,31 @@ THREE.DragControls = function ( _objects, _camera, _domElement ) { _mouse.y = - ( ( event.clientY - rect.top ) / rect.height ) * 2 + 1; _raycaster.setFromCamera( _mouse, _camera ); + if( scope.nowobject.parent){ + var intersects = _raycaster.intersectObjects( scope.nowobject.parent.children ); - var intersects = _raycaster.intersectObjects( _objects ); + if ( intersects.length > 0 ) { + _selected = intersects[ 0 ].object; + if(scope.nowobject.raycastoff){ + _selected = intersects[ 0 ].object.parent; + } - if ( intersects.length > 0 ) { - _selected = intersects[ 0 ].object; + _plane.setFromNormalAndCoplanarPoint( _camera.getWorldDirection( _plane.normal ), _worldPosition.setFromMatrixPosition( _selected.matrixWorld ) ); - _plane.setFromNormalAndCoplanarPoint( _camera.getWorldDirection( _plane.normal ), _worldPosition.setFromMatrixPosition( _selected.matrixWorld ) ); + if ( _raycaster.ray.intersectPlane( _plane, _intersection ) ) { - if ( _raycaster.ray.intersectPlane( _plane, _intersection ) ) { + _inverseMatrix.getInverse( _selected.parent.matrixWorld ); + _offset.copy( _intersection ).sub( _worldPosition.setFromMatrixPosition( _selected.matrixWorld ) ); - _inverseMatrix.getInverse( _selected.parent.matrixWorld ); - _offset.copy( _intersection ).sub( _worldPosition.setFromMatrixPosition( _selected.matrixWorld ) ); + } + + _domElement.style.cursor = 'move'; + + scope.dispatchEvent( { type: 'dragstart', object: _selected } ); } - _domElement.style.cursor = 'move'; - - scope.dispatchEvent( { type: 'dragstart', object: _selected } ); - } @@ -253,9 +268,9 @@ THREE.DragControls = function ( _objects, _camera, _domElement ) { // Backward compatibility - this.setObjects = function () { - - console.error( 'THREE.DragControls: setObjects() has been removed.' ); + this.setObjects = function (array) { + scope.nowobject = array; + // console.error( 'THREE.DragControls: setObjects() has been removed.' ); }; diff --git a/src/jmapNew/config/skinCode/chengdu_03.js b/src/jmapNew/config/skinCode/chengdu_03.js index 753f745bf..6c7e90c45 100644 --- a/src/jmapNew/config/skinCode/chengdu_03.js +++ b/src/jmapNew/config/skinCode/chengdu_03.js @@ -148,7 +148,7 @@ class SkinCode extends defaultStyle { }, lamp: { bgShow: false, // 是否被选中 - guidName: 'chengdu_03', // 成都三号线引导类型 + guidName: 'singleRY', // 成都三号线引导类型 borderVariable: true, // 信号灯边框可变 stopWidth: 2, // 禁止线宽度 borderWidth: 2, // 信号灯边框线宽度 diff --git a/src/jmapNew/config/skinCode/foshan_01.js b/src/jmapNew/config/skinCode/foshan_01.js index 94cf12772..bc9d0b13b 100644 --- a/src/jmapNew/config/skinCode/foshan_01.js +++ b/src/jmapNew/config/skinCode/foshan_01.js @@ -139,7 +139,7 @@ class SkinCode extends defaultStyle { }, lamp: { bgShow: false, // 是否被选中 - guidName: 'ningbo_01', // 默认引导类型 + guidName: 'double', // 默认引导类型 stopWidth: 2, // 禁止线宽度 borderWidth: 1, // 信号灯边框线宽度 borderColor: '#3149C3', // 信号灯边框线颜色 diff --git a/src/jmapNew/config/skinCode/haerbin_01.js b/src/jmapNew/config/skinCode/haerbin_01.js index fd1ab0029..e70790ae5 100644 --- a/src/jmapNew/config/skinCode/haerbin_01.js +++ b/src/jmapNew/config/skinCode/haerbin_01.js @@ -144,7 +144,7 @@ class SkinCode extends defaultStyle { lamp: { bgShow: true, // 是否被选中 logicDisplayNone: true, // 逻辑点灯斜线不显示 - guidName: 'haerbin_01', // 默认引导类型 + guidName: 'doubleAndBase', // 默认引导类型 stopWidth: 2, // 禁止线宽度 borderWidth: 0, // 信号灯边框线宽度 borderColor: '#FF0000', // 信号灯边框线颜色 (虚拟信号机) diff --git a/src/jmapNew/config/skinCode/ningbo_01.js b/src/jmapNew/config/skinCode/ningbo_01.js index 94ae08874..2926891b8 100644 --- a/src/jmapNew/config/skinCode/ningbo_01.js +++ b/src/jmapNew/config/skinCode/ningbo_01.js @@ -146,7 +146,7 @@ class SkinCode extends defaultStyle { }, lamp: { bgShow: false, // 是否被选中 - guidName: 'ningbo_01', // 默认引导类型 + guidName: 'double', // 默认引导类型 borderVariable: true, // 信号灯边框可变 stopWidth: 2, // 禁止线宽度 borderWidth: 2, // 信号灯边框线宽度 diff --git a/src/jmapNew/config/skinCode/xian_02.js b/src/jmapNew/config/skinCode/xian_02.js index 72b92bea2..7adb83e68 100644 --- a/src/jmapNew/config/skinCode/xian_02.js +++ b/src/jmapNew/config/skinCode/xian_02.js @@ -160,18 +160,18 @@ class SkinCode extends defaultStyle { fontSize: 11, // 信号机名称字体大小 fontWeight: 'bold', // 信号机名称字体粗细 defaultColor: 'white', // 信号灯字体默认色 - blockColor: '#EF0C08', // 信号灯字体锁定颜色 + blockColor: '#FFFFFF', // 信号灯字体锁定颜色 checkColor: '#00FF00' // 信号保护区段检查颜色 }, lamp: { bgShow: false, // 是否被选中 - guidName: 'defult', // 默认引导类型 + guidName: 'singleRY', // 默认引导类型 borderVariable: true, // 信号灯边框可变 stopWidth: 2, // 禁止线宽度 borderWidth: 2, // 信号灯边框线宽度 borderColor: '#3149C3', // 信号灯边框线颜色 radiusR: 5, // 信号灯半径 - blockColor: '#C0C0C0', // 信号灯锁闭 + blockColor: '#EF0C08', // 信号灯锁闭 grayColor: '#C0C0C0', // 信号灯灰色 redColor: 'red', // 信号灯红色 greenColor: 'green', // 信号灯绿色 diff --git a/src/jmapNew/shape/Signal/ESigLamp.js b/src/jmapNew/shape/Signal/ESigLamp.js index c8b85f4b4..060ba8950 100644 --- a/src/jmapNew/shape/Signal/ESigLamp.js +++ b/src/jmapNew/shape/Signal/ESigLamp.js @@ -108,6 +108,18 @@ class ESigLamp extends Group { getBoundingRect() { return this.lamp.getBoundingRect(); } + + setAnimationStart(color) { + this.lamp && this.lamp.animateStyle(true) + .when(0, { fill: this.model.style.backgroundColor }) + .when(1000, { fill: color }) + .when(2000, { fill: this.model.style.backgroundColor }) + .when(3000, { fill: color }) + .start(); + } + setAnimationEnd() { + this.lamp && this.lamp.stopAnimation(false); + } } export default ESigLamp; diff --git a/src/jmapNew/shape/Signal/index.js b/src/jmapNew/shape/Signal/index.js index d50941d52..f5c7ad00b 100644 --- a/src/jmapNew/shape/Signal/index.js +++ b/src/jmapNew/shape/Signal/index.js @@ -89,7 +89,7 @@ class Signal extends Group { // 信号灯 const endPoint = this.sigPost.getLampPosition(model.lampPostType); this.lamps = []; - if ((style.Signal.lamp.guidName == 'ningbo_01' || style.Signal.lamp.guidName == 'haerbin_01') && this.count == 1) { + if ((style.Signal.lamp.guidName === 'double' || style.Signal.lamp.guidName === 'doubleAndBase') && this.count == 1) { this.count = 2; } for (let i = 0; i < this.count; i++) { @@ -331,7 +331,7 @@ class Signal extends Group { this.lamps[0] && this.lamps[0].setColor(this.style.Signal.lamp.greenColor); this.lamps[1] && this.lamps[1].setColor(this.style.backgroundColor); // 设置黑色 this.virtualSignal && this.virtualSignal.setColor(this.style.Signal.lamp.greenColor); - if (this.style.Signal.lamp.guidName == 'haerbin_01') { // 设置底座颜色 + if (this.style.Signal.lamp.guidName === 'doubleAndBase') { // 设置底座颜色 this.sigPost.setColor('#00FF00'); if (this.model.logicLight) { this.lamps[0] && this.lamps[0].setColor(this.style.Signal.lamp.blueColor); @@ -342,7 +342,7 @@ class Signal extends Group { openLateral() { this.lamps[0] && this.lamps[0].setColor(this.style.Signal.lamp.yellowColor); this.lamps[1] && this.lamps[1].setColor(this.style.backgroundColor); - if (this.style.Signal.lamp.guidName == 'haerbin_01') { // 设置底座颜色 + if (this.style.Signal.lamp.guidName === 'doubleAndBase') { // 设置底座颜色 this.sigPost.setColor('#00FF00'); if (this.model.logicLight) { // 设置哈尔滨逻辑点灯 颜色 this.lamps[0] && this.lamps[0].setColor(this.style.Signal.lamp.blueColor); @@ -361,16 +361,17 @@ class Signal extends Group { // 引导 guid() { - if (this.style.Signal.lamp.guidName == 'ningbo_01' || this.style.Signal.lamp.guidName == 'haerbin_01') { + if (this.style.Signal.lamp.guidName === 'double') { this.lamps[1].show(); } - if (this.style.Signal.lamp.guidName == 'haerbin_01') { // 设置底座颜色 + if (this.style.Signal.lamp.guidName === 'doubleAndBase') { // 设置底座颜色 + this.lamps[1].show(); this.sigPost.setColor('#00FF00'); } - if (this.style.Signal.lamp.guidName != 'chengdu_03') { // 双灯 允许引导信号 + if (this.style.Signal.lamp.guidName !== 'singleRY') { // 双灯 允许引导信号 this.lamps[0] && this.lamps[0].setColor(this.style.Signal.lamp.redColor); this.lamps[1] && this.lamps[1].setColor(this.style.Signal.lamp.yellowColor); - } else if (this.style.Signal.lamp.guidName == 'chengdu_03') { + } else if (this.style.Signal.lamp.guidName === 'singleRY') { this.lamps[0].setStyle({ fill: this.style.Signal.lamp.yellowColor, stroke: this.style.Signal.lamp.redColor, lineWidth: 2.5 }); } } @@ -378,7 +379,7 @@ class Signal extends Group { // 封锁 block() { this.lamps[0].setColor(this.style.Signal.lamp.redColor); - if (this.style.Signal.lamp.guidName == 'haerbin_01') { // 设置底座颜色 + if (this.style.Signal.lamp.guidName === 'doubleAndBase') { // 设置底座颜色 this.sigPost.setColor('#000080'); } this.sigName.setColor(this.style.Signal.text.blockColor); @@ -408,7 +409,7 @@ class Signal extends Group { // 逻辑点灯 logicalLight() { - if (this.style.Signal.lamp.guidName != 'haerbin_01') { // 哈尔滨不显示 X状态的逻辑点灯 + if (this.style.Signal.lamp.guidName !== 'doubleAndBase') { // 哈尔滨不显示 X状态的逻辑点灯 this.lamps.forEach(lamp => { lamp.setStop(true); }); } } @@ -424,7 +425,7 @@ class Signal extends Group { this.sigRoute.show(); this.sigRoute.setStyle({ fill: this.style.Signal.auto.manualControl }); } - if (this.style.Signal.lamp.guidName == 'haerbin_01') { + if (this.style.Signal.lamp.guidName === 'doubleAndBase') { this.sigName.setColor(this.style.Signal.text.ArtificialRouteColor); } if (this.style.Signal.auto.lampstandard) { @@ -441,7 +442,7 @@ class Signal extends Group { this.sigAuto.setColor(this.style.Signal.auto.autoRoute); this.sigAuto.show(); } - if (this.style.Signal.lamp.guidName == 'haerbin_01') { + if (this.style.Signal.lamp.guidName === 'doubleAndBase') { this.sigName.setColor(this.style.Signal.text.AutoRouteColor); this.setAutoClose(); } @@ -480,12 +481,6 @@ class Signal extends Group { .when(1000, { textFill: this.style.Signal.ciConfirm.textColor }) .when(2000, { textFill: this.style.backgroundColor }) .start(); - this.sigBack && this.sigBack.animateStyle(true) - .when(0, { fill: this.style.backgroundColor }) - .when(1000, { fill: this.style.Signal.sigBack.color }) - .when(2000, { fill: this.style.backgroundColor }) - .when(3000, { fill: this.style.Signal.sigBack.color }) - .start(); } } @@ -500,10 +495,10 @@ class Signal extends Group { this.sigBack && this.sigBack.hide(); this.sigName.setColor(this.style.Signal.text.defaultColor); this.sigPost.setColor(this.style.Signal.post.standardColor); // 设置底座默认颜色 - if (this.style.Signal.lamp.guidName == 'chengdu_03') { + if (this.style.Signal.lamp.guidName === 'singleRY') { this.lamps[0].setStyle({ lineWidth: this.style.Signal.lamp.borderWidth }); } - if (this.style.Signal.lamp.guidName == 'ningbo_01' || this.style.Signal.lamp.guidName == 'haerbin_01') { + if (this.style.Signal.lamp.guidName === 'double' || this.style.Signal.lamp.guidName === 'doubleAndBase') { this.lamps[1].hide(); } this.insideTriangle && this.insideTriangle.hide(); @@ -511,6 +506,8 @@ class Signal extends Group { this.ciConfirm && this.ciConfirm.stopAnimation(false); this.ciConfirm && this.ciConfirm.hide(); this.sigBack && this.sigBack.hide(); + this.sigBack && this.sigBack.stopAnimation(false); + this.lamps && this.lamps[0].setAnimationEnd(); } setState(model) { @@ -557,6 +554,18 @@ class Signal extends Group { if (model.isCiConfirm) { this.setCiConfirm(); } + if (model.isRequestLock) { + this.sigBack && this.sigBack.show(); + this.sigBack && this.sigBack.animateStyle(true) + .when(0, { fill: this.style.backgroundColor }) + .when(1000, { fill: this.style.Signal.sigBack.color }) + .when(2000, { fill: this.style.backgroundColor }) + .when(3000, { fill: this.style.Signal.sigBack.color }) + .start(); + } + if (model.isRequestGuide) { + this.lamps && this.lamps[0] && this.lamps[0].setAnimationStart(this.style.Signal.lamp.yellowColor); + } } getBoundingRect() { @@ -567,9 +576,6 @@ class Signal extends Group { if (this.insideTriangle) { rect.union(this.insideTriangle.getBoundingRect()); } - if (this.ciConfirm) { - rect.union(this.ciConfirm.getBoundingRect()); - } return rect; } diff --git a/src/jmapNew/theme/xian_02/menus/menuCancel.vue b/src/jmapNew/theme/xian_02/menus/menuCancel.vue index c1eb082d8..56c970f95 100644 --- a/src/jmapNew/theme/xian_02/menus/menuCancel.vue +++ b/src/jmapNew/theme/xian_02/menus/menuCancel.vue @@ -8,6 +8,7 @@ import PopMenu from '@/components/PopMenu/popTip'; import { mapGetters } from 'vuex'; import { DeviceMenu } from '@/scripts/ConstDic'; +import deviceType from '@/jmapNew/constant/deviceType'; export default { name: 'CancelMenu', @@ -215,7 +216,12 @@ export default { operation: eachCmd.operation.code, param: eachCmd.param // 请求栈中参数配置 }; - this.$store.dispatch('training/updateMapState', [{code: eachCmd.device.code, _type: eachCmd.device._type, isCiConfirm: 1}]); + const deviceStatus = {code: eachCmd.device.code, _type: eachCmd.device._type, isCiConfirm: 1}; + if (eachCmd.device._type === deviceType.Signal) { + deviceStatus.isRequestLock = 0; + deviceStatus.isRequestGuide = 0; + } + this.$store.dispatch('training/updateMapState', [deviceStatus]); } else { operate = { send: true, @@ -223,7 +229,12 @@ export default { cmdType: eachCmd.cmdType, param: eachCmd.param // 请求栈中参数配置 }; - this.$store.dispatch('training/updateMapState', [{code: eachCmd.device.code, _type: eachCmd.device._type, isCiConfirm: 0}]); + const deviceStatus = {code: eachCmd.device.code, _type: eachCmd.device._type, isCiConfirm: 0}; + if (eachCmd.device._type === deviceType.Signal) { + deviceStatus.isRequestLock = 0; + deviceStatus.isRequestGuide = 0; + } + this.$store.dispatch('training/updateMapState', [deviceStatus]); } this.$store.dispatch('menuOperation/spliceRequestList', {deviceCode:eachCmd.device.code, operateCode:eachCmd.operation.code}); this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { diff --git a/src/jmapNew/theme/xian_02/menus/menuRequest.vue b/src/jmapNew/theme/xian_02/menus/menuRequest.vue index 3adb8ced1..2a40a1c98 100644 --- a/src/jmapNew/theme/xian_02/menus/menuRequest.vue +++ b/src/jmapNew/theme/xian_02/menus/menuRequest.vue @@ -34,6 +34,7 @@