Merge remote-tracking branch 'origin/master'

This commit is contained in:
joylink_zhangsai 2022-05-12 11:08:12 +08:00
commit 0cb4088f6c
407 changed files with 27750 additions and 4023 deletions

View File

@ -5,10 +5,10 @@ NODE_ENV = 'development'
# base api
# VUE_APP_BASE_API = 'https://joylink.club/jlcloud'
# VUE_APP_BASE_API = 'http://192.168.3.4:9000'
VUE_APP_BASE_API = 'http://192.168.3.6:9000'
VUE_APP_VOICE_API = 'https://oss.joylink.club/oss/joylink'
VUE_APP_UPLOAD_API = 'https://upload.joylink.club'
VUE_APP_BASE_SITE='https://test.joylink.club/cbtc'
# VUE_APP_BASE_API = 'http://192.168.3.6:9000'
# VUE_APP_VOICE_API = 'http://119.3.163.89/oss/joylink'
# VUE_APP_UPLOAD_API = 'http://joylink.club/jlfile'
# VUE_APP_BASE_SITE='https://test.joylink.club/cbtc'
# VUE_APP_VOICE_API = 'http://192.168.8.110:9008'

View File

@ -3,7 +3,7 @@ NODE_ENV = 'production'
VUE_APP_PRO = 'local'
# base api
VUE_APP_BASE_API = 'http://160.20.60.15:9000'
VUE_APP_VOICE_API = 'http://160.20.60.15/oss/joylink'
VUE_APP_UPLOAD_API = 'http://160.20.60.15'
VUE_APP_BASE_SITE='http://160.20.60.15'
# VUE_APP_BASE_API = 'http://160.20.60.15:9000'
# VUE_APP_VOICE_API = 'http://160.20.60.15/oss/joylink'
# VUE_APP_UPLOAD_API = 'http://160.20.60.15'
# VUE_APP_BASE_SITE='http://160.20.60.15'

View File

@ -3,7 +3,7 @@ NODE_ENV = 'production'
VUE_APP_PRO = 'ntyl'
# base api
VUE_APP_BASE_API = 'https://joylink.club/jlcloud'
VUE_APP_VOICE_API = 'https://joylink.club/oss/joylink'
VUE_APP_UPLOAD_API = 'https://upload.joylink.club'
VUE_APP_BASE_SITE='https://joylink.club/cbtc'
# VUE_APP_BASE_API = 'https://joylink.club/jlcloud'
# VUE_APP_VOICE_API = 'https://joylink.club/oss/joylink'
# VUE_APP_UPLOAD_API = 'https://upload.joylink.club'
# VUE_APP_BASE_SITE='https://joylink.club/cbtc'

View File

@ -2,7 +2,7 @@
NODE_ENV = 'production'
# base api
VUE_APP_BASE_API = 'https://api.joylink.club/jlcloud'
VUE_APP_VOICE_API = 'https://oss.joylink.club/oss/joylink'
VUE_APP_UPLOAD_API = 'https://upload.joylink.club'
VUE_APP_BASE_SITE='https://joylink.club/cbtc'
# VUE_APP_BASE_API = 'https://joylink.club/jlcloud'
# VUE_APP_VOICE_API = 'https://joylink.club/oss/joylink'
# VUE_APP_UPLOAD_API = 'https://upload.joylink.club'
# VUE_APP_BASE_SITE='https://joylink.club/cbtc'

View File

@ -2,7 +2,7 @@
NODE_ENV = 'test'
# base api
VUE_APP_BASE_API = 'https://test.joylink.club/jlcloud'
VUE_APP_VOICE_API = 'https://oss.joylink.club/oss/joylink'
VUE_APP_UPLOAD_API = 'https://upload.joylink.club'
VUE_APP_BASE_SITE='https://test.joylink.club/cbtc'
# VUE_APP_BASE_API = 'https://test.joylink.club/jlcloud'
# VUE_APP_VOICE_API = 'https://joylink.club/oss/joylink'
# VUE_APP_UPLOAD_API = 'https://upload.joylink.club'
# VUE_APP_BASE_SITE='https://test.joylink.club/cbtc'

View File

@ -17,7 +17,7 @@
"svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml"
},
"dependencies": {
"axios": "0.18.0",
"axios": "^0.18.0",
"echarts": "^4.7.0",
"element-ui": "^2.12.0",
"file-saver": "^1.3.3",
@ -70,9 +70,9 @@
"eslint-plugin-vue": "5.2.2",
"file-loader": "^3.0.1",
"html-webpack-plugin": "3.2.0",
"node-sass": "^4.9.0",
"node-sass": "^4.14.1",
"runjs": "^4.3.2",
"sass-loader": "^7.1.0",
"sass-loader": "^7.3.1",
"script-ext-html-webpack-plugin": "2.1.3",
"script-loader": "^0.7.2",
"serve-static": "^1.13.2",

View File

@ -3,6 +3,16 @@
<router-view />
<deomon-topic ref="deomonTopic" />
<img v-show="loading" :src="loadingImg" class="AppAll">
<div
v-if="!$store.state.user.baseUrl"
v-loading="!$store.state.user.baseUrl"
element-loading-text="拼命加载中"
element-loading-background="rgba(0, 0, 0, 0)"
element-loading-spinner="el-icon-loading"
style="width: 100%;height: 100%;"
>
<img :src="appLoading" class="centerImg">
</div>
</div>
</template>
@ -13,6 +23,7 @@ import { loginInfo, ProjectIcon } from '@/scripts/ProjectConfig';
import DeomonTopic from '@/views/demonstration/deomonTopic';
import WindowResizeHandler from '@/mixin/WindowResizeHandler';
import LoadingImg from '@/assets/loading.gif';
import AppLoading from '@/assets/appLoading.png';
import { openIndexedDB } from '@/utils/indexedDb';
export default {
@ -26,6 +37,7 @@ export default {
data() {
return {
loadingImg: LoadingImg,
appLoading: AppLoading,
loading: false
};
},
@ -113,4 +125,13 @@ export default {
</script>
<style lang="scss" scoped>
.AppAll{position: absolute;top: 0;left: 0;width: 100%;height: 100%;z-index: 2003}
.centerImg {
position: absolute;
left:50%;
top: 50%;
width: 480px;
height: 456px;
margin-left: -240px;
margin-top: -228px;
}
</style>

49
src/api/audioResources.js Normal file
View File

@ -0,0 +1,49 @@
import request from '@/utils/request';
// 创建音频资源
export function createAudioResources(data) {
return request({
url: `/api/audioResources`,
method: 'post',
data
});
}
// 查询所有音频资源
export function queryAllAudioResources() {
return request({
url: `/api/audioResources/list`,
method: 'get'
});
}
// 删除音频资源
export function deleteAudioResources(id) {
return request({
url: `/api/audioResources/${id}`,
method: 'delete'
});
}
// 更新音频资源
export function updateAudioResources(id, data) {
return request({
url: `/api/audioResources/${id}`,
method: 'put',
data
});
}
// 分页查询音频资源
export function pagedAudioResources(params) {
return request({
url: `/api/audioResources/paged`,
method: 'get',
params
});
}
// 上传音频文件
export function uploadAudio(file) {
return request({
url: `/api/upload/AUDIO?appId=00001&appSecret=joylink00001`,
method: 'post',
data: file,
upload: true
});
}

View File

@ -309,3 +309,10 @@ export function getUserDuration(params) {
params
});
}
/** 获取单位二维码 */
export function getCompanyQrCode(orgId) {
return request({
url: `/api/company/${orgId}/qrCode`,
method: 'get'
});
}

View File

@ -49,3 +49,116 @@ export function queryHasIscs(params) {
params
});
}
// iscs设备创建
export function createIscsDevcie(data) {
return request({
url: `/api/iscsDevice`,
method: 'post',
data
});
}
// 查询所有iscs设备
export function queryAllIscsDevice() {
return request({
url: `/api/iscsDevice/all`,
method: 'get'
});
}
// 根据id查询iscs设备
export function queryIscsDevcieById(id) {
return request({
url:
`/api/iscsDevice/${id}`,
method: 'get'
});
}
// 根据mapId获取Iscs设备list
export function queryIscsDeviceListByMapId(mapId) {
return request({
url: `/api/iscsDevice/list/mapId/${mapId}`,
method: 'get'
});
}
// 分页查询ISCS设备
export function pagedIscsDevice(params) {
return request({
url: `/api/iscsDevice/paged`,
method: 'get',
params
});
}
// 删除ISCS设备
export function deleteIscsDevice(id) {
return request({
url: `/api/iscsDevice/${id}`,
method: 'delete'
});
}
// 根据mapId查询设备列表
export function getIscsDeviceListByMapId(mapId) {
return request({
url: `/api/iscsDevice/list/mapId/${mapId}`,
method: 'get'
});
}
// 根据条件查询设备列表
export function queryIscsDeviceCod(params) {
return request({
url: `/api/iscsDevice/list/criteria`,
method: 'get',
params
});
}
// 批量创建ISCS设备
export function batchCreateIscsDevcie(data) {
return request({
url: `/api/iscsDevice/create/batch`,
method: 'post',
data
});
}
// 创建ISCS系统资源
export function createIscsResources(data) {
return request({
url: `/api/systemRes`,
method: 'post',
data
});
}
// 查询所有ISCS系统资源
export function queryAllIscsResources() {
return request({
url: `/api/systemRes/all`,
method: 'get'
});
}
// 根据id查询ISCS系统资源
export function queryIscsResourcesById(id) {
return request({
url: `/api/systemRes/${id}`,
method: 'get'
});
}
// 分页查询ISCS系统资源
export function pagedIscsResources(params) {
return request({
url: `/api/systemRes/paged`,
method: 'get',
params
});
}
// 删除ISCS系统资源
export function deleteIscsResources(id) {
return request({
url: `/api/systemRes/${id}`,
method: 'delete'
});
}
// 按条件查询ISCS系统资源
export function queryIscsResourcesCod(params) {
return request({
url: `/api/systemRes/list/criteria`,
method: 'get',
params
});
}

View File

@ -1,10 +1,10 @@
import request from '@/utils/request';
import store from '@/store/index';
const publicPath = process.env.VUE_APP_PRO == 'local' ? '' : '/cbtc';
export const JL3D_LOCAL_STATIC = publicPath+"/static";
const BASE_UPLOAD_API = process.env.VUE_APP_UPLOAD_API;
export const BASE_ASSET_API = process.env.VUE_APP_VOICE_API;
const BASE_UPLOAD_API = store.state.user.uploadUrl;
export const BASE_ASSET_API = store.state.user.resourcesUrl;
// console.log(JL3D_LOCAL_STATIC);
// console.log(BASE_UPLOAD_API);
// console.log(BASE_ASSET_API);

View File

@ -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: ''
});
}

View File

@ -90,3 +90,25 @@ export function getExamListByMapIdAndPrdType(mapId, prdType) {
params: { prdType: prdType }
});
}
/** 更新试卷规则 */
export function updateExamRule(data) {
return request({
url: `/api/exam/update/rules`,
method: 'put',
data:data
});
}
/** 检查并更新【规则数据异常】状态 */
export function checkAndUpdateAbnormal(mapId) {
return request({
url: `/api/exam/checkAndUpdateAbnormal/${mapId}`,
method: 'put'
});
}
/** 重新生成考试规则 */
export function regenerateRule (mapId) {
return request({
url: `/api/exam/regenerateRules/${mapId}`,
method: 'put'
});
}

View File

@ -66,3 +66,43 @@ export function getClassGradeList(examId, params) {
params
});
}
/** 查询组织学生单次考试成绩曲线 */
export function getClassGradeStatistic(orgId, examId) {
return request({
url: `/api/userExam/curve/${orgId}/${examId}`,
method: 'get'
});
}
/** 查询组织学生单次考试成绩曲线 */
export function getStuGradeStatistic(userId) {
return request({
url: `/api/userExam/curve/${userId}`,
method: 'get',
});
}
/** 个人仿真数据统计 */
export function getSimulationTimeChart(mapId) {
return request({
url: `/api/stats/simulation/${mapId}/stats`,
method: 'get'
});
}
// 课程内实训数据统计
export function getLessonTimeChart(id) {
return request({
url: `/api/stats/lesson/${id}/stats`,
method: 'get'
});
}
// 课程列表
export function getLessonList() {
return request({
url: '/api/stats/lesson/list',
method: 'get'
});
}

View File

@ -37,38 +37,6 @@ export function getDeviceDetail(id) {
method: 'get'
});
}
/** 添加/修改屏蔽门设备网关映射配置 */
export function setPsdConfig(id, data) {
return request({
url: `/api/device/${id}/config/psd`,
method: 'put',
data: data
});
}
/** 添加/修改信号机设备网关映射配置 */
export function setSignalConfig(id, data) {
return request({
url: `/api/device/${id}/config/signal`,
method: 'put',
data: data
});
}
/** 添加/修改信号机设备网关映射配置 */
export function setSwitchConfig(id, data) {
return request({
url: `/api/device/${id}/config/switch`,
method: 'put',
data: data
});
}
/** 添加/修改端头控制盒网关映射配置 */
export function setPslConfig(id, data) {
return request({
url: `/api/device/${id}/config/psl`,
method: 'put',
data: data
});
}
/** 添加/修改ibp盘网关映射配置 */
export function setIbpConfig(id, data) {
return request({
@ -77,15 +45,6 @@ export function setIbpConfig(id, data) {
data: data
});
}
/** 添加/修改psc控制柜网关映射配置 */
export function setPscConfig(id, data) {
return request({
url: `/api/device/${id}/config/psc`,
method: 'put',
data: data
});
}
/** 添加/修改ibp设备配置 */
export function setVrIbpConfig(id, data) {
return request({
@ -177,3 +136,11 @@ export function setIlwConfig(id, data) {
data: data
});
}
/** 添加/修改设备配置 */
export function setDeviceConfig(data) {
return request({
url: `/api/device/config/updateConfig`,
method: 'put',
data: data
});
}

40
src/api/projectServer.js Normal file
View File

@ -0,0 +1,40 @@
import request from '@/utils/request';
/** 获取请求baseURL */
export function getBaseUrlByProject(project) {
return request({
url: `/api/projectServer/project/${project}`,
method: 'get'
});
}
/** 分页查询项目服务器 */
export function projectServerPaging(params) {
return request({
url: `/api/projectServer/paging`,
method: 'get',
params
});
}
/** 创建项目服务器数据 */
export function createProjectServer(data) {
return request({
url: `/api/projectServer`,
method: 'post',
data
});
}
/** 修改项目服务器数据 */
export function updateProjectServer(id, data) {
return request({
url: `/api/projectServer/${id}`,
method: 'put',
data
});
}
/** 删除项目服务器数据 */
export function deleteProjectServer(id) {
return request({
url: `/api/projectServer/${id}`,
method: 'delete'
});
}

View File

@ -234,7 +234,7 @@ export function handleIbpPress(group, stationCode, buttonCode) {
return request({
url: `/simulation/${group}/ibp/press/${stationCode}/${buttonCode}`,
method: 'put'
})
});
}
/** 处理ibp盘事件(松开) */
@ -242,7 +242,7 @@ export function handleIbpRelease(group, stationCode, buttonCode) {
return request({
url: `/simulation/${group}/ibp/release/${stationCode}/${buttonCode}`,
method: 'put'
})
});
}
/** 预览脚本仿真(新版)*/
@ -497,3 +497,19 @@ export function getStandListByRunLineOrTrainCode(group, params) {
params
});
}
/** 上饶列车控制 */
export function srTrainControl(group, params) {
return request({
url: `/api/sr/${group}/control`,
method: 'put',
params
});
}
/** 条件查询仿真中的ISCS资源 */
export function queryIscsResourcesByGroup(group, params) {
return request({
url: `simulation/${group}/iscs/systemResources`,
method: 'get',
params
});
}

View File

@ -10,7 +10,7 @@ export const meansUrl = `/api/upload/MEANS?appId=${productIdentify}`;
// export const regulationUrl = `/api/upload/regulation?appId=${productIdentify}`;
export function getUrl(relatedUrl) {
return `${process.env.VUE_APP_UPLOAD_API}${relatedUrl}`;
return `${this.$store.state.user.uploadUrl}${relatedUrl}`;
}
export function uploadFile(url, data) {

BIN
src/assets/appLoading.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 KiB

BIN
src/assets/left_train.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

BIN
src/assets/right_train.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 67 KiB

View File

@ -75,9 +75,9 @@ export default {
loading: true,
name: 'file',
size: 3,
action: `${process.env.VUE_APP_UPLOAD_API}/api/upload/PICTURE?appId=00001&appSecret=joylink00001`,
action: `${this.$store.state.user.uploadUrl}/api/upload/PICTURE?appId=00001&appSecret=joylink00001`,
response: (res) => {
return `${process.env.VUE_APP_VOICE_API}${res.data}`;
return `${this.$store.state.user.resourcesUrl}${res.data}`;
},
error: () => { that.$message.error('图片上传失败,请检查网络状态'); },
sizeError: () => { that.$message.error('图片上传失败图片大小限制3MB'); } //

View File

@ -198,7 +198,7 @@ export default {
taiwan: 'taiwan',
america: 'America',
companyInfo:'Beijing Jiulian Technology Co., Ltd',
companyTel:'Tel: +86 13289398171',
companyTel:'Tel: +86 13910989830',
companyICP:'Copyright ©2018 Beijing Jiulian Technology Co., Ltd ICP: 18028522',
enterPermissionNum:'please input number',
enterPermissionNumInt:'number must interger',

View File

@ -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',

View File

@ -99,5 +99,9 @@ export default {
publishISCSManage:'publish ISCS Manage',
voiceTraining: 'Voice Training',
mapGroup: 'Map Group',
drawingMange:'Drawing Mange'
drawingMange:'Drawing Mange',
projectServer: 'Project Server',
audioResourcesManage: 'Audio Resources Manage',
iscsDeviceManage: 'ISCS Device Manage',
iscsResourcesManage: 'ISCS Resources Manage'
};

View File

@ -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',

View File

@ -198,8 +198,8 @@ export default {
taiwan: '台湾',
america: '美国',
companyInfo:'北京玖琏科技有限公司',
companyTel:'联系电话: 13289398171',
companyICP:'Copyright ©2018 北京玖琏科技有限公司 京ICP备18028522号',
companyTel:'联系电话: 13910989830',
companyICP:'Copyright ©2018 北京玖琏科技有限公司 京ICP备2021039716号',
enterPermissionNum:'请输入权限数量',
enterPermissionNumInt:'权限数量需为整数',
perpetual: '永久',

View File

@ -74,6 +74,8 @@ export default {
editCourse: '编辑课程',
createCourse: '创建课程',
courseRelease: '课程发布',
courseOnline: '课程上架',
courseOffline: '课程下架',
releaseAssociatedCity: '发布关联城市:',
releaseAssociatedMap: '发布关联地图:',
trainingSequence: '实训排序',
@ -124,4 +126,3 @@ export default {
copy: '复制',
prdType:'产品类型'
};

View File

@ -103,5 +103,9 @@ export default {
publishISCSManage:'发布ISCS管理',
voiceTraining: '语音训练',
mapGroup: '地图分组',
drawingMange:'图纸管理'
drawingMange:'图纸管理',
projectServer: '项目域名',
audioResourcesManage: '音频资源管理',
iscsDeviceManage: 'ISCS设备管理',
iscsResourcesManage: 'ISCS资源管理'
};

View File

@ -123,6 +123,8 @@ export default {
trainModelNameRepeat: '列车模型数据重复',
coursePublishSuccessful: '课程发布成功',
coursePublishFailed: '课程发布失败',
offlineSuccessful: '课程下架成功',
offlineFailed: '课程下架失败',
startOperationHint: '此操作将开始任务, 是否继续?',
cancelsTaskHint: '此操作将取消任务, 是否继续?',
automaticGenerationTrainingSuccess: '自动生成实训成功',

View File

@ -1,7 +1,10 @@
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
export function SetCamera(dom) {
var camera = new THREE.PerspectiveCamera(60, dom.clientWidth/dom.clientHeight, 1, 2000);
var camera = new THREE.PerspectiveCamera(60, dom.clientWidth/dom.clientHeight, 1, 3000);
camera.position.set( 0, 0, 0 );
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
return camera;
}

View File

@ -12,6 +12,7 @@ export function SetScene(project) {
bgTexture = new THREE.TextureLoader().load(JL3D_LOCAL_STATIC+"/background/other.jpg");
}
scene.background = bgTexture;
// cubeTexture.dispos e();
return scene;
}

View File

@ -0,0 +1,155 @@
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
export function WeatherManager(scene){
let scope = this;
let spriteSwitch = false;
let spriteSpeed = 0;
let spriteRota = 0;
let zsTexture = new THREE.TextureLoader().load(JL3D_LOCAL_STATIC+"/background/zs.jpg" );
let zwTexture = new THREE.TextureLoader().load(JL3D_LOCAL_STATIC+"/background/zw.jpg" );
let bwTexture = new THREE.TextureLoader().load(JL3D_LOCAL_STATIC+"/background/bw.jpg" );
let ywTexture = new THREE.TextureLoader().load(JL3D_LOCAL_STATIC+"/background/yw.jpg" );
let rainPoint = new THREE.TextureLoader().load(JL3D_LOCAL_STATIC+"/sprite/rainsprite.png" );
let snowPoint = new THREE.TextureLoader().load(JL3D_LOCAL_STATIC+"/sprite/snowsprite.png" );
let geometry = new THREE.SphereGeometry( 3000, 32, 32 );
let material = new THREE.MeshBasicMaterial( {map:zsTexture,side:THREE.DoubleSide} );
scope.skybox = new THREE.Mesh( geometry, material);
scope.skybox.position.set( 0, 0, 0 );
let spritMaterial = new THREE.PointsMaterial({ //用图片初始化顶点材质
size: 2,
map: snowPoint,
transparent: true
});
let positions = [];
this.drops = 20000;
this.geom = new THREE.BufferGeometry();
this.velocityY = [];
for(let i = 0; i < this.drops; i++){
positions.push( Math.random() * 800 - 400 );
positions.push( Math.random() * 800 );
positions.push( Math.random() * 800 - 400 );
this.velocityY.push(0.5 + Math.random() / 2); //初始化每个粒子的坐标和粒子在Y方向的速度
}
//确定各个顶点的位置坐标
this.geom.setAttribute( 'position', new THREE.Float32BufferAttribute( positions, 3 ) );
this.instance = new THREE.Points(this.geom, spritMaterial); //初始化粒子系统
this.changeweather = function(type){
scene.fog = null;
switch (type) {
case 'zaoshang':
scope.skybox.material.map = zsTexture;
break;
case 'zhongwu':
scope.skybox.material.map = zwTexture;
break;
case 'bangwan':
scope.skybox.material.map = bwTexture;
break;
case 'yewan':
scope.skybox.material.map = ywTexture;
break;
case 'sunny':
spriteSwitch = false;
break;
case 'yt':
spriteSwitch = false;
scene.fog = new THREE.Fog(0xE0E0E0, 1000, 3500);
break;
case 'rain':
scope.instance.material.map = rainPoint;
spriteSwitch = true;
spriteSpeed = 0.01;
spriteRota = 0;
scope.instance.material.size = 0.5;
scene.fog = new THREE.Fog(0xE0E0E0, 1000, 3500);
break;
case 'snow':
scope.instance.material.map = snowPoint;
spriteSwitch = true;
spriteSpeed = 0.0001;
spriteRota = 0.002;
scope.instance.material.size = 1.5;
scene.fog = new THREE.Fog(0xE0E0E0, 1000, 3500);
break;
case 'dy':
spriteSwitch = false;
scene.fog = new THREE.Fog(0xE0E0E0, 500, 3000);
break;
case 'sand':
scene.fog = new THREE.Fog(0x977C00, 1, 1000);
break;
case 'wm':
spriteSwitch = false;
scene.fog = new THREE.Fog(0x9D9D9D, 1, 1000);
}
//
// if(type == "sunny"){
// scope.skybox.material.map = sunnyTexture;
// spriteSwitch = false;
// }
// if(type == "evening"){
// scope.skybox.material.map = eveningTexture;
// spriteSwitch = false;
// }
// if(type == "rain"){
// scope.skybox.material.map = rainTexture;
// }
// if(type == "snow"){
// scope.skybox.material.map = rainTexture;
// }
if(spriteSwitch == true){
if(scope.skybox.children.length == 0){
scope.skybox.add(scope.instance);
}
}else{
scope.skybox.remove(scope.instance);
}
scope.skybox.material.map.needsUpdate = true;
scope.instance.material.map.needsUpdate = true;
}
this.update = function(cameraPos){
scope.skybox.position.x = cameraPos.x;
scope.skybox.position.z = cameraPos.z;
if(spriteSwitch == true){
let positions = this.geom.attributes.position.array;
for(let i=0; i<this.drops * 3; i+=3){ //改变Y坐标加速运动
this.velocityY[i/3] += Math.random() * spriteSpeed;
positions[ i + 1 ] -= this.velocityY[i/3];
if(positions[ i + 1 ] < 30){
positions[ i + 1 ] = 800;
this.velocityY[i/3] = 0.5 + Math.random()* spriteSpeed;
}
}
this.instance.rotation.y += spriteRota;
this.geom.attributes.position.needsUpdate = true;
}
}
}

View File

@ -342,6 +342,10 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
scope.raycasterstatus = false;
scope.nowobject = null;
updatemenulist();
if(data._type == "Station"){
console.log(data);
}
if (data._type == "Switch") {
// scope.modelmanager.switchmodel.locateType = data.body.locateType;

View File

@ -165,7 +165,7 @@ export function JLmapDriving(dom,data,mapId,storemod,translation,routegroup,proj
// datanew();
DriverLoadNew(mapnetdata,scope,netdata.data,mapdata,sectionlist,signallist,switchlist,stationstandlist,trainlisttest,rails,camera,controls3,scene,mixers);
DriverLoadNew(mapnetdata,scope,netdata.data,mapdata,sectionlist,signallist,switchlist,stationstandlist,trainlisttest,rails,camera,controls3,scene,mixers,project);
var timer = setInterval(function() {
if(trainlisttest){
if(trainlisttest.group){
@ -386,7 +386,7 @@ export function JLmapDriving(dom,data,mapId,storemod,translation,routegroup,proj
realsectionlist = loadrealsectionlist;
rails = loadrails;
// console.log(trainlisttest.group.children[0]);
console.log(trainlisttest);
trainlisttest.group.children[0].getObjectByName("C6").add(cameracctv);
}

View File

@ -1,6 +1,5 @@
import StompClient from '@/utils/sock';
import { getBaseUrl } from '@/utils/baseUrl'
import store from '@/store/index';
import { getToken } from '@/utils/auth';
// 定于仿真socket接口
@ -43,7 +42,7 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
let header = {'X-Token': getToken() };
let connectmsg = {
type:'init',
baseurl:getBaseUrl(),
baseurl:store.state.user.baseUrl,
topic:this.topic,
token:getToken(),
};
@ -364,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;
@ -522,6 +521,10 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
}
}
}else{
updateTrainModel.position.x = -100000;
}
}
@ -537,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();
@ -744,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){
@ -1006,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();

View File

@ -20,9 +20,9 @@ import {Materialload} from '@/jlmap3d/main/loaders/Materialload.js';
import { getPublishMapDetail,getPublish3dMapDetail} from '@/api/jlmap3d/load3ddata';
import StompClient from '@/utils/sock';
import { getBaseUrl } from '@/utils/baseUrl'
import { getToken } from '@/utils/auth';
import { sendCommandNew } from '@/api/jmap/training';
import store from '@/store/index';
var clock = new THREE.Clock();
@ -176,7 +176,7 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
let connectmsg = {
type:'init',
baseurl:getBaseUrl(),
baseurl:store.state.user.baseUrl,
topic:'/user/queue/simulation/jl3d/'+group,
token:getToken(),
};

View File

@ -15,7 +15,7 @@ import {Materialload} from '@/jlmap3d/main/loaders/Materialload.js';
import { getPublishMapDetail,getPublish3dMapDetail} from '@/api/jlmap3d/load3ddata';
import StompClient from '@/utils/sock';
import { getBaseUrl } from '@/utils/baseUrl'
import store from '@/store/index';
import { getToken } from '@/utils/auth';
import { sendCommandNew } from '@/api/jmap/training';
@ -174,7 +174,7 @@ export function Jl3dOtherVR(dom,group,skinCode) {
let connectmsg = {
type:'init',
baseurl:getBaseUrl(),
baseurl:store.state.user.baseUrl,
topic:'/user/queue/simulation/jl3d/'+group,
token:getToken(),
};

View File

@ -10,9 +10,9 @@ import { ModelManagerVR } from '@/jlmap3d/jl3dmaintainer/jl3dTrainRescue/trainre
import { VRButton } from '@/jlmap3d/jl3dmaintainer/jl3dFaultDeviceVr/utils/VRButton.js';
import StompClient from '@/utils/sock';
import { getBaseUrl } from '@/utils/baseUrl'
import { getToken } from '@/utils/auth';
import { sendCommandNew } from '@/api/jmap/training';
import store from '@/store/index';
var clock = new THREE.Clock();
@ -170,7 +170,7 @@ export function Jl3dTrainRescueVr(dom,group,skinCode) {
let connectmsg = {
type:'init',
baseurl:getBaseUrl(),
baseurl:store.state.user.baseUrl,
topic:'/user/queue/simulation/jl3d/'+group,
token:getToken(),
};

View File

@ -2,8 +2,8 @@ import StompClient from '@/utils/sock';
// import { getTrainingCbtcDemon, runDiagramStart, runDiagramOver, setTrainingCbtcInitTime } from '@/api/simulation';
// import { creatSubscribe, clearSubscribe, displayTopic, screenTopic } from '@/utils/stomp';
import { getBaseUrl } from '@/utils/baseUrl'
import { getToken } from '@/utils/auth';
import store from '@/store/index';
// 定于仿真socket接口
export function Maintainerconnect(jlmap3d,routegroup,jsonwebwork,lablecodemap) {
@ -45,7 +45,7 @@ export function Maintainerconnect(jlmap3d,routegroup,jsonwebwork,lablecodemap) {
let header = {'X-Token': getToken() };
let connectmsg = {
type:'init',
baseurl:getBaseUrl(),
baseurl:store.state.user.baseUrl,
topic:this.topic,
token:getToken(),
};
@ -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++){

View File

@ -1,5 +1,4 @@
import StompClient from '@/utils/sock';
import { getBaseUrl } from '@/utils/baseUrl'
import { getToken } from '@/utils/auth';
import store from '@/store/index';

View File

@ -68,7 +68,7 @@ export function JLmapDriving(dom,data,mapId,storemod,translation,routegroup,proj
// 定义场景(渲染容器)
let scene = SetScene(project);
scene.background = new THREE.CubeTextureLoader()
.setPath( 'https://oss.joylink.club/oss/joylink/PICTURE/2021-06-15/' )
.setPath( 'https://joylink.club/oss/joylink/PICTURE/2021-06-15/' )
.load( [ '18-75117.jpg', '17-78286.jpg', '19-62689.jpg', '15-95146.jpg', '16-99183.jpg', '14-94914.jpg' ] );
let meshCloud;

View File

@ -1,8 +1,8 @@
import { AssetModel } from '@/jlmap3d/main/loaders/model/Assetmodel';
import { Assetmaterial } from '@/jlmap3d/main/loaders/model/Assetmaterial';
import { getBaseUrl } from '@/utils/baseUrl';
import store from '@/store/index';
import { Loading } from 'element-ui';
const BASE_API = getBaseUrl();
const BASE_API = store.state.user.baseUrl;
import { JL3D_LOCAL_STATIC,BASE_ASSET_API } from '@/api/jlmap3d/assets3d.js';
let signal5 = {

View File

@ -1,6 +1,6 @@
import StompClient from '@/utils/sock';
import { getBaseUrl } from '@/utils/baseUrl'
import store from '@/store/index';
import { getToken } from '@/utils/auth';
// 定于仿真socket接口
@ -45,7 +45,7 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,sta
let header = {'X-Token': getToken() };
let connectmsg = {
type:'init',
baseurl:getBaseUrl(),
baseurl:store.state.user.baseUrl,
topic:this.topic,
token:getToken(),
};

View File

@ -2,7 +2,7 @@ import StompClient from '@/utils/sock';
// import { getTrainingCbtcDemon, runDiagramStart, runDiagramOver, setTrainingCbtcInitTime } from '@/api/simulation';
// import { creatSubscribe, clearSubscribe, displayTopic, screenTopic } from '@/utils/stomp';
import { getBaseUrl } from '@/utils/baseUrl'
import store from '@/store/index';
import { getToken } from '@/utils/auth';
// 定于仿真socket接口
@ -46,7 +46,7 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
let header = {'X-Token': getToken() };
let connectmsg = {
type:'init',
baseurl:getBaseUrl(),
baseurl:store.state.user.baseUrl,
topic:this.topic,
token:getToken(),
};
@ -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;

View File

@ -14,7 +14,10 @@ import { SetRender } from '@/jlmap3d/config/SetRender';
import { SetScene } from '@/jlmap3d/config/SetScene';
import { SetLights } from '@/jlmap3d/config/SetLights';
//controls
import { WeatherManager } from '@/jlmap3d/config/WeatherManager';
//controlManager.oribitControl
import { ControlManager } from '@/jlmap3d/jl3dsimulation/manager/controlmanager.js';
import { OrbitControls } from '@/jlmap3d/main/control/OrbitControls';
// import { DragControls } from '@/jlmap3d/main/control/DragControls';
@ -36,31 +39,21 @@ import {Stats} from '@/jlmap3d/main/lib/stats.min.js';
var clock = new THREE.Clock();
export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) {
let scope = this;
this.dom = dom;
//初始化webgl渲染
let renderer = SetRender(dom);
renderer.domElement.style.position = "absolute";
renderer.domElement.style.top = "0";
document.getElementById('testjlmap3d').appendChild(renderer.domElement);
//定义相机
let camera = SetCamera(dom);
//定义场景(渲染容器)
let scene = SetScene(project);
let scenesimulation = new THREE.Group();
let scenestation = new THREE.Group();
scene.add(scenesimulation);
scene.add(scenestation);
//定义镜头操作
let controls = new THREE.OrbitControls(camera);
controls.maxPolarAngle = Math.PI/2;
// controls.screenSpacePanning = true;
//controls.minPolarAngle = Math.PI/8;
controls.maxDistance = 1000;
let controlManager = new ControlManager( dom,scene);
let weatherManager = new WeatherManager(scene);
scene.add(weatherManager.skybox);
// scene.add(weatherManager.instance);
//模型加载器
this.assetloader = new AssetLoader();
//替换材质组,例:信号机不同灯光
@ -73,8 +66,6 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) {
this.selectmodel = null;
//鼠标点击模型切换
this.raycasterswitch = "null";
//选中物体描边方框
this.helpbox = null;
//车门,站台门道岔动画构造器
this.mixers = [];
//模型操作命令组
@ -88,6 +79,7 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) {
let trainlisttest = null;
let realsectionlist = null;
let rails = null;
let backgroundModel = null;
//轨道相机
let camerarail = {
@ -110,7 +102,7 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) {
scope.jsonwebworknew = new Worker(JL3D_LOCAL_STATIC+"/workertest/jsonworkernew.js");
scope.Subscribe = new Jlmap3dSubscribeNew(scope,routegroup,scope.jsonwebworknew);
scope.Subscribe.socketon(scope.Subscribe.topic);
SimulationLoadNew(mapnetdata,scope,netdata.data,mapdata,camera,controls,scenesimulation,storemod);
SimulationLoadNew(mapnetdata,scope,netdata.data,mapdata,controlManager.orbitCamera,controlManager.oribitControl,scenesimulation,project);
});
});
@ -124,7 +116,19 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) {
//循环渲染
requestAnimationFrame(animate);
//根据相机渲染场景
renderer.render(scene,camera);
if(controlManager.controlMode == "free"){
controlManager.updateOrbitControl();
}
if(controlManager.controlMode == "fps"){
controlManager.updateFpsControl();
}
if(controlManager.controlMode == "train"){
controlManager.updateTrainControl();
}
weatherManager.update(controlManager.orbitCamera.position);
// console.log(controlManager.orbitCamera.position);
// stats.update();
}
@ -137,7 +141,7 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) {
if(scope.datatype == "new"){
}else{
UpdateTrain(camera,trainlisttest);
UpdateTrain(controlManager.orbitCamera,trainlisttest);
}
delta = clock.getDelta();
@ -157,13 +161,13 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) {
}else{
let point = camerarail.curve.getPointAt(camerarail.progress);
let tangent = camerarail.curve.getPointAt(camerarail.progress+0.001);
camera.position.x = point.x;
camera.position.y = point.y;
camera.position.z = point.z;
controlManager.orbitCamera.position.x = point.x;
controlManager.orbitCamera.position.y = point.y;
controlManager.orbitCamera.position.z = point.z;
camerarail.progress += 0.003;
// controls.target = new THREE.Vector3(point.x+1,point.y,point.z);
controls.target = new THREE.Vector3(tangent.x,tangent.y,tangent.z);
controls.update();
// controlManager.oribitControl.target = new THREE.Vector3(point.x+1,point.y,point.z);
controlManager.oribitControl.target = new THREE.Vector3(tangent.x,tangent.y,tangent.z);
controlManager.oribitControl.update();
point = null;
}
@ -176,11 +180,9 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) {
//释放场景缓存关闭渲染循环
this.dispose = function(){
renderer.setAnimationLoop(null);
renderer.dispose();
scene.dispose();
controls.dispose();
camera = null;
controlManager.oribitControl.dispose();
controlManager.orbitCamera = null;
scope.assetloader = null;
mapdata = null;
@ -188,7 +190,6 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) {
scope.materiallist = null;
scope.selectmodel = null;
scope.helpbox = null;
scope.mixers = null;
scope.actions = null;
scope.Subscribe = null;
@ -196,13 +197,6 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) {
//scope = null;
}
this.rayswitch = function(value){
this.raycasterswitch = value;
if(scope.helpbox){
scene.remove( scope.helpbox );
scope.helpbox = null;
}
};
//切换显示车站信息
this.showstationmsg = function(showtype){
@ -219,7 +213,6 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) {
//切换显示列车信息
this.showtrainmsg = function(showtype){
console.log(trainlisttest);
if(showtype == "show"){
for(let st=0;st<trainlisttest.textlist.length;st++){
trainlisttest.list[trainlisttest.textlist[st].name].children[0].add(trainlisttest.textlist[st]);
@ -230,18 +223,21 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) {
}
}
};
this.changeweather = function(weathertype){
// console.log(weathertype);
weatherManager.changeweather(weathertype);
}
//开启轨道镜头交互
this.animateon = function(){
controls.enabled = true;
controlManager.oribitControl.enabled = true;
};
//关闭轨道镜头交互
this.animateoff = function(){
controls.enabled = false;
controlManager.oribitControl.enabled = false;
};
//更新加载后数据
this.loaderdata = function(loadsectionlist,loadlinklist,loadsignallist,loadstationstandlist,loadtrainlisttest,loadrealsectionlist,loadrails){
this.loaderdata = function(loadsectionlist,loadlinklist,loadsignallist,loadstationstandlist,loadtrainlisttest,loadrealsectionlist,loadrails,bgmodel){
sectionlist = loadsectionlist;
linklist = loadlinklist;
@ -251,58 +247,57 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) {
trainlisttest = loadtrainlisttest;
realsectionlist = loadrealsectionlist;
rails = loadrails;
backgroundModel = bgmodel;
}
this.eventon = function(){
//raycaster交互模型点击事件
document.getElementById("testjlmap3d").addEventListener( "mousedown", onselect, false );
//窗口自适应
window.addEventListener( 'resize', onWindowResize, false );
document.getElementById("testjlmap3d").addEventListener( "mousedown", onselect, false );
controls.update();
};
this.eventoff = function(){
//console.log("off");
//raycaster交互模型点击事件
document.getElementById("testjlmap3d").removeEventListener( "mousedown", onselect, false );
//窗口自适应
window.removeEventListener( 'resize', onWindowResize, false );
};
this.enterStopStation = function(){
jl3dSimulationGlobeFunction('changeview','fps');
controlManager.attachFpsCamera(backgroundModel,{x:-2212,y:10.7,z:-15.7});
}
//根据菜单选项切换相机位置
this.updatecamera = function(mesh,type){
if(type == "station"){
camera.position.x = mesh.position.x;
camera.position.y = mesh.position.y+800;
camera.position.z = mesh.position.z+300;
controlManager.orbitCamera.position.x = mesh.position.x;
controlManager.orbitCamera.position.y = mesh.position.y+800;
controlManager.orbitCamera.position.z = mesh.position.z+300;
//更新相机方向
controls.target = new THREE.Vector3(mesh.position.x,mesh.position.y,mesh.position.z);
}
if(type == "train"){
camera.position.x = mesh.position.x;
camera.position.y = mesh.position.y+800;
camera.position.z = mesh.children[2].matrixWorld.elements[14]+300;
//更新相机方向
controls.target = new THREE.Vector3(mesh.position.x,mesh.position.y,mesh.children[2].matrixWorld.elements[14]);
controlManager.oribitControl.target = new THREE.Vector3(mesh.position.x,mesh.position.y,mesh.position.z);
if(stationstandlist && trainlisttest){
controlManager.oribitControl.upmodeldirect(stationstandlist,trainlisttest);
}
controlManager.oribitControl.update();
}
if(stationstandlist && trainlisttest){
controls.upmodeldirect(stationstandlist,trainlisttest);
if(type == "train"){
controlManager.attachTrainCamera(mesh);
}
controls.update();
}
//窗口自适应
function onWindowResize() {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize( window.innerWidth, window.innerHeight );
this.backFpsView = function(){
controlManager.deattachFpsCamera();
if(stationstandlist && trainlisttest){
controlManager.oribitControl.upmodeldirect(stationstandlist,trainlisttest);
}
controlManager.oribitControl.update();
}
this.backTrainView = function(){
controlManager.deattachTrainCamera();
if(stationstandlist && trainlisttest){
controlManager.oribitControl.upmodeldirect(stationstandlist,trainlisttest);
}
controlManager.oribitControl.update();
}
//三维交互点击事件函数
function onselect(event) {
if(event.button == "0"){
if(controlManager.controlMode != 'fps' && event.button == "0" && stationstandlist){
//定义光线
let raycaster = new THREE.Raycaster();
//定义平面鼠标点击坐标
@ -310,81 +305,18 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) {
mouse.x = (event.clientX / window.innerWidth) * 2 - 1;
mouse.y = -(event.clientY / window.innerHeight) * 2 + 1;
raycaster.setFromCamera( mouse, camera );
if(scope.helpbox){
scene.remove( scope.helpbox );
scope.helpbox = null;
}
if(scope.raycasterswitch == "stand"){
raycaster.setFromCamera( mouse, controlManager.orbitCamera );
//从站台对象组获取点击目标
let intersects1 = raycaster.intersectObjects( stationstandlist.textlist);
let intersects1 = raycaster.intersectObjects( stationstandlist.group.children,true);
//获取最近处点击到的模型对象
if(intersects1[0]){
//遍历对象组获取对象坐标更新相机数据
for(let j=0;j<stationstandlist.list.length;j++){
if(intersects1[0].object.name == stationstandlist.list[j].mesh.code){
camera.position.x = stationstandlist.list[j].mesh.position.x;
camera.position.y = stationstandlist.list[j].mesh.position.y+200;
camera.position.z = stationstandlist.list[j].mesh.position.z+300;
//更新相机方向
controls.target = new THREE.Vector3(stationstandlist.list[j].mesh.position.x,stationstandlist.list[j].mesh.position.y,stationstandlist.list[j].mesh.position.z);
controls.update();
}
if(!intersects1[0].object.modeltype){
jl3dSimulationGlobeFunction('changeview','fps');
controlManager.attachFpsCamera(intersects1[0].object.parent,intersects1[0].point);
}
}
}
if(scope.raycasterswitch == "train"){
let intersects = raycaster.intersectObjects( trainlisttest.textlist);
if(intersects[0]){
for(let j=0;j<trainlisttest.list.length;j++){
if(intersects[0].object.name == trainlisttest.list[j].name){
// console.log(trainlisttest.list[j].position.x);
// console.log(trainlisttest.list[j].position.y);
// console.log(trainlisttest.list[j].children[2].matrixWorld.elements[14]);
camera.position.x = trainlisttest.list[j].position.x;
camera.position.y = 200;
camera.position.z = trainlisttest.list[j].children[2].matrixWorld.elements[14]+300;
//console.log(camera.position);
controls.target = new THREE.Vector3(trainlisttest.list[j].children[2].matrixWorld.elements[12],trainlisttest.list[j].children[2].matrixWorld.elements[13],trainlisttest.list[j].children[2].matrixWorld.elements[14]);
controls.update();
}
}
}
}
if(scope.raycasterswitch == "section"){
//console.log(sectionlist.sections.modellist);
let intersects = raycaster.intersectObjects( linklist.linksgroup.children,true);
if(intersects[0]){
// console.log(intersects[0].object);
scope.helpbox = new THREE.BoxHelper( intersects[0].object, 0xff0000 );
scene.add( scope.helpbox );
}
}
if(scope.raycasterswitch == "signal"){
let intersects = raycaster.intersectObjects( signallist.group.children,true);
if(intersects[0]){
// console.log(intersects[0].object.matrixWorld);
scope.helpbox = new THREE.BoxHelper( intersects[0].object, 0xff0000 );
scene.add( scope.helpbox );
}
}
if(scope.raycasterswitch == "switch"){
console.log(sectionlist);
let intersects = raycaster.intersectObjects( sectionlist.switchs.modellist,true);
if(intersects[0]){
scope.helpbox = new THREE.BoxHelper( intersects[0].object, 0xff0000 );
scene.add( scope.helpbox );
}
}
}
}
@ -422,8 +354,8 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) {
// points.push(new THREE.Vector3(stationp1.x+40,3,stationp1.z+15));
// controls.target = new THREE.Vector3(camera.position.x+1,camera.position.y,camera.position.z);
// controls.update();
// controlManager.oribitControl.target = new THREE.Vector3(controlManager.orbitCamera.position.x+1,controlManager.orbitCamera.position.y,controlManager.orbitCamera.position.z);
// controlManager.oribitControl.update();
camerarail.curve = new THREE.CatmullRomCurve3(points);
}

View File

@ -0,0 +1,428 @@
import { Capsule } from '@/jlmap3d/utils/math/Capsule.js';
import { Octree } from '@/jlmap3d/utils/math/Octree.js';
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
import { OBJLoader } from '@/jlmap3d/main/loaders/OBJLoader';
export function ControlManager(dom,scene,lessonData,lessonIndex) {
let scope = this;
this.controlMode = "free";
this.controls = {};
this.nowCamera = null;
this.eventHitMode = false;
let modelManager;
let examList = {};
let examData = {};
let eventBoxs = [];
let raycasterBoxs = [];
let actionList = [];
let eventTrigger;
let nowActions = [];
let allOverAction;
let trainDeviceMode = false;
let fpsMouseStatus = false;
var audiopbm = JL3D_LOCAL_STATIC+'/lesson3d/audio/pbm.wav';
audiopbm = new Audio(audiopbm);
let renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setSize(dom.offsetWidth, dom.offsetHeight);
// renderer.autoClear = false;
renderer.sortObjects = true;
renderer.domElement.style.position = "absolute";
renderer.domElement.style.top = "0";
document.getElementById('testjlmap3d').appendChild(renderer.domElement);
this.orbitCamera = new THREE.PerspectiveCamera(60, dom.clientWidth/dom.clientHeight, 1, 4000);
this.orbitCamera.position.set(0, 0, 0);
this.orbitCamera.aspect = window.innerWidth / window.innerHeight;
this.orbitCamera.updateProjectionMatrix();
this.oribitControl = new THREE.OrbitControls(scope.orbitCamera,dom);
this.oribitControl.maxPolarAngle = Math.PI / 2;
this.oribitControl.maxDistance = 800;
this.oribitControl.update();
let trainCamera = new THREE.PerspectiveCamera( 75,dom.offsetWidth / dom.offsetHeight, 0.1, 1000 );
trainCamera.aspect = dom.offsetWidth / dom.offsetHeight;
trainCamera.updateProjectionMatrix();
let fpsCamera = new THREE.PerspectiveCamera( 75,dom.offsetWidth / dom.offsetHeight, 0.1, 6000 );
fpsCamera.aspect = dom.offsetWidth / dom.offsetHeight;
fpsCamera.rotation.order = 'YXZ';
let attachBox = new THREE.Mesh(
new THREE.BoxGeometry(1,1.5, 1),
new THREE.MeshBasicMaterial({color: 0xff00000,transparent: true,opacity: 0 })//RED box
);
let hitBox = new THREE.Box3(new THREE.Vector3(), new THREE.Vector3());
hitBox.setFromObject(attachBox);
scene.add(attachBox);
//fps control
const GRAVITY = 30;
const NUM_SPHERES = 20;
const SPHERE_RADIUS = 0.1;
const sphereGeometry = new THREE.SphereGeometry( SPHERE_RADIUS, 16, 16 );
const sphereMaterial = new THREE.MeshStandardMaterial( { color: 0x888855, roughness: 0.8, metalness: 0.5, } );
const spheres = [];
let sphereIdx = 0;
for ( let i = 0; i < NUM_SPHERES; i ++ ) {
const sphere = new THREE.Mesh( sphereGeometry, sphereMaterial );
scene.add( sphere );
spheres.push( { mesh: sphere, collider: new THREE.Sphere( new THREE.Vector3( 0, - 100, 0 ), SPHERE_RADIUS ), velocity: new THREE.Vector3() } );
}
const worldOctree = new Octree();
const playerCollider = new Capsule( new THREE.Vector3( 0, 10, 0 ), new THREE.Vector3( 0, 11.5, 0 ), 1 );
// playerCollider.set(
// new THREE.Vector3(
// lessonData.lessonProgress[lessonIndex].cameraPosition.x,
// lessonData.lessonProgress[lessonIndex].cameraPosition.y,
// lessonData.lessonProgress[lessonIndex].cameraPosition.z),
// new THREE.Vector3(
// lessonData.lessonProgress[lessonIndex].cameraPosition.x,
// lessonData.lessonProgress[lessonIndex].cameraPosition.y+1.5,
// lessonData.lessonProgress[lessonIndex].cameraPosition.z ), 1);
// attachBox.position.x = lessonData.lessonProgress[lessonIndex].cameraPosition.x;
// attachBox.position.y = lessonData.lessonProgress[lessonIndex].cameraPosition.y ;
// attachBox.position.z = lessonData.lessonProgress[lessonIndex].cameraPosition.z;
const playerVelocity = new THREE.Vector3();
const playerDirection = new THREE.Vector3();
let playerOnFloor = false;
const keyStates = {};
let clock = new THREE.Clock();
let nowStation = "";
this.attachFpsCamera = function(mesh,point){
nowStation = mesh;
worldOctree.fromGraphNode( nowStation );
scope.nowCamera = fpsCamera;
scope.oribitControl.enabled = false;
attachBox.position.x = point.x;
attachBox.position.y = point.y;
attachBox.position.z = point.z;
playerCollider.set(
new THREE.Vector3(
point.x,
point.y,
point.z),
new THREE.Vector3(
point.x,
point.y+1.5,
point.z ), 1);
scope.orbitCamera.position.x = point.x;
scope.orbitCamera.position.y = point.y+800;
scope.orbitCamera.position.z = point.z+300;
//更新相机方向
scope.oribitControl.target = new THREE.Vector3(point.x,point.y,point.z);
scope.controlMode = "fps";
}
this.deattachFpsCamera = function(){
scope.oribitControl.enabled = true;
scope.controlMode = "free";
scope.orbitCamera.position.x = nowStation.position.x;
scope.orbitCamera.position.y = nowStation.position.y+800;
scope.orbitCamera.position.z = nowStation.children[2].matrixWorld.elements[14]+300;
//更新相机方向
scope.oribitControl.target = new THREE.Vector3(nowStation.position.x,nowStation.position.y,nowStation.children[2].matrixWorld.elements[14]);
scope.oribitControl.enabled = true;
// playerCollider = new Capsule( new THREE.Vector3( 0, 10, 0 ), new THREE.Vector3( 0, 11.9, 0 ), 1 );
}
let nowTrain = "";
this.attachTrainCamera = function(mesh){
scope.oribitControl.enabled = false;
nowTrain = mesh;
this.controlMode = "train";
mesh.children[0].add(trainCamera);
trainCamera.position.x = 10;
trainCamera.position.y = 0;
trainCamera.position.z = 4.5;
trainCamera.rotation.x = Math.PI/2;
trainCamera.rotation.y = -Math.PI/2;
}
this.deattachTrainCamera = function(){
scope.oribitControl.enabled = true;
scope.controlMode = "free";
scope.orbitCamera.position.x = nowTrain.position.x;
scope.orbitCamera.position.y = nowTrain.position.y+800;
scope.orbitCamera.position.z = nowTrain.children[2].matrixWorld.elements[14]+300;
//更新相机方向
scope.oribitControl.target = new THREE.Vector3(nowTrain.position.x,nowTrain.position.y,nowTrain.children[2].matrixWorld.elements[14]);
scope.oribitControl.enabled = true;
}
this.updateOrbitControl = function(){
scope.oribitControl.update();
render(scope.orbitCamera);
};
this.updateFpsControl = function(){
const deltaTime = Math.min( 0.1, clock.getDelta() );
controls( deltaTime );
updatePlayer( deltaTime );
updateSpheres( deltaTime );
render(fpsCamera);
};
this.updateTrainControl = function(){
render(trainCamera);
}
this.updatePos = function(pos){
playerCollider.set(
new THREE.Vector3(
pos.x,
pos.y,
pos.z),
new THREE.Vector3(
pos.x,
pos.y+1.5,
pos.z ), 1);
}
document.addEventListener( 'keydown', ( event ) => {
keyStates[ event.code ] = true;
} );
document.addEventListener( 'keyup', ( event ) => {
keyStates[ event.code ] = false;
} );
document.addEventListener( 'mousedown', (event) => {
fpsMouseStatus = true;
});
document.body.addEventListener( 'mousemove', ( event ) => {
if(fpsMouseStatus == true){
fpsCamera.rotation.y -= event.movementX / 500;
fpsCamera.rotation.x -= event.movementY / 500;
}
// if ( document.pointerLockElement === document.body ) {
// }
} );
document.addEventListener( 'mouseup', () => {
fpsMouseStatus = false;
} );
function playerCollitions() {
const result = worldOctree.capsuleIntersect( playerCollider );
playerOnFloor = false;
if ( result ) {
playerOnFloor = result.normal.y > 0;
if ( ! playerOnFloor ) {
playerVelocity.addScaledVector( result.normal, - result.normal.dot( playerVelocity ) );
}
playerCollider.translate( result.normal.multiplyScalar( result.depth ) );
}
}
function updatePlayer( deltaTime ) {
if ( playerOnFloor ) {
const damping = Math.exp( - 3 * deltaTime ) - 1;
playerVelocity.addScaledVector( playerVelocity, damping );
} else {
if(playerVelocity.y>-10){
playerVelocity.y -= GRAVITY * deltaTime;
}
}
const deltaPosition = playerVelocity.clone().multiplyScalar( deltaTime );
playerCollider.translate( deltaPosition );
playerCollitions();
fpsCamera.position.copy( playerCollider.end );
}
function spheresCollisions() {
for ( let i = 0; i < spheres.length; i ++ ) {
const s1 = spheres[ i ];
for ( let j = i + 1; j < spheres.length; j ++ ) {
const s2 = spheres[ j ];
const d2 = s1.collider.center.distanceToSquared( s2.collider.center );
const r = s1.collider.radius + s2.collider.radius;
const r2 = r * r;
if ( d2 < r2 ) {
const normal = s1.collider.clone().center.sub( s2.collider.center ).normalize();
const v1 = normal.clone().multiplyScalar( normal.dot( s1.velocity ) );
const v2 = normal.clone().multiplyScalar( normal.dot( s2.velocity ) );
s1.velocity.add( v2 ).sub( v1 );
s2.velocity.add( v1 ).sub( v2 );
const d = ( r - Math.sqrt( d2 ) ) / 2;
s1.collider.center.addScaledVector( normal, d );
s2.collider.center.addScaledVector( normal, - d );
}
}
}
}
function updateSpheres( deltaTime ) {
spheres.forEach( sphere =>{
sphere.collider.center.addScaledVector( sphere.velocity, deltaTime );
const result = worldOctree.sphereIntersect( sphere.collider );
if ( result ) {
sphere.velocity.addScaledVector( result.normal, - result.normal.dot( sphere.velocity ) * 1.5 );
sphere.collider.center.add( result.normal.multiplyScalar( result.depth ) );
} else {
sphere.velocity.y -= GRAVITY * deltaTime;
}
const damping = Math.exp( - 1.5 * deltaTime ) - 1;
sphere.velocity.addScaledVector( sphere.velocity, damping );
spheresCollisions();
sphere.mesh.position.copy( sphere.collider.center );
} );
}
function getForwardVector() {
fpsCamera.getWorldDirection( playerDirection );
playerDirection.y = 0;
playerDirection.normalize();
return playerDirection;
}
function getSideVector() {
fpsCamera.getWorldDirection( playerDirection );
playerDirection.y = 0;
playerDirection.normalize();
playerDirection.cross( fpsCamera.up );
return playerDirection;
}
function controls( deltaTime ) {
const speed = 25;
if ( playerOnFloor ) {
if ( keyStates[ 'KeyW' ] ) {
playerVelocity.add( getForwardVector().multiplyScalar( speed * deltaTime ) );
}
if ( keyStates[ 'KeyS' ] ) {
playerVelocity.add( getForwardVector().multiplyScalar( - speed * deltaTime ) );
}
if ( keyStates[ 'KeyA' ] ) {
playerVelocity.add( getSideVector().multiplyScalar( - speed * deltaTime ) );
}
if ( keyStates[ 'KeyD' ] ) {
playerVelocity.add( getSideVector().multiplyScalar( speed * deltaTime ) );
}
if ( keyStates[ 'Space' ] ) {
playerVelocity.y = 10;
}
}
}
function render(camera){
renderer.render( scene, camera );
}
window.onresize = function () {
scope.orbitCamera.aspect = window.innerWidth / window.innerHeight;
scope.orbitCamera.updateProjectionMatrix();
fpsCamera.aspect = window.innerWidth / window.innerHeight;
fpsCamera.updateProjectionMatrix();
renderer.setSize(dom.offsetWidth,dom.offsetHeight);
}
}

View File

@ -1,5 +1,4 @@
import StompClient from '@/utils/sock';
import { getBaseUrl } from '@/utils/baseUrl'
import { getToken } from '@/utils/auth';
import store from '@/store/index';

View File

@ -1,5 +1,4 @@
import StompClient from '@/utils/sock';
import { getBaseUrl } from '@/utils/baseUrl'
import { getToken } from '@/utils/auth';
import store from '@/store/index';

View File

@ -1,5 +1,4 @@
import StompClient from '@/utils/sock';
import { getBaseUrl } from '@/utils/baseUrl'
import { getToken } from '@/utils/auth';
import store from '@/store/index';

View File

@ -1,5 +1,4 @@
import StompClient from '@/utils/sock';
import { getBaseUrl } from '@/utils/baseUrl'
import { getToken } from '@/utils/auth';
import store from '@/store/index';

View File

@ -1,5 +1,4 @@
import StompClient from '@/utils/sock';
import { getBaseUrl } from '@/utils/baseUrl'
import { getToken } from '@/utils/auth';
import store from '@/store/index';

View File

@ -1,5 +1,4 @@
import StompClient from '@/utils/sock';
import { getBaseUrl } from '@/utils/baseUrl'
import { getToken } from '@/utils/auth';
import store from '@/store/index';

View File

@ -1,6 +1,5 @@
import StompClient from '@/utils/sock';
import { getBaseUrl } from '@/utils/baseUrl'
import { getToken } from '@/utils/auth';
import store from '@/store/index';

View File

@ -16,7 +16,8 @@ import { ControlManager } from '@/jlmap3d/lesson3d/manager/controlmanager.js';
import { AnimateManager } from '@/jlmap3d/lesson3d/manager/animatemanager.js';
import { Fire } from '@/jlmap3d/lesson3d/utils/fire.js';
import { AccidentManager } from '@/jlmap3d/lesson3dedit/manager/accidentmanager.js';
import { Loading } from 'element-ui';
@ -29,7 +30,6 @@ export function Lesson3dPlayer(dom,lessonData,lessonIndex) {
// let stats = new Stats();
// dom.appendChild( stats.dom );
let scope = this;
this.dom = dom;
this.nowSceneType = "";
@ -51,21 +51,26 @@ export function Lesson3dPlayer(dom,lessonData,lessonIndex) {
light.position.set( 0, 4000, 0 );
scene.add( light );
// let fire = new Fire();
// fire.init(scene);
var audionext = JL3D_LOCAL_STATIC+'/lesson3d/audio/next.wav';
audionext = new Audio(audionext);
let animateManager = new AnimateManager();
let controlManager = new ControlManager( dom,scene,lessonData,lessonIndex);
let accidentManager = new AccidentManager(scene);
accidentManager.initAccident('player');
if(lessonData.accidentList){
accidentManager.loadAccidentList(lessonData.accidentList)
}
let loadingInstance = Loading.service({ fullscreen: true });
let assetModelManager = new AssetModelManager(scope,scene,controlManager);
let assetModelManager = new AssetModelManager(scope,scene);
assetModelManager.lessonAssetsLoader(lessonData).then((result) => {
scope.nowSceneType = lessonData.lessonProgress[0].progressScene;
animateManager.initAnimation(assetModelManager);
console.log(lessonData.trainDeviceData);
// console.log(lessonData.trainDeviceData);
controlManager.init(animateManager.actions,assetModelManager,lessonData.trainDeviceData);
startLesson();
@ -76,8 +81,6 @@ export function Lesson3dPlayer(dom,lessonData,lessonIndex) {
//console.log(error);
});
this.actionModelControl = function(actionType,actionModel){
if(actionType == "remove"){
@ -88,6 +91,11 @@ export function Lesson3dPlayer(dom,lessonData,lessonIndex) {
}else if(actionType == "changeIndex"){
actionModel.visible = true;
assetModelManager.otherModel.add(actionModel);
audionext.play();
}else if(actionType == "showaccident"){
accidentManager.addAccident(actionModel,scope.nowSceneType);
}else if(actionType == "removeaccident"){
accidentManager.removeAccident(actionModel,scope.nowSceneType);
}
}
@ -98,14 +106,13 @@ export function Lesson3dPlayer(dom,lessonData,lessonIndex) {
this.changeIndex = function(nowIndex){
if(nowIndex!=0){
audionext.play();
oldIndex = lessonIndex;
if(lessonData.lessonProgress[oldIndex].roleName == nowRole){
updateExam(lessonData.lessonProgress[oldIndex],oldIndex);
}
}
lessonIndex = nowIndex;
// console.log(nowIndex);
@ -114,6 +121,7 @@ export function Lesson3dPlayer(dom,lessonData,lessonIndex) {
// console.log(lessonData.lessonProgress[lessonIndex].roleName);
if(lessonData.lessonProgress[lessonIndex].roleName == nowRole){
assetModelManager.changeSceneGroup(scope.nowSceneType);
accidentManager.changeSceneGroup(scope.nowSceneType);
controlManager.initRoleMode(true,nowRole);
controlManager.initControlMode(lessonIndex);
controlManager.changeIndexEvent(lessonData.lessonProgress[lessonIndex].action,true,assetModelManager.lessonTriggerList[scope.nowSceneType]);
@ -121,6 +129,7 @@ export function Lesson3dPlayer(dom,lessonData,lessonIndex) {
} else{
if(lessonData.lessonProgress[lessonIndex].roleName == 'kong'){
assetModelManager.changeSceneGroup(scope.nowSceneType);
accidentManager.changeSceneGroup(scope.nowSceneType);
controlManager.initRoleMode(false,nowRole);
}
controlManager.initRoleMode(false,nowRole);
@ -204,7 +213,7 @@ export function Lesson3dPlayer(dom,lessonData,lessonIndex) {
if(controlManager.controlMode == "non"){
controlManager.updateOrbitControl();
}
// fire.update();
accidentManager.update();
animateManager.updateAnimation();
requestAnimationFrame(animate);

View File

@ -8,9 +8,12 @@ export function AnimateManager() {
let mixers = [];
this.actions = [];
let clock = new THREE.Clock();
let mixerUpdateDelta;
this.initAnimation = function(assetModelManager){
for(let k in assetModelManager.staticAsset){
if(assetModelManager.staticAsset[k].mesh.animations.length > 0){
// console.log(assetModelManager.staticAsset[k]);
@ -22,8 +25,8 @@ export function AnimateManager() {
for(let i=0;i <assetModelManager.staticAsset[k].mesh.children.length;i++){
if(assetModelManager.staticAsset[k].mesh.children[i].type == "Group"){
assetModelManager.staticAsset[k].mesh.children[i].animations = [];
//
// console.log(assetModelManager.staticAsset[k].mesh.children[i]);
//console.log(assetModelManager.staticAsset[k].mesh);
assetModelManager.staticAsset[k].mesh.children[i].animations.push(animations.clone());
let mixer = new THREE.AnimationMixer( assetModelManager.staticAsset[k].mesh.children[i] );
@ -31,7 +34,8 @@ export function AnimateManager() {
scope.actions[actionName] = {
status:"01",
action:mixer.clipAction( assetModelManager.staticAsset[k].mesh.children[i].animations[ 0 ])
action:mixer.clipAction( assetModelManager.staticAsset[k].mesh.children[i].animations[ 0 ]),
actionType:assetModelManager.staticAsset[k].mesh.name,
};
scope.actions[actionName].action.setLoop(THREE.LoopOnce);
@ -41,7 +45,7 @@ export function AnimateManager() {
}
}
}else{
}else{
let animations = assetModelManager.staticAsset[k].mesh.animations;
let mixer = new THREE.AnimationMixer( assetModelManager.staticAsset[k].mesh );
let actionName = assetModelManager.staticAsset[k].mesh.name;
@ -56,14 +60,30 @@ export function AnimateManager() {
}
}
for(let j in assetModelManager.lessonTriggerList){
for(let i =0;i<assetModelManager.lessonTriggerList[j].length;i++){
if(assetModelManager.lessonTriggerList[j][i].cloneanimations){
let animations = assetModelManager.lessonTriggerList[j][i].animations;
let mixer = new THREE.AnimationMixer( assetModelManager.lessonTriggerList[j][i] );
let actionName = assetModelManager.lessonTriggerList[j][i].name;
scope.actions[actionName] = {
status:"01",
action:mixer.clipAction( assetModelManager.lessonTriggerList[j][i].animations[ 0 ])
};
// scope.actions[actionName].action.play();
mixers.push(mixer);
}
}
}
}
let clock = new THREE.Clock();
let mixerUpdateDelta;
this.updateAnimation = function(){
mixerUpdateDelta = clock.getDelta();
for(let i=mixers.length-1;i>=0;i--){
if(mixers[i]._actions[0].isRunning()){
mixers[i].update( mixerUpdateDelta );

View File

@ -112,9 +112,7 @@ export function AssetModelManager(editor,scene) {
scope.lessonTriggerList["dc"] = [];
this.changeSceneGroup = function(groupType){
// console.log(groupType);
// console.log(editor.nowSceneType);
// console.log(scope.lessonTriggerList[editor.nowSceneType]);
editor.nowSceneType = groupType;
scene.remove(this.otherModel);
this.otherModel = groupList[groupType];
@ -153,10 +151,14 @@ export function AssetModelManager(editor,scene) {
initTriggerList();
let modelList = lessonData.modelList;
for(let i=0;i<modelList.length;i++){
// console.log(modelList[i]);
let newModelTrigger = scope.loadAsset[modelList[i].modelId].mesh.clone(true);
if(scope.loadAsset[modelList[i].modelId].mesh.animations.length>0){
newModelTrigger.animations = scope.loadAsset[modelList[i].modelId].mesh.animations;
newModelTrigger.cloneanimations = true;
}
newModelTrigger.showType = "loadModel";
newModelTrigger.label = modelList[i].label;
newModelTrigger.name = modelList[i].label;
newModelTrigger.modelId = modelList[i].modelId;
newModelTrigger.visible = modelList[i].visible;
newModelTrigger.position.x = modelList[i].pos.x;

View File

@ -1,7 +1,7 @@
import { Capsule } from '@/jlmap3d/lesson3d/math/Capsule.js';
import { Capsule } from '@/jlmap3d/utils/math/Capsule.js';
import { Octree } from '@/jlmap3d/lesson3d/math/Octree.js';
import { Octree } from '@/jlmap3d/utils/math/Octree.js';
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
import { OBJLoader } from '@/jlmap3d/main/loaders/OBJLoader';
@ -29,6 +29,9 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) {
let trainDeviceMode = false;
let trainDeviceList = [];
var audiopbm = JL3D_LOCAL_STATIC+'/lesson3d/audio/pbm.wav';
audiopbm = new Audio(audiopbm);
let renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setClearColor(new THREE.Color(0x000000));
renderer.setViewport( 0, 0, dom.offsetWidth, dom.offsetHeight);
@ -130,7 +133,6 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) {
this.initRoleMode = function(rMode,role){
roleMode = rMode;
nowRole = role;
// console.log(roleMode);
};
this.initExam = function(newExamList,newExamData){
@ -297,6 +299,10 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) {
actionEvent("remove",raycasterBoxs[i],raycasterBoxs[i].mesh);
jumpEvent("action",raycasterBoxs[i]);
}else if(raycasterBoxs[i].actionMode == "play"){
// console.log(raycasterBoxs[i]);
if(raycasterBoxs[i].action.actionType == "PBMDH"){
audiopbm.play();
}
if(raycasterBoxs[i].animateModel != "播放动画的模型"){
if(raycasterBoxs[i].action.status == "01"){
raycasterBoxs[i].action.status = "02";
@ -604,6 +610,8 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) {
attachBox.position.x = lessonData.lessonProgress[nowLessonIndex].cameraPosition.x;
attachBox.position.y = lessonData.lessonProgress[nowLessonIndex].cameraPosition.y ;
attachBox.position.z = lessonData.lessonProgress[nowLessonIndex].cameraPosition.z;
console.log(lessonData.lessonProgress[nowLessonIndex]);
fpsCamera.lookAt(lessonData.lessonProgress[nowLessonIndex].cameraTarget.x,lessonData.lessonProgress[nowLessonIndex].cameraTarget.y,lessonData.lessonProgress[nowLessonIndex].cameraTarget.z);
}
}
@ -639,7 +647,6 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) {
for(let i=0;i<actions.length;i++){
if(actions[i].actionType == "auto"){
if(actions[i].actionMode == "play"){
for(let j=0;j<eventTrigger.length;j++){
if(eventTrigger[j].label == actions[i].actionModel){
@ -689,6 +696,13 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) {
}
}
}
if(actions[i].actionMode == "showaccident"){
actionEvent("showaccident",actions[i],actions[i].actionModel);
}
if(actions[i].actionMode == "removeaccident"){
actionEvent("removeaccident",actions[i],actions[i].actionModel);
}
}
if(roleMode){
if(actions[i].actionType == "contact"){

View File

@ -0,0 +1,18 @@
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
export function BagItemData() {
let scope = this;
this.dataList = [];
scope.dataList["ztg"] = [
{
id:"pbmys",
name:"屏蔽门钥匙",
type:"equip",
pic:JL3D_LOCAL_STATIC+"/lesson3d/item/pbmys.png",
status:false,
},
];
}

View File

@ -4,12 +4,25 @@ export function Fire() {
var last_time_activate = Date.now();
this.createNew = function(scene,pos){
this.createAdd = function(scene,pos){
scope.points = new Points(pos);
scope.points.init(pos);
scene.add(scope.points.obj);
}
this.createNew = function(scene,pos){
scope.points = new Points(pos);
scope.points.init(pos);
}
this.addAccident = function(scene){
scene.add(scope.points.obj);
}
this.removeAccident = function(scene){
scene.remove(scope.points.obj);
}
this.update = function(){
var now = Date.now();
scope.points.update();

View File

@ -182,7 +182,7 @@ export function Lesson3dEditor(dom,lessonData) {
var intersects = raycaster.intersectObjects( scene.children,true );
if(intersects.length>0){
accidentManager.createNewAccident(accidentData,intersects[0].point,scope.nowSceneType);
accidentManager.createAddAccident(accidentData,intersects[0].point,scope.nowSceneType);
}
}

View File

@ -6,6 +6,7 @@ export function AccidentManager(scene) {
this.accidentList = [];
this.accidentMode = '';
this.accidentGroup = new THREE.Group();
//场景中可触发事件模型
@ -32,7 +33,7 @@ export function AccidentManager(scene) {
scene.add(scope.accidentGroup);
this.initAccident = function(nowSceneType){
this.initAccident = function(type){
let accidentData = [
{
id:'1',
@ -40,7 +41,12 @@ export function AccidentManager(scene) {
type:"fire"
}
];
jl3dUpdateAccidentData(accidentData);
scope.accidentMode = type;
if(scope.accidentMode == 'player'){
}else{
jl3dUpdateAccidentData(accidentData);
}
}
this.saveDataList = function(){
@ -66,17 +72,37 @@ export function AccidentManager(scene) {
}
return saveList;
}
this.addAccident = function(addLable,nowSceneType){
for(let i=0;i<scope.accidentList[updateSceneType].length;i++){
if(scope.accidentList[updateSceneType][i].label == addLable){
scope.accidentList[updateSceneType][i].object.addAccident(groupList[nowSceneType]);
}
}
}
this.removeAccident = function(removeLable,nowSceneType){
for(let i=0;i<scope.accidentList[updateSceneType].length;i++){
if(scope.accidentList[updateSceneType][i].label == removeLable){
scope.accidentList[updateSceneType][i].object.removeAccident(groupList[nowSceneType]);
}
}
}
this.changeSceneGroup = function(nowSceneType){
if(scope.accidentGroup.children.length>0){
scope.accidentGroup.remove(scope.accidentGroup.children[0]);
}
scope.accidentGroup.add(groupList[nowSceneType]);
jl3dUpdateAccidentlist(scope.accidentList[nowSceneType]);
if(scope.accidentMode == 'player'){
}else{
jl3dUpdateAccidentlist(scope.accidentList[nowSceneType]);
}
updateSceneType = nowSceneType;
}
this.createNewAccident = function(type,pos,nowSceneType){
this.createAddAccident = function(type,pos,nowSceneType){
var rand = Math.floor(Math.random () * 900) + 100;
@ -92,10 +118,14 @@ export function AccidentManager(scene) {
};
if(type == "fire"){
newAccident.object = new Fire();
newAccident.object.createNew(groupList[nowSceneType],pos);
newAccident.object.createAdd(groupList[nowSceneType],pos);
}
scope.accidentList[nowSceneType].push(newAccident);
jl3dUpdateAccidentlist(scope.accidentList[nowSceneType]);
if(scope.accidentMode == 'player'){
}else{
jl3dUpdateAccidentlist(scope.accidentList[nowSceneType]);
}
}
this.deleteAccident = function(selectAccident,nowSceneType){
@ -104,7 +134,9 @@ export function AccidentManager(scene) {
for(let i=0;i<scope.accidentList[nowSceneType].length;i++){
if(scope.accidentList[nowSceneType][i].id == selectAccident.id){
scope.accidentList[nowSceneType].splice(i,1);
jl3dUpdateAccidentlist(scope.accidentList[nowSceneType]);
break;
}
}
@ -112,7 +144,6 @@ export function AccidentManager(scene) {
this.loadAccidentList = function(accidentList){
console.log(accidentList);
for(let i=0;i<accidentList.length;i++){
let newAccident = {
id:accidentList[i].id,
@ -126,10 +157,13 @@ export function AccidentManager(scene) {
};
if(accidentList[i].type == "fire"){
newAccident.object = new Fire();
newAccident.object.createNew(groupList[accidentList[i].sceneType],accidentList[i].pos);
if(scope.accidentMode == 'player'){
newAccident.object.createNew(groupList[accidentList[i].sceneType],accidentList[i].pos);
}else{
newAccident.object.createAdd(groupList[accidentList[i].sceneType],accidentList[i].pos);
}
}
scope.accidentList[accidentList[i].sceneType].push(newAccident);
// jl3dUpdateAccidentlist(scope.accidentList[accidentList[i].sceneType]);
}
}

View File

@ -0,0 +1,18 @@
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
export function BagItemData() {
let scope = this;
this.dataList = [];
scope.dataList["ztg"] = [
{
id:"pbmys",
name:"屏蔽门钥匙",
type:"equip",
pic:JL3D_LOCAL_STATIC+"/lesson3d/item/pbmys.png",
status:false,
},
];
}

View File

@ -257,6 +257,52 @@ export function JobPaneData() {
},
],
},
{
name:"信号楼值班员",
value:"xhlzby",
text:"",
picurl:"",
controlList:[
//联控
{
name:"联控",
data:[],
},
//动作
{
name:"动作",
data:[],
},
//口呼
{
name:"口呼",
data:[],
},
],
},
{
name:"工电调度",
value:"gddd",
text:"",
picurl:"",
controlList:[
//联控
{
name:"联控",
data:[],
},
//动作
{
name:"动作",
data:[],
},
//口呼
{
name:"口呼",
data:[],
},
],
},
{
name:"通号调度",
value:"scdd",
@ -349,6 +395,121 @@ export function JobPaneData() {
},
],
},
{
name:"电力调度",
value:"dldd",
text:"负责供电系统的正常运行。",
picurl:"",
controlList:[
//联控
{
name:"联控",
data:[],
},
//动作
{
name:"动作",
data:[],
},
//口呼
{
name:"口呼",
data:[],
},
],
},
{
name:"环控调度",
value:"hkdd",
text:"负责监控地铁环控系统运行。",
picurl:"",
controlList:[
//联控
{
name:"联控",
data:[],
},
//动作
{
name:"动作",
data:[],
},
//口呼
{
name:"口呼",
data:[],
},
],
},
{
name:"信息调度",
value:"xxdd",
text:"负责故障发生时通报信息。",
picurl:"",
controlList:[
//联控
{
name:"联控",
data:[],
},
//动作
{
name:"动作",
data:[],
},
//口呼
{
name:"口呼",
data:[],
},
],
},
{
name:"安检人员",
value:"ajry",
text:"负责地铁安检并维护秩序",
picurl:"",
controlList:[
//联控
{
name:"联控",
data:[],
},
//动作
{
name:"动作",
data:[],
},
//口呼
{
name:"口呼",
data:[],
},
],
},
{
name:"防疫部门",
value:"fybm",
text:"报告疫情事件。",
picurl:"",
controlList:[
//联控
{
name:"联控",
data:[],
},
//动作
{
name:"动作",
data:[],
},
//口呼
{
name:"口呼",
data:[],
},
],
},
{
name:"报警中心",
value:"bjzx",

File diff suppressed because it is too large Load Diff

View File

@ -14,7 +14,7 @@ import {TdtList} from '@/jlmap3d/main/newmodel/TdtList.js';
import { Loading } from 'element-ui';
// import {SwitchModel} from '@/jlmap3d/model/SwitchModel.js';
export function DriverLoadNew(data,scope,netdata,mapdata,sectionlist,signallist,switchlist,stationstandlist,trainlisttest,rails,camera,controls,scene,mixerss){
export function DriverLoadNew(data,scope,netdata,mapdata,sectionlist,signallist,switchlist,stationstandlist,trainlisttest,rails,camera,controls,scene,mixerss,project){
//console.log(mapdata);
//console.log(data);
@ -81,11 +81,11 @@ export function DriverLoadNew(data,scope,netdata,mapdata,sectionlist,signallist,
}
assetloader.setModelListOver(JSON.parse(netdata.assets).sceneAssetList,0,JSON.parse(netdata.assets).others);
assetloader.setModelListOver(JSON.parse(netdata.assets).sceneAssetList,0,JSON.parse(netdata.assets).others,project);
assetloader.assetPromiseOver(sceneload)
.then(function(data){
return stationstandlist.loadpromise(mapdata.stationList,standsdata,psddata,sceneload,assetloader,mixers,actions,"01",JSON.parse(netdata.assets).others);
return stationstandlist.loadpromise(mapdata.stationList,standsdata,psddata,sceneload,assetloader,mixers,actions,"01",JSON.parse(netdata.assets).others,project);
})
.then(function(data){
return sectionlist.loadpromise(mapdata.sectionList,sectiondata.section,rails,scene,assetloader);

View File

@ -14,7 +14,7 @@ import store from '@/store/index';
// import { Loading } from 'element-ui';
// import {SwitchModel} from '@/jlmap3d/model/SwitchModel.js';
export function SimulationLoadNew(data,scope,netdata,mapdata,camera,controls,scene){
export function SimulationLoadNew(data,scope,netdata,mapdata,camera,controls,scene,project){
//console.log(mapdata);
//console.log(data);
@ -23,6 +23,8 @@ export function SimulationLoadNew(data,scope,netdata,mapdata,camera,controls,sce
let jlmap3ddata = mapdata;
let assetloader = scope.assetloader;
let bgmodel = null;
let mixers = scope.mixers;
let actions = scope.actions;
@ -48,7 +50,6 @@ export function SimulationLoadNew(data,scope,netdata,mapdata,camera,controls,sce
let mapdata = data;
//初始化轨道和道岔
// lengthfact(data);
sectionlist = new SectionListN();
signallist = new SignalListN();
switchlist = new SwitchListN();
@ -76,7 +77,7 @@ export function SimulationLoadNew(data,scope,netdata,mapdata,camera,controls,sce
}
}
}
assetloader.setModelListOver(JSON.parse(netdata.assets).sceneAssetList,1.3,JSON.parse(netdata.assets).others);
assetloader.setModelListOver(JSON.parse(netdata.assets).sceneAssetList,1.3,JSON.parse(netdata.assets).others,project);
// assetloader.setmodellistnew(netdata.assets);
@ -86,7 +87,7 @@ export function SimulationLoadNew(data,scope,netdata,mapdata,camera,controls,sce
//console.log(data);
//,netdata.stands,mixers,actions,"0"
return stationstandlist.loadpromise(mapdata.stationList,standsdata,psddata,sceneload,assetloader,mixers,actions,"02",JSON.parse(netdata.assets).others);
return stationstandlist.loadpromise(mapdata.stationList,standsdata,psddata,sceneload,assetloader,mixers,actions,"02",JSON.parse(netdata.assets).others,project);
})
.then(function(data){
//console.log(data);
@ -117,6 +118,7 @@ export function SimulationLoadNew(data,scope,netdata,mapdata,camera,controls,sce
if(scope.assetloader.modellist[mn].type == "suidao"){
// scope.assetloader.modellist[mn].mesh.deviceType = "suidaobg";
scene.add(scope.assetloader.modellist[mn].mesh);
bgmodel = scope.assetloader.modellist[mn].mesh;
mn = scope.assetloader.modellist.length;
}
}
@ -169,7 +171,7 @@ export function SimulationLoadNew(data,scope,netdata,mapdata,camera,controls,sce
controls.upmodeldirect(stationstandlist,trainlisttest);
controls.update();
backdata.loaderdata(sectionlist,linklist,signallist,stationstandlist,trainlisttest,realsectionlist,rails);
backdata.loaderdata(sectionlist,linklist,signallist,stationstandlist,trainlisttest,realsectionlist,rails,bgmodel);
scope.Subscribe.updatamap(sectionlist,linklist,signallist,stationstandlist,trainlisttest,realsectionlist,rails,tdt,scope.materiallist,scope.actions,scope.sceneload);
scope.webwork.postMessage("on");
scope.jsonwebworknew.postMessage("connect");

View File

@ -1,395 +1,475 @@
import {StationStandModel} from '@/jlmap3d/main/newmodel/StationStandModel.js';
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
import {
StationStandModel
} from '@/jlmap3d/main/newmodel/StationStandModel.js';
import {
JL3D_LOCAL_STATIC
} from '@/api/jlmap3d/assets3d.js';
export function StationStandListN() {
let scope = this;
let scope = this;
this.type = "stationstandlist";
this.type = "stationstandlist";
this.list = [];
this.list = [];
this.group = new THREE.Group();
this.group.name = "station";
this.textlist = [];
this.group = new THREE.Group();
this.group.name = "station";
this.textlist = [];
this.initpromise = function(stationdata,standsdata,psddata,scene,assetloader,mixers,actionss,mode){
return new Promise(function(resolve, reject){
this.initpromise = function(stationdata, standsdata, psddata, scene, assetloader, mixers, actionss, mode) {
return new Promise(function(resolve, reject) {
let stations = stationdata;
let selectmesh1;
let stations = stationdata;
let selectmesh1;
for(let j=0;j<assetloader.modellist.length;j++){
if(assetloader.modellist[j].deviceType == "stand"){
selectmesh1 = assetloader.modellist[j].mesh;
}
}
for (let j = 0; j < assetloader.modellist.length; j++) {
if (assetloader.modellist[j].deviceType == "stand") {
selectmesh1 = assetloader.modellist[j].mesh;
}
}
for(let i=0;i<standsdata.length;i++){
let newstationstand = new StationStandModel(standsdata[i]);
for (let i = 0; i < standsdata.length; i++) {
let newstationstand = new StationStandModel(standsdata[i]);
newstationstand.code = standsdata[i].code;
newstationstand.name = standsdata[i].name;
newstationstand.type = "station";
newstationstand.num = i;
newstationstand.code = standsdata[i].code;
newstationstand.name = standsdata[i].name;
newstationstand.type = "station";
newstationstand.num = i;
newstationstand.direction1.code = standsdata[i].direction1.code;
newstationstand.direction1.name = standsdata[i].direction1.name;
newstationstand.direction1.screenDoorOpenStatus = "01";
newstationstand.direction1.code = standsdata[i].direction1.code;
newstationstand.direction1.name = standsdata[i].direction1.name;
newstationstand.direction1.screenDoorOpenStatus = "01";
newstationstand.direction2.code = standsdata[i].direction2.code;
newstationstand.direction2.name = standsdata[i].direction2.name;
newstationstand.direction2.screenDoorOpenStatus = "01";
newstationstand.direction2.code = standsdata[i].direction2.code;
newstationstand.direction2.name = standsdata[i].direction2.name;
newstationstand.direction2.screenDoorOpenStatus = "01";
let newstationmesh = selectmesh1.clone(true);
newstationmesh.position.x = standsdata[i].position.x;
newstationmesh.position.y = standsdata[i].position.y;
newstationmesh.position.z = standsdata[i].position.z;
// newstationmesh.rotation.x = standsdata[i].rotation._x;
// newstationmesh.rotation.y = standsdata[i].rotation._y;
// newstationmesh.rotation.z = standsdata[i].rotation._z;
newstationstand.mesh = newstationmesh;
scope.group.add(newstationmesh);
let newstationmesh = selectmesh1.clone(true);
newstationmesh.position.x = standsdata[i].position.x;
newstationmesh.position.y = standsdata[i].position.y;
newstationmesh.position.z = standsdata[i].position.z;
// newstationmesh.rotation.x = standsdata[i].rotation._x;
// newstationmesh.rotation.y = standsdata[i].rotation._y;
// newstationmesh.rotation.z = standsdata[i].rotation._z;
newstationstand.mesh = newstationmesh;
scope.group.add(newstationmesh);
scope.list[standsdata[i].code] = newstationstand;
scope.list[standsdata[i].code] = newstationstand;
let newclip = selectmesh1.animations[ 0 ];
for(let j=0;j<newstationmesh.children.length;j++){
let newclip = selectmesh1.animations[0];
for (let j = 0; j < newstationmesh.children.length; j++) {
if(newstationmesh.children[j].name == "top"){
newstationmesh.children[j].animations = [];
newstationmesh.children[j].animations.push(newclip.clone());
if (newstationmesh.children[j].name == "top") {
newstationmesh.children[j].animations = [];
newstationmesh.children[j].animations.push(newclip.clone());
let mixer = new THREE.AnimationMixer( newstationmesh.children[j] );
let mixer = new THREE.AnimationMixer(newstationmesh.children[j]);
for(let n=0;n<psddata.length;n++){
if(psddata[n].standCode == newstationstand.direction2.code){
for (let n = 0; n < psddata.length; n++) {
if (psddata[n].standCode == newstationstand.direction2.code) {
let key = psddata[n].code;
actionss[key] = {
status:"01",
action:mixer.clipAction( newstationmesh.children[j].animations[0])
};
actionss[key].action.setLoop(THREE.LoopOnce);
actionss[key].action.clampWhenFinished = true;
//actionss[key].play();
mixers.push(mixer);
n = psddata.length;
}
}
let key = psddata[n].code;
actionss[key] = {
status: "01",
action: mixer.clipAction(newstationmesh.children[j].animations[0])
};
actionss[key].action.setLoop(THREE.LoopOnce);
actionss[key].action.clampWhenFinished = true;
//actionss[key].play();
mixers.push(mixer);
n = psddata.length;
}
}
}
if(newstationmesh.children[j].name == "down"){
newstationmesh.children[j].animations = [];
newstationmesh.children[j].animations.push(newclip.clone());
}
if (newstationmesh.children[j].name == "down") {
newstationmesh.children[j].animations = [];
newstationmesh.children[j].animations.push(newclip.clone());
let mixer = new THREE.AnimationMixer( newstationmesh.children[j] );
for(let n=0;n<psddata.length;n++){
if(psddata[n].standCode == newstationstand.direction1.code){
let mixer = new THREE.AnimationMixer(newstationmesh.children[j]);
for (let n = 0; n < psddata.length; n++) {
if (psddata[n].standCode == newstationstand.direction1.code) {
let key = psddata[n].code;
actionss[key] = {
status:"01",
action:mixer.clipAction( newstationmesh.children[j].animations[0])
};
actionss[key].action.setLoop(THREE.LoopOnce);
actionss[key].action.clampWhenFinished = true;
//actionss[key].play();
mixers.push(mixer);
n = psddata.length;
}
}
}
let key = psddata[n].code;
actionss[key] = {
status: "01",
action: mixer.clipAction(newstationmesh.children[j].animations[0])
};
actionss[key].action.setLoop(THREE.LoopOnce);
actionss[key].action.clampWhenFinished = true;
//actionss[key].play();
mixers.push(mixer);
n = psddata.length;
}
}
}
}
}
if(mode){
if(mode == "02"){
let textgeometry = new THREE.PlaneBufferGeometry( 65, 90, 1 );
let textt = new THREE.CanvasTexture(getTextCanvas(stationdata[i]));
if (mode) {
if (mode == "02") {
let textgeometry = new THREE.PlaneBufferGeometry(65, 90, 1);
let textt = new THREE.CanvasTexture(getTextCanvas(stationdata[i]));
let textmaterial = new THREE.MeshBasicMaterial( { side: THREE.DoubleSide,map:textt ,transparent: true} );
let textplane = new THREE.Mesh( textgeometry, textmaterial );
textplane.name = stationdata[i].code;
textplane.position.y = 80;
textplane.rotation.x = Math.PI/2;
//textplane.position.x = -30;
scope.textlist.push(textplane);
newstationmesh.add(textplane);
textgeometry.dispose();
textmaterial.dispose();
textt.dispose();
// let newtopstation = topstationmesh.clone(true);
// newtopstation.position.x = map[k].mesh.position.x;
// newtopstation.position.z = map[k].mesh.position.z;
// scene.add(newtopstation);
}
}
}
// scene.add(scope.textlist);
stationdata = null;
psddata = null;
scene.add(scope.group);
resolve("loadedstation");
});
let textmaterial = new THREE.MeshBasicMaterial({
side: THREE.DoubleSide,
map: textt,
transparent: true
});
let textplane = new THREE.Mesh(textgeometry, textmaterial);
textplane.name = stationdata[i].code;
textplane.modeltype = "textplane";
textplane.position.y = 80;
textplane.rotation.x = Math.PI / 2;
//textplane.position.x = -30;
scope.textlist.push(textplane);
newstationmesh.add(textplane);
textgeometry.dispose();
textmaterial.dispose();
textt.dispose();
// let newtopstation = topstationmesh.clone(true);
// newtopstation.position.x = map[k].mesh.position.x;
// newtopstation.position.z = map[k].mesh.position.z;
// scene.add(newtopstation);
}
}
}
// scene.add(scope.textlist);
stationdata = null;
psddata = null;
scene.add(scope.group);
resolve("loadedstation");
});
}
this.loadpromise = function(stationdata,standsdata,psddata,scene,assetloader,mixers,actionss,mode,otherStation){
return new Promise(function(resolve, reject){
// console.log(standsdata);
let stations = stationdata;
let selectmesh1;
let selectmesh2;
let selectmesh3;
let specilmesh;
for(let j=0;j<assetloader.modellist.length;j++){
// console.log(assetloader.modellist[j].type);
if(assetloader.modellist[j].type == "stationInside"){
selectmesh1 = assetloader.modellist[j].mesh;
}
if(assetloader.modellist[j].type == "stationOutside"){
selectmesh2 = assetloader.modellist[j].mesh;
// assetloader.modellist[num2].mesh.rotation.y = Math.PI/2;
}
if(assetloader.modellist[j].type == "stationThree"){
selectmesh3 = assetloader.modellist[j].mesh;
// assetloader.modellist[num2].mesh.rotation.y = Math.PI/2;
}
if(assetloader.modellist[j].type == "spmxa"){
specilmesh = assetloader.modellist[j].mesh;
}
}
this.loadpromise = function(stationdata, standsdata, psddata, scene, assetloader, mixers, actionss, mode, otherStation, project) {
return new Promise(function(resolve, reject) {
// console.log(standsdata);
let stations = stationdata;
let selectmesh1;
let selectmesh2;
let selectmesh3;
let specilmesh;
}
selectmesh1.traverse( function ( child ) {
let nologonc, nologowc, nologohc;
if ( child.isMesh ) {
child.renderOrder = 9;
}
for (let j = 0; j < assetloader.modellist.length; j++) {
// console.log(assetloader.modellist[j].type);
if (assetloader.modellist[j].type == "stationInside") {
selectmesh1 = assetloader.modellist[j].mesh;
}
if (assetloader.modellist[j].type == "stationOutside") {
selectmesh2 = assetloader.modellist[j].mesh;
// assetloader.modellist[num2].mesh.rotation.y = Math.PI/2;
}
if (assetloader.modellist[j].type == "stationThree") {
selectmesh3 = assetloader.modellist[j].mesh;
// assetloader.modellist[num2].mesh.rotation.y = Math.PI/2;
}
if (assetloader.modellist[j].type == "spmxa") {
specilmesh = assetloader.modellist[j].mesh;
}
} );
selectmesh2.traverse( function ( child ) {
if (project == "nologo") {
if (assetloader.modellist[j].type == "nologonc") {
nologonc = assetloader.modellist[j].mesh;
// assetloader.modellist[num2].mesh.rotation.y = Math.PI/2;
}
if (assetloader.modellist[j].type == "nologowc") {
nologowc = assetloader.modellist[j].mesh;
// assetloader.modellist[num2].mesh.rotation.y = Math.PI/2;
}
if (assetloader.modellist[j].type == "nologohc") {
nologohc = assetloader.modellist[j].mesh;
}
}
if ( child.isMesh ) {
child.renderOrder = 9;
}
if (project == "say") {
if (assetloader.modellist[j].type == "nologonc") {
nologonc = assetloader.modellist[j].mesh;
// assetloader.modellist[num2].mesh.rotation.y = Math.PI/2;
}
if (assetloader.modellist[j].type == "nologohc") {
nologohc = assetloader.modellist[j].mesh;
}
}
} );
// selectmesh3.traverse( function ( child ) {
//
// if ( child.isMesh ) {
// child.renderOrder = 9;
// }
//
// } );
//新车门动画获取待定
let allClear = 0;
for(let j=0;j<standsdata.length;j++){
}
selectmesh1.traverse(function(child) {
allClear = 0;
for(let i=0;i<psddata.length;i++){
if (child.isMesh) {
child.renderOrder = 9;
}
for(let n=0;n<standsdata[j].stands.length;n++){
if(psddata[i].standCode == standsdata[j].stands[n].code){
allClear++;
standsdata[j].stands[n].position = psddata[i].position;
}
}
});
selectmesh2.traverse(function(child) {
if(allClear == standsdata[j].stands.length){
standsdata[j].stands.sort(compare);
i = psddata.length;
}
}
}
//
//
// console.log(psddata);
for(let i=0;i<standsdata.length;i++){
if (child.isMesh) {
child.renderOrder = 9;
}
});
// selectmesh3.traverse( function ( child ) {
//
// if ( child.isMesh ) {
// child.renderOrder = 9;
// }
//
// } );
//新车门动画获取待定
let allClear = 0;
for (let j = 0; j < standsdata.length; j++) {
allClear = 0;
for (let i = 0; i < psddata.length; i++) {
for (let n = 0; n < standsdata[j].stands.length; n++) {
if (psddata[i].standCode == standsdata[j].stands[n].code) {
allClear++;
standsdata[j].stands[n].position = psddata[i].position;
}
}
if (allClear == standsdata[j].stands.length) {
standsdata[j].stands.sort(compare);
i = psddata.length;
}
}
}
//
//
// console.log(psddata);
for (let i = 0; i < standsdata.length; i++) {
let newstationstand = new StationStandModel(standsdata[i]);
let newstationstand = new StationStandModel(standsdata[i]);
newstationstand.code = standsdata[i].code;
newstationstand.name = standsdata[i].name;
newstationstand.type = "station";
newstationstand.num = i;
newstationstand.stands = standsdata[i].stands;
// newstationstand.direction1.code = standsdata[i].direction1.code;
// newstationstand.direction1.name = standsdata[i].direction1.name;
// newstationstand.direction1.screenDoorOpenStatus = "01";
//
// newstationstand.direction2.code = standsdata[i].direction2.code;
// newstationstand.direction2.name = standsdata[i].direction2.name;
// newstationstand.direction2.screenDoorOpenStatus = "01";
let newstationmesh = null;
let newclip =null;
newstationstand.code = standsdata[i].code;
newstationstand.name = standsdata[i].name;
newstationstand.type = "station";
newstationstand.num = i;
newstationstand.stands = standsdata[i].stands;
// newstationstand.direction1.code = standsdata[i].direction1.code;
// newstationstand.direction1.name = standsdata[i].direction1.name;
// newstationstand.direction1.screenDoorOpenStatus = "01";
//
// newstationstand.direction2.code = standsdata[i].direction2.code;
// newstationstand.direction2.name = standsdata[i].direction2.name;
// newstationstand.direction2.screenDoorOpenStatus = "01";
let newstationmesh = null;
let newclip = null;
let nowModelType = "normal";
let nowModelType = "normal";
if(otherStation){
for(let o=0;o<otherStation.length;o++){
if(standsdata[i].code == otherStation[o].code){
let selectmeshother = assetloader.modelgroup[ otherStation[o].code];
newstationmesh = selectmeshother;
newclip = selectmeshother.animations[ 0 ];
nowModelType = "specil";
newstationmesh.traverse( function ( child ) {
if (otherStation) {
for (let o = 0; o < otherStation.length; o++) {
if (standsdata[i].code == otherStation[o].code) {
let selectmeshother = assetloader.modelgroup[otherStation[o].code];
newstationmesh = selectmeshother;
newclip = selectmeshother.animations[0];
nowModelType = "specil";
newstationmesh.traverse(function(child) {
if ( child.isMesh ) {
child.renderOrder = 9;
}
if (child.isMesh) {
child.renderOrder = 9;
}
} );
}
}
}
if(nowModelType == "normal"){
if(standsdata[i].stands.length<=2){
if(standsdata[i].inside == undefined){
newstationmesh = selectmesh1.clone(true);
newclip = selectmesh1.animations[ 0 ];
}else if(standsdata[i].inside == true){
newstationmesh = selectmesh1.clone(true);
newclip = selectmesh1.animations[ 0 ];
}else{
newstationmesh = selectmesh2.clone(true);
newclip = selectmesh2.animations[ 0 ];
}
}else{
newstationmesh = selectmesh3.clone(true);
newclip = selectmesh3.animations[ 0 ];
}
});
}
}
}
if (nowModelType == "normal") {
if (standsdata[i].stands.length <= 2) {
if(standsdata[i].code == "Station17596"){
newstationmesh = specilmesh.clone(true);
newclip = specilmesh.animations[ 0 ];
}
}
if (standsdata[i].inside == undefined) {
newstationmesh = selectmesh1.clone(true);
newclip = selectmesh1.animations[0];
} else if (standsdata[i].inside == true) {
newstationmesh = selectmesh1.clone(true);
newclip = selectmesh1.animations[0];
} else {
newstationmesh = selectmesh2.clone(true);
newclip = selectmesh2.animations[0];
}
} else {
newstationmesh = selectmesh3.clone(true);
newclip = selectmesh3.animations[0];
}
if (standsdata[i].code == "Station17596") {
newstationmesh = specilmesh.clone(true);
newclip = specilmesh.animations[0];
}
if (project == "nologo") {
if (i == 1) {
newstationmesh = nologohc.clone(true);
newclip = nologohc.animations[0];
}
if (i == 2) {
newstationmesh = selectmesh2.clone(true);
newclip = selectmesh2.animations[0];
}
if (i == 3) {
newstationmesh = nologonc.clone(true);
newclip = nologonc.animations[0];
}
if (i == 4) {
newstationmesh = nologowc.clone(true);
newclip = nologowc.animations[0];
}
}
if (project == "say") {
if (i == 1) {
newstationmesh = nologohc.clone(true);
newclip = nologohc.animations[0];
}
if (i == 3) {
newstationmesh = nologonc.clone(true);
newclip = nologonc.animations[0];
}
if (i == 4) {
newstationmesh = nologonc.clone(true);
newclip = nologonc.animations[0];
}
}
}
newstationmesh.code = standsdata[i].code;
newstationmesh.name = standsdata[i].code;
// console.log(newstationmesh.name);
// console.log(standsdata[i].inside);
newstationmesh.inside = standsdata[i].inside;
newstationmesh.position.x = standsdata[i].position.x;
newstationmesh.position.y = standsdata[i].position.y;
newstationmesh.position.z = standsdata[i].position.z;
// newstationmesh.rotation.x = standsdata[i].rotation._x;
// newstationmesh.rotation.y = standsdata[i].rotation._y;
// newstationmesh.rotation.z = standsdata[i].rotation._z;
newstationstand.mesh = newstationmesh;
scope.group.add(newstationmesh);
//
scope.list[standsdata[i].code] = newstationstand;
//
for(let j=0;j<standsdata[i].stands.length;j++){
let num = j+1;
newstationmesh.code = standsdata[i].code;
newstationmesh.name = standsdata[i].code;
// console.log(newstationmesh.name);
// console.log(standsdata[i].inside);
newstationmesh.inside = standsdata[i].inside;
newstationmesh.position.x = standsdata[i].position.x;
newstationmesh.position.y = standsdata[i].position.y;
newstationmesh.position.z = standsdata[i].position.z;
// newstationmesh.rotation.x = standsdata[i].rotation._x;
// newstationmesh.rotation.y = standsdata[i].rotation._y;
// newstationmesh.rotation.z = standsdata[i].rotation._z;
newstationstand.mesh = newstationmesh;
scope.group.add(newstationmesh);
//
scope.list[standsdata[i].code] = newstationstand;
//
for (let j = 0; j < standsdata[i].stands.length; j++) {
let num = j + 1;
let addAnimaMesh = newstationmesh.getObjectByName('door'+num);
let addAnimaMesh = newstationmesh.getObjectByName('door' + num);
if(addAnimaMesh){
newstationmesh.getObjectByName('door'+num).animations = [];
newstationmesh.getObjectByName('door'+num).animations.push(newclip.clone());
let mixer = new THREE.AnimationMixer( newstationmesh.getObjectByName('door'+num) );
if (addAnimaMesh) {
newstationmesh.getObjectByName('door' + num).animations = [];
if (newclip) {
newstationmesh.getObjectByName('door' + num).animations.push(newclip.clone());
let mixer = new THREE.AnimationMixer(newstationmesh.getObjectByName('door' + num));
for(let n=0;n<psddata.length;n++){
for (let n = 0; n < psddata.length; n++) {
if(psddata[n].standCode == standsdata[i].stands[j].code){
if (psddata[n].standCode == standsdata[i].stands[j].code) {
let key = psddata[n].code;
actionss[key] = {
status:"01",
action:mixer.clipAction( newstationmesh.getObjectByName('door'+num).animations[0])
};
actionss[key].action.setLoop(THREE.LoopOnce);
actionss[key].action.clampWhenFinished = true;
//actionss[key].play();
let key = psddata[n].code;
actionss[key] = {
status: "01",
action: mixer.clipAction(newstationmesh.getObjectByName('door' + num).animations[0])
};
actionss[key].action.setLoop(THREE.LoopOnce);
actionss[key].action.clampWhenFinished = true;
//actionss[key].play();
n = psddata.length;
}
}
n = psddata.length;
}
}
mixers.push(mixer);
}
mixers.push(mixer);
}
}
}
if(mode){
if(mode == "02"){
let textgeometry = new THREE.PlaneBufferGeometry( 65, 90, 1 );
let textt = new THREE.CanvasTexture(getTextCanvas(standsdata[i]));
}
let textmaterial = new THREE.MeshBasicMaterial( { side: THREE.DoubleSide,map:textt ,transparent: true} );
let textplane = new THREE.Mesh( textgeometry, textmaterial );
textplane.name = standsdata[i].code;
if (mode) {
if (mode == "02") {
let textgeometry = new THREE.PlaneBufferGeometry(65, 90, 1);
let textt = new THREE.CanvasTexture(getTextCanvas(standsdata[i]));
textplane.position.y = 70;
textplane.rotation.x = Math.PI/2;
textplane.position.z = 80;
scope.textlist.push(textplane);
newstationmesh.add(textplane);
textgeometry.dispose();
textmaterial.dispose();
textt.dispose();
}
}
}
let textmaterial = new THREE.MeshBasicMaterial({
side: THREE.DoubleSide,
map: textt,
transparent: true
});
let textplane = new THREE.Mesh(textgeometry, textmaterial);
textplane.name = standsdata[i].code;
textplane.modeltype = "textplane";
textplane.position.y = 70;
textplane.rotation.x = Math.PI / 2;
textplane.position.z = 80;
scope.textlist.push(textplane);
newstationmesh.add(textplane);
textgeometry.dispose();
textmaterial.dispose();
textt.dispose();
}
}
}
// scene.add(scope.textlist);
stationdata = null;
psddata = null;
scene.add(scope.group);
resolve("loadedstation");
});
// scene.add(scope.textlist);
stationdata = null;
psddata = null;
scene.add(scope.group);
resolve("loadedstation");
});
}
}
}
var compare = function (obj1, obj2) {
var val1 = obj1.position.y;
var val2 = obj2.position.y;
if (val1 < val2) {
return -1;
} else if (val1 > val2) {
return 1;
} else {
return 0;
}
var compare = function(obj1, obj2) {
var val1 = obj1.position.y;
var val2 = obj2.position.y;
if (val1 < val2) {
return -1;
} else if (val1 > val2) {
return 1;
} else {
return 0;
}
}
//canvas文字贴图方法
//PS:待提炼 增强功能
var stationcanvas = new Image();
stationcanvas.src = JL3D_LOCAL_STATIC+"/texture/msgtnew.png";
function getTextCanvas(text){
let canvas = document.getElementById('canvastexture');
stationcanvas.src = JL3D_LOCAL_STATIC + "/texture/msgtnew.png";
canvas.width = 128;
canvas.height = 256;
// canvas.style.width = width;
// canvas.style.height = height;
function getTextCanvas(text) {
let canvas = document.getElementById('canvastexture');
let ctx = canvas.getContext('2d');
//ctx.fillStyle = '#FFFFFF';
ctx.fillRect(0, 0,128,256);
canvas.width = 128;
canvas.height = 256;
// canvas.style.width = width;
// canvas.style.height = height;
ctx.fillStyle = '#FFFFFF';
// ctx.textAlign = 'center';
// ctx.textBaseline = 'middle';
ctx.clearRect(0,0,128,256);
let ctx = canvas.getContext('2d');
//ctx.fillStyle = '#FFFFFF';
ctx.fillRect(0, 0, 128, 256);
ctx.drawImage(stationcanvas,0,0,128,256);
ctx.fillStyle = '#FFFFFF';
// ctx.textAlign = 'center';
// ctx.textBaseline = 'middle';
ctx.clearRect(0, 0, 128, 256);
ctx.font = "10px";
ctx.fillText("车站: "+text.name, 15,25);
ctx.drawImage(stationcanvas, 0, 0, 128, 256);
ctx.fillText("漫游", 18,48);
ctx.fillText("信息", 54,48);
ctx.fillText("备忘", 93,48);
ctx.font = "10px";
ctx.fillText("车站: " + text.name, 15, 25);
ctx.fillText("车站序号: "+text.name, 10,115);
ctx.fillText("漫游", 18, 48);
ctx.fillText("信息", 54, 48);
ctx.fillText("备忘", 93, 48);
ctx.fillText("公里标记:",10 ,135);
ctx.fillText(text.kmPost,10 ,155);
ctx.fillText("车站序号: " + text.name, 10, 115);
let data = ctx.getImageData(0, 0,128,256);
return data;
ctx.fillText("公里标记:", 10, 135);
ctx.fillText(text.kmPost, 10, 155);
let data = ctx.getImageData(0, 0, 128, 256);
return data;
}

View File

@ -0,0 +1,529 @@
//转辙机动画
export function Moveanimate(main){
let scope = this;
//内容信息显示plane
this.helpbox = null;
this.textplane = null;
//动画列表
this.animatelist = [];
this.playlist = null;
this.playorder = 0;
//动画播放器开关
this.enable = true;
//动画开关状态
this.status = true;
//当前动画模型
this.nowmodelname = undefined;
//定义屏蔽门零件动画
this.initDoorAnima = function(animaModel){
scope.animatelist[animaModel.animacode+"chaijie"] = [];
scope.animatelist[animaModel.animacode+"fuwei"] = [];
for(let i=0,leni=animaModel.children.length;i<leni;i++){
if(animaModel.children[i].name == "SJZZ"){
let points1 = [];
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+4,animaModel.children[i].position.z+10));
scope.initanimate(scope.animatelist[animaModel.animacode+"chaijie"],animaModel.children[i],animaModel.name+"dizuoon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+4,animaModel.children[i].position.z+10));
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"fuwei"],animaModel.children[i],animaModel.name+"dizuooff",points2,0.5,true,0);
}
if(animaModel.children[i].name == "HLGJZ"){
let points1 = [];
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+4,animaModel.children[i].position.z+8));
scope.initanimate(scope.animatelist[animaModel.animacode+"chaijie"],animaModel.children[i],animaModel.name+"Lxingon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+4,animaModel.children[i].position.z+8));
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"fuwei"],animaModel.children[i],animaModel.name+"Lxingoff",points2,0.5,true,0);
}
if(animaModel.children[i].name == "HLGJY"){
let points1 = [];
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+4,animaModel.children[i].position.z+8));
scope.initanimate(scope.animatelist[animaModel.animacode+"chaijie"],animaModel.children[i],animaModel.name+"jiaoxingxiantieon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+4,animaModel.children[i].position.z+8));
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"fuwei"],animaModel.children[i],animaModel.name+"jiaoxingxiantieoff",points2,0.5,true,0);
}
if(animaModel.children[i].name == "PDJ"){
let points1 = [];
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+4,animaModel.children[i].position.z+6));
scope.initanimate(scope.animatelist[animaModel.animacode+"chaijie"],animaModel.children[i],animaModel.name+"zhongchuipianon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(animaModel.children[i].position.xx,animaModel.children[i].position.y+4,animaModel.children[i].position.z+6));
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"fuwei"],animaModel.children[i],animaModel.name+"zhongchuipianoff",points2,0.5,true,0);
}
if(animaModel.children[i].name == "PDJ1"){
let points1 = [];
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+4,animaModel.children[i].position.z+6));
scope.initanimate(scope.animatelist[animaModel.animacode+"chaijie"],animaModel.children[i],animaModel.name+"laganon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+4,animaModel.children[i].position.z+6));
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"fuwei"],animaModel.children[i],animaModel.name+"laganoff",points2,0.5,true,0);
}
if(animaModel.children[i].name == "HLZZZ"){
let points1 = [];
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+4,animaModel.children[i].position.z+4));
scope.initanimate(scope.animatelist[animaModel.animacode+"chaijie"],animaModel.children[i],animaModel.name+"dongjiedianzhouon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+4,animaModel.children[i].position.z+4));
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"fuwei"],animaModel.children[i],animaModel.name+"dongjiedianzhouoff",points2,0.5,true,0);
}
if(animaModel.children[i].name == "HLZZY"){
let points1 = [];
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+4,animaModel.children[i].position.z+4));
scope.initanimate(scope.animatelist[animaModel.animacode+"chaijie"],animaModel.children[i],animaModel.name+"neibuon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+4,animaModel.children[i].position.z+4));
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"fuwei"],animaModel.children[i],animaModel.name+"neibuoff",points2,0.5,true,0);
}
if(animaModel.children[i].name == "CLPD"){
let points1 = [];
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+6,animaModel.children[i].position.z+4));
scope.initanimate(scope.animatelist[animaModel.animacode+"chaijie"],animaModel.children[i],animaModel.name+"jiedianon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+6,animaModel.children[i].position.z+4));
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"fuwei"],animaModel.children[i],animaModel.name+"jiedianoff",points2,0.5,true,0);
}
if(animaModel.children[i].name == "LCB"){
let points1 = [];
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+8,animaModel.children[i].position.z+2));
scope.initanimate(scope.animatelist[animaModel.animacode+"chaijie"],animaModel.children[i],animaModel.name+"yapianon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+8,animaModel.children[i].position.z+2));
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"fuwei"],animaModel.children[i],animaModel.name+"yapianoff",points2,0.5,true,0);
}
if(animaModel.children[i].name == "DCU"){
let points1 = [];
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+8,animaModel.children[i].position.z+2));
scope.initanimate(scope.animatelist[animaModel.animacode+"chaijie"],animaModel.children[i],animaModel.name+"fanghuozhaoon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+8,animaModel.children[i].position.z+2));
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"fuwei"],animaModel.children[i],animaModel.name+"fanghuozhaooff",points2,0.5,true,0);
}
}
// let points = [];
// points.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
// points.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
// scope.initanimate(animaModel.children[i],animaModel.name+"select1",points,true);
let modelorderlist = [];
modelorderlist[animaModel.animacode] = [
{name:"SJZZ",pos:[0,4,10]},
{name:"HLGJZ",pos:[0,4,8]},
{name:"HLGJY",pos:[0,4,8]},
{name:"PDJ",pos:[0,4,6]},
{name:"PDJ1",pos:[0,4,6]},
{name:"HLZZZ",pos:[0,4,4]},
{name:"HLZZY",pos:[0,4,4]},
{name:"CLPD",pos:[0,6,4]},
{name:"LCB",pos:[0,8,2]},
{name:"DCU",pos:[0,8,2]},
];
scope.animatelist[animaModel.animacode+"on"] = [];
scope.animatelist[animaModel.animacode+"off"] = [];
for(let i=0,leni=modelorderlist[animaModel.animacode].length;i<leni;i++){
let orderdata = modelorderlist[animaModel.animacode];
let modelon = animaModel.getObjectByName(orderdata[i].name);
// modelon.helpbox = undefined;
let pointson = [];
pointson.push(new THREE.Vector3(modelon.position.x,modelon.position.y,modelon.position.z));
pointson.push(new THREE.Vector3(modelon.position.x+orderdata[i].pos[0],modelon.position.y+orderdata[i].pos[1],modelon.position.z+orderdata[i].pos[2]));
let pointsoff = [];
pointsoff.push(new THREE.Vector3(modelon.position.x+orderdata[i].pos[0],modelon.position.y+orderdata[i].pos[1],modelon.position.z+orderdata[i].pos[2]));
pointsoff.push(new THREE.Vector3(modelon.position.x,modelon.position.y,modelon.position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"on"],modelon,animaModel.animacode+modelon.name+"on",pointson,0.03,true,i);
scope.initanimate(scope.animatelist[animaModel.animacode+"off"],modelon,animaModel.animacode+modelon.name+"off",pointsoff,0.03,true,leni-i-1);
}
}
//定义转辙机零件动画
this.initSwitchAnima = function(animaModel){
scope.animatelist[animaModel.animacode+"chaijie"] = [];
scope.animatelist[animaModel.animacode+"fuwei"] = [];
for(let i=0,leni=animaModel.children.length;i<leni;i++){
if(animaModel.children[i].name == "DDJ"){
let points1 = [];
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
points1.push(new THREE.Vector3(animaModel.children[i].position.x-1.5,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"chaijie"],animaModel.children[i],animaModel.name+"dizuoon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(animaModel.children[i].position.x-1.5,animaModel.children[i].position.y,animaModel.children[i].position.z));
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"fuwei"],animaModel.children[i],animaModel.name+"dizuooff",points2,0.5,true,0);
}
if(animaModel.children[i].name == "DJZ"){
let points1 = [];
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
points1.push(new THREE.Vector3(animaModel.children[i].position.x-3,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"chaijie"],animaModel.children[i],animaModel.name+"Lxingon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(animaModel.children[i].position.x-3,animaModel.children[i].position.y,animaModel.children[i].position.z));
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"fuwei"],animaModel.children[i],animaModel.name+"Lxingoff",points2,0.5,true,0);
}
if(animaModel.children[i].name == "DINGK"){
let points1 = [];
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+9,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"chaijie"],animaModel.children[i],animaModel.name+"jiaoxingxiantieon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+9,animaModel.children[i].position.z));
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"fuwei"],animaModel.children[i],animaModel.name+"jiaoxingxiantieoff",points2,0.5,true,0);
}
if(animaModel.children[i].name == "SZ"){
let points1 = [];
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
points1.push(new THREE.Vector3(animaModel.children[i].position.x-1.5,animaModel.children[i].position.y,animaModel.children[i].position.z-1));
scope.initanimate(scope.animatelist[animaModel.animacode+"chaijie"],animaModel.children[i],animaModel.name+"zhongchuipianon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(animaModel.children[i].position.xx-1.5,animaModel.children[i].position.y,animaModel.children[i].position.z-1));
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"fuwei"],animaModel.children[i],animaModel.name+"zhongchuipianoff",points2,0.5,true,0);
}
if(animaModel.children[i].name == "JSQ"){
let points1 = [];
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
points1.push(new THREE.Vector3(animaModel.children[i].position.x-3,animaModel.children[i].position.y+3,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"chaijie"],animaModel.children[i],animaModel.name+"laganon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(animaModel.children[i].position.x-3,animaModel.children[i].position.y+3,animaModel.children[i].position.z));
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"fuwei"],animaModel.children[i],animaModel.name+"laganoff",points2,0.5,true,0);
}
if(animaModel.children[i].name == "YWJCQ"){
let points1 = [];
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+6,animaModel.children[i].position.z+3));
scope.initanimate(scope.animatelist[animaModel.animacode+"chaijie"],animaModel.children[i],animaModel.name+"dongjiedianzhouon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+6,animaModel.children[i].position.z+3));
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"fuwei"],animaModel.children[i],animaModel.name+"dongjiedianzhouoff",points2,0.5,true,0);
}
if(animaModel.children[i].name == "ESWCJJ"){
let points1 = [];
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+6,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"chaijie"],animaModel.children[i],animaModel.name+"neibuon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+6,animaModel.children[i].position.z));
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"fuwei"],animaModel.children[i],animaModel.name+"neibuoff",points2,0.5,true,0);
}
if(animaModel.children[i].name == "AQJD"){
let points1 = [];
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+6,animaModel.children[i].position.z-2));
scope.initanimate(scope.animatelist[animaModel.animacode+"chaijie"],animaModel.children[i],animaModel.name+"jiedianon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+6,animaModel.children[i].position.z-2));
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"fuwei"],animaModel.children[i],animaModel.name+"jiedianoff",points2,0.5,true,0);
}
if(animaModel.children[i].name == "QDP"){
let points1 = [];
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+6,animaModel.children[i].position.z-3));
scope.initanimate(scope.animatelist[animaModel.animacode+"chaijie"],animaModel.children[i],animaModel.name+"yapianon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+6,animaModel.children[i].position.z-3));
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"fuwei"],animaModel.children[i],animaModel.name+"yapianoff",points2,0.5,true,0);
}
if(animaModel.children[i].name == "SDP"){
let points1 = [];
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+6,animaModel.children[i].position.z-4));
scope.initanimate(scope.animatelist[animaModel.animacode+"chaijie"],animaModel.children[i],animaModel.name+"fanghuozhaoon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+6,animaModel.children[i].position.z-4));
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"fuwei"],animaModel.children[i],animaModel.name+"fanghuozhaooff",points2,0.5,true,0);
}
if(animaModel.children[i].name == "ZDKBQ"){
let points1 = [];
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+3,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"chaijie"],animaModel.children[i],animaModel.name+"dianyuanpianon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+3,animaModel.children[i].position.z));
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"fuwei"],animaModel.children[i],animaModel.name+"dianyuanpianoff",points2,0.5,true,0);
}
if(animaModel.children[i].name == "ZZ"){
let points1 = [];
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
points1.push(new THREE.Vector3(animaModel.children[i].position.x+3,animaModel.children[i].position.y+3,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"chaijie"],animaModel.children[i],animaModel.name+"xinpianon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(animaModel.children[i].position.x+3,animaModel.children[i].position.y+3,animaModel.children[i].position.z));
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"fuwei"],animaModel.children[i],animaModel.name+"xinpianoff",points2,0.5,true,0);
}
if(animaModel.children[i].name =="BSG"){
let points1 = [];
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
points1.push(new THREE.Vector3(animaModel.children[i].position.x+1,animaModel.children[i].position.y,animaModel.children[i].position.z-5));
scope.initanimate(scope.animatelist[animaModel.animacode+"chaijie"],animaModel.children[i],animaModel.name+"jueyuanzhouon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(animaModel.children[i].position.x+1,animaModel.children[i].position.y,animaModel.children[i].position.z-5));
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"fuwei"],animaModel.children[i],animaModel.name+"jueyuanzhouoff",points2,0.5,true,0);
}
if(animaModel.children[i].name =="DZG"){
let points1 = [];
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
points1.push(new THREE.Vector3(animaModel.children[i].position.x-1,animaModel.children[i].position.y,animaModel.children[i].position.z-5));
scope.initanimate(scope.animatelist[animaModel.animacode+"chaijie"],animaModel.children[i],animaModel.name+"cigangon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(animaModel.children[i].position.x-1,animaModel.children[i].position.y,animaModel.children[i].position.z-5));
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"fuwei"],animaModel.children[i],animaModel.name+"cigangoff",points2,0.5,true,0);
}
if(animaModel.children[i].name =="CTK"){
let points1 = [];
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
points1.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+6,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"chaijie"],animaModel.children[i],animaModel.name+"ccichuihuqion",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y+6,animaModel.children[i].position.z));
points2.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
scope.initanimate(scope.animatelist[animaModel.animacode+"fuwei"],animaModel.children[i],animaModel.name+"ccichuihuqioff",points2,0.5,true,0);
}
}
// let points = [];
// points.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
// points.push(new THREE.Vector3(animaModel.children[i].position.x,animaModel.children[i].position.y,animaModel.children[i].position.z));
// scope.initanimate(animaModel.children[i],animaModel.name+"select1",points,true);
let modelorderlist = [];
modelorderlist[animaModel.animacode] = [
{name:"SZ",pos:[-1.5,0,-1]},
{name:"DINGK",pos:[0,9,0]},
{name:"DJZ",pos:[-3,0,0]},
{name:"DDJ",pos:[-1.5,0,0]},
{name:"JSQ",pos:[-3,3,0]},
{name:"ZDKBQ",pos:[0,3,0]},
{name:"ZZ",pos:[3,3,0]},
{name:"ESWCJJ",pos:[0,6,0]},
{name:"CTK",pos:[0,6,0]},
{name:"YWJCQ",pos:[0,6,3]},
{name:"AQJD",pos:[0,6,-2]},
{name:"QDP",pos:[0,6,-3]},
{name:"SDP",pos:[0,6,-4]},
{name:"BSG",pos:[1,0,-5]},
{name:"DZG",pos:[-1,0,-5]}
];
scope.animatelist[animaModel.animacode+"on"] = [];
scope.animatelist[animaModel.animacode+"off"] = [];
for(let i=0,leni=modelorderlist[animaModel.animacode].length;i<leni;i++){
let orderdata = modelorderlist[animaModel.animacode];
let modelon = animaModel.getObjectByName(orderdata[i].name);
// modelon.helpbox = undefined;
let pointson = [];
pointson.push(new THREE.Vector3(modelon.position.x,modelon.position.y,modelon.position.z));
pointson.push(new THREE.Vector3(modelon.position.x+orderdata[i].pos[0],modelon.position.y+orderdata[i].pos[1],modelon.position.z+orderdata[i].pos[2]));
let pointsoff = [];
pointsoff.push(new THREE.Vector3(modelon.position.x+orderdata[i].pos[0],modelon.position.y+orderdata[i].pos[1],modelon.position.z+orderdata[i].pos[2]));
pointsoff.push(new THREE.Vector3(modelon.position.x,modelon.position.y,modelon.position.z));
// if(i == 0){
scope.initanimate(scope.animatelist[animaModel.animacode+"on"],modelon,animaModel.animacode+modelon.name+"on",pointson,0.03,true,i);
scope.initanimate(scope.animatelist[animaModel.animacode+"off"],modelon,animaModel.animacode+modelon.name+"off",pointsoff,0.03,true,leni-i-1);
// }else if((i+1)<leni){
// scope.initanimate(modelon,animaModel.animacode+modelon.name+"on",pointson,0.03,true,animaModel.animacode+orderdata[i+1].name+"on");
// scope.initanimate(modelon,animaModel.animacode+modelon.name+"off",pointsoff,0.03,true,animaModel.animacode+orderdata[i-1].name+"off");
// }else{
// scope.initanimate(modelon,animaModel.animacode+modelon.name+"on",pointson,0.03,true);
// scope.initanimate(modelon,animaModel.animacode+modelon.name+"off",pointsoff,0.03,true,animaModel.animacode+orderdata[i-1].name+"off");
// }
// if(animaModel.children[i].name == "xinpian"){
// }
// if(animaModel.children[i].name =="cigang"){
// }
}
}
//动画对象定义
this.initanimate = function(list,modelobject,name,points,speed,type,nextname){
let curve = new THREE.CatmullRomCurve3(points);
// curve动画轨迹
// progress动画进度
// enable当前动画开关
// speed动画速度
let animate = {
name:name,
curve:curve,
progress:0,
directchange:false,
connectmodel:modelobject,
enable:false,
status:"start",
speed:speed,
next:null
};
// list[nextname] = [];
if(list[nextname] == undefined){
list[nextname] = [];
}
list[nextname].push(animate);
}
//设置动画播放列表
this.setplaylist = function(nowlist,enable){
scope.playlist = nowlist;
scope.enable = enable;
scope.playorder = 0;
for(let i=0;i<scope.playlist[scope.playorder].length;i++){
scope.playlist[scope.playorder][i].status = "start";
}
}
//更新信息plane内容
this.updatehelpbox = function(nowhelpbox,nowtextplane){
scope.textplane = nowtextplane;
scope.helpbox = nowhelpbox;
}
this.startstop = function(){
}
this.next = function(){
}
this.before = function(){
}
//动画播放器
this.animateupdate = function(){
if(scope.enable){
if(scope.playlist){
for(let i=0;i<scope.playlist[scope.playorder].length;i++){
if(scope.playlist[scope.playorder][i].status == "start"){
}
if(scope.playlist[scope.playorder][i].progress>=1){
let point = scope.playlist[scope.playorder][i].curve.getPointAt(1);
//更新模型坐标
scope.playlist[scope.playorder][i].connectmodel.position.x = point.x;
scope.playlist[scope.playorder][i].connectmodel.position.y = point.y;
scope.playlist[scope.playorder][i].connectmodel.position.z = point.z;
scope.playlist[scope.playorder][i].enable = false;
scope.playlist[scope.playorder][i].status = "end";
scope.playlist[scope.playorder][i].progress = 0;
if(i >= scope.playlist[scope.playorder].length-1){
if(scope.playorder >= scope.playlist.length-1 ){
scope.playlist = null;
scope.status = true;
scope.enable = false;
main.animationmsgshowoff();
scope.nowmodelname = undefined;
scope.playorder = null;
break;
}else{
scope.playorder += 1;
}
}
}else{
// console.log(scope.animatelist[k].connectmodel);
if(scope.nowmodelname != scope.playlist[scope.playorder][i].connectmodel.name){
scope.nowmodelname = scope.playlist[scope.playorder][i].connectmodel.name;
main.animationmsgshowon(scope.playlist[scope.playorder][i].connectmodel);
}
//根据动画进度获取动画轨迹上点
scope.status = false;
let point = scope.playlist[scope.playorder][i].curve.getPointAt(scope.playlist[scope.playorder][i].progress);
//更新模型坐标
scope.playlist[scope.playorder][i].connectmodel.position.x = point.x;
scope.playlist[scope.playorder][i].connectmodel.position.y = point.y;
scope.playlist[scope.playorder][i].connectmodel.position.z = point.z;
if(scope.helpbox){
scope.helpbox.update();
}
if(scope.textplane){
scope.textplane.position.x = scope.playlist[scope.playorder][i].connectmodel.matrixWorld.elements[12];
scope.textplane.position.y = scope.playlist[scope.playorder][i].connectmodel.matrixWorld.elements[13]+100;
scope.textplane.position.z = scope.playlist[scope.playorder][i].connectmodel.matrixWorld.elements[14];
}
//判断模型转向
if(scope.playlist[scope.playorder][i].directchange){
let tangent = scope.playlist[scope.playorder][i].curve.getPointAt(scope.playlist[scope.playorder][i].progress+0.001);
// scope.animatelist[k]
tangent = null;
}
//增加动画进度,释放点变量
scope.playlist[scope.playorder][i].progress += scope.playlist[scope.playorder][i].speed;
point = null;
}
}
}
}
}
}

View File

@ -0,0 +1,38 @@
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
//信号机贴图
export function Signallightload(lights) {
settexture(lights, "red", JL3D_LOCAL_STATIC+'/device/signal/1.jpg');
settexture(lights, "yellow", JL3D_LOCAL_STATIC+'/device/signal/2.jpg');
settexture(lights, "green", JL3D_LOCAL_STATIC+'/device/signal/3.jpg');
settexture(lights, "black", JL3D_LOCAL_STATIC+'/device/signal/4.jpg');
}
//加载贴图
function settexture(lights, name, textureurl) {
var loader = new THREE.TextureLoader();
// 加载一个资源
loader.load(
// 资源URL
textureurl,
// onLoad回调
function (texture) {
texture.name = name;
lights[name] = texture;
},
// 目前暂不支持onProgress的回调
undefined,
// onError回调
function (err) {
console.error('An error happened.');
}
);
}

View File

@ -0,0 +1,204 @@
export function Textconfig(){
let scope = this;
this.devicelist = [];
//配置继电器文字信息
this.initdevicetext = function(selectmodel){
if(scope.devicelist.length>0){
scope.devicelist = [];
}
console.log(selectmodel.deviceType);
if(selectmodel.deviceType == "DeviceSwitch"){
initSwitchText(selectmodel);
}
if(selectmodel.deviceType == "DeviceDoor"){
initDoorText(selectmodel);
}
}
function initDoorText(selectmodel){
for(let i=0,leni=selectmodel.children.length;i<leni;i++){
let part= {
name:selectmodel.children[i].name,
text:null,
mesh:selectmodel.children[i],
index:i,
show:true,
msg:null,
};
if(selectmodel.children[i].name == "HLGJZ"){
part.text = "滑轮挂件左";
part.msg = "滑轮挂件左";
selectmodel.children[i].text = "滑轮挂件左";
}
if(selectmodel.children[i].name == "HLGJY"){
part.text = "滑轮挂件右";
part.msg = "滑轮挂件右";
selectmodel.children[i].text = "滑轮挂件右";
}
if(selectmodel.children[i].name == "HLZZZ"){
part.text = "滑轮装置左";
part.msg = "滑轮装置左";
selectmodel.children[i].text = "滑轮装置左";
}
if(selectmodel.children[i].name == "HLZZY"){
part.text = "滑轮装置右";
part.msg = "滑轮装置右";
selectmodel.children[i].text = "滑轮装置右";
}
if(selectmodel.children[i].name == "CLPD"){
part.text = "齿轮皮带";
part.msg = "齿轮皮带";
selectmodel.children[i].text = "齿轮皮带";
}
if(selectmodel.children[i].name == "SJZZ"){
part.text = "锁紧装置";
part.msg = "锁紧装置";
selectmodel.children[i].text = "锁紧装置";
}
if(selectmodel.children[i].name == "DCU"){
part.text = "门控单元";
part.msg = "门控单元";
selectmodel.children[i].text = "门控单元";
}
if(selectmodel.children[i].name == "MJL"){
part.text = "门机梁";
part.msg = "门机梁";
selectmodel.children[i].text = "门机梁";
}
if(selectmodel.children[i].name =="LCB"){
part.text = "就地控制盒";
part.msg = "就地控制盒";
selectmodel.children[i].text = "就地控制盒";
}
if(selectmodel.children[i].name =="PDJ"){
part.text = "皮带夹左";
part.msg = "皮带夹左";
selectmodel.children[i].text = "皮带夹左";
}
if(selectmodel.children[i].name =="PDJ1"){
part.text = "皮带夹右";
part.msg = "皮带夹右";
selectmodel.children[i].text = "皮带夹右";
}
// if(part.text == null){
// console.log(selectmodel.children[i].name);
// }
if(part.text){
scope.devicelist.push(part);
}
}
}
function initSwitchText(selectmodel){
for(let i=0,leni=selectmodel.children.length;i<leni;i++){
let part= {
name:selectmodel.children[i].name,
text:null,
mesh:selectmodel.children[i],
index:i,
show:true,
msg:null,
};
if(selectmodel.children[i].name == "AQJD"){
part.text = "安全接点";
part.msg = "安全接点应接触良好。在插入手摇把或钥匙时,安全接点应可靠断开,非经人工恢复不得接通电路。";
selectmodel.children[i].text = "安全接点";
}
if(selectmodel.children[i].name == "DDJ"){
part.text = "电动机";
part.msg = "电动转辙机的电动机在转辙机转换时起机械传动动作源的作用。";
selectmodel.children[i].text = "电动机";
}
if(selectmodel.children[i].name == "DINGK"){
part.text = "机盖";
part.msg = "用于防护机内零部件。";
selectmodel.children[i].text = "机盖";
}
if(selectmodel.children[i].name == "SZ"){
part.text = "锁";
part.msg = "用于将机盖锁在底壳上,并用专用钥匙才能打开。最早锁是从底壳内紧固,机外无法拆卸,但由于加工质量及其他原因导致无法开盖,故目前已改为从底壳外紧固。";
selectmodel.children[i].text = "锁";
}
if(selectmodel.children[i].name == "YWJCQ"){
part.text = "移位接触器";
part.msg = "移位接触器是一只非复式辙动开关,它有一组常闭接点,在转辙机中位于机壳侧壁齿条块顶杆的上方。它的作用是用它的常闭接点窜联在道岔表示电路中,监督主挤切削的状态是否完好,在道岔被挤时,如果表示杆被推或拉的动慢不足,检查柱未被顶起,而主副挤切销被挤断,动作杆在齿条块内位移,导致顶杆上升,使位移接点断开,切断转辙机表示电路,向行车值班员报警";
selectmodel.children[i].text = "移位接触器";
}
if(selectmodel.children[i].name == "ZDKBQ"){
part.text = "自动开闭器";
part.msg = "1.构成转辙机启动电路后在转换过程中以其机械动作构成两次接点变位监督转辙机转换全过程动作是否按要求完成。2.道岔被挤时,表示杆移动将检查柱顶起,使自动开闭器一排动接点离开静接点,从而切断道岔表示电路。";
selectmodel.children[i].text = "自动开闭器";
}
if(selectmodel.children[i].name == "SDP"){
part.text = "速动片";
part.msg = "速动片的作用是检查主轴解锁、转换和锁闭三个动作过程的完成,并最后使自动开闭器迅速切断电机动作电路,接通表示电路。";
selectmodel.children[i].text = "速动片";
}
if(selectmodel.children[i].name == "JSQ"){
part.text = "减速器";
part.msg = "将电动机输出的高转速、低转距的机械能,转变成低转速、大转距的机械能,防止非正常情况下损坏机件或烧毁电动机。";
selectmodel.children[i].text = "减速器";
}
if(selectmodel.children[i].name == "BSG"){
part.text = "表示杆";
part.msg = "检查道岔尖轨的开通方向,监督道岔的状态,给自动开闭器的准确动作提供充分条件。";
selectmodel.children[i].text = "表示杆";
}
if(selectmodel.children[i].name == "DZG"){
part.text = "动作杆";
part.msg = "齿条块和动作杆是转辙机转换道岔最后的执行部件。它们不仅要有足够的机械强度,还要在每次转换结束将道岔锁住。此外,当发生挤岔事故时,尽可能保证转辙机内部机件不受损坏。";
selectmodel.children[i].text = "动作杆";
}
if(selectmodel.children[i].name == "CTK"){
part.text = "齿条块";
part.msg = "齿条块和动作杆是转辙机转换道岔最后的执行部件。它们不仅要有足够的机械强度,还要在每次转换结束将道岔锁住。此外,当发生挤岔事故时,尽可能保证转辙机内部机件不受损坏。";
selectmodel.children[i].text = "齿条块";
}
if(selectmodel.children[i].name == "ZZ"){
part.text = "主轴";
part.msg = "主轴主要由主轴套、承轴、止挡栓和锁闭齿轮等附件与主轴组成。主轴的作用是推动大齿块以转换道岔并和削尖齿相配合完成对道岔的机械锁闭。";
selectmodel.children[i].text = "主轴";
}
if(selectmodel.children[i].name == "DJZ"){
part.text = "电机罩";
part.msg = "保护电机。";
selectmodel.children[i].text = "电机罩";
}
if(selectmodel.children[i].name == "DK"){
part.text = "底壳";
part.msg = "固定转辙机的各部件,确保相关部件的轴向或径向通信。";
selectmodel.children[i].text = "底壳";
}
if(selectmodel.children[i].name =="QDP"){
part.text = "启动片";
part.msg = "1.起输出轴与主轴间的十字接头作用使主轴随输出轴同时旋转。2.控制自动开闭器动作,在道岔转换前切断原表示电路,并为电机反转电路准备条件。";
selectmodel.children[i].text = "启动片";
}
if(selectmodel.children[i].name =="ESWCJJ"){
part.text = "二十位插接件";
part.msg = "用于机内外电缆连接,方便更换转辙机。";
selectmodel.children[i].text = "二十位插接件";
}
// if(part.text == null){
// console.log(selectmodel.children[i].name);
// }
if(part.text){
scope.devicelist.push(part);
}
}
}
}

View File

@ -0,0 +1,161 @@
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
//loader
import { FBXLoader } from '@/jlmap3d/main/loaders/FBXLoader';
import { OrbitControls } from '@/jlmap3d/main/control/OrbitControls';
import { ModelManager } from '@/jlmap3d/otherproject/xzexam/loader.js';
import { Moveanimate } from '@/jlmap3d/otherproject/xzexam/component/moveanimate.js';
var clock = new THREE.Clock();
export function Jl3dXzexam(dom) {
var scope = this;
this.dom = dom;
this.nowcode = null;
this.animateswitch = false;
this.mixers = [];
this.showmodel = null;
//动画状态
this.animastats = false;
//初始化webgl渲染
this.renderer = new THREE.WebGLRenderer({ antialias: true });
this.renderer.setClearColor(new THREE.Color(0x000000));
this.renderer.setSize(dom.offsetWidth, dom.offsetHeight);
this.renderer.shadowMap.enabled = true;
this.renderer.shadowMap.type = THREE.PCFSoftShadowMap;
this.dom.appendChild(this.renderer.domElement);
//定义相机
this.camera = new THREE.PerspectiveCamera(70, dom.offsetWidth / dom.offsetHeight, 0.01, 2000);
this.camera.position.set(27, 2.4, -1);
this.camera.rotation.y = Math.PI/2;
this.camera.aspect = dom.offsetWidth / dom.offsetHeight;
this.camera.updateProjectionMatrix();
//定义场景(渲染容器)
this.scene = new THREE.Scene();
this.scene.background = new THREE.Color(0xa0a0a0);
let moveanima = new Moveanimate(scope);
//定义全局光
let ambientLight = new THREE.AmbientLight(0xffffff, 1.3);
this.scene.add(ambientLight);
//定义轨道视角控制器
this.controls = new THREE.OrbitControls(this.camera, dom);
this.controls.maxPolarAngle = Math.PI / 2;
this.controls.minPolarangle = Math.PI / 5;
this.controls.maxDistance = 30;
this.controls.screenSpacePanning = true;
this.controls.update();
document.addEventListener( "mousedown", onselect, false );
function onselect(){
// console.log(scope.camera.position);
}
this.anime = null;
let modelCzsb,modelFadianji,modelZcg,modelQjd,modelShengzi;
this.modelmanager = new ModelManager();
scope.modelmanager.loadpromise(scope.mixers).then(function (data) {
scope.scene.add(scope.modelmanager.model2.mesh);
modelCzsb = scope.modelmanager.model2.mesh.getObjectByName("CZSB");
scope.modelmanager.model2.mesh.remove(modelCzsb);
// modelCzsb.visible = false;
modelFadianji = scope.modelmanager.model2.mesh.getObjectByName("FADIANJI");
scope.modelmanager.model2.mesh.remove(modelFadianji);
modelZcg = scope.modelmanager.model2.mesh.getObjectByName("ZCG");
scope.modelmanager.model2.mesh.remove(modelZcg);
modelQjd = scope.modelmanager.model2.mesh.getObjectByName("QJD");
scope.modelmanager.model2.mesh.remove(modelQjd);
modelShengzi = scope.modelmanager.model2.mesh.getObjectByName("SHENGZI");
scope.modelmanager.model2.mesh.remove(modelShengzi);
let human1 = scope.modelmanager.model1.mesh;
human1.position.set(25, 0, 1.8);
// human1.rotation.y = -Math.PI/2;
let human2 = human1.clone(true);
human2.position.set(25, 0, -2);
// human2.rotation.y = -Math.PI/2;
scope.scene.add(human1);
scope.scene.add(human2);
animate();
});
window.onresize = function () {
scope.renderer.setSize(dom.offsetWidth,dom.offsetHeight);
}
this.changeIndex = function(index){
if(index == "1"){
// modelCzsb.visible = true;
scope.modelmanager.model2.mesh.add(modelCzsb);
}
if(index == "2"){
scope.modelmanager.model2.mesh.add(modelFadianji);
}
if(index == "3"){
scope.modelmanager.model2.mesh.add(modelZcg);
}
if(index == "4"){
scope.modelmanager.model2.mesh.add(modelQjd);
}
if(index == "5"){
scope.modelmanager.model2.mesh.add(modelShengzi);
}
if(index == "6"){
scope.modelmanager.model2.action.play();
}
if(index == "7"){
scope.modelmanager.model2.mesh.remove(modelCzsb);
scope.modelmanager.model2.mesh.remove(modelFadianji);
scope.modelmanager.model2.mesh.remove(modelZcg);
scope.modelmanager.model2.mesh.remove(modelQjd);
scope.modelmanager.model2.mesh.remove(modelShengzi);
}
}
let stopTime = 0;
//循环渲染函数
function animate() {
scope.anime = requestAnimationFrame(animate);
scope.renderer.render(scope.scene, scope.camera);
scope.controls.update();
//scope.camera.lookAt(plane);
// moveanima.animateupdate();
let delta = clock.getDelta();
if (scope.mixers) {
for (let i = 0; i < scope.mixers.length; i++) {
scope.mixers[i].update(delta);
// if (scope.mixers[i]) {
// if( scope.mixers[i].staticType){
// // console.log(scope.mixers[i].time);
// if(scope.mixers[i]._actions[0].time<stopTime){
// scope.mixers[i].update(delta);
// }else{
// scope.mixers[i]._actions[0].paused = true;
// }
// }else{
// scope.mixers[i].update(delta);
// }
// }
}
}
}
}

View File

@ -0,0 +1,75 @@
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
import { BASE_ASSET_API } from '@/api/jlmap3d/assets3d.js';
export function ModelManager(){
let scope = this;
this.model1 = {};
this.model2 = {};
this.loadpromise = function (mixers){
let initlist = [];
let staticJyHuman = {
assetname: "救援人员",
deviceType: "JyHuman",
id: "xz1",
packageName: "救援人员",
type: "static",
url: "/MODEL/2021-11-19/527-70780.FBX"
};
initlist.push(fbxpromise(staticJyHuman,mixers,scope.model1));
let staticJyScene = {
assetname: "列车救援场景",
deviceType: "JyScene",
id: "xz2",
packageName: "列车救援场景",
type: "static",
url: "/MODEL/2021-11-19/528-20265.FBX"
};
initlist.push(fbxpromise(staticJyScene,mixers,scope.model2));
return new Promise(function(resolve, reject){
Promise.all(initlist).then((result) => {
resolve("success"); //['成功了', 'success']
}).catch((error) => {
//console.log(error);
});
});
}
}
function fbxpromise(asset,mixers,model){
return new Promise(function(resolve, reject){
var loader = new THREE.FBXLoader();
let modelurl;
modelurl = BASE_ASSET_API+asset.url;
loader.load( modelurl, function ( object ) {
let mixer = new THREE.AnimationMixer( object );
object.traverse( function ( child ) {
if ( child.isMesh ) {
child.castShadow = true;
child.receiveShadow = true;
}
} );
model.mesh = object;
if(object.animations.length>0){
model.action = mixer.clipAction( object.animations[ 0 ] );
model.action.setLoop(THREE.LoopOnce);
model.action.clampWhenFinished = true;
mixers.push(mixer);
}
resolve(asset.deviceType);
} );
});
}

View File

@ -1,7 +1,7 @@
import { Capsule } from '@/jlmap3d/lesson3d/math/Capsule.js';
import { Capsule } from '@/jlmap3d/utils/math/Capsule.js';
import { Octree } from '@/jlmap3d/lesson3d/math/Octree.js';
import { Octree } from '@/jlmap3d/utils/math/Octree.js';
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
import { OBJLoader } from '@/jlmap3d/main/loaders/OBJLoader';

View File

@ -1,5 +1,5 @@
import { Capsule } from '@/jlmap3d/lesson3d/math/Capsule.js';
import { Capsule } from '@/jlmap3d/utils/math/Capsule.js';
var Octree = ( function () {
var _v1 = new THREE.Vector3();

View File

@ -29,7 +29,7 @@ class Pathfinding {
// not-recommended these days, so go ahead and start warning.
console.warn('[three-pathfinding]: Use BufferGeometry, not Geometry, to create zone.');
} else {
geometry = new Geometry().fromBufferGeometry(geometry);
geometry = new THREE.Geometry().fromBufferGeometry(geometry);
}
return Builder.buildZone(geometry);

View File

@ -13,7 +13,8 @@ const mapDeviceStyle = {
'12': 'ningbo_03', // 宁波三号线
'13': 'race_01', // 2020国赛线路
'14':'nanjing_02', // 南京二号线
'15': 'datie_01' // 大铁线路一
'15': 'datie_01', // 大铁线路一
'16': 'datie_02' // 大铁线路二
};
export function selectLineCode(code) {

View File

@ -6,8 +6,8 @@ class SkinCode extends defaultStyle {
super();
this.fontFamily = '宋体';
this[deviceType.Section] = {
elemnetType:['name', 'standTrackText', 'reentryTrackText', 'transferTrackText', 'destinationText', 'line', 'separator', 'speedLimit'],
preAxleIgnoreFault: true,
elemnetType:['name', 'standTrackText', 'reentryTrackText', 'transferTrackText', 'destinationText', 'line', 'separator', 'speedLimit'],
preAxleIgnoreFault: true,
active: {
routeColor: false // 进路触发颜色
},
@ -83,7 +83,7 @@ class SkinCode extends defaultStyle {
borderBackgroundColor: '#22DFDF',
textShadowColor: '#22DFDF',
nameShow: true,
nameBackgroundColor: '#000',
nameBackgroundColor: '#000',
lineDash: [3, 3],
lineWidthMore: 2.5
},
@ -126,7 +126,7 @@ class SkinCode extends defaultStyle {
},
trainPosition:{
display: false // 列车实时位置显示
}
}
};
this[deviceType.Signal] = {
@ -351,7 +351,7 @@ class SkinCode extends defaultStyle {
mouseOverStyle: {
borderLineColor: '#FFFFFF',
borderLineDash: [3, 3],
standBackgroundColor: 'rgba(0,0,0,0)'
standBackgroundColor: 'rgba(0,0,0,0)'
},
// reentry: {}, // 站台折返策略
common: { // 通用属性
@ -608,7 +608,7 @@ class SkinCode extends defaultStyle {
lineDash: [3, 3], // 车次窗虚线间隔
lineWidth: 1, // 车次窗线宽
trainWindowSmooth: 0.01, // 车次窗矩形圆滑程度
show: true // 车次窗是否显示
show: false // 车次窗是否显示
};
this[deviceType.SplitStation] = {
lineLength: 15, // 箭头线长度
@ -765,7 +765,7 @@ class SkinCode extends defaultStyle {
};
this[deviceType.FloodGate] = {};
this[deviceType.DirectionRod] = {};
this[deviceType.IndicatorLight] = {};
this[deviceType.IndicatorLight] = {};
}
}

View File

@ -549,7 +549,7 @@ class SkinCode extends defaultStyle {
lineDash: null, // 车次窗虚线间隔
lineWidth: 1, // 车次窗线宽
trainWindowSmooth: 0, // 车次窗矩形圆滑程度
show: true // 车次窗是否显示
show: false // 车次窗是否显示
};
this[deviceType.SplitStation] = {
lineLength: 15, // 箭头线长度
@ -699,7 +699,7 @@ class SkinCode extends defaultStyle {
};
this[deviceType.FloodGate] = {};
this[deviceType.DirectionRod] = {};
this[deviceType.IndicatorLight] = {};
this[deviceType.IndicatorLight] = {};
}
}

View File

@ -746,7 +746,7 @@ class SkinCode extends defaultStyle {
lineDash: null, // 车次窗虚线间隔
lineWidth: 1, // 车次窗线宽
trainWindowSmooth: 0, // 车次窗矩形圆滑程度
show: true // 车次窗是否显示
show: false // 车次窗是否显示
};
this[deviceType.SplitStation] = {
lineLength: 15, // 箭头线长度

View File

@ -394,17 +394,19 @@ class SkinCode extends defaultStyle {
greenColor: '#00FF00', // 控制模式绿色
redColor: '#FF0000', // 控制模式红色
yellowColor: '#FFFF00', // 控制模式黄色
purpleColor:'#840084' // 控制模式紫色
purpleColor:'#840084', // 控制模式紫色
strokeColor: '#fff',
lineWidth: 1
},
emergencyControl: { // 紧急站控
show: true,
show: false,
offset: { x: 0, y: 0 },
text: '紧急站控',
arrowShow: false,
grayColor: '#7F7F7F'
},
centerControl: { // 中控
show: true,
show: false,
offset: { x: 0, y: 0 },
text: '中控',
buttonShow: false,
@ -412,19 +414,38 @@ class SkinCode extends defaultStyle {
grayColor: '#7F7F7F'
},
substationControl: { // 站控按钮
show: true,
show: false,
offset: { x: 0, y: 0 },
text: '站控',
arrowShow: false,
grayColor: '#7F7F7F'
},
interconnectedControl: { // 联锁控
show: true,
show: false,
offset: { x: 0, y: 0 },
text: '联锁控',
arrowShow: false,
grayColor: '#7F7F7F'
}
},
veryControl: {
show: true,
offset: { x: 0, y: 0 },
text: '非常站控'
},
selfDiscipline: {
show: true,
offset: { x: 0, y: 0 },
text: '允许自律'
},
selfDisciplineControl: {
show: true,
offset: { x: 0, y: 0 },
text: '自律控制'
},
veryControlButton: {
offset: { x: 0, y: 0 },
text: '非常站控'
}
}
};

File diff suppressed because it is too large Load Diff

View File

@ -84,7 +84,7 @@ class SkinCode extends defaultStyle {
invadeColor: '#EF0C08', // 区段侵入颜色
spareColor: '#3F3F3F', // 区段空闲颜色
communicationOccupiedColor: '#FE0000', // 区段通信车占用颜色
unCommunicationOccupiedColor: '#FE0000', // 区段非通讯车占用颜色
unCommunicationOccupiedColor: '#A600A6', // 区段非通讯车占用颜色
routeLockColor: '#FFFFFF', // 区段路由锁定颜色
faultLockColor: '#00FF00', // 区段故障锁闭颜色
undefinedColor: '#0071C1', // 区段未定义颜色
@ -581,7 +581,7 @@ class SkinCode extends defaultStyle {
lineDash: null, // 车次窗虚线间隔
lineWidth: 1, // 车次窗线宽
trainWindowSmooth: 0, // 车次窗矩形圆滑程度
show: true // 车次窗是否显示
show: false // 车次窗是否显示
};
this[deviceType.SplitStation] = {
lineLength: 15, // 箭头线长度

View File

@ -654,7 +654,7 @@ class SkinCode extends defaultStyle {
trainHeight: 10, // 列车高度
trainHeadDistance: 2, // 列车和车头之间的间距
trainWidth: 76, // 列车长度
trainTextFontSize: 10, // 列车字号
trainTextFontSize: 16, // 列车字号
fontFamily: 'consolas', // 默认字体 族类
haveTextHSDA: false, // 是否需创建textHSDA对象
haveArrowText: true, // 是否需创建arrowText对象
@ -673,6 +673,7 @@ class SkinCode extends defaultStyle {
{status: '07', showColor: '#FFFF00'}
], // 目的地状态 01准点 02早点 03严重早点 04晚点 05严重晚点 06头码车 07ATP切除
destinationStatusSetText: 'trainServer', // 目的地状态设置的对应哪个text的颜色
runLineHide: true, // 运行时列车line 竖杆隐藏
directionType: [
{
type: 1,

View File

@ -172,6 +172,9 @@ class SkinCode extends defaultStyle {
whiteColor: '#FFFFFF', // 信号灯白色
blueColor: '#000080' // 信号灯蓝色
},
virtual: { // 虚拟信号机
lamp: 'triangle' // 灯型 三角形
},
route: {
direction: false, // 自动进路方向
offset: { x: -4, y: 0 }, // 自动进路偏移量
@ -630,7 +633,7 @@ class SkinCode extends defaultStyle {
lineDash: null, // 车次窗虚线间隔
lineWidth: 1, // 车次窗线宽
trainWindowSmooth: 0, // 车次窗矩形圆滑程度
show: true // 车次窗是否显示
show: false // 车次窗是否显示
};
this[deviceType.SplitStation] = {
lineLength: 15, // 箭头线长度

View File

@ -21,7 +21,8 @@ class SkinCode extends defaultStyle {
textPosition: 'inside', // 文字位置
textVerticalAlign: 'middle', // 文字垂直对齐方式
approachColor: '#FFFFFF',
occupyColor: '#FF0000' // 计轴区段占用字体颜色
occupyColor: '#FF0000', // 计轴区段占用字体颜色
invalidColor:'#ff0000' // // 计轴故障
},
logicText: {
z: 10,
@ -93,9 +94,9 @@ class SkinCode extends defaultStyle {
protectiveLockColor: '#9DFF6E', // 区段保护锁闭
delayUnlockColor: '#00FF00', // 延时解锁
faultLockColor: '#9B4A0A', // 区段故障锁定颜色
faultLockColor: '#00FF00', // 区段故障锁定颜色
invalidColor: '#ff0000', // 计轴故障
invalidColor: '', // 计轴故障
undefinedColor: '#0071C1', // 区段未定义颜色
atcExcisionColor: '#A0522D', // 区段atc切除颜色
atsExcisionColor: '#A0522D', // 区段ats切除颜色
@ -225,6 +226,15 @@ class SkinCode extends defaultStyle {
whiteColor: '#FFFFFF', // 信号灯白色
blueColor: '#0010FF' // 信号灯蓝色
},
virtual: { // 虚拟信号机
bg: { // 虚拟信号机背景
fillColor:'#FFFFFF', // 信号背景颜色
strokecolor:'#FFFFFF', // 信号描边颜色
lineWidth: 1, // 信号背景描边宽度
distanceX: 2, // 信号背景x偏移距离
distanceY: 0 // 信号背景Y偏移距离
}
},
route: {
direction: false, // 自动进路方向
offset: { x: -4, y: 0 }, // 自动进路偏移量
@ -261,7 +271,7 @@ class SkinCode extends defaultStyle {
},
transmission: { // 传输信号机
fillColor: '#f00',
fillColorVirtual: '#000080',
fillColorVirtual: '#f00',
sideLength: 20,
textColor: '#fff',
strokeColor: '#00FFFF'
@ -703,7 +713,7 @@ class SkinCode extends defaultStyle {
lineDash: null, // 车次窗虚线间隔
lineWidth: 1, // 车次窗线宽
trainWindowSmooth: 0, // 车次窗矩形圆滑程度
show: true // 车次窗是否显示
show: false // 车次窗是否显示
};
this[deviceType.SplitStation] = {
lineLength: 15, // 箭头线长度

View File

@ -354,8 +354,8 @@ class SkinCode extends defaultStyle {
borderBackgroundColor: '#22DFDF', // 边框背景色
borderColor: '#fff', // 边框颜色
textShadowColor: '#22DFDF', // 字体阴影颜色
coreBackgroundColor: '#00BFFF', // 岔颜色 浅蓝色
coreBackgroundColorOver: '#001AFC' // 岔颜色 深蓝色
coreBackgroundColor: '#00BFFF', // 岔颜色 浅蓝色
coreBackgroundColorOver: '#001AFC' // 岔颜色 深蓝色
}
};
@ -663,7 +663,7 @@ class SkinCode extends defaultStyle {
lineDash: [3], // 车次窗虚线间隔
lineWidth: 0.5, // 车次窗线宽
trainWindowSmooth: 0, // 车次窗矩形圆滑程度
show: true // 车次窗是否显示
show: false // 车次窗是否显示
};
this[deviceType.SplitStation] = {
lineLength: 15, // 箭头线长度

View File

@ -271,8 +271,8 @@ class SkinCode extends defaultStyle {
mergentR:4, // 站台折返策略边数
position: 0, // 折返方向
offset: {x: -16, y: -15}, // 折返偏移量
noHumanColor: '#0F16DA', // 站台无人折返
autoChangeEndsColor: '#0BF400' // 站台自动换端
noHumanColor: '#0BF400', // 站台无人折返
autoChangeEndsColor: '#0F16DA' // 站台自动换端
},
common: { // 通用属性

View File

@ -604,7 +604,7 @@ class SkinCode extends defaultStyle {
lineDash: null, // 车次窗虚线间隔
lineWidth: 1, // 车次窗线宽
trainWindowSmooth: 0, // 车次窗矩形圆滑程度
show: true // 车次窗是否显示
show: false // 车次窗是否显示
};
this[deviceType.NoOneReturn] = {
displayCondition: '01', // 显示条件 01所有模式下显示 02 行调显示 03现地显示
@ -849,7 +849,7 @@ class SkinCode extends defaultStyle {
};
this[deviceType.FloodGate] = {};
this[deviceType.DirectionRod] = {};
this[deviceType.IndicatorLight] = {};
this[deviceType.IndicatorLight] = {};
}
}

View File

@ -285,4 +285,49 @@ deviceRender[deviceType.IndicatorLight] = {
_type: deviceType.IndicatorLight,
zlevel: 1
};
/** 接发车指示灯 */
deviceRender[deviceType.PickOrDepartArrow] = {
_type: deviceType.PickOrDepartArrow,
zlevel: 1
};
/** 区间占用 区间监控 */
deviceRender[deviceType.SectionOccupied] = {
_type: deviceType.SectionOccupied,
zlevel: 1
};
/** 辅助状态 */
deviceRender[deviceType.AssistStatus] = {
_type: deviceType.AssistStatus,
zlevel: 1
};
/** 总辅助状态 */
deviceRender[deviceType.TotalAssist] = {
_type: deviceType.TotalAssist,
zlevel: 1
};
/** 发车辅助 */
deviceRender[deviceType.DepartAssist] = {
_type: deviceType.DepartAssist,
zlevel: 1
};
/** 接车辅助 */
deviceRender[deviceType.PickAssist] = {
_type: deviceType.PickAssist,
zlevel: 1
};
/** 复原状态灯 */
deviceRender[deviceType.Recovery] = {
_type: deviceType.Recovery,
zlevel: 1
};
/** 事故状态灯 */
deviceRender[deviceType.Accident] = {
_type: deviceType.Accident,
zlevel: 1
};
/** 闭塞状态灯 */
deviceRender[deviceType.Occlusion] = {
_type: deviceType.Occlusion,
zlevel: 1
};
export default deviceRender;

View File

@ -50,7 +50,15 @@ const deviceType = {
FloodGate: 'FloodGate',
DirectionRod: 'DirectionRod',
Responder: 'Responder',
SignalButton: 'SignalButton'
SignalButton: 'SignalButton',
PickOrDepartArrow: 'PickOrDepartArrow',
Occlusion: 'Occlusion',
Accident: 'Accident',
Recovery: 'Recovery',
PickAssist: 'PickAssist',
DepartAssist: 'DepartAssist',
TotalAssist: 'TotalAssist',
AssistStatus: 'AssistStatus',
SectionOccupied: 'SectionOccupied'
};
export default deviceType;

View File

@ -209,6 +209,21 @@ class Jlmap {
setTimeout(() => { this.setCenter(deviceCode); }, 60);
}
}
setCenterOffset(deviceCode, offset) {
const arr = Object.keys(this.mapDevice);
if (arr.length != 0) {
const device = this.mapDevice[deviceCode];
if (device && device.instance) {
var rect = createBoundingRect(device.instance);
rect.x += offset.x;
rect.y += offset.y;
var dcenter = calculateDCenter(rect, this.$zr.getWidth() / 2);
this.setOptions(dcenter);
}
} else {
setTimeout(() => { this.setCenter(deviceCode, offset); }, 60);
}
}
setRevoverBigScreen() {
this.screenFlag = false;
this.$painter.updateTransform({ scaleRate: this.$options.scaleRate, offsetX: this.$options.offsetX, offsetY: this.$options.offsetY });

View File

@ -122,7 +122,6 @@ class MouseController extends Eventful {
this._dragging = false;
}
if (this._zoomOnMouseWheel && this.$jmap.mapDevice['check_box'] && this._previewOrMapDraw ) {
console.log(this.isMoveRight, 'mouseup');
this.eventTarget = this.$jmap.mapDevice['check_box'].instance;
this.handleBoundingRect(this.eventTarget);
let em;

View File

@ -154,8 +154,7 @@ class Painter {
trainDevice.overLapIndex = index;
trainDevice.instance && this.mapInstanceLevel[deviceType.Train].remove(trainDevice.instance);
trainDevice.instance = null;
trainDevice.zrOffsetX = this.$jmap.$options.offsetX;
trainDevice.zrOffsetY = this.$jmap.$options.offsetY;
trainDevice.zrOptions = this.$jmap.$options;
this.add(trainDevice);
});

View File

@ -350,6 +350,15 @@ export function updateMapData(state, model) {
case deviceType.Axle: updateForList(model, state, 'indicatorLightList'); break;
case deviceType.SwitchFault: updateForList(model, state, 'indicatorLightList'); break;
case deviceType.IndicatorLight: updateForList(model, state, 'indicatorLightList'); break;
case deviceType.PickOrDepartArrow: updateForList(model, state, 'indicatorLightList'); break;
case deviceType.Occlusion: updateForList(model, state, 'indicatorLightList'); break;
case deviceType.Accident: updateForList(model, state, 'indicatorLightList'); break;
case deviceType.Recovery: updateForList(model, state, 'indicatorLightList'); break;
case deviceType.PickAssist: updateForList(model, state, 'indicatorLightList'); break;
case deviceType.DepartAssist: updateForList(model, state, 'indicatorLightList'); break;
case deviceType.TotalAssist: updateForList(model, state, 'indicatorLightList'); break;
case deviceType.AssistStatus: updateForList(model, state, 'indicatorLightList'); break;
case deviceType.SectionOccupied: updateForList(model, state, 'indicatorLightList'); break;
case deviceType.SplitStation: updateForList(model, state, 'splitStationList'); break;
case deviceType.Arrow: updateForList(model, state, 'arrowList'); break;
case deviceType.Power: updateForList(model, state, 'powerLineList'); break;

View File

@ -84,7 +84,7 @@ class EHorizontal2Door extends Group {
this.stand2.setStyle('fill', style.Psd.horizontal2Door.defaultColor);
}
}
if (model.noStatus) {
if (model.noStatus || (model.atsNoStatus && store.state.training.prdType == '02')) {
this.stand1.setStyle('fill', '#7F7F7F');
this.stand2.setStyle('fill', '#7F7F7F');
}

View File

@ -51,7 +51,7 @@ class ERect2Door extends Group {
this.psd.setStyle('fill', style.Psd.rectDoor.defaultColor);
}
}
if (model.noStatus) {
if (model.noStatus || (model.atsNoStatus && store.state.training.prdType == '02')) {
this.psd.setStyle('fill', '#7F7F7F');
}
}

Some files were not shown because too many files have changed in this diff Show More