This commit is contained in:
fan 2019-08-29 09:26:27 +08:00
commit 094476bdb5
28 changed files with 393 additions and 31 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 794 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

View File

@ -27,6 +27,7 @@ export default class button extends Group {
]); ]);
constructor(device) { constructor(device) {
super(); super();
this.event = device.event;
this.model = device.model; this.model = device.model;
this.zlevel = device.model.zlevel; this.zlevel = device.model.zlevel;
this.event = device.event; this.event = device.event;

107
src/ibp/shape/elevator.js Normal file
View File

@ -0,0 +1,107 @@
import Group from 'zrender/src/container/Group';
import ElevatorBack from './elevatorBack';
import ElevatorArrow from './elevatorArrow';
export default class elevator extends Group {
constructor(device) {
super();
this.event = device.event;
this.model = device.model;
this.create();
}
create() {
const model = this.model;
this.grouper=new Group({
id: '111',
// width: model.width,
// height: model.height,
position: [model.point.x, model.point.y],
draggable: model.draggable || false
});
this.elevatorBack = new ElevatorBack({model: {
zlevel: model.zlevel,
z: this.z,
// model.draggable ||
draggable: false,
point: {
x: model.point.x,
y: model.point.y
},
width: model.width,
height: model.height,
fillColor: model.fillColor ||'#adadad',
stroke: model.fillColor ||'#adadad',
lineWidth: 0
}
});
this.elevatorArrowTop=new ElevatorArrow({model: {
zlevel: model.zlevel,
z: this.z,
draggable: false,
point: {
x: model.point.x+model.width/6*4.7,
y: model.point.y+model.height/8*0.1
},
width: 20,
status: this.getStatus('top'),
orientation: 'top'
}});
this.elevatorArrowBottom=new ElevatorArrow({model: {
zlevel: model.zlevel,
z: this.z,
draggable: false,
point: {
x: model.point.x+model.width/6*1.3,
y: model.point.y+model.height/8*7.9
},
width: 20,
status: this.getStatus('bottom'),
orientation: 'bottom'
}});
this.grouper.add(this.elevatorBack);
this.grouper.add(this.elevatorArrowTop);
this.grouper.add(this.elevatorArrowBottom);
this.add(this.grouper);
}
getStatus(status) {
return status==this.model.direction? 'on':'off';
}
setDraggable() {
this.grouper.attr('draggable', true);
this.createMouseEvent();
}
createMouseEvent() {
this.on('mousedown', this.mousedown, this);
this.on('mousemove', this.mousemove, this);
this.on('mouseup', this.mouseup, this);
}
mousedown(e) {
this.event.disable();
this.draggroup =this.grouper;
this.deltPostion =[e.event.zrX-this.draggroup.position[0], e.event.zrY-this.draggroup.position[1]];
}
mousemove(e) {
if (this.draggroup !=null) {
var new_pos =[e.event.zrX, e.event.zrY];
this.draggroup.position=[new_pos[0]-this.deltPostion[0], new_pos[1]-this.deltPostion[1]];
this.draggroup.dirty();
}
}
mouseup(e) {
this.event.enable();
this.draggroup=null;
}
}

View File

@ -0,0 +1,96 @@
import Group from 'zrender/src/container/Group';
import Image from 'zrender/src/graphic/Image';
import elevatorArrowPic from '@/assets/ibp_images/elevatorArrow.png';
import elevatorArrowPicOn from '@/assets/ibp_images/elevatorArrow_on.png';
export default class elevatorArrow extends Group {
constructor(device) {
super();
this.model = device.model;
this.zlevel = device.model.zlevel;
this.create();
}
create() {
const model = this.model;
this.imageBg = new Image({
zlevel: this.zlevel,
draggable: model.draggable || false,
style: {
image: this.getStatus(),
x: model.point.x,
y: model.point.y,
width: 31,
height: 60
}
});
this.add(this.imageBg);
this.getOrientate();
}
getOrientate() {
switch (this.model.orientation) {
case 'top': {
this.transformRotation(0);
break;
}
case 'bottom': {
this.transformRotation(180);
break;
}
}
}
// 整体旋转箭头
transformRotation(rotate) {
this.imageBg.origin = [this.model.point.x, this.model.point.y];
this.imageBg.rotation = Math.PI / 180 * Number(rotate);
this.imageBg.dirty();
}
// /** 缩放按钮 */
// transformScale() {
// this.imageBg.origin = [this.model.point.x, this.model.point.y];
// this.imageBg.scale =[this.model.width/68, this.model.width/68];
// this.imageBg.dirty();
// }
getStatus() {
if (this.model.status) {
switch (this.model.status) {
case 'on': {
return elevatorArrowPicOn;
}
case 'off': {
return elevatorArrowPic;
}
}
} else {
return elevatorArrowPic;
}
}
setDraggable() {
this.arrow.attr('draggable', true);
this.createMouseEvent();
}
createMouseEvent() {
this.on('mousedown', this.mousedown, this);
this.on('mousemove', this.mousemove, this);
this.on('mouseup', this.mouseup, this);
}
mousedown(e) {
this.event.disable();
}
mousemove(e) {
}
mouseup(e) {
this.event.enable();
this.model.point.x = this.model.point.x + e.offsetX;
this.model.point.y = this.model.point.y + e.offsetY;
}
}

View File

@ -0,0 +1,69 @@
import Circle from 'zrender/src/graphic/shape/Circle';
import Polygon from 'zrender/src/graphic/shape/Polygon';
import Group from 'zrender/src/container/Group';
export default class elevatorBack extends Group {
constructor(device) {
super();
this.event = device.event;
this.model = device.model;
this.create();
}
create() {
const model = this.model;
this.arrowCircle = new Circle({
zlevel: model.zlevel,
z: model.z,
// path: 'M 0 0 Q -70 -50 0 -100 0 -100 L 150 -400 L 200 -400 Q 270 -350 200 -300 200 -300 L 50 0',
// draggable: model.draggable || false,
shape: {
cx: model.point.x + model.width/6*5,
cy: model.point.y + model.height/8,
r: model.width/6
},
style: {
fill: this.model.fillColor || '#adadad'
}
});
this.arrowPoly = new Polygon({
zlevel: model.zlevel,
z: model.z,
// draggable: model.draggable || false,
shape: {
points: [ [model.point.x+model.width/6, model.point.y + model.height], [model.point.x+model.width/6*2, model.point.y + model.height],
[model.point.x+model.width/6*5, model.point.y + model.height/8*2],
[model.point.x+model.width/6*5, model.point.y],
[model.point.x+model.width/6*4, model.point.y],
[model.point.x+model.width/6, model.point.y + model.height/8*6]
]
},
style: {
stroke: model.stroke || '#adadad',
lineWidth: model.lineWidth,
fill: model.fill || '#adadad'
}
});
this.arrowCircleRight = new Circle({
zlevel: model.zlevel,
z: model.z,
// path: 'M 0 0 Q -70 -50 0 -100 0 -100 L 150 -400 L 200 -400 Q 270 -350 200 -300 200 -300 L 50 0',
// draggable: model.draggable || false,
shape: {
cx: model.point.x + model.width/6,
cy: model.point.y + model.height/8*7,
r: model.width/6
},
style: {
fill: this.model.fillColor || '#adadad'
}
});
this.add(this.arrowPoly);
this.add(this.arrowCircle);
this.add(this.arrowCircleRight);
}
}

View File

@ -25,8 +25,8 @@ export default class rotateTip extends Group {
image: this.getRotateColor(), image: this.getRotateColor(),
x: model.point.x, x: model.point.x,
y: model.point.y, y: model.point.y,
width: 70, width: 68,
height: 74 height: 60
} }
}); });
this.add(this.imageBg); this.add(this.imageBg);
@ -36,7 +36,7 @@ export default class rotateTip extends Group {
/** 缩放按钮 */ /** 缩放按钮 */
transformScale() { transformScale() {
this.imageBg.origin = [this.model.point.x, this.model.point.y]; this.imageBg.origin = [this.model.point.x, this.model.point.y];
this.imageBg.scale =[this.model.width/70, this.model.width/70]; this.imageBg.scale =[this.model.width/68, this.model.width/68];
this.imageBg.dirty(); this.imageBg.dirty();
} }

View File

@ -0,0 +1,60 @@
import Group from 'zrender/src/container/Group';
import Image from 'zrender/src/graphic/Image';
import teleTerminalPic from '@/assets/ibp_images/telephone_terminal.png';
export default class alarm extends Group {
constructor(device) {
super();
this.model = device.model;
this.zlevel = device.model.zlevel;
this.create();
}
create() {
const model = this.model;
this.imageBg = new Image({
zlevel: this.zlevel,
draggable: model.draggable || false,
style: {
image: teleTerminalPic,
x: model.point.x,
y: model.point.y,
width: 64,
height: 56
}
});
this.add(this.imageBg);
this.transformScale();
}
/** 缩放按钮 */
transformScale() {
this.imageBg.origin = [this.model.point.x, this.model.point.y];
this.imageBg.scale =[this.model.width/64, this.model.width/64];
this.imageBg.dirty();
}
setDraggable() {
this.arrow.attr('draggable', true);
this.createMouseEvent();
}
createMouseEvent() {
this.on('mousedown', this.mousedown, this);
this.on('mousemove', this.mousemove, this);
this.on('mouseup', this.mouseup, this);
}
mousedown(e) {
this.event.disable();
}
mousemove(e) {
}
mouseup(e) {
this.event.enable();
this.model.point.x = this.model.point.x + e.offsetX;
this.model.point.y = this.model.point.y + e.offsetY;
}
}

View File

@ -95,17 +95,17 @@ export function JLmapDriving(dom, data, skinCode) {
// 地图模型数据 // 地图模型数据
let mapdata = new Jl3ddata(); let mapdata = new Jl3ddata();
const camera2 = new THREE.PerspectiveCamera( 60, window.innerWidth / window.innerHeight, 1, 2000 ); const camera2 = new THREE.PerspectiveCamera( 60, window.innerWidth / window.innerHeight, 1, 1100 );
camera2.name = 'camera2'; camera2.name = 'camera2';
const controls3 = new MouseControls(camera2, 1.6); const controls3 = new MouseControls(camera2, 1.6);
controls3.enabled = true; controls3.enabled = true;
scene.add(controls3.getObject()); scene.add(controls3.getObject());
let cameracctv = new THREE.PerspectiveCamera(70, dom.clientWidth/dom.clientHeight, 1, 20); let cameracctv = new THREE.PerspectiveCamera(70, dom.clientWidth/dom.clientHeight, 1, 50);
cameracctv.position.set( 5, 1,27 ); cameracctv.position.set( 5, -3,27 );
cameracctv.rotation.y = Math.PI/5*3; cameracctv.rotation.y = Math.PI/2;
camera2.add(cameracctv); camera2.add(cameracctv);
// 订阅仿真socket // 订阅仿真socket
this.Subscribe = new Jl3dDriving(scope); this.Subscribe = new Jl3dDriving(scope);

View File

@ -282,12 +282,14 @@ export function Jl3dDriving(jlmap3d) {
} }
const rotaposz = sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].z; const rotaposz = sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].z;
trainlisttest.list[code].rotation.y = 0; trainlisttest.list[code].rotation.y = 0;
trainlisttest.list[code].position.x = rotaposx; trainlisttest.list[code].position.x = rotaposx;
trainlisttest.list[code].position.y = 0; trainlisttest.list[code].position.y = 0;
for (let tl=0; tl<6; tl++) { for (let tl=0; tl<6; tl++) {
trainlisttest.list[code].children[tl].position.z = rotaposz; trainlisttest.list[code].children[tl].position.z = rotaposz;
} }
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x>sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) { if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x>sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
vexlist.push(new THREE.Vector3(rotaposx, 0, rotaposz)); vexlist.push(new THREE.Vector3(rotaposx, 0, rotaposz));
for (let m=sectionlist.sections.datalist[data.body[i].sectionCode].rail.length-1; m>=0; m--) { for (let m=sectionlist.sections.datalist[data.body[i].sectionCode].rail.length-1; m>=0; m--) {
@ -323,15 +325,14 @@ export function Jl3dDriving(jlmap3d) {
rotaposx = sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x+offset*data.body[i].sectionOffsetPercent; rotaposx = sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x+offset*data.body[i].sectionOffsetPercent;
} }
const rotaposz = sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].z; const rotaposz = sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].z;
trainlisttest.list[code].rotation.y = Math.PI; trainlisttest.list[code].rotation.y = Math.PI;
trainlisttest.list[code].position.x = rotaposx; trainlisttest.list[code].position.x = rotaposx;
trainlisttest.list[code].position.y = 0; trainlisttest.list[code].position.y = 0;
for (let tl=0; tl<6; tl++) {
trainlisttest.list[code].children[tl].position.z = rotaposz;
}
if (data.body[i].groupNumber == '001') {
}
for (let tl=0; tl<6; tl++) {
trainlisttest.list[code].children[tl].position.z = -rotaposz;
}
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x<sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) { if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x<sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
vexlist.push(new THREE.Vector3(rotaposx, 0, rotaposz)); vexlist.push(new THREE.Vector3(rotaposx, 0, rotaposz));
for (let m=sectionlist.sections.datalist[data.body[i].sectionCode].rail.length-1; m>=0; m--) { for (let m=sectionlist.sections.datalist[data.body[i].sectionCode].rail.length-1; m>=0; m--) {
@ -347,7 +348,6 @@ export function Jl3dDriving(jlmap3d) {
} }
} }
} }
trainlisttest.list[code].status = '03'; trainlisttest.list[code].status = '03';
} }
@ -355,10 +355,19 @@ export function Jl3dDriving(jlmap3d) {
trainlisttest.list[code].isStandTrack = sectionlist.sections.datalist[data.body[i].sectionCode].isStandTrack; trainlisttest.list[code].isStandTrack = sectionlist.sections.datalist[data.body[i].sectionCode].isStandTrack;
trainlisttest.list[code].progress = 0; trainlisttest.list[code].progress = 0;
trainlisttest.list[code].len = sectionlist.sections.datalist[data.body[i].sectionCode].distance; trainlisttest.list[code].len = sectionlist.sections.datalist[data.body[i].sectionCode].distance;
trainlisttest.list[code].speed = data.body[i].speed;
if(data.body[i].speed == 0){
trainlisttest.list[code].speeds = data.body[i].speed;
trainlisttest.list[code].speeds = 0;
// trainlisttest.list[code].startmark = 1;
}else{
trainlisttest.list[code].speeds = data.body[i].speed;
trainlisttest.list[code].speeds = parseFloat(data.body[i].speed*10/36/20/trainlisttest.list[code].len); trainlisttest.list[code].speeds = parseFloat(data.body[i].speed*10/36/20/trainlisttest.list[code].len);
} }
}
} else if (trainlisttest.list[code].dispose != data.body[i].dispose && data.body[i].dispose == true) { } else if (trainlisttest.list[code].dispose != data.body[i].dispose && data.body[i].dispose == true) {
trainlisttest.group.remove(trainlisttest.list[code]); trainlisttest.group.remove(trainlisttest.list[code]);
trainlisttest.list[code].progress = null; trainlisttest.list[code].progress = null;

View File

@ -4,11 +4,12 @@ export function UpdateTrain(camera,traindata,control){
for(let j=traindata.group.children.length-1;j>=0;j--){ for(let j=traindata.group.children.length-1;j>=0;j--){
//判断是否有移动事件 //判断是否有移动事件
if(traindata.group.children[j].dispose == false){ //if(traindata.group.children[j].dispose == false){
if(traindata.group.children[j].progress != null){ if(traindata.group.children[j].progress != null){
let trainmodel = traindata.group.children[j]; let trainmodel = traindata.group.children[j];
if(trainmodel.speeds > 0 && trainmodel.speeds){ if(trainmodel.speeds > 0 && trainmodel.speeds){
let speed = null; let speed = null;
if(traindata.group.children[j].progress<1){ if(traindata.group.children[j].progress<1){
@ -265,8 +266,10 @@ export function UpdateTrain(camera,traindata,control){
} }
} }
} }
} //}
} }

View File

@ -18,7 +18,7 @@ let defaulttrain = {
deviceType:"train", deviceType:"train",
type:"num4", type:"num4",
picUrl:"", picUrl:"",
assetUrl:"https://joylink.club/oss/models/train/train.FBX" assetUrl:"https://test.joylink.club/oss/models/train/train.FBX"
} }
@ -56,7 +56,7 @@ let defaultsuidao = {
deviceType:"suidao", deviceType:"suidao",
type:"suidao", type:"suidao",
picUrl:"", picUrl:"",
assetUrl:"https://joylink.club/oss/models/suidao/suidao.FBX" assetUrl:"https://test.joylink.club/oss/models/suidao/suidao.FBX"
}//https://joylink.club/oss/models/suidao/suidao.FBX }//https://joylink.club/oss/models/suidao/suidao.FBX
//../../static/model/ //../../static/model/

View File

@ -556,9 +556,14 @@ THREE.FBXLoader = ( function () {
} }
if ( materialNode.Opacity ) { if ( materialNode.Opacity ) {
if(materialNode.Opacity.value<1 && materialNode.Opacity.value>0.9){
parameters.side = THREE.DoubleSide;
parameters.transparent = true;
parameters.alphaTest = 0.7;
parameters.opacity = 1;
}else{
parameters.opacity = parseFloat( materialNode.Opacity.value ); parameters.opacity = parseFloat( materialNode.Opacity.value );
}
} }
if ( parameters.opacity < 1.0 ) { if ( parameters.opacity < 1.0 ) {

View File

@ -99,11 +99,23 @@ export function StationStandList() {
textt.dispose(); textt.dispose();
}else{ }else{
for(let netnum =0;netnum <netstand.length;netnum++){
if(netstand[netnum].code == k ){
for(let j=0;j<assetloader.modellist.length;j++){ for(let j=0;j<assetloader.modellist.length;j++){
if(assetloader.modellist[j].id == netstand[map[k].index].modelid){ if(assetloader.modellist[j].id == netstand[netnum].modelid){
num = j; num = j;
map[k].index = netnum;
j = assetloader.modellist.length;
} }
} }
netnum = netstand.length;
}
}
map[k].mesh = assetloader.modellist[num].mesh.clone(true); map[k].mesh = assetloader.modellist[num].mesh.clone(true);
let newclip = assetloader.modellist[num].mesh.animations[ 0 ]; let newclip = assetloader.modellist[num].mesh.animations[ 0 ];

View File

@ -14,14 +14,13 @@ export function TrainList() {
this.initpromise = function(data,scene,assetloader,mixers,actionss){ this.initpromise = function(data,scene,assetloader,mixers,actionss){
return new Promise(function(resolve, reject){ return new Promise(function(resolve, reject){
//遍历列车数据 //遍历列车数据
for(let i=0;i<data.length;i++){ for(let i=0;i<data.length;i++){
let newmesh,ntracks1,ntracks2,tclip,fclip; let newmesh,ntracks1,ntracks2,tclip,fclip;
for(let n=assetloader.modellist.length-1;n>=0;n--){ for(let n=assetloader.modellist.length-1;n>=0;n--){
if(assetloader.modellist[n].deviceType == "train"){ if(assetloader.modellist[n].deviceType == "train"){
newmesh = assetloader.modellist[n].mesh.clone(true); newmesh = assetloader.modellist[n].mesh.clone(true);
ntracks1 = assetloader.modellist[n].animations.slice(24,52); ntracks1 = assetloader.modellist[n].animations.slice(24,52);
@ -152,6 +151,7 @@ export function TrainList() {
newmesh.speed = 0; newmesh.speed = 0;
newmesh.speeds = 0; newmesh.speeds = 0;
newmesh.progress = null; newmesh.progress = null;
newmesh.startmark = 0;
scope.list[data[i].code] = newmesh; scope.list[data[i].code] = newmesh;

View File

@ -59,7 +59,7 @@ export default {
prop: 'mobile' prop: 'mobile'
}, },
{ {
title: this.$t('system.global.email'), title: this.$t('global.email'),
prop: 'email' prop: 'email'
}, },
{ {

View File

@ -184,8 +184,8 @@ export default {
} else { } else {
this.$router.push({ path: `${path}` }); this.$router.push({ path: `${path}` });
} }
}).catch(res => { }).catch(error => {
this.$messageBox('保存规则失败'); this.$messageBox(`保存规则失败: ${error.message}`);
}); });
}, },
addRuleList(data) { addRuleList(data) {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 228 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 254 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

View File

Before

Width:  |  Height:  |  Size: 117 KiB

After

Width:  |  Height:  |  Size: 117 KiB

View File

Before

Width:  |  Height:  |  Size: 394 KiB

After

Width:  |  Height:  |  Size: 394 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 544 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 612 KiB