merge
This commit is contained in:
commit
838c32df01
@ -4,7 +4,7 @@ const publicPath = process.env.VUE_APP_PRO == 'local' ? '' : '/cbtc';
|
||||
|
||||
export const JL3D_LOCAL_STATIC = publicPath+"/static";
|
||||
const BASE_UPLOAD_API = store.state.user.uploadUrl;
|
||||
// export const BASE_ASSET_API = this.$store.user.state.resourcesUrl;
|
||||
export const BASE_ASSET_API = store.state.user.resourcesUrl;
|
||||
// console.log(JL3D_LOCAL_STATIC);
|
||||
// console.log(BASE_UPLOAD_API);
|
||||
// console.log(BASE_ASSET_API);
|
||||
|
@ -1,5 +1,5 @@
|
||||
import request from '@/utils/request';
|
||||
|
||||
//获取三维课程草稿列表
|
||||
export function getLesson3dDrftList(params) {
|
||||
return request({
|
||||
url: `/api/draft3dLesson/paging`,
|
||||
@ -7,7 +7,7 @@ export function getLesson3dDrftList(params) {
|
||||
params: params
|
||||
});
|
||||
}
|
||||
|
||||
//获取三维课程草稿数据
|
||||
export function getLesson3dData(lessonId) {
|
||||
return request({
|
||||
url: `/api/draft3dLesson/${lessonId}`,
|
||||
@ -15,13 +15,47 @@ export function getLesson3dData(lessonId) {
|
||||
params: ''
|
||||
});
|
||||
}
|
||||
//获取三维课程发布数据
|
||||
export function getPublishLesson3dData(lessonId) {
|
||||
return request({
|
||||
url: `/api/lesson3d/${lessonId}`,
|
||||
method: 'get',
|
||||
params: ''
|
||||
});
|
||||
}
|
||||
//上架课程
|
||||
export function onlineLesson3d(lessonId) {
|
||||
return request({
|
||||
url: `/api/lesson3d/${lessonId}/online`,
|
||||
method: 'put',
|
||||
params: ''
|
||||
});
|
||||
}
|
||||
//下架课程
|
||||
export function offlineLesson3d(lessonId) {
|
||||
return request({
|
||||
url: `/api/lesson3d/${lessonId}/offline`,
|
||||
method: 'put',
|
||||
params: ''
|
||||
});
|
||||
}
|
||||
|
||||
export function getSelectLesson3dList(params) {
|
||||
return request({
|
||||
url: `/api/lesson3d/list`,
|
||||
method: 'get',
|
||||
params: params
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
//查询发布课程
|
||||
export function publishedLesson3d() {
|
||||
export function publishedLesson3d(params) {
|
||||
return request({
|
||||
url: `/api/lesson3d/paging`,
|
||||
method: 'get',
|
||||
params: ''
|
||||
params: params
|
||||
});
|
||||
}
|
||||
|
||||
@ -39,7 +73,7 @@ export function publishLesson3d(lessonId) {
|
||||
return request({
|
||||
url: `/api/draft3dLesson/${lessonId}/publish`,
|
||||
method: 'post',
|
||||
data: ""
|
||||
data: ''
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ export default {
|
||||
size: 3,
|
||||
action: `${this.$store.state.user.uploadUrl}/api/upload/PICTURE?appId=00001&appSecret=joylink00001`,
|
||||
response: (res) => {
|
||||
return `${this.$store.user.state.resourcesUrl}${res.data}`;
|
||||
return `${this.$store.state.user.resourcesUrl}${res.data}`;
|
||||
},
|
||||
error: () => { that.$message.error('图片上传失败,请检查网络状态'); },
|
||||
sizeError: () => { that.$message.error('图片上传失败,图片大小限制3MB'); } // 图片超过大小的回调
|
||||
|
@ -74,7 +74,9 @@ export default {
|
||||
courseDescription: 'Course description',
|
||||
editCourse: 'Edit course',
|
||||
createCourse: 'Create course',
|
||||
courseRelease: 'Course release',
|
||||
courseRelease: 'Course offonline',
|
||||
courseOnline: 'Course online',
|
||||
courseOffline: 'Course offonline',
|
||||
releaseAssociatedCity: 'Release associated city:',
|
||||
releaseAssociatedMap: 'Release associated map:',
|
||||
trainingSequence: 'Training sequence',
|
||||
|
@ -123,6 +123,8 @@ export default {
|
||||
|
||||
coursePublishSuccessful: 'Successful course release',
|
||||
coursePublishFailed: 'Course launch failed',
|
||||
offlineSuccessful: 'Successful offline',
|
||||
offlineFailed: 'Course offline',
|
||||
startOperationHint: 'This operation will start the task. Do you want to continue?',
|
||||
cancelsTaskHint: 'This action cancels the task. Do you want to continue?',
|
||||
automaticGenerationTrainingSuccess: 'Automatic generation of training success',
|
||||
|
@ -74,6 +74,8 @@ export default {
|
||||
editCourse: '编辑课程',
|
||||
createCourse: '创建课程',
|
||||
courseRelease: '课程发布',
|
||||
courseOnline: '课程上架',
|
||||
courseOffline: '课程下架',
|
||||
releaseAssociatedCity: '发布关联城市:',
|
||||
releaseAssociatedMap: '发布关联地图:',
|
||||
trainingSequence: '实训排序',
|
||||
@ -124,4 +126,3 @@ export default {
|
||||
copy: '复制',
|
||||
prdType:'产品类型'
|
||||
};
|
||||
|
||||
|
@ -123,6 +123,8 @@ export default {
|
||||
trainModelNameRepeat: '列车模型数据重复',
|
||||
coursePublishSuccessful: '课程发布成功',
|
||||
coursePublishFailed: '课程发布失败',
|
||||
offlineSuccessful: '课程下架成功',
|
||||
offlineFailed: '课程下架失败',
|
||||
startOperationHint: '此操作将开始任务, 是否继续?',
|
||||
cancelsTaskHint: '此操作将取消任务, 是否继续?',
|
||||
automaticGenerationTrainingSuccess: '自动生成实训成功',
|
||||
|
@ -363,7 +363,7 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
|
||||
// if(data.code = "336"){
|
||||
// console.log(data);
|
||||
// }
|
||||
|
||||
if(rails.sectionrail[data.section]){
|
||||
if(data.section != updateTrainModel.nowsection){
|
||||
updateTrainModel.nowsection = data.section;
|
||||
updateTrainModel.curve = rails.sectionrail[data.section].lineleft;
|
||||
@ -521,6 +521,10 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
updateTrainModel.position.x = -100000;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -536,203 +540,168 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
|
||||
trainmodel.code = data.code;
|
||||
trainmodel.nowcode = data.code;
|
||||
}
|
||||
if(rails.sectionrail[data.section]){
|
||||
//改变当前列车行驶的区段code
|
||||
if(data.section != trainmodel.nowsection){
|
||||
trainmodel.nowsection = data.section;
|
||||
trainmodel.curve = rails.sectionrail[data.section].lineleft;
|
||||
}
|
||||
|
||||
//改变当前列车行驶的区段code
|
||||
if(data.section != trainmodel.nowsection){
|
||||
trainmodel.nowsection = data.section;
|
||||
trainmodel.curve = rails.sectionrail[data.section].lineleft;
|
||||
}
|
||||
//判断转向
|
||||
if(trainmodel.right != data.right){
|
||||
|
||||
//判断转向
|
||||
if(trainmodel.right != data.right){
|
||||
if(data.right == "0"){
|
||||
trainmodel.right = "0";
|
||||
trainmodel.rotation.y = Math.PI;
|
||||
let point = trainmodel.curve.getPointAt(data.offset);
|
||||
trainmodel.position.x = point.x;
|
||||
for (let tl=0; tl<trainmodel.children.length; tl++) {
|
||||
trainmodel.children[tl].position.z = point.z;
|
||||
}
|
||||
|
||||
if(data.right == "0"){
|
||||
trainmodel.right = "0";
|
||||
trainmodel.rotation.y = Math.PI;
|
||||
let point = trainmodel.curve.getPointAt(data.offset);
|
||||
trainmodel.position.x = point.x;
|
||||
for (let tl=0; tl<trainmodel.children.length; tl++) {
|
||||
trainmodel.children[tl].position.z = point.z;
|
||||
}
|
||||
if(trainmodel.openleft == "1"){
|
||||
trainmodel.openleft = "0";
|
||||
for(let an=actions["traindoor"].top.length-1;an>=0;an--){
|
||||
actions["traindoor"].top[an].stop();
|
||||
}
|
||||
trainmodel.openright = "1";
|
||||
for(let an=actions["traindoor"].down.length-1;an>=0;an--){
|
||||
actions["traindoor"].down[an].reset();
|
||||
actions["traindoor"].down[an].time = actions["traindoor"].down[an]._clip.duration;
|
||||
actions["traindoor"].down[an].timeScale = 1;
|
||||
actions["traindoor"].down[an].play();
|
||||
}
|
||||
}else if(trainmodel.openright == "1"){
|
||||
trainmodel.openright = "0";
|
||||
for(let an=actions["traindoor"].down.length-1;an>=0;an--){
|
||||
actions["traindoor"].down[an].stop();
|
||||
}
|
||||
trainmodel.openleft = "1";
|
||||
for(let an=actions["traindoor"].top.length-1;an>=0;an--){
|
||||
actions["traindoor"].top[an].reset();
|
||||
actions["traindoor"].top[an].time = actions["traindoor"].top[an]._clip.duration;
|
||||
actions["traindoor"].top[an].timeScale = 1;
|
||||
actions["traindoor"].top[an].play();
|
||||
}
|
||||
}
|
||||
|
||||
if(trainmodel.openleft == "1"){
|
||||
trainmodel.openleft = "0";
|
||||
for(let an=actions["traindoor"].top.length-1;an>=0;an--){
|
||||
actions["traindoor"].top[an].stop();
|
||||
}else{
|
||||
trainmodel.right = "1";
|
||||
trainmodel.rotation.y = 0;
|
||||
let point = trainmodel.curve.getPointAt(data.offset);
|
||||
trainmodel.position.x = point.x;
|
||||
for (let tl=0; tl<trainmodel.children.length; tl++) {
|
||||
trainmodel.children[tl].position.z = point.z;
|
||||
}
|
||||
trainmodel.openright = "1";
|
||||
for(let an=actions["traindoor"].down.length-1;an>=0;an--){
|
||||
actions["traindoor"].down[an].reset();
|
||||
actions["traindoor"].down[an].time = actions["traindoor"].down[an]._clip.duration;
|
||||
actions["traindoor"].down[an].timeScale = 1;
|
||||
actions["traindoor"].down[an].play();
|
||||
}
|
||||
}else if(trainmodel.openright == "1"){
|
||||
trainmodel.openright = "0";
|
||||
for(let an=actions["traindoor"].down.length-1;an>=0;an--){
|
||||
actions["traindoor"].down[an].stop();
|
||||
}
|
||||
trainmodel.openleft = "1";
|
||||
for(let an=actions["traindoor"].top.length-1;an>=0;an--){
|
||||
actions["traindoor"].top[an].reset();
|
||||
actions["traindoor"].top[an].time = actions["traindoor"].top[an]._clip.duration;
|
||||
actions["traindoor"].top[an].timeScale = 1;
|
||||
actions["traindoor"].top[an].play();
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
trainmodel.right = "1";
|
||||
trainmodel.rotation.y = 0;
|
||||
let point = trainmodel.curve.getPointAt(data.offset);
|
||||
trainmodel.position.x = point.x;
|
||||
for (let tl=0; tl<trainmodel.children.length; tl++) {
|
||||
trainmodel.children[tl].position.z = point.z;
|
||||
}
|
||||
if(trainmodel.openleft == "1"){
|
||||
trainmodel.openleft = "0";
|
||||
for(let an=actions["traindoor"].top.length-1;an>=0;an--){
|
||||
actions["traindoor"].top[an].stop();
|
||||
}
|
||||
trainmodel.openright = "1";
|
||||
for(let an=actions["traindoor"].down.length-1;an>=0;an--){
|
||||
actions["traindoor"].down[an].reset();
|
||||
actions["traindoor"].down[an].time = actions["traindoor"].down[an]._clip.duration;
|
||||
actions["traindoor"].down[an].timeScale = 1;
|
||||
actions["traindoor"].down[an].play();
|
||||
}
|
||||
}else if(trainmodel.openright == "1"){
|
||||
trainmodel.openright = "0";
|
||||
for(let an=actions["traindoor"].down.length-1;an>=0;an--){
|
||||
actions["traindoor"].down[an].stop();
|
||||
}
|
||||
trainmodel.openleft = "1";
|
||||
for(let an=actions["traindoor"].top.length-1;an>=0;an--){
|
||||
actions["traindoor"].top[an].reset();
|
||||
actions["traindoor"].top[an].time = actions["traindoor"].top[an]._clip.duration;
|
||||
actions["traindoor"].top[an].timeScale = 1;
|
||||
actions["traindoor"].top[an].play();
|
||||
}
|
||||
}
|
||||
|
||||
if(trainmodel.openleft == "1"){
|
||||
trainmodel.openleft = "0";
|
||||
for(let an=actions["traindoor"].top.length-1;an>=0;an--){
|
||||
actions["traindoor"].top[an].stop();
|
||||
}
|
||||
trainmodel.openright = "1";
|
||||
for(let an=actions["traindoor"].down.length-1;an>=0;an--){
|
||||
actions["traindoor"].down[an].reset();
|
||||
actions["traindoor"].down[an].time = actions["traindoor"].down[an]._clip.duration;
|
||||
actions["traindoor"].down[an].timeScale = 1;
|
||||
actions["traindoor"].down[an].play();
|
||||
}
|
||||
}else if(trainmodel.openright == "1"){
|
||||
trainmodel.openright = "0";
|
||||
for(let an=actions["traindoor"].down.length-1;an>=0;an--){
|
||||
actions["traindoor"].down[an].stop();
|
||||
}
|
||||
trainmodel.openleft = "1";
|
||||
for(let an=actions["traindoor"].top.length-1;an>=0;an--){
|
||||
actions["traindoor"].top[an].reset();
|
||||
actions["traindoor"].top[an].time = actions["traindoor"].top[an]._clip.duration;
|
||||
actions["traindoor"].top[an].timeScale = 1;
|
||||
actions["traindoor"].top[an].play();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(trainmodel.curve && trainmodel.offset != data.offset){
|
||||
trainmodel.offset = data.offset;
|
||||
let pos = trainmodel.curve.getPointAt(data.offset);
|
||||
trainmodel.position.x = pos.x;
|
||||
// trainmodel.children[0].position.z = pos.z;
|
||||
if(data.right == "0"){
|
||||
if(-trainmodel.children[0].position.z != pos.z || trainmodel.children[0].position.y != pos.y){
|
||||
trainmodel.children[0].up = new THREE.Vector3(1,0,0);
|
||||
let tangent = trainmodel.curve.getTangentAt(data.offset).normalize();
|
||||
trainmodel.children[0].axis.crossVectors(trainmodel.children[0].up, tangent).normalize();
|
||||
let radians = Math.acos(trainmodel.children[0].up.dot(tangent));
|
||||
trainmodel.children[0].quaternion.setFromAxisAngle(trainmodel.children[0].axis, radians);
|
||||
trainmodel.children[0].rotation.x = -Math.PI/2;
|
||||
let newRotationZ = trainmodel.children[0].rotation.z;
|
||||
trainmodel.children[0].rotation.z = trainmodel.children[0].rotation.y;
|
||||
trainmodel.children[0].rotation.y = -newRotationZ;
|
||||
|
||||
let rotas = {
|
||||
posr:pos,
|
||||
roty:trainmodel.children[0].rotation.y,
|
||||
rotz:trainmodel.children[0].rotation.z
|
||||
}
|
||||
trainmodel.children[1].rotalist.push(rotas);
|
||||
let offsetz = pos.z + trainmodel.children[0].position.z;
|
||||
trainmodel.children[0].position.z -= offsetz;
|
||||
|
||||
// let offsety = pos.y - trainmodel.children[0].position.y;
|
||||
// trainmodel.children[0].position.y += offsetz;
|
||||
// trainmodel.position.z = point.z;
|
||||
|
||||
}
|
||||
if(trainmodel.children[1].rotalist.length > 0 || trainmodel.children[2].rotalist.length > 0 || trainmodel.children[3].rotalist.length > 0 || trainmodel.children[4].rotalist.length > 0|| trainmodel.children[5].rotalist.length > 0){
|
||||
|
||||
for(let rs = 1;rs<trainmodel.children.length;rs++){
|
||||
//console.log(rs);
|
||||
if(trainmodel.children[rs].rotalist[0]){
|
||||
|
||||
let offsetz = parseFloat(trainmodel.children[rs].rotalist[0].posr.z) + parseFloat(trainmodel.children[rs].position.z);
|
||||
trainmodel.children[rs].position.z -= offsetz;
|
||||
|
||||
let offsety = parseFloat(trainmodel.children[rs].rotalist[0].posr.y) - parseFloat(trainmodel.children[rs].position.y);
|
||||
trainmodel.children[rs].position.y += offsety;
|
||||
|
||||
for(let xh=0;xh<trainmodel.children[rs].rotalist.length;xh++){
|
||||
if((trainmodel.children[rs].matrixWorld.elements[12]+10)>=trainmodel.children[rs].rotalist[0].posr.x){
|
||||
|
||||
if(rs != trainmodel.children.length-1){
|
||||
let asd = trainmodel.children[rs].rotalist[0];
|
||||
trainmodel.children[rs+1].rotalist.push(asd);
|
||||
|
||||
}
|
||||
//let offsetx = trainmodel.children[1].matrixWorld.elements[12]-trainmodel.children[0].children[3].matrixWorld.elements[12];
|
||||
|
||||
trainmodel.children[rs].rotation.z = trainmodel.children[rs].rotalist[0].rotz;
|
||||
trainmodel.children[rs].rotation.y = trainmodel.children[rs].rotalist[0].roty;
|
||||
trainmodel.children[rs].rotalist.splice(0,1)
|
||||
xh--;
|
||||
}else{
|
||||
xh = trainmodel.children[rs].rotalist.length;
|
||||
}
|
||||
}
|
||||
//console.log(trainmodel.children[rs].rotalist.length);
|
||||
if(trainmodel.curve && trainmodel.offset != data.offset){
|
||||
trainmodel.offset = data.offset;
|
||||
let pos = trainmodel.curve.getPointAt(data.offset);
|
||||
trainmodel.position.x = pos.x;
|
||||
// trainmodel.children[0].position.z = pos.z;
|
||||
if(data.right == "0"){
|
||||
if(-trainmodel.children[0].position.z != pos.z || trainmodel.children[0].position.y != pos.y){
|
||||
trainmodel.children[0].up = new THREE.Vector3(1,0,0);
|
||||
let tangent = trainmodel.curve.getTangentAt(data.offset).normalize();
|
||||
trainmodel.children[0].axis.crossVectors(trainmodel.children[0].up, tangent).normalize();
|
||||
let radians = Math.acos(trainmodel.children[0].up.dot(tangent));
|
||||
trainmodel.children[0].quaternion.setFromAxisAngle(trainmodel.children[0].axis, radians);
|
||||
trainmodel.children[0].rotation.x = -Math.PI/2;
|
||||
let newRotationZ = trainmodel.children[0].rotation.z;
|
||||
trainmodel.children[0].rotation.z = trainmodel.children[0].rotation.y;
|
||||
trainmodel.children[0].rotation.y = -newRotationZ;
|
||||
|
||||
let rotas = {
|
||||
posr:pos,
|
||||
roty:trainmodel.children[0].rotation.y,
|
||||
rotz:trainmodel.children[0].rotation.z
|
||||
}
|
||||
trainmodel.children[1].rotalist.push(rotas);
|
||||
let offsetz = pos.z + trainmodel.children[0].position.z;
|
||||
trainmodel.children[0].position.z -= offsetz;
|
||||
|
||||
// let offsety = pos.y - trainmodel.children[0].position.y;
|
||||
// trainmodel.children[0].position.y += offsetz;
|
||||
// trainmodel.position.z = point.z;
|
||||
|
||||
}
|
||||
// console.log(trainmodel.rotalist);
|
||||
}
|
||||
if(trainmodel.children[1].rotalist.length > 0 || trainmodel.children[2].rotalist.length > 0 || trainmodel.children[3].rotalist.length > 0 || trainmodel.children[4].rotalist.length > 0|| trainmodel.children[5].rotalist.length > 0){
|
||||
|
||||
}else{
|
||||
//
|
||||
let rotas = {
|
||||
posr:null,
|
||||
roty:null,
|
||||
rotz:null,
|
||||
};
|
||||
if(trainmodel.children[0].position.z < pos.z ){
|
||||
trainmodel.children[0].up = new THREE.Vector3(-1,0,0);
|
||||
let tangent = trainmodel.curve.getTangentAt(data.offset).normalize();
|
||||
trainmodel.children[0].axis.crossVectors(trainmodel.children[0].up, tangent).normalize();
|
||||
let radians = Math.acos(trainmodel.children[0].up.dot(tangent));
|
||||
trainmodel.children[0].quaternion.setFromAxisAngle(trainmodel.children[0].axis, radians);
|
||||
trainmodel.children[0].rotation.x = -Math.PI/2;
|
||||
trainmodel.children[0].rotation.z = trainmodel.children[0].rotation.y;
|
||||
trainmodel.children[0].rotation.y = 0;
|
||||
for(let rs = 1;rs<trainmodel.children.length;rs++){
|
||||
//console.log(rs);
|
||||
if(trainmodel.children[rs].rotalist[0]){
|
||||
|
||||
rotas.posr = pos;
|
||||
// rotas.roty = trainmodel.children[0].rotation.y;
|
||||
rotas.rotz = trainmodel.children[0].rotation.z;
|
||||
let offsetz = parseFloat(trainmodel.children[rs].rotalist[0].posr.z) + parseFloat(trainmodel.children[rs].position.z);
|
||||
trainmodel.children[rs].position.z -= offsetz;
|
||||
|
||||
let offsetz = parseFloat(pos.z) - parseFloat(trainmodel.children[0].position.z);
|
||||
trainmodel.children[0].position.z += offsetz;
|
||||
}else if(trainmodel.children[0].position.z > pos.z){
|
||||
trainmodel.children[0].up = new THREE.Vector3(1,0,0);
|
||||
let tangent = trainmodel.curve.getTangentAt(data.offset).normalize();
|
||||
trainmodel.children[0].axis.crossVectors(trainmodel.children[0].up, tangent).normalize();
|
||||
let radians = Math.acos(trainmodel.children[0].up.dot(tangent));
|
||||
trainmodel.children[0].quaternion.setFromAxisAngle(trainmodel.children[0].axis, radians);
|
||||
trainmodel.children[0].rotation.x = -Math.PI/2;
|
||||
trainmodel.children[0].rotation.z = trainmodel.children[0].rotation.y;
|
||||
trainmodel.children[0].rotation.y = 0;
|
||||
let offsety = parseFloat(trainmodel.children[rs].rotalist[0].posr.y) - parseFloat(trainmodel.children[rs].position.y);
|
||||
trainmodel.children[rs].position.y += offsety;
|
||||
|
||||
rotas.posr = pos;
|
||||
// rotas.roty = trainmodel.children[0].rotation.y;
|
||||
rotas.rotz = trainmodel.children[0].rotation.z;
|
||||
for(let xh=0;xh<trainmodel.children[rs].rotalist.length;xh++){
|
||||
if((trainmodel.children[rs].matrixWorld.elements[12]+10)>=trainmodel.children[rs].rotalist[0].posr.x){
|
||||
|
||||
let offsetz = parseFloat(pos.z) - parseFloat(trainmodel.children[0].position.z);
|
||||
trainmodel.children[0].position.z += offsetz;
|
||||
}
|
||||
if(rs != trainmodel.children.length-1){
|
||||
let asd = trainmodel.children[rs].rotalist[0];
|
||||
trainmodel.children[rs+1].rotalist.push(asd);
|
||||
|
||||
if(trainmodel.children[0].position.y != pos.y){
|
||||
if(rotas.posr == null){
|
||||
}
|
||||
//let offsetx = trainmodel.children[1].matrixWorld.elements[12]-trainmodel.children[0].children[3].matrixWorld.elements[12];
|
||||
|
||||
trainmodel.children[rs].rotation.z = trainmodel.children[rs].rotalist[0].rotz;
|
||||
trainmodel.children[rs].rotation.y = trainmodel.children[rs].rotalist[0].roty;
|
||||
trainmodel.children[rs].rotalist.splice(0,1)
|
||||
xh--;
|
||||
}else{
|
||||
xh = trainmodel.children[rs].rotalist.length;
|
||||
}
|
||||
}
|
||||
//console.log(trainmodel.children[rs].rotalist.length);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
// console.log(trainmodel.rotalist);
|
||||
}
|
||||
|
||||
}else{
|
||||
//
|
||||
let rotas = {
|
||||
posr:null,
|
||||
roty:null,
|
||||
rotz:null,
|
||||
};
|
||||
if(trainmodel.children[0].position.z < pos.z ){
|
||||
trainmodel.children[0].up = new THREE.Vector3(-1,0,0);
|
||||
let tangent = trainmodel.curve.getTangentAt(data.offset).normalize();
|
||||
trainmodel.children[0].axis.crossVectors(trainmodel.children[0].up, tangent).normalize();
|
||||
@ -743,64 +712,96 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
|
||||
trainmodel.children[0].rotation.y = 0;
|
||||
|
||||
rotas.posr = pos;
|
||||
rotas.roty = trainmodel.children[0].rotation.y;
|
||||
// rotas.roty = trainmodel.children[0].rotation.y;
|
||||
rotas.rotz = trainmodel.children[0].rotation.z;
|
||||
|
||||
let offsetz = parseFloat(pos.z) - parseFloat(trainmodel.children[0].position.z);
|
||||
trainmodel.children[0].position.z += offsetz;
|
||||
}else if(trainmodel.children[0].position.z > pos.z){
|
||||
trainmodel.children[0].up = new THREE.Vector3(1,0,0);
|
||||
let tangent = trainmodel.curve.getTangentAt(data.offset).normalize();
|
||||
trainmodel.children[0].axis.crossVectors(trainmodel.children[0].up, tangent).normalize();
|
||||
let radians = Math.acos(trainmodel.children[0].up.dot(tangent));
|
||||
trainmodel.children[0].quaternion.setFromAxisAngle(trainmodel.children[0].axis, radians);
|
||||
trainmodel.children[0].rotation.x = -Math.PI/2;
|
||||
trainmodel.children[0].rotation.z = trainmodel.children[0].rotation.y;
|
||||
trainmodel.children[0].rotation.y = 0;
|
||||
|
||||
rotas.posr = pos;
|
||||
// rotas.roty = trainmodel.children[0].rotation.y;
|
||||
rotas.rotz = trainmodel.children[0].rotation.z;
|
||||
|
||||
let offsetz = parseFloat(pos.z) - parseFloat(trainmodel.children[0].position.z);
|
||||
trainmodel.children[0].position.z += offsetz;
|
||||
let offsety = parseFloat(pos.y) - parseFloat(trainmodel.children[0].position.y);
|
||||
trainmodel.children[0].position.y += offsety;
|
||||
}else{
|
||||
rotas.roty = trainmodel.children[0].rotation.y;
|
||||
let offsety = parseFloat(rotas.posr.y) - parseFloat(trainmodel.children[0].position.y);
|
||||
trainmodel.children[0].position.y += offsety;
|
||||
}
|
||||
}
|
||||
|
||||
if(rotas.posr!= null){
|
||||
trainmodel.children[1].rotalist.push(rotas);
|
||||
}
|
||||
if(trainmodel.children[0].position.y != pos.y){
|
||||
if(rotas.posr == null){
|
||||
trainmodel.children[0].up = new THREE.Vector3(-1,0,0);
|
||||
let tangent = trainmodel.curve.getTangentAt(data.offset).normalize();
|
||||
trainmodel.children[0].axis.crossVectors(trainmodel.children[0].up, tangent).normalize();
|
||||
let radians = Math.acos(trainmodel.children[0].up.dot(tangent));
|
||||
trainmodel.children[0].quaternion.setFromAxisAngle(trainmodel.children[0].axis, radians);
|
||||
trainmodel.children[0].rotation.x = -Math.PI/2;
|
||||
trainmodel.children[0].rotation.z = trainmodel.children[0].rotation.y;
|
||||
trainmodel.children[0].rotation.y = 0;
|
||||
|
||||
rotas.posr = pos;
|
||||
rotas.roty = trainmodel.children[0].rotation.y;
|
||||
rotas.rotz = trainmodel.children[0].rotation.z;
|
||||
|
||||
let offsetz = parseFloat(pos.z) - parseFloat(trainmodel.children[0].position.z);
|
||||
trainmodel.children[0].position.z += offsetz;
|
||||
let offsety = parseFloat(pos.y) - parseFloat(trainmodel.children[0].position.y);
|
||||
trainmodel.children[0].position.y += offsety;
|
||||
}else{
|
||||
rotas.roty = trainmodel.children[0].rotation.y;
|
||||
let offsety = parseFloat(rotas.posr.y) - parseFloat(trainmodel.children[0].position.y);
|
||||
trainmodel.children[0].position.y += offsety;
|
||||
}
|
||||
}
|
||||
|
||||
if(rotas.posr!= null){
|
||||
trainmodel.children[1].rotalist.push(rotas);
|
||||
}
|
||||
|
||||
|
||||
if(trainmodel.children[1].rotalist.length > 0 || trainmodel.children[2].rotalist.length > 0 || trainmodel.children[3].rotalist.length > 0 || trainmodel.children[4].rotalist.length > 0|| trainmodel.children[5].rotalist.length > 0){
|
||||
for(let rs = 1;rs<trainmodel.children.length;rs++){
|
||||
//console.log(rs);
|
||||
if(trainmodel.children[rs].rotalist[0]){
|
||||
let offsetz = parseFloat(trainmodel.children[rs].rotalist[0].posr.z) - parseFloat(trainmodel.children[rs].matrixWorld.elements[14]);
|
||||
trainmodel.children[rs].position.z += offsetz;
|
||||
if(trainmodel.children[1].rotalist.length > 0 || trainmodel.children[2].rotalist.length > 0 || trainmodel.children[3].rotalist.length > 0 || trainmodel.children[4].rotalist.length > 0|| trainmodel.children[5].rotalist.length > 0){
|
||||
for(let rs = 1;rs<trainmodel.children.length;rs++){
|
||||
//console.log(rs);
|
||||
if(trainmodel.children[rs].rotalist[0]){
|
||||
let offsetz = parseFloat(trainmodel.children[rs].rotalist[0].posr.z) - parseFloat(trainmodel.children[rs].matrixWorld.elements[14]);
|
||||
trainmodel.children[rs].position.z += offsetz;
|
||||
|
||||
let offsety = parseFloat(trainmodel.children[rs].rotalist[0].posr.y) - parseFloat(trainmodel.children[rs].matrixWorld.elements[13]);
|
||||
trainmodel.children[rs].position.y += offsety;
|
||||
let offsety = parseFloat(trainmodel.children[rs].rotalist[0].posr.y) - parseFloat(trainmodel.children[rs].matrixWorld.elements[13]);
|
||||
trainmodel.children[rs].position.y += offsety;
|
||||
|
||||
for(let xh=0;xh<trainmodel.children[rs].rotalist.length;xh++){
|
||||
if((trainmodel.children[rs].matrixWorld.elements[12]-10)<=trainmodel.children[rs].rotalist[0].posr.x){
|
||||
for(let xh=0;xh<trainmodel.children[rs].rotalist.length;xh++){
|
||||
if((trainmodel.children[rs].matrixWorld.elements[12]-10)<=trainmodel.children[rs].rotalist[0].posr.x){
|
||||
|
||||
if(rs != trainmodel.children.length-1){
|
||||
let asd = trainmodel.children[rs].rotalist[0];
|
||||
trainmodel.children[rs+1].rotalist.push(asd);
|
||||
if(rs != trainmodel.children.length-1){
|
||||
let asd = trainmodel.children[rs].rotalist[0];
|
||||
trainmodel.children[rs+1].rotalist.push(asd);
|
||||
|
||||
}
|
||||
if(trainmodel.children[rs].rotalist[0].roty != null){
|
||||
trainmodel.children[rs].rotation.y = trainmodel.children[rs].rotalist[0].roty;
|
||||
}
|
||||
trainmodel.children[rs].rotation.z = trainmodel.children[rs].rotalist[0].rotz;
|
||||
trainmodel.children[rs].rotalist.splice(0,1)
|
||||
xh--;
|
||||
}else{
|
||||
xh = trainmodel.children[rs].rotalist.length;
|
||||
}
|
||||
if(trainmodel.children[rs].rotalist[0].roty != null){
|
||||
trainmodel.children[rs].rotation.y = trainmodel.children[rs].rotalist[0].roty;
|
||||
}
|
||||
trainmodel.children[rs].rotation.z = trainmodel.children[rs].rotalist[0].rotz;
|
||||
trainmodel.children[rs].rotalist.splice(0,1)
|
||||
xh--;
|
||||
}else{
|
||||
xh = trainmodel.children[rs].rotalist.length;
|
||||
}
|
||||
//console.log(trainmodel.children[rs].rotalist.length);
|
||||
}
|
||||
//console.log(trainmodel.children[rs].rotalist.length);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// let pos = ;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
function initall(data){
|
||||
@ -1005,94 +1006,98 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
|
||||
}
|
||||
function signalupdate(data) {
|
||||
code = data.code;
|
||||
if(signallist.list[code]){
|
||||
if(data.command == 'No'){
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
}
|
||||
/** 红 */
|
||||
if(data.command == 'R'){
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials["red"];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
}
|
||||
/** 绿 */
|
||||
if(data.command == 'G'){
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials["green"];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
}
|
||||
/** 黄 */
|
||||
if(data.command == 'Y'){
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["yellow"];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
}
|
||||
/** 月白 */
|
||||
if(data.command == 'W'){
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
}
|
||||
/** 蓝 */
|
||||
if(data.command == 'B'){
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
}
|
||||
/** 红黄 */
|
||||
if(data.command == 'RY'){
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials["red"];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["yellow"];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
}
|
||||
|
||||
if(data.command == 'No'){
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
}
|
||||
/** 红 */
|
||||
if(data.command == 'R'){
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials["red"];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
}
|
||||
/** 绿 */
|
||||
if(data.command == 'G'){
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials["green"];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
}
|
||||
/** 黄 */
|
||||
if(data.command == 'Y'){
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["yellow"];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
}
|
||||
/** 月白 */
|
||||
if(data.command == 'W'){
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
}
|
||||
/** 蓝 */
|
||||
if(data.command == 'B'){
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
}
|
||||
/** 红黄 */
|
||||
if(data.command == 'RY'){
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials["red"];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["yellow"];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function initswitch(data) {
|
||||
code = data.code;
|
||||
if (data.command == 'NP') {
|
||||
// sectionlist.switchs.modellist[j].normal = data.normal;
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = 0;
|
||||
actions[code].action.timeScale = 1;
|
||||
actions[code].action.play();
|
||||
actions[code].command = data.command;
|
||||
} else if (data.command == 'RP') {
|
||||
// sectionlist.switchs.modellist[j].normal = data.normal;
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = actions[code].action._clip.duration;
|
||||
actions[code].action.timeScale = -1;
|
||||
actions[code].action.play();
|
||||
actions[code].command = data.command;
|
||||
if(actions[code]){
|
||||
if (data.command == 'NP') {
|
||||
// sectionlist.switchs.modellist[j].normal = data.normal;
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = 0;
|
||||
actions[code].action.timeScale = 1;
|
||||
actions[code].action.play();
|
||||
actions[code].command = data.command;
|
||||
} else if (data.command == 'RP') {
|
||||
// sectionlist.switchs.modellist[j].normal = data.normal;
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = actions[code].action._clip.duration;
|
||||
actions[code].action.timeScale = -1;
|
||||
actions[code].action.play();
|
||||
actions[code].command = data.command;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function switchupdate(data) {
|
||||
code = data.code;
|
||||
if (actions[code].command != data.command) {
|
||||
if (actions[code].command != data.command && actions[code]) {
|
||||
if (data.command == 'NP') {
|
||||
// sectionlist.switchs.modellist[j].normal = data.normal;
|
||||
actions[code].action.reset();
|
||||
|
@ -325,175 +325,96 @@ export function Maintainerconnect(jlmap3d,routegroup,jsonwebwork,lablecodemap) {
|
||||
function trainrunnew(data){
|
||||
let code = data.code;
|
||||
|
||||
if(trainlisttest.list[code].right != data.right){
|
||||
if(rails.sectionrail[data.section]){
|
||||
if(trainlisttest.list[code].right != data.right){
|
||||
|
||||
if(data.right == "0"){
|
||||
trainlisttest.list[code].right = "0";
|
||||
trainlisttest.list[code].rotation.y = Math.PI;
|
||||
let point = rails.sectionrail[data.section].lineleft.getPointAt(data.offset);
|
||||
trainlisttest.list[code].position.x = point.x;
|
||||
for (let tl=0; tl<6; tl++) {
|
||||
trainlisttest.list[code].children[tl].position.z = point.z;
|
||||
}
|
||||
}else{
|
||||
trainlisttest.list[code].right = "1";
|
||||
trainlisttest.list[code].rotation.y = 0;
|
||||
let point = rails.sectionrail[data.section].lineleft.getPointAt(data.offset);
|
||||
trainlisttest.list[code].position.x = point.x;
|
||||
for (let tl=0; tl<6; tl++) {
|
||||
trainlisttest.list[code].children[tl].position.z = point.z;
|
||||
if(data.right == "0"){
|
||||
trainlisttest.list[code].right = "0";
|
||||
trainlisttest.list[code].rotation.y = Math.PI;
|
||||
let point = rails.sectionrail[data.section].lineleft.getPointAt(data.offset);
|
||||
trainlisttest.list[code].position.x = point.x;
|
||||
for (let tl=0; tl<6; tl++) {
|
||||
trainlisttest.list[code].children[tl].position.z = point.z;
|
||||
}
|
||||
}else{
|
||||
trainlisttest.list[code].right = "1";
|
||||
trainlisttest.list[code].rotation.y = 0;
|
||||
let point = rails.sectionrail[data.section].lineleft.getPointAt(data.offset);
|
||||
trainlisttest.list[code].position.x = point.x;
|
||||
for (let tl=0; tl<6; tl++) {
|
||||
trainlisttest.list[code].children[tl].position.z = point.z;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// console.log(data);
|
||||
// console.log(data);
|
||||
|
||||
if(trainlisttest.list[code].dispose == "0"){
|
||||
if (data.right == '1') { // 向右
|
||||
trainlisttest.list[code].right = '1';
|
||||
trainlisttest.list[code].progress = data.offset;
|
||||
// trainlisttest.list[code].isstandsection = rails.sectionrail[data.section].standTrack;
|
||||
// if(rails.sectionrail[data.section].standTrack){
|
||||
// trainlisttest.list[code].statsstop = 0;
|
||||
// }
|
||||
let point = rails.sectionrail[data.section].lineleft.getPointAt(trainlisttest.list[code].progress);
|
||||
trainlisttest.list[code].rotation.y = 0;
|
||||
trainlisttest.list[code].position.x = point.x;
|
||||
trainlisttest.list[code].position.y = 0;
|
||||
if(trainlisttest.list[code].dispose == "0"){
|
||||
if (data.right == '1') { // 向右
|
||||
trainlisttest.list[code].right = '1';
|
||||
trainlisttest.list[code].progress = data.offset;
|
||||
// trainlisttest.list[code].isstandsection = rails.sectionrail[data.section].standTrack;
|
||||
// if(rails.sectionrail[data.section].standTrack){
|
||||
// trainlisttest.list[code].statsstop = 0;
|
||||
// }
|
||||
let point = rails.sectionrail[data.section].lineleft.getPointAt(trainlisttest.list[code].progress);
|
||||
trainlisttest.list[code].rotation.y = 0;
|
||||
trainlisttest.list[code].position.x = point.x;
|
||||
trainlisttest.list[code].position.y = 0;
|
||||
|
||||
// for (let tl=0; tl<6; tl++) {
|
||||
// trainlisttest.list[code].children[tl].position.z = parseFloat(point.z);
|
||||
// }
|
||||
// for (let tl=0; tl<6; tl++) {
|
||||
// trainlisttest.list[code].children[tl].position.z = parseFloat(point.z);
|
||||
// }
|
||||
|
||||
// trainlisttest.list[code].curve = rails.sectionrail[data.section].lineleft;
|
||||
// trainlisttest.list[code].curve = rails.sectionrail[data.section].lineleft;
|
||||
|
||||
// if(data.next){
|
||||
// trainlisttest.list[code].nextcode = data.next;
|
||||
// trainlisttest.list[code].nextcurve = rails.sectionrail[data.next].lineleft;
|
||||
// trainlisttest.list[code].nextlen = rails.sectionrail[data.next].lengthfact;
|
||||
// }
|
||||
// trainlisttest.list[code].len = rails.sectionrail[data.section].lengthfact;
|
||||
trainlisttest.list[code].status = '1';
|
||||
// if(data.next){
|
||||
// trainlisttest.list[code].nextcode = data.next;
|
||||
// trainlisttest.list[code].nextcurve = rails.sectionrail[data.next].lineleft;
|
||||
// trainlisttest.list[code].nextlen = rails.sectionrail[data.next].lengthfact;
|
||||
// }
|
||||
// trainlisttest.list[code].len = rails.sectionrail[data.section].lengthfact;
|
||||
trainlisttest.list[code].status = '1';
|
||||
|
||||
if(trainlisttest.list[code].children[0].position.z != point.z){
|
||||
trainlisttest.list[code].children[0].up = new THREE.Vector3(1,0,0);
|
||||
let tangent = rails.sectionrail[data.section].lineleft.getTangentAt(data.offset).normalize();
|
||||
trainlisttest.list[code].children[0].axis.crossVectors(trainlisttest.list[code].children[0].up, tangent).normalize();
|
||||
let radians = Math.acos(trainlisttest.list[code].children[0].up.dot(tangent));
|
||||
trainlisttest.list[code].children[0].quaternion.setFromAxisAngle(trainlisttest.list[code].children[0].axis, radians);
|
||||
trainlisttest.list[code].children[0].rotation.x = -Math.PI/2;
|
||||
trainlisttest.list[code].children[0].rotation.z = trainlisttest.list[code].children[0].rotation.y;
|
||||
trainlisttest.list[code].children[0].rotation.y = 0;
|
||||
let rotas = {
|
||||
posr:point,
|
||||
rota:trainlisttest.list[code].children[0].rotation.z
|
||||
}
|
||||
trainlisttest.list[code].children[1].rotalist.push(rotas);
|
||||
|
||||
|
||||
let offsetz = parseFloat(point.z) - parseFloat(trainlisttest.list[code].children[0].position.z);
|
||||
trainlisttest.list[code].children[0].position.z += offsetz;
|
||||
}
|
||||
if(trainlisttest.list[code].children[1].rotalist.length > 0 || trainlisttest.list[code].children[2].rotalist.length > 0 || trainlisttest.list[code].children[3].rotalist.length > 0 || trainlisttest.list[code].children[4].rotalist.length > 0|| trainlisttest.list[code].children[5].rotalist.length > 0){
|
||||
for(let rs = 1;rs<6;rs++){
|
||||
//console.log(rs);
|
||||
if(trainlisttest.list[code].children[rs].rotalist[0]){
|
||||
let offsetz = parseFloat(trainlisttest.list[code].children[rs].rotalist[0].posr.z) - parseFloat(trainlisttest.list[code].children[rs].matrixWorld.elements[14]);
|
||||
|
||||
trainlisttest.list[code].children[rs].position.z += offsetz;
|
||||
|
||||
for(let xh=0;xh<trainlisttest.list[code].children[rs].rotalist.length;xh++){
|
||||
if((trainlisttest.list[code].children[rs].matrixWorld.elements[12])>=trainlisttest.list[code].children[rs].rotalist[0].posr.x){
|
||||
// if(trainlisttest.list[code].groupNumber == "005"){
|
||||
// console.log("rs:"+rs);
|
||||
// console.log(trainlisttest.list[code].children[rs].matrixWorld.elements[12]);
|
||||
// console.log(trainlisttest.list[code].children[rs].rotalist[0].posr.x);
|
||||
// }
|
||||
if(rs != 5){
|
||||
let asd = trainlisttest.list[code].children[rs].rotalist[0];
|
||||
trainlisttest.list[code].children[rs+1].rotalist.push(asd);
|
||||
|
||||
}
|
||||
|
||||
trainlisttest.list[code].children[rs].rotation.z = trainlisttest.list[code].children[rs].rotalist[0].rota;
|
||||
trainlisttest.list[code].children[rs].rotalist.splice(0,1)
|
||||
xh--;
|
||||
}else{
|
||||
xh = trainlisttest.list[code].children[rs].rotalist.length;
|
||||
}
|
||||
}
|
||||
//console.log(trainlisttest.list[code].children[rs].rotalist.length);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
} else if (data.right == '0') { // 向左
|
||||
trainlisttest.list[code].right = '0';
|
||||
trainlisttest.list[code].progress = 1-data.offset;
|
||||
// trainlisttest.list[code].isstandsection = rails.sectionrail[data.section].standTrack;
|
||||
// if(rails.sectionrail[data.section].standTrack){
|
||||
// trainlisttest.list[code].statsstop = 0;
|
||||
// }
|
||||
let point = rails.sectionrail[data.section].lineright.getPointAt(trainlisttest.list[code].progress);
|
||||
|
||||
trainlisttest.list[code].rotation.y = Math.PI;
|
||||
trainlisttest.list[code].position.x = point.x;
|
||||
trainlisttest.list[code].position.y = 0;
|
||||
|
||||
// for (let tl=0; tl<6; tl++) {
|
||||
// trainlisttest.list[code].children[tl].position.z = parseFloat(-point.z);
|
||||
// }
|
||||
|
||||
// trainlisttest.list[code].curve = rails.sectionrail[data.section].lineright;
|
||||
// if(data.next){
|
||||
// trainlisttest.list[code].nextcode = data.next;
|
||||
// trainlisttest.list[code].nextcurve = rails.sectionrail[data.next].lineright;
|
||||
// trainlisttest.list[code].nextlen = rails.sectionrail[data.next].lengthfact;
|
||||
// }
|
||||
// trainlisttest.list[code].len = rails.sectionrail[data.section].lengthfact;
|
||||
trainlisttest.list[code].status = '0';
|
||||
if(-trainlisttest.list[code].children[0].position.z != point.z){
|
||||
|
||||
|
||||
trainlisttest.list[code].children[0].up = new THREE.Vector3(-1,0,0);
|
||||
let tangent = rails.sectionrail[data.section].lineright.getTangentAt(data.offset).normalize();
|
||||
if(trainlisttest.list[code].children[0].position.z != point.z){
|
||||
trainlisttest.list[code].children[0].up = new THREE.Vector3(1,0,0);
|
||||
let tangent = rails.sectionrail[data.section].lineleft.getTangentAt(data.offset).normalize();
|
||||
trainlisttest.list[code].children[0].axis.crossVectors(trainlisttest.list[code].children[0].up, tangent).normalize();
|
||||
let radians = Math.acos(trainlisttest.list[code].children[0].up.dot(tangent));
|
||||
trainlisttest.list[code].children[0].quaternion.setFromAxisAngle(trainlisttest.list[code].children[0].axis, radians);
|
||||
trainlisttest.list[code].children[0].rotation.x = -Math.PI/2;
|
||||
trainlisttest.list[code].children[0].rotation.z = trainlisttest.list[code].children[0].rotation.y;
|
||||
trainlisttest.list[code].children[0].rotation.y = 0;
|
||||
|
||||
let rotas = {
|
||||
posr:point,
|
||||
rota:trainlisttest.list[code].children[0].rotation.z
|
||||
}
|
||||
trainlisttest.list[code].children[1].rotalist.push(rotas);
|
||||
let offsetz = point.z + trainlisttest.list[code].children[0].position.z;
|
||||
trainlisttest.list[code].children[0].position.z -= offsetz;
|
||||
// trainlisttest.list[code].position.z = point.z;
|
||||
|
||||
}
|
||||
if(trainlisttest.list[code].children[1].rotalist.length > 0 || trainlisttest.list[code].children[2].rotalist.length > 0 || trainlisttest.list[code].children[3].rotalist.length > 0 || trainlisttest.list[code].children[4].rotalist.length > 0|| trainlisttest.list[code].children[5].rotalist.length > 0){
|
||||
|
||||
for(let rs = 1;rs<6;rs++){
|
||||
let offsetz = parseFloat(point.z) - parseFloat(trainlisttest.list[code].children[0].position.z);
|
||||
trainlisttest.list[code].children[0].position.z += offsetz;
|
||||
}
|
||||
if(trainlisttest.list[code].children[1].rotalist.length > 0 || trainlisttest.list[code].children[2].rotalist.length > 0 || trainlisttest.list[code].children[3].rotalist.length > 0 || trainlisttest.list[code].children[4].rotalist.length > 0|| trainlisttest.list[code].children[5].rotalist.length > 0){
|
||||
for(let rs = 1;rs<6;rs++){
|
||||
//console.log(rs);
|
||||
if(trainlisttest.list[code].children[rs].rotalist[0]){
|
||||
let offsetz = parseFloat(trainlisttest.list[code].children[rs].rotalist[0].posr.z) - parseFloat(trainlisttest.list[code].children[rs].matrixWorld.elements[14]);
|
||||
|
||||
let offsetz = parseFloat(trainlisttest.list[code].children[rs].rotalist[0].posr.z) + parseFloat(trainlisttest.list[code].children[rs].position.z);
|
||||
trainlisttest.list[code].children[rs].position.z -= offsetz;
|
||||
trainlisttest.list[code].children[rs].position.z += offsetz;
|
||||
|
||||
for(let xh=0;xh<trainlisttest.list[code].children[rs].rotalist.length;xh++){
|
||||
if((trainlisttest.list[code].children[rs].matrixWorld.elements[12])<=trainlisttest.list[code].children[rs].rotalist[0].posr.x){
|
||||
|
||||
if((trainlisttest.list[code].children[rs].matrixWorld.elements[12])>=trainlisttest.list[code].children[rs].rotalist[0].posr.x){
|
||||
// if(trainlisttest.list[code].groupNumber == "005"){
|
||||
// console.log("rs:"+rs);
|
||||
// console.log(trainlisttest.list[code].children[rs].matrixWorld.elements[12]);
|
||||
// console.log(trainlisttest.list[code].children[rs].rotalist[0].posr.x);
|
||||
// }
|
||||
if(rs != 5){
|
||||
let asd = trainlisttest.list[code].children[rs].rotalist[0];
|
||||
trainlisttest.list[code].children[rs+1].rotalist.push(asd);
|
||||
|
||||
}
|
||||
//let offsetx = trainlisttest.list[code].children[1].matrixWorld.elements[12]-trainlisttest.list[code].children[0].children[3].matrixWorld.elements[12];
|
||||
|
||||
trainlisttest.list[code].children[rs].rotation.z = trainlisttest.list[code].children[rs].rotalist[0].rota;
|
||||
trainlisttest.list[code].children[rs].rotalist.splice(0,1)
|
||||
@ -503,17 +424,101 @@ export function Maintainerconnect(jlmap3d,routegroup,jsonwebwork,lablecodemap) {
|
||||
}
|
||||
}
|
||||
//console.log(trainlisttest.list[code].children[rs].rotalist.length);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
} else if (data.right == '0') { // 向左
|
||||
trainlisttest.list[code].right = '0';
|
||||
trainlisttest.list[code].progress = 1-data.offset;
|
||||
// trainlisttest.list[code].isstandsection = rails.sectionrail[data.section].standTrack;
|
||||
// if(rails.sectionrail[data.section].standTrack){
|
||||
// trainlisttest.list[code].statsstop = 0;
|
||||
// }
|
||||
let point = rails.sectionrail[data.section].lineright.getPointAt(trainlisttest.list[code].progress);
|
||||
|
||||
trainlisttest.list[code].rotation.y = Math.PI;
|
||||
trainlisttest.list[code].position.x = point.x;
|
||||
trainlisttest.list[code].position.y = 0;
|
||||
|
||||
// for (let tl=0; tl<6; tl++) {
|
||||
// trainlisttest.list[code].children[tl].position.z = parseFloat(-point.z);
|
||||
// }
|
||||
|
||||
// trainlisttest.list[code].curve = rails.sectionrail[data.section].lineright;
|
||||
// if(data.next){
|
||||
// trainlisttest.list[code].nextcode = data.next;
|
||||
// trainlisttest.list[code].nextcurve = rails.sectionrail[data.next].lineright;
|
||||
// trainlisttest.list[code].nextlen = rails.sectionrail[data.next].lengthfact;
|
||||
// }
|
||||
// trainlisttest.list[code].len = rails.sectionrail[data.section].lengthfact;
|
||||
trainlisttest.list[code].status = '0';
|
||||
if(-trainlisttest.list[code].children[0].position.z != point.z){
|
||||
|
||||
|
||||
trainlisttest.list[code].children[0].up = new THREE.Vector3(-1,0,0);
|
||||
let tangent = rails.sectionrail[data.section].lineright.getTangentAt(data.offset).normalize();
|
||||
trainlisttest.list[code].children[0].axis.crossVectors(trainlisttest.list[code].children[0].up, tangent).normalize();
|
||||
let radians = Math.acos(trainlisttest.list[code].children[0].up.dot(tangent));
|
||||
trainlisttest.list[code].children[0].quaternion.setFromAxisAngle(trainlisttest.list[code].children[0].axis, radians);
|
||||
trainlisttest.list[code].children[0].rotation.x = -Math.PI/2;
|
||||
trainlisttest.list[code].children[0].rotation.z = trainlisttest.list[code].children[0].rotation.y;
|
||||
trainlisttest.list[code].children[0].rotation.y = 0;
|
||||
|
||||
let rotas = {
|
||||
posr:point,
|
||||
rota:trainlisttest.list[code].children[0].rotation.z
|
||||
}
|
||||
trainlisttest.list[code].children[1].rotalist.push(rotas);
|
||||
let offsetz = point.z + trainlisttest.list[code].children[0].position.z;
|
||||
trainlisttest.list[code].children[0].position.z -= offsetz;
|
||||
// trainlisttest.list[code].position.z = point.z;
|
||||
|
||||
}
|
||||
// console.log(trainlisttest.list[code].rotalist);
|
||||
if(trainlisttest.list[code].children[1].rotalist.length > 0 || trainlisttest.list[code].children[2].rotalist.length > 0 || trainlisttest.list[code].children[3].rotalist.length > 0 || trainlisttest.list[code].children[4].rotalist.length > 0|| trainlisttest.list[code].children[5].rotalist.length > 0){
|
||||
|
||||
for(let rs = 1;rs<6;rs++){
|
||||
//console.log(rs);
|
||||
if(trainlisttest.list[code].children[rs].rotalist[0]){
|
||||
|
||||
let offsetz = parseFloat(trainlisttest.list[code].children[rs].rotalist[0].posr.z) + parseFloat(trainlisttest.list[code].children[rs].position.z);
|
||||
trainlisttest.list[code].children[rs].position.z -= offsetz;
|
||||
|
||||
for(let xh=0;xh<trainlisttest.list[code].children[rs].rotalist.length;xh++){
|
||||
if((trainlisttest.list[code].children[rs].matrixWorld.elements[12])<=trainlisttest.list[code].children[rs].rotalist[0].posr.x){
|
||||
|
||||
if(rs != 5){
|
||||
let asd = trainlisttest.list[code].children[rs].rotalist[0];
|
||||
trainlisttest.list[code].children[rs+1].rotalist.push(asd);
|
||||
|
||||
}
|
||||
//let offsetx = trainlisttest.list[code].children[1].matrixWorld.elements[12]-trainlisttest.list[code].children[0].children[3].matrixWorld.elements[12];
|
||||
|
||||
trainlisttest.list[code].children[rs].rotation.z = trainlisttest.list[code].children[rs].rotalist[0].rota;
|
||||
trainlisttest.list[code].children[rs].rotalist.splice(0,1)
|
||||
xh--;
|
||||
}else{
|
||||
xh = trainlisttest.list[code].children[rs].rotalist.length;
|
||||
}
|
||||
}
|
||||
//console.log(trainlisttest.list[code].children[rs].rotalist.length);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
// console.log(trainlisttest.list[code].rotalist);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}else{
|
||||
trainlisttest.list[code].position.x = -100000;
|
||||
}
|
||||
|
||||
}
|
||||
function trainrun(data){
|
||||
let code = data.code;
|
||||
@ -871,95 +876,75 @@ export function Maintainerconnect(jlmap3d,routegroup,jsonwebwork,lablecodemap) {
|
||||
|
||||
function signalupdate(data) {
|
||||
code = data.code;
|
||||
if(data.command == 'No'){
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
if(signallist.list[code]){
|
||||
if(data.command == 'No'){
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
}
|
||||
/** 红 */
|
||||
if(data.command == 'R'){
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials["red"];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
}
|
||||
/** 绿 */
|
||||
if(data.command == 'G'){
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials["green"];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
}
|
||||
/** 黄 */
|
||||
if(data.command == 'Y'){
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["yellow"];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
}
|
||||
/** 月白 */
|
||||
if(data.command == 'W'){
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
}
|
||||
/** 蓝 */
|
||||
if(data.command == 'B'){
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
}
|
||||
/** 红黄 */
|
||||
if(data.command == 'RY'){
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials["red"];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["yellow"];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
}
|
||||
}
|
||||
/** 红 */
|
||||
if(data.command == 'R'){
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials["red"];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
}
|
||||
/** 绿 */
|
||||
if(data.command == 'G'){
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials["green"];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
}
|
||||
/** 黄 */
|
||||
if(data.command == 'Y'){
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["yellow"];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
}
|
||||
/** 月白 */
|
||||
if(data.command == 'W'){
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
}
|
||||
/** 蓝 */
|
||||
if(data.command == 'B'){
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
}
|
||||
/** 红黄 */
|
||||
if(data.command == 'RY'){
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials["red"];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["yellow"];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function initswitch(data) {
|
||||
code = data.code;
|
||||
if (data.command == 'NP') {
|
||||
// sectionlist.switchs.modellist[j].normal = data.normal;
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = 0;
|
||||
actions[code].action.timeScale = 1;
|
||||
actions[code].action.play();
|
||||
actions[code].command = data.command;
|
||||
} else if (data.command == 'RP') {
|
||||
// sectionlist.switchs.modellist[j].normal = data.normal;
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = actions[code].action._clip.duration;
|
||||
actions[code].action.timeScale = -1;
|
||||
actions[code].action.play();
|
||||
actions[code].command = data.command;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function switchupdate(data) {
|
||||
code = data.code;
|
||||
|
||||
if (actions[code].command != data.command) {
|
||||
if(actions[code]){
|
||||
if (data.command == 'NP') {
|
||||
// sectionlist.switchs.modellist[j].normal = data.normal;
|
||||
actions[code].action.reset();
|
||||
@ -976,6 +961,32 @@ export function Maintainerconnect(jlmap3d,routegroup,jsonwebwork,lablecodemap) {
|
||||
actions[code].command = data.command;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function switchupdate(data) {
|
||||
code = data.code;
|
||||
if(actions[code]){
|
||||
if (actions[code].command != data.command) {
|
||||
if (data.command == 'NP') {
|
||||
// sectionlist.switchs.modellist[j].normal = data.normal;
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = 0;
|
||||
actions[code].action.timeScale = 1;
|
||||
actions[code].action.play();
|
||||
actions[code].command = data.command;
|
||||
} else if (data.command == 'RP') {
|
||||
// sectionlist.switchs.modellist[j].normal = data.normal;
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = actions[code].action._clip.duration;
|
||||
actions[code].action.timeScale = -1;
|
||||
actions[code].action.play();
|
||||
actions[code].command = data.command;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
function simulationreset(data){
|
||||
for(let i=0;i<trainlisttest.group.children.length;i++){
|
||||
|
@ -165,256 +165,169 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
|
||||
|
||||
function trainRunNew(data){
|
||||
let code = data.code;
|
||||
if(trainlisttest.list[code].right != data.right){
|
||||
if(data.right == "0"){
|
||||
if(rails.sectionrail[data.section]){
|
||||
if(trainlisttest.list[code].right != data.right){
|
||||
if(data.right == "0"){
|
||||
|
||||
trainlisttest.list[code].right = "0";
|
||||
trainlisttest.list[code].rotation.y = Math.PI;
|
||||
let point = rails.sectionrail[data.section].lineleft.getPointAt(data.offset);
|
||||
trainlisttest.list[code].children[0].rotalist = [];
|
||||
trainlisttest.list[code].right = "0";
|
||||
trainlisttest.list[code].rotation.y = Math.PI;
|
||||
let point = rails.sectionrail[data.section].lineleft.getPointAt(data.offset);
|
||||
trainlisttest.list[code].children[0].rotalist = [];
|
||||
|
||||
trainlisttest.list[code].children[0].position.z = parseFloat(-point.z);
|
||||
trainlisttest.list[code].children[0].position.z = parseFloat(-point.z);
|
||||
|
||||
for (let tl=1; tl<trainlisttest.list[code].children.length; tl++) {
|
||||
trainlisttest.list[code].children[tl].rotalist = [];
|
||||
trainlisttest.list[code].children[tl].position.z = trainlisttest.list[code].children[0].position.z;
|
||||
}
|
||||
|
||||
if(trainlisttest.list[code].openleft == "1"){
|
||||
trainlisttest.list[code].openleft = "0";
|
||||
for(let an=actions[code].top.length-1;an>=0;an--){
|
||||
actions[code].top[an].stop();
|
||||
for (let tl=1; tl<trainlisttest.list[code].children.length; tl++) {
|
||||
trainlisttest.list[code].children[tl].rotalist = [];
|
||||
trainlisttest.list[code].children[tl].position.z = trainlisttest.list[code].children[0].position.z;
|
||||
}
|
||||
trainlisttest.list[code].openright = "1";
|
||||
for(let an=actions[code].down.length-1;an>=0;an--){
|
||||
actions[code].down[an].reset();
|
||||
actions[code].down[an].time = actions[code].down[an]._clip.duration;
|
||||
actions[code].down[an].timeScale = 1;
|
||||
actions[code].down[an].play();
|
||||
}
|
||||
}else if(trainlisttest.list[code].openright == "1"){
|
||||
trainlisttest.list[code].openright = "0";
|
||||
for(let an=actions[code].down.length-1;an>=0;an--){
|
||||
actions[code].down[an].stop();
|
||||
}
|
||||
trainlisttest.list[code].openleft = "1";
|
||||
for(let an=actions[code].top.length-1;an>=0;an--){
|
||||
actions[code].top[an].reset();
|
||||
actions[code].top[an].time = actions[code].top[an]._clip.duration;
|
||||
actions[code].top[an].timeScale = 1;
|
||||
actions[code].top[an].play();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if(data.right == "1"){
|
||||
trainlisttest.list[code].right = "1";
|
||||
trainlisttest.list[code].rotation.y = 0;
|
||||
let point = rails.sectionrail[data.section].lineleft.getPointAt(data.offset);
|
||||
trainlisttest.list[code].position.x = point.x;
|
||||
trainlisttest.list[code].children[0].rotalist = [];
|
||||
trainlisttest.list[code].children[0].position.z = parseFloat(point.z);
|
||||
for (let tl=1; tl<trainlisttest.list[code].children.length; tl++) {
|
||||
trainlisttest.list[code].children[tl].rotalist = [];
|
||||
trainlisttest.list[code].children[tl].position.z = trainlisttest.list[code].children[0].position.z;
|
||||
}
|
||||
|
||||
if(trainlisttest.list[code].openleft == "1"){
|
||||
trainlisttest.list[code].openleft = "0";
|
||||
for(let an=actions[code].top.length-1;an>=0;an--){
|
||||
actions[code].top[an].stop();
|
||||
}
|
||||
trainlisttest.list[code].openright = "1";
|
||||
for(let an=actions[code].down.length-1;an>=0;an--){
|
||||
actions[code].down[an].reset();
|
||||
actions[code].down[an].time = actions[code].down[an]._clip.duration;
|
||||
actions[code].down[an].timeScale = 1;
|
||||
actions[code].down[an].play();
|
||||
}
|
||||
}else if(trainlisttest.list[code].openright == "1"){
|
||||
trainlisttest.list[code].openright = "0";
|
||||
for(let an=actions[code].down.length-1;an>=0;an--){
|
||||
actions[code].down[an].stop();
|
||||
}
|
||||
trainlisttest.list[code].openleft = "1";
|
||||
for(let an=actions[code].top.length-1;an>=0;an--){
|
||||
actions[code].top[an].reset();
|
||||
actions[code].top[an].time = actions[code].top[an]._clip.duration;
|
||||
actions[code].top[an].timeScale = 1;
|
||||
actions[code].top[an].play();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// console.log(data);
|
||||
|
||||
if(trainlisttest.list[code].dispose == "0"){
|
||||
if (data.right == '1') { // 向右
|
||||
trainlisttest.list[code].right = '1';
|
||||
trainlisttest.list[code].progress = data.offset;
|
||||
// trainlisttest.list[code].isstandsection = rails.sectionrail[data.section].standTrack;
|
||||
// if(rails.sectionrail[data.section].standTrack){
|
||||
// trainlisttest.list[code].statsstop = 0;
|
||||
// }
|
||||
let point = rails.sectionrail[data.section].lineleft.getPointAt(trainlisttest.list[code].progress);
|
||||
trainlisttest.list[code].rotation.y = 0;
|
||||
trainlisttest.list[code].position.x = point.x;
|
||||
trainlisttest.list[code].position.y = 0;
|
||||
|
||||
// for (let tl=0; tl<trainlisttest.list[code].children.length; tl++) {
|
||||
// trainlisttest.list[code].children[tl].position.z = parseFloat(point.z);
|
||||
// }
|
||||
|
||||
// trainlisttest.list[code].curve = rails.sectionrail[data.section].lineleft;
|
||||
|
||||
// if(data.next){
|
||||
// trainlisttest.list[code].nextcode = data.next;
|
||||
// trainlisttest.list[code].nextcurve = rails.sectionrail[data.next].lineleft;
|
||||
// trainlisttest.list[code].nextlen = rails.sectionrail[data.next].lengthfact;
|
||||
// }
|
||||
// trainlisttest.list[code].len = rails.sectionrail[data.section].lengthfact;
|
||||
trainlisttest.list[code].status = '1';
|
||||
if(trainlisttest.list[code].children[0].position.z != point.z || trainlisttest.list[code].children[0].position.y != point.y){
|
||||
|
||||
trainlisttest.list[code].children[0].up = new THREE.Vector3(1,0,0);
|
||||
let tangent = rails.sectionrail[data.section].lineleft.getTangentAt(data.offset).normalize();
|
||||
trainlisttest.list[code].children[0].axis.crossVectors(trainlisttest.list[code].children[0].up, tangent).normalize();
|
||||
let radians = Math.acos(trainlisttest.list[code].children[0].up.dot(tangent));
|
||||
trainlisttest.list[code].children[0].quaternion.setFromAxisAngle(trainlisttest.list[code].children[0].axis, radians);
|
||||
|
||||
|
||||
trainlisttest.list[code].children[0].rotation.x = -Math.PI/2;
|
||||
let newRotationZ = trainlisttest.list[code].children[0].rotation.z;
|
||||
trainlisttest.list[code].children[0].rotation.z = trainlisttest.list[code].children[0].rotation.y;
|
||||
trainlisttest.list[code].children[0].rotation.y = -newRotationZ;
|
||||
// trainlisttest.list[code].children[0].rotation.y = -newRotationZ;
|
||||
let rotas = {
|
||||
posr:point,
|
||||
roty:trainlisttest.list[code].children[0].rotation.y,
|
||||
rotz:trainlisttest.list[code].children[0].rotation.z
|
||||
}
|
||||
trainlisttest.list[code].children[1].rotalist.push(rotas);
|
||||
|
||||
|
||||
let offsetz = parseFloat(point.z) - parseFloat(trainlisttest.list[code].children[0].position.z);
|
||||
trainlisttest.list[code].children[0].position.z += offsetz;
|
||||
let offsety = parseFloat(point.y) - parseFloat(trainlisttest.list[code].children[0].position.y);
|
||||
trainlisttest.list[code].children[0].position.y += offsety;
|
||||
}
|
||||
// if(trainlisttest.list[code].children[1].rotalist.length > 0 || trainlisttest.list[code].children[2].rotalist.length > 0 || trainlisttest.list[code].children[3].rotalist.length > 0 || trainlisttest.list[code].children[4].rotalist.length > 0|| trainlisttest.list[code].children[5].rotalist.length > 0){
|
||||
for(let rs = 1;rs<trainlisttest.list[code].children.length;rs++){
|
||||
//console.log(rs);
|
||||
if(trainlisttest.list[code].children[rs].rotalist[0]){
|
||||
let offsetz = parseFloat(trainlisttest.list[code].children[rs].rotalist[0].posr.z) - parseFloat(trainlisttest.list[code].children[rs].matrixWorld.elements[14]);
|
||||
trainlisttest.list[code].children[rs].position.z += offsetz;
|
||||
let offsety = parseFloat(trainlisttest.list[code].children[rs].rotalist[0].posr.y) - parseFloat(trainlisttest.list[code].children[rs].matrixWorld.elements[13]);
|
||||
trainlisttest.list[code].children[rs].position.y += offsety;
|
||||
|
||||
for(let xh=0;xh<trainlisttest.list[code].children[rs].rotalist.length;xh++){
|
||||
if((trainlisttest.list[code].children[rs].matrixWorld.elements[12])>=trainlisttest.list[code].children[rs].rotalist[0].posr.x){
|
||||
// if(trainlisttest.list[code].groupNumber == "005"){
|
||||
// console.log("rs:"+rs);
|
||||
// console.log(trainlisttest.list[code].children[rs].matrixWorld.elements[12]);
|
||||
// console.log(trainlisttest.list[code].children[rs].rotalist[0].posr.x);
|
||||
// }
|
||||
if(rs != (trainlisttest.list[code].children.length-1)){
|
||||
let asd = trainlisttest.list[code].children[rs].rotalist[0];
|
||||
trainlisttest.list[code].children[rs+1].rotalist.push(asd);
|
||||
|
||||
}
|
||||
|
||||
trainlisttest.list[code].children[rs].rotation.z = trainlisttest.list[code].children[rs].rotalist[0].rotz;
|
||||
trainlisttest.list[code].children[rs].rotation.y = trainlisttest.list[code].children[rs].rotalist[0].roty;
|
||||
trainlisttest.list[code].children[rs].rotalist.splice(0,1)
|
||||
xh--;
|
||||
}else{
|
||||
xh = trainlisttest.list[code].children[rs].rotalist.length;
|
||||
}
|
||||
}
|
||||
//console.log(trainlisttest.list[code].children[rs].rotalist.length);
|
||||
if(trainlisttest.list[code].openleft == "1"){
|
||||
trainlisttest.list[code].openleft = "0";
|
||||
for(let an=actions[code].top.length-1;an>=0;an--){
|
||||
actions[code].top[an].stop();
|
||||
}
|
||||
trainlisttest.list[code].openright = "1";
|
||||
for(let an=actions[code].down.length-1;an>=0;an--){
|
||||
actions[code].down[an].reset();
|
||||
actions[code].down[an].time = actions[code].down[an]._clip.duration;
|
||||
actions[code].down[an].timeScale = 1;
|
||||
actions[code].down[an].play();
|
||||
}
|
||||
}else if(trainlisttest.list[code].openright == "1"){
|
||||
trainlisttest.list[code].openright = "0";
|
||||
for(let an=actions[code].down.length-1;an>=0;an--){
|
||||
actions[code].down[an].stop();
|
||||
}
|
||||
trainlisttest.list[code].openleft = "1";
|
||||
for(let an=actions[code].top.length-1;an>=0;an--){
|
||||
actions[code].top[an].reset();
|
||||
actions[code].top[an].time = actions[code].top[an]._clip.duration;
|
||||
actions[code].top[an].timeScale = 1;
|
||||
actions[code].top[an].play();
|
||||
}
|
||||
}
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
if(data.right == "1"){
|
||||
trainlisttest.list[code].right = "1";
|
||||
trainlisttest.list[code].rotation.y = 0;
|
||||
let point = rails.sectionrail[data.section].lineleft.getPointAt(data.offset);
|
||||
trainlisttest.list[code].position.x = point.x;
|
||||
trainlisttest.list[code].children[0].rotalist = [];
|
||||
trainlisttest.list[code].children[0].position.z = parseFloat(point.z);
|
||||
for (let tl=1; tl<trainlisttest.list[code].children.length; tl++) {
|
||||
trainlisttest.list[code].children[tl].rotalist = [];
|
||||
trainlisttest.list[code].children[tl].position.z = trainlisttest.list[code].children[0].position.z;
|
||||
}
|
||||
|
||||
} else if (data.right == '0') { // 向左
|
||||
if(trainlisttest.list[code].openleft == "1"){
|
||||
trainlisttest.list[code].openleft = "0";
|
||||
for(let an=actions[code].top.length-1;an>=0;an--){
|
||||
actions[code].top[an].stop();
|
||||
}
|
||||
trainlisttest.list[code].openright = "1";
|
||||
for(let an=actions[code].down.length-1;an>=0;an--){
|
||||
actions[code].down[an].reset();
|
||||
actions[code].down[an].time = actions[code].down[an]._clip.duration;
|
||||
actions[code].down[an].timeScale = 1;
|
||||
actions[code].down[an].play();
|
||||
}
|
||||
}else if(trainlisttest.list[code].openright == "1"){
|
||||
trainlisttest.list[code].openright = "0";
|
||||
for(let an=actions[code].down.length-1;an>=0;an--){
|
||||
actions[code].down[an].stop();
|
||||
}
|
||||
trainlisttest.list[code].openleft = "1";
|
||||
for(let an=actions[code].top.length-1;an>=0;an--){
|
||||
actions[code].top[an].reset();
|
||||
actions[code].top[an].time = actions[code].top[an]._clip.duration;
|
||||
actions[code].top[an].timeScale = 1;
|
||||
actions[code].top[an].play();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
trainlisttest.list[code].right = '0';
|
||||
trainlisttest.list[code].progress = 1-data.offset;
|
||||
// trainlisttest.list[code].isstandsection = rails.sectionrail[data.section].standTrack;
|
||||
// if(rails.sectionrail[data.section].standTrack){
|
||||
// trainlisttest.list[code].statsstop = 0;
|
||||
// }
|
||||
let point = rails.sectionrail[data.section].lineright.getPointAt(trainlisttest.list[code].progress);
|
||||
// console.log(data);
|
||||
|
||||
trainlisttest.list[code].rotation.y = Math.PI;
|
||||
trainlisttest.list[code].position.x = point.x;
|
||||
trainlisttest.list[code].position.y = 0;
|
||||
if(trainlisttest.list[code].dispose == "0"){
|
||||
if (data.right == '1') { // 向右
|
||||
trainlisttest.list[code].right = '1';
|
||||
trainlisttest.list[code].progress = data.offset;
|
||||
// trainlisttest.list[code].isstandsection = rails.sectionrail[data.section].standTrack;
|
||||
// if(rails.sectionrail[data.section].standTrack){
|
||||
// trainlisttest.list[code].statsstop = 0;
|
||||
// }
|
||||
let point = rails.sectionrail[data.section].lineleft.getPointAt(trainlisttest.list[code].progress);
|
||||
trainlisttest.list[code].rotation.y = 0;
|
||||
trainlisttest.list[code].position.x = point.x;
|
||||
trainlisttest.list[code].position.y = 0;
|
||||
|
||||
// for (let tl=0; tl<trainlisttest.list[code].children.length; tl++) {
|
||||
// trainlisttest.list[code].children[tl].position.z = parseFloat(-point.z);
|
||||
// }
|
||||
// for (let tl=0; tl<trainlisttest.list[code].children.length; tl++) {
|
||||
// trainlisttest.list[code].children[tl].position.z = parseFloat(point.z);
|
||||
// }
|
||||
|
||||
// trainlisttest.list[code].curve = rails.sectionrail[data.section].lineright;
|
||||
// if(data.next){
|
||||
// trainlisttest.list[code].nextcode = data.next;
|
||||
// trainlisttest.list[code].nextcurve = rails.sectionrail[data.next].lineright;
|
||||
// trainlisttest.list[code].nextlen = rails.sectionrail[data.next].lengthfact;
|
||||
// }
|
||||
// trainlisttest.list[code].len = rails.sectionrail[data.section].lengthfact;
|
||||
trainlisttest.list[code].status = '0';
|
||||
// trainlisttest.list[code].curve = rails.sectionrail[data.section].lineleft;
|
||||
|
||||
if(-trainlisttest.list[code].children[0].position.z != point.z || trainlisttest.list[code].children[0].position.y != point.y){
|
||||
// if(data.next){
|
||||
// trainlisttest.list[code].nextcode = data.next;
|
||||
// trainlisttest.list[code].nextcurve = rails.sectionrail[data.next].lineleft;
|
||||
// trainlisttest.list[code].nextlen = rails.sectionrail[data.next].lengthfact;
|
||||
// }
|
||||
// trainlisttest.list[code].len = rails.sectionrail[data.section].lengthfact;
|
||||
trainlisttest.list[code].status = '1';
|
||||
if(trainlisttest.list[code].children[0].position.z != point.z || trainlisttest.list[code].children[0].position.y != point.y){
|
||||
|
||||
|
||||
trainlisttest.list[code].children[0].up = new THREE.Vector3(-1,0,0);
|
||||
let tangent = rails.sectionrail[data.section].lineright.getTangentAt(data.offset).normalize();
|
||||
trainlisttest.list[code].children[0].up = new THREE.Vector3(1,0,0);
|
||||
let tangent = rails.sectionrail[data.section].lineleft.getTangentAt(data.offset).normalize();
|
||||
trainlisttest.list[code].children[0].axis.crossVectors(trainlisttest.list[code].children[0].up, tangent).normalize();
|
||||
let radians = Math.acos(trainlisttest.list[code].children[0].up.dot(tangent));
|
||||
trainlisttest.list[code].children[0].quaternion.setFromAxisAngle(trainlisttest.list[code].children[0].axis, radians);
|
||||
|
||||
|
||||
trainlisttest.list[code].children[0].rotation.x = -Math.PI/2;
|
||||
let newRotationZ = trainlisttest.list[code].children[0].rotation.z;
|
||||
trainlisttest.list[code].children[0].rotation.z = trainlisttest.list[code].children[0].rotation.y;
|
||||
trainlisttest.list[code].children[0].rotation.y = 0;
|
||||
trainlisttest.list[code].children[0].rotation.y = -newRotationZ;
|
||||
|
||||
// trainlisttest.list[code].children[0].rotation.y = -newRotationZ;
|
||||
let rotas = {
|
||||
posr:point,
|
||||
roty:trainlisttest.list[code].children[0].rotation.y,
|
||||
rotz:trainlisttest.list[code].children[0].rotation.z
|
||||
}
|
||||
trainlisttest.list[code].children[1].rotalist.push(rotas);
|
||||
let offsetz = point.z + trainlisttest.list[code].children[0].position.z;
|
||||
trainlisttest.list[code].children[0].position.z -= offsetz;
|
||||
|
||||
|
||||
let offsetz = parseFloat(point.z) - parseFloat(trainlisttest.list[code].children[0].position.z);
|
||||
trainlisttest.list[code].children[0].position.z += offsetz;
|
||||
let offsety = parseFloat(point.y) - parseFloat(trainlisttest.list[code].children[0].position.y);
|
||||
trainlisttest.list[code].children[0].position.y += offsety;
|
||||
// trainlisttest.list[code].position.z = point.z;
|
||||
|
||||
}
|
||||
// if(trainlisttest.list[code].children[1].rotalist.length > 0 || trainlisttest.list[code].children[2].rotalist.length > 0 || trainlisttest.list[code].children[3].rotalist.length > 0 || trainlisttest.list[code].children[4].rotalist.length > 0|| trainlisttest.list[code].children[5].rotalist.length > 0){
|
||||
|
||||
for(let rs = 1;rs<trainlisttest.list[code].children.length;rs++){
|
||||
}
|
||||
// if(trainlisttest.list[code].children[1].rotalist.length > 0 || trainlisttest.list[code].children[2].rotalist.length > 0 || trainlisttest.list[code].children[3].rotalist.length > 0 || trainlisttest.list[code].children[4].rotalist.length > 0|| trainlisttest.list[code].children[5].rotalist.length > 0){
|
||||
for(let rs = 1;rs<trainlisttest.list[code].children.length;rs++){
|
||||
//console.log(rs);
|
||||
if(trainlisttest.list[code].children[rs].rotalist[0]){
|
||||
|
||||
let offsetz = parseFloat(trainlisttest.list[code].children[rs].rotalist[0].posr.z) + parseFloat(trainlisttest.list[code].children[rs].position.z);
|
||||
trainlisttest.list[code].children[rs].position.z -= offsetz;
|
||||
let offsetz = parseFloat(trainlisttest.list[code].children[rs].rotalist[0].posr.z) - parseFloat(trainlisttest.list[code].children[rs].matrixWorld.elements[14]);
|
||||
trainlisttest.list[code].children[rs].position.z += offsetz;
|
||||
let offsety = parseFloat(trainlisttest.list[code].children[rs].rotalist[0].posr.y) - parseFloat(trainlisttest.list[code].children[rs].matrixWorld.elements[13]);
|
||||
trainlisttest.list[code].children[rs].position.y += offsety;
|
||||
|
||||
for(let xh=0;xh<trainlisttest.list[code].children[rs].rotalist.length;xh++){
|
||||
if((trainlisttest.list[code].children[rs].matrixWorld.elements[12])<=trainlisttest.list[code].children[rs].rotalist[0].posr.x){
|
||||
|
||||
if((trainlisttest.list[code].children[rs].matrixWorld.elements[12])>=trainlisttest.list[code].children[rs].rotalist[0].posr.x){
|
||||
// if(trainlisttest.list[code].groupNumber == "005"){
|
||||
// console.log("rs:"+rs);
|
||||
// console.log(trainlisttest.list[code].children[rs].matrixWorld.elements[12]);
|
||||
// console.log(trainlisttest.list[code].children[rs].rotalist[0].posr.x);
|
||||
// }
|
||||
if(rs != (trainlisttest.list[code].children.length-1)){
|
||||
let asd = trainlisttest.list[code].children[rs].rotalist[0];
|
||||
trainlisttest.list[code].children[rs+1].rotalist.push(asd);
|
||||
|
||||
}
|
||||
let offsetx = trainlisttest.list[code].children[1].matrixWorld.elements[12]-trainlisttest.list[code].children[0].children[3].matrixWorld.elements[12];
|
||||
trainlisttest.list[code].children[rs].rotation.y = trainlisttest.list[code].children[rs].rotalist[0].roty;
|
||||
|
||||
trainlisttest.list[code].children[rs].rotation.z = trainlisttest.list[code].children[rs].rotalist[0].rotz;
|
||||
trainlisttest.list[code].children[rs].rotation.y = trainlisttest.list[code].children[rs].rotalist[0].roty;
|
||||
trainlisttest.list[code].children[rs].rotalist.splice(0,1)
|
||||
xh--;
|
||||
}else{
|
||||
@ -422,17 +335,109 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
|
||||
}
|
||||
}
|
||||
//console.log(trainlisttest.list[code].children[rs].rotalist.length);
|
||||
|
||||
}
|
||||
}
|
||||
// }
|
||||
|
||||
|
||||
|
||||
} else if (data.right == '0') { // 向左
|
||||
|
||||
trainlisttest.list[code].right = '0';
|
||||
trainlisttest.list[code].progress = 1-data.offset;
|
||||
// trainlisttest.list[code].isstandsection = rails.sectionrail[data.section].standTrack;
|
||||
// if(rails.sectionrail[data.section].standTrack){
|
||||
// trainlisttest.list[code].statsstop = 0;
|
||||
// }
|
||||
let point = rails.sectionrail[data.section].lineright.getPointAt(trainlisttest.list[code].progress);
|
||||
|
||||
trainlisttest.list[code].rotation.y = Math.PI;
|
||||
trainlisttest.list[code].position.x = point.x;
|
||||
trainlisttest.list[code].position.y = 0;
|
||||
|
||||
// for (let tl=0; tl<trainlisttest.list[code].children.length; tl++) {
|
||||
// trainlisttest.list[code].children[tl].position.z = parseFloat(-point.z);
|
||||
// }
|
||||
|
||||
// trainlisttest.list[code].curve = rails.sectionrail[data.section].lineright;
|
||||
// if(data.next){
|
||||
// trainlisttest.list[code].nextcode = data.next;
|
||||
// trainlisttest.list[code].nextcurve = rails.sectionrail[data.next].lineright;
|
||||
// trainlisttest.list[code].nextlen = rails.sectionrail[data.next].lengthfact;
|
||||
// }
|
||||
// trainlisttest.list[code].len = rails.sectionrail[data.section].lengthfact;
|
||||
trainlisttest.list[code].status = '0';
|
||||
|
||||
if(-trainlisttest.list[code].children[0].position.z != point.z || trainlisttest.list[code].children[0].position.y != point.y){
|
||||
|
||||
|
||||
trainlisttest.list[code].children[0].up = new THREE.Vector3(-1,0,0);
|
||||
let tangent = rails.sectionrail[data.section].lineright.getTangentAt(data.offset).normalize();
|
||||
trainlisttest.list[code].children[0].axis.crossVectors(trainlisttest.list[code].children[0].up, tangent).normalize();
|
||||
let radians = Math.acos(trainlisttest.list[code].children[0].up.dot(tangent));
|
||||
trainlisttest.list[code].children[0].quaternion.setFromAxisAngle(trainlisttest.list[code].children[0].axis, radians);
|
||||
trainlisttest.list[code].children[0].rotation.x = -Math.PI/2;
|
||||
let newRotationZ = trainlisttest.list[code].children[0].rotation.z;
|
||||
trainlisttest.list[code].children[0].rotation.z = trainlisttest.list[code].children[0].rotation.y;
|
||||
trainlisttest.list[code].children[0].rotation.y = 0;
|
||||
trainlisttest.list[code].children[0].rotation.y = -newRotationZ;
|
||||
|
||||
let rotas = {
|
||||
posr:point,
|
||||
roty:trainlisttest.list[code].children[0].rotation.y,
|
||||
rotz:trainlisttest.list[code].children[0].rotation.z
|
||||
}
|
||||
trainlisttest.list[code].children[1].rotalist.push(rotas);
|
||||
let offsetz = point.z + trainlisttest.list[code].children[0].position.z;
|
||||
trainlisttest.list[code].children[0].position.z -= offsetz;
|
||||
let offsety = parseFloat(point.y) - parseFloat(trainlisttest.list[code].children[0].position.y);
|
||||
trainlisttest.list[code].children[0].position.y += offsety;
|
||||
// trainlisttest.list[code].position.z = point.z;
|
||||
|
||||
}
|
||||
// console.log(trainlisttest.list[code].rotalist);
|
||||
// }
|
||||
// if(trainlisttest.list[code].children[1].rotalist.length > 0 || trainlisttest.list[code].children[2].rotalist.length > 0 || trainlisttest.list[code].children[3].rotalist.length > 0 || trainlisttest.list[code].children[4].rotalist.length > 0|| trainlisttest.list[code].children[5].rotalist.length > 0){
|
||||
|
||||
for(let rs = 1;rs<trainlisttest.list[code].children.length;rs++){
|
||||
//console.log(rs);
|
||||
if(trainlisttest.list[code].children[rs].rotalist[0]){
|
||||
|
||||
let offsetz = parseFloat(trainlisttest.list[code].children[rs].rotalist[0].posr.z) + parseFloat(trainlisttest.list[code].children[rs].position.z);
|
||||
trainlisttest.list[code].children[rs].position.z -= offsetz;
|
||||
let offsety = parseFloat(trainlisttest.list[code].children[rs].rotalist[0].posr.y) - parseFloat(trainlisttest.list[code].children[rs].matrixWorld.elements[13]);
|
||||
trainlisttest.list[code].children[rs].position.y += offsety;
|
||||
|
||||
for(let xh=0;xh<trainlisttest.list[code].children[rs].rotalist.length;xh++){
|
||||
if((trainlisttest.list[code].children[rs].matrixWorld.elements[12])<=trainlisttest.list[code].children[rs].rotalist[0].posr.x){
|
||||
|
||||
if(rs != (trainlisttest.list[code].children.length-1)){
|
||||
let asd = trainlisttest.list[code].children[rs].rotalist[0];
|
||||
trainlisttest.list[code].children[rs+1].rotalist.push(asd);
|
||||
}
|
||||
let offsetx = trainlisttest.list[code].children[1].matrixWorld.elements[12]-trainlisttest.list[code].children[0].children[3].matrixWorld.elements[12];
|
||||
trainlisttest.list[code].children[rs].rotation.y = trainlisttest.list[code].children[rs].rotalist[0].roty;
|
||||
trainlisttest.list[code].children[rs].rotation.z = trainlisttest.list[code].children[rs].rotalist[0].rotz;
|
||||
trainlisttest.list[code].children[rs].rotalist.splice(0,1)
|
||||
xh--;
|
||||
}else{
|
||||
xh = trainlisttest.list[code].children[rs].rotalist.length;
|
||||
}
|
||||
}
|
||||
//console.log(trainlisttest.list[code].children[rs].rotalist.length);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
// console.log(trainlisttest.list[code].rotalist);
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}else{
|
||||
trainlisttest.list[code].position.x = -1000000;
|
||||
}
|
||||
|
||||
}
|
||||
function trainrun(data){
|
||||
let code = data.code;
|
||||
@ -868,26 +873,7 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
|
||||
|
||||
function initswitch(data) {
|
||||
code = data.code;
|
||||
if (data.command == 'NP') {
|
||||
// sectionlist.switchs.modellist[j].normal = data.normal;
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = 0;
|
||||
actions[code].action.timeScale = 1;
|
||||
actions[code].action.play();
|
||||
actions[code].command = data.command;
|
||||
} else if (data.command == 'RP') {
|
||||
// sectionlist.switchs.modellist[j].normal = data.normal;
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = actions[code].action._clip.duration;
|
||||
actions[code].action.timeScale = -1;
|
||||
actions[code].action.play();
|
||||
actions[code].command = data.command;
|
||||
}
|
||||
}
|
||||
|
||||
function switchupdate(data) {
|
||||
code = data.code;
|
||||
if (actions[code].command != data.command) {
|
||||
if(actions[code]){
|
||||
if (data.command == 'NP') {
|
||||
// sectionlist.switchs.modellist[j].normal = data.normal;
|
||||
actions[code].action.reset();
|
||||
@ -905,6 +891,30 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function switchupdate(data) {
|
||||
code = data.code;
|
||||
if(actions[code]){
|
||||
if (actions[code].command != data.command) {
|
||||
if (data.command == 'NP') {
|
||||
// sectionlist.switchs.modellist[j].normal = data.normal;
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = 0;
|
||||
actions[code].action.timeScale = 1;
|
||||
actions[code].action.play();
|
||||
actions[code].command = data.command;
|
||||
} else if (data.command == 'RP') {
|
||||
// sectionlist.switchs.modellist[j].normal = data.normal;
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = actions[code].action._clip.duration;
|
||||
actions[code].action.timeScale = -1;
|
||||
actions[code].action.play();
|
||||
actions[code].command = data.command;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
function simulationreset(data){
|
||||
for(let i=0;i<trainlisttest.group.children.length;i++){
|
||||
trainlisttest.group.children[i].dispose = true;
|
||||
|
@ -29,7 +29,6 @@ export function Lesson3dPlayer(dom,lessonData,lessonIndex) {
|
||||
|
||||
// let stats = new Stats();
|
||||
// dom.appendChild( stats.dom );
|
||||
|
||||
let scope = this;
|
||||
this.dom = dom;
|
||||
this.nowSceneType = "";
|
||||
@ -65,6 +64,8 @@ export function Lesson3dPlayer(dom,lessonData,lessonIndex) {
|
||||
|
||||
let loadingInstance = Loading.service({ fullscreen: true });
|
||||
let assetModelManager = new AssetModelManager(scope,scene,controlManager);
|
||||
|
||||
console.log(lessonData);
|
||||
assetModelManager.lessonAssetsLoader(lessonData).then((result) => {
|
||||
scope.nowSceneType = lessonData.lessonProgress[0].progressScene;
|
||||
animateManager.initAnimation(assetModelManager);
|
||||
|
@ -60,7 +60,7 @@ export const loginInfo = {
|
||||
xzexam:{
|
||||
title: '城市轨道交通标准化培训软件',
|
||||
loginPath: '/login?project=xzexam',
|
||||
loginParam: 'DEFAULT',
|
||||
loginParam: 'SAY',
|
||||
loginTitle: '空串',
|
||||
logoWidth: '140px',
|
||||
navigationLogoWidth: '120px',
|
||||
@ -729,7 +729,8 @@ export const ProjectCode = {
|
||||
hls: 'DEFAULT',
|
||||
designhls: 'DEFAULT',
|
||||
say: 'SAY',
|
||||
designsay: 'SAY'
|
||||
designsay: 'SAY',
|
||||
xzexam:'SAY',
|
||||
};
|
||||
/** 嵌入第三方平台 导航栏右上角 清空 */
|
||||
export const ThirdLoginList = ['richor', 'designrichor', 'richorygy', 'designrichorygy'];
|
||||
|
@ -25,7 +25,7 @@ export function handlerUrl(data) {
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
// const data = null;
|
||||
// BASE_API = 'https://joylink.club/jlcloud';
|
||||
// BASE_API = 'https://test.joylink.club/jlcloud';
|
||||
BASE_API = 'https://test.joylink.club/jlcloud';
|
||||
// BASE_API = 'http://114.116.51.125/jlcloud';
|
||||
// BASE_API = 'http://192.168.8.152:9000'; // 袁琪
|
||||
// BASE_API = 'http://192.168.8.172:9200'; // 旭强
|
||||
@ -33,7 +33,7 @@ export function handlerUrl(data) {
|
||||
// BASE_API = 'http://192.168.8.140:9000'; // 杜康
|
||||
// BASE_API = 'http://b29z135112.zicp.vip';
|
||||
// BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康
|
||||
BASE_API = 'http://2i38984j47.qicp.vip'; // 张赛
|
||||
// BASE_API = 'http://2i38984j47.qicp.vip'; // 张赛
|
||||
BASE_API = data && data.domainName ? data.domainName : BASE_API;
|
||||
VOICE_API = data && data.resourcesDomainName ? data.resourcesDomainName : 'https://joylink.club/oss/joylink';
|
||||
UPLOAD_API = 'http://joylink.club/jlfile';
|
||||
|
@ -95,7 +95,7 @@ export default {
|
||||
resultMap: {},
|
||||
loading: false,
|
||||
audioPlayId: '',
|
||||
baseUrl:this.$store.user.state.resourcesUrl
|
||||
baseUrl:this.$store.state.user.resourcesUrl
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
|
@ -84,7 +84,7 @@ export default {
|
||||
recordSendingId: null,
|
||||
audioDataMap: {},
|
||||
audioPlayId: '',
|
||||
baseUrl:this.$store.user.state.resourcesUrl
|
||||
baseUrl:this.$store.state.user.resourcesUrl
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
|
@ -56,7 +56,7 @@ export default {
|
||||
});
|
||||
|
||||
uploadFile(action, that.formData).then(resp => {
|
||||
const imgUrl = this.$store.user.state.resourcesUrl + resp.data;
|
||||
const imgUrl = this.$store.state.user.resourcesUrl + resp.data;
|
||||
insertImgFn(imgUrl);
|
||||
}).catch(error => { console.log(error); });
|
||||
};
|
||||
|
@ -590,6 +590,7 @@ export default {
|
||||
},
|
||||
updatetrainlist(){
|
||||
getSimulationTrainlistNew(this.group).then(netdata => {
|
||||
console.log(netdata);
|
||||
this.options = [];
|
||||
this.trainlist = netdata.data;
|
||||
for(let i=0;i<netdata.data.length;i++){
|
||||
|
@ -144,7 +144,7 @@
|
||||
import { JobPaneData } from '@/jlmap3d/lesson3d/toolsmodel/jobpanedata.js';
|
||||
import { ZzwwTrain } from '@/jlmap3d/lesson3dedit/toolsmodel/zzwwtrain.js';
|
||||
|
||||
import { getLesson3dData,updateLesson3dData } from '@/api/jmap/lesson3d';
|
||||
import { getLesson3dData,updateLesson3dData,getPublishLesson3dData} from '@/api/jmap/lesson3d';
|
||||
|
||||
import { JL3D_LOCAL_STATIC,BASE_ASSET_API } from '@/api/jlmap3d/assets3d.js';
|
||||
|
||||
@ -248,15 +248,77 @@
|
||||
window.startLesson = this.startLesson;
|
||||
window.updataExamStatus = this.updataExamStatus;
|
||||
window.lessonEnd = this.lessonEnd;
|
||||
this.init(this.$route.query.lessonId);
|
||||
console.log(this.$route.query.lessonType);
|
||||
if(this.$route.query.lessonType == "publish"){
|
||||
this.initPublish(this.$route.query.lessonId);
|
||||
}else{
|
||||
this.initDraft(this.$route.query.lessonId);
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
init(lessonId){
|
||||
initDraft(lessonId){
|
||||
|
||||
getLesson3dData(lessonId).then(data => {
|
||||
console.log(data);
|
||||
this.netData.name = data.data.name;
|
||||
this.netData.type = data.data.type;
|
||||
|
||||
let dom = document.getElementById('lesson3ddraw');
|
||||
|
||||
this.lessonData = new LessonData();
|
||||
this.jobPaneData = new JobPaneData();
|
||||
this.trainDeviceData = new ZzwwTrain();
|
||||
let loadData;
|
||||
|
||||
|
||||
if(data.data.data){
|
||||
this.lessonMsg = {
|
||||
lessonTittle:data.data.name,
|
||||
userId:data.data.userId,
|
||||
userJob:"",
|
||||
};
|
||||
loadData = JSON.parse(data.data.data);
|
||||
if(this.$route.query.examMode == 1){
|
||||
this.examMode = true;
|
||||
}else{
|
||||
this.examMode = loadData.setup.examMode;
|
||||
}
|
||||
if(loadData.setup.checkedRole.length == 0){
|
||||
this.showSelectJob = false;
|
||||
}
|
||||
this.selectJobList = loadData.setup.checkedRole;
|
||||
this.jobPaneData.dataList = loadData.toolJobPane;
|
||||
this.$refs.jobpane.initJobList(this.jobPaneData.dataList);
|
||||
this.lessonTools = loadData.lessonTools;
|
||||
this.lessonData.loadLessonProgress(loadData.lessonProgress);
|
||||
if(this.lessonTools[5]){
|
||||
loadData.trainDeviceData = this.trainDeviceData.deviceList;
|
||||
}else{
|
||||
this.lessonTools[5] = {
|
||||
name:"大铁车检组件",
|
||||
type:"",
|
||||
isShow:false,
|
||||
};
|
||||
}
|
||||
}else{
|
||||
|
||||
this.lessonData.initLessonProgress();
|
||||
this.$refs.jobpane.initJobList(this.jobPaneData.dataList);
|
||||
this.jl3d.initNowRole();
|
||||
}
|
||||
// console.log("loaddata----------------");
|
||||
// console.log(loadData);
|
||||
// console.log(this.lessonMsg);
|
||||
this.jl3d = new Lesson3dPlayer(dom,loadData,this.lessonPlayIndex);
|
||||
}).catch(() => {
|
||||
});
|
||||
},
|
||||
initPublish(lessonId){
|
||||
getPublishLesson3dData(lessonId).then(data => {
|
||||
console.log(data);
|
||||
this.netData.name = data.data.name;
|
||||
this.netData.type = data.data.type;
|
||||
|
||||
|
@ -6,11 +6,21 @@
|
||||
<div style="position:absolute;left:25%;top:10%;font-size:80px;">
|
||||
<el-row>
|
||||
城市轨道交通标准化培训软件
|
||||
|
||||
</el-row>
|
||||
<el-row style="font-size:40px;">
|
||||
课程模式选择:
|
||||
<el-switch
|
||||
v-model="examMode"
|
||||
active-text="考试模式"
|
||||
inactive-text="教学模式">
|
||||
</el-switch>
|
||||
</el-row>
|
||||
</div>
|
||||
<div style="position:absolute;left:40%;top:20%;font-size:30px">
|
||||
|
||||
<div class="lesson3dSelectButton"
|
||||
</div>
|
||||
<QueryListPage ref="queryListPage" :card-padding="50" :query-form="queryForm" :pager-config="pagerConfig" :query-list="queryList" style="width: 91%;margin-left:4%;margin-top:20px;top:25%;position:absolute" />
|
||||
<!-- <div class="lesson3dSelectButton"
|
||||
:style="{'background-image': 'url('+localStatic+'/other/ck.png)'}"
|
||||
style="left:15%;top:25%;" @click=""></div>
|
||||
|
||||
@ -32,7 +42,7 @@
|
||||
|
||||
<div class="lesson3dSelectButton"
|
||||
:style="{'background-image': 'url('+localStatic+'/other/xr51.png)'}"
|
||||
style="left:65%;top:60%;" @click=""></div>
|
||||
style="left:65%;top:60%;" @click=""></div> -->
|
||||
|
||||
|
||||
</div>
|
||||
@ -42,6 +52,7 @@
|
||||
|
||||
<script>
|
||||
|
||||
import { publishedLesson3d } from '@/api/jmap/lesson3d';
|
||||
import { ProjectIcon } from '@/scripts/ProjectConfig';
|
||||
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
|
||||
import bgPsdImg from '@/assets/bg_psd.png';
|
||||
@ -57,7 +68,56 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
localStatic:JL3D_LOCAL_STATIC,
|
||||
examMode:false,
|
||||
lessonType:'publish',
|
||||
pagerConfig: {
|
||||
pageSize: 'pageSize',
|
||||
pageIndex: 'pageNum'
|
||||
},
|
||||
queryForm: {
|
||||
show: false
|
||||
},
|
||||
queryList: {
|
||||
query: this.queryFunction,
|
||||
selectCheckShow: false,
|
||||
indexShow: true,
|
||||
columns: [
|
||||
{
|
||||
title: '三维课程名称',
|
||||
prop: 'name'
|
||||
},
|
||||
{
|
||||
title: '三维课程类型',
|
||||
prop: 'type'
|
||||
},
|
||||
{
|
||||
title: '创建人',
|
||||
prop: 'userId'
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
prop: 'createTime'
|
||||
},
|
||||
|
||||
{
|
||||
type: 'button',
|
||||
title: this.$t('global.operate'),
|
||||
width: '400',
|
||||
buttons: [
|
||||
{
|
||||
name: this.$t('lesson.courseDetails'),
|
||||
handleClick: this.goDetail,
|
||||
type: 'primary',
|
||||
showControl: (row) => {
|
||||
return row.status !== '1';
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
},
|
||||
beforeDestroy() {
|
||||
|
||||
@ -70,13 +130,16 @@ export default {
|
||||
// console.log("");
|
||||
},
|
||||
methods: {
|
||||
|
||||
enterPlayer:function (id) {
|
||||
// this.$router.push({ path: '/jlmap3d/lcjy', query: {} });
|
||||
|
||||
this.$router.push({ path: '/design/jlmap3d/lesson3dplayer', query: {lessonId:id} });
|
||||
queryFunction(params) {
|
||||
return publishedLesson3d(params);
|
||||
},
|
||||
|
||||
refresh() {
|
||||
this.$refs.queryListPage.refresh(true);
|
||||
},
|
||||
goDetail(index, row) {
|
||||
this.$router.push({ path: '/design/jlmap3d/lesson3dplayer', query: {lessonId: row.id,lineCode: this.$route.query.lineCode,examMode:this.examMode,lessonType:this.lessonType} });
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
@ -1,12 +1,27 @@
|
||||
<template>
|
||||
<div class="joylink-card">
|
||||
|
||||
|
||||
|
||||
<div class="lesson-header">
|
||||
<div class="lesson-list">草稿{{ $t('lesson.courseList') }}</div>
|
||||
<div class="but-group">
|
||||
<el-button size="mini" type="primary" @click="lessonSetupCreate">{{ $t('lesson.newConstruction') }}</el-button>
|
||||
</div>
|
||||
<div class="joylink-card">
|
||||
<el-tabs v-model="activeName" @tab-click="handleClick">
|
||||
|
||||
<el-tab-pane label="草稿数据管理" name="first">
|
||||
<div class="but-group">
|
||||
<el-button size="mini" type="primary" @click="lessonSetupCreate">{{ $t('lesson.newConstruction') }}</el-button>
|
||||
</div>
|
||||
<QueryListPage ref="queryListPage" :card-padding="50" :query-form="queryFormCourse" :pager-config="pagerConfigCourse" :query-list="queryListCourse" style="width: 91%;margin-left:4%;margin-top:20px;" />
|
||||
</el-tab-pane>
|
||||
|
||||
<el-tab-pane label="发布数据管理" name="second">
|
||||
<QueryListPage ref="queryListPage" :card-padding="50" :query-form="queryFormPublish" :pager-config="pagerConfigPublish" :query-list="queryListPublish" style="width: 91%;margin-left:4%;margin-top:20px;" />
|
||||
</el-tab-pane>
|
||||
|
||||
</el-tabs>
|
||||
|
||||
</div>
|
||||
<QueryListPage ref="queryListPage" :card-padding="50" :query-form="queryForm" :pager-config="pagerConfig" :query-list="queryList" style="width: 91%;margin-left:4%;margin-top:20px;" />
|
||||
|
||||
|
||||
<publish-create ref="publishCreate" @refresh="refresh" />
|
||||
<publish-lesson ref="publishLesson" @refresh="refresh" />
|
||||
<lesson-detail ref="lessonDetail" />
|
||||
@ -18,7 +33,7 @@
|
||||
<script>
|
||||
// import { releaseOrCancel } from '@/api/lesson3d';
|
||||
|
||||
import { getLesson3dDrftList,createLesson3d,updateLesson3dBasic,delLesson3d,publishLesson3d } from '@/api/jmap/lesson3d';
|
||||
import { getLesson3dDrftList,createLesson3d,updateLesson3dBasic,delLesson3d,publishedLesson3d,publishLesson3d,onlineLesson3d,offlineLesson3d } from '@/api/jmap/lesson3d';
|
||||
// import { delLesson } from '@/api/jmap/lesson3d';
|
||||
|
||||
|
||||
@ -41,15 +56,23 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
pagerConfig: {
|
||||
activeName: 'first',
|
||||
pagerConfigCourse: {
|
||||
pageSize: 'pageSize',
|
||||
pageIndex: 'pageNum'
|
||||
},
|
||||
queryForm: {
|
||||
pagerConfigPublish: {
|
||||
pageSize: 'pageSize',
|
||||
pageIndex: 'pageNum'
|
||||
},
|
||||
queryFormCourse: {
|
||||
show: false
|
||||
},
|
||||
queryList: {
|
||||
query: this.queryFunction,
|
||||
queryFormPublish: {
|
||||
show: false
|
||||
},
|
||||
queryListCourse: {
|
||||
query: this.queryFunctionCourse,
|
||||
selectCheckShow: false,
|
||||
indexShow: true,
|
||||
columns: [
|
||||
@ -84,14 +107,13 @@ export default {
|
||||
}
|
||||
},
|
||||
{
|
||||
name: this.$t('lesson.notRelease'),
|
||||
name: this.$t('lesson.courseRelease'),
|
||||
handleClick: this.release,
|
||||
type: 'primary',
|
||||
showControl: (row) => {
|
||||
return row.status !== '1';
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
name: this.$t('global.delete'),
|
||||
handleClick: this.deleteLesson,
|
||||
@ -104,7 +126,64 @@ export default {
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
queryListPublish: {
|
||||
query: this.queryFunctionPublish,
|
||||
selectCheckShow: false,
|
||||
indexShow: true,
|
||||
columns: [
|
||||
{
|
||||
title: '三维课程名称',
|
||||
prop: 'name'
|
||||
},
|
||||
{
|
||||
title: '三维课程类型',
|
||||
prop: 'type'
|
||||
},
|
||||
{
|
||||
title: '创建人',
|
||||
prop: 'userId'
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
prop: 'createTime'
|
||||
},
|
||||
|
||||
{
|
||||
type: 'button',
|
||||
title: this.$t('global.operate'),
|
||||
width: '400',
|
||||
buttons: [
|
||||
{
|
||||
name: this.$t('lesson.courseDetails'),
|
||||
handleClick: this.goDetail,
|
||||
type: 'primary',
|
||||
showControl: (row) => {
|
||||
return row.status !== '1';
|
||||
}
|
||||
},
|
||||
{
|
||||
name: this.$t('lesson.courseOnline'),
|
||||
handleClick: this.online,
|
||||
type: 'primary',
|
||||
showControl: (row) => {
|
||||
return row.status !== '1';
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
name: this.$t('lesson.courseOffline'),
|
||||
handleClick: this.offonline,
|
||||
type: 'primary',
|
||||
showControl: (row) => {
|
||||
return row.status !== '1';
|
||||
}
|
||||
},
|
||||
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
};
|
||||
},
|
||||
@ -128,9 +207,12 @@ export default {
|
||||
mounted() {
|
||||
},
|
||||
methods: {
|
||||
queryFunction(params) {
|
||||
queryFunctionCourse(params) {
|
||||
return getLesson3dDrftList(params);
|
||||
},
|
||||
queryFunctionPublish(params) {
|
||||
return publishedLesson3d(params);
|
||||
},
|
||||
handlerStatus(row) {
|
||||
let lessonStatus = '';
|
||||
switch (row.status) {
|
||||
@ -149,6 +231,9 @@ export default {
|
||||
}
|
||||
return lessonStatus;
|
||||
},
|
||||
handleClick(tab, event) {
|
||||
// console.log(tab, event);
|
||||
},
|
||||
refresh() {
|
||||
this.$refs.queryListPage.refresh(true);
|
||||
},
|
||||
@ -168,8 +253,6 @@ export default {
|
||||
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
publish(index, row) {
|
||||
row.mapId = this.$route.params.mapId;
|
||||
row.cityCode = this.$route.query.cityCode;
|
||||
@ -187,8 +270,35 @@ export default {
|
||||
});
|
||||
},
|
||||
|
||||
release(){
|
||||
|
||||
release(index, row){
|
||||
publishLesson3d(row.id).then(response => {
|
||||
this.$message.success(this.$t('tip.coursePublishSuccessful'));
|
||||
this.loading = true;
|
||||
this.refresh();
|
||||
this.loading = false;
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('tip.coursePublishFailed'));
|
||||
});
|
||||
},
|
||||
online(index, row){
|
||||
onlineLesson3d(row.id).then(response => {
|
||||
this.$message.success(this.$t('tip.coursePublishSuccessful'));
|
||||
this.loading = true;
|
||||
this.refresh();
|
||||
this.loading = false;
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('tip.coursePublishFailed'));
|
||||
});
|
||||
},
|
||||
offonline(index, row){
|
||||
offlineLesson3d(row.id).then(response => {
|
||||
this.$message.success(this.$t('tip.offlineSuccessful'));
|
||||
this.loading = true;
|
||||
this.refresh();
|
||||
this.loading = false;
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('tip.offlineFailed'));
|
||||
});
|
||||
},
|
||||
goDetail(index, row) {
|
||||
console.log(row);
|
||||
|
@ -204,7 +204,7 @@ export default {
|
||||
},
|
||||
avatarUrl(val) {
|
||||
if (val && val.creatorAvatarPath) {
|
||||
return this.$store.user.state.resourcesUrl + val.creatorAvatarPath;
|
||||
return this.$store.state.user.resourcesUrl + val.creatorAvatarPath;
|
||||
} else {
|
||||
return 'https://joylink.club/oss/wxmicro_assistant/userhead/defaultuser.png';
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ export default {
|
||||
// yuyin:yuyin,
|
||||
currentAudioIndex:0,
|
||||
isPlay:false,
|
||||
baseUrl: this.$store.user.state.resourcesUrl
|
||||
baseUrl: this.$store.state.user.resourcesUrl
|
||||
};
|
||||
},
|
||||
watch:{
|
||||
|
Loading…
Reference in New Issue
Block a user