综合演练三维通号原型
This commit is contained in:
parent
1257c252f5
commit
080d670c7d
@ -26,6 +26,17 @@ var Staticmodel = {
|
||||
//https://joylink.club/oss/wx/stationstand/stationstand.FBX
|
||||
//../../static/model/device/stationstand.FBX
|
||||
|
||||
},
|
||||
section: {
|
||||
id: "4",
|
||||
name: "区段",
|
||||
deviceType: "section",
|
||||
type: "low",
|
||||
picUrl: "",
|
||||
assetUrl: "../../static/model/device/section/section.FBX"
|
||||
//https://joylink.club/oss/wx/stationstand/stationstand.FBX
|
||||
//../../static/model/device/stationstand.FBX
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -26,11 +26,19 @@ export function ModelManager(){
|
||||
action:null
|
||||
};
|
||||
|
||||
this.sectionmodel = {
|
||||
code:"section",
|
||||
sectionstatus:"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));
|
||||
initlist.push(fbxpromise(data.section,mixers,scope.sectionmodel));
|
||||
|
||||
return new Promise(function(resolve, reject){
|
||||
|
||||
|
681
src/jlmap3d/jl3dmaintainer/Jl3dfaultdevice.js
Normal file
681
src/jlmap3d/jl3dmaintainer/Jl3dfaultdevice.js
Normal file
@ -0,0 +1,681 @@
|
||||
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 { Standtextureload } from '@/jlmap3d/jl3ddevice/standtextureload.js';
|
||||
import { Signallightload } from '@/jlmap3d/jl3ddevice/component/signallight.js';
|
||||
import { Moveanimate } from '@/jlmap3d/jl3ddevice/component/moveanimate.js';
|
||||
import { Textconfig } from '@/jlmap3d/jl3ddevice/component/textconfig.js';
|
||||
|
||||
import { getPublish3dMapDetail} from '@/api/jlmap3d/load3ddata';
|
||||
|
||||
|
||||
import StompClient from '@/utils/sock';
|
||||
|
||||
var clock = new THREE.Clock();
|
||||
export function Jl3dfaultdevice(dom,group,token,skinCode) {
|
||||
var scope = this;
|
||||
|
||||
this.dom = dom;
|
||||
this.nowcode = null;
|
||||
this.animateswitch = false;
|
||||
this.signallights = [];
|
||||
Signallightload(this.signallights);
|
||||
this.mixers = [];
|
||||
this.showmodel = null;
|
||||
|
||||
let helpbox,textplane;
|
||||
let daochamodel;
|
||||
|
||||
let psdtexturemap = [];
|
||||
//点击事件状态
|
||||
this.raycasterstatus = false;
|
||||
//动画状态
|
||||
this.animastats = false;
|
||||
//当前选中模型
|
||||
this.nowobject = null;
|
||||
//当前动画播放模型
|
||||
this.animationmodel = null;
|
||||
|
||||
this.stationtexture = [];
|
||||
this.devicetext = new Textconfig();
|
||||
|
||||
this.windowstatus = '0';
|
||||
|
||||
//初始化webgl渲染
|
||||
this.renderer = new THREE.WebGLRenderer({ antialias: true });
|
||||
this.renderer.setClearColor(new THREE.Color(0x000000));
|
||||
this.renderer.setSize(window.innerWidth, window.innerHeight);
|
||||
this.renderer.shadowMap.enabled = true;
|
||||
this.renderer.shadowMap.type = THREE.PCFSoftShadowMap;
|
||||
this.dom.appendChild(this.renderer.domElement);
|
||||
|
||||
//定义相机
|
||||
|
||||
this.camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.01, 200);
|
||||
this.camera.position.set(0, 20, 30);
|
||||
this.camera.aspect = window.innerWidth / window.innerHeight;
|
||||
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 moveanima = new Moveanimate(scope);
|
||||
|
||||
//定义全局光
|
||||
let ambientLight = new THREE.AmbientLight(0xffffff, 1.3);
|
||||
this.scene.add(ambientLight);
|
||||
|
||||
|
||||
var spotLight = new THREE.SpotLight(0xececff);
|
||||
spotLight.position.set(-50, 80, 0);
|
||||
spotLight.castShadow = true;
|
||||
spotLight.shadow.mapSize.width = 2048;
|
||||
spotLight.shadow.mapSize.height = 2048;
|
||||
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.screenSpacePanning = true;
|
||||
this.controls.update();
|
||||
|
||||
|
||||
|
||||
document.addEventListener( "mousedown", onselect, false );
|
||||
|
||||
let teststomp = new StompClient();
|
||||
// let topic = '/user/topic/simulation/assistant/'+group;
|
||||
let topic = '/user/queue/simulation/jl3d/'+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.nowcode = data.body.code;
|
||||
// scope.selectmodel(data);
|
||||
// }else{
|
||||
if(data.type == "DeviceCtrl_3D"){
|
||||
// console.log(data.body);
|
||||
if(data.body.code == scope.nowcode){
|
||||
scope.updateaction(data.body);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// }
|
||||
|
||||
}
|
||||
window.onresize = function () {
|
||||
scope.camera.aspect = window.innerWidth / window.innerHeight;
|
||||
scope.camera.updateProjectionMatrix();
|
||||
scope.renderer.setSize(window.innerWidth, window.innerHeight);
|
||||
}
|
||||
this.domresize = function(){
|
||||
scope.camera.aspect = window.innerWidth/ window.innerHeight;
|
||||
scope.camera.updateProjectionMatrix();
|
||||
scope.renderer.setSize(window.innerWidth, window.innerHeight);
|
||||
}
|
||||
this.anime = null;
|
||||
|
||||
this.modelmanager = new ModelManager();
|
||||
getPublish3dMapDetail(skinCode).then(netdata => {
|
||||
setpsdstationmap(JSON.parse(netdata.data.stands));
|
||||
Standtextureload(scope,JSON.parse(netdata.data.assets));
|
||||
scope.modelmanager.loadpromise(Staticmodel, scope.mixers).then(function (data) {
|
||||
moveanima.initlistnew(scope.modelmanager.switchmodel.mesh);
|
||||
daochamodel = scope.modelmanager.switchmodel.mesh.getObjectByName("DAOCHA");
|
||||
|
||||
// scope.stationtexture
|
||||
animate();
|
||||
})
|
||||
});
|
||||
|
||||
function setpsdstationmap(stationlist){
|
||||
for(let i=0,leni=stationlist.length;i<leni;i++){
|
||||
psdtexturemap[stationlist[i].direction1.code] = stationlist[i].code;
|
||||
psdtexturemap[stationlist[i].direction2.code] = stationlist[i].code;
|
||||
}
|
||||
}
|
||||
|
||||
//循环渲染函数
|
||||
function animate() {
|
||||
|
||||
scope.anime = requestAnimationFrame(animate);
|
||||
scope.renderer.render(scope.scene, scope.camera);
|
||||
scope.controls.update();
|
||||
//scope.camera.lookAt(plane);
|
||||
//
|
||||
moveanima.animateupdate();
|
||||
let delta = clock.getDelta();
|
||||
if (scope.mixers) {
|
||||
for (let i = 0; i < scope.mixers.length; i++) {
|
||||
if (scope.mixers[i]) {
|
||||
scope.mixers[i].update(delta);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
this.hideswitch = function (nowswitchstatus){
|
||||
if(nowswitchstatus){
|
||||
scope.modelmanager.switchmodel.mesh.add(daochamodel);
|
||||
}else{
|
||||
scope.modelmanager.switchmodel.mesh.remove(daochamodel);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
this.selectmodel = function (data) {
|
||||
console.log(data);
|
||||
if (scope.showmodel) {
|
||||
|
||||
if (scope.showmodel.code != data.code) {
|
||||
scope.scene.remove(scope.showmodel);
|
||||
scope.showmodel = null
|
||||
scope.nowcode = data.code;
|
||||
|
||||
if (data.type == "SWITCH") {
|
||||
// scope.modelmanager.switchmodel.locateType = data.body.locateType;
|
||||
scope.modelmanager.switchmodel.code = data.code;
|
||||
scope.showmodel = scope.modelmanager.switchmodel.mesh;
|
||||
scope.scene.add(scope.showmodel);
|
||||
// scope.devicetext.initdevicetext(scope.modelmanager.switchmodel.mesh);
|
||||
scope.nowobject = scope.modelmanager.switchmodel.mesh;
|
||||
// updatemenulist(scope.devicetext.devicelist);
|
||||
scope.raycasterstatus = true;
|
||||
}else{
|
||||
scope.raycasterstatus = false;
|
||||
scope.nowobject = "";
|
||||
// updatemenulist();
|
||||
}
|
||||
if (data.type == "SIGNAL") {
|
||||
scope.modelmanager.signalmodel.code = data.code;
|
||||
scope.showmodel = scope.modelmanager.signalmodel.mesh;
|
||||
scope.scene.add(scope.showmodel);
|
||||
|
||||
}
|
||||
|
||||
if (data.type == "PSD") {
|
||||
// console.log(data);
|
||||
scope.modelmanager.standmodel.code = data.code;
|
||||
scope.showmodel = scope.modelmanager.standmodel.mesh;
|
||||
scope.scene.add(scope.showmodel);
|
||||
scope.modelmanager.standmodel.action.reset();
|
||||
scope.modelmanager.standmodel.action.time = 0;
|
||||
scope.modelmanager.standmodel.action.timeScale = 1;
|
||||
scope.modelmanager.standmodel.action.play();
|
||||
|
||||
// scope.modelmanager.standmodel.mesh.getObjectByName("zhantaiming").material.map =scope.stationtexture[psdtexturemap[data.standCode]];
|
||||
// scope.modelmanager.standmodel.mesh.getObjectByName("zhantaiming").material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
if (data.type == "AXLE_COUNTER") {
|
||||
// console.log(data);
|
||||
scope.modelmanager.sectionmodel.code = data.code;
|
||||
scope.showmodel = scope.modelmanager.sectionmodel.mesh;
|
||||
scope.scene.add(scope.showmodel);
|
||||
|
||||
// scope.modelmanager.standmodel.mesh.getObjectByName("zhantaiming").material.map =scope.stationtexture[psdtexturemap[data.standCode]];
|
||||
// scope.modelmanager.standmodel.mesh.getObjectByName("zhantaiming").material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
if(scope.showmodel){
|
||||
scope.resetmodel();
|
||||
scope.showmodel.code = data.code;
|
||||
// initstatus(data);
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
scope.nowcode = data.code;
|
||||
|
||||
if (data.type == "SWITCH") {
|
||||
scope.modelmanager.switchmodel.normalPosition = "0";
|
||||
scope.showmodel = scope.modelmanager.switchmodel.mesh;
|
||||
scope.scene.add(scope.showmodel);
|
||||
// if (data.normalPosition == "0") {
|
||||
// scope.modelmanager.switchmodel.normalPosition = "0";
|
||||
// if(scope.modelmanager.switchmodel.action){
|
||||
// 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.normalPosition == "1") {
|
||||
// scope.modelmanager.switchmodel.normalPosition = "1";
|
||||
// if(scope.modelmanager.switchmodel.action){
|
||||
// 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.type == "SIGNAL") {
|
||||
scope.showmodel = scope.modelmanager.signalmodel.mesh;
|
||||
scope.scene.add(scope.showmodel);
|
||||
}
|
||||
|
||||
if (data.type == "PSD") {;
|
||||
scope.showmodel = scope.modelmanager.standmodel.mesh;
|
||||
scope.scene.add(scope.showmodel);
|
||||
scope.modelmanager.standmodel.action.reset();
|
||||
scope.modelmanager.standmodel.action.time = 0;
|
||||
scope.modelmanager.standmodel.action.timeScale = 1;
|
||||
scope.modelmanager.standmodel.action.play();
|
||||
// scope.modelmanager.standmodel.mesh.getObjectByName("zhantaiming").material.map =scope.stationtexture[psdtexturemap[data.standCode]];
|
||||
// scope.modelmanager.standmodel.mesh.getObjectByName("zhantaiming").material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
if (data.type == "AXLE_COUNTER") {
|
||||
scope.showmodel = scope.modelmanager.sectionmodel.mesh;
|
||||
scope.scene.add(scope.showmodel);
|
||||
|
||||
// scope.modelmanager.standmodel.mesh.getObjectByName("zhantaiming").material.map =scope.stationtexture[psdtexturemap[data.standCode]];
|
||||
// scope.modelmanager.standmodel.mesh.getObjectByName("zhantaiming").material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
// initstatus(data);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//设备分解、归位动画按钮
|
||||
this.disperdevice1 = function(){
|
||||
if(scope.nowobject.animacode){
|
||||
if(moveanima.status == true){
|
||||
if(scope.animastats == false){
|
||||
scope.animastats = true;
|
||||
moveanima.setplaylist(moveanima.animatelist[scope.nowobject.animacode+"on"],true)
|
||||
} else if(scope.animastats == true){
|
||||
scope.animastats = false;
|
||||
moveanima.setplaylist(moveanima.animatelist[scope.nowobject.animacode+"off"],true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
this.disperdevice2 = function(){
|
||||
if(scope.nowobject.animacode){
|
||||
if(moveanima.status == true){
|
||||
if(scope.animastats == false){
|
||||
scope.animastats = true;
|
||||
moveanima.setplaylist(moveanima.animatelist[scope.nowobject.animacode+"chaijie"],true);
|
||||
} else if(scope.animastats == true){
|
||||
scope.animastats = false;
|
||||
moveanima.setplaylist(moveanima.animatelist[scope.nowobject.animacode+"fuwei"],true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
this.resetmodel = function(){
|
||||
if(scope.nowobject.animacode){
|
||||
scope.animastats = false;
|
||||
moveanima.setplaylist(moveanima.animatelist[scope.nowobject.animacode+"fuwei"],true);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
this.animationmsgshowon = function(nowobject){
|
||||
scope.animationmodel = nowobject;
|
||||
if(helpbox){
|
||||
scope.animationmodel.helpbox = null;
|
||||
scope.scene.remove( helpbox );
|
||||
helpbox = undefined;
|
||||
}
|
||||
|
||||
settext(scope.animationmodel,scope.animationmodel.position);
|
||||
// console.log(scope.animationmodel);
|
||||
helpbox = new THREE.BoxHelper( scope.animationmodel, 0xff0000 );
|
||||
moveanima.updatehelpbox(helpbox,textplane);
|
||||
// settext(intersects[0].object,intersects[0].point);
|
||||
// getdevicemsg(intersects[0].object.name);
|
||||
scope.scene.add( helpbox );
|
||||
getdevicemsg(nowobject.name);
|
||||
}
|
||||
|
||||
this.animationmsgshowoff = function(nowobject){
|
||||
if(helpbox){
|
||||
scope.animationmodel.helpbox = null;
|
||||
scope.scene.remove( helpbox );
|
||||
helpbox = undefined;
|
||||
}
|
||||
if(textplane){
|
||||
scope.scene.remove(textplane);
|
||||
textplane.geometry.dispose();
|
||||
textplane.material.dispose();
|
||||
}
|
||||
scope.animationmodel = null;
|
||||
}
|
||||
|
||||
this.updateaction = function (data) {
|
||||
if (data.type == "SWITCH") {
|
||||
if (data.normal == "0") {
|
||||
scope.modelmanager.switchmodel.normalPosition = "0";
|
||||
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.normal == "1") {
|
||||
scope.modelmanager.switchmodel.normalPosition = "1";
|
||||
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.type == "SIGNAL") {//从上往下红绿黄
|
||||
if(data.red == 1){
|
||||
scope.modelmanager.signalmodel.mesh.children[0].material.map = scope.signallights["red"];
|
||||
scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true;
|
||||
}else{
|
||||
scope.modelmanager.signalmodel.mesh.children[0].material.map = scope.signallights["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true;
|
||||
}
|
||||
if(data.yellow == 1){
|
||||
scope.modelmanager.signalmodel.mesh.children[2].material.map = scope.signallights["yellow"];
|
||||
scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true;
|
||||
}else{
|
||||
scope.modelmanager.signalmodel.mesh.children[2].material.map = scope.signallights["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true;
|
||||
}
|
||||
if(data.green == 1){
|
||||
scope.modelmanager.signalmodel.mesh.children[1].material.map = scope.signallights["green"];
|
||||
scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true;
|
||||
}else{
|
||||
scope.modelmanager.signalmodel.mesh.children[1].material.map = scope.signallights["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (data.type == "PSD") {
|
||||
if (data.code == scope.nowcode) {
|
||||
if (data.open == "1" ) {
|
||||
scope.modelmanager.standmodel.screenDoorOpenStatus = "0";
|
||||
|
||||
scope.modelmanager.standmodel.action.reset();
|
||||
scope.modelmanager.standmodel.action.time = 0;
|
||||
scope.modelmanager.standmodel.action.timeScale = 1;
|
||||
scope.modelmanager.standmodel.action.play();
|
||||
}
|
||||
|
||||
if (data.open == "0" ) {
|
||||
scope.modelmanager.standmodel.screenDoorOpenStatus = "1";
|
||||
|
||||
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.
|
||||
}
|
||||
this.repairpsd = function(){
|
||||
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();
|
||||
}
|
||||
this.updateselect = function(updata){
|
||||
// console.log(updata);
|
||||
if(helpbox){
|
||||
scope.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);
|
||||
scope.scene.add( helpbox );
|
||||
}
|
||||
|
||||
function getdevicemsg(selectname){
|
||||
// console.log(selectname);
|
||||
for(let i=0,leni=scope.devicetext.devicelist.length;i<leni;i++){
|
||||
|
||||
if(selectname == scope.devicetext.devicelist[i].name){
|
||||
updatemsg(scope.devicetext.devicelist[i].text,scope.devicetext.devicelist[i].msg);
|
||||
i=leni;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function initstatus(data) {
|
||||
if (data._type == "Switch") {
|
||||
if (data.normalPosition == "0") {
|
||||
scope.modelmanager.switchmodel.normalPosition = "0";
|
||||
if(scope.modelmanager.switchmodel.action){
|
||||
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();
|
||||
}
|
||||
} else if (data.normalPosition == "1") {
|
||||
scope.modelmanager.switchmodel.normalPosition = "1";
|
||||
if(scope.modelmanager.switchmodel.action){
|
||||
scope.modelmanager.switchmodel.action.reset();
|
||||
scope.modelmanager.switchmodel.action.time = 0;
|
||||
scope.modelmanager.switchmodel.action.timeScale = -1;
|
||||
scope.modelmanager.switchmodel.action.play();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (data._type == "Signal") {
|
||||
if(data.logicLight == 0){
|
||||
if(data.redOpen == 1){
|
||||
scope.modelmanager.signalmodel.mesh.children[0].material.map = scope.signallights["red"];
|
||||
scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true;
|
||||
}else{
|
||||
scope.modelmanager.signalmodel.mesh.children[0].material.map = scope.signallights["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true;
|
||||
}
|
||||
if(data.yellowOpen == 1){
|
||||
scope.modelmanager.signalmodel.mesh.children[2].material.map = scope.signallights["yellow"];
|
||||
scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true;
|
||||
}else{
|
||||
scope.modelmanager.signalmodel.mesh.children[2].material.map = scope.signallights["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true;
|
||||
}
|
||||
if(data.greenOpen == 1){
|
||||
scope.modelmanager.signalmodel.mesh.children[1].material.map = scope.signallights["green"];
|
||||
scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true;
|
||||
}else{
|
||||
scope.modelmanager.signalmodel.mesh.children[1].material.map = scope.signallights["black"];
|
||||
scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true;
|
||||
}
|
||||
}else{
|
||||
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._type == "Psd") {
|
||||
if (data.screenDoorOpenStatus == "0") {
|
||||
scope.modelmanager.standmodel.screenDoorOpenStatus = "0";
|
||||
|
||||
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.screenDoorOpenStatus == "1") {
|
||||
scope.modelmanager.standmodel.screenDoorOpenStatus = "1";
|
||||
|
||||
scope.modelmanager.standmodel.action.reset();
|
||||
scope.modelmanager.standmodel.action.time = 0;
|
||||
scope.modelmanager.standmodel.action.timeScale = -1;
|
||||
scope.modelmanager.standmodel.action.play();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
this.updatewindowstatus = function(nowwindowstatus){
|
||||
scope.windowstatus == nowwindowstatus;
|
||||
}
|
||||
function onselect(event){
|
||||
if(event.button == '0'){
|
||||
|
||||
if(scope.raycasterstatus){
|
||||
|
||||
//定义光线
|
||||
let raycaster = new THREE.Raycaster();
|
||||
//定义平面鼠标点击坐标
|
||||
let mouse = new THREE.Vector2();
|
||||
let getBoundingClientRect = scope.dom.getBoundingClientRect()
|
||||
if(scope.windowstatus == '0'){
|
||||
mouse.x = ( (event.clientX - getBoundingClientRect .left) /scope.dom.offsetWidth) * 2-1;
|
||||
mouse.y = -( (event.clientY - getBoundingClientRect .top) / scope.dom.offsetHeight) * 2 + 1;
|
||||
}else{
|
||||
mouse.x = (event.clientX / scope.dom.offsetWidth) * 2 - 1;
|
||||
mouse.y = -(event.clientY / scope.dom.offsetHeight) * 2 + 1;
|
||||
}
|
||||
|
||||
raycaster.setFromCamera( mouse, scope.camera );
|
||||
|
||||
|
||||
let intersects = raycaster.intersectObjects( scope.modelmanager.switchmodel.mesh.children,true);
|
||||
if(helpbox){
|
||||
scope.scene.remove( helpbox );
|
||||
helpbox = null;
|
||||
}
|
||||
if(textplane){
|
||||
scope.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);
|
||||
|
||||
}
|
||||
|
||||
scope.scene.add( helpbox );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function settext(intersects,point){
|
||||
if(intersects.text){
|
||||
let textgeometry = new THREE.PlaneBufferGeometry( 18, 12, 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){
|
||||
scope.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+6;
|
||||
textplane.position.z = point.z;
|
||||
// console.log(textplane.position);
|
||||
// textplane.tcode = data[i].code;
|
||||
textplane.rotation.y = -Math.PI/2;
|
||||
textplane.lookAt(scope.camera.position);
|
||||
// scope.textlist.push(textplane);
|
||||
// newmesh.children[0].add(textplane);
|
||||
|
||||
scope.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;
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -19,12 +19,10 @@ import { OrbitControls } from '@/jlmap3d/main/control/OrbitControls';
|
||||
// import { DragControls } from '@/jlmap3d/main/control/DragControls';
|
||||
|
||||
//加载器
|
||||
import { SimulationLoad } from '@/jlmap3d/main/loaders/SimulationLoad';
|
||||
import { SimulationLoadNew } from '@/jlmap3d/main/loaders/SimulationLoadNew';
|
||||
import { MaintainerLoad } from '@/jlmap3d/jl3dmaintainer/maintainerload';
|
||||
|
||||
//connect
|
||||
import {Jlmap3dSubscribe } from '@/jlmap3d/jl3dsimulation/connect/Jlmap3dSubscribe';
|
||||
import {Jlmap3dSubscribeNew } from '@/jlmap3d/jl3dsimulation/connect/Jlmap3dSubscribeNew';
|
||||
import {Maintainerconnect } from '@/jlmap3d/jl3dmaintainer/maintainerconnect';
|
||||
|
||||
import { getPublishMapVersion, getPublishMapDetail,getPublish3dMapDetail} from '@/api/jlmap3d/load3ddata';
|
||||
|
||||
@ -97,11 +95,6 @@ export function JLmap3dMaintainer(dom, data,skinCode,storemod,routegroup,project
|
||||
};
|
||||
//地图模型数据
|
||||
let mapdata = new Jl3ddata();
|
||||
//订阅仿真socket
|
||||
// console.log(routegroup);
|
||||
// this.Subscribe = new Jlmap3dSubscribe(scope,routegroup,scope.jsonwebwork);
|
||||
//连接到通信
|
||||
//console.log(this.Subscribe.config);
|
||||
|
||||
this.webwork = new Worker("../../static/workertest/trainworker.js");
|
||||
//初始化加载数据和模型getPublishMapDetail
|
||||
@ -110,18 +103,13 @@ export function JLmap3dMaintainer(dom, data,skinCode,storemod,routegroup,project
|
||||
getPublish3dMapDetail(skinCode).then(netdata => {
|
||||
let assetsdata = JSON.parse(netdata.data.sections);
|
||||
if(assetsdata.link){
|
||||
scope.datatype = "old";
|
||||
scope.jsonwebwork = new Worker("../../static/workertest/jsonworker.js");
|
||||
scope.Subscribe = new Jlmap3dSubscribe(scope,routegroup,scope.jsonwebwork);
|
||||
scope.Subscribe.socketon(scope.Subscribe.topic);
|
||||
SimulationLoad(mapnetdata,scope,netdata.data,mapdata,camera,controls,scenesimulation,storemod);
|
||||
|
||||
}else{
|
||||
scope.datatype = "new";
|
||||
scope.jsonwebworknew = new Worker("../../static/workertest/jsonworkernew.js");
|
||||
scope.Subscribe = new Jlmap3dSubscribeNew(scope,routegroup,scope.jsonwebworknew);
|
||||
scope.jsonwebworknew = new Worker("../../static/workertest/maintainerworker.js");
|
||||
scope.Subscribe = new Maintainerconnect(scope,routegroup,scope.jsonwebworknew);
|
||||
scope.Subscribe.socketon(scope.Subscribe.topic);
|
||||
SimulationLoadNew(mapnetdata,scope,netdata.data,mapdata,camera,controls,scenesimulation,storemod);
|
||||
MaintainerLoad(mapnetdata,scope,netdata.data,mapdata,camera,controls,scenesimulation,storemod);
|
||||
}
|
||||
|
||||
});
|
||||
@ -304,7 +292,6 @@ export function JLmap3dMaintainer(dom, data,skinCode,storemod,routegroup,project
|
||||
trainlisttest = loadtrainlisttest;
|
||||
realsectionlist = loadrealsectionlist;
|
||||
rails = loadrails;
|
||||
console.log(stationstandlist);
|
||||
scope.updatecamera(stationstandlist.group.children[0],"station");
|
||||
|
||||
}
|
||||
@ -412,8 +399,7 @@ export function JLmap3dMaintainer(dom, data,skinCode,storemod,routegroup,project
|
||||
}
|
||||
|
||||
if(scope.raycasterswitch == "section"){
|
||||
console.log(sectionlist);
|
||||
console.log(linklist);
|
||||
|
||||
//console.log(sectionlist.sections.modellist);
|
||||
let intersects = raycaster.intersectObjects( linklist.linksgroup.children,true);
|
||||
if(intersects[0]){
|
||||
@ -424,7 +410,6 @@ export function JLmap3dMaintainer(dom, data,skinCode,storemod,routegroup,project
|
||||
}
|
||||
|
||||
if(scope.raycasterswitch == "signal"){
|
||||
console.log(signallist);
|
||||
let intersects = raycaster.intersectObjects( signallist.group.children,true);
|
||||
|
||||
if(intersects[0]){
|
||||
@ -435,7 +420,6 @@ export function JLmap3dMaintainer(dom, data,skinCode,storemod,routegroup,project
|
||||
}
|
||||
|
||||
if(scope.raycasterswitch == "switch"){
|
||||
console.log(sectionlist);
|
||||
let intersects = raycaster.intersectObjects( sectionlist.switchs.modellist,true);
|
||||
|
||||
if(intersects[0]){
|
||||
|
828
src/jlmap3d/jl3dmaintainer/maintainerconnect.js
Normal file
828
src/jlmap3d/jl3dmaintainer/maintainerconnect.js
Normal file
@ -0,0 +1,828 @@
|
||||
import StompClient from '@/utils/sock';
|
||||
|
||||
// import { getTrainingCbtcDemon, runDiagramStart, runDiagramOver, setTrainingCbtcInitTime } from '@/api/simulation';
|
||||
// import { creatSubscribe, clearSubscribe, displayTopic, screenTopic } from '@/utils/stomp';
|
||||
import { getBaseUrl } from '@/utils/baseUrl'
|
||||
import { getToken } from '@/utils/auth';
|
||||
|
||||
// 定于仿真socket接口
|
||||
export function Maintainerconnect(jlmap3d,routegroup,jsonwebwork) {
|
||||
|
||||
const scope = this;
|
||||
this.map = null;
|
||||
|
||||
var trainlisttest = null;
|
||||
var sectionlist = null;
|
||||
var signallist = null;
|
||||
var stationstandlist = null;
|
||||
var sectionlist = null;
|
||||
var materials = null;
|
||||
var actions = null;
|
||||
var rails = null;
|
||||
var links = null;
|
||||
|
||||
var scenes = null;
|
||||
|
||||
var code = null;
|
||||
|
||||
var drivingcode = null;
|
||||
var drivingspeed = null;
|
||||
var drivingaptspeed = null;
|
||||
|
||||
let driverswitch = false;
|
||||
|
||||
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;
|
||||
let header = {'X-Token': getToken() };
|
||||
let connectmsg = {
|
||||
type:'init',
|
||||
baseurl:getBaseUrl(),
|
||||
topic:this.topic,
|
||||
token:getToken(),
|
||||
};
|
||||
jsonwebwork.postMessage(connectmsg);
|
||||
jsonwebwork.onmessage = function (event) {
|
||||
|
||||
|
||||
|
||||
// if(event.data.deviceType == "TRAIN"){
|
||||
// // console.log(event.data);
|
||||
//
|
||||
// }
|
||||
if(event.data.type == "Device_Fault_Set_3D"){
|
||||
let newfault = {
|
||||
code:event.data.body.code,
|
||||
type:event.data.body.type,
|
||||
text:event.data.body.fault,
|
||||
fault:event.data.body.fault,
|
||||
}
|
||||
if(event.data.body.type == "SIGNAL"){
|
||||
if(event.data.body.fault == "MAIN_FILAMENT_BROKEN"){
|
||||
newfault.text = "主灯丝断丝故障";
|
||||
}
|
||||
}
|
||||
|
||||
if(event.data.body.type == "SWITCH"){
|
||||
if(event.data.body.fault == "SPLIT"){
|
||||
newfault.text = "道岔挤岔";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(event.data.body.type == "AXLE_COUNTER"){
|
||||
if(event.data.body.fault == "FAULT"){
|
||||
newfault.text = "计轴故障";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(event.data.body.type == "PSD"){
|
||||
if(event.data.body.fault == "FAULT"){
|
||||
newfault.text = "屏蔽门无法关闭故障";
|
||||
}
|
||||
|
||||
}
|
||||
warningmsg("新的故障设备:"+event.data.body.code);
|
||||
updatefault(newfault);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(event.data.type == "Device_Fault_Over_3D"){
|
||||
warningmsg("已修复故障设备:"+event.data.body.code);
|
||||
deletefault(event.data.body.code);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if(event.data.type == "Device_Load_Destroy_3D"){
|
||||
DeviceDestroy(event.data);
|
||||
resetfaultlist();
|
||||
let fault = event.data.body.faultInfoList;
|
||||
for(let i=0,leni= fault.length;i<leni;i++){
|
||||
updatefault(fault[i]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if(event.data.type == 'TrainRun_3D'){
|
||||
|
||||
for(let i=0,leni=event.data.body.length;i<leni;i++){
|
||||
// console.log(event.data.body[i]);
|
||||
trainrunnew(event.data.body[i]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// if(event.data.type == 'TRAIN'){
|
||||
// console.log(event.data);
|
||||
// trainrun(event.data);
|
||||
// }
|
||||
if (event.data.type== 'SIGNAL' && signallist) {
|
||||
signalupdate(event.data);
|
||||
// console.log(event.data);
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.data.type== "PSD" && actions) {
|
||||
standupdate(event.data);
|
||||
return;
|
||||
}
|
||||
if (event.data.type == "SWITCH") {
|
||||
switchupdate(event.data);
|
||||
return;
|
||||
}
|
||||
if (event.data.type == 'TRAIN_DOOR') {
|
||||
traindoorupdate(event.data);
|
||||
return;
|
||||
}
|
||||
|
||||
if(event.data.type == 'Simulation_Reset'){
|
||||
simulationreset(event.data);
|
||||
return;
|
||||
}
|
||||
if(event.data.type == 'Simulation_DeviceStatus'){
|
||||
initall(event.data.body);
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
this.updatamap = function(newsectionlist,newlinklist,newsignallist,newstationstandlist,newtrainlisttest,newrealsectionlist,newrails, materiallist, nowaction, scene) {
|
||||
trainlisttest = newtrainlisttest;
|
||||
sectionlist = newsectionlist;
|
||||
signallist = newsignallist;
|
||||
stationstandlist = newstationstandlist;
|
||||
materials = materiallist;
|
||||
scenes = scene;
|
||||
actions = nowaction;
|
||||
links = newlinklist;
|
||||
rails = newrails;
|
||||
};
|
||||
|
||||
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);
|
||||
for (let i=0; i<trainlisttest.group.children.length; i++) {
|
||||
if (trainlisttest.group.children[i].dispose == false) {
|
||||
code = trainlisttest.group.children[i].name;
|
||||
trainlisttest.list[code].rotation.y = 0;
|
||||
trainlisttest.list[code].open = '1';
|
||||
trainlisttest.list[code].speed = 0;
|
||||
trainlisttest.group.children[i].dispose = true;
|
||||
trainlisttest.group.children[i].position.x = -50000;
|
||||
trainlisttest.group.children[i].position.y = -50000;
|
||||
|
||||
trainlisttest.group.remove(trainlisttest.group.children[i]);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function trainrunnew(data){
|
||||
let code = data.code;
|
||||
|
||||
if(trainlisttest.list[code].right != data.right){
|
||||
|
||||
if(data.right == "0"){
|
||||
trainlisttest.list[code].right = "0";
|
||||
trainlisttest.list[code].rotation.y = Math.PI;
|
||||
let point = rails.sectionrail[data.section].lineleft.getPointAt(data.offset);
|
||||
trainlisttest.list[code].position.x = point.x;
|
||||
for (let tl=0; tl<6; tl++) {
|
||||
trainlisttest.list[code].children[tl].position.z = point.z;
|
||||
}
|
||||
}else{
|
||||
trainlisttest.list[code].right = "1";
|
||||
trainlisttest.list[code].rotation.y = 0;
|
||||
let point = rails.sectionrail[data.section].lineleft.getPointAt(data.offset);
|
||||
trainlisttest.list[code].position.x = point.x;
|
||||
for (let tl=0; tl<6; tl++) {
|
||||
trainlisttest.list[code].children[tl].position.z = point.z;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// console.log(data);
|
||||
|
||||
if(trainlisttest.list[code].dispose == "0"){
|
||||
if (data.right == '1') { // 向右
|
||||
trainlisttest.list[code].right = '1';
|
||||
trainlisttest.list[code].progress = data.offset;
|
||||
// trainlisttest.list[code].isstandsection = rails.sectionrail[data.section].standTrack;
|
||||
// if(rails.sectionrail[data.section].standTrack){
|
||||
// trainlisttest.list[code].statsstop = 0;
|
||||
// }
|
||||
let point = rails.sectionrail[data.section].lineleft.getPointAt(trainlisttest.list[code].progress);
|
||||
trainlisttest.list[code].rotation.y = 0;
|
||||
trainlisttest.list[code].position.x = point.x;
|
||||
trainlisttest.list[code].position.y = 0;
|
||||
|
||||
// for (let tl=0; tl<6; tl++) {
|
||||
// trainlisttest.list[code].children[tl].position.z = parseFloat(point.z);
|
||||
// }
|
||||
|
||||
// trainlisttest.list[code].curve = rails.sectionrail[data.section].lineleft;
|
||||
|
||||
// if(data.next){
|
||||
// trainlisttest.list[code].nextcode = data.next;
|
||||
// trainlisttest.list[code].nextcurve = rails.sectionrail[data.next].lineleft;
|
||||
// trainlisttest.list[code].nextlen = rails.sectionrail[data.next].lengthfact;
|
||||
// }
|
||||
// trainlisttest.list[code].len = rails.sectionrail[data.section].lengthfact;
|
||||
trainlisttest.list[code].status = '1';
|
||||
|
||||
if(trainlisttest.list[code].children[0].position.z != point.z){
|
||||
trainlisttest.list[code].children[0].up = new THREE.Vector3(1,0,0);
|
||||
let tangent = rails.sectionrail[data.section].lineleft.getTangentAt(data.offset).normalize();
|
||||
trainlisttest.list[code].children[0].axis.crossVectors(trainlisttest.list[code].children[0].up, tangent).normalize();
|
||||
let radians = Math.acos(trainlisttest.list[code].children[0].up.dot(tangent));
|
||||
trainlisttest.list[code].children[0].quaternion.setFromAxisAngle(trainlisttest.list[code].children[0].axis, radians);
|
||||
trainlisttest.list[code].children[0].rotation.x = -Math.PI/2;
|
||||
trainlisttest.list[code].children[0].rotation.z = trainlisttest.list[code].children[0].rotation.y;
|
||||
trainlisttest.list[code].children[0].rotation.y = 0;
|
||||
let rotas = {
|
||||
posr:point,
|
||||
rota:trainlisttest.list[code].children[0].rotation.z
|
||||
}
|
||||
trainlisttest.list[code].children[1].rotalist.push(rotas);
|
||||
|
||||
|
||||
let offsetz = parseFloat(point.z) - parseFloat(trainlisttest.list[code].children[0].position.z);
|
||||
trainlisttest.list[code].children[0].position.z += offsetz;
|
||||
}
|
||||
if(trainlisttest.list[code].children[1].rotalist.length > 0 || trainlisttest.list[code].children[2].rotalist.length > 0 || trainlisttest.list[code].children[3].rotalist.length > 0 || trainlisttest.list[code].children[4].rotalist.length > 0|| trainlisttest.list[code].children[5].rotalist.length > 0){
|
||||
for(let rs = 1;rs<6;rs++){
|
||||
//console.log(rs);
|
||||
if(trainlisttest.list[code].children[rs].rotalist[0]){
|
||||
let offsetz = parseFloat(trainlisttest.list[code].children[rs].rotalist[0].posr.z) - parseFloat(trainlisttest.list[code].children[rs].matrixWorld.elements[14]);
|
||||
|
||||
trainlisttest.list[code].children[rs].position.z += offsetz;
|
||||
|
||||
for(let xh=0;xh<trainlisttest.list[code].children[rs].rotalist.length;xh++){
|
||||
if((trainlisttest.list[code].children[rs].matrixWorld.elements[12])>=trainlisttest.list[code].children[rs].rotalist[0].posr.x){
|
||||
// if(trainlisttest.list[code].groupNumber == "005"){
|
||||
// console.log("rs:"+rs);
|
||||
// console.log(trainlisttest.list[code].children[rs].matrixWorld.elements[12]);
|
||||
// console.log(trainlisttest.list[code].children[rs].rotalist[0].posr.x);
|
||||
// }
|
||||
if(rs != 5){
|
||||
let asd = trainlisttest.list[code].children[rs].rotalist[0];
|
||||
trainlisttest.list[code].children[rs+1].rotalist.push(asd);
|
||||
|
||||
}
|
||||
|
||||
trainlisttest.list[code].children[rs].rotation.z = trainlisttest.list[code].children[rs].rotalist[0].rota;
|
||||
trainlisttest.list[code].children[rs].rotalist.splice(0,1)
|
||||
xh--;
|
||||
}else{
|
||||
xh = trainlisttest.list[code].children[rs].rotalist.length;
|
||||
}
|
||||
}
|
||||
//console.log(trainlisttest.list[code].children[rs].rotalist.length);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
} else if (data.right == '0') { // 向左
|
||||
trainlisttest.list[code].right = '0';
|
||||
trainlisttest.list[code].progress = 1-data.offset;
|
||||
// trainlisttest.list[code].isstandsection = rails.sectionrail[data.section].standTrack;
|
||||
// if(rails.sectionrail[data.section].standTrack){
|
||||
// trainlisttest.list[code].statsstop = 0;
|
||||
// }
|
||||
let point = rails.sectionrail[data.section].lineright.getPointAt(trainlisttest.list[code].progress);
|
||||
|
||||
trainlisttest.list[code].rotation.y = Math.PI;
|
||||
trainlisttest.list[code].position.x = point.x;
|
||||
trainlisttest.list[code].position.y = 0;
|
||||
|
||||
// for (let tl=0; tl<6; tl++) {
|
||||
// trainlisttest.list[code].children[tl].position.z = parseFloat(-point.z);
|
||||
// }
|
||||
|
||||
// trainlisttest.list[code].curve = rails.sectionrail[data.section].lineright;
|
||||
// if(data.next){
|
||||
// trainlisttest.list[code].nextcode = data.next;
|
||||
// trainlisttest.list[code].nextcurve = rails.sectionrail[data.next].lineright;
|
||||
// trainlisttest.list[code].nextlen = rails.sectionrail[data.next].lengthfact;
|
||||
// }
|
||||
// trainlisttest.list[code].len = rails.sectionrail[data.section].lengthfact;
|
||||
trainlisttest.list[code].status = '0';
|
||||
if(-trainlisttest.list[code].children[0].position.z != point.z){
|
||||
|
||||
|
||||
trainlisttest.list[code].children[0].up = new THREE.Vector3(-1,0,0);
|
||||
let tangent = rails.sectionrail[data.section].lineright.getTangentAt(data.offset).normalize();
|
||||
trainlisttest.list[code].children[0].axis.crossVectors(trainlisttest.list[code].children[0].up, tangent).normalize();
|
||||
let radians = Math.acos(trainlisttest.list[code].children[0].up.dot(tangent));
|
||||
trainlisttest.list[code].children[0].quaternion.setFromAxisAngle(trainlisttest.list[code].children[0].axis, radians);
|
||||
trainlisttest.list[code].children[0].rotation.x = -Math.PI/2;
|
||||
trainlisttest.list[code].children[0].rotation.z = trainlisttest.list[code].children[0].rotation.y;
|
||||
trainlisttest.list[code].children[0].rotation.y = 0;
|
||||
|
||||
let rotas = {
|
||||
posr:point,
|
||||
rota:trainlisttest.list[code].children[0].rotation.z
|
||||
}
|
||||
trainlisttest.list[code].children[1].rotalist.push(rotas);
|
||||
let offsetz = point.z + trainlisttest.list[code].children[0].position.z;
|
||||
trainlisttest.list[code].children[0].position.z -= offsetz;
|
||||
// trainlisttest.list[code].position.z = point.z;
|
||||
|
||||
}
|
||||
if(trainlisttest.list[code].children[1].rotalist.length > 0 || trainlisttest.list[code].children[2].rotalist.length > 0 || trainlisttest.list[code].children[3].rotalist.length > 0 || trainlisttest.list[code].children[4].rotalist.length > 0|| trainlisttest.list[code].children[5].rotalist.length > 0){
|
||||
|
||||
for(let rs = 1;rs<6;rs++){
|
||||
//console.log(rs);
|
||||
if(trainlisttest.list[code].children[rs].rotalist[0]){
|
||||
|
||||
let offsetz = parseFloat(trainlisttest.list[code].children[rs].rotalist[0].posr.z) + parseFloat(trainlisttest.list[code].children[rs].position.z);
|
||||
trainlisttest.list[code].children[rs].position.z -= offsetz;
|
||||
|
||||
for(let xh=0;xh<trainlisttest.list[code].children[rs].rotalist.length;xh++){
|
||||
if((trainlisttest.list[code].children[rs].matrixWorld.elements[12])<=trainlisttest.list[code].children[rs].rotalist[0].posr.x){
|
||||
|
||||
if(rs != 5){
|
||||
let asd = trainlisttest.list[code].children[rs].rotalist[0];
|
||||
trainlisttest.list[code].children[rs+1].rotalist.push(asd);
|
||||
|
||||
}
|
||||
//let offsetx = trainlisttest.list[code].children[1].matrixWorld.elements[12]-trainlisttest.list[code].children[0].children[3].matrixWorld.elements[12];
|
||||
|
||||
trainlisttest.list[code].children[rs].rotation.z = trainlisttest.list[code].children[rs].rotalist[0].rota;
|
||||
trainlisttest.list[code].children[rs].rotalist.splice(0,1)
|
||||
xh--;
|
||||
}else{
|
||||
xh = trainlisttest.list[code].children[rs].rotalist.length;
|
||||
}
|
||||
}
|
||||
//console.log(trainlisttest.list[code].children[rs].rotalist.length);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
// console.log(trainlisttest.list[code].rotalist);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
function trainrun(data){
|
||||
let code = data.code;
|
||||
// console.log(data);
|
||||
if(trainlisttest.list[code].dispose == "0"){
|
||||
if(trainlisttest.list[code].curve == null){
|
||||
if (data.right == '1') { // 向右
|
||||
trainlisttest.list[code].right = '1';
|
||||
trainlisttest.list[code].progress = data.offset;
|
||||
trainlisttest.list[code].isstandsection = rails.sectionrail[data.section].standTrack;
|
||||
if(rails.sectionrail[data.section].standTrack){
|
||||
trainlisttest.list[code].statsstop = 0;
|
||||
}
|
||||
let point = rails.sectionrail[data.section].lineleft.getPointAt(trainlisttest.list[code].progress);
|
||||
trainlisttest.list[code].rotation.y = 0;
|
||||
trainlisttest.list[code].position.x = point.x;
|
||||
trainlisttest.list[code].position.y = 0;
|
||||
for (let tl=0; tl<6; tl++) {
|
||||
trainlisttest.list[code].children[tl].position.z = parseFloat(point.z);
|
||||
}
|
||||
|
||||
trainlisttest.list[code].curve = rails.sectionrail[data.section].lineleft;
|
||||
|
||||
if(data.next){
|
||||
trainlisttest.list[code].nextcode = data.next;
|
||||
trainlisttest.list[code].nextcurve = rails.sectionrail[data.next].lineleft;
|
||||
trainlisttest.list[code].nextlen = rails.sectionrail[data.next].lengthfact;
|
||||
}
|
||||
trainlisttest.list[code].len = rails.sectionrail[data.section].lengthfact;
|
||||
trainlisttest.list[code].status = '1';
|
||||
|
||||
} else if (data.right == '0') { // 向左
|
||||
trainlisttest.list[code].right = '0';
|
||||
trainlisttest.list[code].progress = 1-data.offset;
|
||||
trainlisttest.list[code].isstandsection = rails.sectionrail[data.section].standTrack;
|
||||
if(rails.sectionrail[data.section].standTrack){
|
||||
trainlisttest.list[code].statsstop = 0;
|
||||
}
|
||||
let point = rails.sectionrail[data.section].lineright.getPointAt(trainlisttest.list[code].progress);
|
||||
|
||||
trainlisttest.list[code].rotation.y = Math.PI;
|
||||
trainlisttest.list[code].position.x = point.x;
|
||||
trainlisttest.list[code].position.y = 0;
|
||||
|
||||
for (let tl=0; tl<6; tl++) {
|
||||
trainlisttest.list[code].children[tl].position.z = parseFloat(-point.z);
|
||||
}
|
||||
|
||||
trainlisttest.list[code].curve = rails.sectionrail[data.section].lineright;
|
||||
if(data.next){
|
||||
trainlisttest.list[code].nextcode = data.next;
|
||||
trainlisttest.list[code].nextcurve = rails.sectionrail[data.next].lineright;
|
||||
trainlisttest.list[code].nextlen = rails.sectionrail[data.next].lengthfact;
|
||||
}
|
||||
trainlisttest.list[code].len = rails.sectionrail[data.section].lengthfact;
|
||||
trainlisttest.list[code].status = '0';
|
||||
}
|
||||
|
||||
|
||||
}else{
|
||||
//后端数据驱动车的位置更新与代码驱动车的移动相结合
|
||||
|
||||
if(data.code != trainlisttest.list[code].code){
|
||||
if (data.right == '1') { // 向右
|
||||
trainlisttest.list[code].right = '1';
|
||||
trainlisttest.list[code].nowcode = data.code;
|
||||
trainlisttest.list[code].curve = rails.sectionrail[data.section].lineleft;
|
||||
trainlisttest.list[code].progress = data.offset;
|
||||
trainlisttest.list[code].nextcode = data.next;
|
||||
trainlisttest.list[code].nextcurve = rails.sectionrail[data.next].lineleft;
|
||||
trainlisttest.list[code].nextlen = rails.sectionrail[data.next].lengthfact;
|
||||
trainlisttest.list[code].nextissection = rails.sectionrail[data.next].standTrack;
|
||||
} else if (data.right == '0') { // 向左
|
||||
trainlisttest.list[code].right = '0';
|
||||
trainlisttest.list[code].nowcode = data.code;
|
||||
trainlisttest.list[code].curve = rails.sectionrail[data.section].lineright;
|
||||
trainlisttest.list[code].progress = 1-data.offset;
|
||||
trainlisttest.list[code].nextcode = data.next;
|
||||
trainlisttest.list[code].nextcurve = rails.sectionrail[data.next].lineright;
|
||||
trainlisttest.list[code].nextlen = rails.sectionrail[data.next].lengthfact;
|
||||
trainlisttest.list[code].nextissection = rails.sectionrail[data.next].standTrack;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(data.speed == 0){
|
||||
trainlisttest.list[code].speeds = 0;
|
||||
trainlisttest.list[code].statsstop = 0;
|
||||
}else{
|
||||
trainlisttest.list[code].speeds = parseFloat(data.speed*10/36/18/trainlisttest.list[code].len);
|
||||
}
|
||||
if(data.right != trainlisttest.list[code].status){
|
||||
|
||||
trainlisttest.list[code].status = data.right;
|
||||
trainlisttest.list[code].curve = null;
|
||||
trainlisttest.list[code].nextcurve = null;
|
||||
trainlisttest.list[code].nextlen = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function initall(data){
|
||||
for(let i=0,leni=data.length;i<leni;i++){
|
||||
if(data[i].deviceType == "SWITCH"){
|
||||
initswitch(data[i]);
|
||||
}
|
||||
if(data[i].deviceType == "PSD"){
|
||||
initstand(data[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function DeviceDestroy(data){
|
||||
for(let i=0,leni=data.body.length;i<leni;i++){
|
||||
|
||||
if(data.body[i].type == "TRAIN"){
|
||||
code =data.body[i].code;
|
||||
if (trainlisttest.list[code].dispose != data.body[i].dispose && data.body[i].dispose == "0") {
|
||||
|
||||
if (rails.sectionrail[data.body[i].section]) {
|
||||
|
||||
trainlisttest.group.add(trainlisttest.list[code]);
|
||||
trainlisttest.list[code].position.y = 0;
|
||||
// trainlisttest.list[code].progress = 0;
|
||||
trainlisttest.list[code].dispose = "0";
|
||||
trainlisttest.list[code].nowcode = data.body[i].section;
|
||||
trainlisttest.list[code].nextcode = null;
|
||||
trainlisttest.list[code].curve = null;
|
||||
trainlisttest.list[code].nextcurve = null;
|
||||
trainlisttest.list[code].pc = 1;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
} else if (trainlisttest.list[code].dispose != data.body[i].dispose && data.body[i].dispose == "1") {
|
||||
trainlisttest.list[code].status = 1;
|
||||
trainlisttest.group.remove(trainlisttest.list[code]);
|
||||
trainlisttest.list[code].progress = null;
|
||||
trainlisttest.list[code].dispose = "1";
|
||||
code = trainlisttest.group.children[i].name;
|
||||
trainlisttest.list[code].rotation.y = 0;
|
||||
trainlisttest.list[code].open = '1';
|
||||
trainlisttest.list[code].curve = null;
|
||||
trainlisttest.list[code].nextcurve = null;
|
||||
trainlisttest.list[code].speed = 0;
|
||||
trainlisttest.list[code].position.x = -50000;
|
||||
trainlisttest.list[code].position.y = -50000;
|
||||
trainlisttest.list[code].pc = 1;
|
||||
|
||||
}
|
||||
}
|
||||
if(data.body[i].type == "SIGNAL"){
|
||||
signalupdate(data.body[i]);
|
||||
}
|
||||
if(data.body[i].type == "SWITCH"){
|
||||
switchupdate(data.body[i]);
|
||||
}
|
||||
if(data.body[i].type == "PSD"){
|
||||
standupdate(data.body[i]);
|
||||
}
|
||||
if(data.body[i].type == "TRAIN_DOOR"){
|
||||
traindoorupdate(data.body[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function traindoorupdate(data){
|
||||
let code = data.code;
|
||||
if(trainlisttest.list[code].right == "0"){
|
||||
if(data.doorCode == "2"){
|
||||
|
||||
if(trainlisttest.list[code].open != data.open && data.open == "0"){
|
||||
trainlisttest.list[code].open = "0";
|
||||
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].open != data.open && data.open == "1"){
|
||||
trainlisttest.list[code].open = "1";
|
||||
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].open != data.open && data.open == '0') {
|
||||
trainlisttest.list[code].open = '0';
|
||||
for (let an=actions[code].down.length-1; an>=0; an--) {
|
||||
actions[code].down[an].reset();
|
||||
actions[code].down[an].time = actions[code].down[an]._clip.duration;
|
||||
actions[code].down[an].timeScale = -1;
|
||||
actions[code].down[an].play();
|
||||
}
|
||||
} else if (trainlisttest.list[code].open != data.open && data.open == '1') {
|
||||
trainlisttest.list[code].open = "1";
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}else{
|
||||
if(data.doorCode == "1"){
|
||||
|
||||
if(trainlisttest.list[code].open != data.open && data.open == "0"){
|
||||
trainlisttest.list[code].open = "0";
|
||||
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].open != data.open && data.open == "1"){
|
||||
trainlisttest.list[code].open = "1";
|
||||
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].open != data.open && data.open == '0') {
|
||||
trainlisttest.list[code].open = '0';
|
||||
for (let an=actions[code].down.length-1; an>=0; an--) {
|
||||
actions[code].down[an].reset();
|
||||
actions[code].down[an].time = actions[code].down[an]._clip.duration;
|
||||
actions[code].down[an].timeScale = -1;
|
||||
actions[code].down[an].play();
|
||||
}
|
||||
} else if (trainlisttest.list[code].open != data.open && data.open == '1') {
|
||||
trainlisttest.list[code].open = "1";
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function trainstatus(data){
|
||||
// 遍历列车对象组
|
||||
if (trainlisttest) {
|
||||
|
||||
code = data.code;
|
||||
// 剔除不显示的车
|
||||
// 找到对应列车
|
||||
if ( trainlisttest.list[code]) {
|
||||
|
||||
trainlisttest.list[code].driveMode = data.driveMode;
|
||||
trainlisttest.list[code].status = data.right;
|
||||
// 车门开关验证
|
||||
|
||||
|
||||
// 遍历获取所在轨道
|
||||
if (trainlisttest.list[code].dispose != data.dispose && data.dispose == "0") {
|
||||
if (rails.sectionrail[data.sectionCode]) {
|
||||
|
||||
trainlisttest.group.add(trainlisttest.list[code]);
|
||||
trainlisttest.list[code].position.y = 0;
|
||||
// trainlisttest.list[code].progress = 0;
|
||||
trainlisttest.list[code].dispose = "0";
|
||||
trainlisttest.list[code].nowcode = data.sectionCode;
|
||||
trainlisttest.list[code].nextcode = null;
|
||||
trainlisttest.list[code].curve = null;
|
||||
trainlisttest.list[code].nextcurve = null;
|
||||
trainlisttest.list[code].pc = 1;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
} else if (trainlisttest.list[code].dispose != data.dispose && data.dispose == "1") {
|
||||
trainlisttest.list[code].status = 1;
|
||||
trainlisttest.group.remove(trainlisttest.list[code]);
|
||||
trainlisttest.list[code].progress = null;
|
||||
trainlisttest.list[code].dispose = "1";
|
||||
code = trainlisttest.group.children[i].name;
|
||||
trainlisttest.list[code].rotation.y = 0;
|
||||
trainlisttest.list[code].open = '1';
|
||||
trainlisttest.list[code].curve = null;
|
||||
trainlisttest.list[code].nextcurve = null;
|
||||
trainlisttest.list[code].speed = 0;
|
||||
trainlisttest.list[code].position.x = -50000;
|
||||
trainlisttest.list[code].position.y = -50000;
|
||||
trainlisttest.list[code].pc = 1;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function initstand(data) {
|
||||
code = data.code;
|
||||
if ( actions[code]) {
|
||||
if (data.close == '1') {
|
||||
actions[code].status = '1';
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = 0;
|
||||
actions[code].action.timeScale = 1;
|
||||
actions[code].action.play();
|
||||
}
|
||||
if (data.close == '0') {
|
||||
actions[code].status = '0';
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = actions[code].action._clip.duration;
|
||||
actions[code].action.timeScale = -1;
|
||||
actions[code].action.play();
|
||||
}
|
||||
}
|
||||
}
|
||||
function standupdate(data) {
|
||||
code = data.code;
|
||||
if ( actions[code]) {
|
||||
if (data.open == '1') {
|
||||
actions[code].status = '1';
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = 0;
|
||||
actions[code].action.timeScale = 1;
|
||||
actions[code].action.play();
|
||||
}
|
||||
if (data.open == '0') {
|
||||
actions[code].status = '0';
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = actions[code].action._clip.duration;
|
||||
actions[code].action.timeScale = -1;
|
||||
actions[code].action.play();
|
||||
}
|
||||
}
|
||||
}
|
||||
function signalupdate(data) {
|
||||
code = data.code;
|
||||
if(data.red == 1){
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials[0];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
}else{
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
||||
}
|
||||
|
||||
if(data.yellow == 1){
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials[1];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
|
||||
}else{
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
|
||||
if(data.green == 1){
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials[2];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
|
||||
}else{
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map = materials[3];
|
||||
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function initswitch(data) {
|
||||
code = data.code;
|
||||
if (data.routeLock == '0') {
|
||||
// sectionlist.switchs.modellist[j].normal = data.normal;
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = 0;
|
||||
actions[code].action.timeScale = 1;
|
||||
actions[code].action.play();
|
||||
actions[code].normal = "02";
|
||||
} else if (data.routeLock == '1') {
|
||||
// sectionlist.switchs.modellist[j].normal = data.normal;
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = actions[code].action._clip.duration;
|
||||
actions[code].action.timeScale = -1;
|
||||
actions[code].action.play();
|
||||
actions[code].normal = "01";
|
||||
}
|
||||
}
|
||||
|
||||
function switchupdate(data) {
|
||||
code = data.code;
|
||||
if (actions[code].normal != data.normal) {
|
||||
if (data.normal == '02') {
|
||||
// sectionlist.switchs.modellist[j].normal = data.normal;
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = 0;
|
||||
actions[code].action.timeScale = 1;
|
||||
actions[code].action.play();
|
||||
actions[code].normal = "02";
|
||||
} else if (data.normal == '01') {
|
||||
// sectionlist.switchs.modellist[j].normal = data.normal;
|
||||
actions[code].action.reset();
|
||||
actions[code].action.time = actions[code].action._clip.duration;
|
||||
actions[code].action.timeScale = -1;
|
||||
actions[code].action.play();
|
||||
actions[code].normal = "01";
|
||||
}
|
||||
}
|
||||
}
|
||||
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--;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
213
src/jlmap3d/jl3dmaintainer/maintainerload.js
Normal file
213
src/jlmap3d/jl3dmaintainer/maintainerload.js
Normal file
@ -0,0 +1,213 @@
|
||||
//componnent
|
||||
import {SectionList} from '@/jlmap3d/main/model/SectionList.js';
|
||||
import {SignalList} from '@/jlmap3d/main/model/SignalList.js';
|
||||
import {StationStandList} from '@/jlmap3d/main/model/StationStandList.js';
|
||||
import {TrainList} from '@/jlmap3d/main/model/TrainList.js';
|
||||
import {RealSectionList} from '@/jlmap3d/main/model/RealSectionList.js';
|
||||
import {LinkList} from '@/jlmap3d/main/model/LinkList.js';
|
||||
import {RailList} from '@/jlmap3d/main/model/RailList.js';
|
||||
|
||||
import {TrainListN} from '@/jlmap3d/main/newmodel/TrainListN.js';
|
||||
import {SectionListN} from '@/jlmap3d/main/newmodel/SectionListN';
|
||||
import {SignalListN} from '@/jlmap3d/main/newmodel/SignalListN';
|
||||
import {StationStandListN} from '@/jlmap3d/main/newmodel/StationStandListN';
|
||||
import {SwitchListN} from '@/jlmap3d/main/newmodel/SwitchListN';
|
||||
import {RailListN} from '@/jlmap3d/main/newmodel/RailListN.js';
|
||||
|
||||
|
||||
import {Materialload} from '@/jlmap3d/main/loaders/Materialload.js';
|
||||
|
||||
import { Loading } from 'element-ui';
|
||||
// import {SwitchModel} from '@/jlmap3d/model/SwitchModel.js';
|
||||
|
||||
export function MaintainerLoad(data,scope,netdata,mapdata,camera,controls,scene){
|
||||
//console.log(mapdata);
|
||||
|
||||
//console.log(data);
|
||||
//console.log(scope);
|
||||
let sceneload = scene;
|
||||
let backdata = scope;
|
||||
let jlmap3ddata = mapdata;
|
||||
let assetloader = scope.assetloader;
|
||||
|
||||
let mixers = scope.mixers;
|
||||
let actions = scope.actions;
|
||||
|
||||
let linklist,sectionlist,signallist,stationstandlist,trainlisttest,switchlist,realsectionlist,rails;
|
||||
|
||||
let loadingInstance = Loading.service({ fullscreen: true });
|
||||
|
||||
let isSection = false;
|
||||
let isNewdata = false;
|
||||
if(netdata.assets){
|
||||
initnew3d(data,netdata);
|
||||
}else{
|
||||
loadingInstance.close();
|
||||
alert("没有三维数据");
|
||||
}
|
||||
|
||||
function initnew3d(data,netdata){
|
||||
Materialload(scope,JSON.parse(netdata.assets));
|
||||
let mapdata = data;
|
||||
//初始化轨道和道岔
|
||||
// lengthfact(data);
|
||||
|
||||
// linklist = new LinkList();
|
||||
sectionlist = new SectionListN();
|
||||
signallist = new SignalListN();
|
||||
switchlist = new SwitchListN();
|
||||
//初始化站台
|
||||
stationstandlist = new StationStandListN();
|
||||
//初始化测试列车
|
||||
trainlisttest = new TrainListN();
|
||||
// realsectionlist = new RealSectionList();
|
||||
|
||||
rails = new RailListN();
|
||||
|
||||
let sectiondata = JSON.parse(netdata.sections);
|
||||
let switchdata = JSON.parse(netdata.switchs);
|
||||
let signaldata = JSON.parse(netdata.signals);
|
||||
let standsdata = JSON.parse(netdata.stands);
|
||||
let psddata = data.psdList;
|
||||
assetloader.setmodellistnew(netdata.assets);
|
||||
|
||||
assetloader.assetpromise(sceneload)
|
||||
// .then(function(data){
|
||||
// return linklist.loadpromise(loaderdata.link,sceneload,assetloader);
|
||||
// })
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
//,netdata.stands,mixers,actions,"0"
|
||||
|
||||
return stationstandlist.loadpromise(mapdata.stationList,standsdata,psddata,sceneload,assetloader,mixers,actions,"02");
|
||||
})
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
return sectionlist.loadpromise(mapdata.sectionList,sectiondata.section,rails,scene,assetloader);
|
||||
})
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
return signallist.loadpromise(mapdata.signalList,signaldata,sceneload,assetloader);
|
||||
})
|
||||
.then(function(data){
|
||||
return switchlist.loadpromise(mapdata.switchList,switchdata,sceneload,assetloader,mixers,actions);
|
||||
})
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
//console.log(assetloader);
|
||||
return trainlisttest.initpromise(mapdata.trainList,sceneload,assetloader,mixers,actions,"02");
|
||||
})
|
||||
// .then(function(data){
|
||||
// return new Promise(function(resolve, reject){
|
||||
// rails.init(sectiondata.section,sectiondata,switchdata,sceneload);
|
||||
// resolve("loadrail");
|
||||
//
|
||||
// });
|
||||
// })
|
||||
.then(function(data){
|
||||
return new Promise(function(resolve, reject){
|
||||
|
||||
//
|
||||
let netasset = JSON.parse(netdata.assets);
|
||||
if(netasset.istexture){
|
||||
for(let mm=0;mm< stationstandlist.group.children.length;mm++){
|
||||
let stationname = stationstandlist.group.children[mm].name;
|
||||
stationstandlist.group.children[mm].getObjectByName("zhantailiebiao").material.map =scope.stationtexture["stationlist"];
|
||||
stationstandlist.group.children[mm].getObjectByName("zhantailiebiao").material.map.needsUpdate = true;
|
||||
let newmaterial = stationstandlist.group.children[mm].getObjectByName("zhantaiming").material.clone();
|
||||
newmaterial.map =scope.stationtexture[stationname];
|
||||
stationstandlist.group.children[mm].getObjectByName("zhantaiming").material = newmaterial;
|
||||
stationstandlist.group.children[mm].getObjectByName("zhantaiming").material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
for(let mn=0;mn<scope.assetloader.modellist.length;mn++){
|
||||
if(scope.assetloader.modellist[mn].deviceType && scope.assetloader.modellist[mn].deviceType == "suidaobg"){
|
||||
// scope.assetloader.modellist[mn].mesh.deviceType = "suidaobg";
|
||||
scene.add(scope.assetloader.modellist[mn].mesh);
|
||||
}
|
||||
}
|
||||
// console.log(stationstandlist.group.children[0].name );
|
||||
// if(stationstandlist.group.children[0].name == "Station75414"){
|
||||
// for(let mn=0;mn<scope.assetloader.modellist.length;mn++){
|
||||
// if(scope.assetloader.modellist[mn].name && scope.assetloader.modellist[mn].name == "nbsuidao"){
|
||||
// scope.assetloader.modellist[mn].mesh.name = "nbsuidao";
|
||||
// scene.add(scope.assetloader.modellist[mn].mesh);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
resolve("mergemodel");
|
||||
});
|
||||
})
|
||||
.then(function(data){
|
||||
// for(let mn=0;mn<scope.assetloader.modellist.length;mn++){
|
||||
// if(scope.assetloader.modellist[mn].name && scope.assetloader.modellist[mn].name == "suidao"){
|
||||
// // scope.assetloader.modellist[mn].mesh.rotation.x = Math.PI/2;
|
||||
// // scope.assetloader.modellist[mn].mesh.position.y -=0.1;
|
||||
// // console.log(scope.assetloader.modellist[mn].mesh);
|
||||
// scene.add(scope.assetloader.modellist[mn].mesh);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // mapdata = jlmap3ddata;
|
||||
backdata.loaderdata(sectionlist,linklist,signallist,stationstandlist,trainlisttest,realsectionlist,rails);
|
||||
scope.Subscribe.updatamap(sectionlist,linklist,signallist,stationstandlist,trainlisttest,realsectionlist,rails,scope.materiallist,scope.actions,scope.sceneload);
|
||||
scope.webwork.postMessage("on");
|
||||
scope.jsonwebworknew.postMessage("connect");
|
||||
loadingInstance.close();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function onProgress( xhr ) {
|
||||
|
||||
if ( xhr.lengthComputable ) {
|
||||
|
||||
let percentComplete = xhr.loaded / xhr.total * 100;
|
||||
//console.log( 'model ' + Math.round( percentComplete, 2 ) + '% downloaded' );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function onError() {}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function lengthfact(data){
|
||||
let linklist = [];
|
||||
//console.log(data);
|
||||
for(let i=0;i<data.linkList.length;i++){
|
||||
|
||||
let dx = Math.abs(data.linkList[i].lp.x - data.linkList[i].rp.x);
|
||||
let dy = Math.abs(data.linkList[i].lp.y - data.linkList[i].rp.y);
|
||||
let distance = Math.sqrt(Math.pow(dx,2)+Math.pow(dy,2));
|
||||
|
||||
let link = {
|
||||
code:data.linkList[i].code,
|
||||
lengthfact:data.linkList[i].lengthFact,
|
||||
distance:distance
|
||||
};
|
||||
linklist.push(link);
|
||||
}
|
||||
|
||||
let sectionlist = [];
|
||||
for(let i=0;i<data.sectionList.length;i++){
|
||||
for(let j=0;j<linklist.length;j++){
|
||||
if(linklist[j].code == data.sectionList[i].linkCode){
|
||||
let sectionoffset = data.sectionList[i].offsetRight - data.sectionList[i].offsetLeft;
|
||||
let sectionlengthfact = sectionoffset/linklist[j].distance*linklist[j].lengthfact
|
||||
let section = {
|
||||
code:data.sectionList[i].code,
|
||||
lengthfact:sectionoffset
|
||||
};
|
||||
sectionlist.push(section);
|
||||
j = linklist.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//console.log(sectionlist);
|
||||
}
|
@ -2,9 +2,9 @@ export function getBaseUrl() {
|
||||
let BASE_API;
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
// BASE_API = 'https://joylink.club/jlcloud';
|
||||
BASE_API = 'https://test.joylink.club/jlcloud';
|
||||
// BASE_API = 'https://test.joylink.club/jlcloud';
|
||||
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪
|
||||
// BASE_API = 'http://192.168.3.6:9000'; // 旭强
|
||||
BASE_API = 'http://192.168.3.6:9000'; // 旭强
|
||||
// BASE_API = 'http://192.168.3.41:9000'; // 张赛
|
||||
// BASE_API = 'http://192.168.3.82:9000'; // 杜康
|
||||
// BASE_API = 'http://192.168.3.41:9000'; // 张赛
|
||||
|
@ -7,7 +7,9 @@
|
||||
v-for="item in options"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
:value="item.value"
|
||||
:disabled="item.disabled"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
@ -143,10 +145,13 @@ import axios from 'axios';
|
||||
for(let i=0;i<netdata.data.length;i++){
|
||||
let option= {
|
||||
value: netdata.data[i].groupNumber,
|
||||
label: netdata.data[i].groupNumber
|
||||
label: netdata.data[i].groupNumber,
|
||||
name:null,
|
||||
}
|
||||
option.disabled = false;
|
||||
if(netdata.data[i].name){
|
||||
option.label = netdata.data[i].name+"正在驾驶"+netdata.data[i].groupNumber;
|
||||
option.disabled = true;
|
||||
}
|
||||
if(netdata.data[i].driverId){
|
||||
if(netdata.data[i].driverId == this.userId){
|
||||
|
169
src/views/jlmap3d/maintainer/component/devicefaultlist.vue
Normal file
169
src/views/jlmap3d/maintainer/component/devicefaultlist.vue
Normal file
@ -0,0 +1,169 @@
|
||||
<template>
|
||||
<div class="editassets">
|
||||
<div class="asset-list">
|
||||
<!-- <el-tabs v-model="activeName"> -->
|
||||
<div class="devicelisttop">
|
||||
<p style="font-size:20px;color:#FFFFFF;">故障列表</p>
|
||||
</div>
|
||||
<div class="devicelistbottom">
|
||||
<div class="displaylist " v-for="(part,index) in devicelist" v-show="true" >
|
||||
<div class="faultmodel">
|
||||
<div>设备编号:{{part.code}}</div>
|
||||
<div>设备类型:{{part.type}}</div>
|
||||
<div>故障内容:</div>
|
||||
<div>{{part.text}}</div>
|
||||
<div class="faultbutton" v-on:click="getIndex(part)" >前往确认</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- </el-tabs> -->
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
export default {
|
||||
name: 'DevicefaultList',
|
||||
components: {
|
||||
|
||||
},
|
||||
props: ['devicelist'],
|
||||
data() {
|
||||
return {
|
||||
activeName: 'train',
|
||||
filterText: '',
|
||||
defaultProps: {
|
||||
children: 'children',
|
||||
label: 'label'
|
||||
},
|
||||
devicetype:true,
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
|
||||
},
|
||||
watch: {
|
||||
filterText(val) {
|
||||
this.$refs.tree2.filter(val);
|
||||
},
|
||||
|
||||
},
|
||||
methods: {
|
||||
|
||||
getIndex(device){
|
||||
this.$emit('selectdevice',device);
|
||||
},
|
||||
|
||||
init: function() {
|
||||
|
||||
},
|
||||
back() {
|
||||
|
||||
},
|
||||
|
||||
|
||||
},
|
||||
mounted() {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
@import "src/styles/mixin.scss";
|
||||
.editassets {
|
||||
position: absolute;
|
||||
float:right;
|
||||
left:2%;
|
||||
top:6%;
|
||||
width: 20%;
|
||||
height: 50%;
|
||||
// background-color: #FFFFFF;
|
||||
|
||||
// border-radius:5px;
|
||||
background-image:url("/static/texture/devicelistpane.png");
|
||||
background-repeat: no-repeat;
|
||||
overflow: hidden;
|
||||
background-size:90% 100%;
|
||||
text-align: center;
|
||||
z-index:4;
|
||||
}
|
||||
|
||||
.asset-list{
|
||||
// position:absolute;
|
||||
|
||||
width: 85%;
|
||||
height: 100%;
|
||||
|
||||
|
||||
|
||||
}
|
||||
.el-tabs{
|
||||
height:100%;
|
||||
}
|
||||
|
||||
.el-scrollbar__wrap.default-scrollbar__wrap {
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
}
|
||||
.devicelisttop{
|
||||
height:10%;
|
||||
width:100%;
|
||||
top:0;
|
||||
}
|
||||
.devicelistbottom{
|
||||
height:85%;
|
||||
width:100%;
|
||||
top:10%;
|
||||
overflow-y: auto;
|
||||
}
|
||||
.displaylist {
|
||||
float:left;
|
||||
position: relative;
|
||||
width:90%;
|
||||
// height:20px;
|
||||
|
||||
margin:0px 5px 0px 5px;
|
||||
|
||||
}
|
||||
.modelpic{
|
||||
left:0;
|
||||
position: absolute;
|
||||
width:100%;
|
||||
height:100%;
|
||||
}
|
||||
|
||||
.modeltop{
|
||||
bottom:0;
|
||||
z-index:0;
|
||||
}
|
||||
.modeldown{
|
||||
top:0;
|
||||
z-index:0;
|
||||
}
|
||||
.faultmodel{
|
||||
width:100%;
|
||||
height:90px;
|
||||
border:1px solid #FFFFFF;
|
||||
font-size:15px;
|
||||
color:#FFFFFF;
|
||||
text-align: left;
|
||||
}
|
||||
.faultbutton{
|
||||
position: absolute;
|
||||
border: 1px solid #FFFFFF;
|
||||
left: 20%;
|
||||
bottom: 0;
|
||||
width: 60%;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
257
src/views/jlmap3d/maintainer/component/faultdevice.vue
Normal file
257
src/views/jlmap3d/maintainer/component/faultdevice.vue
Normal file
@ -0,0 +1,257 @@
|
||||
<template>
|
||||
<div id="jl3ddevicefault" class="jl3dfaultdraw">
|
||||
<canvas id="canvastexture" />
|
||||
<!-- <div class="jl3dcontrolpane" v-show="isswitch">
|
||||
<el-button-group>
|
||||
<el-button type="primary" @click="back">初始化</el-button>
|
||||
<el-button type="primary" @click="alldisper">{{disperreset}}</el-button>
|
||||
<el-button type="primary" @click="dispersed">{{devicestats}}</el-button>
|
||||
<el-button type="primary" @click="switchhide">{{switchshow}}</el-button>
|
||||
</el-button-group>
|
||||
</div> -->
|
||||
<div id="jl3ddevicerepir" class="repirbutton" @click="devicerepir"></div>
|
||||
<div id="jl3dclose" class="backbutton" @click="close3ddeviceview"></div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import Vue from 'vue';
|
||||
import { Jl3dfaultdevice } from '@/jlmap3d/jl3dmaintainer/Jl3dfaultdevice.js';
|
||||
|
||||
import { sendCommandNew } from '@/api/jmap/training';
|
||||
import Command from '@/scripts/cmdPlugin/Command';
|
||||
import Handler from '@/scripts/cmdPlugin/Handler';
|
||||
|
||||
export default {
|
||||
name: 'FaultDevice',
|
||||
components: {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
datastatus:"",
|
||||
jl3d: null,
|
||||
psdlist:this.$store.state.map.map.psdList,
|
||||
windowstatus:false,
|
||||
devicelist:[],
|
||||
devicestats:"分步拆解",
|
||||
disperreset:"整体拆解",
|
||||
switchshow:"隐藏轨道",
|
||||
switchstatus:true,
|
||||
isswitch:false,
|
||||
nowdevice:null,
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
// 'jl3d.animastats': {
|
||||
// handler: function (newVal, oldVal) {
|
||||
// if (newVal != oldVal) {
|
||||
// if(newVal == false){
|
||||
// this.devicestats = "分步拆解";
|
||||
//
|
||||
// this.disperreset = "整体拆解";
|
||||
// }
|
||||
// if(newVal == true){
|
||||
// this.devicestats = "分步复位";
|
||||
//
|
||||
// this.disperreset = "整体复位";
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
// '$store.state.menuOperation.selectedCount': {
|
||||
// handler: function (newVal, oldVal) {
|
||||
// if(this.datastatus == "new"){
|
||||
// if (newVal != oldVal) {
|
||||
// if(this.$store.state.menuOperation.selected._type){
|
||||
// if(this.$store.state.menuOperation.selected._type == "StationStand"){
|
||||
// let standcode = this.$store.state.menuOperation.selected.code;
|
||||
// for(let i=0,leni=this.psdlist.length;i<leni;i++){
|
||||
// if(standcode == this.psdlist[i].standCode){
|
||||
// this.jl3d.selectmodel(Vue.prototype.$jlmap.mapDevice[this.psdlist[i].code]);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }else{
|
||||
// this.jl3d.selectmodel(this.$store.state.menuOperation.selected);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// },
|
||||
// '$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;
|
||||
},
|
||||
mapId() {
|
||||
return this.$route.query.mapId;
|
||||
},
|
||||
group(){
|
||||
return this.$route.query.group;
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
window.updatemenulist = this.updatemenulist;
|
||||
|
||||
let code = this.$route.query.code;
|
||||
let group = this.$route.query.group;
|
||||
let header = this.$route.query.token;
|
||||
// console.log(this.$store.state.menuOperation);
|
||||
// console.log(this.$store.state.map.map.linkList);
|
||||
// console.log(this.$store.state.map.map.linkList);
|
||||
|
||||
this.datastatus = "new";
|
||||
this.initnewdata(group,header);
|
||||
// const mapdata = this.$store.getters['map/map'];
|
||||
// console.log(mapdata);
|
||||
// if (group) {
|
||||
// this.init(group,header);
|
||||
// // this.subscribe(code,group,header);
|
||||
// }
|
||||
},
|
||||
beforeDestroy() {
|
||||
},
|
||||
methods: {
|
||||
|
||||
initnewdata: function (group,header){
|
||||
let dom = document.getElementById('jl3ddevicefault');
|
||||
this.jl3d = new Jl3dfaultdevice(dom,group,header,this.mapId);
|
||||
},
|
||||
close3ddeviceview: function(){
|
||||
this.$emit('closedevice3dview');
|
||||
},
|
||||
windowchange: function(){
|
||||
let changeelement = document.getElementById('jl3ddevicefault');
|
||||
if(this.windowstatus){
|
||||
changeelement.style.width = '40%';
|
||||
changeelement.style.height = '40%';
|
||||
changeelement.style.top = '0';
|
||||
changeelement.style.right = '0';
|
||||
this.windowstatus = false;
|
||||
this.jl3d.updatewindowstatus('0');
|
||||
}else{
|
||||
changeelement.style.width = '100%';
|
||||
changeelement.style.height = '100%';
|
||||
changeelement.style.top = '0';
|
||||
this.windowstatus = true;
|
||||
this.jl3d.updatewindowstatus('1');
|
||||
}
|
||||
if(this.jl3d.domresize){
|
||||
this.jl3d.domresize();
|
||||
}
|
||||
},
|
||||
devicerepir(){
|
||||
if(this.nowdevice){
|
||||
let command = {
|
||||
code:this.nowdevice.code,
|
||||
faultType:this.nowdevice.fault,
|
||||
};
|
||||
sendCommandNew(this.group,"Cancel_Fault", command).then((response) => {
|
||||
// resolve(response);
|
||||
if(response.code == 200){
|
||||
warningmsg("故障修复成功");
|
||||
this.jl3d.repairpsd();
|
||||
}else{
|
||||
warningmsg("故障修复失败或已无故障");
|
||||
}
|
||||
this.nowdevice = null;
|
||||
}).catch(error => {
|
||||
warningmsg("故障修复失败");
|
||||
// reject(error);
|
||||
});
|
||||
}
|
||||
},
|
||||
updatemenulist(devicelist) {
|
||||
if(devicelist){
|
||||
this.devicelist = devicelist;
|
||||
this.isswitch = true;
|
||||
}else{
|
||||
this.devicelist = [];
|
||||
this.isswitch = false;
|
||||
}
|
||||
|
||||
},
|
||||
showmodel(devicedata){
|
||||
this.jl3d.updatewindowstatus('1');
|
||||
this.jl3d.selectmodel(devicedata);
|
||||
this.nowdevice = devicedata;
|
||||
},
|
||||
back(){
|
||||
this.jl3d.resetmodel();
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
/* #jl3d {
|
||||
width: 937px;
|
||||
height: 937px;
|
||||
} */
|
||||
|
||||
.jl3dfaultdraw {
|
||||
position: absolute;
|
||||
float: right;
|
||||
top:0;
|
||||
right:0;
|
||||
/* left: 0; */
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 3;
|
||||
}
|
||||
|
||||
#canvastexture {
|
||||
position: absolute;
|
||||
float: left;
|
||||
left: 0;
|
||||
z-index: -12;
|
||||
}
|
||||
|
||||
.repirbutton{
|
||||
width:160px;
|
||||
height:160px;
|
||||
position: absolute;
|
||||
right:15px;
|
||||
bottom:5px;
|
||||
background-image:url("/static/texture/xiuli.png");
|
||||
background-repeat:no-repeat;
|
||||
background-size:100%;
|
||||
}
|
||||
.backbutton{
|
||||
width:50px;
|
||||
height:50px;
|
||||
position: absolute;
|
||||
right:15px;
|
||||
top:5px;
|
||||
background-image:url("/static/texture/xx.png");
|
||||
background-repeat:no-repeat;
|
||||
background-size:100%;
|
||||
}
|
||||
|
||||
#canvastexture {
|
||||
position: absolute;
|
||||
float: left;
|
||||
left: 0;
|
||||
z-index: -12;
|
||||
}
|
||||
.jl3dcontrolpane{
|
||||
position: absolute;
|
||||
top:0;
|
||||
left:0;
|
||||
}
|
||||
|
||||
</style>
|
@ -10,17 +10,28 @@
|
||||
|
||||
</div>
|
||||
|
||||
<!-- <Jlmap3d-Menu :trainlist="trainlist" :stationlist="stationlist" @sstation="sstation" @strain="strain" />
|
||||
|
||||
<Jlmap3d-Config @showstationmsg="showstationmsg" @showtrainmsg="showtrainmsg" /> -->
|
||||
|
||||
<!-- <Jlmap3d-Msg v-bind:msgdata="msgdata" >
|
||||
</Jlmap3d-Msg > -->
|
||||
<Devicefault-List
|
||||
v-show="faultlistshow"
|
||||
:devicelist="devicelist"
|
||||
@selectdevice="selectdevice"
|
||||
>
|
||||
</Devicefault-List>
|
||||
<Fault-Device
|
||||
v-show="deviceShow"
|
||||
ref = "faultdevice"
|
||||
@closedevice3dview ="devicemodel"
|
||||
/>
|
||||
|
||||
<div id="testjlmap3d" class="jlmap3ddraw">
|
||||
<canvas id="canvastexture" />
|
||||
</div>
|
||||
|
||||
<div class="msg" v-show ="msgshow">
|
||||
<div class="msgtext">
|
||||
{{controlmsg}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</template>
|
||||
@ -37,9 +48,8 @@
|
||||
// import { UrlConfig } from '@/router/index';
|
||||
|
||||
import { JLmap3dMaintainer } from '@/jlmap3d/jl3dmaintainer/jlmap3dmaintainer.js';
|
||||
|
||||
// components
|
||||
import Jlmap3dMenu from '@/views/jlmap3d/simulation/show/menu';
|
||||
import DevicefaultList from '@/views/jlmap3d/maintainer/component/devicefaultlist';
|
||||
import FaultDevice from '@/views/jlmap3d/maintainer/component/faultdevice';
|
||||
|
||||
import Jlmap3dConfig from '@/views/jlmap3d/simulation/show/configmenu';
|
||||
import { ProjectIcon } from '@/scripts/ProjectConfig';
|
||||
@ -50,17 +60,13 @@ var train;
|
||||
export default {
|
||||
name: 'Jl3dMaintainer',
|
||||
components: {
|
||||
Jlmap3dMenu,
|
||||
Jlmap3dConfig
|
||||
DevicefaultList,
|
||||
FaultDevice
|
||||
// Jlmap3dMsg
|
||||
// ShowProperty
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
trainlist: null,
|
||||
stationlist: null,
|
||||
msgdata: null,
|
||||
|
||||
training: {
|
||||
id: '',
|
||||
name: '',
|
||||
@ -72,7 +78,12 @@ export default {
|
||||
selectmodel: null,
|
||||
mapid:null,
|
||||
group:null,
|
||||
token:null
|
||||
token:null,
|
||||
faultlistshow:true,
|
||||
devicelist:[],
|
||||
deviceShow:true,
|
||||
msgshow:false,
|
||||
controlmsg:"",
|
||||
};
|
||||
},
|
||||
beforeDestroy() {
|
||||
@ -90,7 +101,10 @@ export default {
|
||||
document.querySelector("link[rel*='icon']").href = ProjectIcon[this.$route.query.project];
|
||||
},
|
||||
mounted() {
|
||||
window.updatemenulist = this.updatemenulist;
|
||||
window.updatefault = this.updatefault;
|
||||
window.resetfaultlist = this.resetfaultlist;
|
||||
window.deletefault = this.deletefault;
|
||||
window.warningmsg = this.warningmsg;
|
||||
this.getParams();
|
||||
|
||||
// console.log("");
|
||||
@ -101,9 +115,7 @@ export default {
|
||||
this.mapid = this.$route.query.mapId;
|
||||
this.group = this.$route.query.group;
|
||||
this.token = this.$route.query.token;
|
||||
console.log(this.mapid);
|
||||
console.log(this.group);
|
||||
console.log(this.token);
|
||||
|
||||
this.init(this.mapid, this.group);
|
||||
},
|
||||
show: function (skinCode, group) {
|
||||
@ -121,7 +133,7 @@ export default {
|
||||
const dom = document.getElementById('app');
|
||||
const project = this.$route.query.project;
|
||||
// console.log(project);
|
||||
|
||||
this.deviceShow = false;
|
||||
if (project) {
|
||||
|
||||
this.jlmap3d = new JLmap3dMaintainer(dom, mapdata, skinCode, this.$store, group, project);
|
||||
@ -155,31 +167,41 @@ export default {
|
||||
showtrainmsg(showtype) {
|
||||
this.jlmap3d.showtrainmsg(showtype);
|
||||
},
|
||||
updatemenulist(stationlist, trainlist) {
|
||||
const stations = [];
|
||||
for (const k in stationlist) {
|
||||
stations.push(stationlist[k]);
|
||||
}
|
||||
const trains = [];
|
||||
for (const k in trainlist) {
|
||||
trains.push(trainlist[k]);
|
||||
}
|
||||
this.stationlist = stations;
|
||||
this.trainlist = trains;
|
||||
// console.log(this.stationlist);
|
||||
resetfaultlist(){
|
||||
this.devicelist = [];
|
||||
},
|
||||
|
||||
sstation(changedata) {
|
||||
this.jlmap3d.updatecamera(changedata.mesh, 'station');
|
||||
updatefault(fault) {
|
||||
this.devicelist.push(fault);
|
||||
},
|
||||
strain(changedata) {
|
||||
|
||||
if (changedata.dispose == false) {
|
||||
this.jlmap3d.updatecamera(changedata, 'train');
|
||||
deletefault(code){
|
||||
for(let i=0,leni=this.devicelist.length;i<leni;i++){
|
||||
if(code == this.devicelist[i].code){
|
||||
this.devicelist.splice(i,1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
devicemodel(){
|
||||
if (this.deviceShow == false) {
|
||||
this.deviceShow = true;
|
||||
} else {
|
||||
this.deviceShow = false;
|
||||
}
|
||||
},
|
||||
selectdevice(divicedata){
|
||||
this.deviceShow = true;
|
||||
this.$refs.faultdevice.showmodel(divicedata);
|
||||
},
|
||||
warningmsg(nowmsg){
|
||||
console.log(nowmsg);
|
||||
this.controlmsg = nowmsg;
|
||||
this.msgshow = true;
|
||||
setTimeout(this.warningmsgoff,3000);
|
||||
},
|
||||
warningmsgoff(){
|
||||
this.msgshow = false;
|
||||
|
||||
},
|
||||
|
||||
back() {
|
||||
this.$emit('back');
|
||||
}
|
||||
@ -237,7 +259,7 @@ export default {
|
||||
position:absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 30;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.jlmap3ddraw {
|
||||
@ -250,6 +272,24 @@ export default {
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
.msg{
|
||||
width:40%;
|
||||
// height:50px;
|
||||
left:30%;
|
||||
top:10%;
|
||||
text-align: center;
|
||||
position:absolute;
|
||||
z-index:5;
|
||||
}
|
||||
.msgtext{
|
||||
width:100%;
|
||||
// height:50px;
|
||||
border-radius:5px;
|
||||
background:#C0C0C0;
|
||||
color:#FFFFFF;
|
||||
font-size: 40px;
|
||||
}
|
||||
|
||||
#canvastexture {
|
||||
position: absolute;
|
||||
float: left;
|
||||
|
BIN
static/model/device/section/section.FBX
Normal file
BIN
static/model/device/section/section.FBX
Normal file
Binary file not shown.
BIN
static/texture/xiuli.png
Normal file
BIN
static/texture/xiuli.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
BIN
static/texture/xiuli1.png
Normal file
BIN
static/texture/xiuli1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
@ -691,7 +691,6 @@ function timedCount(){
|
||||
// postMessage(data.body[i]);
|
||||
// }
|
||||
// }
|
||||
|
||||
if(data.type == "Device_Fault_Set_3D"){
|
||||
postMessage(data);
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user