北京经济技术开发区经开区虚拟城市项目-【前端】--政府服务中心-2号屏Web
surprise
2023-10-12 1c4e40fddae516928457be1397b5c250b7677639
src/assets/js/rpc.js
@@ -25,9 +25,25 @@
    pointerFly: null, //定点漫游
    isShow: false,
    objArr: [],
    pointrange:null,
    //关键字查询
    getFuzzyQuery(res) {
        store.queryLayer.val = res.message;
        if(res.message.indexOf('奔驰')>-1){
            store.queryLayer.val ='奔驰公司'
        } else if(res.message.indexOf('永昌')>-1){
            store.queryLayer.val ='永昌工业园'
        }else if(res.message.indexOf('京东')>-1){
            store.queryLayer.val ='京东'
        }else if(res.message.indexOf('小米')>-1){
            store.queryLayer.val ='小米'
        }else if(res.message.indexOf('博大')>-1){
            store.queryLayer.val ='博大大厦'
        }else{
            //  store.queryLayer.val = res.message;
        }
        this.setClearAllMsg();
        if (!res.baidu_keys) return;
        var flag = true;
@@ -70,9 +86,23 @@
            this.dataQuery = [];
            this.objArr = [];
            this.pointrange = 2000;
            for (var i = 0; i < length; i++) {
                var world = keyWorld[i].word;
                console.log("world", world);
               if(world.indexOf('奔驰')>-1){
                   world ='奔驰';
                   this.pointrange = 12000
               } else if(world.indexOf('永昌')>-1){
                world ='永昌'
               }else if(world.indexOf('京东')>-1){
                world ='京东'
               }else if(world.indexOf('小米')>-1){
                world ='小米'
               }else if(world.indexOf('博大大厦')>-1){
                world ='博大大厦'
               }else{
               continue;
               }
                this.setFuzzyQueryData(world, i, length - 1);
            }
        }
@@ -100,16 +130,19 @@
                that.objArr.push(itemObj);
            });
            //园区
            var YQArr = result[1].candidates.filter(item => {
                return item.attributes.YQmingchen.includes(res);
            var YQArr = result[1].features.filter(item => {
                return item.properties.YQmingchen.includes(res);
            });
            YQArr.forEach(val => {
                let itemObj = {
                    type: "园区",
                    name: val.attributes.YQmingchen,
                    address: val.attributes.YQdizhi,
                    lon: val.location.x,
                    lat: val.location.y
                    name: val.properties.YQmingchen,
                    address: val.properties.YQdizhi,
                    lon: val.geometry.coordinates[0],
                    lat: val.geometry.coordinates[1],
                    geom: val.properties.Coor1 + val.properties.Coor2
                };
                that.objArr.push(itemObj);
            });
@@ -180,9 +213,14 @@
        let that = this;
        if (res.type == "园区") {
            var geom = res.geom.split(',');
        } else if (res.type == "地块") {
            var coord = [];
            for (var i in geom) {
                coord.push(parseFloat(geom[i]))
            }
            this.setDrawPolyExtent(coord)
        } else if (res.type == "地块" || res.type == "企业") {
            getDiKuanFanWei(res.lon, res.lat).then(response => {
                let center = { lon: 0, lat: 0 };
                let polygon = that.read(response.geometry);
@@ -196,27 +234,32 @@
                        geometry.push(parseFloat(point[0]), parseFloat(point[1]))
                    }
                    that.setLacationLineClear()
                    var position = Cesium.Cartesian3.fromDegreesArray(geometry)
                    that.lacationLine = Viewer.entities.add({
                        name: "立体墙效果",
                        wall: {
                            positions: position,
                            material: new Cesium.DynamicWallMaterialProperty({
                                color: Cesium.Color.RED,
                                duration: 4000
                            }),
                            // 设置高度
                            maximumHeights: Array(position.length).fill(80),
                            minimumHeights: Array(position.length).fill(10),
                        }
                    })
                    that.setDrawPolyExtent(geometry)
                }
            });
        }
    },
    setDrawPolyExtent(res) {
        this.setLacationLineClear()
        var position = Cesium.Cartesian3.fromDegreesArray(res)
        this.lacationLine = Viewer.entities.add({
            name: "立体墙效果",
            wall: {
                positions: position,
                material: new Cesium.DynamicWallMaterialProperty({
                    // color: new Cesium.Color.fromCssColorString('#73DB0E'),
                    color: new Cesium.Color.fromCssColorString('#1f1fa8'),
                    duration: 4000,
                }),
                // 设置高度
                maximumHeights: Array(position.length).fill(80),
                minimumHeights: Array(position.length).fill(10),
            }
        })
    },
    read(wkt) {
@@ -455,7 +498,7 @@
            data.showLine = false;
            data.mode = 1;
            data.pitch = -10;
            data.height = 75;
            data.height = 500;
            data.speed = 25;
            that.LineRoaming = sgworld.Creator.createDynamicObject(
@@ -538,7 +581,7 @@
        );
        this.position = window.Viewer.entities.add({
            name: "FLYToMap",
            position: Cesium.Cartesian3.fromDegrees(res.lon, res.lat, 200),
            position: Cesium.Cartesian3.fromDegrees(res.lon, res.lat, 0),
            point: {
                pixelSize: 1,
                color: Cesium.Color.WHITE.withAlpha(0),
@@ -548,9 +591,9 @@
        });
        window.Viewer.flyTo(this.position, {
            offset: {
                heading: Cesium.Math.toRadians(0.0),
                heading: Cesium.Math.toRadians(-200),
                pitch: Cesium.Math.toRadians(-45),
                range: 700
                range: this.pointrange
            },
            duration: 3
        });