ncc显示配置
This commit is contained in:
parent
68d0d9c83b
commit
5181b1e98a
@ -50,7 +50,7 @@ function handleRunPositionData(nccStation, runLineList) {
|
||||
|
||||
// 同步绘制数据到原始数据
|
||||
export function updateForList(model, state, lstName) {
|
||||
if (!state.nccData) { state.nccData = {nccStationList: [], runLineList:[]}; }
|
||||
if (!state.nccData) { state.nccData = {nccStationList: [], runLineList:[], stationCircleList: [], displayConfig: {} }; }
|
||||
const list = state.nccData[lstName];
|
||||
if (list && list instanceof Array) {
|
||||
const i = list.findIndex(elem => elem.code == model.code );
|
||||
@ -69,6 +69,11 @@ export function updateForList(model, state, lstName) {
|
||||
}
|
||||
state.map.nccData = JSON.stringify(state.nccData);
|
||||
}
|
||||
export function updateDisplayConfig(state, config) {
|
||||
if (!state.nccData) { state.nccData = {nccStationList: [], runLineList:[], stationCircleList: [], displayConfig: {} }; }
|
||||
state.nccData.displayConfig = config;
|
||||
state.map.nccData = JSON.stringify(state.nccData);
|
||||
}
|
||||
|
||||
export function updateMapData(state, model) {
|
||||
if (state.map && model) {
|
||||
|
@ -22,6 +22,7 @@ export default class NccStation extends Group {
|
||||
|
||||
create() {
|
||||
const model = this.model;
|
||||
if (!model.position) { return; }
|
||||
this.stationMain = new Circle({
|
||||
zlevel: this.zlevel,
|
||||
z: this.z,
|
||||
|
@ -15,6 +15,7 @@ export default class StationCircle extends Group {
|
||||
}
|
||||
create() {
|
||||
const model = this.model;
|
||||
if (!model.position) { return; }
|
||||
this.rectBody = new Rect({
|
||||
zlevel: this.zlevel,
|
||||
z: this.z,
|
||||
|
@ -902,6 +902,10 @@ const map = {
|
||||
Vue.prototype.$jlmap && Vue.prototype.$jlmap.$painter.repaint(state.mapDevice);
|
||||
Vue.prototype.$jlmap && Vue.prototype.$jlmap.setDefaultState();
|
||||
},
|
||||
updateNccDisplayConfig: (state, data) => {
|
||||
const parser = parserFactory(ParserType.nccGraph.value);
|
||||
parser.updateDisplayConfig(state, data);
|
||||
},
|
||||
updateMapDevice: (state, list) => {
|
||||
list.forEach(elem => {
|
||||
state.mapDevice[elem.code] = deepAssign(state.mapDevice[elem.code] || {}, elem);
|
||||
@ -1484,6 +1488,9 @@ const map = {
|
||||
},
|
||||
setLinkSwitchMap: ({ commit }, linkSwitchMap) => {
|
||||
commit('setLinkSwitchMap', linkSwitchMap);
|
||||
},
|
||||
updateNccDisplayConfig: ({ commit }, displayConfig) => {
|
||||
commit('updateNccDisplayConfig', displayConfig);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -32,7 +32,7 @@
|
||||
import Vue from 'vue';
|
||||
import Jlmap from '@/jmapNew/map';
|
||||
import ProgressBar from '@/views/components/progressBar/index';
|
||||
import { TrainingMode } from '@/scripts/ConstDic';
|
||||
// import { TrainingMode } from '@/scripts/ConstDic';
|
||||
import { mapGetters } from 'vuex';
|
||||
import { EventBus } from '@/scripts/event-bus';
|
||||
import Theme from '@/jmapNew/theme/factory';
|
||||
@ -81,9 +81,9 @@ export default {
|
||||
return this.$store.state.config.height;
|
||||
},
|
||||
zoomShow() {
|
||||
if (this.mode == TrainingMode.EDIT || this.mode == TrainingMode.MAP_EDIT) {
|
||||
return true;
|
||||
}
|
||||
// if (this.mode == TrainingMode.EDIT || this.mode == TrainingMode.MAP_EDIT) {
|
||||
// return true;
|
||||
// }
|
||||
return false;
|
||||
},
|
||||
showZoom() {
|
||||
|
@ -87,6 +87,10 @@ export default {
|
||||
const logicData = {routeData:this.$store.state.map.routeData, autoReentryData: this.$store.state.map.autoReentryData};
|
||||
const repaint = this.$store.state.map.initJlmapLoadedCount === 1;
|
||||
this.$jlmap.setMap(this.mapData, this.nccDevice, logicData, repaint);
|
||||
if (this.$store.state.map.nccData && this.$store.state.map.nccData.displayConfig) {
|
||||
const displayConfig = this.$store.state.map.nccData.displayConfig;
|
||||
this.$jlmap.updateTransform(displayConfig.scaling || '1', displayConfig.origin || { x: 0, y: 0 });
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -185,24 +185,21 @@ export default {
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
const map = this.$store.state.map.map;
|
||||
this.$store.dispatch('map/saveMapDeviceDefaultRelations').then(() => {
|
||||
const param = {
|
||||
mapId: this.$route.params.mapId,
|
||||
skinVO: {
|
||||
code: this.$store.state.map.map.skinVO.code,
|
||||
name: this.$store.state.map.map.skinVO.name
|
||||
},
|
||||
origin: {
|
||||
x: this.updtModel.origin.x || map.origin.x,
|
||||
y: this.updtModel.origin.y || map.origin.y
|
||||
},
|
||||
scaling: this.updtModel.scaling
|
||||
};
|
||||
saveMap(Object.assign(map, param)).then(response => {
|
||||
this.$message.success(this.$t('map.updateSuccessfully'));
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('map.updateFailed'));
|
||||
});
|
||||
const displayConfig = {
|
||||
origin:{
|
||||
x: this.updtModel.origin.x || 0,
|
||||
y: this.updtModel.origin.y || 0
|
||||
},
|
||||
scaling: this.updtModel.scaling
|
||||
};
|
||||
this.$store.dispatch('map/updateNccDisplayConfig', displayConfig);
|
||||
const param = {
|
||||
mapId: this.$route.params.mapId
|
||||
};
|
||||
saveMap(Object.assign(map, param)).then(response => {
|
||||
this.$message.success(this.$t('map.updateSuccessfully'));
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('map.updateFailed'));
|
||||
});
|
||||
}).catch(() => { });
|
||||
},
|
||||
@ -325,7 +322,6 @@ export default {
|
||||
this.$router.push({ path: `/design/usermap/home` });
|
||||
},
|
||||
updateMapModel(models) { // 创建 跟新元素
|
||||
console.log('updateMapModel', models);
|
||||
this.$store.dispatch('map/updateNccMapDevices', models);
|
||||
},
|
||||
// 撤销
|
||||
|
@ -283,6 +283,10 @@ export default {
|
||||
// 设置新的地图数据
|
||||
setMap(map) {
|
||||
this.$jlmap.setMap(map, this.$store.state.map.nccDevice, {routeData: {}, autoReentryData: {}});
|
||||
if (this.$store.state.map.nccData && this.$store.state.map.nccData.displayConfig) {
|
||||
const displayConfig = this.$store.state.map.nccData.displayConfig;
|
||||
this.$jlmap.updateTransform(displayConfig.scaling || '1', displayConfig.origin || { x: 0, y: 0 });
|
||||
}
|
||||
},
|
||||
// 刷新地图数据
|
||||
refresh(map) {
|
||||
|
Loading…
Reference in New Issue
Block a user