ncc显示配置

This commit is contained in:
fan 2023-04-24 15:43:04 +08:00
parent 68d0d9c83b
commit 5181b1e98a
8 changed files with 42 additions and 24 deletions

View File

@ -50,7 +50,7 @@ function handleRunPositionData(nccStation, runLineList) {
// 同步绘制数据到原始数据 // 同步绘制数据到原始数据
export function updateForList(model, state, lstName) { 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]; const list = state.nccData[lstName];
if (list && list instanceof Array) { if (list && list instanceof Array) {
const i = list.findIndex(elem => elem.code == model.code ); 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); 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) { export function updateMapData(state, model) {
if (state.map && model) { if (state.map && model) {

View File

@ -22,6 +22,7 @@ export default class NccStation extends Group {
create() { create() {
const model = this.model; const model = this.model;
if (!model.position) { return; }
this.stationMain = new Circle({ this.stationMain = new Circle({
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z, z: this.z,

View File

@ -15,6 +15,7 @@ export default class StationCircle extends Group {
} }
create() { create() {
const model = this.model; const model = this.model;
if (!model.position) { return; }
this.rectBody = new Rect({ this.rectBody = new Rect({
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z, z: this.z,

View File

@ -902,6 +902,10 @@ const map = {
Vue.prototype.$jlmap && Vue.prototype.$jlmap.$painter.repaint(state.mapDevice); Vue.prototype.$jlmap && Vue.prototype.$jlmap.$painter.repaint(state.mapDevice);
Vue.prototype.$jlmap && Vue.prototype.$jlmap.setDefaultState(); Vue.prototype.$jlmap && Vue.prototype.$jlmap.setDefaultState();
}, },
updateNccDisplayConfig: (state, data) => {
const parser = parserFactory(ParserType.nccGraph.value);
parser.updateDisplayConfig(state, data);
},
updateMapDevice: (state, list) => { updateMapDevice: (state, list) => {
list.forEach(elem => { list.forEach(elem => {
state.mapDevice[elem.code] = deepAssign(state.mapDevice[elem.code] || {}, elem); state.mapDevice[elem.code] = deepAssign(state.mapDevice[elem.code] || {}, elem);
@ -1484,6 +1488,9 @@ const map = {
}, },
setLinkSwitchMap: ({ commit }, linkSwitchMap) => { setLinkSwitchMap: ({ commit }, linkSwitchMap) => {
commit('setLinkSwitchMap', linkSwitchMap); commit('setLinkSwitchMap', linkSwitchMap);
},
updateNccDisplayConfig: ({ commit }, displayConfig) => {
commit('updateNccDisplayConfig', displayConfig);
} }
} }
}; };

View File

@ -32,7 +32,7 @@
import Vue from 'vue'; import Vue from 'vue';
import Jlmap from '@/jmapNew/map'; import Jlmap from '@/jmapNew/map';
import ProgressBar from '@/views/components/progressBar/index'; import ProgressBar from '@/views/components/progressBar/index';
import { TrainingMode } from '@/scripts/ConstDic'; // import { TrainingMode } from '@/scripts/ConstDic';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { EventBus } from '@/scripts/event-bus'; import { EventBus } from '@/scripts/event-bus';
import Theme from '@/jmapNew/theme/factory'; import Theme from '@/jmapNew/theme/factory';
@ -81,9 +81,9 @@ export default {
return this.$store.state.config.height; return this.$store.state.config.height;
}, },
zoomShow() { zoomShow() {
if (this.mode == TrainingMode.EDIT || this.mode == TrainingMode.MAP_EDIT) { // if (this.mode == TrainingMode.EDIT || this.mode == TrainingMode.MAP_EDIT) {
return true; // return true;
} // }
return false; return false;
}, },
showZoom() { showZoom() {

View File

@ -87,6 +87,10 @@ export default {
const logicData = {routeData:this.$store.state.map.routeData, autoReentryData: this.$store.state.map.autoReentryData}; const logicData = {routeData:this.$store.state.map.routeData, autoReentryData: this.$store.state.map.autoReentryData};
const repaint = this.$store.state.map.initJlmapLoadedCount === 1; const repaint = this.$store.state.map.initJlmapLoadedCount === 1;
this.$jlmap.setMap(this.mapData, this.nccDevice, logicData, repaint); 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 });
}
} }
} }
}; };

View File

@ -185,24 +185,21 @@ export default {
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
const map = this.$store.state.map.map; const map = this.$store.state.map.map;
this.$store.dispatch('map/saveMapDeviceDefaultRelations').then(() => { const displayConfig = {
const param = { origin:{
mapId: this.$route.params.mapId, x: this.updtModel.origin.x || 0,
skinVO: { y: this.updtModel.origin.y || 0
code: this.$store.state.map.map.skinVO.code, },
name: this.$store.state.map.map.skinVO.name scaling: this.updtModel.scaling
}, };
origin: { this.$store.dispatch('map/updateNccDisplayConfig', displayConfig);
x: this.updtModel.origin.x || map.origin.x, const param = {
y: this.updtModel.origin.y || map.origin.y mapId: this.$route.params.mapId
}, };
scaling: this.updtModel.scaling saveMap(Object.assign(map, param)).then(response => {
}; this.$message.success(this.$t('map.updateSuccessfully'));
saveMap(Object.assign(map, param)).then(response => { }).catch(() => {
this.$message.success(this.$t('map.updateSuccessfully')); this.$messageBox(this.$t('map.updateFailed'));
}).catch(() => {
this.$messageBox(this.$t('map.updateFailed'));
});
}); });
}).catch(() => { }); }).catch(() => { });
}, },
@ -325,7 +322,6 @@ export default {
this.$router.push({ path: `/design/usermap/home` }); this.$router.push({ path: `/design/usermap/home` });
}, },
updateMapModel(models) { // updateMapModel(models) { //
console.log('updateMapModel', models);
this.$store.dispatch('map/updateNccMapDevices', models); this.$store.dispatch('map/updateNccMapDevices', models);
}, },
// //

View File

@ -283,6 +283,10 @@ export default {
// //
setMap(map) { setMap(map) {
this.$jlmap.setMap(map, this.$store.state.map.nccDevice, {routeData: {}, autoReentryData: {}}); 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) { refresh(map) {