From 01732b6b9a4e770e71ccd29f0f3bdf917c99c713 Mon Sep 17 00:00:00 2001 From: fan <18706759286@163.com> Date: Wed, 29 Sep 2021 09:44:50 +0800 Subject: [PATCH 01/10] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=EF=BC=9A=20=E7=8E=B0?= =?UTF-8?q?=E5=9C=B0=E6=98=BE=E7=A4=BA=E9=85=8D=E7=BD=AE=E7=94=9F=E6=88=90?= =?UTF-8?q?=E6=9D=83=E9=99=90=E7=9A=84=E6=97=B6=E5=80=99=E6=9C=AA=E7=94=9F?= =?UTF-8?q?=E6=88=90=E8=BD=A6=E7=AB=99=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../newMap/newMapdraft/mapoperate/displayConfig/localConfig.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/src/views/newMap/newMapdraft/mapoperate/displayConfig/localConfig.vue b/src/views/newMap/newMapdraft/mapoperate/displayConfig/localConfig.vue index ae3289212..aaec4b304 100644 --- a/src/views/newMap/newMapdraft/mapoperate/displayConfig/localConfig.vue +++ b/src/views/newMap/newMapdraft/mapoperate/displayConfig/localConfig.vue @@ -366,6 +366,7 @@ export default { if (!item.depot) { tempData.stationCodeList.push(item.code); tempData.switchStationCodeList.push(item.code); + tempData.elementList.push(item.code); } else { stationCodeList.push(item.code); } }); [...this.sectionList, ...this.signalList, ...this.stationStandList, ...this.switchList, ...this.automaticRouteButtonList, From 969a35eec18740289a5307f518c8ecb955e8eb72 Mon Sep 17 00:00:00 2001 From: fan <18706759286@163.com> Date: Wed, 29 Sep 2021 10:12:49 +0800 Subject: [PATCH 02/10] =?UTF-8?q?=E5=88=97=E8=BD=A6=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96=E6=97=B6=20=E9=87=8D=E6=96=B0=E8=A7=A3=E6=9E=90?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=20=E4=BB=A5=E6=B8=85=E9=99=A4=E6=AE=8B?= =?UTF-8?q?=E7=95=99=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/jmapNew/parser/parser-graph.js | 8 +++++++- .../theme/foshan_01/menus/menuDialog/viewTrainId.vue | 7 +++++++ .../theme/fuzhou_01/menus/menuDialog/viewTrainId.vue | 7 +++++++ .../theme/xian_01/menus/menuDialog/viewTrainId.vue | 7 +++++++ src/store/modules/map.js | 8 +++++++- 5 files changed, 35 insertions(+), 2 deletions(-) diff --git a/src/jmapNew/parser/parser-graph.js b/src/jmapNew/parser/parser-graph.js index 934f1c409..4a73436f8 100644 --- a/src/jmapNew/parser/parser-graph.js +++ b/src/jmapNew/parser/parser-graph.js @@ -273,7 +273,13 @@ export function parser(data, skinCode, showConfig) { return mapDevice; } - +// 初始化列车数据(仿真初始化时候,状态消息未初始化列车消息,前端暂时处理(临时解决方案)) +export function parserTrainData(mapDevice, trainList, skinCode, showConfig) { + var propConvert = skinCode ? Vue.prototype.$theme.loadPropConvert(skinCode) : null; + zrUtil.each(trainList || [], elem => { + mapDevice[elem.code] = createDevice(deviceType.Train, elem, propConvert, showConfig); + }, this); +} // 重置坐标点 function handleResetPoint(points) { return (points[points.length - 1].x >= points[0].x); diff --git a/src/jmapNew/theme/foshan_01/menus/menuDialog/viewTrainId.vue b/src/jmapNew/theme/foshan_01/menus/menuDialog/viewTrainId.vue index 19ee2fb5a..71954c9d7 100644 --- a/src/jmapNew/theme/foshan_01/menus/menuDialog/viewTrainId.vue +++ b/src/jmapNew/theme/foshan_01/menus/menuDialog/viewTrainId.vue @@ -107,6 +107,13 @@ export default { return this.dialogShow ? OperationEvent.Command.close.confirm.domId : ''; } }, + watch: { + '$store.state.training.started':function (val) { + if (val) { + this.setTrainDispaly(); + } + } + }, mounted() { this.$nextTick(() => { this.setTrainDispaly(); diff --git a/src/jmapNew/theme/fuzhou_01/menus/menuDialog/viewTrainId.vue b/src/jmapNew/theme/fuzhou_01/menus/menuDialog/viewTrainId.vue index 11396f069..0204b3055 100644 --- a/src/jmapNew/theme/fuzhou_01/menus/menuDialog/viewTrainId.vue +++ b/src/jmapNew/theme/fuzhou_01/menus/menuDialog/viewTrainId.vue @@ -107,6 +107,13 @@ export default { return this.dialogShow ? OperationEvent.Command.close.confirm.domId : ''; } }, + watch: { + '$store.state.training.started':function (val) { + if (val) { + this.setTrainDispaly(); + } + } + }, mounted() { this.$nextTick(() => { this.setTrainDispaly(); diff --git a/src/jmapNew/theme/xian_01/menus/menuDialog/viewTrainId.vue b/src/jmapNew/theme/xian_01/menus/menuDialog/viewTrainId.vue index eaa8ce076..1c3a700ba 100644 --- a/src/jmapNew/theme/xian_01/menus/menuDialog/viewTrainId.vue +++ b/src/jmapNew/theme/xian_01/menus/menuDialog/viewTrainId.vue @@ -107,6 +107,13 @@ export default { return this.dialogShow ? OperationEvent.Command.close.confirm.domId : ''; } }, + watch: { + '$store.state.training.started':function (val) { + if (val) { + this.setTrainDispaly(); + } + } + }, mounted() { this.$nextTick(() => { this.setTrainDispaly(); diff --git a/src/store/modules/map.js b/src/store/modules/map.js index 9c14fc6dc..222ed0c35 100644 --- a/src/store/modules/map.js +++ b/src/store/modules/map.js @@ -1209,9 +1209,15 @@ const map = { commit('mapStateLoadedCountIncrenment'); }, - clearJlmapTrainView: () => { + clearJlmapTrainView: ({ commit, state}) => { if (Vue.prototype.$jlmap) { Vue.prototype.$jlmap.clearTrainView(); + let showConfig = {}; + if (Vue.prototype.$jlmap && typeof Vue.prototype.$jlmap.getShowConfig === 'function') { + showConfig = Vue.prototype.$jlmap.getShowConfig(); + } + const parser = parserFactory(ParserType.Graph.value); + parser.parserTrainData(state.mapDevice, state.map.trainList, state.map.skinVO.code, showConfig); } }, From 36fee6efda46f26aded8a1da6ea3c736c9265322 Mon Sep 17 00:00:00 2001 From: sunzhenyu Date: Wed, 29 Sep 2021 13:18:24 +0800 Subject: [PATCH 03/10] =?UTF-8?q?=E5=85=B6=E4=BB=96=E4=B8=89=E7=BB=B4?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E5=86=85=E5=AE=B9=E5=88=86=E6=8B=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lesson3dedit/toolsmodel/zzwwtrain.js | 3 + .../zzww/manager/controlmanager.js | 707 ++++++++++++++++++ src/jlmap3d/otherproject/zzww/zzww.js | 213 ++++++ src/router/index.js | 2 +- .../zzww}/zzwwtest.vue | 4 +- 5 files changed, 926 insertions(+), 3 deletions(-) create mode 100644 src/jlmap3d/otherproject/zzww/manager/controlmanager.js create mode 100644 src/jlmap3d/otherproject/zzww/zzww.js rename src/views/jlmap3d/{zzwwtest => otherproject/zzww}/zzwwtest.vue (98%) diff --git a/src/jlmap3d/lesson3dedit/toolsmodel/zzwwtrain.js b/src/jlmap3d/lesson3dedit/toolsmodel/zzwwtrain.js index 514e5907e..05f5386ba 100644 --- a/src/jlmap3d/lesson3dedit/toolsmodel/zzwwtrain.js +++ b/src/jlmap3d/lesson3dedit/toolsmodel/zzwwtrain.js @@ -6,6 +6,9 @@ export function ZzwwTrain() { tittle:"防溜防护检查", text:"", devices:[ + { + + }, { id:"ZLQ", name:"止轮器", diff --git a/src/jlmap3d/otherproject/zzww/manager/controlmanager.js b/src/jlmap3d/otherproject/zzww/manager/controlmanager.js new file mode 100644 index 000000000..da5cfd494 --- /dev/null +++ b/src/jlmap3d/otherproject/zzww/manager/controlmanager.js @@ -0,0 +1,707 @@ + +import { Capsule } from '@/jlmap3d/lesson3d/math/Capsule.js'; + +import { Octree } from '@/jlmap3d/lesson3d/math/Octree.js'; + +import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js'; +import { OBJLoader } from '@/jlmap3d/main/loaders/OBJLoader'; + +export function ControlManager(dom,scene,lessonData,lessonIndex) { + + let scope = this; + this.controlMode = ""; + this.controls = {}; + this.nowCamera = null; + this.eventHitMode = false; + let modelManager; + let nowRole = ""; + let roleMode = false; + + let examList = {}; + let examData = {}; + + let eventBoxs = []; + let raycasterBoxs = []; + let actionList = []; + let eventTrigger; + let nowActions; + + let trainDeviceMode = false; + let trainDeviceList = []; + + let renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setClearColor(new THREE.Color(0x000000)); + renderer.setViewport( 0, 0, dom.offsetWidth, dom.offsetHeight); + renderer.setScissor( 0, 0, dom.offsetWidth, dom.offsetHeight); + renderer.setScissorTest( false ); + renderer.setSize(dom.offsetWidth, dom.offsetHeight); + renderer.sortObjects = true; + dom.appendChild(renderer.domElement); + + let orbitCamera = new THREE.PerspectiveCamera(70, dom.offsetWidth / dom.offsetHeight, 0.01, 1000); + orbitCamera.position.set(0, 80, 40); + orbitCamera.aspect = dom.offsetWidth / dom.offsetHeight; + orbitCamera.updateProjectionMatrix(); + + let oribitControl = new THREE.OrbitControls(orbitCamera,dom); + oribitControl.maxPolarAngle = Math.PI / 2; + oribitControl.minPolarangle = Math.PI / 5; + oribitControl.maxDistance = 800; + oribitControl.screenSpacePanning = true; + oribitControl.update(); + + + let fpsCamera = new THREE.PerspectiveCamera( 75,dom.offsetWidth / dom.offsetHeight, 0.1, 1000 ); + fpsCamera.aspect = dom.offsetWidth / dom.offsetHeight; + fpsCamera.rotation.order = 'YXZ'; + + let attachBox = new THREE.Mesh( + new THREE.BoxGeometry(1, 5, 1), + new THREE.MeshBasicMaterial({color: 0xff00000,transparent: true,opacity: 0 })//RED box + ); + let hitBox = new THREE.Box3(new THREE.Vector3(), new THREE.Vector3()); + hitBox.setFromObject(attachBox); + scene.add(attachBox); + + //fps control + const GRAVITY = 30; + + const NUM_SPHERES = 20; + const SPHERE_RADIUS = 0.1; + + const sphereGeometry = new THREE.SphereGeometry( SPHERE_RADIUS, 16, 16 ); + const sphereMaterial = new THREE.MeshStandardMaterial( { color: 0x888855, roughness: 0.8, metalness: 0.5, } ); + + const spheres = []; + let sphereIdx = 0; + + for ( let i = 0; i < NUM_SPHERES; i ++ ) { + + const sphere = new THREE.Mesh( sphereGeometry, sphereMaterial ); + + + scene.add( sphere ); + + spheres.push( { mesh: sphere, collider: new THREE.Sphere( new THREE.Vector3( 0, - 100, 0 ), SPHERE_RADIUS ), velocity: new THREE.Vector3() } ); + + } + + + let loaderObj = new THREE.OBJLoader(); + let standstationPZ,stopstationPZ,occPZ; + // load a resource + loaderObj.load( + JL3D_LOCAL_STATIC+'/lesson3d/standstationPZ.obj', + function ( object ) { + standstationPZ = object; + }, + function ( xhr ) { + console.log( ( xhr.loaded / xhr.total * 100 ) + '% loaded' ); + }, + function ( error ) { + console.log( 'An error happened' ); + } + ); + loaderObj.load( + JL3D_LOCAL_STATIC+'/lesson3d/stopstationPZ.obj', + function ( object ) { + stopstationPZ = object; + }, + function ( xhr ) { + console.log( ( xhr.loaded / xhr.total * 100 ) + '% loaded' ); + }, + function ( error ) { + console.log( 'An error happened' ); + } + ); + loaderObj.load( + JL3D_LOCAL_STATIC+'/lesson3d/occPZ.obj', + function ( object ) { + occPZ = object; + }, + function ( xhr ) { + console.log( ( xhr.loaded / xhr.total * 100 ) + '% loaded' ); + }, + function ( error ) { + console.log( 'An error happened' ); + } + ); + + this.initRoleMode = function(rMode,role){ + roleMode = rMode; + nowRole = role; + // console.log(roleMode); + }; + + this.initExam = function(newExamList,newExamData){ + examList = newExamList; + examData = newExamData; + }; + + function updateExam(){ + updataExamStatus(examData); + } + + const worldOctree = new Octree(); + + const playerCollider = new Capsule( new THREE.Vector3( 0, 10, 0 ), new THREE.Vector3( 0, 11.9, 0 ), 1 ); + // playerCollider.set( + // new THREE.Vector3( + // lessonData.lessonProgress[lessonIndex].cameraPosition.x, + // lessonData.lessonProgress[lessonIndex].cameraPosition.y, + // lessonData.lessonProgress[lessonIndex].cameraPosition.z), + // new THREE.Vector3( + // lessonData.lessonProgress[lessonIndex].cameraPosition.x, + // lessonData.lessonProgress[lessonIndex].cameraPosition.y+1.5, + // lessonData.lessonProgress[lessonIndex].cameraPosition.z ), 1); + // attachBox.position.x = lessonData.lessonProgress[lessonIndex].cameraPosition.x; + // attachBox.position.y = lessonData.lessonProgress[lessonIndex].cameraPosition.y ; + // attachBox.position.z = lessonData.lessonProgress[lessonIndex].cameraPosition.z; + + + + + const playerVelocity = new THREE.Vector3(); + const playerDirection = new THREE.Vector3(); + + let playerOnFloor = false; + + const keyStates = {}; + let clock = new THREE.Clock(); + + + this.updateOrbitControl = function(){ + oribitControl.update(); + render(orbitCamera); + }; + + this.updateFpsControl = function(){ + const deltaTime = Math.min( 0.1, clock.getDelta() ); + + controls( deltaTime ); + + updatePlayer( deltaTime ); + + updateSpheres( deltaTime ); + // console.log(scope.eventHitMode); + // console.log(roleMode); + if(scope.eventHitMode == true && roleMode){ + if(eventBoxs.length>0){ + attachBox.position.copy(fpsCamera.position); + for(let i=0;i { + + keyStates[ event.code ] = true; + + } ); + + document.addEventListener( 'keyup', ( event ) => { + + keyStates[ event.code ] = false; + + } ); + let fpsMouseStatus = false; + document.addEventListener( 'mousedown', (event) => { + fpsMouseStatus = true; + // document.body.requestPointerLock(); + console.log("mousedown-----------------------"); + console.log(raycasterBoxs); + console.log(roleMode); + + if(raycasterBoxs.length>0 && roleMode){ + var mouse = new THREE.Vector2(); + + var raycaster = new THREE.Raycaster(); + + mouse.x = ( event.clientX / dom.offsetWidth ) * 2 - 1; + + mouse.y = - ( event.clientY / dom.offsetHeight ) * 2 + 1; + + raycaster.setFromCamera(mouse,scope.nowCamera) // 也可以给构造函数传参的形式写 + + for(let i=0;i0){ + if(raycasterBoxs[i].type == "switch"){ + if(raycasterBoxs[i].actionMode == "jump"){ + actionEvent("remove",raycasterBoxs[i],raycasterBoxs[i].mesh); + jumpEvent("action",raycasterBoxs[i]); + }else{ + if(raycasterBoxs[i].action.status == "01"){ + raycasterBoxs[i].action.status = "02"; + raycasterBoxs[i].action.action.play(); + }else if(raycasterBoxs[i].action.status == "02"){ + raycasterBoxs[i].action.status = "01"; + raycasterBoxs[i].action.action.stop(); + } + } + + }else if(raycasterBoxs[i].type == "urgeSwitch"){ + console.log(raycasterBoxs[i]); + if(raycasterBoxs[i].action.status == "02"){ + raycasterBoxs[i].action.status = "01"; + raycasterBoxs[i].action.action.stop(); + } + } + + } + } + } + + if(trainDeviceMode == true){ + var mouse = new THREE.Vector2(); + + var raycaster = new THREE.Raycaster(); + + mouse.x = ( event.clientX / dom.offsetWidth ) * 2 - 1; + + mouse.y = - ( event.clientY / dom.offsetHeight ) * 2 + 1; + + raycaster.setFromCamera(mouse,scope.nowCamera); + + var intersects = raycaster.intersectObject( modelManager.otherModel.children[1],true); + if(intersects.length>0){ + + jl3dZzwwTrainTestUpdate(intersects[0].object.name); + + } + + } + + + } ); + + + + document.body.addEventListener( 'mousemove', ( event ) => { + if(fpsMouseStatus == true){ + fpsCamera.rotation.y -= event.movementX / 500; + fpsCamera.rotation.x -= event.movementY / 500; + } + // if ( document.pointerLockElement === document.body ) { + // } + } ); + + document.addEventListener( 'mouseup', () => { + fpsMouseStatus = false; + } ); + + + function playerCollitions() { + + const result = worldOctree.capsuleIntersect( playerCollider ); + + playerOnFloor = false; + + if ( result ) { + + playerOnFloor = result.normal.y > 0; + + if ( ! playerOnFloor ) { + + playerVelocity.addScaledVector( result.normal, - result.normal.dot( playerVelocity ) ); + + } + + playerCollider.translate( result.normal.multiplyScalar( result.depth ) ); + + } + + } + + function updatePlayer( deltaTime ) { + + if ( playerOnFloor ) { + + const damping = Math.exp( - 3 * deltaTime ) - 1; + playerVelocity.addScaledVector( playerVelocity, damping ); + + } else { + + playerVelocity.y -= GRAVITY * deltaTime; + + } + + const deltaPosition = playerVelocity.clone().multiplyScalar( deltaTime ); + playerCollider.translate( deltaPosition ); + + playerCollitions(); + + fpsCamera.position.copy( playerCollider.end ); + + } + + function spheresCollisions() { + + for ( let i = 0; i < spheres.length; i ++ ) { + + const s1 = spheres[ i ]; + + for ( let j = i + 1; j < spheres.length; j ++ ) { + + const s2 = spheres[ j ]; + + const d2 = s1.collider.center.distanceToSquared( s2.collider.center ); + const r = s1.collider.radius + s2.collider.radius; + const r2 = r * r; + + if ( d2 < r2 ) { + + const normal = s1.collider.clone().center.sub( s2.collider.center ).normalize(); + const v1 = normal.clone().multiplyScalar( normal.dot( s1.velocity ) ); + const v2 = normal.clone().multiplyScalar( normal.dot( s2.velocity ) ); + s1.velocity.add( v2 ).sub( v1 ); + s2.velocity.add( v1 ).sub( v2 ); + + const d = ( r - Math.sqrt( d2 ) ) / 2; + + s1.collider.center.addScaledVector( normal, d ); + s2.collider.center.addScaledVector( normal, - d ); + + } + + } + + } + + } + + function updateSpheres( deltaTime ) { + + spheres.forEach( sphere =>{ + + sphere.collider.center.addScaledVector( sphere.velocity, deltaTime ); + + const result = worldOctree.sphereIntersect( sphere.collider ); + + if ( result ) { + + sphere.velocity.addScaledVector( result.normal, - result.normal.dot( sphere.velocity ) * 1.5 ); + sphere.collider.center.add( result.normal.multiplyScalar( result.depth ) ); + + } else { + + sphere.velocity.y -= GRAVITY * deltaTime; + + } + + const damping = Math.exp( - 1.5 * deltaTime ) - 1; + sphere.velocity.addScaledVector( sphere.velocity, damping ); + + spheresCollisions(); + + sphere.mesh.position.copy( sphere.collider.center ); + + } ); + + } + + function getForwardVector() { + + fpsCamera.getWorldDirection( playerDirection ); + playerDirection.y = 0; + playerDirection.normalize(); + + return playerDirection; + + } + + function getSideVector() { + + fpsCamera.getWorldDirection( playerDirection ); + playerDirection.y = 0; + playerDirection.normalize(); + playerDirection.cross( fpsCamera.up ); + + return playerDirection; + + } + + function controls( deltaTime ) { + + const speed = 25; + + if ( playerOnFloor ) { + + if ( keyStates[ 'KeyW' ] ) { + + playerVelocity.add( getForwardVector().multiplyScalar( speed * deltaTime ) ); + + } + + if ( keyStates[ 'KeyS' ] ) { + + playerVelocity.add( getForwardVector().multiplyScalar( - speed * deltaTime ) ); + + } + + if ( keyStates[ 'KeyA' ] ) { + + playerVelocity.add( getSideVector().multiplyScalar( - speed * deltaTime ) ); + + } + + if ( keyStates[ 'KeyD' ] ) { + + playerVelocity.add( getSideVector().multiplyScalar( speed * deltaTime ) ); + + } + + + if ( keyStates[ 'Space' ] ) { + + playerVelocity.y = 10; + + } + + } + + } + + function render(camera){ + renderer.render( scene, camera ); + } + window.onresize = function () { + renderer.setSize(dom.offsetWidth,dom.offsetHeight); + } + + this.initControlMode = function(nowLessonIndex){ + // console.log(lessonData.lessonProgress[nowLessonIndex].progressScene); + + if(lessonData.lessonProgress[nowLessonIndex].progressScene == "standstation"){ + worldOctree.fromGraphNode( standstationPZ ); + }else if(lessonData.lessonProgress[nowLessonIndex].progressScene == "stopstation"){ + worldOctree.fromGraphNode( stopstationPZ ); + }else if(lessonData.lessonProgress[nowLessonIndex].progressScene == "occ"){ + worldOctree.fromGraphNode( occPZ ); + } + + + + + if((lessonData.lessonProgress[nowLessonIndex].changeCamera == true && lessonData.lessonProgress[nowLessonIndex].roleName == nowRole) || nowLessonIndex == 0 || lessonData.lessonProgress[nowLessonIndex].roleName== 'kong'){ + + + scope.controlMode = lessonData.lessonProgress[nowLessonIndex].controlMode; + if(scope.controlMode == "free" || scope.controlMode == "non"){ + scope.nowCamera = orbitCamera; + oribitControl.enabled = true; + + orbitCamera.position.x = lessonData.lessonProgress[nowLessonIndex].cameraPosition.x; + orbitCamera.position.y = lessonData.lessonProgress[nowLessonIndex].cameraPosition.y; + orbitCamera.position.z = lessonData.lessonProgress[nowLessonIndex].cameraPosition.z; + oribitControl.target = new THREE.Vector3(lessonData.lessonProgress[nowLessonIndex].cameraTarget.x,lessonData.lessonProgress[nowLessonIndex].cameraTarget.y,lessonData.lessonProgress[nowLessonIndex].cameraTarget.z); + scope.updateOrbitControl(); + + if(scope.controlMode == "non"){ + oribitControl.enabled = false; + } + }else if(scope.controlMode == "fps"){ + scope.nowCamera = fpsCamera; + oribitControl.enabled = false; + playerCollider.set( + new THREE.Vector3( + lessonData.lessonProgress[nowLessonIndex].cameraPosition.x, + lessonData.lessonProgress[nowLessonIndex].cameraPosition.y, + lessonData.lessonProgress[nowLessonIndex].cameraPosition.z), + new THREE.Vector3( + lessonData.lessonProgress[nowLessonIndex].cameraPosition.x, + lessonData.lessonProgress[nowLessonIndex].cameraPosition.y+1.5, + lessonData.lessonProgress[nowLessonIndex].cameraPosition.z ), 1); + attachBox.position.x = lessonData.lessonProgress[nowLessonIndex].cameraPosition.x; + attachBox.position.y = lessonData.lessonProgress[nowLessonIndex].cameraPosition.y ; + attachBox.position.z = lessonData.lessonProgress[nowLessonIndex].cameraPosition.z; + } + + } + } + + this.changeIndexEvent = function(actions,rMode,lessonTriggerList){ + + eventTrigger = lessonTriggerList; + + nowActions = actions; + // let newEventBoxs = []; + // eventBoxs = newEventBoxs; + raycasterBoxs = []; + roleMode = rMode; + // console.log("---------changeIndex--------"); + // console.log(actions); + // console.log(roleMode); + // console.log(eventTrigger); + // console.log("----------------------------"); + + console.log(roleMode); + if(actions.length>0 ){ + scope.eventHitMode = true; + for(let i=0;i0){ + // console.log(actions); + } + }; + +} diff --git a/src/jlmap3d/otherproject/zzww/zzww.js b/src/jlmap3d/otherproject/zzww/zzww.js new file mode 100644 index 000000000..bb18459a1 --- /dev/null +++ b/src/jlmap3d/otherproject/zzww/zzww.js @@ -0,0 +1,213 @@ +import store from '@/store/index'; +// import { Loading } from 'element-ui'; +import {Stats} from '@/jlmap3d/main/lib/stats.min.js'; +//静态资源文件路径 +import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js'; +//loader +import { FBXLoader } from '@/jlmap3d/main/loaders/FBXLoader'; +//轨道视角控制 +import { OrbitControls } from '@/jlmap3d/main/control/OrbitControls'; +//骨骼动画模型辅助工具 +import { SkeletonUtils } from '@/jlmap3d/main/utils/SkeletonUtils.js'; + +import { AssetModelManager } from '@/jlmap3d/lesson3d/manager/assetmodelmanager.js'; + +import { ControlManager } from '@/jlmap3d/otherproject/zzww/manager/controlmanager.js'; + +import { AnimateManager } from '@/jlmap3d/lesson3d/manager/animatemanager.js'; + +import { Fire } from '@/jlmap3d/lesson3d/utils/fire.js'; + + +// import { AnimationManager } from '@/jlmap3d/lesson3d/manager/assetmodelmanager.js'; + + +let scene; + +export function ZzWw(dom,lessonData,lessonIndex) { + + // let stats = new Stats(); + // dom.appendChild( stats.dom ); + + let scope = this; + this.dom = dom; + this.nowSceneType = ""; + + //定义当前课程角色 + let nowRole = ""; + let oldIndex = 0; + //考试课程 + let examList = []; + let examData = {}; + //定义场景(渲染容器) + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xa0a0a0); + + //定义全局光 + let ambientLight = new THREE.AmbientLight(0xffffff, 1.3); + scene.add(ambientLight); + var light = new THREE.HemisphereLight( 0xffffff, 0x444444 ); + light.position.set( 0, 4000, 0 ); + scene.add( light ); + + // let fire = new Fire(); + // fire.init(scene); + + let animateManager = new AnimateManager(); + + + let controlManager = new ControlManager( dom,scene,lessonData,lessonIndex); + + let assetModelManager = new AssetModelManager(scope,scene,controlManager); + assetModelManager.lessonAssetsLoader(lessonData).then((result) => { + scope.nowSceneType = lessonData.lessonProgress[0].progressScene; + animateManager.initAnimation(assetModelManager); + + + controlManager.init(animateManager.actions,assetModelManager,lessonData.trainDeviceData); + + startLesson(); + animate(); + resolve("loadeend"); //['成功了', 'success'] + }).catch((error) => { + //console.log(error); + }); + + + + this.actionModelControl = function(actionType,actionModel){ + // console.log(actionType); + // console.log(actionModel); + if(actionType == "remove"){ + assetModelManager.otherModel.remove(actionModel); + }else if(actionType == "show"){ + actionModel.visible = true; + assetModelManager.otherModel.add(actionModel); + }else if(actionType == "changeIndex"){ + actionModel.visible = true; + assetModelManager.otherModel.add(actionModel); + } + + + } + + this.actionRemove = function(actionModel){ + + } + + this.changeIndex = function(nowIndex){ + if(nowIndex!=0){ + oldIndex = lessonIndex; + if(lessonData.lessonProgress[oldIndex].roleName == nowRole){ + updateExam(lessonData.lessonProgress[oldIndex],oldIndex); + } + } + + + + lessonIndex = nowIndex; + + // console.log(nowIndex); + scope.nowSceneType = lessonData.lessonProgress[nowIndex].progressScene; + // console.log(nowRole); + // console.log(lessonData.lessonProgress[lessonIndex].roleName); + if(lessonData.lessonProgress[lessonIndex].roleName == nowRole){ + assetModelManager.changeSceneGroup(scope.nowSceneType); + controlManager.initRoleMode(true,nowRole); + controlManager.initControlMode(lessonIndex); + controlManager.changeIndexEvent(lessonData.lessonProgress[lessonIndex].action,true,assetModelManager.lessonTriggerList[scope.nowSceneType]); + + } else{ + if(lessonData.lessonProgress[lessonIndex].roleName == 'kong'){ + assetModelManager.changeSceneGroup(scope.nowSceneType); controlManager.initRoleMode(false,nowRole); + } + controlManager.initRoleMode(false,nowRole); + controlManager.initControlMode(lessonIndex); + controlManager.changeIndexEvent(lessonData.lessonProgress[lessonIndex].action,false,assetModelManager.lessonTriggerList[scope.nowSceneType]); + } + + + if(nowIndex == (lessonData.lessonProgress.length-1)){ + console.log(nowIndex); + console.log(lessonData.lessonProgress.length); + lessonEnd(); + } + } + + this.changeCameraPos = function(pos){ + controlManager.updatePos(pos); + } + + this.initNowRole = function(role){ + if(role){ + nowRole = role; + controlManager.initControlMode(lessonIndex); + let roleMode = false; + if(lessonData.lessonProgress[lessonIndex].roleName == nowRole){ + roleMode = true; + } + controlManager.initRoleMode(roleMode); + for(let i=0;i0){ + controlManager.changeIndexEvent(lessonData.lessonProgress[lessonIndex].action,roleMode,assetModelManager.lessonTriggerList[scope.nowSceneType]); + + }else{ + controlManager.changeIndexEvent(lessonData.lessonProgress[lessonIndex].action,false,assetModelManager.lessonTriggerList[scope.nowSceneType]); + } + // } + }; + + function updateExam(newIndexData,newIndex){ + for(let i=0;i import('@/views/jlmap3d/lesson3dedit/lesson3de const Jlmap3dLesson3dPlayer = () => import('@/views/jlmap3d/lesson3dplayer/lesson3dplayer'); const Jlmap3dLesson3dSelect = () => import('@/views/jlmap3d/lesson3dplayer/lesson3dselect'); -const Jlmap3dZzwwTest = () => import('@/views/jlmap3d/zzwwtest/zzwwtest'); +const Jlmap3dZzwwTest = () => import('@/views/jlmap3d/otherproject/zzww/zzwwtest'); const Jlmap3d = () => import('@/views/jlmap3d/drive/jl3ddrive'); diff --git a/src/views/jlmap3d/zzwwtest/zzwwtest.vue b/src/views/jlmap3d/otherproject/zzww/zzwwtest.vue similarity index 98% rename from src/views/jlmap3d/zzwwtest/zzwwtest.vue rename to src/views/jlmap3d/otherproject/zzww/zzwwtest.vue index 44684a6bb..00a40fada 100644 --- a/src/views/jlmap3d/zzwwtest/zzwwtest.vue +++ b/src/views/jlmap3d/otherproject/zzww/zzwwtest.vue @@ -147,7 +147,7 @@ import TrainTestPane from '@/views/jlmap3d/lesson3dplayer/tools/traintestpane'; - import { Lesson3dPlayer } from '@/jlmap3d/lesson3d/lesson3dplayer.js'; + import { ZzWw } from '@/jlmap3d/otherproject/zzww/zzww.js'; import { LessonData } from '@/jlmap3d/lesson3d/model/lessondata.js'; import { JobPaneData } from '@/jlmap3d/lesson3d/toolsmodel/jobpanedata.js'; @@ -310,7 +310,7 @@ // console.log("loaddata----------------"); // console.log(loadData); // console.log(this.lessonMsg); - this.jl3d = new Lesson3dPlayer(dom,loadData,this.lessonPlayIndex); + this.jl3d = new ZzWw(dom,loadData,this.lessonPlayIndex); }).catch(() => { }); }, From 1e12edd90e93515e619bad53441ecca34aa168e3 Mon Sep 17 00:00:00 2001 From: fan <18706759286@163.com> Date: Wed, 29 Sep 2021 13:19:29 +0800 Subject: [PATCH 04/10] =?UTF-8?q?=E7=BB=BC=E5=90=88=E6=BC=94=E7=BB=83?= =?UTF-8?q?=E5=81=9C=E8=BD=A6=E5=9C=BA=E6=98=BE=E7=A4=BA=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/jmapNew/painter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/jmapNew/painter.js b/src/jmapNew/painter.js index 9ffd9be90..d20eacd1f 100644 --- a/src/jmapNew/painter.js +++ b/src/jmapNew/painter.js @@ -96,7 +96,7 @@ class Painter { const instance = device.instance; if (instance) { this.mapInstanceLevel[device._type].remove(instance); - // device.instance = null; + device.instance = null; } } From fd6e7c9f0919418210b6a201a59820a3cd27dcda Mon Sep 17 00:00:00 2001 From: fan <18706759286@163.com> Date: Wed, 29 Sep 2021 15:35:26 +0800 Subject: [PATCH 05/10] =?UTF-8?q?=E5=8D=97=E4=BA=AC=E4=BA=8C=E5=8F=B7?= =?UTF-8?q?=E7=BA=BF=20atr=20=E5=88=97=E8=BD=A6=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/jmapNew/shape/graph/Signal/index.js | 4 +-- src/views/newMap/displayBaSiDi/atr.vue | 47 +++++++++++++++++++++++-- 2 files changed, 46 insertions(+), 5 deletions(-) diff --git a/src/jmapNew/shape/graph/Signal/index.js b/src/jmapNew/shape/graph/Signal/index.js index 4cb1fd057..f6fead50e 100644 --- a/src/jmapNew/shape/graph/Signal/index.js +++ b/src/jmapNew/shape/graph/Signal/index.js @@ -933,9 +933,7 @@ class Signal extends Group { this.lamps && this.lamps[1] && this.lamps[1].hide(); } - if (this.style.Signal.lamp.faultType == 'flash') { - // this.lamps && this.lamps[0] && this.lamps[0].faultHide(); - } else if (this.style.Signal.lamp.faultType == 'cross') { + if (this.style.Signal.lamp.faultType == 'cross') { this.lamps && this.lamps[0] && this.lamps[0].setFault2Corss(false); } else if (this.style.Signal.lamp.faultType == 'watch') { const device = findDeviceByModelDepType(this.model, deviceType.LampFilament, 'stationCode'); diff --git a/src/views/newMap/displayBaSiDi/atr.vue b/src/views/newMap/displayBaSiDi/atr.vue index 0828ca022..99dfe02cb 100644 --- a/src/views/newMap/displayBaSiDi/atr.vue +++ b/src/views/newMap/displayBaSiDi/atr.vue @@ -168,11 +168,30 @@
- 显示列车信息 + 显示列车信息 执行 重设 关闭
+ + + + + + + + + + @@ -195,11 +214,13 @@ export default { tableData2: [], tableData3: [], tableData4: [], + showTrainList: [], input: '', timeTerm: 'stop', sortStationList: [], noStopList: [], - dialogShow:false + dialogShow:false, + innerVisible: false }; }, computed: { @@ -241,6 +262,20 @@ export default { if (val !== 'REGULATION_OFF') { this.timeTerm = ''; } + }, + '$store.state.map.activeTrainListUpdate': function (val) { + if (val) { + const activeTrainList = this.$store.state.map.activeTrainList; + this.showTrainList = []; + activeTrainList.forEach((trainCode)=>{ + const train = this.$store.getters['map/getDeviceByCode'](trainCode); + if (train && train.sectionCode) { + this.showTrainList.push(train); + } + }); + } else { + this.showTrainList = []; + } } }, mounted() { @@ -290,6 +325,14 @@ export default { } } }, + getSectionName(code) { + const train = this.$store.getters['map/getDeviceByCode'](code); + const section = this.$store.getters['map/getDeviceByCode'](train.sectionCode); + return section ? section.name : ''; + }, + showTrainInfo() { + this.innerVisible = true; + }, doShow() { this.initData(); this.dialogShow = true; From 72bcc0596bfa3ea92acfd2c81f00eb59bd3fc37a Mon Sep 17 00:00:00 2001 From: fan <18706759286@163.com> Date: Wed, 29 Sep 2021 16:22:03 +0800 Subject: [PATCH 06/10] =?UTF-8?q?=E7=A6=8F=E5=B7=9E=E4=B8=80=20=E8=BD=A6?= =?UTF-8?q?=E8=81=94=E6=AE=B5=E5=81=9C=E8=BD=A6=E5=9C=BA=E4=BF=A1=E5=8F=B7?= =?UTF-8?q?=E6=9C=BA=E6=93=8D=E4=BD=9C=20=E5=A2=9E=E5=8A=A0=E9=99=90?= =?UTF-8?q?=E5=88=B6=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/jmapNew/theme/fuzhou_01/menus/menuSignal.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/jmapNew/theme/fuzhou_01/menus/menuSignal.vue b/src/jmapNew/theme/fuzhou_01/menus/menuSignal.vue index 4ad047790..786ab0cd0 100644 --- a/src/jmapNew/theme/fuzhou_01/menus/menuSignal.vue +++ b/src/jmapNew/theme/fuzhou_01/menus/menuSignal.vue @@ -227,7 +227,7 @@ export default { } }, '$store.state.menuOperation.selectedCount': function (val) { - if (this.$store.state.menuOperation.selected._type == 'Signal') { + if (this.$store.state.menuOperation.selected._type == 'Signal' && this.$store.state.training.prdType == '09') { if (this.buttonOperation) { this.operationHandler(this.buttonOperation, this.$store.state.menuOperation.selected); this.$parent.$refs.menuDeplotButton.clearCountDown(); From 34b156df80cae120d6ef0f657453c960bedde27e Mon Sep 17 00:00:00 2001 From: fan <18706759286@163.com> Date: Wed, 29 Sep 2021 17:02:37 +0800 Subject: [PATCH 07/10] =?UTF-8?q?=E4=BE=A7=E9=98=B2=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../flankProtectOperate/detail.vue | 22 +++++++++---------- .../dataRelation/routeoperate/route.vue | 8 +++---- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/src/views/newMap/newMapdraft/dataRelation/flankProtectOperate/detail.vue b/src/views/newMap/newMapdraft/dataRelation/flankProtectOperate/detail.vue index df6ef0c35..2e356bb94 100644 --- a/src/views/newMap/newMapdraft/dataRelation/flankProtectOperate/detail.vue +++ b/src/views/newMap/newMapdraft/dataRelation/flankProtectOperate/detail.vue @@ -13,7 +13,8 @@