This commit is contained in:
joylink_cuiweidong 2020-06-09 17:54:28 +08:00
commit 56eae6302a
17 changed files with 224 additions and 34 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,7 @@
import Group from 'zrender/src/container/Group'; import Group from 'zrender/src/container/Group';
import Line from 'zrender/src/graphic/shape/Line'; import Line from 'zrender/src/graphic/shape/Line';
import Polygon from 'zrender/src/graphic/shape/Polygon';
import JTriangle from '../utils/JTriangle';
export default class line extends Group { export default class line extends Group {
constructor(device) { constructor(device) {
@ -36,6 +38,60 @@ export default class line extends Group {
if (model.classify == 'dashed') { if (model.classify == 'dashed') {
this.iscsLine.setStyle('lineDash', [8, 6]); this.iscsLine.setStyle('lineDash', [8, 6]);
} }
if (model.arrowShow == 'star') {
const traingle = new JTriangle(this.model.point1, this.model.point2);
let rotation = Math.PI * 2 - Math.atan2(traingle.absy, traingle.absx) * traingle.drictx * traingle.dricty;
if (this.model.point1.x >= this.model.point2.x) {
rotation += Math.PI;
}
this.arrows = new Polygon({
zlevel: model.zlevel,
z: model.z,
origin: [0, 0],
rotation: rotation,
shape: {
points: [
[0, 0],
[model.arrowSize * 2.8, -model.arrowSize],
[model.arrowSize * 2.8, model.arrowSize]
],
smooth: 0
},
style: {
lineWidth: 0,
fill: model.fillColor
}
});
this.grouper.add(this.arrows);
} else if (model.arrowShow == 'end') {
const traingle = new JTriangle(this.model.point2, this.model.point1);
let rotation = Math.PI * 2 - Math.atan2(traingle.absy, traingle.absx) * traingle.drictx * traingle.dricty;
if (this.model.point1.x <= this.model.point2.x) {
rotation += Math.PI;
}
const x = model.point2.x - model.point1.x;
const y = model.point2.y - model.point1.y;
this.arrows = new Polygon({
zlevel: model.zlevel,
z: model.z,
origin: [x, y],
rotation: rotation,
shape: {
points: [
[x, y],
[x + model.arrowSize * 2.8, y - model.arrowSize],
[x + model.arrowSize * 2.8, y + model.arrowSize]
],
smooth: 0
},
style: {
lineWidth: 0,
fill: model.fillColor
}
});
this.grouper.add(this.arrows);
}
this.grouper.add(this.iscsLine); this.grouper.add(this.iscsLine);
this.add(this.grouper); this.add(this.grouper);
} }

View File

@ -0,0 +1,73 @@
/** 三角函数计算 */
function JTriangle(beg, end) {
this.init(beg, end);
}
JTriangle.prototype = {
constructor: JTriangle,
beg: null,
end: null,
abspowx: 0,
abspowy: 0,
abspowz: 0,
drictx: 0,
dricty: 0,
drict: 0,
init (beg, end) {
this.beg = beg;
this.end = end;
this.abspowx = Math.pow(this.end.x - this.beg.x, 2);
this.abspowy = Math.pow(this.end.y - this.beg.y, 2);
this.abspowz = this.abspowx + this.abspowy;
this.absx = Math.abs(this.end.x - this.beg.x);
this.absy = Math.abs(this.end.y - this.beg.y);
this.absz = Math.sqrt(Math.pow(this.end.x - this.beg.x, 2), Math.pow(this.end.y - this.beg.y, 2));
this.drictx = this.end.x > this.beg.x ? 1 : -1;
this.dricty = this.end.y > this.beg.y ? 1 : -1;
this.drict = this.drictx * this.dricty;
this.diff_x = end.x - beg.x;
this.diff_y = end.y - beg.y;
},
getRotation () {
return Math.atan(this.diff_y / this.diff_x);
},
getAngle () {
return 360 * Math.atan(this.diff_y / this.diff_x) / (2 * Math.PI);
},
getCos (n) {
return this.drictx * Math.sqrt(Math.pow(n, 2) * this.abspowx / this.abspowz);
},
getSin (n) {
return this.dricty * Math.sqrt(Math.pow(n, 2) * this.abspowy / this.abspowz);
},
getAbsCos(n) {
return Math.sqrt(Math.pow(n, 2) * this.abspowx / this.abspowz);
},
getAbsSin(n) {
return Math.sqrt(Math.pow(n, 2) * this.abspowy / this.abspowz);
},
getCosRate () {
return Math.sqrt(this.abspowx / this.abspowz);
},
getSinRate () {
return Math.sqrt(this.abspowy / this.abspowz);
},
getTanRate () {
var diff_x = this.end.x - this.beg.x;
var diff_y = this.end.y - this.beg.y;
return Math.abs(diff_y / diff_x);
},
getCotRate () {
var diff_x = this.end.x - this.beg.x;
var diff_y = this.end.y - this.beg.y;
return Math.abs(diff_x / diff_y);
},
middlePoint () {
return {
x: Math.min(this.end.x, this.beg.x) + Math.abs(this.end.x - this.beg.x) / 2,
y: Math.min(this.end.y, this.beg.y) + Math.abs(this.end.y - this.beg.y) / 2
};
}
};
export default JTriangle;

View File

@ -7,8 +7,6 @@ export function PassflowConnect(jl3dpass,deviceaction,toptrain,downtrain,routegr
const scope = this; const scope = this;
this.teststomp = new StompClient(); this.teststomp = new StompClient();
let traintopnow = null;
let traindownnow = null;
let topic = '/user/queue/simulation/jl3d/'+routegroup; let topic = '/user/queue/simulation/jl3d/'+routegroup;
let header = {'X-Token': getToken() }; let header = {'X-Token': getToken() };
@ -40,6 +38,7 @@ export function PassflowConnect(jl3dpass,deviceaction,toptrain,downtrain,routegr
deviceaction.top.action.timeScale = -1; deviceaction.top.action.timeScale = -1;
deviceaction.top.action.play(); deviceaction.top.action.play();
}else{ }else{
jl3dpass.passerout("top")
deviceaction.top.action.reset(); deviceaction.top.action.reset();
deviceaction.top.action.time = 0; deviceaction.top.action.time = 0;
deviceaction.top.action.timeScale = 1; deviceaction.top.action.timeScale = 1;
@ -53,6 +52,7 @@ export function PassflowConnect(jl3dpass,deviceaction,toptrain,downtrain,routegr
deviceaction.down.action.timeScale = -1; deviceaction.down.action.timeScale = -1;
deviceaction.down.action.play(); deviceaction.down.action.play();
}else{ }else{
jl3dpass.passerout("down");
deviceaction.down.action.reset(); deviceaction.down.action.reset();
deviceaction.down.action.time = 0; deviceaction.down.action.time = 0;
deviceaction.down.action.timeScale = 1; deviceaction.down.action.timeScale = 1;
@ -62,25 +62,25 @@ export function PassflowConnect(jl3dpass,deviceaction,toptrain,downtrain,routegr
} }
} }
if(data.body.type == "TRAIN_DOOR"){ if(data.body.type == "TRAIN_DOOR"){
if(traintopnow == data.body.code){ if(toptrain.nowcode == data.body.code){
if(data.body.open == "0"){ if(data.body.open == "0"){
closetraindoor(toptrain,data.body.doorCode,"top"); closetraindoor(toptrain,data.body.doorCode,"top");
}else{ }else{
opentraindoor(toptrain,data.body.doorCode,"top"); opentraindoor(toptrain,data.body.doorCode,"top");
jl3dpass.passerout("top"); ;
} }
} }
if(traindownnow == data.body.code){ if(downtrain.nowcode == data.body.code){
// console.log(data.body); // console.log(data.body);
if(data.body.open == "0"){ if(data.body.open == "0"){
closetraindoor(downtrain,data.body.doorCode,"down"); closetraindoor(downtrain,data.body.doorCode,"down");
}else{ }else{
opentraindoor(downtrain,data.body.doorCode,"down"); opentraindoor(downtrain,data.body.doorCode,"down");
jl3dpass.passerout("down");
} }
} }
@ -91,8 +91,8 @@ export function PassflowConnect(jl3dpass,deviceaction,toptrain,downtrain,routegr
for(let i=0,leni = data.body.length;i<leni;i++){ for(let i=0,leni = data.body.length;i<leni;i++){
if(data.body[i].section == jl3dpass.nowstation.topsection){ if(data.body[i].section == jl3dpass.nowstation.topsection){
if(traintopnow != data.body[i].code){ if(toptrain.nowcode != data.body[i].code){
traintopnow = data.body[i].code; toptrain.nowcode = data.body[i].code;
} }
toptrain.position.copy(toptrain.curve.getPointAt(data.body[i].offset)); toptrain.position.copy(toptrain.curve.getPointAt(data.body[i].offset));
@ -101,20 +101,20 @@ export function PassflowConnect(jl3dpass,deviceaction,toptrain,downtrain,routegr
// //
// } // }
}else{ }else{
if(traindownnow == data.body[i].code){ if(downtrain.nowcode == data.body[i].code){
toptrain.position.x -= 1; toptrain.position.x -= 1;
} }
} }
if(data.body[i].section == jl3dpass.nowstation.downsection){ if(data.body[i].section == jl3dpass.nowstation.downsection){
if(traindownnow != data.body[i].code){ if(downtrain.nowcode != data.body[i].code){
traindownnow = data.body[i].code; downtrain.nowcode = data.body[i].code;
} }
downtrain.position.copy(downtrain.curve.getPointAt(data.body[i].offset)); downtrain.position.copy(downtrain.curve.getPointAt(data.body[i].offset));
}else{ }else{
if(traindownnow == data.body[i].code){ if(downtrain.nowcode == data.body[i].code){
downtrain.position.x += 1; downtrain.position.x += 1;
} }
} }
@ -151,26 +151,23 @@ export function PassflowConnect(jl3dpass,deviceaction,toptrain,downtrain,routegr
} }
} }
function closetraindoor(train,doorcode,direct){ function closetraindoor(train,doorcode,direct){
if(direct == "top"){ if(direct == "top"){
if(doorcode == "1"){ if(doorcode == "1"){
actions = train.action.down; actions = train.action.down;
} }
if(doorcode == "2"){ if(doorcode == "2"){
actions = train.action.top; actions = train.action.top;
} }
toptrain.nowcode = null;
}else{ }else{
if(doorcode == "1"){ if(doorcode == "1"){
actions = train.action.top; actions = train.action.top;
} }
if(doorcode == "2"){ if(doorcode == "2"){
actions = train.action.down; actions = train.action.down;
} }
downtrain.nowcode = null;
} }
for(let an=actions.length-1;an>=0;an--){ for(let an=actions.length-1;an>=0;an--){

View File

@ -482,6 +482,9 @@ export function Jl3dpassflow(dom,skinCode,routegroup) {
//下车控制开关 //下车控制开关
toppasseron = false; toppasseron = false;
downpasseron = false; downpasseron = false;
toptrain.nowcode = null;
downtrain.nowcode = null;
// humanlist = new THREE.Group(); // humanlist = new THREE.Group();
for(let j=0; j<humanlist.children.length;j++){ for(let j=0; j<humanlist.children.length;j++){
// scope.uncache(humanlist.children[j]); // scope.uncache(humanlist.children[j]);
@ -520,7 +523,6 @@ export function Jl3dpassflow(dom,skinCode,routegroup) {
// actions[an].timeScale = -1; // actions[an].timeScale = -1;
// actions[an].play(); // actions[an].play();
// } // }
setTimeout
setTimeout(function(){ setTimeout(function(){
initpasser(); initpasser();
aiswitch = 0; aiswitch = 0;
@ -995,6 +997,9 @@ export function Jl3dpassflow(dom,skinCode,routegroup) {
newhuman.stage = stage; newhuman.stage = stage;
if(direct){ if(direct){
if(direct == "top"){
newhuman.rotation.y = Math.PI;
}
newhuman.direct = direct; newhuman.direct = direct;
}else{ }else{
newhuman.direct = null; newhuman.direct = null;
@ -1081,6 +1086,7 @@ export function Jl3dpassflow(dom,skinCode,routegroup) {
toptrain = object.clone(true); toptrain = object.clone(true);
toptrain.nowcode = null;
toptrain.action = { toptrain.action = {
top:[], top:[],
down:[] down:[]
@ -1093,6 +1099,7 @@ export function Jl3dpassflow(dom,skinCode,routegroup) {
toptrain.curve = new THREE.CatmullRomCurve3(points1); toptrain.curve = new THREE.CatmullRomCurve3(points1);
downtrain = object.clone(true); downtrain = object.clone(true);
downtrain.nowcode = null;
downtrain.action = { downtrain.action = {
top:[], top:[],
down:[] down:[]

View File

@ -5,7 +5,7 @@
<el-input v-model="form.code" :disabled="true" /> <el-input v-model="form.code" :disabled="true" />
</el-form-item> </el-form-item>
<el-form-item label="图形宽度" prop="width"> <el-form-item label="图形宽度" prop="width">
<el-input-number v-model="form.width" :min="40" /> <el-input-number v-model="form.width" :min="20" />
</el-form-item> </el-form-item>
<el-form-item label="X轴坐标" prop="x"> <el-form-item label="X轴坐标" prop="x">
<el-input-number v-model="form.x" controls-position="right" :min="1" /> <el-input-number v-model="form.x" controls-position="right" :min="1" />

View File

@ -5,7 +5,7 @@
<el-input v-model="form.code" :disabled="true" /> <el-input v-model="form.code" :disabled="true" />
</el-form-item> </el-form-item>
<el-form-item label="图形宽度" prop="width"> <el-form-item label="图形宽度" prop="width">
<el-input-number v-model="form.width" :min="15" /> <el-input-number v-model="form.width" :min="10" />
</el-form-item> </el-form-item>
<el-form-item label="方向" prop="direction"> <el-form-item label="方向" prop="direction">
<el-select v-model="form.direction" placeholder="请选择类型"> <el-select v-model="form.direction" placeholder="请选择类型">

View File

@ -8,10 +8,7 @@
<el-input-number v-model="form.width" :min="15" /> <el-input-number v-model="form.width" :min="15" />
</el-form-item> </el-form-item>
<el-form-item label="旋转角度" prop="rotateAngle"> <el-form-item label="旋转角度" prop="rotateAngle">
<el-select v-model="form.rotateAngle" placeholder="请选择类型"> <el-input-number v-model="form.rotateAngle" />
<el-option label="0度" value="0" />
<el-option label="90度" value="90" />
</el-select>
</el-form-item> </el-form-item>
<el-form-item label="X轴坐标" prop="x"> <el-form-item label="X轴坐标" prop="x">
<el-input-number v-model="form.x" controls-position="right" :min="1" /> <el-input-number v-model="form.x" controls-position="right" :min="1" />
@ -39,7 +36,7 @@ export default {
buttonText: '立即创建', buttonText: '立即创建',
form:{ form:{
code:'', code:'',
rotateAngle:'0', rotateAngle: 0,
width: 20, width: 20,
x: 10, x: 10,
y: 10 y: 10
@ -76,7 +73,7 @@ export default {
this.form.width = model.width; this.form.width = model.width;
this.form.x = model.point.x; this.form.x = model.point.x;
this.form.y = model.point.y; this.form.y = model.point.y;
this.form.rotateAngle = model.rotateAngle; this.form.rotateAngle = model.rotateAngle || 0;
} }
} }
}, },
@ -112,7 +109,7 @@ export default {
this.showDeleteButton = false; this.showDeleteButton = false;
this.form = { this.form = {
code:'', code:'',
rotateAngle:'0', rotateAngle: 0,
width: 20, width: 20,
x: 10, x: 10,
y: 10 y: 10

View File

@ -13,6 +13,16 @@
<el-form-item label="线段颜色" prop="fillColor"> <el-form-item label="线段颜色" prop="fillColor">
<el-color-picker v-model="form.fillColor" /> <el-color-picker v-model="form.fillColor" />
</el-form-item> </el-form-item>
<el-form-item label="箭头显示" prop="arrowShow">
<el-select v-model="form.arrowShow" placeholder="请选择">
<el-option label="无" value="none" />
<el-option label="始端" value="star" />
<el-option label="终端" value="end" />
</el-select>
</el-form-item>
<el-form-item v-if="form.arrowShow != 'none'" label="箭头大小" prop="arrowSize">
<el-input-number v-model="form.arrowSize" controls-position="right" :min="1" />
</el-form-item>
<el-form-item label="起始X轴坐标"> <el-form-item label="起始X轴坐标">
<el-input-number v-model="form.x1" controls-position="right" :min="0" /> <el-input-number v-model="form.x1" controls-position="right" :min="0" />
</el-form-item> </el-form-item>
@ -49,6 +59,8 @@ export default {
code: '', code: '',
lineWidth: '', lineWidth: '',
fillColor: '#fff', fillColor: '#fff',
arrowShow: 'none',
arrowSize: 5,
x1: 10, x1: 10,
y1: 10, y1: 10,
x2: 20, x2: 20,
@ -84,6 +96,8 @@ export default {
this.form.x2 = model.point2.x; this.form.x2 = model.point2.x;
this.form.y2 = model.point2.y; this.form.y2 = model.point2.y;
this.form.classify = model.classify; this.form.classify = model.classify;
this.form.arrowShow = model.arrowShow || 'none';
this.form.arrowSize = model.arrowSize || 5;
} }
} }
}, },
@ -105,7 +119,9 @@ export default {
_type: 'IscsLine', _type: 'IscsLine',
lineWidth: this.form.lineWidth, lineWidth: this.form.lineWidth,
fillColor: this.form.fillColor, fillColor: this.form.fillColor,
classify:this.form.classify classify: this.form.classify,
arrowShow: this.form.arrowShow,
arrowSize: this.form.arrowSize
}; };
this.$emit('createDataModel', lineModel); this.$emit('createDataModel', lineModel);
this.initPage(); this.initPage();
@ -128,7 +144,9 @@ export default {
_type: 'IscsLine', _type: 'IscsLine',
lineWidth: this.form.lineWidth, lineWidth: this.form.lineWidth,
fillColor: this.form.fillColor, fillColor: this.form.fillColor,
classify:this.form.classify classify: this.form.classify,
arrowShow: this.form.arrowShow,
arrowSize: this.form.arrowSize
}; };
this.$emit('deleteDataModel', lineModel); this.$emit('deleteDataModel', lineModel);
}, },
@ -140,6 +158,8 @@ export default {
code: '', code: '',
lineWidth: '', lineWidth: '',
fillColor: '#fff', fillColor: '#fff',
arrowShow: 'none',
arrowSize: 5,
x1: 10, x1: 10,
y1: 10, y1: 10,
x2: 20, x2: 20,

View File

@ -0,0 +1,35 @@
<template>
<div class="bigSystemBox">
<div class="title-name">{{ $route.query.stationName }}机电隧道通风</div>
<div class="">
<iscsSystem ref="iscsPlate" :width-canvas="1300" :canvas-height="700" />
</div>
</div>
</template>
<script>
import iscsSystem from '../canvas/iscsCanvas';
export default {
components: {
iscsSystem
},
data() {
return {
};
},
mounted() {
this.$refs.iscsPlate.show('28');
},
methods: {
}
};
</script>
<style lang="scss" scoped>
.title-name{
width: 100%;
text-align: center;
font-size: 26px;
margin-top: 30px;
color: #56E5DE;
}
</style>

View File

@ -109,7 +109,7 @@ export default {
title: '', title: '',
meaning: '', meaning: '',
width: '480px', width: '480px',
doubleRowList: ['bigSystem', 'waterSystem'] doubleRowList: ['bigSystem', 'waterSystem', 'tunnelVentilation']
}; };
}, },
computed: { computed: {
@ -144,6 +144,7 @@ export default {
break; break;
case 'bigSystem': case 'bigSystem':
case 'waterSystem': case 'waterSystem':
case 'tunnelVentilation' :
this.title = 'BAS通风空调图元详情'; this.title = 'BAS通风空调图元详情';
this.width = '600px'; this.width = '600px';
this.tableData = this.basData; this.tableData = this.basData;

View File

@ -30,6 +30,8 @@
<lighting-system v-else-if="mode === 'lighting'" /> <lighting-system v-else-if="mode === 'lighting'" />
<electric-escalator v-else-if="mode === 'electricEscalator'" /> <electric-escalator v-else-if="mode === 'electricEscalator'" />
<water-supply v-else-if="mode === 'waterSupply'" /> <water-supply v-else-if="mode === 'waterSupply'" />
<tunnel-ventilation v-else-if="mode === 'tunnelVentilation'" />
<graphic-ele ref="graphicEle" /> <graphic-ele ref="graphicEle" />
<device-control ref="deviceControl" /> <device-control ref="deviceControl" />
</div> </div>
@ -68,6 +70,7 @@ import GraphicEle from './graphicEle';
import DeviceControl from './deviceControl'; import DeviceControl from './deviceControl';
import ElectricEscalator from './bas/electricEscalator'; import ElectricEscalator from './bas/electricEscalator';
import WaterSupply from './bas/waterSupply'; import WaterSupply from './bas/waterSupply';
import TunnelVentilation from './bas/tunnelVentilation';
export default { export default {
components: { components: {
@ -102,7 +105,8 @@ export default {
waterSystem, waterSystem,
LightingSystem, LightingSystem,
ElectricEscalator, ElectricEscalator,
WaterSupply WaterSupply,
TunnelVentilation
}, },
data() { data() {
return { return {

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.