lixuliang
2024-04-19 1fef6dcc04ffe09336e4983c2b05962ad901e545
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
export default {
    methods: {
        // 获取字段
        confirmAddress() {
            Cesium.GeoJsonDataSource.load(this.data.urls).then(dataSource => {
                let entity = dataSource.entities.values[0];
                let properties = entity.properties.getValue();
                this.fields = [];
                for (let key in properties) {
                    this.fields.push(key);
                }
            }).catch(() => {
 
            })
        },
        // 编辑矢量
        editGeosjon(editType, geosjon) {
            let type = this.data.class;
            let value = Cesium.defaultValue(this.data[this.data.class][editType], this.data[editType])
            if (this.polygonLabel && value === undefined) {
                value = this.data.point[editType];
            }
            editType === 'size' && (editType = 'font_size');
            editType === 'labelColor' && (editType = 'fillColor');
            editType === 'pointHeight' && this.showModel && (editType = 'height');
            editType === 'radiusScale' && (value /= 2);
 
            if (editType === 'polygonLabel') {
                editType = 'text';
                value = this.polygonLabel ? this.data.text : '';
            }
 
            if (editType === 'color') {
                if (type === 'point') {
                    editType = 'fillColor'
                } else if (type !== 'model' && !this.effectLine) {
                    editType = 'material'
                }
            }
 
            let data = {}
            if (editType === 'pointType') {
                if (this.pointType === 'label') {
                    data = {
                        text: this.data.text,
                        image: ''
                    }
                } else if (this.pointType === 'billboard') {
                    data = {
                        image: this.data.image,
                        text: ''
                    }
                } else {
                    data = {
                        text: this.data.text,
                        image: this.data.image
                    }
                }
            } else if (editType === 'IgnoreShelter') {
                this.IgnoreShelter ? (data.disableDepthTestDistance = "Infinity") : (data.disableDepthTestDistance = 0);
            } else if (editType === 'fontStyle') {
                this.fontStyle.includes("bold") ? data.bold = true : data.bold = false;
                this.fontStyle.includes("italic") ? data.italic = true : data.italic = false;
            } else {
                data[editType] = value
            }
            geosjon.updataGeosjon && geosjon.updataGeosjon(data);
        },
        // 还原
        restore(vector) {
            vector.restoreGeosjon && vector.restoreGeosjon()
        }
    }
}