suerprisePlus
2024-10-23 559f0776123a2205863b5787d5b8e1e012d397d3
灾害效果修改
已添加1个文件
已修改9个文件
155 ■■■■ 文件已修改
public/config/config.js 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
public/imgs/waterNormals.jpg 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/js/mapSdk/index.js 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/js/mapSdk/menuManager.js 39 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/visual/mapView/index.vue 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/visual/mapView/mapInfo.vue 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/visualization/index.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/visualization/list/mapWeather.js 89 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/visualization/mapView.vue 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/visualization/msgList.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
public/config/config.js
@@ -20,6 +20,7 @@
const pwythHost = "http://localhost/pwyth";
//配置
const config = {
  images:  host + "/imgs/",
  // server服务
  apiServices: "http://" + apiHost + "/server/",
  // 知识图谱服务
public/imgs/waterNormals.jpg
src/assets/js/mapSdk/index.js
@@ -99,7 +99,6 @@
      // 获取点击位置的世界坐标
      var pickedFeature = window.Viewer.scene.pick(event.position);
      if (Cesium.defined(pickedFeature)) {
        console.log(pickedFeature);
        if (pickedFeature.id) {
          const obj = pickedFeature.id;
          var arr = [];
src/assets/js/mapSdk/menuManager.js
@@ -263,31 +263,18 @@
                break;
            case 'a3':
                earthCtrl.factory.createSimpleGraphic('polyline', { showSize: false }, (entity) => {
                    // console.log(entity);
                    // const obj = entity.polyline.positions.getValue();
                    // var std = [];
                    // for (var i in obj) {
                    //     var ellipsoid =Viewer.scene.globe.ellipsoid;
                    //     // 将世界坐标转换为地理坐标(Cartographic)
                    //     var cartographic = ellipsoid.cartesianToCartographic(obj[i]);
                    //     // 获取经纬度
                    //     var longitude = Cesium.Math.toDegrees(cartographic.longitude);
                    //     var latitude = Cesium.Math.toDegrees(cartographic.latitude);
                    //     var height = 0;
                    //     std.push([longitude, latitude, height]);
                    // }
                    // console.log(std);
                    const obj = this.getWKtCoord(entity.polyline.positions.getValue());
                    console.log('polyline Wkt:' + obj);
                });
                break;
            case 'a4':
                earthCtrl.factory.createSimpleGraphic('rectangle', { showSize: false }, (entity) => {});
                break;
            case 'a5':
                earthCtrl.factory.createSimpleGraphic('polygon', { showSize: false }, (entity) => {});
                earthCtrl.factory.createSimpleGraphic('polygon', { showSize: false }, (entity) => {
                    const obj = this.getWKtCoord(entity.polygon.hierarchy.getValue().positions);
                    console.log('polygon Wkt:' + obj);
                });
                break;
            case 'a6':
                earthCtrl.factory.SimpleGraphic.clear();
@@ -297,6 +284,20 @@
        }
        return null;
    },
    getWKtCoord(obj) {
        var ellipsoid = Viewer.scene.globe.ellipsoid;
        var std = [];
        for (var i in obj) {
            // 将世界坐标转换为地理坐标(Cartographic)
            var cartographic = ellipsoid.cartesianToCartographic(obj[i]);
            // 获取经纬度
            var longitude = Cesium.Math.toDegrees(cartographic.longitude);
            var latitude = Cesium.Math.toDegrees(cartographic.latitude);
            var height = 0;
            std.push([longitude, latitude, height]);
        }
        return std;
    },
    // 测量
    setMenuS8(res) {
        const colorAll = this.colorAll;
src/views/visual/mapView/index.vue
@@ -87,6 +87,7 @@
        this.showEarth = true;
        this.mapViewStart();
        this.$busEvent.$on('CHANGE_MAPINFO', (res) => {
            this.setMapInfo(res);
        });
    },
@@ -100,12 +101,15 @@
    methods: {
        setMapInfo(res) {
            // console.log(res);
            if (res.length > 0) {
            this.childObj = null
            if (res && res.length > 0) {
                this.childObj = res;
                setTimeout(() => {
                this.$nextTick(() => {
                    this.$refs && this.$refs.mapInfo && this.$refs.mapInfo.open();
                }, 200);
                })
            } else {
                return
            }
        },
        mapViewStart() {
src/views/visual/mapView/mapInfo.vue
@@ -51,9 +51,7 @@
            setTimeout(() => {
                console.log(store.getters.mapInfo);
            }, 500);
        },
src/views/visualization/index.vue
@@ -25,7 +25,7 @@
                    <atlas v-if="isShow == '知识图谱'"></atlas>
                    <analysis v-if="isShow == '数据分析'"></analysis>
                    <statistics v-if="isShow == '数据统计'"></statistics>
                    <line-loss v-if="isShow == '数字线损'"></line-loss>
                    <line-loss v-if="isShow == '配网运检'"></line-loss>
                    <semanticFunction v-if="isShow == '语义功能'"></semanticFunction>
                </div>
src/views/visualization/list/mapWeather.js
@@ -1,8 +1,9 @@
import mapServer from '../../../assets/js/mapSdk/mapServe';
import * as turf from '@turf/turf';
const mapWeather = {
    regionWeather: null,
    particle: null,
    showRain: 'ShowRain',
    closeRegionWeather() {
        if (this.regionWeather) {
            this.regionWeather.enableWeatherType = SmartEarth.Cesium.RegionWeather.TYPE_NONE;
@@ -12,23 +13,34 @@
            this.particle.deleteObject();
            this.particle = null;
        }
        for (var i in Viewer.scene.primitives._primitives) {
            const name = Viewer.scene.primitives._primitives[i].name;
            if (name && name == this.showRain) {
                Viewer.scene.primitives.remove(Viewer.scene.primitives._primitives[i]);
            }
        }
    },
    setRegionWeatherType(response) {
        this.closeRegionWeather();
        if (!this.regionWeather) {
            this.getRegionWather(response);
        }
        const coord = this.getCoord(response);
        earthCtrl.camera.flyTo(coord[0], coord[1], 1000, 0, -90, 0, 0);
        switch (response.type) {
            case 'rain':
                this.showRain();
                //  earthCtrl.camera.flyTo(coord[0], coord[1], 8000, 0, -90, 0, 0);
                this.showRain(response);
                break;
            case 'fire':
                this.showFire(response);
                earthCtrl.camera.flyTo(coord[0], coord[1], 1000, 0, -90, 0, 0);
                break;
            case 'snow':
                this.showSnow();
                earthCtrl.camera.flyTo(coord[0], coord[1], 1000, 0, -90, 0, 0);
                break;
        }
    },
@@ -44,19 +56,74 @@
            obj,
            {
                translation: SmartEarth.Cesium.Cartesian3.fromElements(0, 0, 0), //平移
                particleSize:10
                particleSize: 10,
            },
            function (data) {}
        );
    },
    showRain() {
        if (this.regionWeather) {
            this.regionWeather.enableWeatherType = SmartEarth.Cesium.RegionWeather.TYPE_RAIN;
            this.regionWeather.regionAlpha = 0.6;
            this.regionWeather.regionGradientDistance = 300;
    showRain(res) {
        var area = [];
        var std =[];
        for (var i = 0; i < res.area.length; i += 3) {
            area.push(res.area[i]);
            area.push(res.area[i + 1]);
            std.push([res.area[i],res.area[i + 1]])
        }
        std.push(std[0])
        const polygon = turf.polygon([std]);
        const centerPoint = turf.center(polygon);
        const coord= centerPoint.geometry.coordinates;
        earthCtrl.camera.flyTo(coord[0], coord[1], 8000, 0, -90, 0, 0);
        const geometry = new Cesium.PolygonGeometry({
            polygonHierarchy: new Cesium.PolygonHierarchy(Cesium.Cartesian3.fromDegreesArray(area)),
            height: 0, // 底面高度
            extrudedHeight: 0.2, // 水面高度
            ellipsoid: Cesium.Ellipsoid.WGS84,
        });
        // 2. 创建GeometryInstance
        const geometryInstances = new Cesium.GeometryInstance({ geometry });
        // 3. 创建material
        const material = new Cesium.Material({
            fabric: {
                type: 'Water',
                uniforms: {
                    baseWaterColor: new Cesium.Color(0.25, 0.6, 0.9, 0.5), // 水面颜色
                    normalMap: config.images + 'waterNormals.jpg', // 贴图
                    frequency: 5000, // 水波纹数量
                    animationSpeed: 0.02, // 水流速
                    amplitude: 30, // 水波纹振动幅度
                    specularIntensity: 5, // 镜面反射强度
    },
            },
        });
        // 4. 创建Appearance
        const appearance = new Cesium.EllipsoidSurfaceAppearance({
            aboveGround: true,
            material,
        });
        // 5. 创建primitive
        var primitive = new Cesium.Primitive({
            geometryInstances,
            appearance,
        });
        primitive.name = this.showRain;
        Viewer.scene.primitives.add(primitive);
        // Viewer.camera.lookAt(primitive.boundingSphere.center, new Cesium.HeadingPitchRange(0.0, Cesium.Math.toRadians(-90), 5000));
        // if (this.regionWeather) {
        //     this.regionWeather.enableWeatherType = SmartEarth.Cesium.RegionWeather.TYPE_RAIN;
        //     this.regionWeather.regionAlpha = 0.6;
        //     this.regionWeather.regionGradientDistance = 300;
        // }
    },
    showSnow() {
        if (this.regionWeather) {
            this.regionWeather.enableWeatherType = SmartEarth.Cesium.RegionWeather.TYPE_SNOW;
@@ -66,8 +133,6 @@
    },
    getCoord(res) {
       const coord = res.point.split(',');
        return coord;
    },
    getRegionWather(res) {
@@ -83,7 +148,7 @@
            primitive: model[0].layer.item,
            position: new SmartEarth.Cesium.Cartesian3.fromDegrees(coord[0], coord[1], 1),
            radius: 1000,
        })
        });
    },
};
src/views/visualization/mapView.vue
@@ -96,8 +96,9 @@
        addRoadLayer() {
            earthCtrl.factory.createPathLayer({
                url: road,
                color: "#00FA9A", //线的颜色
                width: 4.0, //线的宽度
                // color: "#00FA9A", //线的颜色
                 color: "#ff0000", //线的颜色
                width: 5.0, //线的宽度
                pointColor: "#FFFFFF", //移动点的颜色
                speed: 1,
                far: 50000
src/views/visualization/msgList.vue
@@ -67,7 +67,7 @@
    handleClick(item) {
      this.removeLabel();
      // const point = mapConfig.getWKTParse(item.point)
      const point = item.point.split(" ")
      const point = item.point.split(",")
      this.label = earthCtrl.factory.createLabel({
        lon: point[0],
        lat: point[1],