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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
| <!--
| * @Author: shuishen 1109946754@qq.com
| * @Date: 2023-03-10 15:28:07
| * @LastEditors: shuishen 1109946754@qq.com
| * @LastEditTime: 2023-04-19 21:59:01
| * @FilePath: \forest-fire\src\views\armyLocal\components\leftContainer.vue
| * @Description: 防火预警
| *
| * Copyright (c) 2023 by ${git_name_email}, All Rights Reserved.
| -->
| <script setup>
|
| var geojson = {
| "type": "FeatureCollection",
| "features": [
| {
| "type": "Feature",
| "properties": {},
| "geometry": {
| "type": "Polygon",
| "coordinates": [
| [
| [
| 93.6474609375,
| 37.10776507118514
| ],
| [
| 93.01025390625,
| 35.17380831799959
| ],
| [
| 95.11962890625,
| 33.54139466898275
| ],
| [
| 97.53662109375,
| 33.54139466898275
| ],
| [
| 99.25048828124999,
| 33.96158628979907
| ],
| [
| 99.97558593749999,
| 35.191766965947394
| ],
| [
| 99.84374999999999,
| 36.38591277287651
| ],
| [
| 98.85498046875,
| 37.45741810262938
| ],
| [
| 97.18505859374999,
| 37.90953361677018
| ],
| [
| 95.16357421875,
| 37.82280243352756
| ],
| [
| 93.6474609375,
| 37.10776507118514
| ],
| // [
| // 93.01025390625,
| // 35.17380831799959
| // ],
| ]
| ]
| }
| }
| ]
| }
| var promise = global.DC.Namespace.Cesium.GeoJsonDataSource.load(geojson,
| {
| camera: global.viewer.scene.camera,
| canvas: global.viewer.scene.canvas,
| clampToGround: true//开启贴地
| }
| )
| promise.then(function (dataSource) {
| //Get the array of entities
| var entities = dataSource.entities.values
| entities.forEach((entitie) => {
| //必须要设置高度边线才有用,可是设置了高度之后贴地就没了
| entitie.polygon.height = 50
| entitie.polygon.outline = true
| entitie.polygon.outlineColor = global.DC.Namespace.Cesium.Color.AQUA
| entitie.polygon.outlineWidth = 50
| // entitie.polygon.closeTop = false
| entitie.polygon.arcType = global.DC.Namespace.Cesium.ArcType.RHUMB
|
| // //单独设置线条样式
| // var positions = entitie.polygon.hierarchy._value.positions
| // entitie.polyline = {
| // positions: positions,
| // width: 10,
| // material: global.DC.Namespace.Cesium.Color.WHITE,
| // clampToGround: true
| // }
| global.viewer.entities.add(entitie)
| })
| })
| </script>
|
| <template>
| <div class="left-container">
| <el-button type="primary">绘制多边形</el-button>
| <el-button type="primary">绘制线段</el-button>
| <el-button type="primary">绘制图标点</el-button>
| </div>
| </template>
|
| <style lang="scss" scoped>
| .left-container {
| position: absolute;
| top: 200px;
| left: 20px;
| bottom: 120px;
| width: 400px;
| pointer-events: auto;
|
| }
| </style>
|
|