Merge branch 'dev' of https://git.code.tencent.com/lian-cbtc/jl-client into dev
This commit is contained in:
commit
b5cc83a0e0
@ -1,5 +1,5 @@
|
||||
# just a flag
|
||||
NODE_ENV = 'production'
|
||||
NODE_ENV = 'test'
|
||||
|
||||
# base api
|
||||
VUE_APP_BASE_API = 'https://test.joylink.club/jlcloud'
|
||||
|
@ -35,7 +35,7 @@ export default {
|
||||
this.$alert(this.$t('tip.logoutTips'), this.$t('tip.hint'), {
|
||||
confirmButtonText: this.$t('tip.confirm'),
|
||||
callback: action => {
|
||||
this.$store.dispatch('LogOut').then(resp => {
|
||||
this.$store.dispatch('exit').then(resp => {
|
||||
this.$router.push({path: loginInfo[getSessionStorage('project')].loginPath});
|
||||
});
|
||||
}
|
||||
@ -53,13 +53,13 @@ export default {
|
||||
window.addEventListener('unload', async e => {
|
||||
gap_time = new Date().getTime() - beforeUnload_time;
|
||||
if (gap_time <= 5) {
|
||||
await this.$store.dispatch('LogOut');
|
||||
await this.$store.dispatch('exit');
|
||||
}
|
||||
});
|
||||
window.addEventListener('beforeunload', async e => {
|
||||
beforeUnload_time = new Date().getTime();
|
||||
if (isFireFox) {
|
||||
await this.$store.dispatch('LogOut');
|
||||
await this.$store.dispatch('exit');
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -49,6 +49,7 @@ export default {
|
||||
exitPlan: 'Exit Plan',
|
||||
back: 'Back',
|
||||
threeDimensionalView: 'Three-Dimensional View',
|
||||
deviceView: 'DeviceView',
|
||||
taskOperateSuccess: 'Task Operate success',
|
||||
getTimeFail: 'Failed to get time',
|
||||
startSimulationFail: 'Start simulation failed, please go back and try again',
|
||||
|
@ -13,6 +13,7 @@ export default {
|
||||
faultInformation: 'Fault information:',
|
||||
vWeek: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
|
||||
trackCheck: 'Track check',
|
||||
cameraRailMove:'Roaming',
|
||||
signalCheck: 'Signal check',
|
||||
turnoutCheck: 'Turnout check',
|
||||
stationInfoDisplay: 'Station information — display',
|
||||
|
@ -484,7 +484,7 @@ export default {
|
||||
accessSideTurnoutData: 'Access side turnout data',
|
||||
|
||||
turnBackRailName: 'Name of reentrant rail',
|
||||
routeSegmentData: 'The approach automatically triggers the segment data',
|
||||
routeSegmentData: 'Interlock clearance section',
|
||||
routeProtectsData: 'Path continuation protects segment data',
|
||||
physicalSection: 'Access physical segment data',
|
||||
routeAccessScreenData: 'Access screen door data',
|
||||
|
@ -49,6 +49,7 @@ export default {
|
||||
exitPlan: '退出计划',
|
||||
back: '返回',
|
||||
threeDimensionalView: '三维视图',
|
||||
deviceView: '设备视图',
|
||||
taskOperateSuccess: '任务操作成功',
|
||||
getTimeFail: '获取时间失败',
|
||||
startSimulationFail: '开始仿真失败,请返回重试',
|
||||
@ -177,4 +178,3 @@ export default {
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
@ -13,6 +13,7 @@ export default {
|
||||
faultInformation: '故障信息:',
|
||||
vWeek: ['星期天', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
|
||||
trackCheck: '轨道检查',
|
||||
cameraRailMove:'漫游场景',
|
||||
signalCheck: '信号机检查',
|
||||
turnoutCheck: '道岔检查',
|
||||
stationInfoDisplay: '站台信息——显示',
|
||||
|
@ -425,7 +425,7 @@ export default {
|
||||
accessSideTurnoutData: '侧防道岔',
|
||||
|
||||
turnBackRailName: '折返轨名称',
|
||||
routeSegmentData: '进路自动触发区段',
|
||||
routeSegmentData: '连锁出清区段',
|
||||
routeProtectsData: '进路延续保护区段',
|
||||
physicalSection: '进路物理区段',
|
||||
routeRouteScreenData: '进路屏蔽门',
|
||||
|
@ -1,5 +1,5 @@
|
||||
export function SetCamera(dom) {
|
||||
var camera = new THREE.PerspectiveCamera(60, dom.clientWidth/dom.clientHeight, 1, 1500);
|
||||
var camera = new THREE.PerspectiveCamera(60, dom.clientWidth/dom.clientHeight, 1, 5000);
|
||||
camera.position.set( 0, 0, 0 );
|
||||
camera.aspect = window.innerWidth / window.innerHeight;
|
||||
camera.updateProjectionMatrix();
|
||||
|
@ -20,34 +20,34 @@ export function TrainList() {
|
||||
THREE.Loader.Handlers.add( /\.dds$/i, new THREE.DDSLoader() ) ;
|
||||
for(let i=0;i<data.length;i++){
|
||||
new THREE.MTLLoader().setPath( '../../static/model/train/' ).load( 'train.mtl', function ( materials ) {
|
||||
materials.preload();
|
||||
materials.preload();
|
||||
|
||||
new THREE.OBJLoader().setMaterials( materials ).setPath( '../../static/model/train/' ).load( 'train.obj', function ( object ) {
|
||||
new THREE.OBJLoader().setMaterials( materials ).setPath( '../../static/model/train/' ).load( 'train.obj', function ( object ) {
|
||||
|
||||
object.name = data[i].code;
|
||||
object.name = data[i].code;
|
||||
|
||||
object.position.z = 30000;
|
||||
object.position.y = 2;
|
||||
object.position.z = 30000;
|
||||
object.position.y = 2;
|
||||
|
||||
let textgeometry = new THREE.PlaneBufferGeometry( 64, 32, 1 );
|
||||
let textmaterial = new THREE.MeshBasicMaterial( { side: THREE.DoubleSide,map: new THREE.CanvasTexture(getTextCanvas(data[i])),transparent: true} );
|
||||
let textplane = new THREE.Mesh( textgeometry, textmaterial );
|
||||
textplane.name = data[i].code;
|
||||
textplane.position.y = 30;
|
||||
//textplane.rotation.x = Math.PI/2;
|
||||
scope.textlist.push(textplane);
|
||||
object.add(textplane);
|
||||
let textgeometry = new THREE.PlaneBufferGeometry( 64, 32, 1 );
|
||||
let textmaterial = new THREE.MeshBasicMaterial( { side: THREE.DoubleSide,map: new THREE.CanvasTexture(getTextCanvas(data[i])),transparent: true} );
|
||||
let textplane = new THREE.Mesh( textgeometry, textmaterial );
|
||||
textplane.name = data[i].code;
|
||||
textplane.position.y = 30;
|
||||
//textplane.rotation.x = Math.PI/2;
|
||||
scope.textlist.push(textplane);
|
||||
object.add(textplane);
|
||||
|
||||
let newtrain = {};
|
||||
newtrain.mesh = object;
|
||||
newtrain.mesh.scale.set(0.5,0.5,0.5);
|
||||
newtrain.mesh.first = false;
|
||||
let newtrain = {};
|
||||
newtrain.mesh = object;
|
||||
newtrain.mesh.scale.set(0.5,0.5,0.5);
|
||||
newtrain.mesh.first = false;
|
||||
|
||||
scope.list.push(newtrain);
|
||||
scope.group.add(newtrain.mesh);
|
||||
}, onProgress, onError );
|
||||
scope.list.push(newtrain);
|
||||
scope.group.add(newtrain.mesh);
|
||||
}, onProgress, onError );
|
||||
|
||||
} );
|
||||
} );
|
||||
}
|
||||
|
||||
}
|
||||
|
35
src/jlmap3d/jl3ddevice/component/signallight.js
Normal file
35
src/jlmap3d/jl3ddevice/component/signallight.js
Normal file
@ -0,0 +1,35 @@
|
||||
export function Signallightload(lights) {
|
||||
|
||||
|
||||
settexture(lights, "red", 'https://test.joylink.club/oss/wx/signal/1.jpg');
|
||||
|
||||
settexture(lights, "yellow", 'https://test.joylink.club/oss/wx/signal/2.jpg');
|
||||
|
||||
settexture(lights, "green", 'https://test.joylink.club/oss/wx/signal/3.jpg');
|
||||
|
||||
settexture(lights, "black", 'https://test.joylink.club/oss/wx/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.');
|
||||
}
|
||||
);
|
||||
}
|
32
src/jlmap3d/jl3ddevice/config.js
Normal file
32
src/jlmap3d/jl3ddevice/config.js
Normal file
@ -0,0 +1,32 @@
|
||||
var Staticmodel = {
|
||||
Switch: {
|
||||
id: "1",
|
||||
name: "道岔",
|
||||
deviceType: "Switch",
|
||||
type: "fuzhou",
|
||||
picUrl: "",
|
||||
assetUrl: "https://joylink.club/oss/wx/switch/switch.FBX"
|
||||
},
|
||||
Signal: {
|
||||
id: "2",
|
||||
name: "信号机",
|
||||
deviceType: "Signal",
|
||||
type: "low",
|
||||
picUrl: "",
|
||||
assetUrl: "https://joylink.club/oss/wx/signal/signal.FBX"
|
||||
},
|
||||
stationstand: {
|
||||
id: "3",
|
||||
name: "站台",
|
||||
deviceType: "stationstand",
|
||||
type: "low",
|
||||
picUrl: "",
|
||||
assetUrl: "../../static/model/device/stationstand.FBX"
|
||||
//https://joylink.club/oss/wx/stationstand/stationstand.FBX
|
||||
//
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export { Staticmodel }
|
451
src/jlmap3d/jl3ddevice/jl3ddevice.js
Normal file
451
src/jlmap3d/jl3ddevice/jl3ddevice.js
Normal file
@ -0,0 +1,451 @@
|
||||
import { Staticmodel } from '@/jlmap3d/jl3ddevice/config.js';
|
||||
//loader
|
||||
import { FBXLoader } from '@/jlmap3d/main/loaders/FBXLoader';
|
||||
import { OrbitControls } from '@/jlmap3d/main/control/OrbitControls';
|
||||
|
||||
import { ModelManager } from '@/jlmap3d/jl3ddevice/loader.js';
|
||||
import { Signallightload } from '@/jlmap3d/jl3ddevice/component/signallight.js';
|
||||
|
||||
import StompClient from '@/utils/sock';
|
||||
|
||||
var clock = new THREE.Clock();
|
||||
export function Jl3ddevice(dom,group,token) {
|
||||
var scope = this;
|
||||
|
||||
this.dom = dom;
|
||||
this.nowcode = null;
|
||||
this.animateswitch = false;
|
||||
this.signallights = [];
|
||||
Signallightload(this.signallights);
|
||||
this.mixers = [];
|
||||
this.showmodel = null;
|
||||
//初始化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, 120);
|
||||
this.camera.position.set(0, 20, 30);
|
||||
this.camera.aspect = dom.offsetWidth / dom.offsetHeight;
|
||||
this.camera.updateProjectionMatrix();
|
||||
//定义场景(渲染容器)
|
||||
this.scene = new THREE.Scene();
|
||||
this.scene.background = new THREE.Color(0xa0a0a0);
|
||||
|
||||
var mesh = new THREE.Mesh(new THREE.PlaneBufferGeometry(200, 200), new THREE.MeshPhongMaterial({ color: 0x999999, depthWrite: false }));
|
||||
mesh.rotation.x = - Math.PI / 2;
|
||||
mesh.receiveShadow = true;
|
||||
this.scene.add(mesh);
|
||||
|
||||
var grid = new THREE.GridHelper(200, 20, 0x000000, 0x000000);
|
||||
grid.material.opacity = 0.2;
|
||||
grid.material.transparent = true;
|
||||
this.scene.add(grid);
|
||||
|
||||
|
||||
//定义全局光
|
||||
let ambientLight = new THREE.AmbientLight(0xffffff, 1.3);
|
||||
this.scene.add(ambientLight);
|
||||
|
||||
|
||||
var spotLight = new THREE.SpotLight(0xffffff);
|
||||
spotLight.position.set(-50, 60, 15);
|
||||
spotLight.castShadow = true;
|
||||
spotLight.shadow.mapSize.width = 1024;
|
||||
spotLight.shadow.mapSize.height = 1024;
|
||||
this.scene.add(spotLight);
|
||||
|
||||
|
||||
|
||||
this.controls = new THREE.OrbitControls(this.camera, dom);
|
||||
this.controls.maxPolarAngle = Math.PI / 2;
|
||||
this.controls.minPolarangle = Math.PI / 5;
|
||||
this.controls.maxDistance = 80;
|
||||
this.controls.update();
|
||||
this.selectmodel = null;
|
||||
|
||||
let teststomp = new StompClient();
|
||||
let topic = '/user/topic/simulation/assistant/'+group;
|
||||
let header = {'X-Token': token};
|
||||
try {
|
||||
// console.log("teststomp");
|
||||
teststomp.subscribe(topic, callback, header);
|
||||
} catch (error) {
|
||||
console.error('websocket订阅失败');
|
||||
}
|
||||
|
||||
function callback(Response) {
|
||||
let data = JSON.parse(Response.body);
|
||||
if(scope.nowcode != data.body.code){
|
||||
scope.selectmodel(data);
|
||||
}else{
|
||||
scope.updateaction(data);
|
||||
}
|
||||
|
||||
}
|
||||
window.onresize = function () {
|
||||
scope.camera.aspect = scope.dom.offsetWidth / scope.dom.offsetHeight;
|
||||
scope.camera.updateProjectionMatrix();
|
||||
scope.renderer.setSize(scope.dom.offsetWidth, scope.dom.offsetHeight);
|
||||
}
|
||||
|
||||
this.anime = null;
|
||||
|
||||
this.modelmanager = new ModelManager();
|
||||
this.modelmanager.loadpromise(Staticmodel, scope.mixers).then(function (data) {
|
||||
animate();
|
||||
})
|
||||
|
||||
//循环渲染函数
|
||||
function animate() {
|
||||
|
||||
scope.anime = requestAnimationFrame(animate);
|
||||
scope.renderer.render(scope.scene, scope.camera);
|
||||
scope.controls.update();
|
||||
//scope.camera.lookAt(plane);
|
||||
//
|
||||
let delta = clock.getDelta();
|
||||
if (scope.mixers) {
|
||||
for (let i = 0; i < scope.mixers.length; i++) {
|
||||
if (scope.mixers[i]) {
|
||||
scope.mixers[i].update(delta);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
this.selectmodel = function (data) {
|
||||
if (scope.showmodel) {
|
||||
scope.nowcode = data.body.code;
|
||||
if (scope.showmodel.code != data.body.code) {
|
||||
scope.scene.remove(scope.showmodel);
|
||||
scope.showmodel = null
|
||||
|
||||
if (data.body._type == "Switch") {
|
||||
scope.modelmanager.switchmodel.locateType = data.body.locateType;
|
||||
scope.modelmanager.switchmodel.code = data.body.code;
|
||||
|
||||
scope.showmodel = scope.modelmanager.switchmodel.mesh;
|
||||
scope.scene.add(scope.showmodel);
|
||||
|
||||
}
|
||||
if (data.body._type == "Signal") {
|
||||
scope.modelmanager.signalmodel.code = data.body.code;
|
||||
|
||||
scope.showmodel = scope.modelmanager.signalmodel.mesh;
|
||||
scope.scene.add(scope.showmodel);
|
||||
|
||||
}
|
||||
|
||||
if (data.body._type == "StationStand") {
|
||||
|
||||
scope.modelmanager.standmodel.code = data.body.code;
|
||||
|
||||
scope.showmodel = scope.modelmanager.standmodel.mesh;
|
||||
scope.scene.add(scope.showmodel);
|
||||
}
|
||||
scope.showmodel.code = data.body.code;
|
||||
initstatus(data);
|
||||
}
|
||||
} else {
|
||||
if (data.body._type == "Switch") {
|
||||
scope.modelmanager.switchmodel.locateType = data.body.locateType;
|
||||
scope.modelmanager.switchmodel.code = data.body.code;
|
||||
scope.showmodel = scope.modelmanager.switchmodel.mesh;
|
||||
scope.scene.add(scope.showmodel);
|
||||
if (data.body.locateType == "01") {
|
||||
scope.modelmanager.switchmodel.locateType = "01";
|
||||
scope.modelmanager.switchmodel.action.reset();
|
||||
scope.modelmanager.switchmodel.action.time = 0;
|
||||
scope.modelmanager.switchmodel.action.timeScale = -1;
|
||||
scope.modelmanager.switchmodel.action.play();
|
||||
|
||||
} else if (data.body.locateType == "02") {
|
||||
scope.modelmanager.switchmodel.locateType = "02";
|
||||
scope.modelmanager.switchmodel.action.reset();
|
||||
scope.modelmanager.switchmodel.action.time = scope.modelmanager.switchmodel.action._clip.duration;
|
||||
scope.modelmanager.switchmodel.action.timeScale = 1;
|
||||
scope.modelmanager.switchmodel.action.play();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
if (data.body._type == "Signal") {
|
||||
scope.modelmanager.signalmodel.code = data.body.code;
|
||||
scope.showmodel = scope.modelmanager.signalmodel.mesh;
|
||||
scope.scene.add(scope.showmodel);
|
||||
}
|
||||
|
||||
if (data.body._type == "StationStand") {
|
||||
scope.modelmanager.standmodel.code = data.body.code;
|
||||
scope.showmodel = scope.modelmanager.standmodel.mesh;
|
||||
scope.scene.add(scope.showmodel);
|
||||
}
|
||||
initstatus(data);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
this.updateaction = function (data) {
|
||||
|
||||
if (data.body._type == "Switch") {
|
||||
if (data.body.code == scope.modelmanager.switchmodel.code) {
|
||||
if (scope.modelmanager.switchmodel.locateType != data.body.locateType) {
|
||||
if (data.body.locateType == "03" && scope.modelmanager.switchmodel.locateType == "01") {
|
||||
|
||||
scope.modelmanager.switchmodel.locateType = "02";
|
||||
scope.modelmanager.switchmodel.action.reset();
|
||||
scope.modelmanager.switchmodel.action.time = 0;
|
||||
scope.modelmanager.switchmodel.action.timeScale = 1;
|
||||
scope.modelmanager.switchmodel.action.play();
|
||||
|
||||
} else if (data.body.locateType == "03" && scope.modelmanager.switchmodel.locateType == "02") {
|
||||
|
||||
scope.modelmanager.switchmodel.locateType = "01";
|
||||
scope.modelmanager.switchmodel.action.reset();
|
||||
scope.modelmanager.switchmodel.action.time = scope.modelmanager.switchmodel.action._clip.duration;
|
||||
scope.modelmanager.switchmodel.action.timeScale = -1;
|
||||
scope.modelmanager.switchmodel.action.play();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (data.body._type == "Signal") {
|
||||
if (data.body.code == scope.modelmanager.signalmodel.code) {
|
||||
scope.modelmanager.signalmodel.status = data.body.status;
|
||||
|
||||
if (data.body.lightType == "01") {
|
||||
|
||||
if (data.body.status == "01") {
|
||||
scope.modelmanager.signalmodel.mesh.children[0].material.map = scope.signallights["red"];
|
||||
scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true;
|
||||
scope.modelmanager.signalmodel.mesh.children[1].material.map = scope.signallights["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true;
|
||||
scope.modelmanager.signalmodel.mesh.children[2].material.map = scope.signallights["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true;
|
||||
}
|
||||
//开放
|
||||
if (data.body.status == "02") {
|
||||
|
||||
if (data.body.switchLocateType == "01") {
|
||||
scope.modelmanager.signalmodel.mesh.children[0].material.map = scope.signallights["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true;
|
||||
scope.modelmanager.signalmodel.mesh.children[1].material.map = scope.signallights["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true;
|
||||
scope.modelmanager.signalmodel.mesh.children[2].material.map = scope.signallights["green"];
|
||||
scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true;
|
||||
}
|
||||
|
||||
if (data.body.switchLocateType == "02") {
|
||||
scope.modelmanager.signalmodel.mesh.children[0].material.map = scope.signallights["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true;
|
||||
scope.modelmanager.signalmodel.mesh.children[1].material.map = scope.signallights["yellow"];
|
||||
scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true;
|
||||
scope.modelmanager.signalmodel.mesh.children[2].material.map = scope.signallights["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true;
|
||||
}
|
||||
|
||||
}
|
||||
//引导
|
||||
if (data.body.status == "03") {
|
||||
scope.modelmanager.signalmodel.mesh.children[0].material.map = scope.signallights["red"];
|
||||
scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true;
|
||||
scope.modelmanager.signalmodel.mesh.children[1].material.map = scope.signallights["yellow"];
|
||||
scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true;
|
||||
scope.modelmanager.signalmodel.mesh.children[2].material.map = scope.signallights["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true;
|
||||
}
|
||||
//封锁
|
||||
if (data.body.status == "04") {
|
||||
scope.modelmanager.signalmodel.mesh.children[0].material.map = scope.signallights["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true;
|
||||
scope.modelmanager.signalmodel.mesh.children[1].material.map = scope.signallights["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true;
|
||||
scope.modelmanager.signalmodel.mesh.children[2].material.map = scope.signallights["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true;
|
||||
}
|
||||
//故障
|
||||
if (data.body.status == "05") {
|
||||
scope.modelmanager.signalmodel.mesh.children[0].material.map = scope.signallights["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true;
|
||||
scope.modelmanager.signalmodel.mesh.children[1].material.map = scope.signallights["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true;
|
||||
scope.modelmanager.signalmodel.mesh.children[2].material.map = scope.signallights["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true;
|
||||
}
|
||||
|
||||
} else if (data.body.lightType == "02") {
|
||||
scope.modelmanager.signalmodel.mesh.children[0].material.map = scope.signallights["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true;
|
||||
scope.modelmanager.signalmodel.mesh.children[1].material.map = scope.signallights["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true;
|
||||
scope.modelmanager.signalmodel.mesh.children[2].material.map = scope.signallights["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (data.body._type == "StationStand") {
|
||||
if (data.body.code == scope.modelmanager.standmodel.code) {
|
||||
if (data.body.screenDoorOpenStatus == "02" && scope.modelmanager.standmodel.screenDoorOpenStatus == "01") {
|
||||
scope.modelmanager.standmodel.screenDoorOpenStatus = "00";
|
||||
}
|
||||
if (data.body.screenDoorOpenStatus == "02" && scope.modelmanager.standmodel.screenDoorOpenStatus == "00") {
|
||||
scope.modelmanager.standmodel.screenDoorOpenStatus = "02";
|
||||
|
||||
scope.modelmanager.standmodel.action.reset();
|
||||
scope.modelmanager.standmodel.action.time = 0;
|
||||
scope.modelmanager.standmodel.action.timeScale = 1;
|
||||
scope.modelmanager.standmodel.action.play();
|
||||
}
|
||||
|
||||
if (data.body.screenDoorOpenStatus == "01" && scope.modelmanager.standmodel.screenDoorOpenStatus == "02") {
|
||||
scope.modelmanager.standmodel.screenDoorOpenStatus = "00";
|
||||
}
|
||||
if (data.body.screenDoorOpenStatus == "01" && scope.modelmanager.standmodel.screenDoorOpenStatus == "00") {
|
||||
scope.modelmanager.standmodel.screenDoorOpenStatus = "01";
|
||||
|
||||
scope.modelmanager.standmodel.action.reset();
|
||||
scope.modelmanager.standmodel.action.time = scope.modelmanager.standmodel.action._clip.duration;
|
||||
scope.modelmanager.standmodel.action.timeScale = -1;
|
||||
scope.modelmanager.standmodel.action.play();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// scope.showmodel.
|
||||
}
|
||||
|
||||
function initstatus(data) {
|
||||
|
||||
if (data.body._type == "Switch") {
|
||||
|
||||
if (data.body.locateType == "01") {
|
||||
scope.modelmanager.switchmodel.locateType = "01";
|
||||
scope.modelmanager.switchmodel.action.reset();
|
||||
scope.modelmanager.switchmodel.action.time = 0;
|
||||
scope.modelmanager.switchmodel.action.timeScale = -1;
|
||||
scope.modelmanager.switchmodel.action.play();
|
||||
|
||||
} else if (data.body.locateType == "02") {
|
||||
scope.modelmanager.switchmodel.locateType = "02";
|
||||
scope.modelmanager.switchmodel.action.reset();
|
||||
scope.modelmanager.switchmodel.action.time = scope.modelmanager.switchmodel.action._clip.duration;
|
||||
scope.modelmanager.switchmodel.action.timeScale = 1;
|
||||
scope.modelmanager.switchmodel.action.play();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (data.body._type == "Signal") {
|
||||
if (data.body.lightType == "01") {
|
||||
|
||||
if (data.body.status == "01") {
|
||||
scope.modelmanager.signalmodel.mesh.children[0].material.map = scope.signallights["red"];
|
||||
scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true;
|
||||
scope.modelmanager.signalmodel.mesh.children[1].material.map = scope.signallights["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true;
|
||||
scope.modelmanager.signalmodel.mesh.children[2].material.map = scope.signallights["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true;
|
||||
}
|
||||
//开放
|
||||
if (data.body.status == "02") {
|
||||
|
||||
if (data.body.switchLocateType == "01") {
|
||||
scope.modelmanager.signalmodel.mesh.children[0].material.map = scope.signallights["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true;
|
||||
scope.modelmanager.signalmodel.mesh.children[1].material.map = scope.signallights["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true;
|
||||
scope.modelmanager.signalmodel.mesh.children[2].material.map = scope.signallights["green"];
|
||||
scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true;
|
||||
}
|
||||
|
||||
if (data.body.switchLocateType == "02") {
|
||||
scope.modelmanager.signalmodel.mesh.children[0].material.map = scope.signallights["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true;
|
||||
scope.modelmanager.signalmodel.mesh.children[1].material.map = scope.signallights["yellow"];
|
||||
scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true;
|
||||
scope.modelmanager.signalmodel.mesh.children[2].material.map = scope.signallights["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true;
|
||||
}
|
||||
|
||||
}
|
||||
//引导
|
||||
if (data.body.status == "03") {
|
||||
scope.modelmanager.signalmodel.mesh.children[0].material.map = scope.signallights["red"];
|
||||
scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true;
|
||||
scope.modelmanager.signalmodel.mesh.children[1].material.map = scope.signallights["yellow"];
|
||||
scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true;
|
||||
scope.modelmanager.signalmodel.mesh.children[2].material.map = scope.signallights["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true;
|
||||
}
|
||||
//封锁
|
||||
if (data.body.status == "04") {
|
||||
scope.modelmanager.signalmodel.mesh.children[0].material.map = scope.signallights["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true;
|
||||
scope.modelmanager.signalmodel.mesh.children[1].material.map = scope.signallights["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true;
|
||||
scope.modelmanager.signalmodel.mesh.children[2].material.map = scope.signallights["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true;
|
||||
}
|
||||
//故障
|
||||
if (data.body.status == "05") {
|
||||
scope.modelmanager.signalmodel.mesh.children[0].material.map = scope.signallights["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true;
|
||||
scope.modelmanager.signalmodel.mesh.children[1].material.map = scope.signallights["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true;
|
||||
scope.modelmanager.signalmodel.mesh.children[2].material.map = scope.signallights["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true;
|
||||
}
|
||||
|
||||
} else if (data.body.lightType == "02") {
|
||||
scope.modelmanager.signalmodel.mesh.children[0].material.map = scope.signallights["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true;
|
||||
scope.modelmanager.signalmodel.mesh.children[1].material.map = scope.signallights["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true;
|
||||
scope.modelmanager.signalmodel.mesh.children[2].material.map = scope.signallights["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (data.body._type == "StationStand") {
|
||||
if (data.body.code == scope.modelmanager.standmodel.code) {
|
||||
|
||||
if (data.body.screenDoorOpenStatus == "02") {
|
||||
scope.modelmanager.standmodel.screenDoorOpenStatus = "02";
|
||||
|
||||
scope.modelmanager.standmodel.action.reset();
|
||||
scope.modelmanager.standmodel.action.time = scope.modelmanager.standmodel.action._clip.duration;
|
||||
scope.modelmanager.standmodel.action.timeScale = 1;
|
||||
scope.modelmanager.standmodel.action.play();
|
||||
}
|
||||
|
||||
if (data.body.screenDoorOpenStatus == "01") {
|
||||
scope.modelmanager.standmodel.screenDoorOpenStatus = "01";
|
||||
|
||||
scope.modelmanager.standmodel.action.reset();
|
||||
scope.modelmanager.standmodel.action.time = 0;
|
||||
scope.modelmanager.standmodel.action.timeScale = -1;
|
||||
scope.modelmanager.standmodel.action.play();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
76
src/jlmap3d/jl3ddevice/loader.js
Normal file
76
src/jlmap3d/jl3ddevice/loader.js
Normal file
@ -0,0 +1,76 @@
|
||||
|
||||
|
||||
export function ModelManager(){
|
||||
let scope = this;
|
||||
|
||||
this.switchmodel = {
|
||||
code:null,
|
||||
locateType:"01",
|
||||
mesh:null,
|
||||
action:null
|
||||
};
|
||||
|
||||
this.signalmodel = {
|
||||
code:null,
|
||||
lightType:"01",
|
||||
status:"01",
|
||||
switchLocateType:"01",
|
||||
mesh:null,
|
||||
action:null
|
||||
};
|
||||
|
||||
this.standmodel = {
|
||||
code:null,
|
||||
screenDoorOpenStatus:"01",
|
||||
mesh:null,
|
||||
action:null
|
||||
};
|
||||
|
||||
this.loadpromise = function (data,mixers){
|
||||
let initlist = [];
|
||||
initlist.push(fbxpromise(data.Switch,mixers,scope.switchmodel));
|
||||
initlist.push(fbxpromise(data.Signal,mixers,scope.signalmodel));
|
||||
initlist.push(fbxpromise(data.stationstand,mixers,scope.standmodel));
|
||||
|
||||
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();
|
||||
loader.load( asset.assetUrl, 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);
|
||||
//model.action.play();
|
||||
}
|
||||
|
||||
|
||||
|
||||
resolve(asset.deviceType);
|
||||
} );
|
||||
|
||||
});
|
||||
}
|
110
src/jlmap3d/jl3ddevicetrain/component/jdqcontrol.js
Normal file
110
src/jlmap3d/jl3ddevicetrain/component/jdqcontrol.js
Normal file
@ -0,0 +1,110 @@
|
||||
|
||||
export function Jdqcontrol(){
|
||||
let scope = this;
|
||||
|
||||
this.devicelist = [];
|
||||
|
||||
this.jdqinit = function(){
|
||||
|
||||
}
|
||||
|
||||
this.jdqraycast = function(){
|
||||
|
||||
}
|
||||
|
||||
//配置继电器文字信息
|
||||
this.jdqdevicelist = function(selectmodel){
|
||||
if(scope.devicelist.length>0){
|
||||
scope.devicelist = [];
|
||||
}
|
||||
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 == "dizuo"){
|
||||
part.text = "底座";
|
||||
part.msg = "";
|
||||
selectmodel.children[i].text = "底座";
|
||||
}
|
||||
if(selectmodel.children[i].name == "cigang"){
|
||||
part.text = "磁钢";
|
||||
part.msg = "";
|
||||
selectmodel.children[i].text = "磁钢";
|
||||
}
|
||||
if(selectmodel.children[i].name == "Lxing"){
|
||||
part.text = "L型轭铁";
|
||||
part.msg = "扼铁呈L洲形,由电工纯铁板冲压成型,外表镀多层铬防护。";
|
||||
selectmodel.children[i].text = "L型轭铁";
|
||||
}
|
||||
if(selectmodel.children[i].name == "jiaoxingxiantie"){
|
||||
part.text = "角型衔铁";
|
||||
part.msg = "衔铁为角型,靠蝶形钢丝卡固定在轭铁的刀刃上,动作灵活。衔铁由电工纯铁冲压成型,衔铁上铆有重锤片,以保证衔铁靠重力返回";
|
||||
selectmodel.children[i].text = "角型衔铁";
|
||||
}
|
||||
if(selectmodel.children[i].name == "xianquan"){
|
||||
part.text = "线圈";
|
||||
part.msg = "线圈水平安装在铁芯上,分为前圈和后圈,之所以采用双线圈,主要是为了增强控制电路的适应性和灵活性,可根据电路需要单线圈控"+
|
||||
"制、双线圈串联控制或双线圈并联控制。";
|
||||
selectmodel.children[i].text = "线圈";
|
||||
}
|
||||
if(selectmodel.children[i].name == "zhongchuipian"){
|
||||
part.text = "重锤片";
|
||||
part.msg = "重锤片由薄钢板制成,其片数由接点组的多少决定,使衔铁的重量基本上满足后接点压力的需要。";
|
||||
selectmodel.children[i].text = "重锤片";
|
||||
}
|
||||
if(selectmodel.children[i].name == "lagan"){
|
||||
part.text = "拉杆";
|
||||
part.msg = "拉杆有铁制的和塑料制的,衔铁通过拉杆带动接点组。";
|
||||
selectmodel.children[i].text = "拉杆";
|
||||
}
|
||||
if(selectmodel.children[i].name == "dongjiedianzhou"){
|
||||
part.text = "动接点轴";
|
||||
part.msg = "动接点轴由锡磷青铜线制成。";
|
||||
selectmodel.children[i].text = "动接点轴";
|
||||
}
|
||||
if(selectmodel.children[i].name == "neibu"){
|
||||
part.text = "内部";
|
||||
part.msg = "";
|
||||
selectmodel.children[i].text = "内部";
|
||||
}
|
||||
if(selectmodel.children[i].name == "jiedian"){
|
||||
part.text = "接点";
|
||||
part.msg = "";
|
||||
selectmodel.children[i].text = "接点";
|
||||
}
|
||||
if(selectmodel.children[i].name == "yapian"){
|
||||
part.text = "压片";
|
||||
part.msg = "压片由弹簧钢板冲压成弓形,分上、下两篇,其作用是保证接点组的稳固性。";
|
||||
selectmodel.children[i].text = "压片";
|
||||
}
|
||||
if(selectmodel.children[i].name == "fanghuozhao"){
|
||||
part.text = "防火罩";
|
||||
part.msg = "";
|
||||
selectmodel.children[i].text = "防火罩";
|
||||
}
|
||||
if(selectmodel.children[i].name == "dianyuanpian"){
|
||||
part.text = "电源片";
|
||||
part.msg = "电源片单元由黄铜制成的电源片压在胶木内。";
|
||||
selectmodel.children[i].text = "电源片";
|
||||
}
|
||||
if(selectmodel.children[i].name == "xinpian"){
|
||||
part.text = "电路板";
|
||||
part.msg = "";
|
||||
selectmodel.children[i].text = "电路板";
|
||||
}
|
||||
if(selectmodel.children[i].name =="jueyuanzhou"){
|
||||
part.text = "绝缘轴";
|
||||
part.msg = "绝缘轴用冻石瓷料制成,抗冲击强度足够。";
|
||||
selectmodel.children[i].text = "绝缘轴";
|
||||
}
|
||||
|
||||
scope.devicelist.push(part);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
235
src/jlmap3d/jl3ddevicetrain/component/moveanimate.js
Normal file
235
src/jlmap3d/jl3ddevicetrain/component/moveanimate.js
Normal file
@ -0,0 +1,235 @@
|
||||
|
||||
export function Moveanimate(){
|
||||
let scope = this;
|
||||
|
||||
//动画列表
|
||||
this.animatelist = [];
|
||||
|
||||
//动画播放器开关
|
||||
this.enable = true;
|
||||
|
||||
//定义所有继电器部件动画
|
||||
this.initlist = function(modellist){
|
||||
// let points = [];
|
||||
// points.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
|
||||
// points.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
|
||||
// scope.initanimate(modellist[j].children[i],modellist[j].name+"select1",points,true);
|
||||
|
||||
for(let j=0,lenj=modellist.length;j<lenj;j++){
|
||||
for(let i=0,leni=modellist[j].children.length;i<leni;i++){
|
||||
|
||||
if(modellist[j].children[i].name == "dizuo"){
|
||||
let points1 = [];
|
||||
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
|
||||
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z-150));
|
||||
scope.initanimate(modellist[j].children[i],modellist[j].name+"dizuoon",points1,true);
|
||||
let points2 = [];
|
||||
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z-150));
|
||||
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
|
||||
scope.initanimate(modellist[j].children[i],modellist[j].name+"dizuooff",points2,true);
|
||||
}
|
||||
if(modellist[j].children[i].name == "Lxing"){
|
||||
let points1 = [];
|
||||
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
|
||||
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y-50,modellist[j].children[i].position.z));
|
||||
scope.initanimate(modellist[j].children[i],modellist[j].name+"Lxingon",points1,true);
|
||||
let points2 = [];
|
||||
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y-50,modellist[j].children[i].position.z));
|
||||
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
|
||||
scope.initanimate(modellist[j].children[i],modellist[j].name+"Lxingoff",points2,true);
|
||||
}
|
||||
if(modellist[j].children[i].name == "jiaoxingxiantie"){
|
||||
let points1 = [];
|
||||
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
|
||||
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z+25));
|
||||
scope.initanimate(modellist[j].children[i],modellist[j].name+"jiaoxingxiantieon",points1,true);
|
||||
let points2 = [];
|
||||
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z+25));
|
||||
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
|
||||
scope.initanimate(modellist[j].children[i],modellist[j].name+"jiaoxingxiantieoff",points2,true);
|
||||
}
|
||||
if(modellist[j].children[i].name == "xianquan"){
|
||||
let points1 = [];
|
||||
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
|
||||
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y-100,modellist[j].children[i].position.z));
|
||||
scope.initanimate(modellist[j].children[i],modellist[j].name+"xianquanon",points1,true);
|
||||
let points2 = [];
|
||||
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y-100,modellist[j].children[i].position.z));
|
||||
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
|
||||
scope.initanimate(modellist[j].children[i],modellist[j].name+"xianquanoff",points2,true);
|
||||
}
|
||||
if(modellist[j].children[i].name == "zhongchuipian"){
|
||||
let points1 = [];
|
||||
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
|
||||
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y-25,modellist[j].children[i].position.z));
|
||||
scope.initanimate(modellist[j].children[i],modellist[j].name+"zhongchuipianon",points1,true);
|
||||
let points2 = [];
|
||||
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+25,modellist[j].children[i].position.z));
|
||||
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
|
||||
scope.initanimate(modellist[j].children[i],modellist[j].name+"zhongchuipianoff",points2,true);
|
||||
}
|
||||
if(modellist[j].children[i].name == "lagan"){
|
||||
let points1 = [];
|
||||
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
|
||||
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z+50));
|
||||
scope.initanimate(modellist[j].children[i],modellist[j].name+"laganon",points1,true);
|
||||
let points2 = [];
|
||||
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z+50));
|
||||
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
|
||||
scope.initanimate(modellist[j].children[i],modellist[j].name+"laganoff",points2,true);
|
||||
}
|
||||
if(modellist[j].children[i].name == "dongjiedianzhou"){
|
||||
let points1 = [];
|
||||
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
|
||||
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z+25));
|
||||
scope.initanimate(modellist[j].children[i],modellist[j].name+"dongjiedianzhouon",points1,true);
|
||||
let points2 = [];
|
||||
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z+25));
|
||||
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
|
||||
scope.initanimate(modellist[j].children[i],modellist[j].name+"dongjiedianzhouoff",points2,true);
|
||||
}
|
||||
if(modellist[j].children[i].name == "neibu"){
|
||||
let points1 = [];
|
||||
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
|
||||
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z-50));
|
||||
scope.initanimate(modellist[j].children[i],modellist[j].name+"neibuon",points1,true);
|
||||
let points2 = [];
|
||||
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z-50));
|
||||
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
|
||||
scope.initanimate(modellist[j].children[i],modellist[j].name+"neibuoff",points2,true);
|
||||
}
|
||||
if(modellist[j].children[i].name == "jiedian"){
|
||||
let points1 = [];
|
||||
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
|
||||
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z-15));
|
||||
scope.initanimate(modellist[j].children[i],modellist[j].name+"jiedianon",points1,true);
|
||||
let points2 = [];
|
||||
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z-15));
|
||||
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
|
||||
scope.initanimate(modellist[j].children[i],modellist[j].name+"jiedianoff",points2,true);
|
||||
}
|
||||
if(modellist[j].children[i].name == "yapian"){
|
||||
let points1 = [];
|
||||
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
|
||||
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z-25));
|
||||
scope.initanimate(modellist[j].children[i],modellist[j].name+"yapianon",points1,true);
|
||||
let points2 = [];
|
||||
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z-25));
|
||||
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
|
||||
scope.initanimate(modellist[j].children[i],modellist[j].name+"yapianoff",points2,true);
|
||||
}
|
||||
if(modellist[j].children[i].name == "fanghuozhao"){
|
||||
let points1 = [];
|
||||
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
|
||||
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z+200));
|
||||
scope.initanimate(modellist[j].children[i],modellist[j].name+"fanghuozhaoon",points1,true);
|
||||
let points2 = [];
|
||||
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z+200));
|
||||
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
|
||||
scope.initanimate(modellist[j].children[i],modellist[j].name+"fanghuozhaooff",points2,true);
|
||||
}
|
||||
if(modellist[j].children[i].name == "dianyuanpian"){
|
||||
let points1 = [];
|
||||
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
|
||||
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z-50));
|
||||
scope.initanimate(modellist[j].children[i],modellist[j].name+"dianyuanpianon",points1,true);
|
||||
let points2 = [];
|
||||
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z-50));
|
||||
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
|
||||
scope.initanimate(modellist[j].children[i],modellist[j].name+"dianyuanpianoff",points2,true);
|
||||
}
|
||||
if(modellist[j].children[i].name == "xinpian"){
|
||||
let points1 = [];
|
||||
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
|
||||
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+150,modellist[j].children[i].position.z));
|
||||
scope.initanimate(modellist[j].children[i],modellist[j].name+"xinpianon",points1,true);
|
||||
let points2 = [];
|
||||
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+150,modellist[j].children[i].position.z));
|
||||
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
|
||||
scope.initanimate(modellist[j].children[i],modellist[j].name+"xinpianoff",points2,true);
|
||||
}
|
||||
if(modellist[j].children[i].name =="jueyuanzhou"){
|
||||
let points1 = [];
|
||||
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
|
||||
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z));
|
||||
scope.initanimate(modellist[j].children[i],modellist[j].name+"jueyuanzhouon",points1,true);
|
||||
let points2 = [];
|
||||
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z));
|
||||
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
|
||||
scope.initanimate(modellist[j].children[i],modellist[j].name+"jueyuanzhouoff",points2,true);
|
||||
}
|
||||
if(modellist[j].children[i].name =="cigang"){
|
||||
let points1 = [];
|
||||
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
|
||||
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y-100,modellist[j].children[i].position.z+100));
|
||||
scope.initanimate(modellist[j].children[i],modellist[j].name+"cigangon",points1,true);
|
||||
let points2 = [];
|
||||
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y-100,modellist[j].children[i].position.z+100));
|
||||
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
|
||||
scope.initanimate(modellist[j].children[i],modellist[j].name+"cigangoff",points2,true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//动画对象定义
|
||||
this.initanimate = function(modelobject,name,points,type){
|
||||
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:0.05,
|
||||
};
|
||||
scope.animatelist[name] = animate;
|
||||
}
|
||||
|
||||
//动画播放器
|
||||
this.animateupdate = function(){
|
||||
|
||||
if(scope.enable){
|
||||
//遍历动画列表将启动的动画位置更新
|
||||
for(let k in scope.animatelist){
|
||||
if(scope.animatelist[k].enable){
|
||||
// 动画播放结束
|
||||
if(scope.animatelist[k].progress>=0.99){
|
||||
scope.animatelist[k].enable = false;
|
||||
scope.animatelist[k].status = "end";
|
||||
scope.animatelist[k].progress = 0;
|
||||
}else{
|
||||
//根据动画进度获取动画轨迹上点
|
||||
let point = scope.animatelist[k].curve.getPointAt(scope.animatelist[k].progress);
|
||||
//更新模型坐标
|
||||
scope.animatelist[k].connectmodel.position.x = point.x;
|
||||
scope.animatelist[k].connectmodel.position.y = point.y;
|
||||
scope.animatelist[k].connectmodel.position.z = point.z;
|
||||
|
||||
//判断模型转向
|
||||
if(scope.animatelist[k].directchange){
|
||||
let tangent = scope.animatelist[k].curve.getPointAt(scope.animatelist[k].progress+0.001);
|
||||
// scope.animatelist[k]
|
||||
tangent = null;
|
||||
}
|
||||
//增加动画进度,释放点变量
|
||||
scope.animatelist[k].progress += scope.animatelist[k].speed;
|
||||
point = null;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
44
src/jlmap3d/jl3ddevicetrain/config.js
Normal file
44
src/jlmap3d/jl3ddevicetrain/config.js
Normal file
@ -0,0 +1,44 @@
|
||||
var Staticmodel = {
|
||||
Jdq1: {
|
||||
id: "1",
|
||||
name: "继电器1700",
|
||||
deviceType: "jdq1700",
|
||||
type: "training",
|
||||
picUrl: "",
|
||||
assetUrl: "../../static/model/jdq/jdq1700.FBX"
|
||||
},
|
||||
Jdq2: {
|
||||
id: "1",
|
||||
name: "继电器1000",
|
||||
deviceType: "jdq",
|
||||
type: "training",
|
||||
picUrl: "",
|
||||
assetUrl: "../../static/model/jdq/jdq1000.FBX"
|
||||
},
|
||||
Jdq3: {
|
||||
id: "1",
|
||||
name: "继电器h18",
|
||||
deviceType: "jdq",
|
||||
type: "training",
|
||||
picUrl: "",
|
||||
assetUrl: "../../static/model/jdq/jdqh18.FBX"
|
||||
},
|
||||
Jdq4: {
|
||||
id: "1",
|
||||
name: "继电器480",
|
||||
deviceType: "jdq",
|
||||
type: "training",
|
||||
picUrl: "",
|
||||
assetUrl: "../../static/model/jdq/jdq480.FBX"
|
||||
},
|
||||
Jdqg:{
|
||||
id: "0",
|
||||
name: "继电器柜",
|
||||
deviceType: "jdqg",
|
||||
type: "training",
|
||||
picUrl: "",
|
||||
assetUrl: "../../static/model/jdq/jdqg.FBX"
|
||||
}
|
||||
}
|
||||
|
||||
export { Staticmodel }
|
458
src/jlmap3d/jl3ddevicetrain/jl3ddevicetrain.js
Normal file
458
src/jlmap3d/jl3ddevicetrain/jl3ddevicetrain.js
Normal file
@ -0,0 +1,458 @@
|
||||
import { Staticmodel } from '@/jlmap3d/jl3ddevicetrain/config.js';
|
||||
//loader
|
||||
import { FBXLoader } from '@/jlmap3d/main/loaders/FBXLoader';
|
||||
import { OrbitControls } from '@/jlmap3d/main/control/OrbitControls';
|
||||
|
||||
import { ModelManager } from '@/jlmap3d/jl3ddevicetrain/loader.js';
|
||||
import { Moveanimate } from '@/jlmap3d/jl3ddevicetrain/component/moveanimate.js';
|
||||
import { Jdqcontrol } from '@/jlmap3d/jl3ddevicetrain/component/jdqcontrol.js';
|
||||
// import { Signallightload } from '@/jlmap3d/jl3ddevice/component/signallight.js';
|
||||
|
||||
// import StompClient from '@/utils/sock';
|
||||
import {Stats} from '@/jlmap3d/main/lib/stats.min.js';
|
||||
|
||||
var clock = new THREE.Clock();
|
||||
export function Jl3ddevice(dom) {
|
||||
let scope = this;
|
||||
//helpbox选中包围框
|
||||
//textplane三维介绍标牌
|
||||
let helpbox,textplane;
|
||||
this.dom = dom;
|
||||
this.nowcode = null;
|
||||
this.animateswitch = false;
|
||||
this.mixers = [];
|
||||
this.showmodel = null;
|
||||
//场景状态
|
||||
this.status = 0;
|
||||
//动画状态
|
||||
this.animastats = false;
|
||||
//当前选中模型
|
||||
this.selectmodel = null;
|
||||
|
||||
//初始化webgl渲染
|
||||
let renderer = new THREE.WebGLRenderer({ antialias: true,alpha: true });
|
||||
renderer.setPixelRatio( window.devicePixelRatio );
|
||||
renderer.setSize(dom.offsetWidth, dom.offsetHeight);
|
||||
// renderer.shadowMap.enabled = true;
|
||||
// renderer.shadowMap.type = THREE.PCFSoftShadowMap;
|
||||
renderer.setClearColor( 0x000000, 0 );
|
||||
this.dom.appendChild(renderer.domElement);
|
||||
|
||||
//定义相机
|
||||
let camera = new THREE.PerspectiveCamera(70, dom.offsetWidth / dom.offsetHeight, 0.01, 5000);
|
||||
camera.position.set(-1000, 1500, 0);
|
||||
camera.aspect = dom.offsetWidth / dom.offsetHeight;
|
||||
camera.updateProjectionMatrix();
|
||||
|
||||
//视角轨迹控制器
|
||||
this.controls = new THREE.OrbitControls(camera, dom);
|
||||
this.controls.target = new THREE.Vector3(500,1000,0);
|
||||
this.controls.update();
|
||||
|
||||
//定义场景(渲染容器)
|
||||
let scene = new THREE.Scene();
|
||||
var bgTexture = new THREE.TextureLoader().load("../../static/background/background.jpg");
|
||||
scene.background = bgTexture;
|
||||
|
||||
//定义全局光
|
||||
let ambientLight = new THREE.AmbientLight(0xffffff, 1.3);
|
||||
scene.add(ambientLight);
|
||||
|
||||
var light = new THREE.HemisphereLight( 0xffffff, 0x444444 );
|
||||
light.position.set( 0, 200, 0 );
|
||||
scene.add( light );
|
||||
|
||||
// var mesh = new THREE.Mesh( new THREE.PlaneBufferGeometry( 1000, 1000 ), new THREE.MeshPhongMaterial( { color: 0x999999, depthWrite: false } ) );
|
||||
// mesh.position.x = 10000;
|
||||
// mesh.rotation.x = - Math.PI / 2;
|
||||
// mesh.receiveShadow = true;
|
||||
|
||||
//网格地面
|
||||
var grid = new THREE.GridHelper( 1000, 20, 0x000000, 0x000000 );
|
||||
grid.material.opacity = 0.2;
|
||||
grid.material.transparent = true;
|
||||
grid.position.x = 10000;
|
||||
scene.add( grid );
|
||||
|
||||
// scene.add( mesh );
|
||||
//
|
||||
// var spotLight = new THREE.SpotLight(0xffffff);
|
||||
// spotLight.position.set(0, 3000, 0);
|
||||
// spotLight.castShadow = true;
|
||||
// spotLight.shadow.mapSize.width = 1024;
|
||||
// spotLight.shadow.mapSize.height = 1024;
|
||||
// scene.add(spotLight);
|
||||
|
||||
|
||||
//菜单选中设备更新设备较少
|
||||
this.updateselect = function(updata){
|
||||
// console.log(updata);
|
||||
if(helpbox){
|
||||
scene.remove( helpbox );
|
||||
helpbox = null;
|
||||
}
|
||||
helpbox = new THREE.BoxHelper( updata.mesh, 0xff0000 );
|
||||
// console.log(updata.mesh);
|
||||
let point = {
|
||||
x:updata.mesh.matrixWorld.elements[12],
|
||||
y:updata.mesh.matrixWorld.elements[13],
|
||||
z:updata.mesh.matrixWorld.elements[14]
|
||||
};
|
||||
settext(updata.mesh,point)
|
||||
getdevicemsg(updata.mesh.name);
|
||||
// moveanima.animatelist[scope.selectmodel.name+"select1"].enable = true;
|
||||
// console.log(intersects[0].object);
|
||||
scene.add( helpbox );
|
||||
}
|
||||
|
||||
//返回设备选择
|
||||
this.backselect = function(){
|
||||
move2();
|
||||
updatemenulist(scope.jdqcontrol.devicelist);
|
||||
|
||||
scope.modelmanager.controllist[0].position.set(19,1270,-165);
|
||||
scope.modelmanager.controllist[0].rotation.y = -Math.PI/2;
|
||||
scope.modelmanager.controllist[0].rotation.z = -Math.PI/2;
|
||||
|
||||
scope.modelmanager.controllist[1].position.set(19,1270,-55);
|
||||
scope.modelmanager.controllist[1].rotation.y = -Math.PI/2;
|
||||
scope.modelmanager.controllist[1].rotation.z = -Math.PI/2;
|
||||
|
||||
scope.modelmanager.controllist[2].position.set(19,1270,65);
|
||||
scope.modelmanager.controllist[2].rotation.y = -Math.PI/2;
|
||||
scope.modelmanager.controllist[2].rotation.z = -Math.PI/2;
|
||||
|
||||
scope.modelmanager.controllist[3].position.set(19,1270,170);
|
||||
scope.modelmanager.controllist[3].rotation.y = -Math.PI/2;
|
||||
scope.modelmanager.controllist[3].rotation.z = -Math.PI/2;
|
||||
|
||||
camera.position.set(-1000, 1500, 0);
|
||||
scope.controls.target = new THREE.Vector3(500,1000,0);
|
||||
scope.controls.update();
|
||||
scope.status = '0';
|
||||
if(textplane){
|
||||
scene.remove(textplane);
|
||||
textplane.geometry.dispose();
|
||||
textplane.material.dispose();
|
||||
}
|
||||
scope.selectmodel = null;
|
||||
scope.jdqcontrol.devicelist = [];
|
||||
scope.animastats = false;
|
||||
updatemsg();
|
||||
};
|
||||
|
||||
//设备分解、归位动画按钮
|
||||
this.disperdevice = function(){
|
||||
if(scope.status == '1'){
|
||||
if(scope.animastats == false){
|
||||
scope.animastats = true;
|
||||
move1();
|
||||
} else if(scope.animastats == true){
|
||||
scope.animastats = false;
|
||||
move2();
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
//
|
||||
// let teststomp = new StompClient();
|
||||
// let topic = '/user/topic/simulation/assistant/'+group;
|
||||
// let header = {'X-Token': token};
|
||||
// try {
|
||||
// // console.log("teststomp");
|
||||
// teststomp.subscribe(topic, callback, header);
|
||||
// } catch (error) {
|
||||
// console.error('websocket订阅失败');
|
||||
// }
|
||||
//
|
||||
// function callback(Response) {
|
||||
// let data = JSON.parse(Response.body);
|
||||
// if(scope.nowcode != data.body.code){
|
||||
// scope.selectmodel(data);
|
||||
// }else{
|
||||
// scope.updateaction(data);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
// let stats = new Stats();
|
||||
// dom.appendChild( stats.dom );
|
||||
|
||||
document.addEventListener( "mousedown", onselect, false );
|
||||
|
||||
window.onresize = function () {
|
||||
camera.aspect = scope.dom.offsetWidth / scope.dom.offsetHeight;
|
||||
camera.updateProjectionMatrix();
|
||||
renderer.setSize(scope.dom.offsetWidth, scope.dom.offsetHeight);
|
||||
}
|
||||
|
||||
this.jdqcontrol = new Jdqcontrol();
|
||||
|
||||
let moveanima = new Moveanimate();
|
||||
|
||||
this.anime = null;
|
||||
|
||||
this.modelmanager = new ModelManager();
|
||||
this.modelmanager.loadpromise(Staticmodel, scope.mixers,scene).then(function (data) {
|
||||
moveanima.initlist( scope.modelmanager.controllist);
|
||||
animate();
|
||||
})
|
||||
|
||||
//循环渲染函数
|
||||
function animate() {
|
||||
|
||||
scope.anime = requestAnimationFrame(animate);
|
||||
renderer.render(scene, camera);
|
||||
moveanima.animateupdate();
|
||||
// scope.controls.update();
|
||||
// stats.update();
|
||||
}
|
||||
|
||||
|
||||
function move1(){
|
||||
for(let i=0,leni=scope.selectmodel.children.length;i<leni;i++){
|
||||
|
||||
if(scope.selectmodel.children[i].name == "dizuo"){
|
||||
moveanima.animatelist[scope.selectmodel.name+"dizuoon"].enable = true;
|
||||
}
|
||||
if(scope.selectmodel.children[i].name == "Lxing"){
|
||||
moveanima.animatelist[scope.selectmodel.name+"Lxingon"].enable = true;
|
||||
}
|
||||
if(scope.selectmodel.children[i].name == "jiaoxingxiantie"){
|
||||
moveanima.animatelist[scope.selectmodel.name+"jiaoxingxiantieon"].enable = true;
|
||||
}
|
||||
if(scope.selectmodel.children[i].name == "xianquan"){
|
||||
moveanima.animatelist[scope.selectmodel.name+"xianquanon"].enable = true;
|
||||
}
|
||||
if(scope.selectmodel.children[i].name == "zhongchuipian"){
|
||||
moveanima.animatelist[scope.selectmodel.name+"zhongchuipianon"].enable = true;
|
||||
}
|
||||
if(scope.selectmodel.children[i].name == "lagan"){
|
||||
moveanima.animatelist[scope.selectmodel.name+"laganon"].enable = true;
|
||||
}
|
||||
if(scope.selectmodel.children[i].name == "dongjiedianzhou"){
|
||||
moveanima.animatelist[scope.selectmodel.name+"dongjiedianzhouon"].enable = true;
|
||||
}
|
||||
if(scope.selectmodel.children[i].name == "neibu"){
|
||||
moveanima.animatelist[scope.selectmodel.name+"neibuon"].enable = true;
|
||||
}
|
||||
if(scope.selectmodel.children[i].name == "jiedian"){
|
||||
moveanima.animatelist[scope.selectmodel.name+"jiedianon"].enable = true;
|
||||
}
|
||||
if(scope.selectmodel.children[i].name == "yapian"){
|
||||
moveanima.animatelist[scope.selectmodel.name+"yapianon"].enable = true;
|
||||
}
|
||||
if(scope.selectmodel.children[i].name == "fanghuozhao"){
|
||||
moveanima.animatelist[scope.selectmodel.name+"fanghuozhaoon"].enable = true;
|
||||
}
|
||||
if(scope.selectmodel.children[i].name == "dianyuanpian"){
|
||||
moveanima.animatelist[scope.selectmodel.name+"dianyuanpianon"].enable = true;
|
||||
}
|
||||
if(scope.selectmodel.children[i].name == "xinpian"){
|
||||
moveanima.animatelist[scope.selectmodel.name+"xinpianon"].enable = true;
|
||||
}
|
||||
if(scope.selectmodel.children[i].name =="jueyuanzhou"){
|
||||
moveanima.animatelist[scope.selectmodel.name+"jueyuanzhouon"].enable = true;
|
||||
}
|
||||
if(scope.selectmodel.children[i].name =="cigang"){
|
||||
moveanima.animatelist[scope.selectmodel.name+"cigangon"].enable = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function move2(){
|
||||
for(let i=0,leni=scope.selectmodel.children.length;i<leni;i++){
|
||||
|
||||
if(scope.selectmodel.children[i].name == "dizuo"){
|
||||
moveanima.animatelist[scope.selectmodel.name+"dizuooff"].enable = true;
|
||||
}
|
||||
if(scope.selectmodel.children[i].name == "Lxing"){
|
||||
moveanima.animatelist[scope.selectmodel.name+"Lxingoff"].enable = true;
|
||||
}
|
||||
if(scope.selectmodel.children[i].name == "jiaoxingxiantie"){
|
||||
moveanima.animatelist[scope.selectmodel.name+"jiaoxingxiantieoff"].enable = true;
|
||||
}
|
||||
if(scope.selectmodel.children[i].name == "xianquan"){
|
||||
moveanima.animatelist[scope.selectmodel.name+"xianquanoff"].enable = true;
|
||||
}
|
||||
if(scope.selectmodel.children[i].name == "zhongchuipian"){
|
||||
moveanima.animatelist[scope.selectmodel.name+"zhongchuipianoff"].enable = true;
|
||||
}
|
||||
if(scope.selectmodel.children[i].name == "lagan"){
|
||||
moveanima.animatelist[scope.selectmodel.name+"laganoff"].enable = true;
|
||||
}
|
||||
if(scope.selectmodel.children[i].name == "dongjiedianzhou"){
|
||||
moveanima.animatelist[scope.selectmodel.name+"dongjiedianzhouoff"].enable = true;
|
||||
}
|
||||
if(scope.selectmodel.children[i].name == "neibu"){
|
||||
moveanima.animatelist[scope.selectmodel.name+"neibuoff"].enable = true;
|
||||
}
|
||||
if(scope.selectmodel.children[i].name == "jiedian"){
|
||||
moveanima.animatelist[scope.selectmodel.name+"jiedianoff"].enable = true;
|
||||
}
|
||||
if(scope.selectmodel.children[i].name == "yapian"){
|
||||
moveanima.animatelist[scope.selectmodel.name+"yapianoff"].enable = true;
|
||||
}
|
||||
if(scope.selectmodel.children[i].name == "fanghuozhao"){
|
||||
moveanima.animatelist[scope.selectmodel.name+"fanghuozhaooff"].enable = true;
|
||||
}
|
||||
if(scope.selectmodel.children[i].name == "dianyuanpian"){
|
||||
moveanima.animatelist[scope.selectmodel.name+"dianyuanpianoff"].enable = true;
|
||||
}
|
||||
if(scope.selectmodel.children[i].name == "xinpian"){
|
||||
moveanima.animatelist[scope.selectmodel.name+"xinpianoff"].enable = true;
|
||||
}
|
||||
if(scope.selectmodel.children[i].name =="jueyuanzhou"){
|
||||
moveanima.animatelist[scope.selectmodel.name+"jueyuanzhouoff"].enable = true;
|
||||
}
|
||||
if(scope.selectmodel.children[i].name =="cigang"){
|
||||
moveanima.animatelist[scope.selectmodel.name+"cigangoff"].enable = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onselect(event){
|
||||
if(event.button == '0'){
|
||||
if(scope.status == '0'){
|
||||
let raycaster = new THREE.Raycaster();
|
||||
//定义平面鼠标点击坐标
|
||||
let mouse = new THREE.Vector2();
|
||||
mouse.x = (event.clientX / dom.offsetWidth) * 2 - 1;
|
||||
mouse.y = -(event.clientY / dom.offsetHeight) * 2 + 1;
|
||||
|
||||
raycaster.setFromCamera( mouse, camera );
|
||||
for(let i=0,leni=scope.modelmanager.controllist.length;i<leni;i++){
|
||||
let intersects = raycaster.intersectObjects( scope.modelmanager.controllist[i].children,true);
|
||||
|
||||
if(intersects[0]){
|
||||
scope.modelmanager.controllist[i].position.set(10000,0,0);
|
||||
scope.modelmanager.controllist[i].rotation.y = 0;
|
||||
scope.modelmanager.controllist[i].rotation.z = 0;
|
||||
camera.position.set(10800, 500, 0);
|
||||
scope.controls.target = new THREE.Vector3(10000,0,0);
|
||||
scope.jdqcontrol.jdqdevicelist(scope.modelmanager.controllist[i]);
|
||||
updatemenulist(scope.jdqcontrol.devicelist);
|
||||
scope.controls.update();
|
||||
|
||||
scope.selectmodel = scope.modelmanager.controllist[i];
|
||||
scope.status = '1';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if(scope.status == '1'){
|
||||
|
||||
//定义光线
|
||||
let raycaster = new THREE.Raycaster();
|
||||
//定义平面鼠标点击坐标
|
||||
let mouse = new THREE.Vector2();
|
||||
mouse.x = (event.clientX / dom.offsetWidth) * 2 - 1;
|
||||
mouse.y = -(event.clientY / dom.offsetHeight) * 2 + 1;
|
||||
|
||||
raycaster.setFromCamera( mouse, camera );
|
||||
|
||||
|
||||
let intersects = raycaster.intersectObjects( scope.modelmanager.controllist,true);
|
||||
if(helpbox){
|
||||
scene.remove( helpbox );
|
||||
helpbox = null;
|
||||
}
|
||||
if(textplane){
|
||||
scene.remove(textplane);
|
||||
textplane.geometry.dispose();
|
||||
textplane.material.dispose();
|
||||
}
|
||||
if(intersects[0]){
|
||||
|
||||
if(intersects[0].object.raycastoff){
|
||||
helpbox = new THREE.BoxHelper( intersects[0].object.parent, 0xff0000 );
|
||||
settext(intersects[0].object.parent,intersects[0].point);
|
||||
getdevicemsg(intersects[0].object.parent.name);
|
||||
}else{
|
||||
helpbox = new THREE.BoxHelper( intersects[0].object, 0xff0000 );
|
||||
settext(intersects[0].object,intersects[0].point);
|
||||
getdevicemsg(intersects[0].object.name);
|
||||
}
|
||||
scene.add( helpbox );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function getdevicemsg(selectname){
|
||||
// console.log(selectname);
|
||||
for(let i=0,leni=scope.jdqcontrol.devicelist.length;i<leni;i++){
|
||||
|
||||
if(selectname == scope.jdqcontrol.devicelist[i].name){
|
||||
updatemsg(scope.jdqcontrol.devicelist[i].text,scope.jdqcontrol.devicelist[i].msg);
|
||||
i=leni;
|
||||
}
|
||||
}
|
||||
}
|
||||
function settext(intersects,point){
|
||||
if(intersects.text){
|
||||
let textgeometry = new THREE.PlaneBufferGeometry( 300, 200, 1 );
|
||||
let textt = new THREE.CanvasTexture(getTextCanvas(intersects.text));
|
||||
let textmaterial = new THREE.MeshBasicMaterial( {
|
||||
side: THREE.DoubleSide,
|
||||
map:textt ,transparent: true,
|
||||
alphaTest:0.1
|
||||
} );
|
||||
if(textplane){
|
||||
scene.remove(textplane);
|
||||
textplane.geometry.dispose();
|
||||
textplane.material.dispose();
|
||||
}
|
||||
textplane= new THREE.Mesh( textgeometry, textmaterial );
|
||||
// textplane.name = data[i].code;
|
||||
textplane.position.x = point.x;
|
||||
textplane.position.y = point.y+100;
|
||||
textplane.position.z = point.z;
|
||||
// console.log(textplane.position);
|
||||
// textplane.tcode = data[i].code;
|
||||
textplane.rotation.y = -Math.PI/2;
|
||||
textplane.lookAt(camera.position);
|
||||
// scope.textlist.push(textplane);
|
||||
// newmesh.children[0].add(textplane);
|
||||
scene.add(textplane);
|
||||
textgeometry.dispose();
|
||||
textmaterial.dispose();
|
||||
textt.dispose();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
var beauty = new Image();
|
||||
beauty.src = "../../static/texture/guide.png";
|
||||
//canvas文字贴图方法
|
||||
//PS:待提炼 增强功能
|
||||
function getTextCanvas(text){
|
||||
var canvas = document.getElementById('canvastexture');
|
||||
|
||||
canvas.width = 256;
|
||||
canvas.height = 128;
|
||||
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
//var bg = canvas.createPattern(img, "no-repeat");
|
||||
//ctx.fillStyle = bg;
|
||||
ctx.fillRect(0, 0,256,128);
|
||||
ctx.font = "20px Verdana";
|
||||
ctx.fillStyle = '#FFFFFF';
|
||||
ctx.textAlign = 'center';
|
||||
ctx.textBaseline = 'middle';
|
||||
ctx.clearRect(0,0,256,128);
|
||||
//console.log(text.groupNumber);
|
||||
ctx.drawImage(beauty,0,0,256, 128);
|
||||
ctx.fillText("设备部件:"+text, 90,30);
|
||||
// ctx.fillText("车组人员:XXX", 40,20);
|
||||
// ctx.fillText("速度:XXX.XXX", 40,30);
|
||||
//ctx.fillText(text.trainModel.name, width/2,height*3/4);
|
||||
let data = ctx.getImageData(0, 0,256, 128);
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
}
|
134
src/jlmap3d/jl3ddevicetrain/loader.js
Normal file
134
src/jlmap3d/jl3ddevicetrain/loader.js
Normal file
@ -0,0 +1,134 @@
|
||||
|
||||
|
||||
export function ModelManager(){
|
||||
let scope = this;
|
||||
|
||||
this.controllist = [];
|
||||
let jdq1 = {
|
||||
code:jdq1,
|
||||
locateType:"01",
|
||||
mesh:null,
|
||||
action:null
|
||||
};
|
||||
let jdq2 = {
|
||||
code:jdq2,
|
||||
locateType:"01",
|
||||
mesh:null,
|
||||
action:null
|
||||
};
|
||||
let jdq3 = {
|
||||
code:jdq3,
|
||||
locateType:"01",
|
||||
mesh:null,
|
||||
action:null
|
||||
};
|
||||
let jdq4 = {
|
||||
code:jdq4,
|
||||
locateType:"01",
|
||||
mesh:null,
|
||||
action:null
|
||||
};
|
||||
|
||||
|
||||
this.jdqg = {
|
||||
code:null,
|
||||
locateType:"00",
|
||||
mesh:null,
|
||||
action:null
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
this.loadpromise = function (data,mixers,scene){
|
||||
let initlist = [];
|
||||
initlist.push(fbxpromise(data.Jdq1,mixers,jdq1));
|
||||
initlist.push(fbxpromise(data.Jdq2,mixers,jdq2));
|
||||
initlist.push(fbxpromise(data.Jdq3,mixers,jdq3));
|
||||
initlist.push(fbxpromise(data.Jdq4,mixers,jdq4));
|
||||
initlist.push(fbxpromise(data.Jdqg,mixers,scope.jdqg));
|
||||
|
||||
return new Promise(function(resolve, reject){
|
||||
|
||||
Promise.all(initlist).then((result) => {
|
||||
jdq1.mesh.position.x = 19;
|
||||
jdq1.mesh.position.z = -165;
|
||||
jdq1.mesh.position.y = 1270;
|
||||
jdq1.mesh.rotation.y = -Math.PI/2;
|
||||
jdq1.mesh.rotation.z = -Math.PI/2;
|
||||
|
||||
jdq2.mesh.position.x = 19;
|
||||
jdq2.mesh.position.z = -55;
|
||||
jdq2.mesh.position.y = 1270;
|
||||
jdq2.mesh.rotation.y = -Math.PI/2;
|
||||
jdq2.mesh.rotation.z = -Math.PI/2;
|
||||
|
||||
jdq3.mesh.position.x = 19;
|
||||
jdq3.mesh.position.z = 65;
|
||||
jdq3.mesh.position.y = 1270;
|
||||
jdq3.mesh.rotation.y = -Math.PI/2;
|
||||
jdq3.mesh.rotation.z = -Math.PI/2;
|
||||
|
||||
jdq4.mesh.position.x = 19;
|
||||
jdq4.mesh.position.z = 170;
|
||||
jdq4.mesh.position.y = 1270;
|
||||
jdq4.mesh.rotation.y = -Math.PI/2;
|
||||
jdq4.mesh.rotation.z = -Math.PI/2;
|
||||
|
||||
scope.controllist.push(jdq1.mesh);
|
||||
scope.controllist.push(jdq2.mesh);
|
||||
scope.controllist.push(jdq3.mesh);
|
||||
scope.controllist.push(jdq4.mesh);
|
||||
scene.add(jdq1.mesh);
|
||||
scene.add(jdq2.mesh);
|
||||
scene.add(jdq3.mesh);
|
||||
scene.add(jdq4.mesh);
|
||||
scene.add(scope.jdqg.mesh);
|
||||
resolve("success"); //['成功了', 'success']
|
||||
}).catch((error) => {
|
||||
//console.log(error);
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function fbxpromise(asset,mixers,model){
|
||||
return new Promise(function(resolve, reject){
|
||||
var loader = new THREE.FBXLoader();
|
||||
|
||||
loader.load( asset.assetUrl, function ( object ) {
|
||||
let mixer = new THREE.AnimationMixer( object );
|
||||
// object.traverse( function ( child ) {
|
||||
// if ( child.isMesh ) {
|
||||
// child.castShadow = true;
|
||||
// child.receiveShadow = true;
|
||||
// }
|
||||
// } );
|
||||
|
||||
//设置透明贴图的材质属性
|
||||
for(let i=0,leni=object.children.length;i<leni;i++){
|
||||
if(object.children[i].name == "fanghuozhao"){
|
||||
for(let j=0,lenj=object.children[i].children.length;j<lenj;j++){
|
||||
object.children[i].children[j].raycastoff = true;
|
||||
if(object.children[i].children[j].name == "waizhao"){
|
||||
object.children[i].children[j].material.depthTest = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
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);
|
||||
} );
|
||||
|
||||
});
|
||||
}
|
@ -157,7 +157,7 @@ export function JLmapDriving(dom,data,mapId,storemod,translation,routegroup) {
|
||||
// console.log(spotLight);
|
||||
// controls3.getObject().add( spotLight );
|
||||
// 订阅仿真socket
|
||||
this.Subscribe = new Jl3dDriving(updatemmi,sound,translation,routegroup);
|
||||
this.Subscribe = new Jl3dDriving(mixers,updatemmi,sound,translation,routegroup);
|
||||
|
||||
this.Subscribe.socketon(scope.Subscribe.topic);
|
||||
var timer = setInterval(function() {
|
||||
@ -222,15 +222,10 @@ export function JLmapDriving(dom,data,mapId,storemod,translation,routegroup) {
|
||||
//cctv渲染
|
||||
|
||||
|
||||
if(scope.cctvswitch == true){
|
||||
renderercctv.render(scene,cameracctv);
|
||||
}
|
||||
|
||||
//相机按键位移
|
||||
// controls3.update();
|
||||
delta = clock.getDelta();
|
||||
for (let i=mixers.length-1; i>=0; i--) {
|
||||
mixers[i].update( delta );
|
||||
}
|
||||
|
||||
// stats.update();
|
||||
}
|
||||
|
||||
@ -254,7 +249,13 @@ export function JLmapDriving(dom,data,mapId,storemod,translation,routegroup) {
|
||||
scope.webwork.onmessage = function (event) {
|
||||
// 更新列车位置
|
||||
UpdateTrain(camera, trainlisttest);
|
||||
|
||||
delta = clock.getDelta();
|
||||
for (let i=mixers.length-1; i>=0; i--) {
|
||||
mixers[i].update( delta );
|
||||
}
|
||||
if(scope.cctvswitch == true){
|
||||
renderercctv.render(scene,cameracctv);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ import { getToken } from '@/utils/auth';
|
||||
import router from '@/router';
|
||||
|
||||
// 定于仿真socket接口
|
||||
export function Jl3dDriving(updatemmi,sound,translation,routegroup) {
|
||||
export function Jl3dDriving(mixers,updatemmi,sound,translation,routegroup) {
|
||||
|
||||
let scope = this;
|
||||
this.map = null;
|
||||
@ -35,7 +35,6 @@ export function Jl3dDriving(updatemmi,sound,translation,routegroup) {
|
||||
let stoptimer = null;
|
||||
let num = 30;
|
||||
let pointstand = null;
|
||||
let nextpoints = null;
|
||||
// run as plane = 01;
|
||||
// reset = 02;
|
||||
var datatype = '00';
|
||||
@ -100,13 +99,13 @@ export function Jl3dDriving(updatemmi,sound,translation,routegroup) {
|
||||
//
|
||||
//
|
||||
// }
|
||||
|
||||
// console.log("recive");
|
||||
// console.log(data.type);
|
||||
// console.log(data.body);
|
||||
// console.log(data);
|
||||
switch (data.type) {
|
||||
case 'Simulation_Driver_Change':
|
||||
|
||||
trainlisttest.list[drivingcode].dispose = true;
|
||||
trainlisttest.group.remove(trainlisttest.list[drivingcode]);
|
||||
|
||||
drivingcode = data.body.code;
|
||||
trainlisttest.group.add(trainlisttest.list[drivingcode]);
|
||||
// sound.volswitch = true;
|
||||
@ -154,7 +153,7 @@ export function Jl3dDriving(updatemmi,sound,translation,routegroup) {
|
||||
}
|
||||
|
||||
function trainspeed(data){
|
||||
|
||||
// console.log(data);
|
||||
if (trainlisttest) {
|
||||
for (let tl = 0; tl<data.body.length; tl++) {
|
||||
code = data.body[tl].id;
|
||||
@ -191,7 +190,6 @@ export function Jl3dDriving(updatemmi,sound,translation,routegroup) {
|
||||
// if(sound.volswitch == true){
|
||||
// sound.setVolume( data.body[tl].v/100 );
|
||||
// }
|
||||
|
||||
if (data.body[tl].atpv) {
|
||||
updatemmi.updateatpspeed(data.body[tl].atpv);
|
||||
} else {
|
||||
@ -341,14 +339,19 @@ export function Jl3dDriving(updatemmi,sound,translation,routegroup) {
|
||||
drivingcode = code;
|
||||
updatemmi.updatedrivingcode(drivingcode);
|
||||
}
|
||||
if(trainlisttest.list[code].mixerpush == false){
|
||||
for(let mi=0,lenmi=trainlisttest.list[code].mixer.length;mi<lenmi;mi++){
|
||||
mixers.push(trainlisttest.list[code].mixer[mi]);
|
||||
}
|
||||
trainlisttest.list[code].mixerpush = true;
|
||||
}
|
||||
// trainlisttest.group.add(trainlisttest.list[code]);
|
||||
trainlisttest.list[code].position.y = 0;
|
||||
trainlisttest.list[code].progress = 0;
|
||||
// trainlisttest.list[code].oldoffset = data.body[i].sectionOffsetPercent;
|
||||
trainlisttest.list[code].dispose = false;
|
||||
trainlisttest.list[code].nowcode = data.body[i].linkCode;
|
||||
let vexlist = [];
|
||||
let endrotation = null;
|
||||
|
||||
trainlisttest.list[code].pc = 1;
|
||||
// console.log(data.body[i]);
|
||||
if (data.body[i].directionType == '02') { // 向右
|
||||
@ -480,8 +483,8 @@ export function Jl3dDriving(updatemmi,sound,translation,routegroup) {
|
||||
if (data.body[i].directionType == '02') { // 向右
|
||||
|
||||
trainlisttest.list[code].progress = 0;
|
||||
const rotaposx = trainlisttest.list[code].children[5].matrixWorld.elements[12];
|
||||
const rotaposz = trainlisttest.list[code].children[0].matrixWorld.elements[14];
|
||||
let rotaposx = trainlisttest.list[code].children[5].matrixWorld.elements[12];
|
||||
let rotaposz = trainlisttest.list[code].children[0].matrixWorld.elements[14];
|
||||
trainlisttest.list[code].rotation.y = 0;
|
||||
trainlisttest.list[code].position.x = rotaposx;
|
||||
for (let tl=0; tl<6; tl++) {
|
||||
@ -497,8 +500,8 @@ export function Jl3dDriving(updatemmi,sound,translation,routegroup) {
|
||||
|
||||
} else if (data.body[i].directionType == '03') { // 向左
|
||||
trainlisttest.list[code].progress = 0;
|
||||
const rotaposx = trainlisttest.list[code].children[5].matrixWorld.elements[12];
|
||||
const rotaposz = Math.abs(trainlisttest.list[code].children[0].matrixWorld.elements[14]);
|
||||
let rotaposx = trainlisttest.list[code].children[5].matrixWorld.elements[12];
|
||||
let rotaposz = Math.abs(trainlisttest.list[code].children[0].matrixWorld.elements[14]);
|
||||
trainlisttest.list[code].rotation.y = Math.PI;
|
||||
trainlisttest.list[code].position.x = rotaposx;
|
||||
for (let tl=0; tl<6; tl++) {
|
||||
@ -514,6 +517,15 @@ export function Jl3dDriving(updatemmi,sound,translation,routegroup) {
|
||||
}
|
||||
}
|
||||
let nextcode;
|
||||
if(data.body[i].groupNumber == "013"){
|
||||
console.log("===========g013===========");
|
||||
console.log(data.body[i]);
|
||||
console.log(trainlisttest.list[data.body[i].code]);
|
||||
console.log("targetpercent:"+trainlisttest.list[data.body[i].code].targetpercent);
|
||||
console.log("linkoffsetpercent:"+trainlisttest.list[data.body[i].code].linkOffsetPercent);
|
||||
console.log("progress:"+trainlisttest.list[data.body[i].code].progress);
|
||||
console.log("==========================");
|
||||
}
|
||||
if(code == drivingcode){
|
||||
// console.log(data.body[i].targetStation);
|
||||
// console.log("netpercent");
|
||||
@ -543,7 +555,6 @@ export function Jl3dDriving(updatemmi,sound,translation,routegroup) {
|
||||
nextcode = rails.linkrail[data.body[i].linkCode].rconnect;
|
||||
if(nextcode){
|
||||
// console.log(rails.linkrail[nextcode].lineleft.points);
|
||||
nextpoints = rails.linkrail[nextcode].lineleft.points;
|
||||
trainlisttest.list[code].nextcurve = rails.linkrail[nextcode].lineleft;
|
||||
trainlisttest.list[code].nextlen = rails.linkrail[nextcode].lengthfact;
|
||||
}else{
|
||||
@ -579,6 +590,20 @@ export function Jl3dDriving(updatemmi,sound,translation,routegroup) {
|
||||
// console.log("=========================");
|
||||
|
||||
}else{
|
||||
|
||||
|
||||
|
||||
// trainlisttest.list[code].stopstation = data.body[i].targetStation;
|
||||
// // console.log(rails.stops[data.body[i].targetStation].direct2.percent);
|
||||
// trainlisttest.list[code].pc = data.body[i].targetLinkPercent/rails.stops[data.body[i].targetStation].direct2.percent;
|
||||
// trainlisttest.list[code].targetpercent = rails.stops[data.body[i].targetStation].direct2.percent;
|
||||
// trainlisttest.list[code].progress = data.body[i].linkOffsetPercent*trainlisttest.list[code].pc;
|
||||
// trainlisttest.list[code].linkOffsetPercent = data.body[i].linkOffsetPercent;
|
||||
// trainlisttest.list[code].targetLink = data.body[i].targetLink;
|
||||
|
||||
|
||||
|
||||
|
||||
let nextcode;
|
||||
if(data.body[i].directionType == '02'){
|
||||
if(rails.linkrail[data.body[i].linkCode].lineleft){
|
||||
@ -588,9 +613,11 @@ export function Jl3dDriving(updatemmi,sound,translation,routegroup) {
|
||||
trainlisttest.list[code].nextcurve = rails.linkrail[nextcode].lineleft;
|
||||
trainlisttest.list[code].nextlen = rails.linkrail[nextcode].lengthfact;
|
||||
}
|
||||
trainlisttest.list[code].nowcode = data.body[i].linkCode;
|
||||
trainlisttest.list[code].curve = rails.linkrail[data.body[i].linkCode].lineleft;
|
||||
trainlisttest.list[code].len = rails.linkrail[data.body[i].linkCode].lengthfact;
|
||||
trainlisttest.list[code].progress = data.body[i].linkOffsetPercent;
|
||||
trainlisttest.list[code].linkOffsetPercent = data.body[i].linkOffsetPercent;
|
||||
trainlisttest.list[code].speeds = parseFloat(trainlisttest.list[code].speed*10/36/25/trainlisttest.list[code].len);
|
||||
}
|
||||
}else if(data.body[i].directionType == '03'){
|
||||
@ -602,9 +629,11 @@ export function Jl3dDriving(updatemmi,sound,translation,routegroup) {
|
||||
trainlisttest.list[code].nextcurve = rails.linkrail[nextcode].lineright;
|
||||
trainlisttest.list[code].nextlen = rails.linkrail[nextcode].lengthfact;
|
||||
}
|
||||
trainlisttest.list[code].nowcode = data.body[i].linkCode;
|
||||
trainlisttest.list[code].curve = rails.linkrail[data.body[i].linkCode].lineright;
|
||||
trainlisttest.list[code].len = rails.linkrail[data.body[i].linkCode].lengthfact;
|
||||
trainlisttest.list[code].progress = 1-data.body[i].linkOffsetPercent;
|
||||
trainlisttest.list[code].linkOffsetPercent = data.body[i].linkOffsetPercent;
|
||||
trainlisttest.list[code].speeds = parseFloat(trainlisttest.list[code].speed*10/36/25/trainlisttest.list[code].len);
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ export function UpdateTrain(camera,traindata,control){
|
||||
if(traindata != undefined && traindata.group.children[0]){//traindata.group.children[0].dispose == false
|
||||
|
||||
if(traindata.group.children[0].progress != null){
|
||||
|
||||
// console.log(traindata.group);
|
||||
let trainmodel = traindata.group.children[0];
|
||||
if(trainmodel.speeds > 0 && trainmodel.speeds){
|
||||
let speed = null;
|
||||
|
@ -1,13 +1,12 @@
|
||||
import StompClient from '@/utils/sock';
|
||||
|
||||
import { getTrainingCbtcDemon, runDiagramStart, runDiagramOver, setTrainingCbtcInitTime } from '@/api/simulation';
|
||||
|
||||
import { creatSubscribe, clearSubscribe, displayTopic, screenTopic } from '@/utils/stomp';
|
||||
// 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 router from '@/router';
|
||||
|
||||
// 定于仿真socket接口
|
||||
export function Jlmap3dSubscribe(jlmap3d,routegroup) {
|
||||
export function Jlmap3dSubscribe(jlmap3d,routegroup,jsonwebwork) {
|
||||
|
||||
const scope = this;
|
||||
this.map = null;
|
||||
@ -32,38 +31,113 @@ export function Jlmap3dSubscribe(jlmap3d,routegroup) {
|
||||
|
||||
let driverswitch = false;
|
||||
|
||||
const stoptimer = null;
|
||||
const num = 30;
|
||||
const pointstand = null;
|
||||
let stoptimer = null;
|
||||
let num = 30;
|
||||
let pointstand = null;
|
||||
|
||||
let data = null;
|
||||
// run as plane = 01;
|
||||
// reset = 02;
|
||||
|
||||
var datatype = '00';
|
||||
this.teststomp = new StompClient();
|
||||
this.topic = '/user/queue/simulation/jl3d/'+routegroup;
|
||||
const header = {'X-Token': getToken() };
|
||||
let header = {'X-Token': getToken() };
|
||||
let connectmsg = {
|
||||
type:'init',
|
||||
baseurl:getBaseUrl(),
|
||||
topic:this.topic,
|
||||
token:getToken(),
|
||||
};
|
||||
jsonwebwork.postMessage(connectmsg);
|
||||
jsonwebwork.onmessage = function (event) {
|
||||
|
||||
this.updatamap = function(mapdata, materiallist, nowaction, scene) {
|
||||
// if(event.data.type == 'Simulation_Driver_Change'){
|
||||
// drivingcode = event.data.body.code;
|
||||
// jlmap3d.updatedrivingcode( event.data.body.code);
|
||||
// }
|
||||
// if(data.type == 'Simulation_TrainSpeed'){
|
||||
// trainspeed(data);
|
||||
// }
|
||||
// console.log(event);
|
||||
// if(event.data.type == 'SJL3D_TrainStatus'){
|
||||
// trainstatus(event.data);
|
||||
// }
|
||||
// if(event.data.type == 'Simulation_DeviceStatus'){
|
||||
// devicestatus(event.data);
|
||||
// }
|
||||
if(event.data._type == 'Simulation_Driver_Change'){
|
||||
drivingcode = event.data.body.code;
|
||||
jlmap3d.updatedrivingcode( event.data.body.code);
|
||||
}
|
||||
if(event.data._type == 'Train'){
|
||||
// console.log(event.data);
|
||||
trainstatus(event.data);
|
||||
}
|
||||
if (event.data._type== 'Signal' && signallist) {
|
||||
// console.log(event.data);
|
||||
signalupdate(event.data);
|
||||
}
|
||||
|
||||
if (event.data._type== 'StationStand' && actions) {
|
||||
// console.log(event.data);
|
||||
standupdate(event.data);
|
||||
}
|
||||
|
||||
if (event.data._type == 'Switch' && sectionlist) {
|
||||
// console.log(event.data);
|
||||
switchupdate(event.data);
|
||||
}
|
||||
// if(event.data._type = ''){
|
||||
// trainstatus(event.data);
|
||||
// }
|
||||
// if(event.data.type == 'Simulation_DeviceStatus'){
|
||||
// devicestatus(event.data);
|
||||
// }
|
||||
if(event.data.type == 'Simulation_Reset'){
|
||||
simulationreset(event.data);
|
||||
}
|
||||
};
|
||||
|
||||
// jsonwebwork.onmessage = function (event) {
|
||||
// console.log(event.data);
|
||||
// if(event.data.type == 'Simulation_Driver_Change'){
|
||||
// drivingcode = event.data.body.code;
|
||||
// jlmap3d.updatedrivingcode( event.data.body.code);
|
||||
// }
|
||||
// // if(event.data.type == 'Simulation_TrainSpeed'){
|
||||
// // trainspeed(event.data);
|
||||
// // }
|
||||
// if(event.data.type == 'SJL3D_TrainStatus'){
|
||||
// trainstatus(event.data);
|
||||
// }
|
||||
// if(event.data.type == 'Simulation_DeviceStatus'){
|
||||
// devicestatus(event.data);
|
||||
// }
|
||||
// if(event.data.type == 'Simulation_Reset'){
|
||||
// simulationreset(event.data);
|
||||
// }
|
||||
// };
|
||||
|
||||
this.updatamap = function(newsectionlist,newlinklist,newsignallist,newstationstandlist,newtrainlisttest,newrealsectionlist,newrails, materiallist, nowaction, scene) {
|
||||
// console.log(mapdata);
|
||||
|
||||
scope.map = mapdata;
|
||||
trainlisttest = this.map.trainlisttest;
|
||||
sectionlist = this.map.sectionlist;
|
||||
signallist = this.map.signallist;
|
||||
stationstandlist = this.map.stationstandlist;
|
||||
sectionlist = this.map.sectionlist;
|
||||
trainlisttest = newtrainlisttest;
|
||||
sectionlist = newsectionlist;
|
||||
signallist = newsignallist;
|
||||
stationstandlist = newstationstandlist;
|
||||
materials = materiallist;
|
||||
scenes = scene;
|
||||
actions = nowaction;
|
||||
links = this.map.linklist;
|
||||
rails = this.map.rails;
|
||||
links = newlinklist;
|
||||
rails = newrails;
|
||||
|
||||
};
|
||||
|
||||
this.socketon = function(topic) {
|
||||
try {
|
||||
// console.log("teststomp");
|
||||
scope.teststomp.subscribe(topic, callback, header);
|
||||
// scope.teststomp.subscribe(topic, callback, header);
|
||||
} catch (error) {
|
||||
console.error('websocket订阅失败');
|
||||
}
|
||||
@ -90,8 +164,31 @@ export function Jlmap3dSubscribe(jlmap3d,routegroup) {
|
||||
|
||||
// 仿真socket接口回调函数
|
||||
function callback(Response) {
|
||||
// 对象化数据
|
||||
const data = JSON.parse(Response.body);
|
||||
|
||||
// jsonwebwork.postMessage(Response.body);
|
||||
// // 对象化数据
|
||||
// console.log(Response.body);
|
||||
// data = JSON.parse(Response.body);
|
||||
// // console.log(data);
|
||||
// if(data.type == 'Simulation_Driver_Change'){
|
||||
// drivingcode = data.body.code;
|
||||
// jlmap3d.updatedrivingcode( data.body.code);
|
||||
// }
|
||||
// // if(data.type == 'Simulation_TrainSpeed'){
|
||||
// // trainspeed(data);
|
||||
// // }
|
||||
// if(data.type == 'SJL3D_TrainStatus'){
|
||||
// trainstatus(data);
|
||||
// }
|
||||
// if(data.type == 'Simulation_DeviceStatus'){
|
||||
// devicestatus(data);
|
||||
// }
|
||||
// if(data.type == 'Simulation_Reset'){
|
||||
// simulationreset(data);
|
||||
// }
|
||||
|
||||
// data = null;
|
||||
// console.log(data.type);
|
||||
// 遍历后台数据
|
||||
|
||||
// 判断消息类型
|
||||
@ -100,178 +197,146 @@ export function Jlmap3dSubscribe(jlmap3d,routegroup) {
|
||||
//
|
||||
// }
|
||||
|
||||
if (data.type == 'Simulation_Driver_Change') {
|
||||
drivingcode = data.body.code;
|
||||
jlmap3d.updatedrivingcode( data.body.code);
|
||||
}
|
||||
// switch (data.type) {
|
||||
// case 'Simulation_Driver_Change':
|
||||
// drivingcode = data.body.code;
|
||||
// jlmap3d.updatedrivingcode( data.body.code);
|
||||
// break;
|
||||
// case 'Simulation_TrainSpeed':
|
||||
// trainspeed(data);
|
||||
// break;
|
||||
// case 'SJL3D_TrainStatus':
|
||||
// trainstatus(data);
|
||||
// break;
|
||||
// case 'Simulation_DeviceStatus':
|
||||
// devicestatus(data);
|
||||
// break;
|
||||
// case 'Simulation_Reset':
|
||||
// simulationreset(data);
|
||||
// default :
|
||||
// //TODO
|
||||
// }
|
||||
}
|
||||
|
||||
if (data.type == 'Simulation_TrainSpeed') {
|
||||
function trainspeed(data){
|
||||
if (trainlisttest) {
|
||||
|
||||
if (trainlisttest) {
|
||||
|
||||
for (let tl = 0; tl<data.body.length; tl++) {
|
||||
code = data.body[tl].id;
|
||||
for (let tl = 0; tl<data.body.length; tl++) {
|
||||
code = data.body[tl].id;
|
||||
if(trainlisttest.list[code].speed != data.body[tl].v){
|
||||
trainlisttest.list[code].speed = data.body[tl].v;
|
||||
if (trainlisttest.list[code].runMode == '02') {
|
||||
if (trainlisttest.list[code].isStandTrack == true) {
|
||||
trainlisttest.list[code].speeds = parseFloat(data.body[tl].v*10/36/20/trainlisttest.list[code].len);
|
||||
} else {
|
||||
trainlisttest.list[code].speeds = parseFloat(data.body[tl].v*10/36/20/trainlisttest.list[code].len);
|
||||
}
|
||||
} else {
|
||||
|
||||
trainlisttest.list[code].speeds = parseFloat(data.body[tl].v*10/36/20/trainlisttest.list[code].len);
|
||||
}
|
||||
|
||||
if (code == drivingcode) {
|
||||
jlmap3d.updatenowspeed(data.body[tl].v);
|
||||
if (data.body[tl].atpv) {
|
||||
jlmap3d.updateatpspeed(data.body[tl].atpv);
|
||||
|
||||
} else {
|
||||
jlmap3d.updateatpspeed(-1);
|
||||
}
|
||||
if (data.body[tl].atov) {
|
||||
jlmap3d.updateatospeed(data.body[tl].atov);
|
||||
} else {
|
||||
jlmap3d.updateatospeed(-1);
|
||||
}
|
||||
}
|
||||
trainlisttest.list[code].speeds = parseFloat(data.body[tl].v*10/36/20/trainlisttest.list[code].len);
|
||||
// if (trainlisttest.list[code].runMode == '02') {
|
||||
// if (trainlisttest.list[code].isStandTrack == true) {
|
||||
// trainlisttest.list[code].speeds = parseFloat(data.body[tl].v*10/36/20/trainlisttest.list[code].len);
|
||||
// } else {
|
||||
// trainlisttest.list[code].speeds = parseFloat(data.body[tl].v*10/36/20/trainlisttest.list[code].len);
|
||||
// }
|
||||
// } else {
|
||||
//
|
||||
// trainlisttest.list[code].speeds = parseFloat(data.body[tl].v*10/36/20/trainlisttest.list[code].len);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (data.type == 'SJL3D_TrainStatus') {
|
||||
for (let i=data.body.length-1; i>=0; i--) {
|
||||
if (data.body[i]._type == 'Train') {
|
||||
function trainstatus(data){
|
||||
// for (let i=data.body.length-1; i>=0; i--) {
|
||||
// console.log(data.body[i]);
|
||||
|
||||
// console.log(data.body[i]);
|
||||
// 遍历列车对象组
|
||||
if (trainlisttest) {
|
||||
code = data.body[i].code;
|
||||
// 剔除不显示的车
|
||||
// 找到对应列车
|
||||
// console.log(data.body[i]);
|
||||
// 遍历列车对象组
|
||||
if (trainlisttest) {
|
||||
code = data.code;
|
||||
// 剔除不显示的车
|
||||
// 找到对应列车
|
||||
|
||||
if ( trainlisttest.list[code]) {
|
||||
if (code == drivingcode) {
|
||||
driverswitch = data.body[i].runMode;
|
||||
//更新车组号
|
||||
jlmap3d.updatetrainnum(data.body[i].groupNumber);
|
||||
//更新列车
|
||||
let syncdata = {
|
||||
type: 'Train',
|
||||
code: code,
|
||||
sectionCode: data.body[i].sectionCode,
|
||||
percent: 0
|
||||
};
|
||||
|
||||
// if (trainlisttest.list[code].isStandTrack == true && trainlisttest.list[code].progress>0.95 && trainlisttest.list[code].speed<=0) {
|
||||
// if (data.body[i].directionType == '02') {
|
||||
// syncdata.percent = 1-(sectionlist.sections.datalist[data.body[i].sectionCode].rstop/trainlisttest.list[code].len);
|
||||
// } else {
|
||||
// syncdata.percent = sectionlist.sections.datalist[data.body[i].sectionCode].lstop/trainlisttest.list[code].len;
|
||||
// }
|
||||
// scope.teststomp.send('/app/topic/simulation/client/drive', syncdata);
|
||||
// } else {
|
||||
// if (data.body[i].directionType == '02') {
|
||||
// syncdata.percent = trainlisttest.list[code].progress;
|
||||
// } else {
|
||||
// syncdata.percent = 1 - trainlisttest.list[code].progress;
|
||||
// }
|
||||
// scope.teststomp.send('/app/topic/simulation/client/drive', syncdata);
|
||||
// }
|
||||
if ( trainlisttest.list[code]) {
|
||||
|
||||
if (data.body[i].parkRemainTime>0) {
|
||||
jlmap3d.updatestoptime('停站时间:'+parseInt(data.body[i].parkRemainTime));
|
||||
} else {
|
||||
if (data.body[i].runMode == '02') {
|
||||
jlmap3d.updatestoptime('列车自动驾驶中');
|
||||
} else {
|
||||
// if (trainlisttest.list[code].isStandTrack == true && trainlisttest.list[code].progress>0.95 && trainlisttest.list[code].speed<=0) {
|
||||
// // if(stoptimer){
|
||||
// //
|
||||
// // }else{
|
||||
// // stoptimer = setInterval(function(){
|
||||
// // if(num >=0){
|
||||
// // jlmap3d.updatestoptime("停站时间:"+num);
|
||||
// // num --;
|
||||
// // }
|
||||
// // },1000);
|
||||
// // }
|
||||
//
|
||||
// } else {
|
||||
// jlmap3d.updatestoptime('列车人工驾驶中');
|
||||
// }
|
||||
trainlisttest.list[code].runMode = data.runMode;
|
||||
// 车门开关验证
|
||||
// if(data.directionType == "02"){
|
||||
if (trainlisttest.list[code].doorStatus != data.doorStatus && data.doorStatus == '01') {
|
||||
// console.log("close");
|
||||
trainlisttest.list[code].doorStatus = '01';
|
||||
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();
|
||||
}
|
||||
} else if (trainlisttest.list[code].doorStatus != data.doorStatus && data.doorStatus == '02') {
|
||||
// console.log("open");
|
||||
trainlisttest.list[code].doorStatus = '02';
|
||||
for (let an=actions[code].top.length-1; an>=0; an--) {
|
||||
actions[code].top[an].reset();
|
||||
actions[code].top[an].time = 0;
|
||||
actions[code].top[an].timeScale = 1;
|
||||
actions[code].top[an].play();
|
||||
}
|
||||
}
|
||||
// }else{
|
||||
// if(trainlisttest.list[code].doorStatus != data.doorStatus && data.doorStatus == "01"){
|
||||
// //console.log("close");
|
||||
// trainlisttest.list[code].doorStatus = "01";
|
||||
// for(let an=actions[code].down.length-1;an>=0;an--){
|
||||
// actions[code].down[an].reset();
|
||||
// actions[code].down[an].time = actions[code].top[an]._clip.duration;
|
||||
// actions[code].down[an].timeScale = -1;
|
||||
// actions[code].down[an].play();
|
||||
// }
|
||||
// }else if(trainlisttest.list[code].doorStatus != data.doorStatus && data.doorStatus == "02"){
|
||||
// //console.log("open");
|
||||
// trainlisttest.list[code].doorStatus = "02";
|
||||
// for(let an=actions[code].down.length-1;an>=0;an--){
|
||||
// actions[code].down[an].reset();
|
||||
// actions[code].down[an].time = 0;
|
||||
// actions[code].down[an].timeScale = 1;
|
||||
// actions[code].down[an].play();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// 遍历获取所在轨道
|
||||
if (trainlisttest.list[code].dispose != data.dispose && data.dispose == false) {
|
||||
|
||||
if (rails.linkrail[data.linkCode]) {
|
||||
trainlisttest.group.add(trainlisttest.list[code]);
|
||||
trainlisttest.list[code].position.y = 0;
|
||||
// trainlisttest.list[code].progress = 0;
|
||||
trainlisttest.list[code].dispose = false;
|
||||
trainlisttest.list[code].nowcode = data.linkCode;
|
||||
trainlisttest.list[code].nextcode = null;
|
||||
trainlisttest.list[code].pc = 1;
|
||||
trainlisttest.list[code].statsstop = 0;
|
||||
if(trainlisttest.list[code].mixerpush == false){
|
||||
for(let mi=0,lenmi=trainlisttest.list[code].mixer.length;mi<lenmi;mi++){
|
||||
jlmap3d.mixers.push(trainlisttest.list[code].mixer[mi]);
|
||||
}
|
||||
trainlisttest.list[code].mixerpush = true;
|
||||
// console.log(trainlisttest.list[code].mixerpush);
|
||||
}
|
||||
// if(trainlisttest.list[code].speed > 0){
|
||||
// if(stoptimer){
|
||||
// clearInterval( stoptimer );
|
||||
// stoptimer = null;
|
||||
// num = 30;
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
trainlisttest.list[code].runMode = data.body[i].runMode;
|
||||
// 车门开关验证
|
||||
// if(data.body[i].directionType == "02"){
|
||||
if (trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == '01') {
|
||||
// console.log("close");
|
||||
trainlisttest.list[code].doorStatus = '01';
|
||||
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();
|
||||
}
|
||||
} else if (trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == '02') {
|
||||
// console.log("open");
|
||||
trainlisttest.list[code].doorStatus = '02';
|
||||
for (let an=actions[code].top.length-1; an>=0; an--) {
|
||||
actions[code].top[an].reset();
|
||||
actions[code].top[an].time = 0;
|
||||
actions[code].top[an].timeScale = 1;
|
||||
actions[code].top[an].play();
|
||||
}
|
||||
}
|
||||
// }else{
|
||||
// if(trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == "01"){
|
||||
// //console.log("close");
|
||||
// trainlisttest.list[code].doorStatus = "01";
|
||||
// for(let an=actions[code].down.length-1;an>=0;an--){
|
||||
// actions[code].down[an].reset();
|
||||
// actions[code].down[an].time = actions[code].top[an]._clip.duration;
|
||||
// actions[code].down[an].timeScale = -1;
|
||||
// actions[code].down[an].play();
|
||||
// }
|
||||
// }else if(trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == "02"){
|
||||
// //console.log("open");
|
||||
// trainlisttest.list[code].doorStatus = "02";
|
||||
// for(let an=actions[code].down.length-1;an>=0;an--){
|
||||
// actions[code].down[an].reset();
|
||||
// actions[code].down[an].time = 0;
|
||||
// actions[code].down[an].timeScale = 1;
|
||||
// actions[code].down[an].play();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// 遍历获取所在轨道
|
||||
if (trainlisttest.list[code].dispose != data.body[i].dispose && data.body[i].dispose == false) {
|
||||
|
||||
if (rails.linkrail[data.body[i].linkCode]) {
|
||||
trainlisttest.group.add(trainlisttest.list[code]);
|
||||
trainlisttest.list[code].position.y = 0;
|
||||
trainlisttest.list[code].progress = 0;
|
||||
trainlisttest.list[code].oldoffset = data.body[i].linkOffsetPercent;
|
||||
trainlisttest.list[code].dispose = false;
|
||||
trainlisttest.list[code].nowcode = data.body[i].linkCode;
|
||||
trainlisttest.list[code].nextcode = rails.linkrail[data.body[i].linkCode].next;
|
||||
let vexlist = [];
|
||||
if (data.directionType == '02') { // 向右
|
||||
|
||||
if (data.body[i].directionType == '02') { // 向右
|
||||
let point = rails.linkrail[data.body[i].linkCode].lineleft.getPointAt(data.body[i].linkOffsetPercent);
|
||||
|
||||
if(data.targetStation){
|
||||
trainlisttest.list[code].stopstation = data.targetStation;
|
||||
// console.log(rails.stops[data.targetStation].direct2.percent);
|
||||
trainlisttest.list[code].pc = data.targetLinkPercent/rails.stops[data.targetStation].direct2.percent;
|
||||
trainlisttest.list[code].targetpercent = rails.stops[data.targetStation].direct2.percent;
|
||||
trainlisttest.list[code].progress = data.linkOffsetPercent/trainlisttest.list[code].pc;
|
||||
trainlisttest.list[code].linkOffsetPercent = data.linkOffsetPercent;
|
||||
trainlisttest.list[code].targetLink = data.targetLink;
|
||||
// console.log(data.targetLinkPercent);
|
||||
// console.log(rails.stops[data.targetStation].direct2.percent);
|
||||
// console.log(trainlisttest.list[code].progress);
|
||||
// console.log("===================");
|
||||
let point = rails.linkrail[data.linkCode].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;
|
||||
@ -279,193 +344,210 @@ export function Jlmap3dSubscribe(jlmap3d,routegroup) {
|
||||
trainlisttest.list[code].children[tl].position.z = point.z;
|
||||
}
|
||||
|
||||
trainlisttest.list[code].status = '02';
|
||||
trainlisttest.list[code].progress = data.body[i].linkOffsetPercent;
|
||||
trainlisttest.list[code].curve = rails.linkrail[data.body[i].linkCode].lineleft;
|
||||
} else if (data.body[i].directionType == '03') { // 向左
|
||||
let point = rails.linkrail[data.body[i].linkCode].lineright.getPointAt((1-data.body[i].linkOffsetPercent));
|
||||
}
|
||||
|
||||
trainlisttest.list[code].curve = rails.linkrail[data.linkCode].lineleft;
|
||||
trainlisttest.list[code].len = rails.linkrail[data.linkCode].lengthfact;
|
||||
trainlisttest.list[code].status = '02';
|
||||
} else if (data.directionType == '03') { // 向左
|
||||
|
||||
// if(trainlisttest.list[code].rname == "006"){
|
||||
// console.log("0000000000000000");
|
||||
// console.log(data.linkOffsetPercent);
|
||||
// }
|
||||
if(data.targetStation){
|
||||
|
||||
trainlisttest.list[code].stopstation = data.targetStation;
|
||||
trainlisttest.list[code].pc = data.targetLinkPercent/rails.stops[data.targetStation].direct1.percent;
|
||||
trainlisttest.list[code].targetpercent = rails.stops[data.targetStation].direct1.percent;
|
||||
trainlisttest.list[code].progress = 1-(data.linkOffsetPercent/trainlisttest.list[code].pc);
|
||||
trainlisttest.list[code].linkOffsetPercent = data.linkOffsetPercent;
|
||||
trainlisttest.list[code].targetLink = data.targetLink;
|
||||
// console.log(data.targetLinkPercent);
|
||||
// console.log(rails.stops[data.targetStation].direct1.percent);
|
||||
// console.log(trainlisttest.list[code].progress);
|
||||
// console.log("===================");
|
||||
let point = rails.linkrail[data.linkCode].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 = -point.z;
|
||||
}
|
||||
// if(trainlisttest.list[code].rname == "006"){
|
||||
// console.log("0000000000000000");
|
||||
// console.log(data.body[i].linkOffsetPercent);
|
||||
// }
|
||||
|
||||
trainlisttest.list[code].status = '03';
|
||||
trainlisttest.list[code].progress = 1-data.body[i].linkOffsetPercent;
|
||||
trainlisttest.list[code].curve = rails.linkrail[data.body[i].linkCode].lineright;
|
||||
}
|
||||
|
||||
trainlisttest.list[code].curve = rails.linkrail[data.linkCode].lineright;
|
||||
trainlisttest.list[code].len = rails.linkrail[data.linkCode].lengthfact;
|
||||
trainlisttest.list[code].status = '03';
|
||||
|
||||
trainlisttest.list[code].len = rails.linkrail[data.body[i].linkCode].lengthfact;
|
||||
// trainlisttest.list[code].isStandTrack = sectionlist.sections.datalist[data.body[i].sectionCode].isStandTrack;
|
||||
|
||||
// trainlisttest.list[code].len = sectionlist.sections.datalist[data.body[i].sectionCode].distance;
|
||||
|
||||
|
||||
if(data.body[i].speed == 0){
|
||||
trainlisttest.list[code].speeds = data.body[i].speed;
|
||||
trainlisttest.list[code].speeds = 0;
|
||||
// trainlisttest.list[code].startmark = 1;
|
||||
}else{
|
||||
trainlisttest.list[code].speeds = data.body[i].speed;
|
||||
trainlisttest.list[code].speeds = parseFloat(data.body[i].speed*10/36/20/trainlisttest.list[code].len);
|
||||
}
|
||||
|
||||
// trainlisttest.list[code].curve = rails.linkrail[data.linkCode].lineright;
|
||||
}
|
||||
} else if (trainlisttest.list[code].dispose != data.body[i].dispose && data.body[i].dispose == true) {
|
||||
trainlisttest.group.remove(trainlisttest.list[code]);
|
||||
trainlisttest.list[code].progress = null;
|
||||
trainlisttest.list[code].dispose = true;
|
||||
code = trainlisttest.group.children[i].name;
|
||||
|
||||
|
||||
trainlisttest.list[code].len = rails.linkrail[data.linkCode].lengthfact;
|
||||
// trainlisttest.list[code].isStandTrack = sectionlist.sections.datalist[data.sectionCode].isStandTrack;
|
||||
|
||||
// trainlisttest.list[code].len = sectionlist.sections.datalist[data.sectionCode].distance;
|
||||
|
||||
|
||||
if(data.speed == 0){
|
||||
trainlisttest.list[code].speeds = data.speed;
|
||||
trainlisttest.list[code].speeds = 0;
|
||||
// trainlisttest.list[code].startmark = 1;
|
||||
}else{
|
||||
trainlisttest.list[code].speeds = data.speed;
|
||||
trainlisttest.list[code].speeds = parseFloat(data.speed*10/36/20/trainlisttest.list[code].len);
|
||||
}
|
||||
|
||||
}
|
||||
} else if (trainlisttest.list[code].dispose != data.dispose && data.dispose == true) {
|
||||
trainlisttest.group.remove(trainlisttest.list[code]);
|
||||
trainlisttest.list[code].progress = null;
|
||||
trainlisttest.list[code].dispose = true;
|
||||
code = trainlisttest.group.children[i].name;
|
||||
trainlisttest.list[code].rotation.y = 0;
|
||||
trainlisttest.list[code].doorStatus = '01';
|
||||
trainlisttest.list[code].speed = 0;
|
||||
trainlisttest.list[code].position.x = -50000;
|
||||
trainlisttest.list[code].position.y = -50000;
|
||||
trainlisttest.list[code].pc = 1;
|
||||
|
||||
} else if (trainlisttest.list[code].dispose == data.dispose && data.dispose == false) {
|
||||
|
||||
// if(data.){
|
||||
//
|
||||
// }
|
||||
if (data.directionType == '02' && trainlisttest.list[code].status != data.directionType) { // 向右
|
||||
|
||||
|
||||
let rotaposx = trainlisttest.list[code].children[5].matrixWorld.elements[12];
|
||||
let rotaposz = trainlisttest.list[code].children[0].matrixWorld.elements[14];
|
||||
trainlisttest.list[code].rotation.y = 0;
|
||||
trainlisttest.list[code].doorStatus = '01';
|
||||
trainlisttest.list[code].speed = 0;
|
||||
trainlisttest.list[code].position.x = -50000;
|
||||
trainlisttest.list[code].position.y = -50000;
|
||||
trainlisttest.list[code].position.x = rotaposx;
|
||||
for (let tl=0; tl<6; tl++) {
|
||||
trainlisttest.list[code].children[tl].position.z = rotaposz;
|
||||
}
|
||||
|
||||
} else if (trainlisttest.list[code].dispose == data.body[i].dispose && data.body[i].dispose == false) {
|
||||
trainlisttest.list[code].progress = (rotaposx-rails.linkrail[data.linkCode].lp.x)/rails.linkrail[data.linkCode].lengthfact;
|
||||
trainlisttest.list[code].status = '02';
|
||||
trainlisttest.list[code].curve = rails.linkrail[data.linkCode].lineleft;
|
||||
trainlisttest.list[code].nextcurve = null;
|
||||
|
||||
if (rails.linkrail[data.body[i].linkCode]) {
|
||||
if (driverswitch == '02' && code == drivingcode) {
|
||||
jlmap3d.updatenowspeed(data.body[i].speed);
|
||||
if (data.body[i].atpSpeed) {
|
||||
jlmap3d.updateatpspeed(data.body[i].atpSpeed);
|
||||
} else {
|
||||
jlmap3d.updateatpspeed(-1);
|
||||
}
|
||||
if (data.body[i].targetSpeed) {
|
||||
jlmap3d.updateatospeed(data.body[i].targetSpeed);
|
||||
} else {
|
||||
jlmap3d.updateatospeed(-1);
|
||||
}
|
||||
if (data.body[i].maLen) {
|
||||
jlmap3d.updatenowlen(data.body[i].maLen);
|
||||
} else {
|
||||
jlmap3d.updatenowlen(0);
|
||||
}
|
||||
// if(trainlisttest.list[code].isStandTrack == true){
|
||||
// pointstand = null;
|
||||
// if(data.body[i].directionType == "02"){
|
||||
// pointstand = trainlisttest.list[code].curve.getPointAt(data.body[i].sectionOffsetPercent);
|
||||
// }else{
|
||||
// pointstand = trainlisttest.list[code].curve.getPointAt(1-data.body[i].sectionOffsetPercent);
|
||||
// }
|
||||
// console.log(data.body[i].sectionOffsetPercent)
|
||||
// console.log(pointstand.x);
|
||||
//
|
||||
// trainlisttest.list[code].position.x = pointstand.x;
|
||||
// }
|
||||
}
|
||||
if (driverswitch == '05' && code == drivingcode) {
|
||||
if (data.body[i].maLen) {
|
||||
jlmap3d.updatenowlen(data.body[i].maLen);
|
||||
} else {
|
||||
jlmap3d.updatenowlen(0);
|
||||
}
|
||||
}
|
||||
if(trainlisttest.list[code].nowcode != data.body[i].linkCode){
|
||||
trainlisttest.list[code].nowcode = data.body[i].linkCode;
|
||||
trainlisttest.list[code].nextcode = rails.linkrail[data.body[i].linkCode].next;
|
||||
if (data.body[i].directionType == '02') { // 向右
|
||||
trainlisttest.list[code].progress = 0;
|
||||
if (trainlisttest.list[code].status != data.body[i].directionType) {
|
||||
const rotaposx = trainlisttest.list[code].children[5].matrixWorld.elements[12];
|
||||
const rotaposz = trainlisttest.list[code].children[0].matrixWorld.elements[14];
|
||||
trainlisttest.list[code].rotation.y = 0;
|
||||
trainlisttest.list[code].position.x = rotaposx;
|
||||
for (let tl=0; tl<6; tl++) {
|
||||
trainlisttest.list[code].children[tl].position.z = rotaposz;
|
||||
}
|
||||
trainlisttest.list[code].len = rails.linkrail[data.linkCode].lengthfact;
|
||||
|
||||
trainlisttest.list[code].progress = (rotaposx-rails.linkrail[data.body[i].linkCode].lp.x)/rails.linkrail[data.body[i].linkCode].lengthfact;
|
||||
}
|
||||
trainlisttest.list[code].status = '02';
|
||||
trainlisttest.list[code].curve = rails.linkrail[data.body[i].linkCode].lineleft;
|
||||
} else if (data.body[i].directionType == '03') { // 向左
|
||||
trainlisttest.list[code].progress = 0;
|
||||
if (trainlisttest.list[code].status != data.body[i].directionType) {
|
||||
const rotaposx = trainlisttest.list[code].children[5].matrixWorld.elements[12];
|
||||
const rotaposz = Math.abs(trainlisttest.list[code].children[0].matrixWorld.elements[14]);
|
||||
trainlisttest.list[code].rotation.y = Math.PI;
|
||||
trainlisttest.list[code].position.x = rotaposx;
|
||||
for (let tl=0; tl<6; tl++) {
|
||||
trainlisttest.list[code].children[tl].position.z = -rotaposz;
|
||||
}
|
||||
trainlisttest.list[code].progress = 1-(rotaposx-rails.linkrail[data.body[i].linkCode].lp.x)/rails.linkrail[data.body[i].linkCode].lengthfact;
|
||||
}
|
||||
} else if (data.directionType == '03'&& trainlisttest.list[code].status != data.directionType) { // 向左
|
||||
|
||||
trainlisttest.list[code].status = '03';
|
||||
trainlisttest.list[code].curve = rails.linkrail[data.body[i].linkCode].lineright;
|
||||
let rotaposx = trainlisttest.list[code].children[5].matrixWorld.elements[12];
|
||||
let rotaposz = Math.abs(trainlisttest.list[code].children[0].matrixWorld.elements[14]);
|
||||
trainlisttest.list[code].rotation.y = Math.PI;
|
||||
trainlisttest.list[code].position.x = rotaposx;
|
||||
for (let tl=0; tl<6; tl++) {
|
||||
trainlisttest.list[code].children[tl].position.z = -rotaposz;
|
||||
}
|
||||
trainlisttest.list[code].progress = 1-(rotaposx-rails.linkrail[data.linkCode].lp.x)/rails.linkrail[data.linkCode].lengthfact;
|
||||
trainlisttest.list[code].status = '03';
|
||||
trainlisttest.list[code].curve = rails.linkrail[data.linkCode].lineright;
|
||||
trainlisttest.list[code].nextcurve = null;
|
||||
|
||||
trainlisttest.list[code].len = rails.linkrail[data.linkCode].lengthfact;
|
||||
|
||||
}
|
||||
|
||||
|
||||
if(trainlisttest.list[code].nextcode == null && trainlisttest.list[code].stopstation == data.targetStation){
|
||||
// if(data.groupNumber == "013"){
|
||||
// console.log(trainlisttest.list[code].nextcode);
|
||||
// console.log(trainlisttest.list[code].stopstation);
|
||||
// console.log(data.targetStation);
|
||||
// console.log(data.body[i]);
|
||||
// console.log(trainlisttest.list[code]);
|
||||
// }
|
||||
if(trainlisttest.list[code].targetLink != trainlisttest.list[code].nowlink){
|
||||
let nextcode;
|
||||
if(data.directionType == '02'){
|
||||
|
||||
trainlisttest.list[code].status = '02';
|
||||
// console.log(rails.linkrail[trainlisttest.list[code].nowcode]);
|
||||
|
||||
if(rails.linkrail[trainlisttest.list[code].nowcode]){
|
||||
nextcode = rails.linkrail[trainlisttest.list[code].nowcode].rconnect;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// console.log(rails.linkrail[data.body[i].linkCode]);
|
||||
// console.log(data.body[i].linkCode)
|
||||
// console.log(nextcode);
|
||||
|
||||
|
||||
trainlisttest.list[code].len = rails.linkrail[data.body[i].linkCode].lengthfact;
|
||||
}
|
||||
|
||||
|
||||
if(data.body[i].directionType == '02'){
|
||||
let nextcode = rails.linkrail[data.body[i].linkCode].rconnect;
|
||||
if(nextcode){
|
||||
trainlisttest.list[code].nextcurve = rails.linkrail[nextcode].lineright;
|
||||
}
|
||||
|
||||
}else if(data.body[i].directionType == '03'){
|
||||
let nextcode = rails.linkrail[data.body[i].linkCode].lconnect;
|
||||
if(nextcode){
|
||||
trainlisttest.list[code].nextcurve = rails.linkrail[nextcode].lineleft;
|
||||
}
|
||||
trainlisttest.list[code].nextlen = rails.linkrail[nextcode].lengthfact;
|
||||
}else{
|
||||
|
||||
}
|
||||
trainlisttest.list[code].nextlen = 0;
|
||||
}
|
||||
}else if(data.directionType == '03'){
|
||||
|
||||
trainlisttest.list[code].status = '03';
|
||||
if(rails.linkrail[trainlisttest.list[code].nowcode]){
|
||||
nextcode = rails.linkrail[trainlisttest.list[code].nowcode].lconnect;
|
||||
}
|
||||
if(nextcode){
|
||||
trainlisttest.list[code].nextcurve = rails.linkrail[nextcode].lineright;
|
||||
trainlisttest.list[code].nextlen = rails.linkrail[nextcode].lengthfact;
|
||||
}else{
|
||||
|
||||
trainlisttest.list[code].nextlen = 0;
|
||||
}
|
||||
}
|
||||
trainlisttest.list[code].nextcode = nextcode;
|
||||
|
||||
}
|
||||
|
||||
if(trainlisttest.list[code].curve == null){
|
||||
trainlisttest.list[code].len = trainlisttest.list[code].nextlen;
|
||||
trainlisttest.list[code].nowcode = trainlisttest.list[code].nextcode;
|
||||
trainlisttest.list[code].curve = trainlisttest.list[code].nextcurve;
|
||||
trainlisttest.list[code].nextcurve = null;
|
||||
trainlisttest.list[code].nextlen = null;
|
||||
trainlisttest.list[code].nextcode = null;
|
||||
}
|
||||
}
|
||||
|
||||
if(trainlisttest.list[code].stopstation != data.targetStation){
|
||||
|
||||
if(data.directionType == '02'){
|
||||
if(data.targetStation){
|
||||
trainlisttest.list[code].pc = data.targetLinkPercent/rails.stops[data.targetStation].direct2.percent;
|
||||
trainlisttest.list[code].targetpercent = rails.stops[data.targetStation].direct2.percent;
|
||||
trainlisttest.list[code].linkOffsetPercent = data.linkOffsetPercent;
|
||||
trainlisttest.list[code].targetLink = data.targetLink;
|
||||
}
|
||||
|
||||
|
||||
trainlisttest.list[code].status = '02';
|
||||
}else if(data.directionType == '03'){
|
||||
if(data.targetStation){
|
||||
trainlisttest.list[code].pc = data.targetLinkPercent/rails.stops[data.targetStation].direct1.percent;
|
||||
trainlisttest.list[code].targetpercent = rails.stops[data.targetStation].direct1.percent;
|
||||
trainlisttest.list[code].linkOffsetPercent = data.linkOffsetPercent;
|
||||
trainlisttest.list[code].targetLink = data.targetLink;
|
||||
}
|
||||
|
||||
trainlisttest.list[code].status = '03';
|
||||
|
||||
}
|
||||
trainlisttest.list[code].statsstop = 0;
|
||||
trainlisttest.list[code].stopstation = data.targetStation;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (data.type == 'Simulation_DeviceStatus') {
|
||||
// console.log(data.body);
|
||||
for (let i= 0,leni = data.body.length; i<leni; i++) {
|
||||
// 0xFFFFFF
|
||||
// 0xCD0000 红
|
||||
// 0xEEEE00 黄
|
||||
// 0x32CD32 绿
|
||||
|
||||
if (data.body[i]._type == 'Signal' && signallist) {
|
||||
if (signallist) {
|
||||
// console.log(data.body[i]);
|
||||
signalupdate(data.body[i]);
|
||||
// console.log(data.body[i]);
|
||||
if(trainlisttest.list[code].speed != data.speed){
|
||||
trainlisttest.list[code].speed = data.speed;
|
||||
trainlisttest.list[code].speeds = parseFloat(data.speed*10/36/20/trainlisttest.list[code].len);
|
||||
}
|
||||
}
|
||||
|
||||
if (data.body[i]._type == 'StationStand' && actions) {
|
||||
if (actions) {
|
||||
standupdate(data.body[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (data.body[i]._type == 'Switch' && sectionlist) {
|
||||
if (sectionlist) {
|
||||
switchupdate(data.body[i]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
function standupdate(data) {
|
||||
code = data.code;
|
||||
if ( actions[code]) {
|
||||
@ -493,7 +575,34 @@ export function Jlmap3dSubscribe(jlmap3d,routegroup) {
|
||||
}
|
||||
|
||||
}
|
||||
function devicestatus(data){
|
||||
for (let i= 0,leni = data.body.length; i<leni; i++) {
|
||||
// 0xFFFFFF
|
||||
// 0xCD0000 红
|
||||
// 0xEEEE00 黄
|
||||
// 0x32CD32 绿
|
||||
|
||||
if (data._type == 'Signal' && signallist) {
|
||||
if (signallist) {
|
||||
// console.log(data.body[i]);
|
||||
signalupdate(data.body[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (data._type == 'StationStand' && actions) {
|
||||
if (actions) {
|
||||
standupdate(data.body[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (data._type == 'Switch' && sectionlist) {
|
||||
if (sectionlist) {
|
||||
switchupdate(data.body[i]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
function signalupdate(data) {
|
||||
code = data.code;
|
||||
// console.log(data);
|
||||
@ -651,5 +760,18 @@ export function Jlmap3dSubscribe(jlmap3d,routegroup) {
|
||||
}
|
||||
}
|
||||
}
|
||||
function simulationreset(data){
|
||||
for(let i=0;i<trainlisttest.group.children.length;i++){
|
||||
trainlisttest.group.children[i].dispose = true;
|
||||
trainlisttest.group.children[i].stopstation = null;
|
||||
trainlisttest.group.children[i].pc = null;
|
||||
trainlisttest.group.children[i].targetpercent = null;
|
||||
trainlisttest.group.children[i].progress = null;
|
||||
trainlisttest.group.children[i].linkOffsetPercent = null;
|
||||
trainlisttest.group.children[i].targetLink = null;
|
||||
trainlisttest.group.remove(trainlisttest.group.children[i]);
|
||||
i--;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -6,439 +6,440 @@ import router from '@/router';
|
||||
// 定于仿真socket接口
|
||||
export function Jlmap3dSubscribe(worker,routegroup) {
|
||||
|
||||
const scope = this;
|
||||
this.map = null;
|
||||
|
||||
const webworker = worker;
|
||||
var trainlisttest = null;
|
||||
var sectionlist = null;
|
||||
var signallist = null;
|
||||
var stationstandlist = null;
|
||||
var sectionlist = null;
|
||||
var materials = null;
|
||||
var actions = null;
|
||||
var scenes = null;
|
||||
|
||||
var code = null;
|
||||
|
||||
this.teststomp = new StompClient();
|
||||
this.topic = displayTopic;
|
||||
const header = { group: router.currentRoute.query.group, 'X-Token': getToken() };
|
||||
|
||||
this.updatamap = function (mapdata, materiallist, nowaction, scene) {
|
||||
// console.log(mapdata);
|
||||
scope.map = mapdata;
|
||||
trainlisttest = this.map.trainlisttest;
|
||||
sectionlist = this.map.sectionlist;
|
||||
signallist = this.map.signallist;
|
||||
stationstandlist = this.map.stationstandlist;
|
||||
sectionlist = this.map.sectionlist;
|
||||
materials = materiallist;
|
||||
scenes = scene;
|
||||
actions = nowaction;
|
||||
};
|
||||
|
||||
this.socketon = function (topic) {
|
||||
try {
|
||||
// console.log("teststomp");
|
||||
scope.teststomp.subscribe(topic, callback, header);
|
||||
} catch (error) {
|
||||
console.error('websocket订阅失败');
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
this.socketoff = function (topic) {
|
||||
scope.teststomp.unsubscribe(topic);
|
||||
};
|
||||
|
||||
// 仿真socket接口回调函数
|
||||
function callback(Response) {
|
||||
// 对象化数据
|
||||
const data = JSON.parse(Response.body);
|
||||
// 遍历后台数据
|
||||
|
||||
// 判断消息类型
|
||||
// if(data.type == "Simulation_TrainPosition"){
|
||||
//
|
||||
//
|
||||
// }
|
||||
if (data.type == 'Simulation_DeviceStatus') {
|
||||
|
||||
if (data.body.length < 200) {
|
||||
|
||||
for (let i = data.body.length - 1; i >= 0; i--) {
|
||||
|
||||
if (data.body[i]._type == 'Train') {
|
||||
|
||||
// console.log(data.body[i]);
|
||||
// 遍历列车对象组
|
||||
// console.log(data.body[i]);
|
||||
if (trainlisttest) {
|
||||
code = data.body[i].code;
|
||||
// 剔除不显示的车
|
||||
// 找到对应列车
|
||||
|
||||
if (trainlisttest.list[code]) {
|
||||
// 车门开关验证
|
||||
// if(data.body[i].directionType == "02"){
|
||||
if (trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == '01') {
|
||||
// console.log("close");
|
||||
trainlisttest.list[code].doorStatus = '01';
|
||||
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();
|
||||
}
|
||||
} else if (trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == '02') {
|
||||
// console.log("open");
|
||||
trainlisttest.list[code].doorStatus = '02';
|
||||
for (let an = actions[code].top.length - 1; an >= 0; an--) {
|
||||
actions[code].top[an].reset();
|
||||
actions[code].top[an].time = 0;
|
||||
actions[code].top[an].timeScale = 1;
|
||||
actions[code].top[an].play();
|
||||
}
|
||||
}
|
||||
// }else{
|
||||
// if(trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == "01"){
|
||||
// //console.log("close");
|
||||
// trainlisttest.list[code].doorStatus = "01";
|
||||
// for(let an=actions[code].down.length-1;an>=0;an--){
|
||||
// actions[code].down[an].reset();
|
||||
// actions[code].down[an].time = actions[code].top[an]._clip.duration;
|
||||
// actions[code].down[an].timeScale = -1;
|
||||
// actions[code].down[an].play();
|
||||
// }
|
||||
// }else if(trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == "02"){
|
||||
// //console.log("open");
|
||||
// trainlisttest.list[code].doorStatus = "02";
|
||||
// for(let an=actions[code].down.length-1;an>=0;an--){
|
||||
// actions[code].down[an].reset();
|
||||
// actions[code].down[an].time = 0;
|
||||
// actions[code].down[an].timeScale = 1;
|
||||
// actions[code].down[an].play();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// 遍历获取所在轨道
|
||||
if (trainlisttest.list[code].dispose != data.body[i].dispose && data.body[i].dispose == false) {
|
||||
trainlisttest.group.add(trainlisttest.list[code]);
|
||||
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].code) {
|
||||
|
||||
trainlisttest.list[code].position.y = 0;
|
||||
trainlisttest.list[code].progress = 0;
|
||||
trainlisttest.list[code].oldoffset = data.body[i].sectionOffsetPercent;
|
||||
trainlisttest.list[code].dispose = false;
|
||||
|
||||
if (data.body[i].directionType == '02') {
|
||||
trainlisttest.list[code].status = '02';
|
||||
trainlisttest.list[code].rotation.y = 0;
|
||||
} else if (data.body[i].directionType == '03') {
|
||||
trainlisttest.list[code].status = '03';
|
||||
trainlisttest.list[code].rotation.y = Math.PI;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else if (trainlisttest.list[code].dispose != data.body[i].dispose && data.body[i].dispose == true) {
|
||||
trainlisttest.group.remove(trainlisttest.list[code]);
|
||||
trainlisttest.list[code].progress = null;
|
||||
trainlisttest.list[code].dispose = true;
|
||||
|
||||
} else if (trainlisttest.list[code].dispose == data.body[i].dispose && data.body[i].dispose == false) {
|
||||
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].code) {
|
||||
if (trainlisttest.list[code].nowcode != data.body[i].sectionCode || trainlisttest.list[code].nextcode != data.body[i].nextSectionCode) {
|
||||
trainlisttest.list[code].nowcode = data.body[i].sectionCode;
|
||||
trainlisttest.list[code].nextcode = data.body[i].nextSectionCode;
|
||||
const vexlist = [];
|
||||
const endrotation = null;
|
||||
if (data.body[i].directionType == '02') { // 向右
|
||||
if (trainlisttest.list[code].status != data.body[i].directionType) {
|
||||
console.log(trainlisttest.list[code].position);
|
||||
console.log(trainlisttest.list[code].children[5].matrixWorld);
|
||||
trainlisttest.list[code].position.x = trainlisttest.list[code].children[5].matrixWorld.elements[12];
|
||||
trainlisttest.list[code].children[0].position.z = trainlisttest.list[code].children[0].matrixWorld.elements[14];
|
||||
trainlisttest.list[code].children[1].position.z = trainlisttest.list[code].children[1].matrixWorld.elements[14];
|
||||
trainlisttest.list[code].children[2].position.z = trainlisttest.list[code].children[2].matrixWorld.elements[14];
|
||||
trainlisttest.list[code].children[3].position.z = trainlisttest.list[code].children[3].matrixWorld.elements[14];
|
||||
trainlisttest.list[code].children[4].position.z = trainlisttest.list[code].children[4].matrixWorld.elements[14];
|
||||
trainlisttest.list[code].children[5].position.z = trainlisttest.list[code].children[5].matrixWorld.elements[14];
|
||||
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x > sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
|
||||
vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14]));
|
||||
for (let m = sectionlist.sections.datalist[data.body[i].sectionCode].rail.length - 1; m >= 0; m--) {
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x > trainlisttest.list[code].position.x) {
|
||||
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14]));
|
||||
for (let m = 0; m < sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x > trainlisttest.list[code].position.x) {
|
||||
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x > sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
|
||||
for (let m = sectionlist.sections.datalist[data.body[i].sectionCode].rail.length - 1; m >= 0; m--) {
|
||||
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
|
||||
}
|
||||
} else {
|
||||
for (let m = 0; m < sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
|
||||
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
|
||||
}
|
||||
}
|
||||
}
|
||||
trainlisttest.list[code].status = '02';
|
||||
trainlisttest.list[code].rotation.y = 0;
|
||||
|
||||
} else if (data.body[i].directionType == '03') { // 向左
|
||||
|
||||
if (trainlisttest.list[code].status != data.body[i].directionType) {
|
||||
trainlisttest.list[code].position.x = trainlisttest.list[code].children[5].matrixWorld.elements[12];
|
||||
trainlisttest.list[code].children[0].position.z = trainlisttest.list[code].children[0].matrixWorld.elements[14];
|
||||
trainlisttest.list[code].children[1].position.z = trainlisttest.list[code].children[1].matrixWorld.elements[14];
|
||||
trainlisttest.list[code].children[2].position.z = trainlisttest.list[code].children[2].matrixWorld.elements[14];
|
||||
trainlisttest.list[code].children[3].position.z = trainlisttest.list[code].children[3].matrixWorld.elements[14];
|
||||
trainlisttest.list[code].children[4].position.z = trainlisttest.list[code].children[4].matrixWorld.elements[14];
|
||||
trainlisttest.list[code].children[5].position.z = trainlisttest.list[code].children[5].matrixWorld.elements[14];
|
||||
//
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x < sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
|
||||
vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14]));
|
||||
for (let m = sectionlist.sections.datalist[data.body[i].sectionCode].rail.length - 1; m >= 0; m--) {
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x < trainlisttest.list[code].position.x) {
|
||||
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14]));
|
||||
for (let m = 0; m < sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x < trainlisttest.list[code].position.x) {
|
||||
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x < sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
|
||||
for (let m = sectionlist.sections.datalist[data.body[i].sectionCode].rail.length - 1; m >= 0; m--) {
|
||||
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
|
||||
}
|
||||
|
||||
} else {
|
||||
for (let m = 0; m < sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
|
||||
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
|
||||
}
|
||||
}
|
||||
}
|
||||
trainlisttest.list[code].status = '03';
|
||||
trainlisttest.list[code].rotation.y = Math.PI;
|
||||
|
||||
}
|
||||
|
||||
trainlisttest.list[code].curve = new THREE.CatmullRomCurve3(vexlist);
|
||||
// console.log(trainlisttest.list[code].curve.points);
|
||||
// console.log(data.body[i].speed)
|
||||
// console.log(sectionlist.sections.datalist[data.body[i].sectionCode].distance);
|
||||
trainlisttest.list[code].speeds = data.body[i].speed * 10 / 36 / 11 / sectionlist.sections.datalist[data.body[i].sectionCode].distance;
|
||||
|
||||
trainlisttest.list[code].progress = 0;
|
||||
}
|
||||
// console.log("speed");
|
||||
// console.log(data.body[i].speed);
|
||||
// console.log(trainlisttest.list[code].speed);
|
||||
if (data.body[i].speed != trainlisttest.list[code].speed) {
|
||||
trainlisttest.list[code].speed = data.body[i].speed;
|
||||
trainlisttest.list[code].speeds = data.body[i].speed * 10 / 36 / 11 / sectionlist.sections.datalist[data.body[i].sectionCode].distance;
|
||||
// if(trainlisttest.list[code].speeds > 0.1){
|
||||
// console.log(data.body[i]);
|
||||
// console.log(data.body[i].speed)
|
||||
// console.log(sectionlist.sections.datalist[data.body[i].sectionCode].distance);
|
||||
// console.log(trainlisttest.list[code].speeds);
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// 0xFFFFFF
|
||||
// 0xCD0000 红
|
||||
// 0xEEEE00 黄
|
||||
// 0x32CD32 绿
|
||||
if (data.body[i]._type == 'Signal') {
|
||||
|
||||
if (signallist) {
|
||||
code = data.body[i].code;
|
||||
if (data.body[i].lightType == '01') {
|
||||
if (signallist.list[code].mesh.code) {
|
||||
signallist.list[code].mesh.status = data.body[i].status;
|
||||
|
||||
// 55
|
||||
// 33
|
||||
// 77
|
||||
// 关闭
|
||||
if (data.body[i].status == '01') {
|
||||
signallist.list[code].mesh.children[0].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[0].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[1].material.map = materials[0];
|
||||
signallist.list[code].mesh.children[1].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[2].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[2].material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
// 开放
|
||||
if (data.body[i].status == '02') {
|
||||
|
||||
if (data.body[i].switchLocateType == '01') {
|
||||
signallist.list[code].mesh.children[0].material.map = materials[2];
|
||||
signallist.list[code].mesh.children[0].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[1].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[1].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[2].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[2].material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
|
||||
if (data.body[i].switchLocateType == '02') {
|
||||
signallist.list[code].mesh.children[0].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[0].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[1].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[1].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[2].material.map = materials[1];
|
||||
signallist.list[code].mesh.children[2].material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// 引导
|
||||
if (data.body[i].status == '03') {
|
||||
signallist.list[code].mesh.children[0].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[0].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[1].material.map = materials[0];
|
||||
signallist.list[code].mesh.children[1].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[2].material.map = materials[1];
|
||||
signallist.list[code].mesh.children[2].material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
// 封锁
|
||||
if (data.body[i].status == '04') {
|
||||
signallist.list[code].mesh.children[0].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[0].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[1].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[1].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[2].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[2].material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
// 故障
|
||||
if (data.body[i].status == '05') {
|
||||
signallist.list[code].mesh.children[0].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[0].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[1].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[1].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[2].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[2].material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else if (data.body[i].lightType == '01') {
|
||||
if (signallist.list[code].mesh.code) {
|
||||
signallist.list[code].mesh.children[0].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[0].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[1].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[1].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[2].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[2].material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (data.body[i]._type == 'StationStand') {
|
||||
if (actions) {
|
||||
code = data.body[i].code;
|
||||
if (data.body[i].screenDoorOpenStatus == '02' && actions[code].status == '01') {
|
||||
actions[code].status = '00';
|
||||
}
|
||||
if (data.body[i].screenDoorOpenStatus == '02' && actions[code].status == '00') {
|
||||
actions[code].status = '02';
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = 0;
|
||||
actions[code].action.timeScale = 1;
|
||||
actions[code].action.play();
|
||||
}
|
||||
|
||||
if (data.body[i].screenDoorOpenStatus == '01' && actions[code].status == '02') {
|
||||
actions[code].status = '00';
|
||||
}
|
||||
if (data.body[i].screenDoorOpenStatus == '01' && actions[code].status == '00') {
|
||||
actions[code].status = '01';
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = actions[code].action._clip.duration;
|
||||
actions[code].action.timeScale = -1;
|
||||
actions[code].action.play();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (data.body[i]._type == 'Switch') {
|
||||
|
||||
if (sectionlist) {
|
||||
code = data.body[i].code;
|
||||
for (let j = sectionlist.switchs.modellist.length - 1; j >= 0; j--) {
|
||||
if (sectionlist.switchs.modellist[j].code == code) {
|
||||
if (sectionlist.switchs.modellist[j].locateType != data.body[i].locateType) {
|
||||
if (data.body[i].locateType == '02') {
|
||||
sectionlist.switchs.modellist[j].locateType = data.body[i].locateType;
|
||||
actions[sectionlist.switchs.modellist[j].code].reset();
|
||||
actions[sectionlist.switchs.modellist[j].code].time = 0;
|
||||
actions[sectionlist.switchs.modellist[j].code].timeScale = 1;
|
||||
actions[sectionlist.switchs.modellist[j].code].play();
|
||||
|
||||
} else if (data.body[i].locateType == '01') {
|
||||
sectionlist.switchs.modellist[j].locateType = data.body[i].locateType;
|
||||
actions[sectionlist.switchs.modellist[j].code].reset();
|
||||
actions[sectionlist.switchs.modellist[j].code].time = actions[sectionlist.switchs.modellist[j].code]._clip.duration;
|
||||
actions[sectionlist.switchs.modellist[j].code].timeScale = -1;
|
||||
actions[sectionlist.switchs.modellist[j].code].play();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// console.log(sectionlist.group[j].name);
|
||||
j = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
} else if (data.body.length > 200) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
const scope = this;
|
||||
this.map = null;
|
||||
|
||||
const webworker = worker;
|
||||
var trainlisttest = null;
|
||||
var sectionlist = null;
|
||||
var signallist = null;
|
||||
var stationstandlist = null;
|
||||
var sectionlist = null;
|
||||
var materials = null;
|
||||
var actions = null;
|
||||
var scenes = null;
|
||||
|
||||
var code = null;
|
||||
|
||||
this.teststomp = new StompClient();
|
||||
this.topic = displayTopic;
|
||||
const header = { group: router.currentRoute.query.group, 'X-Token': getToken() };
|
||||
console.log( router.currentRoute.query.group);
|
||||
this.updatamap = function (mapdata, materiallist, nowaction, scene) {
|
||||
// console.log(mapdata);
|
||||
scope.map = mapdata;
|
||||
trainlisttest = this.map.trainlisttest;
|
||||
sectionlist = this.map.sectionlist;
|
||||
signallist = this.map.signallist;
|
||||
stationstandlist = this.map.stationstandlist;
|
||||
sectionlist = this.map.sectionlist;
|
||||
materials = materiallist;
|
||||
scenes = scene;
|
||||
actions = nowaction;
|
||||
};
|
||||
|
||||
this.socketon = function (topic) {
|
||||
try {
|
||||
// console.log("teststomp");
|
||||
scope.teststomp.subscribe(topic, callback, header);
|
||||
} catch (error) {
|
||||
console.error('websocket订阅失败');
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
this.socketoff = function (topic) {
|
||||
scope.teststomp.unsubscribe(topic);
|
||||
};
|
||||
|
||||
// 仿真socket接口回调函数
|
||||
function callback(Response) {
|
||||
// 对象化数据
|
||||
const data = JSON.parse(Response.body);
|
||||
// 遍历后台数据
|
||||
|
||||
// 判断消息类型
|
||||
// if(data.type == "Simulation_TrainPosition"){
|
||||
//
|
||||
//
|
||||
// }
|
||||
if (data.type == 'Simulation_DeviceStatus') {
|
||||
|
||||
if (data.body.length < 200) {
|
||||
|
||||
for (let i = data.body.length - 1; i >= 0; i--) {
|
||||
|
||||
if (data.body[i]._type == 'Train') {
|
||||
|
||||
// console.log(data.body[i]);
|
||||
// 遍历列车对象组
|
||||
// console.log(data.body[i]);
|
||||
if (trainlisttest) {
|
||||
code = data.body[i].code;
|
||||
// 剔除不显示的车
|
||||
// 找到对应列车
|
||||
|
||||
if (trainlisttest.list[code]) {
|
||||
// 车门开关验证
|
||||
// if(data.body[i].directionType == "02"){
|
||||
if (trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == '01') {
|
||||
// console.log("close");
|
||||
trainlisttest.list[code].doorStatus = '01';
|
||||
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();
|
||||
}
|
||||
} else if (trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == '02') {
|
||||
// console.log("open");
|
||||
trainlisttest.list[code].doorStatus = '02';
|
||||
for (let an = actions[code].top.length - 1; an >= 0; an--) {
|
||||
actions[code].top[an].reset();
|
||||
actions[code].top[an].time = 0;
|
||||
actions[code].top[an].timeScale = 1;
|
||||
actions[code].top[an].play();
|
||||
}
|
||||
}
|
||||
// }else{
|
||||
// if(trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == "01"){
|
||||
// //console.log("close");
|
||||
// trainlisttest.list[code].doorStatus = "01";
|
||||
// for(let an=actions[code].down.length-1;an>=0;an--){
|
||||
// actions[code].down[an].reset();
|
||||
// actions[code].down[an].time = actions[code].top[an]._clip.duration;
|
||||
// actions[code].down[an].timeScale = -1;
|
||||
// actions[code].down[an].play();
|
||||
// }
|
||||
// }else if(trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == "02"){
|
||||
// //console.log("open");
|
||||
// trainlisttest.list[code].doorStatus = "02";
|
||||
// for(let an=actions[code].down.length-1;an>=0;an--){
|
||||
// actions[code].down[an].reset();
|
||||
// actions[code].down[an].time = 0;
|
||||
// actions[code].down[an].timeScale = 1;
|
||||
// actions[code].down[an].play();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// 遍历获取所在轨道
|
||||
if (trainlisttest.list[code].dispose != data.body[i].dispose && data.body[i].dispose == false) {
|
||||
trainlisttest.group.add(trainlisttest.list[code]);
|
||||
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].code) {
|
||||
|
||||
trainlisttest.list[code].position.y = 0;
|
||||
trainlisttest.list[code].progress = 0;
|
||||
trainlisttest.list[code].oldoffset = data.body[i].sectionOffsetPercent;
|
||||
trainlisttest.list[code].dispose = false;
|
||||
|
||||
if (data.body[i].directionType == '02') {
|
||||
trainlisttest.list[code].status = '02';
|
||||
trainlisttest.list[code].rotation.y = 0;
|
||||
} else if (data.body[i].directionType == '03') {
|
||||
trainlisttest.list[code].status = '03';
|
||||
trainlisttest.list[code].rotation.y = Math.PI;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else if (trainlisttest.list[code].dispose != data.body[i].dispose && data.body[i].dispose == true) {
|
||||
trainlisttest.group.remove(trainlisttest.list[code]);
|
||||
trainlisttest.list[code].progress = null;
|
||||
trainlisttest.list[code].dispose = true;
|
||||
|
||||
} else if (trainlisttest.list[code].dispose == data.body[i].dispose && data.body[i].dispose == false) {
|
||||
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].code) {
|
||||
if (trainlisttest.list[code].nowcode != data.body[i].sectionCode || trainlisttest.list[code].nextcode != data.body[i].nextSectionCode) {
|
||||
trainlisttest.list[code].nowcode = data.body[i].sectionCode;
|
||||
trainlisttest.list[code].nextcode = data.body[i].nextSectionCode;
|
||||
const vexlist = [];
|
||||
const endrotation = null;
|
||||
if (data.body[i].directionType == '02') { // 向右
|
||||
if (trainlisttest.list[code].status != data.body[i].directionType) {
|
||||
console.log(trainlisttest.list[code].position);
|
||||
console.log(trainlisttest.list[code].children[5].matrixWorld);
|
||||
trainlisttest.list[code].position.x = trainlisttest.list[code].children[5].matrixWorld.elements[12];
|
||||
trainlisttest.list[code].children[0].position.z = trainlisttest.list[code].children[0].matrixWorld.elements[14];
|
||||
trainlisttest.list[code].children[1].position.z = trainlisttest.list[code].children[1].matrixWorld.elements[14];
|
||||
trainlisttest.list[code].children[2].position.z = trainlisttest.list[code].children[2].matrixWorld.elements[14];
|
||||
trainlisttest.list[code].children[3].position.z = trainlisttest.list[code].children[3].matrixWorld.elements[14];
|
||||
trainlisttest.list[code].children[4].position.z = trainlisttest.list[code].children[4].matrixWorld.elements[14];
|
||||
trainlisttest.list[code].children[5].position.z = trainlisttest.list[code].children[5].matrixWorld.elements[14];
|
||||
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x > sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
|
||||
vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14]));
|
||||
for (let m = sectionlist.sections.datalist[data.body[i].sectionCode].rail.length - 1; m >= 0; m--) {
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x > trainlisttest.list[code].position.x) {
|
||||
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14]));
|
||||
for (let m = 0; m < sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x > trainlisttest.list[code].position.x) {
|
||||
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x > sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
|
||||
for (let m = sectionlist.sections.datalist[data.body[i].sectionCode].rail.length - 1; m >= 0; m--) {
|
||||
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
|
||||
}
|
||||
} else {
|
||||
for (let m = 0; m < sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
|
||||
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
|
||||
}
|
||||
}
|
||||
}
|
||||
trainlisttest.list[code].status = '02';
|
||||
trainlisttest.list[code].rotation.y = 0;
|
||||
|
||||
} else if (data.body[i].directionType == '03') { // 向左
|
||||
|
||||
if (trainlisttest.list[code].status != data.body[i].directionType) {
|
||||
trainlisttest.list[code].position.x = trainlisttest.list[code].children[5].matrixWorld.elements[12];
|
||||
trainlisttest.list[code].children[0].position.z = trainlisttest.list[code].children[0].matrixWorld.elements[14];
|
||||
trainlisttest.list[code].children[1].position.z = trainlisttest.list[code].children[1].matrixWorld.elements[14];
|
||||
trainlisttest.list[code].children[2].position.z = trainlisttest.list[code].children[2].matrixWorld.elements[14];
|
||||
trainlisttest.list[code].children[3].position.z = trainlisttest.list[code].children[3].matrixWorld.elements[14];
|
||||
trainlisttest.list[code].children[4].position.z = trainlisttest.list[code].children[4].matrixWorld.elements[14];
|
||||
trainlisttest.list[code].children[5].position.z = trainlisttest.list[code].children[5].matrixWorld.elements[14];
|
||||
//
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x < sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
|
||||
vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14]));
|
||||
for (let m = sectionlist.sections.datalist[data.body[i].sectionCode].rail.length - 1; m >= 0; m--) {
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x < trainlisttest.list[code].position.x) {
|
||||
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14]));
|
||||
for (let m = 0; m < sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x < trainlisttest.list[code].position.x) {
|
||||
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x < sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
|
||||
for (let m = sectionlist.sections.datalist[data.body[i].sectionCode].rail.length - 1; m >= 0; m--) {
|
||||
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
|
||||
}
|
||||
|
||||
} else {
|
||||
for (let m = 0; m < sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
|
||||
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
|
||||
}
|
||||
}
|
||||
}
|
||||
trainlisttest.list[code].status = '03';
|
||||
trainlisttest.list[code].rotation.y = Math.PI;
|
||||
|
||||
}
|
||||
|
||||
trainlisttest.list[code].curve = new THREE.CatmullRomCurve3(vexlist);
|
||||
// console.log(trainlisttest.list[code].curve.points);
|
||||
// console.log(data.body[i].speed)
|
||||
// console.log(sectionlist.sections.datalist[data.body[i].sectionCode].distance);
|
||||
trainlisttest.list[code].speeds = data.body[i].speed * 10 / 36 / 11 / sectionlist.sections.datalist[data.body[i].sectionCode].distance;
|
||||
|
||||
trainlisttest.list[code].progress = 0;
|
||||
}
|
||||
// console.log("speed");
|
||||
// console.log(data.body[i].speed);
|
||||
// console.log(trainlisttest.list[code].speed);
|
||||
if (data.body[i].speed != trainlisttest.list[code].speed) {
|
||||
trainlisttest.list[code].speed = data.body[i].speed;
|
||||
trainlisttest.list[code].speeds = data.body[i].speed * 10 / 36 / 11 / sectionlist.sections.datalist[data.body[i].sectionCode].distance;
|
||||
// if(trainlisttest.list[code].speeds > 0.1){
|
||||
// console.log(data.body[i]);
|
||||
// console.log(data.body[i].speed)
|
||||
// console.log(sectionlist.sections.datalist[data.body[i].sectionCode].distance);
|
||||
// console.log(trainlisttest.list[code].speeds);
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// 0xFFFFFF
|
||||
// 0xCD0000 红
|
||||
// 0xEEEE00 黄
|
||||
// 0x32CD32 绿
|
||||
if (data.body[i]._type == 'Signal') {
|
||||
|
||||
if (signallist) {
|
||||
code = data.body[i].code;
|
||||
if (data.body[i].lightType == '01') {
|
||||
if (signallist.list[code].mesh.code) {
|
||||
signallist.list[code].mesh.status = data.body[i].status;
|
||||
|
||||
// 55
|
||||
// 33
|
||||
// 77
|
||||
// 关闭
|
||||
if (data.body[i].status == '01') {
|
||||
signallist.list[code].mesh.children[0].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[0].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[1].material.map = materials[0];
|
||||
signallist.list[code].mesh.children[1].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[2].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[2].material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
// 开放
|
||||
if (data.body[i].status == '02') {
|
||||
|
||||
if (data.body[i].switchLocateType == '01') {
|
||||
signallist.list[code].mesh.children[0].material.map = materials[2];
|
||||
signallist.list[code].mesh.children[0].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[1].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[1].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[2].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[2].material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
|
||||
if (data.body[i].switchLocateType == '02') {
|
||||
signallist.list[code].mesh.children[0].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[0].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[1].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[1].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[2].material.map = materials[1];
|
||||
signallist.list[code].mesh.children[2].material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// 引导
|
||||
if (data.body[i].status == '03') {
|
||||
signallist.list[code].mesh.children[0].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[0].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[1].material.map = materials[0];
|
||||
signallist.list[code].mesh.children[1].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[2].material.map = materials[1];
|
||||
signallist.list[code].mesh.children[2].material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
// 封锁
|
||||
if (data.body[i].status == '04') {
|
||||
signallist.list[code].mesh.children[0].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[0].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[1].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[1].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[2].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[2].material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
// 故障
|
||||
if (data.body[i].status == '05') {
|
||||
signallist.list[code].mesh.children[0].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[0].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[1].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[1].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[2].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[2].material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else if (data.body[i].lightType == '01') {
|
||||
if (signallist.list[code].mesh.code) {
|
||||
signallist.list[code].mesh.children[0].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[0].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[1].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[1].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[2].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[2].material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (data.body[i]._type == 'StationStand') {
|
||||
if (actions) {
|
||||
code = data.body[i].code;
|
||||
if (data.body[i].screenDoorOpenStatus == '02' && actions[code].status == '01') {
|
||||
actions[code].status = '00';
|
||||
}
|
||||
if (data.body[i].screenDoorOpenStatus == '02' && actions[code].status == '00') {
|
||||
actions[code].status = '02';
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = 0;
|
||||
actions[code].action.timeScale = 1;
|
||||
actions[code].action.play();
|
||||
}
|
||||
|
||||
if (data.body[i].screenDoorOpenStatus == '01' && actions[code].status == '02') {
|
||||
actions[code].status = '00';
|
||||
}
|
||||
if (data.body[i].screenDoorOpenStatus == '01' && actions[code].status == '00') {
|
||||
actions[code].status = '01';
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = actions[code].action._clip.duration;
|
||||
actions[code].action.timeScale = -1;
|
||||
actions[code].action.play();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (data.body[i]._type == 'Switch') {
|
||||
|
||||
if (sectionlist) {
|
||||
code = data.body[i].code;
|
||||
for (let j = sectionlist.switchs.modellist.length - 1; j >= 0; j--) {
|
||||
if (sectionlist.switchs.modellist[j].code == code) {
|
||||
if (sectionlist.switchs.modellist[j].locateType != data.body[i].locateType) {
|
||||
if (data.body[i].locateType == '02') {
|
||||
sectionlist.switchs.modellist[j].locateType = data.body[i].locateType;
|
||||
actions[sectionlist.switchs.modellist[j].code].reset();
|
||||
actions[sectionlist.switchs.modellist[j].code].time = 0;
|
||||
actions[sectionlist.switchs.modellist[j].code].timeScale = 1;
|
||||
actions[sectionlist.switchs.modellist[j].code].play();
|
||||
|
||||
} else if (data.body[i].locateType == '01') {
|
||||
sectionlist.switchs.modellist[j].locateType = data.body[i].locateType;
|
||||
actions[sectionlist.switchs.modellist[j].code].reset();
|
||||
actions[sectionlist.switchs.modellist[j].code].time = actions[sectionlist.switchs.modellist[j].code]._clip.duration;
|
||||
actions[sectionlist.switchs.modellist[j].code].timeScale = -1;
|
||||
actions[sectionlist.switchs.modellist[j].code].play();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// console.log(sectionlist.group[j].name);
|
||||
j = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
} else if (data.body.length > 200) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
201
src/jlmap3d/jl3dsimulation/connect/UpdateTrainTest.js
Normal file
201
src/jlmap3d/jl3dsimulation/connect/UpdateTrainTest.js
Normal file
@ -0,0 +1,201 @@
|
||||
|
||||
export function UpdateTrain(camera,traindata){
|
||||
if(traindata != undefined ){
|
||||
for(let j=traindata.group.children.length-1;j>=0;j--){
|
||||
//判断是否有移动事件
|
||||
if(traindata.group.children[j].dispose == false){
|
||||
|
||||
if(traindata.group.children[j].progress != null){
|
||||
|
||||
let trainmodel = traindata.group.children[j];
|
||||
|
||||
if(trainmodel.speeds > 0 && trainmodel.speeds){
|
||||
|
||||
let speed = null;
|
||||
if(traindata.group.children[j].progress >=0&&traindata.group.children[j].progress<=1){
|
||||
// console.log(trainmodel.rname);
|
||||
// console.log(trainmodel.speeds);
|
||||
// console.log(trainmodel.progress);
|
||||
let movecurve = trainmodel.curve;
|
||||
if(trainmodel.status == "03" && movecurve.points.length>1){
|
||||
let point = movecurve.getPointAt(traindata.group.children[j].progress);
|
||||
trainmodel.position.x = point.x;
|
||||
trainmodel.position.y = 0;
|
||||
if(Math.abs( point.z -trainmodel.children[0].matrixWorld.elements[14]) >0.02){
|
||||
trainmodel.children[0].up = new THREE.Vector3(-1,0,0);
|
||||
let tangent = movecurve.getTangentAt(traindata.group.children[j].progress).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;
|
||||
|
||||
// console.log(trainmodel.children[0].rotation.x);
|
||||
// console.log(trainmodel.children[0].rotation.y);
|
||||
// console.log(trainmodel.children[0].rotation.z);
|
||||
let rotas = {
|
||||
posr:point,
|
||||
rota:trainmodel.children[0].rotation.z
|
||||
}
|
||||
trainmodel.children[1].rotalist.push(rotas);
|
||||
|
||||
let offsetz = parseFloat(trainmodel.children[0].matrixWorld.elements[14]) - parseFloat(point.z);
|
||||
trainmodel.children[0].position.z += 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<6;rs++){
|
||||
//console.log(rs);
|
||||
if(trainmodel.children[rs].rotalist[0]){
|
||||
let offsetz = parseFloat(trainmodel.children[rs].matrixWorld.elements[14]) - parseFloat(trainmodel.children[rs].rotalist[0].posr.z);
|
||||
|
||||
trainmodel.children[rs].position.z += offsetz;
|
||||
|
||||
for(let xh=0;xh<trainmodel.children[rs].rotalist.length;xh++){
|
||||
if((trainmodel.children[rs].matrixWorld.elements[12]-8)<=trainmodel.children[rs].rotalist[0].posr.x){
|
||||
|
||||
if(rs != 5){
|
||||
let asd = trainmodel.children[rs].rotalist[0];
|
||||
trainmodel.children[rs+1].rotalist.push(asd);
|
||||
|
||||
}
|
||||
|
||||
trainmodel.children[rs].rotation.z = trainmodel.children[rs].rotalist[0].rota;
|
||||
trainmodel.children[rs].rotalist.splice(0,1)
|
||||
xh--;
|
||||
}else{
|
||||
xh = trainmodel.children[rs].rotalist.length;
|
||||
}
|
||||
}
|
||||
//console.log(trainmodel.children[rs].rotalist.length);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(trainmodel.statsstop == 0){
|
||||
if((1-trainmodel.progress) > trainmodel.targetpercent){
|
||||
// if(trainmodel.rname == "001"){
|
||||
// console.log(trainmodel.targetLink);
|
||||
// console.log(trainmodel.nowcode);
|
||||
// console.log(1-trainmodel.progress);
|
||||
// console.log(trainmodel.targetpercent);
|
||||
// console.log("===============");
|
||||
// }
|
||||
trainmodel.progress += trainmodel.speeds;
|
||||
}else{
|
||||
trainmodel.statsstop = 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(trainmodel.status == "02" && movecurve.points.length>1){
|
||||
let point = movecurve.getPointAt(trainmodel.progress);
|
||||
trainmodel.position.x = point.x;
|
||||
trainmodel.position.y = 0;
|
||||
if(Math.abs( point.z -trainmodel.children[0].matrixWorld.elements[14]) >0.02){
|
||||
trainmodel.children[0].up = new THREE.Vector3(1,0,0);
|
||||
let tangent = movecurve.getTangentAt(traindata.group.children[j].progress).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 rotas = {
|
||||
posr:point,
|
||||
rota:trainmodel.children[0].rotation.z
|
||||
}
|
||||
trainmodel.children[1].rotalist.push(rotas);
|
||||
let offsetz = parseFloat(point.z) - parseFloat(trainmodel.children[0].matrixWorld.elements[14]);
|
||||
trainmodel.children[0].position.z += 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<6;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;
|
||||
|
||||
for(let xh=0;xh<trainmodel.children[rs].rotalist.length;xh++){
|
||||
if((trainmodel.children[rs].matrixWorld.elements[12]+8)>=trainmodel.children[rs].rotalist[0].posr.x){
|
||||
|
||||
if(rs != 5){
|
||||
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].rota;
|
||||
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);
|
||||
}
|
||||
|
||||
if(trainmodel.statsstop == 0){
|
||||
if(trainmodel.progress < trainmodel.targetpercent){
|
||||
trainmodel.progress += trainmodel.speeds;
|
||||
}else{
|
||||
trainmodel.statsstop = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}else{
|
||||
if(trainmodel.nextcurve){
|
||||
// if(trainmodel.status == '02'){
|
||||
// }else if(trainmodel.status == '03'){
|
||||
// }
|
||||
trainmodel.progress = 0;
|
||||
trainmodel.len = trainmodel.nextlen;
|
||||
if(trainmodel.nextcode){
|
||||
trainmodel.nowcode = trainmodel.nextcode;
|
||||
}
|
||||
|
||||
trainmodel.speeds = parseFloat(trainmodel.speed*10/36/25/trainmodel.len);
|
||||
trainmodel.curve = trainmodel.nextcurve;
|
||||
trainmodel.nextcurve = null;
|
||||
trainmodel.nextlen = null;
|
||||
trainmodel.nextcode = null;
|
||||
}
|
||||
// console.log(trainmodel.name);
|
||||
// console.log(trainmodel.progress);
|
||||
// console.log(trainmodel.nextcurve);
|
||||
// if(trainmodel.status == "02"){
|
||||
// trainmodel.progress = 0;
|
||||
// }else if(trainmodel.status == "03"){
|
||||
// trainmodel.progress = 1;
|
||||
// }
|
||||
// trainmodel.curve = trainmodel.nextcurve;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -19,7 +19,7 @@ import { SetLights } from '@/jlmap3d/config/SetLights';
|
||||
|
||||
//controls
|
||||
import { OrbitControls } from '@/jlmap3d/main/control/OrbitControls';
|
||||
import { DragControls } from '@/jlmap3d/main/control/DragControls';
|
||||
// import { DragControls } from '@/jlmap3d/main/control/DragControls';
|
||||
|
||||
//加载器
|
||||
import { ModelLoad } from '@/jlmap3d/main/loaders/ModelLoad';
|
||||
@ -29,7 +29,7 @@ import { getPublishMapVersion, getPublishMapDetail,getPublish3dMapDetail} from '
|
||||
|
||||
//utils
|
||||
// import { UpdateTrain } from '@/jlmap3d/main/utils/UpdateTrain';
|
||||
import { UpdateTrain } from '@/jlmap3d/main/utils/UpdateTrainTest';
|
||||
import { UpdateTrain } from '@/jlmap3d/jl3dsimulation/connect/UpdateTrainTest';
|
||||
// import { ReStart } from '@/jlmap3d/main/utils/ReStart';
|
||||
|
||||
import {Stats} from '@/jlmap3d/main/lib/stats.min.js';
|
||||
@ -53,12 +53,11 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup) {
|
||||
let camera = SetCamera(dom);
|
||||
//定义场景(渲染容器)
|
||||
let scene = SetScene();
|
||||
|
||||
//定义镜头操作
|
||||
let controls = new THREE.OrbitControls(camera);
|
||||
controls.maxPolarAngle = Math.PI/2;
|
||||
//controls.minPolarAngle = Math.PI/8;
|
||||
controls.maxDistance = 1500;
|
||||
controls.maxDistance = 4800;
|
||||
//模型加载器
|
||||
this.assetloader = new AssetLoader();
|
||||
//替换材质组,例:信号机不同灯光
|
||||
@ -68,35 +67,91 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup) {
|
||||
//点击选中的模型
|
||||
this.selectmodel = null;
|
||||
//鼠标点击模型切换
|
||||
this.raycasterswitch = "stand";
|
||||
this.raycasterswitch = "null";
|
||||
//选中物体描边方框
|
||||
this.helpbox = null;
|
||||
//车门,站台门道岔动画构造器
|
||||
this.mixers = [];
|
||||
//模型操作命令组
|
||||
this.actions = {};
|
||||
|
||||
let sectionlist = null;
|
||||
let linklist = null;
|
||||
let signallist = null;
|
||||
let stationstandlist = null;
|
||||
let trainlisttest = null;
|
||||
let realsectionlist = null;
|
||||
let rails = null;
|
||||
|
||||
let camerarail = {
|
||||
curve:null,
|
||||
progress:0,
|
||||
moveswitch:false
|
||||
};
|
||||
this.webwork = new Worker("../../static/workertest/trainworker.js");
|
||||
this.jsonwebwork = new Worker("../../static/workertest/jsonworker.js");
|
||||
//地图模型数据
|
||||
let mapdata = new Jl3ddata();
|
||||
//订阅仿真socket
|
||||
console.log(routegroup);
|
||||
this.Subscribe = new Jlmap3dSubscribe(this.webwork,routegroup);
|
||||
// console.log(routegroup);
|
||||
this.Subscribe = new Jlmap3dSubscribe(scope,routegroup,scope.jsonwebwork);
|
||||
//连接到通信
|
||||
//console.log(this.Subscribe.config);
|
||||
//this.webwork.postMessage(this.Subscribe.teststomp);
|
||||
|
||||
this.Subscribe.socketon(scope.Subscribe.topic);
|
||||
|
||||
//初始化加载数据和模型
|
||||
getPublish3dMapDetail(skinCode).then(netdata => {
|
||||
ModelLoad(data,scope,netdata.data,mapdata,camera,controls,scene,storemod);
|
||||
//初始化加载数据和模型getPublishMapDetail
|
||||
getPublishMapDetail(skinCode).then(data => {
|
||||
let mapnetdata = data.data;
|
||||
getPublish3dMapDetail(skinCode).then(netdata => {
|
||||
ModelLoad(mapnetdata,scope,netdata.data,mapdata,camera,controls,scene,storemod);
|
||||
});
|
||||
});
|
||||
//
|
||||
|
||||
// let stats = new Stats();
|
||||
// dom.appendChild( stats.dom );
|
||||
|
||||
// var timer = setInterval(function() {
|
||||
// if(trainlisttest){
|
||||
// if(trainlisttest.group){
|
||||
// if(trainlisttest.group.children[0]){
|
||||
// for(let k in rails.switchrail){
|
||||
// const ddd = storemod.getters['map/getDeviceByCode'](k);
|
||||
// let switchdata = rails.switchrail[k];
|
||||
// rails.switchrail[k].locateType = ddd.locateType;
|
||||
//
|
||||
// if(ddd.locateType == "01"){
|
||||
// //1--向左 2--向右
|
||||
// //__\__ __/__
|
||||
// if(rails.switchrail[k].directtype == "1"){
|
||||
// rails.linkrail[switchdata.alink].lconnect = switchdata.blink;
|
||||
// rails.linkrail[switchdata.blink].rconnect = switchdata.alink;
|
||||
// }else if(rails.switchrail[k].directtype == "2"){
|
||||
// rails.linkrail[switchdata.alink].rconnect = switchdata.blink;
|
||||
// rails.linkrail[switchdata.blink].lconnect = switchdata.alink;
|
||||
// }
|
||||
//
|
||||
// }else if(ddd.locateType == "02"){
|
||||
// if(rails.switchrail[k].directtype == "1"){
|
||||
// rails.linkrail[switchdata.alink].lconnect = switchdata.clink;
|
||||
// rails.linkrail[switchdata.clink].rconnect = switchdata.alink;
|
||||
// }else if(rails.switchrail[k].directtype == "2"){
|
||||
// rails.linkrail[switchdata.alink].rconnect = switchdata.clink;
|
||||
// rails.linkrail[switchdata.clink].lconnect = switchdata.alink;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// clearInterval(timer);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }, 2000);
|
||||
controls.upscene(scope.animateswitch);
|
||||
//开启渲染
|
||||
animate();
|
||||
startWorker();
|
||||
startWorker(scope.webwork);
|
||||
//动画时间
|
||||
let delta;
|
||||
//循环渲染函数
|
||||
@ -106,29 +161,55 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup) {
|
||||
//renderer.setAnimationLoop(animate);
|
||||
requestAnimationFrame(animate);
|
||||
//判断渲染是否开启
|
||||
if(scope.animateswitch == true){
|
||||
// if(scope.animateswitch == true){
|
||||
// if(camera.position.y<4000){
|
||||
//
|
||||
// }
|
||||
//根据相机渲染场景
|
||||
renderer.render(scene,camera);
|
||||
// console.log(scope.animateswitch);
|
||||
//检测动画构造器播放动画
|
||||
// stats.update();
|
||||
}
|
||||
|
||||
// }
|
||||
// stats.update();
|
||||
}
|
||||
|
||||
function startWorker(){
|
||||
function startWorker(webwork){
|
||||
|
||||
if(typeof(Worker)!=="undefined"){
|
||||
|
||||
|
||||
scope.webwork.onmessage = function (event) {
|
||||
//更新列车位置
|
||||
UpdateTrain(camera,mapdata.trainlisttest);
|
||||
UpdateTrain(camera,trainlisttest);
|
||||
if(camerarail.moveswitch == true){
|
||||
// console.log(camerarail.progress);
|
||||
if(camerarail.progress>=0.99){
|
||||
camerarail.moveswitch = false;
|
||||
camerarail.curve = null;
|
||||
}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;
|
||||
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();
|
||||
point = null;
|
||||
}
|
||||
|
||||
}
|
||||
delta = clock.getDelta();
|
||||
|
||||
for(let i=scope.mixers.length-1;i>=0;i--){
|
||||
if ( scope.mixers[i] ){
|
||||
scope.mixers[i].update( delta );
|
||||
}
|
||||
}
|
||||
// renderer.render(scene,camera);
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
@ -166,24 +247,24 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup) {
|
||||
|
||||
this.showstationmsg = function(showtype){
|
||||
if(showtype == "show"){
|
||||
for(let st=0;st<mapdata.stationstandlist.group.children.length;st++){
|
||||
mapdata.stationstandlist.group.children[st].add(mapdata.stationstandlist.textlist[st]);
|
||||
for(let st=0;st<stationstandlist.group.children.length;st++){
|
||||
stationstandlist.group.children[st].add(stationstandlist.textlist[st]);
|
||||
}
|
||||
}else{
|
||||
for(let st=0;st<mapdata.stationstandlist.group.children.length;st++){
|
||||
mapdata.stationstandlist.group.children[st].remove(mapdata.stationstandlist.textlist[st]);
|
||||
for(let st=0;st<stationstandlist.group.children.length;st++){
|
||||
stationstandlist.group.children[st].remove(stationstandlist.textlist[st]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.showtrainmsg = function(showtype){
|
||||
if(showtype == "show"){
|
||||
for(let st=0;st<mapdata.trainlisttest.textlist.length;st++){
|
||||
mapdata.trainlisttest.list[mapdata.trainlisttest.textlist[st].tcode].children[0].add(mapdata.trainlisttest.textlist[st]);
|
||||
for(let st=0;st<trainlisttest.textlist.length;st++){
|
||||
trainlisttest.list[trainlisttest.textlist[st].tcode].children[0].add(trainlisttest.textlist[st]);
|
||||
}
|
||||
}else{
|
||||
for(let st=0;st<mapdata.trainlisttest.textlist.length;st++){
|
||||
mapdata.trainlisttest.list[mapdata.trainlisttest.textlist[st].tcode].children[0].remove(mapdata.trainlisttest.textlist[st]);
|
||||
for(let st=0;st<trainlisttest.textlist.length;st++){
|
||||
trainlisttest.list[trainlisttest.textlist[st].tcode].children[0].remove(trainlisttest.textlist[st]);
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -194,14 +275,25 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup) {
|
||||
|
||||
this.animateon = function(){
|
||||
controls.enabled = true;
|
||||
scope.animateswitch = true;
|
||||
// scope.animateswitch = true;
|
||||
};
|
||||
|
||||
this.animateoff = function(){
|
||||
controls.enabled = false;
|
||||
scope.animateswitch = false;
|
||||
// scope.animateswitch = false;
|
||||
};
|
||||
|
||||
this.loaderdata = function(loadsectionlist,loadlinklist,loadsignallist,loadstationstandlist,loadtrainlisttest,loadrealsectionlist,loadrails){
|
||||
|
||||
sectionlist = loadsectionlist;
|
||||
linklist = loadlinklist;
|
||||
signallist = loadsignallist;
|
||||
stationstandlist = loadstationstandlist;
|
||||
trainlisttest = loadtrainlisttest;
|
||||
realsectionlist = loadrealsectionlist;
|
||||
rails = loadrails;
|
||||
}
|
||||
|
||||
this.eventon = function(){
|
||||
//raycaster交互模型点击事件
|
||||
document.getElementById("testjlmap3d").addEventListener( "mousedown", onselect, false );
|
||||
@ -236,8 +328,9 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup) {
|
||||
controls.target = new THREE.Vector3(mesh.position.x,mesh.position.y,mesh.children[2].matrixWorld.elements[14]);
|
||||
}
|
||||
|
||||
|
||||
controls.upmodeldirect(mapdata);
|
||||
if(stationstandlist && trainlisttest){
|
||||
controls.upmodeldirect(stationstandlist,trainlisttest);
|
||||
}
|
||||
controls.update();
|
||||
}
|
||||
|
||||
@ -267,17 +360,17 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup) {
|
||||
|
||||
if(scope.raycasterswitch == "stand"){
|
||||
//从站台对象组获取点击目标
|
||||
let intersects1 = raycaster.intersectObjects( mapdata.stationstandlist.textlist);
|
||||
let intersects1 = raycaster.intersectObjects( stationstandlist.textlist);
|
||||
//获取最近处点击到的模型对象
|
||||
if(intersects1[0]){
|
||||
//遍历对象组获取对象坐标更新相机数据
|
||||
for(let j=0;j<mapdata.stationstandlist.list.length;j++){
|
||||
if(intersects1[0].object.name == mapdata.stationstandlist.list[j].mesh.code){
|
||||
camera.position.x = mapdata.stationstandlist.list[j].mesh.position.x;
|
||||
camera.position.y = mapdata.stationstandlist.list[j].mesh.position.y+200;
|
||||
camera.position.z = mapdata.stationstandlist.list[j].mesh.position.z+300;
|
||||
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(mapdata.stationstandlist.list[j].mesh.position.x,mapdata.stationstandlist.list[j].mesh.position.y,mapdata.stationstandlist.list[j].mesh.position.z);
|
||||
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();
|
||||
}
|
||||
}
|
||||
@ -285,18 +378,18 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup) {
|
||||
}
|
||||
|
||||
if(scope.raycasterswitch == "train"){
|
||||
let intersects = raycaster.intersectObjects( mapdata.trainlisttest.textlist);
|
||||
let intersects = raycaster.intersectObjects( trainlisttest.textlist);
|
||||
if(intersects[0]){
|
||||
for(let j=0;j<mapdata.trainlisttest.list.length;j++){
|
||||
if(intersects[0].object.name == mapdata.trainlisttest.list[j].name){
|
||||
// console.log(mapdata.trainlisttest.list[j].position.x);
|
||||
// console.log(mapdata.trainlisttest.list[j].position.y);
|
||||
// console.log(mapdata.trainlisttest.list[j].children[2].matrixWorld.elements[14]);
|
||||
camera.position.x = mapdata.trainlisttest.list[j].position.x;
|
||||
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 = mapdata.trainlisttest.list[j].children[2].matrixWorld.elements[14]+300;
|
||||
camera.position.z = trainlisttest.list[j].children[2].matrixWorld.elements[14]+300;
|
||||
//console.log(camera.position);
|
||||
controls.target = new THREE.Vector3(mapdata.trainlisttest.list[j].children[2].matrixWorld.elements[12],mapdata.trainlisttest.list[j].children[2].matrixWorld.elements[13],mapdata.trainlisttest.list[j].children[2].matrixWorld.elements[14]);
|
||||
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();
|
||||
}
|
||||
}
|
||||
@ -304,28 +397,31 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup) {
|
||||
}
|
||||
|
||||
if(scope.raycasterswitch == "section"){
|
||||
//console.log(mapdata.sectionlist.sections.modellist);
|
||||
let intersects = raycaster.intersectObjects( mapdata.sectionlist.sections.modellist,true);
|
||||
console.log(sectionlist);
|
||||
console.log(linklist);
|
||||
//console.log(sectionlist.sections.modellist);
|
||||
let intersects = raycaster.intersectObjects( linklist.linksgroup.children,true);
|
||||
if(intersects[0]){
|
||||
console.log(intersects[0].object);
|
||||
// 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( mapdata.signallist.group.children,true);
|
||||
console.log(signallist);
|
||||
let intersects = raycaster.intersectObjects( signallist.group.children,true);
|
||||
|
||||
if(intersects[0]){
|
||||
console.log(intersects[0].object.matrixWorld);
|
||||
// console.log(intersects[0].object.matrixWorld);
|
||||
scope.helpbox = new THREE.BoxHelper( intersects[0].object, 0xff0000 );
|
||||
scene.add( scope.helpbox );
|
||||
}
|
||||
}
|
||||
|
||||
if(scope.raycasterswitch == "switch"){
|
||||
let intersects = raycaster.intersectObjects( mapdata.sectionlist.switchs.modellist,true);
|
||||
console.log(sectionlist);
|
||||
let intersects = raycaster.intersectObjects( sectionlist.switchs.modellist,true);
|
||||
|
||||
if(intersects[0]){
|
||||
scope.helpbox = new THREE.BoxHelper( intersects[0].object, 0xff0000 );
|
||||
@ -336,4 +432,33 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup) {
|
||||
}
|
||||
}
|
||||
|
||||
//相机轨迹动画
|
||||
this.camerarailmove = function(){
|
||||
camerarail.moveswitch = true;
|
||||
camerarail.progress = 0;
|
||||
let points = [];
|
||||
let stationp1 = stationstandlist.group.children[0].position;
|
||||
let stationp2 = stationstandlist.group.children[20].position;
|
||||
//全线漫游
|
||||
// points.push(new THREE.Vector3(stationp1.x-20,10,stationp1.z));
|
||||
// points.push(new THREE.Vector3(stationp2.x+20,10,stationp2.z));
|
||||
//站内漫游(晕)
|
||||
// points.push(new THREE.Vector3(stationp1.x-65,11,stationp1.z+15));
|
||||
// points.push(new THREE.Vector3(stationp1.x,11,stationp1.z+15));
|
||||
// points.push(new THREE.Vector3(stationp1.x+5,11,stationp1.z+6));
|
||||
// points.push(new THREE.Vector3(stationp1.x+5,11,stationp1.z-15));
|
||||
// points.push(new THREE.Vector3(stationp1.x+38,11,stationp1.z-15));
|
||||
// points.push(new THREE.Vector3(stationp1.x+38,11,stationp1.z+2));
|
||||
// points.push(new THREE.Vector3(stationp1.x+13,5,stationp1.z+2));
|
||||
|
||||
points.push(new THREE.Vector3(stationp1.x-65,11,stationp1.z+12));
|
||||
points.push(new THREE.Vector3(stationp1.x+60,11,stationp1.z+12));
|
||||
points.push(new THREE.Vector3(stationp1.x+60,7,stationp1.z+12));
|
||||
points.push(new THREE.Vector3(stationp1.x-55,5,stationp1.z+12));
|
||||
// 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();
|
||||
camerarail.curve = new THREE.CatmullRomCurve3(points);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,13 @@
|
||||
THREE.OrbitControls = function ( object, domElement ) {
|
||||
this.object = object;
|
||||
|
||||
this.data = null;
|
||||
this.data = {
|
||||
stationstandlist : null,
|
||||
trainlisttest : null
|
||||
};
|
||||
|
||||
this.animateswitch = null;
|
||||
this.scene = null;
|
||||
|
||||
this.domElement = ( domElement !== undefined ) ? domElement : document;
|
||||
|
||||
@ -122,8 +128,13 @@ THREE.OrbitControls = function ( object, domElement ) {
|
||||
|
||||
};
|
||||
|
||||
this.upmodeldirect = function(data){
|
||||
scope.data = data;
|
||||
this.upmodeldirect = function(newstationstandlist,newtrainlisttest){
|
||||
scope.data.stationstandlist = newstationstandlist;
|
||||
scope.data.trainlisttest = newtrainlisttest;
|
||||
}
|
||||
|
||||
this.upscene = function(animateswitch){
|
||||
// scope.animateswitch = animateswitch;
|
||||
}
|
||||
|
||||
// this method is exposed, but perhaps it would be better if we can make it private...
|
||||
@ -142,7 +153,6 @@ THREE.OrbitControls = function ( object, domElement ) {
|
||||
return function update() {
|
||||
|
||||
|
||||
if(scope.data){
|
||||
//站台牌自动跟随相机
|
||||
if(scope.data.stationstandlist){
|
||||
for(let i = scope.data.stationstandlist.textlist.length-1; i>=0; i --){
|
||||
@ -158,8 +168,6 @@ THREE.OrbitControls = function ( object, domElement ) {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var position = scope.object.position;
|
||||
|
||||
offset.copy( position ).sub( scope.target );
|
||||
@ -491,6 +499,9 @@ THREE.OrbitControls = function ( object, domElement ) {
|
||||
rotateUp( 2 * Math.PI * rotateDelta.y / element.clientHeight );
|
||||
|
||||
rotateStart.copy( rotateEnd );
|
||||
// if(scope.render){
|
||||
// scope.render.render(scope.scene,scope.object);
|
||||
// }
|
||||
|
||||
scope.update();
|
||||
|
||||
@ -780,7 +791,7 @@ THREE.OrbitControls = function ( object, domElement ) {
|
||||
if ( scope.enabled === false ) return;
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
scope.animateswitch = true;
|
||||
switch ( state ) {
|
||||
|
||||
case STATE.ROTATE:
|
||||
@ -814,7 +825,7 @@ THREE.OrbitControls = function ( object, domElement ) {
|
||||
function onMouseUp( event ) {
|
||||
|
||||
if ( scope.enabled === false ) return;
|
||||
|
||||
scope.animateswitch = false;
|
||||
handleMouseUp( event );
|
||||
|
||||
document.removeEventListener( 'mousemove', onMouseMove, false );
|
||||
|
@ -36,6 +36,15 @@ let defaultstation = {
|
||||
picUrl:"",
|
||||
assetUrl:modelurl+"/models/station/fuzhou/fuzhou.FBX"
|
||||
}
|
||||
|
||||
let defaulttopstation = {
|
||||
id:"104",
|
||||
name:"福州车站1",
|
||||
deviceType:"topstand",
|
||||
type:"num5",
|
||||
picUrl:"",
|
||||
assetUrl:modelurl+"/models/station/fuzhou/topstation.FBX"
|
||||
}
|
||||
//modelurl+"/models/station/fuzhou/fuzhou.FBX"
|
||||
//https://test.joylink.club/oss/models/station/fuzhou/fuzhou.FBX
|
||||
//https://joylink.club/oss/models/station/fuzhou/fuzhou.FBX
|
||||
@ -65,7 +74,16 @@ let defaultsuidao = {
|
||||
deviceType:"suidao",
|
||||
type:"suidao",
|
||||
picUrl:"",
|
||||
assetUrl:"../../static/model/suidao/suidao.FBX"
|
||||
assetUrl:modelurl+"/models/suidao/suidao.FBX"
|
||||
}
|
||||
|
||||
let defaultbackground = {
|
||||
id:"16",
|
||||
name:"background",
|
||||
deviceType:"background",
|
||||
type:"background",
|
||||
picUrl:"",
|
||||
assetUrl:modelurl+"/models/suidao/background.FBX"
|
||||
}
|
||||
//modelurl+"/models/suidao/suidao.FBX"
|
||||
//https://test.joylink.club/oss/models/suidao/suidao.FBX
|
||||
@ -134,12 +152,18 @@ export function AssetLoader(){
|
||||
let station = new AssetModel(defaultstation);
|
||||
scope.modellist.push(station);
|
||||
|
||||
let topstation = new AssetModel(defaulttopstation);
|
||||
scope.modellist.push(topstation);
|
||||
|
||||
let driver = new AssetModel(defaultdriver);
|
||||
scope.modellist.push(driver);
|
||||
|
||||
let suidao = new AssetModel(defaultsuidao);
|
||||
scope.modellist.push(suidao);
|
||||
|
||||
let background = new AssetModel(defaultbackground);
|
||||
scope.modellist.push(defaultbackground);
|
||||
|
||||
let defaultswitch1 = new AssetModel(autoswitch1);
|
||||
scope.modellist.push(defaultswitch1);
|
||||
|
||||
@ -202,6 +226,9 @@ export function AssetLoader(){
|
||||
let station = new AssetModel(defaultstation);
|
||||
scope.modellist.push(station);
|
||||
|
||||
let topstation = new AssetModel(defaulttopstation);
|
||||
scope.modellist.push(topstation);
|
||||
|
||||
let autorail = new AssetModel(defaultautorail);
|
||||
scope.modellist.push(autorail);
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/**
|
||||
* @author Kyle-Larson https://github.com/Kyle-Larson
|
||||
* @author Takahiro https://github.com/takahirox
|
||||
@ -28,21 +27,19 @@ THREE.FBXLoader = ( function () {
|
||||
|
||||
function FBXLoader( manager ) {
|
||||
|
||||
this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;
|
||||
THREE.Loader.call( this, manager );
|
||||
|
||||
}
|
||||
|
||||
FBXLoader.prototype = {
|
||||
FBXLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype ), {
|
||||
|
||||
constructor: FBXLoader,
|
||||
|
||||
crossOrigin: 'anonymous',
|
||||
|
||||
load: function ( url, onLoad, onProgress, onError ) {
|
||||
|
||||
var self = this;
|
||||
|
||||
var path = ( self.path === undefined ) ? THREE.LoaderUtils.extractUrlBase( url ) : self.path;
|
||||
var path = ( self.path === '' ) ? THREE.LoaderUtils.extractUrlBase( url ) : self.path;
|
||||
|
||||
var loader = new THREE.FileLoader( this.manager );
|
||||
loader.setPath( self.path );
|
||||
@ -70,27 +67,6 @@ THREE.FBXLoader = ( function () {
|
||||
|
||||
},
|
||||
|
||||
setPath: function ( value ) {
|
||||
|
||||
this.path = value;
|
||||
return this;
|
||||
|
||||
},
|
||||
|
||||
setResourcePath: function ( value ) {
|
||||
|
||||
this.resourcePath = value;
|
||||
return this;
|
||||
|
||||
},
|
||||
|
||||
setCrossOrigin: function ( value ) {
|
||||
|
||||
this.crossOrigin = value;
|
||||
return this;
|
||||
|
||||
},
|
||||
|
||||
parse: function ( FBXBuffer, path ) {
|
||||
|
||||
if ( isFbxFormatBinary( FBXBuffer ) ) {
|
||||
@ -117,18 +93,21 @@ THREE.FBXLoader = ( function () {
|
||||
|
||||
}
|
||||
|
||||
var textureLoader = new THREE.TextureLoader( this.manager ).setPath( this.resourcePath || path ).setCrossOrigin( 'anonymous' );
|
||||
// console.log( fbxTree );
|
||||
|
||||
return new FBXTreeParser( textureLoader ).parse( fbxTree );
|
||||
var textureLoader = new THREE.TextureLoader( this.manager ).setPath( this.resourcePath || path ).setCrossOrigin( this.crossOrigin );
|
||||
|
||||
return new FBXTreeParser( textureLoader, this.manager ).parse( fbxTree );
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
} );
|
||||
|
||||
// Parse the FBXTree object returned by the BinaryParser or TextParser and return a THREE.Group
|
||||
function FBXTreeParser( textureLoader ) {
|
||||
function FBXTreeParser( textureLoader, manager ) {
|
||||
|
||||
this.textureLoader = textureLoader;
|
||||
this.manager = manager;
|
||||
|
||||
}
|
||||
|
||||
@ -287,27 +266,15 @@ THREE.FBXLoader = ( function () {
|
||||
|
||||
case 'tga':
|
||||
|
||||
if ( typeof THREE.TGALoader !== 'function' ) {
|
||||
if ( this.manager.getHandler( '.tga' ) === null ) {
|
||||
|
||||
console.warn( 'FBXLoader: THREE.TGALoader is required to load TGA textures' );
|
||||
return;
|
||||
|
||||
} else {
|
||||
|
||||
if ( THREE.Loader.Handlers.get( '.tga' ) === null ) {
|
||||
|
||||
var tgaLoader = new THREE.TGALoader();
|
||||
tgaLoader.setPath( this.textureLoader.path );
|
||||
|
||||
THREE.Loader.Handlers.add( /\.tga$/i, tgaLoader );
|
||||
|
||||
}
|
||||
|
||||
type = 'image/tga';
|
||||
break;
|
||||
console.warn( 'FBXLoader: TGA loader not found, skipping ', fileName );
|
||||
|
||||
}
|
||||
|
||||
type = 'image/tga';
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
console.warn( 'FBXLoader: Image type "' + extension + '" is not supported.' );
|
||||
@ -412,11 +379,11 @@ THREE.FBXLoader = ( function () {
|
||||
|
||||
if ( extension === 'tga' ) {
|
||||
|
||||
var loader = THREE.Loader.Handlers.get( '.tga' );
|
||||
var loader = this.manager.getHandler( '.tga' );
|
||||
|
||||
if ( loader === null ) {
|
||||
|
||||
console.warn( 'FBXLoader: TGALoader not found, creating empty placeholder texture for', fileName );
|
||||
console.warn( 'FBXLoader: TGA loader not found, creating placeholder texture for', textureNode.RelativeFilename );
|
||||
texture = new THREE.Texture();
|
||||
|
||||
} else {
|
||||
@ -427,7 +394,7 @@ THREE.FBXLoader = ( function () {
|
||||
|
||||
} else if ( extension === 'psd' ) {
|
||||
|
||||
console.warn( 'FBXLoader: PSD textures are not supported, creating empty placeholder texture for', fileName );
|
||||
console.warn( 'FBXLoader: PSD textures are not supported, creating placeholder texture for', textureNode.RelativeFilename );
|
||||
texture = new THREE.Texture();
|
||||
|
||||
} else {
|
||||
@ -549,9 +516,9 @@ THREE.FBXLoader = ( function () {
|
||||
|
||||
}
|
||||
|
||||
if ( materialNode.EmissiveFactor ) {
|
||||
|
||||
if(materialNode.Opacity.value<1 && materialNode.Opacity.value>0.9){
|
||||
if ( materialNode.EmissiveFactor ) {
|
||||
parameters.emissiveIntensity = parseFloat( materialNode.EmissiveFactor.value );
|
||||
if(materialNode.Opacity.value<1 && materialNode.Opacity.value>0.9){
|
||||
parameters.side = THREE.DoubleSide;
|
||||
parameters.transparent = true;
|
||||
// parameters.alphaTest = 0.7;
|
||||
@ -564,8 +531,8 @@ THREE.FBXLoader = ( function () {
|
||||
}
|
||||
|
||||
if ( materialNode.Opacity ) {
|
||||
if(materialNode.Opacity.value<1 && materialNode.Opacity.value>0.9){
|
||||
parameters.side = THREE.DoubleSide;
|
||||
if(materialNode.Opacity.value<1 && materialNode.Opacity.value>0.9){
|
||||
parameters.side = THREE.DoubleSide;
|
||||
parameters.transparent = true;
|
||||
// parameters.alphaTest = 0.7;
|
||||
parameters.opacity = 1;
|
||||
@ -621,6 +588,7 @@ THREE.FBXLoader = ( function () {
|
||||
case 'DiffuseColor':
|
||||
case 'Maya|TEX_color_map':
|
||||
parameters.map = self.getTexture( textureMap, child.ID );
|
||||
// parameters.map.encoding = THREE.sRGBEncoding;
|
||||
break;
|
||||
|
||||
case 'DisplacementColor':
|
||||
@ -629,6 +597,7 @@ THREE.FBXLoader = ( function () {
|
||||
|
||||
case 'EmissiveColor':
|
||||
parameters.emissiveMap = self.getTexture( textureMap, child.ID );
|
||||
parameters.emissiveMap.encoding = THREE.sRGBEncoding;
|
||||
break;
|
||||
|
||||
case 'NormalMap':
|
||||
@ -639,16 +608,18 @@ THREE.FBXLoader = ( function () {
|
||||
case 'ReflectionColor':
|
||||
parameters.envMap = self.getTexture( textureMap, child.ID );
|
||||
parameters.envMap.mapping = THREE.EquirectangularReflectionMapping;
|
||||
parameters.envMap.encoding = THREE.sRGBEncoding;
|
||||
break;
|
||||
|
||||
case 'SpecularColor':
|
||||
parameters.specularMap = self.getTexture( textureMap, child.ID );
|
||||
parameters.specularMap.encoding = THREE.sRGBEncoding;
|
||||
break;
|
||||
|
||||
case 'TransparentColor':
|
||||
parameters.alphaMap = self.getTexture( textureMap, child.ID );
|
||||
parameters.transparent = true;
|
||||
parameters.alphaTest = 0.1;
|
||||
parameters.alphaTest = 0.1;
|
||||
break;
|
||||
|
||||
case 'AmbientColor':
|
||||
@ -926,7 +897,8 @@ THREE.FBXLoader = ( function () {
|
||||
|
||||
}
|
||||
|
||||
model.name = THREE.PropertyBinding.sanitizeNodeName( node.attrName );
|
||||
model.name = node.attrName ? THREE.PropertyBinding.sanitizeNodeName( node.attrName ) : '';
|
||||
|
||||
model.ID = id;
|
||||
|
||||
}
|
||||
@ -960,7 +932,8 @@ THREE.FBXLoader = ( function () {
|
||||
bone.matrixWorld.copy( rawBone.transformLink );
|
||||
|
||||
// set name and id here - otherwise in cases where "subBone" is created it will not have a name / id
|
||||
bone.name = THREE.PropertyBinding.sanitizeNodeName( name );
|
||||
|
||||
bone.name = name ? THREE.PropertyBinding.sanitizeNodeName( name ) : '';
|
||||
bone.ID = id;
|
||||
|
||||
skeleton.bones[ i ] = bone;
|
||||
@ -1567,11 +1540,12 @@ THREE.FBXLoader = ( function () {
|
||||
|
||||
},
|
||||
|
||||
|
||||
// Parse single node mesh geometry in FBXTree.Objects.Geometry
|
||||
parseMeshGeometry: function ( relationships, geoNode, deformers ) {
|
||||
|
||||
var skeletons = deformers.skeletons;
|
||||
var morphTargets = deformers.morphTargets;
|
||||
var morphTargets = [];
|
||||
|
||||
var modelNodes = relationships.parents.map( function ( parent ) {
|
||||
|
||||
@ -1590,13 +1564,15 @@ THREE.FBXLoader = ( function () {
|
||||
|
||||
}, null );
|
||||
|
||||
var morphTarget = relationships.children.reduce( function ( morphTarget, child ) {
|
||||
relationships.children.forEach( function ( child ) {
|
||||
|
||||
if ( morphTargets[ child.ID ] !== undefined ) morphTarget = morphTargets[ child.ID ];
|
||||
if ( deformers.morphTargets[ child.ID ] !== undefined ) {
|
||||
|
||||
return morphTarget;
|
||||
morphTargets.push( deformers.morphTargets[ child.ID ] );
|
||||
|
||||
}, null );
|
||||
}
|
||||
|
||||
} );
|
||||
|
||||
// Assume one model and get the preRotation from that
|
||||
// if there is more than one model associated with the geometry this may cause problems
|
||||
@ -1613,12 +1589,12 @@ THREE.FBXLoader = ( function () {
|
||||
|
||||
var transform = generateTransform( transformData );
|
||||
|
||||
return this.genGeometry( geoNode, skeleton, morphTarget, transform );
|
||||
return this.genGeometry( geoNode, skeleton, morphTargets, transform );
|
||||
|
||||
},
|
||||
|
||||
// Generate a THREE.BufferGeometry from a node in FBXTree.Objects.Geometry
|
||||
genGeometry: function ( geoNode, skeleton, morphTarget, preTransform ) {
|
||||
genGeometry: function ( geoNode, skeleton, morphTargets, preTransform ) {
|
||||
|
||||
var geo = new THREE.BufferGeometry();
|
||||
if ( geoNode.attrName ) geo.name = geoNode.attrName;
|
||||
@ -1630,19 +1606,19 @@ THREE.FBXLoader = ( function () {
|
||||
|
||||
preTransform.applyToBufferAttribute( positionAttribute );
|
||||
|
||||
geo.addAttribute( 'position', positionAttribute );
|
||||
geo.setAttribute( 'position', positionAttribute );
|
||||
|
||||
if ( buffers.colors.length > 0 ) {
|
||||
|
||||
geo.addAttribute( 'color', new THREE.Float32BufferAttribute( buffers.colors, 3 ) );
|
||||
geo.setAttribute( 'color', new THREE.Float32BufferAttribute( buffers.colors, 3 ) );
|
||||
|
||||
}
|
||||
|
||||
if ( skeleton ) {
|
||||
|
||||
geo.addAttribute( 'skinIndex', new THREE.Uint16BufferAttribute( buffers.weightsIndices, 4 ) );
|
||||
geo.setAttribute( 'skinIndex', new THREE.Uint16BufferAttribute( buffers.weightsIndices, 4 ) );
|
||||
|
||||
geo.addAttribute( 'skinWeight', new THREE.Float32BufferAttribute( buffers.vertexWeights, 4 ) );
|
||||
geo.setAttribute( 'skinWeight', new THREE.Float32BufferAttribute( buffers.vertexWeights, 4 ) );
|
||||
|
||||
// used later to bind the skeleton to the model
|
||||
geo.FBX_Deformer = skeleton;
|
||||
@ -1656,7 +1632,7 @@ THREE.FBXLoader = ( function () {
|
||||
var normalMatrix = new THREE.Matrix3().getNormalMatrix( preTransform );
|
||||
normalMatrix.applyToBufferAttribute( normalAttribute );
|
||||
|
||||
geo.addAttribute( 'normal', normalAttribute );
|
||||
geo.setAttribute( 'normal', normalAttribute );
|
||||
|
||||
}
|
||||
|
||||
@ -1672,7 +1648,7 @@ THREE.FBXLoader = ( function () {
|
||||
|
||||
}
|
||||
|
||||
geo.addAttribute( name, new THREE.Float32BufferAttribute( buffers.uvs[ i ], 2 ) );
|
||||
geo.setAttribute( name, new THREE.Float32BufferAttribute( buffers.uvs[ i ], 2 ) );
|
||||
|
||||
} );
|
||||
|
||||
@ -1719,7 +1695,7 @@ THREE.FBXLoader = ( function () {
|
||||
|
||||
}
|
||||
|
||||
this.addMorphTargets( geo, geoNode, morphTarget, preTransform );
|
||||
this.addMorphTargets( geo, geoNode, morphTargets, preTransform );
|
||||
|
||||
return geo;
|
||||
|
||||
@ -2092,23 +2068,29 @@ THREE.FBXLoader = ( function () {
|
||||
|
||||
},
|
||||
|
||||
addMorphTargets: function ( parentGeo, parentGeoNode, morphTarget, preTransform ) {
|
||||
addMorphTargets: function ( parentGeo, parentGeoNode, morphTargets, preTransform ) {
|
||||
|
||||
if ( morphTarget === null ) return;
|
||||
if ( morphTargets.length === 0 ) return;
|
||||
|
||||
parentGeo.morphTargetsRelative = true;
|
||||
|
||||
parentGeo.morphAttributes.position = [];
|
||||
// parentGeo.morphAttributes.normal = []; // not implemented
|
||||
|
||||
var self = this;
|
||||
morphTarget.rawTargets.forEach( function ( rawTarget ) {
|
||||
morphTargets.forEach( function ( morphTarget ) {
|
||||
|
||||
var morphGeoNode = fbxTree.Objects.Geometry[ rawTarget.geoID ];
|
||||
morphTarget.rawTargets.forEach( function ( rawTarget ) {
|
||||
|
||||
if ( morphGeoNode !== undefined ) {
|
||||
var morphGeoNode = fbxTree.Objects.Geometry[ rawTarget.geoID ];
|
||||
|
||||
self.genMorphGeometry( parentGeo, parentGeoNode, morphGeoNode, preTransform, rawTarget.name );
|
||||
if ( morphGeoNode !== undefined ) {
|
||||
|
||||
}
|
||||
self.genMorphGeometry( parentGeo, parentGeoNode, morphGeoNode, preTransform, rawTarget.name );
|
||||
|
||||
}
|
||||
|
||||
} );
|
||||
|
||||
} );
|
||||
|
||||
@ -2120,33 +2102,29 @@ THREE.FBXLoader = ( function () {
|
||||
// Normal and position attributes only have data for the vertices that are affected by the morph
|
||||
genMorphGeometry: function ( parentGeo, parentGeoNode, morphGeoNode, preTransform, name ) {
|
||||
|
||||
var morphGeo = new THREE.BufferGeometry();
|
||||
if ( morphGeoNode.attrName ) morphGeo.name = morphGeoNode.attrName;
|
||||
|
||||
var vertexIndices = ( parentGeoNode.PolygonVertexIndex !== undefined ) ? parentGeoNode.PolygonVertexIndex.a : [];
|
||||
|
||||
// make a copy of the parent's vertex positions
|
||||
var vertexPositions = ( parentGeoNode.Vertices !== undefined ) ? parentGeoNode.Vertices.a.slice() : [];
|
||||
|
||||
var morphPositions = ( morphGeoNode.Vertices !== undefined ) ? morphGeoNode.Vertices.a : [];
|
||||
var morphPositionsSparse = ( morphGeoNode.Vertices !== undefined ) ? morphGeoNode.Vertices.a : [];
|
||||
var indices = ( morphGeoNode.Indexes !== undefined ) ? morphGeoNode.Indexes.a : [];
|
||||
|
||||
var length = parentGeo.attributes.position.count * 3;
|
||||
var morphPositions = new Float32Array( length );
|
||||
|
||||
for ( var i = 0; i < indices.length; i ++ ) {
|
||||
|
||||
var morphIndex = indices[ i ] * 3;
|
||||
|
||||
// FBX format uses blend shapes rather than morph targets. This can be converted
|
||||
// by additively combining the blend shape positions with the original geometry's positions
|
||||
vertexPositions[ morphIndex ] += morphPositions[ i * 3 ];
|
||||
vertexPositions[ morphIndex + 1 ] += morphPositions[ i * 3 + 1 ];
|
||||
vertexPositions[ morphIndex + 2 ] += morphPositions[ i * 3 + 2 ];
|
||||
morphPositions[ morphIndex ] = morphPositionsSparse[ i * 3 ];
|
||||
morphPositions[ morphIndex + 1 ] = morphPositionsSparse[ i * 3 + 1 ];
|
||||
morphPositions[ morphIndex + 2 ] = morphPositionsSparse[ i * 3 + 2 ];
|
||||
|
||||
}
|
||||
|
||||
// TODO: add morph normal support
|
||||
var morphGeoInfo = {
|
||||
vertexIndices: vertexIndices,
|
||||
vertexPositions: vertexPositions,
|
||||
vertexPositions: morphPositions,
|
||||
|
||||
};
|
||||
|
||||
var morphBuffers = this.genBuffers( morphGeoInfo );
|
||||
@ -2340,7 +2318,7 @@ THREE.FBXLoader = ( function () {
|
||||
} );
|
||||
|
||||
var geometry = new THREE.BufferGeometry();
|
||||
geometry.addAttribute( 'position', new THREE.BufferAttribute( positions, 3 ) );
|
||||
geometry.setAttribute( 'position', new THREE.BufferAttribute( positions, 3 ) );
|
||||
|
||||
return geometry;
|
||||
|
||||
@ -2528,7 +2506,7 @@ THREE.FBXLoader = ( function () {
|
||||
|
||||
var node = {
|
||||
|
||||
modelName: THREE.PropertyBinding.sanitizeNodeName( rawModel.attrName ),
|
||||
modelName: rawModel.attrName ? THREE.PropertyBinding.sanitizeNodeName( rawModel.attrName ) : '',
|
||||
ID: rawModel.id,
|
||||
initialPosition: [ 0, 0, 0 ],
|
||||
initialRotation: [ 0, 0, 0 ],
|
||||
@ -2583,7 +2561,7 @@ THREE.FBXLoader = ( function () {
|
||||
|
||||
var node = {
|
||||
|
||||
modelName: THREE.PropertyBinding.sanitizeNodeName( rawModel.attrName ),
|
||||
modelName: rawModel.attrName ? THREE.PropertyBinding.sanitizeNodeName( rawModel.attrName ) : '',
|
||||
morphName: fbxTree.Objects.Deformer[ deformerID ].attrName,
|
||||
|
||||
};
|
||||
@ -3283,7 +3261,7 @@ THREE.FBXLoader = ( function () {
|
||||
|
||||
var version = reader.getUint32();
|
||||
|
||||
//console.log( 'THREE.FBXLoader: FBX binary version: ' + version );
|
||||
console.log( 'THREE.FBXLoader: FBX binary version: ' + version );
|
||||
|
||||
var allNodes = new FBXTree();
|
||||
|
||||
|
4149
src/jlmap3d/main/loaders/FBXLoader1.js
Normal file
4149
src/jlmap3d/main/loaders/FBXLoader1.js
Normal file
File diff suppressed because it is too large
Load Diff
@ -18,6 +18,7 @@ export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene,store
|
||||
//console.log(data);
|
||||
//console.log(scope);
|
||||
let sceneload = scene;
|
||||
let backdata = scope;
|
||||
let jlmap3ddata = mapdata;
|
||||
let assetloader = scope.assetloader;
|
||||
let animateswitch = scope.animateswitch;
|
||||
@ -25,6 +26,8 @@ export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene,store
|
||||
let mixers = scope.mixers;
|
||||
let actions = scope.actions;
|
||||
|
||||
let linklist,sectionlist,signallist,stationstandlist,trainlisttest,realsectionlist,rails;
|
||||
|
||||
let loadingInstance = Loading.service({ fullscreen: true });
|
||||
|
||||
|
||||
@ -50,17 +53,17 @@ export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene,store
|
||||
// console.log(data);
|
||||
//初始化轨道和道岔 暂时
|
||||
lengthfact(data);
|
||||
jlmap3ddata.linklist = new LinkList();
|
||||
jlmap3ddata.sectionlist = new SectionList();
|
||||
linklist = new LinkList();
|
||||
sectionlist = new SectionList();
|
||||
//初始化信号机
|
||||
jlmap3ddata.signallist = new SignalList();
|
||||
signallist = new SignalList();
|
||||
//初始化站台
|
||||
jlmap3ddata.stationstandlist = new StationStandList();
|
||||
stationstandlist = new StationStandList();
|
||||
//初始化测试列车
|
||||
jlmap3ddata.trainlisttest = new TrainList();
|
||||
trainlisttest = new TrainList();
|
||||
|
||||
jlmap3ddata.realsectionlist = new RealSectionList();
|
||||
jlmap3ddata.rails = new RailList();
|
||||
realsectionlist = new RealSectionList();
|
||||
rails = new RailList();
|
||||
let loaderdata = JSON.parse(netdata.sections);
|
||||
let switchdata = JSON.parse(netdata.switchs);
|
||||
let signaldata = JSON.parse(netdata.signals);
|
||||
@ -71,32 +74,33 @@ export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene,store
|
||||
assetloader.assetpromise(sceneload)
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
return jlmap3ddata.linklist.loadpromise(loaderdata.link,scene,assetloader);
|
||||
return linklist.loadpromise(loaderdata.link,scene,assetloader);
|
||||
})
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
return jlmap3ddata.stationstandlist.initpromise(mapdata.stationList,mapdata.stationStandList,sceneload,assetloader,netdata.stands,mixers,actions,"02");
|
||||
return stationstandlist.initpromise(mapdata.stationList,mapdata.stationStandList,sceneload,assetloader,netdata.stands,mixers,actions,"02");
|
||||
})
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
//console.log(assetloader);
|
||||
return jlmap3ddata.trainlisttest.initpromise(mapdata.trainList,sceneload,assetloader,mixers,actions,"02");
|
||||
return trainlisttest.initpromise(mapdata.trainList,sceneload,assetloader,mixers,actions,"02");
|
||||
})
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
return jlmap3ddata.sectionlist.loadpromise(jlmap3ddata,assetloader,loaderdata.section,switchdata,sceneload);
|
||||
return sectionlist.loadpromise(linklist,assetloader,loaderdata.section,switchdata,sceneload);
|
||||
})
|
||||
// .then(function(data){
|
||||
// //console.log(data);
|
||||
// return jlmap3ddata.realsectionlist.initpromise(jlmap3ddata,sceneload,assetloader,mixers,actions);
|
||||
// })
|
||||
// // .then(function(data){
|
||||
// // //console.log(data);
|
||||
// // return realsectionlist.initpromise(jlmap3ddata,sceneload,assetloader,mixers,actions);
|
||||
// // })
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
return jlmap3ddata.signallist.initpromise(mapdata.signalList,sceneload,assetloader,netdata.signals);
|
||||
return signallist.initpromise(mapdata.signalList,sceneload,assetloader,netdata.signals);
|
||||
})
|
||||
.then(function(data){
|
||||
return new Promise(function(resolve, reject){
|
||||
jlmap3ddata.rails.init(loaderdata.link,mapdata.linkList,mapdata.sectionList,switchdata,standsdata,sceneload,storemod);
|
||||
let stopoffset = 61.92;
|
||||
rails.init(loaderdata.link,mapdata.linkList,mapdata.sectionList,switchdata, stationstandlist.list,sceneload,storemod,stopoffset);
|
||||
resolve("loadrail");
|
||||
|
||||
});
|
||||
@ -106,23 +110,33 @@ export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene,store
|
||||
if(scope.assetloader.modellist[mn].name && scope.assetloader.modellist[mn].name == "suidao"){
|
||||
// scope.assetloader.modellist[mn].mesh.rotation.x = Math.PI/2;
|
||||
// console.log(scope.assetloader.modellist[mn].mesh.position);
|
||||
scope.assetloader.modellist[mn].mesh.name = "suidao";
|
||||
scene.add(scope.assetloader.modellist[mn].mesh);
|
||||
}
|
||||
if(scope.assetloader.modellist[mn].name && scope.assetloader.modellist[mn].name == "background"){
|
||||
// scope.assetloader.modellist[mn].mesh.rotation.x = Math.PI/2;
|
||||
// console.log(scope.assetloader.modellist[mn].mesh.position);
|
||||
scope.assetloader.modellist[mn].mesh.name = "background";
|
||||
// console.log(scope.assetloader.modellist[mn].mesh);
|
||||
scene.add(scope.assetloader.modellist[mn].mesh);
|
||||
}
|
||||
}
|
||||
|
||||
scope.animateswitch = true;
|
||||
// scope.animateswitch = true;
|
||||
|
||||
mapdata = jlmap3ddata;
|
||||
//console.log(scope);
|
||||
|
||||
//更新相机方向
|
||||
|
||||
scope.updatecamera(mapdata.stationstandlist.group.children[0],"station");
|
||||
|
||||
scope.Subscribe.updatamap(mapdata,scope.materiallist,scope.actions,scope.sceneload);
|
||||
|
||||
updatemenulist(mapdata.stationstandlist.list,mapdata.trainlisttest.list);
|
||||
backdata.loaderdata(sectionlist,linklist,signallist,stationstandlist,trainlisttest,realsectionlist,rails);
|
||||
scope.updatecamera(stationstandlist.group.children[0],"station");
|
||||
//
|
||||
scope.Subscribe.updatamap(sectionlist,linklist,signallist,stationstandlist,trainlisttest,realsectionlist,rails,scope.materiallist,scope.actions,scope.sceneload);
|
||||
//
|
||||
updatemenulist(stationstandlist.list,trainlisttest.list);
|
||||
scope.webwork.postMessage("on");
|
||||
scope.jsonwebwork.postMessage("connect");
|
||||
// console.log(sceneload);
|
||||
loadingInstance.close();
|
||||
});
|
||||
|
||||
|
@ -18,7 +18,6 @@ export function ModelLoad(data,scope,netdata,sectionlist,linklist,signallist,sta
|
||||
//console.log(data);
|
||||
//console.log(scope);
|
||||
let sceneload = scene;
|
||||
// let jlmap3ddata = mapdata;
|
||||
let backdata = scope;
|
||||
let assetloader = scope.assetloader;
|
||||
let animateswitch = scope.animateswitch;
|
||||
@ -97,8 +96,9 @@ export function ModelLoad(data,scope,netdata,sectionlist,linklist,signallist,sta
|
||||
})
|
||||
.then(function(data){
|
||||
return new Promise(function(resolve, reject){
|
||||
let stopoffset = 64;
|
||||
rails.init(loaderdata.link,mapdata.linkList,mapdata.sectionList,switchdata,
|
||||
stationstandlist.list,sceneload,storemod);
|
||||
stationstandlist.list,sceneload,storemod,stopoffset);
|
||||
resolve("loadrail");
|
||||
|
||||
});
|
||||
|
@ -11,6 +11,7 @@ export function LinkList(data){
|
||||
this.linksgroup.name = "link";
|
||||
|
||||
this.initpromise = function(linkdata,scene,assetloader){
|
||||
// console.log("init");
|
||||
return new Promise(function(resolve, reject){
|
||||
linkhelp(linkdata,scene);
|
||||
|
||||
@ -22,6 +23,7 @@ export function LinkList(data){
|
||||
|
||||
this.loadpromise = function(linkdata,scene,assetloader){
|
||||
// console.log(linkdata);
|
||||
console.log("load");
|
||||
return new Promise(function(resolve, reject){
|
||||
scene.add(scope.linksgroup);
|
||||
loadlink(linkdata,scene,assetloader);
|
||||
@ -57,6 +59,7 @@ function linkhelp(data,scene){
|
||||
}
|
||||
|
||||
|
||||
let mergegeometry = new THREE.Geometry();
|
||||
|
||||
function loadlink(data,scene,assetloader){
|
||||
let autorail;
|
||||
@ -80,6 +83,8 @@ function linkhelp(data,scene){
|
||||
|
||||
|
||||
for(let i=0;i<data.length;i++){
|
||||
// console.log("link");
|
||||
// console.log(data[i]);
|
||||
let testmesh2 = autorail.clone(true);
|
||||
testmesh2.code = data[i].code;
|
||||
testmesh2.name = data[i].name;
|
||||
@ -107,9 +112,13 @@ function linkhelp(data,scene){
|
||||
// testmesh2.rotation.x = data[i].rotation._x;
|
||||
// testmesh2.rotation.y = data[i].rotation._y;
|
||||
testmesh2.rotation.z = data[i].rotation._z;
|
||||
scope.linkdata.push(testmesh2);
|
||||
scope.linksgroup.add(testmesh2);
|
||||
testmesh2.updateMatrix();
|
||||
mergegeometry.merge(new THREE.Geometry().fromBufferGeometry(testmesh2.geometry),testmesh2.matrix);
|
||||
// scope.linkdata.push(testmesh2);
|
||||
// scope.linksgroup.add(testmesh2);
|
||||
}
|
||||
let mergemesh = new THREE.Mesh( mergegeometry, autorail.material );
|
||||
scope.linksgroup.add( mergemesh );
|
||||
}
|
||||
|
||||
|
||||
@ -302,6 +311,7 @@ function linkhelp(data,scene){
|
||||
testmesh2.rightlist = autorail.rightlist;
|
||||
testmesh2.leftlist = autorail.leftlist;
|
||||
testmesh2.lengthfact = data.lengthFact;
|
||||
|
||||
scope.linksgroup.add( testmesh2 );
|
||||
scope.linkdata.push(testmesh2);
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ export function RailList(){
|
||||
this.setrail = function(){
|
||||
|
||||
};
|
||||
this.init = function(linkdata,linklist,sectiondata,switchdata,standsdata,scene,storemod){
|
||||
this.init = function(linkdata,linklist,sectiondata,switchdata,standsdata,scene,storemod,stopoffset){
|
||||
for(let i=0;i<linkdata.length;i++){
|
||||
scope.linkrail[linkdata[i].code] = {
|
||||
lp:linkdata[i].rail[0],
|
||||
@ -132,53 +132,41 @@ export function RailList(){
|
||||
|
||||
for(let i=0;i<switchdata.length;i++){
|
||||
|
||||
const ddd = storemod.getters['map/getDeviceByCode'](switchdata[i].code);
|
||||
scope.switchrail[switchdata[i].code].locateType = ddd.locateType;
|
||||
if(ddd.locateType == "01"){
|
||||
//1--向左 2--向右
|
||||
//__\__ __/__
|
||||
if(scope.switchrail[switchdata[i].code].directtype == "1"){
|
||||
scope.linkrail[switchdata[i].alink].lconnect = switchdata[i].blink;
|
||||
scope.linkrail[switchdata[i].blink].rconnect = switchdata[i].alink;
|
||||
}else if(scope.switchrail[switchdata[i].code].directtype == "2"){
|
||||
scope.linkrail[switchdata[i].alink].rconnect = switchdata[i].blink;
|
||||
scope.linkrail[switchdata[i].blink].lconnect = switchdata[i].alink;
|
||||
}
|
||||
}else if(ddd.locateType == "02"){
|
||||
if(switchdata[i].directtype == "1"){
|
||||
scope.linkrail[switchdata[i].alink].lconnect = switchdata[i].clink;
|
||||
scope.linkrail[switchdata[i].clink].rconnect = switchdata[i].alink;
|
||||
}else if(switchdata[i].directtype == "2"){
|
||||
scope.linkrail[switchdata[i].alink].rconnect = switchdata[i].clink;
|
||||
scope.linkrail[switchdata[i].clink].lconnect = switchdata[i].alink;
|
||||
}
|
||||
}
|
||||
// const ddd = storemod.getters['map/getDeviceByCode'](switchdata[i].code);
|
||||
// scope.switchrail[switchdata[i].code].locateType = ddd.locateType;
|
||||
// if(ddd.locateType == "01"){
|
||||
// //1--向左 2--向右
|
||||
// //__\__ __/__
|
||||
// if(scope.switchrail[switchdata[i].code].directtype == "1"){
|
||||
// scope.linkrail[switchdata[i].alink].lconnect = switchdata[i].blink;
|
||||
// scope.linkrail[switchdata[i].blink].rconnect = switchdata[i].alink;
|
||||
// }else if(scope.switchrail[switchdata[i].code].directtype == "2"){
|
||||
// scope.linkrail[switchdata[i].alink].rconnect = switchdata[i].blink;
|
||||
// scope.linkrail[switchdata[i].blink].lconnect = switchdata[i].alink;
|
||||
// }
|
||||
// }else if(ddd.locateType == "02"){
|
||||
// if(switchdata[i].directtype == "1"){
|
||||
// scope.linkrail[switchdata[i].alink].lconnect = switchdata[i].clink;
|
||||
// scope.linkrail[switchdata[i].clink].rconnect = switchdata[i].alink;
|
||||
// }else if(switchdata[i].directtype == "2"){
|
||||
// scope.linkrail[switchdata[i].alink].rconnect = switchdata[i].clink;
|
||||
// scope.linkrail[switchdata[i].clink].lconnect = switchdata[i].alink;
|
||||
// }
|
||||
// }
|
||||
|
||||
if(scope.linkrail[switchdata[i].blink].lp.x < switchdata[i].position.x){
|
||||
// scope.linkrail[switchdata[i].blink].points.push(new THREE.Vector3(switchdata[i].position.x-2,switchdata[i].position.y,switchdata[i].position.z));
|
||||
// scope.linkrail[switchdata[i].blink].points.push(new THREE.Vector3(switchdata[i].position.x,switchdata[i].position.y,switchdata[i].position.z));
|
||||
// scope.linkrail[switchdata[i].blink].points.push(new THREE.Vector3(switchdata[i].position.x+1.5,switchdata[i].position.y,switchdata[i].position.z));
|
||||
//
|
||||
|
||||
scope.switchrail[switchdata[i].code].directtype = "1";
|
||||
}else{
|
||||
// scope.linkrail[switchdata[i].blink].points.splice(0,0,new THREE.Vector3(switchdata[i].position.x+2,switchdata[i].position.y,switchdata[i].position.z));
|
||||
// scope.linkrail[switchdata[i].blink].points.splice(0,0,new THREE.Vector3(switchdata[i].position.x,switchdata[i].position.y,switchdata[i].position.z));
|
||||
// scope.linkrail[switchdata[i].blink].points.splice(0,0,new THREE.Vector3(switchdata[i].position.x-1.5,switchdata[i].position.y,switchdata[i].position.z));
|
||||
//
|
||||
|
||||
scope.switchrail[switchdata[i].code].directtype = "2";
|
||||
}
|
||||
|
||||
if(scope.linkrail[switchdata[i].clink].lp.x < switchdata[i].position.x){
|
||||
// // scope.linkrail[switchdata[i].clink].points.push(new THREE.Vector3(switchdata[i].position.x-3.5,switchdata[i].position.y,switchdata[i].position.z+0.02));
|
||||
// scope.linkrail[switchdata[i].clink].points.push(new THREE.Vector3(switchdata[i].position.x,switchdata[i].position.y,switchdata[i].position.z));
|
||||
// scope.linkrail[switchdata[i].clink].points.push(new THREE.Vector3(switchdata[i].position.x+1.5,switchdata[i].position.y,switchdata[i].position.z));
|
||||
//
|
||||
|
||||
scope.switchrail[switchdata[i].code].directtype = "1";
|
||||
}else{
|
||||
// // scope.linkrail[switchdata[i].clink].points.splice(0,0,new THREE.Vector3(switchdata[i].position.x+3.5,switchdata[i].position.y,switchdata[i].position.z-0.02));
|
||||
// scope.linkrail[switchdata[i].clink].points.splice(0,0,new THREE.Vector3(switchdata[i].position.x,switchdata[i].position.y,switchdata[i].position.z));
|
||||
// scope.linkrail[switchdata[i].clink].points.splice(0,0,new THREE.Vector3(switchdata[i].position.x-1.5,switchdata[i].position.y,switchdata[i].position.z));
|
||||
//
|
||||
|
||||
scope.switchrail[switchdata[i].code].directtype = "2";
|
||||
}
|
||||
}
|
||||
@ -259,15 +247,15 @@ export function RailList(){
|
||||
// let circle2 = new THREE.Mesh( geometry, material );
|
||||
let num = scope.linkrail[linklist[j].code].lineleft.points.length-1;
|
||||
let lengthfacts = scope.linkrail[linklist[j].code].lineleft.points[num].x - scope.linkrail[linklist[j].code].lineleft.points[0].x;
|
||||
let directoffset1 = standsdata[k].position.x-64-scope.linkrail[linklist[j].code].lineleft.points[0].x;
|
||||
let directoffset1 = standsdata[k].position.x-stopoffset-scope.linkrail[linklist[j].code].lineleft.points[0].x;
|
||||
stop.direct1.percent = directoffset1/lengthfacts;
|
||||
|
||||
// circle1.position.x = standsdata[k].position.x+64;
|
||||
// circle1.position.x = standsdata[k].position.x+stopoffset;
|
||||
// circle1.position.y = 5;
|
||||
// circle1.position.z = scope.linkrail[linklist[j].code].points[0].z;
|
||||
// circle1.rotation.x = -Math.PI/2;
|
||||
//
|
||||
// circle2.position.x = standsdata[k].position.x-64;
|
||||
// circle2.position.x = standsdata[k].position.x-stopoffset;
|
||||
// circle2.position.y = 5;
|
||||
// circle2.position.z = scope.linkrail[linklist[j].code].points[0].z;
|
||||
// circle2.rotation.x = -Math.PI/2;
|
||||
@ -282,7 +270,7 @@ export function RailList(){
|
||||
let num = scope.linkrail[linklist[j].code].lineleft.points.length-1;
|
||||
let lengthfacts = scope.linkrail[linklist[j].code].lineleft.points[num].x - scope.linkrail[linklist[j].code].lineleft.points[0].x;
|
||||
|
||||
let directoffset2 = parseInt(standsdata[k].position.x+64-scope.linkrail[linklist[j].code].lineleft.points[0].x);
|
||||
let directoffset2 = parseInt(standsdata[k].position.x+stopoffset-scope.linkrail[linklist[j].code].lineleft.points[0].x);
|
||||
// console.log(directoffset2);
|
||||
stop.direct2.percent = directoffset2/lengthfacts;
|
||||
// console.log("test");
|
||||
@ -294,9 +282,9 @@ export function RailList(){
|
||||
// console.log(lengthfacts);
|
||||
// console.log("........................");
|
||||
// console.log(standsections[i].leftStopPointOffset);
|
||||
// console.log(standsdata[n].position.x-64-scope.linkrail[linklist[j].code].lineleft.points[0].x);
|
||||
// console.log(standsdata[n].position.x-stopoffset-scope.linkrail[linklist[j].code].lineleft.points[0].x);
|
||||
// console.log("........................");
|
||||
// console.log(standsdata[n].position.x+64);
|
||||
// console.log(standsdata[n].position.x+stopoffset);
|
||||
// console.log(scope.linkrail[linklist[j].code].lineleft.getPointAt(stop.direct1.percent).x);
|
||||
// console.log("sectoffsetright");
|
||||
// console.log(scope.linkrail[linklist[j].code]);
|
||||
@ -305,16 +293,16 @@ export function RailList(){
|
||||
// console.log(lengthfacts);
|
||||
// console.log("........................");
|
||||
// console.log(standsections[i].rightStopPointOffset);
|
||||
// console.log(standsdata[k].position.x+64-scope.linkrail[linklist[j].code].lineleft.points[0].x);
|
||||
// console.log(standsdata[k].position.x+stopoffset-scope.linkrail[linklist[j].code].lineleft.points[0].x);
|
||||
// console.log("........................");
|
||||
// console.log(standsdata[k].position.x+64);
|
||||
// console.log(standsdata[k].position.x+stopoffset);
|
||||
// console.log(scope.linkrail[linklist[j].code].lineleft.getPointAt(stop.direct2.percent).x);
|
||||
// circle1.position.x = standsdata[k].position.x+64;
|
||||
// circle1.position.x = standsdata[k].position.x+stopoffset;
|
||||
// circle1.position.y = 5;
|
||||
// circle1.position.z = scope.linkrail[linklist[j].code].points[0].z;
|
||||
// circle1.rotation.x = -Math.PI/2;
|
||||
// //
|
||||
// circle2.position.x = standsdata[k].position.x-64;
|
||||
// circle2.position.x = standsdata[k].position.x-stopoffset;
|
||||
// circle2.position.y = 5;
|
||||
// circle2.position.z = scope.linkrail[linklist[j].code].points[0].z;
|
||||
// circle2.rotation.x = -Math.PI/2;
|
||||
|
@ -96,6 +96,7 @@ export function RealSectionList(data) {
|
||||
}
|
||||
|
||||
if(name[0] == "Singal"){
|
||||
console.log();
|
||||
newmesh.remove(newmesh.children[i]);
|
||||
i = i-1;
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ import {SectionModel} from '@/jlmap3d/edit/editmodel/SectionModel.js';
|
||||
import {SwitchModel} from '@/jlmap3d/edit/editmodel/SwitchModel.js';
|
||||
export function SectionList() {
|
||||
|
||||
const scope = this;
|
||||
let scope = this;
|
||||
|
||||
this.type = 'sectionlist';
|
||||
|
||||
@ -30,7 +30,7 @@ export function SectionList() {
|
||||
for (let i=0; i<sectiondata.length; i++) {
|
||||
if (sectiondata[i].type == '01') {
|
||||
// 初始化区段对象数据
|
||||
const newsection = new SectionModel(sectiondata);
|
||||
let newsection = new SectionModel(sectiondata);
|
||||
newsection.name = sectiondata[i].code;
|
||||
newsection.code = sectiondata[i].code;
|
||||
newsection.index = i;
|
||||
@ -50,11 +50,11 @@ export function SectionList() {
|
||||
}
|
||||
|
||||
// 定义区分道岔组
|
||||
const switchlist = [];
|
||||
let switchlist = [];
|
||||
// 遍历道岔数据
|
||||
for (let i=0; i<switchdata.length; i++) {
|
||||
// 道岔信息
|
||||
const newswitch = {
|
||||
let newswitch = {
|
||||
code: null,
|
||||
pa: null,
|
||||
pb: null,
|
||||
@ -89,7 +89,7 @@ export function SectionList() {
|
||||
// 遍历道岔信息组合轨道
|
||||
for (let i=0; i<switchlist.length; i++) {
|
||||
// 道岔对象组
|
||||
const newswitch = new SwitchModel();
|
||||
let newswitch = new SwitchModel();
|
||||
|
||||
newswitch.name = switchlist[i].code;
|
||||
newswitch.code = switchlist[i].code;
|
||||
@ -110,25 +110,25 @@ export function SectionList() {
|
||||
scene.add(switchgroup);
|
||||
let linkdata = linklist;
|
||||
|
||||
for(let i=0;i<sectiondata.length;i++){
|
||||
if(sectiondata[i].type == "01"){
|
||||
//初始化区段对象数据
|
||||
let newsection = new SectionModel(sectiondata);
|
||||
|
||||
newsection.name = sectiondata[i].code;
|
||||
newsection.code = sectiondata[i].code;
|
||||
newsection.index = i;
|
||||
newsection.isStandTrack = sectiondata[i].isStandTrack;
|
||||
newsection.relStandCode = sectiondata[i].relStandCode;
|
||||
newsection.type = sectiondata[i].type;
|
||||
newsection.offsetRight = sectiondata[i].offsetRight;
|
||||
newsection.offsetLeft = sectiondata[i].offsetLeft;
|
||||
newsection.linkCode = sectiondata[i].linkCode;
|
||||
|
||||
scope.sections.datalist.push(newsection);
|
||||
// scope.sections.modellist.push("");
|
||||
}
|
||||
}
|
||||
// for(let i=0;i<sectiondata.length;i++){
|
||||
// if(sectiondata[i].type == "01"){
|
||||
// //初始化区段对象数据
|
||||
// let newsection = new SectionModel(sectiondata);
|
||||
//
|
||||
// newsection.name = sectiondata[i].code;
|
||||
// newsection.code = sectiondata[i].code;
|
||||
// newsection.index = i;
|
||||
// newsection.isStandTrack = sectiondata[i].isStandTrack;
|
||||
// newsection.relStandCode = sectiondata[i].relStandCode;
|
||||
// newsection.type = sectiondata[i].type;
|
||||
// newsection.offsetRight = sectiondata[i].offsetRight;
|
||||
// newsection.offsetLeft = sectiondata[i].offsetLeft;
|
||||
// newsection.linkCode = sectiondata[i].linkCode;
|
||||
//
|
||||
// scope.sections.datalist.push(newsection);
|
||||
// // scope.sections.modellist.push("");
|
||||
// }
|
||||
// }
|
||||
|
||||
let autosuidao;
|
||||
for(let i=0;i<assetloader.modellist.length;i++){
|
||||
@ -139,7 +139,8 @@ export function SectionList() {
|
||||
|
||||
for(let i = 0;i < sectiondata.length;i++){
|
||||
|
||||
let testmesh1 = autosuidao.clone(true);
|
||||
// let testmesh1 = autosuidao.clone(true);
|
||||
let testmesh1 = {};
|
||||
testmesh1.code = sectiondata[i].code;
|
||||
testmesh1.name = sectiondata[i].code;
|
||||
if(sectiondata[i].relStandCode){
|
||||
@ -153,42 +154,42 @@ export function SectionList() {
|
||||
testmesh1.leftpoint = sectiondata[i].leftpoint;
|
||||
testmesh1.isStandTrack = sectiondata[i].isStandTrack;
|
||||
testmesh1.lengthfact = sectiondata[i].lengthfact;
|
||||
for(let i=0;i<testmesh1.rightlist.length;i++){
|
||||
testmesh1.geometry.attributes.position.array[testmesh1.rightlist[i]*3] = testmesh1.lengthfact;
|
||||
testmesh1.geometry.attributes.uv.array[testmesh1.rightlist[i]*2] = (testmesh1.geometry.attributes.position.array[3]-testmesh1.geometry.attributes.position.array[0])/15.3;
|
||||
}
|
||||
let newsuidao = new THREE.BufferGeometry();
|
||||
newsuidao.copy(testmesh1.geometry);
|
||||
testmesh1.geometry = newsuidao;
|
||||
testmesh1.geometry.attributes.position.needsUpdate = true;
|
||||
testmesh1.geometry.attributes.uv.needsUpdate = true;
|
||||
testmesh1.geometry.computeBoundingSphere();
|
||||
testmesh1.geometry.center();
|
||||
testmesh1.position.x = sectiondata[i].position.x;
|
||||
testmesh1.position.y = sectiondata[i].position.y;
|
||||
testmesh1.position.z = sectiondata[i].position.z;
|
||||
testmesh1.rotation.x = -Math.PI/2;
|
||||
testmesh1.rotation.z = sectiondata[i].rotation._z;
|
||||
// for(let i=0;i<testmesh1.rightlist.length;i++){
|
||||
// testmesh1.geometry.attributes.position.array[testmesh1.rightlist[i]*3] = testmesh1.lengthfact;
|
||||
// testmesh1.geometry.attributes.uv.array[testmesh1.rightlist[i]*2] = (testmesh1.geometry.attributes.position.array[3]-testmesh1.geometry.attributes.position.array[0])/15.3;
|
||||
// }
|
||||
// let newsuidao = new THREE.BufferGeometry();
|
||||
// newsuidao.copy(testmesh1.geometry);
|
||||
// testmesh1.geometry = newsuidao;
|
||||
// testmesh1.geometry.attributes.position.needsUpdate = true;
|
||||
// testmesh1.geometry.attributes.uv.needsUpdate = true;
|
||||
// testmesh1.geometry.computeBoundingSphere();
|
||||
// testmesh1.geometry.center();
|
||||
// testmesh1.position.x = sectiondata[i].position.x;
|
||||
// testmesh1.position.y = sectiondata[i].position.y;
|
||||
// testmesh1.position.z = sectiondata[i].position.z;
|
||||
// testmesh1.rotation.x = -Math.PI/2;
|
||||
// testmesh1.rotation.z = sectiondata[i].rotation._z;
|
||||
//
|
||||
// let newsection = new SectionModel(sectiondata);
|
||||
//
|
||||
// newsection.name = sectiondata[i].code;
|
||||
// newsection.code = sectiondata[i].code;
|
||||
// newsection.isStandTrack = sectiondata[i].isStandTrack;
|
||||
// newsection.relStandCode = sectiondata[i].relStandCode;
|
||||
// newsection.linkCode = sectiondata[i].linkCode;
|
||||
|
||||
let newsection = new SectionModel(sectiondata);
|
||||
// scope.sections.datalist.push(newsection);
|
||||
|
||||
newsection.name = sectiondata[i].code;
|
||||
newsection.code = sectiondata[i].code;
|
||||
newsection.isStandTrack = sectiondata[i].isStandTrack;
|
||||
newsection.relStandCode = sectiondata[i].relStandCode;
|
||||
newsection.linkCode = sectiondata[i].linkCode;
|
||||
|
||||
scope.sections.datalist.push(newsection);
|
||||
|
||||
|
||||
if(testmesh1.isStandTrack == false){
|
||||
sectiongroup.add(testmesh1);
|
||||
|
||||
}else{
|
||||
scope.standtrack.push(testmesh1);
|
||||
var box = new THREE.BoxHelper( testmesh1, 0xff0000 );
|
||||
sectiongroup.add( box );
|
||||
}
|
||||
//
|
||||
// if(testmesh1.isStandTrack == false){
|
||||
// sectiongroup.add(testmesh1);
|
||||
//
|
||||
// }else{
|
||||
// scope.standtrack.push(testmesh1);
|
||||
// var box = new THREE.BoxHelper( testmesh1, 0xff0000 );
|
||||
// sectiongroup.add( box );
|
||||
// }
|
||||
scope.sections.modellist.push(testmesh1);
|
||||
}
|
||||
|
||||
@ -202,8 +203,7 @@ export function SectionList() {
|
||||
switchmesh2 = assetloader.modellist[i].mesh;
|
||||
}
|
||||
}
|
||||
// switchmesh1.rotation.x = Math.PI/2;
|
||||
// switchmesh2.rotation.z = Math.PI/2;
|
||||
|
||||
for(let i=0;i<switchdata.length;i++){
|
||||
let newswitch = {
|
||||
code:switchdata[i].code,
|
||||
|
@ -20,19 +20,20 @@ export function SignalList() {
|
||||
netsignal = JSON.parse(netdata);
|
||||
haddata = true;
|
||||
}
|
||||
|
||||
let selectmesh = null;
|
||||
for(let j=0;j<assetloader.modellist.length;j++){
|
||||
if(assetloader.modellist[j].deviceType == "signal"){
|
||||
selectmesh = assetloader.modellist[j].mesh;
|
||||
}
|
||||
}
|
||||
for(let i=0;i<data.length;i++){
|
||||
|
||||
let newsignal = new SignalModel(data[i]);
|
||||
let num;
|
||||
if(haddata == false){
|
||||
for(let j=0;j<assetloader.modellist.length;j++){
|
||||
if(assetloader.modellist[j].deviceType == "signal"){
|
||||
num = j;
|
||||
}
|
||||
}
|
||||
|
||||
let newmesh = assetloader.modellist[num].mesh.clone(true);
|
||||
|
||||
let newmesh = selectmesh.clone(true);
|
||||
for(let j=0;j<newmesh.children.length;j++){
|
||||
newmesh.children[j].material.map.uuid = data[i].code+j;
|
||||
console.log(newmesh.children[j].material.map.uuid);
|
||||
|
@ -24,6 +24,20 @@ export function StationStandList() {
|
||||
|
||||
scope.group.name = "station";
|
||||
scene.add(scope.group);
|
||||
|
||||
let selectmesh = null;
|
||||
let topstationmesh = null;
|
||||
let num = null;
|
||||
for(let j=0;j<assetloader.modellist.length;j++){
|
||||
if(assetloader.modellist[j].deviceType == "stand"){
|
||||
num = j;
|
||||
selectmesh = assetloader.modellist[num].mesh;
|
||||
}
|
||||
if(assetloader.modellist[j].deviceType == "topstand"){
|
||||
topstationmesh = assetloader.modellist[j].mesh;
|
||||
}
|
||||
}
|
||||
// console.log(haddata);
|
||||
//遍历车站数据
|
||||
for(let i=0;i<stationdata.length;i++){
|
||||
|
||||
@ -65,11 +79,7 @@ export function StationStandList() {
|
||||
|
||||
let num;
|
||||
if(haddata == false){
|
||||
for(let j=0;j<assetloader.modellist.length;j++){
|
||||
if(assetloader.modellist[j].deviceType == "stand"){
|
||||
num = j;
|
||||
}
|
||||
}
|
||||
|
||||
map[k].mesh = assetloader.modellist[num].mesh.clone(true);
|
||||
map[k].id = assetloader.modellist[num].id;
|
||||
map[k].mesh.code = map[k].code;
|
||||
@ -107,7 +117,7 @@ export function StationStandList() {
|
||||
if(assetloader.modellist[j].id == netstand[netnum].modelid){
|
||||
num = j;
|
||||
map[k].index = netnum;
|
||||
j = assetloader.modellist.length;
|
||||
// j = assetloader.modellist.length;
|
||||
}
|
||||
}
|
||||
|
||||
@ -116,10 +126,8 @@ export function StationStandList() {
|
||||
}
|
||||
|
||||
}
|
||||
map[k].mesh = assetloader.modellist[num].mesh.clone(true);
|
||||
let newclip = assetloader.modellist[num].mesh.animations[ 0 ];
|
||||
|
||||
|
||||
map[k].mesh = selectmesh.clone(true);
|
||||
let newclip = selectmesh.animations[ 0 ];
|
||||
|
||||
for(let j=0;j<map[k].mesh.children.length;j++){
|
||||
|
||||
@ -140,7 +148,6 @@ export function StationStandList() {
|
||||
mixers.push(mixer);
|
||||
}
|
||||
if(map[k].mesh.children[j].name == "down"){
|
||||
let newclip = assetloader.modellist[num].mesh.animations[ 0 ];
|
||||
map[k].mesh.children[j].animations = [];
|
||||
map[k].mesh.children[j].animations.push(newclip.clone());
|
||||
|
||||
@ -167,6 +174,7 @@ export function StationStandList() {
|
||||
map[k].mesh.position.x = netstand[map[k].index].position.x;
|
||||
map[k].mesh.position.y = netstand[map[k].index].position.y;
|
||||
map[k].mesh.position.z = netstand[map[k].index].position.z;
|
||||
|
||||
// map[k].mesh.rotation.x = netstand[map[k].index].rotation._x;
|
||||
// map[k].mesh.rotation.y = netstand[map[k].index].rotation._y;
|
||||
// map[k].mesh.rotation.z = netstand[map[k].index].rotation._z;
|
||||
@ -189,19 +197,19 @@ export function StationStandList() {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
map[k].type = "station";
|
||||
map[k].rname = stationdata[map[k].num].runPlanName;
|
||||
map[k].kmmark = stationdata[map[k].num].kmPost;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
scope.group.add(map[k].mesh);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -236,7 +244,7 @@ function getTextCanvas(text){
|
||||
ctx.drawImage(stationcanvas,0,0,256,512);
|
||||
|
||||
ctx.font = "20px Verdana";
|
||||
ctx.fillText("车站名称: "+text.runPlanName, 20,58);
|
||||
ctx.fillText("车站名称: "+text.name, 20,58);
|
||||
|
||||
ctx.fillText("漫游", 30,100);
|
||||
ctx.fillText("信息", 114,100);
|
||||
|
@ -9,46 +9,56 @@ export function TrainList() {
|
||||
this.list = {};
|
||||
|
||||
this.group = new THREE.Group();
|
||||
|
||||
this.group.name = "train";
|
||||
this.textlist = [];
|
||||
|
||||
this.initpromise = function(data,scene,assetloader,mixers,actionss,mode){
|
||||
return new Promise(function(resolve, reject){
|
||||
let selectmesh,ntracks1,ntracks2,tclip,fclip;
|
||||
for(let n=assetloader.modellist.length-1;n>=0;n--){
|
||||
if(assetloader.modellist[n].deviceType == "train"){
|
||||
|
||||
selectmesh = assetloader.modellist[n].mesh
|
||||
|
||||
ntracks1 = assetloader.modellist[n].animations.slice(24,52);
|
||||
|
||||
tclip = new THREE.AnimationClip("three",2,ntracks1);
|
||||
|
||||
ntracks2 = assetloader.modellist[n].animations.slice(0,24);
|
||||
|
||||
fclip = new THREE.AnimationClip("four",2,ntracks2);
|
||||
|
||||
n = 0;
|
||||
}
|
||||
}
|
||||
//遍历列车数据
|
||||
// console.log(data.length);
|
||||
for(let i=0;i<data.length;i++){
|
||||
|
||||
let newmesh,ntracks1,ntracks2,tclip,fclip;
|
||||
for(let n=assetloader.modellist.length-1;n>=0;n--){
|
||||
if(assetloader.modellist[n].deviceType == "train"){
|
||||
|
||||
newmesh = assetloader.modellist[n].mesh.clone(true);
|
||||
|
||||
ntracks1 = assetloader.modellist[n].animations.slice(24,52);
|
||||
|
||||
tclip = new THREE.AnimationClip("three",2,ntracks1);
|
||||
|
||||
ntracks2 = assetloader.modellist[n].animations.slice(0,24);
|
||||
|
||||
fclip = new THREE.AnimationClip("four",2,ntracks2);
|
||||
|
||||
n = 0;
|
||||
}
|
||||
}
|
||||
actionss[data[i].code] = {
|
||||
top:[],
|
||||
down:[]
|
||||
};
|
||||
|
||||
let newmesh = selectmesh.clone(true);
|
||||
newmesh.mixer = [];
|
||||
// console.log("-------------------------");
|
||||
// console.log(data[i]);
|
||||
for(let j=0;j<newmesh.children.length;j++){
|
||||
|
||||
if(newmesh.children[j].name == "c1" || newmesh.children[j].name == "c6"){
|
||||
for(let n=0;n<newmesh.children[j].children.length;n++){
|
||||
// console.log("===================");
|
||||
for(let n=0,lenn = newmesh.children[j].children.length;n<lenn;n++){
|
||||
|
||||
if(newmesh.children[j].children[n].name == "top"){
|
||||
newmesh.children[j].children[n].animations = [];
|
||||
newmesh.children[j].children[n].animations.push(tclip.clone());
|
||||
let mixer = new THREE.AnimationMixer( newmesh.children[j].children[n] );
|
||||
mixers.push(mixer);
|
||||
// console.log(n);
|
||||
// console.log(newmesh.children[j].children[n]);
|
||||
newmesh.mixer.push(mixer);
|
||||
newmesh.mixerpush = false;
|
||||
// mixers.push(mixer);
|
||||
let action = mixer.clipAction( newmesh.children[j].children[n].animations[ 0 ] );
|
||||
//action.play();
|
||||
action.setLoop(THREE.LoopOnce);
|
||||
@ -61,7 +71,10 @@ export function TrainList() {
|
||||
newmesh.children[j].children[n].animations = [];
|
||||
newmesh.children[j].children[n].animations.push(tclip.clone());
|
||||
let mixer = new THREE.AnimationMixer( newmesh.children[j].children[n] );
|
||||
mixers.push(mixer);
|
||||
|
||||
newmesh.mixer.push(mixer);
|
||||
newmesh.mixerpush = false;
|
||||
// mixers.push(mixer);
|
||||
let action = mixer.clipAction( newmesh.children[j].children[n].animations[ 0 ] );
|
||||
//action.play();
|
||||
action.setLoop(THREE.LoopOnce);
|
||||
@ -70,12 +83,14 @@ export function TrainList() {
|
||||
}
|
||||
}
|
||||
}else{
|
||||
for(let n=0;n<newmesh.children[j].children.length;n++){
|
||||
for(let n=0,lenn = newmesh.children[j].children.length;n<lenn;n++){
|
||||
if(newmesh.children[j].children[n].name == "top"){
|
||||
newmesh.children[j].children[n].animations = [];
|
||||
newmesh.children[j].children[n].animations.push(fclip.clone());
|
||||
let mixer = new THREE.AnimationMixer( newmesh.children[j].children[n] );
|
||||
mixers.push(mixer);
|
||||
newmesh.mixer.push(mixer);
|
||||
newmesh.mixerpush = false;
|
||||
// mixers.push(mixer);
|
||||
let action = mixer.clipAction( newmesh.children[j].children[n].animations[ 0 ] );
|
||||
//action.play();
|
||||
action.setLoop(THREE.LoopOnce);
|
||||
@ -87,7 +102,9 @@ export function TrainList() {
|
||||
newmesh.children[j].children[n].animations = [];
|
||||
newmesh.children[j].children[n].animations.push(fclip.clone());
|
||||
let mixer = new THREE.AnimationMixer( newmesh.children[j].children[n] );
|
||||
mixers.push(mixer);
|
||||
newmesh.mixer.push(mixer);
|
||||
newmesh.mixerpush = false;
|
||||
// mixers.push(mixer);
|
||||
let action = mixer.clipAction( newmesh.children[j].children[n].animations[ 0 ] );
|
||||
//action.play();
|
||||
action.setLoop(THREE.LoopOnce);
|
||||
@ -100,12 +117,13 @@ export function TrainList() {
|
||||
newmesh.children[j].code = data[i].code;
|
||||
newmesh.children[j].axis = new THREE.Vector3();
|
||||
newmesh.children[j].up = new THREE.Vector3(1, 0, 0);
|
||||
newmesh.axis = new THREE.Vector3();
|
||||
newmesh.up = new THREE.Vector3(1, 0, 0);
|
||||
// newmesh.axis = new THREE.Vector3();
|
||||
// newmesh.up = new THREE.Vector3(1, 0, 0);
|
||||
// var pos = new THREE.Mesh( geometryp, materialp);
|
||||
// pos.position.x = -73.5;
|
||||
// newmesh.children[j].add( pos );
|
||||
newmesh.children[j].rotalist = [];
|
||||
// console.log(newmesh);
|
||||
}
|
||||
//
|
||||
// // newmesh.children[4].add(newmesh.children[5]);
|
||||
@ -122,7 +140,11 @@ export function TrainList() {
|
||||
if(mode == "02"){
|
||||
let textgeometry = new THREE.PlaneBufferGeometry( 150, 100, 1 );
|
||||
let textt = new THREE.CanvasTexture(getTextCanvas(data[i]));
|
||||
let textmaterial = new THREE.MeshBasicMaterial( { side: THREE.DoubleSide,map:textt ,transparent: true} );
|
||||
let textmaterial = new THREE.MeshBasicMaterial( {
|
||||
side: THREE.DoubleSide,
|
||||
map:textt ,transparent: true,
|
||||
alphaTest:0.1
|
||||
} );
|
||||
let textplane = new THREE.Mesh( textgeometry, textmaterial );
|
||||
textplane.name = data[i].code;
|
||||
textplane.position.x = 0;
|
||||
@ -165,6 +187,11 @@ export function TrainList() {
|
||||
scope.list[data[i].code] = newmesh;
|
||||
//scene.add(newmesh);
|
||||
}
|
||||
// console.log(selectmesh);
|
||||
// for(let i=0,leni=selectmesh.children.length;i<leni;i++){
|
||||
// selectmesh.children[i].geometry.dispose();
|
||||
// selectmesh.children[i].material.dispose();
|
||||
// }
|
||||
scene.add(scope.group);
|
||||
resolve("loadedtrain");
|
||||
});
|
||||
|
@ -5,7 +5,6 @@
|
||||
<template v-show="isShowMenu">
|
||||
<menu-bar ref="menuBar" :selected="selected" />
|
||||
<menu-tool ref="menuTool" :selected="selected" />
|
||||
<status-bar ref="statusBar" :selected="selected" />
|
||||
</template>
|
||||
<menu-station-control ref="menuStationControl" :selected="selected" />
|
||||
<menu-station-stand ref="menuStationStand" :selected="selected" />
|
||||
@ -33,7 +32,6 @@ import MenuTrain from './menuTrain';
|
||||
import MenuStation from './menuStation';
|
||||
import MenuBar from './menuBar';
|
||||
import MenuTool from './menuTool';
|
||||
import StatusBar from './statusBar';
|
||||
import PassiveAlarm from './passiveDialog/alarm';
|
||||
import PassiveContorl from './passiveDialog/control';
|
||||
import PassiveTimeout from './passiveDialog/timeout';
|
||||
@ -43,7 +41,6 @@ export default {
|
||||
components: {
|
||||
MenuBar,
|
||||
MenuTool,
|
||||
StatusBar,
|
||||
MenuCancel,
|
||||
MenuSignal,
|
||||
MenuSwitch,
|
||||
|
@ -1,31 +0,0 @@
|
||||
<template>
|
||||
<div id="statusBar"></div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'StatusBar',
|
||||
props: {
|
||||
selected: {
|
||||
type: Object
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
#statusBar {
|
||||
z-index: 1000;
|
||||
position: absolute;
|
||||
height: $height;
|
||||
line-height: $height;
|
||||
border-radius: 0px !important;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
}
|
||||
</style>
|
@ -1,31 +0,0 @@
|
||||
<template>
|
||||
<div id="statusDownTrainDetail"></div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'StatusDownTrainDetail',
|
||||
props: {
|
||||
selected: {
|
||||
type: Object
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
#statusDownTrainDetail {
|
||||
z-index: 1000;
|
||||
position: absolute;
|
||||
height: $height;
|
||||
line-height: $height;
|
||||
border-radius: 0px !important;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
}
|
||||
</style>
|
@ -1,31 +0,0 @@
|
||||
<template>
|
||||
<div id="statusUpTrainDetail"></div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'StatusUpTrainDetail',
|
||||
props: {
|
||||
selected: {
|
||||
type: Object
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
#statusUpTrainDetail {
|
||||
z-index: 1000;
|
||||
position: absolute;
|
||||
height: $height;
|
||||
line-height: $height;
|
||||
border-radius: 0px !important;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
}
|
||||
</style>
|
@ -1,26 +0,0 @@
|
||||
<template>
|
||||
<div id="statusBar" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'StatusBar',
|
||||
props: {
|
||||
selected: {
|
||||
type: Object,
|
||||
default() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
|
||||
</style>
|
@ -1,26 +0,0 @@
|
||||
<template>
|
||||
<div id="statusDownTrainDetail" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'StatusDownTrainDetail',
|
||||
props: {
|
||||
selected: {
|
||||
type: Object,
|
||||
default() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
|
||||
</style>
|
@ -1,31 +0,0 @@
|
||||
<template>
|
||||
<div id="statusUpTrainDetail"></div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'StatusUpTrainDetail',
|
||||
props: {
|
||||
selected: {
|
||||
type: Object
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
#statusUpTrainDetail {
|
||||
z-index: 1000;
|
||||
position: absolute;
|
||||
height: $height;
|
||||
line-height: $height;
|
||||
border-radius: 0px !important;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
}
|
||||
</style>
|
@ -1,31 +0,0 @@
|
||||
<template>
|
||||
<div id="statusBar"></div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'StatusBar',
|
||||
props: {
|
||||
selected: {
|
||||
type: Object
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
#statusBar {
|
||||
z-index: 1000;
|
||||
position: absolute;
|
||||
height: $height;
|
||||
line-height: $height;
|
||||
border-radius: 0px !important;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
}
|
||||
</style>
|
@ -1,31 +0,0 @@
|
||||
<template>
|
||||
<div id="statusDownTrainDetail"></div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'StatusDownTrainDetail',
|
||||
props: {
|
||||
selected: {
|
||||
type: Object
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
#statusDownTrainDetail {
|
||||
z-index: 1000;
|
||||
position: absolute;
|
||||
height: $height;
|
||||
line-height: $height;
|
||||
border-radius: 0px !important;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
}
|
||||
</style>
|
@ -1,31 +0,0 @@
|
||||
<template>
|
||||
<div id="statusUpTrainDetail"></div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'StatusUpTrainDetail',
|
||||
props: {
|
||||
selected: {
|
||||
type: Object
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
#statusUpTrainDetail {
|
||||
z-index: 1000;
|
||||
position: absolute;
|
||||
height: $height;
|
||||
line-height: $height;
|
||||
border-radius: 0px !important;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
}
|
||||
</style>
|
@ -22,6 +22,7 @@ export default class Section extends Group {
|
||||
this.model = model;
|
||||
this.style = style;
|
||||
this.selected = false; // 绘图选中状态
|
||||
this.batchSelected = false; // 绘图批量选中状态
|
||||
this.create();
|
||||
this.createMouseEvent();
|
||||
this.setState(model);
|
||||
@ -853,7 +854,15 @@ export default class Section extends Group {
|
||||
drawSelected(selected) {
|
||||
this.selected = selected;
|
||||
if (selected) {
|
||||
this.section && this.section.setStyle({stroke: 'rgba(0,255,255,0.6)'});
|
||||
!this.batchSelected && this.section && this.section.setStyle({stroke: 'rgba(0,255,255,0.6)'});
|
||||
} else {
|
||||
!this.batchSelected && this.section && this.section.setStyle({stroke: this.style.Section.line.spareColor });
|
||||
}
|
||||
}
|
||||
drawBatchSelected(selected) {
|
||||
this.batchSelected = selected;
|
||||
if (selected) {
|
||||
this.section && this.section.setStyle({stroke: 'rgba(255,255,0,0.6)'});
|
||||
} else {
|
||||
this.section && this.section.setStyle({stroke: this.style.Section.line.spareColor });
|
||||
}
|
||||
@ -862,8 +871,8 @@ export default class Section extends Group {
|
||||
checkIsDrawMap() {
|
||||
const path = window.location.href;
|
||||
if (path.includes('/map/draw')) {
|
||||
this.on('mouseout', () => { !this.selected && this.section && this.section.setStyle({stroke: this.style.Section.line.spareColor }); });
|
||||
this.on('mouseover', () => { this.section && this.section.setStyle({stroke: 'rgba(0,255,255,0.6)'}); });
|
||||
this.on('mouseout', () => { !this.batchSelected && !this.selected && this.section && this.section.setStyle({stroke: this.style.Section.line.spareColor }); });
|
||||
this.on('mouseover', () => { !this.batchSelected && this.section && this.section.setStyle({stroke: 'rgba(0,255,255,0.6)'}); });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ function hasPermission(roles, permissionRoles) {
|
||||
return roles.some(role => permissionRoles.indexOf(role) >= 0);
|
||||
}
|
||||
|
||||
const whiteList = ['/login', '/design/login', '/xty/login', '/designxty/login']; // 不重定向白名单
|
||||
const whiteList = ['/login', '/design/login', '/xty/login', '/designxty/login','/jlmap3d/devicetrain']; // 不重定向白名单
|
||||
|
||||
const designPageRegex = [/^\/design/, /^\/scriptDisplay/, /^\/publish/, /^\/orderauthor/, /^\/system/, /^\/display\/record/, /^\/display\/manage/, /^\/apply/, /^\/plan/, /^\/display\/plan/];
|
||||
|
||||
|
@ -10,6 +10,9 @@ const Login = () => import('@/views/login/index');
|
||||
|
||||
const Jlmap3dedit = () => import('@/views/jlmap3d/edit/jlmap3dedit');
|
||||
const Jlmap3d = () => import('@/views/jlmap3d/drive/jl3ddrive');
|
||||
const Jlmap3dSandbox = () => import('@/views/jlmap3d/simulation/jl3dsimulation');
|
||||
const Jlmap3dModel = () => import('@/views/jlmap3d/device/jl3ddevice');
|
||||
const Jlmap3dTrain = () => import('@/views/jlmap3d/devicetrain/jl3ddevicetrain');
|
||||
const Display = () => import('@/views/display/index');
|
||||
const DesignDisplay = () => import('@/views/display/designIndex');
|
||||
|
||||
@ -281,6 +284,21 @@ export const constantRoutes = [
|
||||
component: Jlmap3dedit,
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: '/jlmap3d/sandbox',
|
||||
component: Jlmap3dSandbox,
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: '/jlmap3d/devicemodel',
|
||||
component: Jlmap3dModel,
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: '/jlmap3d/devicetrain',
|
||||
component: Jlmap3dTrain,
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: '/401',
|
||||
component: Error401,
|
||||
@ -928,12 +946,8 @@ router.beforeEach((to, from, next) => {
|
||||
|
||||
// 兼容 vue-router在3.1.0版本以上的路由跳转使用的是 promise 的方式
|
||||
const originalPush = Router.prototype.push;
|
||||
const originalReplace = Router.prototype.replace;
|
||||
Router.prototype.push = function push(location) {
|
||||
return originalPush.call(this, location).catch(err => err);
|
||||
};
|
||||
Router.prototype.replace = function push(location) {
|
||||
return originalReplace.call(this, location).catch(err => err);
|
||||
};
|
||||
|
||||
export default router;
|
||||
|
@ -165,6 +165,20 @@ const user = {
|
||||
});
|
||||
},
|
||||
|
||||
// 关闭页面
|
||||
exit({ commit, dispatch }) {
|
||||
const token = getToken();
|
||||
return new Promise((resolve, reject) => {
|
||||
dispatch('FedLogOut').then(resp => {
|
||||
logout(token).then(() => {
|
||||
resolve();
|
||||
}).catch(error => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
SetAccount({ commit }, account) {
|
||||
commit('SET_ACCOUNT', account);
|
||||
},
|
||||
|
@ -10,6 +10,7 @@ import Stomp from 'stompjs';
|
||||
// var Stomp = require('stompjs');
|
||||
|
||||
const isDev = process.env.NODE_ENV === 'development';
|
||||
const isTest = process.env.NODE_ENV === 'test';
|
||||
const websocketUrl = `${getBaseUrl()}/joylink-websocket?token=`;
|
||||
// const websocketUrl = `http://192.168.3.6:9000/joylink-websocket?token=`;
|
||||
|
||||
@ -164,7 +165,7 @@ StompClient.prototype = {
|
||||
closeStompDebug() {
|
||||
if (this.clientIns) {
|
||||
this.clientIns.debug = undefined;
|
||||
if (isDev) {
|
||||
if (isDev || isTest) {
|
||||
this.clientIns.debug = function (message) {
|
||||
console.debug(message);
|
||||
};
|
||||
|
@ -31,10 +31,10 @@ export default {
|
||||
listImg: [
|
||||
{ src: home1 },
|
||||
{ src: home2 },
|
||||
{ src: home3 },
|
||||
{ src: home4 },
|
||||
{ src: home5 },
|
||||
{ src: home6 }
|
||||
{ src: home3 }
|
||||
// { src: home4 },
|
||||
// { src: home5 },
|
||||
// { src: home6 }
|
||||
]
|
||||
};
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
:quest-id="questId"
|
||||
@tryTime="tryTime"
|
||||
@hidepanel="hidepanel"
|
||||
@devicemodel="devicemodel"
|
||||
@quitQuest="quitQuest"
|
||||
@showScheduling="showScheduling"
|
||||
/>
|
||||
@ -41,7 +42,9 @@
|
||||
<menu-system-time ref="menuSystemTime" :offset="offset" :right="right" :group="group" />
|
||||
</div>
|
||||
|
||||
<Jl3d-Simulation v-show="simulationShow" ref="Jl3dSimulation" :panel-show="simulationShow" @showpanel="showpanel" />
|
||||
<!-- <Jl3d-Simulation v-show="simulationShow" ref="Jl3dSimulation" :panel-show="simulationShow" @showpanel="showpanel" /> -->
|
||||
|
||||
<Jl3d-Device v-if="deviceShow" ref="Jl3dDevice" :panel-show="deviceShow" @showdevice="showdevice" />
|
||||
<Jl3d-Drive v-show="drivingShow" ref="Jl3dDrive" :panel-show="drivingShow" @showdriving="showdriving" />
|
||||
|
||||
<scheduling v-if="isShowScheduling" ref="scheduling" :group="group" />
|
||||
@ -72,9 +75,10 @@ import { EventBus } from '@/scripts/event-bus';
|
||||
import Vue from 'vue';
|
||||
|
||||
// 三维
|
||||
import Jl3dSimulation from '@/views/jlmap3d/simulation/jl3dsimulation';
|
||||
// import Jl3dSimulation from '@/views/jlmap3d/simulation/jl3dsimulation';
|
||||
import Jl3dDrive from '@/views/jlmap3d/drive/jl3ddrive';
|
||||
|
||||
import Jl3dDevice from '@/views/jlmap3d/device/jl3ddevice';
|
||||
import { getToken } from '@/utils/auth';
|
||||
export default {
|
||||
name: 'DisplayDraft',
|
||||
components: {
|
||||
@ -88,8 +92,9 @@ export default {
|
||||
MenuScript,
|
||||
MenuSchema,
|
||||
MenuSystemTime,
|
||||
Jl3dSimulation,
|
||||
// Jl3dSimulation,
|
||||
Jl3dDrive,
|
||||
Jl3dDevice,
|
||||
Scheduling
|
||||
},
|
||||
props: {
|
||||
@ -115,6 +120,7 @@ export default {
|
||||
panelShow: true,
|
||||
simulationShow: false,
|
||||
drivingShow: false,
|
||||
deviceShow: false,
|
||||
questId: 0, // 加载任务的Id
|
||||
group: '',
|
||||
prdTypeMap: {
|
||||
@ -526,11 +532,25 @@ export default {
|
||||
this.drivingShow = true;
|
||||
this.$refs.Jl3dDrive.show(this.mapId, this.group);
|
||||
} else {
|
||||
this.panelShow = false;
|
||||
this.simulationShow = true;
|
||||
this.$refs.Jl3dSimulation.show(this.mapId, this.group);
|
||||
let routeData = this.$router.resolve({
|
||||
path:'/jlmap3d/sandbox',
|
||||
query:{
|
||||
mapid:this.mapId,
|
||||
group:this.group,
|
||||
token:getToken(),
|
||||
}
|
||||
});
|
||||
window.open(routeData.href, '_blank','noopener noreferrer');
|
||||
}
|
||||
},
|
||||
devicemodel(){
|
||||
if(this.deviceShow == false){
|
||||
this.deviceShow = true;
|
||||
}else{
|
||||
this.deviceShow = false;
|
||||
}
|
||||
|
||||
},
|
||||
showScheduling() {
|
||||
this.$refs.scheduling.doShow();
|
||||
},
|
||||
|
@ -9,6 +9,7 @@
|
||||
<el-button-group>
|
||||
<el-button v-if="isShowScheduling" type="primary" @click="jumpScheduling">{{ $t('display.demon.dispatchingPlan') }}</el-button>
|
||||
<el-button type="jumpjlmap3d" @click="jumpjlmap3d">{{ jl3dname }}</el-button>
|
||||
<el-button v-if="isShow3dmodel" type="jumpjlmap3dmodel" @click="jumpjlmap3dmodel">{{ jl3dmodel }}</el-button>
|
||||
<template v-if="isShowQuest">
|
||||
<!-- && !isDesignPlatform -->
|
||||
<el-button v-if="!isDesignPlatform " type="danger" @click="handleQuitQuest">{{ $t('display.demon.exitScript') }}</el-button>
|
||||
@ -20,8 +21,10 @@
|
||||
<el-button type="primary" @click="back">{{ $t('display.demon.back') }}</el-button>
|
||||
</el-button-group>
|
||||
</div>
|
||||
|
||||
<set-time ref="setTime" @ConfirmSelectBeginTime="start" />
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<!-- 单人仿真 -->
|
||||
@ -34,6 +37,9 @@ import { PermissionType } from '@/scripts/ConstDic';
|
||||
import { getCountTime } from '@/utils/index';
|
||||
import { runDiagramIsStart, quitScript } from '@/api/simulation';
|
||||
import { timeFormat } from '@/utils/date';
|
||||
import { getToken } from '@/utils/auth';
|
||||
|
||||
|
||||
|
||||
export default {
|
||||
name: 'MenuDemon',
|
||||
@ -71,7 +77,9 @@ export default {
|
||||
name: '',
|
||||
remarks: ''
|
||||
},
|
||||
jl3dname: this.$t('display.demon.threeDimensionalView')
|
||||
jl3dname: this.$t('display.demon.threeDimensionalView'),
|
||||
jl3dmodel: this.$t('display.demon.deviceView'),
|
||||
isShow3dmodel :false,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@ -192,6 +200,9 @@ export default {
|
||||
jumpjlmap3d() {
|
||||
this.$emit('hidepanel');
|
||||
},
|
||||
jumpjlmap3dmodel() {
|
||||
this.$emit('devicemodel');
|
||||
},
|
||||
jumpScheduling() {
|
||||
this.$emit('showScheduling');
|
||||
},
|
||||
@ -209,8 +220,10 @@ export default {
|
||||
change3dname() {
|
||||
if (this.$route.query.prdType == '04') {
|
||||
this.jl3dname = this.$t('display.demon.driverPerspective');
|
||||
|
||||
} else {
|
||||
this.jl3dname = this.$t('display.demon.threeDimensionalView');
|
||||
this.isShow3dmodel = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
93
src/views/jlmap3d/device/jl3ddevice.vue
Normal file
93
src/views/jlmap3d/device/jl3ddevice.vue
Normal file
@ -0,0 +1,93 @@
|
||||
<template>
|
||||
<div id="jl3d" class="jl3ddraw">
|
||||
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import Vue from 'vue';
|
||||
import { Jl3ddevice } from '@/jlmap3d/jl3ddevice/jl3ddevice.js';
|
||||
|
||||
|
||||
export default {
|
||||
name: 'devicemodel',
|
||||
components: {
|
||||
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
jl3d: null,
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
// '$store.state.socket.device.code': {
|
||||
// handler: function (newVal, oldVal) {
|
||||
// if (newVal != oldVal) {
|
||||
// this.jl3d.selectmodel(this.$store.state.socket.device);
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
// '$store.state.socket.device': {
|
||||
// deep: true,
|
||||
// handler: function (newVal, oldVal) {
|
||||
// if (newVal.code == oldVal.code) {
|
||||
// this.jl3d.updateaction(newVal);
|
||||
// } else {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// },
|
||||
// '$store.state.socket.simulationOverCount': function () {
|
||||
// this.unsubscribe();
|
||||
// }
|
||||
},
|
||||
computed: {
|
||||
code() {
|
||||
return this.$route.query.code;
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
let code = this.$route.query.code;
|
||||
let group = this.$route.query.group;
|
||||
let header = this.$route.query.token;
|
||||
// if (group) {
|
||||
// this.init(group,header);
|
||||
// // this.subscribe(code,group,header);
|
||||
// }
|
||||
this.init(group,header);
|
||||
},
|
||||
beforeDestroy() {
|
||||
},
|
||||
methods: {
|
||||
init: function (group,header) {
|
||||
// let mapdata = this.$store.state.socket.device;
|
||||
let dom = document.getElementById('jl3d');
|
||||
this.jl3d = new Jl3ddevice(dom,group,header);
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
/* #jl3d {
|
||||
width: 937px;
|
||||
height: 937px;
|
||||
} */
|
||||
|
||||
.jl3ddraw {
|
||||
position: absolute;
|
||||
float: right;
|
||||
top:20%;
|
||||
/* left: 0; */
|
||||
width: 40%;
|
||||
height: 60%;
|
||||
z-index: 1500;
|
||||
}
|
||||
|
||||
#canvastexture {
|
||||
position: absolute;
|
||||
float: left;
|
||||
left: 0;
|
||||
z-index: -12;
|
||||
}
|
||||
</style>
|
149
src/views/jlmap3d/devicetrain/component/devicetrainmenu.vue
Normal file
149
src/views/jlmap3d/devicetrain/component/devicetrainmenu.vue
Normal file
@ -0,0 +1,149 @@
|
||||
<template>
|
||||
<div class="editassets">
|
||||
<div class="asset-list">
|
||||
<el-tabs style="margin:5px" v-model="activeName">
|
||||
|
||||
<el-tab-pane class="displayscrol" label="设备部件" name="train">
|
||||
<el-scrollbar ref="devicescrol" style="height:100%;margin-bottom:1px">
|
||||
<el-form ref="form" label-width="120px" size="mini">
|
||||
<div class="displaylist" v-for="(part,index) in devicelist" @click="deviceselect(index,part)" v-show="true" >
|
||||
<div >
|
||||
<p style="border:1px solid #000;">设备名称:{{part.text}}</p>
|
||||
</div>
|
||||
</div>
|
||||
</el-form>
|
||||
</el-scrollbar>
|
||||
</el-tab-pane>
|
||||
|
||||
|
||||
|
||||
</el-tabs>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
export default {
|
||||
name: 'Jl3ddevicetrainMenu',
|
||||
components: {
|
||||
|
||||
},
|
||||
props: ['devicelist'],
|
||||
data() {
|
||||
return {
|
||||
activeName: 'train',
|
||||
filterText: '',
|
||||
defaultProps: {
|
||||
children: 'children',
|
||||
label: 'label'
|
||||
},
|
||||
devicetype:true,
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
|
||||
},
|
||||
watch: {
|
||||
filterText(val) {
|
||||
this.$refs.tree2.filter(val);
|
||||
},
|
||||
|
||||
'devicelist.length':function(newVal){
|
||||
this.$refs.devicescrol.update()
|
||||
}
|
||||
|
||||
},
|
||||
methods: {
|
||||
|
||||
deviceselect(index,train){
|
||||
this.$emit('sdevice',train);
|
||||
},
|
||||
filterNode(value, data) {
|
||||
if (!value) return true;
|
||||
return data.label.indexOf(value) !== -1;
|
||||
},
|
||||
init: function() {
|
||||
|
||||
},
|
||||
back() {
|
||||
|
||||
},
|
||||
|
||||
|
||||
},
|
||||
mounted() {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
@import "src/styles/mixin.scss";
|
||||
.editassets {
|
||||
position: absolute;
|
||||
float:right;
|
||||
right:0;
|
||||
top:0;
|
||||
width: 20%;
|
||||
height: 100%;
|
||||
// background-image:url("/static/texture/menu.png");
|
||||
// background-repeat: no-repeat;
|
||||
// background-size: 100%;
|
||||
// border-radius:5px;
|
||||
}
|
||||
|
||||
.asset-list{
|
||||
position:absolute;
|
||||
left:0;
|
||||
width: 90%;
|
||||
height: 100%;
|
||||
left: 5px;
|
||||
top: 15px;
|
||||
|
||||
|
||||
}
|
||||
.default-scrollbar {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.el-scrollbar__wrap.default-scrollbar__wrap {
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
}
|
||||
.el-scrollbar__view.default-scrollbar__view {}
|
||||
.displayscrol{
|
||||
|
||||
height: 100%;
|
||||
}
|
||||
.displaylist {
|
||||
float:left;
|
||||
position: relative;
|
||||
width:80%;
|
||||
height:20px;
|
||||
margin:0px 0px 20px 0px;
|
||||
|
||||
}
|
||||
.modelpic{
|
||||
left:0;
|
||||
position: absolute;
|
||||
width:100%;
|
||||
height:100%;
|
||||
}
|
||||
|
||||
.modeltop{
|
||||
bottom:0;
|
||||
z-index:0;
|
||||
}
|
||||
.modeldown{
|
||||
top:0;
|
||||
z-index:0;
|
||||
}
|
||||
|
||||
</style>
|
220
src/views/jlmap3d/devicetrain/jl3ddevicetrain.vue
Normal file
220
src/views/jlmap3d/devicetrain/jl3ddevicetrain.vue
Normal file
@ -0,0 +1,220 @@
|
||||
<template>
|
||||
<div class="jl3ddevice">
|
||||
<div id="jl3d" class="jl3ddraw">
|
||||
|
||||
</div>
|
||||
<Jl3ddevicetrain-Menu :devicelist="devicelist" @sdevice="sdevice" >
|
||||
</Jl3ddevicetrain-Menu>
|
||||
<div class="menutop">
|
||||
<el-button-group>
|
||||
<el-button type="primary" @click="selectdevice">选择设备</el-button>
|
||||
<el-button type="primary" @click="dispersed">{{devicestats}}</el-button>
|
||||
</el-button-group>
|
||||
</div>
|
||||
<div class="menudown">
|
||||
<el-button-group>
|
||||
<el-button type="primary" @click="back">退出</el-button>
|
||||
</el-button-group>
|
||||
</div>
|
||||
|
||||
<div id="testjlmap3d" class="jlmap3ddraw">
|
||||
<canvas id="canvastexture" />
|
||||
</div>
|
||||
<div class="showmsg" v-show="msgshow">
|
||||
<div class="msgtop">
|
||||
{{devicename}}
|
||||
</div>
|
||||
<div class="msgdown">
|
||||
{{devicemsg}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
<script>
|
||||
import Vue from 'vue';
|
||||
import { Jl3ddevice } from '@/jlmap3d/jl3ddevicetrain/jl3ddevicetrain.js';
|
||||
import Jl3ddevicetrainMenu from '@/views/jlmap3d/devicetrain/component/devicetrainmenu';
|
||||
export default {
|
||||
name: 'devicetrain',
|
||||
components: {
|
||||
Jl3ddevicetrainMenu
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
jl3d: null,
|
||||
devicelist:[],
|
||||
msgshow:false,
|
||||
devicename:"",
|
||||
devicemsg:"",
|
||||
devicestats:"设备分解",
|
||||
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
// '$store.state.socket.device.code': {
|
||||
// handler: function (newVal, oldVal) {
|
||||
// if (newVal != oldVal) {
|
||||
// this.jl3d.selectmodel(this.$store.state.socket.device);
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
// '$store.state.socket.device': {
|
||||
// deep: true,
|
||||
// handler: function (newVal, oldVal) {
|
||||
// if (newVal.code == oldVal.code) {
|
||||
// this.jl3d.updateaction(newVal);
|
||||
// } else {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// },
|
||||
'jl3d.animastats': {
|
||||
handler: function (newVal, oldVal) {
|
||||
if (newVal != oldVal) {
|
||||
if(newVal == false){
|
||||
this.devicestats = "设备分解";
|
||||
}
|
||||
if(newVal == true){
|
||||
this.devicestats = "设备归位";
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
code() {
|
||||
return this.$route.query.code;
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
window.updatemenulist = this.updatemenulist;
|
||||
window.updatemsg = this.updatemsg;
|
||||
this.init();
|
||||
},
|
||||
beforeDestroy() {
|
||||
},
|
||||
methods: {
|
||||
init: function () {
|
||||
// let mapdata = this.$store.state.socket.device;
|
||||
let dom = document.getElementById('jl3d');
|
||||
this.jl3d = new Jl3ddevice(dom);
|
||||
},
|
||||
sdevice(changedata) {
|
||||
|
||||
this.jl3d.updateselect(changedata);
|
||||
|
||||
},
|
||||
selectdevice(device) {
|
||||
this.jl3d.backselect();
|
||||
},
|
||||
dispersed(device) {
|
||||
this.jl3d.disperdevice();
|
||||
},
|
||||
updatemenulist(devicelist) {
|
||||
this.devicelist = devicelist;
|
||||
},
|
||||
updatemsg(name,text) {
|
||||
// console.log(name);
|
||||
// console.log(text);
|
||||
if(name){
|
||||
this.msgshow = true;
|
||||
this.devicename = name;
|
||||
this.devicemsg = text;
|
||||
}else{
|
||||
this.msgshow = false;
|
||||
}
|
||||
},
|
||||
back(changedata) {
|
||||
window.close();
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
/* #jl3d {
|
||||
width: 937px;
|
||||
height: 937px;
|
||||
} */
|
||||
|
||||
.jl3ddraw {
|
||||
position: absolute;
|
||||
float: left;
|
||||
top:0;
|
||||
/* left: 0; */
|
||||
width: 80%;
|
||||
height: 100%;
|
||||
/* z-index: 1500; */
|
||||
}
|
||||
.showmsg{
|
||||
position: absolute;
|
||||
float:left;
|
||||
left:0;
|
||||
bottom:0;
|
||||
width: 20%;
|
||||
height: 40%;
|
||||
z-index: 10;
|
||||
background-image:url("/static/texture/showmsg.png");
|
||||
background-repeat: no-repeat;
|
||||
background-size: 100%;
|
||||
|
||||
}
|
||||
|
||||
.msgtop{
|
||||
text-align: center;
|
||||
width: 90%;
|
||||
height:10%;
|
||||
position: absolute;
|
||||
top:10%;
|
||||
font-size:30px;
|
||||
color:#FFFFFF;
|
||||
}
|
||||
|
||||
.msgdown{
|
||||
position: absolute;
|
||||
top:20%;
|
||||
left:5%;
|
||||
width: 90%;
|
||||
height:80%;
|
||||
font-size:20px;
|
||||
color:#FFFFFF;
|
||||
word-wrap:break-word;
|
||||
letter-spacing:2px;
|
||||
}
|
||||
#canvastexture {
|
||||
position: absolute;
|
||||
float: left;
|
||||
left: 0;
|
||||
z-index: -12;
|
||||
}
|
||||
|
||||
#testjlmap3d {
|
||||
}
|
||||
|
||||
.jlmap3ddraw {
|
||||
float: left;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position:absolute;
|
||||
z-index: -1;
|
||||
}
|
||||
.menutop{
|
||||
top:0;
|
||||
right:20%;
|
||||
position:absolute;
|
||||
}
|
||||
.menudown{
|
||||
bottom:0;
|
||||
right:20%;
|
||||
position:absolute;
|
||||
}
|
||||
#canvastexture {
|
||||
position: absolute;
|
||||
float: left;
|
||||
left: 0;
|
||||
z-index: -12;
|
||||
}
|
||||
</style>
|
@ -143,6 +143,7 @@ export default {
|
||||
beforeDestroy() {
|
||||
if (this.jlmap3d) {
|
||||
this.jlmap3d.webwork.postMessage('off');
|
||||
this.jlmap3d.webwork.terminate();
|
||||
this.jlmap3d.endsocket();
|
||||
this.jlmap3d.dispose();
|
||||
this.jlmap3d = null;
|
||||
|
@ -6,10 +6,11 @@
|
||||
<el-button-group>
|
||||
<!-- <el-button type="primary" @click="raystand">站台选择</el-button>
|
||||
<el-button type="primary" @click="raytrain">列车选择</el-button> -->
|
||||
<el-button type="primary" @click="railmove">{{$t('jlmap3d.cameraRailMove')}}</el-button>
|
||||
<el-button type="primary" @click="raysection">{{$t('jlmap3d.trackCheck')}}</el-button>
|
||||
<el-button type="primary" @click="rayswitch">{{$t('jlmap3d.signalCheck')}}</el-button>
|
||||
<el-button type="primary" @click="raysignal">{{$t('jlmap3d.turnoutCheck')}}</el-button>
|
||||
<el-button type="primary" @click="back">{{$t('global.back')}}</el-button>
|
||||
<el-button type="primary" @click="rayswitch">{{$t('jlmap3d.turnoutCheck')}}</el-button>
|
||||
<el-button type="primary" @click="raysignal">{{$t('jlmap3d.signalCheck')}}</el-button>
|
||||
<el-button type="primary" @click="back">{{$t('global.exit')}}</el-button>
|
||||
</el-button-group>
|
||||
|
||||
|
||||
@ -74,7 +75,10 @@ export default {
|
||||
|
||||
mapdata: null,
|
||||
jlmap3d: null,
|
||||
selectmodel: null
|
||||
selectmodel: null,
|
||||
mapid:null,
|
||||
group:null,
|
||||
token:null
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
@ -93,7 +97,9 @@ export default {
|
||||
beforeDestroy() {
|
||||
// console.log("destroy");
|
||||
if (this.jlmap3d) {
|
||||
this.jlmap3d.webwork.postMessage('off');
|
||||
this.jlmap3d.webwork.postMessage('off');
|
||||
this.jlmap3d.webwork.terminate();
|
||||
this.jlmap3d.jsonwebwork.terminate();
|
||||
this.jlmap3d.dispose();
|
||||
this.jlmap3d = null;
|
||||
// this.$destroy();
|
||||
@ -102,12 +108,19 @@ export default {
|
||||
|
||||
mounted() {
|
||||
window.updatemenulist = this.updatemenulist;
|
||||
// this.init();
|
||||
this.getParams();
|
||||
|
||||
// console.log("");
|
||||
},
|
||||
methods: {
|
||||
getParams:function(){
|
||||
var routerParams = this.$route.query.group
|
||||
this.mapid = this.$route.query.mapid;
|
||||
this.group = this.$route.query.group;
|
||||
this.token = this.$route.query.token;
|
||||
this.init(this.mapid,this.group);
|
||||
},
|
||||
show: function (skinCode,group) {
|
||||
// console.log(skinCode);
|
||||
// console.log(this.jlmap3d);
|
||||
if (this.jlmap3d == null) {
|
||||
this.init(skinCode,group);
|
||||
} else {
|
||||
@ -138,6 +151,9 @@ export default {
|
||||
rayswitch() {
|
||||
this.jlmap3d.rayswitch('switch');
|
||||
},
|
||||
railmove() {
|
||||
this.jlmap3d.camerarailmove();
|
||||
},
|
||||
showstationmsg(showtype) {
|
||||
this.jlmap3d.showstationmsg(showtype);
|
||||
},
|
||||
@ -170,10 +186,10 @@ export default {
|
||||
},
|
||||
|
||||
back() {
|
||||
|
||||
this.$emit('showpanel');
|
||||
this.jlmap3d.eventoff();
|
||||
this.jlmap3d.animateoff();
|
||||
window.close();
|
||||
// this.$emit('showpanel');
|
||||
// this.jlmap3d.eventoff();
|
||||
// this.jlmap3d.animateoff();
|
||||
// this.jlmap3d = null;
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,6 @@
|
||||
<el-form ref="form" label-width="130px" size="mini">
|
||||
<div class="displaylist" v-for="(station,index) in stationlist" @click="stationselect(index,station)" v-show="station.type==stationtype" >
|
||||
<div >
|
||||
<p>车站:{{station.rname}}</p>
|
||||
<p>车站编号:{{station.name}}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -133,7 +133,7 @@
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane class="view-control" label="批量操作" name="five">
|
||||
<el-form label-width="130px" size="mini">
|
||||
<el-form ref="oprt3" label-width="130px" size="mini">
|
||||
<el-form-item label="选择link:">
|
||||
<el-select v-model="linkCodeList" filterable multiple size="mini">
|
||||
<el-option
|
||||
|
@ -103,7 +103,7 @@ export default {
|
||||
code: '',
|
||||
mapId: '',
|
||||
signalCode: '',
|
||||
alwaysRed: true,
|
||||
alwaysRed: false,
|
||||
sectionList: [],
|
||||
stationStandList: []
|
||||
},
|
||||
|
@ -12,7 +12,7 @@
|
||||
<el-button type="text" class="mapEdit_box" @click="drawMap">{{ $t('map.drawMap') }}</el-button>
|
||||
<el-button type="text" class="mapEdit_box" @click="showMap">{{ $t('map.viewLayer') }}</el-button>
|
||||
</div>
|
||||
<el-tabs v-model="enabledTab" type="card" class="map_card" @tab-click="changePane">
|
||||
<el-tabs v-model="enabledTab" type="card" class="map_card" :before-leave="tabBeforeLeave" @tab-click="changePane">
|
||||
<el-tab-pane :label="$t('map.routeID')" class="tab_pane_box" name="route">
|
||||
<route-operate
|
||||
ref="routeOperate"
|
||||
@ -190,8 +190,17 @@ export default {
|
||||
this.$emit('setCenter', code);
|
||||
},
|
||||
drawMap() {
|
||||
this.$refs.routeOperate.routeSectionListFocus(false);
|
||||
this.$emit('selectView', 'draft');
|
||||
},
|
||||
tabBeforeLeave(activeName, oldActiveName) {
|
||||
if (activeName === 'route') {
|
||||
this.$refs.routeOperate.routeSectionListFocus(true);
|
||||
}
|
||||
if (oldActiveName === 'route') {
|
||||
this.$refs.routeOperate.routeSectionListFocus(false);
|
||||
}
|
||||
},
|
||||
handleHightLight(selected) {
|
||||
if (this.oldDevice && (this.oldDevice._type === 'Section' || this.oldDevice._type === 'Psd') && this.oldDevice.instance && typeof this.oldDevice.instance.drawSelected === 'function') {
|
||||
if (this.isSwitchSection) {
|
||||
|
@ -1,157 +0,0 @@
|
||||
<template>
|
||||
<el-dialog v-dialogDrag :title="$t('map.continueProtectList')" :visible.sync="show" width="85%" :before-do-close="doClose">
|
||||
<div>
|
||||
<QueryListPage
|
||||
ref="queryListPage"
|
||||
:pager-config="pagerConfig"
|
||||
:query-form="queryForm"
|
||||
:query-list="queryList"
|
||||
/>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex';
|
||||
import { getContinueProtectList, delContinueProtect, getContinueProtectById } from '@/api/jmap/mapdraft';
|
||||
|
||||
export default {
|
||||
name: 'ProtectDetail',
|
||||
props: {
|
||||
mapInfo: {
|
||||
type: Object,
|
||||
default() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
show: false,
|
||||
showType: '',
|
||||
pagerConfig: {
|
||||
pageSize: 'pageSize',
|
||||
pageIndex: 'pageNum'
|
||||
},
|
||||
queryForm: {
|
||||
labelWidth: '120px',
|
||||
queryObject: {
|
||||
name: {
|
||||
type: 'text',
|
||||
label: '延续保护名称'
|
||||
}
|
||||
}
|
||||
},
|
||||
queryList: {
|
||||
query: this.queryFunction,
|
||||
selectCheckShow: false,
|
||||
indexShow: true,
|
||||
columns: [
|
||||
{
|
||||
title: '延续保护名称',
|
||||
prop: 'name'
|
||||
},
|
||||
{
|
||||
title: '解锁区段',
|
||||
prop: 'unlockSectionCode',
|
||||
type: 'tag',
|
||||
columnValue: (row) => { return this.$convertField(row.unlockSectionCode, this.sectionList, ['code', 'name']); },
|
||||
tagType: (row) => { return ''; }
|
||||
},
|
||||
{
|
||||
title: '解锁时间(s)',
|
||||
prop: 'unlockTime'
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
title: this.$t('map.operation'),
|
||||
width: '200',
|
||||
buttons: [
|
||||
{
|
||||
name: this.$t('map.compile'),
|
||||
handleClick: this.editObj,
|
||||
showControl: () => { return this.showType !== 'select'; }
|
||||
},
|
||||
{
|
||||
name: this.$t('map.deleteObj'),
|
||||
handleClick: this.deleteObj,
|
||||
type: 'danger',
|
||||
showControl: () => { return this.showType !== 'select'; }
|
||||
},
|
||||
{
|
||||
name: '选择',
|
||||
handleClick: this.selectedObj,
|
||||
showControl: () => { return this.showType === 'select'; }
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('map', [
|
||||
'sectionList',
|
||||
'espList',
|
||||
'psdList'
|
||||
])
|
||||
},
|
||||
watch: {
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
methods: {
|
||||
doShow(type) {
|
||||
this.show = true;
|
||||
this.reloadTable();
|
||||
if (type) {
|
||||
this.showType = type;
|
||||
}
|
||||
},
|
||||
doClose() {
|
||||
this.show = false;
|
||||
},
|
||||
formatName(code) {
|
||||
let name = '';
|
||||
const device = this.$store.getters['map/getDeviceByCode'](code);
|
||||
if (device) {
|
||||
name = device.uniqueName;
|
||||
}
|
||||
|
||||
return name;
|
||||
},
|
||||
queryFunction(params) {
|
||||
if (this.mapInfo && this.mapInfo.id) {
|
||||
return getContinueProtectList(this.mapInfo.id, params);
|
||||
}
|
||||
},
|
||||
editObj(index, row) {
|
||||
getContinueProtectById(row.id).then(response => {
|
||||
const data = response.data;
|
||||
this.$emit('protectSelected', data);
|
||||
this.doClose();
|
||||
});
|
||||
},
|
||||
deleteObj(index, row) {
|
||||
if (this.mapInfo && this.mapInfo.id && row) {
|
||||
// 删除
|
||||
delContinueProtect(row.id).then(response => {
|
||||
this.$message.success(this.$t('map.successfullyDelete'));
|
||||
this.reloadTable();
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('map.failDelete'));
|
||||
});
|
||||
}
|
||||
},
|
||||
reloadTable() {
|
||||
if (this.queryList && this.queryList.reload) {
|
||||
this.queryList.reload();
|
||||
}
|
||||
},
|
||||
selectedObj(index, row) {
|
||||
this.$emit('setOverlapCode', row);
|
||||
this.show = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
@ -1,84 +0,0 @@
|
||||
<template>
|
||||
<div style="height: 100%;">
|
||||
<route-draft
|
||||
ref="routeEdit"
|
||||
:selected="selected"
|
||||
:map-info="mapInfo"
|
||||
:route-data="routeData"
|
||||
/>
|
||||
<route-detail ref="routeDetail" :map-info="mapInfo" @protectSelected="protectSelected" />
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import RouteDraft from './route';
|
||||
import RouteDetail from './detail';
|
||||
|
||||
export default {
|
||||
name: 'ContinueProtect',
|
||||
components: {
|
||||
RouteDraft,
|
||||
RouteDetail
|
||||
},
|
||||
props: {
|
||||
mapInfo: {
|
||||
type: Object,
|
||||
default() {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
selected: {
|
||||
type: Object,
|
||||
default() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
enabledTab: 'protect',
|
||||
routeData: null
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
clickEvent(e, model) {
|
||||
this.onSelect(model);
|
||||
},
|
||||
onSelect(model) {
|
||||
if (model) {
|
||||
this.selected = model;
|
||||
} else {
|
||||
this.selected = null;
|
||||
}
|
||||
},
|
||||
setDelayUnlockStatus(data, status) {
|
||||
if (data && data.delayShowList) {
|
||||
data.delayShowList.forEach(elem => {
|
||||
elem.status = status;
|
||||
});
|
||||
}
|
||||
},
|
||||
protectSelected: function (data) {
|
||||
this.routeData = data;
|
||||
if (this.$refs.routeEdit) {
|
||||
this.$refs.routeEdit.isSave = false;
|
||||
}
|
||||
},
|
||||
previewRouteEvent: function () {
|
||||
if (this.$refs.routeDetail) {
|
||||
this.$refs.routeDetail.doShow();
|
||||
}
|
||||
},
|
||||
createRouteEvent: function () {
|
||||
if (this.$refs.routeEdit) {
|
||||
this.$refs.routeEdit.clear();
|
||||
}
|
||||
},
|
||||
setSelected(selected) {
|
||||
this.$refs.routeEdit.setSelected(selected);
|
||||
},
|
||||
setCenter(code) {
|
||||
this.$emit('setCenter', code);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
@ -1,413 +0,0 @@
|
||||
<template>
|
||||
<div style="height: 100%;">
|
||||
<el-scrollbar wrap-class="scrollbar-wrapper">
|
||||
<el-form ref="form" :model="addModel" :rules="rules" label-width="180px" size="mini">
|
||||
<div class="definition">
|
||||
<el-form-item label="延续保护名称:" prop="name">
|
||||
<el-input v-model="addModel.name" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="解锁区段" prop="unlockSectionCode">
|
||||
<el-select v-model="addModel.unlockSectionCode">
|
||||
<el-option
|
||||
v-for="item in sectionList"
|
||||
:key="item.code"
|
||||
:label="item.name + ' (' + item.code+ ')'"
|
||||
:value="item.code"
|
||||
/>
|
||||
</el-select>
|
||||
<el-button
|
||||
:type=" field === 'unlockSectionCode' ? 'danger' : 'primary'"
|
||||
@click="hover('unlockSectionCode')"
|
||||
>{{ $t('map.activate') }}</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item label="解锁时间(s)" prop="unlockTime">
|
||||
<el-input-number v-model="addModel.unlockTime" :min="0" />
|
||||
</el-form-item>
|
||||
<el-form-item label="延续保护线路:" prop="relSectionSwitchList">
|
||||
<el-table :data="addModel.relSectionSwitchList" border style="width: 80%">
|
||||
<el-table-column type="index" label="序号" width="100" />
|
||||
<el-table-column fixed="right" :label="$t('map.operation')">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
type="text"
|
||||
size="small"
|
||||
@click.native.prevent="deleteOverlab(addModel.relSectionSwitchList, scope.$index)"
|
||||
>
|
||||
移出
|
||||
</el-button>
|
||||
<el-button
|
||||
type="text"
|
||||
size="small"
|
||||
@click.native.prevent="editOverlab(addModel.relSectionSwitchList, scope.$index)"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-form>
|
||||
<el-card class="box-card" shadow="never">
|
||||
<div slot="header" class="clearfix">
|
||||
<span style="font-size: 14px;">{{ cardTitle }}</span>
|
||||
<el-button v-if="cardMode === 'generate'" style="float: right; padding: 3px 0" type="text" @click="generateOverlab">生成</el-button>
|
||||
<el-button-group v-else-if=" cardMode === 'edit'" style="float: right;">
|
||||
<el-button type="text" style="padding:3px 3px" @click="updateOverlab">修改</el-button>
|
||||
<el-button type="text" style="padding:3px 0" @click="cancelOverlab">取消</el-button>
|
||||
</el-button-group>
|
||||
</div>
|
||||
<div>
|
||||
<el-form ref="overlabForm" :model="addOverlapModel" :rules="overLapRules" label-width="135px" size="mini" style="margin-top: 15px">
|
||||
<el-form-item :label="$t('map.routeProtectsData') + ':'" prop="routeOverlapSectionList">
|
||||
<el-select v-model="addOverlapModel.routeOverlapSectionList" multiple clearable :filterable="true">
|
||||
<el-option
|
||||
v-for="item in sectionList"
|
||||
:key="item.code"
|
||||
:label="item.name + ' (' + item.code+ ')'"
|
||||
:value="item.code"
|
||||
/>
|
||||
</el-select>
|
||||
<el-button
|
||||
:type=" field === 'routeOverlapSectionList' ? 'danger' : 'primary'"
|
||||
@click="hover('routeOverlapSectionList')"
|
||||
>{{ $t('map.activate') }}</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('map.continueProtectSwitchData') + ':'" prop="routeOverlapSwitchList">
|
||||
<el-select v-model="overlapCode" clearable :filterable="true" :placeholder="$t('map.pleaseSelect')">
|
||||
<el-option
|
||||
v-for="item in switchList"
|
||||
:key="item.code"
|
||||
:label="`${item.name}(${item.code})`"
|
||||
:value="item.code"
|
||||
/>
|
||||
</el-select>
|
||||
<el-button
|
||||
:type=" field === 'routeOverlapSwitchList' ? 'danger' : 'primary'"
|
||||
@click="hover('routeOverlapSwitchList')"
|
||||
>{{ $t('map.activate') }}</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
@click="pushSwitch(addOverlapModel.routeOverlapSwitchList, {switchCode: overlapCode, normal: overlapType, switchType: overlapType ? '定位' : '反位'})"
|
||||
>{{ $t('map.add') }}
|
||||
</el-button>
|
||||
<el-select v-model="overlapType" :filterable="true" :placeholder="$t('map.pleaseSelect')">
|
||||
<el-option
|
||||
v-for="item in SwitchLocateTypeList"
|
||||
:key="item.code"
|
||||
:label="item.name"
|
||||
:value="item.code"
|
||||
/>
|
||||
</el-select>
|
||||
<el-table :data="addOverlapModel.routeOverlapSwitchList" border style="width: 97%">
|
||||
<el-table-column prop="switchCode" :label="$t('map.switchId')" width="100">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ swictchName(scope.row.switchCode) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="switchType" :label="$t('map.switchType')" />
|
||||
<el-table-column fixed="right" :label="$t('map.operation')" width="50">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
type="text"
|
||||
size="small"
|
||||
@click.native.prevent="deleteSwitch(addOverlapModel.routeOverlapSwitchList, scope.$index)"
|
||||
>
|
||||
{{ $t('map.remove') }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</el-card>
|
||||
<div class="draft">
|
||||
<el-button-group>
|
||||
<el-button v-if="isSave" type="primary" size="small" :loading="loading" @click="save">{{ $t('map.save') }}
|
||||
</el-button>
|
||||
<el-button v-else type="warning" size="small" :loading="loading" @click="update">{{ $t('map.updata') }}
|
||||
</el-button>
|
||||
</el-button-group>
|
||||
</div>
|
||||
</el-scrollbar>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { mapGetters } from 'vuex';
|
||||
import { getUID } from '@/jmap/utils/Uid';
|
||||
import { postContinueProtect, putContinueProtect } from '@/api/jmap/mapdraft';
|
||||
import { ViewMode } from '@/scripts/ConstDic';
|
||||
import { deepAssign } from '@/utils/index';
|
||||
|
||||
export default {
|
||||
name: 'RouteOperation',
|
||||
props: {
|
||||
selected: {
|
||||
type: Object,
|
||||
default() {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
mapInfo: {
|
||||
type: Object,
|
||||
default() {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
routeData: {
|
||||
type: Object,
|
||||
default() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
ViewMode: ViewMode,
|
||||
field: '',
|
||||
overlapCode: '',
|
||||
isSave: true,
|
||||
loading: false,
|
||||
editModel: {},
|
||||
addModel: {
|
||||
id: '',
|
||||
code: '',
|
||||
mapId: '',
|
||||
name: '',
|
||||
unlockSectionCode:'',
|
||||
unlockTime: 0,
|
||||
relSectionSwitchList: []
|
||||
},
|
||||
addOverlapModel: {
|
||||
parentIndex: '',
|
||||
routeOverlapSectionList: [], // 进路延续保护区段数据列表
|
||||
routeOverlapSwitchList: [] // 进路延续保护道岔数据列表
|
||||
},
|
||||
overlapType: '',
|
||||
SwitchLocateTypeList: [
|
||||
{ name: '定位', code: true },
|
||||
{ name: '反位', code: false }
|
||||
],
|
||||
editShow: false,
|
||||
overLapRules: {
|
||||
|
||||
},
|
||||
rules: {
|
||||
name: [
|
||||
{ required: true, message: '请输入延续保护名称', trigger:'blur'}
|
||||
],
|
||||
unlockSectionCode: [
|
||||
{ required: true, message: '请选择解锁区段', trigger:'change'}
|
||||
],
|
||||
unlockTime: [
|
||||
{ required: true, message: '请输入解锁时间', trigger:'blur'}
|
||||
],
|
||||
relSectionSwitchList: [
|
||||
{ required: true, message: '请生成延续保护线路', trigger: 'change'}
|
||||
]
|
||||
},
|
||||
cardMode: 'generate'
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('map', [
|
||||
'switchList',
|
||||
'sectionList'
|
||||
]),
|
||||
cardTitle() {
|
||||
if (this.cardMode === 'generate') {
|
||||
return '生成延续保护线路';
|
||||
} else if (this.cardMode === 'edit') {
|
||||
return '编辑延续保护线路';
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
mapInfo(val) {
|
||||
if (val) {
|
||||
this.addModel.mapId = val.id;
|
||||
}
|
||||
},
|
||||
routeData(val, old) {
|
||||
if (val) {
|
||||
this.addModel = val;
|
||||
this.editShow = true;
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
hover(field) {
|
||||
this.field = field === this.field ? '' : field;
|
||||
},
|
||||
pushSwitch(list, data) {
|
||||
const index = list.findIndex(elem => { return elem.switchCode == data.switchCode; });
|
||||
if (index < 0) {
|
||||
list.push(data);
|
||||
} else {
|
||||
this.$messageBox(this.$t('tip.routeSameID'));
|
||||
}
|
||||
},
|
||||
deleteSwitch(list, index) {
|
||||
list.splice(index, 1);
|
||||
},
|
||||
swictchName(code) {
|
||||
let name = '';
|
||||
if (code) {
|
||||
const swch = this.$store.getters['map/getDeviceByCode'](code);
|
||||
if (swch) {
|
||||
name = `${swch.name}(${swch.code})`;
|
||||
}
|
||||
}
|
||||
return name;
|
||||
},
|
||||
setSelected(selected) {
|
||||
if (selected) {
|
||||
if (selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'routeOverlapSectionList'.toUpperCase()) {
|
||||
if (this.addOverlapModel.routeOverlapSectionList.indexOf(selected.code) === -1) {
|
||||
this.addOverlapModel.routeOverlapSectionList.push(selected.code);
|
||||
}
|
||||
} else if (selected._type.toUpperCase() === 'Switch'.toUpperCase() && this.field.toUpperCase() === 'routeOverlapSwitchList'.toUpperCase()) {
|
||||
this.overlapCode = selected.code;
|
||||
} else if (selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'unlockSectionCode'.toUpperCase()) {
|
||||
this.addModel.unlockSectionCode = selected.code;
|
||||
}
|
||||
}
|
||||
},
|
||||
buildModel(code) {
|
||||
const model = Object.assign({}, this.addModel);
|
||||
if (code) { model['code'] = code; }
|
||||
model['mapId'] = this.mapInfo.id;
|
||||
return model;
|
||||
},
|
||||
save() {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
this.loading = true;
|
||||
postContinueProtect(this.buildModel(getUID('Protect'))).then(resp => {
|
||||
this.$message.success('创建延续保护成功!');
|
||||
this.loading = false;
|
||||
this.clear();
|
||||
}).catch(() => {
|
||||
this.$messageBox('创建延续保护失败!');
|
||||
this.loading = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
update() {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
this.loading = true;
|
||||
putContinueProtect(this.buildModel()).then(resp => {
|
||||
this.$message.success('更新延续保护成功!');
|
||||
this.loading = false;
|
||||
this.clear();
|
||||
}).catch(() => {
|
||||
this.$messageBox('更新延续保护失败!');
|
||||
this.loading = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
clear() {
|
||||
if (this.$refs && this.$refs.form && this.mapInfo) {
|
||||
delete this.addModel.id;
|
||||
this.$refs.form.resetFields();
|
||||
this.addModel.mapId = this.mapInfo.id;
|
||||
this.addModel.relSectionSwitchList = [];
|
||||
this.addModel.code = '';
|
||||
this.addModel.unlockTime = 0;
|
||||
this.addModel.unlockSectionCode = '';
|
||||
this.addModel.id = '';
|
||||
this.addModel.name = '';
|
||||
this.isSave = true;
|
||||
this.cardMode = 'generate';
|
||||
this.clearOverlab();
|
||||
}
|
||||
},
|
||||
deleteOverlab(list, index) {
|
||||
list.splice(index, 1);
|
||||
this.$refs.overlabForm.resetFields();
|
||||
this.clearOverlab();
|
||||
this.cardMode = 'generate';
|
||||
},
|
||||
editOverlab(list, index) {
|
||||
this.addOverlapModel = deepAssign({}, list[index]);
|
||||
this.addOverlapModel.parentIndex = index;
|
||||
this.cardMode = 'edit';
|
||||
},
|
||||
updateOverlab() {
|
||||
if (this.addOverlapModel.parentIndex || this.addOverlapModel.parentIndex === 0 ) {
|
||||
this.addModel.relSectionSwitchList[this.addOverlapModel.parentIndex] = {
|
||||
routeOverlapSectionList:this.addOverlapModel.routeOverlapSectionList,
|
||||
routeOverlapSwitchList:this.addOverlapModel.routeOverlapSwitchList
|
||||
};
|
||||
this.clearOverlab();
|
||||
this.cardMode = 'generate';
|
||||
}
|
||||
},
|
||||
cancelOverlab() {
|
||||
this.clearOverlab();
|
||||
this.cardMode = 'generate';
|
||||
},
|
||||
generateOverlab() {
|
||||
if (!this.addOverlapModel.routeOverlapSectionList.length) {
|
||||
this.$messageBox('请选择进路延续保护区段!');
|
||||
} else if (!this.addOverlapModel.routeOverlapSwitchList.length) {
|
||||
this.$messageBox('请添加延续保护道岔!');
|
||||
} else {
|
||||
this.addModel.relSectionSwitchList.push({
|
||||
routeOverlapSectionList:this.addOverlapModel.routeOverlapSectionList,
|
||||
routeOverlapSwitchList:this.addOverlapModel.routeOverlapSwitchList
|
||||
});
|
||||
this.$refs.overlabForm.resetFields();
|
||||
this.clearOverlab();
|
||||
}
|
||||
},
|
||||
clearOverlab() {
|
||||
this.addOverlapModel = {
|
||||
parentIndex: '',
|
||||
routeOverlapSectionList:[],
|
||||
routeOverlapSwitchList:[]
|
||||
};
|
||||
this.overlapCode = '';
|
||||
this.overlapType = '';
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
/deep/ .el-radio {
|
||||
margin-right: 10px;
|
||||
}
|
||||
/deep/ {
|
||||
.el-select .el-tag {
|
||||
height: auto;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding-right: 15px;
|
||||
box-sizing: border-box;
|
||||
white-space: normal;
|
||||
}
|
||||
.el-input__suffix{
|
||||
right: 2px;
|
||||
}
|
||||
}
|
||||
.box-card {
|
||||
width: 88%;
|
||||
position: relative;
|
||||
left: 8%;
|
||||
}
|
||||
.draft {
|
||||
width: 400px;
|
||||
text-align: center;
|
||||
margin: 20px auto;
|
||||
}
|
||||
</style>
|
@ -9,18 +9,21 @@
|
||||
/>
|
||||
</div>
|
||||
<pre-view-field ref="previewField" :map-info="mapInfo" />
|
||||
<protect-detail ref="protectDetail" :map-info="mapInfo" />
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex';
|
||||
import { listMap, getRouteNewList, delRouteNew, getRouteNewById, putRouteNew, getContinueProtectList, delContinueProtect } from '@/api/jmap/mapdraft'; /** listRouteMapRoute*/
|
||||
import ProtectDetail from './protectDetail';
|
||||
import PreViewField from './preview';
|
||||
|
||||
export default {
|
||||
name: 'RouteDetail',
|
||||
components: {
|
||||
PreViewField
|
||||
PreViewField,
|
||||
ProtectDetail
|
||||
},
|
||||
props: {
|
||||
mapInfo: {
|
||||
@ -328,41 +331,17 @@ export default {
|
||||
}
|
||||
},
|
||||
async overlapSwitchDetail(index, row) { // 延续保护道岔
|
||||
if (this.$refs && this.$refs.previewField && row) {
|
||||
// const param = {
|
||||
// code: row.overlapCode,
|
||||
// pageNum: 10,
|
||||
// pageSize:1
|
||||
// };
|
||||
// getContinueProtectList(this.$route.params.mapId, param).then(resp => {
|
||||
// if (resp.data.list[0]) {
|
||||
// const data = resp.data.list[0];
|
||||
// const overlabList = [];
|
||||
// data.relSectionSwitchList.forEach( (item) =>{
|
||||
// if (item.routeOverlapSwitchList.length) {
|
||||
//
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
// const switchDict = {};
|
||||
// const switchTypeDict = {};
|
||||
// this.switchList.map(elem => { switchDict[elem.code] = elem.name; });
|
||||
// this.SwitchLocateTypeList.map(elem => { switchTypeDict[elem.code] = elem.name; });
|
||||
// const fieldList = {
|
||||
// id: row.id,
|
||||
// mapId: this.$route.params.mapId,
|
||||
// title: '延续保护道岔数据',
|
||||
// name: row.name,
|
||||
// model: {
|
||||
// items: [
|
||||
// { prop: 'switchCode', label: '道岔ID', type: 'text' },
|
||||
// { prop: 'switchCode', label: '道岔名称', type: 'select', options: switchDict },
|
||||
// { prop: 'switchLocateType', label: '道岔类型', type: 'select', options: switchTypeDict }
|
||||
// ]
|
||||
// }
|
||||
// };
|
||||
// this.$refs.previewField.doShow(fieldList, row.routeOverlapSwitchList);
|
||||
if (this.$refs && this.$refs.protectDetail && row) {
|
||||
const param = {
|
||||
code: row.overlapCode,
|
||||
pageNum: 10,
|
||||
pageSize:1
|
||||
};
|
||||
getContinueProtectList(this.$route.params.mapId, param).then(resp => {
|
||||
this.$refs.protectDetail.doShow(resp.data.list[0]);
|
||||
}).catch((error) => {
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
},
|
||||
async flankProtectionSwitchDetail(index, row) { // 进路侧防道岔
|
||||
|
@ -83,6 +83,9 @@ export default {
|
||||
},
|
||||
setCenter(code) {
|
||||
this.$emit('setCenter', code);
|
||||
},
|
||||
routeSectionListFocus(flag) {
|
||||
this.$refs.routeEdit.routeSectionListFocus(flag);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -8,7 +8,7 @@
|
||||
center
|
||||
append-to-body
|
||||
>
|
||||
<el-table :data="data" :span-method="objectSpanMethod" border style="width: 100%">
|
||||
<el-table :data="data" border style="width: 100%">
|
||||
<template v-for="(item, index) in form">
|
||||
<el-table-column :key="index" :label="item.label">
|
||||
<template slot-scope="scope">
|
||||
@ -67,12 +67,6 @@ export default {
|
||||
},
|
||||
doClose(done) {
|
||||
this.show = false;
|
||||
},
|
||||
objectSpanMethod() {
|
||||
return {
|
||||
rowspan: 1,
|
||||
colspan: 1
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -297,7 +297,7 @@ export default {
|
||||
if (this.$refs && this.$refs.form) {
|
||||
delete this.addModel.id;
|
||||
this.$refs.form.resetFields();
|
||||
this.addModel.mapId = this.mapInfo.id;
|
||||
this.addModel.mapId = this.$route.params.mapId;
|
||||
this.addModel.relSectionSwitchList = [];
|
||||
this.addModel.code = '';
|
||||
this.addModel.unlockTime = 0;
|
||||
|
@ -0,0 +1,112 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-dialogDrag
|
||||
:title="mapInfo.name + ' / ' + '延续保护'"
|
||||
:visible.sync="show"
|
||||
width="30%"
|
||||
:before-close="doClose"
|
||||
center
|
||||
append-to-body
|
||||
>
|
||||
|
||||
<el-table ref="protetTable" border :data="data">
|
||||
<el-table-column key="1" label="解锁区段" prop="unlockSectionCode" />
|
||||
<el-table-column key="2" label="解锁时间(s)" prop="unlockTime" />
|
||||
<el-table-column key="3" label="延时保护线路" prop="">
|
||||
<el-table-column key="4" label="进路延续保护区段" prop="routeOverlapSectionList">
|
||||
<template slot-scope="scope">
|
||||
<template v-for="tag in scope.row.routeOverlapSectionList">
|
||||
<el-tag
|
||||
:key="tag"
|
||||
type="primary"
|
||||
style="margin-right: 10px; margin-bottom: 5px;"
|
||||
>{{ tag }}
|
||||
</el-tag></template>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column key="5" label="延续保护道岔" prop="">
|
||||
<el-table-column key="6" label="道岔" prop="switchCode" />
|
||||
<el-table-column key="7" label="道岔类型" prop="switchType" />
|
||||
</el-table-column>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex';
|
||||
export default {
|
||||
name: 'ProtectDetail',
|
||||
props: {
|
||||
mapInfo: {
|
||||
type: Object,
|
||||
default() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
show: false,
|
||||
title: '',
|
||||
data: []
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('map', [
|
||||
'switchList',
|
||||
'sectionList'
|
||||
])
|
||||
},
|
||||
methods: {
|
||||
doShow(data) {
|
||||
this.data = [];
|
||||
data.relSectionSwitchList.forEach(item => {
|
||||
const unlockSectionName = this.handleRouteOverlapSectionList(item, data.unlockSectionCode);
|
||||
if (item.routeOverlapSwitchList.length) {
|
||||
item.routeOverlapSwitchList.forEach( ele => {
|
||||
const column = {
|
||||
unlockSectionCode: unlockSectionName,
|
||||
unlockTime: data.unlockTime,
|
||||
routeOverlapSectionList: item.routeOverlapSectionList,
|
||||
switchCode: ele.switchCode,
|
||||
switchType: ele.normal ? '定位' : '反位'
|
||||
};
|
||||
this.$convertSpecifiedField(column, this.switchList, 'code', 'name', ['switchCode']);
|
||||
this.data.push(column);
|
||||
} );
|
||||
} else {
|
||||
const column = {
|
||||
unlockSectionCode: unlockSectionName,
|
||||
unlockTime: data.unlockTime,
|
||||
routeOverlapSectionList: item.routeOverlapSectionList,
|
||||
switchCode: '',
|
||||
switchType: ''
|
||||
};
|
||||
this.data.push(column);
|
||||
}
|
||||
});
|
||||
this.show = true;
|
||||
},
|
||||
handleRouteOverlapSectionList(data, unlockSectionCode) {
|
||||
this.sectionList.forEach(item => {
|
||||
const index = data.routeOverlapSectionList.indexOf(item.code);
|
||||
if (index >= 0) {
|
||||
data.routeOverlapSectionList[index] = item.name + '(' + item.code + ')';
|
||||
}
|
||||
if (item.code === unlockSectionCode) {
|
||||
unlockSectionCode = item.name + '(' + item.code + ')';
|
||||
}
|
||||
});
|
||||
return unlockSectionCode;
|
||||
},
|
||||
doClose(done) {
|
||||
this.show = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
@ -345,9 +345,24 @@ export default {
|
||||
this.addModel.name = val;
|
||||
}
|
||||
},
|
||||
'addModel.routeSectionList': function(val) {
|
||||
'addModel.routeSectionList': function(val, old) {
|
||||
if (old && old.length) {
|
||||
old.forEach((item) => {
|
||||
const section = this.$store.getters['map/getDeviceByCode'](item);
|
||||
section.instance.drawBatchSelected(false);
|
||||
});
|
||||
}
|
||||
if (val && val.length) {
|
||||
this.$refs.protect.addModel.unlockSectionCode = val[val.length - 1];
|
||||
val.forEach((item) => {
|
||||
const section = this.$store.getters['map/getDeviceByCode'](item);
|
||||
if (section.logicSectionCodeList && section.logicSectionCodeList.length) {
|
||||
section.logicSectionCodeList.forEach( (logicSectionCode) => {
|
||||
this.$store.getters['map/getDeviceByCode'](logicSectionCode).instance.drawBatchSelected(true);
|
||||
});
|
||||
}
|
||||
section.instance.drawBatchSelected(true);
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -466,6 +481,12 @@ export default {
|
||||
this.protectData = resp.data.list[0];
|
||||
});
|
||||
},
|
||||
routeSectionListFocus(flag) {
|
||||
this.addModel.routeSectionList.forEach((item) => {
|
||||
const section = this.$store.getters['map/getDeviceByCode'](item);
|
||||
section.instance.drawBatchSelected(flag);
|
||||
});
|
||||
},
|
||||
setSelected(selected) {
|
||||
if (selected) {
|
||||
if (selected._type.toUpperCase() === 'Signal'.toUpperCase() && this.field.toUpperCase() === 'startSignalCode'.toUpperCase()) {
|
||||
@ -473,8 +494,10 @@ export default {
|
||||
} else if (selected._type.toUpperCase() === 'Signal'.toUpperCase() && this.field.toUpperCase() === 'endSignalCode'.toUpperCase()) {
|
||||
this.addModel.endSignalCode = selected.code;
|
||||
} else if (selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'routeSectionList'.toUpperCase()) {
|
||||
if (this.addModel.routeSectionList.indexOf(selected.code) === -1) {
|
||||
if ((selected.type === '01' || selected.type === '03') && this.addModel.routeSectionList.indexOf(selected.code) === -1) {
|
||||
this.addModel.routeSectionList.push(selected.code);
|
||||
} else if (selected.type === '02' && this.addModel.routeSectionList.indexOf(selected.parentCode) === -1) {
|
||||
this.addModel.routeSectionList.push(selected.parentCode);
|
||||
}
|
||||
} else if (selected._type.toUpperCase() === 'Switch'.toUpperCase() && this.field.toUpperCase() === 'routeSwitchList'.toUpperCase()) {
|
||||
this.routeCode = selected.code;
|
||||
|
@ -320,31 +320,35 @@ export default {
|
||||
this.enabledTab = 'Section';
|
||||
} else {
|
||||
this.enabledTab = type;
|
||||
if (this.oldDevice && this.oldDevice.instance && typeof this.oldDevice.instance.drawSelected === 'function') {
|
||||
if (this.isSwitchSection) {
|
||||
if (this.oldDevice._type == 'Section' && this.oldDevice.type == '04') {
|
||||
this.oldDevice.relevanceSectionList.forEach(item => {
|
||||
const sectionModel = this.$store.getters['map/getDeviceByCode'](item);
|
||||
sectionModel.instance.drawSelected(false);
|
||||
});
|
||||
this.isSwitchSection = false;
|
||||
}
|
||||
}
|
||||
this.oldDevice.instance.drawSelected(false);
|
||||
}
|
||||
if (device && device.instance && typeof device.instance.drawSelected === 'function' ) {
|
||||
if (device._type == 'Section' && device.type == '04') {
|
||||
this.isSwitchSection = true;
|
||||
device.relevanceSectionList.forEach(item => {
|
||||
const sectionModel = this.$store.getters['map/getDeviceByCode'](item);
|
||||
sectionModel.instance.drawSelected(true);
|
||||
});
|
||||
}
|
||||
device.instance.drawSelected(true);
|
||||
}
|
||||
this.oldDevice = device;
|
||||
this.deviceHighLight(device);
|
||||
}
|
||||
},
|
||||
// 高亮设备
|
||||
deviceHighLight(device) {
|
||||
if (this.oldDevice && this.oldDevice.instance && typeof this.oldDevice.instance.drawSelected === 'function') {
|
||||
if (this.isSwitchSection) {
|
||||
if (this.oldDevice._type == 'Section' && this.oldDevice.type == '04') {
|
||||
this.oldDevice.relevanceSectionList.forEach(item => {
|
||||
const sectionModel = this.$store.getters['map/getDeviceByCode'](item);
|
||||
sectionModel.instance.drawSelected(false);
|
||||
});
|
||||
this.isSwitchSection = false;
|
||||
}
|
||||
}
|
||||
this.oldDevice.instance.drawSelected(false);
|
||||
}
|
||||
if (device && device.instance && typeof device.instance.drawSelected === 'function' ) {
|
||||
if (device._type == 'Section' && device.type == '04') {
|
||||
this.isSwitchSection = true;
|
||||
device.relevanceSectionList.forEach(item => {
|
||||
const sectionModel = this.$store.getters['map/getDeviceByCode'](item);
|
||||
sectionModel.instance.drawSelected(true);
|
||||
});
|
||||
}
|
||||
device.instance.drawSelected(true);
|
||||
}
|
||||
this.oldDevice = device;
|
||||
},
|
||||
esqTab(type) {
|
||||
this.esqType = type;
|
||||
},
|
||||
@ -383,6 +387,9 @@ export default {
|
||||
},
|
||||
setCenter(code) {
|
||||
this.$emit('setCenter', code);
|
||||
// 高亮
|
||||
const model = this.$store.getters['map/getDeviceByCode'](code);
|
||||
this.deviceHighLight(model);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -192,7 +192,6 @@ export default {
|
||||
deviceChange(code) {
|
||||
this.$emit('setCenter', code);
|
||||
this.deviceSelect(this.$store.getters['map/getDeviceByCode'](code));
|
||||
this.edit();
|
||||
},
|
||||
hover(field) {
|
||||
this.field = field === this.field ? '' : field;
|
||||
|
@ -240,6 +240,7 @@ export default {
|
||||
kmRangeLeft: 0,
|
||||
region: '',
|
||||
logicSectionNum: [],
|
||||
logicSectionCodeList: [],
|
||||
logicSectionShow: false, // 是否显示逻辑区段
|
||||
standTrack: false, // 是否站台轨
|
||||
standTrackName: '',
|
||||
|
@ -88,6 +88,10 @@ export default {
|
||||
counts += parseInt(ele.num);
|
||||
});
|
||||
if (count === 0 || allNotZeros) {
|
||||
const logicSectionCodeList = [];
|
||||
models.forEach(item=> {
|
||||
logicSectionCodeList.push(item.code);
|
||||
});
|
||||
this.sectionList.forEach(section => { // 删除之前的逻辑区段
|
||||
if (section.type === '02' && section.parentCode == this.editModel.code) {
|
||||
models.push(deepAssign(section, {_dispose: true}));
|
||||
@ -97,6 +101,7 @@ export default {
|
||||
logicSectionNumList = [];
|
||||
}
|
||||
this.editModel.logicSectionNum = [...logicSectionNumList];
|
||||
this.editModel.logicSectionCodeList = logicSectionCodeList;
|
||||
models.push(this.editModel);
|
||||
this.$emit('updateMapModel', models);
|
||||
} else {
|
||||
|
@ -253,7 +253,6 @@ export default {
|
||||
deviceChange(code) {
|
||||
this.$emit('setCenter', code);
|
||||
this.deviceSelect(this.$store.getters['map/getDeviceByCode'](code));
|
||||
this.edit();
|
||||
},
|
||||
hover(field) {
|
||||
this.field = field === this.field ? '' : field;
|
||||
|
BIN
static/model/device/stationstand.FBX
Normal file
BIN
static/model/device/stationstand.FBX
Normal file
Binary file not shown.
BIN
static/model/device/stationstand1.FBX
Normal file
BIN
static/model/device/stationstand1.FBX
Normal file
Binary file not shown.
BIN
static/model/jdq/jdq1000.FBX
Normal file
BIN
static/model/jdq/jdq1000.FBX
Normal file
Binary file not shown.
BIN
static/model/jdq/jdq1000111.FBX
Normal file
BIN
static/model/jdq/jdq1000111.FBX
Normal file
Binary file not shown.
BIN
static/model/jdq/jdq1700.FBX
Normal file
BIN
static/model/jdq/jdq1700.FBX
Normal file
Binary file not shown.
BIN
static/model/jdq/jdq480.FBX
Normal file
BIN
static/model/jdq/jdq480.FBX
Normal file
Binary file not shown.
BIN
static/model/jdq/jdqg.FBX
Normal file
BIN
static/model/jdq/jdqg.FBX
Normal file
Binary file not shown.
BIN
static/model/jdq/jdqh18.FBX
Normal file
BIN
static/model/jdq/jdqh18.FBX
Normal file
Binary file not shown.
Binary file not shown.
BIN
static/model/station/fuzhouold.FBX
Normal file
BIN
static/model/station/fuzhouold.FBX
Normal file
Binary file not shown.
BIN
static/model/station/topstation.FBX
Normal file
BIN
static/model/station/topstation.FBX
Normal file
Binary file not shown.
BIN
static/model/suidao/background.FBX
Normal file
BIN
static/model/suidao/background.FBX
Normal file
Binary file not shown.
BIN
static/model/suidao/background1.FBX
Normal file
BIN
static/model/suidao/background1.FBX
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 92 KiB |
Binary file not shown.
Before Width: | Height: | Size: 42 KiB |
Binary file not shown.
Before Width: | Height: | Size: 78 KiB |
Binary file not shown.
Before Width: | Height: | Size: 82 KiB |
Binary file not shown.
Before Width: | Height: | Size: 42 KiB |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user