北京经济技术开发区经开区虚拟城市项目-【前端】--政府服务中心-1号屏Web
rpc
lixuliang
2023-10-08 87b6f0f45fdaf01ddf96122e26ef25d0cd865972
src/assets/js/rpc.js
@@ -5,8 +5,7 @@
import {
    liushisijiayuanqudizhibianmafuwu,
    findAddressCandidates,
    getLandBorder,
    getParkBorder,
    getDiKuanFanWei,
    ent_selectByName
} from "../../api/api";
import vueEvents from "@/utils/vueEvent.js";
@@ -179,101 +178,39 @@
    // 显示地块范围
    getLandmass(res) {
        let that = this;
        getLandBorder(res.lon, res.lat).then(response => {
            let center = { lon: 0, lat: 0 };
            let polygon = that.read(response.geometry);
            if (polygon.length > 0) {
                var geometry = [];
                let points = polygon[0].split(",");
                for (let i = 0; i < points.length; i++) {
                    let point = points[i].replace(/^\s+|\s+$/g, "").split(" ");
                    center.lon += parseFloat(point[0]) / points.length;
                    center.lat += parseFloat(point[1]) / points.length;
                    geometry.push({
                        x: parseFloat(point[0]),
                        y: parseFloat(point[1]),
                        z: 0
                    });
        if (res.tpye == "园区") {
        } else if (res.tpye == "地块") {
            getDiKuanFanWei(res.lon, res.lat).then(response => {
                let center = { lon: 0, lat: 0 };
                let polygon = that.read(response.geometry);
                if (polygon.length > 0) {
                    var geometry = [];
                    let points = polygon[0].split(",");
                    for (let i = 0; i < points.length; i++) {
                        let point = points[i].replace(/^\s+|\s+$/g, "").split(" ");
                        center.lon += parseFloat(point[0]) / points.length;
                        center.lat += parseFloat(point[1]) / points.length;
                        geometry.push({
                            x: parseFloat(point[0]),
                            y: parseFloat(point[1]),
                            z: 0
                        });
                    }
                    if (that.lacationLine) {
                        sgworld.Creator.DeleteObject(that.lacationLine);
                        that.lacationLine = null;
                    }
                    that.lacationLine = sgworld.Creator.createPolyline(
                        geometry,
                        "#ff0000",
                        1,
                        0,
                        "线"
                    );
                }
                if (that.lacationLine) {
                    sgworld.Creator.DeleteObject(that.lacationLine);
                    that.lacationLine = null;
                }
                that.lacationLine = sgworld.Creator.createPolyline(
                    geometry,
                    "#ff0000",
                    1,
                    0,
                    "线"
                );
            }
        });
        // var positions = [
        //     108.95846,
        //     34.22104,
        //     108.96039,
        //     34.22104,
        //     108.96046,
        //     34.21804,
        //     108.95843,
        //     34.21804,
        //     108.95846,
        //     34.22104
        // ];
        // var wall = Viewer.entities.add({
        //     name: "立体墙效果",
        //     wall: {
        //         positions: Cesium.Cartesian3.fromDegreesArray(positions),
        //         material: new Cesium.DynamicWallMaterialProperty({
        //             color: Cesium.Color.RED,
        //             duration: 4000
        //         }),
        //         // 设置高度
        //         maximumHeights: [20, 20, 20, 20, 20],
        //         minimumHeights: [0, 0, 0, 0, 0],
        //     }
        // })
        // setTimeout(() => {
        //     Viewer.flyTo(wall)
        // }, 20000);
    },
    // 显示园区范围
    getPark(res) {
        let that = this;
        getParkBorder(res.lon, res.lat).then(response => {
            let center = { lon: 0, lat: 0 };
            let polygon = that.read(response.geometry);
            if (polygon.length > 0) {
                var geometry = [];
                let points = polygon[0].split(",");
                for (let i = 0; i < points.length; i++) {
                    let point = points[i].replace(/^\s+|\s+$/g, "").split(" ");
                    center.lon += parseFloat(point[0]) / points.length;
                    center.lat += parseFloat(point[1]) / points.length;
                    geometry.push({
                        x: parseFloat(point[0]),
                        y: parseFloat(point[1]),
                        z: 0
                    });
                }
                if (that.lacationLine) {
                    sgworld.Creator.DeleteObject(that.lacationLine);
                    that.lacationLine = null;
                }
                that.lacationLine = sgworld.Creator.createPolyline(
                    geometry,
                    "#ff0000",
                    1,
                    0,
                    "线"
                );
            }
        });
            });
        }
    },
    read(wkt) {
@@ -563,11 +500,7 @@
        //添加定位弹窗
        this.setAddPointLocation(objdata);
        //范围调用
        if (res.type == '园区') {
            this.getPark(res)
        } else if (res.type == '地块') {
            this.getLandmass(res);
        }
        this.getLandmass(res);
    },
    setAddPointLocation(res) {