Merge remote-tracking branch 'origin/test'
This commit is contained in:
commit
2454ed857f
@ -6,6 +6,9 @@ export function ZzwwTrain() {
|
||||
tittle:"防溜防护检查",
|
||||
text:"",
|
||||
devices:[
|
||||
{
|
||||
|
||||
},
|
||||
{
|
||||
id:"ZLQ",
|
||||
name:"止轮器",
|
||||
|
707
src/jlmap3d/otherproject/zzww/manager/controlmanager.js
Normal file
707
src/jlmap3d/otherproject/zzww/manager/controlmanager.js
Normal file
@ -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<eventBoxs.length;i++){
|
||||
hitBox.setFromObject(attachBox);
|
||||
eventBoxs[i].setFromObject(eventBoxs[i].mesh);
|
||||
// console.log(eventBoxs[i]);
|
||||
if(hitBox.intersectsBox(eventBoxs[i])){
|
||||
// console.log("相交");
|
||||
// console.log(eventBoxs[i].action);
|
||||
|
||||
if(eventBoxs[i].action.actionMode == "remove"){
|
||||
actionEvent("remove",eventBoxs[i].action,eventBoxs[i].mesh);
|
||||
}
|
||||
|
||||
if(eventBoxs[i].action.actionMode == "jump"){
|
||||
jumpEvent("action",eventBoxs[i].action);
|
||||
actionEvent("remove",eventBoxs[i].action,eventBoxs[i].mesh);
|
||||
|
||||
}
|
||||
// console.log("slice");
|
||||
eventBoxs.splice(i,1);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
scope.eventHitMod = false;
|
||||
}
|
||||
// attachBox.position.copy(fpsCamera.position);
|
||||
// hitBox.setFromObject(attachBox);
|
||||
// eventTestBox.setFromObject(eventBox);
|
||||
//
|
||||
// if(hitBox.intersectsBox(eventTestBox)){
|
||||
// //两个物体相交了
|
||||
// console.log("相交");
|
||||
// scope.eventHitMode = false;
|
||||
// }
|
||||
// else{
|
||||
// console.log("不相交");
|
||||
// }
|
||||
}
|
||||
|
||||
render(fpsCamera);
|
||||
};
|
||||
|
||||
|
||||
|
||||
this.init = function(actions,assetModelManager,trainDeviceData){
|
||||
// worldOctree.fromGraphNode( standstationPZ );
|
||||
actionList = actions;
|
||||
modelManager = assetModelManager;
|
||||
if(trainDeviceData){
|
||||
trainDeviceMode = true;
|
||||
trainDeviceList = trainDeviceData;
|
||||
}
|
||||
}
|
||||
|
||||
this.updatePos = function(pos){
|
||||
playerCollider.set(
|
||||
new THREE.Vector3(
|
||||
pos.x,
|
||||
pos.y,
|
||||
pos.z),
|
||||
new THREE.Vector3(
|
||||
pos.x,
|
||||
pos.y+1.5,
|
||||
pos.z ), 1);
|
||||
}
|
||||
|
||||
document.addEventListener( 'keydown', ( event ) => {
|
||||
|
||||
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;i<raycasterBoxs.length;i++){
|
||||
var intersects = raycaster.intersectObject( raycasterBoxs[i].mesh,true);
|
||||
|
||||
if(intersects.length>0){
|
||||
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;i<actions.length;i++){
|
||||
|
||||
if(actions[i].actionType == "auto"){
|
||||
|
||||
console.log(actions[i]);
|
||||
if(actions[i].actionMode == "play"){
|
||||
for(let j=0;j<eventTrigger.length;j++){
|
||||
if(eventTrigger[j].label == actions[i].actionModel){
|
||||
|
||||
if(actionList[eventTrigger[j].actionName].status == "01"){
|
||||
actionList[eventTrigger[j].actionName].status = "02";
|
||||
|
||||
actionList[eventTrigger[j].actionName].action.reset();
|
||||
actionList[eventTrigger[j].actionName].action.timeScale = 1;
|
||||
actionList[eventTrigger[j].actionName].action.clampWhenFinished = true;
|
||||
actionList[eventTrigger[j].actionName].action.setLoop(THREE.LoopOnce);
|
||||
actionList[eventTrigger[j].actionName].action.play();
|
||||
|
||||
}else{
|
||||
actionList[eventTrigger[j].actionName].status = "01";
|
||||
|
||||
actionList[eventTrigger[j].actionName].action.reset();
|
||||
actionList[eventTrigger[j].actionName].action.timeScale = -1;
|
||||
actionList[eventTrigger[j].actionName].action.clampWhenFinished = true;
|
||||
actionList[eventTrigger[j].actionName].action.setLoop(THREE.LoopOnce);
|
||||
actionList[eventTrigger[j].actionName].action.play();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(actions[i].actionMode == "show"){
|
||||
for(let j=0;j<eventTrigger.length;j++){
|
||||
if(eventTrigger[j].label == actions[i].actionModel){
|
||||
actionEvent("show",actions[i],eventTrigger[j]);
|
||||
j = eventTrigger.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(actions[i].actionMode == "remove"){
|
||||
for(let j=0;j<eventTrigger.length;j++){
|
||||
if(eventTrigger[j].label == actions[i].actionModel){
|
||||
actionEvent("remove",actions[i],eventTrigger[j]);
|
||||
j = eventTrigger.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(roleMode){
|
||||
if(actions[i].actionType == "contact"){
|
||||
if(eventTrigger){
|
||||
|
||||
for(let j=0;j<eventTrigger.length;j++){
|
||||
if(eventTrigger[j].label == actions[i].actionModel){
|
||||
let eventTestBox = new THREE.Box3(new THREE.Vector3(), new THREE.Vector3());
|
||||
eventTestBox.setFromObject(eventTrigger[j]);
|
||||
eventTestBox.mesh = eventTrigger[j];
|
||||
eventTestBox.action = actions[i];
|
||||
eventBoxs.push(eventTestBox);
|
||||
actionEvent("changeIndex",eventBoxs[i].action,eventTestBox.mesh);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(actions[i].actionType == "switch"){
|
||||
for(let j=0;j<eventTrigger.length;j++){
|
||||
if(eventTrigger[j].label == actions[i].actionModel){
|
||||
|
||||
let eventRaycaster = {
|
||||
mesh:eventTrigger[j],
|
||||
action:actionList[eventTrigger[j].actionName],
|
||||
type:actions[i].actionType,
|
||||
actionMode:actions[i].actionMode,
|
||||
jumpNode:actions[i].jumpNode,
|
||||
};
|
||||
raycasterBoxs.push(eventRaycaster);
|
||||
|
||||
actionEvent("changeIndex",actions[i],eventTrigger[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(actions[i].actionType == "urgeSwitch"){
|
||||
for(let j=0;j<eventTrigger.length;j++){
|
||||
if(eventTrigger[j].label == actions[i].actionModel){
|
||||
let eventRaycaster = {
|
||||
mesh:eventTrigger[j],
|
||||
action:actionList[eventTrigger[j].actionName],
|
||||
type:actions[i].actionType,
|
||||
};
|
||||
raycasterBoxs.push(eventRaycaster);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}else if(actions.length>0){
|
||||
// console.log(actions);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
213
src/jlmap3d/otherproject/zzww/zzww.js
Normal file
213
src/jlmap3d/otherproject/zzww/zzww.js
Normal file
@ -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;i<lessonData.lessonProgress.length;i++){
|
||||
|
||||
if(nowRole == lessonData.lessonProgress[i].roleName){
|
||||
examList.push(
|
||||
{
|
||||
index:i,
|
||||
score:10,
|
||||
isTrue:false,
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
examData = {
|
||||
allScore:examList.length*10,
|
||||
lastScore:0,
|
||||
allStep:examList.length,
|
||||
trueStep:[],
|
||||
falseStep:[],
|
||||
nowStep:0,
|
||||
time:0,
|
||||
};
|
||||
controlManager.initExam(examList,examData);
|
||||
// updataExamStatus(examData);
|
||||
// if(lessonData.lessonProgress[lessonIndex].action.length>0){
|
||||
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<examList.length;i++){
|
||||
if(examList[i].index == newIndex){
|
||||
examData.trueStep.push(newIndexData);
|
||||
examData.lastScore += 10;
|
||||
examData.nowStep += 1;
|
||||
updataExamStatus(examData);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//循环渲染函数
|
||||
function animate() {
|
||||
|
||||
if(controlManager.controlMode == "free"){
|
||||
controlManager.updateOrbitControl();
|
||||
}
|
||||
if(controlManager.controlMode == "fps"){
|
||||
controlManager.updateFpsControl();
|
||||
}
|
||||
if(controlManager.controlMode == "non"){
|
||||
controlManager.updateOrbitControl();
|
||||
}
|
||||
// fire.update();
|
||||
animateManager.updateAnimation();
|
||||
requestAnimationFrame(animate);
|
||||
|
||||
}
|
||||
|
||||
this.attachModel = function(selectModel){
|
||||
}
|
||||
}
|
@ -96,7 +96,7 @@ class Painter {
|
||||
const instance = device.instance;
|
||||
if (instance) {
|
||||
this.mapInstanceLevel[device._type].remove(instance);
|
||||
// device.instance = null;
|
||||
device.instance = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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');
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
|
@ -17,7 +17,7 @@ const Jlmap3dLesson3dEdit = () => 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');
|
||||
|
@ -319,7 +319,9 @@ export default {
|
||||
/** 换端 */
|
||||
CMD_TRAIN_TURN_DIRECTION: { value: 'Turn_Direction', label: '换端' },
|
||||
/** 选择调度模式 */
|
||||
CMD_TRAIN_REGULATION : { value:'Train_Regulation', label:'选择调度模式' }
|
||||
CMD_TRAIN_REGULATION : { value:'Train_Regulation', label:'选择调度模式' },
|
||||
/** 计算列车间隔 */
|
||||
CMD_TRAIN_CALCULATE_INTERVAL : {value: 'Train_Calculate_Interval', label: '计算列车间隔'}
|
||||
},
|
||||
TrainWindow: {
|
||||
/** 修改列车识别号 */
|
||||
|
@ -61,6 +61,10 @@ class CommandHandle {
|
||||
Stand_Cancel_Emergency_Close: {
|
||||
operate: 'Stand_Cancel_Emergency_Close',
|
||||
paramList: [{name: 'standCode'}]
|
||||
},
|
||||
Train_Calculate_Interval: {
|
||||
operate: 'Train_Calculate_Interval',
|
||||
paramList: [{name: 'trainNumber'}, {name: 'interval'}]
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -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);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -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.152:9000'; // 袁琪
|
||||
// BASE_API = 'http://192.168.8.172:9200'; // 旭强
|
||||
// BASE_API = 'http://192.168.8.109:9000'; // 张赛
|
||||
BASE_API = 'http://192.168.8.109:9000'; // 张赛
|
||||
// BASE_API = 'http://192.168.8.140:9000'; // 杜康
|
||||
// BASE_API = 'http://b29z135112.zicp.vip';
|
||||
// BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康
|
||||
|
@ -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(() => {
|
||||
});
|
||||
},
|
@ -56,18 +56,18 @@
|
||||
<el-radio v-model="atrMode" label="TIME_TABLE_REGULATION">时刻表调度</el-radio>
|
||||
</el-col>
|
||||
<el-col :span="6" style="height: 28px;line-height: 28px;">
|
||||
<el-radio v-model="intervalMode" :disabled="true">列车个数</el-radio>
|
||||
<el-radio v-model="intervalMode" :disabled="atrMode !== 'HEADWAY_REGULATION_FRONT'" label="trainNumber">列车个数</el-radio>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-input-number v-model="trainNumber" size="mini" :min="0" :max="999" :disabled="true" controls-position="right" label="列车个数" />
|
||||
<el-input-number v-model="trainNumber" size="mini" :min="0" :max="999" :disabled="intervalMode !== 'trainNumber'" controls-position="right" label="列车个数" />
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row style="padding: 5px;">
|
||||
<el-col :offset="12" :span="6" style="height: 28px;line-height: 28px;">
|
||||
<el-radio v-model="intervalMode" :disabled="true">间隔时间(秒)</el-radio>
|
||||
<el-radio v-model="intervalMode" :disabled="atrMode !== 'HEADWAY_REGULATION_FRONT'" label="trainInterval">间隔时间(秒)</el-radio>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-input-number v-model="trainInterval" size="mini" :disabled="true" :min="0" :max="999" controls-position="right" label="间隔时间" />
|
||||
<el-input-number v-model="trainInterval" size="mini" :disabled="intervalMode !== 'trainInterval'" :min="0" :max="999" controls-position="right" label="间隔时间" />
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row style="padding: 5px;">
|
||||
@ -75,7 +75,7 @@
|
||||
<el-radio v-model="atrMode" label="HEADWAY_REGULATION_FRONT">列车间隔调度-前调</el-radio>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-button :disabled="true" style="height: 28px;width: 260px;">计算</el-button>
|
||||
<el-button :disabled="!intervalMode" style="height: 28px;width: 260px;" @click="computeInterval">计算</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row style="padding: 5px;">
|
||||
@ -86,21 +86,21 @@
|
||||
<span>最小</span>
|
||||
</el-col>
|
||||
<el-col :span="5">
|
||||
<el-input v-model="input" :disabled="true" size="mini" />
|
||||
<el-input v-model="computeName" :disabled="true" size="mini" />
|
||||
</el-col>
|
||||
<el-col :span="4" :offset="1">
|
||||
<el-input v-model="input" :disabled="true" size="mini" />
|
||||
<el-input v-model="min" :disabled="true" size="mini" />
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row style="padding: 5px;">
|
||||
<el-col :span="2" :offset="12" style="height: 28px;line-height: 28px;">
|
||||
<span>最小</span>
|
||||
<span>最佳</span>
|
||||
</el-col>
|
||||
<el-col :span="5">
|
||||
<el-input v-model="input" size="mini" :disabled="true" />
|
||||
<el-input v-model="computeName" size="mini" :disabled="true" />
|
||||
</el-col>
|
||||
<el-col :span="4" :offset="1">
|
||||
<el-input v-model="input" size="mini" :disabled="true" />
|
||||
<el-input v-model="avg" size="mini" :disabled="true" />
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row style="padding: 5px;">
|
||||
@ -111,10 +111,10 @@
|
||||
<span>最大</span>
|
||||
</el-col>
|
||||
<el-col :span="5">
|
||||
<el-input v-model="input" size="mini" :disabled="true" />
|
||||
<el-input v-model="computeName" size="mini" :disabled="true" />
|
||||
</el-col>
|
||||
<el-col :span="4" :offset="1">
|
||||
<el-input v-model="input" size="mini" :disabled="true" />
|
||||
<el-input v-model="max" size="mini" :disabled="true" />
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row style="padding: 5px 0">
|
||||
@ -168,11 +168,30 @@
|
||||
</el-col>
|
||||
</el-row>
|
||||
<div>
|
||||
<el-button style="width: 100px;height: 28px;margin-right: 103px;">显示列车信息</el-button>
|
||||
<el-button style="width: 100px;height: 28px;margin-right: 103px;" @click="showTrainInfo">显示列车信息</el-button>
|
||||
<el-button style="width: 100px;height: 28px;" @click="commit">执行</el-button>
|
||||
<el-button style="width: 100px;height: 28px;" @click="reset">重设</el-button>
|
||||
<el-button style="width: 100px;height: 28px;" @click="doClose">关闭</el-button>
|
||||
</div>
|
||||
<el-dialog
|
||||
width="500px"
|
||||
title="列车信息"
|
||||
:visible.sync="innerVisible"
|
||||
append-to-body
|
||||
>
|
||||
<el-table :data="showTrainList" style="width: 100%" height="500px">
|
||||
<el-table-column label="列车号">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.destinationCode + scope.row.serviceNumber + scope.row.tripNumber.substring(2) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="name" label="所在区段">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ getSectionName(scope.row.code) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
@ -188,18 +207,23 @@ export default {
|
||||
trainCode: '',
|
||||
atrMode: 'REGULATION_OFF',
|
||||
intervalMode: '',
|
||||
trainInterval: '',
|
||||
trainNumber: '',
|
||||
trainInterval: 90,
|
||||
min: '',
|
||||
max: '',
|
||||
avg: '',
|
||||
trainNumber: 4,
|
||||
tableData: [],
|
||||
tableData1: [],
|
||||
tableData2: [],
|
||||
tableData3: [],
|
||||
tableData4: [],
|
||||
showTrainList: [],
|
||||
input: '',
|
||||
timeTerm: 'stop',
|
||||
sortStationList: [],
|
||||
noStopList: [],
|
||||
dialogShow:false
|
||||
dialogShow:false,
|
||||
innerVisible: false
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@ -213,7 +237,16 @@ export default {
|
||||
'trainList',
|
||||
'stationList',
|
||||
'stationStandList'
|
||||
])
|
||||
]),
|
||||
computeName() {
|
||||
if (this.intervalMode === 'trainNumber') {
|
||||
return '间隔时间';
|
||||
} else if (this.intervalMode === 'trainInterval') {
|
||||
return '列车数量';
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
train(val) {
|
||||
@ -238,9 +271,29 @@ export default {
|
||||
}
|
||||
},
|
||||
atrMode(val) {
|
||||
this.intervalMode = '';
|
||||
if (val !== 'REGULATION_OFF') {
|
||||
this.timeTerm = '';
|
||||
}
|
||||
},
|
||||
intervalMode(val) {
|
||||
this.min = '';
|
||||
this.max = '';
|
||||
this.avg = '';
|
||||
},
|
||||
'$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 +343,38 @@ 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 : '';
|
||||
},
|
||||
computeInterval() {
|
||||
const step = {
|
||||
cmdType: CMD.Train.CMD_TRAIN_CALCULATE_INTERVAL,
|
||||
operate: 'Train_Calculate_Interval',
|
||||
param: { trainNumber: this.trainNumber, interval: this.trainInterval},
|
||||
over:true
|
||||
};
|
||||
this.$store.dispatch('training/nextNew', step).then(({valid, response}) => {
|
||||
if (valid) {
|
||||
this.trainInterval = response.data.intervalTime;
|
||||
this.trainNumber = response.data.trainNumber;
|
||||
this.min = response.data.min;
|
||||
this.max = response.data.max;
|
||||
this.avg = response.data.avg;
|
||||
}
|
||||
}).catch((error) => {
|
||||
console.error(error);
|
||||
if (error && error.code == '10017') {
|
||||
this.$message.error(error.message);
|
||||
} else {
|
||||
this.$message.error('命令执行失败');
|
||||
}
|
||||
});
|
||||
},
|
||||
showTrainInfo() {
|
||||
this.innerVisible = true;
|
||||
},
|
||||
doShow() {
|
||||
this.initData();
|
||||
this.dialogShow = true;
|
||||
@ -309,7 +394,7 @@ export default {
|
||||
} else if (!this.atrMode) {
|
||||
this.$message.error('请选择调度模式!');
|
||||
return;
|
||||
} else if (!this.timeTerm) {
|
||||
} else if (this.atrMode === 'REGULATION_OFF' && !this.timeTerm) {
|
||||
this.$message.error('请选择时间项!');
|
||||
return;
|
||||
}
|
||||
@ -351,6 +436,10 @@ export default {
|
||||
skipMap: skipMap
|
||||
};
|
||||
}
|
||||
} else if (this.atrMode === 'HEADWAY_REGULATION_FRONT') {
|
||||
param.regulationParam = {
|
||||
intervalTime: this.trainInterval
|
||||
};
|
||||
}
|
||||
|
||||
const step = {
|
||||
|
@ -74,8 +74,8 @@
|
||||
<div style="width: 25px;" class="div-simulate-button" :style="{background:isNoRecoverLevelC?'#F00':'#DDD' }" @click="showHimAlarm('C')">C</div>
|
||||
</el-row>
|
||||
<el-row class="button-row" style="margin-top: 20px;">
|
||||
<div style="width: 40px;" class="div-simulate-button" @click="showHimAlarm">报警</div>
|
||||
<div style="width: 40px;" class="div-simulate-button" @click="undeveloped">运图</div>
|
||||
<div style="width: 40px;" class="div-simulate-button" @click="showDiary">日记</div>
|
||||
<div style="width: 40px;" class="div-simulate-button" @click="showDiary">命令</div>
|
||||
</el-row>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
@ -104,6 +104,7 @@
|
||||
</el-row>
|
||||
</div>
|
||||
<alarm-table-hmi ref="alarmTableHmi" />
|
||||
<log-detail ref="logDetail" />
|
||||
<audio id="buzzer" controls loop="loop" style="width: 0;height: 0">
|
||||
<source :src="buzzerAudio" type="audio/mpeg">
|
||||
</audio>
|
||||
@ -125,11 +126,13 @@ import { mapGetters } from 'vuex';
|
||||
import { timeFormat } from '@/utils/date';
|
||||
import BuzzerAudio from '@/assets/buzzer.mp3';
|
||||
import AlarmTableHmi from '@/jmapNew/theme/nanjing_02/menus/menuDialog/alarmTableHmi';
|
||||
import LogDetail from '@/jmapNew/theme/nanjing_02/menus/menuDialog/logDetail';
|
||||
import { prefixIntrger } from '@/utils/date';
|
||||
export default {
|
||||
name: 'BaSiDi',
|
||||
components: {
|
||||
AlarmTableHmi
|
||||
AlarmTableHmi,
|
||||
LogDetail
|
||||
},
|
||||
props: {
|
||||
|
||||
@ -261,6 +264,9 @@ export default {
|
||||
showHimAlarm(level) {
|
||||
this.$refs.alarmTableHmi.doShow(level);
|
||||
},
|
||||
showDiary() {
|
||||
this.$refs.logDetail.doShow();
|
||||
},
|
||||
controlAudio(val) {
|
||||
const audio = document.getElementById('buzzer');
|
||||
this.sound = val;
|
||||
|
@ -172,6 +172,7 @@ export default {
|
||||
this.initLoadData();
|
||||
this.initMemberUserInfo(true);
|
||||
this.$store.dispatch('app/animationsClose');
|
||||
this.$refs.troDialog.doClose();
|
||||
},
|
||||
methods:{
|
||||
// 结束加载状态
|
||||
|
@ -42,7 +42,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogShow: false,
|
||||
dialogShow: true,
|
||||
mapData: null,
|
||||
deviceCode: '',
|
||||
selfJmap: null,
|
||||
|
@ -13,7 +13,8 @@
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex';
|
||||
import { getFlankProtectionList, delFlankProtection, getDraftMapFlsList } from '@/api/jmap/mapdraft';
|
||||
// getDraftMapFlsList
|
||||
import { getFlankProtectionList, delFlankProtection } from '@/api/jmap/mapdraft';
|
||||
|
||||
export default {
|
||||
name: 'RouteDetail',
|
||||
@ -37,11 +38,8 @@ export default {
|
||||
labelWidth: '120px',
|
||||
queryObject: {
|
||||
code: {
|
||||
type: 'select',
|
||||
label: '侧防code',
|
||||
config: {
|
||||
data: []
|
||||
}
|
||||
type: 'text',
|
||||
label: '侧防code'
|
||||
},
|
||||
name: {
|
||||
type: 'text',
|
||||
@ -110,7 +108,7 @@ export default {
|
||||
// }
|
||||
},
|
||||
mounted() {
|
||||
this.acquireMapList();
|
||||
// this.acquireMapList();
|
||||
},
|
||||
methods: {
|
||||
doShow() {
|
||||
@ -134,11 +132,11 @@ export default {
|
||||
return getFlankProtectionList(this.mapInfo.id, params);
|
||||
}
|
||||
},
|
||||
acquireMapList() {
|
||||
getDraftMapFlsList(this.mapInfo.id).then(response => {
|
||||
this.queryForm.queryObject.code.config.data = response.data;
|
||||
});
|
||||
},
|
||||
// acquireMapList() {
|
||||
// getDraftMapFlsList(this.mapInfo.id).then(response => {
|
||||
// this.queryForm.queryObject.code.config.data = response.data;
|
||||
// });
|
||||
// },
|
||||
afterQuery(data) {
|
||||
if (data && data.list) {
|
||||
// const that = this;
|
||||
|
@ -150,11 +150,11 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="侧防列表:">
|
||||
<el-select v-model="addModel.flankProtectionList" clearable multiple filterable :placeholder="$t('map.pleaseSelect')">
|
||||
<el-select v-model="addModel.flsList" clearable multiple filterable :placeholder="$t('map.pleaseSelect')">
|
||||
<el-option
|
||||
v-for="(item,index) in flankProtectList"
|
||||
:key="index"
|
||||
:label="`${item.number}-${item.name}`"
|
||||
:label="item.name"
|
||||
:value="item.code"
|
||||
/>
|
||||
</el-select>
|
||||
@ -271,7 +271,7 @@ export default {
|
||||
routeSectionList: [], // 进路物理区段
|
||||
routeSwitchList: [], // 进路道岔列表
|
||||
routeFlankProtectionList: [], // 进路侧防道岔列表
|
||||
flankProtectionList: [],
|
||||
flsList: [],
|
||||
stationStandList: [], // 站台数据列表
|
||||
overlapCode:'',
|
||||
overrunList: [], // 超限区段数据列表
|
||||
@ -493,7 +493,7 @@ export default {
|
||||
this.addModel.mapId = this.mapInfo.id;
|
||||
this.addModel.routeSwitchList = [];
|
||||
this.addModel.routeFlankProtectionList = [];
|
||||
this.addModel.flankProtectionList = [];
|
||||
this.addModel.flsList = [];
|
||||
this.addModel.overlapCode = '';
|
||||
this.addModel.code = '';
|
||||
this.addModel.conflictingSignalList = [];
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user