首页 / 浏览问题 / 三维GIS / 问题详情
左右分屏的时候如何让左边没效果,右边有效果
nk
29EXP 2021年05月18日
<template>

    <div class="com-btn dis_flex">

        <el-button type="primary" :disabled="disabled" @click="submitForm('visualForm')">{{btnContent[tabid]}}

        </el-button>

    </div>

</template>

<script>

    var isDBOpen = false;

    export default {

        data() {

            return {

                disabled: false,

                tabid: 0,

                btnContent: ['方案展示', '方案对比']

            }

        },

        created() {

            if (this.$route.query.tabid) {

                this.tabid = +this.$route.query.tabid;

            }

            if (this.$store.state.common.projectAbbreviation == '1#地块基本信息') {

                if (this.$store.state.common.flow == 2) {

                    if (this.tabid == 0) {

                        this.disabled = false;

                    }

                    else {

                        this.disabled = true;

                    }

                }

            }

        },

        methods: {

            submitForm(formName) {

                console.log(this.$store.state.common.projectAbbreviation);

                if (this.$store.state.common.projectAbbreviation == '1#地块基本信息') {

                    if (this.$store.state.common.flow == 2) {

                        if (this.tabid == 0) {

                            window[this.$mapClick['项目规划']]();

                            planA.setVisibleInViewport(1, false);

                        }

                    }

                    else if (this.$store.state.common.flow == 3) {

                        if (this.tabid == 0) {

                            window[this.$mapClick['项目设计']]();

                            planA.setVisibleInViewport(1, false);

                        }

                    }

                }

                else if (this.$store.state.common.projectAbbreviation == '进料系统结构') {

                    console.log(this.$store.state.common.projectAbbreviation);

                    if (this.$store.state.common.flow == 2) {

                        if (this.tabid == 0) {

                            window[this.$mapClick['马钢方案展示']]();

                            planA.setVisibleInViewport(1, false);

                        }

                        // else {

                        //     window[this.$mapClick['马钢对比']]();

                        // }

                    }

                }

                var planB_1 = viewer.scene.layers.find('放样道路3');

                var planB_2 = viewer.scene.layers.find('放样道路1');

                var planB_3 = viewer.scene.layers.find('停车场1');

                var planB_4 = viewer.scene.layers.find('停车场2');

                var planB_5 = viewer.scene.layers.find('放样道路2');

                var planB_6 = viewer.scene.layers.find('人行天桥');

                var planB_7 = viewer.scene.layers.find('放样道路4');

                var planA = viewer.scene.layers.find('宝山1号地块');

                viewer.entities.removeById("baseLine&0");

                viewer.entities.removeById("baseLine&1");

                viewer.entities.removeById("baseLine&2");

                viewer.entities.removeById("trialLine&0");

                viewer.entities.removeById("trialLine&1");

                viewer.entities.removeById("trialLine&2");

                viewer.entities.removeById("XM_2");

                viewer.entities.removeById("parking");

                viewer.entities.removeById("kzll");

                viewer.entities.removeById("gjtq");

                viewer.entities.removeById("poi&长滩");

                viewer.entities.removeById("poi&宝山宾馆");

                viewer.entities.removeById("poi&宝钢商场");

                viewer.entities.removeById("poi&宝乐汇");

                viewer.entities.removeById("poi&宝龙广场");

                viewer.entities.removeById("FQ&1");

                viewer.entities.removeById("FQ&2");

                viewer.entities.removeById("FQ&3");

                viewer.entities.removeById("FQ&4");

                viewer.entities.removeById("FQlabel&1");

                viewer.entities.removeById("FQlabel&2");

                viewer.entities.removeById("FQlabel&3");

                viewer.entities.removeById("FQlabel&4");

                if (!isDBOpen) {

                    $("#split_up").css("display", "block");

                    $("#split_bottom").css("display", "block");

                    $("#split_left").css("display", "none");

                    $("#split_right").css("display", "none");

                    $("#split_vertical_trisection_left").css("display", "none");

                    $("#split_vertical_trisection_right").css("display", "none");

                    viewer.scene.multiViewportMode = Cesium.MultiViewportMode["HORIZONTAL"];

                    planA.visible = true;

                    planB_1.visible = true;

                    planB_2.visible = true;

                    planB_3.visible = true;

                    planB_4.visible = true;

                    planB_5.visible = true;

                    planB_6.visible = true;

                    planB_7.visible = true;

                    planB_1.visibleDistanceMax = 500000;

                    planB_2.visibleDistanceMax = 500000;

                    planB_3.visibleDistanceMax = 500000;

                    planB_4.visibleDistanceMax = 500000;

                    planB_5.visibleDistanceMax = 500000;

                    planB_6.visibleDistanceMax = 500000;

                    planB_7.visibleDistanceMax = 500000;

                    planB_1.setVisibleInViewport(1, true);

                    planB_2.setVisibleInViewport(1, true);

                    planB_3.setVisibleInViewport(1, true);

                    planB_4.setVisibleInViewport(1, true);

                    planB_5.setVisibleInViewport(1, true);

                    planB_6.setVisibleInViewport(1, true);

                    planB_7.setVisibleInViewport(1, true);

                    planB_1.setVisibleInViewport(0, false);

                    planB_2.setVisibleInViewport(0, false);

                    planB_3.setVisibleInViewport(0, false);

                    planB_4.setVisibleInViewport(0, false);

                    planB_5.setVisibleInViewport(0, false);

                    planB_6.setVisibleInViewport(0, false);

                    planB_7.setVisibleInViewport(0, false);

                    isDBOpen = true;

                }

                else {

                    $("#split_up").css("display", "none");

                    $("#split_bottom").css("display", "none");

                    $("#split_left").css("display", "none");

                    $("#split_right").css("display", "none");

                    $("#split_vertical_trisection_left").css("display", "none");

                    $("#split_vertical_trisection_right").css("display", "none");

                    viewer.scene.multiViewportMode = Cesium.MultiViewportMode["NONE"];

                    window[this.$mapClick['项目规划']]();

                    window[this.$mapClick['项目设计']]();

                    window[this.$mapClick['马钢对比']]();

                    isDBOpen = false;

                    planB_1.visible = true;

                    planB_2.visible = true;

                    planB_3.visible = true;

                    planB_4.visible = true;

                    planB_5.visible = true;

                    planB_6.visible = true;

                    planB_7.visible = true;

                    planA.visible = false;

                    // planB.setVisibleInViewport(1, true);

                }

            }

        }

    }

</script>

2 个回答

您好,您说的左边没效果右边有效果,具体是指什么效果呢?如果是这样的效果比较多。那么建议您左右分别加载一个场景。通过获取Camera的位置和范围,来使两边同步。这样您两边的场景效果不会同步。但是视野范围是同步的。获取范围您可以参考一下:https://www.cnblogs.com/yangzhengier/p/11847550.html
1,509EXP 2021年05月18日
就是调用一个接口显示一些地块,左边不显示,右边显示
nk
29EXP 2021年05月18日

您好,只是这样,您参考一下示例demo就行。demo上就有一边显示一边不显示的功能

http://support.supermap.com.cn:8090/webgl/examples/webgl/editor.html#multiViewport

...