This commit is contained in:
ival 2019-07-25 14:20:03 +08:00
commit 9acdab0b5b
4 changed files with 121 additions and 210 deletions

View File

@ -58,6 +58,23 @@ class Jlmap {
this.$mouseController.on(this.events.Zoom, this.optionsHandler);
}
loadStyle(skinStyle) {
return selectSkinStyle(skinStyle);
}
loadDefaultState() {
const defaultStateDict = {};
zrUtil.each(Object.keys(deviceState), (type) => {
defaultStateDict[type] = {};
zrUtil.each(Object.keys(deviceState[type] || {}), (state) => {
defaultStateDict[type][state] = deviceState[type][state].Default;
}, this);
}, this);
return defaultStateDict;
}
setMap(map) {
// 保存皮肤类型
this.skinStyle = map.skinVO.code;
@ -81,23 +98,6 @@ class Jlmap {
if (this.methods.viewLoaded instanceof Function) { this.methods.viewLoaded(); }
}
loadStyle(skinStyle) {
return selectSkinStyle(skinStyle);
}
loadDefaultState() {
const defaultStateDict = {};
zrUtil.each(Object.keys(deviceState), (type) => {
defaultStateDict[type] = {};
zrUtil.each(Object.keys(deviceState[type] || {}), (state) => {
defaultStateDict[type][state] = deviceState[type][state].Default;
}, this);
}, this);
return defaultStateDict;
}
setDefaultState() {
const list = [];

View File

@ -19,9 +19,6 @@ export default class Train extends Group {
this.newScale = this.fontSize / style.Train.trainTextFontSize;
this._create();
this.setState(state);
/*this.on('mousedown', this.mouseclick);
this.on('mouseout', this.mouseleave);
this.on('mouseover', this.mouseenter);*/
}
_computed() {
@ -102,27 +99,6 @@ export default class Train extends Group {
this.add(this.trainL);
this.add(this.trainR);
}
/*let rect = Object.assign({}, this.getBoundingRect());
rect.x -= theme.trainWidth / 2;
rect.y -= 5;
rect.width += theme.trainWidth;
rect.height += 10;
this.trainBorder = new Rect({
zlevel: model.zlevel,
z: this.z,
silent: true,
shape: rect,
style: {
lineDash: [3, 3],
stroke: theme.borderColor,
fill: theme.transparentColor
}
})
this.add(this.trainBorder);
this.mouseStatusRecover();*/
}
// 获取设备提示坐标
@ -148,7 +124,7 @@ export default class Train extends Group {
// 设置服务号状态类型
setServerNoType(type) {
if (this.style.Train.serverNoType.length>0) {
let flag = this.style.Train.serverNoType.some((item) =>{
const flag = this.style.Train.serverNoType.some((item) =>{
if (type === item.type) {
this.trainB.setTextTrainServerColor(item.showColor);
return true;
@ -163,14 +139,14 @@ export default class Train extends Group {
// 设置目的地状态
setDestinationStatus(status) {
if (this.style.Train.destinationStatus.length>0) {
let flag = this.style.Train.destinationStatus.some((item) =>{
const flag = this.style.Train.destinationStatus.some((item) =>{
if (status === item.status) {
this.trainB.setTextTrainTargetColor(item.showColor);
return true;
}
});
if (this.style.Train.defaultDestinationColor && !flag) {
this.trainB.setTextTrainTargetColor(this.style.Train.defaultDestinationColor)
this.trainB.setTextTrainTargetColor(this.style.Train.defaultDestinationColor);
}
}
}
@ -287,10 +263,9 @@ export default class Train extends Group {
}
// 是否根据车身上车组号、服务号、车次号、目的地码显示情况改变列车长度
isChangeTrainWidth(model, style) {
if(!style.Train.changeTrainWidth)
return;
if (!style.Train.changeTrainWidth) { return; }
if (model.nameFormat) {
let arr = model.nameFormat.split(':');
const arr = model.nameFormat.split(':');
arr.forEach(ele => {
switch (ele) {
case 'targetCode': {
@ -320,62 +295,4 @@ export default class Train extends Group {
removeTrainDetail() {
this.trainB.removeTrainDetail();
}
//获取列车包围框
/*getBoundingRect() {
let list = [this.trainB, this.trainL, this.trainR];
let rect = null;
list.forEach(elem => {
if (elem) {
let tempRect = elem.getBoundingRect();
if (tempRect.x && tempRect.y && tempRect.width && tempRect.height) {
if (rect) {
rect.union(tempRect);
} else {
rect = tempRect;
}
}
}
});
return rect || new BoundingRect(0, 0, 0, 0);
}*/
/* setSectionBorderShow(show) {
let section = store.getters['map/getViewInstanceByDevice']({ _type: ModelType.Section, _code: this.model.sectionCode });
show && section && section.mouseStatusVisible();
show || section && section.mouseStatusRecover();
}
mouseStatusVisible() {
this.trainBorder.show();
this.setSectionBorderShow(true);
this.trainB.setMouseOver();
}
mouseStatusRecover() {
this.trainBorder.hide();
this.setSectionBorderShow(false);
this.trainB.setMouseOut();
}
mouseclick(e) {
if ([3].includes(e.which)) {
this.selected = !this.selected;
if (this.selected) {
this.mouseStatusVisible();
}
}
}
mouseenter(e) {
if (!this.selected) {
this.mouseStatusVisible();
}
}
mouseleave(e) {
if (!this.selected) {
this.mouseStatusRecover();
}
}*/
}

View File

@ -187,8 +187,6 @@ const map = {
state: {
map: {}, // 地图数据
mapList: {}, // 地图数据列表
dataZoom: {}, // 缩放位置
deviceUpdateCount: 0, // 地图设备更新标识
mapViewLoadedCount: 0, // 地图视图加载完成标识
mapDataLoadedCount: 0, // 地图数据加载完成标识
trainDetails: null // 列车详情显示
@ -439,12 +437,11 @@ const map = {
},
mutations: {
loadMapData: (state) => {
++state.deviceUpdateCount;
setMapData: (state, map) => {
state.map = map;
},
mapRender: (state, devices) => {
Vue.$jlmap && Vue.$jlmap.render(devices);
++state.deviceUpdateCount;
},
mapUpdate: (devices) => {
Vue.$jlmap && Vue.$jlmap.update(devices);
@ -492,8 +489,8 @@ const map = {
commit('mapClear');
},
loadMapData: ({ commit }) => {
commit('loadMapData');
setMapData: ({ commit }, map) => {
commit('setMapData', map);
},
setTrainDetails: ({ commit }, message) => {

View File

@ -27,6 +27,7 @@ import ZoomBox from './zoom/zoom';
import ProgressBar from '@/views/components/progressBar/index';
import { mapGetters } from 'vuex';
import { TrainingMode } from '@/scripts/ConstDic';
import { debuglog } from 'util';
// import { Loading } from 'element-ui';
export default {
@ -71,16 +72,12 @@ export default {
},
watch: {
'$store.state.map.map': function (val, old) {
if (val && val.skinStyle) {
try {
this.setMap(val);
} catch (error) {
this.mapViewLoaded(false);
console.log(error);
}
} else {
this.mapViewLoaded(false);
}
},
'$store.state.training.rezoomCount': function (val, old) {
this.setShowCenter(this.$store.state.training.offsetStationCode);