liuyg
2021-07-02 25ce610f6ecca7325e7a743dc032c4a76559c63d
widgets/LeftNavigationBar/Widget.js
@@ -33,26 +33,60 @@
                // this.begin(this.data);
                var that = this;
                this.getData();
                topic.subscribe("closeNavigation", lang.hitch(this, this.closeNavigation));
                // $('.left-navigation-bar-but').click(() => {
                //     this.changeImg = !this.changeImg;
                //     if (this.changeImg) {
                //         $('.l-n-b-b-img').attr("src", "./images/addL/xzuo.png"); //打开
                //         $('.jimu-widget-LeftNavigationBar').css({
                //             'left': '0px'
                //         });
                //         $('.jimu-widget-instructions').css({
                //             'left': '260px'
                //         });
                //     } else {
                //         $('.l-n-b-b-img').attr("src", "./images/addL/xyou.png"); //关闭
                //         $('.jimu-widget-LeftNavigationBar').css({
                //             'left': '-250px'
                //         });
                //         $('.jimu-widget-instructions').css({
                //             'left': '10px'
                //         });
                //     }
                // })
                $('.left-navigation-bar-but>div').click(() => {
                    topic.publish('closeTool', this.name);
                    topic.publish('closeMap', this.name);
                    $(".jimu-widget-Layermanagement .layer-list").stop().hide();
                $('.left-navigation-bar-but').click(() => {
                    this.changeImg = !this.changeImg;
                    if (this.changeImg) {
                        $('.l-n-b-b-img').attr("src", "./images/addL/xzuo.png"); //打开
                        $('.jimu-widget-LeftNavigationBar').css({
                            'left': '0px'
                        });
                        $('.jimu-widget-instructions').css({
                            'left': '260px'
                        });
                    } else {
                        $('.l-n-b-b-img').attr("src", "./images/addL/xyou.png"); //关闭
                        $('.jimu-widget-LeftNavigationBar').css({
                            'left': '-250px'
                        });
                        $('.jimu-widget-instructions').css({
                            'left': '10px'
                        });
                    if ($(".jimu-widget-Layermanagement .layer-list").is(":hidden")) {
                        $(".jimu-widget-Layermanagement .tree-layer-opcity").stop().hide();
                    }
                    if ($('.left-navigation-bar-main').is(":hidden")) {
                        $('.left-navigation-bar-main').stop().css({
                            'width': '300px',
                            'padding': '10px',
                            'height': 'auto'
                        }).show();
                    } else {
                        $('.left-navigation-bar-main').stop().css({
                            'width': '0px',
                            'padding': '0px',
                            'height': '0px',
                        }).hide();
                    }
                })
                $('#l-n-b-m-search-closeOUR').click(() => {
                    $('.left-navigation-bar-main').stop().css({
                        'width': '0px',
                        'padding': '0px',
                        'height': '0px',
                    }).hide();
                })
@@ -159,7 +193,19 @@
                }
            },
            closeToolBox: function (item) {},
            closeNavigation: function (item) {
                if (item != this.name) {
                    if (!$('.left-navigation-bar-main').is(":hidden")) {
                        $('.left-navigation-bar-main').stop().css({
                            'width': '0px',
                            'padding': '0px',
                            'height': '0px',
                        }).hide();
                    }
                }
            },
            onOpen: function () {
                //面板打开的时候触发 (when open this panel trigger)
@@ -331,7 +377,7 @@
            },
            begin: function (data) {
                var that = this;
                window.mySanweiShujuOpens = {}; //全局scene.open资源
                var a = null;
                layui.use(function () {
@@ -377,6 +423,7 @@
                                        obj.data.children.forEach(item => {
                                            Cesium.when(that[item.id], function (layer) {
                                                topic.publish('removeTilt', 'Layermanagement', item);
                                                topic.publish('removeTiltS', 'spatialAnalysis', item);
                                                topic.publish('removeLayersLegends', 'legends', item);
                                                that.map.scene.layers.remove(layer[0].name)
                                            })
@@ -387,7 +434,11 @@
                                            that[item.id] = scene.open(host + partOfUrl, undefined, {
                                                autoSetView: false //不自动定位
                                            });
                                            window.mySanweiShujuOpens[item.id] = that[item.id];
                                            // console.log(222)
                                            topic.publish('appendTilt', 'Layermanagement', item);
                                            topic.publish('appendTiltS', 'spatialAnalysis', item);
                                            topic.publish('addLayersLegends', 'legends', item);
                                            //定位到场景
                                            Cesium.loadJson(host + partOfUrl + '/scenes.json').then(function (scenes) {
@@ -429,7 +480,9 @@
                                                        destination: rectangle
                                                    });
                                                });
                                                // console.log(444)
                                                topic.publish('appendItem', 'Layermanagement', item, that[item.id]);
                                                topic.publish('appendItemS', 'spatialAnalysis', item, that[item.id]);
                                                topic.publish('addLayersLegends', 'legends', item);
                                            } else {
                                                $.ajax({
@@ -438,11 +491,12 @@
                                                    dataType: 'JSON',
                                                    success: function (res) {
                                                        // console.log(111)
                                                        that[item.id] = that.map.imageryLayers.addImageryProvider(new Cesium.SuperMapImageryProvider({
                                                            url: res[0].path,
                                                        }));
                                                        topic.publish('appendItem', 'Layermanagement', item, that[item.id]);
                                                        topic.publish('appendItemS', 'spatialAnalysis', item, that[item.id]);
                                                        topic.publish('addLayersLegends', 'legends', item);
                                                        that[item.id].alpha = item.alpha;
                                                        that[item.id].getViewableRectangle().then(function (rectangle) {
@@ -459,15 +513,13 @@
                                    }
                                } else {
                                    if (obj.data.model) {
                                        obj.data.children.forEach(item => {
                                            Cesium.when(that[item.id], function (layer) {
                                                topic.publish('removeTilt', 'Layermanagement', item);
                                                topic.publish('removeTiltS', 'spatialAnalysis', item);
                                                topic.publish('removeLayersLegends', 'legends', item);
                                                that.map.scene.layers.remove(layer[0].name)
                                            })
@@ -476,6 +528,7 @@
                                        obj.data.children.forEach(item => {
                                            if (that[item.id]) {
                                                topic.publish('removeItem', 'Layermanagement', item);
                                                topic.publish('removeItemS', 'spatialAnalysis', item);
                                                topic.publish('removeLayersLegends', 'legends', item);
                                                that[item.id].show = false;
                                            }
@@ -494,6 +547,7 @@
                                    if (obj.data.model) {
                                        Cesium.when(that[obj.data.id], function (layer) {
                                            topic.publish('removeTilt', 'Layermanagement', obj.data);
                                            topic.publish('removeTiltS', 'spatialAnalysis', obj.data);
                                            topic.publish('removeLayersLegends', 'legends', obj.data);
                                            that.map.scene.layers.remove(layer[0].name)
                                        })
@@ -507,7 +561,10 @@
                                        that[obj.data.id] = scene.open(host + partOfUrl, undefined, {
                                            autoSetView: false //不自动定位
                                        });
                                        window.mySanweiShujuOpens[obj.data.id] = that[obj.data.id];
                                        topic.publish('appendTilt', 'Layermanagement', obj.data);
                                        topic.publish('appendTiltS', 'spatialAnalysis', obj.data);
                                        topic.publish('addLayersLegends', 'legends', obj.data);
                                        //定位到场景
                                        Cesium.loadJson(host + partOfUrl + '/scenes.json').then(function (scenes) {
@@ -544,7 +601,9 @@
                                                    destination: rectangle
                                                });
                                            });
                                            // console.log(555)
                                            topic.publish('appendItem', 'Layermanagement', obj.data, that[obj.data.id]);
                                            topic.publish('appendItemS', 'spatialAnalysis', obj.data, that[obj.data.id]);
                                            topic.publish('addLayersLegends', 'legends', obj.data);
                                        } else {
                                            $.ajax({
@@ -559,6 +618,7 @@
                                                    }));
                                                    topic.publish('appendItem', 'Layermanagement', obj.data, that[obj.data.id]);
                                                    topic.publish('appendItemS', 'spatialAnalysis', obj.data, that[obj.data.id]);
                                                    topic.publish('addLayersLegends', 'legends', obj.data);
                                                    that[obj.data.id].alpha = obj.data.alpha
@@ -583,6 +643,7 @@
                                        Cesium.when(that[obj.data.id], function (layer) {
                                            topic.publish('removeTilt', 'Layermanagement', obj.data);
                                            topic.publish('removeTiltS', 'spatialAnalysis', obj.data);
                                            topic.publish('removeLayersLegends', 'legends', obj.data);
                                            that.map.scene.layers.remove(layer[0].name)
                                        })
@@ -591,6 +652,7 @@
                                        if (that[obj.data.id]) {
                                            topic.publish('removeItem', 'Layermanagement', obj.data);
                                            topic.publish('removeItemS', 'spatialAnalysis', obj.data);
                                            topic.publish('removeLayersLegends', 'legends', obj.data);
                                            that[obj.data.id].show = false;
                                        }