继电器通信,修改继电器逻辑,继电器模型动画更替,修改设备信号灯逻辑,修改设备道岔初始化bug

This commit is contained in:
sunzhenyu 2019-12-26 10:41:07 +08:00
parent 1602592404
commit 76379f12cc
39 changed files with 3073 additions and 158 deletions

View File

@ -0,0 +1,168 @@
import { getPublishMapDetail,getMapDetail,set3dMapData,get3dMapData } from '@/api/jlmap3d/load3ddata';
//原始信息obj化提供给三维建模
import {SetObj} from '@/jlmap3d/edit/utils/SetObj.js';
//componnent
import {SectionList} from '@/jlmap3d/edit/neweditmodel/SectionList.js';
import {SignalList} from '@/jlmap3d/edit/neweditmodel/SignalList.js';
import {StationStandList} from '@/jlmap3d/edit/neweditmodel/StationStandList.js';
import {TrainList} from '@/jlmap3d/edit/neweditmodel/TrainList.js';
import {TrainListTest} from '@/jlmap3d/edit/neweditmodel/TrainListTest.js';
import {LinkList} from '@/jlmap3d/edit/neweditmodel/LinkList.js';
import {RailList} from '@/jlmap3d/edit/neweditmodel/RailList.js';
import {RealSectionList} from '@/jlmap3d/edit/neweditmodel/RealSectionList.js';
import axios from 'axios';
import {getmodels} from '@/jlmap3d/edit/connect/getmodels';
import { Loading } from 'element-ui';
// import {SwitchModel} from '@/jlmap3d/model/SwitchModel.js';
export function Jlmap3ddata(mapid,scope){
let editmapid = mapid;
let scene = scope.scene;
let jlmap3ddata = scope.mapdata;
let assetloader = scope.assetloader;
let loadingInstance = Loading.service({ fullscreen: true });
get3dMapData(editmapid).then(data => {
//console.log(data);
initobj(editmapid,data);
}).catch(error => {
//console.log(error);
if(error.code == "30001"){
//console.log("没有三维数据");
let params = {mapId:editmapid};
set3dMapData(params).then(data => {
if(data.code == "200"){
//console.log("创建三维数据成功");
// console.log(data);
initobj(editmapid,data.data.id);
}
}).catch(error => {
//console.log(error);
});
}
});
function initobj(mapid,data3did){
console.log(mapid);
console.log(data3did);
getMapDetail(mapid).then(data => {
let mapdata = data.data;
//console.log(data3did);
jlmap3ddata.id = data3did;
jlmap3ddata.mapId = mapid;
// //初始化站台
jlmap3ddata.stationstandlist = new StationStandList();
//初始化轨道和道岔 暂时
jlmap3ddata.sectionlist = new SectionList();
// jlmap3ddata.linklist = new LinkList();
// jlmap3ddata.signallist = new SignalList();
// jlmap3ddata.trainlisttest = new TrainListTest();
//
// jlmap3ddata.raillist = new RailList();
console.log(mapdata);
assetloader.assetinit(scene)
.then(function(data){
//console.log(data);
return jlmap3ddata.stationstandlist.initpromise(jlmap3ddata,mapdata.stationList,mapdata.stationStandList,scene,assetloader);
})
.then(function(data){
//console.log(data);
return jlmap3ddata.sectionlist.initpromise(jlmap3ddata,assetloader,mapdata.sectionList,mapdata.switchList,scene);
})
// .then(function(data){
// //console.log(data);
// return jlmap3ddata.linklist.initpromise(mapdata.linkList,scene,assetloader);
// })
// .then(function(data){
// //console.log(data);
// return jlmap3ddata.signallist.initpromise(jlmap3ddata,mapdata.signalList,scene,assetloader);
// })
// .then(function(data){
// //console.log(data);
// return jlmap3ddata.trainlisttest.initpromise(mapdata.trainList,scene,assetloader);
// })
.then(function(data){
//console.log(data);
loadingInstance.close();
});
//初始化信号
//SetObj(mapdata,scope);
});
}
function init3d(mapid,netdata){
// console.log(netdata)
getMapDetail(mapid).then(data => {
jlmap3ddata.id = netdata.id;
jlmap3ddata.mapId = mapid;
let mapdata = data.data;
jlmap3ddata.linklist = new LinkList();
//初始化轨道和道岔 暂时
jlmap3ddata.sectionlist = new SectionList();
jlmap3ddata.signallist = new SignalList();
//初始化站台
jlmap3ddata.stationstandlist = new StationStandList();
//初始化测试列车
jlmap3ddata.trainlisttest = new TrainListTest();
jlmap3ddata.raillist = new RailList();
let loaderdata = JSON.parse(netdata.sections);
let switchdata = JSON.parse(netdata.switchs);
let signaldata = JSON.parse(netdata.signals);
let standsdata = JSON.parse(netdata.stands);
console.log(mapdata);
assetloader.setmodellist(netdata.assets,5);
assetloader.assetpromise(scene)
.then(function(data){
//console.log(data);
return jlmap3ddata.linklist.loadpromise(loaderdata.link,mapdata.linkList,scene,assetloader);
})
.then(function(data){
//console.log(data);
return jlmap3ddata.sectionlist.loadpromise(jlmap3ddata,assetloader,loaderdata.section,switchdata,scene);
})
.then(function(data){
//console.log(data);
return jlmap3ddata.signallist.loadpromise(signaldata,scene,assetloader,mapdata.signalList);
})
.then(function(data){
//console.log(data);
return jlmap3ddata.stationstandlist.initpromise(jlmap3ddata,mapdata.stationList,mapdata.stationStandList,scene,assetloader,standsdata);
})
.then(function(data){
return jlmap3ddata.sectionlist.sectionpromise(loaderdata.link,mapdata.linkList,mapdata.sectionList,switchdata,standsdata,scene);
})
.then(function(data){
//console.log(data);
return jlmap3ddata.trainlisttest.initpromise(mapdata.trainList,scene,assetloader,"0");
})
// .then(function(data){
// //console.log(data);
// return jlmap3ddata.realsectionlist.loadpromise(jlmap3ddata,scene,assetloader);
// })
.then(function(data){
//console.log(data);
loadingInstance.close();
});
});
}
}

View File

@ -23,11 +23,13 @@ import { SetScene } from '@/jlmap3d/config/SetScene';
import { SetLights } from '@/jlmap3d/config/SetLights';
//加载器
// import { Jlmap3ddata } from '@/jlmap3d/edit/Jlmap3ddata';
import { Jlmap3ddata } from '@/jlmap3d/edit/Jlmap3ddata';
//操作管理器
import { Actionmanage } from '@/jlmap3d/edit/actionmanage';
export function JLmap3dEdit(dom, data, mapid) {
console.log(data);
var scope = this;
this.dom = dom;

View File

@ -0,0 +1,315 @@
export function LinkList(data){
let scope = this;
this.type = "linklist";
this.linkdata = [];
this.linksgroup = new THREE.Group();
this.linksgroup.name = "link";
this.initpromise = function(linkdata,scene,assetloader){
return new Promise(function(resolve, reject){
linkhelp(linkdata,scene);
scene.add(scope.linksgroup);
linktest(linkdata,scene,assetloader);
resolve("loadedrealsection");
});
};
this.loadpromise = function(linkdata,netlink,scene,assetloader){
return new Promise(function(resolve, reject){
scene.add(scope.linksgroup);
loadlink(linkdata,netlink,scene,assetloader);
resolve("loadedrealsection");
});
};
function linkhelp(data,scene){
let groups = new THREE.Group();
for(let i=0;i<data.length;i++){
let lineGeometry = new THREE.Geometry();//生成几何体
lineGeometry.vertices.push(new THREE.Vector3(data[i].lp.x, 1, data[i].lp.y));//线段的两个顶点
lineGeometry.vertices.push(new THREE.Vector3(data[i].rp.x, 1, data[i].rp.y));
let line = new THREE.Line(lineGeometry, new THREE.LineDashedMaterial({
color: 0xffffff,//线段的颜色
dashSize: 1,//短划线的大小
gapSize: 3//短划线之间的距离
}));
line.name = data[i].code;
line.lengthFact = data[i].lengthFact;
line.lp = data[i].lp;
line.rp = data[i].rp;
line.distancex = data[i].rp.x-data[i].lp.x;
line.distancey = data[i].rp.y-data[i].lp.y;
line.computeLineDistances();//不可或缺的,若无,则线段不能显示为虚线
groups.add(line);
}
groups.position.z = 2000;
scene.add(groups);
}
function loadlink(data,netlink,scene,assetloader){
let autorail;
for(let i=0;i<assetloader.modellist.length;i++){
if(assetloader.modellist[i].deviceType == "autorail"){
autorail = assetloader.modellist[i].mesh.children[0];
}
}
let count = autorail.geometry.attributes.position.count;
let rightlist = [];
let leftlist = [];
for(let i=0;i<count;i++){
if(autorail.geometry.attributes.position.array[i*3] >0.49){
rightlist.push(i);
}
if(autorail.geometry.attributes.position.array[i*3] <-0.49){
leftlist.push(i);
}
}
for(let i=0;i<data.length;i++){
let testmesh2 = autorail.clone(true);
testmesh2.code = data[i].code;
testmesh2.name = data[i].name;
testmesh2.rightlist = rightlist;
testmesh2.leftlist = leftlist;
testmesh2.rp = data[i].rp;
testmesh2.lp = data[i].lp;
testmesh2.lengthfact = data[i].lengthfact;
for(let num=0,lennum=netlink.length;num<lennum;num++){
if(netlink[num].code == data[i].code){
testmesh2.oldlength = netlink[num].lengthFact;
num = lennum;
}
}
for(let i=0;i<testmesh2.rightlist.length;i++){
testmesh2.geometry.attributes.position.array[testmesh2.rightlist[i]*3] = testmesh2.lengthfact-25;
testmesh2.geometry.attributes.uv.array[testmesh2.rightlist[i]*2] = testmesh2.geometry.attributes.position.array[0]-testmesh2.geometry.attributes.position.array[3];
}
let newrail = new THREE.BufferGeometry();
newrail.copy(testmesh2.geometry);
testmesh2.geometry = newrail;
testmesh2.geometry.attributes.position.needsUpdate = true;
testmesh2.geometry.attributes.uv.needsUpdate = true;
testmesh2.geometry.computeBoundingSphere();
testmesh2.geometry.center();
testmesh2.position.x = data[i].position.x;
testmesh2.position.y = data[i].position.y;
testmesh2.position.z = data[i].position.z;
// 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);
}
}
// return linklist;
function linktest(data,scene,assetloader){
let autorail = null;
let autosuidao = null;
for(let i=0;i<assetloader.modellist.length;i++){
if(assetloader.modellist[i].deviceType == "autorail"){
autorail = assetloader.modellist[i].mesh.children[0];
}
}
let rightlist = [];
let leftlist = [];
let count = autorail.geometry.attributes.position.count;
for(let i=0;i<count;i++){
if(autorail.geometry.attributes.position.array[i*3] >0.49){
rightlist.push(i);
}
if(autorail.geometry.attributes.position.array[i*3] <-0.49){
leftlist.push(i);
}
}
autorail.rightlist = rightlist;
autorail.leftlist = leftlist;
let reallinks = [];
let testlink;
testlink = data;
if(data){
let index,startdata;
for(let n=0;n<data.length;n++){
if(data[n].leftFdCode == undefined && data[n].leftSdCode == undefined && data[n].rightFdCode ){
if(startdata){
if(data[n].lp.x<startdata.lp.x){
startdata = data[n];
index = n;
}
}else{
startdata = data[n];
index = n;
}
}
}
buildmodel(startdata);
reallinks.push(startdata);
data.splice(index,1);
for(let i=0;i<reallinks.length;i++){
for(let j=0;j<data.length;j++){
if(reallinks[i].leftFdCode && j>=0){
if(reallinks[i].leftFdCode == data[j].code){
buildmodel(data[j],reallinks[i],j,"left");
reallinks.push(data[j]);
data.splice(j,1);
j--;
}
}
if(reallinks[i].leftSdCode && j>=0){
if(reallinks[i].leftSdCode == data[j].code){
buildmodel(data[j],reallinks[i],j,"left");
reallinks.push(data[j]);
data.splice(j,1);
j--;
}
}
if(reallinks[i].rightFdCode && j>=0){
if(reallinks[i].rightFdCode == data[j].code){
buildmodel(data[j],reallinks[i],j,"right");
reallinks.push(data[j]);
data.splice(j,1);
j--;
}
}
if(reallinks[i].rightSdCode && j>=0){
if(reallinks[i].rightSdCode == data[j].code){
buildmodel(data[j],reallinks[i],j,"right");
reallinks.push(data[j]);
data.splice(j,1);
j--;
}
}
}
}
function buildmodel(data,mdata,sx,direct){
let len = data.lengthFact;
let testmesh2 = autorail.clone(true);
for(let i=0;i<autorail.rightlist.length;i++){
testmesh2.geometry.attributes.position.array[autorail.rightlist[i]*3] = len-25;
testmesh2.geometry.attributes.uv.array[autorail.rightlist[i]*2] = testmesh2.geometry.attributes.position.array[0]-testmesh2.geometry.attributes.position.array[3];
}
let newrail = new THREE.BufferGeometry();
newrail.copy(testmesh2.geometry);
testmesh2.geometry = newrail;
testmesh2.geometry.attributes.position.needsUpdate = true;
testmesh2.geometry.attributes.uv.needsUpdate = true;
testmesh2.geometry.computeBoundingSphere();
testmesh2.geometry.center();
// data.lp.y *= 10;
// data.rp.y *= 10;
if(mdata){
if(direct == "left"){
let dx = Math.abs(data.lp.x - data.rp.x);
    let dy = Math.abs(data.lp.y - data.rp.y);
    let distance = Math.sqrt(Math.pow(dx,2)+Math.pow(dy,2));
data.lp.x = (data.lp.x-data.rp.x)*data.lengthFact/distance+mdata.lp.x;
data.lp.y = (data.lp.y-data.rp.y)*data.lengthFact/distance+mdata.lp.y;
data.rp.x = mdata.lp.x;
data.rp.y = mdata.lp.y;
let axix = new THREE.Vector3(1,0,0);
let axixnow = new THREE.Vector3(data.rp.x-data.lp.x,0,data.rp.y-data.lp.y);
let rotenum = axixnow.angleTo(axix);
//不同坐标系方向值不同
if(data.lp.y>data.rp.y){
testmesh2.rotation.z = 0.218;
data.lp.x = data.rp.x - (data.lengthFact)*Math.cos(testmesh2.rotation.z);
data.lp.y = data.rp.y + (data.lengthFact)*Math.sin(testmesh2.rotation.z);
}else if(data.lp.y<data.rp.y){
testmesh2.rotation.z = -0.218;
data.lp.x = data.rp.x - (data.lengthFact)*Math.cos(testmesh2.rotation.z);
data.lp.y = data.rp.y + (data.lengthFact)*Math.sin(testmesh2.rotation.z);
}else{
testmesh2.rotation.z = rotenum;
}
testmesh2.position.x = (data.rp.x + data.lp.x)/2;
testmesh2.position.z = (data.rp.y + data.lp.y)/2;
}
if(direct == "right"){
let dx = Math.abs(data.lp.x - data.rp.x);
    let dy = Math.abs(data.lp.y - data.rp.y);
    let distance = Math.sqrt(Math.pow(dx,2)+Math.pow(dy,2));
data.rp.x = (data.rp.x-data.lp.x)*data.lengthFact/distance+mdata.rp.x;
data.rp.y = (data.rp.y-data.lp.y)*data.lengthFact/distance+mdata.rp.y;
data.lp.x = mdata.rp.x;
data.lp.y = mdata.rp.y;
let axix = new THREE.Vector3(1,0,0);
let axixnow = new THREE.Vector3(data.rp.x-data.lp.x,0,data.rp.y-data.lp.y);
let rotenum = axixnow.angleTo(axix);
//不同坐标系方向值不同
if(data.lp.y>data.rp.y){
testmesh2.rotation.z = 0.218;
data.rp.x = data.lp.x+(data.lengthFact)*Math.cos(testmesh2.rotation.z);
data.rp.y = data.lp.y-(data.lengthFact)*Math.sin(testmesh2.rotation.z);
}else if(data.lp.y<data.rp.y){
testmesh2.rotation.z = -0.218;
data.rp.x = data.lp.x+(data.lengthFact)*Math.cos(testmesh2.rotation.z);
data.rp.y = data.lp.y-(data.lengthFact)*Math.sin(testmesh2.rotation.z);
}
testmesh2.position.x = (data.lp.x + data.rp.x)/2;
testmesh2.position.z = (data.lp.y + data.rp.y)/2;
}
}else{
data.lp.x = data.lp.x;
data.rp.x = data.lp.x + data.lengthFact;
testmesh2.position.x = (data.lp.x + data.rp.x)/2;
testmesh2.position.z = (data.lp.y + data.rp.y)/2;
}
// testmesh2.position.y = 10;
testmesh2.code = data.code;
testmesh2.name = data.name;
testmesh2.meshtype = "link";
testmesh2.lp = data.lp;
testmesh2.rp = data.rp;
testmesh2.rightlist = autorail.rightlist;
testmesh2.leftlist = autorail.leftlist;
testmesh2.lengthfact = data.lengthFact;
scope.linksgroup.add( testmesh2 );
scope.linkdata.push(testmesh2);
}
}
}
}

View File

@ -0,0 +1,69 @@
export function RailList(){
let scope = this;
this.linkrail = [];
this.switchrail = [];
this.setrail = function(){
};
this.resetrail = function(mapdata,scene){
console.log(mapdata);
let raillink = mapdata.linklist.linksgroup.children;
for(let i=0;i<raillink.length;i++){
var geometry = new THREE.PlaneBufferGeometry( raillink[i].lengthfact-25, 0.1, 0.1 );
var material = new THREE.MeshBasicMaterial( {color: 0xffff00, side: THREE.DoubleSide} );
var plane = new THREE.Mesh( geometry, material );
plane.position.x = raillink[i].position.x;
plane.position.y = 2;
plane.position.z = raillink[i].position.z;
plane.rotation.x = -Math.PI/2;
plane.rotation.z = raillink[i].rotation._z;
var geometry1 = new THREE.CircleBufferGeometry( 1, 16 );
var material1 = new THREE.MeshBasicMaterial( { color: 0xffff00 } );
var geometry2 = new THREE.CircleBufferGeometry( 1, 16 );
var material2 = new THREE.MeshBasicMaterial( { color: 0xff2000 } );
var circle1 = new THREE.Mesh( geometry1, material1 );
circle1.position.x = plane.position.x + (raillink[i].lengthfact-25)/2*Math.cos(plane.rotation.z);
circle1.position.z = plane.position.z - (raillink[i].lengthfact-25)/2*Math.sin(plane.rotation.z);
circle1.rotation.x = -Math.PI/2;
scene.add( circle1 );
var circle2 = new THREE.Mesh( geometry2, material2 );
circle2.position.x = plane.position.x - (raillink[i].lengthfact-25)/2*Math.cos(plane.rotation.z);
circle2.position.z = plane.position.z + (raillink[i].lengthfact-25)/2*Math.sin(plane.rotation.z);
circle2.rotation.x = -Math.PI/2;
mapdata.linklist.linksgroup.children[i].rail = [{
x:circle2.position.x,
z:circle2.position.z
},{
x:circle1.position.x,
z:circle1.position.z
}];
scene.add( circle2 );
scene.add( plane );
}
for(let i=0;i<mapdata.sectionlist.switchs.modellist.length;i++){
var geometry = new THREE.CircleBufferGeometry( 1, 16 );
var material = new THREE.MeshBasicMaterial( { color: 0xff00ff } );
var circle1 = new THREE.Mesh( geometry, material );
circle1.position.x = mapdata.sectionlist.switchs.modellist[i].position.x;
circle1.position.z = mapdata.sectionlist.switchs.modellist[i].position.z;
circle1.rotation.x = -Math.PI/2;
scene.add( circle1 );
}
};
this.getrail = function(){
};
}

View File

@ -0,0 +1,185 @@
import {RealSectionModel} from '@/jlmap3d/edit/editmodel/RealSectionModel.js';
export function RealSectionList(data) {
let scope = this;
this.type = "sectionlist";
this.list = [];
this.group = [];
this.switch = [];
this.initpromise = function(sectiondata,switchdata,scene){
return new Promise(function(resolve, reject){
console.log(jlmap3ddata);
let modelnum = null;
for(let i=0;i<assetloader.modellist.length;i++){
if(assetloader.modellist[i].deviceType == "mapSection"){
modelnum = i;
}
}
let newmesh = assetloader.modellist[modelnum].mesh;
//let mixer = new THREE.AnimationMixer( newmesh );
////console.log(sectiondata.sectionlist);
for(let i=0;i<newmesh.children.length;i++){
let name = newmesh.children[i].name.split("_");
let newmeshname = name[0]+"_"+name[1]+"_"+name[2]+"."+name[3];
////console.log(newmeshname);
if(name[0] == "Switch"){
for(let j=0;j<sectiondata.sectionlist.switchs.datalist.length;j++){
if(sectiondata.sectionlist.switchs.datalist[j].name == newmeshname){
//绿色道岔
var box = new THREE.BoxHelper( newmesh.children[i], 0x00EE00 );
scene.add(box);
let nowname = sectiondata.sectionlist.switchs.datalist[j].name;
let nowcode = sectiondata.sectionlist.switchs.datalist[j].code;
newmesh.children[i].name = nowname;
newmesh.children[i].code = nowcode;
for(let n=0;n<newmesh.children[i].children.length;n++){
newmesh.children[i].children[n].code = nowcode;
}
sectiondata.sectionlist.switchs.modellist[j] = newmesh.children[i];
j = sectiondata.sectionlist.switchs.datalist.length;
}
}
}
if(name[0] == "Section"){
//console.log(newmesh.children[i]);
//物理区段
for(let j=0;j<sectiondata.sectionlist.sections.datalist.length;j++){
if(sectiondata.sectionlist.sections.datalist[j].name == newmeshname){
if(sectiondata.sectionlist.sections.datalist[j].isStandTrack == true){
//红色站台区段
var box = new THREE.BoxHelper( newmesh.children[i], 0xff0000 );
}else{
//蓝色其他区段
var box = new THREE.BoxHelper( newmesh.children[i], 0x0000ff );
}
scene.add( box );
let nowname = sectiondata.sectionlist.sections.datalist[j].name;
let nowcode = sectiondata.sectionlist.sections.datalist[j].code;
newmesh.children[i].name = nowname;
newmesh.children[i].code = nowcode;
sectiondata.sectionlist.sections.modellist[j] = newmesh.children[i];
j = sectiondata.sectionlist.sections.datalist.length;
}
}
}
}
scene.add(newmesh);
resolve("loadedrealsection");
});
}
this.init = function(sectiondata,scene,assetloader){
let newmesh = assetloader.modellist[2].mesh;
//let mixer = new THREE.AnimationMixer( newmesh );
////console.log(sectiondata.sectionlist);
for(let i=0;i<newmesh.children.length;i++){
let name = newmesh.children[i].name.split("_");
let newmeshname = name[0]+"_"+name[1]+"_"+name[2]+"."+name[3];
////console.log(newmeshname);
if(name[0] == "Switch"){
for(let j=0;j<sectiondata.sectionlist.switchs.datalist.length;j++){
if(sectiondata.sectionlist.switchs.datalist[j].name == newmeshname){
//绿色道岔
var box = new THREE.BoxHelper( newmesh.children[i], 0x00EE00 );
scene.add(box);
let nowname = sectiondata.sectionlist.switchs.datalist[j].name;
let nowcode = sectiondata.sectionlist.switchs.datalist[j].code;
newmesh.children[i].name = nowname;
newmesh.children[i].code = nowcode;
for(let n=0;n<newmesh.children[i].children.length;n++){
newmesh.children[i].children[n].code = nowcode;
}
sectiondata.sectionlist.switchs.modellist[j] = newmesh.children[i];
j = sectiondata.sectionlist.switchs.datalist.length;
}
}
}
if(name[0] == "Section"){
//物理区段
for(let j=0;j<sectiondata.sectionlist.sections.datalist.length;j++){
if(sectiondata.sectionlist.sections.datalist[j].name == newmeshname){
if(sectiondata.sectionlist.sections.datalist[j].isStandTrack == true){
//红色站台区段
var box = new THREE.BoxHelper( newmesh.children[i], 0xff0000 );
}else{
//蓝色其他区段
var box = new THREE.BoxHelper( newmesh.children[i], 0x0000ff );
}
scene.add( box );
let nowname = sectiondata.sectionlist.sections.datalist[j].name;
let nowcode = sectiondata.sectionlist.sections.datalist[j].code;
newmesh.children[i].name = nowname;
newmesh.children[i].code = nowcode;
sectiondata.sectionlist.sections.modellist[j] = newmesh.children[i];
j = sectiondata.sectionlist.sections.datalist.length;
}
}
}
if(name[0] == "Singal"){
for(let j=0;j<sectiondata.signallist.list.length;j++){
if(sectiondata.signallist.list[j].mesh.code == newmeshname){
sectiondata.signallist.list[j].mesh.position.x = newmesh.children[i].position.x;
sectiondata.signallist.list[j].mesh.position.y = newmesh.children[i].position.y;
sectiondata.signallist.list[j].mesh.position.z = newmesh.children[i].position.z;
j = sectiondata.signallist.list.length;
}
}
}
}
scene.add(newmesh);
}
this.update = function(){
}
this.renderon = function(){
}
this.renderoff = function(){
}
this.dispose = function(){
}
}

View File

@ -0,0 +1,8 @@
export function RealSectionModel(data) {
var scope = this;
this.mesh = null;
this.meshurl = null;
this.picurl = null;
}

View File

@ -0,0 +1,894 @@
import {SectionModel} from '@/jlmap3d/edit/editmodel/SectionModel.js';
import {SwitchModel} from '@/jlmap3d/edit/editmodel/SwitchModel.js';
export function SectionList() {
let scope = this;
this.type = "sectionlist";
this.sectiongroup = new THREE.Group();
this.sectiongroup.name = "section";
this.switchgroup = new THREE.Group();
this.switchgroup.name = "switch";
this.sections = {
datalist:[],
modellist:[]
};
this.stopsection = [];
this.standtrack = [];
this.initpromise = function(jlmap3ddata,assetloader,sectiondata,switchdata,scene){
// console.log(sectiondata);
return new Promise(function(resolve, reject){
scene.add(scope.sectiondata);
scene.add(scope.sectiongroup);
//收集需要显示区段
for(let i=0;i<sectiondata.length;i++){
if(sectiondata[i].type == "01" || sectiondata[i].type == "03"){
//初始化区段对象数据
let newsection = new SectionModel(sectiondata[i]);
newsection.name = sectiondata[i].code;
newsection.code = sectiondata[i].code;
newsection.index = i;
newsection.type = sectiondata[i].type;
newsection.lengthFact = sectiondata[i].lengthFact;
newsection.stationcode = sectiondata[i].stationCode;
newsection.rsection = sectiondata[i].rightSectionCode;
newsection.lsection = sectiondata[i].leftSectionCode;
newsection.points = sectiondata[i].points;
scope.sections.datalist[sectiondata[i].code] = newsection;
// console.log("-----------------------");
// console.log(sectiondata[i].code);
// if(sectiondata[i].code == "T285"){
// console.log(sectiondata[i]);
// }
if(sectiondata[i].standTrack == true){
// console.log(sectiondata[i].code);
sectiondata[i].startx = sectiondata[i].points[0].x;
sectiondata[i].starty = sectiondata[i].points[0].y;
scope.stopsection.push(sectiondata[i]);
}
// sections.modellist.push("");
}
}
//连接区段
for(let i=0;i<switchdata.length;i++){
let acode = switchdata[i].sectionACode;
let bcode = switchdata[i].sectionBCode;
let ccode = switchdata[i].sectionCCode;
if(scope.sections.datalist[acode].rsection == ""){
scope.sections.datalist[acode].rsection = bcode;
scope.sections.datalist[acode].csection = ccode;
}else if(scope.sections.datalist[acode].lsection == ""){
scope.sections.datalist[acode].lsection = bcode;
scope.sections.datalist[acode].csection = ccode;
}
if(scope.sections.datalist[bcode].rsection == ""){
scope.sections.datalist[bcode].rsection = acode;
}else if(scope.sections.datalist[bcode].lsection == ""){
scope.sections.datalist[bcode].lsection = acode;
}
if(scope.sections.datalist[ccode].rsection == ""){
scope.sections.datalist[ccode].rsection = acode;
}else if(scope.sections.datalist[ccode].lsection == ""){
scope.sections.datalist[ccode].lsection = acode;
}
}
console.log(scope.sections.datalist);
console.log(scope.stopsection);
console.log(jlmap3ddata);
let stationlist = jlmap3ddata.stationstandlist.list;
scope.stopsection.sort(compare("startx"))
let stopsections = [];
if((scope.stopsection.length%2)==0){
for(let i=0,leni =scope.stopsection.length;i<leni;i){
// stationsections.push(scope.stopsection[i]);
let realstopsection ={
//上行
topsection:null,
//下行
downsection:null,
};
if(scope.stopsection[i].starty > scope.stopsection[i+1].starty){
realstopsection.topsection = scope.stopsection[i+1];
realstopsection.downsection = scope.stopsection[i];
}else{
realstopsection.topsection = scope.stopsection[i];
realstopsection.downsection = scope.stopsection[i+1];
}
stopsections.push(realstopsection);
i=i+2;
}
}else{
alert("erro stopsection length");
}
console.log(stopsections);
let leng1 = 0;
let leng2 = 0;
for(let i=0,leni=stopsections.length;i<leni;i++){
if(stopsections[i+1]){
let findarray1 = {
distance:0,
findarray:[],
};
let findarray2 = {
distance:0,
findarray:[],
};
// console.log("===========================");
// console.log(stopsections[i].topsection.code);
// console.log(stopsections[i+1].topsection.code);
// console.log("---------------------------");
let topresults = findnextsection(findarray1,scope.sections.datalist[stopsections[i].topsection.code].rsection,stopsections[i+1].topsection.code);
let downresults = findnextsection(findarray2,scope.sections.datalist[stopsections[i].downsection.code].rsection,stopsections[i+1].downsection.code);
let maxlengthfact = 0;
let maxsection = null;
leng1 =leng1 + topresults.distance;
// leng2 =leng2 + downresults.distance;
// console.log(topresults);
// console.log(topresults.distance);
// console.log(downresults.distance);
// console.log("------------------");
if(topresults.distance > downresults.distance){
let offset = topresults.distance - downresults.distance;
for(let n=0,lenn= topresults.findarray.length;n<lenn;n++){
if(topresults.findarray[n].lengthFact>maxsection){
maxlengthfact = topresults.findarray[n].lengthFact;
maxsection = topresults.findarray[n];
}
}
scope.sections.datalist[maxsection.code].lengthFact += offset;
}else if(topresults.distance < downresults.distance){
let offset = downresults.distance - topresults.distance;
for(let n=0,lenn= topresults.findarray.length;n<lenn;n++){
if(topresults.findarray[n].lengthFact>maxsection){
maxlengthfact = topresults.findarray[n].lengthFact;
maxsection = topresults.findarray[n];
}
}
scope.sections.datalist[maxsection.code].lengthFact += offset;
}
}
}
let topstartpoint = {
x:stopsections[0].topsection.points[0].x,
y:0,
z:stopsections[0].topsection.points[0].y
};
let downstartpoint = {
x:stopsections[0].downsection.points[0].x,
y:0,
z:stopsections[0].downsection.points[0].y
};
createsection(topstartpoint,stopsections[0].topsection.code,stopsections[1].topsection.code);
createsection(downstartpoint,stopsections[0].downsection.code,stopsections[1].downsection.code);
for(let i=1,leni=stopsections.length;i<leni;i++){
if(stopsections[i+1]){
createsection(scope.sections.datalist[stopsections[i].topsection.code].mesh.position,stopsections[i].topsection.code,stopsections[i+1].topsection.code);
createsection(scope.sections.datalist[stopsections[i].downsection.code].mesh.position,stopsections[i].downsection.code,stopsections[i+1].downsection.code);
}
}
let stations = jlmap3ddata.stationstandlist.list;
for(let j=0,lenj=stations.length;j<lenj;j++){
// console.log(j);
// console.log(scope.sections.datalist[stations[j].direction1.section]);
let x = scope.sections.datalist[stations[j].direction1.section].mesh.position.x;
let z = (scope.sections.datalist[stations[j].direction1.section].mesh.position.z+scope.sections.datalist[stations[j].direction2.section].mesh.position.z)/2;
var geometry = new THREE.BoxBufferGeometry( 100, 50, 2 );
var material = new THREE.MeshBasicMaterial( {color: 0x00ff00} );
var cube = new THREE.Mesh( geometry, material );
// console.log(x);
cube.position.set(x,0,z);
cube.rotation.x = Math.PI/2;
scene.add( cube );
}
// console.log(stopsections);
// console.log(leng1);
// console.log(leng2);
// if(sectiondata[i].standTrack == true){
// scope.stopsection.push(sectiondata[i]);
// }
resolve("loadersection");
});
};
function createsection(position,start,end){
var geometry = new THREE.BoxBufferGeometry( scope.sections.datalist[start].lengthFact, 5, 2 );
var material = new THREE.MeshBasicMaterial( {color: 0x00ff00} );
var cube = new THREE.Mesh( geometry, material );
cube.position.set(position.x+(scope.sections.datalist[start].lengthFact/2),position.y,position.z);
scope.sectiongroup.add( cube );
scope.sections.datalist[start].mesh = cube;
let topstartpoint = {
x:position.x+scope.sections.datalist[start].lengthFact,
y:0,
z:position.z
};
console.log(topstartpoint.x);
if(scope.sections.datalist[start].code == end){
return ;
}else{
return createsection(topstartpoint,scope.sections.datalist[start].rsection,end);
}
}
function findnextsection(findarray,start,end){
if(scope.sections.datalist[start].code == end){
return findarray;
}else{
findarray.findarray.push(scope.sections.datalist[start]);
findarray.distance = findarray.distance + scope.sections.datalist[start].lengthFact;
// console.log(scope.sections.datalist[start]);
// console.log(scope.sections.datalist[start].code);
return findnextsection(findarray,scope.sections.datalist[start].rsection,end);
}
}
function compare(property){
return function(a,b){
var value1 = a[property];
var value2 = b[property];
return value1 - value2;
}
}
this.sectionpromise = function(linkdata,linklist,sectiondata,switchdata,standsdata,scene){
// console.log(linkdata);
// console.log(linklist);
// console.log(sectiondata);
console.log(standsdata);
return new Promise(function(resolve, reject){
let linkrail = [];
let switchrail = [];
for(let i=0;i<linkdata.length;i++){
linkrail[linkdata[i].code] = {
lp:linkdata[i].rail[0],
rp:linkdata[i].rail[1],
lconnect:null,
rconnect:null,
lengthfact:linkdata[i].lengthfact,
lineleft:null,
lineright:null,
points:[],
type:null
};
}
for(let i=0;i<switchdata.length;i++){
switchrail[switchdata[i].code] = {
alink:switchdata[i].alink,
blink:switchdata[i].blink,
clink:switchdata[i].clink,
position:switchdata[i].position,
directtype:null,
locateType:0
};
if(linkrail[switchdata[i].blink].lp.x < switchdata[i].position.x){
linkrail[switchdata[i].alink].lswitch = switchdata[i].code;
linkrail[switchdata[i].blink].rswitch = switchdata[i].code;
}else{
linkrail[switchdata[i].alink].rswitch = switchdata[i].code;
linkrail[switchdata[i].blink].lswitch = switchdata[i].code;
}
//
if(linkrail[switchdata[i].clink].lp.x < switchdata[i].position.x){
linkrail[switchdata[i].alink].lswitch = switchdata[i].code;
linkrail[switchdata[i].clink].rswitch = switchdata[i].code;
}else{
linkrail[switchdata[i].alink].rswitch = switchdata[i].code;
linkrail[switchdata[i].clink].lswitch = switchdata[i].code;
}
}
for(let i=0;i<linkdata.length;i++){
if(linkdata[i].rotation._z == 0){
linkrail[linkdata[i].code].type = 0;
if(linkrail[linkdata[i].code].lswitch){
let switchpoint = switchrail[linkrail[linkdata[i].code].lswitch].position;
linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x,0,switchpoint.z));
}
linkrail[linkdata[i].code].points.push(new THREE.Vector3(linkrail[linkdata[i].code].lp.x,0,linkrail[linkdata[i].code].lp.z));
linkrail[linkdata[i].code].points.push(new THREE.Vector3(linkrail[linkdata[i].code].rp.x,0,linkrail[linkdata[i].code].rp.z));
if(linkrail[linkdata[i].code].rswitch){
let switchpoint = switchrail[linkrail[linkdata[i].code].rswitch].position;
linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x,0,switchpoint.z));
}
}else{
if(linkdata[i].rotation._z>0){
let testline = new THREE.CatmullRomCurve3([
new THREE.Vector3(linkrail[linkdata[i].code].lp.x,0,linkrail[linkdata[i].code].lp.z),
new THREE.Vector3(linkrail[linkdata[i].code].rp.x,0,linkrail[linkdata[i].code].rp.z)
]);
linkrail[linkdata[i].code].type = 1;
if(linkrail[linkdata[i].code].lswitch){
let switchpoint = switchrail[linkrail[linkdata[i].code].lswitch].position;
linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x,0,switchpoint.z));
linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+1.5,0,switchpoint.z));
linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+2,0,switchpoint.z-0.01));
linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+3.5,0,switchpoint.z-0.05));
}
linkrail[linkdata[i].code].points.push(testline.getPointAt(0.12));
linkrail[linkdata[i].code].points.push(testline.getPointAt(0.22));
linkrail[linkdata[i].code].points.push(testline.getPointAt(0.82));
linkrail[linkdata[i].code].points.push(testline.getPointAt(0.92));
if(linkrail[linkdata[i].code].rswitch){
let switchpoint = switchrail[linkrail[linkdata[i].code].rswitch].position;
linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-3.5,0,switchpoint.z+0.05));
linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-2,0,switchpoint.z+0.01));
linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-1.5,0,switchpoint.z));
linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x,0,switchpoint.z));
}
}else{
let testline = new THREE.CatmullRomCurve3([
new THREE.Vector3(linkrail[linkdata[i].code].lp.x,0,linkrail[linkdata[i].code].lp.z),
new THREE.Vector3(linkrail[linkdata[i].code].rp.x,0,linkrail[linkdata[i].code].rp.z)
]);
linkrail[linkdata[i].code].type = 2;
if(linkrail[linkdata[i].code].lswitch){
let switchpoint = switchrail[linkrail[linkdata[i].code].lswitch].position;
linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x,0,switchpoint.z));
linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+1.5,0,switchpoint.z));
linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+2,0,switchpoint.z+0.01));
linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+3.5,0,switchpoint.z+0.05));
}
linkrail[linkdata[i].code].points.push(testline.getPointAt(0.12));
linkrail[linkdata[i].code].points.push(testline.getPointAt(0.22));
linkrail[linkdata[i].code].points.push(testline.getPointAt(0.82));
linkrail[linkdata[i].code].points.push(testline.getPointAt(0.92));
if(linkrail[linkdata[i].code].rswitch){
let switchpoint = switchrail[linkrail[linkdata[i].code].rswitch].position;
linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-3.5,0,switchpoint.z-0.05));
linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-2,0,switchpoint.z-0.01));
linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-1.5,0,switchpoint.z));
linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x,0,switchpoint.z));
}
}
}
}
for(let i=0;i<linkdata.length;i++){
linkrail[linkdata[i].code].lineleft = new THREE.CatmullRomCurve3(linkrail[linkdata[i].code].points);
linkrail[linkdata[i].code].lineleft.curveType = "centripetal";
// linkrail[linkdata[i].code].lineleft.tension = 0.2;
let rightpoints = [];
linkrail[linkdata[i].code].points.forEach(item=>{
rightpoints.push(item);
}
);
rightpoints.reverse();
linkrail[linkdata[i].code].lineright = new THREE.CatmullRomCurve3(rightpoints);
linkrail[linkdata[i].code].lineright.curveType = "centripetal";
// scope.linkrail[linkdata[i].code].lineright.tension = 0.11;
var points = linkrail[linkdata[i].code].lineleft.getPoints( 50 );
var geometry = new THREE.BufferGeometry().setFromPoints( points );
var material;
if(linkrail[linkdata[i].code].type == 0){
material = new THREE.LineBasicMaterial( { color : 0xff0000 } );
}
if(linkrail[linkdata[i].code].type == 1){
material = new THREE.LineBasicMaterial( { color : 0x00ff00 } );
}
if(linkrail[linkdata[i].code].type == 2){
material = new THREE.LineBasicMaterial( { color : 0x0000ff } );
}
// Create the final object to add to the scene
var curveObject = new THREE.Line( geometry, material );
curveObject.position.y = Math.random();
scene.add(curveObject);
}
let standsections = [];
for(let i=0,len=sectiondata.length;i<len;i++){
if(sectiondata[i].isStandTrack == true){
standsections.push(sectiondata[i]);
}
}
// console.log(standsections);
for(let i=0,leni=standsections.length;i<leni;i++){
for(let j=0,lenj=linklist.length;j<lenj;j++){
if(standsections[i].linkCode == linklist[j].code){
for(let n=0,lenn=standsdata.length;n<lenn;n++){
if(standsections[i].relStandCode == standsdata[n].direction1.name){
let geometry = new THREE.CircleGeometry( 2, 16 );
let material = new THREE.MeshBasicMaterial( { color: 0x00ffff } );
// console.log(standsections[i].stationCode);
// console.log(standsdata[n].code);
// console.log(standsdata[n].position.x);
// console.log("position.z");
// console.log(linkrail[linklist[j].code].points[0].z);
// console.log(standsdata[n].position.z);
// console.log("........................................");
let circle1 = new THREE.Mesh( geometry, material );
let circle2 = new THREE.Mesh( geometry, material );
if(linkrail[linklist[j].code].points[0].z>standsdata[n].position.z){
circle1.position.x = standsdata[n].position.x-64;
circle1.position.y = 5;
circle1.position.z = linkrail[linklist[j].code].points[0].z;
circle1.rotation.x = -Math.PI/2;
circle2.position.x = standsdata[n].position.x+64;
circle2.position.y = 5;
circle2.position.z = linkrail[linklist[j].code].points[0].z-(linkrail[linklist[j].code].points[0].z-standsdata[n].position.z)*2;
circle2.rotation.x = -Math.PI/2;
}else{
circle1.position.x = standsdata[n].position.x+64;
circle1.position.y = 5;
circle1.position.z = linkrail[linklist[j].code].points[0].z+(standsdata[n].position.z-linkrail[linklist[j].code].points[0].z)*2;
circle1.rotation.x = -Math.PI/2;
circle2.position.x = standsdata[n].position.x-64;
circle2.position.y = 5;
circle2.position.z = linkrail[linklist[j].code].points[0].z;
circle2.rotation.x = -Math.PI/2;
}
scene.add( circle1 );
scene.add( circle2 );
n = lenn;
}
}
// console.log(standsections[i]);
// console.log(linklist[j]);
// console.log("====================================");
let progress1 = standsections[i].leftStopPointOffset/linklist[j].lengthFact;
let progress2 = standsections[i].rightStopPointOffset/linklist[j].lengthFact;
let point1 = linkrail[linklist[j].code].lineleft.getPointAt(progress1);
var geometry = new THREE.CircleGeometry( 2, 16 );
var material = new THREE.MeshBasicMaterial( { color: 0xffff00 } );
let circle1 = new THREE.Mesh( geometry, material );
circle1.position.x = point1.x;
circle1.position.y = point1.y;
circle1.position.z = point1.z;
circle1.rotation.x = -Math.PI/2;
scene.add( circle1 );
let point2 = linkrail[linklist[j].code].lineleft.getPointAt(progress2);
let circle2 = new THREE.Mesh( geometry, material );
circle2.position.x = point2.x;
circle2.position.y = point2.y;
circle2.position.z = point2.z;
circle2.rotation.x = -Math.PI/2;
scene.add( circle2 );
// console.log(progress1);
// console.log(progress2);
// console.log(standsections[i].leftStopPointOffset);
// console.log(standsections[i].rightStopPointOffset);
// console.log(linklist[j].lengthFact);
// console.log(linkrail[linklist[j].code].lineleft.points);
// console.log(point1);
// console.log(point2);
// console.log("====================================");
j = lenj;
}
}
}
resolve("loadersection");
});
}
//
// this.init = function(sectiondata,switchdata,scene){
//
// //遍历区段
// 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.type = sectiondata[i].type;
//
// sections.datalist.push(newsection);
// // sections.modellist.push("");
// }
//
// }
//
// //定义区分道岔组
// let switchlist = [];
// //遍历道岔数据
// for(let i=0;i<switchdata.length;i++){
// //道岔信息
// let newswitch = {
// code:null,
// pa:null,
// pb:null,
// pc:null,
// paname:null,
// pbname:null,
// pcname:null
// };
// //获取道岔分辨的点 PS:可能修改动态判断
// for(let j=0;j<sectiondata.length;j++){
// if(switchdata[i].sectionACode == sectiondata[j].code){
// newswitch.pa = sectiondata[j].points;
// newswitch.paname = switchdata[i].sectionACode;
// }
// if(switchdata[i].sectionBCode == sectiondata[j].code){
// newswitch.pb = sectiondata[j].points;
// newswitch.pbname = switchdata[i].sectionBCode;
// }
// if(switchdata[i].sectionCCode == sectiondata[j].code){
// newswitch.pc = sectiondata[j].points;
// newswitch.pcname = switchdata[i].sectionCCode;
// }
// if(newswitch.pa != null && newswitch.pb!= null && newswitch.pc != null){
// newswitch.code = switchdata[i].code;
// switchlist.push(newswitch);
// j = sectiondata.length;
// }
// }
// }
//
// //道岔贴图
//
// //遍历道岔信息组合轨道
// for(let i=0;i<switchlist.length;i++){
// //道岔对象组
// let newswitch = new SwitchModel();
//
// newswitch.name = switchlist[i].code;
// newswitch.code = switchlist[i].code;
//
// newswitch.index = i;
//
// switchs.datalist.push(newswitch);
// switchs.modellist.push("");
// }
// }
this.loadpromise = function(jlmap3ddata,assetloader,sectiondata,switchdata,scene){
return new Promise(function(resolve, reject){
// console.log(sectiondata);
scene.add(scope.sectiongroup);
scene.add(scope.switchgroup);
let linkdata = jlmap3ddata.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);
// sections.modellist.push("");
}
}
let autosuidao;
for(let i=0;i<assetloader.modellist.length;i++){
if(assetloader.modellist[i].deviceType == "autosuidao"){
autosuidao = assetloader.modellist[i].mesh.children[0];
}
}
for(let i = 0;i < sectiondata.length;i++){
let testmesh1 = autosuidao.clone(true);
testmesh1.code = sectiondata[i].code;
testmesh1.name = sectiondata[i].code;
if(sectiondata[i].relStandCode){
testmesh1.relStandCode = sectiondata[i].relStandCode;
}else{
testmesh1.relStandCode = "";
}
testmesh1.rightlist = sectiondata[i].rightlist;
testmesh1.leftlist = sectiondata[i].leftlist;
testmesh1.rightpoint = sectiondata[i].rightpoint;
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;
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;
scope.sections.datalist.push(newsection);
if(testmesh1.isStandTrack == false){
// scope.sectiongroup.add(testmesh1);
}else{
scope.standtrack.push(testmesh1);
var box = new THREE.BoxHelper( testmesh1, 0xff0000 );
// scope.sectiongroup.add( box );
}
scope.sections.modellist.push(testmesh1);
}
let switchmesh1;
let switchmesh2;
for(let i=0;i<assetloader.modellist.length;i++){
if(assetloader.modellist[i].deviceType == "autoswitch1"){
switchmesh1 = assetloader.modellist[i].mesh;
}
if(assetloader.modellist[i].deviceType == "autoswitch2"){
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,
pa:switchdata[i].pa,
pb:switchdata[i].pb,
pc:switchdata[i].pc,
paname:switchdata[i].paname,
pbname:switchdata[i].pbname,
pcname:switchdata[i].pcname,
alink:switchdata[i].alink,
blink:switchdata[i].blink,
clink:switchdata[i].clink
};
let sectionA,sectionB,sectionC;
for(let j=0;j<scope.sections.modellist.length;j++){
if(newswitch.paname == scope.sections.modellist[j].code){
sectionA = scope.sections.modellist[j];
}else if(newswitch.pbname == scope.sections.modellist[j].code){
sectionB = scope.sections.modellist[j];
}else if(newswitch.pcname == scope.sections.modellist[j].code){
sectionC = scope.sections.modellist[j];
}
}
let testswitch;
if(switchdata[i].pa[0].x>switchdata[i].pb[0].x){
if(((switchdata[i].pc[0].y+switchdata[i].pc[1].y)/2) < switchdata[i].pa[0].y){
if(((switchdata[i].pc[0].x+switchdata[i].pc[1].x)/2)>switchdata[i].pa[0].x){
testswitch = switchmesh1.clone(true);
}else{
testswitch = switchmesh2.clone(true);
}
}else{
if(((switchdata[i].pc[0].x+switchdata[i].pc[1].x)/2)>switchdata[i].pa[0].x){
testswitch = switchmesh2.clone(true);
}else{
testswitch = switchmesh1.clone(true);
}
testswitch.rotation.z = Math.PI;
}
}else{
if(((switchdata[i].pc[0].y+switchdata[i].pc[1].y)/2) < switchdata[i].pa[1].y){
if(((switchdata[i].pc[0].x+switchdata[i].pc[1].x)/2)>switchdata[i].pa[1].x){
testswitch = switchmesh1.clone(true);
}else{
testswitch = switchmesh2.clone(true);
}
}else{
if(((switchdata[i].pc[0].x+switchdata[i].pc[1].x)/2)>switchdata[i].pa[1].x){
testswitch = switchmesh2.clone(true);
}else{
testswitch = switchmesh1.clone(true);
}
testswitch.rotation.z = Math.PI;
}
}
testswitch.position.x = switchdata[i].position.x;
testswitch.position.y = switchdata[i].position.y;
testswitch.position.z = switchdata[i].position.z;
// testswitch.rotation.x = switchdata[i].rotation._x;
// testswitch.rotation.y = switchdata[i].rotation._y;
// testswitch.rotation.z = switchdata[i].rotation._z;
scope.switchs.datalist.push(newswitch);
scope.switchs.modellist.push(testswitch);
scope.switchgroup.add(testswitch);
}
resolve("loadersection");
});
}
function buildsuidao(linkdata,suidaodata,assetloader,scene){
let autosuidao;
for(let i=0;i<assetloader.modellist.length;i++){
if(assetloader.modellist[i].deviceType == "autosuidao"){
autosuidao = assetloader.modellist[i].mesh.children[0];
}
}
// console.log(suidaodata);
let rightlist = [];
let leftlist = [];
let rightpoint = 0;
let leftpoint = 0;
let count = autosuidao.geometry.attributes.position.count;
for(let i=0;i<count;i++){
if(autosuidao.geometry.attributes.position.array[i*3] >7){
rightlist.push(i);
if(autosuidao.geometry.attributes.position.array[i*3] > rightpoint){
rightpoint = i;
}
}
if(autosuidao.geometry.attributes.position.array[i*3] <-7){
leftlist.push(i);
if(autosuidao.geometry.attributes.position.array[i*3] < rightpoint){
leftpoint = i;
}
}
}
autosuidao.rightlist = rightlist;
autosuidao.leftlist = leftlist;
autosuidao.rightpoint = rightpoint;
autosuidao.leftpoint = leftpoint;
// console.log(autosuidao);
// console.log(linkdata.linksgroup.children);
// console.log(suidaodata.datalist);
for(let i = 0;i < suidaodata.datalist.length;i++){
let link = linkdata.linksgroup.getObjectByProperty("code",suidaodata.datalist[i].linkCode);
let suidao = suidaodata.datalist[i];
let len = suidao.offsetRight-suidao.offsetLeft;
// console.log("-------------------------------------");
// console.log("name:"+link.name);
// console.log(link.lengthfact);
// console.log(len);
// console.log("ofl:"+suidao.offsetLeft+" "+"ofr:"+suidao.offsetRight);
// console.log("-------------------------------------");
let testmesh1 = autosuidao.clone(true);
for(let i=0;i<autosuidao.rightlist.length;i++){
testmesh1.geometry.attributes.position.array[autosuidao.rightlist[i]*3] = len-7.5;
testmesh1.geometry.attributes.uv.array[autosuidao.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();
let lenfact = link.lengthfact;
testmesh1.rotation.x = -Math.PI/2;
testmesh1.rotation.z = link.rotation.z;
//
// console.log(link.lp.x);
// console.log(link.rp.x);
// console.log(suidao.offsetLeft*(len/lenfact));
// console.log((link.rp.x-link.lp.x)*(len/lenfact)/2);
// console.log("==============");
//
if(testmesh1.rotation.z != 0){
testmesh1.position.x = link.lp.x+suidao.offsetLeft*(len/lenfact)+ (link.rp.x-link.lp.x)*(len/lenfact)/2;
if(link.lp.y > link.rp.y){
testmesh1.position.z = link.lp.y-suidao.offsetLeft*(len/lenfact) + (link.rp.y-link.lp.y)*(len/lenfact)/2;
}else{
testmesh1.position.z = link.lp.y+suidao.offsetLeft*(len/lenfact) + (link.rp.y-link.lp.y)*(len/lenfact)/2;
}
}else{
testmesh1.position.x = link.lp.x+suidao.offsetLeft+len/2;
testmesh1.position.z = link.position.z;
}
testmesh1.position.y = 3.5;
// testmesh1.rotation.x = Math.PI/4;
testmesh1.code = suidaodata.datalist[i].code;
testmesh1.name = suidaodata.datalist[i].code;
// testmesh1.position.z = link.position.z;
testmesh1.relStandCode = suidaodata.datalist[i].relStandCode;
// testmesh1.stationCode = suidaodata.datalist[i].stationCode;
testmesh1.rightlist = autosuidao.rightlist;
testmesh1.leftlist = autosuidao.leftlist;
testmesh1.rightpoint = autosuidao.rightpoint;
testmesh1.leftpoint = autosuidao.leftpoint;
testmesh1.isStandTrack = suidaodata.datalist[i].isStandTrack;
testmesh1.lengthfact = len;
testmesh1.linkCode = suidao.linkCode;
if(suidaodata.datalist[i].isStandTrack == false){
scope.sectiongroup.add(testmesh1);
}else{
scope.standtrack.push(testmesh1);
var box = new THREE.BoxHelper( testmesh1, 0xff0000 );
scope.sectiongroup.add( box );
}
scope.sections.modellist.push(testmesh1);
}
}
this.resetsection = function(scene){
scene.remove(scope.sectiongroup);
};
this.reposition = function(){
}
this.update = function(){
}
this.renderon = function(){
}
this.renderoff = function(){
}
this.dispose = function(){
}
}

View File

@ -0,0 +1,26 @@
export function SectionModel(data) {
var scope = this;
//命名
this.name = null;
//code
this.code = null;
//索引位置
this.index = null;
//轨迹点
this.rail = [];
this.railline = null;
//长度
this.distance = [];
this.isStandTrack = null;
this.type = null;
//指向模型
this.mesh = null;
// //模型地址
// this.meshurl = null;
// //贴图地址
// this.picurl = null;
}

View File

@ -0,0 +1,222 @@
import {SignalModel} from '@/jlmap3d/edit/editmodel/SignalModel.js';
export function SignalList() {
let scope = this;
this.type = "signallist";
this.list = [];
this.group = new THREE.Group();
this.initpromise = function(jlmap3ddata,data,scene,assetloader,netdata){
return new Promise(function(resolve, reject){
scope.group.name = "signal";
//遍历信号数据
let netsignal = null;
let haddata = false;
if(netdata){
netsignal = JSON.parse(netdata);
haddata = true;
}
let linkdata = jlmap3ddata.linklist;
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);
newmesh.name = assetloader.modellist[num].name;
newmesh.modelid = assetloader.modellist[num].id;
newmesh.code = data[i].code;
for(let j=0;j<newmesh.children.length;j++){
newmesh.children[j].code = data[i].code;
}
let link = linkdata.linksgroup.getObjectByProperty("code",data[i].linkCode);
let posx = null;
if(data[i].offset > link.lengthfact/2){
posx = link.position.x + data[i].offset - link.lengthfact/2-10;
}else{
posx = link.position.x - (link.lengthfact/2 - data[i].offset)+10;
}
//根据线路方向修改信号灯位置
if(data[i].directionType == "01"){
newmesh.position.set(posx,0,link.position.z-3);
newmesh.rotation.z = ( Math.PI / 2 );
}else if(data[i].directionType == "02"){
newmesh.position.set(posx,0,link.position.z+3);
newmesh.rotation.z = ( - Math.PI / 2 );
}
newmesh.scale.x = 0.05;
newmesh.scale.y = 0.05;
newmesh.scale.z = 0.05;
newmesh.offset = data[i].offset;
newmest.linkCode = data[i].linkCode;
newsignal.mesh = newmesh;
newsignal.offset = data[i].offset;
newsignal.mesh.status = "01";
scope.group.add(newsignal.mesh);
scope.list.push(newsignal);
}else{
for(let j=0;j<assetloader.modellist.length;j++){
if(assetloader.modellist[j].id == netsignal[i].modelid){
num = j;
}
}
let newmesh = assetloader.modellist[num].mesh.clone(true);
newmesh.uuid = netsignal[i].id;
newmesh.name = netsignal[i].name;
newmesh.modelid = assetloader.modellist[num].id;
newmesh.code = netsignal[i].code;
for(let j=0;j<newmesh.children.length;j++){
newmesh.children[j].code = netsignal[i].code;
}
newmesh.position.x = netsignal[i].position.x;
newmesh.position.y = netsignal[i].position.y;
newmesh.position.z = netsignal[i].position.z;
newmesh.rotation.x = netsignal[i].rotation._x;
newmesh.rotation.y = netsignal[i].rotation._y;
newmesh.rotation.z = netsignal[i].rotation._z;
newmesh.scale.x = netsignal[i].scale.x;
newmesh.scale.y = netsignal[i].scale.y;
newmesh.scale.z = netsignal[i].scale.z;
newsignal.mesh = newmesh;
newsignal.mesh.status = "01";
scope.group.add(newsignal.mesh);
scope.list.push(newsignal);
}
}
scene.add(scope.group);
resolve("loadedsignal");
});
}
this.loadpromise = function(signaldata,scene,assetloader,data){
return new Promise(function(resolve, reject){
for(let i=0;i<signaldata.length;i++){
let newsignal = new SignalModel(signaldata[i]);
let num;
for(let j=0;j<assetloader.modellist.length;j++){
if(assetloader.modellist[j].id == signaldata[i].modelid){
num = j;
}
}
let newmesh = assetloader.modellist[num].mesh.clone(true);
newmesh.uuid = signaldata[i].id;
newmesh.name = signaldata[i].name;
newmesh.modelid = assetloader.modellist[num].id;
newmesh.code = signaldata[i].code;
newmesh.offset = data[i].offset;
newmesh.linkCode = data[i].linkCode;
newmesh.directionType = data[i].directionType;
newmesh.position.x = signaldata[i].position.x;
newmesh.position.y = signaldata[i].position.y;
newmesh.position.z = signaldata[i].position.z;
newmesh.rotation.x = signaldata[i].rotation._x;
newmesh.rotation.y = signaldata[i].rotation._y;
newmesh.rotation.z = signaldata[i].rotation._z;
newsignal.mesh = newmesh;
newsignal.mesh.status = "01";
scope.group.add(newsignal.mesh);
scope.list.push(newsignal);
}
scene.add(scope.group);
resolve("loadedsignal");
});
};
this.resetsignal = function(jlmap3ddata){
// console.log(jlmap3ddata.linksgroup);
// console.log(jlmap3ddata);
let linkdata = jlmap3ddata.linkdata;
for(let i=0;i<scope.group.children.length;i++){
let signaldata = scope.group.children[i];
for(let j=0,lenj=linkdata.length;j<lenj;j++){
if(linkdata[j].code == signaldata.linkCode){
let posx = linkdata[j].lp.x + (signaldata.offset/linkdata[j].oldlength)*linkdata[j].lengthfact;
//根据线路方向修改信号灯位置
// console.log(posx);
if(signaldata.directionType == "01"){
signaldata.position.set(posx,0,linkdata[j].position.z-2.4);
signaldata.rotation.z = ( Math.PI / 2 );
// signaldata.scale.set(1,1,1);
}else if(signaldata.directionType == "02"){
signaldata.position.set(posx,0,linkdata[j].position.z+2.4);
signaldata.rotation.z = ( - Math.PI / 2 );
// signaldata.scale.set(1,1,1);
}
j = lenj;
}
}
}
};
this.init = function(data,realsectionlist,scene,assetloader){
scope.group.name = "signal";
//遍历信号数据
for(let i=0;i<data.length;i++){
let newsignal = new SignalModel(data);
let newmesh = assetloader.modellist[0].mesh.clone(true);
newmesh.name = assetloader.modellist[0].id;
newmesh.code = data[i].code;
for(let j=0;j<newmesh.children.length;j++){
newmesh.children[j].code = data[i].code;
}
//根据线路方向修改信号灯位置
if(data[i].directionType == "01"){
newmesh.position.set(data[i].position.x,1,data[i].position.y-10);
newmesh.rotation.z = ( Math.PI / 2 );
}else if(data[i].directionType == "02"){
newmesh.position.set(data[i].position.x,1,data[i].position.y+10);
newmesh.rotation.z = ( - Math.PI / 2 );
}
//newmesh.scale.set(0.1,0.1,0.1);
newsignal.mesh = newmesh;
newsignal.mesh.status = "01";
scope.group.add(newsignal.mesh);
scope.list.push(newsignal);
}
scene.add(scope.group);
}
this.reposition = function(){
}
this.update = function(){
}
this.renderon = function(){
}
this.renderoff = function(){
}
this.dispose = function(){
}
}

View File

@ -0,0 +1,36 @@
export function SignalModel(data) {
this.uuid = null;
this.code = null;
this.name = null;
this.modelid = null;
this.type = null;
this.direction = null;
this.ismodel = false;
this.istexture = false;
this.modelurl = null;
// this.textures = {
// red:null,
// yellor:null,
// green:null
// }
// this.position = {
// x:0,
// y:0,
// z:0
// };
// this.rotation = {
// x:0,
// y:0,
// z:0
// };
// this.scale = {
// x:0,
// y:0,
// z:0
// }
this.mesh = null;
this.meshurl = null;
this.picurl = null;
}

View File

@ -0,0 +1,202 @@
import {StationStandModel} from '@/jlmap3d/edit/editmodel/StationStandModel.js';
export function StationStandList() {
let scope = this;
this.type = "stationstandlist";
this.list = [];
this.group = new THREE.Group();
this.textlist = [];
this.initpromise = function(jlmap3ddata,stationdata,stationstanddata,scene,assetloader,netdata){
return new Promise(function(resolve, reject){
let netstand = null;
let haddata = false;
if(netdata){
haddata = true;
}
scope.group.name = "station";
scene.add(scope.group);
//遍历车站数据
// console.log(stationstanddata);
for(let i=0;i<stationdata.length;i++){
let newstationstand = new StationStandModel(stationdata[i]);
//判断站台是否显示
if(stationdata[i].visible == true){
//遍历车站站台数据
for(let j=0;j<stationstanddata.length;j++){
if(stationstanddata[j].small == false){
//收集有效车站数据
if(stationstanddata[j].stationCode == stationdata[i].code){
newstationstand.name = stationdata[i].name;
newstationstand.code = stationdata[i].code;
// console.log(stationstanddata[j]);
// console.log(newstationstand.name);
//向右上行
if(stationstanddata[j].right == true){
newstationstand.direction1.position = stationstanddata[j].position;
newstationstand.direction1.name = stationstanddata[j].code;
newstationstand.direction1.screenDoorOpenStatus = "01";
newstationstand.direction1.section = stationstanddata[j].standTrackCode;
// console.log(stationstanddata[j].standTrackCode);
}
//向左下行
if(stationstanddata[j].right == false){
newstationstand.direction2.position = stationstanddata[j].position;
newstationstand.direction2.name = stationstanddata[j].code;
newstationstand.direction2.screenDoorOpenStatus = "01";
newstationstand.direction2.section = stationstanddata[j].standTrackCode;
// console.log(stationstanddata[j].standTrackCode);
}
}
}
}
scope.list.push(newstationstand);
}
}
// console.log(scope.list);
//建立需要显示车的车站模型对象
// for(let i=0;i<scope.list.length;i++){
//
// let num;
// if(haddata == false){
// for(let j=0;j<assetloader.modellist.length;j++){
// if(assetloader.modellist[j].deviceType == "stand"){
// num = j;
// }
// }
//
// scope.list[i].mesh = assetloader.modellist[num].mesh.clone(true);
//
// scope.list[i].uuid = assetloader.modellist[num].uuid;
// scope.list[i].id = assetloader.modellist[num].id;
// scope.list[i].modelid = assetloader.modellist[num].id;
// scope.list[i].mesh.code = scope.list[i].code;
//
// for(let j=0;j<scope.list[i].mesh.children.length;j++){
// scope.list[i].mesh.children[j].code = scope.list[i].code;
// }
// let standsection = [];
// for(let n = 0;n<jlmap3ddata.sectionlist.standtrack.length;n++){
// if(jlmap3ddata.sectionlist.standtrack[n].relStandCode == scope.list[i].direction1.name){
// standsection.push(jlmap3ddata.sectionlist.standtrack[n]);
// }
// if(jlmap3ddata.sectionlist.standtrack[n].relStandCode == scope.list[i].direction2.name){
// standsection.push(jlmap3ddata.sectionlist.standtrack[n]);
// }
// }
// let posx = (standsection[0].position.x + standsection[1].position.x)/2;
// let posz = (standsection[0].position.z + standsection[1].position.z)/2;;
// scope.list[i].mesh.position.set(posx,0,posz);
//
//
// // let textgeometry = new THREE.PlaneBufferGeometry( 128, 64, 1 );
// // let textmaterial = new THREE.MeshBasicMaterial( { side: THREE.DoubleSide,map: new THREE.CanvasTexture(getTextCanvas(stationdata[i])),transparent: true} );
// // let textplane = new THREE.Mesh( textgeometry, textmaterial );
// // textplane.name = stationdata[i].code;
// // textplane.position.y = 60;
// // textplane.rotation.x = 30;
// // //textplane.position.x = -30;
// // scope.list[i].mesh.add(textplane);
//
// scope.group.add(scope.list[i].mesh);
// }else{
//
// for(let j=0;j<assetloader.modellist.length;j++){
// if(assetloader.modellist[j].deviceType == "stand"){
// num = j;
// }
// }
// scope.list[i].mesh = assetloader.modellist[num].mesh.clone(true);
// scope.list[i].mesh.name = netdata[i].name;
// scope.list[i].mesh.code = netdata[i].code;
// scope.list[i].id = netdata[i].id;
// scope.list[i].modelid = netdata[i].modelid;
// for(let j=0;j<scope.list[i].mesh.children.length;j++){
// scope.list[i].mesh.children[j].code = netdata[i].code;
// }
//
// scope.list[i].mesh.position.x = netdata[i].position.x;
// scope.list[i].mesh.position.y = netdata[i].position.y;
// scope.list[i].mesh.position.z = netdata[i].position.z;
// // scope.list[i].mesh.rotation.x = netstand[i].rotation._x;
// // scope.list[i].mesh.rotation.y = netstand[i].rotation._y;
// // scope.list[i].mesh.rotation.z = netstand[i].rotation._z;
// scope.list[i].mesh.scale.x = netdata[i].scale.x;
// scope.list[i].mesh.scale.y = netdata[i].scale.y;
// scope.list[i].mesh.scale.z = netdata[i].scale.z;
//
// let textgeometry = new THREE.PlaneBufferGeometry( 128, 64, 1 );
// let textmaterial = new THREE.MeshBasicMaterial( { side: THREE.DoubleSide,map: new THREE.CanvasTexture(getTextCanvas(stationdata[i])),transparent: true} );
// let textplane = new THREE.Mesh( textgeometry, textmaterial );
// textplane.name = stationdata[i].code;
// textplane.position.y = 60;
// textplane.rotation.x = 30;
// //textplane.position.x = -30;
// scope.list[i].mesh.add(textplane);
//
// scope.group.add(scope.list[i].mesh);
// }
//
// // scene.add(plane);
// }
resolve("loadedstation");
});
}
this.update = function(){
}
this.renderon = function(){
}
this.renderoff = function(){
}
this.dispose = function(){
}
}
//canvas文字贴图方法
//PS:待提炼 增强功能
function getTextCanvas(text){
var canvas = document.getElementById('canvastexture');
// let width = 128;
// let height = 64;
// canvas.style.width = width + "px";
// canvas.style.height = height + "px";
var ctx = canvas.getContext('2d');
ctx.fillStyle = '#FFFFFF';
ctx.fillRect(0, 0,128,64);
ctx.font = "500px";
ctx.fillStyle = '#000000';
ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
ctx.clearRect(0,0,128,64);
ctx.fillText(text.name, 128/2,64/4);
ctx.fillText(text.runPlanName, 128/2,64*2/4);
ctx.fillText(text.kmPost, 128/2,64*3/4);
let data = ctx.getImageData(0, 0,128,64);
return data;
}

View File

@ -0,0 +1,35 @@
export function StationStandModel(opts) {
var scope = this;
this.uuid = null;
this.code = null;
this.name = null;
this.modelid = null;
this.type = null;
this.ismodel = false;
this.istexture = false;
this.modelurl = null;
this.direction1= {
position:null,
name:null,
screenDoorOpenStatus:null,
mesh:null,
openpos:[],
closepos:[]
}
this.direction2= {
position:null,
name:null,
screenDoorOpenStatus:null,
mesh:null,
openpos:[],
closepos:[]
}
this.mesh = null;
this.meshurl = null;
this.picurl = null;
}

View File

@ -0,0 +1,29 @@
import {SwitchModel} from '@/jlmap3d/model/SwitchModel.js';
export function SwitchList() {
this.type = "switchlist";
this.list = null;
this.init = function(){
}
this.update = function(){
}
this.renderon = function(){
}
this.renderoff = function(){
}
this.dispose = function(){
}
}

View File

@ -0,0 +1,22 @@
export function SwitchModel() {
var scope = this;
//命名
this.name = null;
//code
this.code = null;
//索引位置
this.index = null;
//轨迹点
this.rail = [];
//长度
this.distance = null;
this.action = null;
//指向模型
this.mesh = null;
// //模型地址
// this.meshurl = null;
// //贴图地址
// this.picurl = null;
}

View File

@ -0,0 +1,107 @@
import {TrainModel} from '@/jlmap3d/edit/editmodel/TrainModel.js';
export function TrainList() {
let scope = this;
this.type = "trainlist";
this.list = [];
this.group = [];
this.textlist = [];
this.init = function(data,scene){
scope.group = new THREE.Group();
scope.group.name = "train";
scene.add(scope.group);
// model
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();
new THREE.OBJLoader().setMaterials( materials ).setPath( '../../static/model/train/' ).load( 'train.obj', function ( object ) {
object.name = data[i].code;
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 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 );
} );
}
}
this.update = function(){
}
this.renderon = function(){
}
this.renderoff = function(){
}
this.dispose = function(){
}
}
let onProgress = function ( xhr ) {
if ( xhr.lengthComputable ) {
let percentComplete = xhr.loaded / xhr.total * 100;
//console.log( Math.round( percentComplete, 2 ) + '% downloaded' );
}
};
let onError = function () { };
function getTextCanvas(text){
var width=128, height=64;
var canvas = document.createElement('canvas');
canvas.width = width;
canvas.height = height;
canvas.style.width = width + "px";
canvas.style.height = height + "px";
var ctx = canvas.getContext('2d');
ctx.fillStyle = '#FFFFFF';
ctx.fillRect(0, 0, width, height);
ctx.font = 1+'px';
ctx.fillStyle = '#000000';
ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
ctx.clearRect(0,0,width,height);
//ctx.fillText(text.trainNumber, width/2,height/4);
ctx.fillText("车组号:"+text.trainNumber, width/2,height*2/4);
//ctx.fillText(text.trainModel.name, width/2,height*3/4);
return canvas;
}

View File

@ -0,0 +1,175 @@
import {TrainModel} from '@/jlmap3d/edit/editmodel/TrainModel.js';
export function TrainListTest() {
let scope = this;
this.type = "trainlist";
this.list = [];
this.group = [];
this.textlist = [];
this.initpromise = function(data,scene,assetloader){
return new Promise(function(resolve, reject){
//列车节数
let trainnum = 4;
//遍历列车数据
for(let i=0;i<data.length;i++){
// let group = new THREE.Group();
// //创建列车模型
// for(let j=0;j<trainnum;j++){
// let geometry = new THREE.BoxBufferGeometry( 10, 4, 5 );
// let material = new THREE.MeshBasicMaterial( {color: 0x3A5FCD} );
// let train = new THREE.Mesh( geometry, material );
// train.name = data[i].code;
// train.position.set(j*11,2,0);
// group.add(train);
// }
let newmesh;
for(let n=0;n<assetloader.modellist.length;n++){
if(assetloader.modellist[n].deviceType == "train"){
newmesh = assetloader.modellist[n].mesh.clone(true);
n = assetloader.modellist.length;
}
}
for(let j=0;j<newmesh.children.length;j++){
newmesh.children[j].name = data[i].code;
//newmesh.children[j].rotation.y = 0.05*j;
}
//创建列车字牌
let textgeometry = new THREE.PlaneBufferGeometry( 128, 64, 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.position.x = -30;
//textplane.rotation.x = Math.PI;
scope.textlist.push(textplane);
newmesh.add(textplane);
//group.add(textplane);
newmesh.first = false;
newmesh.name = data[i].code;
newmesh.groupNumber = data[i].groupNumber;
newmesh.position.set(20,2,-20*i);
//newmesh.rotation.y = Math.PI/2;
newmesh.movelist = [];
newmesh.rotelist = [];
newmesh.endpoint = null;
scope.list.push(newmesh);
//scene.add(newmesh);
}
resolve("loadedtrain");
});
}
this.init = function(data,scene,assetloader){
//列车节数
let trainnum = 4;
//遍历列车数据
for(let i=0;i<data.length;i++){
// let group = new THREE.Group();
// //创建列车模型
// for(let j=0;j<trainnum;j++){
// let geometry = new THREE.BoxBufferGeometry( 10, 4, 5 );
// let material = new THREE.MeshBasicMaterial( {color: 0x3A5FCD} );
// let train = new THREE.Mesh( geometry, material );
// train.name = data[i].code;
// train.position.set(j*11,2,0);
// group.add(train);
// }
let newmesh = assetloader.modellist[1].mesh.clone(true);
for(let j=0;j<newmesh.children.length;j++){
newmesh.children[j].name = data[i].code;
//newmesh.children[j].rotation.y = 0.05*j;
}
//创建列车字牌
let textgeometry = new THREE.PlaneBufferGeometry( 128, 64, 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.position.x = -30;
//textplane.rotation.x = Math.PI;
scope.textlist.push(textplane);
newmesh.add(textplane);
//group.add(textplane);
newmesh.first = false;
newmesh.name = data[i].code;
newmesh.groupNumber = data[i].groupNumber;
newmesh.position.set(20,2,-20*i);
//newmesh.rotation.y = Math.PI/2;
newmesh.movelist = [];
newmesh.rotelist = [];
newmesh.endpoint = null;
scope.list.push(newmesh);
scene.add(newmesh);
}
}
this.update = function(){
}
this.renderon = function(){
}
this.renderoff = function(){
}
this.dispose = function(){
}
}
let onProgress = function ( xhr ) {
if ( xhr.lengthComputable ) {
let percentComplete = xhr.loaded / xhr.total * 100;
//console.log( Math.round( percentComplete, 2 ) + '% downloaded' );
}
};
let onError = function () { };
//canvas文字贴图方法
//PS:待提炼 增强功能
function getTextCanvas(text){
var canvas = document.getElementById('canvastexture');
// let width = 128;
// let height = 64;
// canvas.style.width = width + "px";
// canvas.style.height = height + "px";
var ctx = canvas.getContext('2d');
ctx.fillStyle = '#FFFFFF';
ctx.fillRect(0, 0,128,64);
ctx.font = "500px";
ctx.fillStyle = '#000000';
ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
ctx.clearRect(0,0,128,64);
////console.log(text.groupNumber);
//ctx.fillText(text.trainNumber, width/2,height/4);
ctx.fillText("车组号:"+text.groupNumber, 128/2,64*2/4);
//ctx.fillText(text.trainModel.name, width/2,height*3/4);
let data = ctx.getImageData(0, 0,128,64);
return data;
}

View File

@ -0,0 +1,8 @@
export function TrainModel(opts) {
var scope = this;
this.mesh = null;
this.meshurl = null;
this.picurl = null;
}

View File

@ -58,7 +58,7 @@ export function Jl3ddevice(dom,group,token) {
spotLight.position.set(-50, 60, 15);
spotLight.castShadow = true;
spotLight.shadow.mapSize.width = 1024;
spotLight.shadow.mapSize.height = 1024;
spotLight.shadow.mapSize.height = 1024;
this.scene.add(spotLight);
@ -83,6 +83,7 @@ spotLight.shadow.mapSize.height = 1024;
function callback(Response) {
let data = JSON.parse(Response.body);
if(scope.nowcode != data.body.code){
scope.nowcode = data.body.code;
scope.selectmodel(data);
}else{
scope.updateaction(data);
@ -221,7 +222,7 @@ spotLight.shadow.mapSize.height = 1024;
}
}
if (data.body._type == "Signal") {
if (data.body._type == "Signal") {//从上往下红绿黄
if (data.body.code == scope.modelmanager.signalmodel.code) {
scope.modelmanager.signalmodel.status = data.body.status;
@ -237,28 +238,24 @@ spotLight.shadow.mapSize.height = 1024;
}
//开放
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;
}
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.status == "03") {
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") {
if (data.body.status == "04") {
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"];
@ -267,7 +264,7 @@ spotLight.shadow.mapSize.height = 1024;
scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true;
}
//封锁
if (data.body.status == "04") {
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"];
@ -276,7 +273,7 @@ spotLight.shadow.mapSize.height = 1024;
scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true;
}
//故障
if (data.body.status == "05") {
if (data.body.status == "06") {
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"];
@ -365,33 +362,28 @@ spotLight.shadow.mapSize.height = 1024;
}
//开放
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;
}
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["green"];
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.switchLocateType == "03") {
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["yellow"];
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 = 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 = scope.signallights["yellow"];
scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true;
}
//封锁

View File

@ -0,0 +1,87 @@
import SockJS from 'sockjs-client';
import Stomp from 'stompjs';
import { getBaseUrl } from '@/utils/baseUrl';
const BASE_API = getBaseUrl();
let baseUrl = "http://192.168.3.6:9600";//本地旭强
if(BASE_API == 'https://joylink.club/jlcloud'){
baseUrl = "https://joylink.club/relay";
}else if(BASE_API == 'https://test.joylink.club/jlcloud'){
baseUrl = "https://test.joylink.club/relay";
}
class StompClient {
constructor() {
const ws = new SockJS(`${baseUrl}/ws-relay`);
this.client = Stomp.over(ws);
this.client.debug = function (message) {
console.debug(message);
};
this.subscribeMap = new Map(); // 已订阅,对象{dest:'', handler:function, sub: Object}
this.connected = false;
this.onUsed = false;
}
connect() {
return new Promise((resolve, reject) => {
this.onUsed = true;
const that = this;
const header = {
login: 'relay',
passcode: 'relay'
};
this.client.connect(header,
()=>{
that.connected = true;
// 重连时需要重新订阅
that.subscribeMap.forEach((subscribe, dest) => {
that.subscribe(subscribe.dest, subscribe.handler);
});
resolve();
},
(error)=>{
console.error(error);
this.connected = false;
reject(error);
});
});
}
disconnect() {
this.onUsed = false;
this.client.disconnect();
}
subscribe(destination, handler) {
if (!this.connected) {
const that = this;
this.connect().then(() => {
that.subscribe(destination, handler);
});
} else {
const sub = this.client.subscribe(destination, handler);
this.subscribeMap.set(destination, {dest: destination, handler: handler, sub: sub});
}
}
unsubscribe(destination) {
const subscribe = this.subscribeMap.get(destination);
if (subscribe && subscribe.sub) {
subscribe.sub.unsubscribe();
} else if (subscribe) {
this.subscribeMap.delete(destination);
}
}
send(destination, body) {
if (body) {
body = JSON.stringify(body);
this.client.send(destination, {}, body);
} else {
console.error('stomp send body required');
}
}
}
export default StompClient;

View File

@ -0,0 +1,43 @@
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 DeviceSubscribe(jlmap3d,routegroup,jsonwebwork) {
const scope = this;
this.map = null;
this.teststomp = new StompClient();
this.topic = '/user/queue/simulation/jl3d/'+routegroup;
let header = {'X-Token': getToken() };
this.updatamap = function() {
};
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) {
}
}

View File

@ -2,11 +2,11 @@ import { getBaseUrl } from '@/utils/baseUrl';
const BASE_API = getBaseUrl();
let modelurl = "../../static/model/jdq/";
if(BASE_API == 'https://joylink.club/jlcloud'){
modelurl = "https://joylink.club/oss/jdq/";
}else if(BASE_API == 'https://test.joylink.club/jlcloud'){
modelurl = "https://test.joylink.club/oss/jdq/";
}
// if(BASE_API == 'https://joylink.club/jlcloud'){
// modelurl = "https://joylink.club/oss/jdq/";
// }else if(BASE_API == 'https://test.joylink.club/jlcloud'){
// modelurl = "https://test.joylink.club/oss/jdq/";
// }
var Staticmodel = {
Jdq1: {

View File

@ -6,6 +6,8 @@ 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 StompClient from '@/jlmap3d/jl3ddevicetrain/component/StompClient.js';
// import { Signallightload } from '@/jlmap3d/jl3ddevice/component/signallight.js';
// import StompClient from '@/utils/sock';
@ -17,6 +19,7 @@ export function Jl3ddevice(dom) {
//helpbox选中包围框
//textplane三维介绍标牌
let helpbox,textplane;
let connect = null;
this.dom = dom;
this.nowcode = null;
this.animateswitch = false;
@ -179,7 +182,7 @@ export function Jl3ddevice(dom) {
// dom.appendChild( stats.dom );
document.addEventListener( "mousedown", onselect, false );
document.addEventListener( "touchstart", ontouch, false );
window.onresize = function () {
camera.aspect = scope.dom.offsetWidth / scope.dom.offsetHeight;
camera.updateProjectionMatrix();
@ -195,10 +198,48 @@ export function Jl3ddevice(dom) {
this.modelmanager = new ModelManager();
this.modelmanager.loadpromise(Staticmodel, scope.mixers,scene).then(function (data) {
moveanima.initlist( scope.modelmanager.controllist);
connect = new StompClient();
// debugger
connect.subscribe("/queue/relay/status",callback);
animate();
})
});
this.sendmsg = function (type,index){
let msg = {
id:index+1,
on:null
};
if(type == "0"){
msg.on = true;
}
if(type == "1"){
msg.on = false;
}
connect.send("/app/topic/relay/"+msg.id+"/control/"+msg.on,msg);
}
this.upmodelaction = function(type,index){
if(type == "0"){
scope.modelmanager.actionlist[index].reset();
scope.modelmanager.actionlist[index].time = 0;
scope.modelmanager.actionlist[index].timeScale = 1;
scope.modelmanager.actionlist[index].play();
}
if(type == "1"){
scope.modelmanager.actionlist[index].reset();
scope.modelmanager.actionlist[index].time = scope.modelmanager.actionlist[index]._clip.duration;
scope.modelmanager.actionlist[index].timeScale = -1;
scope.modelmanager.actionlist[index].play();
}
};
//循环渲染函数
let delta;
let data;
function callback(Response){
// console.log(Response);
data = JSON.parse(Response.body);
// console.log(data);
upjdqstats(data);
}
function animate() {
scope.anime = requestAnimationFrame(animate);
@ -206,6 +247,15 @@ export function Jl3ddevice(dom) {
moveanima.animateupdate();
// scope.controls.update();
// stats.update();
delta = clock.getDelta();
if (scope.mixers) {
for (let i = 0; i < scope.mixers.length; i++) {
if (scope.mixers[i]) {
scope.mixers[i].update(delta);
}
}
}
}
@ -261,56 +311,124 @@ export function Jl3ddevice(dom) {
}
function move2(){
for(let i=0,leni=scope.selectmodel.children.length;i<leni;i++){
if(scope.selectmodel){
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 == "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;
}
}
if(scope.selectmodel.children[i].name == "Lxing"){
moveanima.animatelist[scope.selectmodel.name+"Lxingoff"].enable = true;
}
}
function ontouch(event){
if(scope.status == '0'){
let raycaster = new THREE.Raycaster();
//定义平面鼠标点击坐标
let mouse = new THREE.Vector2();
mouse.x = (event.touches[0].pageX / dom.offsetWidth) * 2 - 1;
mouse.y = -(event.touches[0].pageY / 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.selectmodel.children[i].name == "jiaoxingxiantie"){
moveanima.animatelist[scope.selectmodel.name+"jiaoxingxiantieoff"].enable = true;
}
if(scope.status == '1'){
//定义光线
let raycaster = new THREE.Raycaster();
//定义平面鼠标点击坐标
let mouse = new THREE.Vector2();
mouse.x = (event.touches[0].pageX / dom.offsetWidth) * 2 - 1;
mouse.y = -(event.touches[0].pageY / dom.offsetHeight) * 2 + 1;
raycaster.setFromCamera( mouse, camera );
let intersects = raycaster.intersectObjects( scope.modelmanager.controllist,true);
if(helpbox){
scene.remove( helpbox );
helpbox = null;
}
if(scope.selectmodel.children[i].name == "xianquan"){
moveanima.animatelist[scope.selectmodel.name+"xianquanoff"].enable = true;
if(textplane){
scene.remove(textplane);
textplane.geometry.dispose();
textplane.material.dispose();
}
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;
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 onselect(event){
if(event.button == '0'){
if(scope.status == '0'){

View File

@ -4,6 +4,7 @@ export function ModelManager(){
let scope = this;
this.controllist = [];
this.actionlist = [];
let jdq1 = {
code:jdq1,
locateType:"01",
@ -51,24 +52,28 @@ export function ModelManager(){
return new Promise(function(resolve, reject){
Promise.all(initlist).then((result) => {
jdq1.mesh.stats = "0";
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.stats = "0";
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.stats = "0";
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.stats = "0";
jdq4.mesh.position.x = 19;
jdq4.mesh.position.z = 170;
jdq4.mesh.position.y = 1270;
@ -79,6 +84,11 @@ export function ModelManager(){
scope.controllist.push(jdq2.mesh);
scope.controllist.push(jdq3.mesh);
scope.controllist.push(jdq4.mesh);
console.log(jdq1);
scope.actionlist.push(jdq1.action);
scope.actionlist.push(jdq2.action);
scope.actionlist.push(jdq3.action);
scope.actionlist.push(jdq4.action);
scene.add(jdq1.mesh);
scene.add(jdq2.mesh);
scene.add(jdq3.mesh);
@ -120,11 +130,14 @@ function fbxpromise(asset,mixers,model){
}
}
model.mesh = object;
if(object.animations.length>0){
model.action = mixer.clipAction( object.animations[ 0 ] );
model.action.setLoop(THREE.LoopOnce);
model.action.clampWhenFinished = true;
// model.action.play();
// scope.actionlist.push("1");
mixers.push(mixer);
}
resolve(asset.deviceType);

View File

@ -107,6 +107,7 @@ export function Jl3dDriving(mixers,updatemmi,sound,translation,routegroup) {
trainlisttest.group.remove(trainlisttest.list[drivingcode]);
drivingcode = data.body.code;
trainlisttest.group.add(trainlisttest.list[drivingcode]);
// sound.volswitch = true;
updatemmi.updatedrivingcode( data.body.code);
@ -517,15 +518,7 @@ export function Jl3dDriving(mixers,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");
@ -603,7 +596,7 @@ export function Jl3dDriving(mixers,updatemmi,sound,translation,routegroup) {
console.log(data.body[i]);
let nextcode;
if(data.body[i].directionType == '02'){
if(rails.linkrail[data.body[i].linkCode].lineleft){
@ -618,6 +611,11 @@ export function Jl3dDriving(mixers,updatemmi,sound,translation,routegroup) {
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;
if(data.body[i].targetStation){
trainlisttest.list[code].pc = data.body[i].targetLinkPercent/rails.stops[data.body[i].targetStation].direct1.percent;
trainlisttest.list[code].targetpercent = rails.stops[data.body[i].targetStation].direct1.percent;
trainlisttest.list[code].targetLink = data.body[i].targetLink;
}
trainlisttest.list[code].speeds = parseFloat(trainlisttest.list[code].speed*10/36/25/trainlisttest.list[code].len);
}
}else if(data.body[i].directionType == '03'){
@ -634,6 +632,11 @@ export function Jl3dDriving(mixers,updatemmi,sound,translation,routegroup) {
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;
if(data.body[i].targetStation){
trainlisttest.list[code].pc = data.body[i].targetLinkPercent/rails.stops[data.body[i].targetStation].direct1.percent;
trainlisttest.list[code].targetpercent = rails.stops[data.body[i].targetStation].direct1.percent;
trainlisttest.list[code].targetLink = data.body[i].targetLink;
}
trainlisttest.list[code].speeds = parseFloat(trainlisttest.list[code].speed*10/36/25/trainlisttest.list[code].len);
}
}
@ -748,26 +751,20 @@ export function Jl3dDriving(mixers,updatemmi,sound,translation,routegroup) {
}
// 开放
if (data.status == '02') {
if (data.switchLocateType == '01') {
signallist.list[code].mesh.getObjectByName("red").material.map = materials[3];
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials[3];
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("green").material.map = materials[2];
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
}
if (data.switchLocateType == '02') {
signallist.list[code].mesh.getObjectByName("red").material.map = materials[3];
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials[1];
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("green").material.map = materials[3];
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
}
signallist.list[code].mesh.getObjectByName("red").material.map = materials[3];
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials[3];
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("green").material.map = materials[2];
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
}
if (data.status == '03') {
signallist.list[code].mesh.getObjectByName("red").material.map = materials[3];
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials[1];
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("green").material.map = materials[3];
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
}
// 引导

View File

@ -71,7 +71,7 @@ export function Jlmap3dSubscribe(jlmap3d,routegroup,jsonwebwork) {
jlmap3d.updatedrivingcode( event.data.body.code);
}
if(event.data._type == 'Train'){
// console.log(event.data);
console.log(event.data);
trainstatus(event.data);
}
if (event.data._type== 'Signal' && signallist) {
@ -625,28 +625,23 @@ export function Jlmap3dSubscribe(jlmap3d,routegroup,jsonwebwork) {
}
// 开放
if (data.status == '02') {
if (data.switchLocateType == '01') {
signallist.list[code].mesh.getObjectByName("red").material.map = materials[3];
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials[3];
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("green").material.map = materials[2];
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
}
if (data.switchLocateType == '02') {
signallist.list[code].mesh.getObjectByName("red").material.map = materials[3];
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials[1];
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("green").material.map = materials[3];
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
}
signallist.list[code].mesh.getObjectByName("red").material.map = materials[3];
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials[3];
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("green").material.map = materials[2];
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
}
if (data.status == '03') {
signallist.list[code].mesh.getObjectByName("red").material.map = materials[3];
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials[1];
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("green").material.map = materials[3];
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
}
// 引导
if (data.status == '03') {
signallist.list[code].mesh.getObjectByName("red").material.map = materials[0];

View File

@ -108,9 +108,9 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup) {
ModelLoad(mapnetdata,scope,netdata.data,mapdata,camera,controls,scene,storemod);
});
});
let stats = new Stats();
dom.appendChild( stats.dom );
//
// let stats = new Stats();
// dom.appendChild( stats.dom );
// var timer = setInterval(function() {
// if(trainlisttest){
@ -171,7 +171,7 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup) {
//检测动画构造器播放动画
// }
stats.update();
// stats.update();
}
function startWorker(webwork){

View File

@ -24,7 +24,7 @@ let defaulttrain = {
deviceType:"train",
type:"num4",
picUrl:"",
assetUrl:modelurl+"/models/train/train.FBX"
assetUrl:"../../static/model/train/train.FBX"
}

View File

@ -69,7 +69,7 @@ export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene,store
let signaldata = JSON.parse(netdata.signals);
let standsdata = JSON.parse(netdata.stands);
// console.log(netdata.assets);
assetloader.setmodellist(netdata.assets,5);
assetloader.setmodellist(netdata.assets,1);
assetloader.assetpromise(sceneload)
.then(function(data){

View File

@ -20,11 +20,11 @@ export function TrainList() {
selectmesh = assetloader.modellist[n].mesh
ntracks1 = assetloader.modellist[n].animations.slice(24,52);
ntracks1 = assetloader.modellist[n].animations.slice(16,27);
tclip = new THREE.AnimationClip("three",2,ntracks1);
ntracks2 = assetloader.modellist[n].animations.slice(0,24);
ntracks2 = assetloader.modellist[n].animations.slice(0,15);
fclip = new THREE.AnimationClip("four",2,ntracks2);

View File

@ -3,11 +3,11 @@ 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.41:9000'; // 张赛
BASE_API = 'http://192.168.3.82:9000'; // 杜康
// BASE_API = 'http://192.168.3.82:9000'; // 杜康
} else {
BASE_API = process.env.VUE_APP_BASE_API;
}

View File

@ -93,6 +93,7 @@ export default {
top:0;
width: 20%;
height: 100%;
background-color: #FFFFFF;
// background-image:url("/static/texture/menu.png");
// background-repeat: no-repeat;
// background-size: 100%;

View File

@ -28,6 +28,37 @@
{{devicemsg}}
</div>
</div>
<div class="jlmap3dstats">
<div class="statusdiv">JWJXC-1700
</div>
<div class="statusdiv">JPJXC-1000
</div>
<div class="statusdiv">JZJXC-H18
</div>
<div class="statusdiv">JPJXC-480
</div>
<div class="statusdiv">状态:{{stats1700}}
</div>
<div class="statusdiv">状态:{{stats1000}}
</div>
<div class="statusdiv">状态:{{statsh18}}
</div>
<div class="statusdiv">状态:{{stats480}}
</div>
<div class="statusdiv" @click="switch1700">{{text1700}}
</div>
<div class="statusdiv" @click="switch1000">{{text1000}}
</div>
<div class="statusdiv" @click="switchh18">{{texth18}}
</div>
<div class="statusdiv" @click="switch480">{{text480}}
</div>
</div>
</div>
</template>
@ -48,7 +79,18 @@
devicename:"",
devicemsg:"",
devicestats:"设备分解",
stats1700:"off",
stats1000:"off",
statsh18:"off",
stats480:"off",
text1700:"关",
text1000:"关",
texth18:"关",
text480:"关",
on1700:false,
on1000:false,
onh18:false,
on480:false,
}
},
watch: {
@ -92,6 +134,7 @@
mounted() {
window.updatemenulist = this.updatemenulist;
window.updatemsg = this.updatemsg;
window.upjdqstats = this.upjdqstats;
this.init();
},
beforeDestroy() {
@ -127,6 +170,101 @@
this.msgshow = false;
}
},
upjdqstats(data){
// console.log(data[0].on);
if(data[0].on != this.on1700){
if(data[0].on == true){
this.text1700 = "开";
this.stats1700 = "on";
this.on1700 = true;
this.jl3d.upmodelaction(0,0);
}
if(data[0].on == false){
this.text1700 = "关";
this.stats1700 = "off";
this.on1700 = false;
this.jl3d.upmodelaction(1,0);
}
}
if(data[1].on != this.on1000){
if(data[1].on == true){
this.text1000 = "开";
this.stats1000 = "on";
this.on1000 = true;
this.jl3d.upmodelaction(0,1);
}
if(data[1].on == false){
this.text1000 = "关";
this.stats1000 = "off";
this.on1000 = false;
this.jl3d.upmodelaction(1,1);
}
}
if(data[2].on != this.onh18){
if(data[2].on == true){
this.texth18 = "开";
this.statsh18 = "on";
this.onh18 = true;
this.jl3d.upmodelaction(0,2);
}
if(data[2].on == false){
this.texth18 = "关";
this.statsh18 = "off";
this.onh18 = false;
this.jl3d.upmodelaction(1,2);
}
}
if(data[3].on != this.on480){
if(data[3].on == true){
this.text480 = "开";
this.stats480 = "on";
this.on480 = true;
this.jl3d.upmodelaction(0,3);
}
if(data[3].on == false){
this.text480 = "关";
this.stats480 = "off";
this.on480 = false;
this.jl3d.upmodelaction(1,3);
}
}
},
switch1700(){
if(this.stats1700 == "off"){
this.jl3d.sendmsg(0,0);
}else if(this.stats1700 == "on"){
this.jl3d.sendmsg(1,0);
}
},
switch1000(){
if(this.stats1000 == "off"){
this.jl3d.sendmsg(0,1);
}else if(this.stats1000 == "on"){
this.jl3d.sendmsg(1,1);
}
},
switchh18(){
if(this.statsh18 == "off"){
this.jl3d.sendmsg(0,2);
}else if(this.statsh18 == "on"){
this.jl3d.sendmsg(1,2);
}
},
switch480(){
if(this.stats480 == "off"){
this.jl3d.sendmsg(0,3);
}else if(this.stats480 == "on"){
this.jl3d.sendmsg(1,3);
}
},
back(changedata) {
window.close();
},
@ -162,6 +300,33 @@
}
.jlmap3dstats{
position: absolute;
float:left;
/* left:10px; */
/* top:20px; */
width: 40%;
/* height: 20%; */
z-index: 10;
background-color: #409EFF;
border-radius: 4px;
color: #FFFFFF
/* background-image:url("/static/texture/menu.png"); */
/* background-repeat: no-repeat; */
/* background-size: 100%; */
}
.statusdiv{
float:left;
top:50%;
width:25%;
/* height:30%; */
font-size: 20px;
border: 1px solid white;
text-align: center;
cursor:pointer;
}
.msgtop{
text-align: center;
width: 90%;

View File

@ -123,6 +123,7 @@
init: function () {
//console.log(this.mapid);
let mapdata = this.$store.getters['map/map'];
console.log(mapdata);
let dom = document.getElementById('testdraw');
this.jlmap3dedit = new JLmap3dEdit(dom, mapdata, this.mapid);
//this.jlmap3dedit.eventon();

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.