This commit is contained in:
joylink_cuiweidong 2020-05-07 09:42:44 +08:00
commit a2470debf2
6 changed files with 38 additions and 25 deletions

View File

@ -136,10 +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);
// this.$painter.updateTransform1([
// { scaleRate: 0.3, offsetX: -50, offsetY: -100, width: 1600, height: 500 },
// { scaleRate: 0.3, offsetX: 1500, offsetY: -300, width: 1600, height: 500},
// { scaleRate: 0.3, offsetX: 3050, offsetY: -500, width: 1600, height: 500}]);
if (this.$options.disabled == true) { if (this.$options.disabled == true) {
this.$mouseController.disable(); this.$mouseController.disable();
} else { } else {
@ -160,6 +156,19 @@ class Jlmap {
} }
} }
setUpdateScreen(opts) {
this.$painter.updateTransform1(
[
{ scaleRate: 0.3, offsetY: -100 },
{ scaleRate: 0.3, offsetY: -300 },
{ scaleRate: 0.3, offsetY: -500 },
{ scaleRate: 0.3, offsetY: -700 },
{ scaleRate: 0.3, offsetY: -900 },
{ scaleRate: 0.3, offsetY: -1100 }
],
{width: opts.width, height: opts.height});
}
setLevelVisible(list) { setLevelVisible(list) {
this.$painter.setLevelVisible(list); this.$painter.setLevelVisible(list);
} }

View File

@ -192,8 +192,8 @@ class Painter {
this.$transformHandle.updateTransform(opt); this.$transformHandle.updateTransform(opt);
} }
updateTransform1(opts) { updateTransform1(list, opts) {
this.$transformHandleScreen.updateTransform(opts); this.$transformHandleScreen.updateTransform(list, opts);
} }
/** /**
* 更新zrender尺寸 * 更新zrender尺寸

View File

@ -4,27 +4,18 @@ import {createTransform, createBoundingRect} from './utils/parser';
class TransformHandle { class TransformHandle {
constructor(painter) { constructor(painter) {
this.$painter = painter; this.$painter = painter;
this.width = 1600;
this.parentLevel = painter.getParentLevel(); this.parentLevel = painter.getParentLevel();
this.rect = { x: 0, y: 0, width: 1600, height: 800 }; this.rect = { x: 0, y: 0, width: 0, height: 0 };
this.transform = [createTransform({ scaleRate: 1, offsetX: 0, offsetY: 0 })]; this.transform = [createTransform({ scaleRate: 1, offsetX: 0, offsetY: 0 })];
} }
checkVisible(view, rect) { checkVisible(view) {
// return createBoundingRect(view).intersect(rect);
return createBoundingRect(view).intersect(this.rect); return createBoundingRect(view).intersect(this.rect);
} }
revisibleView(view) {
if (this.checkVisible(view)) {
view.show();
} else {
view.hide();
}
// view.dirty();
}
// 视图进行缩放/平移 // 视图进行缩放/平移
transformView(view) { transformView(view) {
if (view) { if (view) {
@ -48,9 +39,13 @@ class TransformHandle {
} }
// 更新偏移量 // 更新偏移量
updateTransform(opts) { updateTransform(list, opts) {
const rightWidth = 80; // 右边空余宽度
this.rect = { x: 0, y: 0, width: opts.width - rightWidth, height: opts.height };
this.width = opts.width - rightWidth;
this.transform = []; this.transform = [];
opts.forEach(item => { list.forEach((item, index) => {
item['offsetX'] = index * (this.width - 50) - 50;
this.transform.push(createTransform(item)); this.transform.push(createTransform(item));
}); });
this.transformAll(); this.transformAll();

View File

@ -53,9 +53,9 @@ export default {
}, },
'$store.state.map.mapViewLoadedCount':function() { '$store.state.map.mapViewLoadedCount':function() {
this.$store.dispatch('map/setTrainWindowShow', false); this.$store.dispatch('map/setTrainWindowShow', false);
console.log(this, this.$jlmap);
this.$jlmap.off('zoom'); this.$jlmap.off('zoom');
this.$jlmap.off('pan'); this.$jlmap.off('pan');
this.handleUpdateScreen();
} }
}, },
async beforeDestroy() { async beforeDestroy() {
@ -81,7 +81,6 @@ export default {
this.$store.dispatch('training/over'); this.$store.dispatch('training/over');
this.$store.dispatch('training/setMapDefaultState'); this.$store.dispatch('training/setMapDefaultState');
this.$store.dispatch('map/clearJlmapTrainView'); this.$store.dispatch('map/clearJlmapTrainView');
}); });
} catch (error) { } catch (error) {
this.$messageBox(`获取地图数据失败: ${error.message}`); this.$messageBox(`获取地图数据失败: ${error.message}`);
@ -104,6 +103,13 @@ export default {
const height = this.height; const height = this.height;
this.$store.dispatch('config/resize', { width, height }); this.$store.dispatch('config/resize', { width, height });
}); });
},
handleUpdateScreen() {
const size = {
width: this.$store.state.app.width - (this.widthLeft || 450) - 2,
height: this.height
};
this.$jlmap.setUpdateScreen(size);
} }
} }
}; };

View File

@ -64,7 +64,7 @@
@switchStationMode="switchStationMode" @switchStationMode="switchStationMode"
/> />
<menu-system-time ref="menuSystemTime" :offset="offset" :right="right" :group="group" /> <menu-system-time v-if="!isScreen" ref="menuSystemTime" :offset="offset" :right="right" :group="group" />
</div> </div>
<!-- <Jl3d-Simulation v-show="simulationShow" ref="Jl3dSimulation" :panel-show="simulationShow" @showpanel="showpanel" /> --> <!-- <Jl3d-Simulation v-show="simulationShow" ref="Jl3dSimulation" :panel-show="simulationShow" @showpanel="showpanel" /> -->
@ -208,6 +208,9 @@ export default {
isScript() { isScript() {
return this.mode === 'script'; return this.mode === 'script';
}, },
isScreen() {
return this.model === 'dp';
},
isDrive() { isDrive() {
return this.prdType == '04'; return this.prdType == '04';
}, },

View File

@ -6,7 +6,7 @@
<zoom-box v-if="!isScreen" :scale-rate="dataZoom.scaleRate" @setShrink="setShrink" @setMagnify="setMagnify" /> <zoom-box v-if="!isScreen" :scale-rate="dataZoom.scaleRate" @setShrink="setShrink" @setMagnify="setMagnify" />
<show-mode v-if="isDesign" :local-station-show="localStationShow" @setShowMode="setShowMode" /> <show-mode v-if="isDesign" :local-station-show="localStationShow" @setShowMode="setShowMode" />
<switch-station v-if="isDesign && (showMode === '03') && localStationShow" ref="switchStation" :concentration-station-list="concentrationStationList" @setShowStation="setShowStation" /> <switch-station v-if="isDesign && (showMode === '03') && localStationShow" ref="switchStation" :concentration-station-list="concentrationStationList" @setShowStation="setShowStation" />
<div v-if="show" class="zoom-view" :style="{ width: width +'px'}"> <div v-if="show && !isScreen" class="zoom-view" :style="{ width: width +'px'}">
<el-form :model="dataZoom" label-width="80px" size="mini" inline> <el-form :model="dataZoom" label-width="80px" size="mini" inline>
<el-form-item :label="$t(`global.offset`)"> <el-form-item :label="$t(`global.offset`)">
<el-input v-model="dataZoom.offsetX" :disabled="true" style="width: 95px" /> <el-input v-model="dataZoom.offsetX" :disabled="true" style="width: 95px" />
@ -96,7 +96,7 @@ export default {
return false; return false;
}, },
isScreen() { isScreen() {
return this.$route.params.mode == 'dp' || this.$store.state.training.roles == 'BigScreen'; return this.$route.params.mode == 'dp' || this.$route.path.includes('bigScreen');
}, },
maskOpen() { maskOpen() {
return this.$store.state.config.maskOpen; return this.$store.state.config.maskOpen;