Merge branch 'test' of https://git.code.tencent.com/lian-cbtc/jl-client into test
This commit is contained in:
commit
4fe805e02f
@ -37,7 +37,6 @@ export function Sectionaction(){
|
||||
}
|
||||
//点击事件
|
||||
this.raycaster = function(data,type){
|
||||
console.log(type);
|
||||
let modellist;
|
||||
if(type == "test"){
|
||||
modellist = data.scene.getObjectByName("section").children;
|
||||
@ -80,13 +79,13 @@ export function Sectionaction(){
|
||||
|
||||
raycaster.setFromCamera( mouse, data.camera );
|
||||
let intersects1;
|
||||
console.log(modellist);
|
||||
// console.log(modellist);
|
||||
for(let i=0;i<modellist.length;i++){
|
||||
intersects1 = raycaster.intersectObject(modellist[i],true);
|
||||
console.log(intersects1);
|
||||
// console.log(intersects1);
|
||||
if(intersects1[0]){
|
||||
console.log(intersects1[0].object.code);
|
||||
console.log(modellist[i].code);
|
||||
// console.log(intersects1[0].object.code);
|
||||
// console.log(modellist[i].code);
|
||||
if(intersects1[0].object.code == modellist[i].code){
|
||||
|
||||
return modellist[i];
|
||||
|
@ -59,37 +59,32 @@ export function getmodels(data) {
|
||||
let sections = [];
|
||||
// console.log(data.mapdata.sectionlist.sections.datalist);
|
||||
for(let i in data.mapdata.sectionlist.sections.datalist){
|
||||
console.log(data.mapdata.sectionlist.sections.datalist[i].code);
|
||||
console.log(data.mapdata.sectionlist.sections.datalist[i]);
|
||||
console.log(data.mapdata.sectionlist.sections.datalist[i].mesh.lengthFact);
|
||||
let section = {
|
||||
// uuid:data.mapdata.sectionlist.sections.modellist[i].uuid,
|
||||
code:data.mapdata.sectionlist.sections.datalist[i].code,
|
||||
name:data.mapdata.sectionlist.sections.datalist[i].name,
|
||||
lengthFact:data.mapdata.sectionlist.sections.datalist[i].mesh.lengthFact,
|
||||
standTrack:data.mapdata.sectionlist.sections.datalist[i].standTrack,
|
||||
rightlist:data.mapdata.sectionlist.sections.datalist[i].rightlist,
|
||||
leftlist:data.mapdata.sectionlist.sections.datalist[i].leftlist,
|
||||
rp:data.mapdata.sectionlist.sections.datalist[i].rp,
|
||||
lp:data.mapdata.sectionlist.sections.datalist[i].lp,
|
||||
|
||||
railpoint:data.mapdata.sectionlist.sections.datalist[i].mesh.railpoint,
|
||||
rail:data.mapdata.sectionlist.sections.datalist[i].rail,
|
||||
position:data.mapdata.sectionlist.sections.datalist[i].mesh.position,
|
||||
rotation:data.mapdata.sectionlist.sections.datalist[i].mesh.rotation,
|
||||
scale:data.mapdata.sectionlist.sections.datalist[i].mesh.scale,
|
||||
rsection:null,
|
||||
lsection:null,
|
||||
csection:null
|
||||
}
|
||||
if(data.mapdata.sectionlist.sections.datalist[i].rsection){
|
||||
section.rsection = data.mapdata.sectionlist.sections.datalist[i].rsection;
|
||||
}
|
||||
if(data.mapdata.sectionlist.sections.datalist[i].lsection){
|
||||
section.lsection = data.mapdata.sectionlist.sections.datalist[i].lsection;
|
||||
}
|
||||
if(data.mapdata.sectionlist.sections.datalist[i].csection){
|
||||
section.csection = data.mapdata.sectionlist.sections.datalist[i].csection;
|
||||
}
|
||||
let nowmesh = data.mapdata.sectionlist.sectiongroup.getObjectByProperty("code",section.code);
|
||||
section.railpoint = nowmesh.railpoint
|
||||
// console.log(nowmesh.railpoint);
|
||||
// if(data.mapdata.sectionlist.sections.datalist[i].rsection){
|
||||
// section.rsection = data.mapdata.sectionlist.sections.datalist[i].rsection;
|
||||
// }
|
||||
// if(data.mapdata.sectionlist.sections.datalist[i].lsection){
|
||||
// section.lsection = data.mapdata.sectionlist.sections.datalist[i].lsection;
|
||||
// }
|
||||
// if(data.mapdata.sectionlist.sections.datalist[i].csection){
|
||||
// section.csection = data.mapdata.sectionlist.sections.datalist[i].csection;
|
||||
// }
|
||||
|
||||
// testmesh1.position.z = link.position.z;
|
||||
|
||||
|
@ -53,7 +53,7 @@ export function JLmap3dEdit(dom, data, mapid) {
|
||||
dom.appendChild(this.renderer.domElement);
|
||||
|
||||
//定义相机
|
||||
this.camera = new THREE.PerspectiveCamera(70, dom.clientWidth/dom.clientHeight, 1, 1000);
|
||||
this.camera = new THREE.PerspectiveCamera(70, dom.clientWidth/dom.clientHeight, 1, 100000);
|
||||
this.camera.aspect = window.innerWidth / window.innerHeight;
|
||||
this.camera.updateProjectionMatrix();
|
||||
this.camera.position.set(0,0,1800);
|
||||
@ -68,7 +68,6 @@ export function JLmap3dEdit(dom, data, mapid) {
|
||||
this.transcontrol.addEventListener( 'change', render );
|
||||
|
||||
this.transcontrol.addEventListener( 'dragging-changed', function ( event ) {
|
||||
|
||||
scope.controls.enabled = ! event.value;
|
||||
scope.selectswitch = ! event.value;
|
||||
} );
|
||||
@ -234,10 +233,14 @@ export function JLmap3dEdit(dom, data, mapid) {
|
||||
|
||||
|
||||
this.vexscal = function(){
|
||||
|
||||
this.scalswitch = true;
|
||||
scalControls.attach(scope.selectmodel);
|
||||
scope.transcontrol.detach()
|
||||
this.scalswitch = true;
|
||||
if(scope.selectmodel.railpoint){
|
||||
scalControls.attach(scope.selectmodel,scope.selectmodel.railpoint);
|
||||
}else{
|
||||
scalControls.attach(scope.selectmodel);
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
@ -257,6 +260,7 @@ export function JLmap3dEdit(dom, data, mapid) {
|
||||
console.log("autoss");
|
||||
console.log(scope.mapdata);
|
||||
scope.mapdata.signallist.resetsignal(scope.mapdata);
|
||||
scope.mapdata.switchlist.resetswitch(scope.mapdata);
|
||||
//old
|
||||
// scope.mapdata.signallist.resetsignal(scope.mapdata.linklist);
|
||||
};
|
||||
@ -313,7 +317,12 @@ export function JLmap3dEdit(dom, data, mapid) {
|
||||
|
||||
if(scope.selectmodel != null){
|
||||
//console.log(scope.selectmodel.rotation);
|
||||
scope.transcontrol.attach( scope.selectmodel );
|
||||
if(scalControls.scalon){
|
||||
|
||||
}else{
|
||||
scope.transcontrol.attach( scope.selectmodel,scope.editmode );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -853,24 +853,13 @@ export function SectionList() {
|
||||
|
||||
this.loadpromise = function(jlmap3ddata,assetloader,sectiondata,scene){
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
autorail.rightlist = rightlist;
|
||||
autorail.leftlist = leftlist;
|
||||
var texture = new THREE.TextureLoader().load( '../../static/test/z0251.png' );
|
||||
texture.wrapS = texture.wrapT = THREE.RepeatWrapping;
|
||||
texture.repeat.set( 1,1);
|
||||
|
||||
var selectmaterial = new THREE.MeshPhongMaterial( { map: texture,transparent:true,alphaTest:0.1 } );
|
||||
|
||||
|
||||
scene.add(scope.sectiongroup);
|
||||
return new Promise(function(resolve, reject){
|
||||
for(let i=0,leni = sectiondata.length;i<leni;i++){
|
||||
@ -879,40 +868,131 @@ export function SectionList() {
|
||||
name:sectiondata[i].name,
|
||||
standTrack:sectiondata[i].standTrack,
|
||||
rail:sectiondata[i].rail,
|
||||
rightlist:rightlist,
|
||||
leftlist:leftlist,
|
||||
rsection:sectiondata[i].rsection,
|
||||
lsection:sectiondata[i].lsection,
|
||||
csection:sectiondata[i].csection,
|
||||
lengthFact:sectiondata[i].lengthFact,
|
||||
rp:sectiondata[i].rp,
|
||||
lp:sectiondata[i].lp,
|
||||
railpoint:sectiondata[i].railpoint,
|
||||
mesh:null
|
||||
};
|
||||
|
||||
let len = newsection.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;
|
||||
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);
|
||||
let testmesh2 = null;
|
||||
|
||||
if(newsection.railpoint.length>2){
|
||||
// console.log(newsection);
|
||||
let height = Math.random()/1000;
|
||||
var closedSpline = new THREE.CatmullRomCurve3( [
|
||||
new THREE.Vector3(newsection.railpoint[0].x,newsection.railpoint[0].y,newsection.railpoint[0].z),
|
||||
new THREE.Vector3(newsection.railpoint[1].x,newsection.railpoint[1].y,newsection.railpoint[1].z),
|
||||
new THREE.Vector3(newsection.railpoint[2].x,newsection.railpoint[2].y,newsection.railpoint[2].z)
|
||||
] );
|
||||
console.log();
|
||||
closedSpline.type = 'catmullrom';
|
||||
closedSpline.closed = false;
|
||||
var extrudeSettings = {
|
||||
steps : 5,
|
||||
curveSegments : 1,
|
||||
bevelSegments : 1,
|
||||
bevelEnabled : false,
|
||||
extrudePath : closedSpline,
|
||||
};
|
||||
var shape = new THREE.Shape();
|
||||
shape.moveTo( 0,-2 );
|
||||
shape.lineTo( 0, 2 );
|
||||
var geometry = new THREE.ExtrudeBufferGeometry( shape, extrudeSettings );
|
||||
testmesh2 = new THREE.Mesh( geometry, selectmaterial );
|
||||
|
||||
testmesh2.railpoint = [
|
||||
{x:newsection.railpoint[0].x,y:newsection.railpoint[0].y,z:newsection.railpoint[0].z},
|
||||
{x:newsection.railpoint[1].x,y:newsection.railpoint[1].y,z:newsection.railpoint[1].z},
|
||||
{x:newsection.railpoint[2].x,y:newsection.railpoint[2].y,z:newsection.railpoint[2].z},
|
||||
];
|
||||
testmesh2.lengthFact = newsection.railpoint[2].x - newsection.railpoint[0].x;
|
||||
// closedSpline.arcLengthDivisions;
|
||||
let count = testmesh2.geometry.attributes.position.count/3;
|
||||
|
||||
for(let i=0;i<count;i++){
|
||||
let ui=i*6;
|
||||
if(i%2 != 0){
|
||||
testmesh2.geometry.attributes.uv.array[ui] = 0;
|
||||
testmesh2.geometry.attributes.uv.array[ui+1] = 1;
|
||||
testmesh2.geometry.attributes.uv.array[ui+2] = len/5;
|
||||
testmesh2.geometry.attributes.uv.array[ui+3] = 1;
|
||||
testmesh2.geometry.attributes.uv.array[ui+4] = len/5;
|
||||
testmesh2.geometry.attributes.uv.array[ui+5] = 0;
|
||||
}else{
|
||||
testmesh2.geometry.attributes.uv.array[ui] = 0;
|
||||
testmesh2.geometry.attributes.uv.array[ui+1] = 0;
|
||||
testmesh2.geometry.attributes.uv.array[ui+2] = 0;
|
||||
testmesh2.geometry.attributes.uv.array[ui+3] = 1;
|
||||
testmesh2.geometry.attributes.uv.array[ui+4] = len/5;
|
||||
testmesh2.geometry.attributes.uv.array[ui+5] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}else{
|
||||
let height = Math.random()/1000;
|
||||
|
||||
|
||||
var closedSpline = new THREE.CatmullRomCurve3( [
|
||||
new THREE.Vector3(newsection.railpoint[0].x,newsection.railpoint[0].y,newsection.railpoint[0].z),
|
||||
new THREE.Vector3(newsection.railpoint[1].x,newsection.railpoint[1].y,newsection.railpoint[1].z),
|
||||
] );
|
||||
|
||||
closedSpline.type = 'catmullrom';
|
||||
closedSpline.closed = false;
|
||||
// Set up settings for later extrusion
|
||||
var extrudeSettings = {
|
||||
steps : 1,
|
||||
curveSegments : 1,
|
||||
bevelSegments : 1,
|
||||
bevelEnabled : false,
|
||||
extrudePath : closedSpline,
|
||||
};
|
||||
var shape = new THREE.Shape();
|
||||
shape.moveTo( -2,0 );
|
||||
shape.lineTo( 2,0 );
|
||||
// Extrude the triangle along the CatmullRom curve
|
||||
var geometry = new THREE.ExtrudeBufferGeometry( shape, extrudeSettings );
|
||||
testmesh2 = new THREE.Mesh( geometry, selectmaterial );
|
||||
|
||||
testmesh2.railpoint = [
|
||||
{x:newsection.railpoint[0].x,y:newsection.railpoint[0].y,z:newsection.railpoint[0].z},
|
||||
{x:newsection.railpoint[1].x,y:newsection.railpoint[1].y,z:newsection.railpoint[1].z},
|
||||
];
|
||||
testmesh2.lengthFact = newsection.railpoint[1].x - newsection.railpoint[0].x;
|
||||
// closedSpline.arcLengthDivisions;
|
||||
let count = testmesh2.geometry.attributes.position.count/3;
|
||||
|
||||
for(let i=0;i<count;i++){
|
||||
let ui=i*6;
|
||||
if(i%2 != 0){
|
||||
testmesh2.geometry.attributes.uv.array[ui] = 0;
|
||||
testmesh2.geometry.attributes.uv.array[ui+1] = 1;
|
||||
testmesh2.geometry.attributes.uv.array[ui+2] = len;
|
||||
testmesh2.geometry.attributes.uv.array[ui+3] = 1;
|
||||
testmesh2.geometry.attributes.uv.array[ui+4] = len;
|
||||
testmesh2.geometry.attributes.uv.array[ui+5] = 0;
|
||||
}else{
|
||||
testmesh2.geometry.attributes.uv.array[ui] = 0;
|
||||
testmesh2.geometry.attributes.uv.array[ui+1] = 0;
|
||||
testmesh2.geometry.attributes.uv.array[ui+2] = 0;
|
||||
testmesh2.geometry.attributes.uv.array[ui+3] = 1;
|
||||
testmesh2.geometry.attributes.uv.array[ui+4] = len;
|
||||
testmesh2.geometry.attributes.uv.array[ui+5] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// console.log(sectiondata[i]);
|
||||
// console.log(testmesh2);
|
||||
// console.log(newsection);
|
||||
testmesh2.geometry = newrail;
|
||||
testmesh2.geometry.attributes.position.needsUpdate = true;
|
||||
testmesh2.geometry.attributes.uv.needsUpdate = true;
|
||||
testmesh2.geometry.computeBoundingSphere();
|
||||
testmesh2.geometry.center();
|
||||
testmesh2.code = newsection.code;
|
||||
testmesh2.rightlist = sectiondata[i].rightlist;
|
||||
testmesh2.leftlist = sectiondata[i].leftlist;
|
||||
testmesh2.lengthFact = newsection.lengthFact;
|
||||
testmesh2.position.set(sectiondata[i].position.x,sectiondata[i].position.y,sectiondata[i].position.z);
|
||||
testmesh2.rotation.set(sectiondata[i].rotation._x,sectiondata[i].rotation._y,sectiondata[i].rotation._z);
|
||||
testmesh2.standTrack = newsection.standTrack;
|
||||
testmesh2.meshtype = "section";
|
||||
|
||||
// testmesh2.geometry.computeBoundingBox();
|
||||
// testmesh2.geometry.center()
|
||||
// testmesh2.position.set(sectiondata[i].position.x,sectiondata[i].position.y,sectiondata[i].position.z);
|
||||
scope.sectiongroup.add(testmesh2);
|
||||
newsection.mesh = testmesh2;
|
||||
scope.sections.datalist[newsection.code] = newsection;
|
||||
|
@ -145,6 +145,8 @@ export function SignalList() {
|
||||
|
||||
// console.log(signaldata[i]);
|
||||
let newmesh = assetloader.modellist[num].mesh.clone(true);
|
||||
newmesh.sectionCode = data[n].sectionCode;
|
||||
newmesh.sectionOffset = data[n].sectionOffset;
|
||||
// newmesh.uuid = signaldata[i].id;
|
||||
for(let j=0;j<newmesh.children.length;j++){
|
||||
newmesh.children[j].code = signaldata[i].code;
|
||||
@ -152,8 +154,8 @@ export function SignalList() {
|
||||
newmesh.name = signaldata[i].name;
|
||||
newmesh.modelid = assetloader.modellist[num].id;
|
||||
newmesh.code = signaldata[i].code;
|
||||
newmesh.right = data[i].right;
|
||||
newmesh.virtual = data[i].virtual;
|
||||
newmesh.right = data[n].right;
|
||||
newmesh.virtual = data[n].virtual;
|
||||
newmesh.position.x = signaldata[i].position.x;
|
||||
newmesh.position.y = signaldata[i].position.y;
|
||||
newmesh.position.z = signaldata[i].position.z;
|
||||
@ -179,38 +181,34 @@ export function SignalList() {
|
||||
};
|
||||
this.resetsignal = function(jlmap3ddata){
|
||||
// console.log(jlmap3ddata.linksgroup);
|
||||
console.log(jlmap3ddata.sectionlist.sections.datalist);
|
||||
let sectiondata = jlmap3ddata.sectionlist.sections.datalist;
|
||||
let sectiondata = jlmap3ddata.sectionlist.sectiongroup.children;
|
||||
for(let i=0;i<scope.group.children.length;i++){
|
||||
let signaldata = scope.group.children[i];
|
||||
for(let j in sectiondata){
|
||||
|
||||
for(let j=0;j<sectiondata.length;j++){
|
||||
if(sectiondata[j].code == signaldata.sectionCode){
|
||||
|
||||
let section = sectiondata[signaldata.sectionCode];
|
||||
let section = sectiondata[j];
|
||||
let posx = null;
|
||||
console.log(section);
|
||||
// console.log(section);
|
||||
|
||||
posx = section.railpoint[0].x + signaldata.sectionOffset;
|
||||
|
||||
if(signaldata.sectionOffset > section.lengthFact/2){
|
||||
posx = section.mesh.position.x + signaldata.sectionOffset - section.lengthFact/2;
|
||||
}else{
|
||||
posx = section.mesh.position.x - (section.lengthFact/2 - signaldata.sectionOffset);
|
||||
}
|
||||
//根据线路方向修改信号灯位置
|
||||
if(signaldata.right == false){
|
||||
if(section.standTrack == true){
|
||||
posx = posx - 7;
|
||||
}
|
||||
|
||||
signaldata.position.set(posx,0,section.mesh.position.z-3);
|
||||
signaldata.position.set(posx,0,section.railpoint[0].z-3);
|
||||
signaldata.rotation.z = ( Math.PI / 2 );
|
||||
}else if(signaldata.right == true){
|
||||
if(section.standTrack == true){
|
||||
posx = posx + 7;
|
||||
}
|
||||
signaldata.position.set(posx,0,section.mesh.position.z+3);
|
||||
signaldata.position.set(posx,0,section.railpoint[0].z+3);
|
||||
signaldata.rotation.z = ( - Math.PI / 2 );
|
||||
}
|
||||
|
||||
j = sectiondata.length;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -157,10 +157,7 @@ export function StationStandList() {
|
||||
}
|
||||
this.loadpromise = function(jlmap3ddata,standsdata,jlmapstanddata,scene,assetloader){
|
||||
return new Promise(function(resolve, reject){
|
||||
console.log("............");
|
||||
console.log(jlmap3ddata);
|
||||
console.log(standsdata);
|
||||
console.log(jlmapstanddata);
|
||||
|
||||
let stations = jlmap3ddata.stationstandlist.list;
|
||||
let num;
|
||||
let num2;
|
||||
|
@ -75,6 +75,7 @@ export function SwitchList() {
|
||||
pc:switchdata[i].pc
|
||||
};
|
||||
|
||||
// console.log(newswitch.pa);
|
||||
let autoswitch = assetloader.modellist[num].mesh.clone(true);
|
||||
autoswitch.code = switchdata[i].code;
|
||||
for(let j=0;j<autoswitch.children.length;j++){
|
||||
@ -94,6 +95,23 @@ export function SwitchList() {
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
this.resetswitch = function(data){
|
||||
// console.log("reset");
|
||||
let sectiondata = data.sectionlist.sectiongroup;
|
||||
for(let i=0;i<scope.switchs.datalist.length;i++){
|
||||
|
||||
let sectionA = sectiondata.getObjectByProperty("code",scope.switchs.datalist[i].pa);
|
||||
let sectionB = sectiondata.getObjectByProperty("code",scope.switchs.datalist[i].pb);
|
||||
|
||||
if(sectionA.railpoint[0].x > sectionB.railpoint[0].x){
|
||||
scope.switchs.modellist[i].position.set(sectionA.railpoint[0].x,0,sectionA.railpoint[0].z);
|
||||
}else{
|
||||
scope.switchs.modellist[i].position.set(sectionA.railpoint[1].x,0,sectionA.railpoint[1].z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.update = function(){
|
||||
|
||||
}
|
||||
|
@ -147,6 +147,7 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
|
||||
|
||||
function trainrun(data){
|
||||
let code = data.code;
|
||||
|
||||
if(trainlisttest.list[code].dispose == "0"){
|
||||
if(trainlisttest.list[code].curve == null){
|
||||
if (data.right == '1') { // 向右
|
||||
@ -204,6 +205,7 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
|
||||
|
||||
}else{
|
||||
//后端数据驱动车的位置更新与代码驱动车的移动相结合
|
||||
|
||||
if(data.code != trainlisttest.list[code].code){
|
||||
if (data.right == '1') { // 向右
|
||||
trainlisttest.list[code].right = '1';
|
||||
|
@ -21,7 +21,7 @@ THREE.DragControls = function ( _objects, _camera, _domElement ) {
|
||||
var _intersection = new THREE.Vector3();
|
||||
var _worldPosition = new THREE.Vector3();
|
||||
var _inverseMatrix = new THREE.Matrix4();
|
||||
|
||||
|
||||
var _selected = null, _hovered = null;
|
||||
|
||||
//
|
||||
|
@ -7,23 +7,54 @@
|
||||
THREE.ScalControls = function ( scene,_camera, _domElement ) {
|
||||
var _scene = scene;
|
||||
var originposition;
|
||||
|
||||
var _objects = [];
|
||||
|
||||
var helpmove = null;
|
||||
var objectparent = null;
|
||||
var selectmaterial = null;
|
||||
var oldobject = null;
|
||||
|
||||
var geometry = new THREE.BoxBufferGeometry( 1, 1, 1 );
|
||||
var material = new THREE.MeshBasicMaterial( {color: 0x00ff00} );
|
||||
|
||||
var newcurvehelp = new THREE.Group();
|
||||
|
||||
var cube = new THREE.Mesh( geometry, material );
|
||||
cube.name = "left";
|
||||
newcurvehelp.add( cube );
|
||||
_objects.push(cube);
|
||||
|
||||
var cube = new THREE.Mesh( geometry, material );
|
||||
cube.name = "mid";
|
||||
newcurvehelp.add( cube );
|
||||
_objects.push(cube);
|
||||
|
||||
var cube = new THREE.Mesh( geometry, material );
|
||||
cube.name = "right";
|
||||
newcurvehelp.add( cube );
|
||||
_objects.push(cube);
|
||||
|
||||
var newlinehelp = new THREE.Group();
|
||||
|
||||
var cube = new THREE.Mesh( geometry, material );
|
||||
cube.name = "left";
|
||||
newlinehelp.add( cube );
|
||||
_objects.push(cube);
|
||||
|
||||
var cube = new THREE.Mesh( geometry, material );
|
||||
cube.name = "right";
|
||||
newlinehelp.add( cube );
|
||||
_objects.push(cube);
|
||||
|
||||
var cubegroup = new THREE.Group();
|
||||
|
||||
var geometry = new THREE.BoxBufferGeometry( 5, 5, 5 );
|
||||
var material = new THREE.MeshBasicMaterial( {color: 0x00ff00} );
|
||||
var cube = new THREE.Mesh( geometry, material );
|
||||
cube.position.x = 1;
|
||||
cube.position.z = 0;
|
||||
cube.name = "right";
|
||||
cubegroup.add( cube );
|
||||
_objects.push(cube);
|
||||
|
||||
var geometry = new THREE.BoxBufferGeometry( 5, 5, 5 );
|
||||
var material = new THREE.MeshBasicMaterial( {color: 0x00ff00} );
|
||||
var cube = new THREE.Mesh( geometry, material );
|
||||
cube.position.x = -1;
|
||||
cube.position.z = 0;
|
||||
cube.name = "left";
|
||||
cubegroup.add( cube );
|
||||
_objects.push(cube);
|
||||
@ -53,6 +84,7 @@ THREE.ScalControls = function ( scene,_camera, _domElement ) {
|
||||
|
||||
var scope = this;
|
||||
|
||||
this.scalon = false;
|
||||
function activate() {
|
||||
|
||||
_domElement.addEventListener( 'mousemove', onDocumentMouseMove, false );
|
||||
@ -99,57 +131,58 @@ THREE.ScalControls = function ( scene,_camera, _domElement ) {
|
||||
if ( _raycaster.ray.intersectPlane( _plane, _intersection ) ) {
|
||||
_selected.position.copy( _intersection.sub( _offset ).applyMatrix4( _inverseMatrix ) );
|
||||
_selected.position.y = 0;
|
||||
console.log(_movemesh);
|
||||
if(_movemesh.meshtype == "link"){
|
||||
if(_selected.name == "left"){
|
||||
for(let i=0;i<_movemesh.leftlist.length;i++){
|
||||
_movemesh.geometry.attributes.position.array[_movemesh.leftlist[i]*3] = _selected.position.x - originposition;
|
||||
_movemesh.geometry.attributes.uv.array[_movemesh.leftlist[i]*2] = _movemesh.geometry.attributes.position.array[0]-_movemesh.geometry.attributes.position.array[3];
|
||||
|
||||
}
|
||||
}
|
||||
if(_movemesh.meshtype = "section"){
|
||||
newsectioncreate();
|
||||
|
||||
if(_selected.name == "right"){
|
||||
for(let i=0;i<_movemesh.rightlist.length;i++){
|
||||
_movemesh.geometry.attributes.position.array[_movemesh.rightlist[i]*3] = _selected.position.x - originposition;
|
||||
_movemesh.geometry.attributes.uv.array[_movemesh.leftlist[i]*2] = _movemesh.geometry.attributes.position.array[0]-_movemesh.geometry.attributes.position.array[3];
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(_selected.name == "left"){
|
||||
for(let i=0;i<_movemesh.leftlist.length;i++){
|
||||
_movemesh.geometry.attributes.position.array[_movemesh.leftlist[i]*3] = _selected.position.x - originposition;
|
||||
_movemesh.geometry.attributes.uv.array[_movemesh.leftlist[i]*2] = (_movemesh.geometry.attributes.position.array[3]-_movemesh.geometry.attributes.position.array[0])/15.3;
|
||||
}
|
||||
}
|
||||
if(_movemesh.meshtype == "link"){
|
||||
if(_selected.name == "left"){
|
||||
for(let i=0;i<_movemesh.leftlist.length;i++){
|
||||
_movemesh.geometry.attributes.position.array[_movemesh.leftlist[i]*3] = _selected.position.x - originposition.x;
|
||||
_movemesh.geometry.attributes.uv.array[_movemesh.leftlist[i]*2] = _movemesh.geometry.attributes.position.array[0]-_movemesh.geometry.attributes.position.array[3];
|
||||
|
||||
if(_selected.name == "right"){
|
||||
for(let i=0;i<_movemesh.rightlist.length;i++){
|
||||
}
|
||||
}
|
||||
|
||||
if(_selected.name == "right"){
|
||||
for(let i=0;i<_movemesh.rightlist.length;i++){
|
||||
_movemesh.geometry.attributes.position.array[_movemesh.rightlist[i]*3] = _selected.position.x - originposition.x;
|
||||
_movemesh.geometry.attributes.uv.array[_movemesh.leftlist[i]*2] = _movemesh.geometry.attributes.position.array[0]-_movemesh.geometry.attributes.position.array[3];
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(_selected.name == "left"){
|
||||
for(let i=0;i<_movemesh.leftlist.length;i++){
|
||||
_movemesh.geometry.attributes.position.array[_movemesh.leftlist[i]*3] = _selected.position.x - originposition.x;
|
||||
_movemesh.geometry.attributes.uv.array[_movemesh.leftlist[i]*2] = (_movemesh.geometry.attributes.position.array[3]-_movemesh.geometry.attributes.position.array[0])/15.3;
|
||||
}
|
||||
}
|
||||
|
||||
if(_selected.name == "right"){
|
||||
for(let i=0;i<_movemesh.rightlist.length;i++){
|
||||
|
||||
_movemesh.geometry.attributes.position.array[_movemesh.rightlist[i]*3] = _selected.position.x - originposition.x;
|
||||
_movemesh.geometry.attributes.uv.array[_movemesh.leftlist[i]*2] = (_movemesh.geometry.attributes.position.array[3]-_movemesh.geometry.attributes.position.array[0])/15.3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// newgeometry.attributes.uv.array[7] = i;
|
||||
|
||||
_movemesh.geometry.attributes.position.needsUpdate = true;
|
||||
_movemesh.geometry.attributes.uv.needsUpdate = true;
|
||||
_movemesh.material.needsUpdate = true;
|
||||
// _movemesh.geometry.computeBoundingBox();
|
||||
_movemesh.geometry.computeBoundingSphere();
|
||||
_movemesh.geometry.center();
|
||||
// _movemesh.lengthfact = (_movemesh.geometry.attributes.position.array[_movemesh.rightlist[0]] - _movemesh.geometry.attributes.position.array[_movemesh.leftlist[0]])*2+28;
|
||||
_movemesh.lengthFact = (_movemesh.geometry.attributes.position.array[_movemesh.rightlist[0]*3] - _movemesh.geometry.attributes.position.array[_movemesh.leftlist[0]*3]);
|
||||
|
||||
_movemesh.geometry.attributes.position.array[_movemesh.rightlist[i]*3] = _selected.position.x - originposition;
|
||||
_movemesh.geometry.attributes.uv.array[_movemesh.leftlist[i]*2] = (_movemesh.geometry.attributes.position.array[3]-_movemesh.geometry.attributes.position.array[0])/15.3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// newgeometry.attributes.uv.array[7] = i;
|
||||
|
||||
_movemesh.geometry.attributes.position.needsUpdate = true;
|
||||
_movemesh.geometry.attributes.uv.needsUpdate = true;
|
||||
_movemesh.material.needsUpdate = true;
|
||||
// _movemesh.geometry.computeBoundingBox();
|
||||
_movemesh.geometry.computeBoundingSphere();
|
||||
_movemesh.geometry.center();
|
||||
// _movemesh.lengthfact = (_movemesh.geometry.attributes.position.array[_movemesh.rightlist[0]] - _movemesh.geometry.attributes.position.array[_movemesh.leftlist[0]])*2+28;
|
||||
_movemesh.lengthFact = (_movemesh.geometry.attributes.position.array[_movemesh.rightlist[0]*3] - _movemesh.geometry.attributes.position.array[_movemesh.leftlist[0]*3]);
|
||||
|
||||
// testmesh2.position.z = 50;
|
||||
|
||||
// testmesh2.geometry.center();
|
||||
// console.log(testmesh2.geometry.attributes);
|
||||
|
||||
}
|
||||
|
||||
scope.dispatchEvent( { type: 'drag', object: _selected } );
|
||||
@ -230,6 +263,7 @@ THREE.ScalControls = function ( scene,_camera, _domElement ) {
|
||||
|
||||
_selected = null;
|
||||
|
||||
console.log("mouseup");
|
||||
}
|
||||
|
||||
_domElement.style.cursor = _hovered ? 'pointer' : 'auto';
|
||||
@ -316,6 +350,104 @@ THREE.ScalControls = function ( scene,_camera, _domElement ) {
|
||||
|
||||
}
|
||||
|
||||
//区段重新构建
|
||||
function newsectioncreate(){
|
||||
oldobject = _movemesh;
|
||||
objectparent.remove(oldobject);
|
||||
|
||||
let newpointlist = [];
|
||||
let curvestep = 1;
|
||||
var closedSpline;
|
||||
var extrudeSettings;
|
||||
for(let i=0;i<_movemesh.railpoint.length;i++){
|
||||
newpointlist.push(new THREE.Vector3(_movemesh.railpoint[i].x,_movemesh.railpoint[i].y,_movemesh.railpoint[i].z));
|
||||
}
|
||||
|
||||
if(_movemesh.railpoint.length>2){
|
||||
|
||||
if(_selected.name == "left"){
|
||||
newpointlist[0] = new THREE.Vector3(_selected.position.x,_movemesh.railpoint[0].y,_selected.position.z);
|
||||
}
|
||||
if(_selected.name == "mid"){
|
||||
newpointlist[1] = new THREE.Vector3(_selected.position.x,_movemesh.railpoint[0].y,_selected.position.z);
|
||||
}
|
||||
if(_selected.name == "right"){
|
||||
newpointlist[2] = new THREE.Vector3(_selected.position.x,_movemesh.railpoint[0].y,_selected.position.z);
|
||||
}
|
||||
curvestep = 10;
|
||||
}else{
|
||||
|
||||
if(_selected.name == "left"){
|
||||
newpointlist[0] = new THREE.Vector3(_selected.position.x,_movemesh.railpoint[0].y,_selected.position.z);
|
||||
}
|
||||
if(_selected.name == "right"){
|
||||
newpointlist[1] = new THREE.Vector3(_selected.position.x,_movemesh.railpoint[0].y,_selected.position.z);
|
||||
}
|
||||
curvestep =1;
|
||||
}
|
||||
closedSpline = new THREE.CatmullRomCurve3(newpointlist);
|
||||
closedSpline.type = 'catmullrom';
|
||||
closedSpline.closed = false;
|
||||
|
||||
extrudeSettings = {
|
||||
steps : curvestep,
|
||||
curveSegments : 1,
|
||||
bevelSegments : 1,
|
||||
bevelEnabled : false,
|
||||
extrudePath : closedSpline,
|
||||
};
|
||||
|
||||
var shape = new THREE.Shape();
|
||||
shape.moveTo( 0,-2 );
|
||||
shape.lineTo( 0, 2 );
|
||||
selectmaterial = _movemesh.material;
|
||||
var geometry = new THREE.ExtrudeBufferGeometry( shape, extrudeSettings );
|
||||
_movemesh = new THREE.Mesh( geometry, selectmaterial );
|
||||
_movemesh.code = oldobject.code;
|
||||
_movemesh.railpoint = [];
|
||||
for(let i=0;i<newpointlist.length;i++){
|
||||
_movemesh.railpoint[i] = {
|
||||
x:newpointlist[i].x,
|
||||
y:newpointlist[i].y,
|
||||
z:newpointlist[i].z
|
||||
}
|
||||
}
|
||||
_movemesh.lengthFact = closedSpline.arcLengthDivisions/4;
|
||||
if(newpointlist.length>2){
|
||||
_movemesh.lengthFact = _movemesh.lengthFact/curvestep;
|
||||
}
|
||||
|
||||
let len = _movemesh.lengthFact;
|
||||
// closedSpline.arcLengthDivisions;
|
||||
let count = _movemesh.geometry.attributes.position.count/3;
|
||||
|
||||
for(let i=0;i<count;i++){
|
||||
let ui=i*6;
|
||||
if(i%2 != 0){
|
||||
_movemesh.geometry.attributes.uv.array[ui] = 0;
|
||||
_movemesh.geometry.attributes.uv.array[ui+1] = 1;
|
||||
_movemesh.geometry.attributes.uv.array[ui+2] = len;
|
||||
_movemesh.geometry.attributes.uv.array[ui+3] = 1;
|
||||
_movemesh.geometry.attributes.uv.array[ui+4] = len;
|
||||
_movemesh.geometry.attributes.uv.array[ui+5] = 0;
|
||||
}else{
|
||||
_movemesh.geometry.attributes.uv.array[ui] = 0;
|
||||
_movemesh.geometry.attributes.uv.array[ui+1] = 0;
|
||||
_movemesh.geometry.attributes.uv.array[ui+2] = 0;
|
||||
_movemesh.geometry.attributes.uv.array[ui+3] = 1;
|
||||
_movemesh.geometry.attributes.uv.array[ui+4] = len;
|
||||
_movemesh.geometry.attributes.uv.array[ui+5] = 0;
|
||||
}
|
||||
}
|
||||
_movemesh.meshtype = "section";
|
||||
// _movemesh.geometry.computeBoundingBox();
|
||||
// _movemesh.geometry.center()
|
||||
// _movemesh.position.set(oldobject.position.x,oldobject.position.y,oldobject.position.z);
|
||||
|
||||
// console.log(_movemesh.railpoint[2].x);
|
||||
objectparent.add(_movemesh);
|
||||
}
|
||||
|
||||
activate();
|
||||
|
||||
// API
|
||||
@ -327,24 +459,68 @@ THREE.ScalControls = function ( scene,_camera, _domElement ) {
|
||||
this.dispose = dispose;
|
||||
|
||||
// Backward compatibility
|
||||
this.attach = function(movemesh){
|
||||
console.log(movemesh);
|
||||
_movemesh = movemesh;
|
||||
originposition = movemesh.position.x;
|
||||
let offset = (_movemesh.geometry.attributes.position.array[movemesh.rightlist[0]*3] - _movemesh.geometry.attributes.position.array[movemesh.leftlist[0]*3])/2;
|
||||
cubegroup.children[0].position.x = movemesh.position.x + offset;
|
||||
cubegroup.children[0].position.y = movemesh.position.y;
|
||||
cubegroup.children[0].position.z = movemesh.position.z;
|
||||
cubegroup.children[1].position.x = movemesh.position.x - offset;
|
||||
cubegroup.children[1].position.y = movemesh.position.y;
|
||||
cubegroup.children[1].position.z = movemesh.position.z;
|
||||
this.attach = function(movemesh,points){
|
||||
if(!helpmove){
|
||||
if(points){
|
||||
|
||||
_movemesh = movemesh;
|
||||
originposition = movemesh.position;
|
||||
if(points.length>2){
|
||||
helpmove = newcurvehelp;
|
||||
}else{
|
||||
helpmove = newlinehelp;
|
||||
}
|
||||
helpmove.position.y = 0;
|
||||
for(let i=0;i<points.length;i++){
|
||||
helpmove.children[i].position.x = points[i].x;
|
||||
helpmove.children[i].position.y = points[i].y;
|
||||
helpmove.children[i].position.z = points[i].z;
|
||||
}
|
||||
|
||||
}else{
|
||||
_movemesh = movemesh;
|
||||
originposition = movemesh.position;
|
||||
let offset = (_movemesh.geometry.attributes.position.array[movemesh.rightlist[0]*3] - _movemesh.geometry.attributes.position.array[movemesh.leftlist[0]*3])/2;
|
||||
cubegroup.children[0].position.x = movemesh.position.x + offset;
|
||||
cubegroup.children[0].position.y = movemesh.position.y;
|
||||
cubegroup.children[0].position.z = movemesh.position.z;
|
||||
cubegroup.children[1].position.x = movemesh.position.x - offset;
|
||||
cubegroup.children[1].position.y = movemesh.position.y;
|
||||
cubegroup.children[1].position.z = movemesh.position.z;
|
||||
helpmove = cubegroup;
|
||||
helpmove.position.y = 0;
|
||||
}
|
||||
objectparent = _movemesh.parent;
|
||||
scope.scalon = true;
|
||||
_scene.add(helpmove);
|
||||
}
|
||||
|
||||
|
||||
|
||||
_scene.add(cubegroup);
|
||||
}
|
||||
|
||||
this.detach = function(){
|
||||
// _movemesh = "";
|
||||
_scene.remove(cubegroup);
|
||||
if(helpmove){
|
||||
|
||||
if(_selected){
|
||||
|
||||
}else{
|
||||
console.log("detach");
|
||||
helpmove.position.y = 90000;
|
||||
// _scene.remove(helpmove);
|
||||
// objectparent = null;
|
||||
scope.scalon = false;
|
||||
helpmove = null;
|
||||
}
|
||||
// for(let i=0;i<helpmove.children.length;i++){
|
||||
// helpmove.children[i].position.x = -9999;
|
||||
// helpmove.children[i].position.y = -9999;
|
||||
// helpmove.children[i].position.z = -9999;
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
this.setObjects = function () {
|
||||
|
@ -18,6 +18,24 @@ THREE.TransformControls = function ( camera, domElement ) {
|
||||
|
||||
var scope = this;
|
||||
|
||||
var geometry = new THREE.BoxBufferGeometry( 1, 1, 1 );
|
||||
var material = new THREE.MeshBasicMaterial( {color: 0x00ff00} );
|
||||
|
||||
var virtualmovebox = new THREE.Mesh( geometry, material );
|
||||
var atobject = undefined;
|
||||
var sectionswitch = undefined;
|
||||
|
||||
var cube1 = new THREE.Mesh( geometry, material );
|
||||
cube1.name = "left";
|
||||
|
||||
var cube2 = new THREE.Mesh( geometry, material );
|
||||
cube2.name = "mis";
|
||||
|
||||
var cube3 = new THREE.Mesh( geometry, material );
|
||||
cube3.name = "right";
|
||||
|
||||
|
||||
|
||||
// Define properties with getters/setter
|
||||
// Setting the defined property will automatically trigger change event
|
||||
// Defined properties are passed down to gizmo and plane
|
||||
@ -131,16 +149,48 @@ THREE.TransformControls = function ( camera, domElement ) {
|
||||
};
|
||||
|
||||
// Set current object
|
||||
this.attach = function ( object ) {
|
||||
this.attach = function ( object,editmode ) {
|
||||
console.log(editmode);
|
||||
atobject = object;
|
||||
if(editmode == "trackedit"){
|
||||
if(atobject){
|
||||
sectionswitch = true;
|
||||
atobject.add(virtualmovebox);
|
||||
|
||||
this.object = object;
|
||||
this.visible = true;
|
||||
this.object = virtualmovebox;
|
||||
this.visible = true;
|
||||
|
||||
let len = object.railpoint.length-1;
|
||||
|
||||
cube1.position.set(object.railpoint[0].x-object.position.x,0,object.railpoint[0].z-object.position.z);
|
||||
cube3.position.set(object.railpoint[len].x-object.position.x,0,object.railpoint[len].z-object.position.z);
|
||||
atobject.add(cube1);
|
||||
atobject.add(cube3);
|
||||
if(object.railpoint.length>2){
|
||||
cube2.position.set(object.railpoint[1].x-object.position.x,0,object.railpoint[1].z-object.position.z);
|
||||
atobject.add(cube2);
|
||||
virtualmovebox.position.set(cube2.position.x,cube2.position.y,cube2.position.z);
|
||||
}else{
|
||||
virtualmovebox.position.set((cube1.position.x+cube3.position.x)/2,0,(cube1.position.z+cube3.position.z)/2);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
sectionswitch = false;
|
||||
this.object = object;
|
||||
this.visible = true;
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
// Detatch from object
|
||||
this.detach = function () {
|
||||
|
||||
if(atobject){
|
||||
atobject.remove(virtualmovebox);
|
||||
atobject.remove(cube1);
|
||||
atobject.remove(cube2);
|
||||
atobject.remove(cube3);
|
||||
}
|
||||
sectionswitch = false;
|
||||
this.object = undefined;
|
||||
this.visible = false;
|
||||
this.axis = null;
|
||||
@ -335,13 +385,47 @@ THREE.TransformControls = function ( camera, domElement ) {
|
||||
} else {
|
||||
offset.applyQuaternion( parentQuaternionInv ).divide( parentScale );
|
||||
}
|
||||
console.log(sectionswitch);
|
||||
if(sectionswitch){
|
||||
let oldpositionx = object.position.x;
|
||||
let oldpositionz = object.position.z;
|
||||
object.position.copy( offset ).add( positionStart );
|
||||
atobject.position.x += object.position.x - oldpositionx;
|
||||
atobject.position.z += object.position.z - oldpositionz;
|
||||
|
||||
console.log(object.position.x - oldpositionx);
|
||||
atobject.railpoint[0] = {
|
||||
x:cube1.matrixWorld.elements[12],
|
||||
y:cube1.matrixWorld.elements[13],
|
||||
z:cube1.matrixWorld.elements[14],
|
||||
};
|
||||
|
||||
if(atobject.railpoint.length>2){
|
||||
atobject.railpoint[1] = {
|
||||
x:cube2.matrixWorld.elements[12],
|
||||
y:cube2.matrixWorld.elements[13],
|
||||
z:cube2.matrixWorld.elements[14],
|
||||
};
|
||||
atobject.railpoint[2] = {
|
||||
x:cube3.matrixWorld.elements[12],
|
||||
y:cube3.matrixWorld.elements[13],
|
||||
z:cube3.matrixWorld.elements[14],
|
||||
};
|
||||
}else{
|
||||
atobject.railpoint[1] = {
|
||||
x:cube3.matrixWorld.elements[12],
|
||||
y:cube3.matrixWorld.elements[13],
|
||||
z:cube3.matrixWorld.elements[14],
|
||||
};
|
||||
}
|
||||
}else{
|
||||
object.position.copy( offset ).add( positionStart );
|
||||
}
|
||||
|
||||
|
||||
object.position.copy( offset ).add( positionStart );
|
||||
|
||||
// Apply translation snap
|
||||
|
||||
if ( this.translationSnap ) {
|
||||
|
||||
if ( space === 'local' ) {
|
||||
|
||||
object.position.applyQuaternion(_tempQuaternion.copy( quaternionStart ).inverse() );
|
||||
|
@ -85,7 +85,7 @@ export function DriverLoadNew(data,scope,netdata,mapdata,sectionlist,signallist,
|
||||
})
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
return sectionlist.loadpromise(mapdata.sectionList,sectiondata.section,scene,assetloader);
|
||||
return sectionlist.loadpromise(mapdata.sectionList,sectiondata.section,rails,scene,assetloader);
|
||||
})
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
@ -99,14 +99,14 @@ export function DriverLoadNew(data,scope,netdata,mapdata,sectionlist,signallist,
|
||||
//console.log(assetloader);
|
||||
return trainlisttest.drivertrain(mapdata.trainList,sceneload,assetloader,mixers,actions,"01");
|
||||
})
|
||||
.then(function(data){
|
||||
return new Promise(function(resolve, reject){
|
||||
let stopoffset = 64;
|
||||
rails.init(sectiondata.section,sectiondata,switchdata,sceneload);
|
||||
resolve("loadrail");
|
||||
|
||||
});
|
||||
})
|
||||
// .then(function(data){
|
||||
// return new Promise(function(resolve, reject){
|
||||
// let stopoffset = 64;
|
||||
// rails.init(sectiondata.section,sectiondata,switchdata,sceneload);
|
||||
// resolve("loadrail");
|
||||
//
|
||||
// });
|
||||
// })
|
||||
.then(function(data){
|
||||
return new Promise(function(resolve, reject){
|
||||
|
||||
|
@ -83,7 +83,7 @@ export function SimulationLoadNew(data,scope,netdata,mapdata,camera,controls,sce
|
||||
})
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
return sectionlist.loadpromise(mapdata.sectionList,sectiondata.section,scene,assetloader);
|
||||
return sectionlist.loadpromise(mapdata.sectionList,sectiondata.section,rails,scene,assetloader);
|
||||
})
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
@ -97,14 +97,13 @@ export function SimulationLoadNew(data,scope,netdata,mapdata,camera,controls,sce
|
||||
//console.log(assetloader);
|
||||
return trainlisttest.initpromise(mapdata.trainList,sceneload,assetloader,mixers,actions,"02");
|
||||
})
|
||||
.then(function(data){
|
||||
return new Promise(function(resolve, reject){
|
||||
let stopoffset = 64;
|
||||
rails.init(sectiondata.section,sectiondata,switchdata,sceneload);
|
||||
resolve("loadrail");
|
||||
|
||||
});
|
||||
})
|
||||
// .then(function(data){
|
||||
// return new Promise(function(resolve, reject){
|
||||
// rails.init(sectiondata.section,sectiondata,switchdata,sceneload);
|
||||
// resolve("loadrail");
|
||||
//
|
||||
// });
|
||||
// })
|
||||
.then(function(data){
|
||||
return new Promise(function(resolve, reject){
|
||||
|
||||
|
@ -180,7 +180,7 @@ export function RailListN(){
|
||||
scope.sectionrail[section[i].code].standTrack = false;
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
// for(let n=0,nm=scope.sectionrail[section[i].code].lineleft.points.length;n<nm;n++){
|
||||
// var geometry = new THREE.CircleGeometry( 0.05, 16 );
|
||||
// var material = new THREE.MeshBasicMaterial( { color: 0xffff00 } );
|
||||
@ -216,5 +216,60 @@ export function RailListN(){
|
||||
}
|
||||
|
||||
}
|
||||
this.setrails = function(sectioncode,points,standtrack,lengthfact,scene){
|
||||
scope.sectionrail[sectioncode] = {
|
||||
lengthfact:lengthfact,
|
||||
lineleft:null,
|
||||
lineright:null,
|
||||
standTrack:standtrack,
|
||||
};
|
||||
let leftpoints = [];
|
||||
let rightpoints = [];
|
||||
for(let i=0;i<points.length;i++){
|
||||
leftpoints.push(points[i]);
|
||||
rightpoints.push(points[points.length-i-1]);
|
||||
}
|
||||
|
||||
scope.sectionrail[sectioncode].lineleft = new THREE.CatmullRomCurve3(leftpoints);
|
||||
scope.sectionrail[sectioncode].lineleft.curveType = "centripetal";
|
||||
scope.sectionrail[sectioncode].lineleft.name = sectioncode;
|
||||
|
||||
scope.sectionrail[sectioncode].lineright = new THREE.CatmullRomCurve3(rightpoints);
|
||||
scope.sectionrail[sectioncode].lineright.curveType = "centripetal";
|
||||
scope.sectionrail[sectioncode].lineright.name = sectioncode;
|
||||
|
||||
// //
|
||||
// for(let n=0,nm=scope.sectionrail[sectioncode].lineleft.points.length;n<nm;n++){
|
||||
// var geometry = new THREE.CircleGeometry( 0.05, 16 );
|
||||
// var material = new THREE.MeshBasicMaterial( { color: 0xffff00 } );
|
||||
// var circle = new THREE.Mesh( geometry, material );
|
||||
// // console.log(n);
|
||||
// // console.log(scope.sectionrail[section[i].code].lineleft.points[n]);
|
||||
// circle.position.x = scope.sectionrail[sectioncode].lineleft.points[n].x;
|
||||
// circle.position.y = scope.sectionrail[sectioncode].lineleft.points[n].y;
|
||||
// circle.position.z = scope.sectionrail[sectioncode].lineleft.points[n].z;
|
||||
// circle.rotation.x = -Math.PI/2;
|
||||
// scene.add( circle );
|
||||
// }
|
||||
// // scope.sectionrail[section[i].code].lineright.tension = 0.11;
|
||||
// var points = scope.sectionrail[sectioncode].lineleft.getPoints( 50 );
|
||||
// var geometry = new THREE.BufferGeometry().setFromPoints( points );
|
||||
// var material;
|
||||
// if(scope.sectionrail[sectioncode].type == "a"){
|
||||
// material = new THREE.LineBasicMaterial( { color : 0xff0000 } );
|
||||
// }
|
||||
// if(scope.sectionrail[sectioncode].type == "b"){
|
||||
// material = new THREE.LineBasicMaterial( { color : 0x00ff00 } );
|
||||
// }
|
||||
// if(scope.sectionrail[sectioncode].type == "c"){
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
|
@ -17,32 +17,32 @@ export function SectionListN() {
|
||||
this.stopsection = [];
|
||||
this.standtrack = [];
|
||||
var autorail;
|
||||
this.loadpromise = function(sectionList,sectiondata,scene,assetloader){
|
||||
this.loadpromise = function(sectionList,sectiondata,rails,scene,assetloader){
|
||||
// console.log(sectiondata);
|
||||
var texture = new THREE.TextureLoader().load( '../../static/test/z0251.png' );
|
||||
texture.wrapS = texture.wrapT = THREE.RepeatWrapping;
|
||||
texture.repeat.set( 1,1);
|
||||
|
||||
var selectmaterial = new THREE.MeshPhongMaterial( { map: texture,transparent:true } );
|
||||
var selectmaterial = new THREE.MeshPhongMaterial( { map: texture,transparent:true,alphaTest:0.1 } );
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
autorail.rightlist = rightlist;
|
||||
autorail.leftlist = leftlist;
|
||||
// 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);
|
||||
// }
|
||||
// }
|
||||
// autorail.rightlist = rightlist;
|
||||
// autorail.leftlist = leftlist;
|
||||
scene.add(scope.sectiongroup);
|
||||
return new Promise(function(resolve, reject){
|
||||
// console.log(sectiondata);
|
||||
@ -53,11 +53,7 @@ this.loadpromise = function(sectionList,sectiondata,scene,assetloader){
|
||||
name:sectiondata[i].name,
|
||||
standTrack:sectiondata[i].standTrack,
|
||||
rail:sectiondata[i].rail,
|
||||
rightlist:sectiondata[i].rightlist,
|
||||
leftlist:sectiondata[i].leftlist,
|
||||
rsection:sectiondata[i].rsection,
|
||||
lsection:sectiondata[i].lsection,
|
||||
csection:sectiondata[i].csection,
|
||||
railpoint:sectiondata[i].railpoint,
|
||||
lengthFact:sectiondata[i].lengthFact,
|
||||
|
||||
lconnect:null,
|
||||
@ -72,149 +68,136 @@ this.loadpromise = function(sectionList,sectiondata,scene,assetloader){
|
||||
mesh:null
|
||||
};
|
||||
|
||||
// newsection.railpoint.length>2
|
||||
let len = newsection.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;
|
||||
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();
|
||||
testmesh2.position.set(sectiondata[i].position.x,sectiondata[i].position.y,sectiondata[i].position.z);
|
||||
testmesh2.rotation.set(sectiondata[i].rotation._x,sectiondata[i].rotation._y,sectiondata[i].rotation._z);
|
||||
testmesh2.matrixAutoUpdate = false;
|
||||
scope.sections.datalist[newsection.code] = newsection;
|
||||
testmesh2.updateMatrix();
|
||||
mergegeometry.merge(new THREE.Geometry().fromBufferGeometry(testmesh2.geometry),testmesh2.matrix);
|
||||
testmesh2.geometry.dispose();
|
||||
for(let j in testmesh2.material){
|
||||
testmesh2.material[j].map.dispose();
|
||||
testmesh2.material[j].dispose();
|
||||
}
|
||||
testmesh2 = null;
|
||||
// if(newsection.rp.z != newsection.lp.z){
|
||||
// // console.log(newsection);
|
||||
// let height = Math.random()/1000;
|
||||
// var closedSpline = new THREE.CatmullRomCurve3( [
|
||||
// new THREE.Vector3(newsection.lp.x, height, newsection.lp.z),
|
||||
// new THREE.Vector3(newsection.lp.x+2, height,newsection.lp.z),
|
||||
// new THREE.Vector3((newsection.lp.x+newsection.rp.x)/2, height,(newsection.lp.z+newsection.rp.z)/2),
|
||||
// new THREE.Vector3(newsection.rp.x-2, height,newsection.rp.z),
|
||||
// new THREE.Vector3(newsection.rp.x, height, newsection.rp.z)
|
||||
// ] );
|
||||
//
|
||||
// closedSpline.type = 'catmullrom';
|
||||
// closedSpline.closed = false;
|
||||
// // Set up settings for later extrusion
|
||||
// var extrudeSettings = {
|
||||
// steps : 12,
|
||||
// curveSegments : 1,
|
||||
// bevelSegments : 1,
|
||||
// bevelEnabled : false,
|
||||
// extrudePath : closedSpline,
|
||||
// };
|
||||
// var shape = new THREE.Shape();
|
||||
// shape.moveTo( 0,-2 );
|
||||
// shape.lineTo( 0, 2 );
|
||||
// // Extrude the triangle along the CatmullRom curve
|
||||
// var geometry = new THREE.ExtrudeBufferGeometry( shape, extrudeSettings );
|
||||
// var material = new THREE.MeshLambertMaterial( { color: 0xb00000, wireframe: true } );
|
||||
// // newnormal = new Float32Array(newnormal);
|
||||
// // console.log(newnormal);
|
||||
// // geometry.attributes.normal = new THREE.BufferAttribute(newnormal, 3);
|
||||
// // geometry.attributes.needsUpdate = true;
|
||||
// // Create mesh with the resulting geometry
|
||||
// var mesh = new THREE.Mesh( geometry, selectmaterial );
|
||||
// let count = mesh.geometry.attributes.position.count/3;
|
||||
//
|
||||
// for(let i=0;i<count;i++){
|
||||
// let ui=i*6;
|
||||
// if(i%2 != 0){
|
||||
// mesh.geometry.attributes.uv.array[ui] = 0;
|
||||
// mesh.geometry.attributes.uv.array[ui+1] = 1;
|
||||
// mesh.geometry.attributes.uv.array[ui+2] = len/10;
|
||||
// mesh.geometry.attributes.uv.array[ui+3] = 1;
|
||||
// mesh.geometry.attributes.uv.array[ui+4] = len/10;
|
||||
// mesh.geometry.attributes.uv.array[ui+5] = 0;
|
||||
// }else{
|
||||
// mesh.geometry.attributes.uv.array[ui] = 0;
|
||||
// mesh.geometry.attributes.uv.array[ui+1] = 0;
|
||||
// mesh.geometry.attributes.uv.array[ui+2] = 0;
|
||||
// mesh.geometry.attributes.uv.array[ui+3] = 1;
|
||||
// mesh.geometry.attributes.uv.array[ui+4] = len/10;
|
||||
// mesh.geometry.attributes.uv.array[ui+5] = 0;
|
||||
// }
|
||||
// }
|
||||
// mergegeometry.merge(new THREE.Geometry().fromBufferGeometry(mesh.geometry),mesh.matrix);
|
||||
// // mergegeometry.merge(new THREE.Geometry().fromBufferGeometry(mesh.geometry),mesh.matrix);
|
||||
// console.log(mesh);
|
||||
// // scene.add(mesh);
|
||||
// }else{
|
||||
// let height = Math.random()/1000;
|
||||
// var closedSpline = new THREE.CatmullRomCurve3( [
|
||||
// new THREE.Vector3(newsection.lp.x, height, newsection.lp.z),
|
||||
// new THREE.Vector3(newsection.rp.x, height, newsection.rp.z)
|
||||
// ] );
|
||||
//
|
||||
// closedSpline.type = 'catmullrom';
|
||||
// closedSpline.closed = false;
|
||||
// // Set up settings for later extrusion
|
||||
// var extrudeSettings = {
|
||||
// steps : 1,
|
||||
// curveSegments : 1,
|
||||
// bevelSegments : 1,
|
||||
// bevelEnabled : false,
|
||||
// extrudePath : closedSpline,
|
||||
// };
|
||||
// var shape = new THREE.Shape();
|
||||
// shape.moveTo( -2,0 );
|
||||
// shape.lineTo( 2,0 );
|
||||
// // Extrude the triangle along the CatmullRom curve
|
||||
// var geometry = new THREE.ExtrudeBufferGeometry( shape, extrudeSettings );
|
||||
// var material = new THREE.MeshLambertMaterial( { color: 0xb00000, wireframe: true } );
|
||||
// // newnormal = new Float32Array(newnormal);
|
||||
// // console.log(newnormal);
|
||||
// // geometry.attributes.normal = new THREE.BufferAttribute(newnormal, 3);
|
||||
// // geometry.attributes.needsUpdate = true;
|
||||
// // Create mesh with the resulting geometry
|
||||
// var mesh = new THREE.Mesh( geometry, selectmaterial );
|
||||
// let count = mesh.geometry.attributes.position.count/3;
|
||||
//
|
||||
// for(let i=0;i<count;i++){
|
||||
// let ui=i*6;
|
||||
// if(i%2 != 0){
|
||||
// mesh.geometry.attributes.uv.array[ui] = 0;
|
||||
// mesh.geometry.attributes.uv.array[ui+1] = 1;
|
||||
// mesh.geometry.attributes.uv.array[ui+2] = len;
|
||||
// mesh.geometry.attributes.uv.array[ui+3] = 1;
|
||||
// mesh.geometry.attributes.uv.array[ui+4] = len;
|
||||
// mesh.geometry.attributes.uv.array[ui+5] = 0;
|
||||
// }else{
|
||||
// mesh.geometry.attributes.uv.array[ui] = 0;
|
||||
// mesh.geometry.attributes.uv.array[ui+1] = 0;
|
||||
// mesh.geometry.attributes.uv.array[ui+2] = 0;
|
||||
// mesh.geometry.attributes.uv.array[ui+3] = 1;
|
||||
// mesh.geometry.attributes.uv.array[ui+4] = len;
|
||||
// mesh.geometry.attributes.uv.array[ui+5] = 0;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// mergegeometry.merge(new THREE.Geometry().fromBufferGeometry(mesh.geometry),mesh.matrix);
|
||||
// // console.log(mesh);
|
||||
// // scene.add(mesh);
|
||||
//
|
||||
// let testmesh2 = autorail.clone(true);
|
||||
// for(let i=0;i<autorail.rightlist.length;i++){
|
||||
// testmesh2.geometry.attributes.position.array[autorail.rightlist[i]*3] = len;
|
||||
// testmesh2.geometry.attributes.uv.array[autorail.rightlist[i]*2] = testmesh2.geometry.attributes.position.array[0]-testmesh2.geometry.attributes.position.array[3];
|
||||
// }
|
||||
}
|
||||
let mergemesh = new THREE.Mesh( mergegeometry, autorail.material );
|
||||
// let mergemesh = new THREE.Mesh( mergegeometry, selectmaterial );
|
||||
// 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.set(sectiondata[i].position.x,sectiondata[i].position.y,sectiondata[i].position.z);
|
||||
// testmesh2.rotation.set(sectiondata[i].rotation._x,sectiondata[i].rotation._y,sectiondata[i].rotation._z);
|
||||
// testmesh2.matrixAutoUpdate = false;
|
||||
// scope.sections.datalist[newsection.code] = newsection;
|
||||
// testmesh2.updateMatrix();
|
||||
// mergegeometry.merge(new THREE.Geometry().fromBufferGeometry(testmesh2.geometry),testmesh2.matrix);
|
||||
// testmesh2.geometry.dispose();
|
||||
// for(let j in testmesh2.material){
|
||||
// testmesh2.material[j].map.dispose();
|
||||
// testmesh2.material[j].dispose();
|
||||
// }
|
||||
// testmesh2 = null;
|
||||
if(newsection.railpoint.length>2){
|
||||
// console.log(newsection);
|
||||
let height = Math.random()/1000;
|
||||
var closedSpline = new THREE.CatmullRomCurve3( [
|
||||
new THREE.Vector3(newsection.railpoint[0].x,newsection.railpoint[0].y,newsection.railpoint[0].z),
|
||||
new THREE.Vector3(newsection.railpoint[1].x,newsection.railpoint[1].y,newsection.railpoint[1].z),
|
||||
new THREE.Vector3(newsection.railpoint[2].x,newsection.railpoint[2].y,newsection.railpoint[2].z)
|
||||
] );
|
||||
|
||||
closedSpline.type = 'catmullrom';
|
||||
closedSpline.closed = false;
|
||||
var extrudeSettings = {
|
||||
steps : 5,
|
||||
curveSegments : 1,
|
||||
bevelSegments : 1,
|
||||
bevelEnabled : false,
|
||||
extrudePath : closedSpline,
|
||||
};
|
||||
var shape = new THREE.Shape();
|
||||
shape.moveTo( 0,-2 );
|
||||
shape.lineTo( 0, 2 );
|
||||
var geometry = new THREE.ExtrudeBufferGeometry( shape, extrudeSettings );
|
||||
var mesh = new THREE.Mesh( geometry, selectmaterial );
|
||||
let count = mesh.geometry.attributes.position.count/3;
|
||||
|
||||
for(let i=0;i<count;i++){
|
||||
let ui=i*6;
|
||||
if(i%2 != 0){
|
||||
mesh.geometry.attributes.uv.array[ui] = 0;
|
||||
mesh.geometry.attributes.uv.array[ui+1] = 1;
|
||||
mesh.geometry.attributes.uv.array[ui+2] = len/5;
|
||||
mesh.geometry.attributes.uv.array[ui+3] = 1;
|
||||
mesh.geometry.attributes.uv.array[ui+4] = len/5;
|
||||
mesh.geometry.attributes.uv.array[ui+5] = 0;
|
||||
}else{
|
||||
mesh.geometry.attributes.uv.array[ui] = 0;
|
||||
mesh.geometry.attributes.uv.array[ui+1] = 0;
|
||||
mesh.geometry.attributes.uv.array[ui+2] = 0;
|
||||
mesh.geometry.attributes.uv.array[ui+3] = 1;
|
||||
mesh.geometry.attributes.uv.array[ui+4] = len/5;
|
||||
mesh.geometry.attributes.uv.array[ui+5] = 0;
|
||||
}
|
||||
}
|
||||
mergegeometry.merge(new THREE.Geometry().fromBufferGeometry(mesh.geometry),mesh.matrix);
|
||||
mesh.geometry.dispose();
|
||||
mesh.material.map.dispose();
|
||||
mesh.material.dispose();
|
||||
rails.setrails(sectiondata[i].code,closedSpline.points,sectiondata[i].standTrack,len,scene);
|
||||
}else{
|
||||
let height = Math.random()/1000;
|
||||
var closedSpline = new THREE.CatmullRomCurve3( [
|
||||
new THREE.Vector3(newsection.railpoint[0].x,newsection.railpoint[0].y,newsection.railpoint[0].z),
|
||||
new THREE.Vector3(newsection.railpoint[1].x,newsection.railpoint[1].y,newsection.railpoint[1].z),
|
||||
] );
|
||||
|
||||
closedSpline.type = 'catmullrom';
|
||||
closedSpline.closed = false;
|
||||
// Set up settings for later extrusion
|
||||
var extrudeSettings = {
|
||||
steps : 1,
|
||||
curveSegments : 1,
|
||||
bevelSegments : 1,
|
||||
bevelEnabled : false,
|
||||
extrudePath : closedSpline,
|
||||
};
|
||||
var shape = new THREE.Shape();
|
||||
shape.moveTo( -2,0 );
|
||||
shape.lineTo( 2,0 );
|
||||
// Extrude the triangle along the CatmullRom curve
|
||||
var geometry = new THREE.ExtrudeBufferGeometry( shape, extrudeSettings );
|
||||
var mesh = new THREE.Mesh( geometry, selectmaterial );
|
||||
let count = mesh.geometry.attributes.position.count/3;
|
||||
|
||||
for(let i=0;i<count;i++){
|
||||
let ui=i*6;
|
||||
if(i%2 != 0){
|
||||
mesh.geometry.attributes.uv.array[ui] = 0;
|
||||
mesh.geometry.attributes.uv.array[ui+1] = 1;
|
||||
mesh.geometry.attributes.uv.array[ui+2] = len;
|
||||
mesh.geometry.attributes.uv.array[ui+3] = 1;
|
||||
mesh.geometry.attributes.uv.array[ui+4] = len;
|
||||
mesh.geometry.attributes.uv.array[ui+5] = 0;
|
||||
}else{
|
||||
mesh.geometry.attributes.uv.array[ui] = 0;
|
||||
mesh.geometry.attributes.uv.array[ui+1] = 0;
|
||||
mesh.geometry.attributes.uv.array[ui+2] = 0;
|
||||
mesh.geometry.attributes.uv.array[ui+3] = 1;
|
||||
mesh.geometry.attributes.uv.array[ui+4] = len;
|
||||
mesh.geometry.attributes.uv.array[ui+5] = 0;
|
||||
}
|
||||
}
|
||||
mergegeometry.merge(new THREE.Geometry().fromBufferGeometry(mesh.geometry),mesh.matrix);
|
||||
mesh.geometry.dispose();
|
||||
mesh.material.map.dispose();
|
||||
mesh.material.dispose();
|
||||
|
||||
rails.setrails(sectiondata[i].code,closedSpline.points,sectiondata[i].standTrack,len,scene);
|
||||
}
|
||||
}
|
||||
// let mergemesh = new THREE.Mesh( mergegeometry, autorail.material );
|
||||
let mergemesh = new THREE.Mesh( mergegeometry, selectmaterial );
|
||||
mergemesh.matrixAutoUpdate = false;
|
||||
scope.sectiongroup.add(mergemesh);
|
||||
|
||||
resolve("loadersection");
|
||||
});
|
||||
|
||||
|
@ -35,7 +35,6 @@ export function SwitchListN() {
|
||||
directtype:null,
|
||||
locateType:0
|
||||
};
|
||||
|
||||
let autoswitch = assetloader.modellist[num].mesh.clone(true);
|
||||
autoswitch.code = switchdata[i].code;
|
||||
for(let j=0;j<autoswitch.children.length;j++){
|
||||
|
@ -14,7 +14,7 @@ class SkinCode extends defaultStyle {
|
||||
distance: 18, // 文字离区段距离
|
||||
fontSize: 11, // 字体大小
|
||||
fontWeight: 'normal', // 字体粗细
|
||||
fontColor: 'lightgreen', // 字体颜色
|
||||
fontColor: '#FFFFFF', // 字体颜色
|
||||
textAlign: 'center', // 水平对齐方式
|
||||
textPosition: 'inside', // 文字位置
|
||||
textVerticalAlign: 'middle' // 文字垂直对齐方式
|
||||
@ -254,12 +254,14 @@ class SkinCode extends defaultStyle {
|
||||
detainCar: { // 扣车
|
||||
position: -1, // 扣车标识在站台上显示方向
|
||||
text: 'H', // 扣车显示内容
|
||||
offset: {x: -8, y: 13}, // 扣车偏移量
|
||||
offset: {x: 8, y: 0}, // 扣车偏移量
|
||||
centerTrainColor: 'white', // 中心扣车颜色
|
||||
andCenterTrainColor: 'red', // 车站+中心扣车颜色
|
||||
detainTrainTextColor: '#E4EF50', // 车站扣除文字颜色
|
||||
fontSize: 10,
|
||||
fontWeight: 'normal'
|
||||
fontWeight: 'normal',
|
||||
circleWidth:14, // 西安二号线特殊样式 圆圈的宽度
|
||||
special:true // 西安二号线特殊样式
|
||||
},
|
||||
stopTime: { // 停站时间
|
||||
position: 1, // 停站时间方向
|
||||
@ -399,7 +401,7 @@ class SkinCode extends defaultStyle {
|
||||
position: 0, // 区段名称位置 1 上面 -1 下面 0 对称
|
||||
offset: {x: 0, y: 8}, // 道岔名称与区段距离
|
||||
fontSize: 11, // 字体大小
|
||||
fontColor: '#C0C0C0', // 道岔名称颜色
|
||||
fontColor: '#FFFFFF', // 道岔名称颜色
|
||||
fontWeight: 'normal', // 字体粗细
|
||||
borderColor: '#FE0000', // 道岔边框颜色
|
||||
lossColor: 'lightgreen', // 道岔失去颜色
|
||||
@ -537,10 +539,10 @@ class SkinCode extends defaultStyle {
|
||||
};
|
||||
this[deviceType.Axle] = {
|
||||
displayCondition: '01', // 显示条件 (01所有模式下显示 02 行调显示 03现地显示)
|
||||
lineLength: 14,
|
||||
lineWidth: 2,
|
||||
distance: 5,
|
||||
radiusR: 3,
|
||||
lineLength: 18,
|
||||
lineWidth: 3,
|
||||
distance: 7,
|
||||
radiusR: 5,
|
||||
strokeColor: '#9F9C9C',
|
||||
fillColor: '#9F9C9C',
|
||||
resetStrokeColor: '#FFFF00',
|
||||
@ -552,23 +554,23 @@ class SkinCode extends defaultStyle {
|
||||
distance: 30, // 模式间距
|
||||
psd: {
|
||||
text: 'PSD',
|
||||
defaultColor: '#FFF'
|
||||
defaultColor: '#9F9C9C'
|
||||
},
|
||||
mfa: {
|
||||
text: 'MFA',
|
||||
defaultColor: '#FFF'
|
||||
defaultColor: '#9F9C9C'
|
||||
},
|
||||
mfb: {
|
||||
text: 'MFB',
|
||||
defaultColor: '#FFF'
|
||||
defaultColor: '#9F9C9C'
|
||||
},
|
||||
pfa: {
|
||||
text: 'PFA',
|
||||
defaultColor: '#FFF'
|
||||
defaultColor: '#9F9C9C'
|
||||
},
|
||||
pfb: {
|
||||
text: 'PFB',
|
||||
defaultColor: '#FFF'
|
||||
defaultColor: '#9F9C9C'
|
||||
}
|
||||
};
|
||||
this[deviceType.ReturnModeGroup] = {
|
||||
|
@ -294,7 +294,7 @@ class Jlmap {
|
||||
}
|
||||
showStationHandlePsd(oDevice, stationCode) {
|
||||
const standDevice = this.mapDevice[oDevice.standCode];
|
||||
if (standDevice.deviceStationCode === stationCode || !stationCode) {
|
||||
if (standDevice && standDevice.deviceStationCode === stationCode || !stationCode) {
|
||||
this.$painter.updateSpecialShowStation(oDevice, true);
|
||||
} else {
|
||||
this.$painter.updateSpecialShowStation(oDevice, false);
|
||||
|
@ -129,8 +129,8 @@ export default class SaidLamp extends Group {
|
||||
this.control = new EUnmanned({
|
||||
zlevel: this.zlevel,
|
||||
z: this.z,
|
||||
x: model.unmannedPosition.x,
|
||||
y: model.unmannedPosition.y,
|
||||
x: model.position.x,
|
||||
y: model.position.y,
|
||||
_subType: 'Unmanned',
|
||||
width: this.style.NoOneReturn.width,
|
||||
fill: this.style.NoOneReturn.defaultColor
|
||||
|
67
src/jmapNew/shape/StationStand/EDetainCircle.js
Normal file
67
src/jmapNew/shape/StationStand/EDetainCircle.js
Normal file
@ -0,0 +1,67 @@
|
||||
import Group from 'zrender/src/container/Group';
|
||||
import Circle from 'zrender/src/graphic/shape/Circle';
|
||||
import Line from 'zrender/src/graphic/shape/Line';
|
||||
|
||||
class EDetainCircle extends Group {
|
||||
constructor(model) {
|
||||
super();
|
||||
this.model = model;
|
||||
this.create();
|
||||
}
|
||||
|
||||
create() {
|
||||
const model = this.model;
|
||||
const style = this.model.style;
|
||||
this.detainCircle = new Circle({
|
||||
zlevel: model.zlevel,
|
||||
z: model.z,
|
||||
shape: {
|
||||
cx: model.x,
|
||||
cy: model.y,
|
||||
r: model.radius
|
||||
},
|
||||
style:{
|
||||
lineWidth:2,
|
||||
stroke:style.sidelineColor
|
||||
}
|
||||
});
|
||||
this.line1 = new Line({
|
||||
zlevel: model.zlevel,
|
||||
z: model.z,
|
||||
shape:{
|
||||
x1:model.x - model.radius * 0.7,
|
||||
y1:model.y - model.radius * 0.7,
|
||||
x2:model.x + model.radius * 0.7,
|
||||
y2:model.y + model.radius * 0.7
|
||||
},
|
||||
style:{
|
||||
lineWidth:2,
|
||||
stroke:style.sidelineColor
|
||||
}
|
||||
});
|
||||
this.line2 = new Line({
|
||||
zlevel: model.zlevel,
|
||||
z: model.z,
|
||||
shape:{
|
||||
x1:model.x - model.radius * 0.7,
|
||||
y1:model.y + model.radius * 0.7,
|
||||
x2:model.x + model.radius * 0.7,
|
||||
y2:model.y - model.radius * 0.7
|
||||
},
|
||||
style:{
|
||||
lineWidth:2,
|
||||
stroke:style.sidelineColor
|
||||
}
|
||||
});
|
||||
this.add(this.detainCircle);
|
||||
this.add(this.line1);
|
||||
this.add(this.line2);
|
||||
}
|
||||
|
||||
setColor(color) {
|
||||
this.detainCircle.setStyle('stroke', color);
|
||||
this.line1.setStyle('stroke', color);
|
||||
}
|
||||
}
|
||||
|
||||
export default EDetainCircle;
|
@ -12,6 +12,7 @@ import EHighlight from '../element/EHighlight';
|
||||
import ETrainStop from './ETrainStop';
|
||||
import ETrainDepart from './ETrainDepart';
|
||||
import EControl from '../element/EControl';
|
||||
import EDetainCircle from './EDetainCircle';
|
||||
import {isShowThePrdType} from '../../utils/handlePath';
|
||||
|
||||
class StationStand extends Group {
|
||||
@ -131,21 +132,34 @@ class StationStand extends Group {
|
||||
this.add(this.reentry);
|
||||
}
|
||||
|
||||
/** 站台扣车*/
|
||||
const detainD = model.right ? 1 : -1;
|
||||
const detainX = model.position.x - style.StationStand.detainCar.position * detainD * (style.StationStand.detainCar.offset.x - model.width / 2);
|
||||
const detainY = model.position.y + detainD * (style.StationStand.detainCar.offset.y - model.height / 2);
|
||||
this.detain = new EDetain({
|
||||
zlevel: this.zlevel,
|
||||
z: this.z,
|
||||
style: style,
|
||||
x: detainX,
|
||||
y: detainY,
|
||||
width: model.width,
|
||||
inside: model.inside,
|
||||
right: model.right
|
||||
});
|
||||
this.add(this.detain);
|
||||
if (style.StationStand.detainCar.special) {
|
||||
const detainD = model.right ? 1 : -1;
|
||||
this.detainCircle = new EDetainCircle({
|
||||
zlevel: this.zlevel,
|
||||
z: this.z,
|
||||
style: style,
|
||||
x: model.position.x + (model.width / 2) * detainD + detainD * style.StationStand.detainCar.offset.x + detainD * style.StationStand.detainCar.circleWidth / 2,
|
||||
y: model.position.y,
|
||||
radius:style.StationStand.detainCar.circleWidth / 2
|
||||
});
|
||||
this.add(this.detainCircle);
|
||||
} else {
|
||||
/** 站台扣车*/
|
||||
const detainD = model.right ? 1 : -1;
|
||||
const detainX = model.position.x - style.StationStand.detainCar.position * detainD * (style.StationStand.detainCar.offset.x - model.width / 2);
|
||||
const detainY = model.position.y + detainD * (style.StationStand.detainCar.offset.y - model.height / 2);
|
||||
this.detain = new EDetain({
|
||||
zlevel: this.zlevel,
|
||||
z: this.z,
|
||||
style: style,
|
||||
x: detainX,
|
||||
y: detainY,
|
||||
width: model.width,
|
||||
inside: model.inside,
|
||||
right: model.right
|
||||
});
|
||||
this.add(this.detain);
|
||||
}
|
||||
|
||||
/** 停站时间*/
|
||||
if (style.StationStand.stopTime.offset) {
|
||||
|
@ -24,8 +24,8 @@
|
||||
</el-row>
|
||||
<div v-if="passModel">
|
||||
<div style="height: 12px" />
|
||||
<el-radio :id="upRadioId" v-model="passRadio" label="1" style="display: block; padding-left: 10px; margin-bottom: 10px;" :disabled="passRadio == '2'" @change="changeRadio">设置自动通过</el-radio>
|
||||
<el-radio :id="upRadioId" v-model="passRadio" label="2" style="display: block; padding-left: 10px;" :disabled="passRadio == '1'" @change="changeRadio">取消自动通过</el-radio>
|
||||
<el-radio v-model="passRadio" label="1" style="display: block; padding-left: 10px; margin-bottom: 10px;" :disabled="passRadio == '2'" @change="changeRadio">设置自动通过</el-radio>
|
||||
<el-radio v-model="passRadio" label="2" style="display: block; padding-left: 10px;" :disabled="passRadio == '1'" @change="changeRadio">取消自动通过</el-radio>
|
||||
</div>
|
||||
<el-row justify="center" class="button-group">
|
||||
<el-col :span="10" :offset="2">
|
||||
|
@ -64,7 +64,8 @@ export default {
|
||||
row: null,
|
||||
operation: '',
|
||||
stationLists: [],
|
||||
disabledAll: false
|
||||
disabledAll: false,
|
||||
checked2: false
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
|
@ -24,10 +24,10 @@
|
||||
</el-row>
|
||||
<el-row style="margin: 12px 0;">
|
||||
<el-col :span="11">
|
||||
<el-radio :id="upRadioId" v-model="passRadio" label="1" style="display: block; padding-left: 10px; margin-bottom: 10px;" :disabled="passRadio == '2'">设置</el-radio>
|
||||
<el-radio v-model="passRadio" label="1" style="display: block; padding-left: 10px; margin-bottom: 10px;" :disabled="passRadio == '2'">设置</el-radio>
|
||||
</el-col>
|
||||
<el-col :span="11" :offset="2">
|
||||
<el-radio :id="upRadioId" v-model="passRadio" label="2" style="display: block; padding-left: 10px;" :disabled="passRadio == '1'">取消</el-radio>
|
||||
<el-radio v-model="passRadio" label="2" style="display: block; padding-left: 10px;" :disabled="passRadio == '1'">取消</el-radio>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row justify="center" class="button-group">
|
||||
|
@ -179,6 +179,18 @@ export function parser(data, skinCode, showConfig) {
|
||||
case 'Axle':
|
||||
mapDevice[elem.code] = createDevice(deviceType.Axle, elem, propConvert, showConfig);
|
||||
break;
|
||||
case 'ModeStatusGroup':
|
||||
mapDevice[elem.code] = createDevice(deviceType.ModeStatusGroup, elem, propConvert, showConfig);
|
||||
break;
|
||||
case 'LampFilament':
|
||||
mapDevice[elem.code] = createDevice(deviceType.LampFilament, elem, propConvert, showConfig);
|
||||
break;
|
||||
case 'ReturnModeGroup':
|
||||
mapDevice[elem.code] = createDevice(deviceType.ReturnModeGroup, elem, propConvert, showConfig);
|
||||
break;
|
||||
case 'ControlSwitch':
|
||||
mapDevice[elem.code] = createDevice(deviceType.ControlSwitch, elem, propConvert, showConfig);
|
||||
break;
|
||||
}
|
||||
}, this);
|
||||
|
||||
|
@ -202,7 +202,6 @@ export default {
|
||||
},
|
||||
updatetrainstatus(newdata){
|
||||
//更新车组号
|
||||
|
||||
this.updatespeed(newdata.v);
|
||||
|
||||
this.updateatpspeed(newdata.pv);
|
||||
|
@ -324,13 +324,17 @@ export default {
|
||||
} else {
|
||||
this.mouseNumTime += 1;
|
||||
}
|
||||
if (this.mapBoxP) {
|
||||
if (this.mouseNumTime >= 8) {
|
||||
this.mapBoxP.style.cursor = 'none'; // canvas 单个绘图层级只设置一层就好
|
||||
} else {
|
||||
this.mapBoxP.style.cursor = '';
|
||||
}
|
||||
}
|
||||
if (this.mapBox) {
|
||||
if (this.mouseNumTime >= 15) {
|
||||
for (let i = 0; i < this.mapBox.length; i++) {
|
||||
this.mapBox[i].style.cursor = 'none';
|
||||
}
|
||||
} else {
|
||||
for (let i = 0; i < this.mapBox.length; i++) {
|
||||
this.mapBox[i].style.cursor = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 1000);
|
||||
},
|
||||
mousemove() {
|
||||
|
@ -5,7 +5,7 @@
|
||||
<progress-bar ref="progressBar" />
|
||||
<zoom-box v-if="!isScreen" :scale-rate="dataZoom.scaleRate" @setShrink="setShrink" @setMagnify="setMagnify" />
|
||||
<show-mode v-if="isDesign" :local-station-show="localStationShow" @setShowMode="setShowMode" />
|
||||
<switch-station v-show="isDesign && (showMode === '03') && localStationShow" ref="switchStation" :concentration-station-list="concentrationStationList" @setShowStation="setShowStation" />
|
||||
<switch-station v-if="isDesign && (showMode === '03') && localStationShow" ref="switchStation" :concentration-station-list="concentrationStationList" @setShowStation="setShowStation" />
|
||||
<div v-if="show" class="zoom-view" :style="{ width: width +'px'}">
|
||||
<el-form :model="dataZoom" label-width="80px" size="mini" inline>
|
||||
<el-form-item :label="$t(`global.offset`)">
|
||||
|
@ -9,7 +9,7 @@
|
||||
filterable
|
||||
:placeholder="item.placeholder"
|
||||
:disabled="item.disabled"
|
||||
@change="item.deviceChange||deviceChange"
|
||||
@change="item.deviceChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="option in item.options"
|
||||
@ -45,7 +45,7 @@
|
||||
:placeholder="item.placeholder"
|
||||
:disabled="item.disabled"
|
||||
:clearable="item.clearable"
|
||||
@change="item.deviceChange||deviceChange"
|
||||
@change="item.deviceChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="option in item.options"
|
||||
@ -206,8 +206,6 @@ export default {
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
deviceChange() {
|
||||
},
|
||||
handleLabel(option, label) {
|
||||
if (label == 'name') {
|
||||
return option.name;
|
||||
|
@ -13,7 +13,7 @@
|
||||
:placeholder="item.placeholder"
|
||||
:disabled="item.disabled"
|
||||
:clearable="item.clearable"
|
||||
@change="item.deviceChange||deviceChange"
|
||||
@change="item.deviceChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="option in item.options"
|
||||
@ -50,7 +50,7 @@
|
||||
:placeholder="item.placeholder"
|
||||
:disabled="item.disabled"
|
||||
:clearable="item.clearable"
|
||||
@change="item.deviceChange||deviceChange"
|
||||
@change="item.deviceChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="option in item.options"
|
||||
@ -86,7 +86,7 @@
|
||||
<template v-if="checkFieldType(item, 'input')">
|
||||
<el-form-item v-if="!item.isHidden" :key="item.prop" :label="item.label" :prop="item.prop" :required="item.required">
|
||||
<template v-if="item.change">
|
||||
<el-input v-model="formModel[item.prop]" type="text" :disabled="item.disabled" maxlength="30" :show-word-limit="true" @input="item.deviceChange||deviceChange" />
|
||||
<el-input v-model="formModel[item.prop]" type="text" :disabled="item.disabled" maxlength="30" :show-word-limit="true" @input="item.deviceChange" />
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-input v-model="formModel[item.prop]" type="text" :disabled="item.disabled" maxlength="30" :show-word-limit="true" />
|
||||
@ -129,7 +129,7 @@
|
||||
<div v-for="opt in item.children" :key="opt.code" class="listWidth">
|
||||
<el-form-item :label="opt.label" :prop="opt.prop" :label-width="opt.labelWidth">
|
||||
<template v-if="opt.change">
|
||||
<el-input-number v-model="formModel[opt.firstLevel][opt.secondLevel]" :label="opt.label" :disabled="opt.disabled" @change="opt.deviceChange||deviceChange" />
|
||||
<el-input-number v-model="formModel[opt.firstLevel][opt.secondLevel]" :label="opt.label" :disabled="opt.disabled" @change="opt.deviceChange" />
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-input-number v-model="formModel[opt.firstLevel][opt.secondLevel]" :label="opt.label" :disabled="opt.disabled" />
|
||||
@ -224,7 +224,7 @@
|
||||
<template v-if="checkFieldType(item, 'checkbox')">
|
||||
<template v-if="item.change">
|
||||
<el-form-item v-if="!item.isHidden" :key="item.prop" :label="item.label" :prop="item.prop" :required="item.required">
|
||||
<el-checkbox v-model="formModel[item.prop]" :disabled="item.disabled" @change="item.deviceChange||deviceChange" />
|
||||
<el-checkbox v-model="formModel[item.prop]" :disabled="item.disabled" @change="item.deviceChange" />
|
||||
</el-form-item>
|
||||
</template>
|
||||
<template v-else>
|
||||
@ -283,8 +283,6 @@ export default {
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
deviceChange() {
|
||||
},
|
||||
handleLabel(option, label) {
|
||||
if (label == 'name') {
|
||||
return option.name;
|
||||
|
@ -17,6 +17,9 @@
|
||||
<div style="height: calc(100% - 46px);">
|
||||
<el-scrollbar wrap-class="scrollbar-wrapper">
|
||||
<config-data ref="make" :form="formMake" :form-model="addModel" :rules="createRules" />
|
||||
<div style="color: #99a9bf;font-size: 12px;text-align: center;">
|
||||
<span>提示:设置归属车站时,坐标会默认设置为车站下方50px</span>
|
||||
</div>
|
||||
</el-scrollbar>
|
||||
</div>
|
||||
<div class="button_box">
|
||||
@ -52,7 +55,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
activeName: 'first',
|
||||
autoList: [],
|
||||
selectLists: [],
|
||||
atsControlList: [],
|
||||
centerCommunicationList: [],
|
||||
chainControlList: [],
|
||||
@ -158,7 +161,7 @@ export default {
|
||||
draw: {
|
||||
name: this.$t('map.drawData'),
|
||||
item: [
|
||||
{ prop:'type', label: this.$t('map.saidLampType'), type: 'select', optionLabel: 'name', optionValue: 'value', options: this.typeList },
|
||||
{ prop:'type', label: this.$t('map.saidLampType'), type: 'select', optionLabel: 'name', optionValue: 'value', options: this.typeList, change: true, deviceChange: this.typeChange },
|
||||
{ prop: 'code', label: `${this.$t('map.code')}`, type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.selectLists, change: true, deviceChange: this.deviceChange },
|
||||
{ prop: 'name', label: this.$t('map.saidLampName'), type: 'input', isHidden: this.noNameTypeList.includes(this.editModel.type) },
|
||||
{ prop: 'position', label: this.$t('map.textPoints'), type: 'coordinate', width: '140px', children: [
|
||||
@ -176,13 +179,13 @@ export default {
|
||||
const form = {
|
||||
labelWidth: '150px',
|
||||
items: [
|
||||
{ prop:'type', label: this.$t('map.saidLampType'), type: 'select', optionLabel: 'name', optionValue: 'value', options: this.typeList},
|
||||
{ prop: 'name', label: this.$t('map.saidLampName'), type: 'input', isHidden: this.noNameTypeList.includes(this.editModel.type) },
|
||||
{ prop:'type', label: this.$t('map.saidLampType'), type: 'select', optionLabel: 'name', optionValue: 'value', options: this.typeList, change: true, deviceChange: this.typeChange},
|
||||
{ prop: 'name', label: this.$t('map.saidLampName'), type: 'input', isHidden: this.noNameTypeList.includes(this.addModel.type) },
|
||||
{ prop:'stationCode', label: '所属车站', type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.stationList, change: true, deviceChange: this.changeBelongStation},
|
||||
{ prop: 'position', label: this.$t('map.textPoints'), type: 'coordinate', width: '140px', children: [
|
||||
{ prop: 'position.x', firstLevel: 'position', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '25px' },
|
||||
{ prop: 'position.y', firstLevel: 'position', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px' }
|
||||
] },
|
||||
{ prop:'stationCode', label: '所属车站', type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.stationList}
|
||||
] }
|
||||
]
|
||||
};
|
||||
return form;
|
||||
@ -192,9 +195,6 @@ export default {
|
||||
type: [
|
||||
{ required: true, message: this.$t('rules.selectSaidLampType'), trigger: 'change' }
|
||||
],
|
||||
name: [
|
||||
{ required: true, message: this.$t('rules.enterSaidLampName'), trigger: 'blur' }
|
||||
],
|
||||
'position.x': [
|
||||
{ required: true, message: this.$t('rules.trainPositionX'), trigger: 'blur' }
|
||||
],
|
||||
@ -232,10 +232,16 @@ export default {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.selectLists = this.indicatorLightList;
|
||||
this.selectLists = this.indicatorLightList;
|
||||
this.handleIndicatorLightList(this.indicatorLightList);
|
||||
},
|
||||
methods: {
|
||||
typeChange(type) {
|
||||
this.$refs.dataform.resetFields();
|
||||
this.$refs.make.resetFields();
|
||||
this.addModel.type = type;
|
||||
this.editModel.type = type;
|
||||
},
|
||||
handleIndicatorLightList(indicatorLightList) {
|
||||
this.atsControlList = [];
|
||||
this.centerCommunicationList = [];
|
||||
@ -366,20 +372,6 @@ export default {
|
||||
break;
|
||||
}
|
||||
},
|
||||
changeStation(code) { // 选择对应的所属设备集中站
|
||||
this.autoList.forEach(elem => {
|
||||
if (elem.code == code) {
|
||||
this.addModel.stationCode = elem.stationCode;
|
||||
}
|
||||
});
|
||||
},
|
||||
changeEditStation(code) { // 选择对应的所属设备集中站
|
||||
this.autoList.forEach(elem => {
|
||||
if (elem.code == code) {
|
||||
this.editModel.stationCode = elem.stationCode;
|
||||
}
|
||||
});
|
||||
},
|
||||
deviceChange(code) {
|
||||
this.$emit('setCenter', code);
|
||||
this.deviceSelect(this.$store.getters['map/getDeviceByCode'](code));
|
||||
@ -450,6 +442,17 @@ export default {
|
||||
}
|
||||
return idPrefix;
|
||||
},
|
||||
changeBelongStation(code) {
|
||||
if (code) {
|
||||
this.stationList.forEach(item => {
|
||||
if (item.code === code) {
|
||||
this.addModel.position.x = item.position.x;
|
||||
this.addModel.position.y = item.position.y + 50;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
// 创建对象
|
||||
create() {
|
||||
this.$refs.make.validate((valid) => {
|
||||
|
@ -122,7 +122,7 @@ export default {
|
||||
{ prop: 'position.x', firstLevel: 'position', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '20px' },
|
||||
{ prop: 'position.y', firstLevel: 'position', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '20px' }
|
||||
] },
|
||||
{ prop:'concentrateStationList', label:this.$t('map.concentrateStationList'), type: 'multiSelect', optionLabel: 'name', optionValue: 'code', options: this.concertrateStation, deviceChange:this.changeConcertrateStation }
|
||||
{ prop:'concentrateStationList', label:this.$t('map.concentrateStationList'), type: 'multiSelect', optionLabel: 'name', optionValue: 'code', options: this.concertrateStation, deviceChange: this.changeConcentrateStation }
|
||||
]
|
||||
}
|
||||
}
|
||||
@ -138,7 +138,7 @@ export default {
|
||||
{ prop: 'position.x', firstLevel: 'position', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '20px' },
|
||||
{ prop: 'position.y', firstLevel: 'position', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '20px' }
|
||||
] },
|
||||
{ prop:'concentrateStationList', label:this.$t('map.concentrateStationList'), type: 'multiSelect', optionLabel: 'name', optionValue: 'code', options: this.concertrateStation }
|
||||
{ prop:'concentrateStationList', label:this.$t('map.concentrateStationList'), type: 'multiSelect', optionLabel: 'name', optionValue: 'code', options: this.concertrateStation, deviceChange: this.changeConcentrateStation }
|
||||
]
|
||||
};
|
||||
return form;
|
||||
@ -176,6 +176,7 @@ export default {
|
||||
this.$emit('setCenter', code);
|
||||
this.deviceSelect(this.$store.getters['map/getDeviceByCode'](code));
|
||||
},
|
||||
changeConcentrateStation() {},
|
||||
handleClick() {
|
||||
this.getConcertrateStation();
|
||||
},
|
||||
|
Binary file not shown.
BIN
static/model/suidao/hebsuidao1.FBX
Normal file
BIN
static/model/suidao/hebsuidao1.FBX
Normal file
Binary file not shown.
BIN
static/model/suidao/hebsuidaow.FBX
Normal file
BIN
static/model/suidao/hebsuidaow.FBX
Normal file
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 9.8 KiB After Width: | Height: | Size: 9.2 KiB |
BIN
static/test/z02512.png
Normal file
BIN
static/test/z02512.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.8 KiB |
Loading…
Reference in New Issue
Block a user