修改三维驾驶列车模型距离,三维编辑器增加车站坐标校准,增加站台停车点显示

This commit is contained in:
sunzhenyu 2020-09-18 18:29:02 +08:00
parent af322ec7aa
commit 60554583d1
7 changed files with 76 additions and 11 deletions

View File

@ -30,6 +30,7 @@ import { Actionmanage } from '@/jlmap3d/edit/actionmanage';
export function JLmap3dEdit(dom, data, mapid) {
console.log(data);
var scope = this;
this.dom = dom;
@ -74,6 +75,7 @@ export function JLmap3dEdit(dom, data, mapid) {
this.scene.add(this.transcontrol);
this.assetloader = new AssetLoader();
//this.assetloader.assetinit(scope.scene);
@ -295,16 +297,65 @@ export function JLmap3dEdit(dom, data, mapid) {
};
this.changeStationPos = function(changeStation){
for(let i=0,leni=scope.mapdata.stationstandlist.list.length;i<leni;i++){
if(changeStation.code == scope.mapdata.stationstandlist.list[i].code){
let changeData = scope.mapdata.stationstandlist.list[i];
let topStandTrack = scope.mapdata.sectionlist.sections.datalist[changeData.stands[0].section];
let downStandTrack = scope.mapdata.sectionlist.sections.datalist[changeData.stands[changeData.stands.length-1].section];
changeStation.position.set(topStandTrack.railpoint[0].x+(topStandTrack.leftStopPointOffset+topStandTrack.rightStopPointOffset)/2,topStandTrack.railpoint[1].y,(topStandTrack.railpoint[1].z+downStandTrack.railpoint[1].z)/2);
}
}
}
this.vexscaloff = function(){
scalControls.detach()
};
//临时增加停车标组
let stationStopGroup = new THREE.Group();
scope.scene.add(stationStopGroup);
this.testrail = function(){
console.log("testrail");
console.log(scope.mapdata);
scope.mapdata.raillist.resetrail(scope.mapdata,scope.scene);
if(stationStopGroup.children.length == 0){
for(let k in scope.mapdata.sectionlist.sections.datalist){
if(scope.mapdata.sectionlist.sections.datalist[k].standTrack == true){
var geometry = new THREE.PlaneGeometry( 10, 10, 4 );
var material = new THREE.MeshBasicMaterial( {color: 0xffff00, side: THREE.DoubleSide} );
var plane1 = new THREE.Mesh( geometry, material );
plane1.code = k;
plane1.stopType = "left";
var plane2 = new THREE.Mesh( geometry, material );
plane2.code = k;
plane2.stopType = "right";
plane1.rotation.y = Math.PI/2;
plane2.rotation.y = Math.PI/2;
plane1.position.set(scope.mapdata.sectionlist.sections.datalist[k].railpoint[0].x+scope.mapdata.sectionlist.sections.datalist[k].leftStopPointOffset,scope.mapdata.sectionlist.sections.datalist[k].railpoint[1].y,scope.mapdata.sectionlist.sections.datalist[k].railpoint[1].z);
plane2.position.set(scope.mapdata.sectionlist.sections.datalist[k].railpoint[0].x+scope.mapdata.sectionlist.sections.datalist[k].rightStopPointOffset,scope.mapdata.sectionlist.sections.datalist[k].railpoint[1].y,scope.mapdata.sectionlist.sections.datalist[k].railpoint[1].z);
stationStopGroup.add(plane1);
stationStopGroup.add(plane2);
}
}
}else{
for(let i=0,leni = stationStopGroup.children.length;i<leni;i++){
let k = stationStopGroup.children[i].code;
if(stationStopGroup.children[i].stopType == "left"){
stationStopGroup.children[i].position.set(scope.mapdata.sectionlist.sections.datalist[k].railpoint[0].x+scope.mapdata.sectionlist.sections.datalist[k].leftStopPointOffset,scope.mapdata.sectionlist.sections.datalist[k].railpoint[1].y,scope.mapdata.sectionlist.sections.datalist[k].railpoint[1].z);
}else{
stationStopGroup.children[i].position.set(scope.mapdata.sectionlist.sections.datalist[k].railpoint[0].x+scope.mapdata.sectionlist.sections.datalist[k].rightStopPointOffset,scope.mapdata.sectionlist.sections.datalist[k].railpoint[1].y,scope.mapdata.sectionlist.sections.datalist[k].railpoint[1].z);
}
}
}
// console.log("testrail");
// console.log(scope.mapdata);
// scope.mapdata.raillist.resetrail(scope.mapdata,scope.scene);
};
this.autoss = function(){

View File

@ -128,7 +128,7 @@ export function StationStandList() {
let stands = [];
for(let j=0;j<jlmapstanddata.length;j++){
if(jlmapstanddata[j].stationCode == standsdata[i].code && jlmapstanddata[j].small != true){
let changestand = {
code : jlmapstanddata[j].code,
position : jlmapstanddata[j].position,
@ -153,9 +153,11 @@ export function StationStandList() {
newstationstand.code = standsdata[i].code;
newstationstand.name = standsdata[i].name;
newstationstand.inside = standsdata[i].inside;
// console.log(standsdata[i]);
newstationmesh.code = standsdata[i].code;
newstationmesh.name = standsdata[i].name;
newstationmesh.meshtype = "station";
newstationmesh.position.x = standsdata[i].position.x;
newstationmesh.position.y = standsdata[i].position.y;
newstationmesh.position.z = standsdata[i].position.z;

View File

@ -588,8 +588,8 @@ export function AssetLoader(){
//object.traverse(function (node) {//获取其中对象
// node.frustumCulled = true;
//});
if(asset.deviceType == "train"){
let realtrain = new THREE.Group();
for(let j=6;j>0;j--){
let name = "c"+j;
@ -666,6 +666,7 @@ export function AssetLoader(){
// node.frustumCulled = true;
//});
if(asset.type == "train"){
console.log(scope.trainoffset);
let realtrain = new THREE.Group();
for(let j=6;j>0;j--){
let name = "c"+j;

View File

@ -69,7 +69,7 @@ export function DriverLoadNew(data,scope,netdata,mapdata,sectionlist,signallist,
let signaldata = JSON.parse(netdata.signals);
let standsdata = JSON.parse(netdata.stands);
let psddata = data.psdList;
assetloader.setModelListOver(JSON.parse(netdata.assets).sceneAssetList);
assetloader.setModelListOver(JSON.parse(netdata.assets).sceneAssetList,-13);
assetloader.assetPromiseOver(sceneload)
.then(function(data){
@ -154,7 +154,7 @@ export function DriverLoadNew(data,scope,netdata,mapdata,sectionlist,signallist,
}
//旧link相关停操作待删除
function lengthfact(data){
let linklist = [];
for(let i=0;i<data.linkList.length;i++){

View File

@ -10,7 +10,7 @@
<el-button type="testrail" @click="testrail">测试轨迹</el-button>
<el-button type="testrail" @click="testrail">显示站台轨停车点</el-button>
<el-button type="autoss" @click="autoss">自动匹配轨道信号灯</el-button>

View File

@ -49,9 +49,13 @@
<el-button v-if="selectmodel.meshtype == 'section'" @click="rightAlignment">区段右对齐</el-button>
<el-button type="vexscal" @click="vexScalPlane">平面拉伸</el-button>
<el-button v-if="selectmodel.meshtype == 'section'" type="vexscal" @click="vexScalPlane">平面拉伸</el-button>
<el-button type="vexscal" @click="vexScalVertical">高度改变</el-button>
<el-button v-if="selectmodel.meshtype == 'section'" type="vexscal" @click="vexScalVertical">高度改变</el-button>
<el-button v-if="selectmodel.meshtype == 'station'" @click="changeStationPos">自动对齐停车点</el-button>
<!-- <el-button v-if="selectmodel.meshtype == 'station'" type="vexscal" @click="vexScalVertical">高度改变</el-button> -->
<!-- <el-form-item label="是否显示:" prop="visible">
<el-checkbox ></el-checkbox>
@ -182,6 +186,10 @@ export default {
this.$emit('vexscal',"vertical");
},
changeStationPos(){
this.$emit('changeStationPos',this.selectmodel);
},
switchproperty(){
this.activeName = "second";
},

View File

@ -8,7 +8,7 @@
<Edit-Action ref="action" @saction="saction" @actionevent="actionevent">
</Edit-Action>
<Edit-Property ref="property" :selectmodel='selectmodel' @alignment="alignment" @vexscal= "vexscal" >
<Edit-Property ref="property" :selectmodel='selectmodel' @alignment="alignment" @vexscal= "vexscal" @changeStationPos="changeStationPos">
</Edit-Property>
<Edit-Assets ref="assets" @smodel="smodel" @stexture="stexture">
@ -177,6 +177,9 @@
this.jlmap3dedit.vexscal(scalMode);
console.log("vexscal");
},
changeStationPos(changeStation){
this.jlmap3dedit.changeStationPos(changeStation);
},
testrail(){
this.jlmap3dedit.testrail();
},