This commit is contained in:
zyy 2020-09-16 17:53:44 +08:00
commit 8c9f18f239
16 changed files with 600 additions and 110 deletions

View File

@ -162,7 +162,7 @@ export function jl3dEditorLoader(mapid,scope){
.then(function(data){ .then(function(data){
//console.log(data); //console.log(data);
// return jlmap3ddata.sectionlist.initpromise(jlmap3ddata,assetloader,mapdata.sectionList,mapdata.switchList,scene); // return jlmap3ddata.sectionlist.initpromise(jlmap3ddata,assetloader,mapdata.sectionList,mapdata.switchList,scene);
return jlmap3ddata.sectionlist.loadpromise(jlmap3ddata,assetloader,sectiondata.section,scene); return jlmap3ddata.sectionlist.loadpromise(jlmap3ddata,assetloader,sectiondata.section,mapdata.sectionList,mapdata.switchList,scene);
}) })
.then(function(data){ .then(function(data){
//console.log(data); //console.log(data);

View File

@ -282,11 +282,12 @@ export function JLmap3dEdit(dom, data, mapid) {
} }
this.vexscal = function(){ this.vexscal = function(scalMode){
scope.transcontrol.detach() scope.transcontrol.detach()
this.scalswitch = true; this.scalswitch = true;
if(scope.selectmodel.railpoint){ if(scope.selectmodel.railpoint){
scalControls.attach(scope.selectmodel,scope.selectmodel.railpoint); scalControls.updateDatalist(scope.mapdata.sectionlist.sections.datalist);
scalControls.attach(scope.selectmodel,scope.selectmodel.railpoint,scalMode);
}else{ }else{
scalControls.attach(scope.selectmodel); scalControls.attach(scope.selectmodel);
} }
@ -315,6 +316,120 @@ export function JLmap3dEdit(dom, data, mapid) {
// scope.mapdata.signallist.resetsignal(scope.mapdata.linklist); // scope.mapdata.signallist.resetsignal(scope.mapdata.linklist);
}; };
//区段跟左右相邻的区段对齐
this.alignmentSection = function(alignmentCode,direct){
let oldobject = scope.mapdata.sectionlist.sections.datalist[alignmentCode].mesh;
let alignmentModel = scope.mapdata.sectionlist.sections.datalist[alignmentCode];
let objectparent = oldobject.parent;
objectparent.remove(oldobject);
let newRailPoint = [];
if(direct == "left"){
if(alignmentModel.lsection){
let connectSectionCode = alignmentModel.lsection;
let offsetX = alignmentModel.mesh.railpoint[0].x - scope.mapdata.sectionlist.sections.datalist[connectSectionCode].mesh.railpoint[2].x;
let offsetY = alignmentModel.mesh.railpoint[0].y - scope.mapdata.sectionlist.sections.datalist[connectSectionCode].mesh.railpoint[2].y;
let offsetZ = alignmentModel.mesh.railpoint[0].z - scope.mapdata.sectionlist.sections.datalist[connectSectionCode].mesh.railpoint[2].z;
alignmentModel.railpoint[0].x = scope.mapdata.sectionlist.sections.datalist[connectSectionCode].mesh.railpoint[2].x;
alignmentModel.railpoint[0].y = scope.mapdata.sectionlist.sections.datalist[connectSectionCode].mesh.railpoint[2].y;
alignmentModel.railpoint[0].z = scope.mapdata.sectionlist.sections.datalist[connectSectionCode].mesh.railpoint[2].z;
alignmentModel.railpoint[1].x -= offsetX;
alignmentModel.railpoint[1].y -= offsetY;
alignmentModel.railpoint[1].z -= offsetZ;
alignmentModel.railpoint[2].x -= offsetX;
alignmentModel.railpoint[2].y -= offsetY;
alignmentModel.railpoint[2].z -= offsetZ;
}
}
if(direct == "right"){
if(alignmentModel.rsection){
let connectSectionCode = alignmentModel.rsection;
let offsetX = alignmentModel.mesh.railpoint[2].x - scope.mapdata.sectionlist.sections.datalist[connectSectionCode].mesh.railpoint[0].x;
let offsetY = alignmentModel.mesh.railpoint[2].y - scope.mapdata.sectionlist.sections.datalist[connectSectionCode].mesh.railpoint[0].y;
let offsetZ = alignmentModel.mesh.railpoint[2].z - scope.mapdata.sectionlist.sections.datalist[connectSectionCode].mesh.railpoint[0].z;
alignmentModel.railpoint[2].x = scope.mapdata.sectionlist.sections.datalist[connectSectionCode].mesh.railpoint[0].x;
alignmentModel.railpoint[2].y = scope.mapdata.sectionlist.sections.datalist[connectSectionCode].mesh.railpoint[0].y;
alignmentModel.railpoint[2].z = scope.mapdata.sectionlist.sections.datalist[connectSectionCode].mesh.railpoint[0].z;
alignmentModel.railpoint[1].x -= offsetX;
alignmentModel.railpoint[1].y -= offsetY;
alignmentModel.railpoint[1].z -= offsetZ;
alignmentModel.railpoint[0].x -= offsetX;
alignmentModel.railpoint[0].y -= offsetY;
alignmentModel.railpoint[0].z -= offsetZ
}
}
let newpointlist = [];
for(let i=0;i<alignmentModel.railpoint.length;i++){
newpointlist.push(new THREE.Vector3(alignmentModel.railpoint[i].x,alignmentModel.railpoint[i].y,alignmentModel.railpoint[i].z));
}
let closedSpline = new THREE.CatmullRomCurve3(newpointlist);
closedSpline.type = 'catmullrom';
closedSpline.closed = false;
let extrudeSettings = {
steps : 5,
curveSegments : 1,
bevelSegments : 1,
bevelEnabled : false,
extrudePath : closedSpline,
};
var shape = new THREE.Shape();
shape.moveTo( 0,-2 );
shape.lineTo( 0, 2 );
let selectmaterial = oldobject.material;
var geometry = new THREE.ExtrudeBufferGeometry( shape, extrudeSettings );
let newAlignmentSection = new THREE.Mesh( geometry, selectmaterial );
newAlignmentSection.code = oldobject.code;
newAlignmentSection.railpoint = [];
for(let i=0;i<newpointlist.length;i++){
newAlignmentSection.railpoint[i] = {
x:newpointlist[i].x,
y:newpointlist[i].y,
z:newpointlist[i].z
}
}
newAlignmentSection.lengthFact = closedSpline.arcLengthDivisions/4;
if(newpointlist.length>2){
newAlignmentSection.lengthFact = newAlignmentSection.lengthFact/5;
}
let len = newAlignmentSection.lengthFact;
// closedSpline.arcLengthDivisions;
let count = newAlignmentSection.geometry.attributes.position.count/3;
for(let i=0;i<count;i++){
let ui=i*6;
if(i%2 != 0){
newAlignmentSection.geometry.attributes.uv.array[ui] = 0;
newAlignmentSection.geometry.attributes.uv.array[ui+1] = 1;
newAlignmentSection.geometry.attributes.uv.array[ui+2] = len;
newAlignmentSection.geometry.attributes.uv.array[ui+3] = 1;
newAlignmentSection.geometry.attributes.uv.array[ui+4] = len;
newAlignmentSection.geometry.attributes.uv.array[ui+5] = 0;
}else{
newAlignmentSection.geometry.attributes.uv.array[ui] = 0;
newAlignmentSection.geometry.attributes.uv.array[ui+1] = 0;
newAlignmentSection.geometry.attributes.uv.array[ui+2] = 0;
newAlignmentSection.geometry.attributes.uv.array[ui+3] = 1;
newAlignmentSection.geometry.attributes.uv.array[ui+4] = len;
newAlignmentSection.geometry.attributes.uv.array[ui+5] = 0;
}
}
newAlignmentSection.meshtype = "section";
scope.mapdata.sectionlist.sections.datalist[alignmentCode].mesh = newAlignmentSection;
objectparent.add(newAlignmentSection);
};
function onWindowResize() { function onWindowResize() {
//窗口自适应 //窗口自适应
scope.camera.aspect = window.innerWidth / window.innerHeight; scope.camera.aspect = window.innerWidth / window.innerHeight;

View File

@ -331,11 +331,7 @@ export function SectionList() {
console.log(stopsections[i]); console.log(stopsections[i]);
if(stopsections[i+1] ){ if(stopsections[i+1] ){
for(let j=0,lenj=stopsections[i].reals.length;j<lenj;j++){ for(let j=0,lenj=stopsections[i].reals.length;j<lenj;j++){
console.log("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$");
console.log(stopsections[i].reals[j]);
console.log(scope.sections.datalist);
console.log(scope.sections.datalist[stopsections[i].reals[j].section.rightSectionCode]);
let topnextpoint = {}; let topnextpoint = {};
if(scope.sections.datalist[stopsections[i].reals[j].section.code].railpoint == 0){ if(scope.sections.datalist[stopsections[i].reals[j].section.code].railpoint == 0){
@ -388,14 +384,14 @@ export function SectionList() {
assetloader.modellist[num2].mesh.rotation.x = 0; assetloader.modellist[num2].mesh.rotation.x = 0;
} }
} }
//根据站台区段创建站台位置 128停车点距离
for(let j=0,lenj=stations.length;j<lenj;j++){ for(let j=0,lenj=stations.length;j<lenj;j++){
// console.log(j); // console.log(j);
console.log(stations[j]); console.log(stations[j]);
let direction1 = scope.sections.datalist[stations[j].stands[0].section]; let direction1 = scope.sections.datalist[stations[j].stands[0].section];
let direction2 = scope.sections.datalist[stations[j].stands[1].section]; let direction2 = scope.sections.datalist[stations[j].stands[1].section];
console.log(direction1); console.log(direction1);
let x = direction1.railpoint[0].x+direction1.leftStopPointOffset+62; let x = direction1.railpoint[0].x+direction1.leftStopPointOffset+64;
let z = (direction1.railpoint[0].z+direction2.railpoint[0].z)/2; let z = (direction1.railpoint[0].z+direction2.railpoint[0].z)/2;
let mesh; let mesh;
if(stations[j].stands[0].inside == true){ if(stations[j].stands[0].inside == true){
@ -804,21 +800,16 @@ export function SectionList() {
data.mesh = testmesh2; data.mesh = testmesh2;
} }
// var box = new THREE.BoxHelper( testmesh2, 0xffffff );
// scope.sectiongroup.add( box );
} }
this.loadpromise = function(jlmap3ddata,assetloader,sectiondata,scene){ this.loadpromise = function(jlmap3ddata,assetloader,sectiondata,section2d,switch2d,scene){
// console.log("-------------------");
// console.log(jlmap3ddata.sectionlist.sections.datalist);
// console.log(sectiondata);
var texture = new THREE.TextureLoader().load( '../../static/test/z0251.png' ); var texture = new THREE.TextureLoader().load( '../../static/test/z0251.png' );
texture.wrapS = texture.wrapT = THREE.RepeatWrapping; texture.wrapS = texture.wrapT = THREE.RepeatWrapping;
texture.repeat.set( 1,1); texture.repeat.set( 1,1);
var selectmaterial = new THREE.MeshPhongMaterial( { map: texture,transparent:true,alphaTest:0.1 } ); var selectmaterial = new THREE.MeshPhongMaterial( { map: texture,transparent:true,alphaTest:0.1 } );
scene.add(scope.sectiongroup); scene.add(scope.sectiongroup);
return new Promise(function(resolve, reject){ return new Promise(function(resolve, reject){
for(let i=0,leni = sectiondata.length;i<leni;i++){ for(let i=0,leni = sectiondata.length;i<leni;i++){
@ -835,24 +826,14 @@ export function SectionList() {
}; };
let testmesh2 = null; let testmesh2 = null;
if(newsection.standTrack == true){
}
if(newsection.railpoint.length>2){ if(newsection.railpoint.length>2){
// console.log(newsection);
console.log("=======================");
if(newsection.code == "T27"){
console.log(newsection.railpoint[0]);
console.log(newsection.railpoint[1]);
console.log(newsection.railpoint[2]);
}
let height = Math.random()/1000; let height = Math.random()/1000;
var closedSpline = new THREE.CatmullRomCurve3( [ var closedSpline = new THREE.CatmullRomCurve3( [
new THREE.Vector3(newsection.railpoint[0].x,height,newsection.railpoint[0].z), new THREE.Vector3(newsection.railpoint[0].x,newsection.railpoint[0].y,newsection.railpoint[0].z),
new THREE.Vector3(newsection.railpoint[1].x,height,newsection.railpoint[1].z+0.0001), new THREE.Vector3(newsection.railpoint[1].x,newsection.railpoint[1].y,newsection.railpoint[1].z+0.0001),
new THREE.Vector3(newsection.railpoint[2].x,height,newsection.railpoint[2].z) new THREE.Vector3(newsection.railpoint[2].x,newsection.railpoint[2].y,newsection.railpoint[2].z)
] ); ] );
closedSpline.type = 'catmullrom'; closedSpline.type = 'catmullrom';
closedSpline.closed = false; closedSpline.closed = false;
@ -864,8 +845,14 @@ export function SectionList() {
extrudePath : closedSpline, extrudePath : closedSpline,
}; };
var shape = new THREE.Shape(); var shape = new THREE.Shape();
if(newsection.railpoint[0].y != newsection.railpoint[2].y){
shape.moveTo( -2, 0 );
shape.lineTo( 2, 0 );
}else{
shape.moveTo( 0,-2 ); shape.moveTo( 0,-2 );
shape.lineTo( 0, 2 ); shape.lineTo( 0, 2 );
}
var geometry = new THREE.ExtrudeBufferGeometry( shape, extrudeSettings ); var geometry = new THREE.ExtrudeBufferGeometry( shape, extrudeSettings );
var randomMaterail = new THREE.MeshLambertMaterial({ var randomMaterail = new THREE.MeshLambertMaterial({
@ -874,15 +861,15 @@ export function SectionList() {
}); });
if(newsection.standTrack == false){ if(newsection.standTrack == false){
testmesh2 = new THREE.Mesh( geometry, randomMaterail ); testmesh2 = new THREE.Mesh( geometry, selectmaterial );
}else{ }else{
testmesh2 = new THREE.Mesh( geometry, selectmaterial ); testmesh2 = new THREE.Mesh( geometry, selectmaterial );
} }
testmesh2.railpoint = [ testmesh2.railpoint = [
{x:newsection.railpoint[0].x,y:height,z:newsection.railpoint[0].z}, {x:newsection.railpoint[0].x,y:newsection.railpoint[0].y,z:newsection.railpoint[0].z},
{x:newsection.railpoint[1].x,y:height,z:newsection.railpoint[1].z}, {x:newsection.railpoint[1].x,y:newsection.railpoint[1].y,z:newsection.railpoint[1].z},
{x:newsection.railpoint[2].x,y:height,z:newsection.railpoint[2].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; testmesh2.lengthFact = newsection.railpoint[2].x-newsection.railpoint[0].x;
let len = testmesh2.lengthFact; let len = testmesh2.lengthFact;
@ -999,6 +986,100 @@ export function SectionList() {
} }
for(let i=0;i<section2d.length;i++){
if(section2d[i].type == "01" || section2d[i].type == "03"){
scope.sections.datalist[section2d[i].code].rsection = section2d[i].rightSectionCode;
scope.sections.datalist[section2d[i].code].lsection = section2d[i].leftSectionCode;
scope.sections.datalist[section2d[i].code].points = section2d[i].points;
scope.sections.datalist[section2d[i].code].pointslength = section2d[i].points.length-1;
if(section2d[i].standTrack == true){
scope.sections.datalist[section2d[i].code].standLeftX = section2d[i].points[0].x;
scope.sections.datalist[section2d[i].code].standLeftY = section2d[i].points[0].y;
scope.sections.datalist[section2d[i].code].standRightLeftX = section2d[i].points[1].x;
scope.sections.datalist[section2d[i].code].standRightRightY = section2d[i].points[1].y;
scope.sections.datalist[section2d[i].code].leftStopPointOffset = section2d[i].leftStopPointOffset;
scope.sections.datalist[section2d[i].code].rightStopPointOffset = section2d[i].leftStopPointOffset+124;
}
}
}
//连接区段
for(let i=0;i<switch2d.length;i++){
let acode = switch2d[i].sectionACode;
let bcode = switch2d[i].sectionBCode;
let ccode = switch2d[i].sectionCCode;
// console.log(switchdata[i]);
let aposx = (scope.sections.datalist[acode].points[0].x + scope.sections.datalist[acode].points[scope.sections.datalist[acode].pointslength].x)/2;
let cposx = (scope.sections.datalist[ccode].points[0].x + scope.sections.datalist[ccode].points[scope.sections.datalist[ccode].pointslength].x)/2;
let aposy = (scope.sections.datalist[acode].points[0].y + scope.sections.datalist[acode].points[scope.sections.datalist[acode].pointslength].y)/2;
let cposy = (scope.sections.datalist[ccode].points[0].y + scope.sections.datalist[ccode].points[scope.sections.datalist[ccode].pointslength].y)/2;
// console.log("----------------");
if(aposx > cposx){
if(aposy < cposy){
// ——A
// /C
scope.sections.datalist[ccode].ctype = 1;
}else{
// \C
// ——A
scope.sections.datalist[ccode].ctype = 2;
}
}else{
if(aposy < cposy){
// A——
// \C
scope.sections.datalist[ccode].ctype = 3;
}else{
// /C
// A——
scope.sections.datalist[ccode].ctype = 4;
}
}
scope.sections.datalist[acode].csection = ccode;
if(scope.sections.datalist[ccode].ctype == 1 || scope.sections.datalist[ccode].ctype == 2){
if(scope.sections.datalist[acode].lsection == "" || scope.sections.datalist[acode].lsection == undefined){
scope.sections.datalist[acode].lsection = bcode;
}
if(scope.sections.datalist[bcode].rsection == "" || scope.sections.datalist[bcode].rsection == undefined){
scope.sections.datalist[bcode].rsection = acode;
}
if(scope.sections.datalist[ccode].rsection == "" || scope.sections.datalist[ccode].rsection == undefined){
scope.sections.datalist[ccode].rsection = acode;
}else if(scope.sections.datalist[ccode].lsection == "" || scope.sections.datalist[ccode].lsection == undefined){
scope.sections.datalist[ccode].lsection = acode;
}
}
if(scope.sections.datalist[ccode].ctype == 3 || scope.sections.datalist[ccode].ctype == 4){
if(scope.sections.datalist[acode].rsection == "" || scope.sections.datalist[acode].rsection == undefined){
scope.sections.datalist[acode].rsection = bcode;
}
if(scope.sections.datalist[bcode].lsection == "" ||scope.sections.datalist[bcode].lsection == undefined ){
scope.sections.datalist[bcode].lsection = acode;
}
if(scope.sections.datalist[ccode].rsection == "" || scope.sections.datalist[ccode].rsection == undefined){
scope.sections.datalist[ccode].rsection = acode;
}else if(scope.sections.datalist[ccode].lsection == "" || scope.sections.datalist[ccode].lsection == undefined){
scope.sections.datalist[ccode].lsection = acode;
}
}
}
resolve("loadersection"); resolve("loadersection");
}); });

View File

@ -126,10 +126,9 @@ export function StationStandList() {
let newstationstand = new StationStandModel(standsdata[i]); let newstationstand = new StationStandModel(standsdata[i]);
let newstationmesh; let newstationmesh;
let stands = []; let stands = [];
console.log("--------------------");
for(let j=0;j<jlmapstanddata.length;j++){ for(let j=0;j<jlmapstanddata.length;j++){
if(jlmapstanddata[j].stationCode == standsdata[i].code && jlmapstanddata[j].small != true){ if(jlmapstanddata[j].stationCode == standsdata[i].code && jlmapstanddata[j].small != true){
console.log(jlmapstanddata[j]);
let changestand = { let changestand = {
code : jlmapstanddata[j].code, code : jlmapstanddata[j].code,
position : jlmapstanddata[j].position, position : jlmapstanddata[j].position,

View File

@ -110,7 +110,7 @@ let views4 = [
{ {
left: 0, left: 0,
bottom: 0, bottom: 0,
width: 0.5, width: 0.24,
height: 0.5, height: 0.5,
background: new THREE.Color( 0.5, 0.5, 0.7 ), background: new THREE.Color( 0.5, 0.5, 0.7 ),
eye: [ 3.7, 16, 26 ], eye: [ 3.7, 16, 26 ],
@ -118,9 +118,9 @@ let views4 = [
fov: 30 fov: 30
}, },
{ {
left: 0, left:0.25,
bottom: 0.5, bottom: 0,
width: 0.5, width: 0.24,
height: 0.5, height: 0.5,
background: new THREE.Color( 0.5, 0.5, 0.7 ), background: new THREE.Color( 0.5, 0.5, 0.7 ),
eye: [ 3.7,17,-4 ], eye: [ 3.7,17,-4 ],
@ -130,7 +130,7 @@ let views4 = [
{ {
left: 0.5, left: 0.5,
bottom: 0, bottom: 0,
width: 0.5, width: 0.24,
height: 0.5, height: 0.5,
background: new THREE.Color( 0.7, 0.5, 0.5 ), background: new THREE.Color( 0.7, 0.5, 0.5 ),
eye: [ -60, 6,11], eye: [ -60, 6,11],
@ -138,9 +138,9 @@ let views4 = [
fov: 45 fov: 45
}, },
{ {
left: 0.5, left: 0.75,
bottom: 0.5, bottom: 0,
width: 0.5, width: 0.24,
height: 0.5, height: 0.5,
background: new THREE.Color( 0.5, 0.7, 0.7 ), background: new THREE.Color( 0.5, 0.7, 0.7 ),
eye: [ -7,17,2], eye: [ -7,17,2],
@ -154,7 +154,7 @@ let views2 = [
left: 0, left: 0,
bottom: 0, bottom: 0,
width: 0.5, width: 0.5,
height: 1, height: 0.5,
background: new THREE.Color( 0.5, 0.5, 0.7 ), background: new THREE.Color( 0.5, 0.5, 0.7 ),
eye: [ 3.7, 16, 26 ], eye: [ 3.7, 16, 26 ],
up: [3.7, 10 ,16 ], up: [3.7, 10 ,16 ],
@ -164,16 +164,83 @@ let views2 = [
left: 0.5, left: 0.5,
bottom: 0, bottom: 0,
width: 0.5, width: 0.5,
height: 1, height: 0.5,
background: new THREE.Color( 0.7, 0.5, 0.5 ), background: new THREE.Color( 0.7, 0.5, 0.5 ),
eye: [ -60, 6,11], eye: [ -60, 6,11],
up: [ -59, 5.9,11 ], up: [ -59, 5.9,11 ],
fov: 60 fov: 60
}, },
]; ];
export function Jl3dpassflow(dom,skinCode,routegroup) {
let scope = this;
//
// let views4 = [
// {
// left: 0,
// bottom: 0,
// width: 0.5,
// height: 0.5,
// background: new THREE.Color( 0.5, 0.5, 0.7 ),
// eye: [ 3.7, 16, 26 ],
// up: [3.7, 10 ,16 ],
// fov: 30
// },
// {
// left: 0,
// bottom: 0.5,
// width: 0.5,
// height: 0.5,
// background: new THREE.Color( 0.5, 0.5, 0.7 ),
// eye: [ 3.7,17,-4 ],
// up: [ 3.7, 10 ,16],
// fov: 30
// },
// {
// left: 0.5,
// bottom: 0,
// width: 0.5,
// height: 0.5,
// background: new THREE.Color( 0.7, 0.5, 0.5 ),
// eye: [ -60, 6,11],
// up: [ -59, 5.9,11 ],
// fov: 45
// },
// {
// left: 0.5,
// bottom: 0.5,
// width: 0.5,
// height: 0.5,
// background: new THREE.Color( 0.5, 0.7, 0.7 ),
// eye: [ -7,17,2],
// up: [-7, 10, 8],
// fov: 60
// }
// ];
//
// let views2 = [
// {
// left: 0,
// bottom: 0,
// width: 0.5,
// height: 1,
// background: new THREE.Color( 0.5, 0.5, 0.7 ),
// eye: [ 3.7, 16, 26 ],
// up: [3.7, 10 ,16 ],
// fov: 60
// },
// {
// left: 0.5,
// bottom: 0,
// width: 0.5,
// height: 1,
// background: new THREE.Color( 0.7, 0.5, 0.5 ),
// eye: [ -60, 6,11],
// up: [ -59, 5.9,11 ],
// fov: 60
// },
// ];
export function Jl3dpassflow(dom,skinCode,routegroup,viewMap) {
let scope = this;
initView(viewMap);
this.dom = dom; this.dom = dom;
this.nowcode = null; this.nowcode = null;
this.animateswitch = false; this.animateswitch = false;
@ -440,6 +507,142 @@ export function Jl3dpassflow(dom,skinCode,routegroup) {
animate(); animate();
}) })
}); });
function initView(viewMap){
if(viewMap == "normal"){
views4 = [
{
left: 0,
bottom: 0,
width: 0.5,
height: 0.5,
background: new THREE.Color( 0.5, 0.5, 0.7 ),
eye: [ 3.7, 16, 26 ],
up: [3.7, 10 ,16 ],
fov: 30
},
{
left: 0,
bottom: 0.5,
width: 0.5,
height: 0.5,
background: new THREE.Color( 0.5, 0.5, 0.7 ),
eye: [ 3.7,17,-4 ],
up: [ 3.7, 10 ,16],
fov: 30
},
{
left: 0.5,
bottom: 0,
width: 0.5,
height: 0.5,
background: new THREE.Color( 0.7, 0.5, 0.5 ),
eye: [ -60, 6,11],
up: [ -59, 5.9,11 ],
fov: 45
},
{
left: 0.5,
bottom: 0.5,
width: 0.5,
height: 0.5,
background: new THREE.Color( 0.5, 0.7, 0.7 ),
eye: [ -7,17,2],
up: [-7, 10, 8],
fov: 60
}
];
views2 = [
{
left: 0,
bottom: 0,
width: 0.5,
height: 1,
background: new THREE.Color( 0.5, 0.5, 0.7 ),
eye: [ 3.7, 16, 26 ],
up: [3.7, 10 ,16 ],
fov: 60
},
{
left: 0.5,
bottom: 0,
width: 0.5,
height: 1,
background: new THREE.Color( 0.7, 0.5, 0.5 ),
eye: [ -60, 6,11],
up: [ -59, 5.9,11 ],
fov: 60
},
];
}else{
views4 = [
{
left: 0,
bottom: 0,
width: 0.24,
height: 0.5,
background: new THREE.Color( 0.5, 0.5, 0.7 ),
eye: [ 3.7, 16, 26 ],
up: [3.7, 10 ,16 ],
fov: 30
},
{
left:0.25,
bottom: 0,
width: 0.24,
height: 0.5,
background: new THREE.Color( 0.5, 0.5, 0.7 ),
eye: [ 3.7,17,-4 ],
up: [ 3.7, 10 ,16],
fov: 30
},
{
left: 0.5,
bottom: 0,
width: 0.24,
height: 0.5,
background: new THREE.Color( 0.7, 0.5, 0.5 ),
eye: [ -60, 6,11],
up: [ -59, 5.9,11 ],
fov: 45
},
{
left: 0.75,
bottom: 0,
width: 0.24,
height: 0.5,
background: new THREE.Color( 0.5, 0.7, 0.7 ),
eye: [ -7,17,2],
up: [-7, 10, 8],
fov: 60
}
];
views2 = [
{
left: 0,
bottom: 0,
width: 0.5,
height: 0.5,
background: new THREE.Color( 0.5, 0.5, 0.7 ),
eye: [ 3.7, 16, 26 ],
up: [3.7, 10 ,16 ],
fov: 60
},
{
left: 0.5,
bottom: 0,
width: 0.5,
height: 0.5,
background: new THREE.Color( 0.7, 0.5, 0.5 ),
eye: [ -60, 6,11],
up: [ -59, 5.9,11 ],
fov: 60
},
];
}
}
function inithumans(){ function inithumans(){
originhuman1 = scope.modelmanager.man1.mesh; originhuman1 = scope.modelmanager.man1.mesh;
originhuman1.progress = 1; originhuman1.progress = 1;

View File

@ -266,33 +266,41 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
// } // }
// trainlisttest.list[code].len = rails.sectionrail[data.section].lengthfact; // trainlisttest.list[code].len = rails.sectionrail[data.section].lengthfact;
trainlisttest.list[code].status = '1'; trainlisttest.list[code].status = '1';
if(trainlisttest.list[code].children[0].position.z != point.z){ if(trainlisttest.list[code].children[0].position.z != point.z || trainlisttest.list[code].children[0].position.y != point.y){
trainlisttest.list[code].children[0].up = new THREE.Vector3(1,0,0); trainlisttest.list[code].children[0].up = new THREE.Vector3(1,0,0);
let tangent = rails.sectionrail[data.section].lineleft.getTangentAt(data.offset).normalize(); let tangent = rails.sectionrail[data.section].lineleft.getTangentAt(data.offset).normalize();
trainlisttest.list[code].children[0].axis.crossVectors(trainlisttest.list[code].children[0].up, tangent).normalize(); trainlisttest.list[code].children[0].axis.crossVectors(trainlisttest.list[code].children[0].up, tangent).normalize();
let radians = Math.acos(trainlisttest.list[code].children[0].up.dot(tangent)); let radians = Math.acos(trainlisttest.list[code].children[0].up.dot(tangent));
trainlisttest.list[code].children[0].quaternion.setFromAxisAngle(trainlisttest.list[code].children[0].axis, radians); trainlisttest.list[code].children[0].quaternion.setFromAxisAngle(trainlisttest.list[code].children[0].axis, radians);
trainlisttest.list[code].children[0].rotation.x = -Math.PI/2; trainlisttest.list[code].children[0].rotation.x = -Math.PI/2;
let newRotationZ = trainlisttest.list[code].children[0].rotation.z;
trainlisttest.list[code].children[0].rotation.z = trainlisttest.list[code].children[0].rotation.y; trainlisttest.list[code].children[0].rotation.z = trainlisttest.list[code].children[0].rotation.y;
trainlisttest.list[code].children[0].rotation.y = 0; trainlisttest.list[code].children[0].rotation.y = 0;
// trainlisttest.list[code].children[0].rotation.y = -newRotationZ;
let rotas = { let rotas = {
posr:point, posr:point,
rota:trainlisttest.list[code].children[0].rotation.z roty:trainlisttest.list[code].children[0].rotation.y,
rotz:trainlisttest.list[code].children[0].rotation.z
} }
trainlisttest.list[code].children[1].rotalist.push(rotas); trainlisttest.list[code].children[1].rotalist.push(rotas);
let offsetz = parseFloat(point.z) - parseFloat(trainlisttest.list[code].children[0].position.z); let offsetz = parseFloat(point.z) - parseFloat(trainlisttest.list[code].children[0].position.z);
trainlisttest.list[code].children[0].position.z += offsetz; trainlisttest.list[code].children[0].position.z += offsetz;
// let offsety = parseFloat(point.y) - parseFloat(trainlisttest.list[code].children[0].position.y);
// trainlisttest.list[code].children[0].position.y += offsety;
} }
if(trainlisttest.list[code].children[1].rotalist.length > 0 || trainlisttest.list[code].children[2].rotalist.length > 0 || trainlisttest.list[code].children[3].rotalist.length > 0 || trainlisttest.list[code].children[4].rotalist.length > 0|| trainlisttest.list[code].children[5].rotalist.length > 0){ if(trainlisttest.list[code].children[1].rotalist.length > 0 || trainlisttest.list[code].children[2].rotalist.length > 0 || trainlisttest.list[code].children[3].rotalist.length > 0 || trainlisttest.list[code].children[4].rotalist.length > 0|| trainlisttest.list[code].children[5].rotalist.length > 0){
for(let rs = 1;rs<6;rs++){ for(let rs = 1;rs<6;rs++){
//console.log(rs); //console.log(rs);
if(trainlisttest.list[code].children[rs].rotalist[0]){ if(trainlisttest.list[code].children[rs].rotalist[0]){
let offsetz = parseFloat(trainlisttest.list[code].children[rs].rotalist[0].posr.z) - parseFloat(trainlisttest.list[code].children[rs].matrixWorld.elements[14]); let offsetz = parseFloat(trainlisttest.list[code].children[rs].rotalist[0].posr.z) - parseFloat(trainlisttest.list[code].children[rs].matrixWorld.elements[14]);
trainlisttest.list[code].children[rs].position.z += offsetz; trainlisttest.list[code].children[rs].position.z += offsetz;
// let offsety = parseFloat(trainlisttest.list[code].children[rs].rotalist[0].posr.y) - parseFloat(trainlisttest.list[code].children[rs].matrixWorld.elements[13]);
// trainlisttest.list[code].children[rs].position.y += offsety;
for(let xh=0;xh<trainlisttest.list[code].children[rs].rotalist.length;xh++){ for(let xh=0;xh<trainlisttest.list[code].children[rs].rotalist.length;xh++){
if((trainlisttest.list[code].children[rs].matrixWorld.elements[12])>=trainlisttest.list[code].children[rs].rotalist[0].posr.x){ if((trainlisttest.list[code].children[rs].matrixWorld.elements[12])>=trainlisttest.list[code].children[rs].rotalist[0].posr.x){
@ -307,7 +315,8 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
} }
trainlisttest.list[code].children[rs].rotation.z = trainlisttest.list[code].children[rs].rotalist[0].rota; trainlisttest.list[code].children[rs].rotation.z = trainlisttest.list[code].children[rs].rotalist[0].rotz;
// trainlisttest.list[code].children[rs].rotation.y = trainlisttest.list[code].children[rs].rotalist[0].roty;
trainlisttest.list[code].children[rs].rotalist.splice(0,1) trainlisttest.list[code].children[rs].rotalist.splice(0,1)
xh--; xh--;
}else{ }else{
@ -348,7 +357,7 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
// trainlisttest.list[code].len = rails.sectionrail[data.section].lengthfact; // trainlisttest.list[code].len = rails.sectionrail[data.section].lengthfact;
trainlisttest.list[code].status = '0'; trainlisttest.list[code].status = '0';
if(-trainlisttest.list[code].children[0].position.z != point.z){ if(-trainlisttest.list[code].children[0].position.z != point.z || trainlisttest.list[code].children[0].position.y != point.y){
trainlisttest.list[code].children[0].up = new THREE.Vector3(-1,0,0); trainlisttest.list[code].children[0].up = new THREE.Vector3(-1,0,0);
@ -357,16 +366,21 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
let radians = Math.acos(trainlisttest.list[code].children[0].up.dot(tangent)); let radians = Math.acos(trainlisttest.list[code].children[0].up.dot(tangent));
trainlisttest.list[code].children[0].quaternion.setFromAxisAngle(trainlisttest.list[code].children[0].axis, radians); trainlisttest.list[code].children[0].quaternion.setFromAxisAngle(trainlisttest.list[code].children[0].axis, radians);
trainlisttest.list[code].children[0].rotation.x = -Math.PI/2; trainlisttest.list[code].children[0].rotation.x = -Math.PI/2;
let newRotationZ = trainlisttest.list[code].children[0].rotation.z;
trainlisttest.list[code].children[0].rotation.z = trainlisttest.list[code].children[0].rotation.y; trainlisttest.list[code].children[0].rotation.z = trainlisttest.list[code].children[0].rotation.y;
trainlisttest.list[code].children[0].rotation.y = 0; trainlisttest.list[code].children[0].rotation.y = 0;
// trainlisttest.list[code].children[0].rotation.y = -newRotationZ;
let rotas = { let rotas = {
posr:point, posr:point,
rota:trainlisttest.list[code].children[0].rotation.z roty:trainlisttest.list[code].children[0].rotation.y,
rotz:trainlisttest.list[code].children[0].rotation.z
} }
trainlisttest.list[code].children[1].rotalist.push(rotas); trainlisttest.list[code].children[1].rotalist.push(rotas);
let offsetz = point.z + trainlisttest.list[code].children[0].position.z; let offsetz = point.z + trainlisttest.list[code].children[0].position.z;
trainlisttest.list[code].children[0].position.z -= offsetz; trainlisttest.list[code].children[0].position.z -= offsetz;
// let offsety = parseFloat(point.y) - parseFloat(trainlisttest.list[code].children[0].position.y);
// trainlisttest.list[code].children[0].position.y += offsety;
// trainlisttest.list[code].position.z = point.z; // trainlisttest.list[code].position.z = point.z;
} }
@ -378,6 +392,8 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
let offsetz = parseFloat(trainlisttest.list[code].children[rs].rotalist[0].posr.z) + parseFloat(trainlisttest.list[code].children[rs].position.z); let offsetz = parseFloat(trainlisttest.list[code].children[rs].rotalist[0].posr.z) + parseFloat(trainlisttest.list[code].children[rs].position.z);
trainlisttest.list[code].children[rs].position.z -= offsetz; trainlisttest.list[code].children[rs].position.z -= offsetz;
// let offsety = parseFloat(trainlisttest.list[code].children[rs].rotalist[0].posr.y) - parseFloat(trainlisttest.list[code].children[rs].matrixWorld.elements[13]);
// trainlisttest.list[code].children[rs].position.y += offsety;
for(let xh=0;xh<trainlisttest.list[code].children[rs].rotalist.length;xh++){ for(let xh=0;xh<trainlisttest.list[code].children[rs].rotalist.length;xh++){
if((trainlisttest.list[code].children[rs].matrixWorld.elements[12])<=trainlisttest.list[code].children[rs].rotalist[0].posr.x){ if((trainlisttest.list[code].children[rs].matrixWorld.elements[12])<=trainlisttest.list[code].children[rs].rotalist[0].posr.x){
@ -385,11 +401,10 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
if(rs != 5){ if(rs != 5){
let asd = trainlisttest.list[code].children[rs].rotalist[0]; let asd = trainlisttest.list[code].children[rs].rotalist[0];
trainlisttest.list[code].children[rs+1].rotalist.push(asd); trainlisttest.list[code].children[rs+1].rotalist.push(asd);
} }
//let offsetx = trainlisttest.list[code].children[1].matrixWorld.elements[12]-trainlisttest.list[code].children[0].children[3].matrixWorld.elements[12]; //let offsetx = trainlisttest.list[code].children[1].matrixWorld.elements[12]-trainlisttest.list[code].children[0].children[3].matrixWorld.elements[12];
// trainlisttest.list[code].children[rs].rotation.y = trainlisttest.list[code].children[rs].rotalist[0].roty;
trainlisttest.list[code].children[rs].rotation.z = trainlisttest.list[code].children[rs].rotalist[0].rota; trainlisttest.list[code].children[rs].rotation.z = trainlisttest.list[code].children[rs].rotalist[0].rotz;
trainlisttest.list[code].children[rs].rotalist.splice(0,1) trainlisttest.list[code].children[rs].rotalist.splice(0,1)
xh--; xh--;
}else{ }else{

View File

@ -14,7 +14,7 @@ THREE.ScalControls = function ( scene,_camera, _domElement ) {
var objectparent = null; var objectparent = null;
var selectmaterial = null; var selectmaterial = null;
var oldobject = null; var oldobject = null;
var sectionList = [];
var geometry = new THREE.BoxBufferGeometry( 1, 1, 1 ); var geometry = new THREE.BoxBufferGeometry( 1, 1, 1 );
var material = new THREE.MeshBasicMaterial( {color: 0x00ff00} ); var material = new THREE.MeshBasicMaterial( {color: 0x00ff00} );
@ -58,7 +58,7 @@ THREE.ScalControls = function ( scene,_camera, _domElement ) {
cube.name = "left"; cube.name = "left";
cubegroup.add( cube ); cubegroup.add( cube );
_objects.push(cube); _objects.push(cube);
let scalMode = null;
if ( _objects instanceof THREE.Camera ) { if ( _objects instanceof THREE.Camera ) {
@ -130,7 +130,12 @@ THREE.ScalControls = function ( scene,_camera, _domElement ) {
if ( _raycaster.ray.intersectPlane( _plane, _intersection ) ) { if ( _raycaster.ray.intersectPlane( _plane, _intersection ) ) {
_selected.position.copy( _intersection.sub( _offset ).applyMatrix4( _inverseMatrix ) ); _selected.position.copy( _intersection.sub( _offset ).applyMatrix4( _inverseMatrix ) );
_selected.position.y = 0; // if(scalMode == "plane"){
// _selected.position.y = 0;
// }else{
//
// }
if(_movemesh.meshtype = "section"){ if(_movemesh.meshtype = "section"){
newsectioncreate(); newsectioncreate();
@ -263,7 +268,6 @@ THREE.ScalControls = function ( scene,_camera, _domElement ) {
_selected = null; _selected = null;
console.log("mouseup");
} }
_domElement.style.cursor = _hovered ? 'pointer' : 'auto'; _domElement.style.cursor = _hovered ? 'pointer' : 'auto';
@ -362,17 +366,19 @@ THREE.ScalControls = function ( scene,_camera, _domElement ) {
for(let i=0;i<_movemesh.railpoint.length;i++){ 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)); newpointlist.push(new THREE.Vector3(_movemesh.railpoint[i].x,_movemesh.railpoint[i].y,_movemesh.railpoint[i].z));
} }
console.log(scalMode);
if(scalMode == "plane"){
if(_movemesh.railpoint.length>2){ if(_movemesh.railpoint.length>2){
if(_selected.name == "left"){ if(_selected.name == "left"){
newpointlist[0] = new THREE.Vector3(_selected.position.x,_movemesh.railpoint[0].y,_selected.position.z); newpointlist[0] = new THREE.Vector3(_selected.position.x,_movemesh.railpoint[0].y,_selected.position.z);
} }
if(_selected.name == "mid"){ if(_selected.name == "mid"){
newpointlist[1] = new THREE.Vector3(_selected.position.x,_movemesh.railpoint[0].y,_selected.position.z); newpointlist[1] = new THREE.Vector3(_selected.position.x,_movemesh.railpoint[1].y,_selected.position.z);
} }
if(_selected.name == "right"){ if(_selected.name == "right"){
newpointlist[2] = new THREE.Vector3(_selected.position.x,_movemesh.railpoint[0].y,_selected.position.z); newpointlist[2] = new THREE.Vector3(_selected.position.x,_movemesh.railpoint[2].y,_selected.position.z);
} }
curvestep = 10; curvestep = 10;
}else{ }else{
@ -381,10 +387,35 @@ THREE.ScalControls = function ( scene,_camera, _domElement ) {
newpointlist[0] = new THREE.Vector3(_selected.position.x,_movemesh.railpoint[0].y,_selected.position.z); newpointlist[0] = new THREE.Vector3(_selected.position.x,_movemesh.railpoint[0].y,_selected.position.z);
} }
if(_selected.name == "right"){ if(_selected.name == "right"){
newpointlist[1] = new THREE.Vector3(_selected.position.x,_movemesh.railpoint[0].y,_selected.position.z); newpointlist[1] = new THREE.Vector3(_selected.position.x,_movemesh.railpoint[1].y,_selected.position.z);
} }
curvestep =1; curvestep =1;
} }
}else{
if(_movemesh.railpoint.length>2){
if(_selected.name == "left"){
newpointlist[0] = new THREE.Vector3(_movemesh.railpoint[0].x,_selected.position.y,_movemesh.railpoint[0].z);
}
if(_selected.name == "mid"){
newpointlist[1] = new THREE.Vector3(_movemesh.railpoint[1].x,_selected.position.y,_movemesh.railpoint[1].z);
}
if(_selected.name == "right"){
newpointlist[2] = new THREE.Vector3(_movemesh.railpoint[2].x,_selected.position.y,_movemesh.railpoint[2].z);
}
curvestep = 10;
}else{
if(_selected.name == "left"){
newpointlist[0] = new THREE.Vector3(_movemesh.railpoint[0].x,_selected.position.y,_movemesh.railpoint[0].z);
}
if(_selected.name == "right"){
newpointlist[1] = new THREE.Vector3(_movemesh.railpoint[1].x,_selected.position.y,_movemesh.railpoint[1].z);
}
curvestep =1;
}
}
closedSpline = new THREE.CatmullRomCurve3(newpointlist); closedSpline = new THREE.CatmullRomCurve3(newpointlist);
closedSpline.type = 'catmullrom'; closedSpline.type = 'catmullrom';
closedSpline.closed = false; closedSpline.closed = false;
@ -398,8 +429,16 @@ THREE.ScalControls = function ( scene,_camera, _domElement ) {
}; };
var shape = new THREE.Shape(); var shape = new THREE.Shape();
if(newpointlist[0].y != newpointlist[2].y){
shape.moveTo( -2, 0 );
shape.lineTo( 2, 0 );
}else{
shape.moveTo( 0,-2 ); shape.moveTo( 0,-2 );
shape.lineTo( 0, 2 ); shape.lineTo( 0, 2 );
}
selectmaterial = _movemesh.material; selectmaterial = _movemesh.material;
var geometry = new THREE.ExtrudeBufferGeometry( shape, extrudeSettings ); var geometry = new THREE.ExtrudeBufferGeometry( shape, extrudeSettings );
_movemesh = new THREE.Mesh( geometry, selectmaterial ); _movemesh = new THREE.Mesh( geometry, selectmaterial );
@ -440,6 +479,8 @@ THREE.ScalControls = function ( scene,_camera, _domElement ) {
} }
} }
_movemesh.meshtype = "section"; _movemesh.meshtype = "section";
sectionList[_movemesh.code].mesh = _movemesh;
sectionList[_movemesh.code].railpoint = _movemesh.railpoint;
// _movemesh.geometry.computeBoundingBox(); // _movemesh.geometry.computeBoundingBox();
// _movemesh.geometry.center() // _movemesh.geometry.center()
// _movemesh.position.set(oldobject.position.x,oldobject.position.y,oldobject.position.z); // _movemesh.position.set(oldobject.position.x,oldobject.position.y,oldobject.position.z);
@ -458,8 +499,12 @@ THREE.ScalControls = function ( scene,_camera, _domElement ) {
this.deactivate = deactivate; this.deactivate = deactivate;
this.dispose = dispose; this.dispose = dispose;
this.updateDatalist = function(sectionDataList){
sectionList = sectionDataList;
}
// Backward compatibility // Backward compatibility
this.attach = function(movemesh,points){ this.attach = function(movemesh,points,mode){
scalMode = mode;
if(!helpmove){ if(!helpmove){
if(points){ if(points){

View File

@ -162,12 +162,12 @@ THREE.TransformControls = function ( camera, domElement ) {
let len = object.railpoint.length-1; let len = object.railpoint.length-1;
cube1.position.set(object.railpoint[0].x-object.position.x,0,object.railpoint[0].z-object.position.z); cube1.position.set(object.railpoint[0].x-object.position.x,object.railpoint[0].y,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); cube3.position.set(object.railpoint[len].x-object.position.x,object.railpoint[len].y,object.railpoint[len].z-object.position.z);
atobject.add(cube1); atobject.add(cube1);
atobject.add(cube3); atobject.add(cube3);
if(object.railpoint.length>2){ if(object.railpoint.length>2){
cube2.position.set(object.railpoint[1].x-object.position.x,0,object.railpoint[1].z-object.position.z); cube2.position.set(object.railpoint[1].x-object.position.x,object.railpoint[1].y,object.railpoint[1].z-object.position.z);
atobject.add(cube2); atobject.add(cube2);
virtualmovebox.position.set(cube2.position.x,cube2.position.y,cube2.position.z); virtualmovebox.position.set(cube2.position.x,cube2.position.y,cube2.position.z);
}else{ }else{

View File

@ -231,14 +231,15 @@ export function RailListN(){
} }
scope.sectionrail[sectioncode].lineleft = new THREE.CatmullRomCurve3(leftpoints); scope.sectionrail[sectioncode].lineleft = new THREE.CatmullRomCurve3(leftpoints);
scope.sectionrail[sectioncode].lineleft.curveType = "centripetal"; scope.sectionrail[sectioncode].lineleft.type = "catmullrom";
scope.sectionrail[sectioncode].lineleft.closed = false;
scope.sectionrail[sectioncode].lineleft.name = sectioncode; scope.sectionrail[sectioncode].lineleft.name = sectioncode;
scope.sectionrail[sectioncode].lineright = new THREE.CatmullRomCurve3(rightpoints); scope.sectionrail[sectioncode].lineright = new THREE.CatmullRomCurve3(rightpoints);
scope.sectionrail[sectioncode].lineright.curveType = "centripetal"; scope.sectionrail[sectioncode].lineright.type = "catmullrom";
scope.sectionrail[sectioncode].lineright.closed = false;
scope.sectionrail[sectioncode].lineright.name = sectioncode; scope.sectionrail[sectioncode].lineright.name = sectioncode;
// //
// for(let n=0,nm=scope.sectionrail[sectioncode].lineleft.points.length;n<nm;n++){ // for(let n=0,nm=scope.sectionrail[sectioncode].lineleft.points.length;n<nm;n++){
// var geometry = new THREE.CircleGeometry( 0.05, 16 ); // var geometry = new THREE.CircleGeometry( 0.05, 16 );
// var material = new THREE.MeshBasicMaterial( { color: 0xffff00 } ); // var material = new THREE.MeshBasicMaterial( { color: 0xffff00 } );

View File

@ -100,9 +100,9 @@ this.loadpromise = function(sectionList,sectiondata,rails,scene,assetloader){
// console.log(newsection); // console.log(newsection);
let height = Math.random()/1000; let height = Math.random()/1000;
var closedSpline = new THREE.CatmullRomCurve3( [ var closedSpline = new THREE.CatmullRomCurve3( [
new THREE.Vector3(newsection.railpoint[0].x,height,newsection.railpoint[0].z), new THREE.Vector3(newsection.railpoint[0].x,newsection.railpoint[0].y,newsection.railpoint[0].z),
new THREE.Vector3(newsection.railpoint[1].x,height,newsection.railpoint[1].z+0.0001), new THREE.Vector3(newsection.railpoint[1].x,newsection.railpoint[1].y,newsection.railpoint[1].z+0.0001),
new THREE.Vector3(newsection.railpoint[2].x,height,newsection.railpoint[2].z) new THREE.Vector3(newsection.railpoint[2].x,newsection.railpoint[2].y,newsection.railpoint[2].z)
] ); ] );
closedSpline.type = 'catmullrom'; closedSpline.type = 'catmullrom';
@ -115,8 +115,15 @@ this.loadpromise = function(sectionList,sectiondata,rails,scene,assetloader){
extrudePath : closedSpline, extrudePath : closedSpline,
}; };
var shape = new THREE.Shape(); var shape = new THREE.Shape();
if(newsection.railpoint[0].y != newsection.railpoint[2].y){
console.log(newsection);
shape.moveTo( -2, 0 );
shape.lineTo( 2, 0 );
}else{
shape.moveTo( 0,-2 ); shape.moveTo( 0,-2 );
shape.lineTo( 0, 2 ); shape.lineTo( 0, 2 );
}
var geometry = new THREE.ExtrudeBufferGeometry( shape, extrudeSettings ); var geometry = new THREE.ExtrudeBufferGeometry( shape, extrudeSettings );
var mesh = new THREE.Mesh( geometry, selectmaterial ); var mesh = new THREE.Mesh( geometry, selectmaterial );
let count = mesh.geometry.attributes.position.count/3; let count = mesh.geometry.attributes.position.count/3;
@ -155,15 +162,14 @@ this.loadpromise = function(sectionList,sectiondata,rails,scene,assetloader){
closedSpline.closed = false; closedSpline.closed = false;
// Set up settings for later extrusion // Set up settings for later extrusion
var extrudeSettings = { var extrudeSettings = {
steps : 1, steps : 5,
curveSegments : 1, curveSegments : 1,
bevelSegments : 1, bevelSegments : 1,
bevelEnabled : false, bevelEnabled : false,
extrudePath : closedSpline, extrudePath : closedSpline,
}; };
var shape = new THREE.Shape(); var shape = new THREE.Shape();
shape.moveTo( -2,0 );
shape.lineTo( 2,0 );
// Extrude the triangle along the CatmullRom curve // Extrude the triangle along the CatmullRom curve
var geometry = new THREE.ExtrudeBufferGeometry( shape, extrudeSettings ); var geometry = new THREE.ExtrudeBufferGeometry( shape, extrudeSettings );
var mesh = new THREE.Mesh( geometry, selectmaterial ); var mesh = new THREE.Mesh( geometry, selectmaterial );

View File

@ -211,9 +211,7 @@ export function StationStandListN() {
for(let n=0;n<psddata.length;n++){ for(let n=0;n<psddata.length;n++){
for(let m=0;m<newstationstand.stands.length;m++){ for(let m=0;m<newstationstand.stands.length;m++){
console.log("====================");
console.log(newstationstand.stands[m]);
console.log(psddata[n]);
if(psddata[n].standCode == newstationstand.stands[m].code && newstationstand.stands[m].right == false){ if(psddata[n].standCode == newstationstand.stands[m].code && newstationstand.stands[m].right == false){
let key = psddata[n].code; let key = psddata[n].code;
@ -241,9 +239,7 @@ export function StationStandListN() {
let mixer = new THREE.AnimationMixer( newstationmesh.children[j] ); let mixer = new THREE.AnimationMixer( newstationmesh.children[j] );
for(let n=0;n<psddata.length;n++){ for(let n=0;n<psddata.length;n++){
for(let m=0;m<newstationstand.stands.length;m++){ for(let m=0;m<newstationstand.stands.length;m++){
console.log("====================");
console.log(newstationstand.stands[m]);
console.log(psddata[n]);
if(psddata[n].standCode == newstationstand.stands[m].code && newstationstand.stands[m].right == true){ if(psddata[n].standCode == newstationstand.stands[m].code && newstationstand.stands[m].right == true){
let key = psddata[n].code; let key = psddata[n].code;
actionss[key] = { actionss[key] = {

View File

@ -210,6 +210,13 @@ export function TrainListN() {
fclip = new THREE.AnimationClip("four",2,ntracks2); fclip = new THREE.AnimationClip("four",2,ntracks2);
// ntracks2 = assetloader.modellist[n].animations.slice(6,13);
//
// fclip = new THREE.AnimationClip("four",2,ntracks2);
//
// ntracks1 = assetloader.modellist[n].animations.slice(0,5);
//
// tclip = new THREE.AnimationClip("three",2,ntracks1);
n = 0; n = 0;
} }
} }

View File

@ -8,7 +8,7 @@
<el-button type="transscal" @click="transscal">放大缩小</el-button> <el-button type="transscal" @click="transscal">放大缩小</el-button>
<el-button type="vexscal" @click="vexscal">拉伸</el-button>
<el-button type="testrail" @click="testrail">测试轨迹</el-button> <el-button type="testrail" @click="testrail">测试轨迹</el-button>
@ -57,9 +57,6 @@ export default {
async transscal(){ async transscal(){
this.$emit('transscal'); this.$emit('transscal');
}, },
async vexscal(){
this.$emit('vexscal');
},
async testrail(){ async testrail(){
this.$emit('testrail'); this.$emit('testrail');
}, },

View File

@ -45,6 +45,13 @@
<el-input ></el-input> <el-input ></el-input>
</el-form-item> </el-form-item>
<el-button v-if="selectmodel.meshtype == 'section'" @click="leftAlignment">区段左对齐</el-button>
<el-button v-if="selectmodel.meshtype == 'section'" @click="rightAlignment">区段右对齐</el-button>
<el-button type="vexscal" @click="vexScalPlane">平面拉伸</el-button>
<el-button type="vexscal" @click="vexScalVertical">高度改变</el-button>
<!-- <el-form-item label="是否显示:" prop="visible"> <!-- <el-form-item label="是否显示:" prop="visible">
<el-checkbox ></el-checkbox> <el-checkbox ></el-checkbox>
@ -160,6 +167,20 @@ export default {
}, },
init: function() { init: function() {
},
leftAlignment(){
this.$emit('alignment',this.selectmodel.code,"left");
},
rightAlignment(){
this.$emit('alignment',this.selectmodel.code,"right");
},
vexScalPlane(scalMode){
this.$emit('vexscal',"plane");
},
vexScalVertical(scalMode){
this.$emit('vexscal',"vertical");
}, },
switchproperty(){ switchproperty(){
this.activeName = "second"; this.activeName = "second";

View File

@ -8,13 +8,13 @@
<Edit-Action ref="action" @saction="saction" @actionevent="actionevent"> <Edit-Action ref="action" @saction="saction" @actionevent="actionevent">
</Edit-Action> </Edit-Action>
<Edit-Property ref="property" :selectmodel='selectmodel'> <Edit-Property ref="property" :selectmodel='selectmodel' @alignment="alignment" @vexscal= "vexscal" >
</Edit-Property> </Edit-Property>
<Edit-Assets ref="assets" @smodel="smodel" @stexture="stexture"> <Edit-Assets ref="assets" @smodel="smodel" @stexture="stexture">
</Edit-Assets> </Edit-Assets>
<Edit-Menu ref="menu" @transpos="transpos" @transrota="transrota" @transscal="transscal" @vexscal= "vexscal" @testrail="testrail" @autoss="autoss" @expo="expo" @save="save" <Edit-Menu ref="menu" @transpos="transpos" @transrota="transrota" @transscal="transscal" @testrail="testrail" @autoss="autoss" @expo="expo" @save="save"
@savetest="savetest" @back="back"> @savetest="savetest" @back="back">
</Edit-Menu> </Edit-Menu>
@ -171,10 +171,10 @@
this.jlmap3dedit.transcontrol.setMode('scale'); this.jlmap3dedit.transcontrol.setMode('scale');
this.jlmap3dedit.vexscaloff(); this.jlmap3dedit.vexscaloff();
}, },
vexscal(){ vexscal(scalMode){
this.jlmap3dedit.transcontrol.detach(); this.jlmap3dedit.transcontrol.detach();
this.jlmap3dedit.vexscal(); this.jlmap3dedit.vexscal(scalMode);
console.log("vexscal"); console.log("vexscal");
}, },
testrail(){ testrail(){
@ -187,6 +187,10 @@
this.jlmap3dedit.exportsection(); this.jlmap3dedit.exportsection();
}, },
alignment(alignmentCode,direct){
this.jlmap3dedit.alignmentSection(alignmentCode,direct);
},
save() { save() {
//console.log("save"); //console.log("save");
console.log(this.jlmap3dedit.assetManager); console.log(this.jlmap3dedit.assetManager);

View File

@ -82,7 +82,7 @@ export default {
init: function () { init: function () {
// let mapdata = this.$store.state.socket.device; // let mapdata = this.$store.state.socket.device;
const dom = document.getElementById('jl3d'); const dom = document.getElementById('jl3d');
this.jl3d = new Jl3dpassflow(dom,this.$route.query.mapid,this.$route.query.group); this.jl3d = new Jl3dpassflow(dom,this.$route.query.mapid,this.$route.query.group,"normal");
}, },
switchrender() { switchrender() {
if (this.renderswitch == true) { if (this.renderswitch == true) {