Merge remote-tracking branch 'origin/test'

This commit is contained in:
sheng 2020-05-10 21:48:36 +08:00
commit 4b2871b8d1
454 changed files with 20342 additions and 9896 deletions

View File

@ -6,7 +6,7 @@ NODE_ENV = 'development'
# VUE_APP_BASE_API = 'https://joylink.club/jlcloud' # VUE_APP_BASE_API = 'https://joylink.club/jlcloud'
# VUE_APP_BASE_API = 'http://192.168.3.4:9000' # VUE_APP_BASE_API = 'http://192.168.3.4:9000'
VUE_APP_BASE_API = 'http://192.168.3.6:9000' VUE_APP_BASE_API = 'http://192.168.3.6:9000'
VUE_VOICE_API = 'https://test.joylink.club' VUE_APP_VOICE_API = 'https://test.joylink.club'
# vue-cli uses the VUE_CLI_BABEL_TRANSPILE_MODULES environment variable, # vue-cli uses the VUE_CLI_BABEL_TRANSPILE_MODULES environment variable,
# to control whether the babel-plugin-dynamic-import-node plugin is enabled. # to control whether the babel-plugin-dynamic-import-node plugin is enabled.

View File

@ -4,4 +4,4 @@ VUE_APP_PRO = 'local'
# base api # base api
VUE_APP_BASE_API = 'https://joylink.club/jlcloud' VUE_APP_BASE_API = 'https://joylink.club/jlcloud'
VUE_VOICE_API = 'https://joylink.club' VUE_APP_VOICE_API = 'https://joylink.club'

View File

@ -3,4 +3,4 @@ NODE_ENV = 'production'
# base api # base api
VUE_APP_BASE_API = 'https://joylink.club/jlcloud' VUE_APP_BASE_API = 'https://joylink.club/jlcloud'
VUE_VOICE_API = 'https://joylink.club' VUE_APP_VOICE_API = 'https://joylink.club'

View File

@ -3,4 +3,4 @@ NODE_ENV = 'test'
# base api # base api
VUE_APP_BASE_API = 'https://test.joylink.club/jlcloud' VUE_APP_BASE_API = 'https://test.joylink.club/jlcloud'
VUE_VOICE_API = 'https://test.joylink.club' VUE_APP_VOICE_API = 'https://test.joylink.club'

View File

@ -310,3 +310,12 @@ export function getSimulationConversationIdNew(params, group) {
params: params params: params
}); });
} }
// 获取、微信仿真聊天接口(新版地图)
export function uploadAudioFileNew (group, lang, per, conversationId, file) {
return request({
url: `/simulation/${group}/wx/chat?conversationId=${conversationId}&lang=${lang}&per=${per}`,
method: 'post',
data: file
});
}

View File

@ -89,14 +89,14 @@ export function putMapOffLine(mapId) {
}); });
} }
/** 修改发布地图名称*/ // /** 修改发布地图名称*/
export function updatePublishMapName(data) { // export function updatePublishMapName(data) {
return request({ // return request({
url: `/api/map/${data.mapId}/updateName`, // url: `/api/map/${data.mapId}/updateName`,
method: 'put', // method: 'put',
data: data // data: data
}); // });
} // }
// 检测地图名称唯一性 // 检测地图名称唯一性
export function checkMapName(name) { export function checkMapName(name) {
@ -123,10 +123,19 @@ export function hasDoorStationList(mapId) {
}); });
} }
/** 修改发布地图城市*/ // /** 修改发布地图城市*/
export function updatePublishMapCity(data) { // export function updatePublishMapCity(data) {
// return request({
// url: `/api/map/${data.mapId}/city`,
// method: 'put',
// data: data
// });
// }
// 修改地图基本信息
export function updatePublishMapInfo(data) {
return request({ return request({
url: `/api/map/${data.mapId}/city`, url: `/api/map/${data.mapId}/info`,
method: 'put', method: 'put',
data: data data: data
}); });

View File

@ -247,6 +247,66 @@ export function updateRouting(data) {
}); });
} }
/** 分页查询交路数据(新版)*/
export function listRoutingData(mapId, params) {
return request({
url: `/api/mapBuild/${mapId}/routingData`,
method: 'get',
params: params
});
}
/** 创建交路(新版)*/
export function addRoutingData(data) {
return request({
url: `/api/mapBuild/routingData`,
method: 'post',
data: data
});
}
/** 删除交路(新版)*/
export function deleteRoutingData(routingId) {
return request({
url: `/api/mapBuild/routingData/${routingId}`,
method: 'delete'
});
}
/** 获取交路详情(新版)*/
export function getRoutingData(routingId) {
return request({
url: `/api/mapBuild/routingData/${routingId}`,
method: 'get'
});
}
/** 生成交路区段数据(新版)*/
export function gernateRoutingSection(data) {
return request({
url: `/api/mapBuild/routingData/generate`,
method: 'PUT',
data: data
});
}
/** 更新交路(新版)*/
export function updateRoutingData(data) {
return request({
url: `/api/mapBuild/routingData/${data.id}`,
method: 'put',
data: data
});
}
/** 根据地图交路区段生成站间运行等级(新版)*/
export function generateStationRunData(routingId) {
return request({
url: `/api/draftMap/runLevel/generate/routing/${routingId}`,
method: 'post'
});
}
// 创建自动信号 old旧数据 // 创建自动信号 old旧数据
export function postAutoSignal(data) { export function postAutoSignal(data) {
return request({ return request({
@ -575,3 +635,10 @@ export function getStationParkTimeList(mapId, params) {
params params
}); });
} }
/** 删除原有连锁关系,生成新联锁数据 */
export function generateCI (mapId) {
return request({
url: `/api/mapBuild/${mapId}/ci/generateAndSave`,
method: 'post'
});
}

View File

@ -388,6 +388,14 @@ export function postGenerateLevel(data) {
}); });
} }
/** 根据地图交路一键生成生成所有站间运行等级 (新版)*/
export function generateAllStationRunData(mapId) {
return request({
url: `/api/draftMap/runLevel/generate/routing?mapId=${mapId}`,
method: 'post'
});
}
// 新建站间运行等级 // 新建站间运行等级
export function postSaveLevel(data) { export function postSaveLevel(data) {
return request({ return request({

Binary file not shown.

After

Width:  |  Height:  |  Size: 330 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 705 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 999 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 825 B

View File

@ -0,0 +1,336 @@
<template>
<div v-show="show" class="pop-menu pop_menu_tip" :style="{ height: height, left: tPosition.x+'px', top: tPosition.y+'px' }">
<div v-if="tipMsg" class="tip-top" :style="{textAlign: textAlign}">
<div>{{ tipMsg }}</div>
<div>{{ tipSubhead }}</div>
</div>
<div v-for="(item, index) in menu" :key="index" class="" :style="{ width: width }">
<div v-if="item.children">
<el-popover
placement="right-start"
trigger="hover"
:style="{width: calculateSubWidth(item)}"
class="custom-popover"
:popper-class="popClass"
:offset="0"
:close-delay="50"
:visible-arrow="false"
>
<ul
style="list-style: none; margin: 0px; padding: 0px; padding-right:0px; border-radius:0px;"
>
<li v-for="(child, idx) in item.children" :key="idx" class="hover-popover">
<template v-if="child.type === 'separator'">
<div class="separator">&ensp;</div>
</template>
<template v-else>
<el-button
v-if="isShow(child)"
type="text"
class="dsp-block"
:style="{color:checkIfDisabled(child)? '': 'black'}"
:disabled="checkIfDisabled(child)"
@click="child.handler(child)"
>{{ child.label }}</el-button>
</template>
</li>
</ul>
<template v-if="item.type === 'separator'">
<div class="separator">&ensp;</div>
</template>
<template v-else>
<el-button
v-if="isShow(item)"
slot="reference"
class="dsp-block"
type="text"
:disabled="checkIfDisabled(item)"
>
{{ item.label }}
<i class="el-icon-arrow-right" style="float: right;" />
</el-button>
</template>
</el-popover>
</div>
<div v-else>
<template v-if="item.type === 'separator'">
<div class="separator">&ensp;</div>
</template>
<template v-else>
<template v-if="isShow(item)">
<el-button
v-if="item.type ==='file'"
type="text"
class="uploadDemo"
:disabled="checkIfDisabled(item)"
>
<input
:ref="item.label"
type="file"
class="file_box"
accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"
@change="openLoadFile(item)"
>
{{ item.label }}
</el-button>
<el-button
v-else
id="testId"
class="dsp-block"
type="text"
:disabled="checkIfDisabled(item)"
@click="item.handler"
>
{{ item.label }}
</el-button>
</template>
</template>
</div>
</div>
</div>
</template>
<script>
import { checkRectCollision } from '@/utils/index';
export default {
name: 'PopMenu',
props: {
menu: {
type: Array,
required: true
},
popClass: {
type: String,
default() {
return '';
}
},
tipMsg: {
type: String,
default() {
return '';
}
},
tipSubhead: {
type: String,
default() {
return '';
}
},
textAlign: {
type: String,
default() {
return 'center';
}
}
},
data() {
return {
show: false,
defaultFontSize: 14,
tPosition: {
x: -1000,
y: -1000
},
height: 'auto'
};
},
computed: {
width() {
let fontNum = 0;
let newLabel = '';
this.menu.forEach(elem => {
newLabel = elem.label && elem.label.replace(/[^\u0000-\u00ff]/g, 'aa');
if (elem.label && newLabel.length > fontNum) {
fontNum = newLabel.length;
// fontNum = elem.label.length;
}
});
if (this.tipMsg) {
newLabel = this.tipMsg.replace(/[^\u0000-\u00ff]/g, 'aa');
if (newLabel.length > fontNum) {
fontNum = newLabel.length;
}
}
var width = fontNum / 2 * this.defaultFontSize + 60 + 'px';
// if(this.$t('global.lanuage')==='en'){
// width = fontNum/2 * this.defaultFontSize + 40 + 'px';
// }
return width;
}
},
mounted() {
},
methods: {
resetShowPosition(point) {
if (point) {
this.show = true;
const self = this;
this.$nextTick(() => {
const gutter = 3;
//
const height = self.$el.clientHeight;
const width = self.$el.clientWidth;
let px = 0;
let py = 0;
if (point.x + width > document.documentElement.clientWidth) {
px = document.documentElement.clientWidth - width - gutter;
} else {
px = point.x;
}
if (point.y + height > document.documentElement.clientHeight) {
py = document.documentElement.clientHeight - height - gutter;
} else {
py = point.y;
}
//
const popTipDialog = document.getElementById('pop_tip_dialog');
if (popTipDialog) {
const tipRect = {
point: { x: popTipDialog.offsetLeft, y: popTipDialog.offsetTop },
width: popTipDialog.offsetWidth,
height: popTipDialog.offsetHeight
};
const menuRect = {
point: { x: px, y: py },
width: self.$el.offsetWidth,
height: self.$el.offsetHeight
};
const collision = checkRectCollision(tipRect, menuRect);
//
if (collision) {
px = tipRect.point.x + tipRect.width + gutter;
if (px + width > document.documentElement.clientWidth) {
px = tipRect.point.x - menuRect.width - gutter;
}
}
}
self.tPosition.x = px;
self.tPosition.y = py;
});
}
},
close() {
this.show = false;
// popover
const popoverList = document.getElementsByClassName('el-popover');
for (let i = 0; i < popoverList.length; i++) {
popoverList[i].style.display = 'none';
}
},
checkIfDisabled(menuObj) {
return menuObj.disabled === true;
},
isShow(menuObj) {
if (typeof (menuObj.show) === 'undefined') {
return true;
} else {
return menuObj.show;
}
},
calculateSubWidth(item) {
const children = item.children;
let width = 0;
let fontNum = 0;
children.forEach(elem => {
if (elem.label.length > fontNum) {
fontNum = elem.label.length;
}
});
width = fontNum * this.defaultFontSize + 20 + 'px';
return width;
},
openLoadFile(item) {
const obj = this.$refs[item.label][0];
if (obj.files) {
const file = obj.files[0];
item.handler(file);
obj.value = '';
}
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
$bg: #78e2ad;
$hoverBg: #78e2ad;
.pop-menu {
background-color: $bg;
position: fixed;
padding: 5px 0px;
border: 1px solid gray;
z-index: 9999;
.dsp-block {
display: block;
text-align: left;
width: 100%;
border-radius: unset;
border: 2px solid transparent;
color: #000;
}
.dsp-block:hover {
background-color: $hoverBg;
border-top: 2px solid #fff;
border-left: 2px solid #fff;
border-right: 2px solid #284743;
border-bottom: 2px solid #284743;
}
.tip-top{
width: 100%;
background: #000;
color: #fff;
font-size: 14px;
padding: 2px 15px;
}
}
.hover-popover{
border: 2px solid transparent;
&:hover{
background-color: $hoverBg;
border-top: 2px solid #fff;
border-left: 2px solid #fff;
border-right: 2px solid #284743;
border-bottom: 2px solid #284743;
}
}
.uploadDemo {
position: relative;
overflow: hidden;
width: 100%;
cursor: pointer;
border: 1px solid transparent;
color: #000;
input {
opacity: 0;
cursor: pointer;
position: absolute;
width: 100%;
height: 100%;
}
}
.uploadDemo:hover {
background-color: $hoverBg;
}
.el-button--text {
padding: 6px 15px;
text-align: left;
width: 100%;
}
.separator {
background: gray;
width: 90%;
height: 1px;
margin: 0px 5%;
}
</style>

View File

@ -29,8 +29,20 @@ export default {
const t = e.clientY - disY; const t = e.clientY - disY;
/** 移动当前元素*/ /** 移动当前元素*/
if (l + styL < 0) {
dragDom.style.left = `0px`;
} else if (l + styL > document.body.clientWidth - dragDom.clientWidth - 10) {
dragDom.style.left = `${document.body.clientWidth - dragDom.clientWidth - 10}px`;
} else {
dragDom.style.left = `${l + styL}px`; dragDom.style.left = `${l + styL}px`;
}
if (t + styT < 0) {
dragDom.style.top = `0px`;
} else if (t + styT > document.body.clientHeight - dragDom.clientHeight - 10) {
dragDom.style.top = `${document.body.clientHeight - dragDom.clientHeight - 10}px`;
} else {
dragDom.style.top = `${t + styT}px`; dragDom.style.top = `${t + styT}px`;
}
/** 将此时的位置传出去*/ /** 将此时的位置传出去*/
// binding.value({ x: e.pageX, y: e.pageY }); // binding.value({ x: e.pageX, y: e.pageY });

View File

@ -52,7 +52,8 @@ export default {
exitPlan: 'Exit Plan', exitPlan: 'Exit Plan',
back: 'Back', back: 'Back',
threeDimensionalView: 'Three-Dimensional View', threeDimensionalView: 'Three-Dimensional View',
passengerflow: 'Passenger Flow View', threeDimensionalStation: 'Three-Dimensional Station',
passengerflow: 'CCTV View',
deviceView: 'DeviceView', deviceView: 'DeviceView',
taskOperateSuccess: 'Task Operate success', taskOperateSuccess: 'Task Operate success',
getTimeFail: 'Failed to get time', getTimeFail: 'Failed to get time',

View File

@ -535,6 +535,8 @@ export default {
blockCodingClomn: 'Block coding', blockCodingClomn: 'Block coding',
routing: 'Pay the way', routing: 'Pay the way',
generateStationRunDataSuccess:'Generate station run data success',
generateStationRunDataFailed:'Generate station run data failed',
linkageSwitchList: 'Linkage switch list', linkageSwitchList: 'Linkage switch list',

View File

@ -52,7 +52,8 @@ export default {
exitPlan: '退出计划', exitPlan: '退出计划',
back: '返回', back: '返回',
threeDimensionalView: '三维视图', threeDimensionalView: '三维视图',
passengerflow: '客流量视图', threeDimensionalStation: '三维车站',
passengerflow: 'cctv视图',
deviceView: '设备视图', deviceView: '设备视图',
taskOperateSuccess: '任务操作成功', taskOperateSuccess: '任务操作成功',
getTimeFail: '获取时间失败', getTimeFail: '获取时间失败',

View File

@ -530,6 +530,8 @@ export default {
blockCodingClomn: '区段编码', blockCodingClomn: '区段编码',
routing: '交路', routing: '交路',
generateStationRunDataSuccess:'站间运行数据生成成功',
generateStationRunDataFailed:'站间运行数据生成失败',
linkageSwitchList: '联动道岔列表', linkageSwitchList: '联动道岔列表',

View File

@ -123,12 +123,21 @@ deviceRender[deviceType.FireDamper] = {
zlevel: 1, zlevel: 1,
z: 4 z: 4
}; };
/** 排烟防火阀 */
deviceRender[deviceType.SmookExhaustFd] = {
_type: deviceType.SmookExhaustFd,
zlevel: 1,
z: 4
};
/** 防烟防火阀 */ /** 防烟防火阀 */
deviceRender[deviceType.SmookProofFd] = { deviceRender[deviceType.SmookProofFd] = {
_type: deviceType.SmookProofFd, _type: deviceType.SmookProofFd,
zlevel: 1, zlevel: 1,
z: 4 z: 4
}; };
/** 闸机渲染配置 */ /** 闸机渲染配置 */
deviceRender[deviceType.BrakeMachine] = { deviceRender[deviceType.BrakeMachine] = {
_type: deviceType.BrakeMachine, _type: deviceType.BrakeMachine,
@ -163,7 +172,7 @@ deviceRender[deviceType.AirConditioner] = {
deviceRender[deviceType.VolumeControlDamper] = { deviceRender[deviceType.VolumeControlDamper] = {
_type: deviceType.VolumeControlDamper, _type: deviceType.VolumeControlDamper,
zlevel: 1, zlevel: 1,
z: 4 z: 5
}; };
/** 文字 */ /** 文字 */
deviceRender[deviceType.IscsText] = { deviceRender[deviceType.IscsText] = {
@ -219,6 +228,19 @@ deviceRender[deviceType.ArcStatus] = {
_type: deviceType.ArcStatus, _type: deviceType.ArcStatus,
zlevel: 1, zlevel: 1,
z: 4 z: 4
} };
/** 按钮 */
deviceRender[deviceType.IscsButton] = {
_type: deviceType.IscsButton,
zlevel: 1,
z: 4
};
/** 状态表 */
deviceRender[deviceType.StateTable] = {
_type: deviceType.StateTable,
zlevel: 1,
z: 5
};
export default deviceRender; export default deviceRender;

View File

@ -20,6 +20,7 @@ const deviceType = {
TunnelFan:'TunnelFan', TunnelFan:'TunnelFan',
FireDamper:'FireDamper', FireDamper:'FireDamper',
SmookProofFd:'SmookProofFd', SmookProofFd:'SmookProofFd',
SmookExhaustFd:'SmookExhaustFd',
BrakeMachine: 'BrakeMachine', BrakeMachine: 'BrakeMachine',
EntranceGuard: 'EntranceGuard', EntranceGuard: 'EntranceGuard',
SemiAutomaticTicketMachine: 'SemiAutomaticTicketMachine', SemiAutomaticTicketMachine: 'SemiAutomaticTicketMachine',
@ -33,7 +34,9 @@ const deviceType = {
FasBrakeMachine:'FasBrakeMachine', FasBrakeMachine:'FasBrakeMachine',
Staircase:'Staircase', Staircase:'Staircase',
SingleStaircase: 'SingleStaircase', SingleStaircase: 'SingleStaircase',
ArcStatus: 'ArcStatus' ArcStatus: 'ArcStatus',
IscsButton: 'IscsButton',
StateTable: 'StateTable'
}; };
export default deviceType; export default deviceType;

File diff suppressed because one or more lines are too long

View File

@ -17,8 +17,12 @@ export default class airConditioner extends Group {
position: [this.model.point.x, this.model.point.y] position: [this.model.point.x, this.model.point.y]
}); });
this.path = createPathSvg(this.model); this.path = createPathSvg(this.model);
this.add(this.grouper);
this.grouper.add(this.path); this.grouper.add(this.path);
if (!this.model.isRight) {
this.grouper.origin = [this.model.width / 2, this.model.width * 0.571 / 2];
this.grouper.scale = [-1, -1];
}
this.add(this.grouper);
} }
setModel(dx, dy) { setModel(dx, dy) {
this.model.point.x += dx; this.model.point.x += dx;

View File

@ -31,7 +31,8 @@ export default class chiller extends Group {
}, },
style: { style: {
stroke:this.model.color, stroke:this.model.color,
lineWidth:2 lineWidth:2,
fill:'rgba(0,0,0,0)'
} }
}); });
this.circle1 = new Circle({ this.circle1 = new Circle({

View File

@ -1,8 +1,7 @@
import Group from 'zrender/src/container/Group'; import Group from 'zrender/src/container/Group';
import Polygon from 'zrender/src/graphic/shape/Polygon';
import Polyline from 'zrender/src/graphic/shape/Polyline'; import Polyline from 'zrender/src/graphic/shape/Polyline';
import Circle from 'zrender/src/graphic/shape/Circle'; import Circle from 'zrender/src/graphic/shape/Circle';
export default class smookProofFd extends Group { export default class fireDamper extends Group {
constructor(device) { constructor(device) {
super(); super();
this.model = device.model; this.model = device.model;
@ -17,15 +16,23 @@ export default class smookProofFd extends Group {
id: this.model.code, id: this.model.code,
position: [this.model.point.x, this.model.point.y] position: [this.model.point.x, this.model.point.y]
}); });
this.polygon1 = new Polygon({ const polygonW = this.model.width;
let polygonH = this.model.width / 2;
let cy = this.model.width / 4;
if (this.model.direction == 'vertical') {
polygonH = this.model.width * 2;
cy = this.model.width / 2;
}
this.polygon1 = new Polyline({
zlevel: this.model.zlevel, zlevel: this.model.zlevel,
z: this.model.z, z: this.model.z,
shape:{ shape:{
points:[ points:[
[0, 0], [0, 0],
[this.model.width, 0], [polygonW, 0],
[this.model.width, this.model.width / 2], [polygonW, polygonH],
[0, this.model.width / 2] [0, polygonH],
[0, 0]
] ]
}, },
style: { style: {
@ -37,48 +44,18 @@ export default class smookProofFd extends Group {
zlevel: this.model.zlevel, zlevel: this.model.zlevel,
z: this.model.z, z: this.model.z,
shape:{ shape:{
cx:this.model.width / 2, cx:polygonW / 2,
cy:this.model.width / 4, cy:polygonH / 2,
r:this.model.width / 4 r:cy
},
style: {
stroke:this.model.color,
lineWidth:2
}
});
this.polyline1 = new Polyline({
zlevel: this.model.zlevel,
z: this.model.z,
shape:{
points:[
[0, 0],
[this.model.width, this.model.width / 2]
]
},
style: {
stroke:this.model.color,
lineWidth:2
}
});
this.polyline2 = new Polyline({
zlevel: this.model.zlevel,
z: this.model.z,
shape:{
points:[
[this.model.width, 0],
[0, this.model.width / 2]
]
}, },
style: { style: {
stroke:this.model.color, stroke:this.model.color,
fill:'rgba(0,0,0,0)',
lineWidth:2 lineWidth:2
} }
}); });
this.grouper.add(this.polygon1); this.grouper.add(this.polygon1);
this.grouper.add(this.circle); this.grouper.add(this.circle);
this.grouper.add(this.polyline1);
this.grouper.add(this.polyline2);
this.add(this.grouper); this.add(this.grouper);
} }
setModel(dx, dy) { setModel(dx, dy) {

View File

@ -26,7 +26,8 @@ export default class frozenPump extends Group {
}, },
style: { style: {
stroke: this.model.color, stroke: this.model.color,
lineWidth:2 lineWidth:2,
fill:'rgba(0,0,0,0)'
} }
}); });
this.triangle = new Polygon({ this.triangle = new Polygon({

View File

@ -0,0 +1,97 @@
import Group from 'zrender/src/container/Group';
import Polyline from 'zrender/src/graphic/shape/Polyline';
import Circle from 'zrender/src/graphic/shape/Circle';
export default class smookExhaustFd extends Group {
constructor(device) {
super();
this.model = device.model;
this._type = device.model._type;
this._code = device.model.code;
this.zlevel = device.model.zlevel;
this.z = device.model.zlevel;
this.create();
}
create() {
this.grouper = new Group({
id: this.model.code,
position: [this.model.point.x, this.model.point.y]
});
const polygonW = this.model.width;
let polygonH = this.model.width / 2;
let cy = this.model.width / 4;
if (this.model.direction == 'vertical') {
polygonH = this.model.width * 2;
cy = this.model.width / 2;
}
this.polygon1 = new Polyline({
zlevel: this.model.zlevel,
z: this.model.z,
shape:{
points:[
[0, 0],
[polygonW, 0],
[polygonW, polygonH],
[0, polygonH],
[0, 0]
]
},
style: {
stroke:this.model.color,
lineWidth:2
}
});
this.circle = new Circle({
zlevel: this.model.zlevel,
z: this.model.z,
shape:{
cx:polygonW / 2,
cy:polygonH / 2,
r:cy
},
style: {
stroke:this.model.color,
fill:'rgba(0,0,0,0)',
lineWidth:2
}
});
this.polyline1 = new Polyline({
zlevel: this.model.zlevel,
z: this.model.z,
shape:{
points:[
[0, 0],
[polygonW, polygonH]
]
},
style: {
stroke:this.model.color,
lineWidth:2
}
});
this.polyline2 = new Polyline({
zlevel: this.model.zlevel,
z: this.model.z,
shape:{
points:[
[polygonW, 0],
[0, polygonH]
]
},
style: {
stroke:this.model.color,
lineWidth:2
}
});
this.grouper.add(this.polygon1);
this.grouper.add(this.circle);
this.grouper.add(this.polyline1);
this.grouper.add(this.polyline2);
this.add(this.grouper);
}
setModel(dx, dy) {
this.model.point.x += dx;
this.model.point.y += dy;
}
}

View File

@ -28,7 +28,8 @@ export default class smookProofFd extends Group {
}, },
style: { style: {
stroke:this.model.color, stroke:this.model.color,
lineWidth:2 lineWidth:2,
fill:'rgba(0,0,0,0)'
} }
}); });
this.polyline1 = new Polyline({ this.polyline1 = new Polyline({
@ -86,7 +87,8 @@ export default class smookProofFd extends Group {
}, },
style: { style: {
stroke:this.model.color, stroke:this.model.color,
lineWidth:2 lineWidth:2,
fill:'rgba(0,0,0,0)'
} }
}); });

View File

@ -114,7 +114,12 @@ export default class ventilator extends Group {
this.grouper.add(this.rhombus2); this.grouper.add(this.rhombus2);
this.grouper.add(this.triangle); this.grouper.add(this.triangle);
this.grouper.add(this.line); this.grouper.add(this.line);
if (!this.model.isRight) {
this.grouper.origin = [this.model.width / 2, this.model.width * 1.368 / 2];
this.grouper.scale = [-1, 1];
}
this.add(this.grouper); this.add(this.grouper);
} }
setModel(dx, dy) { setModel(dx, dy) {
this.model.point.x += dx; this.model.point.x += dx;

View File

@ -17,8 +17,10 @@ export default class volumeControlDamper extends Group {
position: [this.model.point.x, this.model.point.y] position: [this.model.point.x, this.model.point.y]
}); });
this.path = createPathSvg(this.model); this.path = createPathSvg(this.model);
this.add(this.grouper);
this.grouper.add(this.path); this.grouper.add(this.path);
this.grouper.origin = [this.model.width / 2, this.model.width * 1.368 / 2];
this.grouper.rotation = Math.PI / 180 * (this.model.rotateAngle || 0);
this.add(this.grouper);
} }
setModel(dx, dy) { setModel(dx, dy) {
this.model.point.x += dx; this.model.point.x += dx;

63
src/iscs/shape/button.js Normal file
View File

@ -0,0 +1,63 @@
import Group from 'zrender/src/container/Group';
import Rect from 'zrender/src/graphic/shape/Rect';
import Text from 'zrender/src/graphic/Text';
export default class Button extends Group {
constructor(device) {
super();
this.model = device.model;
this._type = device.model._type;
this._code = device.model.code;
this.zlevel = device.model.zlevel;
this._function = device.model.function;
this.z = device.model.z;
this.create();
}
create() {
const model = this.model;
this.grouper = new Group({
id: model.code,
position: [model.point.x, model.point.y]
});
this.buttonText = new Text({
zlevel: model.zlevel,
z: model.z + 1,
style: {
x: 0,
y: 0,
fontWeight: 'normal',
fontSize: model.fontSize,
fontFamily: 'consolas',
text: model.context,
textFill: '#FFF',
textAlign: 'center',
textPosition: 'inside',
textVerticalAlign: 'bottom'
}
});
const textRect = this.buttonText.getBoundingRect();
this.buttonText.setStyle('textLineHeight', textRect.height);
this.buttonRect = new Rect({
zlevel: model.zlevel,
z: model.z,
shape: {
x: textRect.x - model.levelPadding,
y: textRect.y - model.verticalPadding,
width: textRect.width + 2 * model.levelPadding,
height: textRect.height + 2 * model.verticalPadding
},
style: {
fill: '#879096',
stroke: '#132E48',
lineWidth: 1
}
});
this.grouper.add(this.buttonRect);
this.grouper.add(this.buttonText);
this.add(this.grouper);
}
setModel(dx, dy) {
this.model.point.x += dx;
this.model.point.y += dy;
}
}

View File

@ -64,6 +64,8 @@ const map = {
export default function createPathSvg(model) { export default function createPathSvg(model) {
const svg = path.createFromString(map[model._type].path, { const svg = path.createFromString(map[model._type].path, {
z:model.z,
zlevel:model.zlevel,
style: { style: {
fill: model.fill || '#00FF00' fill: model.fill || '#00FF00'
} }

View File

@ -34,6 +34,9 @@ import FasBrakeMachine from './fasBrakeMachine';
import Staircase from './staircase'; import Staircase from './staircase';
import SingleStaircase from './singleStaircase'; import SingleStaircase from './singleStaircase';
import ArcStatus from './ArcStatus'; import ArcStatus from './ArcStatus';
import IscsButton from './button';
import SmookExhaustFd from './bas/smookExhaustFd';
import StateTable from './stateTable';
const iscsShape = {}; const iscsShape = {};
iscsShape[deviceType.ManualAlarmButton] = ManualAlarmButton; iscsShape[deviceType.ManualAlarmButton] = ManualAlarmButton;
@ -56,6 +59,7 @@ iscsShape[deviceType.OrbitalVentilator] = OrbitalVentilator;
iscsShape[deviceType.JetFan] = JetFan; iscsShape[deviceType.JetFan] = JetFan;
iscsShape[deviceType.TunnelFan] = TunnelFan; iscsShape[deviceType.TunnelFan] = TunnelFan;
iscsShape[deviceType.FireDamper] = FireDamper; iscsShape[deviceType.FireDamper] = FireDamper;
iscsShape[deviceType.SmookExhaustFd] = SmookExhaustFd;
iscsShape[deviceType.SmookProofFd] = SmookProofFd; iscsShape[deviceType.SmookProofFd] = SmookProofFd;
iscsShape[deviceType.BrakeMachine] = BrakeMachine; iscsShape[deviceType.BrakeMachine] = BrakeMachine;
iscsShape[deviceType.EntranceGuard] = EntranceGuard; iscsShape[deviceType.EntranceGuard] = EntranceGuard;
@ -72,6 +76,8 @@ iscsShape[deviceType.FasBrakeMachine] = FasBrakeMachine;
iscsShape[deviceType.Staircase] = Staircase; iscsShape[deviceType.Staircase] = Staircase;
iscsShape[deviceType.SingleStaircase] = SingleStaircase; iscsShape[deviceType.SingleStaircase] = SingleStaircase;
iscsShape[deviceType.ArcStatus] = ArcStatus; iscsShape[deviceType.ArcStatus] = ArcStatus;
iscsShape[deviceType.IscsButton] = IscsButton;
iscsShape[deviceType.StateTable] = StateTable;
function shapefactory(device, iscs) { function shapefactory(device, iscs) {
const type = device.model._type; const type = device.model._type;

View File

@ -33,6 +33,9 @@ export default class line extends Group {
stroke: this.model.fillColor stroke: this.model.fillColor
} }
}); });
if (model.classify == 'dashed') {
this.iscsLine.setStyle('lineDash', [2, 2]);
}
this.grouper.add(this.iscsLine); this.grouper.add(this.iscsLine);
this.add(this.grouper); this.add(this.grouper);
} }

View File

@ -1,5 +1,8 @@
import Group from 'zrender/src/container/Group'; import Group from 'zrender/src/container/Group';
const mean = { import Rect from 'zrender/src/graphic/shape/Rect';
import Line from 'zrender/src/graphic/shape/Line';
import Text from 'zrender/src/graphic/Text';
const stateMap = {
slidingDoorEmergencyDoorOpenMalfunction : '滑动门&应急门开门故障', slidingDoorEmergencyDoorOpenMalfunction : '滑动门&应急门开门故障',
slidingDoorEmergencyDoorCloseMalfunction: '滑动门&应急门关门故障', slidingDoorEmergencyDoorCloseMalfunction: '滑动门&应急门关门故障',
slidingDoorsInterlockAllClear: '滑动门互锁解除报警', slidingDoorsInterlockAllClear: '滑动门互锁解除报警',
@ -16,7 +19,26 @@ const mean = {
systemDrivePowerFailure: '系统驱动电源故障', systemDrivePowerFailure: '系统驱动电源故障',
systemControlPowerFailure: '系统控制电源故障', systemControlPowerFailure: '系统控制电源故障',
monitorPowerFailure: '监视电源故障', monitorPowerFailure: '监视电源故障',
fieldBusFault:'现场总线故障' fieldBusFault:'现场总线故障',
fasSystemFailure: { default: '正常'}, // 火灾系统故障
facpAutoMode: { default: '手动' }, // FACP自动状态
gesControlStatus: { default: '手动'}, // 气灭控制系统状态
hydrantStartupStatus: { default: '停止'}, // 消火栓泵启动状态
tscFireCondition: { default: '正常'}, // 感温电缆火警状态
aEquipmentAreaFireDetector: { default: '正常'}, // 站厅A端设备区点型火灾探测器
bEquipmentAreaFireDetector: { default: '正常'}, // 站厅B端设备区点型火灾探测器
pcaFireDetector: { default: '正常' }, // 站台公共区点型火灾探测器
scaFireDetector: { default: '正常'}, // 站厅公共区点型火灾探测器
elevatorCutFirePowerSupply: { default: '正常'}, // 站内垂直电梯切非站台B消
otherCutFirePowerSupply: { default: '正常'}, // 其他切非回路站台B消
inDownLeftManualAlarm: { default: '正常' }, // 站内下行左线手动报警按钮
inUpRightManualAlarm: { default: '正常'}, // 站内上行右线手动报警按钮
outDownLeftManualAlarm: { default: '正常'}, // 站间下行左线手动报警按钮
outUpRightManualAlarm: { default: '正常'}, // 站间上行右线手动报警按钮
inDownLeftHydrant: { default: '正常'}, // 站内下行左线消火栓按钮
inUpRightHydrant: { default: '正常'}, // 站内上行右线消火栓按钮
outDownLeftHydrant: { default: '正常'}, // 站间下行左线消火栓按钮
outUpRightHydrant: { default: '正常'} // 站间上行右线消火栓按钮
}; };
export default class StateTable extends Group { export default class StateTable extends Group {
@ -29,8 +51,147 @@ export default class StateTable extends Group {
this._code = device.model.code; this._code = device.model.code;
this.create(); this.create();
} }
cerate() { create() {
// this.header = const model = this.model;
this.grouper = new Group({
id: model.code,
position: [model.point.x, model.point.y]
});
this.lines = [];
let columnWidth = 0;
let rowNum = model.rowNum;
let contentIndex = 2;
if (model.headerType === 'none') {
rowNum = model.rowNum - 1;
contentIndex = 1;
}
model.columnWidthList.forEach(item => {
columnWidth += item;
const line = new Line({
zlevel: this.zlevel,
z: this.z,
shape: {
x1: columnWidth,
y1: model.headerType === 'merge' ? model.rowHeight : 0,
x2: columnWidth,
y2: rowNum * model.rowHeight
},
style: {
stroke: '#FFF',
lineWidth: 2
}
});
this.grouper.add(line);
this.lines.push(line);
});
this.tabelBorder = new Rect({
zlevel: this.zlevel,
z: this.z,
shape: {
x: 0,
y: 0,
width: columnWidth,
height: rowNum * model.rowHeight
},
style: {
stroke: '#aFFF',
fill: 'rgba(255, 255, 255, 0)',
lineWidth: 2
}
});
this.grouper.add(this.tabelBorder);
for (let i = 0; i < rowNum; i++) {
const line = new Line({
zlevel: this.zlevel,
z: this.z,
shape: {
x1: 0,
y1: i * model.rowHeight,
x2: columnWidth,
y2: i * model.rowHeight
},
style: {
stroke: '#FFF',
lineWidth: 2
}
});
this.grouper.add(line);
this.lines.push(line);
}
this.header = [];
if (model.headerType === 'merge') {
const header = new Text({
zlevel: model.zlevel,
z: model.z + 1,
style: {
x: columnWidth / 2,
y: model.rowHeight,
fontWeight: 'normal',
fontSize: model.headerFontSize,
fontFamily: 'consolas',
text: model.headerContextList[0],
textFill: '#FFF',
textAlign: 'center',
textPosition: 'inside',
textVerticalAlign: 'bottom',
textLineHeight: model.rowHeight
}
});
this.grouper.add(header);
this.header.push(header);
} else if (model.headerType === 'normal') {
let width = 0;
model.columnWidthList.forEach((item, i) => {
const header = new Text({
zlevel: model.zlevel,
z: model.z + 1,
style: {
x: item / 2 + width,
y: model.rowHeight,
fontWeight: 'normal',
fontSize: model.headerFontSize,
fontFamily: 'consolas',
text: model.headerContextList[i],
textFill: '#FFF',
textAlign: 'center',
textPosition: 'inside',
textVerticalAlign: 'bottom',
textLineHeight: model.rowHeight
}
});
width += item;
this.grouper.add(header);
this.header.push(header);
});
}
this.tabelContent = [];
model.tableData.forEach((item, i)=> {
let width = 0;
model.columnWidthList.forEach((elem, j) => {
const text = new Text({
zlevel: model.zlevel,
z: model.z + 1,
_subType: stateMap[item['column' + (j + 1)]],
style:{
x: elem / 2 + width,
y: model.rowHeight * (i + contentIndex),
fontWeight: 'normal',
fontSize: model.fontSize,
fontFamily: 'consolas',
text: stateMap[item['column' + (j + 1)]] ? stateMap[item['column' + (j + 1)]].default : item['column' + (j + 1)],
textFill: stateMap[item['column' + (j + 1)]] ? '#38984F' : '#4CCDE4',
textAlign: 'center',
textPosition: 'inside',
textVerticalAlign: 'bottom',
textLineHeight: model.rowHeight
}
});
this.grouper.add(text);
this.tabelContent.push(text);
width += elem;
});
});
this.add(this.grouper);
} }
setModel(dx, dy) { setModel(dx, dy) {
this.model.point.x += dx; this.model.point.x += dx;

View File

@ -106,6 +106,9 @@ export function parser(data) {
zrUtil.each(data.fireDamperList || [], elem =>{ zrUtil.each(data.fireDamperList || [], elem =>{
iscsDevice[elem.code] = deviceFactory(deviceType.FireDamper, elem); iscsDevice[elem.code] = deviceFactory(deviceType.FireDamper, elem);
} ); } );
zrUtil.each(data.smookExhaustFdList || [], elem =>{
iscsDevice[elem.code] = deviceFactory(deviceType.SmookExhaustFd, elem);
} );
zrUtil.each(data.smookProofFdList || [], elem =>{ zrUtil.each(data.smookProofFdList || [], elem =>{
iscsDevice[elem.code] = deviceFactory(deviceType.SmookProofFd, elem); iscsDevice[elem.code] = deviceFactory(deviceType.SmookProofFd, elem);
} ); } );
@ -148,6 +151,12 @@ export function parser(data) {
zrUtil.each(data.singleStaircaseList || [], elem=> { zrUtil.each(data.singleStaircaseList || [], elem=> {
iscsDevice[elem.code] = deviceFactory(deviceType.SingleStaircase, elem); iscsDevice[elem.code] = deviceFactory(deviceType.SingleStaircase, elem);
}); });
zrUtil.each(data.iscsButtonList || [], elem=> {
iscsDevice[elem.code] = deviceFactory(deviceType.IscsButton, elem);
});
zrUtil.each(data.stateTableList || [], elem=> {
iscsDevice[elem.code] = deviceFactory(deviceType.StateTable, elem);
});
} }
return iscsDevice; return iscsDevice;
@ -242,6 +251,9 @@ export function updateIscsData(state, device) {
case deviceType.FireDamper: case deviceType.FireDamper:
updateIscsListByDevice(state, 'fireDamperList', device); updateIscsListByDevice(state, 'fireDamperList', device);
break; break;
case deviceType.SmookExhaustFd:
updateIscsListByDevice(state, 'smookExhaustFdList', device);
break;
case deviceType.SmookProofFd: case deviceType.SmookProofFd:
updateIscsListByDevice(state, 'smookProofFdList', device); updateIscsListByDevice(state, 'smookProofFdList', device);
break; break;
@ -275,6 +287,12 @@ export function updateIscsData(state, device) {
case deviceType.ArcStatus: case deviceType.ArcStatus:
updateIscsListByDevice(state, 'arcStatusList', device); updateIscsListByDevice(state, 'arcStatusList', device);
break; break;
case deviceType.IscsButton:
updateIscsListByDevice(state, 'iscsButtonList', device);
break;
case deviceType.StateTable:
updateIscsListByDevice(state, 'stateTableList', device);
break;
} }
// store.dispatch('iscs/setIscsData', state.iscs); // store.dispatch('iscs/setIscsData', state.iscs);
} }

View File

@ -162,8 +162,8 @@ export function JLmap3dEdit(dom, data, mapid) {
this.export = function(){ this.export = function(){
let exporter = new THREE.OBJExporter(); let exporter = new THREE.OBJExporter();
console.log(scope.mapdata); console.log(scope.mapdata);
// let exportmodels = scope.mapdata.stationstandlist.group; let exportmodels = scope.mapdata.stationstandlist.group;
let exportmodels = scope.mapdata.sectionlist.sectiongroup; // let exportmodels = scope.mapdata.sectionlist.sectiongroup;
// let exportmodels = scope.mapdata.stationstandlist.group; // let exportmodels = scope.mapdata.stationstandlist.group;
let result = exporter.parse( exportmodels ); let result = exporter.parse( exportmodels );

View File

@ -109,6 +109,7 @@ export function Jl3ddeviceNew(dom,group,token) {
this.modelmanager = new ModelManager(); this.modelmanager = new ModelManager();
this.modelmanager.loadpromise(Staticmodel, scope.mixers).then(function (data) { this.modelmanager.loadpromise(Staticmodel, scope.mixers).then(function (data) {
console.log(scope.modelmanager);
animate(); animate();
}) })
@ -157,10 +158,12 @@ export function Jl3ddeviceNew(dom,group,token) {
scope.showmodel = scope.modelmanager.standmodel.mesh; scope.showmodel = scope.modelmanager.standmodel.mesh;
scope.scene.add(scope.showmodel); scope.scene.add(scope.showmodel);
} }
if(scope.showmodel){
scope.showmodel.code = data.code; scope.showmodel.code = data.code;
initstatus(data); initstatus(data);
} }
}
} else { } else {
scope.nowcode = data.code; scope.nowcode = data.code;
@ -170,19 +173,20 @@ export function Jl3ddeviceNew(dom,group,token) {
// scope.scene.add(scope.showmodel); // scope.scene.add(scope.showmodel);
if (data.normalPosition == "0") { if (data.normalPosition == "0") {
scope.modelmanager.switchmodel.normalPosition = "0"; scope.modelmanager.switchmodel.normalPosition = "0";
if(scope.modelmanager.switchmodel.action){
scope.modelmanager.switchmodel.action.reset(); scope.modelmanager.switchmodel.action.reset();
scope.modelmanager.switchmodel.action.time = 0; scope.modelmanager.switchmodel.action.time = 0;
scope.modelmanager.switchmodel.action.timeScale = -1; scope.modelmanager.switchmodel.action.timeScale = -1;
scope.modelmanager.switchmodel.action.play(); scope.modelmanager.switchmodel.action.play();
}
} else if (data.normalPosition == "1") { } else if (data.normalPosition == "1") {
scope.modelmanager.switchmodel.normalPosition = "1"; scope.modelmanager.switchmodel.normalPosition = "1";
if(scope.modelmanager.switchmodel.action){
scope.modelmanager.switchmodel.action.reset(); scope.modelmanager.switchmodel.action.reset();
scope.modelmanager.switchmodel.action.time = scope.modelmanager.switchmodel.action._clip.duration; scope.modelmanager.switchmodel.action.time = scope.modelmanager.switchmodel.action._clip.duration;
scope.modelmanager.switchmodel.action.timeScale = 1; scope.modelmanager.switchmodel.action.timeScale = 1;
scope.modelmanager.switchmodel.action.play(); scope.modelmanager.switchmodel.action.play();
}
} }
} }
@ -209,14 +213,12 @@ export function Jl3ddeviceNew(dom,group,token) {
scope.modelmanager.switchmodel.action.time = 0; scope.modelmanager.switchmodel.action.time = 0;
scope.modelmanager.switchmodel.action.timeScale = 1; scope.modelmanager.switchmodel.action.timeScale = 1;
scope.modelmanager.switchmodel.action.play(); scope.modelmanager.switchmodel.action.play();
} else if (data.normal == "1") { } else if (data.normal == "1") {
scope.modelmanager.switchmodel.normalPosition = "1"; scope.modelmanager.switchmodel.normalPosition = "1";
scope.modelmanager.switchmodel.action.reset(); scope.modelmanager.switchmodel.action.reset();
scope.modelmanager.switchmodel.action.time = scope.modelmanager.switchmodel.action._clip.duration; scope.modelmanager.switchmodel.action.time = scope.modelmanager.switchmodel.action._clip.duration;
scope.modelmanager.switchmodel.action.timeScale = -1; scope.modelmanager.switchmodel.action.timeScale = -1;
scope.modelmanager.switchmodel.action.play(); scope.modelmanager.switchmodel.action.play();
} }
} }
@ -274,18 +276,22 @@ export function Jl3ddeviceNew(dom,group,token) {
if (data._type == "Switch") { if (data._type == "Switch") {
if (data.normalPosition == "0") { if (data.normalPosition == "0") {
scope.modelmanager.switchmodel.normalPosition = "0"; scope.modelmanager.switchmodel.normalPosition = "0";
if(scope.modelmanager.switchmodel.action){
scope.modelmanager.switchmodel.action.reset(); scope.modelmanager.switchmodel.action.reset();
scope.modelmanager.switchmodel.action.time = scope.modelmanager.switchmodel.action._clip.duration; scope.modelmanager.switchmodel.action.time = scope.modelmanager.switchmodel.action._clip.duration;
scope.modelmanager.switchmodel.action.timeScale = 1; scope.modelmanager.switchmodel.action.timeScale = 1;
scope.modelmanager.switchmodel.action.play(); scope.modelmanager.switchmodel.action.play();
}
} else if (data.normalPosition == "1") { } else if (data.normalPosition == "1") {
scope.modelmanager.switchmodel.normalPosition = "1"; scope.modelmanager.switchmodel.normalPosition = "1";
if(scope.modelmanager.switchmodel.action){
scope.modelmanager.switchmodel.action.reset(); scope.modelmanager.switchmodel.action.reset();
scope.modelmanager.switchmodel.action.time = 0; scope.modelmanager.switchmodel.action.time = 0;
scope.modelmanager.switchmodel.action.timeScale = -1; scope.modelmanager.switchmodel.action.timeScale = -1;
scope.modelmanager.switchmodel.action.play(); scope.modelmanager.switchmodel.action.play();
} }
}
} }
if (data._type == "Signal") { if (data._type == "Signal") {

View File

@ -66,7 +66,7 @@ function fbxpromise(asset,mixers,model){
mixers.push(mixer); mixers.push(mixer);
//model.action.play(); //model.action.play();
} }
console.log(object);
resolve(asset.deviceType); resolve(asset.deviceType);

View File

@ -102,6 +102,41 @@ export function Jdqcontrol(){
part.msg = "绝缘轴用冻石瓷料制成,抗冲击强度足够。"; part.msg = "绝缘轴用冻石瓷料制成,抗冲击强度足够。";
selectmodel.children[i].text = "绝缘轴"; selectmodel.children[i].text = "绝缘轴";
} }
if(selectmodel.children[i].name =="cichuihuqi"){
part.text = "磁吹弧器";
part.msg = "磁吹弧器。";
selectmodel.children[i].text = "磁吹弧器";
}
if(selectmodel.children[i].name =="jiaqiangdongjiediandanyuan"){
part.text = "加强接点单元";
part.msg = "加强接点单元。";
selectmodel.children[i].text = "加强接点单元";
}
if(selectmodel.children[i].name =="yunmugehupian"){
part.text = "云母隔弧片";
part.msg = "云母隔弧片。";
selectmodel.children[i].text = "云母隔弧片";
}
if(selectmodel.children[i].name =="yapian1"){
part.text = "压片";
part.msg = "压片。";
selectmodel.children[i].text = "压片";
}
if(selectmodel.children[i].name =="jiedian1"){
part.text = "接点";
part.msg = "接点。";
selectmodel.children[i].text = "接点";
}
if(selectmodel.children[i].name =="ccichuihuqi"){
part.text = "磁吹弧器";
part.msg = "磁吹弧器。";
selectmodel.children[i].text = "磁吹弧器";
}
// if(part.text == null){
// console.log(selectmodel.children[i].name);
// }
scope.devicelist.push(part); scope.devicelist.push(part);
} }

View File

@ -1,185 +1,541 @@
export function Moveanimate(){ export function Moveanimate(main){
let scope = this; let scope = this;
this.helpbox = null;
this.textplane = null;
//动画列表 //动画列表
this.animatelist = []; this.animatelist = [];
this.playlist = null;
this.playorder = 0;
//动画播放器开关 //动画播放器开关
this.enable = true; this.enable = true;
//动画开关状态
this.status = true;
//当前动画模型
this.nowmodelname = undefined;
//定义所有继电器部件动画 //定义所有继电器部件动画
this.initlist = function(modellist){ // this.initlist = function(modellist){
// let points = []; //
// points.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); // for(let j=0,lenj=modellist.length;j<lenj;j++){
// points.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); //
// scope.initanimate(modellist[j].children[i],modellist[j].name+"select1",points,true); // for(let i=0,leni=modellist[j].children.length;i<leni;i++){
//
// if(modellist[j].children[i].name == "dizuo"){
// let points1 = [];
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z-150));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"dizuoon",points1,0.5,true,0);
// let points2 = [];
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z-150));
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"dizuooff",points2,0.5,true,0);
//
//
// }
// if(modellist[j].children[i].name == "Lxing"){
// let points1 = [];
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y-50,modellist[j].children[i].position.z));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"Lxingon",points1,0.5,true,0);
// let points2 = [];
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y-50,modellist[j].children[i].position.z));
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"Lxingoff",points2,0.5,true,0);
// }
// if(modellist[j].children[i].name == "jiaoxingxiantie"){
// let points1 = [];
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z+25));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"jiaoxingxiantieon",points1,0.5,true,0);
// let points2 = [];
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z+25));
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"jiaoxingxiantieoff",points2,0.5,true,0);
// }
// if(modellist[j].children[i].name == "xianquan"){
// let points1 = [];
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y-100,modellist[j].children[i].position.z));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"xianquanon",points1,0.5,true,0);
// let points2 = [];
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y-100,modellist[j].children[i].position.z));
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"xianquanoff",points2,0.5,true,0);
// }
// if(modellist[j].children[i].name == "zhongchuipian"){
// let points1 = [];
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y-25,modellist[j].children[i].position.z));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"zhongchuipianon",points1,0.5,true,0);
// let points2 = [];
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+25,modellist[j].children[i].position.z));
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"zhongchuipianoff",points2,0.5,true,0);
// }
// if(modellist[j].children[i].name == "lagan"){
// let points1 = [];
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z+50));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"laganon",points1,0.5,true,0);
// let points2 = [];
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z+50));
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"laganoff",points2,0.5,true,0);
// }
// if(modellist[j].children[i].name == "dongjiedianzhou"){
// let points1 = [];
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z+25));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"dongjiedianzhouon",points1,0.5,true,0);
// let points2 = [];
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z+25));
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"dongjiedianzhouoff",points2,0.5,true,0);
// }
// if(modellist[j].children[i].name == "neibu"){
// let points1 = [];
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z-50));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"neibuon",points1,0.5,true,0);
// let points2 = [];
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z-50));
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"neibuoff",points2,0.5,true,0);
// }
// if(modellist[j].children[i].name == "jiedian"){
// let points1 = [];
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z-15));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"jiedianon",points1,0.5,true,0);
// let points2 = [];
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z-15));
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"jiedianoff",points2,0.5,true,0);
//
// }
// if(modellist[j].children[i].name == "yapian"){
// let points1 = [];
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z-25));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"yapianon",points1,0.5,true,0);
// let points2 = [];
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z-25));
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"yapianoff",points2,0.5,true,0);
// }
// if(modellist[j].children[i].name == "fanghuozhao"){
// let points1 = [];
//
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z+200));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"fanghuozhaoon",points1,0.5,true,0);
//
// let points2 = [];
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z+200));
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"fanghuozhaooff",points2,0.5,true,0);
// }
// if(modellist[j].children[i].name == "dianyuanpian"){
// let points1 = [];
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z-50));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"dianyuanpianon",points1,0.5,true,0);
// let points2 = [];
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z-50));
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"dianyuanpianoff",points2,0.5,true,0);
// }
// if(modellist[j].children[i].name == "xinpian"){
// let points1 = [];
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+150,modellist[j].children[i].position.z));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"xinpianon",points1,0.5,true,0);
// let points2 = [];
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+150,modellist[j].children[i].position.z));
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"xinpianoff",points2,0.5,true,0);
// }
// if(modellist[j].children[i].name =="jueyuanzhou"){
// let points1 = [];
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"jueyuanzhouon",points1,0.5,true,0);
// let points2 = [];
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z));
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"jueyuanzhouoff",points2,0.5,true,0);
// }
// if(modellist[j].children[i].name =="cigang"){
// let points1 = [];
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y-100,modellist[j].children[i].position.z+100));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"cigangon",points1,0.5,true,0);
// let points2 = [];
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y-100,modellist[j].children[i].position.z+100));
// points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"cigangoff",points2,0.5,true,0);
// }
// }
//
// }
// //
//
//
//
// }
this.initlistnew = function(modellist){
for(let j=0,lenj=modellist.length;j<lenj;j++){ for(let j=0,lenj=modellist.length;j<lenj;j++){
console.log(modellist[j].code+"==================================");
scope.animatelist[modellist[j].code+"chaijie"] = [];
scope.animatelist[modellist[j].code+"fuwei"] = [];
for(let i=0,leni=modellist[j].children.length;i<leni;i++){ for(let i=0,leni=modellist[j].children.length;i<leni;i++){
console.log(modellist[j].children[i].name);
if(modellist[j].children[i].name == "dizuo"){ if(modellist[j].children[i].name == "dizuo"){
let points1 = []; let points1 = [];
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z-150)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z-150));
scope.initanimate(modellist[j].children[i],modellist[j].name+"dizuoon",points1,true); scope.initanimate(scope.animatelist[modellist[j].code+"chaijie"],modellist[j].children[i],modellist[j].name+"dizuoon",points1,0.5,true,0);
let points2 = []; let points2 = [];
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z-150)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z-150));
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
scope.initanimate(modellist[j].children[i],modellist[j].name+"dizuooff",points2,true); scope.initanimate(scope.animatelist[modellist[j].code+"fuwei"],modellist[j].children[i],modellist[j].name+"dizuooff",points2,0.5,true,0);
} }
if(modellist[j].children[i].name == "Lxing"){ if(modellist[j].children[i].name == "Lxing"){
let points1 = []; let points1 = [];
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y-50,modellist[j].children[i].position.z)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y-50,modellist[j].children[i].position.z));
scope.initanimate(modellist[j].children[i],modellist[j].name+"Lxingon",points1,true); scope.initanimate(scope.animatelist[modellist[j].code+"chaijie"],modellist[j].children[i],modellist[j].name+"Lxingon",points1,0.5,true,0);
let points2 = []; let points2 = [];
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y-50,modellist[j].children[i].position.z)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y-50,modellist[j].children[i].position.z));
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
scope.initanimate(modellist[j].children[i],modellist[j].name+"Lxingoff",points2,true); scope.initanimate(scope.animatelist[modellist[j].code+"fuwei"],modellist[j].children[i],modellist[j].name+"Lxingoff",points2,0.5,true,0);
} }
if(modellist[j].children[i].name == "jiaoxingxiantie"){ if(modellist[j].children[i].name == "jiaoxingxiantie"){
let points1 = []; let points1 = [];
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z+25)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z+25));
scope.initanimate(modellist[j].children[i],modellist[j].name+"jiaoxingxiantieon",points1,true); scope.initanimate(scope.animatelist[modellist[j].code+"chaijie"],modellist[j].children[i],modellist[j].name+"jiaoxingxiantieon",points1,0.5,true,0);
let points2 = []; let points2 = [];
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z+25)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z+25));
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
scope.initanimate(modellist[j].children[i],modellist[j].name+"jiaoxingxiantieoff",points2,true); scope.initanimate(scope.animatelist[modellist[j].code+"fuwei"],modellist[j].children[i],modellist[j].name+"jiaoxingxiantieoff",points2,0.5,true,0);
} }
if(modellist[j].children[i].name == "xianquan"){ if(modellist[j].children[i].name == "xianquan"){
let points1 = []; let points1 = [];
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y-100,modellist[j].children[i].position.z)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y-100,modellist[j].children[i].position.z));
scope.initanimate(modellist[j].children[i],modellist[j].name+"xianquanon",points1,true); scope.initanimate(scope.animatelist[modellist[j].code+"chaijie"],modellist[j].children[i],modellist[j].name+"xianquanon",points1,0.5,true,0);
let points2 = []; let points2 = [];
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y-100,modellist[j].children[i].position.z)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y-100,modellist[j].children[i].position.z));
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
scope.initanimate(modellist[j].children[i],modellist[j].name+"xianquanoff",points2,true); scope.initanimate(scope.animatelist[modellist[j].code+"fuwei"],modellist[j].children[i],modellist[j].name+"xianquanoff",points2,0.5,true,0);
} }
if(modellist[j].children[i].name == "zhongchuipian"){ if(modellist[j].children[i].name == "zhongchuipian"){
let points1 = []; let points1 = [];
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y-25,modellist[j].children[i].position.z)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y-25,modellist[j].children[i].position.z));
scope.initanimate(modellist[j].children[i],modellist[j].name+"zhongchuipianon",points1,true); scope.initanimate(scope.animatelist[modellist[j].code+"chaijie"],modellist[j].children[i],modellist[j].name+"zhongchuipianon",points1,0.5,true,0);
let points2 = []; let points2 = [];
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+25,modellist[j].children[i].position.z)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+25,modellist[j].children[i].position.z));
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
scope.initanimate(modellist[j].children[i],modellist[j].name+"zhongchuipianoff",points2,true); scope.initanimate(scope.animatelist[modellist[j].code+"fuwei"],modellist[j].children[i],modellist[j].name+"zhongchuipianoff",points2,0.5,true,0);
} }
if(modellist[j].children[i].name == "lagan"){ if(modellist[j].children[i].name == "lagan"){
let points1 = []; let points1 = [];
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z+50)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z+50));
scope.initanimate(modellist[j].children[i],modellist[j].name+"laganon",points1,true); scope.initanimate(scope.animatelist[modellist[j].code+"chaijie"],modellist[j].children[i],modellist[j].name+"laganon",points1,0.5,true,0);
let points2 = []; let points2 = [];
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z+50)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z+50));
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
scope.initanimate(modellist[j].children[i],modellist[j].name+"laganoff",points2,true); scope.initanimate(scope.animatelist[modellist[j].code+"fuwei"],modellist[j].children[i],modellist[j].name+"laganoff",points2,0.5,true,0);
} }
if(modellist[j].children[i].name == "dongjiedianzhou"){ if(modellist[j].children[i].name == "dongjiedianzhou"){
let points1 = []; let points1 = [];
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z+25)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z+25));
scope.initanimate(modellist[j].children[i],modellist[j].name+"dongjiedianzhouon",points1,true); scope.initanimate(scope.animatelist[modellist[j].code+"chaijie"],modellist[j].children[i],modellist[j].name+"dongjiedianzhouon",points1,0.5,true,0);
let points2 = []; let points2 = [];
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z+25)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z+25));
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
scope.initanimate(modellist[j].children[i],modellist[j].name+"dongjiedianzhouoff",points2,true); scope.initanimate(scope.animatelist[modellist[j].code+"fuwei"],modellist[j].children[i],modellist[j].name+"dongjiedianzhouoff",points2,0.5,true,0);
} }
if(modellist[j].children[i].name == "neibu"){ if(modellist[j].children[i].name == "neibu"){
let points1 = []; let points1 = [];
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z-50)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z-50));
scope.initanimate(modellist[j].children[i],modellist[j].name+"neibuon",points1,true); scope.initanimate(scope.animatelist[modellist[j].code+"chaijie"],modellist[j].children[i],modellist[j].name+"neibuon",points1,0.5,true,0);
let points2 = []; let points2 = [];
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z-50)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z-50));
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
scope.initanimate(modellist[j].children[i],modellist[j].name+"neibuoff",points2,true); scope.initanimate(scope.animatelist[modellist[j].code+"fuwei"],modellist[j].children[i],modellist[j].name+"neibuoff",points2,0.5,true,0);
} }
if(modellist[j].children[i].name == "jiedian"){ if(modellist[j].children[i].name == "jiedian"){
let points1 = []; let points1 = [];
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z-15)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z-15));
scope.initanimate(modellist[j].children[i],modellist[j].name+"jiedianon",points1,true); scope.initanimate(scope.animatelist[modellist[j].code+"chaijie"],modellist[j].children[i],modellist[j].name+"jiedianon",points1,0.5,true,0);
let points2 = []; let points2 = [];
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z-15)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z-15));
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
scope.initanimate(modellist[j].children[i],modellist[j].name+"jiedianoff",points2,true); scope.initanimate(scope.animatelist[modellist[j].code+"fuwei"],modellist[j].children[i],modellist[j].name+"jiedianoff",points2,0.5,true,0);
} }
if(modellist[j].children[i].name == "yapian"){ if(modellist[j].children[i].name == "yapian"){
let points1 = []; let points1 = [];
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z-25)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z-25));
scope.initanimate(modellist[j].children[i],modellist[j].name+"yapianon",points1,true); scope.initanimate(scope.animatelist[modellist[j].code+"chaijie"],modellist[j].children[i],modellist[j].name+"yapianon",points1,0.5,true,0);
let points2 = []; let points2 = [];
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z-25)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z-25));
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
scope.initanimate(modellist[j].children[i],modellist[j].name+"yapianoff",points2,true); scope.initanimate(scope.animatelist[modellist[j].code+"fuwei"],modellist[j].children[i],modellist[j].name+"yapianoff",points2,0.5,true,0);
} }
if(modellist[j].children[i].name == "fanghuozhao"){ if(modellist[j].children[i].name == "fanghuozhao"){
let points1 = []; let points1 = [];
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z+200)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z+200));
scope.initanimate(modellist[j].children[i],modellist[j].name+"fanghuozhaoon",points1,true); scope.initanimate(scope.animatelist[modellist[j].code+"chaijie"],modellist[j].children[i],modellist[j].name+"fanghuozhaoon",points1,0.5,true,0);
let points2 = []; let points2 = [];
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z+200)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z+200));
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
scope.initanimate(modellist[j].children[i],modellist[j].name+"fanghuozhaooff",points2,true); scope.initanimate(scope.animatelist[modellist[j].code+"fuwei"],modellist[j].children[i],modellist[j].name+"fanghuozhaooff",points2,0.5,true,0);
} }
if(modellist[j].children[i].name == "dianyuanpian"){ if(modellist[j].children[i].name == "dianyuanpian"){
let points1 = []; let points1 = [];
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z-50)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z-50));
scope.initanimate(modellist[j].children[i],modellist[j].name+"dianyuanpianon",points1,true); scope.initanimate(scope.animatelist[modellist[j].code+"chaijie"],modellist[j].children[i],modellist[j].name+"dianyuanpianon",points1,0.5,true,0);
let points2 = []; let points2 = [];
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z-50)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z-50));
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
scope.initanimate(modellist[j].children[i],modellist[j].name+"dianyuanpianoff",points2,true); scope.initanimate(scope.animatelist[modellist[j].code+"fuwei"],modellist[j].children[i],modellist[j].name+"dianyuanpianoff",points2,0.5,true,0);
} }
if(modellist[j].children[i].name == "xinpian"){ if(modellist[j].children[i].name == "xinpian"){
let points1 = []; let points1 = [];
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+150,modellist[j].children[i].position.z)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+150,modellist[j].children[i].position.z));
scope.initanimate(modellist[j].children[i],modellist[j].name+"xinpianon",points1,true); scope.initanimate(scope.animatelist[modellist[j].code+"chaijie"],modellist[j].children[i],modellist[j].name+"xinpianon",points1,0.5,true,0);
let points2 = []; let points2 = [];
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+150,modellist[j].children[i].position.z)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+150,modellist[j].children[i].position.z));
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
scope.initanimate(modellist[j].children[i],modellist[j].name+"xinpianoff",points2,true); scope.initanimate(scope.animatelist[modellist[j].code+"fuwei"],modellist[j].children[i],modellist[j].name+"xinpianoff",points2,0.5,true,0);
} }
if(modellist[j].children[i].name =="jueyuanzhou"){ if(modellist[j].children[i].name =="jueyuanzhou"){
let points1 = []; let points1 = [];
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z));
scope.initanimate(modellist[j].children[i],modellist[j].name+"jueyuanzhouon",points1,true); scope.initanimate(scope.animatelist[modellist[j].code+"chaijie"],modellist[j].children[i],modellist[j].name+"jueyuanzhouon",points1,0.5,true,0);
let points2 = []; let points2 = [];
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z));
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
scope.initanimate(modellist[j].children[i],modellist[j].name+"jueyuanzhouoff",points2,true); scope.initanimate(scope.animatelist[modellist[j].code+"fuwei"],modellist[j].children[i],modellist[j].name+"jueyuanzhouoff",points2,0.5,true,0);
} }
if(modellist[j].children[i].name =="cigang"){ if(modellist[j].children[i].name =="cigang"){
let points1 = []; let points1 = [];
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y-100,modellist[j].children[i].position.z+100)); points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y-100,modellist[j].children[i].position.z+100));
scope.initanimate(modellist[j].children[i],modellist[j].name+"cigangon",points1,true); scope.initanimate(scope.animatelist[modellist[j].code+"chaijie"],modellist[j].children[i],modellist[j].name+"cigangon",points1,0.5,true,0);
let points2 = []; let points2 = [];
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y-100,modellist[j].children[i].position.z+100)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y-100,modellist[j].children[i].position.z+100));
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z)); points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
scope.initanimate(modellist[j].children[i],modellist[j].name+"cigangoff",points2,true); scope.initanimate(scope.animatelist[modellist[j].code+"fuwei"],modellist[j].children[i],modellist[j].name+"cigangoff",points2,0.5,true,0);
}
if(modellist[j].children[i].name =="ccichuihuqi"){
let points1 = [];
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y-50,modellist[j].children[i].position.z+100));
scope.initanimate(scope.animatelist[modellist[j].code+"chaijie"],modellist[j].children[i],modellist[j].name+"ccichuihuqion",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y-50,modellist[j].children[i].position.z+100));
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
scope.initanimate(scope.animatelist[modellist[j].code+"fuwei"],modellist[j].children[i],modellist[j].name+"ccichuihuqioff",points2,0.5,true,0);
}
if(modellist[j].children[i].name =="cichuihuqi"){
let points1 = [];
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y-50,modellist[j].children[i].position.z+100));
scope.initanimate(scope.animatelist[modellist[j].code+"chaijie"],modellist[j].children[i],modellist[j].name+"cichuihuqion",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y-50,modellist[j].children[i].position.z+100));
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
scope.initanimate(scope.animatelist[modellist[j].code+"fuwei"],modellist[j].children[i],modellist[j].name+"cichuihuqioff",points2,0.5,true,0);
}
if(modellist[j].children[i].name =="jiaqiangdongjiediandanyuan"){
let points1 = [];
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+25,modellist[j].children[i].position.z+100));
scope.initanimate(scope.animatelist[modellist[j].code+"chaijie"],modellist[j].children[i],modellist[j].name+"jiaqiangdongjiediandanyuanon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+25,modellist[j].children[i].position.z+100));
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
scope.initanimate(scope.animatelist[modellist[j].code+"fuwei"],modellist[j].children[i],modellist[j].name+"jiaqiangdongjiediandanyuanoff",points2,0.5,true,0);
}
if(modellist[j].children[i].name =="yunmugehupian"){
let points1 = [];
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
points1.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z+100));
scope.initanimate(scope.animatelist[modellist[j].code+"chaijie"],modellist[j].children[i],modellist[j].name+"yunmugehupianon",points1,0.5,true,0);
let points2 = [];
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y+100,modellist[j].children[i].position.z+100));
points2.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
scope.initanimate(scope.animatelist[modellist[j].code+"fuwei"],modellist[j].children[i],modellist[j].name+"yunmugehupianoff",points2,0.5,true,0);
} }
} }
} }
// let points = [];
// points.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// points.push(new THREE.Vector3(modellist[j].children[i].position.x,modellist[j].children[i].position.y,modellist[j].children[i].position.z));
// scope.initanimate(modellist[j].children[i],modellist[j].name+"select1",points,true);
let modelorderlist = [];
modelorderlist[modellist[0].code] = [
{name:"fanghuozhao",pos:[0,0,200]},
{name:"dizuo",pos:[0,0,-150]},
{name:"dianyuanpian",pos:[0,0,-50]},
{name:"neibu",pos:[0,0,-25]},
{name:"xianquan",pos:[0,-200,0]},
{name:"Lxing",pos:[0,-150,0]},
{name:"jiaoxingxiantie",pos:[0,-100,50]},
{name:"zhongchuipian",pos:[0,-100,-50]},
{name:"jiedian",pos:[0,0,100]},
{name:"dongjiedianzhou",pos:[0,100,100]},
{name:"jueyuanzhou",pos:[0,150,50]},
{name:"lagan",pos:[0,150,0]},
{name:"yapian",pos:[0,0,25]}
];
modelorderlist[modellist[1].code] = [
{name:"fanghuozhao",pos:[0,0,200]},
{name:"dizuo",pos:[0,0,-150]},
{name:"dianyuanpian",pos:[0,0,-50]},
{name:"neibu",pos:[0,0,-25]},
{name:"xianquan",pos:[0,-200,0]},
{name:"Lxing",pos:[0,-150,0]},
{name:"jiaoxingxiantie",pos:[0,-100,50]},
{name:"zhongchuipian",pos:[0,-100,-50]},
{name:"jiedian",pos:[0,0,100]},
{name:"dongjiedianzhou",pos:[0,100,100]},
{name:"jueyuanzhou",pos:[0,150,50]},
{name:"lagan",pos:[0,150,0]},
{name:"yapian",pos:[0,0,25]}
];
modelorderlist[modellist[2].code] = [
{name:"fanghuozhao",pos:[0,0,200]},
{name:"dizuo",pos:[0,0,-150]},
{name:"dianyuanpian",pos:[0,0,-50]},
{name:"neibu",pos:[0,0,-25]},
{name:"xianquan",pos:[0,-200,0]},
{name:"Lxing",pos:[0,-150,0]},
{name:"jiaoxingxiantie",pos:[0,-100,50]},
{name:"zhongchuipian",pos:[0,-100,-50]},
{name:"jiedian",pos:[0,0,100]},
{name:"dongjiedianzhou",pos:[0,100,100]},
{name:"jueyuanzhou",pos:[0,150,50]},
{name:"lagan",pos:[0,150,0]},
{name:"yapian",pos:[0,0,25]}
];
modelorderlist[modellist[3].code] = [
{name:"fanghuozhao",pos:[0,0,200]},
{name:"dizuo",pos:[0,0,-150]},
{name:"dianyuanpian",pos:[0,0,-50]},
{name:"neibu",pos:[0,0,-25]},
{name:"xianquan",pos:[0,-200,0]},
{name:"Lxing",pos:[0,-150,0]},
{name:"jiaoxingxiantie",pos:[0,-100,50]},
{name:"zhongchuipian",pos:[0,-100,-50]},
{name:"jiedian",pos:[0,0,100]},
{name:"dongjiedianzhou",pos:[0,100,100]},
{name:"jueyuanzhou",pos:[0,150,50]},
{name:"lagan",pos:[0,150,0]},
{name:"yapian",pos:[0,0,25]}
];
modelorderlist[modellist[4].code] = [
{name:"fanghuozhao",pos:[0,0,200]},
{name:"dizuo",pos:[0,0,-150]},
{name:"dianyuanpian",pos:[0,0,-50]},
{name:"neibu",pos:[0,0,-25]},
{name:"xianquan",pos:[0,-200,0]},
{name:"Lxing",pos:[0,-150,0]},
{name:"zhongchuipian",pos:[0,-100,-50]},
{name:"jiaoxingxiantie",pos:[0,-100,50]},
{name:"jiedian",pos:[0,150,100]},
{name:"dongjiedianzhou",pos:[0,150,75]},
{name:"jueyuanzhou",pos:[0,150,50]},
{name:"yunmugehupian",pos:[0,100,100]},
{name:"jiaqiangdongjiediandanyuan",pos:[0,75,75]},
{name:"cichuihuqi",pos:[0,75,25]},
{name:"lagan",pos:[0,150,0]},
{name:"yapian1",pos:[0,0,100]},
{name:"yapian",pos:[0,0,10]}
];
modelorderlist[modellist[5].code] = [
{name:"fanghuozhao",pos:[0,0,200]},
{name:"dizuo",pos:[0,0,-150]},
{name:"dianyuanpian",pos:[0,0,-50]},
{name:"neibu",pos:[0,0,-25]},
{name:"xianquan",pos:[0,-200,0]},
{name:"cigang",pos:[0,-200,50]},
{name:"Lxing",pos:[0,-150,0]},
{name:"jiaoxingxiantie",pos:[0,-100,50]},
{name:"zhongchuipian",pos:[0,-100,-50]},
{name:"jiedian",pos:[0,0,100]},
{name:"dongjiedianzhou",pos:[0,100,100]},
{name:"jueyuanzhou",pos:[0,150,50]},
{name:"ccichuihuqi",pos:[0,-50,75]},
{name:"lagan",pos:[0,150,0]},
{name:"yapian",pos:[0,0,25]}
];
for(let j=0,lenj=modellist.length;j<lenj;j++){
scope.animatelist[modellist[j].code+"on"] = [];
scope.animatelist[modellist[j].code+"off"] = [];
for(let i=0,leni=modelorderlist[modellist[j].code].length;i<leni;i++){
let orderdata = modelorderlist[modellist[j].code];
let modelon = modellist[j].getObjectByName(orderdata[i].name);
// modelon.helpbox = undefined;
let pointson = [];
pointson.push(new THREE.Vector3(modelon.position.x,modelon.position.y,modelon.position.z));
pointson.push(new THREE.Vector3(modelon.position.x+orderdata[i].pos[0],modelon.position.y+orderdata[i].pos[1],modelon.position.z+orderdata[i].pos[2]));
let pointsoff = [];
pointsoff.push(new THREE.Vector3(modelon.position.x+orderdata[i].pos[0],modelon.position.y+orderdata[i].pos[1],modelon.position.z+orderdata[i].pos[2]));
pointsoff.push(new THREE.Vector3(modelon.position.x,modelon.position.y,modelon.position.z));
// if(i == 0){
scope.initanimate(scope.animatelist[modellist[j].code+"on"],modelon,modellist[j].code+modelon.name+"on",pointson,0.01,true,i);
scope.initanimate(scope.animatelist[modellist[j].code+"off"],modelon,modellist[j].code+modelon.name+"off",pointsoff,0.01,true,leni-i-1);
// }else if((i+1)<leni){
// scope.initanimate(modelon,modellist[j].code+modelon.name+"on",pointson,0.01,true,modellist[j].code+orderdata[i+1].name+"on");
// scope.initanimate(modelon,modellist[j].code+modelon.name+"off",pointsoff,0.01,true,modellist[j].code+orderdata[i-1].name+"off");
// }else{
// scope.initanimate(modelon,modellist[j].code+modelon.name+"on",pointson,0.01,true);
// scope.initanimate(modelon,modellist[j].code+modelon.name+"off",pointsoff,0.01,true,modellist[j].code+orderdata[i-1].name+"off");
// }
// if(modellist[j].children[i].name == "xinpian"){
// }
// if(modellist[j].children[i].name =="cigang"){
// }
} }
}
}
//动画对象定义 //动画对象定义
this.initanimate = function(modelobject,name,points,type){ this.initanimate = function(list,modelobject,name,points,speed,type,nextname){
let curve = new THREE.CatmullRomCurve3(points); let curve = new THREE.CatmullRomCurve3(points);
@ -195,51 +551,121 @@ export function Moveanimate(){
connectmodel:modelobject, connectmodel:modelobject,
enable:false, enable:false,
status:"start", status:"start",
speed:0.05, speed:speed,
next:null
}; };
scope.animatelist[name] = animate; // list[nextname] = [];
if(list[nextname] == undefined){
list[nextname] = [];
}
list[nextname].push(animate);
if(nextname){
// list[nextname] = animate;
// animate.next = nextname;
}else{
// list.push(animate);
} }
}
this.setplaylist = function(nowlist,enable){
scope.playlist = nowlist;
scope.enable = enable;
scope.playorder = 0;
for(let i=0;i<scope.playlist[scope.playorder].length;i++){
scope.playlist[scope.playorder][i].status = "start";
}
}
this.updatehelpbox = function(nowhelpbox,nowtextplane){
scope.textplane = nowtextplane;
scope.helpbox = nowhelpbox;
}
this.startstop = function(){
}
this.next = function(){
}
this.before = function(){
}
//动画播放器 //动画播放器
this.animateupdate = function(){ this.animateupdate = function(){
// console.log(scope.animatelist);
if(scope.enable){ if(scope.enable){
//遍历动画列表将启动的动画位置更新 if(scope.playlist){
for(let k in scope.animatelist){
if(scope.animatelist[k].enable){ for(let i=0;i<scope.playlist[scope.playorder].length;i++){
// 动画播放结束 if(scope.playlist[scope.playorder][i].status == "start"){
if(scope.animatelist[k].progress>=1){
let point = scope.animatelist[k].curve.getPointAt(1); }
if(scope.playlist[scope.playorder][i].progress>=1){
let point = scope.playlist[scope.playorder][i].curve.getPointAt(1);
//更新模型坐标 //更新模型坐标
scope.animatelist[k].connectmodel.position.x = point.x; scope.playlist[scope.playorder][i].connectmodel.position.x = point.x;
scope.animatelist[k].connectmodel.position.y = point.y; scope.playlist[scope.playorder][i].connectmodel.position.y = point.y;
scope.animatelist[k].connectmodel.position.z = point.z; scope.playlist[scope.playorder][i].connectmodel.position.z = point.z;
scope.animatelist[k].enable = false; scope.playlist[scope.playorder][i].enable = false;
scope.animatelist[k].status = "end"; scope.playlist[scope.playorder][i].status = "end";
scope.animatelist[k].progress = 0; scope.playlist[scope.playorder][i].progress = 0;
if(i >= scope.playlist[scope.playorder].length-1){
if(scope.playorder >= scope.playlist.length-1 ){
scope.playlist = null;
scope.status = true;
scope.enable = false;
main.animationmsgshowoff();
scope.nowmodelname = undefined;
scope.playorder = null;
break;
}else{ }else{
//根据动画进度获取动画轨迹上点 scope.playorder += 1;
}
}
let point = scope.animatelist[k].curve.getPointAt(scope.animatelist[k].progress);
}else{
// console.log(scope.animatelist[k].connectmodel);
if(scope.nowmodelname != scope.playlist[scope.playorder][i].connectmodel.name){
scope.nowmodelname = scope.playlist[scope.playorder][i].connectmodel.name;
main.animationmsgshowon(scope.playlist[scope.playorder][i].connectmodel);
}
//根据动画进度获取动画轨迹上点
scope.status = false;
let point = scope.playlist[scope.playorder][i].curve.getPointAt(scope.playlist[scope.playorder][i].progress);
//更新模型坐标 //更新模型坐标
scope.animatelist[k].connectmodel.position.x = point.x; scope.playlist[scope.playorder][i].connectmodel.position.x = point.x;
scope.animatelist[k].connectmodel.position.y = point.y; scope.playlist[scope.playorder][i].connectmodel.position.y = point.y;
scope.animatelist[k].connectmodel.position.z = point.z; scope.playlist[scope.playorder][i].connectmodel.position.z = point.z;
if(scope.helpbox){
scope.helpbox.update();
}
if(scope.textplane){
scope.textplane.position.x = scope.playlist[scope.playorder][i].connectmodel.matrixWorld.elements[12];
scope.textplane.position.y = scope.playlist[scope.playorder][i].connectmodel.matrixWorld.elements[13]+100;
scope.textplane.position.z = scope.playlist[scope.playorder][i].connectmodel.matrixWorld.elements[14];
}
//判断模型转向 //判断模型转向
if(scope.animatelist[k].directchange){ if(scope.playlist[scope.playorder][i].directchange){
let tangent = scope.animatelist[k].curve.getPointAt(scope.animatelist[k].progress+0.001); let tangent = scope.playlist[scope.playorder][i].curve.getPointAt(scope.playlist[scope.playorder][i].progress+0.001);
// scope.animatelist[k] // scope.animatelist[k]
tangent = null; tangent = null;
} }
//增加动画进度,释放点变量 //增加动画进度,释放点变量
scope.animatelist[k].progress += scope.animatelist[k].speed; scope.playlist[scope.playorder][i].progress += scope.playlist[scope.playorder][i].speed;
point = null; point = null;
} }
} }
} }
} }
} }

View File

@ -7,6 +7,8 @@ import { ModelManager } from '@/jlmap3d/jl3ddevicetrain/loader.js';
import { Moveanimate } from '@/jlmap3d/jl3ddevicetrain/component/moveanimate.js'; import { Moveanimate } from '@/jlmap3d/jl3ddevicetrain/component/moveanimate.js';
import { Jdqcontrol } from '@/jlmap3d/jl3ddevicetrain/component/jdqcontrol.js'; import { Jdqcontrol } from '@/jlmap3d/jl3ddevicetrain/component/jdqcontrol.js';
import { DragControls } from '@/jlmap3d/main/control/DragControls.js';
import StompClient from '@/jlmap3d/jl3ddevicetrain/component/StompClient.js'; import StompClient from '@/jlmap3d/jl3ddevicetrain/component/StompClient.js';
// import { Signallightload } from '@/jlmap3d/jl3ddevice/component/signallight.js'; // import { Signallightload } from '@/jlmap3d/jl3ddevice/component/signallight.js';
@ -31,27 +33,31 @@ export function Jl3ddevice(dom,serviceid) {
this.animastats = false; this.animastats = false;
//当前选中模型 //当前选中模型
this.selectmodel = null; this.selectmodel = null;
//当前动画播放模型
this.animationmodel = null;
//初始化webgl渲染 //初始化webgl渲染
let renderer = new THREE.WebGLRenderer({ antialias: true,alpha: true }); let renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setPixelRatio( window.devicePixelRatio ); renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize(dom.offsetWidth, dom.offsetHeight); renderer.setSize(dom.offsetWidth, dom.offsetHeight);
// renderer.shadowMap.enabled = true; // renderer.shadowMap.enabled = true;
// renderer.shadowMap.type = THREE.PCFSoftShadowMap; // renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.setClearColor( 0x000000, 0 ); renderer.setClearColor( 0x000000, 0 );
this.dom.appendChild(renderer.domElement); this.dom.appendChild(renderer.domElement);
//定义相机 //定义相机
let camera = new THREE.PerspectiveCamera(70, dom.offsetWidth / dom.offsetHeight, 0.01, 5000); let camera = new THREE.PerspectiveCamera(70, dom.offsetWidth / dom.offsetHeight, 0.01, 4000);
camera.position.set(-1000, 1500, 0); camera.position.set(-1000, 1500, 0);
camera.aspect = dom.offsetWidth / dom.offsetHeight; camera.aspect = dom.offsetWidth / dom.offsetHeight;
camera.updateProjectionMatrix(); camera.updateProjectionMatrix();
//视角轨迹控制器 //视角轨迹控制器
this.controls = new THREE.OrbitControls(camera, dom); this.controls = new THREE.OrbitControls(camera, dom);
this.controls.enabled = true;
this.controls.target = new THREE.Vector3(500,1000,0); this.controls.target = new THREE.Vector3(500,1000,0);
this.controls.screenSpacePanning = true; this.controls.screenSpacePanning = true;
this.controls.update(); this.controls.update();
this.controls.maxDistance = 3000;
//定义场景(渲染容器) //定义场景(渲染容器)
let scene = new THREE.Scene(); let scene = new THREE.Scene();
@ -72,8 +78,9 @@ export function Jl3ddevice(dom,serviceid) {
// grid.material.transparent = true; // grid.material.transparent = true;
// grid.position.x = 10000; // grid.position.x = 10000;
// scene.add( grid ); // scene.add( grid );
let objects = [];
let dragcontrol = new THREE.DragControls( objects, camera, scope.dom );
dragcontrol.enabled = false;
//菜单选中设备更新设备较少 //菜单选中设备更新设备较少
this.updateselect = function(updata){ this.updateselect = function(updata){
@ -91,15 +98,13 @@ export function Jl3ddevice(dom,serviceid) {
}; };
settext(updata.mesh,point) settext(updata.mesh,point)
getdevicemsg(updata.mesh.name); getdevicemsg(updata.mesh.name);
// moveanima.animatelist[scope.selectmodel.name+"select1"].enable = true;
// console.log(intersects[0].object);
scene.add( helpbox ); scene.add( helpbox );
} }
//返回设备选择 //返回设备选择
this.backselect = function(){ this.backselect = function(){
move2(); move3();
updatemenulist(scope.jdqcontrol.devicelist); updatemenulist(scope.jdqcontrol.devicelist,"all");
scope.modelmanager.controllist[0].position.set(19,1270,-275); scope.modelmanager.controllist[0].position.set(19,1270,-275);
scope.modelmanager.controllist[0].rotation.y = -Math.PI/2; scope.modelmanager.controllist[0].rotation.y = -Math.PI/2;
@ -141,8 +146,10 @@ export function Jl3ddevice(dom,serviceid) {
}; };
//设备分解、归位动画按钮 //设备分解、归位动画按钮
this.disperdevice = function(){ this.disperdevice1 = function(){
if(scope.status == '1'){ if(scope.status == '1'){
if(moveanima.status == true){
if(scope.animastats == false){ if(scope.animastats == false){
scope.animastats = true; scope.animastats = true;
move1(); move1();
@ -150,14 +157,36 @@ export function Jl3ddevice(dom,serviceid) {
scope.animastats = false; scope.animastats = false;
move2(); move2();
} }
}
} }
}; };
this.disperdevice2 = function(){
if(scope.status == '1'){
if(moveanima.status == true){
if(scope.animastats == false){
scope.animastats = true;
moveanima.setplaylist(moveanima.animatelist[scope.selectmodel.code+"chaijie"],true);
} else if(scope.animastats == true){
scope.animastats = false;
moveanima.setplaylist(moveanima.animatelist[scope.selectmodel.code+"fuwei"],true);
}
}
}
};
// let stats = new Stats(); // let stats = new Stats();
// dom.appendChild( stats.dom ); // dom.appendChild( stats.dom );
document.addEventListener( "mousedown", onselect, false ); document.addEventListener( "mousedown", onselect, false );
document.addEventListener( "mouseup", onmouseup, false );
document.addEventListener( "touchstart", ontouch, false ); document.addEventListener( "touchstart", ontouch, false );
window.onresize = function () { window.onresize = function () {
camera.aspect = scope.dom.offsetWidth / scope.dom.offsetHeight; camera.aspect = scope.dom.offsetWidth / scope.dom.offsetHeight;
@ -167,12 +196,12 @@ export function Jl3ddevice(dom,serviceid) {
this.jdqcontrol = new Jdqcontrol(); this.jdqcontrol = new Jdqcontrol();
let moveanima = new Moveanimate(); let moveanima = new Moveanimate(scope);
this.anime = null; this.anime = null;
this.modelmanager = new ModelManager(); this.modelmanager = new ModelManager();
this.modelmanager.loadpromise(Staticmodel, scope.mixers,scene).then(function (data) { this.modelmanager.loadpromise(Staticmodel, scope.mixers,scene).then(function (data) {
moveanima.initlist( scope.modelmanager.controllist); moveanima.initlistnew( scope.modelmanager.controllist);
connect = new StompClient(); connect = new StompClient();
// debugger // debugger
connect.subscribe("/queue/simulation/"+serviceid,callback); connect.subscribe("/queue/simulation/"+serviceid,callback);
@ -195,6 +224,7 @@ export function Jl3ddevice(dom,serviceid) {
connect.send("/app/topic/simulation/"+serviceid+"/relay/"+msg.id+"/control/"+msg.on,{}); connect.send("/app/topic/simulation/"+serviceid+"/relay/"+msg.id+"/control/"+msg.on,{});
} }
this.upmodelaction = function(type,index){ this.upmodelaction = function(type,index){
if(type == "0"){ if(type == "0"){
@ -210,6 +240,23 @@ export function Jl3ddevice(dom,serviceid) {
scope.modelmanager.actionlist[index].play(); scope.modelmanager.actionlist[index].play();
} }
}; };
this.buttoncontrol = function(action){
if("startstop"){
moveanima.startstop();
}
if("next"){
moveanima.next();
}
if("before"){
moveanima.before();
}
};
this.resetmodel = function(){
moveanima.setplaylist(moveanima.animatelist[scope.selectmodel.code+"fuwei"],true);
};
//循环渲染函数 //循环渲染函数
let delta; let delta;
let data; let data;
@ -227,9 +274,12 @@ export function Jl3ddevice(dom,serviceid) {
// scope.controls.update(); // scope.controls.update();
// stats.update(); // stats.update();
delta = clock.getDelta(); delta = clock.getDelta();
if(textplane){
textplane.lookAt(camera.position);
}
if (scope.mixers) { if (scope.mixers) {
for (let i = 0; i < scope.mixers.length; i++) { for (let i = 0; i < scope.mixers.length; i++) {
if (scope.mixers[i]) { if (scope.mixers[i]._actions[0].isRunning()) {
scope.mixers[i].update(delta); scope.mixers[i].update(delta);
} }
} }
@ -239,107 +289,18 @@ export function Jl3ddevice(dom,serviceid) {
function move1(){ function move1(){
for(let i=0,leni=scope.selectmodel.children.length;i<leni;i++){ moveanima.setplaylist(moveanima.animatelist[scope.selectmodel.code+"on"],true);
if(scope.selectmodel.children[i].name == "dizuo"){
moveanima.animatelist[scope.selectmodel.name+"dizuoon"].enable = true;
}
if(scope.selectmodel.children[i].name == "Lxing"){
moveanima.animatelist[scope.selectmodel.name+"Lxingon"].enable = true;
}
if(scope.selectmodel.children[i].name == "jiaoxingxiantie"){
moveanima.animatelist[scope.selectmodel.name+"jiaoxingxiantieon"].enable = true;
}
if(scope.selectmodel.children[i].name == "xianquan"){
moveanima.animatelist[scope.selectmodel.name+"xianquanon"].enable = true;
}
if(scope.selectmodel.children[i].name == "zhongchuipian"){
moveanima.animatelist[scope.selectmodel.name+"zhongchuipianon"].enable = true;
}
if(scope.selectmodel.children[i].name == "lagan"){
moveanima.animatelist[scope.selectmodel.name+"laganon"].enable = true;
}
if(scope.selectmodel.children[i].name == "dongjiedianzhou"){
moveanima.animatelist[scope.selectmodel.name+"dongjiedianzhouon"].enable = true;
}
if(scope.selectmodel.children[i].name == "neibu"){
moveanima.animatelist[scope.selectmodel.name+"neibuon"].enable = true;
}
if(scope.selectmodel.children[i].name == "jiedian"){
moveanima.animatelist[scope.selectmodel.name+"jiedianon"].enable = true;
}
if(scope.selectmodel.children[i].name == "yapian"){
moveanima.animatelist[scope.selectmodel.name+"yapianon"].enable = true;
}
if(scope.selectmodel.children[i].name == "fanghuozhao"){
moveanima.animatelist[scope.selectmodel.name+"fanghuozhaoon"].enable = true;
}
if(scope.selectmodel.children[i].name == "dianyuanpian"){
moveanima.animatelist[scope.selectmodel.name+"dianyuanpianon"].enable = true;
}
if(scope.selectmodel.children[i].name == "xinpian"){
moveanima.animatelist[scope.selectmodel.name+"xinpianon"].enable = true;
}
if(scope.selectmodel.children[i].name =="jueyuanzhou"){
moveanima.animatelist[scope.selectmodel.name+"jueyuanzhouon"].enable = true;
}
if(scope.selectmodel.children[i].name =="cigang"){
moveanima.animatelist[scope.selectmodel.name+"cigangon"].enable = true;
}
}
} }
function move2(){ function move2(){
if(scope.selectmodel){ if(scope.selectmodel){
moveanima.setplaylist(moveanima.animatelist[scope.selectmodel.code+"off"],true);
}
}
for(let i=0,leni=scope.selectmodel.children.length;i<leni;i++){ function move3(){
if(scope.selectmodel){
if(scope.selectmodel.children[i].name == "dizuo"){ moveanima.setplaylist(moveanima.animatelist[scope.selectmodel.code+"fuwei"],true);
moveanima.animatelist[scope.selectmodel.name+"dizuooff"].enable = true;
}
if(scope.selectmodel.children[i].name == "Lxing"){
moveanima.animatelist[scope.selectmodel.name+"Lxingoff"].enable = true;
}
if(scope.selectmodel.children[i].name == "jiaoxingxiantie"){
moveanima.animatelist[scope.selectmodel.name+"jiaoxingxiantieoff"].enable = true;
}
if(scope.selectmodel.children[i].name == "xianquan"){
moveanima.animatelist[scope.selectmodel.name+"xianquanoff"].enable = true;
}
if(scope.selectmodel.children[i].name == "zhongchuipian"){
moveanima.animatelist[scope.selectmodel.name+"zhongchuipianoff"].enable = true;
}
if(scope.selectmodel.children[i].name == "lagan"){
moveanima.animatelist[scope.selectmodel.name+"laganoff"].enable = true;
}
if(scope.selectmodel.children[i].name == "dongjiedianzhou"){
moveanima.animatelist[scope.selectmodel.name+"dongjiedianzhouoff"].enable = true;
}
if(scope.selectmodel.children[i].name == "neibu"){
moveanima.animatelist[scope.selectmodel.name+"neibuoff"].enable = true;
}
if(scope.selectmodel.children[i].name == "jiedian"){
moveanima.animatelist[scope.selectmodel.name+"jiedianoff"].enable = true;
}
if(scope.selectmodel.children[i].name == "yapian"){
moveanima.animatelist[scope.selectmodel.name+"yapianoff"].enable = true;
}
if(scope.selectmodel.children[i].name == "fanghuozhao"){
moveanima.animatelist[scope.selectmodel.name+"fanghuozhaooff"].enable = true;
}
if(scope.selectmodel.children[i].name == "dianyuanpian"){
moveanima.animatelist[scope.selectmodel.name+"dianyuanpianoff"].enable = true;
}
if(scope.selectmodel.children[i].name == "xinpian"){
moveanima.animatelist[scope.selectmodel.name+"xinpianoff"].enable = true;
}
if(scope.selectmodel.children[i].name =="jueyuanzhou"){
moveanima.animatelist[scope.selectmodel.name+"jueyuanzhouoff"].enable = true;
}
if(scope.selectmodel.children[i].name =="cigang"){
moveanima.animatelist[scope.selectmodel.name+"cigangoff"].enable = true;
}
}
} }
} }
@ -363,7 +324,7 @@ export function Jl3ddevice(dom,serviceid) {
camera.position.set(10800, 500, 0); camera.position.set(10800, 500, 0);
scope.controls.target = new THREE.Vector3(10000,0,0); scope.controls.target = new THREE.Vector3(10000,0,0);
scope.jdqcontrol.jdqdevicelist(scope.modelmanager.controllist[i]); scope.jdqcontrol.jdqdevicelist(scope.modelmanager.controllist[i]);
updatemenulist(scope.jdqcontrol.devicelist); updatemenulist(scope.jdqcontrol.devicelist,scope.modelmanager.controllist[i].code);
scope.controls.update(); scope.controls.update();
scope.selectmodel = scope.modelmanager.controllist[i]; scope.selectmodel = scope.modelmanager.controllist[i];
@ -431,7 +392,7 @@ export function Jl3ddevice(dom,serviceid) {
camera.position.set(10800, 500, 0); camera.position.set(10800, 500, 0);
scope.controls.target = new THREE.Vector3(10000,0,0); scope.controls.target = new THREE.Vector3(10000,0,0);
scope.jdqcontrol.jdqdevicelist(scope.modelmanager.controllist[i]); scope.jdqcontrol.jdqdevicelist(scope.modelmanager.controllist[i]);
updatemenulist(scope.jdqcontrol.devicelist); updatemenulist(scope.jdqcontrol.devicelist,scope.modelmanager.controllist[i].code);
scope.controls.update(); scope.controls.update();
scope.selectmodel = scope.modelmanager.controllist[i]; scope.selectmodel = scope.modelmanager.controllist[i];
@ -464,16 +425,23 @@ export function Jl3ddevice(dom,serviceid) {
textplane.material.dispose(); textplane.material.dispose();
} }
if(intersects[0]){ if(intersects[0]){
dragcontrol.setObjects(intersects[0].object);
if(intersects[0].object.raycastoff){ if(intersects[0].object.raycastoff){
helpbox = new THREE.BoxHelper( intersects[0].object.parent, 0xff0000 ); helpbox = new THREE.BoxHelper( intersects[0].object.parent, 0xff0000 );
settext(intersects[0].object.parent,intersects[0].point); settext(intersects[0].object.parent,intersects[0].point);
getdevicemsg(intersects[0].object.parent.name); getdevicemsg(intersects[0].object.parent.name);
}else{ }else{
helpbox = new THREE.BoxHelper( intersects[0].object, 0xff0000 ); helpbox = new THREE.BoxHelper( intersects[0].object, 0xff0000 );
settext(intersects[0].object,intersects[0].point); settext(intersects[0].object,intersects[0].point);
getdevicemsg(intersects[0].object.name); getdevicemsg(intersects[0].object.name);
} }
scope.controls.enabled = false;
dragcontrol.enabled = true;
scene.add( helpbox ); scene.add( helpbox );
} }
} }
@ -481,6 +449,47 @@ export function Jl3ddevice(dom,serviceid) {
} }
} }
function onmouseup(event){
// event.preventDefault();
scope.controls.enabled = true;
dragcontrol.enabled = false;
//
// dragcontrol.setObjects(null);
// document.removeEventListener("mouseup", onmouseup, false );
}
this.animationmsgshowon = function(nowobject){
scope.animationmodel = nowobject;
if(helpbox){
scope.animationmodel.helpbox = null;
scene.remove( helpbox );
helpbox = undefined;
}
settext(scope.animationmodel,scope.animationmodel.position);
// console.log(scope.animationmodel);
helpbox = new THREE.BoxHelper( scope.animationmodel, 0xff0000 );
moveanima.updatehelpbox(helpbox,textplane);
// settext(intersects[0].object,intersects[0].point);
// getdevicemsg(intersects[0].object.name);
scene.add( helpbox );
getdevicemsg(nowobject.name);
}
this.animationmsgshowoff = function(nowobject){
if(helpbox){
scope.animationmodel.helpbox = null;
scene.remove( helpbox );
helpbox = undefined;
}
if(textplane){
scene.remove(textplane);
textplane.geometry.dispose();
textplane.material.dispose();
}
scope.animationmodel = null;
}
function getdevicemsg(selectname){ function getdevicemsg(selectname){
// console.log(selectname); // console.log(selectname);
@ -493,6 +502,7 @@ export function Jl3ddevice(dom,serviceid) {
} }
} }
function settext(intersects,point){ function settext(intersects,point){
if(scope.status == '1'){
if(intersects.text){ if(intersects.text){
let textgeometry = new THREE.PlaneBufferGeometry( 300, 200, 1 ); let textgeometry = new THREE.PlaneBufferGeometry( 300, 200, 1 );
let textt = new THREE.CanvasTexture(getTextCanvas(intersects.text)); let textt = new THREE.CanvasTexture(getTextCanvas(intersects.text));
@ -517,12 +527,16 @@ export function Jl3ddevice(dom,serviceid) {
textplane.lookAt(camera.position); textplane.lookAt(camera.position);
// scope.textlist.push(textplane); // scope.textlist.push(textplane);
// newmesh.children[0].add(textplane); // newmesh.children[0].add(textplane);
scene.add(textplane); scene.add(textplane);
textgeometry.dispose(); textgeometry.dispose();
textmaterial.dispose(); textmaterial.dispose();
textt.dispose(); textt.dispose();
} }
}
} }
var beauty = new Image(); var beauty = new Image();
@ -530,6 +544,7 @@ export function Jl3ddevice(dom,serviceid) {
//canvas文字贴图方法 //canvas文字贴图方法
//PS:待提炼 增强功能 //PS:待提炼 增强功能
function getTextCanvas(text){ function getTextCanvas(text){
if(scope.status == '1'){
var canvas = document.getElementById('canvastexture'); var canvas = document.getElementById('canvastexture');
canvas.width = 256; canvas.width = 256;
@ -555,5 +570,6 @@ export function Jl3ddevice(dom,serviceid) {
return data; return data;
} }
}
} }

View File

@ -0,0 +1,570 @@
import { Staticmodel } from '@/jlmap3d/jl3ddevicetrain/config.js';
//loader
import { FBXLoader } from '@/jlmap3d/main/loaders/FBXLoader';
import { OrbitControls } from '@/jlmap3d/main/control/OrbitControls';
import { ModelManager } from '@/jlmap3d/jl3ddevicetrain/loader.js';
import { Moveanimate } from '@/jlmap3d/jl3ddevicetrain/component/moveanimate.js';
import { Jdqcontrol } from '@/jlmap3d/jl3ddevicetrain/component/jdqcontrol.js';
import StompClient from '@/jlmap3d/jl3ddevicetrain/component/StompClient.js';
// import { Signallightload } from '@/jlmap3d/jl3ddevice/component/signallight.js';
// import StompClient from '@/utils/sock';
import {Stats} from '@/jlmap3d/main/lib/stats.min.js';
var clock = new THREE.Clock();
export function Jl3ddevice(dom,serviceid) {
let scope = this;
//helpbox选中包围框
//textplane三维介绍标牌
let helpbox,textplane;
let connect = null;
this.dom = dom;
this.nowcode = null;
this.animateswitch = false;
this.mixers = [];
this.showmodel = null;
//场景状态
this.status = 0;
//动画状态
this.animastats = false;
//当前选中模型
this.selectmodel = null;
//初始化webgl渲染
let renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize(dom.offsetWidth, dom.offsetHeight);
// renderer.shadowMap.enabled = true;
// renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.setClearColor( 0x000000, 0 );
this.dom.appendChild(renderer.domElement);
//定义相机
let camera = new THREE.PerspectiveCamera(70, dom.offsetWidth / dom.offsetHeight, 0.01, 5000);
camera.position.set(-1000, 1500, 0);
camera.aspect = dom.offsetWidth / dom.offsetHeight;
camera.updateProjectionMatrix();
//视角轨迹控制器
this.controls = new THREE.OrbitControls(camera, dom);
this.controls.target = new THREE.Vector3(500,1000,0);
this.controls.screenSpacePanning = true;
this.controls.update();
//定义场景(渲染容器)
let scene = new THREE.Scene();
var bgTexture = new THREE.TextureLoader().load("../../static/background/other.jpg");
scene.background = bgTexture;
//定义全局光
let ambientLight = new THREE.AmbientLight(0xffffff, 1.3);
scene.add(ambientLight);
var light = new THREE.HemisphereLight( 0xffffff, 0x444444 );
light.position.set( 0, 200, 0 );
scene.add( light );
//网格地面
// var grid = new THREE.GridHelper( 1000, 20, 0x000000, 0x000000 );
// grid.material.opacity = 0.2;
// grid.material.transparent = true;
// grid.position.x = 10000;
// scene.add( grid );
//菜单选中设备更新设备较少
this.updateselect = function(updata){
// console.log(updata);
if(helpbox){
scene.remove( helpbox );
helpbox = null;
}
helpbox = new THREE.BoxHelper( updata.mesh, 0xff0000 );
// console.log(updata.mesh);
let point = {
x:updata.mesh.matrixWorld.elements[12],
y:updata.mesh.matrixWorld.elements[13],
z:updata.mesh.matrixWorld.elements[14]
};
settext(updata.mesh,point)
getdevicemsg(updata.mesh.name);
// moveanima.animatelist[scope.selectmodel.name+"select1"].enable = true;
// console.log(intersects[0].object);
scene.add( helpbox );
}
//返回设备选择
this.backselect = function(){
move2();
updatemenulist(scope.jdqcontrol.devicelist);
scope.modelmanager.controllist[0].position.set(19,1270,-275);
scope.modelmanager.controllist[0].rotation.y = -Math.PI/2;
scope.modelmanager.controllist[0].rotation.z = -Math.PI/2;
scope.modelmanager.controllist[1].position.set(19,1270,-165);
scope.modelmanager.controllist[1].rotation.y = -Math.PI/2;
scope.modelmanager.controllist[1].rotation.z = -Math.PI/2;
scope.modelmanager.controllist[2].position.set(19,1270,-55);
scope.modelmanager.controllist[2].rotation.y = -Math.PI/2;
scope.modelmanager.controllist[2].rotation.z = -Math.PI/2;
scope.modelmanager.controllist[3].position.set(19,1270,65);
scope.modelmanager.controllist[3].rotation.y = -Math.PI/2;
scope.modelmanager.controllist[3].rotation.z = -Math.PI/2;
scope.modelmanager.controllist[4].position.set(19,1270,170);
scope.modelmanager.controllist[4].rotation.y = -Math.PI/2;
scope.modelmanager.controllist[4].rotation.z = -Math.PI/2;
scope.modelmanager.controllist[5].position.set(19,1270,280);
scope.modelmanager.controllist[5].rotation.y = -Math.PI/2;
scope.modelmanager.controllist[5].rotation.z = -Math.PI/2;
camera.position.set(-1000, 1500, 0);
scope.controls.target = new THREE.Vector3(500,1000,0);
scope.controls.update();
scope.status = '0';
if(textplane){
scene.remove(textplane);
textplane.geometry.dispose();
textplane.material.dispose();
}
scope.selectmodel = null;
scope.jdqcontrol.devicelist = [];
scope.animastats = false;
updatemsg();
};
//设备分解、归位动画按钮
this.disperdevice = function(){
if(scope.status == '1'){
if(moveanima.status == true){
if(scope.animastats == false){
scope.animastats = true;
move1();
} else if(scope.animastats == true){
scope.animastats = false;
move2();
}
}
}
};
// let stats = new Stats();
// dom.appendChild( stats.dom );
document.addEventListener( "mousedown", onselect, false );
document.addEventListener( "touchstart", ontouch, false );
window.onresize = function () {
camera.aspect = scope.dom.offsetWidth / scope.dom.offsetHeight;
camera.updateProjectionMatrix();
renderer.setSize(scope.dom.offsetWidth, scope.dom.offsetHeight);
}
this.jdqcontrol = new Jdqcontrol();
let moveanima = new Moveanimate(scope);
this.anime = null;
this.modelmanager = new ModelManager();
this.modelmanager.loadpromise(Staticmodel, scope.mixers,scene).then(function (data) {
moveanima.initlistnew( scope.modelmanager.controllist);
connect = new StompClient();
// debugger
connect.subscribe("/queue/simulation/"+serviceid,callback);
animate();
});
this.sendmsg = function (type,index){
// console.log(index);
let msg = {
// deskId:serviceid,
id:index+1,
on:null
};
if(type == "0"){
msg.on = true;
}
if(type == "1"){
msg.on = false;
}
//"/app/topic/relay/"+msg.id+"/control/"+msg.on
connect.send("/app/topic/simulation/"+serviceid+"/relay/"+msg.id+"/control/"+msg.on,{});
}
this.upmodelaction = function(type,index){
if(type == "0"){
scope.modelmanager.actionlist[index].reset();
scope.modelmanager.actionlist[index].time = 0;
scope.modelmanager.actionlist[index].timeScale = 1;
scope.modelmanager.actionlist[index].play();
}
if(type == "1"){
scope.modelmanager.actionlist[index].reset();
scope.modelmanager.actionlist[index].time = scope.modelmanager.actionlist[index]._clip.duration;
scope.modelmanager.actionlist[index].timeScale = -1;
scope.modelmanager.actionlist[index].play();
}
};
//循环渲染函数
let delta;
let data;
function callback(Response){
// console.log(Response);
data = JSON.parse(Response.body);
// console.log(data);
upjdqstats(data);
}
function animate() {
scope.anime = requestAnimationFrame(animate);
renderer.render(scene, camera);
moveanima.animateupdate();
// scope.controls.update();
// stats.update();
delta = clock.getDelta();
if (scope.mixers) {
for (let i = 0; i < scope.mixers.length; i++) {
if (scope.mixers[i]._actions[0].isRunning()) {
scope.mixers[i].update(delta);
}
}
}
}
function move1(){
console.log(scope.selectmodel);
moveanima.animatelist[scope.selectmodel.code+"fanghuozhao"+"on"].enable = true;
// for(let i=0,leni=scope.selectmodel.children.length;i<leni;i++){
//
// if(scope.selectmodel.children[i].name == "dizuo"){
// moveanima.animatelist[scope.selectmodel.name+"dizuoon"].enable = true;
// }
// if(scope.selectmodel.children[i].name == "Lxing"){
// moveanima.animatelist[scope.selectmodel.name+"Lxingon"].enable = true;
// }
// if(scope.selectmodel.children[i].name == "jiaoxingxiantie"){
// moveanima.animatelist[scope.selectmodel.name+"jiaoxingxiantieon"].enable = true;
// }
// if(scope.selectmodel.children[i].name == "xianquan"){
// moveanima.animatelist[scope.selectmodel.name+"xianquanon"].enable = true;
// }
// if(scope.selectmodel.children[i].name == "zhongchuipian"){
// moveanima.animatelist[scope.selectmodel.name+"zhongchuipianon"].enable = true;
// }
// if(scope.selectmodel.children[i].name == "lagan"){
// moveanima.animatelist[scope.selectmodel.name+"laganon"].enable = true;
// }
// if(scope.selectmodel.children[i].name == "dongjiedianzhou"){
// moveanima.animatelist[scope.selectmodel.name+"dongjiedianzhouon"].enable = true;
// }
// if(scope.selectmodel.children[i].name == "neibu"){
// moveanima.animatelist[scope.selectmodel.name+"neibuon"].enable = true;
// }
// if(scope.selectmodel.children[i].name == "jiedian"){
// moveanima.animatelist[scope.selectmodel.name+"jiedianon"].enable = true;
// }
// if(scope.selectmodel.children[i].name == "yapian"){
// moveanima.animatelist[scope.selectmodel.name+"yapianon"].enable = true;
// }
// if(scope.selectmodel.children[i].name == "fanghuozhao"){
// moveanima.animatelist[scope.selectmodel.name+"fanghuozhaoon"].enable = true;
// }
// if(scope.selectmodel.children[i].name == "dianyuanpian"){
// moveanima.animatelist[scope.selectmodel.name+"dianyuanpianon"].enable = true;
// }
// if(scope.selectmodel.children[i].name == "xinpian"){
// moveanima.animatelist[scope.selectmodel.name+"xinpianon"].enable = true;
// }
// if(scope.selectmodel.children[i].name =="jueyuanzhou"){
// moveanima.animatelist[scope.selectmodel.name+"jueyuanzhouon"].enable = true;
// }
// if(scope.selectmodel.children[i].name =="cigang"){
// moveanima.animatelist[scope.selectmodel.name+"cigangon"].enable = true;
// }
// }
}
function move2(){
if(scope.selectmodel){
moveanima.animatelist[scope.selectmodel.code+"yapian"+"off"].enable = true;
// for(let i=0,leni=scope.selectmodel.children.length;i<leni;i++){
//
// if(scope.selectmodel.children[i].name == "dizuo"){
// moveanima.animatelist[scope.selectmodel.name+"dizuooff"].enable = true;
// }
// if(scope.selectmodel.children[i].name == "Lxing"){
// moveanima.animatelist[scope.selectmodel.name+"Lxingoff"].enable = true;
// }
// if(scope.selectmodel.children[i].name == "jiaoxingxiantie"){
// moveanima.animatelist[scope.selectmodel.name+"jiaoxingxiantieoff"].enable = true;
// }
// if(scope.selectmodel.children[i].name == "xianquan"){
// moveanima.animatelist[scope.selectmodel.name+"xianquanoff"].enable = true;
// }
// if(scope.selectmodel.children[i].name == "zhongchuipian"){
// moveanima.animatelist[scope.selectmodel.name+"zhongchuipianoff"].enable = true;
// }
// if(scope.selectmodel.children[i].name == "lagan"){
// moveanima.animatelist[scope.selectmodel.name+"laganoff"].enable = true;
// }
// if(scope.selectmodel.children[i].name == "dongjiedianzhou"){
// moveanima.animatelist[scope.selectmodel.name+"dongjiedianzhouoff"].enable = true;
// }
// if(scope.selectmodel.children[i].name == "neibu"){
// moveanima.animatelist[scope.selectmodel.name+"neibuoff"].enable = true;
// }
// if(scope.selectmodel.children[i].name == "jiedian"){
// moveanima.animatelist[scope.selectmodel.name+"jiedianoff"].enable = true;
// }
// if(scope.selectmodel.children[i].name == "yapian"){
// moveanima.animatelist[scope.selectmodel.name+"yapianoff"].enable = true;
// }
// if(scope.selectmodel.children[i].name == "fanghuozhao"){
// moveanima.animatelist[scope.selectmodel.name+"fanghuozhaooff"].enable = true;
// }
// if(scope.selectmodel.children[i].name == "dianyuanpian"){
// moveanima.animatelist[scope.selectmodel.name+"dianyuanpianoff"].enable = true;
// }
// if(scope.selectmodel.children[i].name == "xinpian"){
// moveanima.animatelist[scope.selectmodel.name+"xinpianoff"].enable = true;
// }
// if(scope.selectmodel.children[i].name =="jueyuanzhou"){
// moveanima.animatelist[scope.selectmodel.name+"jueyuanzhouoff"].enable = true;
// }
// if(scope.selectmodel.children[i].name =="cigang"){
// moveanima.animatelist[scope.selectmodel.name+"cigangoff"].enable = true;
// }
// }
}
}
function ontouch(event){
if(scope.status == '0'){
let raycaster = new THREE.Raycaster();
//定义平面鼠标点击坐标
let mouse = new THREE.Vector2();
mouse.x = (event.touches[0].pageX / dom.offsetWidth) * 2 - 1;
mouse.y = -(event.touches[0].pageY / dom.offsetHeight) * 2 + 1;
raycaster.setFromCamera( mouse, camera );
for(let i=0,leni=scope.modelmanager.controllist.length;i<leni;i++){
let intersects = raycaster.intersectObjects( scope.modelmanager.controllist[i].children,true);
if(intersects[0]){
scope.modelmanager.controllist[i].position.set(10000,0,0);
scope.modelmanager.controllist[i].rotation.y = 0;
scope.modelmanager.controllist[i].rotation.z = 0;
camera.position.set(10800, 500, 0);
scope.controls.target = new THREE.Vector3(10000,0,0);
scope.jdqcontrol.jdqdevicelist(scope.modelmanager.controllist[i]);
updatemenulist(scope.jdqcontrol.devicelist);
scope.controls.update();
scope.selectmodel = scope.modelmanager.controllist[i];
scope.status = '1';
}
}
}
if(scope.status == '1'){
//定义光线
let raycaster = new THREE.Raycaster();
//定义平面鼠标点击坐标
let mouse = new THREE.Vector2();
mouse.x = (event.touches[0].pageX / dom.offsetWidth) * 2 - 1;
mouse.y = -(event.touches[0].pageY / dom.offsetHeight) * 2 + 1;
raycaster.setFromCamera( mouse, camera );
let intersects = raycaster.intersectObjects( scope.modelmanager.controllist,true);
if(helpbox){
scene.remove( helpbox );
helpbox = null;
}
if(textplane){
scene.remove(textplane);
textplane.geometry.dispose();
textplane.material.dispose();
}
if(intersects[0]){
if(intersects[0].object.raycastoff){
helpbox = new THREE.BoxHelper( intersects[0].object.parent, 0xff0000 );
settext(intersects[0].object.parent,intersects[0].point);
getdevicemsg(intersects[0].object.parent.name);
}else{
helpbox = new THREE.BoxHelper( intersects[0].object, 0xff0000 );
settext(intersects[0].object,intersects[0].point);
getdevicemsg(intersects[0].object.name);
}
scene.add( helpbox );
}
}
}
function onselect(event){
if(event.button == '0'){
if(scope.status == '0'){
let raycaster = new THREE.Raycaster();
//定义平面鼠标点击坐标
let mouse = new THREE.Vector2();
mouse.x = (event.clientX / dom.offsetWidth) * 2 - 1;
mouse.y = -(event.clientY / dom.offsetHeight) * 2 + 1;
raycaster.setFromCamera( mouse, camera );
for(let i=0,leni=scope.modelmanager.controllist.length;i<leni;i++){
let intersects = raycaster.intersectObjects( scope.modelmanager.controllist[i].children,true);
if(intersects[0]){
scope.modelmanager.controllist[i].position.set(10000,0,0);
scope.modelmanager.controllist[i].rotation.y = 0;
scope.modelmanager.controllist[i].rotation.z = 0;
camera.position.set(10800, 500, 0);
scope.controls.target = new THREE.Vector3(10000,0,0);
scope.jdqcontrol.jdqdevicelist(scope.modelmanager.controllist[i]);
updatemenulist(scope.jdqcontrol.devicelist);
scope.controls.update();
scope.selectmodel = scope.modelmanager.controllist[i];
scope.status = '1';
i = scope.modelmanager.controllist.length;
}
}
}
if(scope.status == '1'){
//定义光线
let raycaster = new THREE.Raycaster();
//定义平面鼠标点击坐标
let mouse = new THREE.Vector2();
mouse.x = (event.clientX / dom.offsetWidth) * 2 - 1;
mouse.y = -(event.clientY / dom.offsetHeight) * 2 + 1;
raycaster.setFromCamera( mouse, camera );
let intersects = raycaster.intersectObjects( scope.modelmanager.controllist,true);
if(helpbox){
scene.remove( helpbox );
helpbox = null;
}
if(textplane){
scene.remove(textplane);
textplane.geometry.dispose();
textplane.material.dispose();
}
if(intersects[0]){
if(intersects[0].object.raycastoff){
helpbox = new THREE.BoxHelper( intersects[0].object.parent, 0xff0000 );
settext(intersects[0].object.parent,intersects[0].point);
getdevicemsg(intersects[0].object.parent.name);
}else{
helpbox = new THREE.BoxHelper( intersects[0].object, 0xff0000 );
settext(intersects[0].object,intersects[0].point);
getdevicemsg(intersects[0].object.name);
}
scene.add( helpbox );
}
}
}
}
this.animationmsgshow = function(nowobject){
getdevicemsg(nowobject.name);
}
function getdevicemsg(selectname){
// console.log(selectname);
for(let i=0,leni=scope.jdqcontrol.devicelist.length;i<leni;i++){
if(selectname == scope.jdqcontrol.devicelist[i].name){
updatemsg(scope.jdqcontrol.devicelist[i].text,scope.jdqcontrol.devicelist[i].msg);
i=leni;
}
}
}
function settext(intersects,point){
if(intersects.text){
let textgeometry = new THREE.PlaneBufferGeometry( 300, 200, 1 );
let textt = new THREE.CanvasTexture(getTextCanvas(intersects.text));
let textmaterial = new THREE.MeshBasicMaterial( {
side: THREE.DoubleSide,
map:textt ,transparent: true,
alphaTest:0.1
} );
if(textplane){
scene.remove(textplane);
textplane.geometry.dispose();
textplane.material.dispose();
}
textplane= new THREE.Mesh( textgeometry, textmaterial );
// textplane.name = data[i].code;
textplane.position.x = point.x;
textplane.position.y = point.y+100;
textplane.position.z = point.z;
// console.log(textplane.position);
// textplane.tcode = data[i].code;
textplane.rotation.y = -Math.PI/2;
textplane.lookAt(camera.position);
// scope.textlist.push(textplane);
// newmesh.children[0].add(textplane);
scene.add(textplane);
textgeometry.dispose();
textmaterial.dispose();
textt.dispose();
}
}
var beauty = new Image();
beauty.src = "../../static/texture/guide.png";
//canvas文字贴图方法
//PS:待提炼 增强功能
function getTextCanvas(text){
var canvas = document.getElementById('canvastexture');
canvas.width = 256;
canvas.height = 128;
var ctx = canvas.getContext('2d');
//var bg = canvas.createPattern(img, "no-repeat");
//ctx.fillStyle = bg;
ctx.fillRect(0, 0,256,128);
ctx.font = "20px Verdana";
ctx.fillStyle = '#FFFFFF';
ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
ctx.clearRect(0,0,256,128);
//console.log(text.groupNumber);
ctx.drawImage(beauty,0,0,256, 128);
ctx.fillText("设备部件:"+text, 90,30);
// ctx.fillText("车组人员:XXX", 40,20);
// ctx.fillText("速度:XXX.XXX", 40,30);
//ctx.fillText(text.trainModel.name, width/2,height*3/4);
let data = ctx.getImageData(0, 0,256, 128);
return data;
}
}

View File

@ -6,43 +6,42 @@ export function ModelManager(){
this.controllist = []; this.controllist = [];
this.actionlist = []; this.actionlist = [];
let jdq1 = { let jdq1 = {
code:jdq1, code:"jdq1",
locateType:"01", locateType:"01",
mesh:null, mesh:null,
action:null action:null
}; };
let jdq2 = { let jdq2 = {
code:jdq2, code:"jdq2",
locateType:"01", locateType:"01",
mesh:null, mesh:null,
action:null action:null
}; };
let jdq3 = { let jdq3 = {
code:jdq3, code:"jdq3",
locateType:"01", locateType:"01",
mesh:null, mesh:null,
action:null action:null
}; };
let jdq4 = { let jdq4 = {
code:jdq4, code:"jdq4",
locateType:"01", locateType:"01",
mesh:null, mesh:null,
action:null action:null
}; };
let jdq5 = { let jdq5 = {
code:jdq5, code:"jdq5",
locateType:"01", locateType:"01",
mesh:null, mesh:null,
action:null action:null
}; };
let jdq6 = { let jdq6 = {
code:jdq6, code:"jdq6",
locateType:"01", locateType:"01",
mesh:null, mesh:null,
action:null action:null
}; };
this.jdqg = { this.jdqg = {
code:null, code:null,
locateType:"00", locateType:"00",
@ -164,7 +163,9 @@ function fbxpromise(asset,mixers,model){
} }
} }
object.name = asset.name; object.name = asset.name;
object.code = model.code;
model.mesh = object; model.mesh = object;
if(object.animations.length>0){ if(object.animations.length>0){

View File

@ -140,7 +140,7 @@ export function JLmapDriving(dom,data,mapId,storemod,translation,routegroup,proj
// controls3.getObject().rotation.x = Math.PI/2; // controls3.getObject().rotation.x = Math.PI/2;
scene.add(controls3.getObject()); scene.add(controls3.getObject());
let cameracctv = new THREE.PerspectiveCamera(50, dom.clientWidth/dom.clientHeight, 1, 10); let cameracctv = new THREE.PerspectiveCamera(50, dom.clientWidth/dom.clientHeight, 1, 50);
cameracctv.position.set( 0, -1,30 ); cameracctv.position.set( 0, -1,30 );
// cameracctv.rotation.y = Math.PI/2; // cameracctv.rotation.y = Math.PI/2;
@ -251,7 +251,9 @@ export function JLmapDriving(dom,data,mapId,storemod,translation,routegroup,proj
renderer.render(scene, camera); renderer.render(scene, camera);
//cctv渲染 //cctv渲染
if(scope.cctvswitch == true){
renderercctv.render(scene,cameracctv);
}
//相机按键位移 //相机按键位移
// controls3.update(); // controls3.update();
@ -284,11 +286,11 @@ export function JLmapDriving(dom,data,mapId,storemod,translation,routegroup,proj
// //
delta = clock.getDelta(); delta = clock.getDelta();
for (let i=mixers.length-1; i>=0; i--) { for (let i=mixers.length-1; i>=0; i--) {
if(mixers[i]._actions[0].isRunning()){
mixers[i].update( delta ); mixers[i].update( delta );
} }
if(scope.cctvswitch == true){
renderercctv.render(scene,cameracctv);
} }
}; };
} }

View File

@ -58,21 +58,23 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
// // console.log(event.data); // // console.log(event.data);
// //
// } // }
if(event.data.type == "Device_Load_Destroy_3D"){ if(event.data.type == "Device_Load_Destroy_3D"){
DeviceDestroy(event.data); DeviceDestroy(event.data);
return; return;
} }
if(event.data.type == 'TrainRun_3D'){ if(event.data.type == 'TrainRun_3D'){
for(let i=0,leni=event.data.body.length;i<leni;i++){ for(let i=0,leni=event.data.body.length;i<leni;i++){
// console.log(event.data.body[i]); // console.log(event.data.body[i]);
trainrun(event.data.body[i]); trainrunnew(event.data.body[i]);
} }
return; return;
} }
// if(event.data.type == 'TRAIN'){ // if(event.data.type == 'TRAIN'){
// // console.log(event.data); // console.log(event.data);
// trainrun(event.data); // trainrun(event.data);
// } // }
if (event.data.type== 'SIGNAL' && signallist) { if (event.data.type== 'SIGNAL' && signallist) {
@ -144,10 +146,202 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
} }
}; };
function trainrunnew(data){
function trainrun(data){
let code = data.code; let code = data.code;
if(trainlisttest.list[code].right != data.right){
if(data.right == "0"){
trainlisttest.list[code].right = "0";
trainlisttest.list[code].rotation.y = Math.PI;
let point = rails.sectionrail[data.section].lineleft.getPointAt(data.offset);
trainlisttest.list[code].position.x = point.x;
for (let tl=0; tl<6; tl++) {
trainlisttest.list[code].children[tl].position.z = point.z;
}
}else{
trainlisttest.list[code].right = "1";
trainlisttest.list[code].rotation.y = 0;
let point = rails.sectionrail[data.section].lineleft.getPointAt(data.offset);
trainlisttest.list[code].position.x = point.x;
for (let tl=0; tl<6; tl++) {
trainlisttest.list[code].children[tl].position.z = point.z;
}
}
}
// console.log(data);
if(trainlisttest.list[code].dispose == "0"){
if (data.right == '1') { // 向右
trainlisttest.list[code].right = '1';
trainlisttest.list[code].progress = data.offset;
// trainlisttest.list[code].isstandsection = rails.sectionrail[data.section].standTrack;
// if(rails.sectionrail[data.section].standTrack){
// trainlisttest.list[code].statsstop = 0;
// }
let point = rails.sectionrail[data.section].lineleft.getPointAt(trainlisttest.list[code].progress);
trainlisttest.list[code].rotation.y = 0;
trainlisttest.list[code].position.x = point.x;
trainlisttest.list[code].position.y = 0;
// for (let tl=0; tl<6; tl++) {
// trainlisttest.list[code].children[tl].position.z = parseFloat(point.z);
// }
// trainlisttest.list[code].curve = rails.sectionrail[data.section].lineleft;
// if(data.next){
// trainlisttest.list[code].nextcode = data.next;
// trainlisttest.list[code].nextcurve = rails.sectionrail[data.next].lineleft;
// trainlisttest.list[code].nextlen = rails.sectionrail[data.next].lengthfact;
// }
// trainlisttest.list[code].len = rails.sectionrail[data.section].lengthfact;
trainlisttest.list[code].status = '1';
if(trainlisttest.list[code].children[0].position.z != point.z){
trainlisttest.list[code].children[0].up = new THREE.Vector3(1,0,0);
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();
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].rotation.x = -Math.PI/2;
trainlisttest.list[code].children[0].rotation.z = trainlisttest.list[code].children[0].rotation.y;
trainlisttest.list[code].children[0].rotation.y = 0;
let rotas = {
posr:point,
rota:trainlisttest.list[code].children[0].rotation.z
}
trainlisttest.list[code].children[1].rotalist.push(rotas);
let offsetz = parseFloat(point.z) - parseFloat(trainlisttest.list[code].children[0].position.z);
trainlisttest.list[code].children[0].position.z += offsetz;
}
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++){
//console.log(rs);
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]);
trainlisttest.list[code].children[rs].position.z += offsetz;
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].groupNumber == "005"){
// console.log("rs:"+rs);
// console.log(trainlisttest.list[code].children[rs].matrixWorld.elements[12]);
// console.log(trainlisttest.list[code].children[rs].rotalist[0].posr.x);
// }
if(rs != 5){
let asd = trainlisttest.list[code].children[rs].rotalist[0];
trainlisttest.list[code].children[rs+1].rotalist.push(asd);
}
trainlisttest.list[code].children[rs].rotation.z = trainlisttest.list[code].children[rs].rotalist[0].rota;
trainlisttest.list[code].children[rs].rotalist.splice(0,1)
xh--;
}else{
xh = trainlisttest.list[code].children[rs].rotalist.length;
}
}
//console.log(trainlisttest.list[code].children[rs].rotalist.length);
}
}
}
} else if (data.right == '0') { // 向左
trainlisttest.list[code].right = '0';
trainlisttest.list[code].progress = 1-data.offset;
// trainlisttest.list[code].isstandsection = rails.sectionrail[data.section].standTrack;
// if(rails.sectionrail[data.section].standTrack){
// trainlisttest.list[code].statsstop = 0;
// }
let point = rails.sectionrail[data.section].lineright.getPointAt(trainlisttest.list[code].progress);
trainlisttest.list[code].rotation.y = Math.PI;
trainlisttest.list[code].position.x = point.x;
trainlisttest.list[code].position.y = 0;
// for (let tl=0; tl<6; tl++) {
// trainlisttest.list[code].children[tl].position.z = parseFloat(-point.z);
// }
// trainlisttest.list[code].curve = rails.sectionrail[data.section].lineright;
// if(data.next){
// trainlisttest.list[code].nextcode = data.next;
// trainlisttest.list[code].nextcurve = rails.sectionrail[data.next].lineright;
// trainlisttest.list[code].nextlen = rails.sectionrail[data.next].lengthfact;
// }
// trainlisttest.list[code].len = rails.sectionrail[data.section].lengthfact;
trainlisttest.list[code].status = '0';
if(-trainlisttest.list[code].children[0].position.z != point.z){
trainlisttest.list[code].children[0].up = new THREE.Vector3(-1,0,0);
let tangent = rails.sectionrail[data.section].lineright.getTangentAt(data.offset).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));
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.z = trainlisttest.list[code].children[0].rotation.y;
trainlisttest.list[code].children[0].rotation.y = 0;
let rotas = {
posr:point,
rota:trainlisttest.list[code].children[0].rotation.z
}
trainlisttest.list[code].children[1].rotalist.push(rotas);
let offsetz = point.z + trainlisttest.list[code].children[0].position.z;
trainlisttest.list[code].children[0].position.z -= offsetz;
// trainlisttest.list[code].position.z = point.z;
}
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++){
//console.log(rs);
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].position.z);
trainlisttest.list[code].children[rs].position.z -= offsetz;
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(rs != 5){
let asd = trainlisttest.list[code].children[rs].rotalist[0];
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];
trainlisttest.list[code].children[rs].rotation.z = trainlisttest.list[code].children[rs].rotalist[0].rota;
trainlisttest.list[code].children[rs].rotalist.splice(0,1)
xh--;
}else{
xh = trainlisttest.list[code].children[rs].rotalist.length;
}
}
//console.log(trainlisttest.list[code].children[rs].rotalist.length);
}
}
// console.log(trainlisttest.list[code].rotalist);
}
}
}
}
function trainrun(data){
let code = data.code;
console.log(data);
if(trainlisttest.list[code].dispose == "0"){ if(trainlisttest.list[code].dispose == "0"){
if(trainlisttest.list[code].curve == null){ if(trainlisttest.list[code].curve == null){
if (data.right == '1') { // 向右 if (data.right == '1') { // 向右
@ -275,6 +469,7 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
trainlisttest.list[code].pc = 1; trainlisttest.list[code].pc = 1;
if(trainlisttest.list[code].mixerpush == false){ if(trainlisttest.list[code].mixerpush == false){
for(let mi=0,lenmi=trainlisttest.list[code].mixer.length;mi<lenmi;mi++){ for(let mi=0,lenmi=trainlisttest.list[code].mixer.length;mi<lenmi;mi++){
jlmap3d.mixers.push(trainlisttest.list[code].mixer[mi]); jlmap3d.mixers.push(trainlisttest.list[code].mixer[mi]);
} }

View File

@ -54,7 +54,9 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) {
//定义场景(渲染容器) //定义场景(渲染容器)
let scene = SetScene(project); let scene = SetScene(project);
let scenesimulation = new THREE.Group(); let scenesimulation = new THREE.Group();
let scenestation = new THREE.Group();
scene.add(scenesimulation); scene.add(scenesimulation);
scene.add(scenestation);
//定义镜头操作 //定义镜头操作
let controls = new THREE.OrbitControls(camera); let controls = new THREE.OrbitControls(camera);
controls.maxPolarAngle = Math.PI/2; controls.maxPolarAngle = Math.PI/2;
@ -189,12 +191,12 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) {
scope.webwork.onmessage = function (event) { scope.webwork.onmessage = function (event) {
//更新列车位置 //更新列车位置
if(scope.datatype == "new"){ // if(scope.datatype == "new"){
//
UpdateTrainNew(camera,trainlisttest); // UpdateTrainNew(camera,trainlisttest);
}else{ // }else{
UpdateTrain(camera,trainlisttest); // UpdateTrain(camera,trainlisttest);
} // }
if(camerarail.moveswitch == true){ if(camerarail.moveswitch == true){
// console.log(camerarail.progress); // console.log(camerarail.progress);
@ -218,13 +220,11 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) {
delta = clock.getDelta(); delta = clock.getDelta();
for(let i=scope.mixers.length-1;i>=0;i--){ for(let i=scope.mixers.length-1;i>=0;i--){
if ( scope.mixers[i] ){ if(scope.mixers[i]._actions[0].isRunning()){
// console.log(scope.mixers[i]._actions[0].isRunning());
scope.mixers[i].update( delta ); scope.mixers[i].update( delta );
} }
} }
// renderer.render(scene,camera);
}; };
} }

View File

@ -0,0 +1,55 @@
var Staticmodel = {
man1: {
id: "1",
name: "人物1",
deviceType: "man",
type: "man",
picUrl: "",
assetUrl: "../../static/model/passflow/man1.FBX"
},//"https://joylink.club/oss/wx/switch/switch.FBX"
//../../static/model/device/switch.FBX
man2: {
id: "2",
name: "人物2",
deviceType: "man",
type: "man",
picUrl: "",
assetUrl: "../../static/model/passflow/man2.FBX"
},
station: {
id: "3",
name: "车站",
deviceType: "station",
type: "hrb",
picUrl: "",
assetUrl: "../../static/model/passflow/station.FBX"
},
zhajiin: {
id: "4",
name: "闸机",
deviceType: "zhajiin",
type: "hrb",
picUrl: "",
assetUrl: "../../static/model/passflow/zhajiin.FBX"
},
zhajiout: {
id: "5",
name: "闸机",
deviceType: "zhajiout",
type: "hrb",
picUrl: "",
assetUrl: "../../static/model/passflow/zhajiout.FBX"
},
monitor: {
id: "6",
name: "摄像机",
deviceType: "monitor",
type: "hrb",
picUrl: "",
assetUrl: "../../static/model/passflow/monitor.FBX"
},
}
export { Staticmodel }

View File

@ -0,0 +1,853 @@
import { Staticmodel } from '@/jlmap3d/jl3dpassflow/config.js';
//loader
import { FBXLoader } from '@/jlmap3d/main/loaders/FBXLoader';
import { OrbitControls } from '@/jlmap3d/main/control/OrbitControls';
import { ModelManager } from '@/jlmap3d/jl3dpassflow/loader.js';
import { SkeletonUtils } from '@/jlmap3d/main/utils/SkeletonUtils.js';
import StompClient from '@/utils/sock';
import { Loading } from 'element-ui';
var clock = new THREE.Clock();
let scene,camerass,renderer;
let rendermode = 0;
var mixers = [];
var testmesh1,testmesh2;
var humans = [];
var checkdoor1 = [];
var checkdoor2 = [];
var station;
var zhajiinmodel;
var zhajioutmodel;
var monitor;
let ids = 0;
var rungroup = new THREE.Group();
let originhuman1 = null;
let originhuman2 = null;
let originanima1 = null;
let originanima2 = null;
let moveanimatelist = [];
let zhajiin = [];
let zhajiout = [];
let deviceaction = [];
for(let i=0;i<5;i++){
checkdoor1[i]={
id:"c1"+i,
status:0,
pos:[],
max:10
};
}
for(let i=0;i<5;i++){
let zhaji = {
id:"in0"+(i+1),
status:0,
waiting:0
}
zhajiin.push(zhaji);
}
for(let i=0;i<5;i++){
let zhaji = {
id:"out0"+(i+1),
status:0,
waiting:0
}
zhajiout.push(zhaji);
}
let stationleft = [];
let stationright = [];
for(let i=0;i<22;i++){
let sl = {
id:"left"+i,
status:0,
waiting:0
}
stationleft.push(sl);
}
for(let i=0;i<22;i++){
let sr = {
id:"right"+i,
status:0,
waiting:0
}
stationright.push(sr);
}
var windowWidth = window.innerWidth ;
var windowHeight = window.innerHeight;
var views = [
{
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: [ -8, 5,0],
up: [ -9, 5,-0.1 ],
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
}
];
export function Jl3dstation(dom) {
var scope = this;
this.dom = dom;
this.nowcode = null;
this.animateswitch = false;
this.signallights = [];
this.mixers = [];
this.showmodel = null;
//初始化webgl渲染
renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setClearColor(new THREE.Color(0x000000));
renderer.setSize(dom.offsetWidth, dom.offsetHeight);
this.dom.appendChild(renderer.domElement);
//定义相机
camerass = new THREE.PerspectiveCamera(70, dom.offsetWidth / dom.offsetHeight, 0.01, 1000);
camerass.position.set(0, 80, 40);
camerass.aspect = dom.offsetWidth / dom.offsetHeight;
camerass.updateProjectionMatrix();
for ( var ii = 0; ii < views.length; ++ ii ) {
var view = views[ ii ];
var camera = new THREE.PerspectiveCamera( view.fov, window.innerWidth / window.innerHeight, 1, 200 );
camera.position.fromArray( view.eye );
camera.lookAt( view.up[0],view.up[1],view.up[2] );
view.camera = camera;
}
//定义场景(渲染容器)
scene = new THREE.Scene();
scene.background = new THREE.Color(0xa0a0a0);
var mesh = new THREE.Mesh(new THREE.PlaneBufferGeometry(200, 200), new THREE.MeshPhongMaterial({ color: 0x999999, depthWrite: false }));
mesh.rotation.x = - Math.PI / 2;
mesh.receiveShadow = true;
scene.add(mesh);
var grid = new THREE.GridHelper(200, 20, 0x000000, 0x000000);
grid.material.opacity = 0.2;
grid.material.transparent = true;
scene.add(grid);
//定义全局光
let ambientLight = new THREE.AmbientLight(0xffffff, 1.3);
scene.add(ambientLight);
//
// var spotLight = new THREE.SpotLight(0xffffff);
// spotLight.position.set(-50, 60, 15);
// spotLight.castShadow = true;
// spotLight.shadow.mapSize.width = 1024;
// spotLight.shadow.mapSize.height = 1024;
// scene.add(spotLight);
this.controls = new THREE.OrbitControls(camerass, dom);
this.controls.maxPolarAngle = Math.PI / 2;
this.controls.minPolarangle = Math.PI / 5;
this.controls.maxDistance = 800;
this.controls.screenSpacePanning = true;
this.controls.update();
this.selectmodel = null;
window.onresize = function () {
renderer.setSize(scope.dom.offsetWidth, scope.dom.offsetHeight);
windowWidth = scope.dom.offsetWidth ;
windowHeight = scope.dom.offsetHeight;
camerass.aspect = scope.dom.offsetWidth / scope.dom.offsetHeight;
camerass.updateProjectionMatrix();
}
this.anime = null;
this.modelmanager = new ModelManager();
let loadingInstance = Loading.service({ fullscreen: true });
this.modelmanager.loadpromise(Staticmodel, scope.mixers).then(function (data) {
// console.log(scope.modelmanager);
initstationanimation(scope.modelmanager.station.mesh);
initzhajiinaimation(scope.modelmanager.zhajiin.mesh);
initzhajioutanimation(scope.modelmanager.zhajiout.mesh);
monitor = scope.modelmanager.monitor.mesh;
scene.add(monitor);
originhuman1 = scope.modelmanager.man1.mesh;
originhuman2 = scope.modelmanager.man2.mesh;
let mixer1 = new THREE.AnimationMixer( originhuman1 );
let mixer2 = new THREE.AnimationMixer( originhuman2 );
originanima1 = originhuman1.animations[ 0 ];
originanima2 = originhuman2.animations[ 0 ];
originhuman1.remove(originhuman1.children[2]);
scene.add(rungroup);
loadingInstance.close();
scope.switchrender(true);
animate();
})
//
// let checkobject = setInterval(function(){
// // console.log(originhuman1);
// if(originhuman1){
// console.log("start");
// clearInterval(checkobject);
// //进站控制
// setInterval(function(){
// // console.log("ww");
// // console.log(humans.length);
// if(humans){
// // console.log(humans.length);
// if(humans.length<500){
// newhumancreate();
// }
// // console.log(humans.length);
// for(let i=0;i<humans.length;i++){
// // console.log(humans[i]);
//
// if(humans[i].status == 0){
//
// if(humans[i].stage == 1){
// let points = [];
// points.push(new THREE.Vector3(humans[i].mesh.position.x,humans[i].mesh.position.y,humans[i].mesh.position.z));
// points.push(new THREE.Vector3(humans[i].mesh.position.x,humans[i].mesh.position.y,humans[i].mesh.position.z-5));
// zhajicontrol("in",humans[i].doors);
// moveanimateinit(humans[i],i,points,i,0.02);
// }
// if(humans[i].stage == 2){
// let points = [];
// points.push(new THREE.Vector3(humans[i].mesh.position.x,humans[i].mesh.position.y,humans[i].mesh.position.z));
// points.push(new THREE.Vector3(12,10,12.9));
// points.push(new THREE.Vector3(28,1.7,12.9));
// points.push(new THREE.Vector3(34,1.7,12.9));
//
// //1--left
// //2-- right
// if(humans[i].direct == 1){
// points.push(new THREE.Vector3(34,1.7,16));
// for(let j =0;j<22;j++){
// if(stationleft[j].waiting == 0){
//
// points.push(new THREE.Vector3(51-j*5,1.7,22));
//
// points.push(new THREE.Vector3(51-j*5,1.7,23));
//
// humans[i].doors = j;
// stationright[j].waiting = 1;
// moveanimateinit(humans[i],i,points,i,0.002);
// j =22;
// }
// }
// }else{
// points.push(new THREE.Vector3(34,1.7,16));
// points.push(new THREE.Vector3(14,1.7,17));
// points.push(new THREE.Vector3(14,1.7,3));
// for(let j =0;j<22;j++){
// if(stationright[j].waiting == 0){
//
// points.push(new THREE.Vector3(51-j*5,1.7,3));
//
// points.push(new THREE.Vector3(51-j*5,1.7,2));
// humans[i].doors = j;
// stationright[j].waiting = 1;
// moveanimateinit(humans[i],i,points,i,0.002);
// j =22;
// }
// }
// }
// moveanimateinit(humans[i],i,points,i,0.002);
// }
// //出站
// if(humans[i].stage == 3){
// let points = [];
// points.push(new THREE.Vector3(humans[i].mesh.position.x,humans[i].mesh.position.y,humans[i].mesh.position.z));
// if(humans[i].doors<11){
// if(humans[i].direct == 1){
// points.push(new THREE.Vector3(10,1.7,17));
// }else{
// points.push(new THREE.Vector3(8,1.7,5));
// }
// points.push(new THREE.Vector3(8,1.7,13));
// points.push(new THREE.Vector3(5,1.7,13));
// points.push(new THREE.Vector3(-4,6,13));
// }else{
// if(humans[i].direct == 1){
// points.push(new THREE.Vector3(-19,1.7,17));
// }else{
// points.push(new THREE.Vector3(-18,1.7,6.4));
// }
// points.push(new THREE.Vector3(-18,1.7,13));
// points.push(new THREE.Vector3(-12,1.7,13));
// points.push(new THREE.Vector3(-7,6.8,12));
// }
// points.push(new THREE.Vector3(-5,10,4));
// points.push(new THREE.Vector3(14,10,3));
// var j = Math.floor(Math.random()*(4-1+1))+1;
// points.push(new THREE.Vector3(19,10,-2+j*1.4));
//
// humans[i].doors = j;
// moveanimateinit(humans[i],i,points,i,0.002);
// }
// if(humans[i].stage == 4){
//
// let points = [];
// points.push(new THREE.Vector3(humans[i].mesh.position.x,humans[i].mesh.position.y,humans[i].mesh.position.z));
//
// points.push(new THREE.Vector3(humans[i].mesh.position.x+4,humans[i].mesh.position.y,humans[i].mesh.position.z));
//
// if(humans[i].direct == 1){
// points.push(new THREE.Vector3(33,10,25));
// }else{
// points.push(new THREE.Vector3(33.5,10,-5));
// }
// zhajicontrol("out",humans[i].doors);
// moveanimateinit(humans[i],i,points,i,0.002);
// }
// }
// }
// }
// },3000);
// };
// },1000);
this.switchrender = function(mode){
if(mode){
rendermode = 0;
renderer.setViewport( 0, 0, scope.dom.offsetWidth, scope.dom.offsetHeight );
renderer.setScissor( 0, 0, scope.dom.offsetWidth, scope.dom.offsetHeight );
renderer.setScissorTest( false );
renderer.setSize(scope.dom.offsetWidth, scope.dom.offsetHeight);
camerass.aspect = dom.offsetWidth / dom.offsetHeight;
camerass.updateProjectionMatrix();
}else{
rendermode = 1;
}
}
//循环渲染函数
function animate() {
// console.log(rendermode);
if(rendermode == 0){
renderer.render(scene, camerass);
scope.controls.update();
}else{
monitorrender();
}
let delta = clock.getDelta();
for(let i=mixers.length-1;i>=0;i--){
if ( mixers[i] && mixers[i].runplay == true){
mixers[i].update( delta );
}
}
moveanimateupdate();
scope.anime = requestAnimationFrame(animate);
}
function moveanimateinit(model,name,points,index,speed){
let curve = new THREE.CatmullRomCurve3(points);
curve.curvrtype = "chordal";
// curve动画轨迹
// progress动画进度
// enable当前动画开关
// speed动画速度
let animate = {
name:index,
index:index,
curve:curve,
progress:0,
directchange:false,
enable:true,
status:"start",
speed:speed,
};
humans[index].runrail = animate;
humans[index].status = 1;
humans[index].action.play();
humans[index].mixer.runplay = true;
moveanimatelist.push(animate);
}
function moveanimateupdate(){
if(humans.length>0){
for(let i=0;i<humans.length;i++){
if(humans[i].runrail.enable){
// 动画播放结束
if(humans[i].runrail.progress>=1){
// let point = humans[i].runrail.curve.getPointAt(1);
//更新模型坐标
// console.log(moveanimatelist);
if(humans[i].status == 1){
humans[i].runrail.enable = false;
humans[i].runrail.progress = 1;
humans[i].mixer.runplay = false;
humans[i].action.stop();
humans[i].status = 0;
if(humans[i].stage == 4){
rungroup.remove(humans[i].mesh);
// humans.splice(i,1);
}
if(humans[i].stage == 3){
if(humans[i].direct == 1){
stationleft[humans[i].doors].waiting = 0;
}else{
stationright[humans[i].doors].waiting = 0;
}
humans[i].stage = 4;
}
if(humans[i].stage == 2){
humans[i].stage = 3;
}
if(humans[i].stage == 1){
humans[i].stage = 2;
}
if(humans[i].stage == 0){
console.log(humans[i].doors);
zhajiin[humans[i].doors].waiting = 0;
humans[i].stage = 1;
}
moveanimatelist.splice(i,1);
}
}else{
//根据动画进度获取动画轨迹上点
let point = humans[i].runrail.curve.getPointAt(humans[i].runrail.progress);
//更新模型坐标
humans[i].mesh.position.x = point.x;
humans[i].mesh.position.y = point.y;
humans[i].mesh.position.z = point.z;
if((humans[i].runrail.progress+0.001)<1){
let tangent = humans[i].runrail.curve.getPointAt(humans[i].runrail.progress+0.001);
humans[i].mesh.lookAt(new THREE.Vector3(tangent.x,humans[i].mesh.position.y,tangent.z));
}
humans[i].runrail.progress += humans[i].runrail.speed;
point = null;
}
}
}
}
}
function newhumancreate(){
var direct = Math.floor(Math.random()*(3-1+1))+1;
var mantype = Math.floor(Math.random()*(3-1+1))+1;
// console.log(direct);
let points = [];
let newhuman;
if(mantype == 1){
newhuman = THREE.SkeletonUtils.clone( originhuman1 );
newhuman.animations = [];
newhuman.animations.push(originanima1.clone());
}else{
newhuman = THREE.SkeletonUtils.clone( originhuman2 );
newhuman.animations = [];
newhuman.animations.push(originanima2.clone());
}
if(direct == 1|| direct == 2){
newhuman.position.set(32,10,25);
points.push(new THREE.Vector3(32,10,25));
points.push(new THREE.Vector3(26,10,21));
points.push(new THREE.Vector3(18,10,18));
}else{
newhuman.position.set(32,10,-5);
points.push(new THREE.Vector3(32,10,-5));
points.push(new THREE.Vector3(26,10,12));
points.push(new THREE.Vector3(24,10,17));
points.push(new THREE.Vector3(18,10,18));
}
let j = Math.floor(Math.random()*(4-1+1))+1;
points.push(new THREE.Vector3(-0.5+j*1.4,10,18.5));
// zhajiin[j].waiting = 1;
let mixer = new THREE.AnimationMixer( newhuman );
mixer.runplay = false;
let action = mixer.clipAction( newhuman.animations[ 0 ] );
var stationdirection = Math.floor(Math.random()*(2-1+1))+1;
let newone = {
id:humans.length,
mesh:newhuman,
status:1,
stage:0,
direct:stationdirection,
doorstatus:null,
doors:j,
action:action,
mixer:mixer,
runrail:null
};
humans.push(newone);
mixers.push(mixer);
rungroup.add(newhuman);
moveanimateinit(newone,humans.length,points,newone.id,0.002);
// return newone;
}
function initstationanimation(object){
let mixer = new THREE.AnimationMixer( object );
let newclip = object.animations[ 0 ];
for(let j=0;j<object.children.length;j++){
if(object.children[j].name == "top"){
object.children[j].animations = [];
object.children[j].animations.push(newclip.clone());
let mixer = new THREE.AnimationMixer( object.children[j] );
let action =mixer.clipAction( object.children[j].animations[0])
action.setLoop(THREE.LoopOnce);
action.clampWhenFinished = true;
// action.play();
mixer.runplay = true;
mixers.push(mixer);
let device = {
action:action,
mixer:mixer,
};
deviceaction[object.children[j].name] = device;
}
if(object.children[j].name == "down"){
object.children[j].animations = [];
object.children[j].animations.push(newclip.clone());
let mixer = new THREE.AnimationMixer( object.children[j] );
let action =mixer.clipAction( object.children[j].animations[0])
// action.play();
action.setLoop(THREE.LoopOnce);
action.clampWhenFinished = true;
mixer.runplay = true;
mixers.push(mixer);
let device = {
action:action,
mixer:mixer,
};
deviceaction[object.children[j].name] = device;
}
}
station = object;
scene.add(object);
}
function initzhajiinaimation(object){
let mixer = new THREE.AnimationMixer( object );
let newclip = object.animations[ 0 ];
let newzhaji = object;
for(let i=0;i<newzhaji.children.length;i++){
if(newzhaji.children[i].name == "in01"){
newzhaji.children[i].animations = [];
newzhaji.children[i].animations.push(newclip.clone());
let mixer = new THREE.AnimationMixer( newzhaji.children[i] );
let action =mixer.clipAction( newzhaji.children[i].animations[0]);
action.setLoop(THREE.LoopOnce);
action.clampWhenFinished = true;
mixer.runplay = true;
mixers.push(mixer);
let device = {
action:action,
mixer:mixer,
};
deviceaction[object.children[i].name] = device;
}
if(newzhaji.children[i].name == "in02"){
newzhaji.children[i].animations = [];
newzhaji.children[i].animations.push(newclip.clone());
let mixer = new THREE.AnimationMixer( newzhaji.children[i] );
let action =mixer.clipAction( newzhaji.children[i].animations[0]);
action.setLoop(THREE.LoopOnce);
action.clampWhenFinished = true;
mixer.runplay = true;
mixers.push(mixer);
let device = {
action:action,
mixer:mixer,
};
deviceaction[object.children[i].name] = device;
}
if(newzhaji.children[i].name == "in03"){
newzhaji.children[i].animations = [];
newzhaji.children[i].animations.push(newclip.clone());
let mixer = new THREE.AnimationMixer( newzhaji.children[i] );
let action =mixer.clipAction( newzhaji.children[i].animations[0]);
action.setLoop(THREE.LoopOnce);
action.clampWhenFinished = true;
mixer.runplay = true;
mixers.push(mixer);
let device = {
action:action,
mixer:mixer,
};
deviceaction[object.children[i].name] = device;
}
if(newzhaji.children[i].name == "in04"){
newzhaji.children[i].animations = [];
newzhaji.children[i].animations.push(newclip.clone());
let mixer = new THREE.AnimationMixer( newzhaji.children[i] );
let action =mixer.clipAction( newzhaji.children[i].animations[0]);
action.setLoop(THREE.LoopOnce);
action.clampWhenFinished = true;
mixer.runplay = true;
mixers.push(mixer);
let device = {
action:action,
mixer:mixer,
};
deviceaction[object.children[i].name] = device;
}
if(newzhaji.children[i].name == "in05"){
newzhaji.children[i].animations = [];
newzhaji.children[i].animations.push(newclip.clone());
let mixer = new THREE.AnimationMixer( newzhaji.children[i] );
let action =mixer.clipAction( newzhaji.children[i].animations[0]);
action.setLoop(THREE.LoopOnce);
action.clampWhenFinished = true;
mixer.runplay = true;
mixers.push(mixer);
let device = {
action:action,
mixer:mixer,
};
deviceaction[object.children[i].name] = device;
}
}
zhajiinmodel = newzhaji;
scene.add(newzhaji);
}
function initzhajioutanimation(object){
let mixer = new THREE.AnimationMixer( object );
let newclip = object.animations[ 0 ];
let newzhaji = object;
for(let i=0;i<newzhaji.children.length;i++){
if(newzhaji.children[i].name == "out01"){
newzhaji.children[i].animations = [];
newzhaji.children[i].animations.push(newclip.clone());
let mixer = new THREE.AnimationMixer( newzhaji.children[i] );
let action =mixer.clipAction( newzhaji.children[i].animations[0]);
action.setLoop(THREE.LoopOnce);
action.clampWhenFinished = true;
mixer.runplay = true;
mixers.push(mixer);
let device = {
action:action,
mixer:mixer,
};
deviceaction[object.children[i].name] = device;
}
if(newzhaji.children[i].name == "out02"){
newzhaji.children[i].animations = [];
newzhaji.children[i].animations.push(newclip.clone());
let mixer = new THREE.AnimationMixer( newzhaji.children[i] );
let action =mixer.clipAction( newzhaji.children[i].animations[0]);
action.setLoop(THREE.LoopOnce);
action.clampWhenFinished = true;
mixer.runplay = true;
mixers.push(mixer);
let device = {
action:action,
mixer:mixer,
};
deviceaction[object.children[i].name] = device;
}
if(newzhaji.children[i].name == "out03"){
newzhaji.children[i].animations = [];
newzhaji.children[i].animations.push(newclip.clone());
let mixer = new THREE.AnimationMixer( newzhaji.children[i] );
let action =mixer.clipAction( newzhaji.children[i].animations[0]);
action.setLoop(THREE.LoopOnce);
action.clampWhenFinished = true;
mixer.runplay = true;
mixers.push(mixer);
let device = {
action:action,
mixer:mixer,
};
deviceaction[object.children[i].name] = device;
}
if(newzhaji.children[i].name == "out04"){
newzhaji.children[i].animations = [];
newzhaji.children[i].animations.push(newclip.clone());
let mixer = new THREE.AnimationMixer( newzhaji.children[i] );
let action =mixer.clipAction( newzhaji.children[i].animations[0]);
action.setLoop(THREE.LoopOnce);
action.clampWhenFinished = true;
mixer.runplay = true;
mixers.push(mixer);
let device = {
action:action,
mixer:mixer,
};
deviceaction[object.children[i].name] = device;
}
if(newzhaji.children[i].name == "out05"){
newzhaji.children[i].animations = [];
newzhaji.children[i].animations.push(newclip.clone());
let mixer = new THREE.AnimationMixer( newzhaji.children[i] );
let action =mixer.clipAction( newzhaji.children[i].animations[0]);
action.setLoop(THREE.LoopOnce);
action.clampWhenFinished = true;
mixer.runplay = true;
mixers.push(mixer);
let device = {
action:action,
mixer:mixer,
};
deviceaction[object.children[i].name] = device;
}
}
zhajioutmodel = newzhaji
scene.add(newzhaji);
}
function zhajicontrol(type,door){
console.log(door);
console.log(zhajiin);
let devicenum = door-1;
if(type == "in"){
deviceaction[zhajiin[devicenum].id].action.reset();
deviceaction[zhajiin[devicenum].id].action.time = 0;
deviceaction[zhajiin[devicenum].id].action.timeScale = 1;
deviceaction[zhajiin[devicenum].id].action.play();
}else if(type == "out"){
deviceaction[zhajiout[devicenum].id].action.reset();
deviceaction[zhajiout[devicenum].id].action.time = 0;
deviceaction[zhajiout[devicenum].id].action.timeScale = 1;
deviceaction[zhajiout[devicenum].id].action.play();
}
}
function monitorrender() {
// updateSize();
for ( var ii = 0; ii < views.length; ++ ii ) {
var view = views[ ii ];
var camera = view.camera;
// view.updateCamera( camera, scene, mouseX, mouseY );
var left = Math.floor( windowWidth * view.left );
var bottom = Math.floor( windowHeight * view.bottom );
var width = Math.floor( windowWidth * view.width );
var height = Math.floor( windowHeight * view.height );
renderer.setViewport( left, bottom, width, height );
renderer.setScissor( left, bottom, width, height );
renderer.setScissorTest( true );
camera.aspect = width / height;
camera.updateProjectionMatrix();
renderer.render( scene, camera );
}
}
}

View File

@ -0,0 +1,90 @@
export function ModelManager(){
let scope = this;
this.man1 = {
code:null,
locateType:"01",
mesh:null,
action:null
};
this.man2 = {
code:null,
locateType:"01",
mesh:null,
action:null
};
this.station = {
code:null,
screenDoorOpenStatus:"01",
mesh:null,
action:null
};
this.zhajiin = {
code:null,
screenDoorOpenStatus:"01",
mesh:null,
action:null
};
this.zhajiout = {
code:null,
screenDoorOpenStatus:"01",
mesh:null,
action:null
};
this.monitor = {
code:null,
screenDoorOpenStatus:"01",
mesh:null,
action:null
};
this.loadpromise = function (data,mixers){
let initlist = [];
initlist.push(fbxpromise(data.man1,mixers,scope.man1));
initlist.push(fbxpromise(data.man2,mixers,scope.man2));
initlist.push(fbxpromise(data.station,mixers,scope.station));
initlist.push(fbxpromise(data.zhajiin,mixers,scope.zhajiin));
initlist.push(fbxpromise(data.zhajiout,mixers,scope.zhajiout));
initlist.push(fbxpromise(data.monitor,mixers,scope.monitor));
return new Promise(function(resolve, reject){
Promise.all(initlist).then((result) => {
resolve("success"); //['成功了', 'success']
}).catch((error) => {
//console.log(error);
});
});
}
}
function fbxpromise(asset,mixers,model){
return new Promise(function(resolve, reject){
var loader = new THREE.FBXLoader();
loader.load( asset.assetUrl, function ( object ) {
// let mixer = new THREE.AnimationMixer( object );
// object.traverse( function ( child ) {
// if ( child.isMesh ) {
// child.castShadow = true;
// child.receiveShadow = true;
// }
// } );
model.mesh = object;
resolve(asset.deviceType);
} );
});
}

View File

@ -6,6 +6,7 @@
THREE.DragControls = function ( _objects, _camera, _domElement ) { THREE.DragControls = function ( _objects, _camera, _domElement ) {
if ( _objects instanceof THREE.Camera ) { if ( _objects instanceof THREE.Camera ) {
console.warn( 'THREE.DragControls: Constructor now expects ( objects, camera, domElement )' ); console.warn( 'THREE.DragControls: Constructor now expects ( objects, camera, domElement )' );
@ -27,7 +28,7 @@ THREE.DragControls = function ( _objects, _camera, _domElement ) {
// //
var scope = this; var scope = this;
this.nowobject = _objects;
function activate() { function activate() {
_domElement.addEventListener( 'mousemove', onDocumentMouseMove, false ); _domElement.addEventListener( 'mousemove', onDocumentMouseMove, false );
@ -84,13 +85,15 @@ THREE.DragControls = function ( _objects, _camera, _domElement ) {
} }
_raycaster.setFromCamera( _mouse, _camera ); _raycaster.setFromCamera( _mouse, _camera );
if( scope.nowobject.parent){
var intersects = _raycaster.intersectObjects( _objects ); var intersects = _raycaster.intersectObjects( scope.nowobject.parent.children );
if ( intersects.length > 0 ) { if ( intersects.length > 0 ) {
var object = intersects[ 0 ].object; var object = intersects[ 0 ].object;
if(scope.nowobject.raycastoff){
object = intersects[ 0 ].object.parent;
}
_plane.setFromNormalAndCoplanarPoint( _camera.getWorldDirection( _plane.normal ), _worldPosition.setFromMatrixPosition( object.matrixWorld ) ); _plane.setFromNormalAndCoplanarPoint( _camera.getWorldDirection( _plane.normal ), _worldPosition.setFromMatrixPosition( object.matrixWorld ) );
if ( _hovered !== object ) { if ( _hovered !== object ) {
@ -117,17 +120,22 @@ THREE.DragControls = function ( _objects, _camera, _domElement ) {
} }
}
function onDocumentMouseDown( event ) { function onDocumentMouseDown( event ) {
event.preventDefault(); event.preventDefault();
_raycaster.setFromCamera( _mouse, _camera ); _raycaster.setFromCamera( _mouse, _camera );
if( scope.nowobject.parent){
var intersects = _raycaster.intersectObjects( _objects ); var intersects = _raycaster.intersectObjects( scope.nowobject.parent.children );
if ( intersects.length > 0 ) { if ( intersects.length > 0 ) {
_selected = intersects[ 0 ].object; _selected = intersects[ 0 ].object;
if(scope.nowobject.raycastoff){
_selected = intersects[ 0 ].object.parent;
}
if ( _raycaster.ray.intersectPlane( _plane, _intersection ) ) { if ( _raycaster.ray.intersectPlane( _plane, _intersection ) ) {
@ -142,6 +150,8 @@ THREE.DragControls = function ( _objects, _camera, _domElement ) {
} }
}
} }
@ -200,12 +210,15 @@ THREE.DragControls = function ( _objects, _camera, _domElement ) {
_mouse.y = - ( ( event.clientY - rect.top ) / rect.height ) * 2 + 1; _mouse.y = - ( ( event.clientY - rect.top ) / rect.height ) * 2 + 1;
_raycaster.setFromCamera( _mouse, _camera ); _raycaster.setFromCamera( _mouse, _camera );
if( scope.nowobject.parent){
var intersects = _raycaster.intersectObjects( _objects ); var intersects = _raycaster.intersectObjects( scope.nowobject.parent.children );
if ( intersects.length > 0 ) { if ( intersects.length > 0 ) {
_selected = intersects[ 0 ].object; _selected = intersects[ 0 ].object;
if(scope.nowobject.raycastoff){
_selected = intersects[ 0 ].object.parent;
}
_plane.setFromNormalAndCoplanarPoint( _camera.getWorldDirection( _plane.normal ), _worldPosition.setFromMatrixPosition( _selected.matrixWorld ) ); _plane.setFromNormalAndCoplanarPoint( _camera.getWorldDirection( _plane.normal ), _worldPosition.setFromMatrixPosition( _selected.matrixWorld ) );
@ -222,6 +235,8 @@ THREE.DragControls = function ( _objects, _camera, _domElement ) {
} }
}
} }
@ -253,9 +268,9 @@ THREE.DragControls = function ( _objects, _camera, _domElement ) {
// Backward compatibility // Backward compatibility
this.setObjects = function () { this.setObjects = function (array) {
scope.nowobject = array;
console.error( 'THREE.DragControls: setObjects() has been removed.' ); // console.error( 'THREE.DragControls: setObjects() has been removed.' );
}; };

View File

@ -86,7 +86,14 @@ let hebsuidao = {
picUrl:"", picUrl:"",
assetUrl:"../../static/model/suidao/hebsuidao.FBX" assetUrl:"../../static/model/suidao/hebsuidao.FBX"
} }
let nbsuidao = {
id:"1010",
name:"nbsuidao",
deviceType:"nbsuidao",
type:"nbsuidao",
picUrl:"",
assetUrl:"../../static/model/suidao/nbsuidao.FBX"
}
let defaultbackground = { let defaultbackground = {
id:"16", id:"16",
name:"background", name:"background",
@ -221,6 +228,10 @@ export function AssetLoader(){
let hebsd = new AssetModel(hebsuidao); let hebsd = new AssetModel(hebsuidao);
scope.modellist.push(hebsd); scope.modellist.push(hebsd);
let nbsd = new AssetModel(nbsuidao);
scope.modellist.push(nbsd);
let defaultswitch1 = new AssetModel(autoswitch1); let defaultswitch1 = new AssetModel(autoswitch1);
scope.modellist.push(defaultswitch1); scope.modellist.push(defaultswitch1);

View File

@ -134,6 +134,14 @@ export function DriverLoadNew(data,scope,netdata,mapdata,sectionlist,signallist,
} }
} }
} }
if(stationstandlist.group.children[0].name == "Station75414"){
for(let mn=0;mn<scope.assetloader.modellist.length;mn++){
if(scope.assetloader.modellist[mn].name && scope.assetloader.modellist[mn].name == "nbsuidao"){
scope.assetloader.modellist[mn].mesh.name = "nbsuidao";
scene.add(scope.assetloader.modellist[mn].mesh);
}
}
}
resolve("mergemodel"); resolve("mergemodel");
}); });
}) })

View File

@ -127,8 +127,15 @@ export function SimulationLoadNew(data,scope,netdata,mapdata,camera,controls,sce
} }
} }
} }
console.log(stationstandlist.group.children[0].name );
if(stationstandlist.group.children[0].name == "Station75414"){
for(let mn=0;mn<scope.assetloader.modellist.length;mn++){
if(scope.assetloader.modellist[mn].name && scope.assetloader.modellist[mn].name == "nbsuidao"){
scope.assetloader.modellist[mn].mesh.name = "nbsuidao";
scene.add(scope.assetloader.modellist[mn].mesh);
}
}
}
resolve("mergemodel"); resolve("mergemodel");
}); });
}) })

View File

@ -94,6 +94,7 @@ this.loadpromise = function(sectionList,sectiondata,rails,scene,assetloader){
// testmesh2.material[j].dispose(); // testmesh2.material[j].dispose();
// } // }
// testmesh2 = null; // testmesh2 = null;
if(newsection.railpoint.length>2){ if(newsection.railpoint.length>2){
// console.log(newsection); // console.log(newsection);
let height = Math.random()/1000; let height = Math.random()/1000;

View File

@ -80,7 +80,10 @@ class SkinCode extends defaultStyle {
mouseOverStyle: { mouseOverStyle: {
borderColor: '#fff', borderColor: '#fff',
borderBackgroundColor: '#22DFDF', borderBackgroundColor: '#22DFDF',
textShadowColor: '#22DFDF' textShadowColor: '#22DFDF',
nameShow: true,
lineDash: [3, 3],
lineWidthMore: 0
}, },
line: { line: {
width: 5, // 区段宽度 width: 5, // 区段宽度

View File

@ -148,7 +148,7 @@ class SkinCode extends defaultStyle {
}, },
lamp: { lamp: {
bgShow: false, // 是否被选中 bgShow: false, // 是否被选中
guidName: 'chengdu_03', // 成都三号线引导类型 guidName: 'singleRY', // 成都三号线引导类型
borderVariable: true, // 信号灯边框可变 borderVariable: true, // 信号灯边框可变
stopWidth: 2, // 禁止线宽度 stopWidth: 2, // 禁止线宽度
borderWidth: 2, // 信号灯边框线宽度 borderWidth: 2, // 信号灯边框线宽度

View File

@ -139,7 +139,7 @@ class SkinCode extends defaultStyle {
}, },
lamp: { lamp: {
bgShow: false, // 是否被选中 bgShow: false, // 是否被选中
guidName: 'ningbo_01', // 默认引导类型 guidName: 'double', // 默认引导类型
stopWidth: 2, // 禁止线宽度 stopWidth: 2, // 禁止线宽度
borderWidth: 1, // 信号灯边框线宽度 borderWidth: 1, // 信号灯边框线宽度
borderColor: '#3149C3', // 信号灯边框线颜色 borderColor: '#3149C3', // 信号灯边框线颜色

View File

@ -613,9 +613,17 @@ class SkinCode extends defaultStyle {
} }
], // 运行方向状态类型对应车头显示状态 1从左往右 0从右往左 ], // 运行方向状态类型对应车头显示状态 1从左往右 0从右往左
directionStopType: [ directionStopType: [
{type: '01', lineLShow: false, lineRShow: false}, {
{type: '02', lineLShow: false, lineRShow: true}, type: 1,
{type: '03', lineLShow: true, lineRShow: false} lineLShow: false,
lineRShow: true
},
{
type: 0,
lineLShow: true,
lineRShow: false
}
], // 列车停止方向类型对应车头显示状态 01未知方向 02从左往右 上行 03从右往左 下行 ], // 列车停止方向类型对应车头显示状态 01未知方向 02从左往右 上行 03从右往左 下行
driveModeStatus: [ driveModeStatus: [
{ {

View File

@ -144,7 +144,7 @@ class SkinCode extends defaultStyle {
lamp: { lamp: {
bgShow: true, // 是否被选中 bgShow: true, // 是否被选中
logicDisplayNone: true, // 逻辑点灯斜线不显示 logicDisplayNone: true, // 逻辑点灯斜线不显示
guidName: 'haerbin_01', // 默认引导类型 guidName: 'doubleAndBase', // 默认引导类型
stopWidth: 2, // 禁止线宽度 stopWidth: 2, // 禁止线宽度
borderWidth: 0, // 信号灯边框线宽度 borderWidth: 0, // 信号灯边框线宽度
borderColor: '#FF0000', // 信号灯边框线颜色 (虚拟信号机) borderColor: '#FF0000', // 信号灯边框线颜色 (虚拟信号机)

View File

@ -82,7 +82,7 @@ class SkinCode extends defaultStyle {
spareColor: '#5578B6', // 区段空闲颜色 spareColor: '#5578B6', // 区段空闲颜色
communicationOccupiedColor: 'red', // 区段通信车占用颜色 // 调整 未确定 communicationOccupiedColor: 'red', // 区段通信车占用颜色 // 调整 未确定
unCommunicationOccupiedColor: 'red', // 区段非通讯车占用颜色 unCommunicationOccupiedColor: 'red', // 区段非通讯车占用颜色
routeLockColor: 'rgba(0, 255, 0, 1)', // 区段路由锁定颜色 routeLockColor: '#00ff00', // 区段进路锁定颜色
faultLockColor: 'white', // 区段故障锁定颜色 faultLockColor: 'white', // 区段故障锁定颜色
undefinedColor: '#0071C1', // 区段未定义颜色 undefinedColor: '#0071C1', // 区段未定义颜色
protectionLockedColor: '#FFFFFF', // 保护区段锁闭 protectionLockedColor: '#FFFFFF', // 保护区段锁闭
@ -90,7 +90,7 @@ class SkinCode extends defaultStyle {
atcExcisionColor: '#A0522D', // 区段atc切除颜色 atcExcisionColor: '#A0522D', // 区段atc切除颜色
atsExcisionColor: '#A0522D', // 区段ats切除颜色 atsExcisionColor: '#A0522D', // 区段ats切除颜色
timeReleaseColor: '#3F3F3F', // 区段延时释放颜色 timeReleaseColor: '#3F3F3F', // 区段延时释放颜色
protectiveLockColor: '#a2d36f', // 区段保护锁闭 延续保护 protectiveLockColor: '#03C85C', // 区段保护锁闭 延续保护
protectiveTimeReleaseColor: '#0071C1', // 区段保护延时解锁 protectiveTimeReleaseColor: '#0071C1', // 区段保护延时解锁
logicalColor: '#FFFF00', // 逻辑区段颜色 (未用) logicalColor: '#FFFF00', // 逻辑区段颜色 (未用)
logicalTextColor: 'white' // 逻辑区段名称颜色 (未用) logicalTextColor: 'white' // 逻辑区段名称颜色 (未用)
@ -146,7 +146,7 @@ class SkinCode extends defaultStyle {
}, },
lamp: { lamp: {
bgShow: false, // 是否被选中 bgShow: false, // 是否被选中
guidName: 'ningbo_01', // 默认引导类型 guidName: 'double', // 默认引导类型
borderVariable: true, // 信号灯边框可变 borderVariable: true, // 信号灯边框可变
stopWidth: 2, // 禁止线宽度 stopWidth: 2, // 禁止线宽度
borderWidth: 2, // 信号灯边框线宽度 borderWidth: 2, // 信号灯边框线宽度

View File

@ -213,7 +213,7 @@ class SkinCode extends defaultStyle {
}, },
reentry: { // 站台折返策略 reentry: { // 站台折返策略
position: 0, // 折返方向 position: 0, // 折返方向
offset: {x: -16, y: 20}, // 折返偏移量 offset: {x: -16, y: -15}, // 折返偏移量
noHumanColor: '#0F16DA', // 站台无人折返 noHumanColor: '#0F16DA', // 站台无人折返
autoChangeEndsColor: '#0BF400' // 站台自动换端 autoChangeEndsColor: '#0BF400' // 站台自动换端
}, },
@ -632,9 +632,16 @@ class SkinCode extends defaultStyle {
} }
], // 运行方向状态类型对应车头显示状态 1从左往右 0从右往左 ], // 运行方向状态类型对应车头显示状态 1从左往右 0从右往左
directionStopType: [ directionStopType: [
{type: '01', lineLShow: false, lineRShow: false}, {
{type: '02', lineLShow: false, lineRShow: true}, type: 1,
{type: '03', lineLShow: true, lineRShow: false} lineLShow: false,
lineRShow: true
},
{
type: 0,
lineLShow: true,
lineRShow: false
}
], // 列车停止方向类型对应车头显示状态 01未知方向 02从左往右 上行 03从右往左 下行 ], // 列车停止方向类型对应车头显示状态 01未知方向 02从左往右 上行 03从右往左 下行
driveModeStatus: [ driveModeStatus: [
{ {

View File

@ -14,7 +14,7 @@ class SkinCode extends defaultStyle {
distance: 18, // 文字离区段距离 distance: 18, // 文字离区段距离
fontSize: 11, // 字体大小 fontSize: 11, // 字体大小
fontWeight: 'normal', // 字体粗细 fontWeight: 'normal', // 字体粗细
fontColor: 'lightgreen', // 字体颜色 fontColor: '#FFFFFF', // 字体颜色
textAlign: 'center', // 水平对齐方式 textAlign: 'center', // 水平对齐方式
textPosition: 'inside', // 文字位置 textPosition: 'inside', // 文字位置
textVerticalAlign: 'middle' // 文字垂直对齐方式 textVerticalAlign: 'middle' // 文字垂直对齐方式
@ -75,8 +75,16 @@ class SkinCode extends defaultStyle {
textPosition: 'inside', // 文字位置 textPosition: 'inside', // 文字位置
textVerticalAlign: 'middle' // 文字垂直对齐方式 textVerticalAlign: 'middle' // 文字垂直对齐方式
}, },
mouseOverStyle: {
borderColor: '#fff',
borderBackgroundColor: '#22DFDF',
textShadowColor: '#22DFDF',
nameShow: false,
lineDash: null,
lineWidthMore: 6
},
line: { line: {
width: 2, // 区段宽度 width: 4, // 区段宽度
beyondWidth: 0, // 区段宽超出宽度 beyondWidth: 0, // 区段宽超出宽度
invadeColor: '#FFFFFF', // 区段侵入颜色 invadeColor: '#FFFFFF', // 区段侵入颜色
spareColor: '#AAA9A9', // 区段空闲颜色 spareColor: '#AAA9A9', // 区段空闲颜色
@ -97,12 +105,13 @@ class SkinCode extends defaultStyle {
}, },
axle: { axle: {
show: true, // 计轴是否显示 show: true, // 计轴是否显示
radius: 3, // 计轴 半径 radius: 5, // 计轴 半径
distance: 5, // 计轴和区段之间的距离 (未用) distance: 5, // 计轴和区段之间的距离 (未用)
color: '#808080', // 区段计轴颜色 color: '#9F9C9C', // 区段计轴颜色
occupyColor: '#FF0000', // 区段计轴占用颜色 occupyColor: '#FF0000', // 区段计轴占用颜色
resetColor: '#00FFFF', // 区段计轴预复位颜色 resetColor: '#00FFFF', // 区段计轴预复位颜色
Failure: '#E6A23C' // #FFFF00 计轴失效 Failure: '#E6A23C', // #FFFF00 计轴失效
lineWidth: 3
}, },
speedLimit: { // 限速元素 speedLimit: { // 限速元素
width: 1, // 限速线的宽度 width: 1, // 限速线的宽度
@ -151,12 +160,12 @@ class SkinCode extends defaultStyle {
fontSize: 11, // 信号机名称字体大小 fontSize: 11, // 信号机名称字体大小
fontWeight: 'bold', // 信号机名称字体粗细 fontWeight: 'bold', // 信号机名称字体粗细
defaultColor: 'white', // 信号灯字体默认色 defaultColor: 'white', // 信号灯字体默认色
blockColor: '#EF0C08', // 信号灯字体锁定颜色 blockColor: '#FFFFFF', // 信号灯字体锁定颜色
checkColor: '#00FF00' // 信号保护区段检查颜色 checkColor: '#00FF00' // 信号保护区段检查颜色
}, },
lamp: { lamp: {
bgShow: false, // 是否被选中 bgShow: false, // 是否被选中
guidName: 'defult', // 默认引导类型 guidName: 'singleRY', // 默认引导类型
borderVariable: true, // 信号灯边框可变 borderVariable: true, // 信号灯边框可变
stopWidth: 2, // 禁止线宽度 stopWidth: 2, // 禁止线宽度
borderWidth: 2, // 信号灯边框线宽度 borderWidth: 2, // 信号灯边框线宽度
@ -168,7 +177,8 @@ class SkinCode extends defaultStyle {
greenColor: 'green', // 信号灯绿色 greenColor: 'green', // 信号灯绿色
yellowColor: 'yellow', // 信号灯黄色 yellowColor: 'yellow', // 信号灯黄色
whiteColor: '#FFFFFF', // 信号灯白色 whiteColor: '#FFFFFF', // 信号灯白色
blueColor: '#0070C0' // 信号灯蓝色 blueColor: '#0070C0', // 信号灯蓝色
logicDisplayNone: true // 信号机上×型标识不展示
}, },
route: { route: {
direction: true, // 自动通过方向 direction: true, // 自动通过方向
@ -183,7 +193,8 @@ class SkinCode extends defaultStyle {
manualControl: '#FFFF00', // 人工控制 manualControl: '#FFFF00', // 人工控制
autoRoute: '#00FF00', // 自动进路 autoRoute: '#00FF00', // 自动进路
autoTrigger: '#FFFF00', // 自动触发 autoTrigger: '#FFFF00', // 自动触发
outConflict: '#C00808' // 出车冲突 outConflict: '#C00808', // 出车冲突,
lampstandard: true // 灯柱颜色变化
}, },
delay: { delay: {
direction: false, // 延时解锁方向 direction: false, // 延时解锁方向
@ -216,7 +227,14 @@ class SkinCode extends defaultStyle {
insideTriangle: { insideTriangle: {
lineWidth: 2, lineWidth: 2,
strokeColor: 'rgba(0,0,0,0)', strokeColor: 'rgba(0,0,0,0)',
fillColor: '#00FF00' fillColor: '#00FF00',
startSignalColor: '#F00' // 排列进路 始端信号机颜色
},
ciConfirm: {
textColor: '#FF0',
fontSize: 12,
distance: 20,
defaultText: 'E'
} }
}; };
@ -253,14 +271,18 @@ class SkinCode extends defaultStyle {
defaultColor:'#808080', // 西安二号线特殊样式(默认颜色) defaultColor:'#808080', // 西安二号线特殊样式(默认颜色)
special:true // 西安二号线特殊样式 special:true // 西安二号线特殊样式
}, },
patternFilter:{ // 模式筛选标识
defaultColor:'#808080', // 默认颜色,
offset:{x:25, y:15} // 相对于站台边缘的偏移
},
reentry: {}, // 站台折返策略 reentry: {}, // 站台折返策略
detainCar: { // 扣车 detainCar: { // 扣车
position: -1, // 扣车标识在站台上显示方向 position: -1, // 扣车标识在站台上显示方向
text: 'H', // 扣车显示内容 text: 'H', // 扣车显示内容
offset: {x: 8, y: 0}, // 扣车偏移量 offset: {x: 8, y: 0}, // 扣车偏移量
centerTrainColor: 'white', // 中心扣车颜色 centerTrainColor: '#E400E4', // 中心扣车颜色
andCenterTrainColor: 'red', // 车站+中心扣车颜色 andCenterTrainColor: 'red', // 车站+中心扣车颜色
detainTrainTextColor: '#E4EF50', // 车站扣除文字颜色 detainTrainTextColor: '#E4EF50', // 车站扣除颜色
fontSize: 10, fontSize: 10,
fontWeight: 'normal', fontWeight: 'normal',
circleWidth:14, // 西安二号线特殊样式 圆圈的宽度 circleWidth:14, // 西安二号线特殊样式 圆圈的宽度
@ -405,12 +427,12 @@ class SkinCode extends defaultStyle {
position: 0, // 区段名称位置 1 上面 -1 下面 0 对称 position: 0, // 区段名称位置 1 上面 -1 下面 0 对称
offset: { x: -15, y: 9 }, // 道岔名称与区段距离 offset: { x: -15, y: 9 }, // 道岔名称与区段距离
fontSize: 11, // 字体大小 fontSize: 11, // 字体大小
fontColor: '#C0C0C0', // 道岔名称颜色 fontColor: '#FFFFFF', // 道岔名称颜色
fontWeight: 'normal', // 字体粗细 fontWeight: 'normal', // 字体粗细
borderColor: '#FE0000', // 道岔边框颜色 borderColor: '#FE0000', // 道岔边框颜色
lossColor: 'lightgreen', // 道岔失去颜色 lossColor: 'lightgreen', // 道岔失去颜色
locateColor: 'lightgreen', // 道岔定位颜色 locateColor: '#FFFFFF', // 道岔定位颜色
inversionColor: 'lightgreen', // 道岔反位颜色 inversionColor: '#FFFFFF', // 道岔反位颜色
monolockLocationColor: '#00FF00', // 道岔单锁'定位'颜色 (绿色) monolockLocationColor: '#00FF00', // 道岔单锁'定位'颜色 (绿色)
monolockInversionColor: '#FFFF00' // 道岔单锁'反位'颜色 (黄色) monolockInversionColor: '#FFFF00' // 道岔单锁'反位'颜色 (黄色)
}, },
@ -482,7 +504,8 @@ class SkinCode extends defaultStyle {
}; };
this[deviceType.Line] = { this[deviceType.Line] = {
lineColor: '#FFFFFF' // 线条颜色 lineColor: '#FFFFFF', // 线条颜色
lineDash: [8, 4]
}; };
this[deviceType.AutomaticRoute] = { this[deviceType.AutomaticRoute] = {
// 是否显示 // 是否显示
@ -635,12 +658,13 @@ class SkinCode extends defaultStyle {
}; };
this[deviceType.Train] = { this[deviceType.Train] = {
trainBody: { trainBody: {
trainBodyLineWidth: 1, // 车身line宽 trainBodyLineWidth: 2, // 车身line宽
changeTrainWidth: false, // 是否根据车身上车组号、服务号、车次号、目的地码显示情况改变列车长度 changeTrainWidth: false, // 是否根据车身上车组号、服务号、车次号、目的地码显示情况改变列车长度
specialTrainType: [], // 特殊列车类型需设置显示格式 specialTrainType: [], // 特殊列车类型需设置显示格式
lrPadding: 4, // 两边间隔 lrPadding: 4, // 两边间隔
upPadding: 4, // 上边距离 upPadding: 4, // 上边距离
trainBodyFillColor: '#000099', // 列车车身填充颜色 trainBodyFillColor: '#2AA32A', // 列车车身填充颜色
trainSidelineColor: '#2AA32A',
trainNameFormat: 'serviceNumber:targetCode'// 列车显示格式 trainNameFormat: 'serviceNumber:targetCode'// 列车显示格式
}, },
directionArrow: { directionArrow: {
@ -678,12 +702,12 @@ class SkinCode extends defaultStyle {
trainTargetNumberOffset: {x: -4, y: 4}// 车组号偏移量 trainTargetNumberOffset: {x: -4, y: 4}// 车组号偏移量
}, },
trainHead: { trainHead: {
trainMoreLength: 1, // 列车车头比车身高出的长度,上下相比车体伸出去的边框 trainMoreLength: 0, // 列车车头比车身高出的长度,上下相比车体伸出去的边框
trainHeadTriangleFirst: { x: 7, y: 1}, // 列车车头三角坐标1偏移量 trainHeadTriangleFirst: { x: -1, y: -1}, // 列车车头三角坐标1偏移量
trainHeadTriangleSecond: { x: 13, y: 10}, // 列车车头三角坐标2偏移量 trainHeadTriangleSecond: { x: 15, y: 10}, // 列车车头三角坐标2偏移量
trainHeadTriangleThird: { x: 7, y: 19}, // 列车车头三角坐标3偏移量 trainHeadTriangleThird: { x: -1, y: 21}, // 列车车头三角坐标3偏移量
trainConntWidth: 4, // 列车竖杠的宽度 trainConntWidth: 0, // 列车竖杠的宽度
trainHeadFillColor: '#000000', // 列车车头矩形填充颜色 trainHeadFillColor: '#2AA32A', // 列车车头矩形填充颜色
trainHeadRectHeight: 20 // 列车车头矩形高度 trainHeadRectHeight: 20 // 列车车头矩形高度
}, },
common: { common: {
@ -747,8 +771,8 @@ class SkinCode extends defaultStyle {
driveModeStatus: [ driveModeStatus: [
{ {
status: 'AM', status: 'AM',
trainLColor: '#00FF00', trainLColor: '#2AA32A',
trainRColor: '#00FF00' trainRColor: '#2AA32A'
}, },
{ {
status: 'CM', status: 'CM',

View File

@ -240,4 +240,9 @@ deviceRender[deviceType.SwitchFault] = {
_type: deviceType.SwitchFault, _type: deviceType.SwitchFault,
zlevel: 1 zlevel: 1
}; };
/** Arrow 箭头 */
deviceRender[deviceType.Arrow] = {
_type: deviceType.Arrow,
zlevel: 1
};
export default deviceRender; export default deviceRender;

View File

@ -41,7 +41,8 @@ const deviceType = {
ControlSwitch: 'ControlSwitch', ControlSwitch: 'ControlSwitch',
Axle: 'Axle', Axle: 'Axle',
SplitStation:'SplitStation', SplitStation:'SplitStation',
SwitchFault: 'SwitchFault' SwitchFault: 'SwitchFault',
Arrow: 'Arrow'
}; };
export default deviceType; export default deviceType;

View File

@ -136,7 +136,6 @@ class Jlmap {
const options = this.pullBack(opts); const options = this.pullBack(opts);
this.$options.update(options); this.$options.update(options);
this.$painter.updateTransform(this.$options); this.$painter.updateTransform(this.$options);
if (this.$options.disabled == true) { if (this.$options.disabled == true) {
this.$mouseController.disable(); this.$mouseController.disable();
} else { } else {
@ -157,6 +156,33 @@ class Jlmap {
} }
} }
setUpdateScreen(opts) {
const num = opts.num;
const offsetY = (opts.height - 100) / num; // 高度差
const arr = [];
let rect = '';
for (const i in this.mapDevice) {
const element = this.mapDevice[i];
if (element.instance) {
if (!rect) {
rect = element.instance.getBoundingRect().clone();
} else {
rect.union(element.instance.getBoundingRect().clone());
}
}
}
const scaleWidth = Math.floor((((opts.width - 100) * num) / rect.width) * 100) / 100;
const scaleHeight = Math.floor(((opts.height - 100) / (rect.height * num)) * 100) / 100;
const scale = Math.min(scaleWidth, scaleHeight);
const spliceWidth = (rect.width + 100) / num * scale;
const dx = (opts.width - spliceWidth) / 2;
for (let index = 0; index < num; index++) {
const param = { scaleRate: scale, offsetX: ((spliceWidth) * index) - dx, offsetY: -100 - (offsetY * index) };
arr.push(param);
}
this.$painter.updateTransform1(arr, {x: dx, y: 0, width: spliceWidth, height: opts.height});
}
setLevelVisible(list) { setLevelVisible(list) {
this.$painter.setLevelVisible(list); this.$painter.setLevelVisible(list);
} }
@ -493,6 +519,7 @@ class Jlmap {
break; break;
case this.events.Keyboard: case this.events.Keyboard:
this.$keyboardController.on(this.events.Keyboard, cb, context); this.$keyboardController.on(this.events.Keyboard, cb, context);
break;
} }
} }
} }
@ -513,6 +540,12 @@ class Jlmap {
case this.events.Keyboard: case this.events.Keyboard:
this.$keyboardController.off(this.events.keyboard, cb); this.$keyboardController.off(this.events.keyboard, cb);
break; break;
case this.events.__Pan:
this.$mouseController.off(this.events.__Pan, cb);
break;
case this.events.__Zoom:
this.$mouseController.off(this.events.__Zoom, cb);
break;
} }
} }
} }

View File

@ -5,6 +5,7 @@ import deviceType from './constant/deviceType';
import transitionDeviceStatus from './constant/stateTransition'; import transitionDeviceStatus from './constant/stateTransition';
import shapefactory from './shape/factory'; import shapefactory from './shape/factory';
import TransformHandle from './transformHandle'; import TransformHandle from './transformHandle';
import TransformHandleScreen from './transformHandleScreen';
class Painter { class Painter {
constructor(jmap) { constructor(jmap) {
@ -20,6 +21,7 @@ class Painter {
// 视图控制器 // 视图控制器
this.$transformHandle = new TransformHandle(this); this.$transformHandle = new TransformHandle(this);
this.$transformHandleScreen = new TransformHandleScreen(this);
} }
/** /**
@ -190,6 +192,9 @@ class Painter {
this.$transformHandle.updateTransform(opt); this.$transformHandle.updateTransform(opt);
} }
updateTransform1(list, opts) {
this.$transformHandleScreen.updateTransform(list, opts);
}
/** /**
* 更新zrender尺寸 * 更新zrender尺寸
* @param {*} opt * @param {*} opt

View File

@ -0,0 +1,90 @@
import Line from 'zrender/src/graphic/shape/Line';
import Group from 'zrender/src/container/Group';
import {isShowThePrdType} from '../../utils/handlePath';
import Polygon from 'zrender/src/graphic/shape/Polygon';
export default class Arrow extends Group {
constructor(model, style) {
super();
this._code = model.code;
this._type = model._type;
this.zlevel = model.zlevel;
this.z = 0;
this.model = model;
this.style = style;
this.isShowShape = true;
if (isShowThePrdType(model.prdType, model.showConditions) || model.previewOrMapDraw) {
this.create();
this.setState(model);
}
if (model.previewOrMapDraw) {
this.setShowMode();
}
}
create() {
const model = this.model;
this.triangle = new Polygon({
zlevel: this.zlevel,
z: this.z,
shape: {
points: [
[model.position.x, model.position.y],
[model.position.x + model.triangleLength, model.position.y + model.triangleHeight / 2],
[model.position.x + model.triangleLength, model.position.y - model.triangleHeight / 2]
]
},
style: {
fill: model.color
}
});
this.line = new Line({
zlevel: this.zlevel,
z: this.z,
shape: {
x1: model.position.x + model.triangleLength,
y1: model.position.y,
x2: model.position.x + model.length,
y2: model.position.y
},
style: {
lineWidth: model.lineWidth,
stroke: model.color
}
});
this.add(this.triangle);
this.add(this.line);
}
setState(model) {
if (!this.isShowShape) return;
}
// 设置显示模式
setShowMode() {
const showMode = this.model.showMode;
const showConditions = this.model.showConditions;
if (!showConditions || showConditions === '01' || showMode === showConditions) {
this.eachChild((child) => {
child.show();
});
} else {
this.eachChild((child) => {
child.hide();
});
}
}
setShowStation(stationCode) {
if (!stationCode || this.model.stationCode === stationCode) {
this.eachChild((child) => {
child.show();
});
this.isShowShape = true;
this.setState(this.model);
} else {
this.eachChild((child) => {
child.hide();
});
this.isShowShape = false;
}
}
}

View File

@ -49,7 +49,7 @@ export default class Line2 extends Group {
case '01': break; case '01': break;
case '02': case '02':
this.eachChild((child) => { this.eachChild((child) => {
child.setStyle('lineDash', [4]); child.setStyle('lineDash', this.style.Line.lineDash || [4]);
}); });
break; break;
} }

View File

@ -52,7 +52,7 @@ export default class EDeviceStatus extends Group {
fontSize: style.ModeStatusGroup.fontSize, fontSize: style.ModeStatusGroup.fontSize,
fontFamily: style.fontFamily, fontFamily: style.fontFamily,
text: style.ModeStatusGroup.stationCommunication.defaultText, text: style.ModeStatusGroup.stationCommunication.defaultText,
textFill: style.ModeStatusGroup.stationControlMode.defaultColor, textFill: style.ModeStatusGroup.stationCommunication.defaultColor,
textAlign: style.textStyle.textAlign, textAlign: style.textStyle.textAlign,
textVerticalAlign: style.textStyle.textVerticalAlign textVerticalAlign: style.textStyle.textVerticalAlign
} }

View File

@ -1,84 +1,257 @@
// 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 Circle from 'zrender/src/graphic/shape/Circle'; import Circle from 'zrender/src/graphic/shape/Circle';
import Path from 'zrender/src/graphic/Path'; import Isogon from 'zrender/src/graphic/shape/Isogon';
// import Path from 'zrender/src/graphic/Path';
// 计轴 // 计轴
export default Path.extend({ // export default Path.extend({
type: 'EAxle', // type: 'EAxle',
_subType: '', // _subType: '',
buildPath: function (path, shape) { // buildPath: function (path, shape) {
if (shape && shape.style && shape.traingle) { // if (shape && shape.style && shape.traingle) {
const axleLength = 2 * shape.style.Section.axle.radius; // const axleLength = 2 * shape.style.Section.axle.radius;
// const positionx = shape.point.x + shape.drictx * (shape.traingle.getCos(axleLength) * 1.2); // // const positionx = shape.point.x + shape.drictx * (shape.traingle.getCos(axleLength) * 1.2);
// const positiony = shape.point.y + shape.dricty * (shape.traingle.getCos(axleLength) * 1.2); // // const positiony = shape.point.y + shape.dricty * (shape.traingle.getCos(axleLength) * 1.2);
const positionx = shape.point.x + shape.drictx * (shape.traingle.getCos(axleLength) * 1.05); // const positionx = shape.point.x + shape.drictx * (shape.traingle.getCos(axleLength) * 1.05);
const positiony = shape.point.y + shape.dricty * (shape.traingle.getCos(axleLength) * 1.05); // const positiony = shape.point.y + shape.dricty * (shape.traingle.getCos(axleLength) * 1.05);
// 圆弧 // // 圆弧
const arcX = positionx - shape.dricty * shape.traingle.getSin(axleLength); // const arcX = positionx - shape.dricty * shape.traingle.getSin(axleLength);
const arcY = positiony + shape.drictx * shape.traingle.getSin(axleLength); // const arcY = positiony + shape.drictx * shape.traingle.getSin(axleLength);
const arcR = shape.style.Section.axle.radius; // const arcR = shape.style.Section.axle.radius;
path.arc(arcX, arcY, arcR, 0, 2 * Math.PI, false); // path.arc(arcX, arcY, arcR, 0, 2 * Math.PI, false);
path.closePath(); // path.closePath();
//
const x1 = positionx - shape.traingle.getCos(axleLength * shape.multiple1) - shape.dricty * shape.traingle.getSin(axleLength); // const x1 = positionx - shape.traingle.getCos(axleLength * shape.multiple1) - shape.dricty * shape.traingle.getSin(axleLength);
const y1 = positiony + shape.drictx * shape.traingle.getSin(axleLength * shape.multiple1) - shape.traingle.getSin(axleLength); // const y1 = positiony + shape.drictx * shape.traingle.getSin(axleLength * shape.multiple1) - shape.traingle.getSin(axleLength);
const x2 = positionx + shape.traingle.getCos(axleLength * shape.multiple2) - shape.dricty * shape.traingle.getSin(axleLength); // const x2 = positionx + shape.traingle.getCos(axleLength * shape.multiple2) - shape.dricty * shape.traingle.getSin(axleLength);
const y2 = positiony + shape.drictx * shape.traingle.getSin(axleLength * shape.multiple2) + shape.traingle.getSin(axleLength); // const y2 = positiony + shape.drictx * shape.traingle.getSin(axleLength * shape.multiple2) + shape.traingle.getSin(axleLength);
path.moveTo(x1, y1); // path.moveTo(x1, y1);
path.lineTo(x2, y2); // path.lineTo(x2, y2);
path.closePath(); // path.closePath();
// }
// }
// });
export default class EAxle111 extends Group {
constructor(model) {
super();
this.model = model;
this.zlevel = model.zlevel;
this._subType = model._subType;
this.style = model.style;
this.z = model.z;
this.create(model);
} }
create(model) {
const axleLength = 2 * model.shape.style.Section.axle.radius;
let positionx = model.shape.point.x - model.shape.dricty * (model.shape.traingle.getSin(axleLength) * 1.2);
let positiony = model.shape.point.y + model.shape.dricty * (model.shape.traingle.getCos(axleLength) * 1.2);
if (model.shape.difference === 0) {
positionx += model.shape.drictx * 1;
} else if (model.shape.difference > 0) {
positionx -= model.shape.drictx * model.shape.traingle.getSin(1);
positiony -= model.shape.drictx * model.shape.traingle.getCos(1);
} else {
positionx += model.shape.drictx * model.shape.traingle.getSin(1);
positiony += model.shape.drictx * model.shape.traingle.getCos(1);
}
const x1 = positionx;
const y1 = positiony;
const x2 = positionx + model.shape.drictx * 9 / 2 * model.shape.style.Section.axle.radius;
const y2 = positiony;
const arcX = positionx + model.shape.drictx * 2 * model.shape.style.Section.axle.radius;
const arcY = positiony;
const angle = -model.shape.traingle.getRotation();
this.line = new Line({
zlevel: this.zlevel,
z: this.z,
origin: [positionx, positiony],
rotation:angle,
shape: {
x1:x1,
y1:y1,
x2:x2,
y2:y2
},
style: {
lineWidth: this.style.lineWidth,
fill: this.style.fill,
stroke: this.style.stroke
} }
}); });
this.add(this.line);
// export default class EAxle extends Group { if (model.shape.isSpecial) {
// constructor(model) { const brokenLineX1 = positionx + model.shape.drictx * model.shape.style.Section.axle.radius;
// super(); const brokenLineY1 = positiony - model.shape.style.Section.axle.radius * 2 / 3;
// this.model = model; const brokenLineY2 = positiony + model.shape.style.Section.axle.radius * 2 / 3;
// this.zlevel = model.zlevel; const brokenLineX2 = positionx + model.shape.drictx * model.shape.style.Section.axle.radius * 4;
// this.z = 5; const brokenLineY3 = positiony - model.shape.style.Section.axle.radius * 2 / 3;
// this.create(model); const brokenLineY4 = positiony + model.shape.style.Section.axle.radius * 2 / 3;
// } const brokenLineX3 = positionx + model.shape.drictx * model.shape.style.Section.axle.radius * 4 / 3;
const brokenLineX4 = positionx + model.shape.drictx * model.shape.style.Section.axle.radius * 11 / 3;
// create(model) { const brokenLineY5 = positiony - model.shape.style.Section.axle.radius;
// if (model && model.style && model.traingle) { const brokenLineY6 = positiony + model.shape.style.Section.axle.radius;
// const axleLength = 2 * model.style.Section.axle.radius; this.isogonOutside = new Isogon({
// const positionx = model.point.x + model.drictx * (model.traingle.getCos(axleLength) * 1.2); zlevel: this.model.zlevel,
// const positiony = model.point.y + model.dricty * (model.traingle.getCos(axleLength) * 1.2); z: this.model.z,
// this.line = new Line({ origin: [positionx, positiony],
// zlevel: this.zlevel, rotation:angle,
// z: this.z, // origin: [arcX, arcY],
// progressive: model.progressive, // rotation:Math.PI / 8,
// shape: { shape: {
// x1: positionx - model.traingle.getCos(axleLength) - model.dricty * model.traingle.getSin(axleLength), x: arcX,
// y1: positiony + model.drictx * model.traingle.getSin(axleLength) - model.traingle.getSin(axleLength), y: arcY,
// x2: positionx + model.traingle.getCos(axleLength) - model.dricty * model.traingle.getSin(axleLength), r: model.shape.style.Section.axle.radius,
// y2: positiony + model.drictx * model.traingle.getSin(axleLength) + model.traingle.getSin(axleLength) n: 8
// }, },
// style: { style: {
// GBaseLineWidth: 2, fill: this.style.fill
// stroke: model.style.Section.axle.color }
// } });
// }); this.isogonInside = new Isogon({
// this.axle = new Circle({ zlevel: this.model.zlevel,
// zlevel: this.zlevel, z: this.model.z + 1,
// z: this.z, origin: [positionx, positiony],
// progressive: model.progressive, rotation:angle,
// shape: { // origin: [arcX, arcY],
// cx: positionx - model.dricty * model.traingle.getSin(axleLength), // rotation:Math.PI / 4,
// cy: positiony + model.drictx * model.traingle.getSin(axleLength), shape: {
// r: model.style.Section.axle.radius x: arcX,
// }, y: arcY,
// style: { r: model.shape.style.Section.axle.radius / 2,
// GBaseLineWidth: 1, n: 4
// stroke: model.style.Section.axle.color, },
// fill: model.style.transparentColor style: {
// } fill: '#000'
// }); }
});
// this.add(this.line); this.line1 = new Line({
// this.add(this.axle); zlevel: this.zlevel,
// } z: this.z,
// } origin: [positionx, positiony],
// } rotation:angle,
shape: {
x1: brokenLineX1,
y1: brokenLineY1,
x2: brokenLineX1,
y2: brokenLineY2
},
style: {
lineWidth: 1,
fill: this.style.fill,
stroke: this.style.stroke
}
});
this.line2 = new Line({
zlevel: this.zlevel,
z: this.z,
origin: [positionx, positiony],
rotation:angle,
shape: {
x1: brokenLineX2,
y1: brokenLineY3,
x2: brokenLineX2,
y2: brokenLineY4
},
style: {
lineWidth: 1,
fill: this.style.fill,
stroke: this.style.stroke
}
});
this.line3 = new Line({
zlevel: this.zlevel,
z: this.z,
origin: [positionx, positiony],
rotation:angle,
shape: {
x1: brokenLineX1,
y1: brokenLineY1,
x2: brokenLineX3,
y2: brokenLineY5
},
style: {
lineWidth: 1,
fill: this.style.fill,
stroke: this.style.stroke
}
});
this.line4 = new Line({
zlevel: this.zlevel,
z: this.z,
origin: [positionx, positiony],
rotation:angle,
shape: {
x1: brokenLineX1,
y1: brokenLineY2,
x2: brokenLineX3,
y2: brokenLineY6
},
style: {
lineWidth: 1,
fill: this.style.fill,
stroke: this.style.stroke
}
});
this.line5 = new Line({
zlevel: this.zlevel,
z: this.z,
origin: [positionx, positiony],
rotation:angle,
shape: {
x1: brokenLineX2,
y1: brokenLineY1,
x2: brokenLineX4,
y2: brokenLineY5
},
style: {
lineWidth: 1,
fill: this.style.fill,
stroke: this.style.stroke
}
});
this.line6 = new Line({
zlevel: this.zlevel,
z: this.z,
origin: [positionx, positiony],
rotation:angle,
shape: {
x1: brokenLineX2,
y1: brokenLineY2,
x2: brokenLineX4,
y2: brokenLineY6
},
style: {
lineWidth: 1,
fill: this.style.fill,
stroke: this.style.stroke
}
});
this.add(this.isogonInside);
this.add(this.isogonOutside);
this.add(this.line1);
this.add(this.line2);
this.add(this.line3);
this.add(this.line4);
this.add(this.line5);
this.add(this.line6);
} else {
this.circle = new Circle({
zlevel: this.model.zlevel,
z: this.model.z,
origin: [positionx, positiony],
rotation:angle,
shape: {
cx: arcX,
cy: arcY,
r: model.shape.style.Section.axle.radius
},
style: {
fill: this.style.fill
}
});
this.add(this.circle);
}
}
}

View File

@ -1,5 +1,6 @@
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 Polyline from 'zrender/src/graphic/shape/Polyline';
import BezierCurve from 'zrender/src/graphic/shape/BezierCurve'; import BezierCurve from 'zrender/src/graphic/shape/BezierCurve';
/** 创建区段线集合*/ /** 创建区段线集合*/
@ -48,29 +49,34 @@ export default class ELines extends Group {
}); });
this.add(this.section); this.add(this.section);
} else { } else {
for (let i = 0; i < (model.points.length - 1); i++) { const points = [];
this.section = new Line({ for (let i = 0; i < model.points.length; i++) {
points.push([model.points[i].x, model.points[i].y]);
}
this.section = new Polyline({
isLine: true, isLine: true,
zlevel: this.zlevel, zlevel: this.zlevel,
progressive: model.progressive, progressive: model.progressive,
z: this.z, z: this.z,
// shape: {
// x1: model.points[i].x,
// y1: model.points[i].y,
// x2: model.points[i + 1].x,
// y2: model.points[i + 1].y
// },
shape: { shape: {
x1: model.points[i].x, points: points
y1: model.points[i].y,
x2: model.points[i + 1].x,
y2: model.points[i + 1].y
}, },
style: { style: {
lineWidth: model.style.Section.line.width, lineWidth: model.style.Section.line.width,
stroke: stroke stroke: stroke
} }
}); });
this.sections.push(this.section); // this.sections.push(this.section);
this.add(this.section); this.add(this.section);
} }
} }
} }
}
setStyle(styles) { setStyle(styles) {
this.eachChild((child) => { this.eachChild((child) => {
@ -130,14 +136,15 @@ export default class ELines extends Group {
} }
getBoundingRect() { getBoundingRect() {
if (this.model.isCurve) { // if (this.model.isCurve) {
return this.section.getBoundingRect().clone(); return this.section.getBoundingRect().clone();
} else { // } else {
const rect = this.sections[0].getBoundingRect(); // return this.section.getBoundingRect().clone();
this.sections.forEach(section => { // const rect = this.sections[0].getBoundingRect();
rect.union(section.getBoundingRect().clone()); // this.sections.forEach(section => {
}); // rect.union(section.getBoundingRect().clone());
return rect; // });
} // return rect;
// }
} }
} }

View File

@ -1,7 +1,9 @@
import Group from 'zrender/src/container/Group'; import Group from 'zrender/src/container/Group';
import Text from 'zrender/src/graphic/Text'; import Text from 'zrender/src/graphic/Text';
import Rect from 'zrender/src/graphic/shape/Rect'; import Rect from 'zrender/src/graphic/shape/Rect';
// import Polygon from 'zrender/src/graphic/shape/Polygon';
import store from '@/store/index_APP_TARGET'; import store from '@/store/index_APP_TARGET';
// import JTriangle from '../../utils/JTriangle';
class EMouse extends Group { class EMouse extends Group {
constructor(device, code) { constructor(device, code) {
super(); super();
@ -11,7 +13,7 @@ class EMouse extends Group {
} }
create() { create() {
// 名称的包围框 // 名称的包围框
if (this.device.name) { if (this.device.name && this.device.style.Section.mouseOverStyle.nameShow) {
const rect = this.device.name.getBoundingRect(); const rect = this.device.name.getBoundingRect();
if (!this.device.isSwitchSection) { if (!this.device.isSwitchSection) {
this.sectionTextBorder = new Rect({ this.sectionTextBorder = new Rect({
@ -69,16 +71,65 @@ class EMouse extends Group {
// 区段包围框 // 区段包围框
if (this.device.section) { if (this.device.section) {
const rect = this.device.section.getBoundingRect(); const rect = this.device.section.getBoundingRect();
rect.height = rect.height + this.device.style.Section.mouseOverStyle.lineWidthMore;
const shape = {
x: rect.x,
y: rect.y - this.device.style.Section.mouseOverStyle.lineWidthMore / 2,
width: rect.width,
height: rect.height
};
this.lineBorder = new Rect({ this.lineBorder = new Rect({
zlevel: this.device.zlevel, zlevel: this.device.zlevel,
z: this.device.z - 1, z: this.device.z - 1,
shape: rect, shape: shape,
style: { style: {
lineDash: [3, 3], lineDash: this.device.style.Section.mouseOverStyle.lineDash,
stroke: this.device.style.Section.mouseOverStyle.borderColor, stroke: this.device.style.Section.mouseOverStyle.borderColor,
fill: this.device.style.transparentColor fill: this.device.style.transparentColor
} }
}); });
// const model = this.device.model;
// const arr = JSON.parse(JSON.stringify(model.points));
// arr.reverse();
// const points = [];
// model.points.forEach((ele, index) => {
// if (index == model.points.length - 1) {
// this.triangle = new JTriangle(model.points[index - 1], ele);
// } else {
// console.log(ele, model.points[index + 1]);
// this.triangle = new JTriangle(ele, model.points[index + 1]);
// }
// const directx = this.triangle.drictx;
// const directy = this.triangle.dricty;
// const x = 5 * this.triangle.getSinRate();
// console.log(this.triangle.getCosRate(), this.triangle.getSinRate());
// const y = 5;
// points.push([ele.x - (directx * x), ele.y - (directy * y)]);
// });
// arr.forEach((ele, index) => {
// if (index == arr.length - 1) {
// this.triangle = new JTriangle(arr[index - 1], ele);
// } else {
// this.triangle = new JTriangle(ele, arr[index + 1]);
// }
// const directx = this.triangle.drictx;
// const directy = this.triangle.dricty;
// const x = 5 * this.triangle.getSinRate();
// const y = 5;
// points.push([ele.x + (directx * x), ele.y + (directy * y)]);
// });
// this.lineBorder = new Polygon({
// zlevel: this.device.zlevel,
// z: this.device.z - 1,
// shape: {
// points: points
// },
// style: {
// lineDash: this.device.style.Section.mouseOverStyle.lineDash,
// stroke: this.device.style.Section.mouseOverStyle.borderColor,
// fill: this.device.style.transparentColor
// }
// });
this.add(this.lineBorder); this.add(this.lineBorder);
this.lineBorder.hide(); this.lineBorder.hide();

View File

@ -50,17 +50,20 @@ export default class Section extends Group {
if (this.model.leftAxlePosition) { if (this.model.leftAxlePosition) {
this.leftAxle = new EAxle({ this.leftAxle = new EAxle({
_subType: 'leftAxle', _subType: 'leftAxle',
zlevel: this.zlevel,
z: this.z,
shape: { shape: {
style: this.style, style: this.style,
traingle: traingleStart, traingle: traingleStart,
drictx: 1, drictx: 1,
dricty: this.model.leftAxlePosition, dricty: this.model.leftAxlePosition === 1 || this.model.leftAxlePosition === 2 ? 1 : -1,
isSpecial: this.model.leftAxlePosition === -2 || this.model.leftAxlePosition === 2,
point: this.model.points[0], point: this.model.points[0],
multiple1: 1, difference: this.model.points[0].y - this.model.points[1].y,
multiple2: 1.5 multiple: 1
}, },
style: { style: {
lineWidth: 2, lineWidth: this.style.Section.axle.lineWidth,
fill: this.style.Section.axle.color, fill: this.style.Section.axle.color,
stroke: this.style.Section.axle.color stroke: this.style.Section.axle.color
} }
@ -70,17 +73,20 @@ export default class Section extends Group {
if (this.model.rightAxlePosition) { if (this.model.rightAxlePosition) {
this.rightAxle = new EAxle({ this.rightAxle = new EAxle({
_subType: 'rightAxle', _subType: 'rightAxle',
zlevel: this.zlevel,
z: this.z,
shape: { shape: {
style: this.style, style: this.style,
traingle: traingleEnd, traingle: traingleEnd,
drictx: -1, drictx: -1,
dricty: this.model.rightAxlePosition, dricty: this.model.rightAxlePosition === 1 || this.model.rightAxlePosition === 2 ? 1 : -1,
isSpecial: this.model.rightAxlePosition === -2 || this.model.rightAxlePosition === 2,
point: this.model.points[length - 1], point: this.model.points[length - 1],
multiple1: 1.5, difference: this.model.points[length - 2].y - this.model.points[length - 1].y,
multiple2: 1 multiple1: -1
}, },
style: { style: {
lineWidth: 2, lineWidth: this.style.Section.axle.lineWidth,
fill: this.style.Section.axle.color, fill: this.style.Section.axle.color,
stroke: this.style.Section.axle.color stroke: this.style.Section.axle.color
} }
@ -261,7 +267,8 @@ export default class Section extends Group {
createSection() { createSection() {
const model = this.model; const model = this.model;
const style = this.style; const style = this.style;
// 创建区段 // 创建区段 model.logicSectionNum 为空 或 0 表明没有逻辑区段 创建 否则过滤
if ((model.type == '01' && (model.logicSectionNum[0] == 0 || model.logicSectionNum.length == 0)) || model.type == '02' || model.type == '03') {
this.section = new ELines({ this.section = new ELines({
zlevel: this.zlevel, zlevel: this.zlevel,
z: model.type == '02' ? this.z + 1 : this.z, // 逻辑区段会覆盖物理区段 z: model.type == '02' ? this.z + 1 : this.z, // 逻辑区段会覆盖物理区段
@ -297,6 +304,7 @@ export default class Section extends Group {
this.lineBorder.setStyle({ lineWidth: 0 }); this.lineBorder.setStyle({ lineWidth: 0 });
} }
} }
}
// 折返箭头 // 折返箭头
createTurnBack() { createTurnBack() {
@ -765,7 +773,7 @@ export default class Section extends Group {
} }
createMouseEvent() { // 鼠标事件 createMouseEvent() { // 鼠标事件
if (this.style.Section.mouseOverStyle) { // 只有北京线路才会有鼠标事件 if (this.style.Section.mouseOverStyle) {
this.mouseEvent = new EMouse(this, this.model.relSwitchCode); this.mouseEvent = new EMouse(this, this.model.relSwitchCode);
this.add(this.mouseEvent); this.add(this.mouseEvent);
this.on('mouseout', (e) => { this.mouseEvent.mouseout(e); }); this.on('mouseout', (e) => { this.mouseEvent.mouseout(e); });

View File

@ -30,7 +30,7 @@ class ESigLamp extends Group {
stroke: style.Signal.lamp.borderColor stroke: style.Signal.lamp.borderColor
} }
}); });
if ( !style.Signal.lamp.logicDisplayNone ) {
this.lstop = new Line({ this.lstop = new Line({
_subType: 'SignalLamp', _subType: 'SignalLamp',
_val: '3', _val: '3',
@ -51,7 +51,6 @@ class ESigLamp extends Group {
stroke: style.backgroundColor stroke: style.backgroundColor
} }
}); });
this.rstop = new Line({ this.rstop = new Line({
_subType: 'SignalLamp', _subType: 'SignalLamp',
_val: '3', _val: '3',
@ -72,6 +71,7 @@ class ESigLamp extends Group {
stroke: style.backgroundColor stroke: style.backgroundColor
} }
}); });
}
this.add(this.lamp); this.add(this.lamp);
if (!style.Signal.lamp.logicDisplayNone) { if (!style.Signal.lamp.logicDisplayNone) {
this.add(this.lstop); this.add(this.lstop);
@ -97,17 +97,29 @@ class ESigLamp extends Group {
setStop(has) { setStop(has) {
if (has) { if (has) {
this.lstop.show(); this.lstop && this.lstop.show();
this.rstop.show(); this.rstop && this.rstop.show();
} else { } else {
this.lstop.hide(); this.lstop && this.lstop.hide();
this.rstop.hide(); this.rstop && this.rstop.hide();
} }
} }
getBoundingRect() { getBoundingRect() {
return this.lamp.getBoundingRect(); return this.lamp.getBoundingRect();
} }
setAnimationStart(color) {
this.lamp && this.lamp.animateStyle(true)
.when(0, { fill: this.model.style.backgroundColor })
.when(1000, { fill: color })
.when(2000, { fill: this.model.style.backgroundColor })
.when(3000, { fill: color })
.start();
}
setAnimationEnd() {
this.lamp && this.lamp.stopAnimation(false);
}
} }
export default ESigLamp; export default ESigLamp;

View File

@ -41,13 +41,13 @@ class ESigName extends Group {
setColor(color) { setColor(color) {
this.name.setStyle('textFill', color); this.name.setStyle('textFill', color);
} }
getNameText() {
return this.name;
}
// 隐藏
hide() { hide() {
this.name.hide(); this.name.hide();
} }
// 显示
show() { show() {
this.name.show(); this.name.show();
} }

View File

@ -64,6 +64,7 @@ class ESigPost extends Group {
setTerminalOptional() { setTerminalOptional() {
this.triangle = new Polygon({ this.triangle = new Polygon({
zlevel: this.model.zlevel, zlevel: this.model.zlevel,
_val: '3',
z: this.model.z, z: this.model.z,
shape: { shape: {
points: [ points: [
@ -87,7 +88,7 @@ class ESigPost extends Group {
} }
/* 关闭闪烁三角形并还原灯柱 */ /* 关闭闪烁三角形并还原灯柱 */
removeTerminalOptional() { removeTerminalOptional() {
this.triangle.stopAnimation(false); this.triangle && this.triangle.stopAnimation(false);
this.triangle && this.remove(this.triangle); this.triangle && this.remove(this.triangle);
this.ver.show(); this.ver.show();
this.hor.show(); this.hor.show();

View File

@ -16,6 +16,7 @@ import {isShowThePrdType} from '../../utils/handlePath';
import Rect from 'zrender/src/graphic/shape/Rect'; import Rect from 'zrender/src/graphic/shape/Rect';
import Polygon from 'zrender/src/graphic/shape/Polygon'; import Polygon from 'zrender/src/graphic/shape/Polygon';
import Text from 'zrender/src/graphic/Text'; import Text from 'zrender/src/graphic/Text';
import Isogon from 'zrender/src/graphic/shape/Isogon';
class Signal extends Group { class Signal extends Group {
constructor(model, style) { constructor(model, style) {
@ -61,11 +62,34 @@ class Signal extends Group {
x: model.position.x + model.positionPoint.x, x: model.position.x + model.positionPoint.x,
y: model.position.y + model.positionPoint.y + posit * (style.Signal.distance + style.Section.line.width + style.Signal.lamp.radiusR) y: model.position.y + model.positionPoint.y + posit * (style.Signal.distance + style.Section.line.width + style.Signal.lamp.radiusR)
}); });
if (style.Signal.ciConfirm) {
this.ciConfirm = new Text({
zlevel: this.zlevel,
z: this.z,
silent: false,
_subType: 'enabled',
style: {
textBorderColor: 'red',
textBorderWidth: 0,
x: model.position.x + model.positionPoint.x,
y: model.position.y + model.positionPoint.y + posit * (style.Signal.distance + style.Section.line.width + style.Signal.lamp.radiusR + style.Signal.ciConfirm.distance),
fontWeight: style.textStyle.fontWeight,
fontSize: style.Signal.ciConfirm.fontSize,
fontFamily: style.fontFamily,
text: style.Signal.ciConfirm.defaultText,
textFill: style.Signal.ciConfirm.textColor,
textAlign: style.textStyle.textAlign,
textPosition: 'inside',
textVerticalAlign: style.textStyle.textVerticalAlign
}
});
this.add(this.ciConfirm);
this.ciConfirm.hide();
}
// 信号灯 // 信号灯
const endPoint = this.sigPost.getLampPosition(model.lampPostType); const endPoint = this.sigPost.getLampPosition(model.lampPostType);
this.lamps = []; this.lamps = [];
if ((style.Signal.lamp.guidName == 'ningbo_01' || style.Signal.lamp.guidName == 'haerbin_01') && this.count == 1) { if ((style.Signal.lamp.guidName === 'double' || style.Signal.lamp.guidName === 'doubleAndBase') && this.count == 1) {
this.count = 2; this.count = 2;
} }
for (let i = 0; i < this.count; i++) { for (let i = 0; i < this.count; i++) {
@ -101,15 +125,19 @@ class Signal extends Group {
this.tText.hide(); this.tText.hide();
} }
if (style.Signal.insideTriangle) { if (style.Signal.insideTriangle) {
this.insideTriangle = new Polygon({ const right = model.right ? 1 : -1;
const angle = Math.PI / 6 * right;
this.insideTriangle = new Isogon({
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z + 1, z: this.z + 1,
_val: '3',
origin: [endPoint.x, endPoint.y],
rotation:angle,
shape: { shape: {
points: [ x: endPoint.x,
[endPoint.x - style.Signal.lamp.radiusR, endPoint.y - Math.sin(2 * Math.PI / 6) * style.Signal.lamp.radiusR], y: endPoint.y,
[endPoint.x - style.Signal.lamp.radiusR, endPoint.y + Math.sin(2 * Math.PI / 6) * style.Signal.lamp.radiusR], r: style.Signal.lamp.radiusR,
[endPoint.x + style.Signal.lamp.radiusR, endPoint.y] n: 3
]
}, },
style: { style: {
lineWidth: style.Signal.insideTriangle.lineWidth, lineWidth: style.Signal.insideTriangle.lineWidth,
@ -117,11 +145,16 @@ class Signal extends Group {
fill: style.Signal.insideTriangle.fillColor fill: style.Signal.insideTriangle.fillColor
} }
}); });
// this.add(this.insideTriangle); this.add(this.insideTriangle);
// this.insideTriangle.hide();
} }
if (style.Signal.sigBack) { if (style.Signal.sigBack) {
const signalRect = this.getBoundingRect(); const signalRect = this.sigPost.getBoundingRect();
this.lamps.forEach(elem => {
signalRect.union(elem.getBoundingRect());
});
if (this.insideTriangle) {
signalRect.union(this.insideTriangle.getBoundingRect());
}
// 信号的背景 // 信号的背景
this.sigBack = new Rect({ this.sigBack = new Rect({
zlevel: this.zlevel, zlevel: this.zlevel,
@ -230,6 +263,7 @@ class Signal extends Group {
this.add(this.sigPost); this.add(this.sigPost);
this.add(this.sigName); this.add(this.sigName);
this.style.Signal.text.show && model.nameShow ? this.sigName.show() : this.sigName.hide(); this.style.Signal.text.show && model.nameShow ? this.sigName.show() : this.sigName.hide();
this.add(this.sigAuto); this.add(this.sigAuto);
this.add(this.sigRoute); this.add(this.sigRoute);
@ -298,7 +332,7 @@ class Signal extends Group {
this.lamps[0] && this.lamps[0].setColor(this.style.Signal.lamp.greenColor); this.lamps[0] && this.lamps[0].setColor(this.style.Signal.lamp.greenColor);
this.lamps[1] && this.lamps[1].setColor(this.style.backgroundColor); // 设置黑色 this.lamps[1] && this.lamps[1].setColor(this.style.backgroundColor); // 设置黑色
this.virtualSignal && this.virtualSignal.setColor(this.style.Signal.lamp.greenColor); this.virtualSignal && this.virtualSignal.setColor(this.style.Signal.lamp.greenColor);
if (this.style.Signal.lamp.guidName == 'haerbin_01') { // 设置底座颜色 if (this.style.Signal.lamp.guidName === 'doubleAndBase') { // 设置底座颜色
this.sigPost.setColor('#00FF00'); this.sigPost.setColor('#00FF00');
if (this.model.logicLight) { if (this.model.logicLight) {
this.lamps[0] && this.lamps[0].setColor(this.style.Signal.lamp.blueColor); this.lamps[0] && this.lamps[0].setColor(this.style.Signal.lamp.blueColor);
@ -309,7 +343,7 @@ class Signal extends Group {
openLateral() { openLateral() {
this.lamps[0] && this.lamps[0].setColor(this.style.Signal.lamp.yellowColor); this.lamps[0] && this.lamps[0].setColor(this.style.Signal.lamp.yellowColor);
this.lamps[1] && this.lamps[1].setColor(this.style.backgroundColor); this.lamps[1] && this.lamps[1].setColor(this.style.backgroundColor);
if (this.style.Signal.lamp.guidName == 'haerbin_01') { // 设置底座颜色 if (this.style.Signal.lamp.guidName === 'doubleAndBase') { // 设置底座颜色
this.sigPost.setColor('#00FF00'); this.sigPost.setColor('#00FF00');
if (this.model.logicLight) { // 设置哈尔滨逻辑点灯 颜色 if (this.model.logicLight) { // 设置哈尔滨逻辑点灯 颜色
this.lamps[0] && this.lamps[0].setColor(this.style.Signal.lamp.blueColor); this.lamps[0] && this.lamps[0].setColor(this.style.Signal.lamp.blueColor);
@ -328,16 +362,17 @@ class Signal extends Group {
// 引导 // 引导
guid() { guid() {
if (this.style.Signal.lamp.guidName == 'ningbo_01' || this.style.Signal.lamp.guidName == 'haerbin_01') { if (this.style.Signal.lamp.guidName === 'double') {
this.lamps[1].show(); this.lamps[1].show();
} }
if (this.style.Signal.lamp.guidName == 'haerbin_01') { // 设置底座颜色 if (this.style.Signal.lamp.guidName === 'doubleAndBase') { // 设置底座颜色
this.lamps[1].show();
this.sigPost.setColor('#00FF00'); this.sigPost.setColor('#00FF00');
} }
if (this.style.Signal.lamp.guidName != 'chengdu_03') { // 双灯 允许引导信号 if (this.style.Signal.lamp.guidName !== 'singleRY') { // 双灯 允许引导信号
this.lamps[0] && this.lamps[0].setColor(this.style.Signal.lamp.redColor); this.lamps[0] && this.lamps[0].setColor(this.style.Signal.lamp.redColor);
this.lamps[1] && this.lamps[1].setColor(this.style.Signal.lamp.yellowColor); this.lamps[1] && this.lamps[1].setColor(this.style.Signal.lamp.yellowColor);
} else if (this.style.Signal.lamp.guidName == 'chengdu_03') { } else if (this.style.Signal.lamp.guidName === 'singleRY') {
this.lamps[0].setStyle({ fill: this.style.Signal.lamp.yellowColor, stroke: this.style.Signal.lamp.redColor, lineWidth: 2.5 }); this.lamps[0].setStyle({ fill: this.style.Signal.lamp.yellowColor, stroke: this.style.Signal.lamp.redColor, lineWidth: 2.5 });
} }
} }
@ -345,7 +380,7 @@ class Signal extends Group {
// 封锁 // 封锁
block() { block() {
this.lamps[0].setColor(this.style.Signal.lamp.redColor); this.lamps[0].setColor(this.style.Signal.lamp.redColor);
if (this.style.Signal.lamp.guidName == 'haerbin_01') { // 设置底座颜色 if (this.style.Signal.lamp.guidName === 'doubleAndBase') { // 设置底座颜色
this.sigPost.setColor('#000080'); this.sigPost.setColor('#000080');
} }
this.sigName.setColor(this.style.Signal.text.blockColor); this.sigName.setColor(this.style.Signal.text.blockColor);
@ -353,15 +388,7 @@ class Signal extends Group {
this.sigName.setStyle({ textBorderWidth: 1 }); this.sigName.setStyle({ textBorderWidth: 1 });
this.sigName.setColor('#fff'); this.sigName.setColor('#fff');
} }
// if (this.style.Signal.sigBack) { this.sigBack && this.sigBack.show();
// this.sigBack.show();
// this.sigBack.animateStyle(true)
// .when(0, { fill: this.style.backgroundColor })
// .when(1000, { fill: this.style.Signal.sigBack.color })
// .when(2000, { fill: this.style.backgroundColor })
// .when(3000, { fill: this.style.Signal.sigBack.color })
// .start();
// }
} }
// 功能封锁 // 功能封锁
@ -383,7 +410,7 @@ class Signal extends Group {
// 逻辑点灯 // 逻辑点灯
logicalLight() { logicalLight() {
if (this.style.Signal.lamp.guidName != 'haerbin_01') { // 哈尔滨不显示 X状态的逻辑点灯 if (this.style.Signal.lamp.guidName !== 'doubleAndBase') { // 哈尔滨不显示 X状态的逻辑点灯
this.lamps.forEach(lamp => { lamp.setStop(true); }); this.lamps.forEach(lamp => { lamp.setStop(true); });
} }
} }
@ -399,9 +426,12 @@ class Signal extends Group {
this.sigRoute.show(); this.sigRoute.show();
this.sigRoute.setStyle({ fill: this.style.Signal.auto.manualControl }); this.sigRoute.setStyle({ fill: this.style.Signal.auto.manualControl });
} }
if (this.style.Signal.lamp.guidName == 'haerbin_01') { if (this.style.Signal.lamp.guidName === 'doubleAndBase') {
this.sigName.setColor(this.style.Signal.text.ArtificialRouteColor); this.sigName.setColor(this.style.Signal.text.ArtificialRouteColor);
} }
if (this.style.Signal.auto.lampstandard) {
this.sigPost.setColor(this.style.Signal.auto.manualControl);
}
} }
// 设置自动进路模式状态类型 // 设置自动进路模式状态类型
@ -413,7 +443,7 @@ class Signal extends Group {
this.sigAuto.setColor(this.style.Signal.auto.autoRoute); this.sigAuto.setColor(this.style.Signal.auto.autoRoute);
this.sigAuto.show(); this.sigAuto.show();
} }
if (this.style.Signal.lamp.guidName == 'haerbin_01') { if (this.style.Signal.lamp.guidName === 'doubleAndBase') {
this.sigName.setColor(this.style.Signal.text.AutoRouteColor); this.sigName.setColor(this.style.Signal.text.AutoRouteColor);
this.setAutoClose(); this.setAutoClose();
} }
@ -443,9 +473,21 @@ class Signal extends Group {
setDelayUnlock() { setDelayUnlock() {
this.sigDelay.show(); this.sigDelay.show();
} }
// 信号封锁CI确认
setCiConfirm() {
if (this.ciConfirm) {
this.ciConfirm.show();
this.ciConfirm.animateStyle(true)
.when(0, { textFill: this.style.backgroundColor })
.when(1000, { textFill: this.style.Signal.ciConfirm.textColor })
.when(2000, { textFill: this.style.backgroundColor })
.start();
}
}
// 恢复状态 // 恢复状态
recover() { recover() {
this.lamps.forEach(item=> { item.show(); });
this.sigName.setStyle({ textBorderWidth: 0 }); this.sigName.setStyle({ textBorderWidth: 0 });
this.setAutoClose(); this.setAutoClose();
this.sigDelay.hide(); this.sigDelay.hide();
@ -454,12 +496,19 @@ class Signal extends Group {
this.sigBack && this.sigBack.hide(); this.sigBack && this.sigBack.hide();
this.sigName.setColor(this.style.Signal.text.defaultColor); this.sigName.setColor(this.style.Signal.text.defaultColor);
this.sigPost.setColor(this.style.Signal.post.standardColor); // 设置底座默认颜色 this.sigPost.setColor(this.style.Signal.post.standardColor); // 设置底座默认颜色
if (this.style.Signal.lamp.guidName == 'chengdu_03') { if (this.style.Signal.lamp.guidName === 'singleRY') {
this.lamps[0].setStyle({ lineWidth: this.style.Signal.lamp.borderWidth }); this.lamps[0].setStyle({ lineWidth: this.style.Signal.lamp.borderWidth });
} }
if (this.style.Signal.lamp.guidName == 'ningbo_01' || this.style.Signal.lamp.guidName == 'haerbin_01') { if (this.style.Signal.lamp.guidName === 'double' || this.style.Signal.lamp.guidName === 'doubleAndBase') {
this.lamps[1].hide(); this.lamps[1].hide();
} }
this.insideTriangle && this.insideTriangle.hide();
this.sigPost && this.sigPost.removeTerminalOptional();
this.ciConfirm && this.ciConfirm.stopAnimation(false);
this.ciConfirm && this.ciConfirm.hide();
this.sigBack && this.sigBack.hide();
this.sigBack && this.sigBack.stopAnimation(false);
this.lamps && this.lamps[0].setAnimationEnd();
} }
setState(model) { setState(model) {
@ -496,6 +545,28 @@ class Signal extends Group {
} else { } else {
this.physicsLight(); // 设置物理点灯 this.physicsLight(); // 设置物理点灯
} }
if (model.isStartSignal) {
this.insideTriangle && this.insideTriangle.show();
this.lamps.forEach(item => { item.hide(); });
this.insideTriangle.setStyle({fill: this.style.Signal.insideTriangle.startSignalColor, stroke: this.style.Signal.insideTriangle.startSignalColor});
} else if (model.isTerminalSignal) {
this.sigPost && this.sigPost.setTerminalOptional();
}
if (model.isCiConfirm) {
this.setCiConfirm();
}
if (model.isRequestLock) {
this.sigBack && this.sigBack.show();
this.sigBack && this.sigBack.animateStyle(true)
.when(0, { fill: this.style.backgroundColor })
.when(1000, { fill: this.style.Signal.sigBack.color })
.when(2000, { fill: this.style.backgroundColor })
.when(3000, { fill: this.style.Signal.sigBack.color })
.start();
}
if (model.isRequestGuide) {
this.lamps && this.lamps[0] && this.lamps[0].setAnimationStart(this.style.Signal.lamp.yellowColor);
}
} }
getBoundingRect() { getBoundingRect() {
@ -503,6 +574,9 @@ class Signal extends Group {
this.lamps.forEach(elem => { this.lamps.forEach(elem => {
rect.union(elem.getBoundingRect()); rect.union(elem.getBoundingRect());
}); });
if (this.insideTriangle) {
rect.union(this.insideTriangle.getBoundingRect());
}
return rect; return rect;
} }

View File

@ -61,6 +61,7 @@ class EDetainCircle extends Group {
setColor(color) { setColor(color) {
this.detainCircle.setStyle('stroke', color); this.detainCircle.setStyle('stroke', color);
this.line1.setStyle('stroke', color); this.line1.setStyle('stroke', color);
this.line2.setStyle('stroke', color);
} }
} }

View File

@ -0,0 +1,57 @@
import Group from 'zrender/src/container/Group';
import Polygon from 'zrender/src/graphic/shape/Polygon';
class EPatternFilter extends Group {
constructor(model) {
super();
this.model = model;
this.create();
}
create() {
const model = this.model;
const style = this.model.style;
const startX = (model.width / 2 + style.StationStand.patternFilter.offset.x);
const startY = model.y + (model.height / 2 + style.StationStand.patternFilter.offset.y) * model.direction + (1 + model.direction) / 2 * 14;
this.patternFilter1 = new Polygon({
zlevel: model.zlevel,
z: model.z,
shape: {
points:[
[model.x - startX, startY],
[model.x - startX, startY - 14],
[model.x - startX - 14, startY - 14],
[model.x - startX - 14 - 10 * 0.866, startY - 7],
[model.x - startX - 14, startY]
]
},
style: {
fill: style.StationStand.patternFilter.defaultColor
}
});
this.patternFilter2 = new Polygon({
zlevel: model.zlevel,
z: model.z,
shape: {
points:[
[model.x + startX, startY],
[model.x + startX, startY - 14],
[model.x + startX + 14, startY - 14],
[model.x + startX + 14 + 10 * 0.866, startY - 7],
[model.x + startX + 14, startY]
]
},
style: {
fill: style.StationStand.patternFilter.defaultColor
}
});
this.add(this.patternFilter1);
this.add(this.patternFilter2);
}
setColor(color) {
this.patternFilter1.setStyle('fill', color);
}
}
export default EPatternFilter;

View File

@ -13,6 +13,7 @@ import ETrainStop from './ETrainStop';
import ETrainDepart from './ETrainDepart'; import ETrainDepart from './ETrainDepart';
import EControl from '../element/EControl'; import EControl from '../element/EControl';
import EDetainCircle from './EDetainCircle'; import EDetainCircle from './EDetainCircle';
import EPatternFilter from './EPatternFilter';
import {isShowThePrdType} from '../../utils/handlePath'; import {isShowThePrdType} from '../../utils/handlePath';
class StationStand extends Group { class StationStand extends Group {
@ -60,6 +61,22 @@ class StationStand extends Group {
}); });
this.add(this.safeStand); this.add(this.safeStand);
// 模式筛选标识(西安二号线特殊的情况)
if (style.StationStand.patternFilter) {
const direction = model.right ? 1 : -1;
this.patternFilter = new EPatternFilter({
zlevel: this.zlevel,
z: this.z + 1,
style: style,
x: model.position.x,
y: model.position.y,
width: model.width,
height:model.height,
direction:direction
});
this.add(this.patternFilter);
}
/** 站台紧急关闭*/ /** 站台紧急关闭*/
const emergentOffset = model.inside ? style.StationStand.standEmergent.insideOffset : style.StationStand.standEmergent.outsideOffset; const emergentOffset = model.inside ? style.StationStand.standEmergent.insideOffset : style.StationStand.standEmergent.outsideOffset;
const emergentH = model.right ? 1 : -1; const emergentH = model.right ? 1 : -1;
@ -117,13 +134,14 @@ class StationStand extends Group {
/** 站台折返策略*/ /** 站台折返策略*/
if (style.StationStand.reentry.offset) { if (style.StationStand.reentry.offset) {
const reentryH = style.StationStand.standEmergent.mergentR; const reentryH = style.StationStand.standEmergent.mergentR;
const reentryX = model.position.x - (style.StationStand.reentry.position || drict) * (style.StationStand.reentry.offset.x - model.width / 2); const isRight = model.right ? -1 : 1;
const reentryY = model.position.y + (style.StationStand.reentry.position || drict) * (style.StationStand.reentry.offset.y) + drict * reentryH; const reentryX = model.position.x - (style.StationStand.reentry.position || isRight) * (style.StationStand.reentry.offset.x - model.width / 2);
const reentryY = model.position.y + (style.StationStand.reentry.position || isRight) * (style.StationStand.reentry.offset.y) + isRight * reentryH;
this.reentry = new EReentry({ this.reentry = new EReentry({
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z + 1, z: this.z + 1,
style: style, style: style,
drict: drict, drict: isRight,
x: reentryX, x: reentryX,
y: reentryY, y: reentryY,
lineWidth: 0, lineWidth: 0,
@ -421,18 +439,21 @@ class StationStand extends Group {
standDetainTrain() { standDetainTrain() {
this.detain && this.detain.showMode(); this.detain && this.detain.showMode();
this.detain && this.detain.setColor(this.style.StationStand.detainCar.detainTrainTextColor); this.detain && this.detain.setColor(this.style.StationStand.detainCar.detainTrainTextColor);
this.detainCircle && this.detainCircle.setColor(this.style.StationStand.detainCar.centerTrainColor);
} }
/** 中心扣车*/ /** 中心扣车*/
centerDetainTrain() { centerDetainTrain() {
this.detain && this.detain.showMode(); this.detain && this.detain.showMode();
this.detain && this.detain.setColor(this.style.StationStand.detainCar.centerTrainColor); this.detain && this.detain.setColor(this.style.StationStand.detainCar.centerTrainColor);
this.detainCircle && this.detainCircle.setColor(this.style.StationStand.detainCar.centerTrainColor);
} }
/** 中心+车站扣车*/ /** 中心+车站扣车*/
standAndCenterDetainTrain() { standAndCenterDetainTrain() {
this.detain && this.detain.showMode(); this.detain && this.detain.showMode();
this.detain && this.detain.setColor(this.style.StationStand.detainCar.andCenterTrainColor); this.detain && this.detain.setColor(this.style.StationStand.detainCar.andCenterTrainColor);
this.detainCircle && this.detainCircle.setColor(this.style.StationStand.detainCar.centerTrainColor);
} }
/** 人工设置停战时间*/ /** 人工设置停战时间*/
@ -495,7 +516,13 @@ class StationStand extends Group {
} }
/** 设置折返策略*/ /** 设置折返策略*/
switch (model.reentryStrategy) { let reentryStrategy = '';
if (model.reentryStrategy !== '04') {
reentryStrategy = model.reentryStrategy;
} else {
reentryStrategy = model.defaultReentryStrategy;
}
switch (reentryStrategy) {
case '04': /** 默认*/ case '04': /** 默认*/
case '01': case '01':
this.noReentry(); /** 无折返策略*/ this.noReentry(); /** 无折返策略*/
@ -588,7 +615,7 @@ class StationStand extends Group {
} }
} }
setShowStation(stationCode) { setShowStation(stationCode) {
if (!stationCode || this.model.deviceStationCode === stationCode) { if ((!stationCode || this.model.deviceStationCode === stationCode) && this.model.visible) {
this.eachChild(item => { this.eachChild(item => {
item.show(); item.show();
}); });

View File

@ -3,6 +3,7 @@
*/ */
import Line from 'zrender/src/graphic/shape/Line'; import Line from 'zrender/src/graphic/shape/Line';
import Group from 'zrender/src/container/Group'; import Group from 'zrender/src/container/Group';
import Text from 'zrender/src/graphic/Text';
import JTriangle from '../../utils/JTriangle'; import JTriangle from '../../utils/JTriangle';
import ESwName from './ESwName.js'; import ESwName from './ESwName.js';
import ESwLocal from './ESwLocal.js'; import ESwLocal from './ESwLocal.js';
@ -155,12 +156,28 @@ export default class Switch extends Group {
triangle: this.triangle triangle: this.triangle
}); });
this.enabledName = new Text({ // 道岔使能 E 西安二号线独有
zlevel: this.zlevel,
z: this.z + 6,
_subType: 'enabled', // 标识
style: {
x: arrowTextX,
y: arrowTextY,
fontSize: 12,
text: 'E',
textAlign: 'center',
textVerticalAlign: 'middle',
textFill: 'yellow'
}
});
this.add(this.locShelter); this.add(this.locShelter);
this.add(this.relocShelter); this.add(this.relocShelter);
this.add(this.rhomboid); this.add(this.rhomboid);
this.add(this.sheltertriangle); this.add(this.sheltertriangle);
this.add(this.releaseBackground); this.add(this.releaseBackground);
this.add(this.name); this.add(this.name);
this.add(this.enabledName);
style.Switch.text.show && model.nameShow ? this.name.show() : this.name.hide(); style.Switch.text.show && model.nameShow ? this.name.show() : this.name.hide();
} }
@ -200,6 +217,15 @@ export default class Switch extends Group {
} }
} }
setCiConfirm() {
this.enabledName && this.enabledName.show();
this.enabledName.animateStyle(true)
.when(0, { textFill: this.style.backgroundColor })
.when(1000, { textFill: 'yellow' })
.when(2000, { textFill: this.style.backgroundColor })
.start();
}
/** 名称动画*/ /** 名称动画*/
nameTextAnimation() { nameTextAnimation() {
this.name.getNameText().animateStyle(true) this.name.getNameText().animateStyle(true)
@ -241,6 +267,7 @@ export default class Switch extends Group {
this.setHasTextBorder(0); this.setHasTextBorder(0);
this.locShelter.hide(); // 定位覆盖图形 this.locShelter.hide(); // 定位覆盖图形
this.relocShelter.hide(); // 反位覆盖图形 this.relocShelter.hide(); // 反位覆盖图形
this.enabledName.hide(); // 使能隐藏
} }
/** 定位*/ /** 定位*/
@ -461,6 +488,8 @@ export default class Switch extends Group {
model.singleLock && model.blockade && this.blockMonolock(); // 单锁&锁闭状态 model.singleLock && model.blockade && this.blockMonolock(); // 单锁&锁闭状态
/** 区段切除*/ /** 区段切除*/
// this.setForkAction(); // 道岔挤岔完成 // this.setForkAction(); // 道岔挤岔完成
// 道岔使能显示
model.isCiConfirm && this.setCiConfirm();
model.cutOff && this.setSwitchCutOff(); model.cutOff && this.setSwitchCutOff();
if (this.style.Switch.sectionAction.flag) { // 哈尔滨线路处理道岔相关区段颜色 if (this.style.Switch.sectionAction.flag) { // 哈尔滨线路处理道岔相关区段颜色
const switchModel = Vue.prototype.$jlmap.mapDevice[model.code]; const switchModel = Vue.prototype.$jlmap.mapDevice[model.code];

View File

@ -13,6 +13,7 @@ export default class TrainHead extends Group {
const model = this.model; const model = this.model;
const style = this.model.style; const style = this.model.style;
const baseMargin = (model.drect === -1 ? 1 : 0); const baseMargin = (model.drect === -1 ? 1 : 0);
if (style.Train.trainHead.trainConntWidth) {
this.line = new Rect({ this.line = new Rect({
zlevel: model.zlevel, zlevel: model.zlevel,
z: model.z, z: model.z,
@ -28,6 +29,8 @@ export default class TrainHead extends Group {
fill: style.Train.trainHead.trainHeadFillColor fill: style.Train.trainHead.trainHeadFillColor
} }
}); });
this.add(this.line);
}
this.arrow = new Polygon({ this.arrow = new Polygon({
zlevel: model.zlevel, zlevel: model.zlevel,
z: model.z, z: model.z,
@ -45,16 +48,17 @@ export default class TrainHead extends Group {
} }
}); });
this.add(this.line);
this.add(this.arrow); this.add(this.arrow);
} }
setColor(color) { setColor(color) {
this.line && this.line.setStyle('fill', color); this.line && this.line.setStyle('fill', color);
this.arrow && this.arrow.setStyle('fill', color); this.arrow && this.arrow.setStyle('fill', color);
} }
setLineShow(isShow, sss) { setLineShow(isShow) {
if (this.line) {
isShow ? this.line.show() : this.line.hide(); isShow ? this.line.show() : this.line.hide();
} }
}
setArrowShow(isShow) { setArrowShow(isShow) {
isShow ? this.arrow.show() : this.arrow.hide(); isShow ? this.arrow.show() : this.arrow.hide();
} }

View File

@ -16,13 +16,15 @@ export default class Train extends Group {
this.zlevel = model.zlevel; this.zlevel = model.zlevel;
this.model = model; this.model = model;
this.style = style; this.style = style;
this.size = 0;
this.z = 40; this.z = 40;
// this.size = 0;
this.section = null; this.section = null;
this.isShowShape = true; this.isShowShape = true;
this.fontSize = style.Train.common.useSelfText ? style.Train.common.nameFontSize || style.Train.common.trainTextFontSize : model.nameFontSize || style.Train.common.nameFontSize || style.Train.common.trainTextFontSize; this.fontSize = style.Train.common.useSelfText ? style.Train.common.nameFontSize || style.Train.common.trainTextFontSize : model.nameFontSize || style.Train.common.nameFontSize || style.Train.common.trainTextFontSize;
// this.fontSize = model.nameFontSize || style.Train.common.nameFontSize || style.Train.common.trainTextFontSize;
this.newScale = this.fontSize / style.Train.common.trainTextFontSize; this.newScale = this.fontSize / style.Train.common.trainTextFontSize;
this.nameFormat = style.Train.common.useSelfFormat ? style.Train.trainBody.trainNameFormat : model.nameFormat || style.Train.trainBody.trainNameFormat; this.nameFormat = style.Train.common.useSelfFormat ? style.Train.trainBody.trainNameFormat : model.nameFormat || style.Train.trainBody.trainNameFormat;
// this.nameFormat = model.nameFormat || style.Train.trainBody.trainNameFormat;
if (style.Train.trainBody.specialTrainType.length > 0) { if (style.Train.trainBody.specialTrainType.length > 0) {
style.Train.trainBody.specialTrainType.some((item) => { style.Train.trainBody.specialTrainType.some((item) => {
if (model.type === item.type) { if (model.type === item.type) {
@ -32,6 +34,7 @@ export default class Train extends Group {
} }
}); });
} }
this.create(); this.create();
this.setState(model, this); this.setState(model, this);
this.initShowStation(model); this.initShowStation(model);

View File

@ -26,15 +26,18 @@ class TrainWindow extends Group {
} }
createMouseEvent() { createMouseEvent() {
if (this.model.trainWindowShow) {
this.mouseEvent = new EMouse(this); this.mouseEvent = new EMouse(this);
this.on('mouseout', (e) => { this.mouseEvent.mouseout(e); }); this.on('mouseout', (e) => { this.mouseEvent.mouseout(e); });
this.on('mouseover', (e) => { this.mouseEvent.mouseover(e); }); this.on('mouseover', (e) => { this.mouseEvent.mouseover(e); });
} }
}
/** 创建车次窗*/ /** 创建车次窗*/
createTrainWindow() { createTrainWindow() {
const model = this.model; const model = this.model;
const point = model.point || model.position; const point = model.point || model.position;
if (this.model.trainWindowShow) {
this.trainRect = new Polygon({ this.trainRect = new Polygon({
_subType: 'TrainWindow', _subType: 'TrainWindow',
zlevel: this.zlevel, zlevel: this.zlevel,
@ -57,6 +60,7 @@ class TrainWindow extends Group {
}); });
this.add(this.trainRect); this.add(this.trainRect);
} }
}
isPop(e) { isPop(e) {
for (var i = 0; i < this.childCount(); i++) { for (var i = 0; i < this.childCount(); i++) {

View File

@ -23,6 +23,7 @@ import CheckBox from './checkBox/checkBox.js';
import AutomaticRoute from './AutomacticRoute/index.js'; import AutomaticRoute from './AutomacticRoute/index.js';
import SaidLamp from './SaidLamp/index.js'; import SaidLamp from './SaidLamp/index.js';
import SplitStation from './SplitStation/index'; import SplitStation from './SplitStation/index';
import Arrow from './Arrow/index';
/** 图库*/ /** 图库*/
const mapShape = {}; const mapShape = {};
@ -67,6 +68,7 @@ mapShape[deviceType.ReturnModeGroup] = SaidLamp;
mapShape[deviceType.Axle] = SaidLamp; mapShape[deviceType.Axle] = SaidLamp;
mapShape[deviceType.SwitchFault] = SaidLamp; mapShape[deviceType.SwitchFault] = SaidLamp;
mapShape[deviceType.SplitStation] = SplitStation; mapShape[deviceType.SplitStation] = SplitStation;
mapShape[deviceType.Arrow] = Arrow;
function shapefactory(device, jmap) { function shapefactory(device, jmap) {
const type = device._type; const type = device._type;

View File

@ -146,8 +146,8 @@ export default {
this.tripNumberList.push(item); this.tripNumberList.push(item);
} }
}); });
}).catch(error => { }).catch(() => {
this.$messageBox(error.message); // this.$messageBox(error.message);
}); });
this.dialogShow = true; this.dialogShow = true;
this.$nextTick(function () { this.$nextTick(function () {

View File

@ -769,14 +769,7 @@ export default {
} }
}); });
}, },
selectedClassB(item, index) {
const order = this.order || 0;
if (this.mode !== TrainingMode.TEACH) { //
this.popupMenuB(item, index);
} else if (this.steps[order] && this.steps[order].type == 'bar') { //
this.popupMenuB(item, index);
}
},
popupMenuB(item, index) { popupMenuB(item, index) {
this.$store.dispatch('menuOperation/setPopMenu', { position: null, menu: null }); this.$store.dispatch('menuOperation/setPopMenu', { position: null, menu: null });
const operate = { const operate = {

View File

@ -106,15 +106,6 @@ export default {
] ]
}; };
}, },
watch: {
'$store.state.menuOperation.menuCount': function (val) {
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Station) && !this.buttonOperation) {
this.doShow(this.$store.state.menuOperation.menuPosition);
} else {
this.doClose();
}
}
},
computed: { computed: {
...mapGetters('training', [ ...mapGetters('training', [
'mode', 'mode',
@ -124,6 +115,15 @@ export default {
'buttonOperation' 'buttonOperation'
]) ])
}, },
watch: {
'$store.state.menuOperation.menuCount': function (val) {
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Station) && !this.buttonOperation) {
this.doShow(this.$store.state.menuOperation.menuPosition);
} else {
this.doClose();
}
}
},
methods: { methods: {
clickEvent() { clickEvent() {
const self = this; const self = this;

View File

@ -2,6 +2,7 @@ import deviceType from '../../constant/deviceType';
class Model { class Model {
constructor() { constructor() {
this.screenLine = 3;
// 公共字段部分默认初始值 // 公共字段部分默认初始值
this['public'] = {}; this['public'] = {};
this['public'][deviceType.Signal] = { this['public'][deviceType.Signal] = {

View File

@ -156,8 +156,8 @@ export default {
this.tripNumberList.push(item); this.tripNumberList.push(item);
} }
}); });
}).catch(error => { }).catch(() => {
this.$messageBox(error.message); // this.$messageBox(error.message);
}); });
this.dialogShow = true; this.dialogShow = true;
this.$nextTick(function () { this.$nextTick(function () {

View File

@ -84,7 +84,7 @@ export default {
label: '道岔单解', label: '道岔单解',
handler: this.unlock, handler: this.unlock,
cmdType: CMD.Switch.CMD_SWITCH_SINGLE_UNLOCK cmdType: CMD.Switch.CMD_SWITCH_SINGLE_UNLOCK
}, }
// { // {
// label: '', // label: '',
// handler: '', // handler: '',

View File

@ -94,7 +94,7 @@ export default {
console.error(error); console.error(error);
this.loading = false; this.loading = false;
this.reloadTable(); this.reloadTable();
this.$messageBox(`生成用户每日运行图失败`); // this.$messageBox(``);
}); });
} else { } else {
this.$messageBox(`请选择需要加载的运行图`); this.$messageBox(`请选择需要加载的运行图`);
@ -120,7 +120,7 @@ export default {
}); });
}); });
}).catch(() => { }).catch(() => {
this.$messageBox(`获取车站列表失败`); // this.$messageBox(``);
}); });
} }
}, },

View File

@ -114,7 +114,7 @@ export default {
this.doClose(); this.doClose();
}).catch(() => { }).catch(() => {
this.doClose(); this.doClose();
this.$messageBox('创建运行图计划失败'); // this.$messageBox('');
}); });
} }
}); });

View File

@ -117,7 +117,7 @@ export default {
this.reloadTable(); this.reloadTable();
}).catch(() => { }).catch(() => {
this.reloadTable(); this.reloadTable();
this.$messageBox('删除失败'); // this.$messageBox('');
}); });
}).catch(() => { }); }).catch(() => { });
}, },

View File

@ -2,6 +2,7 @@ import deviceType from '../../constant/deviceType';
class Model { class Model {
constructor() { constructor() {
this.screenLine = 3;
// 公共字段部分默认初始值 // 公共字段部分默认初始值
this['public'] = {}; this['public'] = {};
this['public'][deviceType.Signal] = { this['public'][deviceType.Signal] = {

View File

@ -149,8 +149,8 @@ export default {
this.tripNumberList.push(item); this.tripNumberList.push(item);
} }
}); });
}).catch(error => { }).catch(() => {
this.$messageBox(error.message); // this.$messageBox(error.message);
}); });
this.dialogShow = true; this.dialogShow = true;
this.$nextTick(function () { this.$nextTick(function () {
@ -184,11 +184,11 @@ export default {
if (valid) { if (valid) {
this.doClose(); this.doClose();
} }
}).catch(error => { }).catch(() => {
this.loading = false; this.loading = false;
this.doClose(); this.doClose();
// this.$refs.noticeInfo.doShow(operate); // this.$refs.noticeInfo.doShow(operate);
this.$messageBox(error.message); // this.$messageBox(error.message);
}); });
} else { } else {
return false; return false;

View File

@ -64,7 +64,6 @@
</div> </div>
<station-control-convert ref="stationControlConvert" /> <station-control-convert ref="stationControlConvert" />
<password-box ref="passwordBox" @setLoginResult="getLoginResult" /> <password-box ref="passwordBox" @setLoginResult="getLoginResult" />
<view-train-id ref="viewTrainId" />
<view-name ref="viewName" /> <view-name ref="viewName" />
<notice-info ref="noticeInfo" /> <notice-info ref="noticeInfo" />
<train-add ref="trainAdd" /> <train-add ref="trainAdd" />
@ -86,7 +85,6 @@ import TrainAdd from './menuDialog/trainAdd';
import TrainTranstalet from './menuDialog/trainTranstalet'; import TrainTranstalet from './menuDialog/trainTranstalet';
import TrainDelete from './menuDialog/trainDelete'; import TrainDelete from './menuDialog/trainDelete';
import PasswordBox from './menuDialog/passwordBox'; import PasswordBox from './menuDialog/passwordBox';
import ViewTrainId from './menuDialog/viewTrainId';
import ViewName from './menuDialog/viewName'; import ViewName from './menuDialog/viewName';
import ManageUser from './menuDialog/manageUser'; import ManageUser from './menuDialog/manageUser';
import HelpAbout from './menuDialog/helpAbout'; import HelpAbout from './menuDialog/helpAbout';
@ -100,7 +98,6 @@ export default {
NoticeInfo, NoticeInfo,
StationControlConvert, StationControlConvert,
PasswordBox, PasswordBox,
ViewTrainId,
ViewName, ViewName,
TrainAdd, TrainAdd,
TrainTranstalet, TrainTranstalet,

View File

@ -1,193 +0,0 @@
<template>
<el-dialog
v-dialogDrag
class="chengdou-03__systerm view-train-id"
title="列车识别号显示设置"
:visible.sync="show"
width="420px"
:before-close="doClose"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
>
<div style="padding: 10px 20px; border: 1px double lightgray;">
<span class="base-label">计划车显示模式</span>
<el-radio-group v-model="planMode">
<el-row>
<el-col :span="10">
<el-radio :label="1">表号+车次号</el-radio>
</el-col>
<el-col :span="10" :offset="4">
<el-radio :label="2">表号+车组号</el-radio>
</el-col>
</el-row>
<el-row>
<el-col :span="10">
<el-radio :label="3">目的地号+车次号</el-radio>
</el-col>
<el-col :span="10" :offset="4">
<el-radio :label="4">目的地号+车组号</el-radio>
</el-col>
</el-row>
<el-row>
<el-col :span="10">
<el-radio :label="5">目的地号+表号+车次号</el-radio>
</el-col>
<el-col :span="10" :offset="4">
<el-radio :label="6">目的地号+表号+车组号</el-radio>
</el-col>
</el-row>
</el-radio-group>
</div>
<div style="padding: 10px 20px; border: 1px double lightgray; margin: 20px 0px;">
<span class="base-label">头码车显示模式</span>
<el-radio-group v-model="headMode">
<el-row>
<el-col :span="10">
<el-radio :label="3">目的地号+车次号</el-radio>
</el-col>
<el-col :span="6" :offset="8">
<el-radio :label="4">目的地号+车组号</el-radio>
</el-col>
</el-row>
</el-radio-group>
</div>
<div style="padding: 10px 20px; border: 1px double lightgray;">
<span class="base-label">字体大小</span>
<el-row>
<el-col :span="10">
<el-input v-model="fontSize" size="small" min="16" max="99" />
</el-col>
<el-col :span="10" :offset="1">
<span style="height:32px; line-height:32px;">范围16-99</span>
</el-col>
</el-row>
</div>
<el-row class="button-group">
<el-col :span="6" :offset="2">
<el-button :id="domIdConfirm" type="primary" :loading="loading" @click="commit">确定</el-button>
</el-col>
<el-col :span="4" :offset="8">
<el-button :id="domIdCancel" @click="cancel"> </el-button>
</el-col>
</el-row>
<notice-info ref="noticeInfo" />
</el-dialog>
</template>
<script>
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import OperationHandler from '@/scripts/cmdPlugin/OperationHandler';
import NoticeInfo from '../dialog/childDialog/childDialog/noticeInfo';
export default {
name: 'ViewTrainId',
components: {
NoticeInfo
},
data() {
return {
dialogShow: false,
loading: false,
operate: null,
operation: '',
planMode: 5,
headMode: 5,
fontSize: 16
};
},
computed: {
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
},
domIdCancel() {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
},
domIdConfirm() {
return this.dialogShow ? OperationEvent.Command.close.confirm.domId : '';
}
},
mounted() {
this.$nextTick(() => {
this.setTrainDispaly();
this.$store.dispatch('training/tipReload');
});
},
methods: {
doShow(operate) {
this.operate = operate || {};
this.operation = operate.operation;
//
if (!this.dialogShow) {
this.loading = false;
}
this.dialogShow = true;
this.$nextTick(function () {
this.$store.dispatch('training/emitTipFresh');
});
},
doClose() {
this.loading = false;
this.dialogShow = false;
this.$store.dispatch('training/emitTipFresh');
},
cancel() {
const operate = {
type: this.operate.type,
operation: OperationEvent.Command.cancel.menu.operation
};
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) {
this.doClose();
}
});
},
commit() {
const operate = {
over: true,
type: this.operate.type,
operation: OperationEvent.Command.close.confirm.operation,
val: [this.planMode, this.headMode, this.fontSize].join('::')
};
this.loading = true;
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
this.loading = false;
if (valid) {
this.setTrainDispaly();
this.doClose();
}
}).catch(error => {
this.loading = false;
});
},
setTrainDispaly() {
const updatList = [];
const trainList = this.$store.getters['training/viewTrainList']();
if (trainList && trainList.length > 0) {
const nameFormat = this.trainNameFormatBy(this.planMode);
const nameFontSize = this.fontSize;
trainList.forEach(elem => {
updatList.push(Object.assign(this.$jlmap.getDeviceByCode(elem.code), { nameFormat, nameFontSize }));
});
this.$store.dispatch('map/updateMapDevices', updatList);
}
},
trainNameFormatBy(mode) {
switch (mode.toString()) {
case '1': return 'serviceNumber:tripNumber'; // +
case '2': return 'serviceNumber:groupNumber'; // +
case '3': return 'targetCode:tripNumber'; // +
case '4': return 'targetCode:groupNumber'; // +
case '5': return 'targetCode:serviceNumber:tripNumber'; // ++
case '6': return 'targetCode:serviceNumber:groupNumber'; // ++
}
return ''; //
}
}
};
</script>

View File

@ -2,6 +2,7 @@ import deviceType from '../../constant/deviceType';
class Model { class Model {
constructor() { constructor() {
this.screenLine = 3;
// 公共字段部分默认初始值 // 公共字段部分默认初始值
this['public'] = {}; this['public'] = {};
this['public'][deviceType.Signal] = { this['public'][deviceType.Signal] = {

View File

@ -128,7 +128,7 @@ export default {
this.$emit('setOperate', { step: 1, success: true }); this.$emit('setOperate', { step: 1, success: true });
this.doClose(); this.doClose();
} }
}).catch((error) => { }).catch(() => {
this.loading = false; this.loading = false;
this.$emit('setOperate', { step: 0, success: false }); this.$emit('setOperate', { step: 0, success: false });
this.doClose(); this.doClose();
@ -147,9 +147,7 @@ export default {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.doClose(); this.doClose();
} }
}).catch(error => { }).catch(() => { this.doClose(); });
this.doClose();
});
} }
} }
}; };

Some files were not shown because too many files have changed in this diff Show More