diff --git a/src/assets/iscs_picture/check_arrow_double_hong.png b/src/assets/iscs_picture/check_arrow_double_hong.png new file mode 100644 index 000000000..2d8cff9d2 Binary files /dev/null and b/src/assets/iscs_picture/check_arrow_double_hong.png differ diff --git a/src/assets/iscs_picture/check_arrow_double_lv.png b/src/assets/iscs_picture/check_arrow_double_lv.png new file mode 100644 index 000000000..6bc40192c Binary files /dev/null and b/src/assets/iscs_picture/check_arrow_double_lv.png differ diff --git a/src/assets/iscs_picture/check_arrow_left_hong.png b/src/assets/iscs_picture/check_arrow_left_hong.png new file mode 100644 index 000000000..14e7876b8 Binary files /dev/null and b/src/assets/iscs_picture/check_arrow_left_hong.png differ diff --git a/src/assets/iscs_picture/check_arrow_left_lv.png b/src/assets/iscs_picture/check_arrow_left_lv.png new file mode 100644 index 000000000..e58d448b2 Binary files /dev/null and b/src/assets/iscs_picture/check_arrow_left_lv.png differ diff --git a/src/assets/iscs_picture/check_arrow_right_hong.png b/src/assets/iscs_picture/check_arrow_right_hong.png new file mode 100644 index 000000000..211407970 Binary files /dev/null and b/src/assets/iscs_picture/check_arrow_right_hong.png differ diff --git a/src/assets/iscs_picture/check_arrow_right_lv.png b/src/assets/iscs_picture/check_arrow_right_lv.png new file mode 100644 index 000000000..3d2e3a360 Binary files /dev/null and b/src/assets/iscs_picture/check_arrow_right_lv.png differ diff --git a/src/assets/iscs_picture/check_sell2.png b/src/assets/iscs_picture/check_sell2.png index 49ee298eb..8ba55aeaa 100644 Binary files a/src/assets/iscs_picture/check_sell2.png and b/src/assets/iscs_picture/check_sell2.png differ diff --git a/src/assets/iscs_picture/check_sell2_hong.png b/src/assets/iscs_picture/check_sell2_hong.png new file mode 100644 index 000000000..1f2b3d136 Binary files /dev/null and b/src/assets/iscs_picture/check_sell2_hong.png differ diff --git a/src/assets/iscs_picture/check_sell2_lv.png b/src/assets/iscs_picture/check_sell2_lv.png new file mode 100644 index 000000000..f243cb12c Binary files /dev/null and b/src/assets/iscs_picture/check_sell2_lv.png differ diff --git a/src/assets/iscs_picture/check_sell3.png b/src/assets/iscs_picture/check_sell3.png new file mode 100644 index 000000000..49ee298eb Binary files /dev/null and b/src/assets/iscs_picture/check_sell3.png differ diff --git a/src/iscs/shape/picture.js b/src/iscs/shape/picture.js index 570eaed78..061d0d124 100644 --- a/src/iscs/shape/picture.js +++ b/src/iscs/shape/picture.js @@ -49,11 +49,20 @@ import iscsDibian from '@/assets/iscs_picture/iscs-dibian.png'; import iscsPt1 from '@/assets/iscs_picture/iscs-pt1.png'; import checkNormal from '@/assets/iscs_picture/check_normal.png'; import checkArrowLeft from '@/assets/iscs_picture/check_arrow_left.png'; +import checkArrowLeftLv from '@/assets/iscs_picture/check_arrow_left_lv.png'; +import checkArrowLeftHong from '@/assets/iscs_picture/check_arrow_left_hong.png'; import checkArrowRight from '@/assets/iscs_picture/check_arrow_right.png'; +import checkArrowRightLv from '@/assets/iscs_picture/check_arrow_right_lv.png'; +import checkArrowRightHong from '@/assets/iscs_picture/check_arrow_right_hong.png'; import checkArrowDouble from '@/assets/iscs_picture/check_arrow_double.png'; +import checkArrowDoubleLv from '@/assets/iscs_picture/check_arrow_double_lv.png'; +import checkArrowDoubleHong from '@/assets/iscs_picture/check_arrow_double_hong.png'; import checkFlowCumulative from '@/assets/iscs_picture/check_flow_cumulative.png'; import checkSell from '@/assets/iscs_picture/check_sell.png'; import checkSell2 from '@/assets/iscs_picture/check_sell2.png'; +import checkSell2Lv from '@/assets/iscs_picture/check_sell2_lv.png'; +import checkSell2Hong from '@/assets/iscs_picture/check_sell2_hong.png'; +import checkSell3 from '@/assets/iscs_picture/check_sell3.png'; import bgShowRoom from '@/assets/iscs_picture/bg-showroom.jpg'; import bgStand from '@/assets/iscs_picture/bg-stand.jpg'; import bgFasPlatformA from '@/assets/iscs_picture/fas_platform_a_bg.png'; @@ -131,11 +140,17 @@ const pictureObj = { iscsPt1, checkNormal, checkArrowLeft, + checkArrowLeftLv, + checkArrowLeftHong, checkArrowRight, + checkArrowRightLv, + checkArrowRightHong, checkArrowDouble, checkFlowCumulative, checkSell, checkSell2, + checkSell2Lv, + checkSell2Hong, bgShowRoom, bgStand, basAnnulus, @@ -210,6 +225,9 @@ export default class Picture extends Group { this.grouper.add(this.imageButton); this.add(this.grouper); } + setStyle( style ) { + this.imageButton.setStyle(style); + } setModel(dx, dy) { this.model.point.x += dx; this.model.point.y += dy; diff --git a/src/jlmap3d/jl3ddrive/drivecontrol/simulation.js b/src/jlmap3d/jl3ddrive/drivecontrol/simulation.js index 421b4355e..975ab60dc 100644 --- a/src/jlmap3d/jl3ddrive/drivecontrol/simulation.js +++ b/src/jlmap3d/jl3ddrive/drivecontrol/simulation.js @@ -130,3 +130,19 @@ export function trainSimulationDoorControl(group, data) { data: data }); } + +export function trainSimulationDoorSelection(group, data) { + return request({ + url: `/simulation/${group}/operate/Driver_Door_Selection`, + method: 'post', + data: data + }); +} + +export function trainSimulationDoorMode(group, data) { + return request({ + url: `/simulation/${group}/operate/Driver_Door_Mode`, + method: 'post', + data: data + }); +} diff --git a/src/jlmap3d/jl3ddrive/jl3ddrive.js b/src/jlmap3d/jl3ddrive/jl3ddrive.js index e9e968099..5cc3c4595 100644 --- a/src/jlmap3d/jl3ddrive/jl3ddrive.js +++ b/src/jlmap3d/jl3ddrive/jl3ddrive.js @@ -145,7 +145,7 @@ export function JLmapDriving(dom,data,mapId,storemod,translation,routegroup,proj scene.add(controls3.getObject()); let cameracctv = new THREE.PerspectiveCamera(50, dom.clientWidth/dom.clientHeight, 0.1, 50); - cameracctv.position.set( -3, 0,4.5 ); + cameracctv.position.set( 1, 0,4.5 ); cameracctv.rotation.y = -Math.PI/2; cameracctv.rotation.x = Math.PI/2; @@ -387,7 +387,7 @@ export function JLmapDriving(dom,data,mapId,storemod,translation,routegroup,proj rails = loadrails; // console.log(trainlisttest.group.children[0]); - trainlisttest.group.children[0].getObjectByName("C3").add(cameracctv); + trainlisttest.group.children[0].getObjectByName("C6").add(cameracctv); } this.eventon = function() { diff --git a/src/jlmap3d/jl3ddrive/moveupdate/DrivingConnectNew.js b/src/jlmap3d/jl3ddrive/moveupdate/DrivingConnectNew.js index 5d250abc3..357dc721c 100644 --- a/src/jlmap3d/jl3ddrive/moveupdate/DrivingConnectNew.js +++ b/src/jlmap3d/jl3ddrive/moveupdate/DrivingConnectNew.js @@ -837,7 +837,6 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri } }else if(trainmodel.openleft != data.open && data.open == "1"){ trainmodel.openleft = "1"; - console.log(data); for(let an=actions["traindoor"].top.length-1;an>=0;an--){ actions["traindoor"].top[an].reset(); actions["traindoor"].top[an].time = 0; @@ -988,7 +987,7 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri } function standupdate(data) { code = data.code; - + if ( actions[code]) { if (data.open == '1') { actions[code].status = '1'; diff --git a/src/jlmap3d/lesson3d/lesson3dplayer.js b/src/jlmap3d/lesson3d/lesson3dplayer.js index 1a84b8f0b..bb7e36e89 100644 --- a/src/jlmap3d/lesson3d/lesson3dplayer.js +++ b/src/jlmap3d/lesson3d/lesson3dplayer.js @@ -104,13 +104,17 @@ export function Lesson3dPlayer(dom,lessonData,lessonIndex) { // console.log(nowRole); // console.log(lessonData.lessonProgress[lessonIndex].roleName); if(lessonData.lessonProgress[lessonIndex].roleName == nowRole){ - controlManager.initControlMode(lessonIndex); + assetModelManager.changeSceneGroup(scope.nowSceneType); controlManager.initRoleMode(true,nowRole); + controlManager.initControlMode(lessonIndex); controlManager.changeIndexEvent(lessonData.lessonProgress[lessonIndex].action,true,assetModelManager.lessonTriggerList[scope.nowSceneType]); - }else{ - controlManager.initControlMode(lessonIndex); + } 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]); } diff --git a/src/jlmap3d/lesson3d/manager/assetmodelmanager.js b/src/jlmap3d/lesson3d/manager/assetmodelmanager.js index 8c430e5a6..8118cd0ec 100644 --- a/src/jlmap3d/lesson3d/manager/assetmodelmanager.js +++ b/src/jlmap3d/lesson3d/manager/assetmodelmanager.js @@ -13,6 +13,7 @@ export function AssetModelManager(editor,scene) { groupList["standstation"] = new THREE.Group(); groupList["stopstation"] = new THREE.Group(); groupList["device"] = new THREE.Group(); + groupList["occ"] = new THREE.Group(); groupList["xl"] = new THREE.Group(); groupList["dc"] = new THREE.Group(); @@ -90,15 +91,36 @@ export function AssetModelManager(editor,scene) { sceneType:"stopstation", }; + scope.staticAsset['occ'] = { + modelId:'occ', + packageName:"occ大厅", + url:"/MODEL/2021-09-02/210-32471.FBX", + mesh:"", + assetType:'onlineasset', + isUse:true, + resourceType:"三维课程", + sceneType:"occ", + }; //场景中可触发事件模型 this.lessonTriggerList = []; scope.lessonTriggerList["standstation"] = []; scope.lessonTriggerList["stopstation"] = []; scope.lessonTriggerList["device"] = []; + scope.lessonTriggerList["occ"] = []; scope.lessonTriggerList["xl"] = []; scope.lessonTriggerList["dc"] = []; + this.changeSceneGroup = function(groupType){ + // console.log(groupType); + // console.log(editor.nowSceneType); + // console.log(scope.lessonTriggerList[editor.nowSceneType]); + editor.nowSceneType = groupType; + scene.remove(this.otherModel); + this.otherModel = groupList[groupType]; + scene.add(this.otherModel); + updateTriggerList(scope.lessonTriggerList[editor.nowSceneType]); + } //加载课程资源 this.lessonAssetsLoader = function(lessonData){ let initlist = []; diff --git a/src/jlmap3d/lesson3d/manager/controlmanager.js b/src/jlmap3d/lesson3d/manager/controlmanager.js index 4e64c1665..dfa66751c 100644 --- a/src/jlmap3d/lesson3d/manager/controlmanager.js +++ b/src/jlmap3d/lesson3d/manager/controlmanager.js @@ -84,7 +84,7 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) { let loaderObj = new THREE.OBJLoader(); - let standstationPZ,stopstationPZ; + let standstationPZ,stopstationPZ,occPZ; // load a resource loaderObj.load( JL3D_LOCAL_STATIC+'/lesson3d/standstationPZ.obj', @@ -110,6 +110,19 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) { 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; @@ -215,7 +228,7 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) { this.init = function(actions){ - worldOctree.fromGraphNode( standstationPZ ); + // worldOctree.fromGraphNode( standstationPZ ); actionList = actions; } @@ -279,6 +292,7 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) { } }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(); @@ -485,16 +499,23 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) { } this.initControlMode = function(nowLessonIndex){ - console.log(lessonData.lessonProgress[nowLessonIndex].progressScene); + // 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 ); } - scope.controlMode = lessonData.lessonProgress[nowLessonIndex].controlMode; - if(lessonData.lessonProgress[nowLessonIndex].changeCamera == true){ + + + + 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; @@ -537,11 +558,11 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) { // eventBoxs = newEventBoxs; raycasterBoxs = []; roleMode = rMode; - console.log("---------changeIndex--------"); - console.log(actions); - console.log(roleMode); - console.log(eventTrigger); - console.log("----------------------------"); + // console.log("---------changeIndex--------"); + // console.log(actions); + // console.log(roleMode); + // console.log(eventTrigger); + // console.log("----------------------------"); if(actions.length>0 && roleMode){ diff --git a/src/jlmap3d/lesson3dedit/accident/fire.js b/src/jlmap3d/lesson3dedit/accident/fire.js new file mode 100644 index 000000000..3968f225d --- /dev/null +++ b/src/jlmap3d/lesson3dedit/accident/fire.js @@ -0,0 +1,238 @@ +export function Fire() { + let scope = this; + this.points = {}; + var last_time_activate = Date.now(); + + + this.createNew = function(scene,pos){ + scope.points = new Points(pos); + scope.points.init(pos); + scene.add(scope.points.obj); + } + + this.update = function(){ + var now = Date.now(); + scope.points.update(); + if (now - last_time_activate > 10) { + + scope.points.activateMover(); + last_time_activate = Date.now(); + } + } + + var Mover = function() { + this.position = new THREE.Vector3(); + this.velocity = new THREE.Vector3(); + this.acceleration = new THREE.Vector3(); + this.anchor = new THREE.Vector3(); + this.mass = 1; + this.r = 0; + this.g = 0; + this.b = 0; + this.a = 1; + this.time = 0; + this.is_active = false; + }; + + Mover.prototype = { + init: function(vector) { + this.position = vector.clone(); + this.velocity = vector.clone(); + this.anchor = vector.clone(); + this.acceleration.set(0, 0, 0); + this.a = 1; + this.time = 0; + }, + updatePosition: function() { + this.position.copy(this.velocity); + }, + updateVelocity: function() { + this.acceleration.divideScalar(this.mass); + this.velocity.add(this.acceleration); + // if (this.velocity.distanceTo(this.position) >= 1) { + // this.direct(this.velocity); + // } + }, + applyForce: function(vector) { + this.acceleration.add(vector); + }, + applyFriction: function() { + var friction = friction(this.acceleration, 0.1); + this.applyForce(friction); + }, + applyDragForce: function(value) { + var drag = drag(this.acceleration, value); + this.applyForce(drag); + }, + hook: function(rest_length, k) { + var force = hook(this.velocity, this.anchor, rest_length, k); + this.applyForce(force); + }, + activate: function() { + this.is_active = true; + }, + inactivate: function() { + this.is_active = false; + } + }; + + + var Points = function(pos) { + this.movers_num = 3000; + this.movers = []; + this.pos = pos; + this.geometry = null; + this.material = null; + this.obj = null; + this.texture = null; + this.antigravity = new THREE.Vector3(0, 0.1, 0); +}; + +Points.prototype = { + init: function(pos) { + this.createTexture(); + this.geometry = new THREE.Geometry(); + this.material = new THREE.PointsMaterial({ + color: 0xff6633, + size: 3, + transparent: true, + opacity: 0.5, + map: this.texture, + // depthTest: false, + depthWrite:false, + alphaTest: 0.1, + blending: THREE.AdditiveBlending, + }); + for (var i = 0; i < this.movers_num; i++) { + var mover = new Mover(); + + mover.init(new THREE.Vector3((10*Math.random()+pos.x),pos.y, (10*Math.random()+pos.z))); + this.movers.push(mover); + this.geometry.vertices.push(mover.position); + } + this.obj = new THREE.Points(this.geometry, this.material); + this.obj.renderOrder = 1; + }, + update: function() { + var points_vertices = []; + + for (var i = 0; i < this.movers.length; i++) { + var mover = this.movers[i]; + if (mover.is_active) { + mover.applyForce(this.antigravity); + mover.updateVelocity(); + mover.updatePosition(); + if (mover.position.y > (this.pos.y+5)) { + mover.inactivate(); + } + } + points_vertices.push(mover.position); + } + this.obj.geometry.vertices = points_vertices; + this.obj.geometry.verticesNeedUpdate = true; + }, + activateMover: function() { + var count = 0; + let pos = this.pos; + for (var i = 0; i < this.movers.length; i++) { + var mover = this.movers[i]; + + if (mover.is_active) continue; + var rad1 = getRadian(Math.log(getRandomInt(200, 256)) / Math.log(256) * 270); + var rad2 = getRadian(getRandomInt(0, 360)); + var force = getSpherical(rad1, rad2, 1); + mover.activate(); + mover.init(new THREE.Vector3((10*Math.random()+pos.x), pos.y+5, (10*Math.random()+pos.z))); + mover.applyForce(force); + + count++; + if (count >= 10) break; + } + }, + createTexture: function() { + var canvas = document.createElement('canvas'); + var ctx = canvas.getContext('2d'); + var grad = null; + + canvas.width = 200; + canvas.height = 200; + grad = ctx.createRadialGradient(100, 100, 20, 100, 100, 100); + grad.addColorStop(0.2, 'rgba(255, 255, 255, 1)'); + grad.addColorStop(0.5, 'rgba(255, 255, 255, 0.3)'); + grad.addColorStop(1.0, 'rgba(255, 255, 255, 0)'); + ctx.fillStyle = grad; + ctx.arc(100, 100, 100, 0, Math.PI / 180, true); + ctx.fill(); + this.texture = new THREE.Texture(canvas); + this.texture.minFilter = THREE.NearestFilter; + this.texture.needsUpdate = true; + } + }; + + var HemiLight = function() { + this.rad1 = getRadian(60); + this.rad2 = getRadian(30); + this.range = 1000; + this.hex1 = 0xffffff; + this.hex2 = 0x333333; + this.intensity = 1; + this.obj; + }; + + HemiLight.prototype = { + init: function(hex1, hex2) { + if (hex1) this.hex1 = hex1; + if (hex2) this.hex2 = hex2; + this.obj = new THREE.HemisphereLight(this.hex1, this.hex2, this.intensity); + this.setPosition(); + }, + setPosition: function() { + var points = getSpherical(this.rad1, this.rad2, this.range); + this.obj.position.copy(points); + } + }; + + function getRandomInt(min, max) { + return Math.floor(Math.random() * (max - min)) + min; + } + function getDegree(radian) { + return radian / Math.PI * 180; + } + function getRadian(degrees) { + return degrees * Math.PI / 180; + } + function getSpherical(rad1, rad2, r) { + var x = Math.cos(rad1) * Math.cos(rad2) * r; + var z = Math.cos(rad1) * Math.sin(rad2) * r; + var y = Math.sin(rad1) * r; + return new THREE.Vector3(x, y, z); + } + + + function friction(acceleration, mu, normal, mass) { + var force = acceleration.clone(); + if (!normal) normal = 1; + if (!mass) mass = 1; + force.multiplyScalar(-1); + force.normalize(); + force.multiplyScalar(mu); + return force; + } + + function drag(acceleration, value) { + var force = acceleration.clone(); + force.multiplyScalar(-1); + force.normalize(); + force.multiplyScalar(acceleration.length() * value); + return force; + } + + function hook(velocity, anchor, rest_length, k) { + var force = velocity.clone().sub(anchor); + var distance = force.length() - rest_length; + force.normalize(); + force.multiplyScalar(-1 * k * distance); + return force; + } + +} diff --git a/src/jlmap3d/lesson3dedit/assetmodelmanager/assetmodelmanager.js b/src/jlmap3d/lesson3dedit/assetmodelmanager/assetmodelmanager.js index 3250ebb3c..6feedfdea 100644 --- a/src/jlmap3d/lesson3dedit/assetmodelmanager/assetmodelmanager.js +++ b/src/jlmap3d/lesson3dedit/assetmodelmanager/assetmodelmanager.js @@ -102,7 +102,7 @@ export function AssetModelManager(editor,scene) { scope.staticAsset['occ'] = { modelId:'occ', packageName:"occ大厅", - url:"/MODEL/2021-08-23/203-65635.FBX", + url:"/MODEL/2021-09-02/210-32471.FBX", mesh:"", assetType:'onlineasset', isUse:true, diff --git a/src/jlmap3d/lesson3dedit/lesson3deditor.js b/src/jlmap3d/lesson3dedit/lesson3deditor.js index bbd0f81de..43769d1bc 100644 --- a/src/jlmap3d/lesson3dedit/lesson3deditor.js +++ b/src/jlmap3d/lesson3dedit/lesson3deditor.js @@ -10,7 +10,9 @@ import { OrbitControls } from '@/jlmap3d/main/control/OrbitControls'; //骨骼动画模型辅助工具 import { SkeletonUtils } from '@/jlmap3d/main/utils/SkeletonUtils.js'; -import { AssetModelManager } from '@/jlmap3d/lesson3dedit/assetmodelmanager/assetmodelmanager.js'; +import { AssetModelManager } from '@/jlmap3d/lesson3dedit/manager/assetmodelmanager.js'; + +import { AccidentManager } from '@/jlmap3d/lesson3dedit/manager/accidentmanager.js'; import { TransformControls } from '@/jlmap3d/lesson3dedit/controls/TransformControls'; @@ -75,6 +77,8 @@ export function Lesson3dEditor(dom,lessonData) { // scene.add(transcontrol); + let accidentManager = new AccidentManager(scene); + accidentManager.initAccident(); let assetModelManager = new AssetModelManager(scope,scene); @@ -85,6 +89,11 @@ export function Lesson3dEditor(dom,lessonData) { }else{ assetModelManager.lessonAssetsLoader(); } + + if(lessonData.accidentList){ + accidentManager.loadAccidentList(lessonData.accidentList) + } + }else{ assetModelManager.lessonAssetsLoader(); } @@ -98,6 +107,7 @@ export function Lesson3dEditor(dom,lessonData) { render(); scope.controls.update(); // delta = clock.getDelta(); + accidentManager.update(); requestAnimationFrame(animate); } @@ -112,8 +122,11 @@ export function Lesson3dEditor(dom,lessonData) { this.changeIndex = function(nowIndex){ lessonIndex = nowIndex; + console.log(lessonData.lessonProgress[lessonIndex]); scope.nowSceneType = lessonData.lessonProgress[lessonIndex].progressScene; assetModelManager.changeSceneGroup(scope.nowSceneType); + + accidentManager.changeSceneGroup(scope.nowSceneType); // if(lessonData.lessonProgress[lessonIndex].roleName == nowRole){ // controlManager.initControlMode(lessonIndex); // controlManager.initRoleMode(true,nowRole); @@ -131,6 +144,7 @@ export function Lesson3dEditor(dom,lessonData) { console.log(value2); if(type == "changeScene"){ assetModelManager.changeSceneGroup(value1); + accidentManager.changeSceneGroup(value1); scope.nowSceneType = value1; } } @@ -155,10 +169,32 @@ export function Lesson3dEditor(dom,lessonData) { } + this.createAccident = function(accidentData,mousePos){ + var mouse = new THREE.Vector2(); + + var raycaster = new THREE.Raycaster(); + + mouse.x = ( mousePos.x / window.innerWidth ) * 2 - 1; + + mouse.y = - ( mousePos.y / dom.offsetHeight ) * 2 + 1; + + raycaster.setFromCamera(mouse,scope.camerass) // 也可以给构造函数传参的形式写 + + var intersects = raycaster.intersectObjects( scene.children,true ); + + if(intersects.length>0){ + accidentManager.createNewAccident(accidentData,intersects[0].point,scope.nowSceneType); + } + } + this.saveAssetModel = function(){ return assetModelManager.saveModelList(); } + this.saveAccidentModel = function(){ + return accidentManager.saveDataList(); + } + this.attachModel = function(selectModel){ transcontrol.attach(selectModel); } @@ -167,4 +203,8 @@ export function Lesson3dEditor(dom,lessonData) { transcontrol.detach(); assetModelManager.deleteAsset(selectModel,scope.nowSceneType); } + this.deleteAccident = function(selectAccident){ + accidentManager.deleteAccident(selectAccident,scope.nowSceneType); + } + } diff --git a/src/jlmap3d/lesson3dedit/manager/accidentmanager.js b/src/jlmap3d/lesson3dedit/manager/accidentmanager.js new file mode 100644 index 000000000..f435b52f6 --- /dev/null +++ b/src/jlmap3d/lesson3dedit/manager/accidentmanager.js @@ -0,0 +1,146 @@ +// import { AssetModelManager } from '@/jlmap3d/lesson3dedit/manager/assetmodelmanager.js'; +import { Fire } from '@/jlmap3d/lesson3dedit/accident/fire.js'; + +export function AccidentManager(scene) { + let scope = this; + + this.accidentList = []; + + this.accidentGroup = new THREE.Group(); + + //场景中可触发事件模型 + this.accidentList = []; + + scope.accidentList["standstation"] = []; + scope.accidentList["stopstation"] = []; + + scope.accidentList["occ"] = []; + + scope.accidentList["device"] = []; + scope.accidentList["xl"] = []; + scope.accidentList["dc"] = []; + + let groupList = []; + groupList["standstation"] = new THREE.Group(); + groupList["stopstation"] = new THREE.Group(); + groupList["occ"] = new THREE.Group(); + groupList["device"] = new THREE.Group(); + groupList["xl"] = new THREE.Group(); + groupList["dc"] = new THREE.Group(); + + let updateSceneType = "standstation"; + + scene.add(scope.accidentGroup); + + this.initAccident = function(nowSceneType){ + let accidentData = [ + { + id:'1', + name:"火灾", + type:"fire" + } + ]; + jl3dUpdateAccidentData(accidentData); + } + + this.saveDataList = function(){ + let saveList = []; + for(let g in scope.accidentList){ + for(let i=0;i0){ + scope.accidentGroup.remove(scope.accidentGroup.children[0]); + } + scope.accidentGroup.add(groupList[nowSceneType]); + jl3dUpdateAccidentlist(scope.accidentList[nowSceneType]); + updateSceneType = nowSceneType; + } + + this.createNewAccident = function(type,pos,nowSceneType){ + + var rand = Math.floor(Math.random () * 900) + 100; + + let newAccident = { + id:rand, + name:type, + label:type+rand, + type:type, + object:{}, + pos:pos, + sceneType:nowSceneType, + showType:"loadModel", + }; + if(type == "fire"){ + newAccident.object = new Fire(); + newAccident.object.createNew(groupList[nowSceneType],pos); + } + scope.accidentList[nowSceneType].push(newAccident); + jl3dUpdateAccidentlist(scope.accidentList[nowSceneType]); + } + + this.deleteAccident = function(selectAccident,nowSceneType){ + groupList[nowSceneType].remove(selectAccident.object.points.obj); + console.log(selectAccident); + for(let i=0;i { + + initTriggerList(); + if(lessonData){ + let modelList = lessonData.modelList; + for(let i=0;i { + //console.log(error); + }); + + }); + } + + this.deleteAsset = function(selectModel,nowSceneType){ + scope.otherModel.remove(selectModel); + for(let i=0;i + // + // + // + // + //FT 扶梯 + //FTAN 扶梯按钮(急停) + //FTD 扶梯灯 + //FTKG 扶梯开关(钥匙孔) + //FTTJ 扶梯台阶 + function initTriggerList(){ + scope.staticAsset['station'].mesh.getObjectByName("FTAN").showType = "default"; + scope.staticAsset['station'].mesh.getObjectByName("FTAN").label = "扶梯急停按钮"; + scope.lessonTriggerList["standstation"].push(scope.staticAsset['station'].mesh.getObjectByName("FTAN")); + + scope.staticAsset['station'].mesh.getObjectByName("FTKG").showType = "default"; + scope.staticAsset['station'].mesh.getObjectByName("FTKG").label = "扶梯钥匙孔"; + scope.lessonTriggerList["standstation"].push(scope.staticAsset['station'].mesh.getObjectByName("FTKG")); + + scope.staticAsset['station'].mesh.getObjectByName("spbmkg").showType = "default"; + scope.staticAsset['station'].mesh.getObjectByName("spbmkg").label = "屏蔽门开关"; + scope.lessonTriggerList["standstation"].push(scope.staticAsset['station'].mesh.getObjectByName("spbmkg")); + + + + // console.log(scope.loadAsset['default1'].mesh.getObjectByName("FTKG")); + } + + //动态加载资源 + this.lessonAssetsNewLoader = function(assetData,pos,nowSceneType){ + let isLoaded = false; + var rand = Math.floor(Math.random () * 900) + 100; + if(scope.loadAsset[assetData.id]){ + let newModelTrigger = scope.loadAsset[assetData.id].mesh.clone(true); + newModelTrigger.modelId = assetData.id; + newModelTrigger.showType = "loadModel"; + newModelTrigger.label = assetData.packageName +rand; + newModelTrigger.position.copy(pos); + newModelTrigger.sceneType = nowSceneType; + + scope.lessonTriggerList[nowSceneType].push(newModelTrigger); + groupList[nowSceneType].add(newModelTrigger); + + updateTriggerList(scope.lessonTriggerList[nowSceneType]); + }else{ + scope.loadAsset[assetData.id] = { + modelId:assetData.id, + packageName:assetData.packageName +rand, + url:assetData.url, + mesh:"", + assetType:'loadModel', + isUse:true, + resourceType:"三维课程", + sceneType:nowSceneType, + }; + console.log("new"); + + fbxpromise(scope.loadAsset[assetData.id]).then(function(object){ + + console.log(scope.loadAsset[assetData.id].mesh); + + let newModelTrigger = scope.loadAsset[assetData.id].mesh.clone(true); + newModelTrigger.showType = "loadModel"; + newModelTrigger.modelId = assetData.id; + newModelTrigger.label = assetData.packageName+rand; + newModelTrigger.position.copy(pos); + newModelTrigger.sceneType = nowSceneType; + + scope.lessonTriggerList[nowSceneType].push(newModelTrigger); + groupList[nowSceneType].add(newModelTrigger); + + updateTriggerList(scope.lessonTriggerList[nowSceneType]); + // resolve("loadednew"); + }); + } + } + + + //fbx模型加载 + function fbxpromise(asset){ + return new Promise(function(resolve, reject){ + var loader = new THREE.FBXLoader(); + // console.log(asset); + // console.log(asset.url); + if(asset.assetType == "static"){ + loader.load( asset.url, function ( object ) { + if(asset.sceneType){ + object.sceneType = asset.sceneType; + } + asset.mesh = object; + groupList[asset.sceneType].add(object); + // scope.otherModel.add(object); + resolve(); + } ); + }else if(asset.assetType == "onlineasset"){ + loader.load( BASE_ASSET_API+asset.url, function ( object ) { + if(asset.sceneType){ + object.sceneType = asset.sceneType; + } + asset.mesh = object; + groupList[asset.sceneType].add(object); + + resolve(); + } ); + }else{ + loader.load( BASE_ASSET_API+asset.url, function ( object ) { + if(asset.sceneType){ + object.sceneType = asset.sceneType; + } + asset.mesh = object; + if(asset.assetType == "default"){ + + console.log(object); + // scene.add(object); + }else if(asset.assetType == 'loadModel'){ + + } + + resolve(); + } ); + } + + + }); + } + +} diff --git a/src/jlmap3d/lesson3dedit/model/lessondata.js b/src/jlmap3d/lesson3dedit/model/lessondata.js index f5eedf5cc..b7cbe796d 100644 --- a/src/jlmap3d/lesson3dedit/model/lessondata.js +++ b/src/jlmap3d/lesson3dedit/model/lessondata.js @@ -9,6 +9,7 @@ export function LessonData() { this.lessonData = { //资源列表 assetList:[], + accidentList:[], setup:{ examMode:"", checkedRole:"", @@ -32,7 +33,7 @@ export function LessonData() { roleName:"", roleUse:true, score:0, - progressScene:"", + progressScene:"standstation", nextCode:"", nextNode:"", triggerType:"", diff --git a/src/jlmap3d/main/loaders/DriverLoadNew.js b/src/jlmap3d/main/loaders/DriverLoadNew.js index 153774b8e..70f85ace4 100644 --- a/src/jlmap3d/main/loaders/DriverLoadNew.js +++ b/src/jlmap3d/main/loaders/DriverLoadNew.js @@ -102,7 +102,7 @@ export function DriverLoadNew(data,scope,netdata,mapdata,sectionlist,signallist, .then(function(data){ //console.log(data); //console.log(assetloader); - console.log(stationstandlist); + // console.log(stationstandlist); return tdt.initTdt(stationstandlist.list,mapdata.sectionList,rails.sectionrail,sceneload); }) .then(function(data){ diff --git a/src/jlmap3d/main/newmodel/TdtList.js b/src/jlmap3d/main/newmodel/TdtList.js index c2d0d86da..52d94a0f4 100644 --- a/src/jlmap3d/main/newmodel/TdtList.js +++ b/src/jlmap3d/main/newmodel/TdtList.js @@ -36,11 +36,11 @@ export function TdtList() { let pos = stationData[k].mesh.position; if(stationData[k].stands[i].right == true){ newmesh.rotation.y = -Math.PI/2; - newmesh.position.set(pos.x+75,0,pos.z+14.8); + newmesh.position.set(pos.x+75,0,pos.z+12.8); }else{ newmesh.rotation.y = Math.PI/2; - newmesh.position.set(pos.x-75,0,pos.z-14.8); + newmesh.position.set(pos.x-75,0,pos.z-12.8); } diff --git a/src/jmapNew/map.js b/src/jmapNew/map.js index 7184e2d03..ad9dba79e 100644 --- a/src/jmapNew/map.js +++ b/src/jmapNew/map.js @@ -37,6 +37,9 @@ class Jlmap { // 设备数据 this.mapDevice = {}; + // 大屏配置 + this.splitList = []; + // 默认状态 this.defaultStateDict = this.loadDefaultState(); @@ -143,6 +146,7 @@ class Jlmap { setOptions(opts) { const options = this.pullBack(opts); if (this.screenFlag) { + this.$options.update(options); this.$painter.updateScreen(options); } else { this.$options.update(options); @@ -216,8 +220,6 @@ class Jlmap { setUpdateScreen(opts) { this.setRecover({ scaleRate: 1, offsetX: 0, offsetY: 0 }); this.screenFlag = true; - const screenList = []; - const rectList = []; let rect = ''; for (const i in this.mapDevice) { const element = this.mapDevice[i]; @@ -233,31 +235,56 @@ class Jlmap { opts.offsetList = []; } const screenSplit = opts.list.length ? opts.list : Vue.prototype.$theme.loadPropConvert(this.lineCode).screenSplit; - const screenDifference = Vue.prototype.$theme.loadPropConvert(this.lineCode).screenDifference || 160; - const splitList = JSON.parse(JSON.stringify(screenSplit)); + this.splitList = JSON.parse(JSON.stringify(screenSplit)); const num = screenSplit.length + 1; - const offsetY = (opts.height - 100) / num; // 高度差 const maxWidth = rect.width; - splitList.push(maxWidth); + this.splitList.push(maxWidth); const scaleX = Math.floor((((opts.width - 200) * num) / rect.width) * 100) / 100; const scaleY = Math.floor(((opts.height - 100) / (rect.height * num)) * 100) / 100; - const scale = Math.min(scaleX, scaleY); + this.screenScale = Math.min(scaleX, scaleY); - for (let i = 0; i < splitList.length; i++) { + this.optsWidth = opts.width; + this.optsHeight = opts.height; + this.optsOffsetList = opts.offsetList; + + const scaleBili = this.screenScale; + + this.$options.scaleRate = this.screenScale || 1; + this.$options.scaleIndex = 0; + this.$options.offsetX = 0; + this.$options.offsetY = 0; + // 更新视图大小 + // this.$painter.updateTransform({ scaleRate: this.$options.scaleRate, offsetX: this.$options.offsetX, offsetY: this.$options.offsetY }); + + const {screenList, rectList} = this.calculateScreenPosition(scaleBili); + this.$painter.updateTransform1(screenList, rectList); + } + + calculateScreenPosition(scaleBili) { + const screenList = []; + const rectList = []; + const screenDifference = Vue.prototype.$theme.loadPropConvert(this.lineCode).screenDifference || 160; + const bili = scaleBili / this.screenScale; + const offsetY = (this.optsHeight - 100) / this.splitList.length; // 高度差 + + for (let i = 0; i < this.splitList.length; i++) { let offsetX = ''; if (i == 0) { - offsetX = -(opts.width - splitList[0] * scale) / 2; + offsetX = -(this.optsWidth - this.splitList[0] * scaleBili) / 2; } else { - const dx = (opts.width - (splitList[i] - splitList[i - 1]) * scale) / 2; // 居中计算偏移值 - offsetX = splitList[i - 1] * scale - dx; + const dx = (this.optsWidth - (this.splitList[i] - this.splitList[i - 1]) * scaleBili) / 2; // 居中计算偏移值 + offsetX = this.splitList[i - 1] * scaleBili - dx; } - const offset = opts.offsetList[i] || 0; - const param = { scaleRateX: scale, scaleRateY: scale, offsetX: offsetX, offsetY: -screenDifference - (offsetY * i) - offset }; + const offset = this.optsOffsetList[i] || 0; + const param = { scaleRateX: scaleBili, scaleRateY: scaleBili, offsetX: offsetX, offsetY: (-screenDifference - (offsetY * i) - offset) * bili }; screenList.push(param); - const rect = {x: 0, y: 0, width: Number(splitList[i]) + 5, height: opts.height}; + const rect = {x: 0, y: 0, width: Number(this.splitList[i]) + 5, height: this.optsHeight}; rectList.push(rect); } - this.$painter.updateTransform1(screenList, rectList); + return { + screenList, + rectList + }; } setLevelVisible(list) { diff --git a/src/jmapNew/painter.js b/src/jmapNew/painter.js index 970c8a776..d8f8f4765 100644 --- a/src/jmapNew/painter.js +++ b/src/jmapNew/painter.js @@ -225,6 +225,11 @@ class Painter { this.screenFlag = true; this.$transformHandleScreen.updateTransform(list, opts); } + + updateScreenZoom(bili) { + return this.$jmap.calculateScreenPosition(bili); + } + /** * 更新zrender尺寸 * @param {*} opt diff --git a/src/jmapNew/transformHandleScreen.js b/src/jmapNew/transformHandleScreen.js index f85a545a3..7de040eda 100644 --- a/src/jmapNew/transformHandleScreen.js +++ b/src/jmapNew/transformHandleScreen.js @@ -1,9 +1,24 @@ import {createTransform1, createBoundingRect} from './utils/parser'; + class TransformHandle { constructor(painter) { this.$painter = painter; + this.scale = ''; + this.scaleIndex = 0; + this.scaleList = [ + 0.2, 0.4, 0.6, 0.8, 0.9, + 1, 1.2, 1.4, 1.6, 1.8, + 2, 2.2, 2.4, 2.6, 2.8, + 3, 3.2, 3.4, 3.6, 3.8, + 4, 4.2, 4.4, 4.6, 4.8, + 5, 5.2, 5.4, 5.6, 5.8, + 6, 6.2, 6.4, 6.6, 6.8, + 7, 7.2, 7.4, 7.6, 7.8, + 8 + ]; + this.parentLevel = painter.getParentLevel(); this.rect = { x: 0, y: 0, width: 0, height: 0 }; @@ -79,6 +94,7 @@ class TransformHandle { // 更新偏移量 updateTransform(list, rectList) { this.rectList = rectList; + // this.scale = list[0].scaleRateX; this.transform = []; list.forEach(item => { this.transform.push(createTransform1(item)); @@ -87,10 +103,24 @@ class TransformHandle { this.transformAll(); } updataOffset(opt) { - this.transform.forEach(item => { - item[4] = item[4] + opt.dx; - item[5] = item[5] + opt.dy; - }); + if (opt.scale) { + if (opt.scale <= 0) { + this.scaleIndex = this.scaleIndex <= 0 ? 0 : this.scaleIndex - 1; + } else { + this.scaleIndex = this.scaleIndex >= 40 ? 40 : this.scaleIndex + 1; + } + const {screenList, rectList} = this.$painter.updateScreenZoom(this.scaleList[this.scaleIndex]); + this.rectList = rectList; + this.transform = []; + screenList.forEach(item => { + this.transform.push(createTransform1(item)); + }); + } else { + this.transform.forEach(item => { + item[4] = item[4] + opt.dx; + item[5] = item[5] + opt.dy; + }); + } this.transformAll1(); } updataOffsetNum(opts) { diff --git a/src/utils/baseUrl.js b/src/utils/baseUrl.js index a01be0900..6752e47ae 100644 --- a/src/utils/baseUrl.js +++ b/src/utils/baseUrl.js @@ -2,10 +2,10 @@ export function getBaseUrl() { let BASE_API; if (process.env.NODE_ENV === 'development') { // BASE_API = 'https://joylink.club/jlcloud'; - // BASE_API = 'https://test.joylink.club/jlcloud'; + BASE_API = 'https://test.joylink.club/jlcloud'; // BASE_API = 'http://192.168.8.107:9000'; // 袁琪 // BASE_API = 'http://192.168.2.175:9000'; // 旭强 有线 - BASE_API = 'http://192.168.8.167:9000'; // 旭强 无线 + // BASE_API = 'http://192.168.8.167:9000'; // 旭强 无线 // BASE_API = 'http://192.168.2.183:9000'; // 张赛 // BASE_API = 'http://192.168.8.140:9000'; // 杜康 // BASE_API = 'http://b29z135112.zicp.vip'; diff --git a/src/views/designPlatform/bigScreen.vue b/src/views/designPlatform/bigScreen.vue index 2257960e9..7af525824 100644 --- a/src/views/designPlatform/bigScreen.vue +++ b/src/views/designPlatform/bigScreen.vue @@ -62,7 +62,7 @@ export default { }, '$store.state.map.mapViewLoadedCount':function() { this.$store.dispatch('map/setTrainWindowShow', false); - this.$jlmap.off('zoom'); + // this.$jlmap.off('zoom'); this.handleUpdateScreen(); if (this.$route.query.group && !this.$route.path.includes('displayIscs')) { this.subscribe(); diff --git a/src/views/iscs/iscsDraw/icscComponents/picture.vue b/src/views/iscs/iscsDraw/icscComponents/picture.vue index 08b6f6402..e421c3dcd 100644 --- a/src/views/iscs/iscsDraw/icscComponents/picture.vue +++ b/src/views/iscs/iscsDraw/icscComponents/picture.vue @@ -101,13 +101,13 @@ export default { { name: '抵挡图', value: 'iscsDangwei' }, { name: '地变图', value: 'iscsDibian' }, { name: 'PT1', value: 'iscsPt1' }, - { name: '受检左侧箭头', value: 'checkArrowLeft' }, - { name: '受检右侧箭头', value: 'checkArrowRight' }, - { name: '受检两侧箭头', value: 'checkArrowDouble' }, - { name: '受检流量累计', value: 'checkFlowCumulative' }, - { name: '受检正常', value: 'checkNormal' }, - { name: '受检售票', value: 'checkSell' }, - { name: '受检售票2', value: 'checkSell2' }, + { name: '售检左侧箭头', value: 'checkArrowLeft' }, + { name: '售检右侧箭头', value: 'checkArrowRight' }, + { name: '售检两侧箭头', value: 'checkArrowDouble' }, + { name: '售检流量累计', value: 'checkFlowCumulative' }, + { name: '售检正常', value: 'checkNormal' }, + { name: '售检售票', value: 'checkSell' }, + { name: '售检售票2', value: 'checkSell2' }, { name: '站厅背景', value: 'bgShowRoom' }, { name: '站台背景', value: 'bgStand' }, { name: '站台A端背景', value: 'bgFasPlatformA' }, diff --git a/src/views/jlmap3d/drive/drivecontrol/toprightpane.vue b/src/views/jlmap3d/drive/drivecontrol/toprightpane.vue index be7595f7f..894240a98 100644 --- a/src/views/jlmap3d/drive/drivecontrol/toprightpane.vue +++ b/src/views/jlmap3d/drive/drivecontrol/toprightpane.vue @@ -103,14 +103,6 @@
{{ $t('jlmap3d.removalATP') }}
-
{{ $t('jlmap3d.openRightDoor') }}
@@ -123,14 +115,23 @@
{{ $t('jlmap3d.emergencyBraking') }}
- + @@ -140,7 +141,17 @@