月球大数据地理空间分析展示平台-【前端】-月球2期前端
surprise
2023-10-30 ecf3ad202a851caa39660ddfaa16e1bf16565b2e
src/assets/js/Map/temporaryTools.js
@@ -10,6 +10,28 @@
            }
        }
    },
    removeTemporaryLayerAll() {
        var entities = window.Viewer.entities._entities._array;
        for (var i in entities) {
            if (entities[i]._shpType && entities[i]._shpType == "temporaryLayer") {
                window.Viewer.entities.remove(entities[i])
            }
        }
    },
    locationTemporaryLayer(res) {
        var entities = window.Viewer.entities._entities._array;
        for (var i in entities) {
            if (entities[i].id == res.id && entities[i]._shpType == res.shpType) {
                window.Viewer.flyTo(entities[i], {
                    offset: {
                        heading: Cesium.Math.toRadians(0.0),
                        pitch: Cesium.Math.toRadians(-90),
                        range: 400
                    }
                });
            }
        }
    },
    addTemporaryTool(res) {
        switch (res.type) {
            case "point":
@@ -129,11 +151,13 @@
                    res.near,
                    res.far
                ),
                outline: true,
                outline: false,
                outlineWidth: res.width,
                outlineColor: Cesium.Color.fromCssColorString(
                    res.outlineColor
                ).withAlpha(res.outlineAlpha),
                heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
            },
        });
    },
@@ -142,7 +166,7 @@
        if (res.outline) {
            outlinewidth = res.width
        }
        window.Viewer.entities.add({
            name: res.cnName,
            id: res.id,
@@ -156,7 +180,7 @@
                    res.near,
                    res.far
                ),
                material: new Cesium.PolylineOutlineMaterialProperty({
                    color: Cesium.Color.fromCssColorString(res.material).withAlpha(
                        res.materialAlpha
@@ -263,6 +287,7 @@
            var coord = this.setCartesianToEightFour(val[i])
            geom.push(coord.lng, coord.lat)
        }
        return {
            id: this.isedit ? res.id : (new Date()).getTime(),
            cnName: res.name,
@@ -276,7 +301,7 @@
            type: 'polygon',
            shpType: 'temporaryLayer',
            layerType: '多边形',
            outline: res.outline != null ? res.outline : false,
            outline: res.polygon.outline != null ? res.polygon.outline._value : false,
            width: res.polygon.outlineWidth ? res.polygon.outlineWidth._value : 1,
        }
    },
@@ -339,7 +364,7 @@
            layerType: '线',
            geometry: geom,
            heightReference: res.polyline.clampToGround._value,
            outline:  res.outline != null ?  res.outline : false,
            outline: res.outline != null ? res.outline : false,
            width: res.polyline.width._value,
            material: this.colorRgbToHex('rgb(' + (mataColor.red * 255) + ',' + (mataColor.green * 255) + ',' + (mataColor.blue * 255) + ')'),
            outlineColor: this.colorRgbToHex('rgb(' + (outlineColor.red * 255) + ',' + (outlineColor.green * 255) + ',' + (outlineColor.blue * 255) + ')'),
@@ -361,7 +386,6 @@
        if (res.label.outlineWidth && res.label.outlineWidth._value) {
            width = res.label.outlineWidth._value
        }
        return {
            id: this.isedit ? res.id : (new Date()).getTime(),
            cnName: res.name,
@@ -386,7 +410,6 @@
            layerType: '文本点',
        }
    },
    getPointEntityObj(res) {
        var mataColor = res.point.color._value;
        var outlineColor = res.point.outlineColor._value;
@@ -408,6 +431,7 @@
            layerType: '基本点',
            heightReference: res.point.disableDepthTestDistance != null ? false : true,
            size: res.point.pixelSize._value,
        }
    },