@saifuwei/sdm-gis-engine 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,341 @@
1
+ import * as t from 'cesium';
2
+ import { HeightReference, LabelStyle, Color, Cartesian2, EllipsoidGeodesic, DeveloperError, defined, Math as Math$1, Cartographic, Rectangle, Camera, Ray, Cartesian3, IntersectionTests, SceneMode, Matrix4, JulianDate, knockout, Matrix3, Transforms, CesiumTerrainProvider, EllipsoidTerrainProvider, HeadingPitchRange, Viewer, HeadingPitchRoll, BoundingSphere, DirectionalLight, SceneTransforms, createOsmBuildings, ScreenSpaceEventHandler, Entity, ScreenSpaceEventType, SingleTileImageryProvider, UrlTemplateImageryProvider, Cesium3DTileset, Cesium3DTileStyle, ShadowMode, PrimitiveCollection, KmlDataSource, ConstantProperty, ArcType, sampleTerrainMostDetailed, ClassificationType as ClassificationType$1, PolygonHierarchy as PolygonHierarchy$1, GeoJsonDataSource, DistanceDisplayCondition, VerticalOrigin, HorizontalOrigin, CustomDataSource, TranslationRotationScale, Quaternion, CallbackProperty, PolylineOutlineMaterialProperty, ColorBlendMode, WebMercatorTilingScheme, WebMercatorProjection, ArcGisMapServerImageryProvider, WebMapTileServiceImageryProvider, Clock, SampledPositionProperty, LinearApproximation, ClockRange, VelocityOrientationProperty, createGuid, PolylineGlowMaterialProperty, ParticleSystem, CircleEmitter, BoxEmitter, SphereEmitter, ConeEmitter, Cartesian4, PolylineArrowMaterialProperty, LabelGraphics, Event, EventHelper, getTimestamp, getElement } from 'cesium';
3
+ import Lt from 'cesium/Source/Core/EasingFunction';
4
+ import * as Et from '@turf/turf';
5
+ import 'cesium/Source/Core/Geometry';
6
+ import 'cesium/Source/Core/GeometryAttribute';
7
+ import 'cesium/Source/Core/ComponentDatatype';
8
+ import 'cesium/Source/Core/PrimitiveType';
9
+ import 'cesium/Source/Renderer/VertexArray';
10
+ import 'cesium/Source/Renderer/BufferUsage';
11
+ import 'cesium/Source/Widgets/widgets.css';
12
+ import 'antd';
13
+
14
+ const basicUrl = '';
15
+ var HFGISEngineConfig = {
16
+ isCesium: true,
17
+ name: 'HFGIS引擎',
18
+ description: 'HFGIS引擎,基于cesium二次封装',
19
+ //缩略图背景
20
+ cardImg: basicUrl + '/3D/images/cardImg/gis/gisTool.jpg',
21
+ operatorPath: 'webGis/HFGISEngine/InterfaceOperator',
22
+ // cameraConfig: {
23
+ // position: [107.55517916795455, 29.59546028264523, 2803.875136785634],
24
+ // hpr: [315.9380136356884, -85.69968744934701, 0.0678973455367844],
25
+ // animation: true,
26
+ // },
27
+ shadows: true,
28
+
29
+ fog: {
30
+ enabled: true,
31
+ density: 0.0005
32
+ },
33
+
34
+ /**
35
+ * 配置地图
36
+ * '地图1', '地图2', '地图3', '地图4', '地图5', '地图6', '地图7', '地图8',
37
+ * 纯瓦片', '纯路网', '纯地名', '地名和路网', '矢量切片'
38
+ * 无字段时 默认 '地图7' ,推荐天地图影像 5,7,9
39
+ */
40
+ imageryLayerType: '天地图影像',
41
+ imageryAnnotationLayer: false, //师傅开启影像注解 (地名)//天地图加载已经默认组合开启了
42
+ // 加载的地图贴片的个数,默认100
43
+ tileCacheSize: 20,
44
+ // 视角的最大高度
45
+ // maximumZoomDistance: 10000,
46
+ //是否开启3D地形
47
+ enableTerrain: false,
48
+ // 3D地形服务URL(可选,默认使用火星科技地形)
49
+ // terrainUrl: 'http://10.90.66.57:8892/sdm/terrain',
50
+ terrainUrl: 'https://zhuwei.safewaytools.com:3443/sdm/terrain',
51
+ // 中国边界线
52
+ // chinaBoundaryLine: {
53
+ // url: basicUrl + '/cesium-assets/Data/baitao/中华人民共和国.json',
54
+ // show: true,
55
+ // },
56
+ // boundaryTerrain: {
57
+ // url: basicUrl + '/cesium-assets/Data/baitao/data01.json',
58
+ // show: false,
59
+ // },
60
+
61
+ //自定义的geojson数据 引擎会自己解析
62
+ geojsonConfig: {
63
+ // boundary: {
64
+ // url: basicUrl + '/cesium-assets/Data/baitao/中华人民共和国.json',
65
+ // name: '中国边界',
66
+ // type: 'boundary',
67
+ // show: true,
68
+ // },
69
+ // //路网
70
+ // road: {
71
+ // name: '白涛路网',
72
+ // type: 'road',
73
+ // distanceDisplayCondition: [0, 50000],
74
+ // url: basicUrl + '/cesium-assets/Data/baitao/baitaoRoad.geojson',
75
+ // mapUrl: basicUrl + '/cesium-assets/Tool/continuity_two_yellow_01.png',
76
+ // },
77
+ //路网
78
+ // label: {
79
+ // name: '白涛地名点位',
80
+ // type: 'label',
81
+ // distanceDisplayCondition: [0, 5000], //可见范围,以高度为准
82
+ // url: basicUrl + '/cesium-assets/Data/baitao/point.geojson',
83
+ // enableCluster: true, //聚合开启
84
+ // },
85
+ },
86
+
87
+ /**
88
+ * 各种切换的配置
89
+ */
90
+ viewConfig: {
91
+ //必须配置的
92
+ home: {
93
+ position: [
94
+ window.appConfig?.mapCenter?.longitude || 107.53240541024215,
95
+ window.appConfig?.mapCenter?.latitude || 29.555532000606224,
96
+ window.appConfig?.mapCenter?.altitude || 13477.06785972357
97
+ ],
98
+ hpr: [328.4548196578917, -80.92800217585201, 359.99112538006995]
99
+ },
100
+ china: {
101
+ position: [103.84, 31.15, 17850000],
102
+ hpr: [348.4202942851978, -89.74026687972041, 0]
103
+ },
104
+ global: {
105
+ position: [107.63442943653064, 29.497340764413348, 24477.73141599715],
106
+ hpr: [312.05253894419633, -59.66609785128698, 0.0678973455367844]
107
+ }
108
+ },
109
+
110
+ /**
111
+ * 聚合的配置
112
+ */
113
+ clusterConfig: {
114
+ enabled: true,
115
+ url: basicUrl + '/cesium-assets/Data/baitao/point-yellow.png',
116
+ width: 30, //可以是图标的宽度,也可以按照比例扩大
117
+ height: 30 * 2.15
118
+ },
119
+
120
+ /**
121
+ * 绘制图形的配置
122
+ */
123
+ drawEntityConfig: {
124
+ /**默认启动聚合模块,如果为false,模块不启动,但是后续可以通过面板开启聚合与展开 */
125
+
126
+ billboard: {
127
+ name: '巡检点图标',
128
+ url: basicUrl + '/cesium-assets/Data/baitao/Map_Patrol.png',
129
+ imgWidth: 64,
130
+ imgHeight: 96
131
+ },
132
+ textMask: {
133
+ name: '文字标注配置',
134
+ url: basicUrl + '/cesium-assets/Data/baitao/device.png',
135
+ imgWidth: 64,
136
+ imgHeight: 96
137
+ },
138
+ polygonTrackLine: {
139
+ name: '轨迹线',
140
+ url: basicUrl + '/cesium-assets/Tool/inside-person.png',
141
+ showStartIcon: true,
142
+ showEndIcon: true,
143
+ showTrackIcon: false
144
+ },
145
+
146
+ //内置
147
+ polygonFlowLine: {
148
+ name: '行进线',
149
+ url: basicUrl + '/cesium-assets/Tool/continuity_two_yellow_01.png'
150
+ },
151
+
152
+ datas: [
153
+ // {
154
+ // id: '66b80066-10b9-463d-8d87-31dca802d721',
155
+ // name: '自定义动效平面',
156
+ // type: 'plane',
157
+ // positions: [
158
+ // [-1673869.5136483305, 5292133.640259012, 3131457.547122734],
159
+ // [-1674166.5297217544, 5291811.831140895, 3131840.0046895095],
160
+ // [-1674373.4788963047, 5291842.583625783, 3131678.4926952748],
161
+ // [-1674021.521456435, 5292167.70911103, 3131319.640283432],
162
+ // [-1673869.5136483305, 5292133.640259012, 3131457.547122734]
163
+ // ],
164
+ // lonlats: [
165
+ // [107.55184453816697, 29.59543618996954, 0.005993465574597604],
166
+ // [107.55576969775034, 29.599404323710807, 0.006548228511427804],
167
+ // [107.55771073589574, 29.59772856038029, 0.006364741376694769],
168
+ // [107.5532345219462, 29.59400539500477, 0.0058427987828176195],
169
+ // [107.55184453816697, 29.59543618996954, 0.005993465574597604]
170
+ // ],
171
+ // color: 'rgba(255,255,0,0.5)',
172
+ // center: [107.55408080638524, 29.59640213180699, 0.00614853996402708]
173
+ // },
174
+ // //聚焦使用 勿删
175
+ // {
176
+ // id: 'fee30833-11ad-4908-8dec-bdb473e8f8b5',
177
+ // name: '轨迹线',
178
+ // type: 'polygontrackline',
179
+ // positions: [
180
+ // [-1674070.0011730941, 5292167.737245599, 3131293.8625837853],
181
+ // [-1674324.6170064525, 5291929.0980726285, 3131559.240773625],
182
+ // [-1674412.2098238214, 5291944.29220948, 3131487.215451117],
183
+ // [-1674492.4351742177, 5291871.713130851, 3131566.4344349205],
184
+ // [-1674566.4818969574, 5291883.295964758, 3131507.662029157],
185
+ // [-1674510.4526984598, 5291966.727957816, 3131397.372886012],
186
+ // [-1674249.0064139066, 5292106.999571106, 3131300.7617041464],
187
+ // [-1674161.1339537725, 5292189.079505015, 3131209.635436994]
188
+ // ],
189
+ // lonlats: [
190
+ // [107.55371155927755, 29.593737915899805, 0.012929350352952583],
191
+ // [107.55696044263053, 29.596491247344144, 0.012000009612140414],
192
+ // [107.55777519573603, 29.5957439684243, 0.011876036929274943],
193
+ // [107.55879076742042, 29.596565883497483, 0.013405391387762153],
194
+ // [107.55948343893535, 29.59595610571585, 0.011721241116876098],
195
+ // [107.55867219887695, 29.5948118392464, 0.01263498279776146],
196
+ // [107.5556623698288, 29.59380949418754, 0.012124192138165502],
197
+ // [107.5545420118624, 29.592864064336197, 0.012446028845679134]
198
+ // ],
199
+ // color: 'rgb(6,180,178)',
200
+ // url: '/cesium-assets/Tool/inside-person.png',
201
+ // showStartIcon: true,
202
+ // showEndIcon: true,
203
+ // showTrackIcon: true,
204
+ // currentLonlat: [
205
+ // 107.55879076742042, 29.596565883497483, 0.013405391387762153
206
+ // ]
207
+ // }
208
+ ]
209
+ }
210
+ };
211
+
212
+ function Dt(t,i){var e={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&0>i.indexOf(s)&&(e[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(s=Object.getOwnPropertySymbols(t);s.length>o;o++)0>i.indexOf(s[o])&&Object.prototype.propertyIsEnumerable.call(t,s[o])&&(e[s[o]]=t[s[o]]);}return e}function Mt(t,i,e,s){return new(e||(e=Promise))((function(o,n){function a(t){try{l(s.next(t));}catch(t){n(t);}}function r(t){try{l(s.throw(t));}catch(t){n(t);}}function l(t){var i;t.done?o(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i);}))).then(a,r);}l((s=s.apply(t,i||[])).next());}))}"function"==typeof SuppressedError&&SuppressedError;class Rt{constructor(t){this.duration=.85,this.easingFunction=Lt.CUBIC_IN_OUT,this.registEventHandlers=[],this.animationFrame=0,this.operator=t,this.viewer=t.viewer,this.eventHandler=new ScreenSpaceEventHandler(this.viewer.scene.canvas),this.init();}init(){this.initLeftDownEventHandler(),this.animate();}animate(){var t,i;(null===(t=this.registEventHandlers)||void 0===t?void 0:t.length)&&(null===(i=this.registEventHandlers)||void 0===i||i.forEach((t=>{t();}))),this.animationFrame=requestAnimationFrame(this.animate.bind(this));}initLeftDownEventHandler(){this.eventHandler.setInputAction((t=>{let i=this.viewer.scene.pick(t.position),n=null;i&&i.id instanceof Entity&&(n=i.id),i&&i.primitive&&(n=i.primitive);let a={entity:null==n?void 0:n.userData,screenPosition:{x:t.position.x,y:t.position.y}},r=this.viewer.scene.pickPosition(t.position);if(!r){const i=this.viewer.camera.pickEllipsoid(t.position,this.viewer.scene.globe.ellipsoid);i&&(r=i);}if(!r){if(this.viewer.terrainProvider){const i=this.viewer.camera.getPickRay(t.position);if(i){const t=this.viewer.scene.globe.pick(i,this.viewer.scene);t&&(r=t);}}}if(r){let i=Cartographic.fromCartesian(r),e=Math$1.toDegrees(i.latitude),n=Math$1.toDegrees(i.longitude);a=Object.assign(a,{lon:n,lat:e,alt:i.height,position:t.position});}this.callFun&&this.callFun(a);}),ScreenSpaceEventType.LEFT_CLICK);}flytoEvent(t){const i=this.viewer.scene.pick(t.position);if(!i)return;let s,o;if(i.id instanceof Entity&&i.id.userData){if(o=i.id.userData,o.viewConfig){const{position:t,hpr:i}=o.viewConfig;this.viewer.camera.flyTo({destination:Cartesian3.fromDegrees(t[0],t[1],t[2]),orientation:HeadingPitchRoll.fromDegrees(i[0],i[1],i[2]),duration:this.duration,easingFunction:this.easingFunction});}}else i.primitive&&i.primitive.userData&&(o=i.primitive.userData,s=i.primitive);if(s)if(s.userData&&(s.userData.flyto||s.userData.viewConfig)){let{position:t,orientation:i,duration:e}=s.userData.flyto;this.viewer.camera.flyTo({destination:Cartesian3.fromDegrees(t[0],t[1],t[2]),orientation:HeadingPitchRoll.fromDegrees(i[0],i[1],i[2]),duration:e||this.duration,easingFunction:this.easingFunction});}else {const t=s.boundingSphere;t&&this.viewer.camera.flyToBoundingSphere(t,{duration:this.duration,easingFunction:this.easingFunction});}}setClickCallBack(t){t&&(this.callFun=t);}clearClickCallBack(){this.callFun&&(this.callFun=void 0);}registEventHandlerCallback(t){t&&this.registEventHandlers.push(t);}clearRegistEventHandler(){this.registEventHandlers&&this.registEventHandlers.length&&(this.registEventHandlers=[]);}dispose(){this.eventHandler.removeInputAction(ScreenSpaceEventType.LEFT_CLICK),this.animationFrame&&cancelAnimationFrame(this.animationFrame);}}function xt(i){const e=t.Cartographic.fromCartesian(i);return [t.Math.toDegrees(e.longitude),t.Math.toDegrees(e.latitude)]}function kt(t,i){if(!t||!i)return 0;return function(t,i){let e=t[1]*Math.PI/180,s=i[1]*Math.PI/180,o=t[0]*Math.PI/180-i[0]*Math.PI/180,n=2*Math.asin(Math.sqrt(Math.pow(Math.sin((e-s)/2),2)+Math.cos(e)*Math.cos(s)*Math.pow(Math.sin(o/2),2)));return n*=6378.137,n=Math.round(1e4*n)/10,n}(xt(t),xt(i))}function Pt(i){return t.Cartographic.fromCartesian(i).height}function Ot(t){if(3>t.length)return 0;let i=[];t.forEach((t=>{i.push(xt(t));})),i.push(i[0]);let e=Et.polygon([i]);return Et.area(e).toFixed(3)}const At={label:{scale:.5,font:"32px sans-serif",distanceDisplayCondition:[0,5e4],verticalOrigin:"BOTTOM",style:t.LabelStyle.FILL_AND_OUTLINE,pixelOffset:[0,-10],outlineWidth:2,outlineColor:"#000000",fillColor:"#00FFFF",eyeOffset:[0,0,-10],showBackground:true,backgroundColor:"rgba(0,0,0,1))",backgroundPadding:[10,7]},polygon:{material:{color:"#ebe12c",alpha:.4},clampToGround:true,perPositionHeight:true,heightReference:"CLAMP_TO_GROUND",classificationType:"BOTH"},polyline:{width:9,material:{color:"#ebe12c",glowPower:.1},perPositionHeight:true,disableDepthTestDistance:1/0,depthTest:false,zIndex:1e3,heightReference:t.HeightReference.CLAMP_TO_GROUND},vertex:{depthTest:false,color:"#FFFF00",pixelSize:8,disableDepthTestDistance:1/0,outlineColor:"#FFFFFF",outlineWidth:2}};class It{list=new Map;constructor(t){this.viewer=t,this.positions=[],this.tempPositions=[],this.initEvents(),this.group=null,this.options=At;}createGroup(){this.group={id:this.generateId(),positions:[],vertexEntities:[],polygonEntity:null,resultLabel:null},this.list.set(this.group.id,this.group);}setBaseHeight(t){this.height=t;}initEvents(){this.handler=new t.ScreenSpaceEventHandler(this.viewer.scene.canvas),this.MeasureStartEvent=new t.Event,this.MeasureEndEvent=new t.Event;}active(t={}){this.isMeasure||(this.isContinuous=t.isContinuous||false,this.createGroup(),this.registerEvents(),this.isMeasure=true,this.options=Object.assign(this.options,t));}deactive(){this.isMeasure&&this.unRegisterEvents();}unRegisterEvents(){this.handler.removeInputAction(t.ScreenSpaceEventType.LEFT_CLICK),this.handler.removeInputAction(t.ScreenSpaceEventType.MOUSE_MOVE),this.handler.removeInputAction(t.ScreenSpaceEventType.RIGHT_CLICK);}registerEvents(){this.leftClickEvent(),this.mouseMoveEvent(),this.rightClickEvent();}leftClickEvent(){this.handler.setInputAction((i=>{this.viewer._element.style.cursor="default";let e=this.viewer.scene.pickPosition(i.position);if(!e){e=this.viewer.scene.camera.pickEllipsoid(e,this.viewer.scene.globe.ellipsoid);}t.defined(e)&&(this.positions.push(e),this.height=this.unifiedHeight(this.positions,this.height),1==this.positions.length&&this.createPolygonEntity(),this.createVertex());}),t.ScreenSpaceEventType.LEFT_CLICK);}mouseMoveEvent(){this.handler.setInputAction((t=>{if(!this.isMeasure)return;this.viewer._element.style.cursor="default";let i=this.viewer.scene.pickPosition(t.endPosition);i||(i=this.viewer.scene.camera.pickEllipsoid(t.startPosition,this.viewer.scene.globe.ellipsoid)),i&&this.handleMoveEvent(i);}),t.ScreenSpaceEventType.MOUSE_MOVE);}handleMoveEvent(t){1>this.positions.length||(this.height=this.unifiedHeight(this.positions,this.height),this.tempPositions=this.positions.concat(t),this.tempPositions.length>2&&!this.group?.resultLabel&&this.createResultLabel());}createResultLabel(){const i=this.options.label,e=this.group.id,s=this.viewer.entities.add({position:new t.CallbackProperty((t=>this.getCenterPosition()),false),type:"MeasureAreaResult",label:{text:new t.CallbackProperty((t=>{const i=this.list.get(e);return i?this.isMeasure&&this.group&&this.group.id===e&&this.tempPositions&&this.tempPositions.length>0?"\u9762\u79ef"+Ot(this.tempPositions)+"\u5e73\u65b9\u7c73":i.positions&&i.positions.length>0?"\u9762\u79ef"+Ot(i.positions)+"\u5e73\u65b9\u7c73":"\u9762\u79ef0.00\u5e73\u65b9\u7c73":"\u9762\u79ef0.00\u5e73\u65b9\u7c73"}),false),scale:i.scale,font:i.font,distanceDisplayCondition:new t.DistanceDisplayCondition(i.distanceDisplayCondition[0],i.distanceDisplayCondition[1]),verticalOrigin:t.VerticalOrigin[i.verticalOrigin],style:i.style,pixelOffset:new t.Cartesian2(i.pixelOffset[0],i.pixelOffset[1]),outlineWidth:i.outlineWidth,outlineColor:t.Color.fromCssColorString(i.outlineColor),fillColor:t.Color.fromCssColorString(i.fillColor),eyeOffset:new t.Cartesian3(i.eyeOffset[0],i.eyeOffset[1],i.eyeOffset[2]),showBackground:i.showBackground,backgroundColor:t.Color.fromCssColorString(i.backgroundColor),backgroundPadding:new t.Cartesian2(i.backgroundPadding[0],i.backgroundPadding[1]),disableDepthTestDistance:1/0}});this.group&&(this.group.resultLabel=s);}getCenterPosition(){let i=[];if(3>this.tempPositions.length)return this.tempPositions[0];this.tempPositions.forEach((t=>{const e=this.cartesian3ToPoint3D(t);i.push([e.x,e.y]);}));let e=Et.lineString(i),s=Et.bbox(e),o=Et.bboxPolygon(s),n=Et.center(o).geometry.coordinates;return t.Cartesian3.fromDegrees(n[0],n[1],this.height+.3)}unifiedHeight(i,e){let s;e||(e=this.getPositionHeight(i[0]));for(let o=0;i.length>o;o++){s=this.cartesian3ToPoint3D(i[o]),i[o]=t.Cartesian3.fromDegrees(s.x,s.y,e);}return e}createPolygonEntity(){const i=this.options.polygon,e=this.options.polyline,s=this.group.id,o=this.viewer.entities.add({polygon:{hierarchy:new t.CallbackProperty((i=>{const e=this.list.get(s);return new t.PolygonHierarchy(e?this.isMeasure&&this.group&&this.group.id===s&&this.tempPositions&&this.tempPositions.length>0?this.tempPositions:e.positions&&e.positions.length>0?e.positions:[]:[])}),false),material:t.Color.fromCssColorString(i.material.color).withAlpha(i.material.alpha),heightReference:t.HeightReference[i.heightReference],classificationType:t.ClassificationType[i.classificationType],clampToGround:i.clampToGround},polyline:{perPositionHeight:e.perPositionHeight,positions:new t.CallbackProperty((t=>{const i=this.list.get(s);return i?this.isMeasure&&this.group&&this.group.id===s&&this.tempPositions&&this.tempPositions.length>0?this.tempPositions.concat(this.tempPositions[0]):i.positions&&i.positions.length>0?i.positions.concat(i.positions[0]):[]:[]}),false),width:e.width,material:new t.PolylineGlowMaterialProperty({color:t.Color.fromCssColorString(e.material.color),glowPower:e.material.glowPower}),disableDepthTestDistance:e.disableDepthTestDistance,depthTest:e.depthTest,zIndex:e.zIndex,heightReference:e.heightReference}});this.group&&(this.group.polygonEntity=o);}createVertex(){const i=this.options.vertex;let e=this.viewer.entities.add({position:this.positions[this.positions.length-1],type:"MeasureAreaVertex",point:{depthTest:i.depthTest,color:t.Color.fromCssColorString(i.color),pixelSize:i.pixelSize,disableDepthTestDistance:i.disableDepthTestDistance,outlineColor:t.Color.fromCssColorString(i.outlineColor),outlineWidth:i.outlineWidth}});e.depthTest=i.depthTest,this.group&&this.group.vertexEntities.push(e);}getPositionHeight(i){return t.Cartographic.fromCartesian(i).height}cartesian3ToPoint3D(i){const e=t.Cartographic.fromCartesian(i);return {x:t.Math.toDegrees(e.longitude),y:t.Math.toDegrees(e.latitude),z:e.height}}rightClickEvent(){this.handler.setInputAction((t=>{this.isMeasure&&(3>this.positions.length?this.isContinuous?(this.discardCurrentMeasurement(),this.createGroup()):this.deactive():(this.tempPositions=[...this.positions],this.group&&this.group.resultLabel&&(this.group.resultLabel.position=this.getCenterPosition(),this.group.resultLabel.label.text="\u603b\u9762\u79ef"+Ot(this.positions)+"\u5e73\u65b9\u7c73"),this.measureEnd()));}),t.ScreenSpaceEventType.RIGHT_CLICK);}measureEnd(){this.MeasureEndEvent.raiseEvent(this.measureArea),this.isContinuous?this.startNewMeasurement():this.deactivate();}startNewMeasurement(){this.group&&(this.group.positions=[...this.positions],this.tempPositions=[...this.positions]),this.positions=[],this.height=void 0,this.createGroup();}discardCurrentMeasurement(){this.group&&(this.removeGroupEntities(this.group),this.list.delete(this.group.id)),this.positions=[],this.tempPositions=[],this.height=void 0;}deactivate(){this.isMeasure&&(this.group&&(this.group.positions=[...this.positions],this.tempPositions=[...this.positions]),this.unRegisterEvents(),this.viewer._element.style.cursor="pointer",this.viewer.enableCursorStyle=true,this.isMeasure=false,this.isContinuous=false,this.positions=[],this.height=void 0);}stop(){this.isContinuous=false,this.deactivate();}clear(){this.stop(),this.group&&(this.removeGroupEntities(this.group),this.group=null),this.clearAllGroups(),this.height=void 0;}generateId(){return Math.random().toString(36).substr(2,9)+"-"+Math.random().toString(36).substr(2,4)+"-"+Math.random().toString(36).substr(2,4)+"-"+Math.random().toString(36).substr(2,4)+"-"+Math.random().toString(36).substr(2,12)}removeGroupById(t){const i=this.list.get(t);return !!i&&(this.removeGroupEntities(i),this.list.delete(t),true)}removeGroupEntities(t){t.polygonEntity&&this.viewer.entities.remove(t.polygonEntity),t.vertexEntities&&t.vertexEntities.forEach((t=>{this.viewer.entities.remove(t);})),t.resultLabel&&this.viewer.entities.remove(t.resultLabel);}clearAllGroups(){this.list.forEach((t=>{this.removeGroupEntities(t);})),this.list.clear();}getAllGroupIds(){return Array.from(this.list.keys())}getGroupById(t){return this.list.get(t)}getGroupCount(){return this.list.size}getData(){return {...this.options,positions:this.positions,id:this.group?this.group.id:null}}}const _t={label:{scale:.5,font:"32px sans-serif",distanceDisplayCondition:[0,5e4],verticalOrigin:"BOTTOM",style:t.LabelStyle.FILL_AND_OUTLINE,pixelOffset:[0,-10],outlineWidth:2,outlineColor:"#000000",fillColor:"#00FFFF",eyeOffset:[0,0,-10],showBackground:true,backgroundColor:"rgba(0,0,0,1))",backgroundPadding:[10,7]},polygon:{perPositionHeight:true,width:9,material:{color:"#ebe12c",glowPower:.1},outlineColor:"#ebe12c",outlineWidth:2,disableDepthTestDistance:1/0,clampToGround:false,zIndex:1e3,depthTest:false},vertex:{depthTest:false,color:"#FFFF00",pixelSize:8,disableDepthTestDistance:1/0,outlineColor:"#FFFFFF",outlineWidth:2}};class Ft{list=new Map;constructor(t){this.viewer=t,this.positions=[],this.tempPositions=[],this.initEvents(),this.group=null,this.options=_t;}createGroup(){this.group={id:this.generateId(),positions:[],segmentLabels:[],startLabel:null,totalLabel:null,vertexEntities:[],polygonEntity:null,measureArea:null,jsonData:null},this.list.set(this.group.id,this.group);}setBaseHeight(t){this.height=t;}initEvents(){this.handler=new t.ScreenSpaceEventHandler(this.viewer.scene.canvas),this.MeasureStartEvent=new t.Event,this.MeasureEndEvent=new t.Event;}active(t={}){this.isMeasure||(this.isContinuous=t.isContinuous||false,this.createGroup(),this.registerEvents(),this.isMeasure=true,this.options=Object.assign(this.options,t));}deactive(){this.isMeasure&&this.unRegisterEvents();}unRegisterEvents(){this.handler.removeInputAction(t.ScreenSpaceEventType.LEFT_CLICK),this.handler.removeInputAction(t.ScreenSpaceEventType.MOUSE_MOVE),this.handler.removeInputAction(t.ScreenSpaceEventType.RIGHT_CLICK);}registerEvents(){this.leftClickEvent(),this.mouseMoveEvent(),this.rightClickEvent();}leftClickEvent(){this.handler.setInputAction((i=>{this.viewer._element.style.cursor="default";let e=this.viewer.scene.pickPosition(i.position);if(!e){e=this.viewer.scene.camera.pickEllipsoid(i.position,this.viewer.scene.globe.ellipsoid);}t.defined(e)&&(this.positions.push(e),this.height=this.unifiedHeight(this.positions,this.height),1==this.positions.length&&(this.createPolygonEntity(),this.createStartLabel("\u8d77\u70b9")),this.createVertex());}),t.ScreenSpaceEventType.LEFT_CLICK);}createPolygonEntity(){const i=this.options.polygon,e=this.group.id,s=this.viewer.entities.add({polyline:{perPositionHeight:i.perPositionHeight,heightReference:t.HeightReference.CLAMP_TO_GROUND,positions:new t.CallbackProperty((t=>{const i=this.list.get(e);return i?this.isMeasure&&this.group&&this.group.id===e&&this.tempPositions&&this.tempPositions.length>0?this.tempPositions:i.positions&&i.positions.length>0?i.positions:[]:[]}),false),width:i.width,material:new t.PolylineGlowMaterialProperty({color:t.Color.fromCssColorString(i.material.color),glowPower:i.material.glowPower}),outlineColor:t.Color.fromCssColorString(i.outlineColor),outlineWidth:i.outlineWidth,disableDepthTestDistance:i.disableDepthTestDistance,clampToGround:i.clampToGround,zIndex:i.zIndex,depthTest:i.depthTest}});s.depthTest=i.depthTest,this.group&&(this.group.polygonEntity=s);}createLabel(i,e,s="MeasureLabel"){const o=this.options.label;return this.viewer.entities.add({position:e,type:s,label:{text:i,scale:o.scale,font:o.font,distanceDisplayCondition:new t.DistanceDisplayCondition(o.distanceDisplayCondition[0],o.distanceDisplayCondition[1]),verticalOrigin:t.VerticalOrigin[o.verticalOrigin],style:o.style,pixelOffset:new t.Cartesian2(o.pixelOffset[0],o.pixelOffset[1]),outlineWidth:o.outlineWidth,outlineColor:t.Color.fromCssColorString(o.outlineColor),fillColor:t.Color.fromCssColorString(o.fillColor),showBackground:o.showBackground,backgroundColor:t.Color.fromCssColorString(o.backgroundColor),backgroundPadding:new t.Cartesian2(o.backgroundPadding[0],o.backgroundPadding[1]),disableDepthTestDistance:1/0}})}createStartLabel(t){this.group&&this.group.startLabel&&(this.viewer.entities.remove(this.group.startLabel),this.group.startLabel.connectorLine&&this.viewer.entities.remove(this.group.startLabel.connectorLine));const i=this.createLabel(t,this.positions[0],"MeasureStartLabel");this.group&&(this.group.startLabel=i);}createSegmentLabel(t,i,e){const s=kt(i,e);let o;if(0===t)o=(s/1e3).toFixed(3)+"\u516c\u91cc";else {o=`${((this.getCumulativeDistance(t+1)+s)/1e3).toFixed(3)}\u516c\u91cc\n(+${(s/1e3).toFixed(3)}\u516c\u91cc)`;}const n=this.createLabel(o,e,"MeasureSegmentLabel");this.group&&this.group.segmentLabels.push(n);}createTotalLabel(){this.group&&this.group.totalLabel&&(this.viewer.entities.remove(this.group.totalLabel),this.group.totalLabel.connectorLine&&this.viewer.entities.remove(this.group.totalLabel.connectorLine));const t=this.getCumulativeDistance(this.positions.length),i=this.positions.length>1?kt(this.positions[this.positions.length-2],this.positions[this.positions.length-1]):0,e=this.createLabel(`\u603b\u957f:${(t/1e3).toFixed(3)}\u516c\u91cc\n(+${(i/1e3).toFixed(3)}\u516c\u91cc)`,this.positions[this.positions.length-1],"MeasureTotalLabel");this.group&&(this.group.totalLabel=e);}getCumulativeDistance(t){let i=0;for(let e=0;t-1>e;e++)i+=kt(this.positions[e],this.positions[e+1]);return i}getSegmentCenterPosition(i,e){const s=Et.point([this.cartesian3ToPoint3D(i).x,this.cartesian3ToPoint3D(i).y]),o=Et.point([this.cartesian3ToPoint3D(e).x,this.cartesian3ToPoint3D(e).y]),n=Et.midpoint(s,o);return t.Cartesian3.fromDegrees(n.geometry.coordinates[0],n.geometry.coordinates[1],this.height+.3)}mouseMoveEvent(){this.handler.setInputAction((t=>{if(!this.isMeasure)return;this.viewer._element.style.cursor="default";let i=this.viewer.scene.pickPosition(t.endPosition);i||(i=this.viewer.scene.camera.pickEllipsoid(t.startPosition,this.viewer.scene.globe.ellipsoid)),i&&this.handleMoveEvent(i);}),t.ScreenSpaceEventType.MOUSE_MOVE);}handleMoveEvent(t){1>this.positions.length||(this.height=this.unifiedHeight(this.positions,this.height),this.tempPositions=this.positions.concat(t));}getCenterPosition(){let i=[];if(2>this.tempPositions.length)return this.tempPositions[0];this.tempPositions.forEach((t=>{const e=this.cartesian3ToPoint3D(t);i.push([e.x,e.y]);}));let e=Et.point(i[0]),s=Et.point(i[1]),o=Et.midpoint(e,s);return t.Cartesian3.fromDegrees(o.geometry.coordinates[0],o.geometry.coordinates[1],this.height+.3)}unifiedHeight(i,e){let s;e||(e=this.getPositionHeight(i[0]));for(let o=0;i.length>o;o++){s=this.cartesian3ToPoint3D(i[o]),i[o]=t.Cartesian3.fromDegrees(s.x,s.y,e);}return e}createVertex(){const i=this.options.vertex;let e=this.viewer.entities.add({position:this.positions[this.positions.length-1],type:"eidtVertex",point:{depthTest:i.depthTest,color:t.Color.fromCssColorString(i.color),pixelSize:i.pixelSize,disableDepthTestDistance:i.disableDepthTestDistance,outlineColor:t.Color.fromCssColorString(i.outlineColor),outlineWidth:i.outlineWidth}});if(e.depthTest=i.depthTest,this.group&&this.group.vertexEntities.push(e),this.positions.length>=2){const t=this.positions.length-2;this.createSegmentLabel(t,this.positions[t],this.positions[t+1]);}}getPositionHeight(i){return t.Cartographic.fromCartesian(i).height}cartesian3ToPoint3D(i){const e=t.Cartographic.fromCartesian(i);return {x:t.Math.toDegrees(e.longitude),y:t.Math.toDegrees(e.latitude),z:e.height}}rightClickEvent(){this.handler.setInputAction((t=>{if(this.isMeasure)if(this.positions.length<2)this.isContinuous?(this.discardCurrentMeasurement(),this.createGroup()):this.deactive();else {if(this.group&&this.group.segmentLabels.length>0){const t=this.group.segmentLabels[this.group.segmentLabels.length-1],i=this.getCumulativeDistance(this.positions.length),e=this.positions.length>1?kt(this.positions[this.positions.length-2],this.positions[this.positions.length-1]):0;t.label.text=`\u603b\u957f:${(i/1e3).toFixed(3)}\u516c\u91cc\n(+${(e/1e3).toFixed(3)}\u516c\u91cc)`,t.type="MeasureTotalLabel",this.group.totalLabel=t;}this.tempPositions=[...this.positions],this.measureEnd();}}),t.ScreenSpaceEventType.RIGHT_CLICK);}measureEnd(){this.MeasureEndEvent.raiseEvent(this.measureArea),this.isContinuous?this.startNewMeasurement():this.deactivate();}startNewMeasurement(){this.group&&(this.group.positions=[...this.positions],this.tempPositions=[...this.positions]),this.positions=[],this.height=void 0,this.createGroup();}discardCurrentMeasurement(){this.group&&(this.removeGroupEntities(this.group),this.list.delete(this.group.id)),this.positions=[],this.tempPositions=[],this.height=void 0;}generateId(){return Math.random().toString(36).substr(2,9)+"-"+Math.random().toString(36).substr(2,4)+"-"+Math.random().toString(36).substr(2,4)+"-"+Math.random().toString(36).substr(2,4)+"-"+Math.random().toString(36).substr(2,12)}removeGroupById(t){const i=this.list.get(t);return !!i&&(this.removeGroupEntities(i),this.list.delete(t),true)}removeGroupEntities(t){t.startLabel&&(this.viewer.entities.remove(t.startLabel),t.startLabel.connectorLine&&this.viewer.entities.remove(t.startLabel.connectorLine)),t.segmentLabels&&t.segmentLabels.forEach((t=>{this.viewer.entities.remove(t),t.connectorLine&&this.viewer.entities.remove(t.connectorLine);})),t.totalLabel&&!t.segmentLabels.includes(t.totalLabel)&&(this.viewer.entities.remove(t.totalLabel),t.totalLabel.connectorLine&&this.viewer.entities.remove(t.totalLabel.connectorLine)),t.vertexEntities&&t.vertexEntities.forEach((t=>{this.viewer.entities.remove(t);})),t.polygonEntity&&this.viewer.entities.remove(t.polygonEntity);}clearAllGroups(){this.list.forEach((t=>{this.removeGroupEntities(t);})),this.list.clear();}getAllGroupIds(){return Array.from(this.list.keys())}getGroupById(t){return this.list.get(t)}getGroupCount(){return this.list.size}getData(){return {...this.options,positions:this.positions,id:this.group.id}}deactivate(){this.isMeasure&&(this.group&&(this.group.positions=[...this.positions],this.tempPositions=[...this.positions]),this.unRegisterEvents(),this.viewer._element.style.cursor="pointer",this.viewer.enableCursorStyle=true,this.isMeasure=false,this.isContinuous=false,this.positions=[],this.height=void 0);}stop(){this.isContinuous=false,this.deactivate();}clear(){this.stop(),this.group&&(this.removeGroupEntities(this.group),this.group=null),this.clearAllGroups(),this.height=void 0;}}class zt{list=new Map;constructor(t){this.viewer=t,this.positions=[],this.vertexEntities=[],this.tempPositions=[],this.initEvents(),this.group=null,this.options=_t;}createGroup(){this.group={id:this.generateId(),positions:[],vertexEntities:[],polygonEntity:null,resultLabel:null},this.list.set(this.group.id,this.group);}initEvents(){this.handler=new t.ScreenSpaceEventHandler(this.viewer.scene.canvas),this.MeasureStartEvent=new t.Event,this.MeasureEndEvent=new t.Event;}active(t={}){this.isMeasure||(this.isContinuous=t.isContinuous||false,this.createGroup(),this.registerEvents(),this.isMeasure=true,this.positions=[],this.tempPositions=[],this.options=Object.assign(this.options,t));}deactive(){this.isMeasure&&(this.isMeasure=false,this.unRegisterEvents());}unRegisterEvents(){this.handler.removeInputAction(t.ScreenSpaceEventType.LEFT_CLICK),this.handler.removeInputAction(t.ScreenSpaceEventType.MOUSE_MOVE),this.handler.removeInputAction(t.ScreenSpaceEventType.RIGHT_CLICK);}registerEvents(){this.leftClickEvent(),this.mouseMoveEvent(),this.rightClickEvent();}leftClickEvent(){this.handler.setInputAction((i=>{if(this.viewer._element.style.cursor="default",2==this.positions.length)return void this.deactivate();let e=this.viewer.scene.pickPosition(i.position);if(!e){e=this.viewer.scene.camera.pickEllipsoid(e,this.viewer.scene.globe.ellipsoid);}t.defined(e)&&(this.positions.push(e),1===this.positions.length&&this.createPolygonEntity(),this.createVertex());}),t.ScreenSpaceEventType.LEFT_CLICK);}createPolygonEntity(){const i=this.options.polygon,e=this.group.id,s=this.viewer.entities.add({polyline:{perPositionHeight:i.perPositionHeight,heightReference:t.HeightReference.CLAMP_TO_GROUND,positions:new t.CallbackProperty((t=>{const i=this.list.get(e);return i?this.isMeasure&&this.group&&this.group.id===e&&this.tempPositions&&this.tempPositions.length>0?this.tempPositions:i.positions&&i.positions.length>0?i.positions:[]:[]}),false),width:i.width,material:new t.PolylineGlowMaterialProperty({color:t.Color.fromCssColorString(i.material.color),glowPower:i.material.glowPower}),outlineColor:t.Color.fromCssColorString(i.outlineColor),outlineWidth:i.outlineWidth,disableDepthTestDistance:i.disableDepthTestDistance,clampToGround:i.clampToGround,zIndex:i.zIndex,depthTest:i.depthTest}});s.depthTest=i.depthTest,this.group&&(this.group.polygonEntity=s);}mouseMoveEvent(){this.handler.setInputAction((t=>{if(!this.isMeasure)return;if(2==this.positions.length)return this.tempPositions=[...this.positions],this.group.resultLabel.position=this.getCenterPosition(),this.group.resultLabel.label.text="\u9ad8\u5ea6\u5dee"+this.getHeightByPoints(this.positions)+"\u7c73",void this.measureEnd();this.viewer._element.style.cursor="default";let i=this.viewer.scene.pickPosition(t.endPosition);i||(i=this.viewer.scene.camera.pickEllipsoid(t.startPosition,this.viewer.scene.globe.ellipsoid)),i&&this.handleMoveEvent(i);}),t.ScreenSpaceEventType.MOUSE_MOVE);}handleMoveEvent(t){1>this.positions.length||(this.tempPositions=this.positions.concat(t),2>this.tempPositions.length||this.group?.resultLabel||this.createResultLabel());}createResultLabel(){const i=this.options.label,e=this.group.id,s=this.viewer.entities.add({position:new t.CallbackProperty((t=>this.getCenterPosition()),false),type:"MeasureHeightResult",label:{text:new t.CallbackProperty((t=>{const i=this.list.get(e);return i?this.isMeasure&&this.group&&this.group.id===e&&this.tempPositions&&this.tempPositions.length>0?"\u9ad8\u5ea6\u5dee"+this.getHeightByPoints(this.tempPositions)+"\u7c73":i.positions&&i.positions.length>0?"\u9ad8\u5ea6\u5dee"+this.getHeightByPoints(i.positions)+"\u7c73":"\u9ad8\u5ea6\u5dee0.00\u7c73":"\u9ad8\u5ea6\u5dee0.00\u7c73"}),false),scale:i.scale,font:i.font,distanceDisplayCondition:new t.DistanceDisplayCondition(i.distanceDisplayCondition[0],i.distanceDisplayCondition[1]),verticalOrigin:t.VerticalOrigin[i.verticalOrigin],style:i.style,pixelOffset:new t.Cartesian2(i.pixelOffset[0],i.pixelOffset[1]),outlineWidth:i.outlineWidth,outlineColor:t.Color.fromCssColorString(i.outlineColor),fillColor:t.Color.fromCssColorString(i.fillColor),eyeOffset:new t.Cartesian3(i.eyeOffset[0],i.eyeOffset[1],i.eyeOffset[2]),showBackground:i.showBackground,backgroundColor:t.Color.fromCssColorString(i.backgroundColor),backgroundPadding:new t.Cartesian2(i.backgroundPadding[0],i.backgroundPadding[1]),disableDepthTestDistance:1/0}});this.group&&(this.group.resultLabel=s);}unifiedHeight(i,e){let s;e||(e=this.getPositionHeight(i[0]));for(let o=0;i.length>o;o++){s=this.cartesian3ToPoint3D(i[o]),i[o]=t.Cartesian3.fromDegrees(s.x,s.y,e);}return e}getPositionHeight(i){return t.Cartographic.fromCartesian(i).height}getCenterPosition(){let i=[];if(2>this.tempPositions.length)return this.tempPositions[0];this.tempPositions.forEach((t=>{const e=this.cartesian3ToPoint3D(t);i.push([e.x,e.y]);}));let e=Et.point(i[0]),s=Et.point(i[1]),o=Et.midpoint(e,s);return t.Cartesian3.fromDegrees(o.geometry.coordinates[0],o.geometry.coordinates[1],Pt(this.tempPositions[0])+this.getHeightByPoints(this.tempPositions)/2)}createVertex(){const i=this.options.vertex;let e=this.viewer.entities.add({position:this.positions[this.positions.length-1],type:"MeasureHeightVertex",point:{depthTest:i.depthTest,color:t.Color.fromCssColorString(i.color),pixelSize:i.pixelSize,disableDepthTestDistance:i.disableDepthTestDistance}});e.depthTest=i.depthTest,this.group&&this.group.vertexEntities.push(e);}cartesian3ToPoint3D(i){const e=t.Cartographic.fromCartesian(i);return {x:t.Math.toDegrees(e.longitude),y:t.Math.toDegrees(e.latitude),z:e.height}}rightClickEvent(){this.handler.setInputAction((i=>{if(this.isMeasure)if(0!==this.positions.length){if(1===this.positions.length){let e=this.viewer.scene.pickPosition(i.position);if(!e){e=this.viewer.scene.camera.pickEllipsoid(i.position,this.viewer.scene.globe.ellipsoid);}if(!t.defined(e))return void this.deactive();this.positions.push(e),this.height=this.unifiedHeight(this.positions,this.height),this.createVertex();}this.tempPositions=[...this.positions],this.group.resultLabel||this.createResultLabel(),this.group.resultLabel.position=this.getCenterPosition(),this.group.resultLabel.label.text="\u9ad8\u5ea6\u5dee"+this.getHeightByPoints(this.positions)+"\u7c73",this.measureEnd();}else this.isContinuous?(this.discardCurrentMeasurement(),this.createGroup()):this.deactive();}),t.ScreenSpaceEventType.RIGHT_CLICK);}getHeightByPoints(t){return 2>t.length?0:(Pt(t[1])-Pt(t[0])).toFixed(2)}measureEnd(){this.MeasureEndEvent.raiseEvent(this.measureArea),this.isContinuous?this.startNewMeasurement():this.deactivate();}startNewMeasurement(){this.group&&(this.group.positions=[...this.positions],this.tempPositions=[...this.positions]),this.positions=[],this.height=void 0,this.createGroup();}discardCurrentMeasurement(){this.group&&(this.removeGroupEntities(this.group),this.list.delete(this.group.id)),this.positions=[],this.tempPositions=[],this.height=void 0;}deactivate(){this.isMeasure&&(this.group&&(this.group.positions=[...this.positions],this.tempPositions=[...this.positions]),this.unRegisterEvents(),this.viewer._element.style.cursor="pointer",this.viewer.enableCursorStyle=true,this.isMeasure=false,this.isContinuous=false);}stop(){this.isContinuous=false,this.deactivate();}clear(){this.stop(),this.group&&(this.removeGroupEntities(this.group),this.group=null),this.clearAllGroups(),this.tempPositions=[],this.positions=[],this.vertexEntities=[];}generateId(){return Math.random().toString(36).substr(2,9)+"-"+Math.random().toString(36).substr(2,4)+"-"+Math.random().toString(36).substr(2,4)+"-"+Math.random().toString(36).substr(2,4)+"-"+Math.random().toString(36).substr(2,12)}removeGroupById(t){const i=this.list.get(t);return !!i&&(this.removeGroupEntities(i),this.list.delete(t),true)}removeGroupEntities(t){t.polygonEntity&&this.viewer.entities.remove(t.polygonEntity),t.vertexEntities&&t.vertexEntities.forEach((t=>{this.viewer.entities.remove(t);})),t.resultLabel&&this.viewer.entities.remove(t.resultLabel);}clearAllGroups(){this.list.forEach((t=>{this.removeGroupEntities(t);})),this.list.clear();}getAllGroupIds(){return Array.from(this.list.keys())}getGroupById(t){return this.list.get(t)}getGroupCount(){return this.list.size}getData(){return {...this.options,positions:this.positions,id:this.group?this.group.id:null}}}const Ht={label:{scale:.5,font:"32px sans-serif",distanceDisplayCondition:[0,5e4],verticalOrigin:"BOTTOM",style:t.LabelStyle.FILL_AND_OUTLINE,pixelOffset:[0,-10],outlineWidth:2,outlineColor:"#000000",fillColor:"#00FFFF",eyeOffset:[0,0,-10],showBackground:true,backgroundColor:"rgba(0,0,0,1))",backgroundPadding:[10,7],zIndex:1e3},point:{depthTest:false,color:"#FFFF00",pixelSize:8,disableDepthTestDistance:1/0,outlineColor:"#FFFFFF",outlineWidth:2}};class Vt{constructor(t){this.list=new Map,this.isMeasure=false,this.isContinuous=false,this.viewer=t,this.positions=[],this.tempPositions=[],this.initEvents(),this.group=null,this.options=Ht;}createGroup(){this.group={id:this.generateId(),positions:[],pointEntities:[],labelEntity:null},this.list.set(this.group.id,this.group);}initEvents(){this.handler=new t.ScreenSpaceEventHandler(this.viewer.scene.canvas),this.PointClickEvent=new t.Event;}active(t={}){this.isMeasure||(this.isContinuous=t.isContinuous||false,this.createGroup(),this.registerEvents(),this.isMeasure=true,this.options=Object.assign(this.options,t));}deactive(){this.isMeasure&&(this.isMeasure=false,this.isContinuous=false,this.unRegisterEvents());}unRegisterEvents(){this.handler.removeInputAction(t.ScreenSpaceEventType.LEFT_CLICK);}registerEvents(){this.leftClickEvent();}leftClickEvent(){this.handler.setInputAction((i=>{this.viewer._element.style.cursor="default";let e=this.viewer.scene.pickPosition(i.position);if(!e){e=this.viewer.scene.camera.pickEllipsoid(i.position,this.viewer.scene.globe.ellipsoid);}t.defined(e)&&(this.positions.push(e),this.createPointEntity(),this.createLabelEntity(),this.measureEnd());}),t.ScreenSpaceEventType.LEFT_CLICK);}createPointEntity(){const i=this.options.point;let e=this.viewer.entities.add({position:this.positions[this.positions.length-1],point:{color:t.Color.fromCssColorString(i.color),pixelSize:i.pixelSize,disableDepthTestDistance:i.disableDepthTestDistance,outlineColor:t.Color.fromCssColorString(i.outlineColor),outlineWidth:i.outlineWidth}});e.type="MeasurePoint",e.depthTest=i.depthTest,this.group&&this.group.pointEntities.push(e);}createLabelEntity(){const i=this.options.label,e=this.positions[this.positions.length-1],s=t.Cartographic.fromCartesian(e),o=t.Math.toDegrees(s.longitude),n=t.Math.toDegrees(s.latitude),a=s.height,r=`\u7ecf\u5ea6: ${o.toFixed(6)}\n\u7eac\u5ea6: ${n.toFixed(6)}\n\u6d77\u62d4: ${a.toFixed(1)}\u7c73`,l=this.viewer.entities.add({position:e,label:{text:r,scale:i.scale,font:i.font,distanceDisplayCondition:new t.DistanceDisplayCondition(i.distanceDisplayCondition[0],i.distanceDisplayCondition[1]),verticalOrigin:t.VerticalOrigin[i.verticalOrigin],horizontalOrigin:t.HorizontalOrigin[i.horizontalOrigin],style:i.style,pixelOffset:new t.Cartesian2(i.pixelOffset[0],i.pixelOffset[1]),outlineWidth:i.outlineWidth,outlineColor:t.Color.fromCssColorString(i.outlineColor),fillColor:t.Color.fromCssColorString(i.fillColor),showBackground:i.showBackground,backgroundColor:t.Color.fromCssColorString(i.backgroundColor),backgroundPadding:new t.Cartesian2(i.backgroundPadding[0],i.backgroundPadding[1]),disableDepthTestDistance:1/0}});l.type="MeasurePointLabel",this.group&&(this.group.labelEntity=l);}measureEnd(){this.PointClickEvent.raiseEvent(this.getData()),this.isContinuous?this.startNewMeasurement():this.deactive();}startNewMeasurement(){this.positions=[],this.createGroup();}stop(){this.isContinuous=false,this.deactive();}generateId(){return Math.random().toString(36).substr(2,9)+"-"+Math.random().toString(36).substr(2,4)+"-"+Math.random().toString(36).substr(2,4)+"-"+Math.random().toString(36).substr(2,4)+"-"+Math.random().toString(36).substr(2,12)}removeGroupById(t){const i=this.list.get(t);return !!i&&(this.removeGroupEntities(i),this.list.delete(t),true)}removeGroupEntities(t){t.pointEntities&&t.pointEntities.forEach((t=>{this.viewer.entities.remove(t);})),t.labelEntity&&this.viewer.entities.remove(t.labelEntity);}clearAllGroups(){this.list.forEach((t=>{this.removeGroupEntities(t);})),this.list.clear();}getAllGroupIds(){return Array.from(this.list.keys())}getGroupById(t){return this.list.get(t)}getGroupCount(){return this.list.size}getData(){return Object.assign(Object.assign({},this.options),{positions:this.positions,id:this.group?this.group.id:null})}clear(){this.stop(),this.group&&(this.removeGroupEntities(this.group),this.group=null),this.clearAllGroups(),this.positions=[];}}class Wt{constructor(i={}){this._definitionChanged=new t.Event,this._color=t.defaultValue(i.color,new t.Color(1,1,0,1)),this._repeat=t.defaultValue(i.repeat,new t.Cartesian2(1,1)),this._time=(new Date).getTime(),this._image=i.image||"",this.duration=i.duration,this._isPaused=false;}get isConstant(){return false}get definitionChanged(){return this._definitionChanged}get color(){return t.createPropertyDescriptor("color")}set color(t){this._color=t,this._definitionChanged.raiseEvent(this);}getType(i){return t.Material.PolygonFlowLineDiffuseMaterialType}getValue(i,e){return (e=t.defaultValue(e,{})).u_color=this._color,e.image=this._image,e.repeat=this._repeat,e.time=!this._isPaused&&this.duration?((new Date).getTime()-this._time)%this.duration/this.duration:0,e}equals(i){return this===i||i instanceof Wt&&t.Property.equals(this._color,i._color)}togglePause(t){this._isPaused=t,this._isPaused||(this._time=(new Date).getTime());}}t.Material.PolygonFlowLineDiffuseMaterialType||(t.Material.PolygonFlowLineDiffuseMaterialType="PolygonFlowLineDiffuseMaterial"),t.Material.FlowLineDiffuseSource||(t.Material.FlowLineDiffuseSource="\n\tuniform vec4 u_color;\n\tuniform vec2 u_repeat; // \u6dfb\u52a0\u91cd\u590d\u5c5e\u6027\n\tczm_material czm_getMaterial(czm_materialInput materialInput){\n\tczm_material material = czm_getDefaultMaterial(materialInput);\n\t\tvec2 st = materialInput.st;\n\t\t// \u5e94\u7528\u91cd\u590d\u5c5e\u6027\n\t\tst = fract(st * repeat); // \u4f7f\u7528fract\u51fd\u6570\u786e\u4fdd\u7eb9\u7406\u5750\u6807\u5728[0, 1]\u533a\u95f4\u5185\n\n\t\tvec4 colorImage = texture2D(image, vec2(fract(st.s - time), st.t));\n\t\tmaterial.alpha = colorImage.a * u_color.a;\n\t\tmaterial.diffuse = u_color.rgb ;\n\t\treturn material;\n\t}"),t.Material._materialCache.getMaterial(t.Material.PolygonFlowLineDiffuseMaterialType)||t.Material._materialCache.addMaterial(t.Material.PolygonFlowLineDiffuseMaterialType,{fabric:{type:t.Material.PolygonFlowLineDiffuseMaterialType,uniforms:{u_color:t.Color.MEDIUMORCHID,time:0,image:"",transparent:true,repeat:new t.Cartesian2(1,1)},source:t.Material.FlowLineDiffuseSource},translucent:function(t){return true}});class jt{constructor(i={}){this._definitionChanged=new t.Event,this._color=t.defaultValue("string"==typeof i.color?t.Color.fromCssColorString(i.color):i.color,new t.Color(1,1,0,1)),this._time=(new Date).getTime(),this.duration=i.duration,this._isPaused=false;}get isConstant(){return false}get definitionChanged(){return this._definitionChanged}get color(){return t.createPropertyDescriptor("color")}set color(t){this._color=t,this._definitionChanged.raiseEvent(this);}getType(i){return t.Material.PolygonLineDiffuseMaterialType}getValue(i,e){return (e=t.defaultValue(e,{})).u_color=this._color,e.time=!this._isPaused&&this.duration?((new Date).getTime()-this._time)%this.duration/this.duration:0,e}equals(i){return this===i||i instanceof jt&&t.Property.equals(this._color,i._color)}togglePause(t){this._isPaused=t,this._isPaused||(this._time=(new Date).getTime());}}Object.defineProperties(jt.prototype,{color:t.createPropertyDescriptor("color")}),t.Material.PolygonLineDiffuseMaterialType||(t.Material.PolygonLineDiffuseMaterialType="PolygonLineDiffuseMaterialProperty"),t.Material._materialCache.getMaterial(t.Material.PolygonLineDiffuseMaterialType)||t.Material._materialCache.addMaterial(t.Material.PolygonLineDiffuseMaterialType,{fabric:{type:t.Material.PolygonLineDiffuseMaterialType,uniforms:{u_color:t.Color.MEDIUMORCHID,time:0},source:"\n\t\t\tuniform vec4 u_color;\n\t\t\tczm_material czm_getMaterial(czm_materialInput materialInput){\n\t\t\t\tczm_material material = czm_getDefaultMaterial(materialInput);\n\t\t\t\tvec2 st = materialInput.st;\n\t\t\t\tmaterial.diffuse = u_color.rgb * 2.0;\n\t\t\t\tmaterial.alpha = u_color.a * (1.0-fract(st.s - time))*0.5;\n\t\t\t\treturn material;\n\t\t\t}"},translucent:function(t){return true}});class Gt{constructor(t){this.viewer=t;}parsing(t){return Mt(this,void 0,void 0,(function*(){const{url:i,mapUrl:e,width:s=10,duration:o=3e3,show:n=true,distanceDisplayCondition:a=[500,3e3]}=t;if(this.dataSource=yield GeoJsonDataSource.load(i),this.dataSource)return this.viewer.dataSources.add(this.dataSource),this.dataSource.entities.values.forEach((t=>{t.polyline.width=s,t.polyline.material=e?new Wt({image:e,clampToGround:true,duration:o}):new jt({color:new Color(6/255,180/255,178/255,1),clampToGround:true}),a&&(t.polyline.distanceDisplayCondition=new DistanceDisplayCondition(a[0],a[1])),t.name&&(t.label={text:t.name,pixelOffset:new Cartesian2(0,-30),scale:10,horizontalOrigin:HorizontalOrigin.CENTER,verticalOrigin:VerticalOrigin.CENTER,showBackground:true,show:n}),t.show=n;})),this.dataSource}))}clear(){var t,i;this.dataSource&&(this.dataSource.clustering.destroy(),this.dataSource.entities.removeAll(),null===(t=this.viewer.dataSources)||void 0===t||t.remove(this.dataSource),null===(i=this.viewer.dataSources)||void 0===i||i.removeAll());}}class Bt extends CustomDataSource{constructor(t){super(),this.viewer=t;}parsing(t){return Mt(this,void 0,void 0,(function*(){const{url:i,show:e=true,distanceDisplayCondition:s=[0,4e3]}=t;if(this.dataSource=yield GeoJsonDataSource.load(i,{stroke:Color.fromCssColorString("#27E31E"),strokeWidth:5,clampToGround:true}),this.dataSource)return this.viewer.dataSources.add(this.dataSource),this.dataSource.entities.values.forEach((t=>{t.billboard&&(t.billboard.show=false),t.name?(t.heightReference=HeightReference.CLAMP_TO_GROUND,t.label={text:t.name,pixelOffset:new Cartesian2(0,-20),color:Color.BLACK,scale:.4,horizontalOrigin:HorizontalOrigin.CENTER,verticalOrigin:VerticalOrigin.CENTER,heightReference:HeightReference.CLAMP_TO_GROUND,distanceDisplayCondition:new DistanceDisplayCondition(s[0],s[1])}):(this.viewer.entities.remove(t.billboard),this.viewer.entities.remove(t)),t.show=e;})),this.dataSource}))}clear(){var t,i;this.dataSource&&(this.dataSource.clustering.destroy(),this.dataSource.entities.removeAll(),null===(t=this.viewer.dataSources)||void 0===t||t.remove(this.dataSource),null===(i=this.viewer.dataSources)||void 0===i||i.removeAll());}}class Zt{constructor(t){this.viewer=t;}parsing(t){return Mt(this,void 0,void 0,(function*(){const{url:i,width:e=2,duration:s=3e3,color:o=new Color(6/255,180/255,178/255,1),show:n=true,distanceDisplayCondition:a=[5e4,188e5]}=t;this.dataSource=yield GeoJsonDataSource.load(i);const r=new jt({color:o instanceof Color?o:Color.fromCssColorString(o),duration:s});return this.dataSource&&(this.viewer.dataSources.add(this.dataSource),this.dataSource.entities.values.forEach((t=>{t.polyline.width=e,t.polyline.material=r;}))),this.dataSource}))}clear(){var t,i;this.dataSource&&(this.dataSource.clustering.destroy(),this.dataSource.entities.removeAll(),null===(t=this.viewer.dataSources)||void 0===t||t.remove(this.dataSource),null===(i=this.viewer.dataSources)||void 0===i||i.removeAll());}getData(){var t;return null===(t=this.dataSource)||void 0===t?void 0:t.options}}const Nt=t=>{if(!t||1>t.length)return;let i=0,e=0,s=0;for(let o=0;t.length>o;o+=3)i+=t[o],e+=t[o+1],s+=t[o+2];return [i/(t.length/3),e/(t.length/3),s/(t.length/3)]},Ut=(t,i=false)=>qt(t,i),qt=(t,i=false)=>{if(!t||1>t.length)return;let e=0,s=0,o=0;t.forEach((t=>{Array.isArray(t)?(e+=t[0],s+=t[1],o+=t[2]):t instanceof Cartesian3&&(e+=t.x,s+=t.y,o+=t.z);}));let n=e/t.length,a=s/t.length,l=o/t.length;return i?[n,a,l]:new Cartesian3(n,a,l)},$t=t=>{if(!t)return [];let i=[];return t.length&&t.forEach((t=>{t&&i.push([t.x,t.y,t.z]);})),i&&i},Yt=t=>{let i=[];if(3<t.length)for(let e=0;t.length>e;e+=3)i.push([t[e],t[e+1],t[e+2]]);else i.push([...t]);return i&&i},Kt={name:"",url:"",width:64,height:64,scale:.5,dispose:false};let Xt=class{constructor(t,i){this.viewer=t,this.options=Object.assign({},Kt,i),this.options.id||(this.options.id=createGuid());}add(){}update(t){return this.options=Object.assign({},this.options,t),t.remove||t.dispose?(this.dispose(),null):this.options}getData(){if(!this.options)return null;let t=Object.assign(Object.assign({},this.options),{id:this.options.id,name:this.options.name,type:this.options.type,dispose:false,show:this.options.show,opacity:this.options.opacity,alpha:this.options.opacity});for(const i in this.options) void 0!==this.options[i]&&this.options[i]instanceof Color&&(t[i]=this.options[i].toCssHexString());return void 0===this.options.url&&void 0===this.options.uri||(t.url=this.options.url||this.options.uri),void 0!==this.options.center&&(t.center=this.options.center,t.lonlat=this.options.center),void 0!==this.options.position&&(t.position=this.options.position),void 0!==this.options.scale&&(t.scale=this.options.scale),void 0!==this.options.rotation&&(t.rotation=this.options.rotation),void 0!==this.options.height&&(t.height=this.options.height),void 0!==this.options.area&&(t.blockArea=this.options.area),void 0!==this.options.viewConfig&&(t.viewConfig=this.options.viewConfig),void 0!==this.options.showStartIcon&&(t.showStartIcon=this.options.showStartIcon),void 0!==this.options.showEndIcon&&(t.showEndIcon=this.options.showEndIcon),void 0!==this.options.showTrackIcon&&(t.showTrackIcon=this.options.showTrackIcon),void 0!==this.options.currentLonlat&&(t.currentLonlat=this.options.currentLonlat),void 0!==this.options.radius&&(t.radius=this.options.radius),void 0!==this.options.eyeOffset&&(t.eyeOffset={x:this.options.eyeOffset.x,y:this.options.eyeOffset.y,z:this.options.eyeOffset.z}),void 0!==this.options.pixelOffset&&(t.pixelOffset={x:this.options.pixelOffset.x,y:this.options.pixelOffset.y}),void 0!==this.options.depthOffset&&(t.depthOffset={x:this.options.depthOffset.x,y:this.options.depthOffset.y}),void 0!==this.options.shadows&&(t.shadows=this.options.shadows),void 0!==this.options.clampToGround&&(t.clampToGround=this.options.clampToGround),void 0!==this.options.pauseAnimation&&(t.pauseAnimation=this.options.pauseAnimation),t}updateCenter(t){if(1>t.length)return;let i;return i="object"==typeof t?Nt(t):this.getCenter(this.options.positions),this.update(i instanceof Cartesian3?{center:[i.x,i.y,i.z]}:{center:i}),i}getCenter(t,i=false){return Ut(t,i)}dispose(){var t;this.dataSource&&(this.dataSource instanceof GeoJsonDataSource&&(this.dataSource.entities.removeAll(),null===(t=this.viewer)||void 0===t||t.dataSources.remove(this.dataSource,true)),this.options=null,this.dataSource=null,this.userData=null,this.viewer=null);}remove(){return this.dispose()}};const Jt={flyTo:true,call:()=>{},color:"#00ffff",markerColor:"#00ffff",stroke:"#00ffff",fill:"#00ffff",strokeWidth:3,clampToGround:true,distanceDisplayCondition:[0,4e3],show:true,showNameLabel:false,heightReference:HeightReference.CLAMP_TO_GROUND,opacity:1};class Qt extends Xt{constructor(t,i){super(t,i),this.viewer=t,this.options=Object.assign(Object.assign(Object.assign({},this.options),Jt),i);}add(){return Mt(this,void 0,void 0,(function*(){const{url:t}=this.options;try{"string"==typeof this.options.fill&&(this.options.fill=Color.fromCssColorString(this.options.fill).withAlpha(.5)),"string"==typeof this.options.stroke&&(this.options.stroke=Color.fromCssColorString(this.options.stroke).withAlpha(.85)),"string"==typeof this.options.markerColor&&(this.options.markerColor=Color.fromCssColorString(this.options.markerColor).withAlpha(this.options.opacity));const i=yield GeoJsonDataSource.load(t,this.options);if(this.dataSource=i,!i)return;this.viewer.dataSources.add(i);const e=i.entities.values;if(e.length>0)for(let t=0;e.length>t;t++){const i=e[t];i.clampToGround=HeightReference.CLAMP_TO_GROUND,i.billboard&&(i.billboard.image=this.createCanvas(),i.billboard.color=this.options.markerColor,i.billboard.pixelOffset=new Cartesian2(0,-1),i.billboard.depthOffset=new Cartesian2(0,10),i.billboard.disableDepthTestDistance=1/0,i.billboard.heightReference=HeightReference.CLAMP_TO_GROUND,i.billboard.eyeOffset=new Cartesian3(0,0,-1),i.name&&this.options.showNameLabel&&(i.label={text:i.name,color:Color.BLACK,horizontalOrigin:HorizontalOrigin.CENTER,verticalOrigin:VerticalOrigin.BOTTOM,pixelOffset:new Cartesian2(0,-20),depthOffset:new Cartesian2(0,11),scale:.4,heightReference:HeightReference.CLAMP_TO_GROUND,distanceDisplayCondition:new DistanceDisplayCondition(0,2e3),disableDepthTestDistance:1e4}));}i.options=this.options,this.options.flyTo&&this.viewer.flyTo(i),this.options.name&&(i.name=this.options.name);}catch(t){return}}))}createCanvas(){const t=document.createElement("canvas");t.width=16,t.height=16;const i=t.getContext("2d");return i.beginPath(),i.arc(8,8,8,0,2*Math.PI,true),i.closePath(),i.fillStyle="rgb(255, 255, 255)",i.fill(),t}getInfo(){return this.getData()}getData(){return Object.assign(Object.assign({},this.options),super.getData())}update(t){var i,e,s,o,n,a,r;if(this.dataSource){if(super.update(t),void 0!==t.show&&(this.dataSource.show=t.show),void 0!==t.opacity){const e=t.opacity,s=this.options.color instanceof Color?this.options.color:Color.fromCssColorString(this.options.color);null===(i=this.dataSource.entities.values)||void 0===i||i.forEach((t=>{t.billboard&&(t.billboard.color=s.withAlpha(e)),t.polyline&&(t.polyline.material.color=s.withAlpha(e)),t.polygon&&(t.polygon.material.color=s.withAlpha(e));}));}if(void 0!==t.color){const i=t.color instanceof Color?t.color:Color.fromCssColorString(t.color),s=this.options.opacity;null===(e=this.dataSource.entities.values)||void 0===e||e.forEach((t=>{t.billboard&&(t.billboard.color=i.withAlpha(s)),t.polyline&&(t.polyline.material=i.withAlpha(s)),t.polygon&&(t.polygon.material=i.withAlpha(s));}));}if(void 0!==t.markerColor){const i=Color.fromCssColorString(t.markerColor);null===(s=this.dataSource.entities.values)||void 0===s||s.forEach((t=>{t.billboard.color=i;}));}if(void 0!==t.stroke){const t=this.options.stroke instanceof Color?this.options.stroke:Color.fromCssColorString(this.options.stroke);null===(o=this.dataSource.entities.values)||void 0===o||o.forEach((i=>{i.polyline&&(i.polyline.material.color=t.withAlpha(this.options.opacity)),i.polygon&&(i.polygon.material.color=t.withAlpha(this.options.opacity));}));}if(void 0!==t.fill){const t=this.options.fill instanceof Color?this.options.fill:Color.fromCssColorString(this.options.fill);null===(n=this.dataSource.entities.values)||void 0===n||n.forEach((i=>{i.polygon&&(i.polygon.material.color=t.withAlpha(this.options.opacity));}));} void 0!==t.strokeWidth&&(null===(a=this.dataSource.entities.values)||void 0===a||a.forEach((i=>{i.polyline&&(i.polyline.width=t.strokeWidth);}))),void 0!==t.showNameLabel&&(null===(r=this.dataSource.entities.values)||void 0===r||r.forEach((i=>{i.label&&(i.label.show=t.showNameLabel);})));}}}class ti{constructor(t){this.datasourcesList=new Map,this.viewer=t,this.road=new Gt(t),this.label=new Bt(t),this.boundary=new Zt(t);}ensureDepthTestSettings(){this.viewer.terrainProvider&&"EllipsoidTerrainProvider"===this.viewer.terrainProvider.constructor.name&&(this.viewer.scene.globe.depthTestAgainstTerrain=false);}parsing(t){return Mt(this,arguments,void 0,(function*(t,i=false){const{road:e,label:s,boundary:o}=t;i||(e&&(yield this.road.parsing(e)),o&&(yield this.boundary.parsing(o))),s&&(yield this.label.parsing(s));}))}parseGeoJson(t,i){return Mt(this,void 0,void 0,(function*(){try{if(null==i?void 0:i.polygonType){const t=Object.assign({},Jt,i);let e;switch(null==t?void 0:t.polygonType){case "Road":e=yield this.road.parsing(t);break;case "label":e=yield this.label.parsing(t);break;case "Boundary":e=yield this.boundary.parsing(t);}if(!e)return;return t.flyTo&&this.viewer.flyTo(e),t.name&&(e.name=t.name),e.options=t,e}{const t=new Qt(this.viewer,Object.assign(Object.assign({},i),{clampToGround:!0,heightReference:HeightReference.CLAMP_TO_GROUND}));return yield t.add(),this.datasourcesList.set(t.options.id,t),t}}catch(t){return}}))}dispose(){var t,i,e;null===(t=this.boundary)||void 0===t||t.clear(),null===(i=this.road)||void 0===i||i.clear(),null===(e=this.label)||void 0===e||e.clear(),this.viewer.dataSources.removeAll(true);}hasDataSourceById(t){return this.datasourcesList.has(t)}getDataSourceInfoById(t){if(this.datasourcesList.has(t)){const i=this.datasourcesList.get(t);return (null==i?void 0:i.getData)?i.getData():null==i?void 0:i.options}return null}updateDataSourceById(t,i){if(this.datasourcesList.has(t)){const e=this.datasourcesList.get(t);null==e||e.update(i);}}showDataLayerByName(t,i=true){var e;const s=null===(e=this.viewer.dataSources)||void 0===e?void 0:e.getByName(t);s&&Array.isArray(s)&&s.length&&s.forEach((t=>{t.show=i;}));}removeDataLayerByName(t){var i;const e=null===(i=this.viewer.dataSources)||void 0===i?void 0:i.getByName(t);e&&Array.isArray(e)&&e.length&&e.forEach((t=>{t.entities.removeAll(),this.viewer.dataSources.remove(t,true);}));}flyToDataLayerByName(t){var i;const e=null===(i=this.viewer.dataSources)||void 0===i?void 0:i.getByName(t);e&&Array.isArray(e)&&e.length&&e.forEach((t=>{this.viewer.flyTo(t);}));}updateDataSourceInfo(t,i){var e;const s=null===(e=this.viewer.dataSources)||void 0===e?void 0:e.getByName(t);s&&Array.isArray(s)&&s.length&&s.forEach((t=>{t.options=i;}));}flyToDataSourceById(t){const i=this.datasourcesList.get(t);i&&this.viewer.flyTo(i.dataSource);}refreshAllDataSources(){this.viewer.scene.requestRender();}}class ii{constructor(i={}){this._definitionChanged=new t.Event,this._color=t.defaultValue(i.color,new t.Color(1,1,0,1)),this._time=(new Date).getTime(),this.duration=i.duration,this._isPaused=false;}get isConstant(){return false}get definitionChanged(){return this._definitionChanged}get color(){return t.createPropertyDescriptor("color")}set color(t){this._color=t,this._definitionChanged.raiseEvent(this);}getType(i){return t.Material.WallDiffuseMaterialType}getValue(i,e){return (e=t.defaultValue(e,{})).u_color=this._color,e.time=!this._isPaused&&this.duration?((new Date).getTime()-this._time)%this.duration/this.duration:0,e}equals(i){return this===i||i instanceof ii&&t.Property.equals(this._color,i._color)}togglePause(t){this._isPaused=t,this._isPaused||(this._time=(new Date).getTime());}}Object.defineProperties(ii.prototype,{color:t.createPropertyDescriptor("color")}),t.Material.WallDiffuseMaterialType||(t.Material.WallDiffuseMaterialType="WallDiffuseMaterialProperty"),t.Material._materialCache.getMaterial(t.Material.WallDiffuseMaterialType)||t.Material._materialCache.addMaterial(t.Material.WallDiffuseMaterialType,{fabric:{type:t.Material.WallDiffuseMaterialType,uniforms:{u_color:t.Color.MEDIUMORCHID,time:0},source:"\n\t\t\tuniform vec4 u_color;\n\t\t\tczm_material czm_getMaterial(czm_materialInput materialInput){\n\t\t\t\tczm_material material = czm_getDefaultMaterial(materialInput);\n\t\t\t\tvec2 st = materialInput.st;\n\t\t\t\tmaterial.diffuse = u_color.rgb * 2.0;\n\t\t\t\t// material.alpha = color.a * (1.0 - fract(st.t)) * 0.8;\n\t\t\t\tmaterial.alpha = u_color.a * (1.0-fract(st.t - time))*0.5;\n\t\t\t\treturn material;\n\t\t\t}"},translucent:function(t){return true}});let ei=class{constructor(t){this.option=null,this.parentPosition={x:0,y:0},this.initOption={name:"info",offset:{x:0,y:0},opacity:1,innerHTML:"<h1>\u4fe1\u606f\u7a97\u53e3</h1>",component:null,zIndex:"",placement:"top"},this.showed=true,this.option=Object.assign(Object.assign({},this.initOption),t),this.eventListeners=[],this.imgElement=null;}_setOption(t){this.option=Object.assign(Object.assign({},this.option),t),this._update();}_addTo(t){var i;this.viewer=t,this.instance=this._setInstance(),null===(i=this.viewer)||void 0===i||i.container.appendChild(this.instance),this._update();}_setInstance(){var t,i,e,s,o,n,a,r,l,h,d,c;const u=document.createElement("div");if(u.className="infoWindow-wrapper "+(null===(t=this.option)||void 0===t?void 0:t.name),u.innerHTML=null===(i=this.option)||void 0===i?void 0:i.innerHTML,u.style.position="absolute",u.style.left="0px",u.style.top="0px",this.imgElement=u.querySelector("img"),this.imgElement&&((null===(e=this.option)||void 0===e?void 0:e.imgWidth)&&(this.imgElement.style.width=null===(s=this.option)||void 0===s?void 0:s.imgWidth),(null===(o=this.option)||void 0===o?void 0:o.imgHeight)&&(this.imgElement.style.height=null===(n=this.option)||void 0===n?void 0:n.imgHeight)),null===(a=this.option)||void 0===a?void 0:a.onClick){const t=null===(r=this.option)||void 0===r?void 0:r.onClick.bind(this);u.addEventListener("click",t),this.eventListeners.push({type:"click",listener:t});}if(null===(l=this.option)||void 0===l?void 0:l.onMouseEnter){const t=null===(h=this.option)||void 0===h?void 0:h.onMouseEnter.bind(this);u.addEventListener("mouseenter",t),this.eventListeners.push({type:"mouseenter",listener:t});}if(null===(d=this.option)||void 0===d?void 0:d.onMouseLeave){const t=null===(c=this.option)||void 0===c?void 0:c.onMouseLeave.bind(this);u.addEventListener("mouseleave",t),this.eventListeners.push({type:"mouseleave",listener:t});}return u.addEventListener("contextmenu",(t=>(t.preventDefault(),false)),{once:true}),u}getInstance(){return this.instance}_setPosition(t){this.parentPosition=t.position,t.offset&&this.option&&(this.option.offset=t.offset),this._update();}_update(){var t,i,e,s,o,n,a,r,l,h,d,c,u,p,m;if(this.instance&&(this.instance.style.zIndex=(null===(t=this.option)||void 0===t?void 0:t.zIndex)||"",this.instance.style.display=this.showed?"":"none",this.instance.style.opacity=null===(i=this.option)||void 0===i?void 0:i.opacity,this.imgElement&&((null===(e=this.option)||void 0===e?void 0:e.imgWidth)&&(this.imgElement.style.width=null===(s=this.option)||void 0===s?void 0:s.imgWidth),(null===(o=this.option)||void 0===o?void 0:o.imgHeight)&&(this.imgElement.style.height=null===(n=this.option)||void 0===n?void 0:n.imgHeight)),void 0!==(null===(a=this.option)||void 0===a?void 0:a.pointerEvents)&&(this.instance.style.pointerEvents=null===(r=this.option)||void 0===r?void 0:r.pointerEvents),void 0!==(null===(l=this.option)||void 0===l?void 0:l.userSelect)&&(this.instance.style.userSelect=null===(h=this.option)||void 0===h?void 0:h.userSelect),this.option)){const t=(null===(d=this.option)||void 0===d?void 0:d.placement)||"top",i=this.instance.offsetWidth,e=this.instance.offsetHeight,s=(null===(u=null===(c=this.option)||void 0===c?void 0:c.offset)||void 0===u?void 0:u.x)||0,o=(null===(m=null===(p=this.option)||void 0===p?void 0:p.offset)||void 0===m?void 0:m.y)||0;let n,a;switch(t){case "bottom":n=this.parentPosition.x-i/2+s,a=this.parentPosition.y+o;break;case "left":n=this.parentPosition.x-i+s,a=this.parentPosition.y-e/2+o;break;case "right":n=this.parentPosition.x+s,a=this.parentPosition.y-e/2+o;break;default:n=this.parentPosition.x-i/2+s,a=this.parentPosition.y-e+o;}this.instance.style.transform=`translate(${n}px, ${a}px)`;}}isShowed(){return this.showed}_show(){this.showed=true,this._update();}_hide(){this.showed=false,this._update();}_remove(){this.instance&&(this.viewer=null,this.eventListeners.forEach((({type:t,listener:i})=>{var e;null===(e=this.instance)||void 0===e||e.removeEventListener(t,i);})),this.eventListeners=[],this.instance.remove(),this.instance.parentNode&&this.instance.parentNode.removeChild(this.instance)),this.instance=null,this.imgElement=null,this.initOption=null,this.parentPosition=null,this.option=null;}setZindex(t){this.option&&(this.option.zIndex=t,this._update());}};const si=new Set(["billboard","model","waterwave","textmask","circlegradient","polyverticalline"]),oi=new Set(["polyline","polyline2","polylinepath","polygonflowline","polygonarrowline","polygontrackline"]);function ni(t,i){const e=[];for(const s of t)e.push(s[0],s[1],i);return e}function ai(t,i){if(3>t.length)return null;const e=Et.point([t[0],t[1]]),s=Et.buffer(e,i.radius,{units:i.units||"kilometers",steps:i.steps||64});if(!s)return null;const o=s.geometry.coordinates[0];return {lonlats:ni(o,t[2]||0),coordinates:o}}function ri(t,i){if(6>t.length)return null;const e=function(t){const i=[];for(let e=0;t.length>e+2;e+=3)i.push([t[e],t[e+1]]);return i}(t);if(2>e.length)return null;const s=Et.lineString(e),o=Et.buffer(s,i.radius,{units:i.units||"kilometers",steps:i.steps||64});if(!o)return null;const n=o.geometry.coordinates[0],a=function(t){let i=0,e=0;for(let s=2;t.length>s;s+=3)i+=t[s],e++;return e>0?i/e:0}(t);return {lonlats:ni(n,a),coordinates:n}}const li="#ffff00",hi=1,di=1.2,ci="#ffff00",ui=1,pi=1.5,mi="#ffff00",gi=.8,fi=4,vi="#ffff00",yi=4,wi=1,Ci="#ffff00",bi=1,Si={color:"#FF6B35",opacity:.3,outlineColor:"#FF6B35",outlineOpacity:.8,outlineWidth:2,clampToGround:true,radius:1,units:"kilometers",steps:64,show:true},Ti={name:"",url:"",dispose:false};class Li{constructor(t,i){this.viewer=null,this.infoWindow=null,this.renderCallback=null,this.isSelect=false,this._bufferEntity=null,this._bufferOptions=null,this._bufferResult=null,this._terrainCenterHeight=null,this._terrainUpdateTimer=null,this._tileLoadHandler=null,this._isConstructing=false,this.viewer=t,this.options=Object.assign({},Ti,i);}add(){return "\u5916\u90e8\u91cd\u8f7d\u5b9e\u73b0"}update(t,i){if(!this.options)return null;if(t.lonlat&&i&&!t.skipUpdateLonlat){this.updateLonlat(t.lonlat,i,t.skipDragControl||false);}else {if(false===t.clampToTerrain&&(t._terrainHeights=null),this.options=Object.assign({},this.options,t),t.dispose)return void this.dispose();const i=this.getData();this.userData=this.entity.userData=Object.assign({},this.userData,i);}return t.remove||t.dispose?(this.dispose(),null):(void 0!==t.select&&(t.select?this.select():this.unSelect()),void 0!==t.unselect&&this.unSelect(),void 0!==t.showBuffer&&(t.showBuffer?this.hasBuffer()||this.createBuffer(this.options.bufferRadius||Si.radius,{radius:this.options.bufferRadius,units:this.options.bufferUnits,color:this.options.bufferColor,opacity:this.options.bufferOpacity}):this.removeBuffer()),void 0!==t.bufferRadius&&this.hasBuffer()&&this.updateBuffer({radius:t.bufferRadius}),void 0!==t.bufferColor&&this.hasBuffer()&&this.updateBuffer({color:t.bufferColor}),void 0!==t.bufferOpacity&&this.hasBuffer()&&this.updateBuffer({opacity:t.bufferOpacity}),void 0!==t.bufferUnits&&this.hasBuffer()&&this.updateBuffer({units:t.bufferUnits}),this.options)}getData(){var t;if(!this.options)return null;this.options.center||!this.options.lonlats&&!this.options.positions||this.applyCenter();let i=Object.assign(Object.assign({},this.options),{id:this.options.id,name:this.options.name,type:null===(t=this.options.type)||void 0===t?void 0:t.toLowerCase(),position:this.getCenter(this.options.positions,true),positions:$t(this.options.positions),lonlat:Nt(this.options.lonlat||this.options.center),lonlats:Yt(this.options.lonlats),dispose:false,show:this.options.show,opacity:this.options.opacity});return void 0!==this.options.color&&(i.color=this.options.color instanceof Color?this.options.color.toCssHexString():this.options.color),void 0!==this.options.outlineColor&&(i.outlineColor=this.options.outlineColor instanceof Color?this.options.outlineColor.toCssHexString():this.options.outlineColor),void 0===this.options.url&&void 0===this.options.uri||(i.url=this.options.url||this.options.uri),void 0!==this.options.center&&(i.center=this.options.center,i.lonlat=this.options.center),void 0!==this.options.position&&(i.position=this.options.position),void 0!==this.options.scale&&(i.scale=this.options.scale),void 0!==this.options.rotation&&(i.rotation=this.options.rotation),void 0!==this.options.height&&(i.height=this.options.height),void 0!==this.options.area&&(i.blockArea=this.options.area),void 0!==this.options.viewConfig&&(i.viewConfig=this.options.viewConfig),void 0!==this.options.showStartIcon&&(i.showStartIcon=this.options.showStartIcon),void 0!==this.options.showEndIcon&&(i.showEndIcon=this.options.showEndIcon),void 0!==this.options.showTrackIcon&&(i.showTrackIcon=this.options.showTrackIcon),void 0!==this.options.currentLonlat&&(i.currentLonlat=this.options.currentLonlat),void 0!==this.options.radius&&(i.radius=this.options.radius),void 0!==this.options.eyeOffset&&(i.eyeOffset={x:this.options.eyeOffset.x,y:this.options.eyeOffset.y,z:this.options.eyeOffset.z}),void 0!==this.options.pixelOffset&&(i.pixelOffset={x:this.options.pixelOffset.x,y:this.options.pixelOffset.y}),void 0!==this.options.depthOffset&&(i.depthOffset={x:this.options.depthOffset.x,y:this.options.depthOffset.y}),void 0!==this.options.shadows&&(i.shadows=this.options.shadows),void 0!==this.options.clampToGround&&(i.clampToGround=this.options.clampToGround),void 0!==this.options.heightReference&&(i.heightReference=this.options.heightReference),void 0!==this.options.classificationType&&(i.classificationType=this.options.classificationType),void 0!==this.options.pauseAnimation&&(i.pauseAnimation=this.options.pauseAnimation),i.call&&delete i.call,i.callback&&delete i.callback,this.hasBuffer()&&(i.showBuffer=true,i.bufferRadius=this._bufferOptions.radius,i.bufferUnits=this._bufferOptions.units,i.bufferColor=this._bufferOptions.color,i.bufferOpacity=this._bufferOptions.opacity),i}updateCenter(t){if(!t||1>t.length)return;let i;return i=t.length>0&&"number"==typeof t[0]?Nt(t):this.getCenter(t),this.update(i instanceof Cartesian3?{center:[i.x,i.y,i.z]}:{center:i}),!this._isConstructing&&this.shouldSyncCenterHeightToTerrain()&&this.refreshCenterHeightFromSceneOrTerrain(),i}applyCenter(){const t=this.updateCenter(this.options.lonlats||this.options.positions);this.options=Object.assign({},this.options,{center:t,lonlat:t}),this._initBufferFromOptions();}getCenter(t,i=false){return Ut(t,i)}shouldSyncCenterHeightToTerrain(){var t;return !!(null===(t=this.options)||void 0===t?void 0:t.clampToTerrain)}setDate(){}_initBufferFromOptions(){var t;(null===(t=this.options)||void 0===t?void 0:t.showBuffer)&&!this.hasBuffer()&&this.createBuffer(this.options.bufferRadius||Si.radius,{radius:this.options.bufferRadius,units:this.options.bufferUnits,color:this.options.bufferColor,opacity:this.options.bufferOpacity});}createBuffer(t,i){var e,s;if(!this.viewer||!(null===(e=this.options)||void 0===e?void 0:e.lonlats))return null;const o=i?Object.fromEntries(Object.entries(i).filter((([t,i])=>void 0!==i))):{};return this._bufferOptions=Object.assign(Object.assign(Object.assign({},Si),o),{radius:t}),this._recomputeBuffer(),this._bufferResult?(this._bufferEntity=this.viewer.entities.add({show:null===(s=this._bufferOptions.show)||void 0===s||s,polygon:{hierarchy:new CallbackProperty((()=>{if(this._bufferResult)return new PolygonHierarchy$1(Cartesian3.fromDegreesArrayHeights(this._bufferResult.lonlats))}),false),material:this.normalizeColor(this._bufferOptions.color,this._bufferOptions.opacity),outline:true,outlineColor:new CallbackProperty((()=>this.normalizeColor(this._bufferOptions.outlineColor,this._bufferOptions.outlineOpacity)),false),outlineWidth:new CallbackProperty((()=>this._bufferOptions.outlineWidth),false),classificationType:ClassificationType$1.BOTH}}),this._bufferEntity):null}_recomputeBuffer(){var t,i;if(this._bufferOptions&&(null===(t=this.options)||void 0===t?void 0:t.lonlats))try{const t=(null===(i=this.options.type)||void 0===i?void 0:i.toLowerCase())||"";this._bufferResult=function(t,i,e){return !t||3>t.length?null:si.has(i)?ai(t,e):oi.has(i)?ri(t,e):3===t.length?ai(t,e):6>t.length?null:ri(t,e)}(this.options.lonlats,t,{radius:this._bufferOptions.radius,units:this._bufferOptions.units,steps:this._bufferOptions.steps});}catch(t){this._bufferResult=null;}}updateBuffer(t){var i;this._bufferEntity&&(t&&(this._bufferOptions=Object.assign(Object.assign({},this._bufferOptions),t)),void 0===(null==t?void 0:t.radius)&&void 0===(null==t?void 0:t.units)&&void 0===(null==t?void 0:t.steps)||this._recomputeBuffer(),void 0===(null==t?void 0:t.color)&&void 0===(null==t?void 0:t.opacity)||(this._bufferEntity.polygon.material=this.normalizeColor(this._bufferOptions.color,this._bufferOptions.opacity)),null===(i=this.viewer)||void 0===i||i.scene.requestRender());}removeBuffer(){this._bufferEntity&&this.viewer&&this.viewer.entities.remove(this._bufferEntity),this._bufferEntity=null,this._bufferOptions=null,this._bufferResult=null;}hasBuffer(){return null!==this._bufferEntity}getBufferData(){return this._bufferOptions&&this._bufferResult?{radius:this._bufferOptions.radius,units:this._bufferOptions.units,steps:this._bufferOptions.steps,color:this._bufferOptions.color,opacity:this._bufferOptions.opacity,outlineColor:this._bufferOptions.outlineColor,outlineOpacity:this._bufferOptions.outlineOpacity,outlineWidth:this._bufferOptions.outlineWidth,bufferLonlats:this._bufferResult.lonlats}:null}dispose(){var t;this.removeInfoWindow(),this.removeBuffer(),this.stopTerrainWatching(),this.entity&&(null===(t=this.viewer)||void 0===t||t.entities.remove(this.entity)),this.options=null,this.entity=null,this.userData=null,this.viewer=null,this.operator=null;}remove(){this.dispose();}updateLonlat(t,i,e=false){this.options=Object.assign({},this.options,((t,i)=>{if(!i)return;const e=t.lonlat;if(!e)return;const s=i[0]-e[0],o=i[1]-e[1],n=i[2]-e[2];if((0!==s||0!==o||0!==n)&&t.lonlats&&t.lonlats.length){let e=[],a=[];for(let i=0;t.lonlats.length>i;i+=3){const l=t.lonlats[i]+s,h=t.lonlats[i+1]+o,d=t.lonlats[i+2]+n;e.push(l,h,d),a.push(Cartesian3.fromDegrees(l,h,d));}const l=Nt(e);return {lonlats:e,positions:a,position:Ut(a,true),lonlat:i,center:l}}})(this.options,t));const s=this.getData();return i.userData=i.entity.userData=Object.assign({},i.userData,s),this.hasBuffer()&&this._recomputeBuffer(),this.operator.hasDragControl()&&!e&&this.operator.handleDragControlClick(this),Object.assign({},s)}addInfoWindow(t={}){var i,e,s;if(this.options.center||this.updateCenter((null===(i=this.options)||void 0===i?void 0:i.lonlats)||(null===(e=this.options)||void 0===e?void 0:e.positions)),!this.infoWindow){const{customInfoWindow:i}=t,e=Dt(t,["customInfoWindow"]),o=this._resolveInfoWindowClass(i);this.infoWindow=new o(Object.assign({},this.options,e)),null===(s=this.infoWindow)||void 0===s||s._addTo(this.viewer),this._registerRenderCallback();}}_resolveInfoWindowClass(t){var i,e,s;return "function"==typeof t?t:t&&"function"==typeof(null==t?void 0:t.constructor)&&t.constructor!==Object?t.constructor:"function"==typeof(null===(i=this.operator)||void 0===i?void 0:i.customInfoWindow)?this.operator.customInfoWindow:(null===(e=this.operator)||void 0===e?void 0:e.customInfoWindow)&&"function"==typeof(null===(s=this.operator.customInfoWindow)||void 0===s?void 0:s.constructor)&&this.operator.customInfoWindow.constructor!==Object?this.operator.customInfoWindow.constructor:ei}updateInfoWindow(t){this.infoWindow&&this.infoWindow._setOption(t);}hasInfoWindow(){return !!this.infoWindow}showInfoWindow(){this.infoWindow&&this.infoWindow._show();}hideInfoWindow(){this.infoWindow&&this.infoWindow._hide();}removeInfoWindow(){this.infoWindow&&(this.infoWindow._remove(),this.infoWindow=null,this._unregisterRenderCallback());}_registerRenderCallback(){this.viewer&&this.infoWindow&&(this.renderCallback&&this._unregisterRenderCallback(),this.renderCallback=this.viewer.scene.postRender.addEventListener((()=>{if(this.entity&&this.infoWindow&&this.viewer&&this.options.center){const t=this.options.scale||1,i=this.getWindowCoordinates(this.getInfoWindowAnchorLonlat());i&&this.infoWindow._setPosition({position:{x:i.x,y:i.y},offset:{x:0,y:this.options.imgHeight?-this.options.imgHeight*t-6:-6}});}})));}_unregisterRenderCallback(){this.renderCallback&&this.viewer&&(this.viewer.scene.postRender.removeEventListener(this.renderCallback),this.renderCallback=null);}getInfoWindowAnchorLonlat(){var t,i,e;const s=null===(t=this.options)||void 0===t?void 0:t.center;if(!Array.isArray(s)||2>s.length)return s;const o=null===(i=this.options)||void 0===i?void 0:i.infoWindowHeightOffset;return "number"==typeof o&&Number.isFinite(o)?[s[0],s[1],(null!==(e=s[2])&&void 0!==e?e:0)+o]:s}getWindowCoordinates(t,i){var e,s;if(!t||!this.viewer)return;let o;if(o=Array.isArray(t)?Cartesian3.fromDegrees(t[0],t[1],null!==(e=null!=i?i:t[2])&&void 0!==e?e:0):Cartesian3.fromDegrees(t.longitude,t.latitude,null!==(s=null!=i?i:t.height)&&void 0!==s?s:0),o){const t=new Cartesian2;return SceneTransforms.wgs84ToWindowCoordinates(this.viewer.scene,o,t)}}flyto(t={}){this.entity&&this.viewer.flyTo(this.entity,t);}rigistOperator(t){this.operator=t;}select(){var t;this.entity&&(this.isSelect=true,null===(t=this.operator)||void 0===t||t._recordHighlight(this));}applySelectVisual(){}unSelect(){var t;this.entity&&(this.isSelect=false,null===(t=this.operator)||void 0===t||t._unRecordHighlight(this));}isTerrainEnabled(){return !(!this.viewer||!this.viewer.terrainProvider)&&"EllipsoidTerrainProvider"!==this.viewer.terrainProvider.constructor.name}getCenterCartographicForSampling(){const t=this.options.center;if(!t||2>t.length)return null;const i=t[1],e=t[2]||0;return new Cartographic(Math$1.toRadians(t[0]),Math$1.toRadians(i),e)}sampleCenterHeightCompatible(){return Mt(this,void 0,void 0,(function*(){var t;if(this._terrainCenterHeight=null,!this.viewer)return;const i=this.getCenterCartographicForSampling();if(!i)return;const e=this.viewer.scene;if(e&&e.mode===SceneMode.SCENE3D&&e.sampleHeightSupported&&"function"==typeof e.sampleHeightMostDetailed)try{const s=yield e.sampleHeightMostDetailed([i]),o=null===(t=null==s?void 0:s[0])||void 0===t?void 0:t.height;if("number"==typeof o&&Number.isFinite(o))return void(this._terrainCenterHeight=o)}catch(t){}yield this.sampleCenterTerrainHeight(i);}))}applySampledCenterHeight(t){var i,e;if(!Number.isFinite(t))return;const s=null===(i=this.options)||void 0===i?void 0:i.center;if(!Array.isArray(s)||2>s.length)return;const o=null!==(e=s[2])&&void 0!==e?e:0;if(.01>Math.abs(t-o))return;const n=[s[0],s[1],t];this.update({center:n,lonlat:n,skipUpdateLonlat:true}),requestAnimationFrame((()=>{var t,i,e;null===(e=null===(i=null===(t=this.viewer)||void 0===t?void 0:t.scene)||void 0===i?void 0:i.requestRender)||void 0===e||e.call(i);}));}refreshCenterHeightFromSceneOrTerrain(){return Mt(this,void 0,void 0,(function*(){if(!this.shouldSyncCenterHeightToTerrain())return null;try{yield this.sampleCenterHeightCompatible(),null!==this._terrainCenterHeight&&this.applySampledCenterHeight(this._terrainCenterHeight);}catch(t){}return this._terrainCenterHeight}))}sampleCenterTerrainHeight(t){return Mt(this,void 0,void 0,(function*(){try{if(!this.viewer)return;const i=t||this.getCenterCartographicForSampling();if(!i)return;if(!this.viewer.terrainProvider)return;if(!this.isTerrainEnabled())return;const e=yield sampleTerrainMostDetailed(this.viewer.terrainProvider,[i]);if(!e||0===e.length)return;this._terrainCenterHeight=e[0].height;}catch(t){}}))}startTerrainWatching(){var t,i;if(!this.shouldSyncCenterHeightToTerrain())return;if(this._tileLoadHandler)return;let e=0;this._tileLoadHandler=t=>{if(0!==t)return;3e3>Date.now()-e||(clearTimeout(this._terrainUpdateTimer),this._terrainUpdateTimer=setTimeout((()=>{this.isTerrainEnabled()?(e=Date.now(),this.sampleCenterTerrainHeight().then((()=>{null!==this._terrainCenterHeight&&this.applySampledCenterHeight(this._terrainCenterHeight);}))):this._terrainCenterHeight=null;}),1e3));},(null===(i=null===(t=this.viewer)||void 0===t?void 0:t.scene)||void 0===i?void 0:i.globe)&&this.viewer.scene.globe.tileLoadProgressEvent.addEventListener(this._tileLoadHandler);}stopTerrainWatching(){this._tileLoadHandler&&this.viewer&&this.viewer.scene.globe&&(this.viewer.scene.globe.tileLoadProgressEvent.removeEventListener(this._tileLoadHandler),this._tileLoadHandler=null),clearTimeout(this._terrainUpdateTimer),this._terrainUpdateTimer=null;}normalizeColor(t,i=1){if("string"==typeof t){return Color.fromCssColorString(t).withAlpha(i)}return t instanceof Color?t.withAlpha(i):Color.YELLOW.withAlpha(i)}}class Ei extends Li{DF={name:"\u81ea\u5b9a\u4e49\u6750\u8d28\u7acb\u4f53\u5899\u6548\u679c",color:"#64b4b2",clampToGround:true,duration:1e3,maximumHeights:100,minimumHeights:0,showCenter:false,showAnimationLine:true,height:100,show:true,opacity:1,pauseAnimation:false,outline:false,outlineColor:"#64b4b2",outlineWidth:2,outlineOpacity:.8,clampToTerrain:false,_terrainHeights:null,_terrainUpdateTimer:null};constructor(t,i){super(t,i),this.options={...this.options,...this.DF,...i},this._isConstructing=true,this.add(),this._isConstructing=false,this.options.clampToTerrain&&this._checkIfLonlatsHasRealHeights()&&this._initTerrainHeightsFromLonlats(),this.options.clampToTerrain&&this.isTerrainEnabled()||this._setCenterHeightForFlatMode(),this.options.clampToTerrain&&Promise.resolve().then((()=>{this.refreshWallHeightsAndCenter().catch((t=>{}));}));}async sampleTerrainHeight(){const t=this.options.lonlats||this.options.positions;if(!t||0===t.length)return;let i=[];if(this.options.lonlats)for(let e=0;t.length>e;e+=3)i.push(new Cartographic(Math$1.toRadians(t[e]),Math$1.toRadians(t[e+1]),t[e+2]||0));else i=t.map((t=>Cartographic.fromCartesian(t)));if(0===i.length)return;const e=this.viewer.scene;if(3===e?.mode&&e.sampleHeightSupported&&"function"==typeof e.sampleHeightMostDetailed)try{const t=await e.sampleHeightMostDetailed(i);if(t?.some((t=>Number.isFinite(t.height))))return void(this.options._terrainHeights=t.map((t=>t.height||0)))}catch(t){}if(this.viewer.terrainProvider&&"EllipsoidTerrainProvider"!==this.viewer.terrainProvider.constructor.name)try{const t=await sampleTerrainMostDetailed(this.viewer.terrainProvider,i);t?.length>0&&(this.options._terrainHeights=t.map((t=>t.height)));}catch(t){this._checkIfLonlatsHasRealHeights()&&this._initTerrainHeightsFromLonlats();}}async refreshWallHeightsAndCenter(){this.options.clampToTerrain&&this.isTerrainEnabled()&&await this.sampleTerrainHeight(),this.entity?.wall&&(this.entity.wall.dirty=true),await this.refreshCenterHeightFromSceneOrTerrain(),this.viewer?.scene?.requestRender?.();}_checkIfLonlatsHasRealHeights(){const t=this.options.lonlats||this.options.positions;if(!t||0===t.length)return false;if(this.options.lonlats){for(let i=2;t.length>i;i+=3){const e=t[i];if("number"==typeof e&&0!==e&&Number.isFinite(e))return true}return false}return !(!this.options.positions||!Array.isArray(this.options.positions))&&this.options.positions.some((t=>!(!t||"number"!=typeof t.z)&&(0!==t.z&&Number.isFinite(t.z))))}_initTerrainHeightsFromLonlats(){const t=this.options.lonlats;if(!t||0===t.length)return;const i=[];for(let e=2;t.length>e;e+=3)i.push(t[e]||0);i.length>0&&(this.options._terrainHeights=i);}_setCenterHeightForFlatMode(){const t=this.options.center;Array.isArray(t)&&t.length>=2&&(this.options.center=[t[0],t[1],.1]);}isTerrainEnabled(){return !(!this.viewer.terrainProvider||"EllipsoidTerrainProvider"===this.viewer.terrainProvider.constructor.name)||this.has3DTilesInScene()}startTerrainWatching(){if(!this.options.clampToTerrain)return;if(this._tileLoadHandler)return;let t=0;this._tileLoadHandler=i=>{if(0!==i)return;3e3>Date.now()-t||(clearTimeout(this.options._terrainUpdateTimer),this.options._terrainUpdateTimer=setTimeout((()=>{(this.isTerrainEnabled()||this.has3DTilesInScene())&&(t=Date.now(),this.refreshWallHeightsAndCenter().catch((t=>{})));}),1e3));},this.viewer&&this.viewer.scene&&this.viewer.scene.globe&&this.viewer.scene.globe.tileLoadProgressEvent.addEventListener(this._tileLoadHandler);}has3DTilesInScene(){const t=this.viewer.scene.primitives;for(let i=0;t.length>i;i++)if("Cesium3DTileset"===t.get(i)?.constructor?.name)return true;return false}stopTerrainWatching(){this._tileLoadHandler&&(this.viewer.scene.globe.tileLoadProgressEvent.removeEventListener(this._tileLoadHandler),this._tileLoadHandler=null),clearTimeout(this.options._terrainUpdateTimer),this.options._terrainUpdateTimer=null;}add(){if(this.entity)return this;try{this.material=new ii({color:Color.fromAlpha("string"==typeof this.options.color?Color.fromCssColorString(this.options.color):this.options.color,this.options.opacity),duration:this.options.duration}),this.entity=this.viewer.entities.add({name:new CallbackProperty((()=>this.options.name),!1),id:this.options.id&&this.options.id,show:new CallbackProperty((()=>this.options.show),!1),wall:{positions:new CallbackProperty((()=>this.options?.lonlats?Cartesian3.fromDegreesArrayHeights(this.options.lonlats):this.options.positions),!1),maximumHeights:new CallbackProperty((()=>{const t=(this.options?.lonlats?Cartesian3.fromDegreesArrayHeights(this.options.lonlats):this.options.positions).length;return this.options.clampToTerrain&&this.options._terrainHeights?this.options._terrainHeights.map((t=>t+this.options.height)):Array(t).fill(this.options.height)}),!1),minimumHeights:new CallbackProperty((()=>{const t=this.options?.lonlats?Cartesian3.fromDegreesArrayHeights(this.options.lonlats):this.options.positions;return this.options.clampToTerrain&&this.options._terrainHeights?this.options._terrainHeights:Array(t.length).fill(this.options.minimumHeights)}),!1),material:this.material,outline:new CallbackProperty((()=>this.options.outline),!1),outlineColor:new CallbackProperty((()=>this.normalizeColor(this.options.outlineColor,this.options.outlineOpacity)),!1),outlineWidth:new CallbackProperty((()=>this.options.outlineWidth),!1)}});try{const t=this.options.lonlats?this.options.lonlats:this.options.positions;if(!t||0===t.length)return this;let i=this.updateCenter(t);if(!i)return this;this.options.clampToTerrain||!Array.isArray(i)||2>i.length||(i=[i[0],i[1],.1],this.options.center=i),this.options.showCenter&&i&&(Array.isArray(i)?(3>i.length&&(i=[i[0],i[1],i[2]||0]),this.entity.position=Cartesian3.fromDegrees(i[0],i[1],i[2])):this.entity.position=i,this.entity.label={text:new CallbackProperty((t=>"\u4e2d\u5fc3\u4f4d\u7f6e"+(Array.isArray(i)?i.join(","):""+i)),!1),scale:.5,font:"normal 28px MicroSoft YaHei",distanceDisplayCondition:new DistanceDisplayCondition(0,5e3),verticalOrigin:VerticalOrigin.BOTTOM,horizontalOrigin:HorizontalOrigin.CENTER,style:LabelStyle.FILL_AND_OUTLINE,pixelOffset:new Cartesian2(0,-10),outlineWidth:9,outlineColor:Color.YELLOW});}catch(t){}return this.options.showAnimationLine&&(this.entity.polyline={positions:new CallbackProperty((()=>{if(this.options.clampToTerrain&&this.options._terrainHeights&&this.options.lonlats){const t=this.options.lonlats,i=this.options._terrainHeights,e=[];for(let s=0,o=0;t.length>s;s+=3,o++){e.push(t[s]),e.push(t[s+1]);e.push((i.length>o?i[o]:t[s+2]||0)+.3);}return Cartesian3.fromDegreesArrayHeights(e)}return this.options?.lonlats?Cartesian3.fromDegreesArrayHeights(this.options.lonlats):this.options.positions}),!1),width:new CallbackProperty((()=>this.options.outlineWidth),!1),material:new jt({color:this.options.color,duration:this.options.duration})}),this.options.id||(this.options={...this.options,id:this.entity.id}),this.applyCenter(),this}catch(t){}}toggleAnimation(t){this.entity?.wall.material&&this.entity?.wall.material.togglePause(t),this.entity?.polyline&&this.entity?.polyline.material&&this.entity?.polyline.material.togglePause(t),this.options=Object.assign({},this.options,{pauseAnimation:t});}update(t){if(this.options&&this.entity&&(super.update(t,this),!t.remove&&!t.dispose)){if(this.entity?.wall&&(this.entity.show=this.options.show),this.options.showAnimationLine&&this.entity?.polyline&&(this.entity.polyline.show=this.options.show),t.color||t.opacity){const i="string"==typeof this.options.color?Color.fromCssColorString(this.options.color):this.options.color;if(this.entity?.wall&&this.material&&(this.material._color=Color.fromAlpha(i,this.options.opacity)),this.options.showAnimationLine&&this.entity?.polyline&&this.entity?.polyline.material&&(this.entity.polyline.material._color=Color.fromAlpha(i,this.options.opacity)),void 0!==t.height){const i=this.options?.lonlats?Cartesian3.fromDegreesArrayHeights(this.options.lonlats):this.options.positions;this.options.clampToTerrain&&this.options._terrainHeights?(this.entity.wall.maximumHeights=this.options._terrainHeights.map((i=>i+t.height)),this.entity.wall.minimumHeights=this.options._terrainHeights):(this.entity.wall.maximumHeights=Array(i.length).fill(t.height),this.entity.wall.minimumHeights=Array(i.length).fill(this.options.minimumHeights));}}if(void 0!==t.pauseAnimation&&this.toggleAnimation(t.pauseAnimation),this.options.clampToTerrain&&(true===t.clampToTerrain||t.lonlats||t.positions||void 0!==t.height)?this.refreshWallHeightsAndCenter().catch((t=>{})):this.options.clampToTerrain||false!==t.clampToTerrain&&!t.lonlats&&!t.positions||(false===t.clampToTerrain&&(this.options._terrainHeights=null,this.stopTerrainWatching()),this._setCenterHeightForFlatMode(),this.entity?.wall&&(this.entity.wall.dirty=true),this.viewer?.scene?.requestRender?.()),this.updateOutline(t),t.center&&this.entity?.position){const i=t.center;Array.isArray(i)&&i.length>=2&&(this.entity.position=Cartesian3.fromDegrees(i[0],i[1],i[2]||0));}}}updateOutline(t){this.entity?.wall&&(void 0!==t.outline&&(this.entity.wall.outline=t.outline),void 0!==t.outlineColor&&(this.entity.wall.outlineColor=this.normalizeColor(t.outlineColor,t.outlineOpacity||this.options.outlineOpacity)),void 0!==t.outlineWidth&&(this.entity.wall.outlineWidth=t.outlineWidth)),this.entity?.polyline&&this.entity?.polyline?.material&&(void 0!==t.showAnimationLine&&(this.entity.polyline.show=t.showAnimationLine),void 0!==t.outlineWidth&&(this.entity.polyline.width=t.outlineWidth),void 0!==t.outlineColor&&(this.entity.polyline.material._color=this.normalizeColor(t.outlineColor,t.outlineOpacity||this.options.outlineOpacity)),void 0!==t.outlineOpacity&&this.entity.polyline.material._color.withAlpha(t.outlineOpacity),void 0!==t.pauseAnimation&&this.toggleAnimation(t.pauseAnimation));}destroy(){this.stopTerrainWatching(),this.material&&this.material.destroy?.(),super.destroy?.();}select(){this.entity&&(super.select(),this.updateOutline({outline:true,outlineColor:mi,outlineOpacity:gi,outlineWidth:fi}));}unSelect(){this.entity&&(super.unSelect(),this.updateOutline({outline:this.options.outline,outlineColor:this.options.outlineColor,outlineOpacity:this.options.outlineOpacity,outlineWidth:this.options.outlineWidth}));}getInfoWindowAnchorLonlat(){const t=this.options?.center;if(!Array.isArray(t)||2>t.length)return t;const i=this.options?.infoWindowHeightOffset;if("number"==typeof i&&Number.isFinite(i))return [t[0],t[1],(t[2]??0)+i];const e=this.options?.height||0;let s;switch(this.infoWindow?.option?.placement||"top"){case "bottom":s=.1;break;case "left":case "right":s=e/2;break;default:s=e;}return [t[0],t[1],(t[2]??0)+s]}}class Di extends Li{DF={name:"\u7acb\u4f53\u591a\u8fb9\u5f62",color:"#64b4b2",extrudedHeight:30,clampToGround:true,perPositionHeight:false,closeTop:true,closeBottom:false,heightReference:"CLAMP_TO_GROUND",classificationType:"BOTH",duration:3e3,showAnimationLine:true,show:true,opacity:.5,outline:false,outlineColor:"#64b4b2",outlineWidth:2,outlineOpacity:.8,pauseAnimation:false};constructor(t,i){return super(t,i),this.options={...this.options,...this.DF,...i},this.add()}add(){try{return this.entity=this.viewer.entities.add({name:new CallbackProperty((()=>this.options.name),!1),id:this.options.id,show:new CallbackProperty((()=>this.options.show),!1),polygon:{hierarchy:new CallbackProperty((()=>new PolygonHierarchy$1(this.options?.lonlats?Cartesian3.fromDegreesArrayHeights(this.options.lonlats):this.options.positions)),!1),material:this.normalizeColor(this.options.color,this.options.opacity),extrudedHeight:new CallbackProperty((()=>this.options.extrudedHeight),!1),perPositionHeight:this.options.perPositionHeight,clampToGround:new CallbackProperty((()=>this.options.clampToGround),!1),heightReference:new CallbackProperty((()=>"string"==typeof this.options.heightReference?HeightReference[this.options.heightReference]:this.options.heightReference),!1),classificationType:new CallbackProperty((()=>"string"==typeof this.options.classificationType?ClassificationType$1[this.options.classificationType]:this.options.classificationType),!1),extrudedHeightReference:new CallbackProperty((()=>"string"==typeof this.options.extrudedHeightReference?HeightReference[this.options.extrudedHeightReference]:this.options.extrudedHeightReference),!1),outline:new CallbackProperty((()=>this.options.outline),!1),outlineColor:new CallbackProperty((()=>this.normalizeColor(this.options.outlineColor,this.options.outlineOpacity)),!1),outlineWidth:new CallbackProperty((()=>this.options.outlineWidth),!1),closeTop:this.options.closeTop,closeBottom:this.options.closeBottom}}),this.options.showAnimationLine&&(this.entity.polyline={positions:new CallbackProperty((()=>{let t=[...this.options.lonlats];for(let i=0;this.options.lonlats.length>i;i+=3)t.push(this.options.lonlats[i],this.options.lonlats[i+1],this.options.lonlats[i+2]+this.options.extrudedHeight);return this.options?.lonlats?Cartesian3.fromDegreesArrayHeights(t):this.options.positions}),!1),width:new CallbackProperty((()=>this.options.outlineWidth),!1),clampToGround:this.options.clampToGround,material:new jt({color:this.options.outlineColor,duration:this.options.duration})}),this.options.id||(this.options={...this.options,id:this.entity.id}),this.applyCenter(),this}catch(t){}}toggleAnimation(t){this.entity?.polyline&&this.entity?.polyline.material&&this.entity?.polyline.material.togglePause(t),this.options=Object.assign({},this.options,{pauseAnimation:t});}update(t){this.entity&&this.options&&(super.update(t,this),t.remove||t.dispose||(void 0!==t.show&&(this.entity.show=this.options.show),this.entity.polygon&&(void 0!==t.height&&(this.entity.polygon.extrudedHeight=t.height),void 0!==t.color&&(this.entity.polygon.material=this.normalizeColor(t.color,this.options.opacity))),this.entity?.polyline&&this.updateOutline(t),this.options=Object.assign({},this.options,t)));}updateOutline(t){this.entity?.polygon&&(void 0!==t.outline&&(this.entity.polygon.outline=t.outline),void 0!==t.outlineColor&&(this.entity.polygon.outlineColor=t.outlineColor instanceof Color?t.outlineColor:Color.fromCssColorString(t.outlineColor)),void 0!==t.outlineWidth&&(this.entity.polygon.outlineWidth=t.outlineWidth)),this.entity?.polyline&&this.entity?.polyline?.material&&(void 0!==t.showAnimationLine&&(this.entity.polyline.show=t.showAnimationLine),void 0!==t.outlineWidth&&(this.entity.polyline.width=t.outlineWidth),void 0!==t.outlineColor&&(this.entity.polyline.material._color=this.normalizeColor(t.outlineColor,t.outlineOpacity||this.options.outlineOpacity)),void 0!==t.outlineOpacity&&this.entity.polyline.material._color.withAlpha(t.outlineOpacity),void 0!==t.pauseAnimation&&this.toggleAnimation(t.pauseAnimation));}select(){this.entity&&(super.select(),this.updateOutline({outline:true,outlineColor:mi,outlineOpacity:gi,outlineWidth:fi}));}unSelect(){this.entity&&(super.unSelect(),this.updateOutline({outline:this.options.outline,outlineColor:this.options.outlineColor,outlineOpacity:this.options.outlineOpacity,outlineWidth:this.options.outlineWidth}));}}class Mi extends Li{DF={name:"\u81ea\u5b9a\u4e49\u6750\u8d28\u8d34\u5730\u7ebf",color:new Color(6/255,180/255,178/255,1),width:3,clampToGround:true,duration:3e3,show:true,opacity:1,pauseAnimation:false,classificationType:"BOTH"};constructor(t,i){return super(t,i),this.options={...this.options,...this.DF,...i},this.add()}add(){try{return this.entity=this.viewer.entities.add({name:new CallbackProperty((()=>this.options.name),!1),id:this.options.id,show:new CallbackProperty((()=>this.options.show),!1),polyline:{positions:new CallbackProperty((()=>this.options?.lonlats?Cartesian3.fromDegreesArrayHeights(this.options.lonlats):this.options.positions),!1),width:new CallbackProperty((()=>this.options.width),!1),clampToGround:new CallbackProperty((()=>this.options.clampToGround),!1),classificationType:new CallbackProperty((()=>"string"==typeof this.options.classificationType?ClassificationType$1[this.options.classificationType]:this.options.classificationType),!1),material:new jt({color:"string"==typeof this.options.color?Color.fromCssColorString(this.options.color).withAlpha(this.options.opacity):this.options.color.withAlpha(this.options.opacity),duration:this.options.duration})}}),this.options.id||this.update({id:this.entity.id}),this.applyCenter(),this}catch(t){}}toggleAnimation(t){this.entity?.polyline&&this.entity?.polyline.material&&(this.options=Object.assign({},this.options,{pauseAnimation:t}),this.entity?.polyline.material.togglePause(t));}update(t){if(this.options&&this.entity){if(super.update(t,this),this.entity?.polyline&&this.entity?.polyline.material){if(void 0!==t.color){const i="string"==typeof this.options.color?Color.fromCssColorString(t.color).withAlpha(this.options.opacity):this.options.color.withAlpha(this.options.opacity);this.entity.polyline.material.color.alpha=i.alpha,this.entity.polyline.material.color.red=i.red,this.entity.polyline.material.color.green=i.green,this.entity.polyline.material.color.blue=i.blue;} void 0!==t.opacity&&this.entity.polyline.material.color.withAlpha(t.opacity);}t.remove||t.dispose||(this.entity.show=this.options.show,void 0!==t.pauseAnimation&&this.toggleAnimation(t.pauseAnimation));}}select(){if(this.entity&&(super.select(),this.entity?.polyline&&this.entity?.polyline.material)){const t=this.normalizeColor(ci,ui);this.entity.polyline.material.color.alpha=t.alpha,this.entity.polyline.material.color.red=t.red,this.entity.polyline.material.color.green=t.green,this.entity.polyline.material.color.blue=t.blue,this.options.width=this.options.width*pi;}}unSelect(){if(this.entity&&(super.unSelect(),this.entity?.polyline&&this.entity?.polyline.material)){const t=this.normalizeColor(this.options.color,this.options.opacity);this.entity.polyline.material.color.alpha=t.alpha,this.entity.polyline.material.color.red=t.red,this.entity.polyline.material.color.green=t.green,this.entity.polyline.material.color.blue=t.blue,this.options.width=this.options.width/pi;}}}class Ri extends Li{DF={name:"\u5e38\u89c4\u7ec4\u5408\u70b9\u7ebf",color:new Color(101/255,245/255,170/255,1),outlineColor:new Color(55/255,148/255,98/255,1),width:4,pixelOffset:new Cartesian2(0,0),depthOffset:new Cartesian2(0,0),outlineWidth:1,clampToGround:true,showPoint:true,pointSize:10,pointOutlineWidth:8,show:true,opacity:.8,classificationType:"BOTH",pointHeightReference:"CLAMP_TO_GROUND"};pointEntities=[];constructor(t,i){return super(t,i),this.options={...this.options,...this.DF,...i},this.add()}add(){try{if(this.entity=this.viewer.entities.add({name:new CallbackProperty((()=>this.options.name),!1),id:this.options.id,show:new CallbackProperty((()=>this.options.show),!1),polyline:{positions:new CallbackProperty((()=>this.options?.lonlats?Cartesian3.fromDegreesArrayHeights(this.options.lonlats):this.options.positions),!1),width:new CallbackProperty((()=>this.options.width),!1),clampToGround:new CallbackProperty((()=>this.options.clampToGround),!1),classificationType:new CallbackProperty((()=>"string"==typeof this.options.classificationType?ClassificationType$1[this.options.classificationType]:this.options.classificationType),!1),material:new PolylineOutlineMaterialProperty({color:"string"==typeof this.options.color?Color.fromCssColorString(this.options.color).withAlpha(this.options.opacity):this.options.color.withAlpha(this.options.opacity),outlineWidth:this.options.outlineWidth/2,outlineColor:this.options.outlineColor},!0)}}),this.options.id||this.update({id:this.entity.id}),this.options.lonlats.length)for(let t=0;this.options.lonlats.length>t;t+=3){this.createPoint([this.options.lonlats[t],this.options.lonlats[t+1],this.options.lonlats[t+2]]);}return this.applyCenter(),this}catch(t){}}createPoint(t){let i=this.viewer.entities.add({position:new CallbackProperty((()=>Cartesian3.fromDegrees(t[0],t[1],t[2]||.01)),false),show:new CallbackProperty((()=>this.options.show),false),point:{depthTest:false,color:Color.fromAlpha("string"==typeof this.options.color?Color.fromCssColorString(this.options.color):this.options.color,this.options.opacity),pixelSize:this.options.pointSize||10,outlineColor:Color.fromAlpha("string"==typeof this.options.outlineColor?Color.fromCssColorString(this.options.outlineColor):this.options.outlineColor,this.options.opacity),outlineWidth:this.options.pointOutlineWidth||8,depthOffset:new Cartesian2(this.options.depthOffset.x,this.options.depthOffset.y),pixelOffset:new Cartesian2(this.options.pixelOffset.x,this.options.pixelOffset.y),disableDepthTestDistance:1/0,zIndex:1e3,heightReference:new CallbackProperty((()=>"string"==typeof this.options.pointHeightReference?HeightReference[this.options.pointHeightReference]:this.options.pointHeightReference),false)}});i.userData||(i.userData={...this.options,isGroup:true,originId:i.id}),i.userData.entityId=this.entity.id,this.pointEntities.push(i);}clearPointEntities(){this.pointEntities.length&&this.pointEntities.forEach((t=>{this.viewer.entities.remove(t);}));}dispose(){if(this.pointEntities.length)for(let t=0;this.pointEntities.length>t;t++){this.viewer.entities.remove(this.pointEntities[t]);}super.dispose();}update(t){if(this.options&&this.entity&&(super.update(t,this),!t.remove&&!t.dispose)){if(this.options.showPoint&&this.options.lonlats.length){this.clearPointEntities();for(let t=0;this.options.lonlats.length>t;t+=3){this.createPoint([this.options.lonlats[t],this.options.lonlats[t+1],this.options.lonlats[t+2]]);}}if(this.entity.show=this.options.show,this.pointEntities?.forEach((t=>{t.show=this.options.show;})),this.entity.polyline&&this.entity.polyline.material){if(void 0!==t.color||void 0!==t.opacity){const i="string"==typeof t.color?Color.fromCssColorString(t.color):t.color;this.entity.polyline.material.color=Color.fromAlpha(i,this.options.opacity),this.pointEntities?.forEach((t=>{t.point.color=Color.fromAlpha(i,this.options.opacity);}));}if(void 0!==t.outlineColor||void 0!==t.opacity){const i="string"==typeof t.outlineColor?Color.fromCssColorString(t.outlineColor):t.outlineColor;this.entity.polyline.material.outlineColor=Color.fromAlpha(i,this.options.opacity),this.pointEntities?.forEach((t=>{t.point.outlineColor=Color.fromAlpha(i,this.options.opacity);}));}}}}select(){if(this.entity&&(super.select(),this.entity?.polyline)){const t=this.normalizeColor(ci,ui);this.entity.polyline.material.color=t.withAlpha(.5),this.entity.polyline.material.outlineColor=t,this.options.width=this.options.width*pi;}}unSelect(){if(this.entity&&(super.unSelect(),this.entity?.polyline)){this.entity.polyline.material.color=this.normalizeColor(this.options.color,this.options.opacity);const t=this.normalizeColor(this.options.outlineColor,this.options.opacity);this.entity.polyline.material.outlineColor=t,this.options.width=this.options.width/pi;}}}class xi extends Li{DF={name:"\u884c\u8fdb\u7ebf",color:"#64b4b2",width:10,clampToGround:true,duration:3e3,image:"",repeat:new Cartesian2(40,1),show:true,opacity:1,pauseAnimation:false,classificationType:"BOTH"};constructor(t,i){return super(t,i),this.options={...this.options,...this.DF,...i},this.add()}add(){try{const t="string"==typeof this.options.color?Color.fromCssColorString(this.options.color).withAlpha(this.options.opacity):this.options.color.withAlpha(this.options.opacity);return this.material=new Wt({color:t,duration:this.options.duration,image:this.options.url,repeat:new Cartesian2(this.options.repeat.x,this.options.repeat.y)}),this.entity=this.viewer.entities.add({name:new CallbackProperty((()=>this.options.name),!1),id:this.options.id,show:new CallbackProperty((()=>this.options.show),!1),polyline:{heightReference:HeightReference.CLAMP_TO_GROUND,positions:new CallbackProperty((()=>this.options?.lonlats?Cartesian3.fromDegreesArrayHeights(this.options.lonlats):this.options.positions),!1),width:new CallbackProperty((()=>this.options.width),!1),clampToGround:new CallbackProperty((()=>this.options.clampToGround),!1),classificationType:new CallbackProperty((()=>"string"==typeof this.options.classificationType?ClassificationType$1[this.options.classificationType]:this.options.classificationType),!1),material:this.material}}),this.options.id||this.update({id:this.entity.id}),this.applyCenter(),this}catch(t){}}toggleAnimation(t){this.material&&(this.options=Object.assign({},this.options,{pauseAnimation:t}),this.material.togglePause(t));}update(t){if(this.options&&this.entity&&(super.update(t,this),!t.remove)){if(this.entity.show=this.options.show,t.color||void 0!==t.opacity){const t="string"==typeof this.options.color?Color.fromCssColorString(this.options.color):this.options.color;this.material&&(this.material.color=Color.fromAlpha(t,this.options.opacity));} void 0!==t.pauseAnimation&&this.toggleAnimation(t.pauseAnimation);}}select(){this.entity&&(super.select(),this.entity?.polyline&&(this.material.color=this.normalizeColor(ci,ui),this.options.width=this.options.width*pi));}unSelect(){this.entity&&(super.unSelect(),this.entity?.polyline&&(this.material.color=this.normalizeColor(this.options.color,this.options.opacity),this.options.width=this.options.width/pi));}}class ki{constructor(i={}){this._definitionChanged=new t.Event,this._color=t.defaultValue(i.color,new t.Color(1,1,0,1)),this._time=(new Date).getTime(),this.duration=i.duration,this._isPaused=false;}get isConstant(){return false}get definitionChanged(){return this._definitionChanged}get color(){return t.createPropertyDescriptor("color")}set color(t){this._color=t,this._definitionChanged.raiseEvent(this);}getType(i){return t.Material.PolyVerticalLineDiffuseMaterialType}getValue(i,e){return (e=t.defaultValue(e,{})).u_color=this._color,e.time=!this._isPaused&&this.duration?((new Date).getTime()-this._time)%this.duration/this.duration:0,e}equals(i){return this===i||i instanceof ki&&t.Property.equals(this._color,i._color)}togglePause(t){this._isPaused=t,this._isPaused||(this._time=(new Date).getTime());}}Object.defineProperties(ki.prototype,{color:t.createPropertyDescriptor("color")}),t.Material.PolyVerticalLineDiffuseMaterialType||(t.Material.PolyVerticalLineDiffuseMaterialType="PolyVerticalLineDiffuseMaterialProperty"),t.Material._materialCache.getMaterial(t.Material.PolyVerticalLineDiffuseMaterialType)||t.Material._materialCache.addMaterial(t.Material.PolyVerticalLineDiffuseMaterialType,{fabric:{type:t.Material.PolyVerticalLineDiffuseMaterialType,uniforms:{u_color:t.Color.MEDIUMORCHID,time:0},source:"\n\t\t\tuniform vec4 u_color;\n\t\t\tczm_material czm_getMaterial(czm_materialInput materialInput){\n\t\t\t\tczm_material material = czm_getDefaultMaterial(materialInput);\n\t\t\t\tvec2 st = materialInput.st;\n\t\t\t\tmaterial.diffuse = u_color.rgb * 2.0;\n\t\t\t\tmaterial.alpha = u_color.a * (1.0-fract(st.s + time))*0.5;\n\t\t\t\treturn material;\n\t\t\t}"},translucent:function(t){return true}});class Pi{constructor(i={}){this._definitionChanged=new t.Event,this._color=t.defaultValue((i.color instanceof t.Color?i.color:t.Color.fromCssColorString(i.color))||new t.Color(1,1,0,1)),this._time=(new Date).getTime(),this._colorSubscription=void 0,this.duration=t.defaultValue(i.duration,1e3),this.count=t.defaultValue(i.count,2),this._isPaused=false,this.gradient=t.defaultValue(i.gradient,.1),0===this.gradient&&(this.gradient=0),this.gradient>1&&(this.gradient=1);}get isConstant(){return false}get definitionChanged(){return this._definitionChanged}get color(){return t.createPropertyDescriptor("color")}set color(t){this._color=t,this._definitionChanged.raiseEvent(this);}getType(i){return t.Material.CircleWaveMaterialType}getValue(i,e){return (e=t.defaultValue(e,{})).u_color=this._color,e.time=!this._isPaused&&this.duration?((new Date).getTime()-this._time)%this.duration/this.duration:0,e.count=this.count,e.gradient=1+10*(1-this.gradient),e}equals(i){return this===i||i instanceof Pi&&t.Property.equals(this._color,i._color)}togglePause(t){this._isPaused=t,this._isPaused||(this._time=(new Date).getTime());}}Object.defineProperties(Pi.prototype,{color:t.createPropertyDescriptor("color"),duration:t.createPropertyDescriptor("duration"),count:t.createPropertyDescriptor("count"),isConstant:{get:function(){return false}},definitionChanged:{get:function(){return this._definitionChanged}}}),t.Material.CircleWaveMaterialType||(t.Material.CircleWaveMaterialType="CircleWaveMaterial"),t.Material._materialCache.getMaterial(t.Material.CircleWaveMaterialType)||t.Material._materialCache.addMaterial(t.Material.CircleWaveMaterialType,{fabric:{type:t.Material.CircleWaveMaterialType,uniforms:{u_color:t.Color.MEDIUMORCHID,time:1,count:1,gradient:.1},source:"\n czm_material czm_getMaterial(czm_materialInput materialInput) {\n czm_material material = czm_getDefaultMaterial(materialInput);\n material.diffuse = 1.5 * u_color.rgb;\n vec2 st = materialInput.st;\n vec3 str = materialInput.str;\n float dis = distance(st, vec2(0.5, 0.5));\n float per = fract(time);\n if (abs(str.z) > 0.001) {\n discard;\n }\n if (dis > 0.5) {\n discard;\n } else {\n float perDis = 0.5 / count;\n float disNum;\n float bl = .0;\n for (int i = 0; i <= 9; i++) {\n if (float(i) <= count) {\n \t\t\t\tdisNum = perDis *float(i) - dis + per / count;\n if (disNum > 0.0) {\n if (disNum < perDis) {\n bl = 1.0 - disNum / perDis;\n } else if(disNum - perDis < perDis) {\n bl = 1.0 - abs(1.0 - disNum / perDis);\n }\n material.alpha = u_color.a * pow(bl, gradient);\n }\n }\n }\n }\n return material;\n }\n "},translucent:function(t){return true}});class Oi extends Li{DF={name:"\u81ea\u5b9a\u4e49\u6750\u8d28\u8d34\u7ad6\u76f4\u7ebf",color:new Color(6/255,180/255,178/255,1),width:3,duration:1e3,height:500,waterwave:{show:true,color:new Color(6/255,180/255,178/255,1),maxRadius:50,duration:3e3,count:3,gradient:.5},show:true,opacity:1,radius:50,clampToGround:false,classificationType:"BOTH",pauseAnimation:false};constructor(t,i){return super(t,i),this.options={...this.options,...this.DF,...i},this.add()}add(){try{return this.material=new ki({color:Color.fromAlpha("string"==typeof this.options.color?Color.fromCssColorString(this.options.color):this.options.color,this.options.opacity),duration:this.options.duration}),this.entity=this.viewer.entities.add({name:new CallbackProperty((()=>this.options.name),!1),id:this.options.id,show:new CallbackProperty((()=>this.options.show),!1),position:new CallbackProperty((()=>this.options?.lonlats?Cartesian3.fromDegrees(this.options.lonlats[0],this.options.lonlats[1],this.options.lonlats[2]):this.options.positions[0]),!1),polyline:{positions:new CallbackProperty((()=>{let t=[...this.options.lonlats,this.options.lonlats[0],this.options.lonlats[1],this.options.height];return this.options?.lonlats?Cartesian3.fromDegreesArrayHeights(t):this.options.positions}),!1),clampToGround:new CallbackProperty((()=>this.options.clampToGround),!1),classificationType:new CallbackProperty((()=>"string"==typeof this.options.classificationType?ClassificationType[this.options.classificationType]:this.options.classificationType),!1),width:new CallbackProperty((()=>this.options.width),!1),material:this.material}}),this.options.waterwave&&this.options.waterwave.show&&(this.entity.ellipse={semiMinorAxis:this.options.radius||this.options.waterwave.maxRadius,semiMajorAxis:this.options.radius||this.options.waterwave.maxRadius,material:new Pi({color:this.options.color||this.options.waterwave.color,duration:this.options.waterwave.duration,gradient:this.options.waterwave.gradient,count:this.options.waterwave.count}),show:new CallbackProperty((()=>this.options.waterwave.show),!1)}),this.options.id||this.update({id:this.entity.id}),this.applyCenter(),this}catch(t){}}toggleAnimation(t){this.entity?.polyline.material&&this.entity?.polyline.material.togglePause(t),this.entity?.ellipse&&this.entity?.ellipse.material&&this.entity?.ellipse.material.togglePause(t),this.options=Object.assign({},this.options,{pauseAnimation:t});}update(t){if(this.options&&this.entity){if(super.update(t,this),t.color||t.opacity){const t="string"==typeof this.options.color?Color.fromCssColorString(this.options.color):this.options.color;this.material._color=Color.fromAlpha(t,this.options.opacity),this.entity?.ellipse&&this.entity?.ellipse.material&&(this.entity.ellipse.material._color=Color.fromAlpha(t,this.options.opacity));}t.remove||t.dispose||(this.entity.show=this.options.show,void 0!==t.pauseAnimation&&this.toggleAnimation(t.pauseAnimation),void 0!==t.radius&&(this.entity.ellipse.semiMinorAxis=t.radius,this.entity.ellipse.semiMajorAxis=t.radius));}}select(){if(!this.entity)return;super.select();const t=this.normalizeColor(ci,ui);this.entity?.polyline&&(this.material._color=t,this.options.width=this.options.width*pi),this.entity?.ellipse&&this.entity?.ellipse.material&&(this.entity.ellipse.material._color=t);}unSelect(){if(!this.entity)return;super.unSelect();const t=this.normalizeColor(this.options.color,this.options.opacity);this.entity?.polyline&&(this.material._color=t,this.options.width=this.options.width/pi),this.entity?.ellipse&&this.entity?.ellipse.material&&(this.entity.ellipse.material._color=t);}}const Ai={fontShow:false,fontText:void 0,fontSize:16,fontFamily:"Microsoft YaHei",fontColor:"#ffffff",fontColorAlpha:1,fontOutlineColor:"#000000",fontOutlineColorAlpha:1,fontOutlineWidth:4,fontStyle:LabelStyle.FILL_AND_OUTLINE,fontScale:1,fontHorizontalOrigin:"CENTER",fontVerticalOrigin:"BOTTOM",fontPixelOffset:[0,-10],fontDisableDepthTestDistance:1/0,fontShowBackground:true,fontBackgroundColor:"#000000",fontBackgroundColorAlpha:.5,fontBackgroundPadding:[10,5],fontHeightReference:HeightReference.RELATIVE_TO_GROUND,fontRenderingGroupId:9};class Ii{constructor(t,i){this.entity=t,this.options=Object.assign({},Ai,i),this.create();}create(){if(this.entity)return this.entity.label=new LabelGraphics({show:new CallbackProperty((()=>this.options.fontShow),false),text:new CallbackProperty((()=>this.options.fontText||this.options.name),false),font:new CallbackProperty((()=>`${this.options.fontSize}px ${this.options.fontFamily}`),false),fillColor:new CallbackProperty((()=>this.options.fontColor instanceof Color?this.options.fontColor.withAlpha(this.options.fontColorAlpha):Color.fromCssColorString(this.options.fontColor).withAlpha(this.options.fontColorAlpha)),false),outlineColor:new CallbackProperty((()=>this.options.fontOutlineColor instanceof Color?this.options.fontOutlineColor.withAlpha(this.options.fontOutlineColorAlpha):Color.fromCssColorString(this.options.fontOutlineColor).withAlpha(this.options.fontOutlineColorAlpha)),false),outlineWidth:new CallbackProperty((()=>this.options.fontOutlineWidth),false),style:this.options.fontStyle,scale:new CallbackProperty((()=>this.options.fontScale),false),horizontalOrigin:new CallbackProperty((()=>"string"==typeof this.options.fontHorizontalOrigin?HorizontalOrigin[this.options.fontHorizontalOrigin]:this.options.fontHorizontalOrigin),false),verticalOrigin:new CallbackProperty((()=>"string"==typeof this.options.fontVerticalOrigin?VerticalOrigin[this.options.fontVerticalOrigin]:this.options.fontVerticalOrigin),false),pixelOffset:new CallbackProperty((()=>new Cartesian2(void 0!==this.options.imgWidth?(this.options.fontPixelOffset[0]+this.options.imgWidth/2)*this.options.scale:this.options.fontPixelOffset[0],void 0!==this.options.imgHeight?(this.options.fontPixelOffset[1]-this.options.imgHeight/2)*this.options.scale:this.options.fontPixelOffset[1])),false),disableDepthTestDistance:1/0,showBackground:new CallbackProperty((()=>this.options.fontShowBackground),false),backgroundColor:new CallbackProperty((()=>this.options.fontBackgroundColor instanceof Color?this.options.fontBackgroundColor.withAlpha(this.options.fontBackgroundColorAlpha):Color.fromCssColorString(this.options.fontBackgroundColor).withAlpha(this.options.fontBackgroundColorAlpha)),false),backgroundPadding:new CallbackProperty((()=>new Cartesian2(this.options.fontBackgroundPadding[0],this.options.fontBackgroundPadding[1])),false),heightReference:this.options.fontHeightReference}),this}update(t){this.entity.label&&(this.options=Object.assign(Object.assign({},this.options),t));}remove(){this.entity.label&&(this.entity.label=void 0);}getData(){if(!this.options)return null;let t=Object.assign(Object.assign({},this.options),{name:this.options.fontText||this.options.name,type:"label"});return void 0!==this.options.fontColor&&(t.fontColor=this.options.fontColor instanceof Color?this.options.fontColor.toCssHexString():this.options.fontColor),void 0!==this.options.fontOutlineColor&&(t.fontOutlineColor=this.options.fontOutlineColor instanceof Color?this.options.fontOutlineColor.toCssHexString():this.options.fontOutlineColor),void 0!==this.options.fontBackgroundColor&&(t.fontBackgroundColor=this.options.fontBackgroundColor instanceof Color?this.options.fontBackgroundColor.toCssHexString():this.options.fontBackgroundColor),void 0!==this.options.fontEyeOffset&&(t.fontEyeOffset=[this.options.fontEyeOffset,this.options.fontEyeOffset,this.options.fontEyeOffset]),t}}const _i={name:"\u56fe\u680701",url:"/cesium-assets/Data/baitao/Map_Patrol.png",pixelOffset:new Cartesian2(0,0),imgWidth:64,imgHeight:96,scale:.5,depthOffset:new Cartesian2(0,1),showName:false,show:true,disableDepthTestDistance:[0,5e3],opacity:1,color:Color.WHITE.withAlpha(1),showWaterwave:false,waterwave:{show:false,color:"#06B4B2",maxRadius:50,duration:3e3,count:3,gradient:.5},heightReference:"CLAMP_TO_GROUND",...Ai,clampToTerrain:false};class Fi extends Li{label=void 0;constructor(t,i){return super(t,i),this.options=Object.assign({},this.options,_i,i),this.add(),this}shouldSyncCenterHeightToTerrain(){const{clampToTerrain:t,heightReference:i}=this.options||{};return !!t||"CLAMP_TO_GROUND"===i||i===HeightReference.CLAMP_TO_GROUND}add(){try{this.entity=new Entity({name:new CallbackProperty((()=>this.options.name),!1),position:new CallbackProperty((()=>this.options?.lonlats?Cartesian3.fromDegrees(this.options.lonlats[0],this.options.lonlats[1],this.options.lonlats[2]):this.options.positions[0]),!1),id:this.options.id&&this.options.id,show:new CallbackProperty((()=>this.options.show),!1),billboard:{image:new CallbackProperty((()=>this.options.url),!1),width:new CallbackProperty((()=>this.options.imgWidth),!1),height:new CallbackProperty((()=>this.options.imgHeight),!1),color:new CallbackProperty((()=>this.normalizeColor(this.options.color,this.options.opacity)),!1),scale:new CallbackProperty((()=>this.options.scale),!1),pixelOffset:new Cartesian2(this.options.pixelOffset.x,this.options.pixelOffset.y),verticalOrigin:VerticalOrigin.BOTTOM,horizontalOrigin:HorizontalOrigin.CENTER,disableDepthTestDistance:1/0,depthOffset:new Cartesian2(this.options.depthOffset.x,this.options.depthOffset.y),heightReference:new CallbackProperty((()=>"string"==typeof this.options.heightReference?HeightReference[this.options.heightReference]:this.options.heightReference),!1)},renderingGroupId:9});let t=this.updateCenter(this.options.lonlats?this.options.lonlats:this.options.positions);return this.options.clampToTerrain||!Array.isArray(t)||2>t.length||(t=[t[0],t[1],.1]),this.options={...this.options,center:t,lonlat:t},this._waterwaveCreated=!1,(this.options.showWaterwave||this.options.waterwave&&this.options.waterwave.show)&&this.createWaterwave(),this.options.showName&&this.createLabel(),this.options.id||this.update({id:this.entity.id}),this.entity&&this.viewer.entities.add(this.entity),this._initBufferFromOptions(),this}catch(t){}}getData(){return {...super.getData(),...this.label?.getData()}}toggleAnimation(t){this.entity?.ellipse&&this.entity?.ellipse.material&&this.entity?.ellipse.material.togglePause(t);}createLabel(){this.label=new Ii(this.entity,{...this.options,fontHorizontalOrigin:HorizontalOrigin.LEFT,fontVerticalOrigin:VerticalOrigin.CENTER,fontScale:this.options.scale,fontSize:32,fontShow:true});}clearLabel(){this.label?.remove();}update(t){if(!this.options||!this.entity)return;if(super.update(t,this),t.remove||t.dispose)return;if(void 0!==t.showName&&(t.showName?(this.clearLabel(),this.createLabel()):this.clearLabel()),void 0!==t.show&&(this.entity.show=t.show),this.label&&this.label.update(t),void 0!==t.showWaterwave&&this.updateWaterwave(),void 0!==t.waterwave&&this.updateWaterwave(),t.color||t.opacity){const t="string"==typeof this.options.color?Color.fromCssColorString(this.options.color):this.options.color;this.entity.billboard&&(this.entity.billboard.color=Color.fromAlpha(t,this.options.opacity));} void 0!==t.opacity&&this.entity.billboard.color.withAlpha(this.options.opacity),void 0!==t.scale&&(this.entity.billboard.scale=t.scale);if(this.shouldSyncCenterHeightToTerrain())(t.lonlat||t.lonlats||t.positions||void 0!==t.heightReference||void 0!==t.clampToTerrain)&&this.refreshCenterHeightFromSceneOrTerrain().catch((t=>{}));else if(t.lonlat||t.lonlats||t.positions||void 0!==t.heightReference||void 0!==t.clampToTerrain){const t=this.options.center;Array.isArray(t)&&t.length>=2&&(this.options.center=[t[0],t[1],.1],this.options.lonlat=this.options.center),this.viewer?.scene?.requestRender?.();}return this.options}createWaterwave(){this.entity&&this.options.waterwave&&(this.entity.ellipse={show:true,semiMinorAxis:this.options.waterwave.maxRadius,semiMajorAxis:this.options.waterwave.maxRadius,material:new Pi({color:this.options.waterwave.color,duration:this.options.waterwave.duration,gradient:this.options.waterwave.gradient,count:this.options.waterwave.count})},this._waterwaveCreated=true);}hideWaterwave(){this.entity&&this.entity.ellipse&&(this.entity.ellipse.show=false);}showWaterwaveEllipse(){this.entity&&this.entity.ellipse&&(this.entity.ellipse.show=true);}updateWaterwave(){if(!this.entity||!this.options.waterwave)return;const t=this._waterwaveCreated&&this.entity.ellipse;(void 0!==this.options.showWaterwave?this.options.showWaterwave:this.options.waterwave.show)?t?(this.showWaterwaveEllipse(),this.entity.ellipse&&(this.entity.ellipse.semiMinorAxis=this.options.waterwave.maxRadius,this.entity.ellipse.semiMajorAxis=this.options.waterwave.maxRadius,this.entity.ellipse.material=new Pi({color:this.options.waterwave.color,duration:this.options.waterwave.duration,gradient:this.options.waterwave.gradient,count:this.options.waterwave.count}))):this.createWaterwave():t&&this.hideWaterwave();}select(){this.entity&&(super.select(),this._applyBillboardHighlight());}applySelectVisual(){this.entity&&(this.isSelect=true,this._applyBillboardHighlight());}_applyBillboardHighlight(){this.entity?.billboard&&(this.entity.billboard.color=this.normalizeColor(li,hi),this.entity.billboard.scale=this.options.scale*di);}unSelect(){this.entity&&(super.unSelect(),this.entity.billboard&&(this.entity.billboard.color=this.normalizeColor(this.options.color,this.options.opacity),this.entity.billboard.scale=this.options.scale));}remove(){this.entity&&(super.remove(),this._waterwaveCreated=false,this.clearLabel());}}class zi extends Li{DF={name:"\u8f68\u8ff9\u7ebf",color:new Color(6/255,180/255,178/255,1),outlineColor:new Color(55/255,148/255,98/255,1),url:"/cesium-assets/Tool/inside-person.png",width:4,outlineWidth:1,clampToGround:true,duration:3e3,dashLength:15,showStartIcon:true,showEndIcon:true,showTrackIcon:true,currentLonlat:[],show:true,opacity:1,pauseAnimation:false,classificationType:"BOTH"};constructor(t,i,e){return super(t,i),this.options={...this.options,...this.DF,...i},this.add()}add(){try{if(this.entity=this.viewer.entities.add({name:new CallbackProperty((()=>this.options.name),!1),id:this.options.id,label:{text:this.options.name,show:!1,font:"18px sans-serif",fillColor:new CallbackProperty((()=>Color.fromAlpha(this.options.color,this.options.opacity)),!1),outlineColor:Color.BLACK,outlineWidth:2},show:new CallbackProperty((()=>this.options.show),!1),polyline:{positions:new CallbackProperty((()=>this.options?.lonlats?Cartesian3.fromDegreesArrayHeights(this.options.lonlats):this.options.positions),!1),width:new CallbackProperty((()=>this.options.width),!1),clampToGround:new CallbackProperty((()=>this.options.clampToGround),!1),classificationType:new CallbackProperty((()=>"string"==typeof this.options.classificationType?ClassificationType$1[this.options.classificationType]:this.options.classificationType),!1),material:new PolylineOutlineMaterialProperty({color:new CallbackProperty((()=>"string"==typeof this.options.color?Color.fromCssColorString(this.options.color).withAlpha(this.options.opacity):this.options.color.withAlpha(this.options.opacity)),!1),outlineWidth:this.options.outlineWidth/2,outlineColor:this.options.outlineColor})}}),this.options.id||this.update({id:this.entity.id}),this.options.showStartIcon&&this.options.lonlats.length>2){const t=this.options.lonlats.slice(0,3);t&&(this.startIconEntity=new Fi(this.viewer,{lonlats:t,id:this.options.id+"_start",url:"/cesium-assets/Data/baitao/startTrack.png",show:new CallbackProperty((()=>this.options.show&&this.options.showStartIcon),!1),opacity:this.options.opacity,heightReference:this.options.clampToGround?"CLAMP_TO_GROUND":"NONE"}));}if(this.options.showTrackIcon&&this.options.lonlats.length>5&&(this.trackIconEntity=new Fi(this.viewer,{lonlats:this.options.currentLonlat,id:this.options.id+"_track",url:this.options.url,show:new CallbackProperty((()=>this.options.show&&this.options.showTrackIcon),!1),opacity:this.options.opacity,heightReference:this.options.clampToGround?"CLAMP_TO_GROUND":"NONE"}),this.options?.currentLonlat.length||this.update({currentLonlat:this.options.lonlats.slice(0,3)})),this.options.showEndIcon&&this.options.lonlats.length>5){const t=this.options.lonlats.slice(-3);t&&(this.endIconEntity=new Fi(this.viewer,{lonlats:t,id:this.options.id+"_end",url:"/cesium-assets/Data/baitao/endTrack.png",show:new CallbackProperty((()=>this.options.show&&this.options.showEndIcon),!1),heightReference:this.options.clampToGround?"CLAMP_TO_GROUND":"NONE",opacity:this.options.opacity}));}return this.applyCenter(),this}catch(t){}}dispose(){this.startIconEntity?.dispose(),this.trackIconEntity?.dispose(),this.endIconEntity?.dispose(),this.entity&&this.viewer.entities.remove(this.entity),super.dispose();}toggleAnimation(t){this.startIconEntity?.toggleAnimation(t),this.trackIconEntity?.toggleAnimation(t),this.endIconEntity?.toggleAnimation(t),this.options=Object.assign({},this.options,{pauseAnimation:t});}update(t){if(this.options&&this.entity&&(super.update(t,this),!t.remove&&!t.dispose&&(this.entity?.polyline&&(this.entity.show=this.options.show),this.startIconEntity&&(this.startIconEntity.show=this.options.show&&this.options.showStartIcon),this.trackIconEntity&&(this.trackIconEntity.show=this.options.show&&this.options.showTrackIcon),void 0!==t.show&&(this.startIconEntity.update({show:t.show}),this.trackIconEntity.update({show:t.show}),this.endIconEntity.update({show:t.show})),void 0!==t.opacity&&(this.startIconEntity.update({opacity:t.opacity}),this.trackIconEntity.update({opacity:t.opacity}),this.endIconEntity.update({opacity:t.opacity})),this.entity.polyline&&this.entity.polyline.material))){if(void 0!==t.color||void 0!==t.opacity){const t="string"==typeof this.options.color?Color.fromCssColorString(this.options.color):this.options.color;this.entity.polyline.material.color=Color.fromAlpha(t,this.options.opacity);}if(void 0!==t.outlineColor||void 0!==t.opacity){const t="string"==typeof this.options.outlineColor?Color.fromCssColorString(this.options.outlineColor):this.options.outlineColor;this.entity.polyline.material.outlineColor=Color.fromAlpha(t,this.options.opacity);} void 0!==t.showStartIcon&&this.startIconEntity.update({show:t.showStartIcon}),void 0!==t.showTrackIcon&&this.trackIconEntity.update({show:t.showTrackIcon}),void 0!==t.showEndIcon&&this.endIconEntity.update({show:t.showEndIcon}),void 0!==t.currentLonlat&&this.trackIconEntity.update({lonlats:t.currentLonlat}),void 0!==t.pauseAnimation&&this.toggleAnimation(t.pauseAnimation);}}select(){if(this.entity&&(super.select(),this.entity?.polyline)){const t=this.normalizeColor(ci,ui);this.entity.polyline.material.color=t.withAlpha(.5),this.entity.polyline.material.outlineColor=t,this.options.width=this.options.width*pi;}}unSelect(){if(this.entity&&(super.unSelect(),this.entity?.polyline)){this.entity.polyline.material.color=this.normalizeColor(this.options.color,this.options.opacity);const t=this.normalizeColor(this.options.outlineColor,this.options.opacity);this.entity.polyline.material.outlineColor=t,this.options.width=this.options.width/pi;}}}class Hi extends Li{DF={name:"\u81ea\u5b9a\u4e49\u52a8\u6548\u5e73\u9762",color:"#64b4b2",height:0,clampToGround:true,perPositionHeight:true,heightReference:"CLAMP_TO_GROUND",classificationType:"BOTH",duration:3e3,showAnimationLine:true,showCenter:false,show:true,opacity:.5,outline:false,outlineColor:"#64b4b2",outlineWidth:2,outlineOpacity:.8,pauseAnimation:false,centerText:"\u4e2d\u5fc3\u4f4d\u7f6e",centerScale:.5,centerFont:"normal 28px MicroSoft YaHei",centerColor:"#ffffff",centerDistanceDisplayCondition:[0,5e4],centerVerticalOrigin:VerticalOrigin.CENTER,centerHorizontalOrigin:HorizontalOrigin.CENTER,centerStyle:LabelStyle.FILL_AND_OUTLINE,centerPixelOffset:[0,-10],centerOutlineWidth:2,centerOutlineColor:"#ffff00"};constructor(t,i){return super(t,i),this.options={...this.options,...this.DF,...i},this.add()}add(){try{this.entity=this.viewer.entities.add({name:new CallbackProperty((()=>this.options.name),!1),id:this.options.id,polygon:{hierarchy:new CallbackProperty((()=>new PolygonHierarchy$1(this.options?.lonlats?Cartesian3.fromDegreesArrayHeights(this.options.lonlats):this.options.positions)),!1),material:new CallbackProperty((()=>{const t="string"==typeof this.options.color?Color.fromCssColorString(this.options.color):this.options.color;return Color.fromAlpha(t,this.options.opacity)}),!1),outline:new CallbackProperty((()=>this.options.outline),!1),outlineColor:new CallbackProperty((()=>this.normalizeColor(this.options.outlineColor,this.options.outlineOpacity)),!1),outlineWidth:new CallbackProperty((()=>this.options.outlineWidth),!1),heightReference:new CallbackProperty((()=>"string"==typeof this.options.heightReference?HeightReference[this.options.heightReference]:this.options.heightReference),!1),classificationType:new CallbackProperty((()=>"string"==typeof this.options.classificationType?ClassificationType$1[this.options.classificationType]:this.options.classificationType),!1)}}),this.options.showAnimationLine&&(this.entity.polyline={positions:new CallbackProperty((()=>this.options?.lonlats?Cartesian3.fromDegreesArrayHeights(this.options.lonlats):this.options.positions),!1),width:new CallbackProperty((()=>this.options.outlineWidth),!1),clampToGround:this.options.clampToGround,material:new jt({color:this.options.outlineColor,duration:this.options.duration})});const t=this.updateCenter(this.options.lonlats?this.options.lonlats:this.options.positions);return this.options.showCenter&&t&&(this.entity.position=Array.isArray(t)?Cartesian3.fromDegrees(t[0],t[1],t[1]):t,this.entity.label={text:new CallbackProperty((i=>this.options.centerText||this.options.name||""+t),!1),color:this.options.centerColor instanceof Color?this.options.centerColor:Color.fromCssColorString(this.options.centerColor),scale:this.options.centerScale,font:this.options.centerFont,distanceDisplayCondition:new DistanceDisplayCondition(this.options.centerDistanceDisplayCondition[0],this.options.centerDistanceDisplayCondition[1]),verticalOrigin:this.options.centerVerticalOrigin,horizontalOrigin:this.options.centerHorizontalOrigin,style:this.options.centerStyle,pixelOffset:new Cartesian2(this.options.centerPixelOffset[0],this.options.centerPixelOffset[1]),outlineWidth:this.options.centerOutlineWidth,outlineColor:this.options.centerOutlineColor instanceof Color?this.options.centerOutlineColor:Color.fromCssColorString(this.options.centerOutlineColor)}),this.options.id||(this.options={...this.options,id:this.entity.id}),this.applyCenter(),this}catch(t){}}toggleAnimation(t){this.entity?.polyline&&this.entity?.polyline.material&&this.entity?.polyline.material.togglePause(t),this.options=Object.assign({},this.options,{pauseAnimation:t});}update(t){if(this.entity&&this.options&&(super.update(t,this),!t.remove&&!t.dispose)){if(void 0!==t.show&&(this.entity.show=this.options.show),this.entity?.label&&(void 0!==t.centerText&&(this.options.centerText=t.centerText),void 0!==t.centerColor&&(this.entity.label.color=t.centerColor instanceof Color?t.centerColor:Color.fromCssColorString(t.centerColor)),void 0!==t.centerScale&&(this.entity.label.scale=t.centerScale),void 0!==t.centerFont&&(this.entity.label.font=t.centerFont),void 0!==t.centerDistanceDisplayCondition&&(this.entity.label.distanceDisplayCondition=new DistanceDisplayCondition(t.centerDistanceDisplayCondition[0],t.centerDistanceDisplayCondition[1])),void 0!==t.centerStyle&&(this.entity.label.style=t.centerStyle),void 0!==t.centerPixelOffset&&(this.entity.label.pixelOffset=new Cartesian2(t.centerPixelOffset[0],t.centerPixelOffset[1])),void 0!==t.centerOutlineWidth&&(this.entity.label.outlineWidth=t.centerOutlineWidth),void 0!==t.centerOutlineColor&&(this.entity.label.outlineColor=t.centerOutlineColor instanceof Color?t.centerOutlineColor:Color.fromCssColorString(t.centerOutlineColor)),this.options=Object.assign({},this.options,t)),this.entity?.polygon&&this.entity?.polygon.material){const t="string"==typeof this.options.color?Color.fromCssColorString(this.options.color):this.options.color;this.entity.polygon.material=Color.fromAlpha(t,this.options.opacity);}this.entity?.polyline&&this.updateOutline(t);}}updateOutline(t){this.entity?.polygon&&(void 0!==t.outline&&(this.entity.polygon.outline=t.outline),void 0!==t.outlineColor&&(this.entity.polygon.outlineColor=t.outlineColor instanceof Color?t.outlineColor:Color.fromCssColorString(t.outlineColor)),void 0!==t.outlineWidth&&(this.entity.polygon.outlineWidth=t.outlineWidth)),this.entity?.polyline&&this.entity?.polyline?.material&&(void 0!==t.showAnimationLine&&(this.entity.polyline.show=t.showAnimationLine),void 0!==t.outlineWidth&&(this.entity.polyline.width=t.outlineWidth),void 0!==t.outlineColor&&(this.entity.polyline.material._color=this.normalizeColor(t.outlineColor,t.outlineOpacity||this.options.outlineOpacity)),void 0!==t.outlineOpacity&&this.entity.polyline.material._color.withAlpha(t.outlineOpacity),void 0!==t.pauseAnimation&&this.toggleAnimation(t.pauseAnimation));}getData(){let t=super.getData();return t.centerText=this.options.centerText,t.centerColor=this.options.centerColor,t.centerScale=this.options.centerScale,t.centerFont=this.options.centerFont,t.centerStyle=this.options.centerStyle,t.centerPixelOffset=this.options.centerPixelOffset,t.centerOutlineWidth=this.options.centerOutlineWidth,t.centerOutlineColor=this.options.centerOutlineColor,t}select(){this.entity&&(super.select(),this.updateOutline({outline:true,outlineColor:mi,outlineOpacity:gi,outlineWidth:fi}));}unSelect(){this.entity&&(super.unSelect(),this.updateOutline({outline:this.options.outline,outlineColor:this.options.outlineColor,outlineOpacity:this.options.outlineOpacity,outlineWidth:this.options.outlineWidth}));}}class Vi extends Li{DF={name:"\u81ea\u5b9a\u4e49\u6c34\u6ce2\u7eb9",color:"#06B4B2",maxRadius:50,duration:3e3,count:3,show:true,gradient:.5,opacity:1,pauseAnimation:false};constructor(t,i){return super(t,i),this.options={...this.options,...this.DF,...i},this.add()}add(){try{return this.material=new Pi({color:this.options.color,duration:this.options.duration,gradient:this.options.gradient,count:this.options.count}),this.entity=this.viewer.entities.add({name:new CallbackProperty((()=>this.options.name),!1),id:this.options.id,show:new CallbackProperty((()=>this.options.show),!1),position:new CallbackProperty((()=>this.options?.lonlats?Cartesian3.fromDegrees(this.options.lonlats[0],this.options.lonlats[1],this.options.lonlats[2]):this.options.positions[0]),!1),ellipse:{semiMinorAxis:this.options.maxRadius,semiMajorAxis:this.options.maxRadius,material:this.material}}),this.options.id||this.update({id:this.entity.id}),this.applyCenter(),this}catch(t){}}toggleAnimation(t){this.entity?.ellipse.material&&this.entity?.ellipse.material.togglePause(t),this.options=Object.assign({},this.options,{pauseAnimation:t});}update(t){if(this.options&&this.entity&&(super.update(t,this),!t.remove&&!t.dispose)){if(void 0!==t.show&&(this.entity.show=t.show),void 0===t.maxRadius&&void 0===t.radius||(this.entity.ellipse.semiMinorAxis=t.maxRadius||t.radius,this.entity.ellipse.semiMajorAxis=t.maxRadius||t.radius),this.material){if(t.color){const i="string"==typeof t.color?Color.fromCssColorString(t.color):t.color;this.material._color=i.withAlpha(this.options.opacity);}t.opacity&&(this.material._color.alpha=t.opacity),void 0!==t.duration&&(this.material.duration=t.duration),void 0!==t.count&&(this.material.count=t.count),void 0!==t.gradient&&(this.material.gradient=t.gradient);} void 0!==this.options.pauseAnimation&&this.toggleAnimation(this.options.pauseAnimation);}}select(){this.entity&&(super.select(),this.material&&(this.material._color=this.normalizeColor(Ci,bi)));}unSelect(){this.entity&&(super.unSelect(),this.material&&(this.material._color=this.normalizeColor(this.options.color,this.options.opacity)));}}class Wi{constructor(i={}){this._definitionChanged=new t.Event,this._color="string"==typeof i.color?t.Color.fromCssColorString(i.color):t.defaultValue(i.color,new t.Color(1,1,0,1)),this._repeat=t.defaultValue(i.repeat,new t.Cartesian2(1,1)),this._time=(new Date).getTime(),this.duration=i.duration,this._isPaused=false;}get isConstant(){return false}get definitionChanged(){return this._definitionChanged}get color(){return this._color}set color(i){this._color="string"==typeof i?t.Color.fromCssColorString(i):i,this._definitionChanged.raiseEvent();}getType(i){return t.Material.PolygonArrowLineDiffuseMaterialType}getValue(i,e){return (e=t.defaultValue(e,{})).u_color=this._color,e.repeat=this._repeat,e.time=!this._isPaused&&this.duration?((new Date).getTime()-this._time)%this.duration/this.duration:0,e}equals(i){return this===i||i instanceof Wi&&t.Color.equals(this._color,i._color)}togglePause(t){this._isPaused=t,this._isPaused||(this._time=(new Date).getTime());}}t.Material.PolygonArrowLineDiffuseMaterialType||(t.Material.PolygonArrowLineDiffuseMaterialType="PolygonArrowLineDiffuseMaterial"),t.Material._materialCache.getMaterial(t.Material.PolygonArrowLineDiffuseMaterialType)||t.Material._materialCache.addMaterial(t.Material.PolygonArrowLineDiffuseMaterialType,{fabric:{materials:{arrowMaterial:{type:"PolylineArrow",uniforms:{color:new t.Color(1,1,0,1)}},dashMaterial:{type:"PolylineDash",uniforms:{dashLength:16,dashPattern:255}},headMaterial:{source:"czm_material czm_getMaterial(czm_materialInput materialInput) { \n czm_material material = czm_getDefaultMaterial(materialInput); \n vec2 st = materialInput.st; \n#ifdef GL_OES_standard_derivatives \n float base = 1.0 - abs(fwidth(st.s)) * 10.0 * czm_pixelRatio; \n#else \n float base = 0.95; \n#endif \n material.alpha = 1.0 - smoothstep(base - 0.0001, base, st.s); \n material.diffuse = vec3(1.0); \n return material; \n} \n"}},components:{diffuse:"arrowMaterial.diffuse",alpha:"arrowMaterial.alpha * (1.0 - (headMaterial.alpha * (1.0 - dashMaterial.alpha)));"}},translucent:function(t){const{materials:i,uniforms:e}=t;return i.arrowMaterial.uniforms.color=e.u_color,i.headMaterial.uniforms.color=e.u_color,true}});class ji extends Li{DF={name:"\u7bad\u5934\u865a\u7ebf",color:"#64b4b2",width:15,clampToGround:true,dashLength:16,dashPattern:255,isDashed:true,currentLonlat:[],show:true,opacity:1,classificationType:"BOTH"};constructor(t,i){return super(t,i),this.options={...this.options,...this.DF,...i},this.add()}add(){try{const t="string"==typeof this.options.color?Color.fromCssColorString(this.options.color):this.options.color,i=Color.fromAlpha(t,this.options.opacity);return this.material=new Wi({color:i,dashLength:this.options.dashLength,dashPattern:this.options.dashPattern,isDashed:this.options.isDashed}),this.entity=this.viewer.entities.add({name:new CallbackProperty((()=>this.options.name),!1),id:this.options.id,show:new CallbackProperty((()=>this.options.show),!1),polyline:{positions:new CallbackProperty((()=>this.options?.lonlats?Cartesian3.fromDegreesArrayHeights(this.options.lonlats):this.options.positions),!1),width:new CallbackProperty((()=>this.options.width),!1),clampToGround:new CallbackProperty((()=>this.options.clampToGround),!1),classificationType:new CallbackProperty((()=>"string"==typeof this.options.classificationType?ClassificationType$1[this.options.classificationType]:this.options.classificationType),!1),material:this.material}}),this.options.id||this.update({id:this.entity.id}),this.applyCenter(),this}catch(t){}}update(t){if(this.options&&this.entity&&(super.update(t),!t.remove&&!t.dispose)){if(this.entity.show=this.options.show,t.color||void 0!==t.opacity){const t="string"==typeof this.options.color?Color.fromCssColorString(this.options.color):this.options.color;this.material&&(this.material.color=Color.fromAlpha(t,this.options.opacity));} void 0!==t.select&&(t.select?this.select():this.unSelect());}}select(){this.entity&&(super.select(),this.entity?.polyline&&(this.material.color=this.normalizeColor(ci,ui),this.options.width=this.options.width*pi));}unSelect(){this.entity&&(super.unSelect(),this.entity?.polyline&&(this.material.color=this.normalizeColor(this.options.color,this.options.opacity),this.options.width=this.options.width/pi));}}class Gi{constructor(i={}){this._definitionChanged=new t.Event,this._color=i.color?i.color instanceof t.Color?i.color.withAlpha(i.opacity||1):t.Color.fromCssColorString(i.color).withAlpha(i.opacity||1):new t.Color(1,1,0,1),this._gradient=t.defaultValue(i.gradient,.25),this._isInward=t.defaultValue(i.isInward,true);}get isConstant(){return false}get definitionChanged(){return this._definitionChanged}getType(i){return t.Material.CircleGradientMaterialType}getValue(i,e){return (e=t.defaultValue(e,{})).color=t.Color.clone(this._color),e.gradient=this._gradient,e.isInward=this._isInward,e}equals(i){return this===i||i instanceof Gi&&t.Property.equals(this._color,i._color)}}Object.defineProperties(Gi.prototype,{color:t.createPropertyDescriptor("color"),gradient:t.createPropertyDescriptor("gradient"),isInward:t.createPropertyDescriptor("isInward")}),t.Material.CircleGradientMaterialType||(t.Material.CircleGradientMaterialType="CircleGradientMaterial"),t.Material._materialCache.getMaterial(t.Material.CircleGradientMaterialType)||t.Material._materialCache.addMaterial(t.Material.CircleGradientMaterialType,{fabric:{type:t.Material.CircleGradientMaterialType,uniforms:{color:new t.Color(1,0,0,.5),gradient:.25,isInward:true},source:"\n uniform vec4 color;\n uniform float gradient;\n uniform bool isInward;\n\n czm_material czm_getMaterial(czm_materialInput materialInput) {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n float dist = length(st - vec2(0.5));\n \n float alpha;\n if(isInward) {\n // \u4ece\u5916\u5411\u5185\u6e10\u53d8\n alpha = 1.0 - smoothstep(0.0, gradient, dist);\n } else {\n // \u4ece\u5185\u5411\u5916\u6e10\u53d8\n alpha = smoothstep(0.5 - gradient, 0.5, dist);\n }\n \n material.diffuse = color.rgb;\n material.alpha = color.a * alpha;\n \n return material;\n }\n "},translucent:function(t){return true}});const Bi={name:"\u6e10\u53d8\u5706",color:"#64b4b2",outlineColor:"#64b4b2",outlineWidth:2,radius:100,gradient:.75,isInward:false,show:true,opacity:.75,outline:true,clampToGround:true};class Zi extends Li{constructor(t,i){return super(t,i),this.options={...this.options,...Bi,...i},this.add()}add(){try{return this.material=new Gi({color:this.normalizeColor(this.options.color,this.options.opacity),opacity:this.options.opacity,gradient:this.options.gradient,isInward:this.options.isInward}),this.entity=this.viewer.entities.add({name:new CallbackProperty((()=>this.options.name),!1),id:this.options.id,show:new CallbackProperty((()=>this.options.show),!1),position:new CallbackProperty((()=>this.options?.lonlats?Cartesian3.fromDegrees(this.options.lonlats[0],this.options.lonlats[1],this.options.lonlats[2]):this.options.positions[0]),!1),ellipse:{semiMinorAxis:new CallbackProperty((()=>this.options.radius),!1),semiMajorAxis:new CallbackProperty((()=>this.options.radius),!1),outline:this.options.outline,outlineColor:this.options.outlineColor,outlineWidth:this.options.outlineWidth,clampToGround:this.options.clampToGround,material:this.material}}),this.options.id||this.update({id:this.entity.id}),this.applyCenter(),this}catch(t){}}update(t){if(super.update(t,this),!t.remove&&!t.dispose){if(void 0!==t.show&&(this.entity.show=t.show),this.material){if(void 0!==t.color){const i="string"==typeof t.color?Color.fromCssColorString(t.color).withAlpha(this.options.opacity):t.color.withAlpha(this.options.opacity);this.material._color=i;} void 0!==t.opacity&&(this.material._color=Color.fromAlpha("string"==typeof this.options.color?Color.fromCssColorString(this.options.color):this.options.color,t.opacity));} void 0!==t.radius&&(this.entity.ellipse.semiMinorAxis=t.radius,this.entity.ellipse.semiMajorAxis=t.radius);}}select(){this.entity&&(super.select(),this.material&&(this.material._color=this.normalizeColor(Ci,bi)));}unSelect(){this.entity&&(super.unSelect(),this.material&&(this.material._color=this.normalizeColor(this.options.color,this.options.opacity)));}}class Ni extends Li{DF={name:"\u9ed8\u8ba4\u6807\u6ce8",url:"/cesium-assets/Data/baitao/Map_Patrol.png",pixelOffset:new Cartesian2(0,-30),depthOffset:new Cartesian2(0,1),imgWidth:64,imgHeight:96,scale:1,show:true,opacity:1,color:Color.WHITE,textColor:Color.WHITE,backgroundColor:Color.BLACK,backgroundOpacity:.5,backgroundPadding:new Cartesian2(10,5)};constructor(t,i){return super(t,i),this.options={...this.options,...this.DF,...i},this.add()}add(){try{return this.entity=new Entity({name:new CallbackProperty((()=>this.options.name),!1),position:new CallbackProperty((()=>{if(this.options?.lonlats)return this.options.lonlats?Cartesian3.fromDegrees(this.options.lonlats[0],this.options.lonlats[1],this.options.lonlats[2]):this.options.positions[0]}),!1),id:this.options.id&&this.options.id,show:new CallbackProperty((()=>this.options.show),!1),billboard:{image:new CallbackProperty((()=>this.options.url),!1),color:new CallbackProperty((()=>"string"==typeof this.options.color?Color.fromCssColorString(this.options.color).withAlpha(this.options.opacity):this.options.color.withAlpha(this.options.opacity)),!1),width:this.options.imgWidth,height:this.options.imgHeight,scale:this.options.scale,pixelOffset:new Cartesian2(this.options.pixelOffset.x,this.options.pixelOffset.y),disableDepthTestDistance:1/0,depthOffset:new Cartesian2(this.options.depthOffset.x,this.options.depthOffset.y),heightReference:HeightReference.CLAMP_TO_GROUND,renderingGroupId:9},label:{text:new CallbackProperty((()=>this.options.name),!1),font:"32px sans-serif",style:LabelStyle.FILL,scale:this.options.scale,fillColor:this.options.textColor,horizontalOrigin:HorizontalOrigin.CENTER,verticalOrigin:VerticalOrigin.BOTTOM,showBackground:!0,backgroundColor:this.options.backgroundColor,backgroundOpacity:this.options.backgroundOpacity,backgroundPadding:new Cartesian2(this.options.backgroundPadding.x,this.options.backgroundPadding.y),disableDepthTestDistance:1/0,depthOffset:new Cartesian2(this.options.depthOffset.x,this.options.depthOffset.y),heightReference:HeightReference.CLAMP_TO_GROUND,renderingGroupId:9}}),this.options.id||this.update({id:this.entity.id}),this.applyCenter(),this.entity&&this.viewer.entities.add(this.entity),this}catch(t){}}update(t){if(this.options&&this.entity&&(super.update(t,this),!t.remove&&!t.dispose)){if(void 0!==t.show&&(this.entity.show=t.show),t.color||t.opacity){const t="string"==typeof this.options.color?Color.fromCssColorString(this.options.color):this.options.color;this.entity?.billboard&&(this.entity.billboard.color=Color.fromAlpha(t,this.options.opacity)),this.entity?.label&&(this.entity.label.fillColor=Color.fromAlpha(this.options.textColor,this.options.opacity),this.entity.label.backgroundColor=Color.fromAlpha("string"==typeof this.options.backgroundColor?Color.fromCssColorString(this.options.backgroundColor):this.options.backgroundColor,this.options.backgroundOpacity||this.options.opacity));}t.textColor&&this.entity?.label&&(this.entity.label.fillColor=Color.fromAlpha(this.options.textColor,this.options.opacity)),t.backgroundColor&&this.entity?.label&&(this.entity.label.backgroundColor=Color.fromAlpha("string"==typeof this.options.backgroundColor?Color.fromCssColorString(this.options.backgroundColor):this.options.backgroundColor,this.options.backgroundOpacity||this.options.opacity));}}}class Ui extends Li{DF={name:"\u6a21\u578b",url:"",scale:1,minimumPixelSize:64,maximumScale:2e4,color:Color.WHITE.withAlpha(1),opacity:1,colorBlendMode:"HIGHLIGHT",colorBlendAmount:.5,silhouetteColor:Color.YELLOW,silhouetteSize:0,silhouetteOpacity:1,clampToGround:true,rotation:0,show:true,shadows:true,opacity:1,heightReference:"NONE",...Ai};label=void 0;constructor(t,i){return super(t,i),this.options=Object.assign({},this.options,this.DF,i),i.color&&(this.options.color=this._processColor(i.color,i.opacity)),this.add()}_processColor(t,i){if(void 0!==i){if(t instanceof Color)return t.withAlpha(i);if("string"==typeof t)return Color.fromCssColorString(t).withAlpha(i)}return t}add(){try{return this.entity=this.viewer.entities.add({name:new CallbackProperty((()=>this.options.name),!1),id:this.options.id,show:new CallbackProperty((()=>this.options.show),!1),position:new CallbackProperty((()=>this.options?.lonlats?Cartesian3.fromDegrees(this.options.lonlats[0],this.options.lonlats[1],this.options.lonlats[2]):this.options.position),!1),shadows:this.options.shadows,model:{uri:this.options.url,scale:this.options.scale,color:this.options.color.withAlpha(this.options.opacity),colorBlendMode:ColorBlendMode[this.options.colorBlendMode],clampToGround:this.options.clampToGround,orientation:new CallbackProperty((()=>{const[t,i,e]=this.options.rotation.map((t=>Math$1.toRadians(t)));return HeadingPitchRoll.fromRadians(t,i,e)}),!1),heightReference:new CallbackProperty((()=>"string"==typeof this.options.heightReference?HeightReference[this.options.heightReference]:this.options.heightReference),!1)}}),this.options.showName&&this.createLabel(),this.options.id||this.update({id:this.entity.id}),this.update({rotation:this.options.rotation}),this.applyCenter(),this}catch(t){}}setShadow(t){this.entity&&(this.entity.model.shadows=t?ShadowMode.ENABLED:ShadowMode.DISABLED);}update(t){if(this.options&&this.entity&&(super.update(t,this),!t.remove&&!t.dispose&&this.entity&&this.entity.model)){if(void 0!==t.url&&(this.entity.model.uri=t.url),void 0!==t.scale&&(this.entity.model.scale=t.scale),void 0!==t.show&&(this.entity.show=t.show),void 0!==t.color||void 0!==t.opacity){const i=this._processColor(t.color||this.options.color,this.options.opacity);this.entity.model.color=i;} void 0!==t.colorBlendMode&&(this.entity.model.colorBlendMode=t.colorBlendMode),void 0!==t.colorBlendAmount&&(this.entity.model.colorBlendAmount=t.colorBlendAmount),void 0!==t.silhouetteColor&&(this.options.silhouetteColor=t.silhouetteColor,this.entity.model.silhouetteColor=this._processColor(t.silhouetteColor,this.options.silhouetteOpacity)),void 0!==t.silhouetteSize&&(this.options.silhouetteSize=t.silhouetteSize,this.entity.model.silhouetteColor=this._processColor(this.options.silhouetteColor,this.options.silhouetteOpacity),this.entity.model.silhouetteSize=t.silhouetteSize),void 0!==t.silhouetteOpacity&&(this.options.silhouetteOpacity=t.silhouetteOpacity,this.entity.model.silhouetteColor=this._processColor(this.options.silhouetteColor,t.silhouetteOpacity)),void 0!==t.clampToGround&&(this.entity.model.clampToGround=t.clampToGround),void 0!==t.rotation&&this.setRotation(t.rotation),void 0!==t.scale&&(this.entity.model.scale=t.scale),void 0!==t.height&&(this.options.lonlats?this.options.lonlats[2]=t.height:this.options.position[2]=t.height),void 0!==t.shadows&&this.setShadow(t.shadows),void 0!==t.showName&&(t.showName?(this.clearLabel(),this.createLabel()):this.clearLabel()),this.label&&this.label.update(t),void 0!==t.select&&(t.select?this.select():this.unSelect());}}setRotation(t){const i=this.options?.lonlats?Cartesian3.fromDegrees(this.options.lonlats[0],this.options.lonlats[1],this.options.lonlats[2]):this.options.position,e=Math$1.toRadians(t),s=new HeadingPitchRoll(e,0,0);this.entity.orientation=Transforms.headingPitchRollQuaternion(i,s);}setSelected(t){t?(this.entity.model.silhouetteColor=Color.fromAlpha(Color.YELLOW,1),this.entity.model.silhouetteSize=4):(this.entity.model.silhouetteColor=Color.fromAlpha(Color.YELLOW,1),this.entity.model.silhouetteSize=0);}getData(){let t=super.getData();return void 0!==this.options.silhouetteColor&&(t.silhouetteColor=this.options.silhouetteColor instanceof Color?this.options.silhouetteColor.toCssHexString():this.options.silhouetteColor),t.silhouetteSize=this.options.silhouetteSize,t.silhouetteOpacity=this.options.silhouetteOpacity,{...t,...this.label?.getData()}}createLabel(){this.label=new Ii(this.entity,{...this.options,fontShow:true});}clearLabel(){this.label?.remove();}select(){this.entity&&(super.select(),this.entity.model&&(this.entity.model.silhouetteColor=this.normalizeColor(vi,wi),this.entity.model.silhouetteSize=yi,this.entity.model.silhouetteOpacity=wi));}unSelect(){this.entity&&(super.unSelect(),this.entity.model&&(this.entity.model.silhouetteColor=this.normalizeColor(this.options.silhouetteColor,this.options.silhouetteOpacity),this.entity.model.silhouetteSize=this.options.silhouetteSize,this.entity.model.silhouetteOpacity=this.options.silhouetteOpacity));}}const qi=()=>{let t=false;return navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)&&(t=true),800>document.body.clientWidth&&(t=true),t};class $i{constructor(t){this.drawTools=t,this.viewer=t.viewer,this.gizmoEntities=[],this.screenSpaceLength=100,this.selectedAxis=null,this.isMoving=false,this.startPosition=null,this.targetEntity=null,this.targetEntityId=null,this.initEventHandler(),this.cameraChangedListener=this.viewer.camera.changed.addEventListener((()=>{this.viewer.scene.requestRender();}));}initEventHandler(){this.handler=new ScreenSpaceEventHandler(this.viewer.scene.canvas),this.handler.setInputAction((t=>{const i=this.viewer.scene.pick(t.position);if(!i)return;const e=i.id;e&&e.gizmoAxis&&(this.isMoving=true,this.selectedAxis=e.gizmoAxis,this.startPosition=this.viewer.scene.pickPosition(t.position),this.viewer.scene.screenSpaceCameraController.enableRotate=false);}),ScreenSpaceEventType.LEFT_DOWN),this.handler.setInputAction((t=>{if(this.isMoving&&this.selectedAxis&&this.startPosition){const i=this.viewer.scene.pickPosition(t.endPosition);if(!i)return;const e=new Cartesian3;Cartesian3.subtract(i,this.startPosition,e);const s=this.axisVectors[this.selectedAxis],o=Cartesian3.dot(e,s),n=Cartesian3.multiplyByScalar(s,o,new Cartesian3);if(this.targetEntity&&this.targetEntity.userData){const t=this.targetEntity.userData.positions.map((t=>Array.isArray(t)?[t[0]+n.x,t[1]+n.y,t[2]+n.z]:t instanceof Cartesian3?new Cartesian3(t.x+n.x,t.y+n.y,t.z+n.z):t)),i=this.positions2lonlats(t).flat(),e=Nt(i);this.drawTools?.change(this.targetEntityId,{lonlat:e}),this.viewer.scene.requestRender();}this.startPosition=i;}this.axisHover(t);}),ScreenSpaceEventType.MOUSE_MOVE),this.handler.setInputAction((()=>{this.isMoving&&(this.isMoving=false,this.selectedAxis=null,this.startPosition=null,this.viewer.scene.screenSpaceCameraController.enableRotate=true);}),ScreenSpaceEventType.LEFT_UP);}axisHover(t){const i=this.viewer.scene.pick(t.endPosition);if(!i)return void this.gizmoEntities.forEach((t=>{t.gizmoAxis&&(t.polyline.material.color=this.getAxisColor(t.gizmoAxis),t.polyline.depthFailMaterial.color=this.getAxisColor(t.gizmoAxis));}));const e=i.id;e&&e.gizmoAxis&&(e.polyline.material.color=Color.YELLOW,e.polyline.depthFailMaterial.color=Color.YELLOW);}getCenterFromLonLat(t){if(!t||1>t.length)return;let i=0,e=0,s=0;for(let o=0;t.length>o;o+=3)i+=t[o],e+=t[o+1],s+=t[o+2];return [i/(t.length/3),e/(t.length/3),s/(t.length/3)]}show(t){if(!t||!t.userData)return;this.targetEntity&&this.targetEntity!==t&&this.hide();this.targetEntity=t.userData.isGroup?this.drawTools?.getEntityById(t.userData.id).entity:t,this.targetEntityId=t.userData.id;if(("polygon"===this.targetEntity.userData.type?.toLowerCase()||"plane"===this.targetEntity.userData.type?.toLowerCase()||"wall"===this.targetEntity.userData.type?.toLowerCase())&&this.targetEntity.userData.lonlats){const t=this.targetEntity.userData.lonlats,i=Array.isArray(t[0]);let e=i?t:[];if(!i&&t.length>3&&t.length%3==0)for(let i=0;t.length>i;i+=3)e.push([t[i],t[i+1],t[i+2]]);0>=e.length||e[0][0]===e[e.length-1][0]&&e[0][1]===e[e.length-1][1]&&e[0][2]===e[e.length-1][2]||e.push([...e[0]]);const s=[];e.forEach((t=>{s.push(t[0],t[1],t[2]);})),this.targetEntity.userData.lonlats=e,this.targetEntity.userData.positions=e.map((t=>Cartesian3.fromDegrees(t[0],t[1],t[2])));}this.createGizmo(),this.viewer.scene.requestRender();}hide(){this.clearGizmo(),this.targetEntity=null,this.targetEntityId=null,this.viewer.scene.requestRender();}createGizmo(){if(this.clearGizmo(),!this.targetEntity)return;const t=this.getEntityCenter();if(!t)return;let i,e,o;Cartographic.fromCartesian(t);const n=Transforms.eastNorthUpToFixedFrame(t);if(i=Cartesian3.normalize(Cartesian3.fromCartesian4(Matrix4.getColumn(n,0,new Cartesian4)),new Cartesian3),e=Cartesian3.normalize(Cartesian3.fromCartesian4(Matrix4.getColumn(n,1,new Cartesian4)),new Cartesian3),this.targetEntity.modelMatrix){const t=Matrix4.getRotation(this.targetEntity.modelMatrix,new Matrix3),i=new Cartesian3(0,0,1);o=new Cartesian3,Matrix3.multiplyByVector(t,i,o),Cartesian3.normalize(o,o);}else o=Cartesian3.normalize(Cartesian3.fromCartesian4(Matrix4.getColumn(n,2,new Cartesian4)),new Cartesian3);if(this.targetEntity.modelMatrix){const t=Matrix4.getRotation(this.targetEntity.modelMatrix,new Matrix3);Matrix3.multiplyByVector(t,i,i),Matrix3.multiplyByVector(t,e,e),Cartesian3.normalize(i,i),Cartesian3.normalize(e,e);}this.axisVectors={X:i,Y:e,Z:o},this.createAxisWithArrow(t,i,Color.RED,"X"),this.createAxisWithArrow(t,e,Color.GREEN,"Y"),this.createAxisWithArrow(t,o,Color.BLUE,"Z");}createAxisWithArrow(t,i,e,s){const o=this.viewer.entities.add({polyline:{positions:new CallbackProperty((()=>{const t=this.getEntityCenter();if(!t)return [];const e=Cartesian3.distance(this.viewer.camera.position,t),s=Cartesian3.multiplyByScalar(i,2*e*Math.tan(this.viewer.camera.frustum.fov/2)/this.viewer.canvas.height*this.screenSpaceLength,new Cartesian3);return [t,Cartesian3.add(t,s,new Cartesian3)]}),false),width:12,disableDepthTestDistance:0,zIndex:Number.MAX_VALUE,depthOffset:new Cartesian2(0,-30),material:new PolylineArrowMaterialProperty(e),depthFailMaterial:new PolylineArrowMaterialProperty(e)},gizmoAxis:s});this.gizmoEntities.push(o);}createArrowImage(t){const i=document.createElement("canvas");i.width=64,i.height=64;const e=i.getContext("2d");return e.beginPath(),e.moveTo(32,0),e.lineTo(48,32),e.lineTo(16,32),e.closePath(),e.fillStyle=t.toCssColorString(),e.fill(),i}getEntityCenter(){if(!this.targetEntity||!this.targetEntity.userData)return null;if(this.targetEntity.userData.center){const t=this.targetEntity.userData.center;return Cartesian3.fromDegrees(t[0],t[1],t[2])}if(!this.targetEntity.userData.positions)return null;const t=this.targetEntity.userData.positions;if(0===t.length)return null;let i=0,e=0,s=0;return t.forEach((t=>{t instanceof Cartesian3?(i+=t.x,e+=t.y,s+=t.z):(i+=t[0],e+=t[1],s+=t[2]);})),new Cartesian3(i/t.length,e/t.length,s/t.length)}positions2lonlats(t){if(!t||0===t.length)return [];const i=[];return t.forEach((t=>{let e;if(t instanceof Cartesian3)e=Cartographic.fromCartesian(t);else {const i=new Cartesian3(t[0],t[1],t[2]);e=Cartographic.fromCartesian(i);}const n=Math$1.toDegrees(e.longitude),a=Math$1.toDegrees(e.latitude);i.push([n,a,e.height]);})),i}getCenterLonLat(t){if(!t||0===t.length)return null;let i=0,e=0,n=0;t.forEach((t=>{t instanceof Cartesian3?(i+=t.x,e+=t.y,n+=t.z):(i+=t[0],e+=t[1],n+=t[2]);}));const a=new Cartesian3(i/t.length,e/t.length,n/t.length),l=Cartographic.fromCartesian(a);return [Math$1.toDegrees(l.longitude),Math$1.toDegrees(l.latitude),l.height]}updateGizmoPosition(){}updateGizmoOrientation(){const t=this.getEntityCenter();if(!t)return;const i=Cartesian3.UNIT_Z,e=Cartesian3.UNIT_X,s=Cartesian3.UNIT_Y;this.clearGizmo(),this.createAxisWithArrow(t,Cartesian3.multiplyByScalar(e,this.axisLength,new Cartesian3),Color.RED,"X"),this.createAxisWithArrow(t,Cartesian3.multiplyByScalar(s,this.axisLength,new Cartesian3),Color.GREEN,"Y"),this.createAxisWithArrow(t,Cartesian3.multiplyByScalar(i,this.axisLength,new Cartesian3),Color.BLUE,"Z");}clearGizmo(){this.gizmoEntities.forEach((t=>{this.viewer.entities.remove(t);})),this.gizmoEntities=[];}dispose(){this.clearGizmo(),this.handler&&(this.handler.destroy(),this.handler=null),this.cameraChangedListener&&(this.cameraChangedListener(),this.cameraChangedListener=null);}getAxisColor(t){switch(t){case "X":return Color.RED;case "Y":return Color.GREEN;case "Z":return Color.BLUE;default:return Color.WHITE}}}const Yi=Color.fromCssColorString("#0095ff"),Ki=Color.fromCssColorString("#00ff1d").withAlpha(.4),Xi=Color.fromCssColorString("#ff0c78").withAlpha(.75),Ji=Color.YELLOW,Qi=Color.YELLOW;class te{constructor(t){this.drawTools=t,this.viewer=t.viewer,this.targetEntity=null,this.targetEntityId=null,this.isMoving=false,this.startPosition=null,this.handler=null,this.isActive=false,this.isSingeEntity=true,this.vertexEntities=[],this.middleVertexEntities=[],this.centerVertexEntity=null,this.selectedVertexIndex=void 0,this.hoveredVertexIndex=void 0,this.tooltipEntity=null,this.isDraggingCenter=false,document.addEventListener("keydown",this.handleKeyDown.bind(this)),this.vertexRightClickCallback=null;}activate(){this.isActive||(this.isActive=true,this.initEventHandler());}deactivate(){this.isActive&&(this.isActive=false,this.clearVertexEntities(),this.clearMiddleVertexEntities(),this.clearCenterVertex(),this.clearTooltip(),this.handler&&(this.handler.destroy(),this.handler=null),this.targetEntity&&(this.targetEntity=null),this.isMoving=false,this.isDraggingCenter=false,this.startPosition=null,this.selectedVertexIndex=void 0,this.hoveredVertexIndex=void 0,this.viewer.scene.screenSpaceCameraController.enableRotate=true);}initEventHandler(){this.handler&&this.handler.destroy(),this.handler=new ScreenSpaceEventHandler(this.viewer.scene.canvas),this.downHandler(),this.moveHandler(),this.upHandler();}handleKeyDown(t){if(this.isActive&&"Delete"===t.key&&void 0!==this.hoveredVertexIndex&&"MeasureAreaVertex"===this.hoveredVertexType){const t=this.vertexEntities[this.hoveredVertexIndex].position.getValue(this.viewer.clock.currentTime);this.canDeleteVertex(this.hoveredVertexIndex)&&this.createTooltip(t,"\u662f\u5426\u5220\u9664\u8be5\u9876\u70b9\uff1f",this.hoveredVertexIndex);}}downHandler(){this.handler.setInputAction((t=>{if(!this.isActive)return;const i=this.viewer.scene.pick(t.position);if(!i)return;const e=i.id||i.primitive;this.handleVertexClick(t,e)||e&&e.userData&&this.handleEntityClick(e);}),ScreenSpaceEventType.LEFT_DOWN);}handleVertexClick(t,i){return "MeasureAreaVertex"===i.type?(this.handleMainVertexClick(t,i),true):"MeasureAreaMiddleVertex"===i.type?(this.handleMiddleVertexClick(t,i),true):"MeasureAreaCenterVertex"===i.type&&(this.handleCenterVertexClick(t,i),true)}handleMainVertexClick(t,i){this.isMoving=true,this.selectedVertexIndex=this.vertexEntities.indexOf(i),this.startPosition=this.viewer.scene.pickPosition(t.position),this.viewer.scene.screenSpaceCameraController.enableRotate=false,this.viewer._element.style.cursor="move";}handleMiddleVertexClick(t,i){const e=this.middleVertexEntities.indexOf(i)+1,n=i.position.getValue(this.viewer.clock.currentTime),a=Cartographic.fromCartesian(n),r=Math$1.toDegrees(a.longitude),l=Math$1.toDegrees(a.latitude);this.targetEntity.userData.lonlats.splice(e,0,[r,l,a.height]),this.recreateAllVertices(),this.isMoving=true,this.selectedVertexIndex=e,this.startPosition=n,this.viewer.scene.screenSpaceCameraController.enableRotate=false,this.viewer._element.style.cursor="move";}handleCenterVertexClick(t,i){this.isDraggingCenter=true;const e=i.position.getValue(this.viewer.clock.currentTime);this.startPosition=e,this.viewer.scene.screenSpaceCameraController.enableRotate=false,this.viewer._element.style.cursor="move";}recreateAllVertices(){this.clearVertexEntities(),this.clearMiddleVertexEntities(),this.clearCenterVertex(),this.targetEntity.userData.lonlats.forEach((t=>{this.createVertex(t);})),this.createMiddleVertices(),this.createCenterVertex();}handleEntityClick(t){const i=t.userData.lonlats||[],e=t.userData.isGroup,s=t.userData.type?.toLowerCase(),o="polygon"===s||"plane"===s||"wall"===t.userData.type,n="tiles"===s;this.clearAllVertices(),this.updateTargetEntity(t,e),n?this.handleTilesEntity():this.createEntityVertices(i,o);}clearAllVertices(){this.clearVertexEntities(),this.clearMiddleVertexEntities(),this.clearCenterVertex(),this.selectedVertexIndex=void 0;}updateTargetEntity(t,i){this.targetEntityId=t.userData.id,this.targetEntity=i?this.drawTools?.getEntityById(this.targetEntityId).entity:t;}handleModelEntity(){this.drawTools?.change(this.targetEntityId,{opacity:.5,silhouetteColor:Qi,silhouetteSize:2});}handleTilesEntity(){const t=this.drawTools.operator?.getTilesById(this.targetEntityId);if(t){t.options.lonlat&&(this.clearCenterVertex(),this.createCenterVertex());}}createEntityVertices(t,i){const e=Array.isArray(t[0]);let s=e?t:[];if(!e&&t.length>3&&t.length%3==0)for(let i=0;t.length>i;i+=3)s.push([t[i],t[i+1],t[i+2]]);s.length>0&&this.processVertices(s,i);}processVertices(t,i){let e=[...t];i&&this.isFirstLastPointEqual(e)&&e.splice(e.length-1,1),e.forEach((t=>{this.createVertex(t);})),e.length>1&&this.createMiddleVertices(),e.length>2&&this.createCenterForPolygon(e);}isFirstLastPointEqual(t){const i=t[0],e=t[t.length-1];return i[0]===e[0]&&i[1]===e[1]&&i[2]===e[2]}createCenterForPolygon(t){const i=[];t.forEach((t=>{i.push(t[0],t[1],t[2]);}));const e=this.getCenterFromLonLat(i);this.targetEntity.userData||(this.targetEntity.userData={}),this.targetEntity.userData=Object.assign({},this.targetEntity.userData,{center:e}),this.createCenterVertex();}moveHandler(){this.handler.setInputAction((t=>{if(!this.isActive)return;const i=this.viewer.scene.pick(t.endPosition);if(this.vertexEventHover(i),!this.targetEntity||!this.isMoving&&!this.isDraggingCenter)return;const e=this.viewer.scene.pickPosition(t.endPosition);if(!e)return;let n=Cartographic.fromCartesian(e),a=Math$1.toDegrees(n.latitude),r=Math$1.toDegrees(n.longitude);this.isDraggingCenter?this.handleCenterDrag(r,a,e):void 0!==this.selectedVertexIndex&&this.vertexEntities.length&&this.handleVertexDrag(r,a),this.startPosition=e;}),ScreenSpaceEventType.MOUSE_MOVE);}handleCenterDrag(t,i,e){const n=Cartographic.fromCartesian(this.startPosition),a=t-Math$1.toDegrees(n.longitude),r=i-Math$1.toDegrees(n.latitude);"tiles"===this.targetEntity?.userData?.type?.toLowerCase()?this.handleTilesDrag(a,r):this.handleEntityCenterDrag(a,r),this.centerVertexEntity&&(this.centerVertexEntity.position=e);}handleTilesDrag(t,i){const e=this.drawTools?.operator?.getTilesById(this.targetEntityId),s=e.options.lonlat,o=[s[0]+t,s[1]+i,s[2]];this.drawTools?.operator?.updateTiles(this.targetEntityId,{lonlat:o}),this.dragCallback&&this.dragCallback(e.options,e);}handleEntityCenterDrag(t,i){const e=this.targetEntity.userData.lonlats.map((e=>[e[0]+t,e[1]+i,e[2]]));this.vertexEntities.forEach(((t,i)=>{t.position=Cartesian3.fromDegrees(e[i][0],e[i][1],e[i][2]);})),this.updateEntityPosition(e);}handleVertexDrag(t,i){const e=this.targetEntity.userData.lonlats[this.selectedVertexIndex][2],s=Cartesian3.fromDegrees(t,i,e);this.vertexEntities[this.selectedVertexIndex].position=s;const o=this.targetEntity?.userData?.type?.toLowerCase();let n=this.targetEntity.userData.lonlats;if("wall"===o&&n.length>0){const t=n[0],i=n[n.length-1];t[0]===i[0]&&t[1]===i[1]&&t[2]===i[2]&&(n=n.slice(0,-1));}const a=n.map(((s,o)=>o===this.selectedVertexIndex?[t,i,e]:[...s]));this.updateEntityPosition(a);}updateEntityPosition(t){const i=[];t.forEach((t=>{i.push(t[0],t[1],t[2]);}));const e=this.targetEntity?.userData?.type?.toLowerCase();if("wall"===e){const e=t[0],s=t[t.length-1];e[0]===s[0]&&e[1]===s[1]&&e[2]===s[2]||i.push(t[0][0],t[0][1],t[0][2]);}const s=this.getCenterFromLonLat(i);this.drawTools?.change(this.targetEntityId,{lonlats:i,lonlat:s,center:s,skipUpdateLonlat:true});const o=this.drawTools?.getEntityById(this.targetEntityId);this.dragCallback&&this.dragCallback(this.targetEntity.userData,o),this.clearMiddleVertexEntities(),this.createMiddleVertices(),this.centerVertexEntity&&(this.centerVertexEntity.position=Cartesian3.fromDegrees(s[0],s[1],s[2]));}upHandler(){this.handler.setInputAction((()=>{if(!this.isActive)return;const t=this.targetEntity?.userData?.type?.toLowerCase();this.handleEntityPositionUpdate(t),this.resetDragState();}),ScreenSpaceEventType.LEFT_UP),this.handler.setInputAction((t=>{this.isActive&&this.handleRightClick(t);}),ScreenSpaceEventType.RIGHT_UP);}handleEntityPositionUpdate(t){if((this.isMoving||this.isDraggingCenter)&&this.targetEntity&&"tiles"!==t){const i=this.vertexEntities.map((t=>{const i=t.position.getValue(this.viewer.clock.currentTime),e=Cartographic.fromCartesian(i);return [Math$1.toDegrees(e.longitude),Math$1.toDegrees(e.latitude),e.height]}));this.targetEntity.userData.lonlats=i;const e=[];if(i.forEach((t=>{e.push(t[0],t[1],t[2]);})),"wall"===t){const t=i[0],s=i[i.length-1];t[0]===s[0]&&t[1]===s[1]&&t[2]===s[2]||e.push(i[0][0],i[0][1],i[0][2]);}const n=this.getCenterFromLonLat(e);this.drawTools?.change(this.targetEntityId,{lonlats:e,lonlat:n,center:n,skipUpdateLonlat:true});}}resetDragState(){this.isMoving=false,this.isDraggingCenter=false,this.viewer.scene.screenSpaceCameraController.enableRotate=true,this.viewer._element.style.cursor="default",this.selectedVertexIndex=void 0;}handleRightClick(t){const i=this.viewer.scene.pick(t.position);if(!i||!i.id)return;const e=i.id;if("MeasureAreaVertex"===e.type){const t=this.vertexEntities.indexOf(e);this.handleVertexRightClick(e,t);}}handleVertexRightClick(t,i){this.vertexRightClickCallback?this.vertexRightClickCallback({entity:t,vertexIndex:i,position:t.position.getValue(this.viewer.clock.currentTime),canDelete:this.canDeleteVertex(i),deleteVertex:()=>this.deleteVertex(i),targetEntity:this.targetEntity,vertexEntities:this.vertexEntities}):this.canDeleteVertex(i)&&this.createTooltip(t.position.getValue(this.viewer.clock.currentTime),"\u662f\u5426\u5220\u9664\u8be5\u9876\u70b9\uff1f",i);}canDeleteVertex(t){if(!this.targetEntity||!this.targetEntity.userData)return false;const i=this.targetEntity.userData.type?.toLowerCase(),e=this.vertexEntities.length;return "polygon"===i||"plane"===i||"wall"===i?e>3:("polyline"===i||"polyline2"===i||"polygonflowline"===i)&&e>2}deleteVertex(t){const i=this.vertexEntities.splice(t,1)[0];this.viewer.entities.remove(i),this.targetEntity.userData.lonlats.splice(t,1);const e=[];this.targetEntity.userData.lonlats.forEach((t=>{e.push(t[0],t[1],t[2]);}));const s=this.getCenterFromLonLat(e);this.drawTools?.change(this.targetEntityId,{lonlats:e,center:s}),this.clearMiddleVertexEntities(),this.createMiddleVertices(),this.vertexEntities.length>2?(this.clearCenterVertex(),this.createCenterVertex()):this.clearCenterVertex(),this.viewer.scene.requestRender();}createVertex(t){const i=this.drawTools.operator.enableTerrain;let e=this.viewer.entities.add({position:Cartesian3.fromDegrees(t[0],t[1],t[2]),type:"MeasureAreaVertex",point:{depthTest:false,color:Yi,outlineColor:Ji,outlineWidth:2,pixelSize:8,zIndex:999999,depthOffset:new Cartesian2(0,-10),disableDepthTestDistance:1/0,heightReference:i?HeightReference.CLAMP_TO_GROUND:HeightReference.NONE}});e.depthTest=false,this.vertexEntities.push(e);}createMiddleVertex(t){let i=this.viewer.entities.add({position:t,type:"MeasureAreaMiddleVertex",point:{depthTest:false,color:Ki,outlineColor:Ji,outlineWidth:2,pixelSize:6.4,disableDepthTestDistance:1/0,zIndex:9999,heightReference:this.drawTools.operator.enableTerrain?HeightReference.CLAMP_TO_GROUND:HeightReference.NONE}});i.depthTest=false,this.middleVertexEntities.push(i);}createCenterVertex(){if(!this.targetEntity||!this.targetEntity.userData.center)return;const t=this.drawTools.operator.enableTerrain,i=this.targetEntity.userData.center;this.centerVertexEntity=this.viewer.entities.add({position:Cartesian3.fromDegrees(i[0],i[1],i[2]),type:"MeasureAreaCenterVertex",point:{depthTest:false,color:Xi,outlineColor:Ji,outlineWidth:2,pixelSize:9.6,disableDepthTestDistance:1/0,zIndex:9999,heightReference:t?HeightReference.CLAMP_TO_GROUND:HeightReference.NONE}}),this.centerVertexEntity.depthTest=false;}clearCenterVertex(){this.centerVertexEntity&&(this.viewer.entities.remove(this.centerVertexEntity),this.centerVertexEntity=null);}createMiddleVertices(){if(this.clearMiddleVertexEntities(),2>this.vertexEntities.length)return;const t="polygon"===this.targetEntity?.userData?.type?.toLowerCase()||"plane"===this.targetEntity?.userData?.type?.toLowerCase()||"wall"===this.targetEntity?.userData?.type?.toLowerCase()?this.vertexEntities.length:this.vertexEntities.length-1;for(let i=0;t>i;i++){const t=this.vertexEntities[i].position.getValue(this.viewer.clock.currentTime),e=this.vertexEntities[(i+1)%this.vertexEntities.length].position.getValue(this.viewer.clock.currentTime),s=Cartesian3.midpoint(t,e,new Cartesian3);this.createMiddleVertex(s);}}vertexEventHover(t){if(!this.tooltipEntity||!this.tooltipEntity.isDeleteConfirm)if(t&&t.id){if(["MeasureAreaVertex","MeasureAreaMiddleVertex","MeasureAreaCenterVertex"].includes(t.id.type)){let i=-1;if("MeasureAreaVertex"===t.id.type?i=this.vertexEntities.indexOf(t.id):"MeasureAreaMiddleVertex"===t.id.type&&(i=this.middleVertexEntities.indexOf(t.id)),this.hoveredVertexIndex!==i||t.id.type!==this.hoveredVertexType){if(void 0!==this.hoveredVertexIndex){let t;"MeasureAreaVertex"===this.hoveredVertexType?t=this.vertexEntities[this.hoveredVertexIndex]:"MeasureAreaMiddleVertex"===this.hoveredVertexType?t=this.middleVertexEntities[this.hoveredVertexIndex]:"MeasureAreaCenterVertex"===this.hoveredVertexType&&(t=this.centerVertexEntity),t&&(t.point.pixelSize=8,t.point.outlineWidth=2),this.tooltipEntity&&!this.tooltipEntity.isDeleteConfirm&&this.clearTooltip();}t.id.point.pixelSize=12,t.id.point.outlineWidth=2,this.hoveredVertexIndex=i,this.hoveredVertexType=t.id.type;}}}else if(void 0!==this.hoveredVertexIndex){let t;"MeasureAreaVertex"===this.hoveredVertexType?t=this.vertexEntities[this.hoveredVertexIndex]:"MeasureAreaMiddleVertex"===this.hoveredVertexType?t=this.middleVertexEntities[this.hoveredVertexIndex]:"MeasureAreaCenterVertex"===this.hoveredVertexType&&(t=this.centerVertexEntity),t&&(t.point.pixelSize=8,t.point.outlineWidth=2),this.hoveredVertexIndex=void 0,this.hoveredVertexType=void 0,this.tooltipEntity&&!this.tooltipEntity.isDeleteConfirm&&this.clearTooltip();}}clearVertexEntities(){this.vertexEntities&&(this.vertexEntities.forEach((t=>{this.viewer.entities.remove(t);})),this.vertexEntities=[]);}clearMiddleVertexEntities(){this.middleVertexEntities&&(this.middleVertexEntities.forEach((t=>{this.viewer.entities.remove(t);})),this.middleVertexEntities=[]);}getCenterFromLonLat(t){if(!t||1>t.length)return;let i=0,e=0,s=0;for(let o=0;t.length>o;o+=3)i+=t[o],e+=t[o+1],s+=t[o+2];return [i/(t.length/3),e/(t.length/3),s/(t.length/3)]}createTooltip(t,i,e){this.clearTooltip();const s=document.createElement("div");s.style.position="absolute",s.style.backgroundColor="rgba(42, 42, 42, 0.8)",s.style.padding="8px",s.style.borderRadius="4px",s.style.color="white",s.style.fontSize="14px",s.style.zIndex="9999",s.style.display="none";const o=document.createElement("div");o.textContent=i,o.style.marginBottom="8px",s.appendChild(o);const n=document.createElement("div");n.style.display="flex",n.style.justifyContent="flex-end",n.style.gap="8px";const a=document.createElement("button");a.textContent="\u786e\u5b9a",a.style.padding="4px 8px",a.style.backgroundColor="#1890ff",a.style.border="none",a.style.borderRadius="2px",a.style.color="white",a.style.cursor="pointer";const r=document.createElement("button");r.textContent="\u53d6\u6d88",r.style.padding="4px 8px",r.style.backgroundColor="#666",r.style.border="none",r.style.borderRadius="2px",r.style.color="white",r.style.cursor="pointer",n.appendChild(r),n.appendChild(a),s.appendChild(n),document.body.appendChild(s);const l=()=>{const i=this.viewer.scene.cartesianToCanvasCoordinates(t);i?(s.style.left=i.x+10+"px",s.style.top=i.y-10+"px",s.style.display="block"):s.style.display="none";};l();const h=this.viewer.scene.postRender.addEventListener((()=>{l();}));a.onclick=()=>{this.canDeleteVertex(e)&&this.deleteVertex(e),this.clearTooltip();},r.onclick=()=>{this.clearTooltip();},this.tooltipEntity={element:s,postRenderListener:h,isDeleteConfirm:true};}clearTooltip(){this.tooltipEntity&&(this.tooltipEntity.element&&this.tooltipEntity.element.parentNode&&this.tooltipEntity.element.parentNode.removeChild(this.tooltipEntity.element),this.tooltipEntity.postRenderListener&&this.tooltipEntity.postRenderListener(),this.tooltipEntity=null);}dispose(){this.clearTooltip(),this.handler&&(this.handler.destroy(),this.handler=null),document.removeEventListener("keydown",this.handleKeyDown.bind(this));}onVertexRightClick(t){"function"==typeof t&&(this.vertexRightClickCallback=t);}onDrag(t){"function"==typeof t&&(this.dragCallback=t);}clearDrag(){this.dragCallback=null;}}class ie{constructor(t){this.drawTools=t,this.viewer=t.viewer,this.transformGizmo=new $i(t),this.dragControl=new te(t),this.initEventHandler(),this.editMode="none";}initEventHandler(){this.eventHandler=new ScreenSpaceEventHandler(this.viewer.scene.canvas);}activate(t="gizmo"){this.deactivate(),this.editMode=t,"gizmo"===t?this.initLeftClickEventHandler():"drag"===t&&this.dragControl.activate();}deactivate(){this.editMode="none",this.eventHandler.removeInputAction(ScreenSpaceEventType.LEFT_CLICK),this.transformGizmo.hide(),this.dragControl.deactivate();}initLeftClickEventHandler(){this.eventHandler.setInputAction((t=>{let i=this.viewer.scene.pick(t.position),e=null;i&&i.id&&(e=i.id),i&&e?(this.handleEditEntity(),this.handlePickEditEntity(e)):this.handleEditEntity();}),ScreenSpaceEventType.LEFT_CLICK);}handleEditEntity(){this.transformGizmo.hide(),this.editEntity&&(this.closeEntityEditMode(),this.editEntity=void 0,this.isEdited&&(this.isEdited=false,this.isEditing=false));}handlePickEditEntity(t){t&&(this.editEntity=t,this.isEditing=false,this.isEdited=false,this.openEntityEditMode(),this.transformGizmo.show(t));}openEntityEditMode(){this.editEntity&&(this.editEntity.show=true);}closeEntityEditMode(){this.editEntity&&(this.editEntity.show=true);}dispose(){this.deactivate(),this.eventHandler.destroy(),this.transformGizmo.dispose(),this.dragControl.dispose();}onVertexRightClick(t){return this.dragControl.onVertexRightClick(t)}handleDragControlClick(t){if(t)return this.dragControl.handleEntityClick(t)}clearDragControlClick(){this.dragControl.clearAllVertices();}}const ee=["billboard","model","waterwave","textmask","circlegradient","polyverticalline","polygonTrackLine","tiles","kml","geojson"];class se{constructor(t,i){this.viewer=t,this.positions=[],this.lonlats=[],this.vertexEntities=[],this.tempPositions=[],this.drawType="",this.showMesureResultEntity=false,this.list=new Map,this.config=i,this.enabled=false,this.isContinuous=false,this.isPausedanimAtionEffect=false,this.entityEdit=null,this.initEvents();}setBaseHeight(t){this.height=t;}initEvents(){this.handler=new t.ScreenSpaceEventHandler(this.viewer.scene.canvas),this.MeasureStartEvent=new t.Event,this.MeasureEndEvent=new t.Event;}setEnable(t){this.enabled=t;}active(t,i){return this.isContinuous=i?.isContinuous||false,this.registerEvents(),this.isMeasure=true,this.drawType=t.toLowerCase(),i&&(this.setDrawOptions=i),this.positions}deactive(){if(this.isMeasure)return this.unRegisterEvents(),this.positions}unRegisterEvents(){this.handler.removeInputAction(t.ScreenSpaceEventType.LEFT_CLICK),this.handler.removeInputAction(t.ScreenSpaceEventType.MOUSE_MOVE),this.handler.removeInputAction(t.ScreenSpaceEventType.RIGHT_CLICK);}registerEvents(){this.leftClickEvent(),this.mouseMoveEvent(),this.rightClickEvent();}leftClickEvent(){this.enabled&&this.handler.setInputAction((i=>{this.viewer._element.style.cursor="default";let e=this.viewer.scene.pickPosition(i.position);if(!e){e=this.viewer.camera.pickEllipsoid(i.position,this.viewer.scene.globe.ellipsoid);}if(!e){if(this.viewer.terrainProvider){const t=this.viewer.camera.getPickRay(i.position);if(t){const i=this.viewer.scene.globe.pick(t,this.viewer.scene);i&&(e=i);}}}if(!t.defined(e))return;let s=t.Cartographic.fromCartesian(e),o=t.Math.toDegrees(s.latitude),n=t.Math.toDegrees(s.longitude);this.lonlats.push([n,o,s.height]),this.positions.push(e),this.height=this.unifiedHeight(this.positions,this.height),1==this.positions.length&&this.createPolygonEntity(),this.createVertex();}),t.ScreenSpaceEventType.LEFT_CLICK);}mouseMoveEvent(){this.enabled&&this.handler.setInputAction((t=>{if(!this.isMeasure)return;this.viewer._element.style.cursor="default";let i=this.viewer.scene.pickPosition(t.endPosition);if(!i){i=this.viewer.camera.pickEllipsoid(t.endPosition,this.viewer.scene.globe.ellipsoid);}if(!i){if(this.viewer.terrainProvider){const e=this.viewer.camera.getPickRay(t.endPosition);if(e){const t=this.viewer.scene.globe.pick(e,this.viewer.scene);t&&(i=t);}}}i&&(qi()||this.handleMoveEvent(i));}),t.ScreenSpaceEventType.MOUSE_MOVE);}handleMoveEvent(t){1>this.positions.length||(this.height=this.unifiedHeight(this.positions,this.height),this.tempPositions=this.positions.concat(t));}createResultLabel(){}getCenterPosition(){let i=[];if(3>this.tempPositions.length)return this.tempPositions[0];this.tempPositions.forEach((t=>{const e=this.cartesian3ToPoint3D(t);i.push([e.x,e.y]);}));let e=Et.lineString(i),s=Et.bbox(e),o=Et.bboxPolygon(s),n=Et.center(o).geometry.coordinates;return t.Cartesian3.fromDegrees(n[0],n[1],this.height+.3)}unifiedHeight(i,e){let s;e||(e=this.getPositionHeight(i[0]));for(let o=0;i.length>o;o++){s=this.cartesian3ToPoint3D(i[o]),i[o]=t.Cartesian3.fromDegrees(s.x,s.y,e);}return e}createPolygonEntity(){ee.includes(this.drawType)?(this.drawEntity(),this.isContinuous?this._clearVisuals():this.clear(),this.measureEnd()):this.polygonEntity=this.viewer.entities.add({polyline:{perPositionHeight:true,positions:new t.CallbackProperty((t=>this.positions&&2>=this.positions.length?this.tempPositions:this.tempPositions.concat(this.tempPositions[0])),false),width:3,material:new t.PolylineDashMaterialProperty({color:t.Color.YELLOW}),clampToGround:true,depthTest:false,disableDepthTestDistance:1/0}});}createVertex(){const i=this.lonlats[this.lonlats.length-1],e=i?t.Cartesian3.fromDegrees(i[0],i[1],i[2]??0):this.positions[this.positions.length-1];let s=this.viewer.entities.add({position:e,type:"eidtVertex",point:{depthTest:false,color:t.Color.YELLOW,pixelSize:8,disableDepthTestDistance:1/0,outlineColor:t.Color.WHITE,outlineWidth:2}});if(s.depthTest=false,this.vertexEntities.push(s),qi()){if(1>this.positions.length)return;this.height=this.unifiedHeight(this.positions,this.height),this.tempPositions=this.positions;}}getPositionHeight(i){return t.Cartographic.fromCartesian(i).height}cartesian3ToPoint3D(i){const e=t.Cartographic.fromCartesian(i);return {x:t.Math.toDegrees(e.longitude),y:t.Math.toDegrees(e.latitude),z:e.height}}rightClickEvent(){this.enabled&&this.handler.setInputAction((t=>this.drawEnd()),t.ScreenSpaceEventType.RIGHT_CLICK);}drawEnd(){if(!this.isMeasure)return this.positions;const i=this.isContinuous?()=>this._clearVisuals():()=>this.clear();return 2===this.positions.length?(this.drawEntity(),i(),this.measureEnd()):3>this.positions.length?(i(),this.measureEnd()):(this.tempPositions=[...this.positions],this.polygonEntity&&(this.polygonEntity.polyline={positions:this.positions.concat(this.positions[0]),width:3,material:new t.PolylineDashMaterialProperty({color:t.Color.YELLOW})}),this.drawEntity(),i(),this.measureEnd()),this.positions}measureEnd(){this.MeasureEndEvent.raiseEvent(this.measureArea),this.isContinuous?this._softReset():(this.deactive(),this.deactivate());}_softReset(){this.positions=[],this.lonlats=[],this.tempPositions=[],this.height=void 0,this.isMeasure=true;}_clearVisuals(){this.viewer.entities.remove(this.polygonEntity),this.polygonEntity=void 0,this.vertexEntities.forEach((t=>{this.viewer.entities.remove(t);})),this.vertexEntities=[],this.height=void 0;}stop(){this.isContinuous=false,this.deactive(),this.clear(),this.deactivate();}deactivate(){this.isMeasure&&(this.unRegisterEvents(),this.viewer._element.style.cursor="pointer",this.viewer.enableCursorStyle=true,this.isMeasure=false,this.tempPositions=[],this.positions=[],this.lonlats=[],this.height=void 0);}clear(){this.viewer.entities.remove(this.polygonEntity),this.polygonEntity=void 0,this.vertexEntities.forEach((t=>{this.viewer.entities.remove(t);})),this.vertexEntities=[],this.viewer.entities.remove(this.vertexEntities),this.vertexEntities=[],this.height=void 0,this.setDrawOptions={};}remove(t){if(this.list.has(t)){const i=this.list.get(t);this.list.delete(t),i.entity&&this.viewer.entities.remove(i.entity);}this.billboardCustomDataSource?.entities.removeById(t),this.enableDrag(false);}change(t,i){if(this.list.has(t)){let e=this.list.get(t);return e&&e.update(i,e)}}updateDrawTypeCenter(t,i){if(this.list.has(t)){let e=this.list.get(t);return e&&e.updateLonlat&&e.updateLonlat(i,e)}}enableEdit(t){this.entityEdit||(this.entityEdit=new ie(this)),t?this.entityEdit.activate("gizmo"):this.entityEdit.deactivate();}enableDrag(t){this.entityEdit||(this.entityEdit=new ie(this)),t?this.entityEdit.activate("drag"):this.entityEdit.deactivate();}clearAll(){this.setEnable(false);const t=i=>{if(i)if(Array.isArray(i))for(let e=i.length-1;e>=0;e--)t(i[e]);else {if(i._children&&i._children.length)for(let e=i._children.length-1;e>=0;e--)t(i._children[e]);this.viewer.entities.remove(i);}},i=Array.from(this.list.entries());for(let e=i.length-1;e>=0;e--){const[s,o]=i[e];o?.dispose&&o.dispose(),t(o?.entity),this.list.delete(s);}this.list.clear(),this.billboardCustomDataSource?.entities.values.length&&this.billboardCustomDataSource?.entities.removeAll();}dispose(){this.clear(),this.clearAll(),this.entityEdit&&(this.entityEdit.dispose(),this.entityEdit=null),this.operator&&(this.operator=null);}async drawEntity(t={}){const{billboard:i,model:e,polygonFlowLine:s,textMask:o,polyVerticalLine:n,polygonTrackLine:a}=this.config?.drawEntityConfig;let r,l=this.positions,h=this.lonlats;switch(t=Object.assign({},this.setDrawOptions,t),this.isContinuous&&delete t.id,t&&t.type?this.drawType=t.type:t.type=this.drawType,"tiles"===t.type&&(r=await this.drawTiles({lonlats:h,...t})),"kml"===t.type&&(r=await this.drawKml({lonlats:h,...t})),"geojson"===t.type&&(r=await this.drawGeojson({lonlats:h,...t})),t.type.toLowerCase()){case "textmask":o&&(t=Object.assign({},o,this.setDrawOptions,t)),r=new Ni(this.viewer,{positions:l,...this.convert2CesiumFormat({lonlats:h,...t})});break;case "billboard":i&&(t=Object.assign({},i,this.setDrawOptions,t)),r=new Fi(this.viewer,{positions:l,...this.convert2CesiumFormat({lonlats:h,...t})});break;case "model":e&&(t=Object.assign({},e,this.setDrawOptions,t)),r=new Ui(this.viewer,{positions:l,...this.convert2CesiumFormat({lonlats:h,...t})});break;case "polyline":r=new Mi(this.viewer,{positions:l,...this.convert2CesiumFormat({lonlats:h,...t})});break;case "polyline2":case "polylinepath":r=new Ri(this.viewer,{positions:l,...this.convert2CesiumFormat({lonlats:h,...t})});break;case "polygonflowline":s&&(t=Object.assign({},s,this.setDrawOptions,t)),r=new xi(this.viewer,{positions:l,...this.convert2CesiumFormat({lonlats:h,...t})});break;case "polygontrackline":a&&(t=Object.assign({},a,this.setDrawOptions,t)),r=new zi(this.viewer,{positions:l,...this.convert2CesiumFormat({lonlats:h,...t})});break;case "polyverticalline":n&&(t=Object.assign({},n,this.setDrawOptions,t)),r=new Oi(this.viewer,{positions:l,...this.convert2CesiumFormat({lonlats:h,...t})});break;case "plane":l=[...this.positions,this.positions[0]],h=[...this.lonlats,this.lonlats[0]],r=new Hi(this.viewer,{positions:l,...this.convert2CesiumFormat({lonlats:h,...t})});break;case "wall":l=[...this.positions,this.positions[0]],h=[...this.lonlats,this.lonlats[0]],r=new Ei(this.viewer,{positions:l,area:Ot(this.positions),...this.convert2CesiumFormat({lonlats:h,...t})});break;case "polygon":l=[...this.positions,this.positions[0]],h=[...this.lonlats,this.lonlats[0]],r=new Di(this.viewer,{positions:l,...this.convert2CesiumFormat({lonlats:h,...t})});break;case "waterwave":r=new Vi(this.viewer,{positions:l,...this.convert2CesiumFormat({lonlats:h,...t})});break;case "polygonarrowline":r=new ji(this.viewer,{positions:l,...this.convert2CesiumFormat({lonlats:h,...t})});break;case "circlegradient":r=new Zi(this.viewer,{positions:l,...this.convert2CesiumFormat({lonlats:h,...t})});}if(r){const i=r.getData();return t.viewConfig&&(i.viewConfig=t.viewConfig),r.userData=i,r.entity&&(r.entity.userData=i),r.options.lonlat||(r.options.lonlat=i.lonlat),r.options.position||(r.options.position=i.position),this.viewer.scene.requestRender(),void 0!==this.isPausedanimAtionEffect&&r.toggleAnimation&&r.toggleAnimation(this.isPausedanimAtionEffect),this.list.set(i.id,r),this.callFun&&this.callFun(i,r),t.call&&t.call(i,r),r.rigistOperator(this.operator),r}}drawEndCallback(t){t&&(this.callFun=t);}clearDrawEndCallback(){this.callFun=null;}saveEntityView(t){if(t){const i=this.getViewConfig();t.update({viewConfig:i});const e=t.getData();t.userData=e,t.entity.userData=e,this.callFun&&this.callFun(e);}}getViewConfig(){const t=(t=>{let i=Math$1.toDegrees(t.scene.camera.heading),e=Math$1.toDegrees(t.scene.camera.pitch),s=Math$1.toDegrees(t.scene.camera.roll),n=t.scene.camera.positionCartographic,a=Math$1.toDegrees(n.longitude),l=Math$1.toDegrees(n.latitude),h=n.height;return {lng:a,lat:l,height:h,heading:i,pitch:e,roll:s,position:Cartesian3.fromDegrees(a,l,h)}})(this.viewer);return {position:[t.lng,t.lat,t.height],hpr:[t.heading,t.pitch,t.roll]}}getDrawData(t){if(t){const i=this.list.get(t);return i&&i?.getData()}{const t=[];return this.list?.forEach(((i,e)=>{if(i&&i.getData){let e={...i.getData()};e&&t.push(e);}})),t&&t}}getEntityInfoById(t){return this.list.has(t)?this.list.get(t).getData():null}getEntityById(t){return this.list.has(t)?this.list.get(t):null}hasEntityById(t){return this.list.has(t)}getEntitys(){return Array.from(this.list.values())}toggleAnimation(t){this.isPausedanimAtionEffect=t,this.list.size&&this.list.forEach(((t,i)=>{t.toggleAnimation&&t.toggleAnimation(this.isPausedanimAtionEffect);}));}flyTo(t,i){if(!this.list.has(t))return;const e=this.list.get(t).entity;return e?((t,i,e)=>{if(!i)return;const s=Object.assign(Object.assign({},{radiusFactor:2.5,heading:0,pitch:-75,duration:3,complete:null,call:null}),e);let n;if(i.model){const t=i.position.getValue(),e=i.model.scale.getValue();n=new BoundingSphere(t,s.radius||100*e);}else if(i.position){const t=i.position.getValue();n=new BoundingSphere(t,s.radius||300);}else if(i.polygon){const t=i.polygon.hierarchy.getValue().positions;n=BoundingSphere.fromPoints(t);}else if(i.polyline){const t=i.polyline.positions.getValue();n=BoundingSphere.fromPoints(t);}else if(i.wall){const t=i.wall.positions.getValue();n=BoundingSphere.fromPoints(t);}if(!n)return;const a=Math$1.toRadians(s.heading||0),r=Math$1.toRadians(s.pitch||-75),l=new HeadingPitchRange(a,r,n.radius*s.radiusFactor);t.camera.flyToBoundingSphere(n,{offset:l,duration:s.duration||3,complete:s.complete||s.callback||s.call});})(this.viewer,e,i):void 0}convert2CesiumFormat(i){let e={};for(const s in i)if(Object.prototype.hasOwnProperty.call(i,s)){const o=i[s];switch(e[s]=o,s){case "positions":let i=[];o.forEach((e=>{Array.isArray(e)&&i.push(new t.Cartesian3(e[0],e[1],e[2]));})),i&&(e[s]=i);break;case "lonlats":let n=[];o.forEach((t=>{Array.isArray(t)&&n.push(t[0],t[1],t[2]||.1);})),n&&(e[s]=n);break;case "color":case "outlineColor":e[s]=new t.Color.fromCssColorString(o);break;case "pixelOffset":e[s]=new t.Cartesian2(o[0],o[1]);break;case "eyeOffset":e[s]=new t.Cartesian3(o[0],o[1],o[2]);}}return e}rigistOperator(t){this.operator=t;}async drawTiles(t){try{const{data:i,tiles:e}=await(this.operator?.drawTiles(t));return t.call&&t.call(i,e),this.callFun&&this.callFun(i,e),e}catch(t){}}async drawKml(t){try{const{url:i}=t,e=await(this.operator?.parseKML(i,t));return t.call&&t.call(e.options,e),this.callFun&&this.callFun(e.options,e),e}catch(t){}}async drawGeojson(t){try{const{url:i}=t,e=await(this.operator?.parseGeoJson(i,t)),s=e?.getData()||e.options;return t.call&&t.call(s,e),this.callFun&&this.callFun(s,e),e}catch(t){}}onDrag(t){this.entityEdit||(this.entityEdit=new ie(this)),this.entityEdit?.dragControl?.onDrag(t);}clearDrag(){this.entityEdit?.dragControl?.clearDrag();}}const oe=(t,i,e)=>Mt(void 0,void 0,void 0,(function*(){try{const{color:s="#00ffff",flyTo:o=!0,call:n,lineWidth:a=2,name:r}=e,l=yield KmlDataSource.load(i,{camera:t.scene.camera,canvas:t.scene.canvas});t.dataSources.add(l),void 0!==r&&(l.name=r),l.entities.values.forEach((i=>(i.polygon&&(i.polygon.heightReference=new ConstantProperty(HeightReference.CLAMP_TO_GROUND),i.polyline&&(i.polyline.clampToGround=new ConstantProperty(!0))),i.polyline&&(i.polyline.clampToGround=new ConstantProperty(!0),i.polyline.arcType=new ConstantProperty(ArcType.GEODESIC),i.polyline.disableDepthTestDistance=new ConstantProperty(1/0),i.polyline.material=Color.fromCssColorString(s),i.polyline.width=new ConstantProperty(a)),o&&t.flyTo(l),n&&n(),this)));}catch(t){}})),ne=52.35987755982988,ae=3.141592653589793,re=6378245,le=.006693421622965943;class he{static BD09ToGCJ02(t,i){let e=+t-.0065,s=+i-.006,o=Math.sqrt(e*e+s*s)-2e-5*Math.sin(s*ne),n=Math.atan2(s,e)-3e-6*Math.cos(e*ne);return [o*Math.cos(n),o*Math.sin(n)]}static GCJ02ToBD09(t,i){let e=Math.sqrt((t=+t)*t+(i=+i)*i)+2e-5*Math.sin(i*ne),s=Math.atan2(i,t)+3e-6*Math.cos(t*ne);return [e*Math.cos(s)+.0065,e*Math.sin(s)+.006]}static WGS84ToGCJ02(t,i){if(this.out_of_china(t=+t,i=+i))return [t,i];{let e=this.delta(t,i);return [t+e[0],i+e[1]]}}static GCJ02ToWGS84(t,i){if(this.out_of_china(t=+t,i=+i))return [t,i];{let e=this.delta(t,i);return [2*t-(t+e[0]),2*i-(i+e[1])]}}static delta(t,i){let e=this.transformLng(t-105,i-35),s=this.transformLat(t-105,i-35);const o=i/180*ae;let n=Math.sin(o);n=1-le*n*n;const a=Math.sqrt(n);return e=180*e/(re/a*Math.cos(o)*ae),s=180*s/(re*(1-le)/(n*a)*ae),[e,s]}static transformLng(t,i){let e=300+(t=+t)+2*(i=+i)+.1*t*t+.1*t*i+.1*Math.sqrt(Math.abs(t));return e+=2*(20*Math.sin(6*t*ae)+20*Math.sin(2*t*ae))/3,e+=2*(20*Math.sin(t*ae)+40*Math.sin(t/3*ae))/3,e+=2*(150*Math.sin(t/12*ae)+300*Math.sin(t/30*ae))/3,e}static transformLat(t,i){let e=2*(t=+t)-100+3*(i=+i)+.2*i*i+.1*t*i+.2*Math.sqrt(Math.abs(t));return e+=2*(20*Math.sin(6*t*ae)+20*Math.sin(2*t*ae))/3,e+=2*(20*Math.sin(i*ae)+40*Math.sin(i/3*ae))/3,e+=2*(160*Math.sin(i/12*ae)+320*Math.sin(i*ae/30))/3,e}static out_of_china(t,i){return i=+i,!((t=+t)>73.66&&135.05>t&&i>3.86&&53.55>i)}}class de extends WebMercatorTilingScheme{constructor(t){super(t);let i=new WebMercatorProjection;this._projection.project=function(t,e){return e=he.WGS84ToGCJ02(Math$1.toDegrees(t.longitude),Math$1.toDegrees(t.latitude)),e=i.project(new Cartographic(Math$1.toRadians(e[0]),Math$1.toRadians(e[1]))),new Cartesian2(e.x,e.y)},this._projection.unproject=function(t,e){let n=i.unproject(t);return e=he.GCJ02ToWGS84(Math$1.toDegrees(n.longitude),Math$1.toDegrees(n.latitude)),new Cartographic(Math$1.toRadians(e[0]),Math$1.toRadians(e[1]))};}}class ce extends UrlTemplateImageryProvider{constructor(t={}){t.url=t.url?t.url:"img"===t.style?"https://webst{s}.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}":"cva"===t.style?"https://webst{s}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}":"https://webrd{s}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}",t.crs=t.crs||"WGS84",t.subdomains&&t.subdomains.length||(t.subdomains=["01","02","03","04"]),"WGS84"===t.crs&&(t.tilingScheme=new de(t)),super(t);}}class ue extends UrlTemplateImageryProvider{constructor(t={}){t.url=("img"===t.style?"https://p{s}.map.gtimg.com/sateTiles/{z}/{sx}/{sy}/{x}_{reverseY}.jpg?version=400&&key=d84d6d83e0e51e481e50454ccbe8986b":"https://rt{s}.map.gtimg.com/tile?z={z}&x={x}&y={reverseY}&styleid={style}&scene=0&version=347&&key=d84d6d83e0e51e481e50454ccbe8986b").replace("{style}",t.style||1),t.subdomains&&t.subdomains.length||(t.subdomains=["0","1","2"]),"img"===t.style&&(t.customTags={sx:(t,i,e,s)=>i>>4,sy:(t,i,e,s)=>(1<<s)-e>>4}),t.crs=t.crs||"WGS84","WGS84"===t.crs&&(t.tilingScheme=new de(t)),super(t);}}const pe=["9c8eabae38d04f7bd7a44c1cc4eadbd1","f3eb6408781c0aeb4d54285c8cce903f","9c8eabae38d04f7bd7a44c1cc4eadbd1","9ab1d4052eb7e63e6d44f706e27b2f52","1c05fe50f79633364018a6de51ffa11f","d9c5e12eea1dd122750381f7157b9d18","0c937be6d225e5852f4a5510e486b289","6f3f86df48e4b3bf082055e5040f818c","943bdefb4e7167308c7c4f81bcb54e55","b85cbd56630d50d8ae3811c2bdcdb855"],me=pe[Math.floor(Math.random()*pe.length)],ge="https://t{s}.tianditu.gov.cn/",fe=["7","6","5","4","3","2","1","0"];class ve extends UrlTemplateImageryProvider{constructor(){super({url:`${ge}DataServer?T=img_w&x={x}&y={y}&l={z}&tk=${me}`,tilingScheme:new WebMercatorTilingScheme,subdomains:fe,maximumLevel:18});}}class ye extends UrlTemplateImageryProvider{constructor(t={}){const i=Object.assign({},{layerType:"img",maximumLevel:21,minimumLevel:0,fileExtension:"png"},t);let e="";if(i.url)if(i.url.includes("{z}")&&i.url.includes("{x}")&&i.url.includes("{y}"))e=i.url;else {const t={img:"img_w",vec:"vec_w",ter:"ter_w",cva:"cva_w",cia:"cia_w"}[i.layerType]||"img_w";e=`${i.url.replace(/\/$/,"")}/${t}/{z}/{x}/{y}.${i.fileExtension}`;}else {e=`./public/tiles/${{img:"img_w",vec:"vec_w",ter:"ter_w",cva:"cva_w",cia:"cia_w"}[i.layerType]||"img_w"}/{z}/{x}/{y}.${i.fileExtension}`;}const s={url:e,tilingScheme:new WebMercatorTilingScheme,maximumLevel:i.maximumLevel,minimumLevel:i.minimumLevel};i.subdomains&&i.subdomains.length>0&&(s.subdomains=i.subdomains),super(s);}}class we extends UrlTemplateImageryProvider{constructor(){super({url:`${ge}DataServer?T=cia_w&x={x}&y={y}&l={z}&tk=${me}`,tilingScheme:new WebMercatorTilingScheme,subdomains:fe,maximumLevel:18});}}class Ce extends UrlTemplateImageryProvider{constructor(t={}){const i=Object.assign({},{annotationType:"cia",maximumLevel:18,minimumLevel:0,fileExtension:"png"},t);let e="";if(i.url)if(i.url.includes("{z}")&&i.url.includes("{x}")&&i.url.includes("{y}"))e=i.url;else {const t={cia:"cia_w",cva:"cva_w"}[i.annotationType]||"cia_w";e=`${i.url.replace(/\/$/,"")}/${t}/{z}/{x}/{y}.${i.fileExtension}`;}else {e=`./public/tiles/${{cia:"cia_w",cva:"cva_w"}[i.annotationType]||"cia_w"}/{z}/{x}/{y}.${i.fileExtension}`;}const s={url:e,tilingScheme:new WebMercatorTilingScheme,maximumLevel:i.maximumLevel,minimumLevel:i.minimumLevel};i.subdomains&&i.subdomains.length>0&&(s.subdomains=i.subdomains),super(s);}}class be extends UrlTemplateImageryProvider{constructor(){super({url:`${ge}DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=${me}`,tilingScheme:new WebMercatorTilingScheme,subdomains:fe,maximumLevel:18});}}class Se extends WebMapTileServiceImageryProvider{constructor(){super({url:"http://t0.tianditu.gov.cn/cva_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=cva&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default&format=tiles&tk="+me,layer:"tdtCvaLayer",style:"default",format:"image/jpeg",tileMatrixSetID:"GoogleMapsCompatible"});}}class Te extends ArcGisMapServerImageryProvider{constructor(){super({url:"https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer",layer:"arcImgLayer",style:"default",format:"image/jpeg",tileMatrixSetID:"GoogleMapsCompatible",show:true,maximumLevel:18});}}class Le extends ArcGisMapServerImageryProvider{constructor(){super({url:"https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer",layer:"arcImgLayer",style:"default",format:"image/jpeg",tileMatrixSetID:"GoogleMapsCompatible",show:true,maximumLevel:18});}}const Ee="http://webst01.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}",De="https://wprd01.is.autonavi.com/appmaptile?x={x}&y={y}&z={z}&lang=zh_cn&size=1&scl=1&style=8&ltype=11",Me="https://wprd01.is.autonavi.com/appmaptile?x={x}&y={y}&z={z}&lang=zh_cn&size=1&scl=1&style=8&ltype=4",Re="http://webst01.is.autonavi.com/appmaptile?style=8&x={x}&y={y}&z={z}",xe="http://webrd01.is.autonavi.com/appmaptile?&scale=1&lang=zh_cn&style=8&x={x}&y={y}&z={z}";class ke extends UrlTemplateImageryProvider{constructor(t={}){super(Object.assign({},{url:Ee,tilingScheme:new WebMercatorTilingScheme,maximumLevel:18,minimumLevel:1},t));}}const Pe=(t=Ee)=>new ke({url:t}),Oe=(t=De)=>new ke({url:t}),Ae=(t=Me)=>new ke({url:t}),Ie=(t=Re)=>new ke({url:t}),_e=(t=xe)=>new ke({url:t});class Fe{constructor(i,e){this.viewer=i,this.options=e,this.filterRGB="string"==typeof e.filterColor?t.Color.fromCssColorString(e.filterColor).toBytes():e.filterColor.toBytes(),this.modifyMap();}modifyMap(){const t=this.viewer.imageryLayers.get(0);t.brightness=this.options.brightness||.6,t.contrast=this.options.contrast||1.8,t.gamma=this.options.gamma||.3,t.hue=this.options.hue||1,t.saturation=this.options.saturation||0;const i=this.viewer.scene.globe._surfaceShaderSet.baseFragmentShaderSource.sources;for(let t=0;i.length>t;t++){let e="color = czm_saturation(color, textureSaturation);\n#endif\n";this.options.invertColor&&(e+="\n color.r = 1.0 - color.r;\n color.g = 1.0 - color.g;\n color.b = 1.0 - color.b;\n "),this.filterRGB.length>0&&(e+=`\n color.r = color.r * ${this.filterRGB[0]}.0/255.0;\n color.g = color.g * ${this.filterRGB[1]}.0/255.0;\n color.b = color.b * ${this.filterRGB[2]}.0/255.0;\n `),i[t]=i[t].replace("color = czm_saturation(color, textureSaturation);\n#endif\n",e);}return this.viewer.scene.requestRender(),t}changeFilterColor(i){this.filterRGB="string"==typeof i?t.Color.fromCssColorString(i).toBytes():i.toBytes(),this.modifyMap();}dispose(){this.restoreOriginalShader(),this.viewer.scene.requestRender();}}class ze{constructor(t){this.list=new Map,this.originalShaderSources=null,this.filterLayer=null,this.offlineUrl=null,this.viewer=t;}add(t,i){this.list.set(t,i);}remove(t){this.list.has(t)&&this.list.get(t);}get(t){}show(t){}hide(t){}clear(){ void 0!==this.viewer.imageryLayers.get(0)&&this.viewer.imageryLayers.removeAll();}dispose(){this.list.clear(),this.viewer.imageryLayers.remove(this.privider),this.viewer.imageryLayers.removeAll(true),this.originalShaderSources=null;}changeImageLayer(t,i){switch(t){case "\u84dd\u8272\u5730\u7403":this.clear();return this.addSingleImg(i||"/cesium-assets/Assets/Images/world_1.jpg");case "\u65e0\u5e95\u56fe":return this.clear(),this.addSingleImg();case "\u5929\u5730\u56fe\u5f71\u50cf":case "\u5929\u5730\u56fe":return this.addTDTLayer(i);case "\u5929\u5730\u56fe\u5f71\u50cf\u6ce8\u8bb0":return this.addTDTCLayer();case "\u5929\u5730\u56fe\u77e2\u91cf":return this.addTDTLayerVector(i);case "\u5929\u5730\u56fe\u77e2\u91cf\u6ce8\u8bb0":return this.addTDTCLayerVector();case "\u9ad8\u5fb7\u5f71\u50cf":return this.addAmapImager();case "ArcGIS\u5f71\u50cf":this.privider=new Le;break;case "\u817e\u8baf\u5f71\u50cf":case "\u5730\u56fe5":this.privider=new ue({crs:"WGS84"});break;case "\u5730\u56fe1":break;case "\u5730\u56fe2":this.privider=new ce({style:"cva",crs:"WGS84"});break;case "\u5730\u56fe3":case "\u5730\u56fe4":this.privider=new ce({crs:"WGS84"});break;case "\u5730\u56fe6":this.privider=new ue({crs:"WGS84",style:"img"});break;case "\u5730\u56fe7":this.privider=new ue({style:4});break;case "\u5730\u56fe9":this.privider=new Te;break;case "\u7eaf\u74e6\u7247":this.privider=Pe();break;case "\u7eaf\u8def\u7f51":this.privider=Oe();break;case "\u7eaf\u5730\u540d":this.privider=Ae();break;case "\u5730\u540d\u548c\u8def\u7f51":this.privider=Ie();break;case "\u77e2\u91cf\u5207\u7247":this.privider=_e();}return this.addLayer(this.privider),this.privider}addLayer(t){this.clear(),this.viewer.imageryLayers.addImageryProvider(t,0);}addAmapImager(){this.clear(),this.privider=new ce({style:"img",crs:"WGS84"}),this.viewer.imageryLayers.addImageryProvider(this.privider,0),this.wmts_privider=new ce({style:"cva",crs:"WGS84"}),this.viewer.imageryLayers.addImageryProvider(this.wmts_privider,1);}addTDTLayer(t){this.clear(),this.offlineUrl=t||null,this.privider=t?new ye({url:t}):new ve,this.viewer.imageryLayers.addImageryProvider(this.privider,0),this.addTDTCLayer();}addTDTCLayer(){const t=this.offlineUrl&&(this.offlineUrl.includes("{z}")||this.offlineUrl.includes("{x}")||this.offlineUrl.includes("{y}"));this.wmts_privider=this.offlineUrl&&!t?new Ce({url:this.offlineUrl}):new we,this.viewer.imageryLayers.addImageryProvider(this.wmts_privider,1);}addTDTLayerVector(t){this.clear(),this.offlineUrl=t||null,this.privider=t?new ye({url:t,layerType:"vec"}):new be,this.viewer.imageryLayers.addImageryProvider(this.privider,0),this.addTDTCLayerVector();}addTDTCLayerVector(){const t=this.offlineUrl&&(this.offlineUrl.includes("{z}")||this.offlineUrl.includes("{x}")||this.offlineUrl.includes("{y}"));this.wmts_privider=this.offlineUrl&&!t?new Ce({url:this.offlineUrl,annotationType:"cva"}):new Se,this.viewer.imageryLayers.addImageryProvider(this.wmts_privider,1);}addSingleImg(t="/cesium-assets/Assets/Images/null.png"){const i=new SingleTileImageryProvider({url:t});this.viewer.imageryLayers.addImageryProvider(i);}changeBaseMapColor(t="#4e70a6",i={}){ void 0!==this.viewer.imageryLayers.get(0)&&(this.filterLayer?this.filterLayer.changeFilterColor(t):this.filterLayer=new Fe(this.viewer,{invertColor:true,filterColor:t,brightness:i.brightness||.6,contrast:i.contrast||1.8,gamma:i.gamma||.3,hue:i.hue||1,saturation:i.saturation||0}));}resetBaseMapColor(){this.filterLayer&&(this.filterLayer.dispose(),this.filterLayer=null);}}class He{constructor(t,i){this._viewer=t,this._amount=i;}_bindEvent(){this._viewer.clock.onTick.addEventListener(this._aroundView.bind(this));}_unbindEvent(){this._viewer.camera.lookAtTransform(Matrix4.IDENTITY),this._viewer.clock.onTick.removeEventListener(this._aroundView.bind(this));}start(){return this._viewer.clock.shouldAnimate=true,this._unbindEvent(),this._bindEvent(),this}stop(){return this._viewer.clock.shouldAnimate=false,this._unbindEvent(),this}_aroundView(){if(this._viewer.clock.shouldAnimate){let t=this._viewer.camera.heading,i=this._viewer.camera.pitch,e=this._viewer.camera.roll;t+=Math$1.toRadians(this._amount),2*Math.PI>t&&t>2*-Math.PI||(t=0),this._viewer.camera.setView({orientation:{heading:t,pitch:i,roll:e}});}}}var Ve=knockout,We=function(t,i,e){i=getElement(i);var s,o=function(t){var i=document.createElement("div");i.innerHTML=t;for(var e=document.createDocumentFragment();i.firstChild;)e.appendChild(i.firstChild);return e}(t),n=[];for(s=0;o.childNodes.length>s;++s)n.push(o.childNodes[s]);for(i.appendChild(o),s=0;n.length>s;++s){var a=n[s];1!==a.nodeType&&8!==a.nodeType||Ve.applyBindings(e,a);}return n},je=knockout,Ge=function(t){if(!defined(t)||!defined(t.terria))throw new DeveloperError("options.terria is required.");this.terria=t.terria,this._removeSubscription=void 0,this._lastLegendUpdate=void 0,this.eventHelper=new EventHelper,this.distanceLabel=void 0,this.barWidth=void 0,this.enableDistanceLegend=!defined(t.enableDistanceLegend)||t.enableDistanceLegend,je.track(this,["distanceLabel","barWidth"]),this.eventHelper.add(this.terria.afterWidgetChanged,(function(){defined(this._removeSubscription)&&(this._removeSubscription(),this._removeSubscription=void 0);}),this);var i=this;function e(){if(defined(i.terria)){var t=i.terria.scene;i._removeSubscription=t.postRender.addEventListener((function(){!function(t,i){if(!t.enableDistanceLegend)return t.barWidth=void 0,void(t.distanceLabel=void 0);var e=getTimestamp();if(t._lastLegendUpdate+250>e)return;t._lastLegendUpdate=e;var s=i.canvas.clientWidth,o=i.canvas.clientHeight,n=i.camera.getPickRay(new Cartesian2(s/2|0,o-1)),a=i.camera.getPickRay(new Cartesian2(1+s/2|0,o-1)),r=i.globe,l=r.pick(n,i),h=r.pick(a,i);if(!defined(l)||!defined(h))return t.barWidth=void 0,void(t.distanceLabel=void 0);var d=r.ellipsoid.cartesianToCartographic(l),c=r.ellipsoid.cartesianToCartographic(h);Be.setEndPoints(d,c);for(var u,m=Be.surfaceDistance,g=100,f=Ze.length-1;!defined(u)&&f>=0;--f)g>Ze[f]/m&&(u=Ze[f]);if(defined(u)){var v;v=1e3>u?u+" m":u/1e3+" km",t.barWidth=u/m|0,t.distanceLabel=v;}else t.barWidth=void 0,t.distanceLabel=void 0;}(this,t);}),i);}}e(),this.eventHelper.add(this.terria.afterWidgetChanged,(function(){e();}),this);};Ge.prototype.destroy=function(){this.eventHelper.removeAll();},Ge.prototype.show=function(t){We(this.enableDistanceLegend?'<div class="distance-legend" data-bind="visible: distanceLabel && barWidth"><div class="distance-legend-label" data-bind="text: distanceLabel"></div><div class="distance-legend-scale-bar" data-bind="style: { width: barWidth + \'px\', left: (5 + (125 - barWidth) / 2) + \'px\' }"></div></div>':'<div class="distance-legend" style="display: none;" data-bind="visible: distanceLabel && barWidth"><div class="distance-legend-label" data-bind="text: distanceLabel"></div><div class="distance-legend-scale-bar" data-bind="style: { width: barWidth + \'px\', left: (5 + (125 - barWidth) / 2) + \'px\' }"></div></div>',t,this);},Ge.create=function(t){var i=new Ge(t);return i.show(t.container),i};var Be=new EllipsoidGeodesic,Ze=[1,2,3,5,10,20,30,50,100,200,300,500,1e3,2e3,3e3,5e3,1e4,2e4,3e4,5e4,1e5,2e5,3e5,5e5,1e6,2e6,3e6,5e6,1e7,2e7,3e7,5e7];var Ne=knockout,Ue=function(t){if(!defined(t))throw new DeveloperError("terria is required");this._terria=t,this.name="Unnamed Control",this.text=void 0,this.svgIcon=void 0,this.svgHeight=void 0,this.svgWidth=void 0,this.cssClass=void 0,this.isActive=false,Ne.track(this,["name","svgIcon","svgHeight","svgWidth","cssClass","isActive"]);};Object.defineProperties(Ue.prototype,{terria:{get:function(){return this._terria}},hasText:{get:function(){return defined(this.text)&&"string"==typeof this.text}}}),Ue.prototype.activate=function(){throw new DeveloperError("activate must be implemented in the derived class.")};var qe=function(t){Ue.apply(this,arguments);},$e=function(t){qe.apply(this,arguments),this.name=t.options.resetTooltip?t.options.resetTooltip:"\u91cd\u7f6e\u89c6\u56fe",this.navigationLocked=false,this.svgIcon=t.options.resetSvg?"":"M 7.5,0 C 3.375,0 0,3.375 0,7.5 0,11.625 3.375,15 7.5,15 c 3.46875,0 6.375,-2.4375 7.21875,-5.625 l -1.96875,0 C 12,11.53125 9.9375,13.125 7.5,13.125 4.40625,13.125 1.875,10.59375 1.875,7.5 1.875,4.40625 4.40625,1.875 7.5,1.875 c 1.59375,0 2.90625,0.65625 3.9375,1.6875 l -3,3 6.5625,0 L 15,0 12.75,2.25 C 11.4375,0.84375 9.5625,0 7.5,0 z",this.resetSvg=t.options.resetSvg,this.resetSuccess=t.options.resetSuccess,this.svgHeight=15,this.svgWidth=15,this.cssClass="navigation-control-icon-reset";};($e.prototype=Object.create(qe.prototype=Object.create(Ue.prototype))).setNavigationLocked=function(t){this.navigationLocked=t;},$e.prototype.resetView=function(){if(!this.navigationLocked){var t=this.terria.scene;if(t.screenSpaceCameraController.enableInputs){this.isActive=true;var i=t.camera;if(defined(this.terria.trackedEntity)){var e=this.terria.trackedEntity;this.terria.trackedEntity=void 0,this.terria.trackedEntity=e;}else {const e=this.terria.options.duration?this.terria.options.duration:3;if(this.terria.options.defaultResetView){const n=this.terria.options.orientation?this.terria.options.orientation:{heading:Math$1.toRadians(5.729578)};if(this.terria.options.defaultResetView&&this.terria.options.defaultResetView instanceof Cartographic)i.flyTo({destination:t.globe.ellipsoid.cartographicToCartesian(this.terria.options.defaultResetView),orientation:n,duration:e});else if(this.terria.options.defaultResetView&&this.terria.options.defaultResetView instanceof Rectangle)try{Rectangle.validate(this.terria.options.defaultResetView),i.flyTo({destination:this.terria.options.defaultResetView,orientation:n,duration:e,complete:this.resetSuccess});}catch(t){}}else "function"==typeof i.flyHome?i.flyHome(1):i.flyTo({destination:Camera.DEFAULT_VIEW_RECTANGLE,duration:e});}this.isActive=false;}}},$e.prototype.activate=function(){this.resetView();};var Ye={},Ke=new Cartographic,Xe=new Ray;Ye.getCameraFocus=function(t,i,e){var s=t.scene,o=s.camera;if(s.mode!==SceneMode.MORPHING&&(defined(e)||(e=new Cartesian3),defined(t.trackedEntity)?e=t.trackedEntity.position.getValue(t.clock.currentTime,e):(Xe.origin=o.positionWC,Xe.direction=o.directionWC,e=s.globe.pick(Xe,s,e)),defined(e)))return s.mode===SceneMode.SCENE2D||s.mode===SceneMode.COLUMBUS_VIEW?(e=o.worldToCameraCoordinatesPoint(e,e),i&&(e=s.globe.ellipsoid.cartographicToCartesian(s.mapProjection.unproject(e,Ke),e))):i||(e=o.worldToCameraCoordinatesPoint(e,e)),e};var Je=function(t,i){qe.apply(this,arguments),this.name=i?t.options.zoomInTooltip?t.options.zoomInTooltip:"\u653e\u5927":t.options.zoomOutTooltip?t.options.zoomOutTooltip:"\u7f29\u5c0f",i?t.options.zoomInSvg?this.zoomInSvg=t.options.zoomInSvg:this.text="+":t.options.zoomOutSvg?this.zoomOutSvg=t.options.zoomOutSvg:this.text="-",this.cssClass="navigation-control-icon-zoom-"+(i?"in":"out"),this.relativeAmount=2,i&&(this.relativeAmount=1/this.relativeAmount);};Je.prototype.relativeAmount=1,(Je.prototype=Object.create(qe.prototype)).activate=function(){this.zoom(this.relativeAmount);};var Qe=new Cartesian3;Je.prototype.zoom=function(t){if(this.isActive=true,defined(this.terria)){var i=this.terria.scene,e=i.screenSpaceCameraController;if(!e.enableInputs||!e.enableZoom)return;var s,o=i.camera;switch(i.mode){case SceneMode.MORPHING:break;case SceneMode.SCENE2D:o.zoomIn(o.positionCartographic.height*(1-this.relativeAmount));break;default:var n;if(n=defined(this.terria.trackedEntity)?new Cartesian3:Ye.getCameraFocus(this.terria,false),defined(n))s={direction:o.direction,up:o.up};else {var a=new Ray(o.worldToCameraCoordinatesPoint(i.globe.ellipsoid.cartographicToCartesian(o.positionCartographic)),o.directionWC);n=IntersectionTests.grazingAltitudeLocation(a,i.globe.ellipsoid),s={heading:o.heading,pitch:o.pitch,roll:o.roll};}if(o.position.z>=406944828719368.56)return;var l=Cartesian3.subtract(o.position,n,Qe),h=Cartesian3.multiplyByScalar(l,t,l),d=Cartesian3.add(n,h,n);defined(this.terria.trackedEntity)||i.mode===SceneMode.COLUMBUS_VIEW?o.position=d:o.flyTo({destination:d,orientation:s,duration:.5,convert:false});}}this.isActive=false;};var ts=knockout,is=function(t){this.terria=t.terria,this.eventHelper=new EventHelper,this.enableZoomControls=!defined(t.enableZoomControls)||t.enableZoomControls,this.enableCompass=!defined(t.enableCompass)||t.enableCompass,this.navigationLocked=false,this.controls=t.controls,defined(this.controls)||(this.controls=[new Je(this.terria,true),new $e(this.terria),new Je(this.terria,false)]),this.svgCompassOuterRing="m 66.5625,0 0,15.15625 3.71875,0 0,-10.40625 5.5,10.40625 4.375,0 0,-15.15625 -3.71875,0 0,10.40625 L 70.9375,0 66.5625,0 z M 72.5,20.21875 c -28.867432,0 -52.28125,23.407738 -52.28125,52.28125 0,28.87351 23.413818,52.3125 52.28125,52.3125 28.86743,0 52.28125,-23.43899 52.28125,-52.3125 0,-28.873512 -23.41382,-52.28125 -52.28125,-52.28125 z m 0,1.75 c 13.842515,0 26.368948,5.558092 35.5,14.5625 l -11.03125,11 0.625,0.625 11.03125,-11 c 8.9199,9.108762 14.4375,21.579143 14.4375,35.34375 0,13.764606 -5.5176,26.22729 -14.4375,35.34375 l -11.03125,-11 -0.625,0.625 11.03125,11 c -9.130866,9.01087 -21.658601,14.59375 -35.5,14.59375 -13.801622,0 -26.321058,-5.53481 -35.4375,-14.5 l 11.125,-11.09375 c 6.277989,6.12179 14.857796,9.90625 24.3125,9.90625 19.241896,0 34.875,-15.629154 34.875,-34.875 0,-19.245847 -15.633104,-34.84375 -34.875,-34.84375 -9.454704,0 -18.034511,3.760884 -24.3125,9.875 L 37.0625,36.4375 C 46.179178,27.478444 58.696991,21.96875 72.5,21.96875 z m -0.875,0.84375 0,13.9375 1.75,0 0,-13.9375 -1.75,0 z M 36.46875,37.0625 47.5625,48.15625 C 41.429794,54.436565 37.65625,63.027539 37.65625,72.5 c 0,9.472461 3.773544,18.055746 9.90625,24.34375 L 36.46875,107.9375 c -8.96721,-9.1247 -14.5,-21.624886 -14.5,-35.4375 0,-13.812615 5.53279,-26.320526 14.5,-35.4375 z M 72.5,39.40625 c 18.297686,0 33.125,14.791695 33.125,33.09375 0,18.302054 -14.827314,33.125 -33.125,33.125 -18.297687,0 -33.09375,-14.822946 -33.09375,-33.125 0,-18.302056 14.796063,-33.09375 33.09375,-33.09375 z M 22.84375,71.625 l 0,1.75 13.96875,0 0,-1.75 -13.96875,0 z m 85.5625,0 0,1.75 14,0 0,-1.75 -14,0 z M 71.75,108.25 l 0,13.9375 1.71875,0 0,-13.9375 -1.71875,0 z",this.svgCompassGyro="m 72.71875,54.375 c -0.476702,0 -0.908208,0.245402 -1.21875,0.5625 -0.310542,0.317098 -0.551189,0.701933 -0.78125,1.1875 -0.172018,0.363062 -0.319101,0.791709 -0.46875,1.25 -6.91615,1.075544 -12.313231,6.656514 -13,13.625 -0.327516,0.117495 -0.661877,0.244642 -0.9375,0.375 -0.485434,0.22959 -0.901634,0.471239 -1.21875,0.78125 -0.317116,0.310011 -0.5625,0.742111 -0.5625,1.21875 l 0.03125,0 c 0,0.476639 0.245384,0.877489 0.5625,1.1875 0.317116,0.310011 0.702066,0.58291 1.1875,0.8125 0.35554,0.168155 0.771616,0.32165 1.21875,0.46875 1.370803,6.10004 6.420817,10.834127 12.71875,11.8125 0.146999,0.447079 0.30025,0.863113 0.46875,1.21875 0.230061,0.485567 0.470708,0.870402 0.78125,1.1875 0.310542,0.317098 0.742048,0.5625 1.21875,0.5625 0.476702,0 0.876958,-0.245402 1.1875,-0.5625 0.310542,-0.317098 0.582439,-0.701933 0.8125,-1.1875 0.172018,-0.363062 0.319101,-0.791709 0.46875,-1.25 6.249045,-1.017063 11.256351,-5.7184 12.625,-11.78125 0.447134,-0.1471 0.86321,-0.300595 1.21875,-0.46875 0.485434,-0.22959 0.901633,-0.502489 1.21875,-0.8125 0.317117,-0.310011 0.5625,-0.710861 0.5625,-1.1875 l -0.03125,0 c 0,-0.476639 -0.245383,-0.908739 -0.5625,-1.21875 C 89.901633,71.846239 89.516684,71.60459 89.03125,71.375 88.755626,71.244642 88.456123,71.117495 88.125,71 87.439949,64.078341 82.072807,58.503735 75.21875,57.375 c -0.15044,-0.461669 -0.326927,-0.884711 -0.5,-1.25 -0.230061,-0.485567 -0.501958,-0.870402 -0.8125,-1.1875 -0.310542,-0.317098 -0.710798,-0.5625 -1.1875,-0.5625 z m -0.0625,1.40625 c 0.03595,-0.01283 0.05968,0 0.0625,0 0.0056,0 0.04321,-0.02233 0.1875,0.125 0.144288,0.147334 0.34336,0.447188 0.53125,0.84375 0.06385,0.134761 0.123901,0.309578 0.1875,0.46875 -0.320353,-0.01957 -0.643524,-0.0625 -0.96875,-0.0625 -0.289073,0 -0.558569,0.04702 -0.84375,0.0625 C 71.8761,57.059578 71.936151,56.884761 72,56.75 c 0.18789,-0.396562 0.355712,-0.696416 0.5,-0.84375 0.07214,-0.07367 0.120304,-0.112167 0.15625,-0.125 z m 0,2.40625 c 0.448007,0 0.906196,0.05436 1.34375,0.09375 0.177011,0.592256 0.347655,1.271044 0.5,2.03125 0.475097,2.370753 0.807525,5.463852 0.9375,8.9375 -0.906869,-0.02852 -1.834463,-0.0625 -2.78125,-0.0625 -0.92298,0 -1.802327,0.03537 -2.6875,0.0625 0.138529,-3.473648 0.493653,-6.566747 0.96875,-8.9375 0.154684,-0.771878 0.320019,-1.463985 0.5,-2.0625 0.405568,-0.03377 0.804291,-0.0625 1.21875,-0.0625 z m -2.71875,0.28125 c -0.129732,0.498888 -0.259782,0.987558 -0.375,1.5625 -0.498513,2.487595 -0.838088,5.693299 -0.96875,9.25 -3.21363,0.15162 -6.119596,0.480068 -8.40625,0.9375 -0.682394,0.136509 -1.275579,0.279657 -1.84375,0.4375 0.799068,-6.135482 5.504716,-11.036454 11.59375,-12.1875 z M 75.5,58.5 c 6.043169,1.18408 10.705093,6.052712 11.5,12.15625 -0.569435,-0.155806 -1.200273,-0.302525 -1.875,-0.4375 -2.262525,-0.452605 -5.108535,-0.783809 -8.28125,-0.9375 -0.130662,-3.556701 -0.470237,-6.762405 -0.96875,-9.25 C 75.761959,59.467174 75.626981,58.990925 75.5,58.5 z m -2.84375,12.09375 c 0.959338,0 1.895843,0.03282 2.8125,0.0625 C 75.48165,71.267751 75.5,71.871028 75.5,72.5 c 0,1.228616 -0.01449,2.438313 -0.0625,3.59375 -0.897358,0.0284 -1.811972,0.0625 -2.75,0.0625 -0.927373,0 -1.831062,-0.03473 -2.71875,-0.0625 -0.05109,-1.155437 -0.0625,-2.365134 -0.0625,-3.59375 0,-0.628972 0.01741,-1.232249 0.03125,-1.84375 0.895269,-0.02827 1.783025,-0.0625 2.71875,-0.0625 z M 68.5625,70.6875 c -0.01243,0.60601 -0.03125,1.189946 -0.03125,1.8125 0,1.22431 0.01541,2.407837 0.0625,3.5625 -3.125243,-0.150329 -5.92077,-0.471558 -8.09375,-0.90625 -0.784983,-0.157031 -1.511491,-0.316471 -2.125,-0.5 -0.107878,-0.704096 -0.1875,-1.422089 -0.1875,-2.15625 0,-0.115714 0.02849,-0.228688 0.03125,-0.34375 0.643106,-0.20284 1.389577,-0.390377 2.25,-0.5625 2.166953,-0.433487 4.97905,-0.75541 8.09375,-0.90625 z m 8.3125,0.03125 c 3.075121,0.15271 5.824455,0.446046 7.96875,0.875 0.857478,0.171534 1.630962,0.360416 2.28125,0.5625 0.0027,0.114659 0,0.228443 0,0.34375 0,0.735827 -0.07914,1.450633 -0.1875,2.15625 -0.598568,0.180148 -1.29077,0.34562 -2.0625,0.5 -2.158064,0.431708 -4.932088,0.754666 -8.03125,0.90625 0.04709,-1.154663 0.0625,-2.33819 0.0625,-3.5625 0,-0.611824 -0.01924,-1.185379 -0.03125,-1.78125 z M 57.15625,72.5625 c 0.0023,0.572772 0.06082,1.131112 0.125,1.6875 -0.125327,-0.05123 -0.266577,-0.10497 -0.375,-0.15625 -0.396499,-0.187528 -0.665288,-0.387337 -0.8125,-0.53125 -0.147212,-0.143913 -0.15625,-0.182756 -0.15625,-0.1875 0,-0.0047 -0.02221,-0.07484 0.125,-0.21875 0.147212,-0.143913 0.447251,-0.312472 0.84375,-0.5 0.07123,-0.03369 0.171867,-0.06006 0.25,-0.09375 z m 31.03125,0 c 0.08201,0.03503 0.175941,0.05872 0.25,0.09375 0.396499,0.187528 0.665288,0.356087 0.8125,0.5 0.14725,0.14391 0.15625,0.21405 0.15625,0.21875 0,0.0047 -0.009,0.04359 -0.15625,0.1875 -0.147212,0.143913 -0.416001,0.343722 -0.8125,0.53125 -0.09755,0.04613 -0.233314,0.07889 -0.34375,0.125 0.06214,-0.546289 0.09144,-1.094215 0.09375,-1.65625 z m -29.5,3.625 c 0.479308,0.123125 0.983064,0.234089 1.53125,0.34375 2.301781,0.460458 5.229421,0.787224 8.46875,0.9375 0.167006,2.84339 0.46081,5.433176 0.875,7.5 0.115218,0.574942 0.245268,1.063612 0.375,1.5625 -5.463677,-1.028179 -9.833074,-5.091831 -11.25,-10.34375 z m 27.96875,0 C 85.247546,81.408945 80.919274,85.442932 75.5,86.5 c 0.126981,-0.490925 0.261959,-0.967174 0.375,-1.53125 0.41419,-2.066824 0.707994,-4.65661 0.875,-7.5 3.204493,-0.15162 6.088346,-0.480068 8.375,-0.9375 0.548186,-0.109661 1.051942,-0.220625 1.53125,-0.34375 z M 70.0625,77.53125 c 0.865391,0.02589 1.723666,0.03125 2.625,0.03125 0.912062,0 1.782843,-0.0048 2.65625,-0.03125 -0.165173,2.736408 -0.453252,5.207651 -0.84375,7.15625 -0.152345,0.760206 -0.322989,1.438994 -0.5,2.03125 -0.437447,0.03919 -0.895856,0.0625 -1.34375,0.0625 -0.414943,0 -0.812719,-0.02881 -1.21875,-0.0625 -0.177011,-0.592256 -0.347655,-1.271044 -0.5,-2.03125 -0.390498,-1.948599 -0.700644,-4.419842 -0.875,-7.15625 z m 1.75,10.28125 c 0.284911,0.01545 0.554954,0.03125 0.84375,0.03125 0.325029,0 0.648588,-0.01171 0.96875,-0.03125 -0.05999,0.148763 -0.127309,0.31046 -0.1875,0.4375 -0.18789,0.396562 -0.386962,0.696416 -0.53125,0.84375 -0.144288,0.147334 -0.181857,0.125 -0.1875,0.125 -0.0056,0 -0.07446,0.02233 -0.21875,-0.125 C 72.355712,88.946416 72.18789,88.646562 72,88.25 71.939809,88.12296 71.872486,87.961263 71.8125,87.8125 z",this.svgCompassRotationMarker="M 72.46875,22.03125 C 59.505873,22.050338 46.521615,27.004287 36.6875,36.875 L 47.84375,47.96875 C 61.521556,34.240041 83.442603,34.227389 97.125,47.90625 l 11.125,-11.125 C 98.401629,26.935424 85.431627,22.012162 72.46875,22.03125 z",this.showCompass=defined(this.terria)&&this.enableCompass,this.heading=this.showCompass?this.terria.scene.camera.heading:0,this.isOrbiting=false,this.orbitCursorAngle=0,this.orbitCursorOpacity=0,this.orbitLastTimestamp=0,this.orbitFrame=void 0,this.orbitIsLook=false,this.orbitMouseMoveFunction=void 0,this.orbitMouseUpFunction=void 0,this.isRotating=false,this.rotateInitialCursorAngle=void 0,this.rotateFrame=void 0,this.rotateIsLook=false,this.rotateMouseMoveFunction=void 0,this.rotateMouseUpFunction=void 0,this._unsubcribeFromPostRender=void 0,ts.track(this,["controls","showCompass","heading","isOrbiting","orbitCursorAngle","isRotating"]);var i=this;function e(){defined(i.terria)?(i._unsubcribeFromPostRender&&(i._unsubcribeFromPostRender(),i._unsubcribeFromPostRender=void 0),i.showCompass=i.enableCompass,i._unsubcribeFromPostRender=i.terria.scene.postRender.addEventListener((function(){i.heading=i.terria.scene.camera.heading;}))):(i._unsubcribeFromPostRender&&(i._unsubcribeFromPostRender(),i._unsubcribeFromPostRender=void 0),i.showCompass=false);}is.prototype.setNavigationLocked=function(t){this.navigationLocked=t,this.controls&&this.controls.length>1&&this.controls[1].setNavigationLocked(this.navigationLocked);},this.eventHelper.add(this.terria.afterWidgetChanged,e,this),e();};is.prototype.destroy=function(){this.eventHelper.removeAll();},is.prototype.show=function(t){const i="</div>",e=">",s=' style="display: none;"',o='<div class="compass"',n=" <div class=\"compass-rotation-marker\" data-bind=\"visible: isOrbiting, style: { transform: 'rotate(-' + orbitCursorAngle + 'rad)', '-webkit-transform': 'rotate(-' + orbitCursorAngle + 'rad)', opacity: orbitCursorOpacity }",a=" <div class=\"compass-outer-ring\" title=\"\" data-bind=\"style: { transform: 'rotate(-' + heading + 'rad)', '-webkit-transform': 'rotate(-' + heading + 'rad)' }",r=' <div class="compass-gyro" data-bind="css: { \'compass-gyro-active\': isOrbiting }',l=(void 0===this.terria.options.enableCompassOuterRing||this.terria.options.enableCompassOuterRing?'title="" data-bind="visible: showCompass, event: { mousedown: handleMouseDown,touchstart:handleMouseDown, dblclick: handleDoubleClick }">':'title="" data-bind="visible: showCompass">')+'<div class="compass-outer-ring-background"></div>'+((this.terria.options.compassRotationMarkerSvg?n+'"'+e+this.terria.options.compassRotationMarkerSvg:n+', cesiumSvgPath: { path: svgCompassRotationMarker, width: 145, height: 145 }"'+e)+i)+((this.terria.options.compassOuterRingSvg?a+'"'+e+this.terria.options.compassOuterRingSvg:a+', cesiumSvgPath: { path: svgCompassOuterRing, width: 145, height: 145 }"'+e)+i)+' <div class="compass-gyro-background"></div>'+((this.terria.options.compassGyroSvg?r+'"'+e+this.terria.options.compassGyroSvg:r+',cesiumSvgPath: { path: svgCompassGyro, width: 145, height: 145 } "'+e)+i)+i,h='<div class="navigation-controls"',d='>\x3c!-- ko foreach: controls --\x3e<div data-bind="click: activate, attr: { title: $data.name }, css: $root.isLastControl($data) ? \'navigation-control-last\' : \'navigation-control\' "> \x3c!-- ko if: $data.hasText --\x3e <div data-bind="text: $data.text, css: $data.isActive ? \'navigation-control-icon-active \' + $data.cssClass : $data.cssClass"></div> \x3c!-- /ko --\x3e \x3c!-- ko ifnot: $data.hasText --\x3e \x3c!-- ko if: $data.svgIcon --\x3e <div data-bind="cesiumSvgPath: { path: $data.svgIcon, width: $data.svgWidth, height: $data.svgHeight }, css: $data.isActive ? \'navigation-control-icon-active \' + $data.cssClass : $data.cssClass"></div> \x3c!-- /ko --\x3e \x3c!-- ko ifnot: $data.svgIcon --\x3e \x3c!-- ko if: $data.resetSvg --\x3e <div class="navigation-control-icon-svg reset" onclick="'+this.terria.options.reset+'">'+this.terria.options.resetSvg+'</div> \x3c!-- /ko --\x3e \x3c!-- ko ifnot: $data.resetSvg --\x3e \x3c!-- ko if: $data.zoomInSvg --\x3e <div class="navigation-control-icon-svg" zoomin>'+this.terria.options.zoomInSvg+'</div> \x3c!-- /ko --\x3e \x3c!-- ko ifnot: $data.zoomInSvg --\x3e \x3c!-- ko if: $data.zoomOutSvg --\x3e <div class="navigation-control-icon-svg zoomout">'+this.terria.options.zoomOutSvg+"</div> \x3c!-- /ko --\x3e \x3c!-- /ko --\x3e \x3c!-- /ko --\x3e \x3c!-- /ko --\x3e \x3c!-- /ko --\x3e </div> \x3c!-- /ko --\x3e"+i;We((this.enableCompass?o+l:o+s+l)+(this.enableZoomControls?h+d:h+s+e+d),t,this);},is.prototype.add=function(t){this.controls.push(t);},is.prototype.remove=function(t){this.controls.remove(t);},is.prototype.isLastControl=function(t){return t===this.controls[this.controls.length-1]};var es=new Cartesian2;const ss=t=>{let i;i=t.touches?t.touches[0]:t;const{clientX:e,clientY:s}=i;return {clientX:e,clientY:s}};is.prototype.handleMouseDown=function(t,i){const{clientX:e,clientY:s}=ss(i);if(this.terria.scene.mode===SceneMode.MORPHING)return true;if(t.navigationLocked)return true;var n=i.currentTarget,a=i.currentTarget.getBoundingClientRect(),l=a.width/2,h=new Cartesian2((a.right-a.left)/2,(a.bottom-a.top)/2),d=new Cartesian2(e-a.left,s-a.top),c=Cartesian2.subtract(d,h,es),u=Cartesian2.magnitude(c)/l;if(50/145>u)!function(t,i,e){var s=t.terria.scene,n=s.screenSpaceCameraController;if(s.mode===SceneMode.MORPHING||!n.enableInputs)return;if(t.navigationLocked)return true;switch(s.mode){case SceneMode.COLUMBUS_VIEW:if(n.enableLook)break;if(!n.enableTranslate||!n.enableTilt)return;break;case SceneMode.SCENE3D:if(n.enableLook)break;if(!n.enableTilt||!n.enableRotate)return;break;case SceneMode.SCENE2D:if(!n.enableTranslate)return}hs(t),defined(t.orbitTickFunction)&&t.terria.clock.onTick.removeEventListener(t.orbitTickFunction);t.orbitMouseMoveFunction=void 0,t.orbitMouseUpFunction=void 0,t.orbitTickFunction=void 0,t.isOrbiting=true,t.orbitLastTimestamp=getTimestamp();var a=s.camera;if(defined(t.terria.trackedEntity))t.orbitFrame=void 0,t.orbitIsLook=false;else {var l=Ye.getCameraFocus(t.terria,true,as);defined(l)?(t.orbitFrame=Transforms.eastNorthUpToFixedFrame(l,s.globe.ellipsoid,ns),t.orbitIsLook=false):(t.orbitFrame=Transforms.eastNorthUpToFixedFrame(a.positionWC,s.globe.ellipsoid,ns),t.orbitIsLook=true);}function h(i,e){t.orbitCursorAngle=Math$1.zeroToTwoPi(Math.atan2(-i.y,i.x)-Math$1.PI_OVER_TWO);var s=Cartesian2.magnitude(i),n=Math.min(s/(e/2),1);t.orbitCursorOpacity=.5*n*n+.5;}t.orbitTickFunction=function(i){var e,n=getTimestamp(),l=(n-t.orbitLastTimestamp)*(2.5*(t.orbitCursorOpacity-.5)/1e3),h=t.orbitCursorAngle+Math$1.PI_OVER_TWO,d=Math.cos(h)*l,c=Math.sin(h)*l;if(t.navigationLocked)return true;defined(t.orbitFrame)&&(e=Matrix4.clone(a.transform,os),a.lookAtTransform(t.orbitFrame)),s.mode===SceneMode.SCENE2D?a.move(new Cartesian3(d,c,0),Math.max(s.canvas.clientWidth,s.canvas.clientHeight)/100*a.positionCartographic.height*l):t.orbitIsLook?(a.look(Cartesian3.UNIT_Z,-d),a.look(a.right,-c)):(a.rotateLeft(d),a.rotateUp(c)),defined(t.orbitFrame)&&a.lookAtTransform(e),t.orbitLastTimestamp=n;},t.orbitMouseMoveFunction=function(t){const{clientX:e,clientY:s}=ss(t);var o=i.getBoundingClientRect(),n=new Cartesian2((o.right-o.left)/2,(o.bottom-o.top)/2),a=new Cartesian2(e-o.left,s-o.top);h(Cartesian2.subtract(a,n,es),o.width);},t.orbitMouseUpFunction=function(i){t.isOrbiting=false,hs(t),defined(t.orbitTickFunction)&&t.terria.clock.onTick.removeEventListener(t.orbitTickFunction),t.orbitMouseMoveFunction=void 0,t.orbitMouseUpFunction=void 0,t.orbitTickFunction=void 0;},rs(t),t.terria.clock.onTick.addEventListener(t.orbitTickFunction),h(e,i.getBoundingClientRect().width);}(this,n,c);else {if(u>=1)return true;!function(t,i,e){var s,n=t.terria.scene,a=n.camera,r=n.screenSpaceCameraController;if(n.mode===SceneMode.MORPHING||n.mode===SceneMode.SCENE2D||!r.enableInputs)return;if(t.navigationLocked)return true;if(!r.enableLook&&(n.mode===SceneMode.COLUMBUS_VIEW||n.mode===SceneMode.SCENE3D&&!r.enableRotate))return;if(ds(t),t.rotateMouseMoveFunction=void 0,t.rotateMouseUpFunction=void 0,t.isRotating=true,t.rotateInitialCursorAngle=Math.atan2(-e.y,e.x),defined(t.terria.trackedEntity))t.rotateFrame=void 0,t.rotateIsLook=false;else {var l=Ye.getCameraFocus(t.terria,true,as);defined(l)&&(n.mode!==SceneMode.COLUMBUS_VIEW||r.enableLook||r.enableTranslate)?(t.rotateFrame=Transforms.eastNorthUpToFixedFrame(l,n.globe.ellipsoid,ns),t.rotateIsLook=false):(t.rotateFrame=Transforms.eastNorthUpToFixedFrame(a.positionWC,n.globe.ellipsoid,ns),t.rotateIsLook=true);}defined(t.rotateFrame)&&(s=Matrix4.clone(a.transform,os),a.lookAtTransform(t.rotateFrame));t.rotateInitialCameraAngle=-a.heading,defined(t.rotateFrame)&&a.lookAtTransform(s);t.rotateMouseMoveFunction=function(e){const{clientX:s,clientY:n}=ss(e);var a,r=i.getBoundingClientRect(),l=new Cartesian2((r.right-r.left)/2,(r.bottom-r.top)/2),h=new Cartesian2(s-r.left,n-r.top),d=Cartesian2.subtract(h,l,es),c=Math$1.zeroToTwoPi(t.rotateInitialCameraAngle-(Math.atan2(-d.y,d.x)-t.rotateInitialCursorAngle)),u=t.terria.scene.camera;defined(t.rotateFrame)&&(a=Matrix4.clone(u.transform,os),u.lookAtTransform(t.rotateFrame)),u.rotateRight(c- -u.heading),defined(t.rotateFrame)&&u.lookAtTransform(a);},t.rotateMouseUpFunction=function(i){t.isRotating=false,ds(t),t.rotateMouseMoveFunction=void 0,t.rotateMouseUpFunction=void 0;},ls(t);}(this,n,c);}};var os=new Matrix4,ns=new Matrix4,as=new Cartesian3;is.prototype.handleDoubleClick=function(t,i){var e=t.terria.scene,s=e.camera,n=e.screenSpaceCameraController;if(e.mode===SceneMode.MORPHING||!n.enableInputs)return true;if(t.navigationLocked)return true;if(e.mode!==SceneMode.COLUMBUS_VIEW||n.enableTranslate){if(e.mode===SceneMode.SCENE3D||e.mode===SceneMode.COLUMBUS_VIEW){if(!n.enableLook)return;if(e.mode===SceneMode.SCENE3D&&!n.enableRotate)return}var a=Ye.getCameraFocus(t.terria,true,as);if(defined(a)){var l=e.globe.ellipsoid.cartographicToCartesian(s.positionCartographic,new Cartesian3),h=e.globe.ellipsoid.geodeticSurfaceNormal(a),d=new BoundingSphere(a,0);s.flyToBoundingSphere(d,{offset:new HeadingPitchRange(0,Math$1.PI_OVER_TWO-Cartesian3.angleBetween(h,s.directionWC),Cartesian3.distance(l,a)),duration:1.5});}else this.controls[1].resetView();}},is.create=function(t){var i=new is(t);return i.show(t.container),i};const rs=t=>{document.addEventListener("mousemove",t.orbitMouseMoveFunction,false),document.addEventListener("touchmove",t.orbitMouseMoveFunction,false),document.addEventListener("mouseup",t.orbitMouseUpFunction,false),document.addEventListener("touchend",t.orbitMouseUpFunction,false);},ls=t=>{document.addEventListener("mousemove",t.rotateMouseMoveFunction,false),document.addEventListener("touchmove",t.rotateMouseMoveFunction,false),document.addEventListener("mouseup",t.rotateMouseUpFunction,false),document.addEventListener("touchend",t.rotateMouseUpFunction,false);},hs=t=>{document.removeEventListener("mousemove",t.orbitMouseMoveFunction,false),document.removeEventListener("touchmove",t.orbitMouseMoveFunction,false),document.removeEventListener("mouseup",t.orbitMouseUpFunction,false),document.removeEventListener("touchend",t.orbitMouseUpFunction,false);},ds=t=>{document.removeEventListener("mousemove",t.rotateMouseMoveFunction,false),document.removeEventListener("touchmove",t.rotateMouseMoveFunction,false),document.removeEventListener("mouseup",t.rotateMouseUpFunction,false),document.removeEventListener("touchend",t.rotateMouseUpFunction,false);};var cs=Event,us=function(t){ps.apply(this,arguments),this._onDestroyListeners=[];};function ps(t,i){if(!defined(t))throw new DeveloperError("CesiumWidget or Viewer is required.");var e=defined(t.cesiumWidget)?t.cesiumWidget:t,s=document.createElement("div");s.className="cesium-widget-cesiumNavigationContainer",e.container.appendChild(s),this.terria=t,this.terria.options=defined(i)?i:{},this.terria.afterWidgetChanged=new cs,this.terria.beforeWidgetChanged=new cs,this.container=s,defined(this.terria.options.enableDistanceLegend)&&!this.terria.options.enableDistanceLegend||(this.distanceLegendDiv=document.createElement("div"),s.appendChild(this.distanceLegendDiv),this.distanceLegendDiv.setAttribute("id","distanceLegendDiv"),this.distanceLegendViewModel=Ge.create({container:this.distanceLegendDiv,terria:this.terria,mapElement:s,enableDistanceLegend:true})),defined(this.terria.options.enableZoomControls)&&!this.terria.options.enableZoomControls||defined(this.terria.options.enableCompass)&&!this.terria.options.enableCompass?!defined(this.terria.options.enableZoomControls)||this.terria.options.enableZoomControls||defined(this.terria.options.enableCompass)&&!this.terria.options.enableCompass?defined(this.terria.options.enableZoomControls)&&!this.terria.options.enableZoomControls||!defined(this.terria.options.enableCompass)||this.terria.options.enableCompass?defined(this.terria.options.enableZoomControls)&&!this.terria.options.enableZoomControls&&defined(this.terria.options.enableCompass):(this.navigationDiv=document.createElement("div"),this.navigationDiv.setAttribute("id","navigationDiv"),s.appendChild(this.navigationDiv),this.navigationViewModel=is.create({container:this.navigationDiv,terria:this.terria,enableZoomControls:true,enableCompass:false})):(this.navigationDiv=document.createElement("div"),this.navigationDiv.setAttribute("id","navigationDiv"),s.appendChild(this.navigationDiv),this.navigationViewModel=is.create({container:this.navigationDiv,terria:this.terria,enableZoomControls:false,enableCompass:true})):(this.navigationDiv=document.createElement("div"),this.navigationDiv.setAttribute("id","navigationDiv"),s.appendChild(this.navigationDiv),this.navigationViewModel=is.create({container:this.navigationDiv,terria:this.terria,enableZoomControls:true,enableCompass:true}));}us.prototype.distanceLegendViewModel=void 0,us.prototype.navigationViewModel=void 0,us.prototype.navigationDiv=void 0,us.prototype.distanceLegendDiv=void 0,us.prototype.terria=void 0,us.prototype.container=void 0,us.prototype._onDestroyListeners=void 0,us.prototype._navigationLocked=false,us.prototype.setNavigationLocked=function(t){this._navigationLocked=t,this.navigationViewModel.setNavigationLocked(this._navigationLocked);},us.prototype.getNavigationLocked=function(){return this._navigationLocked},us.prototype.destroy=function(){defined(this.navigationViewModel)&&this.navigationViewModel.destroy(),defined(this.distanceLegendViewModel)&&this.distanceLegendViewModel.destroy(),defined(this.navigationDiv)&&this.navigationDiv.parentNode.removeChild(this.navigationDiv),delete this.navigationDiv,defined(this.distanceLegendDiv)&&this.distanceLegendDiv.parentNode.removeChild(this.distanceLegendDiv),delete this.distanceLegendDiv,defined(this.container)&&this.container.parentNode.removeChild(this.container),delete this.container;for(var t=0;this._onDestroyListeners.length>t;t++)this._onDestroyListeners[t]();},us.prototype.addOnDestroyListener=function(t){"function"==typeof t&&this._onDestroyListeners.push(t);};const ms={enableCompass:true,enableZoomControls:true,enableDistanceLegend:true,enableCompassOuterRing:true,compassOuterRingSvg:'\n <div class="compass-outer-ring-wrapper">\n <svg class=" compass-outer-ring" width="145" height="145" viewBox="0 0 145 145" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M66.7693 19.5027H78.1499C78.8169 19.5027 79.2269 18.785 78.9069 18.2082L73.2549 8.42938C72.9209 7.86548 72.0879 7.85268 71.7549 8.41658L66.0387 18.2082C65.6927 18.785 66.1029 19.5027 66.7693 19.5027Z" fill="#FF4C38"/>\n<path d="M43.5732 45.2368L43.5593 45.2484C43.1415 45.5964 42.5288 45.5406 42.1808 45.1228L37.0648 38.9814C36.7168 38.5636 36.7726 37.951 37.1904 37.603L37.2043 37.5913C37.6221 37.2433 38.2348 37.2991 38.5828 37.7169L43.6988 43.8583C44.0468 44.2761 43.991 44.8888 43.5732 45.2368ZM38.9404 49.6151L38.9264 49.6267C38.555 50.0304 37.947 50.0651 37.5433 49.6937L31.6242 44.3156C31.2205 43.9443 31.1858 43.3362 31.5572 42.9325L31.5711 42.9209C31.9425 42.5172 32.5505 42.4825 32.9542 42.8539L38.8733 48.2319C39.277 48.6033 39.3117 49.2113 38.9404 49.6151Z" fill="#676768"/>\n<path d="M34.9851 54.6085L34.9712 54.6201C34.6602 55.0679 34.0568 55.1932 33.6089 54.8821L26.9912 50.3927C26.5434 50.0817 26.4182 49.4783 26.7292 49.0305L26.7431 49.0189C27.0542 48.571 27.6576 48.4458 28.1054 48.7569L34.7232 53.2462C35.1594 53.5434 35.2707 54.1584 34.9851 54.6085Z" fill="white"/>\n<path d="M31.7306 60.1032L31.7282 60.1287C31.4915 60.609 30.9066 60.8131 30.4123 60.5879L23.2328 57.0383C22.7525 56.8015 22.5484 56.2167 22.7736 55.7224L22.7759 55.6969C23.0127 55.2166 23.5975 55.0125 24.0918 55.2377L31.2597 58.7733C31.7772 59.0264 31.9813 59.6112 31.7306 60.1032ZM29.2905 65.981L29.2882 66.0065C29.1256 66.5193 28.5593 66.8024 28.0465 66.6398L20.4491 64.1461C19.9362 63.9835 19.6532 63.4172 19.8158 62.9044L19.8181 62.8789C19.9806 62.366 20.5469 62.083 21.0598 62.2455L28.6572 64.7393C29.1816 64.9158 29.453 65.4681 29.2905 65.981ZM27.6858 72.1537L27.6835 72.1792C27.5836 72.7106 27.0753 73.0633 26.5439 72.9634L18.6678 71.551C18.1364 71.4511 17.7837 70.9428 17.8836 70.4114L17.8859 70.3859C17.9858 69.8545 18.4941 69.5018 19.0255 69.6017L26.9016 71.0141C27.433 71.114 27.7857 71.6222 27.6858 72.1537Z" fill="#676768"/>\n<path d="M26.9674 78.4843L26.9651 78.5103C26.9418 79.0483 26.4915 79.4703 25.9392 79.4593L17.9492 79.1563C17.4108 79.1323 16.9885 78.6823 17.0002 78.1299L17.0025 78.1044C17.0258 77.566 17.4761 77.1437 18.0284 77.1554L26.0184 77.4586C26.5568 77.4819 26.9907 77.9461 26.9674 78.4843Z" fill="white"/>\n<path d="M27.1335 84.8572L27.1311 84.8822C27.1844 85.4282 26.7945 85.8942 26.2607 85.9612L18.2983 86.7672C17.753 86.8212 17.2866 86.4312 17.2194 85.8972L17.2217 85.8712C17.1684 85.3262 17.5584 84.8602 18.0921 84.7922L26.0545 83.9862C26.5883 83.9192 27.0802 84.3112 27.1335 84.8572ZM28.1697 91.1412L28.1673 91.1672C28.2995 91.6942 27.9676 92.2302 27.4408 92.3622L19.6871 94.2682C19.1602 94.4002 18.6242 94.0682 18.492 93.5412L18.4944 93.5162C18.3622 92.9892 18.6941 92.4532 19.221 92.3212L26.9746 90.4152C27.5131 90.2962 28.0514 90.6032 28.1697 91.1412Z" fill="#676768"/>\n<path d="M30.0878 97.2102L30.0994 97.2242C30.2989 97.7182 30.0528 98.3012 29.5585 98.5002L22.1457 101.467C21.6514 101.667 21.0689 101.421 20.8694 100.926L20.8578 100.912C20.6584 100.418 20.9045 99.8352 21.3988 99.6362L28.8116 96.6692C29.3059 96.4702 29.8883 96.7162 30.0878 97.2102Z" fill="white"/>\n<path d="M32.8321 102.968L32.8437 102.982C33.1105 103.444 32.9526 104.047 32.4768 104.326L25.5396 108.288C25.0778 108.555 24.4744 108.397 24.196 107.921L24.1844 107.907C23.9176 107.446 24.0756 106.842 24.5513 106.564L31.4885 102.601C31.962 102.349 32.5653 102.506 32.8321 102.968ZM36.3493 108.295L36.3609 108.309C36.695 108.738 36.6137 109.348 36.1843 109.683L29.8689 114.59C29.4395 114.924 28.8292 114.842 28.4951 114.413L28.4835 114.399C28.1494 113.97 28.2307 113.359 28.6601 113.025L34.9755 108.118C35.4049 107.784 36.0152 107.865 36.3493 108.295ZM40.5605 113.067L40.5721 113.081C40.9619 113.464 40.9711 114.07 40.5997 114.473L35.0197 120.207C34.6368 120.596 34.0311 120.606 33.6273 120.234L33.6157 120.22C33.2259 119.837 33.2168 119.232 33.5881 118.828L39.1681 113.095C39.551 112.705 40.1707 112.684 40.5605 113.067Z" fill="#676768"/>\n<path d="M45.4076 117.215L45.4192 117.229C45.8531 117.551 45.9528 118.152 45.6278 118.612L40.9087 125.067C40.5861 125.501 39.985 125.601 39.5256 125.276L39.514 125.262C39.0801 124.939 38.9804 124.338 39.3053 123.879L44.0244 117.423C44.361 116.978 44.9737 116.892 45.4076 117.215Z" fill="white"/>\n<path d="M50.784 120.639L50.8095 120.641C51.2875 120.903 51.4661 121.486 51.2154 121.978L47.4337 129.02C47.1714 129.498 46.5889 129.677 46.0969 129.426L46.0714 129.424C45.5934 129.162 45.4148 128.579 45.6655 128.087L49.4472 121.045C49.7095 120.567 50.3059 120.376 50.784 120.639ZM56.5782 123.29L56.6037 123.292C57.1142 123.48 57.3717 124.044 57.1837 124.555L54.4161 132.05C54.228 132.561 53.664 132.818 53.1535 132.63L53.128 132.628C52.6175 132.44 52.36 131.876 52.5481 131.365L55.304 123.856C55.5037 123.359 56.0677 123.102 56.5782 123.29ZM62.6812 125.094L62.7068 125.097C63.2358 125.222 63.5746 125.742 63.4631 126.259L61.7722 134.084C61.6468 134.613 61.1269 134.952 60.6094 134.841L60.5839 134.838C60.0548 134.713 59.7161 134.193 59.8276 133.676L61.5184 125.851C61.6322 125.308 62.1637 124.983 62.6812 125.094Z" fill="#676768"/>\n<path d="M68.9909 126.042L69.0164 126.045C69.5664 126.082 69.9609 126.555 69.9239 127.105L69.3397 135.07C69.3025 135.62 68.829 136.014 68.279 135.977L68.2535 135.975C67.7035 135.937 67.3091 135.464 67.3463 134.914L67.9302 126.949C67.979 126.413 68.4409 126.005 68.9909 126.042Z" fill="white"/>\n<path d="M75.3679 126.108L75.3939 126.111C75.9369 126.083 76.415 126.487 76.443 127.03L76.977 135.006C77.005 135.549 76.601 136.027 76.058 136.055L76.032 136.053C75.489 136.08 75.011 135.676 74.984 135.133L74.449 127.157C74.41 126.6 74.8249 126.136 75.3679 126.108ZM81.685 125.281L81.711 125.283C82.235 125.177 82.757 125.52 82.864 126.045L84.5079 133.852C84.6149 134.376 84.271 134.898 83.747 135.005L83.721 135.003C83.197 135.109 82.674 134.766 82.568 134.241L80.9379 126.423C80.8169 125.91 81.149 125.374 81.685 125.281ZM87.8119 123.574L87.8259 123.563C88.3319 123.377 88.9 123.635 89.084 124.166L91.7839 131.683C91.9689 132.189 91.711 132.758 91.18 132.941L91.166 132.953C90.66 133.138 90.0919 132.88 89.9079 132.349L87.208 124.832C87.048 124.328 87.3059 123.76 87.8119 123.574Z" fill="#676768"/>\n<path d="M93.668 121.032L93.682 121.02C94.155 120.767 94.756 120.951 95.009 121.424L98.728 128.494C98.981 128.967 98.797 129.568 98.324 129.821L98.31 129.833C97.836 130.085 97.235 129.902 96.982 129.429L93.264 122.359C93.011 121.886 93.194 121.285 93.668 121.032Z" fill="white"/>\n<path d="M99.1059 117.705L99.1199 117.693C99.5599 117.373 100.168 117.48 100.489 117.921L105.161 124.408C105.481 124.849 105.375 125.457 104.934 125.777L104.92 125.789C104.479 126.109 103.871 126.002 103.551 125.561L98.8779 119.074C98.5689 118.647 98.6649 118.025 99.1059 117.705ZM104.017 113.661L104.031 113.649C104.425 113.273 105.043 113.278 105.419 113.673L110.955 119.441C111.33 119.835 111.326 120.452 110.931 120.828L110.917 120.84C110.523 121.216 109.905 121.211 109.529 120.816L103.993 115.049C103.618 114.654 103.636 114.025 104.017 113.661ZM108.332 108.958L108.346 108.946C108.68 108.526 109.293 108.44 109.724 108.788L116.005 113.723C116.425 114.058 116.511 114.67 116.163 115.102L116.149 115.113C115.815 115.533 115.202 115.619 114.771 115.271L108.489 110.336C108.069 110.002 108.009 109.392 108.332 108.958Z" fill="#676768"/>\n<path d="M111.937 103.713L111.951 103.702C112.225 103.238 112.819 103.073 113.297 103.335L120.202 107.349C120.666 107.623 120.831 108.217 120.569 108.695L120.555 108.707C120.281 109.171 119.687 109.336 119.209 109.073L112.303 105.06C111.839 104.786 111.674 104.192 111.937 103.713Z" fill="white"/>\n<path d="M114.785 98.0142L114.788 97.9892C114.987 97.4922 115.563 97.2492 116.059 97.4482L123.455 100.464C123.951 100.664 124.195 101.24 123.995 101.736L123.993 101.762C123.793 102.258 123.218 102.502 122.721 102.302L115.326 99.2862C114.829 99.0872 114.586 98.5112 114.785 98.0142ZM116.828 91.9722L116.831 91.9462C116.956 91.4172 117.499 91.1062 118.028 91.2322L125.777 93.1992C126.306 93.3242 126.617 93.8672 126.491 94.3962L126.489 94.4222C126.364 94.9512 125.82 95.2622 125.291 95.1362L117.543 93.1692C117.002 93.0302 116.678 92.4992 116.828 91.9722ZM117.978 85.7062L117.981 85.6812C118.043 85.1332 118.529 84.7532 119.065 84.8012L127.003 85.6662C127.551 85.7292 127.932 86.2142 127.883 86.7502L127.88 86.7762C127.818 87.3232 127.333 87.7042 126.797 87.6552L118.858 86.7902C118.31 86.7272 117.93 86.2422 117.978 85.7062Z" fill="#676768"/>\n<path d="M118.263 79.3363L118.265 79.3113C118.237 78.7673 118.678 78.3063 119.219 78.3043L127.221 78.0546C127.764 78.0269 128.225 78.4683 128.228 79.0083L128.225 79.0343C128.253 79.5773 127.812 80.0393 127.271 80.0413L119.27 80.2903C118.74 80.3063 118.29 79.8793 118.263 79.3363Z" fill="white"/>\n<path d="M117.656 73.0008L117.658 72.9752C117.565 72.4391 117.92 71.931 118.457 71.8382L126.34 70.4844C126.876 70.3917 127.384 70.7468 127.477 71.2829L127.475 71.3084C127.536 71.6542 127.407 72.0077 127.137 72.2324C127.005 72.3426 126.846 72.4159 126.676 72.4454L118.793 73.7993C118.447 73.8603 118.093 73.7316 117.869 73.4617C117.758 73.3294 117.685 73.1707 117.656 73.0008ZM116.174 66.8043L116.176 66.7788C116.005 66.2612 116.299 65.709 116.817 65.5373L124.427 63.0904C124.944 62.9188 125.497 63.2136 125.668 63.7311L125.666 63.7567C125.838 64.2742 125.543 64.8265 125.025 64.9981L117.415 67.445C116.9 67.5911 116.346 67.3218 116.174 66.8043ZM113.845 60.8653L113.833 60.8514C113.594 60.3663 113.803 59.7676 114.289 59.5287L121.49 56.0536C121.975 55.8147 122.574 56.0236 122.813 56.5087L122.824 56.5226C123.063 57.0077 122.854 57.6064 122.369 57.8453L115.168 61.3204C114.669 61.5709 114.084 61.3504 113.845 60.8653Z" fill="#676768"/>\n<path d="M110.709 55.3161L110.697 55.3022C110.391 54.8496 110.523 54.2439 110.976 53.9376L117.623 49.4855C118.075 49.1792 118.681 49.3116 118.987 49.7642L118.999 49.7781C119.305 50.2307 119.173 50.8364 118.72 51.1426L112.073 55.5948C111.634 55.8894 111.015 55.7687 110.709 55.3161Z" fill="white"/>\n<path d="M106.832 50.2654L106.82 50.2515C106.458 49.8453 106.488 49.2304 106.895 48.8684L112.862 43.5435C113.268 43.1816 113.883 43.2119 114.245 43.6181L114.257 43.632C114.619 44.0382 114.588 44.6531 114.182 45.0151L108.215 50.34C107.823 50.6903 107.194 50.6716 106.832 50.2654ZM102.298 45.7857L102.286 45.7718C101.88 45.4259 101.808 44.8017 102.168 44.384L107.319 38.277C107.665 37.8709 108.289 37.7991 108.707 38.1588L108.718 38.1728C109.124 38.5186 109.196 39.1429 108.836 39.5606L103.686 45.6676C103.326 46.0853 102.704 46.1316 102.298 45.7857ZM97.1749 41.9859L97.1629 41.9719C96.7129 41.6864 96.5619 41.0807 96.8609 40.6189L101.119 33.8642C101.404 33.4141 102.01 33.2634 102.472 33.5628L102.483 33.5767C102.934 33.8622 103.084 34.468 102.785 34.9297L98.5279 41.6844C98.2279 42.1462 97.6359 42.2853 97.1749 41.9859Z" fill="#676768"/>\n<path d="M91.5819 38.9542L91.5569 38.9518C91.0619 38.7266 90.8439 38.1534 91.0579 37.6452L94.3339 30.3635C94.5589 29.8693 95.1319 29.6512 95.6399 29.8648L95.6659 29.8672C96.1599 30.0924 96.3779 30.6656 96.1649 31.1738L92.8889 38.4555C92.6499 38.9613 92.0649 39.1654 91.5819 38.9542Z" fill="white"/>\n<path d="M85.609 36.7113L85.584 36.7089C85.057 36.558 84.76 36.0033 84.923 35.4905L87.154 27.8048C87.305 27.2781 87.86 26.9811 88.373 27.1436L88.398 27.146C88.925 27.2969 89.222 27.8516 89.059 28.3644L86.828 36.0501C86.665 36.5629 86.122 36.8738 85.609 36.7113ZM79.39 35.334L79.365 35.3317C78.831 35.2573 78.453 34.7467 78.527 34.2129L79.672 26.2997C79.747 25.7659 80.257 25.3878 80.791 25.4621L80.817 25.4644C81.35 25.5388 81.729 26.0494 81.654 26.5832L80.495 34.508C80.42 35.0418 79.924 35.4083 79.39 35.334Z" fill="#676768"/>\n<path d="M73.0269 34.8318L73.0009 34.8294C72.4609 34.8317 72.0239 34.393 72.0219 33.8523L72.0559 25.8506C72.0539 25.3099 72.4929 24.8737 73.0329 24.8715L73.0589 24.8738C73.5989 24.8716 74.0359 25.3102 74.0379 25.851L74.0179 33.841C74.0199 34.3817 73.5679 34.8295 73.0269 34.8318Z" fill="white"/>\n<path d="M66.6727 35.218L66.6472 35.2156C66.1134 35.2828 65.6192 34.9161 65.5404 34.3684L64.4604 26.4454C64.3932 25.9117 64.7599 25.4174 65.3076 25.3386L65.3331 25.3409C65.8669 25.2737 66.3611 25.6405 66.4399 26.1882L67.5199 34.1112C67.5871 34.6449 67.2204 35.1392 66.6727 35.218ZM60.4322 36.477L60.4067 36.4746C59.8914 36.6207 59.3392 36.3259 59.1954 35.7852L57.013 28.0964C56.8669 27.5812 57.1617 27.0289 57.7025 26.8851L57.728 26.8875C58.2432 26.7414 58.7955 27.0362 58.9393 27.5769L61.1216 35.2657C61.2538 35.7925 60.9474 36.3308 60.4322 36.477Z" fill="#676768"/>\n<path d="M54.4213 38.6063L54.4074 38.6179C53.9107 38.8429 53.3399 38.6108 53.1148 38.1141L49.8951 30.7941C49.6701 30.2975 49.9022 29.7266 50.3989 29.5016L50.4128 29.49C50.9095 29.265 51.4803 29.4972 51.7053 29.9938L54.9251 37.3138C55.1385 37.7965 54.918 38.3813 54.4213 38.6063Z" fill="white"/>\n<path d="M48.7607 41.5525L48.7467 41.5641C48.2825 41.8564 47.6792 41.6985 47.3985 41.2482L43.1784 34.4549C42.8861 33.9907 43.044 33.3873 43.4943 33.1066L43.5082 33.095C43.9724 32.8027 44.5757 32.9606 44.8564 33.4109L49.0765 40.2042C49.3712 40.6429 49.2248 41.2601 48.7607 41.5525Z" fill="#676768"/>\n<path d="M77.5489 39.1354V50.0445H76.0359L70.4909 42.0438H70.3899V50.0445H68.744V39.1354H70.2679L75.8179 47.1468H75.9189V39.1354H77.5489Z" fill="white"/>\n<path d="M74.6939 114.001C74.6369 113.497 74.4029 113.106 73.9909 112.829C73.5789 112.548 73.0609 112.408 72.4359 112.408C71.9879 112.408 71.6009 112.479 71.2739 112.621C70.9479 112.76 70.6939 112.951 70.5129 113.196C70.3349 113.438 70.2459 113.713 70.2459 114.022C70.2459 114.281 70.3069 114.505 70.4269 114.693C70.5519 114.882 70.7129 115.04 70.9119 115.167C71.1149 115.292 71.3309 115.396 71.5619 115.482C71.7929 115.563 72.0149 115.631 72.2279 115.684L73.2929 115.961C73.6409 116.046 73.9979 116.162 74.3639 116.307C74.7299 116.453 75.0689 116.645 75.3809 116.883C75.6939 117.12 75.9459 117.415 76.1379 117.767C76.3329 118.118 76.4309 118.539 76.4309 119.029C76.4309 119.647 76.2709 120.196 75.9509 120.675C75.6349 121.155 75.1749 121.533 74.5719 121.81C73.9709 122.087 73.2449 122.225 72.3929 122.225C71.5759 122.225 70.8699 122.096 70.2729 121.836C69.6762 121.577 69.2092 121.21 68.8719 120.734C68.5345 120.254 68.3481 119.686 68.3126 119.029H69.9639C69.9959 119.423 70.1239 119.752 70.3469 120.015C70.5749 120.274 70.8639 120.467 71.2159 120.595C71.5709 120.72 71.9599 120.782 72.3819 120.782C72.8469 120.782 73.2609 120.709 73.6229 120.563C73.9889 120.414 74.2769 120.208 74.4859 119.945C74.6959 119.679 74.8009 119.368 74.8009 119.013C74.8009 118.69 74.7079 118.426 74.5239 118.22C74.3429 118.014 74.0959 117.843 73.7829 117.708C73.4739 117.573 73.1239 117.454 72.7339 117.351L71.4449 117C70.5709 116.762 69.8789 116.412 69.3673 115.95C68.8595 115.489 68.6056 114.878 68.6056 114.118C68.6056 113.489 68.776 112.941 69.1169 112.472C69.4578 112.003 69.9199 111.639 70.5019 111.38C71.0839 111.117 71.7409 110.986 72.4729 110.986C73.2109 110.986 73.8629 111.116 74.4279 111.375C74.9959 111.634 75.4429 111.991 75.7699 112.445C76.0969 112.896 76.2669 113.415 76.2809 114.001H74.6939Z" fill="white"/>\n<path d="M33.8801 85.0443L30.8545 74.1354H32.5857L34.711 82.5833H34.8122L37.0228 74.1354H38.738L40.9486 82.5893H41.0498L43.1698 74.1354H44.9063L41.8754 85.0443H40.2188L37.923 76.8733H37.8378L35.542 85.0443H33.8801Z" fill="white"/>\n<path d="M106.744 85.0443V74.1354H113.584V75.5523H108.39V78.8763H113.227V80.2873H108.39V83.6273H113.648V85.0443H106.744Z" fill="white"/>\n</svg>\n</div>\n',zoomInTooltip:"\u653e\u5927",zoomOutTooltip:"\u7f29\u5c0f"};class gs{constructor(t,i={}){this.navigation=new us(t,Object.assign(Object.assign({},ms),i));}destroy(){this.navigation.destroy();}show(){this.navigation.container.style.display="block";}hide(){this.navigation.container.style.display="none";}}const fs={infoBox:false,selectionIndicator:false,animation:false,shouldAnimate:false,timeline:false,baseLayerPicker:false,geocoder:false,homeButton:false,sceneModePicker:false,navigationHelpButton:false,shadows:false,fullscreenButton:false,requestRenderMode:false};class vs{constructor(t){this.isMobile=()=>{let t=false;return navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)&&(t=true),800>document.body.clientWidth&&(t=true),t},this.params=t,this.params.config=Object.assign({},fs,this.params.config||{});const{containerId:i}=this.params;this.container=document.getElementById(i),this.viewer=new Viewer(this.container,{infoBox:this.params.config.infoBox,selectionIndicator:this.params.config.selectionIndicator,animation:this.params.config.animation,shouldAnimate:this.params.config.shouldAnimate,timeline:this.params.config.timeline,baseLayerPicker:this.params.config.baseLayerPicker,geocoder:this.params.config.geocoder,homeButton:this.params.config.homeButton,sceneModePicker:this.params.config.sceneModePicker,navigationHelpButton:this.params.config.navigationHelpButton,shadows:this.params.config.shadows,fullscreenButton:this.params.config.fullscreenButton,requestRenderMode:this.params.config.requestRenderMode,imageryProvider:this.params.config.imageryLayerType?void 0:new ue({style:4}),contextOptions:{webgl:{alpha:true,depth:true,stencil:true,antialias:true,powerPreference:"high-performance",premultipliedAlpha:true,preserveDrawingBuffer:true,failIfMajorPerformanceCaveat:true}},useDefaultRenderLoop:this.params.useDefaultRenderLoop||void 0}),this.viewer.scene.globe.tileCacheSize=this.params.config.tileCacheSize||20,this.viewer.scene.moon.show=false,this.viewer.scene.sun.show=false,this.viewer.scene.skyBox.show=false,this.viewer.resolutionScale=1,this.params.config.maximumZoomDistance&&(this.viewer.scene.screenSpaceCameraController.maximumZoomDistance=this.params.config.maximumZoomDistance),this.params.config.minimumZoomDistance&&(this.viewer.scene.screenSpaceCameraController.minimumZoomDistance=this.params.config.minimumZoomDistance),this.scene=this.viewer.scene;let e=this.params.config.sunLight;e&&(this.scene.light.intensity=e.intensity),this.scene.sun.show=false,this.scene.moon.show=false,this.viewer.scene.globe.depthTestAgainstTerrain=true,this.viewer.cesiumWidget.creditContainer.style.display="none",this.viewer.scene.postProcessStages.fxaa.enabled=true,this.viewer.scene.postRender.addEventListener(this.postRender,this),this.params.config.cesiumNavigation&&this.initCesiumNavigation();}initTimeFormat(){this.viewer.animation&&(this.viewer.animation.viewModel.dateFormatter=(t,i)=>{const e=JulianDate.toGregorianDate(t);return e.day+" "+new Date(e.year,e.month-1,e.day).toLocaleString("zh-cn",{month:"short"})+" "+e.year},this.viewer.animation.viewModel.timeFormatter=(t,i)=>JulianDate.toDate(t).toLocaleTimeString());}delIndexDB(){}init(){return Mt(this,void 0,void 0,(function*(){this.viewer.scene.globe.depthTestAgainstTerrain=true;let t=this.params.config.cameraConfig;t&&(yield this.flyTo(t));}))}initCesiumNavigation(){this.cesiumNavigation=new gs(this.viewer);}setFltToHome(){this.viewer.homeButton.viewModel.command.beforeExecute.addEventListener((t=>{t.cancel=true,this.flyToHome();}));}flyToHome(){let t=this.params.config.cameraConfig;t&&this.flyTo(t);}flyTo(t,i){return Mt(this,void 0,void 0,(function*(){let{position:e,hpr:s,duration:o=2,animation:n=true}=t;const l=Array.isArray(e)?Cartesian3.fromDegrees(e[0],e[1],e[2]):new Cartesian3(e.x,e.y,e.z),h=HeadingPitchRoll.fromDegrees(s[0],s[1],s[2]);if(n)return new Promise(((t,e)=>{this.viewer.camera.flyTo({destination:l,orientation:h,duration:o,complete:()=>{i&&i(),t(true);},cancel:()=>{i&&i(),e(false);}});}));this.viewer.scene.camera.setView({destination:l,orientation:h});}))}flyToRectangle(t){t=t||[Cartesian3.fromDegrees(104.15528644354428,30.752166584535512,0),Cartesian3.fromDegrees(104.27206271917905,30.827572468324576,0)];let i=Rectangle.fromCartesianArray(t),e=BoundingSphere.fromRectangle3D(i);this.viewer.camera.flyToBoundingSphere(e,{duration:5,complete:function(){},offset:{heading:Math$1.toRadians(0),pitch:Math$1.toRadians(-90),range:0}});}initLight(){var t;let i=this.params.config.sunLight;if(i&&i.direction){let e=Color.fromCssColorString(i.color||"#ffffff"),s=new DirectionalLight({direction:new Cartesian3(i.direction[0],i.direction[1],i.direction[2]),color:e,intensity:null!==(t=i.intensity)&&void 0!==t?t:1});this.scene.light=s;}}postRender(){}getCameraInfo(){let t=Math$1.toDegrees(this.viewer.scene.camera.heading),i=Math$1.toDegrees(this.viewer.scene.camera.pitch),e=Math$1.toDegrees(this.viewer.scene.camera.roll),s=this.viewer.scene.camera.positionCartographic,n=Math$1.toDegrees(s.longitude),a=Math$1.toDegrees(s.latitude),l=s.height;return {lng:n,lat:a,height:l,heading:t,pitch:i,roll:e,position:Cartesian3.fromDegrees(n,a,l)}}getViewInfo(){const t=this.getCameraInfo();return {position:[t.lng,t.lat,t.height],hpr:[t.heading,t.pitch,t.roll]}}getWindowCoordinates(t){if(!t)return;let i;if(i=Array.isArray(t)?Cartesian3.fromDegrees(t[0],t[1],t[2]||.1):Cartesian3.fromDegrees(t.longitude,t.latitude,t.height),i){const t=new Cartesian2;return SceneTransforms.wgs84ToWindowCoordinates(this.scene,i,t)}}render(){}_resize(){}clear(){var t;null===(t=this.viewer.entities)||void 0===t||t.removeAll(),this.viewer.imageryLayers.removeAll(),this.viewer.imageryLayers.destroy(),this.viewer.scene.postRender.removeEventListener(this.postRender,this),this.viewer.scene.globe.material&&(this.viewer.scene.globe.material.shaderSource="",this.viewer.scene.globe.material.uniforms="",this.viewer.scene.globe.material.materials=null,this.viewer.scene.globe.material.destroy());}}const ys={type:"tiles",height:void 0,scale:1,rotation:0,position:null,lonlat:null,lonlats:null,positions:null,url:"",shadows:true,color:null,opacity:1,dispose:false,useOriginPosition:true};class ws{constructor(t,i={}){this.viewer=t,this.options=Object.assign({},ys,i),this.tileset=null,this.highlightPrimitives=null,this._originalTransform=null,this.operator=null,this.state=null;}async init(t){this.options=Object.assign({},this.options,t);const i=new Cesium3DTileset({url:this.options.url,shadows:this.options.shadows,maximumScreenSpaceError:16,maximumMemoryUsage:512,debugShowBoundingVolume:false,skipLevelOfDetail:true,baseScreenSpaceError:1024,skipScreenSpaceErrorFactor:16,skipLevels:1,immediatelyLoadDesiredLevelOfDetail:false,loadSiblings:false,cullWithChildrenBounds:true});return this.viewer.scene.primitives.add(i),this.tileset=i,await i.readyPromise.then((t=>(this._originalTransform=Matrix4.clone(t.root.transform),this.update(this.options),this.getInfo())))}_saveState(){this.options&&(this.state={color:this.options.color,opacity:this.options.opacity});}_restoreState(){if(!this.state)return;const t=this.state;this.options=Object.assign({},this.options,t),this.state=null,t.color?this.setColor(t.color):this.tileset.style=void 0,void 0!==t.opacity&&t.color&&this.setOpacity(t.opacity);}select(){this.tileset&&(this.operator?._recordHighlight(this),this._saveState(),this.tileset.style=new Cesium3DTileStyle({color:'color("yellow")'}));}unSelect(){this.tileset&&(this.operator?._unRecordHighlight(this),this._restoreState());}show(){this.tileset&&(this.tileset.show=true);}hide(){this.tileset&&(this.tileset.show=false);}flyTo(t={}){if(!this.tileset)return;const i=this.tileset.boundingSphere;if(!i)return;const e=Math$1.toRadians(t.heading||0),s=Math$1.toRadians(t.pitch||-45),n=new HeadingPitchRange(e,s,t.range||2.5*i.radius);this.viewer.camera.flyToBoundingSphere(i,{offset:n,duration:t.duration||3,complete:t.complete});}changeHeight(t){if(!this.tileset)return;const i=this.options.lonlat;this.setPosition([i[0],i[1],t]);}setPosition(t){if(!this.tileset)return;let i,e,n;if(Array.isArray(t))[i,e,n]=t;else if(t instanceof Cartesian3){const n=Cartographic.fromCartesian(t);i=Math$1.toDegrees(n.longitude),e=Math$1.toDegrees(n.latitude);}this.options.position=this.options.lonlat=this.options.center=[i,e,n],this.options.height=n;const a=Cartesian3.fromDegrees(i,e,n||0),l=Transforms.eastNorthUpToFixedFrame(a),h="number"==typeof this.options.scale?new Cartesian3(this.options.scale,this.options.scale,this.options.scale):new Cartesian3(this.options.scale[0],this.options.scale[1],this.options.scale[2]),d=Math$1.toRadians(this.options.rotation),c=Matrix3.fromRotationZ(d),u=Matrix4.fromScale(h),p=Matrix4.fromRotationTranslation(c);this.tileset.root.transform=Matrix4.multiply(Matrix4.multiply(l,p,new Matrix4),u,new Matrix4),this.tileset.userData={...this.tileset.userData,...this.options},this.viewer.scene.requestRender();}setRotation(t){if(!this.tileset)return;this.options.rotation=t;const i=Math$1.toRadians(t),e=Matrix4.getTranslation(this.tileset.root.transform,new Cartesian3),s=Transforms.eastNorthUpToFixedFrame(e),n="number"==typeof this.options.scale?new Cartesian3(this.options.scale,this.options.scale,this.options.scale):new Cartesian3(this.options.scale[0],this.options.scale[1],this.options.scale[2]),a=Matrix3.fromRotationZ(i),l=Matrix4.fromScale(n),h=Matrix4.fromRotationTranslation(a);this.tileset.root.transform=Matrix4.multiply(Matrix4.multiply(s,h,new Matrix4),l,new Matrix4),this.tileset.userData={...this.tileset.userData,...this.options},this.viewer.scene.requestRender();}setScale(t){if(!this.tileset)return;this.options.scale=t;const i=Matrix4.getTranslation(this.tileset.root.transform,new Cartesian3),e=Transforms.eastNorthUpToFixedFrame(i),s="number"==typeof this.options.scale?new Cartesian3(this.options.scale,this.options.scale,this.options.scale):new Cartesian3(this.options.scale[0],this.options.scale[1],this.options.scale[2]),n=Math$1.toRadians(this.options.rotation),a=Matrix3.fromRotationZ(n),l=Matrix4.fromScale(s),h=Matrix4.fromRotationTranslation(a);this.tileset.root.transform=Matrix4.multiply(Matrix4.multiply(e,h,new Matrix4),l,new Matrix4),this.tileset.userData={...this.tileset.userData,...this.options},this.viewer.scene.requestRender();}setShadow(t){this.tileset&&(this.tileset.shadows=t?ShadowMode.ENABLED:ShadowMode.DISABLED);}setSingle(t){if(this.tileset&&(this.highlightPrimitives&&(this.viewer.scene.primitives.remove(this.highlightPrimitives),this.highlightPrimitives=null),t)){this.highlightPrimitives=new PrimitiveCollection,this.viewer.scene.primitives.add(this.highlightPrimitives);const t=i=>{if(i.content&&i.content.boundingVolume){const t=i.content.boundingVolume.boundingSphere;if(t){const e=new ClassificationPrimitive({geometryInstances:new GeometryInstance({geometry:new PolygonGeometry({polygonHierarchy:new PolygonHierarchy,extrudedHeight:2*t.radius}),attributes:{color:ColorGeometryInstanceAttribute.fromColor(Color.fromRandom().withAlpha(.5)),show:new ShowGeometryInstanceAttribute(true)},id:"tile-highlight-"+i.depth}),classificationType:ClassificationType.CESIUM_3D_TILE});this.highlightPrimitives.add(e);}}i.children&&i.children.forEach((i=>t(i)));};this.tileset.root&&t(this.tileset.root);}}getInfo(){if(!this.options)return null;let t={...this.options};for(const i in this.options) void 0!==this.options[i]&&this.options[i]instanceof Color&&(t[i]=this.options[i].toCssHexString());return t.select&&delete t.select,t}getData(){return this.getInfo()}update(t={}){if(this.options=Object.assign({},this.options,t),void 0!==t.scale&&this.setScale(t.scale),void 0!==t.rotation&&this.setRotation(t.rotation),t.useOriginPosition)this.options.useOriginPosition=t.useOriginPosition,this._syncOriginalTransform(),this.setPosition(this.options.position);else if(t.lonlat||t.lonlats&&t.lonlats[0]||t.position){const i=t.lonlat||t.position||t.lonlats[0];i&&this.setPosition(i);} void 0!==t.select&&(t.select?this.select():this.unSelect()),void 0!==t.show&&(t.show?this.show():this.hide()),void 0!==t.shadows&&this.setShadow(t.shadows),void 0!==t.single&&this.setSingle(t.single);const i={...this.tileset.userData,...this.options,...t};this.tileset.root.userData=i,this.tileset.userData=i,(t.dispose||t.remove)&&this.remove(),t.color&&(this.setColor(t.color),this.state&&(this.state.color=t.color)),t.opacity&&(this.setOpacity(t.opacity),this.state&&(this.state.opacity=t.opacity)),void 0!==t.height&&this.changeHeight(t.height);}_mergeStyle(t){const i=this.tileset.style?{color:this.tileset.style.color}:{};return t.color&&(i.color=t.color),new Cesium3DTileStyle({...i,...t})}_parseHexColor(t){const i=/^#?([a-f\d]{3,4}|[a-f\d]{6}|[a-f\d]{8})$/i.exec(t);if(!i)return;let e=i[1];3!==e.length&&4!==e.length||(e=e.split("").map((t=>t+t)).join(""));return `color("${t}", ${e.match(/.{2}/g).map((t=>parseInt(t,16)/255))[3]??1})`}setColor(t){if(!this.tileset)return;let i;if("string"==typeof t?i=Color.fromCssColorString(t):t instanceof Color&&(i=t),!i)return;i=i.withAlpha(this.options.opacity);const e=`color("${i.toCssColorString()}")`;this.tileset.style=new Cesium3DTileStyle({color:e});}setOpacity(t){if(!this.tileset||!this.options.color||!t)return;let i;if("string"==typeof this.options.color?i=Color.fromCssColorString(this.options.color):this.options.color instanceof Color&&(i=this.options.color),i=i.withAlpha(t),!i)return;const e=`color("${i.toCssColorString()}")`;this.tileset.style=new Cesium3DTileStyle({color:e});}setOptions(t={}){const i={height:"changeHeight",scale:"setScale",rotation:"setRotation",position:"setPosition",lonlat:"setPosition",positions:"setPosition",shadows:"setShadow"};this.options=Object.assign({},this.options,t),Object.entries(t).forEach((([t,e])=>{if(i[t])if(this["_"+t]=e,"positions"===t){const n=Cartographic.fromCartesian(e[0]),a=Math$1.toDegrees(n.longitude),r=Math$1.toDegrees(n.latitude);this[i[t]]([a,r,n.height]);}else this[i[t]](e);}));}remove(){try{this.highlightPrimitives&&(this.viewer.scene.primitives.remove(this.highlightPrimitives),this.highlightPrimitives=null),this.options=null,this.tileset&&(this.viewer.scene.primitives.remove(this.tileset),this.tileset?.isDestroyed()||(this.tileset?.destroy(),this.tileset=null),this.viewer=null);}catch(t){}}get height(){return this.options.height}set height(t){this.options.height=t,this.changeHeight(t);}get scale(){return this.options.scale}set scale(t){this.options.scale=t,this.setScale(t);}get rotation(){return this.options.rotation}set rotation(t){this.options.rotation=t,this.setRotation(t);}_syncOriginalTransform(){if(this._originalTransform&&this.tileset)try{const t=Matrix4.getTranslation(this._originalTransform,new Cartesian3),i=Cartographic.fromCartesian(t),e=Number(Math$1.toDegrees(i.longitude).toFixed(6)),n=Number(Math$1.toDegrees(i.latitude).toFixed(6)),a=Number(i.height.toFixed(2)),l=Transforms.eastNorthUpToFixedFrame(t),h=Matrix4.inverse(l,new Matrix4),d=Matrix4.multiply(h,this._originalTransform,new Matrix4),c=Matrix4.getScale(d,new Cartesian3),u=Matrix4.getRotation(d,new Matrix3);let p=Math$1.toDegrees(Math.atan2(u[3],u[0]));p=(p%360+360)%360,p=Number(p.toFixed(2));const m=[Number(c.x.toFixed(3)),Number(c.y.toFixed(3)),Number(c.z.toFixed(3))],g=.001;m.forEach(((t,i)=>{g>Math.abs(t-1)&&(m[i]=1);})),this.options.position=this.options.lonlat=this.options.center=[e,n,a],this.options.rotation=p,this.options.scale=m;const f=Cartesian3.fromDegrees(e,n,a),v=Transforms.eastNorthUpToFixedFrame(f),y=Matrix3.fromRotationZ(Math$1.toRadians(p)),w=Matrix4.fromScale(new Cartesian3(...m)),C=Matrix4.fromRotationTranslation(y);this.tileset.root.transform=Matrix4.multiply(Matrix4.multiply(v,C,new Matrix4),w,new Matrix4);}catch(t){this.tileset.root.transform=Matrix4.clone(this._originalTransform);}}rigistOperator(t){this.operator=t;}dispose(){this.remove();}}class Cs{constructor(t,i={}){this.viewer=t,this.MapLayers=[];}add(t,i){if("3dtiles"===t){const t=new ws(this.viewer,i);return this.MapLayers.push(t),t}}remove(){this.MapLayers.forEach((t=>{t.remove();})),this.MapLayers=[];}dispose(){this.remove();}}class bs{constructor(){this.highlightedEntitys=new Map;}add(t,i=false){!i&&this.clear(),Array.isArray(t)?t.forEach((t=>{t&&t.options.id&&this.highlightedEntitys.set(t.options.id,t);})):t&&t.options.id&&this.highlightedEntitys.set(t.options.id,t);}has(t){return this.highlightedEntitys.has("string"==typeof t?t:t.options.id)}get(t){return this.highlightedEntitys.get(t)}remove(t){Array.isArray(t)?t.forEach((t=>{t&&t.options.id&&this.highlightedEntitys.delete(t.options.id);})):t&&t.options.id&&this.highlightedEntitys.delete(t.options.id);}clear(){if(0===this.highlightedEntitys.size)return;const t=Array.from(this.highlightedEntitys.values());for(let i=t.length-1;i>=0;i--){const e=t[i];e&&(null==e?void 0:e.unSelect)&&e.unSelect();}this.highlightedEntitys.clear();}}const Ss=()=>{const t=new Uint8Array(16);return crypto.getRandomValues(t),t[6]=15&t[6]|64,t[8]=63&t[8]|128,Array.from(t).map(((t,i)=>t.toString(16).padStart(2,"0")+([4,6,8,10].includes(i)?"-":""))).join("").slice(0,36)};let Ts=JulianDate.fromDate(new Date(2015,2,25,16));JulianDate.addSeconds(Ts,10,new JulianDate);class Ls{constructor(t){this.speed=500,this.firstView=false,this.follow=false,this.loop=true,this.onCompleteCallback=null,this.routePositionProperty=void 0,this.firstViewRenderListener=void 0,this.trackCircumference=0,this.updateInfoCallback=null,this.clockTickListener=null,this.viewer=t,this.clock=new Clock;}setTrackPos(t){let i=this.getLineLength(t.map((t=>Cartesian3.fromDegrees(t[0],t[1],t[2])))),e=new JulianDate,s=JulianDate.addSeconds(e,i/this.speed,new JulianDate),o=new SampledPositionProperty;o.setInterpolationOptions({interpolationDegree:1,interpolationAlgorithm:LinearApproximation});let n=0,a=Cartesian3.fromDegrees(t[0][0],t[0][1],t[0][2]);for(let s=0;t.length>s;s++){let l=Cartesian3.fromDegrees(t[s][0],t[s][1],t[s][2]);n+=Cartesian3.distance(a,l);let h=JulianDate.addSeconds(e,n/i*i/this.speed,new JulianDate);o.addSample(h,l),a=l;}this.viewer.clock.startTime=e.clone(),this.viewer.clock.stopTime=s.clone(),this.viewer.clock.currentTime=e.clone(),this.viewer.clock.shouldAnimate=true,this.viewer.clock.clockRange=this.loop?ClockRange.LOOP_STOP:ClockRange.CLAMPED,this.targetEntity&&(Cartesian3.fromDegrees(t[0][0],t[0][1],t[0][2]),this.targetEntity.position=o,this.targetEntity.orientation=new VelocityOrientationProperty(o),this.targetEntity.show=true,this.routePositionProperty=o),this.trackCircumference=this.getCircumference(t),this.startInfoUpdateListener(),this.loop||this.startCompleteListener();}getCircumference(t){if(2>t.length)return 0;let i=0;for(let e=0;t.length>e;e++)if(t.length-1>e){const s=t[e],o=t[e+1];i+=Cartesian3.distance(Cartesian3.fromDegrees(s[0],s[1],s[2]),Cartesian3.fromDegrees(o[0],o[1],o[2]));}return i/1e3}getTrackTime(){return 0==this.trackCircumference?0:this.trackCircumference/(3.6*this.speed)}getRemainingTime(){if(0==this.trackCircumference)return 0;const t=this.getTrackTime(),i=this.viewer.clock.currentTime,e=this.viewer.clock.startTime;if(!i||!e)return t;const s=JulianDate.secondsDifference(i,e);return Math.max(0,t-s/3600)}startInfoUpdateListener(){this.stopInfoUpdateListener(),this.clockTickListener=()=>{this.updateInfoCallback&&this.updateInfoCallback();},this.viewer.clock.onTick.addEventListener(this.clockTickListener);}stopInfoUpdateListener(){this.clockTickListener&&(this.viewer.clock.onTick.removeEventListener(this.clockTickListener),this.clockTickListener=null);}setUpdateInfoCallback(t){this.updateInfoCallback=t;}setLoop(t){this.loop=t,this.viewer.clock&&(this.viewer.clock.clockRange=this.loop?ClockRange.LOOP_STOP:ClockRange.CLAMPED);}getLoop(){return this.loop}startCompleteListener(){const t=()=>{if(this.viewer.clock.currentTime&&this.viewer.clock.stopTime){JulianDate.greaterThanOrEquals(this.viewer.clock.currentTime,this.viewer.clock.stopTime)&&(this.onCompleteCallback&&this.onCompleteCallback(),this.viewer.clock.onTick.removeEventListener(t));}};this.viewer.clock.onTick.addEventListener(t);}setOnCompleteCallback(t){this.onCompleteCallback=t;}getLineLength(t){let i=0;for(let e=0;t.length>e;e++)if(t.length-1>e){i+=Cartesian3.distance(t[e],t[e+1]);}return i}cartesianRadiansToDegrees(t){const i=Cartographic.fromCartesian(t),e=Math$1.toDegrees(i.longitude),n=Math$1.toDegrees(i.latitude);return Cartographic.fromRadians(e,n,i.height)}computeCirclularFlight(t){let i=new SampledPositionProperty;i.setInterpolationOptions({interpolationDegree:1,interpolationAlgorithm:LinearApproximation});for(let e=0;t.length>e;e++){let s=JulianDate.addSeconds(Ts,e,new JulianDate),o=Cartesian3.fromDegrees(t[e][0],t[e][1],t[e][2]);i.addSample(s,o);}return i}enableFirstView(t=true){null!=this.routePositionProperty&&(this.firstView=t,this.targetEntity&&(this.targetEntity.show=!t),t?(this.viewer.trackedEntity=this.targetEntity,this.viewer.scene.screenSpaceCameraController.enableZoom=false,this.firstViewRenderListener||(this.firstViewRenderListener=()=>{if(this.viewer.trackedEntity){let t=new Matrix4,i=this.viewer.clock.currentTime;i&&this.getModelMatrix(this.viewer.trackedEntity,i,t);this.viewer.scene.camera.lookAtTransform(t,new Cartesian3(-1,0,.1));}}),this.viewer.scene.preRender.addEventListener(this.firstViewRenderListener)):(this.firstView=false,this.viewer.trackedEntity=void 0,this.viewer.scene.screenSpaceCameraController.enableZoom=true,this.firstViewRenderListener&&(this.viewer.scene.preRender.removeEventListener(this.firstViewRenderListener),this.firstViewRenderListener=void 0),this.setViewOffset(new Cartesian3(-90,0,100))));}enableFollow(t){null!=this.routePositionProperty&&(this.follow=t,t&&this.targetEntity?(this.targetEntity.show=true,this.viewer.trackedEntity=this.targetEntity,this.setViewOffset()):this.viewer.trackedEntity=void 0);}getModelMatrix(t,i,e){var s,o;let n=new Matrix3,a=null===(s=t.position)||void 0===s?void 0:s.getValue(i,new Cartesian3);if(!a)return;let l=null===(o=t.orientation)||void 0===o?void 0:o.getValue(i,new Quaternion);return e=l?Matrix4.fromRotationTranslation(Matrix3.fromQuaternion(l,n),a,e):Transforms.eastNorthUpToFixedFrame(a,void 0,e)}setViewOffset(t){if(!this.viewer.trackedEntity)return;let i=this.viewer.clock.currentTime,e=new Matrix4;i&&this.getModelMatrix(this.viewer.trackedEntity,i,e);let s=90,o=55,n=0;this.firstView&&(s=1,o=.1,n=0),this.viewer.scene.camera.lookAtTransform(e,t||new Cartesian3(-s,n,o));}cancelRoam(){this.targetEntity&&(this.targetEntity.show=false,this.targetEntity.position=void 0,this.firstView=false,this.follow=false,this.routePositionProperty=void 0),this.stopInfoUpdateListener();}dispose(){this.cancelRoam(),this.viewer.trackedEntity=void 0,this.targetEntity=void 0,this.lineEntity=void 0,this.routePositionProperty=void 0,this.firstViewRenderListener&&this.viewer.scene.preRender.removeEventListener(this.firstViewRenderListener),this.firstViewRenderListener=void 0,this.updateInfoCallback=null,this.onCompleteCallback=null;}}class Es{constructor(t){this.operator=null,this.list=new Map,this.options={},this.targetEntity=null,this.showInfoPanel=true,this.operator=t;}addTarget(t){return Mt(this,void 0,void 0,(function*(){if(this.operator)try{const i=yield this.operator.drawEntity(t);i&&i.length>0&&(this.targetEntity=i[0]);}catch(t){}}))}addLine(t){return Mt(this,void 0,void 0,(function*(){var i;this.operator&&(t.id||(t.id=Ss()),this.operator.enableDraw(true),t.call=(i,e)=>{this.list.set(t.id,{target:this.targetEntity,line:e,options:t,roam:null,isSimulating:false}),this.options=e.getData(),this.setTargetToStartPoint(t.id);},yield null===(i=this.operator)||void 0===i?void 0:i.setDrawType(t.type,t));}))}setTargetToStartPoint(t){if(!this.targetEntity||!this.operator)return;const i=this.list.get(t);if(!i||!i.line)return;const e=i.line.getData();e&&e.lonlats&&e.lonlats.length>=3&&this.targetEntity&&this.targetEntity.update({lonlat:e.lonlats[0]});}simulate(t){if(!this.operator)return;const i=t||this.options.id;if(!i)return;const e=this.list.get(i);e&&e.line&&(e.isSimulating?this.stopSimulation(i):this.startSimulation(i));}startSimulation(t){if(!this.operator)return;const i=this.list.get(t);if(!i||!i.line||!i.target)return;const e=i.target.entity,s=i.line.entity;if(!e||!s)return;const o=i.line.getData();if(!o||!o.lonlats||2>o.lonlats.length)return;const n=new Ls(this.operator.viewer);i.roam=n,i.isSimulating=true,n.targetEntity=e,n.lineEntity=s,n.speed=5.56,n.setTrackPos(o.lonlats),this.showInfoPanel&&this.updateInfoPanel(t,{showName:true}),n.setUpdateInfoCallback((()=>{this.showInfoPanel&&this.updateInfoPanel(t,{updateText:true});}));}updateSimulation(t,i){if(this.operator)if(i){const e=this.list.get(i);if(!e||!e.roam)return;this.updateRouteSimulation(e,t,i);}else this.list.forEach(((i,e)=>{i.isSimulating&&i.roam&&this.updateRouteSimulation(i,t,e);}));}updateRouteSimulation(t,i,e){var s;const o=t.roam;if(o){if(i.speed){o.speed=i.speed;const n=null===(s=t.line)||void 0===s?void 0:s.getData();n&&n.lonlats&&o.setTrackPos(n.lonlats),this.updateInfoPanel(e,{updateText:true});}i.lonlats&&o.setTrackPos(i.lonlats),void 0!==i.enableRoamFollow&&o.enableFollow(i.enableRoamFollow),void 0!==i.enableFirstView&&o.enableFirstView(i.enableFirstView),void 0!==i.enableRoam&&(i.enableRoam?this.startRouteRoam(e):o.cancelRoam()),void 0!==i.loop&&o.setLoop(i.loop),void 0!==i.showInfoPanel&&this.updateInfoPanel(e,{showName:i.showInfoPanel});}}updateInfoPanel(t,i={}){var e;if(!this.operator)return;const s=this.list.get(t);if(s&&s.target&&s.roam&&this.showInfoPanel&&(void 0!==i.showName&&s.target.update({showName:i.showName,fontHorizontalOrigin:"LEFT"}),void 0!==i.fontText||void 0!==i.updateText)){const t=s.roam,o=null===(e=s.line)||void 0===e?void 0:e.getData(),n=t.getCircumference(o?o.lonlats:this.options.lonlats).toFixed(2),a=t.getTrackTime().toFixed(2),r=t.speed.toFixed(2),l=(3.6*t.speed).toFixed(2),h=t.getRemainingTime().toFixed(2);s.target.update({fontText:i.fontText||"\u901f\u5ea6: "+r+" m/s \n\u65f6\u901f: "+l+" km/h\n\u603b\u957f: "+n+" km\n\u603b\u8017\u65f6"+a+" h\n\u5269\u4f59\u8017\u65f6: "+h+" h"});}}enableRoamFollow(t=false,i){var e;if(i){const s=this.list.get(i);null===(e=null==s?void 0:s.roam)||void 0===e||e.enableFollow(t);}else this.list.forEach((i=>{i.isSimulating&&i.roam&&i.roam.enableFollow(t);}));}enableFirstView(t=false,i){var e;if(i){const s=this.list.get(i);null===(e=null==s?void 0:s.roam)||void 0===e||e.enableFirstView(t);}else this.list.forEach((i=>{i.isSimulating&&i.roam&&i.roam.enableFirstView(t);}));}startRoam(t){t?this.startRouteRoam(t):this.list.forEach(((t,i)=>{t.isSimulating&&t.roam&&this.startRouteRoam(i);}));}startRouteRoam(t){var i;const e=this.list.get(t);if(!e||!e.roam)return;const s=null===(i=e.line)||void 0===i?void 0:i.getData();s&&s.lonlats&&e.roam.setTrackPos(s.lonlats);}stopSimulation(t){if(t){const i=this.list.get(t);i&&i.roam&&(i.roam.cancelRoam(),i.roam.setUpdateInfoCallback(null),i.roam.dispose(),i.roam=null,i.isSimulating=false);}else this.list.forEach(((t,i)=>{t.roam&&(t.roam.cancelRoam(),t.roam.setUpdateInfoCallback(null),t.roam.dispose(),t.roam=null,t.isSimulating=false);}));this.operator&&(this.operator.viewer.clock.shouldAnimate=false);}getSimulatingRoutes(){const t=[];return this.list.forEach(((i,e)=>{i.isSimulating&&t.push(e);})),t}getRouteStatus(t){const i=this.list.get(t);return {isSimulating:(null==i?void 0:i.isSimulating)||false,hasRoam:!!(null==i?void 0:i.roam)}}clearAllRoutes(){if(this.stopSimulation(),this.list.size){const t=Array.from(this.list.keys());for(let i=t.length-1;i>=0;i--){const e=t[i],s=this.list.get(e);(null==s?void 0:s.roam)&&s.roam.dispose(),(null==s?void 0:s.target)&&s.target.dispose(),(null==s?void 0:s.line)&&s.line.dispose(),this.list.delete(e);}this.list.clear();}}dispose(){this.stopSimulation(),this.list.clear(),this.targetEntity=null,this.operator=null;}}const Ds=Object.prototype.hasOwnProperty,Ms="undefined"!=typeof Symbol?Symbol.toStringTag:void 0;function Rs(t){if(!function(t){const i=typeof t;return null!==t&&("object"===i||"function"===i)}(t))return false;const i=function(t){if(null===t)return void 0===t?"[object Undefined]":"[object Null]";if(!Ms||!(Ms in Object(t)))return toString.call(t);const i=Ds.call(t,Ms),e=t[Ms];let s=false;try{t[Ms]=void 0,s=!0;}catch(t){}const o=Object.prototype.toString.call(t);return s&&(i?t[Ms]=e:delete t[Ms]),o}(t);return "[object Function]"===i||"[object AsyncFunction]"===i||"[object GeneratorFunction]"===i||"[object Proxy]"===i}function xs(t){return "[object Number]"===Object.prototype.toString.call(t)&&!isNaN(t)}const ks={};function Ps(t){return null!=t&&!isNaN(t)}class Os{constructor(t,i){this.u=t,this.v=i,this.m=this.magnitude();}magnitude(){return Math.sqrt(this.u**2+this.v**2)}directionTo(){let t=Math.atan2(this.u,this.v)*(180/Math.PI);return 0>t&&(t+=360),t}directionFrom(){return (this.directionTo()+180)%360}}class As{constructor(t){this.grid=[],this.xmin=t.xmin,this.xmax=t.xmax,this.ymin=t.ymin,this.ymax=t.ymax,this.cols=t.cols,this.rows=t.rows,this.us=t.us,this.vs=t.vs,this.deltaX=t.deltaX,this.deltaY=t.deltaY,this.flipY=!!t.flipY,this.ymin=Math.min(t.ymax,t.ymin),this.ymax=Math.max(t.ymax,t.ymin),0>this.deltaY&&this.ymax>this.ymin||void 0===t.flipY&&(this.flipY=true),this.isFields=true;var i;this.isContinuous=Math.floor(this.cols*t.deltaX)>=360,this.translateX="translateX"in t?t.translateX:this.xmax>180,"wrappedX"in t&&(ks[i="`wrappedX` namespace will deprecated please use `translateX` instead\uff01"]||(ks[i]=true)),this.wrapX=!!t.wrapX,this.grid=this.buildGrid(),this.range=this.calculateRange();}buildGrid(){const t=[];let i=0;const{rows:e,cols:s,us:o,vs:n}=this;for(let a=0;e>a;a++){const e=[];for(let t=0;s>t;t++,i++){const s=o[i],a=n[i],r=this.isValid(s)&&this.isValid(a);e[t]=r?new Os(s,a):null;}this.isContinuous&&e.push(e[0]),t[a]=e;}return t}release(){this.grid=[];}extent(){return [this.xmin,this.ymin,this.xmax,this.ymax]}bilinearInterpolateVector(t,i,e,s,o,n){const a=1-t,r=1-i,l=a*r,h=t*r,d=a*i,c=t*i;return new Os(e.u*l+s.u*h+o.u*d+n.u*c,e.v*l+s.v*h+o.v*d+n.v*c)}calculateRange(){if(!this.grid||!this.grid[0])return;const t=this.grid.length,i=this.grid[0].length;let e,s;for(let o=0;t>o;o++)for(let t=0;i>t;t++){const i=this.grid[o][t];if(null!==i){const t=i.m||i.magnitude();void 0===e?e=t:void 0===s?(s=t,e=Math.min(e,s),s=Math.max(e,s)):(e=Math.min(t,e),s=Math.max(t,s));}}return [e,s]}isValid(t){return null!=t}getWrappedLongitudes(){let t=this.xmin,i=this.xmax;return this.translateX&&(this.isContinuous?(t=-180,i=180):(i=this.xmax-360,t=this.xmin-360)),[t,i]}contains(t,i){const[e,s]=this.getWrappedLongitudes();180>=s||-180>t||t>s-360?e>=-180||t>180||e+360>t||(t-=360):t+=360;let o;return o=0>this.deltaY?i>=this.ymax&&this.ymin>=i:i>=this.ymin&&this.ymax>=i,t>=e&&s>=t&&o}getDecimalIndexes(t,i){const e=((s=t-this.xmin)-(o=360)*Math.floor(s/o))/this.deltaX;var s,o;if(this.flipY){return [e,(this.ymax-i)/this.deltaY]}return [e,(this.ymin+i)/this.deltaY]}valueAt(t,i){let e=false;if((this.wrapX||this.contains(t,i))&&(e=true),!e)return null;const s=this.getDecimalIndexes(t,i),o=Math.floor(s[0]),n=Math.floor(s[1]),a=this.clampColumnIndex(o),r=this.clampRowIndex(n);return this.valueAtIndexes(a,r)}interpolatedValueAt(t,i){let e=false;if((this.wrapX||this.contains(t,i))&&(e=true),!e)return null;const[s,o]=this.getDecimalIndexes(t,i);return this.interpolatePoint(s,o)}hasValueAt(t,i){return null!==this.valueAt(t,i)}interpolatePoint(t,i){const e=this.getFourSurroundingIndexes(t,i),[s,o,n,a]=e,r=this.getFourSurroundingValues(s,o,n,a);if(r){const[e,o,a,l]=r;return this.bilinearInterpolateVector(t-s,i-n,e,o,a,l)}return null}clampColumnIndex(t){let i=t;0>t&&(i=0);const e=this.cols-1;return t>e&&(i=e),i}clampRowIndex(t){let i=t;0>t&&(i=0);const e=this.rows-1;return t>e&&(i=e),i}getFourSurroundingIndexes(t,i){const e=Math.floor(t);let s=e+1;this.isContinuous&&s>=this.cols&&(s=0),s=this.clampColumnIndex(s);const o=this.clampRowIndex(Math.floor(i));return [e,s,o,this.clampRowIndex(o+1)]}getFourSurroundingValues(t,i,e,s){let o;if(o=this.grid[e]){const e=o[t],n=o[i];if(this.isValid(e)&&this.isValid(n)&&(o=this.grid[s])){const s=o[t],a=o[i];if(this.isValid(s)&&this.isValid(a))return [e,n,s,a]}}return null}valueAtIndexes(t,i){return this.grid[i][t]}lonLatAtIndexes(t,i){return [this.longitudeAtX(t),this.latitudeAtY(i)]}longitudeAtX(t){let i=this.xmin+this.deltaX/2+t*this.deltaX;return this.translateX&&(i=i>180?i-360:i),i}latitudeAtY(t){return this.ymax-this.deltaY/2-t*this.deltaY}randomize(t={},i,e,s){const o=Math.random()*(i||this.cols)|0,n=Math.random()*(e||this.rows)|0,a=s([o,n]);return null!==a?(t.x=a[0],t.y=a[1]):(t.x=this.longitudeAtX(o),t.y=this.latitudeAtY(n)),t}checkFields(){return this.isFields}}const Is={globalAlpha:.9,lineWidth:1,colorScale:"#fff",velocityScale:.04,maxAge:90,paths:800,frameRate:20,useCoordsDraw:true};function _s(t,i,e,s){return Math.max(0,Math.min(s.length-1,Math.round((t-i)/(e-i)*(s.length-1))))}class Fs{constructor(t,i,e){if(this.particles=[],this.generated=false,this.ctx=t,!this.ctx)throw Error("ctx error");this.animate=this.animate.bind(this),this.setOptions(i),e&&this.updateData(e);}static{this.Field=As;}setOptions(t){this.options={...Is,...t};const{width:i,height:e}=this.ctx.canvas;"particleAge"in t&&!("maxAge"in t)&&xs(this.options.particleAge)&&(this.options.maxAge=this.options.particleAge),"particleMultiplier"in t&&!("paths"in t)&&xs(this.options.particleMultiplier)&&(this.options.paths=Math.round(i*e*this.options.particleMultiplier)),this.prerender();}getOptions(){return this.options}updateData(t){this.field=t,this.generated&&(this.particles=this.prepareParticlePaths());}project(...t){throw Error("project must be overriden")}unproject(...t){throw Error("unproject must be overriden")}intersectsCoordinate(t){throw Error("must be overriden")}clearCanvas(){this.stop(),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.forceStop=false;}isStop(){return !this.starting}start(){this.starting=true,this.forceStop=false,this.then=Date.now(),this.animate();}stop(){cancelAnimationFrame(this.animationLoop),this.starting=false,this.forceStop=true;}animate(){this.animationLoop&&cancelAnimationFrame(this.animationLoop),this.animationLoop=requestAnimationFrame(this.animate);const t=Date.now(),i=t-this.then;i>this.options.frameRate&&(this.then=t-i%this.options.frameRate,this.render());}prerender(){this.generated=false,this.field&&(this.particles=this.prepareParticlePaths(),this.generated=true,this.starting||this.forceStop||(this.starting=true,this.then=Date.now(),this.animate()));}render(){this.moveParticles(),this.drawParticles(),this.postrender();}postrender(){}moveParticles(){const{width:t,height:i}=this.ctx.canvas,e=this.particles,s=this.options.maxAge,o=Rs(this.options.velocityScale)?this.options.velocityScale():this.options.velocityScale;let n=0;const a=e.length;for(;a>n;n++){const a=e[n];a.age>s&&(a.age=0,this.field.randomize(a,t,i,this.unproject));const r=a.x,l=a.y,h=this.field.interpolatedValueAt(r,l);if(null===h)a.age=s;else {const t=r+h.u*o,i=l+h.v*o;this.field.hasValueAt(t,i)?(a.xt=t,a.yt=i,a.m=h.m):(a.x=t,a.y=i,a.age=s);}a.age++;}}fadeIn(){const t=this.ctx.globalCompositeOperation;this.ctx.globalCompositeOperation="destination-in",this.ctx.fillRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.globalCompositeOperation=t;}drawParticles(){const t=this.particles;var i;this.fadeIn(),this.ctx.globalAlpha=this.options.globalAlpha,this.ctx.fillStyle=`rgba(0, 0, 0, ${this.options.globalAlpha})`,this.ctx.lineWidth=xs(this.options.lineWidth)?this.options.lineWidth:1,this.ctx.strokeStyle=null!=(i=this.options.colorScale)&&("string"==typeof i||null!==i.constructor&&i.constructor===String)?this.options.colorScale:"#fff";let e=0;const s=t.length;if(this.field&&s>0){let i,o;for(Ps(this.options.minVelocity)&&Ps(this.options.maxVelocity)?(i=this.options.minVelocity,o=this.options.maxVelocity):[i,o]=this.field.range;s>e;e++)this[this.options.useCoordsDraw?"drawCoordsParticle":"drawPixelParticle"](t[e],i,o);}}drawPixelParticle(t,i,e){const s=[t.x,t.y],o=[t.xt,t.yt];if(o&&s&&Ps(o[0])&&Ps(o[1])&&Ps(s[0])&&Ps(s[1])&&this.options.maxAge>=t.age){if(this.ctx.beginPath(),this.ctx.moveTo(s[0],s[1]),this.ctx.lineTo(o[0],o[1]),Rs(this.options.colorScale))this.ctx.strokeStyle=this.options.colorScale(t.m);else if(Array.isArray(this.options.colorScale)){const s=_s(t.m,i,e,this.options.colorScale);this.ctx.strokeStyle=this.options.colorScale[s];}Rs(this.options.lineWidth)&&(this.ctx.lineWidth=this.options.lineWidth(t.m)),t.x=t.xt,t.y=t.yt,this.ctx.stroke();}}drawCoordsParticle(t,i,e){const s=[t.x,t.y],o=[t.xt,t.yt];if(o&&s&&Ps(o[0])&&Ps(o[1])&&Ps(s[0])&&Ps(s[1])&&this.intersectsCoordinate(o)&&this.options.maxAge>=t.age){const n=this.project(s),a=this.project(o);if(n&&a){if(this.ctx.beginPath(),this.ctx.moveTo(n[0],n[1]),this.ctx.lineTo(a[0],a[1]),t.x=t.xt,t.y=t.yt,Rs(this.options.colorScale))this.ctx.strokeStyle=this.options.colorScale(t.m);else if(Array.isArray(this.options.colorScale)){const s=_s(t.m,i,e,this.options.colorScale);this.ctx.strokeStyle=this.options.colorScale[s];}Rs(this.options.lineWidth)&&(this.ctx.lineWidth=this.options.lineWidth(t.m)),this.ctx.stroke();}}}prepareParticlePaths(){const{width:t,height:i}=this.ctx.canvas,e="function"==typeof this.options.paths?this.options.paths(this):this.options.paths,s=[];if(!this.field)return [];let o=0;for(;e>o;o++)s.push(this.field.randomize({age:this.randomize()},t,i,this.unproject));return s}randomize(){return Math.floor(Math.random()*this.options.maxAge)}}class zs{constructor(t,i={}){this.canvas=null,this.wind=null,this.field=null,this.viewer=null,this.options=function(t,...i){return Object.assign(t,...i)}({},i),this.pickWindOptions();const e=document.createElement("canvas");e.style.cssText="position:absolute; left:0; top:0;user-select:none;pointer-events: none;",e.className="cesium-wind-j",this.canvas=e,t&&this.setData(t);}addTo(t){this.viewer=t,this.appendCanvas(),this.render(this.canvas);}remove(){var t;this.viewer&&(this.wind&&this.wind.stop(),this.canvas&&(t=this.canvas)&&t.parentNode&&t.parentNode.removeChild(t),delete this.canvas);}removeLayer(){this.remove();}setData(t){return t&&t.checkFields&&t.checkFields()?this.field=t:Array.isArray(t)&&(this.field=function(t,i={}){let e,s;if(t.forEach((function(t){switch(t.header.parameterCategory+","+t.header.parameterNumber){case "1,2":case "2,2":e=t;break;case "1,3":case "2,3":s=t;}})),!s||!e)return;const o=e.header;return new As({xmin:o.lo1,ymin:o.la1,xmax:o.lo2,ymax:o.la2,deltaX:o.dx,deltaY:o.dy,cols:o.nx,rows:o.ny,us:e.data,vs:s.data,...i})}(t)),this.viewer&&this.canvas&&this.field&&(this.wind.updateData(this.field),this.appendCanvas(),this.render(this.canvas)),this}getData(){return this.field}getWindOptions(){return this.options.windOptions||{}}pickWindOptions(){Object.keys(Is).forEach((t=>{t in this.options&&(void 0===this.options.windOptions&&(this.options.windOptions={}),this.options.windOptions[t]=this.options[t]);}));}getContext(){if(null!==this.canvas)return this.canvas.getContext("2d")}appendCanvas(){if(!this.viewer||!this.canvas)return;if(document.querySelector(".cesium-wind-j"))return;this.adjustSize();this.viewer.canvas.parentNode.appendChild(this.canvas);}adjustSize(){const t=this.viewer,i=this.canvas,{width:e,height:s}=t.canvas;i.width=1*e,i.height=1*s,i.style.width=e+"px",i.style.height=s+"px";}render(t){if(!this.getData()||!this.viewer)return this;const i=this.getWindOptions();if(t&&!this.wind){const t=this.getData(),e=this.getContext();e&&(this.wind=new Fs(e,i,t),this.wind.project=this.project.bind(this),this.wind.unproject=this.unproject.bind(this),this.wind.intersectsCoordinate=this.intersectsCoordinate.bind(this),this.wind.postrender=()=>{});}return this.wind&&(this.wind.prerender(),this.wind.render()),this}project(i){const e=t.Cartesian3.fromDegrees(i[0],i[1]),s=this.viewer.scene,o=(t.SceneTransforms?.wgs84ToWindowCoordinates||t.SceneTransforms.worldToWindowCoordinates)(s,e);return [o.x,o.y]}unproject(i){const e=this.viewer,s=new t.Cartesian2(i[0],i[1]),o=e.scene.globe.pick(e.camera.getPickRay(s),e.scene);if(!o)return null;const n=e.scene.globe.ellipsoid.cartesianToCartographic(o),a=t.Math.toDegrees(n.latitude);return [t.Math.toDegrees(n.longitude),a]}intersectsCoordinate(i){const e=new t.EllipsoidalOccluder(t.Ellipsoid.WGS84,this.viewer.camera.position),s=t.Cartesian3.fromDegrees(i[0],i[1]);return e.isPointVisible(s)}}const Hs={colorScale:["rgb(36,104, 180)","rgb(60,157, 194)","rgb(128,205,193 )","rgb(151,218,168 )","rgb(198,231,181)","rgb(238,247,217)","rgb(255,238,159)","rgb(252,217,125)","rgb(255,182,100)","rgb(252,150,75)","rgb(250,112,52)","rgb(245,64,32)","rgb(237,45,28)","rgb(220,24,32)","rgb(180,0,35)"],frameRate:30,maxAge:60,globalAlpha:.9,velocityScale:1/30,paths:2e3,lineWidth:1};class Vs{constructor(t,i={}){this.windLayer=null,this.options={},this.viewer=t,this.options=Object.assign({},Hs,i);}init(t){this.options=Object.assign({},this.options,t),fetch(t.url).then((t=>t.json())).then((t=>{this.windLayer=new zs(t,{windOptions:this.options}),this.windLayer.addTo(this.viewer);}));}remove(){this.windLayer&&(this.windLayer.remove(),this.windLayer=null);}updateOptions(t){if(this.windLayer){const i=this.windLayer.getWindOptions();Object.assign(i,t),this.windLayer.wind&&this.windLayer.wind.setOptions&&this.windLayer.wind.setOptions(i),this.windLayer.render&&this.windLayer.canvas&&this.windLayer.render(this.windLayer.canvas);}}show(){this.windLayer&&this.windLayer.canvas&&(this.windLayer.canvas.style.display="block",this.windLayer.wind&&this.windLayer.wind.start());}hide(){this.windLayer&&this.windLayer.canvas&&(this.windLayer.canvas.style.display="none",this.windLayer.wind&&this.windLayer.wind.stop());}pause(){this.windLayer&&this.windLayer.wind&&this.windLayer.wind.stop();}resume(){this.windLayer&&this.windLayer.wind&&this.windLayer.wind.start();}dispose(){this.remove();}}const Ws={radius:10,blur:.85,maxOpacity:.8,canvasSize:512,gradient:{0:"#0000ff",.25:"#00ffff",.5:"#00ff00",.75:"#ffff00",1:"#ff0000"},padding:.1};class js{constructor(t,i,e={}){this.imageryLayer=null,this.bounds={west:0,south:0,east:0,north:0},this.isActive=false,this.rafId=null,this.viewer=t,this.operator=i,this.options=Object.assign(Object.assign({},Ws),e),this.canvas=document.createElement("canvas"),this.ctx=this.canvas.getContext("2d");}show(t={}){this.options=Object.assign(Object.assign({},this.options),t),this.isActive=true,this.render();}update(t={}){if(!this.isActive)return;const i=Dt(t,["refresh"]);this.options=Object.assign(Object.assign({},this.options),i),this.scheduleRender();}refresh(){this.isActive&&this.render();}dispose(){this.isActive=false,null!==this.rafId&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.removeImageryLayer(),this.canvas.width=0,this.canvas.height=0;}scheduleRender(){null===this.rafId&&(this.rafId=requestAnimationFrame((()=>{this.rafId=null,this.render();})));}render(){const t=this.collectBillboardPoints();0!==t.length?(this.bounds=function(t,i=.1){if(0===t.length)return {west:0,south:0,east:0,north:0};let e=1/0,s=1/0,o=-1/0,n=-1/0;for(const i of t)e>i.lon&&(e=i.lon),i.lon>o&&(o=i.lon),s>i.lat&&(s=i.lat),i.lat>n&&(n=i.lat);e===o&&(e-=.01,o+=.01);s===n&&(s-=.01,n+=.01);const a=(o-e)*i,r=(n-s)*i;return {west:e-a,south:s-r,east:o+a,north:n+r}}(t,this.options.padding),this.canvas.width=this.options.canvasSize,this.canvas.height=this.options.canvasSize,this.renderHeatmap(t),this.applyColorize(),this.overlayToMap()):this.removeImageryLayer();}collectBillboardPoints(){const t=this.operator.getEntitys()||[],i=[],e=this.options.entityIds,s=e&&e.length>0?new Set(e):null;for(const e of t){const t=e.getData?e.getData():e;if(!t)continue;if("billboard"!==t.type)continue;if(s&&!s.has(t.id))continue;const o=t.lonlat;o&&o.length>=2&&i.push({lon:o[0],lat:o[1]});}return i}renderHeatmap(t){const{canvasSize:i,radius:e,blur:s}=this.options,o=this.ctx;o.clearRect(0,0,i,i),o.globalCompositeOperation="lighter";const n=e*(1+s);for(const e of t){const{x:t,y:s}=Gs(e.lon,e.lat,this.bounds,i);this.drawGrayPoint(t,s,n);}o.globalCompositeOperation="source-over";}drawGrayPoint(t,i,e){const s=this.ctx.createRadialGradient(t,i,0,t,i,e);s.addColorStop(0,"rgba(0,0,0,1)"),s.addColorStop(1,"rgba(0,0,0,0)"),this.ctx.fillStyle=s,this.ctx.beginPath(),this.ctx.arc(t,i,e,0,2*Math.PI),this.ctx.fill();}applyColorize(){const{canvasSize:t,maxOpacity:i}=this.options,e=this.ctx.getImageData(0,0,t,t),s=e.data,o=function(t){const i=document.createElement("canvas");i.width=256,i.height=1;const e=i.getContext("2d"),s=e.createLinearGradient(0,0,256,0),o=Object.entries(t).sort(((t,i)=>Number(t[0])-Number(i[0])));for(const[t,i]of o)s.addColorStop(Number(t),i);return e.fillStyle=s,e.fillRect(0,0,256,1),e.getImageData(0,0,256,1).data}(this.options.gradient);for(let t=0;s.length>t;t+=4){const e=s[t+3];if(e>0){const n=4*Math.min(e,255);s[t]=o[n],s[t+1]=o[n+1],s[t+2]=o[n+2],s[t+3]=Math.round(Math.min(255,e/255*i*255));}}this.ctx.putImageData(e,0,0);}overlayToMap(){this.removeImageryLayer();const t=new SingleTileImageryProvider({url:this.canvas.toDataURL("image/png"),rectangle:Rectangle.fromDegrees(this.bounds.west,this.bounds.south,this.bounds.east,this.bounds.north)});this.imageryLayer=this.viewer.imageryLayers.addImageryProvider(t);}removeImageryLayer(){this.imageryLayer&&(this.viewer.imageryLayers.remove(this.imageryLayer,true),this.imageryLayer=null);}}function Gs(t,i,e,s){return {x:(t-e.west)/(e.east-e.west)*s,y:(e.north-i)/(e.north-e.south)*s}}const Bs={longitude:107.56,latitude:29.58,height:6,radius:300,heading:0,pitch:-5,fov:90,angleStep:1.5,distanceStep:5,visibleColor:"#00ff00",invisibleColor:"#ff0000",opacity:.4};class Zs{constructor(t,i,e={}){this.visiblePolygon=null,this.invisiblePolygon=null,this.isActive=false,this.isAnalyzing=false,this.viewer=t,this.operator=i,this.options=Object.assign(Object.assign({},Bs),e),this.id=e.id||"m-"+Math.random().toString(36).substring(2,10)+"-"+Date.now().toString(36),this.name=e.name||"viewShed";}show(){return Mt(this,arguments,void 0,(function*(t={}){this.options=Object.assign(Object.assign({},this.options),t),this.isActive=true,yield this.analyze();}))}update(){return Mt(this,arguments,void 0,(function*(t={}){this.isActive&&(this.options=Object.assign(Object.assign({},this.options),t),yield this.analyze());}))}dispose(){this.isActive=false,this.removePolygons();}getData(){const{longitude:t,latitude:i,height:e,radius:s,heading:o,pitch:n,fov:a,opacity:r}=this.options;return {id:this.id,type:"viewShed",position:[t,i,e],style:{angle:a,distance:s,heading:o,pitch:n,opacity:r},attr:{name:this.name}}}analyze(){return Mt(this,void 0,void 0,(function*(){if(!this.isAnalyzing){this.isAnalyzing=true;try{const{longitude:t,latitude:i,height:e,distanceStep:n}=this.options,a=this.generateRayPositions(),r=Cartographic.fromDegrees(t,i),l=[r];for(const t of a)l.push(...t.positions);yield this.batchSampleTerrain(l);const h=(r.height||0)+e,d=this.options.pitch*Math.PI/180-this.options.fov/2*Math.PI/180,c=[];for(const t of a){const i=[];let e=d;for(let s=0;t.positions.length>s;s++){const a=t.positions[s],r=(s+1)*n,l=a.height||0,d=Math$1.toDegrees(a.longitude),c=Math$1.toDegrees(a.latitude),u=Us(h,l,r),p=u>e;p&&(e=u),i.push({lon:d,lat:c,distance:r,terrainHeight:l,visible:p});}c.push({bearing:t.bearing,samples:i});}this.createPolygons(c);}finally{this.isAnalyzing=false;}}}))}generateRayPositions(){const{longitude:t,latitude:i,radius:e,angleStep:o,distanceStep:n,heading:a,fov:r}=this.options,l=[],h=Math.floor(e/n),d=r/2;let c=0;for(;r>=c;){const e=((a-d+c)%360+360)%360,r=[];for(let o=1;h>=o;o++){const a=Ns(t,i,e,o*n);r.push(Cartographic.fromDegrees(a.lon,a.lat));}l.push({bearing:e,positions:r}),c+=o;}return l}batchSampleTerrain(t){return Mt(this,void 0,void 0,(function*(){if(this.viewer.terrainProvider instanceof EllipsoidTerrainProvider)return;const i=1e3;for(let e=0;t.length>e;e+=4e3){const s=[];for(let o=0;4>o;o++){const n=e+o*i;if(n>=t.length)break;s.push(t.slice(n,n+i));}yield Promise.all(s.map((t=>sampleTerrainMostDetailed(this.viewer.terrainProvider,t))));}}))}createPolygons(t){this.removePolygons();const{visibleLonlats:i,invisibleLonlats:e}=function(t,i,e){const s=[],o=[],n=[];for(const a of e){const{samples:e}=a;if(0===e.length)continue;const r=e[e.length-1];n.push({lon:r.lon,lat:r.lat});let l=-1;for(let t=0;e.length>t&&e[t].visible;t++)l=t;if(l<0)o.push({lon:t,lat:i});else {const t=e[l];s.push({lon:t.lon,lat:t.lat}),o.push({lon:t.lon,lat:t.lat});}}const a=[];if(s.length>=2){a.push(t,i,0);for(const t of s)a.push(t.lon,t.lat,0);a.push(t,i,0);}const r=[];if(n.length>=2){for(const t of o)r.push(t.lon,t.lat,0);for(let t=n.length-1;t>=0;t--)r.push(n[t].lon,n[t].lat,0);}return {visibleLonlats:a,invisibleLonlats:r}}(this.options.longitude,this.options.latitude,t);12>e.length||(this.invisiblePolygon=this.viewer.entities.add({polygon:{hierarchy:new PolygonHierarchy$1(Cartesian3.fromDegreesArrayHeights(e)),material:Color.fromCssColorString(this.options.invisibleColor).withAlpha(this.options.opacity),classificationType:ClassificationType$1.BOTH}})),12>i.length||(this.visiblePolygon=this.viewer.entities.add({polygon:{hierarchy:new PolygonHierarchy$1(Cartesian3.fromDegreesArrayHeights(i)),material:Color.fromCssColorString(this.options.visibleColor).withAlpha(this.options.opacity),classificationType:ClassificationType$1.BOTH}}));}removePolygons(){this.invisiblePolygon&&(this.viewer.entities.remove(this.invisiblePolygon),this.invisiblePolygon=null),this.visiblePolygon&&(this.viewer.entities.remove(this.visiblePolygon),this.visiblePolygon=null);}}function Ns(t,i,e,s){const o=i*Math.PI/180,n=e*Math.PI/180,a=s*Math.cos(n)/110540;return {lon:t+s*Math.sin(n)/(111320*Math.cos(o)),lat:i+a}}function Us(t,i,e){return e>0?Math.atan2(i-t,e):0}class qs{constructor(t,i,e={}){this.currentSimulationRef=null,this.viewer=t,this.operator=i,this.options=e;}analyze(t){var i;const{materialType:e,accidentType:s,windSpeed:o,windDirection:n}=t;this.options=Object.assign(Object.assign({},this.options),t);const a=null===(i=this.operator)||void 0===i?void 0:i.simulationManager;if(!a)return;this.currentSimulationRef&&this.disposeCurrentModel();const r=this.selectModel(e,s);if(!r)return;const l=r.type+"-accident-analysis";a.create(r.type,Object.assign(Object.assign({},r.params),{windSpeed:o,windDirection:n,longitude:t.longitude,latitude:t.latitude,height:t.height}),{id:l,activate:true}),this.currentSimulationRef={type:r.type,id:l};}selectModel(t,i){var e;return (null===(e={"\u53ef\u71c3\u6c14\u4f53":{"\u6cc4\u6f0f":{type:"gasContinuousDiffusion",params:{leakRate:10,lethalRadius:100,idlhRadius:300,warningRadius:600}},"\u7206\u70b8":{type:"vaporCloudExplosion",params:{deathRadius:80,seriousRadius:160,minorRadius:320}},"\u706b\u707e":{type:"jetFire",params:{flameLength:30,lethalRadius:50,seriousRadius:100}}},"\u6709\u6bd2\u6c14\u4f53":{"\u6cc4\u6f0f":{type:"gasContinuousDiffusion",params:{leakRate:5,lethalRadius:150,idlhRadius:400,warningRadius:800}},"\u7206\u70b8":{type:"shockwave",params:{deathRadius:50,seriousRadius:100,minorRadius:200,glassRadius:500}},"\u706b\u707e":{type:"heatRadiation",params:{lethalRadius:80,seriousRadius:160,minorRadius:300}}},"\u53ef\u71c3\u6db2\u4f53":{"\u6cc4\u6f0f":{type:"jetDiffusion",params:{leakRate:15,lethalRadius:120,idlhRadius:350,warningRadius:700}},"\u7206\u70b8":{type:"vaporCloudExplosion",params:{deathRadius:100,seriousRadius:200,minorRadius:400}},"\u706b\u707e":{type:"poolFire",params:{poolRadius:30,lethalRadius:50,seriousRadius:100,safeRadius:200}}},"\u7206\u70b8\u7269":{"\u6cc4\u6f0f":{type:"adiabaticDiffusion",params:{lethalRadius:80,idlhRadius:250,warningRadius:500}},"\u7206\u70b8":{type:"shockwave",params:{deathRadius:100,seriousRadius:200,minorRadius:400,glassRadius:800}},"\u706b\u707e":{type:"solidFlame",params:{poolRadius:20,lethalRadius:60,seriousRadius:120,safeRadius:240}}}}[t])||void 0===e?void 0:e[i])||null}disposeCurrentModel(){var t,i;this.currentSimulationRef&&(null===(i=null===(t=this.operator)||void 0===t?void 0:t.simulationManager)||void 0===i||i.remove(this.currentSimulationRef.type,this.currentSimulationRef.id),this.currentSimulationRef=null);}clear(){this.disposeCurrentModel();}dispose(){this.clear(),this.viewer=null,this.operator=null;}}const $s={show:true,image:"",imageSize:[25,25],gravity:0,startColor:"#ffffff",startColorAlpha:.3,endColor:"#000000",endColorAlpha:.7,startScale:0,endScale:8,minimumParticleLife:1,maximumParticleLife:4,minimumSpeed:1,maximumSpeed:4,emitter:"CircleEmitter",emissionRate:5,emitterRadius:6,lifetime:60,loop:true,sizeInMeters:true,updateCallback:()=>{}};class Ys{constructor(t,i){this.viewer=null,this.entity=null,this.list=new Map,this.particleSystem=null,this.viewer=t,this.options=Object.assign({},$s,i),this.entity=null;}add(t){var i,s,o;this.options=null,this.entity=null,this.particleSystem=null,t.id||(t.id=Ss());const n=Object.assign({},$s,t),a=new Entity({position:Cartesian3.fromDegrees(n.longitude,n.latitude,n.height)});null===(i=this.viewer)||void 0===i||i.entities.add(a);const l=this.computeModelMatrix(a),d=this.computeEmitterModelMatrix(),c=new ParticleSystem({image:n.image,imageSize:n.imageSize instanceof Cartesian2?n.imageSize:new Cartesian2(n.imageSize[0],n.imageSize[1]),startColor:n.startColor instanceof Color?n.startColor:Color.fromCssColorString(n.startColor).withAlpha(n.startColorAlpha),endColor:n.endColor instanceof Color?n.endColor:Color.fromCssColorString(n.endColor).withAlpha(n.endColorAlpha),startScale:n.startScale,endScale:n.endScale,minimumParticleLife:n.minimumParticleLife,maximumParticleLife:n.maximumParticleLife,minimumSpeed:n.minimumSpeed,maximumSpeed:n.maximumSpeed,lifetime:n.lifetime,emitter:this.getEmitter(n),emissionRate:n.emissionRate,modelMatrix:l,emitterModelMatrix:d,loop:n.loop,sizeInMeters:n.sizeInMeters,show:n.show,updateCallback:n.updateCallback});null===(o=null===(s=this.viewer)||void 0===s?void 0:s.scene)||void 0===o||o.primitives.add(c),this.list.set(n.id,{particleSystem:c,entity:a,options:n}),this.entity=a,this.particleSystem=c,this.options=n,this.start();}getEmitter(t){const i=Object.assign({},$s,t);switch(i.emitter){case "ConeEmitter":return new ConeEmitter(Math$1.toRadians(i.emitterAngle||45));case "SphereEmitter":return new SphereEmitter(i.emitterRadius);case "BoxEmitter":return new BoxEmitter(new Cartesian3(i.emitterSize[0]||5,i.emitterSize[1]||5,i.emitterSize[2]||5));default:return new CircleEmitter(i.emitterRadius)}}setEmitterParams(t){this.particleSystem&&(void 0!==t.emitterRadius&&(this.particleSystem.emitter.radius=t.emitterRadius),void 0!==t.emitterAngle&&(this.particleSystem.emitter.angle=Math$1.toRadians(t.emitterAngle)));}computeModelMatrix(t){if(!t||!t.position)return;let i=t.position.getValue(JulianDate.now());return i?Transforms.eastNorthUpToFixedFrame(i):void 0}computeEmitterModelMatrix(){let t=HeadingPitchRoll.fromDegrees(0,0,0),i=new TranslationRotationScale;return i.translation=Cartesian3.fromElements(0,0,0),i.rotation=Quaternion.fromHeadingPitchRoll(t),Matrix4.fromTranslationRotationScale(i)}start(){var t;this.particleSystem&&this.viewer&&((null===(t=this.viewer.clock)||void 0===t?void 0:t.shouldAnimate)||(this.viewer.clock.shouldAnimate=true),this.particleSystem.show=true);}stop(){this.particleSystem&&(this.particleSystem.show=false);}update(t){if(this.particleSystem){if(void 0!==t.show&&(this.particleSystem.show=t.show),void 0!==t.startColor&&(this.particleSystem.startColor=Color.fromCssColorString(t.startColor).withAlpha(this.options.startColorAlpha)),void 0!==t.startColorAlpha&&(this.particleSystem.startColor.alpha=t.startColorAlpha),void 0!==t.endColor&&(this.particleSystem.endColor=Color.fromCssColorString(t.endColor).withAlpha(this.options.endColorAlpha)),void 0!==t.endColorAlpha&&(this.particleSystem.endColor.alpha=t.endColorAlpha),void 0!==t.startScale&&(this.particleSystem.startScale=t.startScale),void 0!==t.endScale&&(this.particleSystem.endScale=t.endScale),void 0!==t.minimumParticleLife&&(this.particleSystem.minimumParticleLife=t.minimumParticleLife),void 0!==t.maximumParticleLife&&(this.particleSystem.maximumParticleLife=t.maximumParticleLife),void 0!==t.minimumSpeed&&(this.particleSystem.minimumSpeed=t.minimumSpeed),void 0!==t.maximumSpeed&&(this.particleSystem.maximumSpeed=t.maximumSpeed),void 0!==t.emissionRate&&(this.particleSystem.emissionRate=t.emissionRate),void 0!==t.lifetime&&(this.particleSystem.lifetime=t.lifetime),void 0!==t.emitter&&(this.particleSystem.emitter=this.getEmitter(t)),void 0!==t.emitterRadius&&this.setEmitterParams(t),void 0!==t.bursts&&(this.particleSystem.bursts=t.bursts),void 0!==t.loop&&(this.particleSystem.loop=t.loop),void 0!==t.image&&(this.particleSystem.image=t.image),void 0!==t.imageSize){const i=t.imageSize instanceof Cartesian2?t.imageSize:new Cartesian2(t.imageSize[0],t.imageSize[1]);this.particleSystem.minimumImageSize=i,this.particleSystem.maximumImageSize=i;} void 0!==t.minimumImageSize&&(this.particleSystem.minimumImageSize=t.minimumImageSize instanceof Cartesian2?t.minimumImageSize:new Cartesian2(t.minimumImageSize[0],t.minimumImageSize[1])),void 0!==t.maximumImageSize&&(this.particleSystem.maximumImageSize=t.maximumImageSize instanceof Cartesian2?t.maximumImageSize:new Cartesian2(t.maximumImageSize[0],t.maximumImageSize[1])),void 0!==t.updateCallback&&(this.particleSystem.updateCallback=t.updateCallback),this.options=Object.assign({},this.options,t);}}clear(){var t,i,e;if(this.list.size){const s=Array.from(this.list.keys());for(let o=s.length-1;o>=0;o--){const n=s[o],a=this.list.get(n);a&&a.particleSystem&&a.entity&&(a.particleSystem.show=false,null===(i=null===(t=this.viewer)||void 0===t?void 0:t.scene)||void 0===i||i.primitives.remove(a.particleSystem),null===(e=this.viewer)||void 0===e||e.entities.remove(a.entity),this.list.delete(n));}this.list.clear();}}dispose(){this.options=null,this.entity=null,this.particleSystem=null,this.viewer=null,this.clear();}}const Ks={image:"/cesium-assets/SampleData/smoke.png",imageSize:[25,25]},Xs=new Cartesian3;class Js extends Ys{constructor(t,i){super(t,i);}add(t){const i=Object.assign({},Ks,t);i.updateCallback||(i.updateCallback=Js.applyGravity),super.add(i);}static applyGravity(t,i){Cartesian3.normalize(t.position,Xs),Cartesian3.fromElements(20*i,30*i,Xs.y*i,Xs),t.velocity=Cartesian3.add(t.velocity,Xs,t.velocity);}}const Qs={image:"/cesium-assets/SampleData/fire.png",imageSize:[25,25],startColor:"#ffff00",startColorAlpha:.95,endColor:"#ff0000",endColorAlpha:.05,startScale:0,endScale:10,minimumParticleLife:1,maximumParticleLife:6,minimumSpeed:1,maximumSpeed:4,emissionRate:4,lifetime:30,emitter:"ConeEmitter",emitterRadius:5,loop:true,sizeInMeters:true,showSmoke:true};class to extends Ys{constructor(t,i){super(t,i),this.smokeSimulation=null,this.list=new Map,this._updateCallback=null;}add(t){const i=Object.assign({},Qs,t);if(super.add(i),i.updateCallback&&(this._updateCallback=i.updateCallback),i.showSmoke&&(this.smokeSimulation=this.createSmokeSimulation({longitude:i.longitude,latitude:i.latitude,height:i.height,startScale:i.startScale,endScale:i.endScale,show:i.showSmoke,updateCallback:i.updateCallback})),this.list.has(i.id)){const t=this.list.get(i.id);t&&(t.smokeSimulation=this.smokeSimulation);}}createSmokeSimulation(t){const i=new Js(this.viewer,t);return i.add(t),i}setEmitterParams(t){super.setEmitterParams(t),this.smokeSimulation&&this.smokeSimulation.setEmitterParams(t);}update(t){if(this.particleSystem){if(super.update(t),void 0!==t.updateCallback&&this.smokeSimulation&&(this._updateCallback=t.updateCallback,this.smokeSimulation.update({updateCallback:t.updateCallback})),this.smokeSimulation){const i={};void 0!==t.endScale&&(i.endScale=1.5*t.endScale),void 0!==t.minimumSpeed&&(i.minimumSpeed=.3*t.minimumSpeed),void 0!==t.maximumSpeed&&(i.maximumSpeed=.5*t.maximumSpeed),void 0!==t.emissionRate&&(i.emissionRate=.6*t.emissionRate),void 0!==t.minimumParticleLife&&(i.minimumParticleLife=1.2*t.minimumParticleLife),void 0!==t.maximumParticleLife&&(i.maximumParticleLife=1.5*t.maximumParticleLife),Object.keys(i).length>0&&this.smokeSimulation.update(i);} void 0!==t.showSmoke&&this.showSmoke(t.showSmoke),this.options=Object.assign({},this.options,t);}}showSmoke(t){this.smokeSimulation&&this.smokeSimulation.update({show:t});}clear(){super.clear(),this.smokeSimulation&&this.smokeSimulation.clear();}dispose(){super.dispose();}}const io=107.56085388978732,eo=29.581785101550125,so=.3647529238310357;function oo(t){return t.toFixed(2)}function no(t,i,e){const s=t.latitude*Math.PI/180,o=i*Math.PI/180,n=e*Math.cos(o)/110540;return {longitude:t.longitude+e*Math.sin(o)/(111320*Math.cos(s)),latitude:t.latitude+n,height:t.height}}class ao{constructor(t,i,e={}){var s,o,n;this.zones=new Map,this.labelEntities=[],this.zoneDefinitions=[],this.waterwaveEntity=null,this.isActive=false,this.labelMode="aligned",this.showLabels=true,this.viewer=t,this.operator=i,this.center={longitude:null!==(s=e.longitude)&&void 0!==s?s:io,latitude:null!==(o=e.latitude)&&void 0!==o?o:eo,height:null!==(n=e.height)&&void 0!==n?n:so},this.options=e;}addZones(t,i){return Mt(this,void 0,void 0,(function*(){var e;this.center=t,this.zoneDefinitions=i;for(const s of i){const i=s.id||Ss();s.id=i;const o=yield this.operator.drawEntity({id:i,type:"circlegradient",lonlats:[[t.longitude,t.latitude,t.height]],radius:s.radius,color:s.color,opacity:s.opacity,gradient:null!==(e=s.gradient)&&void 0!==e?e:.75,isInward:false,outline:false,clampToGround:true});o&&o.length>0&&this.zones.set(i,o[0]);}this.showLabels&&this.addZoneLabels(t,i),this.isActive=true;}))}getBearing(t){return "aligned"===this.labelMode?180:135+20*t}getLabelPixelOffset(t,i){return 5>i?new Cartesian2(12,-18-18*t):20>i?new Cartesian2(10,-12-12*t):50>i?new Cartesian2(8,-8-8*t):new Cartesian2(5,-5)}addZoneLabels(t,i){this.clearLabels(),i.forEach(((i,e)=>{if(0>=i.radius)return void this.labelEntities.push(null);const s=this.getBearing(e),o=no(t,s,i.radius),n=this.viewer.entities.add({polyline:{positions:new CallbackProperty((()=>Cartesian3.fromDegreesArrayHeights([t.longitude,t.latitude,t.height+.5,o.longitude,o.latitude,o.height+.5])),false),width:2,material:new PolylineGlowMaterialProperty({glowPower:.1,color:Color.fromCssColorString(i.color).withAlpha(.9)}),clampToGround:true},position:Cartesian3.fromDegrees(o.longitude,o.latitude,o.height),label:{text:`${i.label}: ${oo(i.radius)}m`,font:"14px Microsoft YaHei",fillColor:Color.WHITE,outlineColor:Color.BLACK,outlineWidth:3,style:LabelStyle.FILL_AND_OUTLINE,verticalOrigin:VerticalOrigin.BOTTOM,horizontalOrigin:HorizontalOrigin.LEFT,pixelOffset:this.getLabelPixelOffset(e,i.radius),disableDepthTestDistance:1/0,showBackground:true,backgroundColor:Color.BLACK.withAlpha(.5),backgroundPadding:new Cartesian2(6,4),heightReference:HeightReference.RELATIVE_TO_GROUND}});this.labelEntities.push(n);}));}updateZoneLabel(t,i){var e,s;if(0>t||t>=this.labelEntities.length)return;if(t>=this.zoneDefinitions.length)return;if(this.zoneDefinitions[t].radius=i,0>=i){const i=this.labelEntities[t];return void(i&&(null===(s=null===(e=this.viewer)||void 0===e?void 0:e.entities)||void 0===s||s.remove(i),this.labelEntities[t]=null))}if(!this.labelEntities[t])return void(this.showLabels&&this.isActive&&this.addZoneLabels(this.center,this.zoneDefinitions));const o=this.getBearing(t),n=no(this.center,o,i),a=this.labelEntities[t];if(a&&(a.position=Cartesian3.fromDegrees(n.longitude,n.latitude,n.height),a.polyline&&(a.polyline.positions=new CallbackProperty((()=>Cartesian3.fromDegreesArrayHeights([this.center.longitude,this.center.latitude,this.center.height+.5,n.longitude,n.latitude,n.height+.5])),false)),a.label)){a.label.text=`${this.zoneDefinitions[t].label}: ${oo(i)}m`,a.label.pixelOffset=this.getLabelPixelOffset(t,i);}}updateZoneCenter(t){var i;this.center.longitude=t.longitude,this.center.latitude=t.latitude,this.center.height=t.height;const e=[t.longitude,t.latitude,t.height];this.zones.forEach((t=>{var i;null===(i=null==t?void 0:t.update)||void 0===i||i.call(t,{lonlat:e});})),(null===(i=this.waterwaveEntity)||void 0===i?void 0:i.update)&&this.waterwaveEntity.update({lonlat:e}),this.showLabels&&this.zoneDefinitions.length>0&&this.addZoneLabels(this.center,this.zoneDefinitions);}setLabelMode(t){this.labelMode=t,this.showLabels&&this.isActive&&this.zoneDefinitions.length>0&&this.addZoneLabels(this.center,this.zoneDefinitions);}setShowLabels(t){this.showLabels=t,t&&this.isActive&&this.zoneDefinitions.length>0&&0===this.labelEntities.length?this.addZoneLabels(this.center,this.zoneDefinitions):t||this.clearLabels();}updateZoneColor(t,i){const e=Array.from(this.zones.keys());t>=0&&e.length>t&&(this.updateZone(e[t],{color:i}),this.zoneDefinitions.length>t&&(this.zoneDefinitions[t].color=i));}static interpolateKeyframes(t,i){var e,s;if(0===t.length)return {};if(t[0].time>=i)return Object.assign({},t[0].params);if(i>=t[t.length-1].time)return Object.assign({},t[t.length-1].params);for(let o=0;t.length-1>o;o++)if(i>=t[o].time&&t[o+1].time>=i){const n=(i-t[o].time)/(t[o+1].time-t[o].time),a={},r=new Set([...Object.keys(t[o].params),...Object.keys(t[o+1].params)]);for(const i of r){const r=null!==(e=t[o].params[i])&&void 0!==e?e:t[o+1].params[i],l=null!==(s=t[o+1].params[i])&&void 0!==s?s:r;void 0!==r&&(a[i]=r+(l-r)*n);}return a}return Object.assign({},t[t.length-1].params)}applyTimeState(t){}updateZone(t,i){const e=this.zones.get(t);e&&e.update(i);}updateAllZoneRadii(t){for(const i of t)this.updateZone(i.id,{radius:i.radius});}addWaterwave(t){return Mt(this,arguments,void 0,(function*(t,i={}){var e,s,o,n,a,r;const l=i.id||Ss(),h=yield this.operator.drawEntity({id:l,type:"waterwave",lonlats:[[t.longitude,t.latitude,t.height]],maxRadius:null!==(e=i.maxRadius)&&void 0!==e?e:500,duration:null!==(s=i.duration)&&void 0!==s?s:3e3,count:null!==(o=i.count)&&void 0!==o?o:1,gradient:null!==(n=i.gradient)&&void 0!==n?n:.3,color:null!==(a=i.color)&&void 0!==a?a:"#ff4400",opacity:null!==(r=i.opacity)&&void 0!==r?r:.8});return h&&h.length>0&&(this.waterwaveEntity=h[0]),this.waterwaveEntity}))}updateWaterwave(t){this.waterwaveEntity&&this.waterwaveEntity.update(t);}clearLabels(){var t,i;for(const e of this.labelEntities)e&&(null===(i=null===(t=this.viewer)||void 0===t?void 0:t.entities)||void 0===i||i.remove(e));this.labelEntities=[];}clear(){var t;if(this.zones.forEach(((t,i)=>{t&&(t.update({remove:true}),this.operator.removeDraw(i));})),this.zones.clear(),this.clearLabels(),this.zoneDefinitions=[],this.waterwaveEntity){const i=null===(t=this.waterwaveEntity.options)||void 0===t?void 0:t.id;this.waterwaveEntity.update({remove:true}),i&&this.operator.removeDraw(i),this.waterwaveEntity=null;}this.isActive=false;}setVisible(t){this.zones.forEach((i=>{i&&i.update({show:t});}));for(const i of this.labelEntities)i&&(i.show=t);this.waterwaveEntity&&this.waterwaveEntity.update({show:t});}dispose(){this.clear(),this.viewer=null,this.operator=null,this.options=null;}}const ro={lethalRadius:100,seriousRadius:200,minorRadius:400};class lo extends ao{constructor(t,i,e={}){super(t,i,Object.assign(Object.assign({},ro),e)),this.zoneIds={lethal:"",serious:"",minor:""};}add(){return Mt(this,arguments,void 0,(function*(t={}){var i,e,s;this.clear();const o=Object.assign(Object.assign(Object.assign({},ro),this.options),t);this.options=o;const n={longitude:null!==(i=o.longitude)&&void 0!==i?i:this.center.longitude,latitude:null!==(e=o.latitude)&&void 0!==e?e:this.center.latitude,height:null!==(s=o.height)&&void 0!==s?s:this.center.height},a=[{label:"\u8f7b\u4f24\u533a",radius:o.minorRadius,color:"#ffcc00",opacity:.3,gradient:.75},{label:"\u91cd\u4f24\u533a",radius:o.seriousRadius,color:"#ff6600",opacity:.4,gradient:.75},{label:"\u81f4\u6b7b\u533a",radius:o.lethalRadius,color:"#ff0000",opacity:.5,gradient:.75}];yield this.addZones(n,a);const r=Array.from(this.zones.keys());this.zoneIds.minor=r[0]||"",this.zoneIds.serious=r[1]||"",this.zoneIds.lethal=r[2]||"";}))}update(t){ void 0!==t.lethalRadius&&(this.updateZone(this.zoneIds.lethal,{radius:t.lethalRadius}),this.updateZoneLabel(2,t.lethalRadius)),void 0!==t.seriousRadius&&(this.updateZone(this.zoneIds.serious,{radius:t.seriousRadius}),this.updateZoneLabel(1,t.seriousRadius)),void 0!==t.minorRadius&&(this.updateZone(this.zoneIds.minor,{radius:t.minorRadius}),this.updateZoneLabel(0,t.minorRadius)),void 0!==t.lethalColor&&this.updateZoneColor(2,t.lethalColor),void 0!==t.seriousColor&&this.updateZoneColor(1,t.seriousColor),void 0!==t.minorColor&&this.updateZoneColor(0,t.minorColor),void 0!==t.show&&this.setVisible(t.show),this.options=Object.assign(Object.assign({},this.options),t);}applyTimeState(t){this.update(t);}}function ho(t){return t*Math.PI/180}function co(t,i,e,s=1){return {x:Math.sin(i)*t*e*s,y:Math.cos(i)*t*e*s}}const uo={jetDirection:0,windSpeed:3,windDirection:0,flameLength:30,emissionRate:8,flameWidth:8,particleLife:4,lethalRadius:50,seriousRadius:100,showFlame:true,showRadiationZone:true};class po extends ao{constructor(t,i,e={}){super(t,i,Object.assign(Object.assign({},uo),e)),this.zoneIds={lethal:"",serious:""},this.particleSystem=null,this.windParams={speed:uo.windSpeed,directionRad:ho(uo.windDirection)};}updateJetDirection(t){var i;if(!(null===(i=this.particleSystem)||void 0===i?void 0:i.particleSystem))return;const e=HeadingPitchRoll.fromDegrees(t,0,0),s=new TranslationRotationScale;s.translation=Cartesian3.fromElements(0,0,0),s.rotation=Quaternion.fromHeadingPitchRoll(e),this.particleSystem.particleSystem.emitterModelMatrix=Matrix4.fromTranslationRotationScale(s);}getFlameParticleOptions(t){const i=t.flameLength/30;return {startScale:.125*t.flameWidth,endScale:t.flameWidth,minimumParticleLife:.25*t.particleLife,maximumParticleLife:t.particleLife,minimumSpeed:5*i,maximumSpeed:15*i}}createFlameUpdateCallback(){const t=this.windParams,i=new Cartesian3;return (e,s)=>{const o=co(t.speed,t.directionRad,s,6);Cartesian3.fromElements(o.x,o.y,0,i),e.position=Cartesian3.add(e.position,i,e.position);}}add(){return Mt(this,arguments,void 0,(function*(t={}){var i,e,s;this.clear();const o=Object.assign(Object.assign(Object.assign({},uo),this.options),t);this.options=o,this.windParams.speed=o.windSpeed,this.windParams.directionRad=ho(o.windDirection);const n={longitude:null!==(i=o.longitude)&&void 0!==i?i:this.center.longitude,latitude:null!==(e=o.latitude)&&void 0!==e?e:this.center.latitude,height:null!==(s=o.height)&&void 0!==s?s:this.center.height};if(o.showRadiationZone){const t=[{label:"\u91cd\u4f24\u533a",radius:o.seriousRadius,color:"#ff6600",opacity:.3,gradient:.75},{label:"\u81f4\u6b7b\u533a",radius:o.lethalRadius,color:"#ff0000",opacity:.45,gradient:.75}];yield this.addZones(n,t);const i=Array.from(this.zones.keys());this.zoneIds.serious=i[0]||"",this.zoneIds.lethal=i[1]||"";}if(o.showFlame){const t=this.getFlameParticleOptions(o);this.particleSystem=new Ys(this.viewer,{}),this.particleSystem.add(Object.assign(Object.assign({id:Ss(),longitude:n.longitude,latitude:n.latitude,height:n.height,image:"/cesium-assets/SampleData/fire.png",imageSize:[25,25],startColor:"#ffff00",startColorAlpha:.9,endColor:"#ff0000",endColorAlpha:.1},t),{emitter:"ConeEmitter",emitterRadius:3,emitterAngle:30,emissionRate:o.emissionRate,lifetime:60,loop:true,sizeInMeters:true,showSmoke:false,updateCallback:this.createFlameUpdateCallback()})),this.updateJetDirection(o.jetDirection);}}))}update(t){const i=Object.assign(Object.assign({},this.options),t);if(void 0===t.windSpeed&&void 0===t.windDirection||(this.windParams.speed=i.windSpeed,this.windParams.directionRad=ho(i.windDirection)),void 0!==t.lethalRadius&&(this.updateZone(this.zoneIds.lethal,{radius:t.lethalRadius}),this.updateZoneLabel(1,t.lethalRadius)),void 0!==t.seriousRadius&&(this.updateZone(this.zoneIds.serious,{radius:t.seriousRadius}),this.updateZoneLabel(0,t.seriousRadius)),void 0!==t.showFlame&&this.particleSystem&&this.particleSystem.update({show:t.showFlame}),void 0!==t.showRadiationZone&&this.zones.forEach((i=>{null==i||i.update({show:t.showRadiationZone});})),void 0!==t.show&&(this.setVisible(t.show),this.particleSystem&&this.particleSystem.update({show:t.show})),void 0!==t.lethalColor&&this.updateZoneColor(1,t.lethalColor),void 0!==t.seriousColor&&this.updateZoneColor(0,t.seriousColor),void 0!==t.jetDirection&&this.updateJetDirection(t.jetDirection),void 0!==t.emissionRate&&this.particleSystem&&this.particleSystem.update({emissionRate:t.emissionRate}),void 0!==t.flameLength&&this.particleSystem){const i=t.flameLength/30;this.particleSystem.update({minimumSpeed:5*i,maximumSpeed:15*i});} void 0!==t.flameWidth&&this.particleSystem&&this.particleSystem.update({startScale:.125*t.flameWidth,endScale:t.flameWidth}),void 0!==t.particleLife&&this.particleSystem&&this.particleSystem.update({minimumParticleLife:.25*t.particleLife,maximumParticleLife:t.particleLife}),this.options=i;}applyTimeState(t){this.update(t);}clear(){super.clear(),this.particleSystem&&(this.particleSystem.clear(),this.particleSystem=null);}dispose(){this.particleSystem&&(this.particleSystem.dispose(),this.particleSystem=null),super.dispose();}}const mo={"\u539f\u6cb9":1,"\u6c7d\u6cb9":1.2,"\u67f4\u6cb9":.9,LNG:1.3,"\u6db2\u5316\u6c14":1.15,"\u82ef":1.1,"\u7532\u9187":.85},go={poolRadius:20,flameHeight:10,lethalRadius:30,seriousRadius:60,safeRadius:120,showFlame:true,showRadiationZone:true,emissionRate:5,flameScale:16,particleLife:4,windSpeed:3,windDirection:0,materialType:"\u539f\u6cb9",dikeRadius:50};class fo extends ao{constructor(t,i,e={}){super(t,i,Object.assign(Object.assign({},go),e)),this.zoneIds={lethal:"",serious:"",safe:""},this.fireSimulation=null,this.windParams={speed:go.windSpeed,directionRad:ho(go.windDirection)};}getHeatFactor(t){return mo[t]||1}createFlameUpdateCallback(){const t=this.windParams,i=new Cartesian3;return (e,s)=>{const o=co(t.speed,t.directionRad,s,4);Cartesian3.fromElements(o.x,o.y,0,i),e.position=Cartesian3.add(e.position,i,e.position);}}add(){return Mt(this,arguments,void 0,(function*(t={}){var i,e,s;this.clear();const o=Object.assign(Object.assign(Object.assign({},go),this.options),t);this.options=o,this.windParams.speed=o.windSpeed,this.windParams.directionRad=ho(o.windDirection);const n={longitude:null!==(i=o.longitude)&&void 0!==i?i:this.center.longitude,latitude:null!==(e=o.latitude)&&void 0!==e?e:this.center.latitude,height:null!==(s=o.height)&&void 0!==s?s:this.center.height},a=this.getHeatFactor(o.materialType);if(o.showRadiationZone){const t=[{label:"\u5b89\u5168\u533a",radius:o.safeRadius*a,color:"#00cc00",opacity:.2,gradient:.75},{label:"\u91cd\u4f24\u533a",radius:o.seriousRadius*a,color:"#ff6600",opacity:.35,gradient:.75},{label:"\u81f4\u6b7b\u533a",radius:o.lethalRadius*a,color:"#ff0000",opacity:.45,gradient:.75},{label:"\u56f4\u5830\u8fb9\u754c",radius:o.dikeRadius,color:"#ffffff",opacity:.15,gradient:.5}];yield this.addZones(n,t);const i=Array.from(this.zones.keys());this.zoneIds.safe=i[0]||"",this.zoneIds.serious=i[1]||"",this.zoneIds.lethal=i[2]||"";}if(o.showFlame){const t=function(t){var i,e,s,o;const n=null!==(i=t.flameHeight)&&void 0!==i?i:go.flameHeight,a=null!==(e=t.particleLife)&&void 0!==e?e:go.particleLife,r=n/10;return {emissionRate:null!==(s=t.emissionRate)&&void 0!==s?s:go.emissionRate,startScale:0,endScale:null!==(o=t.flameScale)&&void 0!==o?o:go.flameScale,minimumSpeed:1*r,maximumSpeed:3*r,minimumParticleLife:.25*a,maximumParticleLife:a}}(o);this.fireSimulation=new to(this.viewer,{}),this.fireSimulation.add(Object.assign(Object.assign({longitude:n.longitude,latitude:n.latitude,height:n.height,emitter:"CircleEmitter",emitterRadius:o.poolRadius},t),{showSmoke:true,updateCallback:this.createFlameUpdateCallback()}));}}))}update(t){const i=Object.assign(Object.assign({},this.options),t);if(void 0===t.windSpeed&&void 0===t.windDirection||(this.windParams.speed=i.windSpeed,this.windParams.directionRad=ho(i.windDirection)),void 0!==t.poolRadius&&this.fireSimulation&&this.fireSimulation.setEmitterParams({emitterRadius:t.poolRadius}),void 0!==t.materialType){const e=this.getHeatFactor(t.materialType),s=i.seriousRadius,o=i.safeRadius;this.updateZone(this.zoneIds.lethal,{radius:i.lethalRadius*e}),this.updateZone(this.zoneIds.serious,{radius:s*e}),this.updateZone(this.zoneIds.safe,{radius:o*e});}if(void 0!==t.lethalRadius){const e=this.getHeatFactor(i.materialType);this.updateZone(this.zoneIds.lethal,{radius:t.lethalRadius*e}),this.updateZoneLabel(2,t.lethalRadius);}if(void 0!==t.seriousRadius){const e=this.getHeatFactor(i.materialType);this.updateZone(this.zoneIds.serious,{radius:t.seriousRadius*e}),this.updateZoneLabel(1,t.seriousRadius);}if(void 0!==t.safeRadius){const e=this.getHeatFactor(i.materialType);this.updateZone(this.zoneIds.safe,{radius:t.safeRadius*e}),this.updateZoneLabel(0,t.safeRadius);}if(void 0!==t.dikeRadius){const i=Array.from(this.zones.keys());i[3]&&this.updateZone(i[3],{radius:t.dikeRadius});}if(void 0!==t.showFlame&&this.fireSimulation&&this.fireSimulation.update({show:t.showFlame}),void 0!==t.showRadiationZone&&this.zones.forEach((i=>{null==i||i.update({show:t.showRadiationZone});})),void 0!==t.show&&(this.setVisible(t.show),this.fireSimulation&&this.fireSimulation.update({show:t.show})),void 0!==t.lethalColor&&this.updateZoneColor(2,t.lethalColor),void 0!==t.seriousColor&&this.updateZoneColor(1,t.seriousColor),void 0!==t.safeColor&&this.updateZoneColor(0,t.safeColor),void 0!==t.emissionRate&&this.fireSimulation&&this.fireSimulation.update({emissionRate:t.emissionRate}),void 0!==t.flameHeight&&this.fireSimulation){const i=t.flameHeight/10;this.fireSimulation.update({minimumSpeed:1*i,maximumSpeed:3*i});} void 0!==t.flameScale&&this.fireSimulation&&this.fireSimulation.update({endScale:t.flameScale}),void 0!==t.particleLife&&this.fireSimulation&&this.fireSimulation.update({minimumParticleLife:.25*t.particleLife,maximumParticleLife:t.particleLife}),this.options=i;}applyTimeState(t){this.update(t);}clear(){super.clear(),this.fireSimulation&&(this.fireSimulation.clear(),this.fireSimulation=null);}dispose(){this.fireSimulation&&(this.fireSimulation.dispose(),this.fireSimulation=null),super.dispose();}}const vo={fire:{image:"/cesium-assets/SampleData/fire.png",startColor:"#ff6600",endColor:"#333333",startColorAlpha:.9,endColorAlpha:.1,startScale:1,endScale:.5,minimumSpeed:20,maximumSpeed:60,minimumParticleLife:2,maximumParticleLife:5},debris:{image:"/cesium-assets/SampleData/circular_particle.png",startColor:"#8B4513",endColor:"#555555",startColorAlpha:1,endColorAlpha:.3,startScale:.8,endScale:.3,minimumSpeed:15,maximumSpeed:50,minimumParticleLife:3,maximumParticleLife:6},spark:{image:"/cesium-assets/SampleData/fire.png",startColor:"#ffff00",endColor:"#ff4400",startColorAlpha:1,endColorAlpha:0,startScale:.5,endScale:.1,minimumSpeed:30,maximumSpeed:80,minimumParticleLife:1,maximumParticleLife:3},smoke:{image:"/cesium-assets/SampleData/smoke.png",startColor:"#666666",endColor:"#111111",startColorAlpha:.6,endColorAlpha:.05,startScale:1,endScale:3,minimumSpeed:5,maximumSpeed:20,minimumParticleLife:4,maximumParticleLife:8}},yo={particleCount:20,maxDistance:300,particleSize:5,showDangerZone:true,projectileType:"fire",dangerZoneColor:"#ff3300",modelUri:"/cesium-assets/models/Cesium_Air.glb",modelScale:1};class wo{constructor(t,i,e={}){this.particleSystem=null,this.zoneSim=null,this.modelEntities=[],this.modelAnimTimer=null,this.modelRafId=null,this.modelStates=[],this.isActive=false,this.viewer=t,this.operator=i,this.options=Object.assign(Object.assign({},yo),e);}add(){return Mt(this,arguments,void 0,(function*(t={}){var i,e,s;this.clear();const o=Object.assign(Object.assign(Object.assign({},yo),this.options),t);this.options=o;const n={longitude:null!==(i=o.longitude)&&void 0!==i?i:107.56085388978732,latitude:null!==(e=o.latitude)&&void 0!==e?e:29.581785101550125,height:null!==(s=o.height)&&void 0!==s?s:.3647529238310357};"model"===o.projectileType?this.addModelProjectiles(n,o):this.addParticleProjectiles(n,o),o.showDangerZone&&(this.zoneSim=new ao(this.viewer,this.operator,o),yield this.zoneSim.addZones(n,[{label:"\u5371\u9669\u533a",radius:o.maxDistance,color:o.dangerZoneColor,opacity:.25,gradient:.75}])),this.isActive=true;}))}addParticleProjectiles(t,i){var e;const s=null!==(e=vo[i.projectileType])&&void 0!==e?e:vo.fire;this.particleSystem=new Ys(this.viewer,{}),this.particleSystem.add({id:Ss(),longitude:t.longitude,latitude:t.latitude,height:t.height,image:s.image,imageSize:[i.particleSize,i.particleSize],startColor:s.startColor,startColorAlpha:s.startColorAlpha,endColor:s.endColor,endColorAlpha:s.endColorAlpha,startScale:s.startScale,endScale:s.endScale,minimumParticleLife:s.minimumParticleLife,maximumParticleLife:s.maximumParticleLife,minimumSpeed:s.minimumSpeed,maximumSpeed:s.maximumSpeed,emitter:"SphereEmitter",emitterRadius:2,emissionRate:i.particleCount,lifetime:30,loop:true,sizeInMeters:true,updateCallback:(t,i)=>{const e=new Cartesian3(0,0,-9.8*i);t.velocity=Cartesian3.add(t.velocity,e,t.velocity);}});}addModelProjectiles(t,i){this.clearModelEntities();const e=Math.min(i.particleCount,30),o=Cartographic.fromDegrees(t.longitude,t.latitude,t.height),n=111320*Math.cos(o.latitude);this.modelStates=[];const a=performance.now()/1e3;for(let s=0;e>s;s++)this.createModelEntity(t,i,a,5,n,s);const l=()=>{const i=performance.now()/1e3;for(let e=0;this.modelStates.length>e;e++){const s=this.modelStates[e];let o=i-s.startTime;o>s.duration&&(this.resetModelState(s,i,t,n),o=0);s.currentPos=Cartesian3.fromDegrees(s.centerLon+s.vE*o/s.metersPerDegreeLon,s.centerLat+s.vN*o/110540,Math.max(s.centerHeight+(s.vU*o-4.9*o*o),0));}this.modelRafId=requestAnimationFrame(l);};this.modelRafId=requestAnimationFrame(l);}resetModelState(t,i,e,s){const o=2*Math.random()*Math.PI,n=Math.random()*Math.PI/3+Math.PI/12,a=20+40*Math.random();t.startTime=i,t.vE=a*Math.cos(n)*Math.cos(o),t.vN=a*Math.cos(n)*Math.sin(o),t.vU=a*Math.sin(n),t.centerLon=e.longitude,t.centerLat=e.latitude,t.centerHeight=e.height,t.metersPerDegreeLon=s;}createModelEntity(t,i,e,s,o,n){var a,l;if(!this.viewer)return;const h=2*Math.random()*Math.PI,d=Math.random()*Math.PI/3+Math.PI/12,c=20+40*Math.random(),u=c*Math.cos(d)*Math.cos(h),p=c*Math.cos(d)*Math.sin(h),m=c*Math.sin(d),g=Cartesian3.fromDegrees(t.longitude,t.latitude,t.height),f={startTime:e-Math.random()*s,duration:s,vE:u,vN:p,vU:m,centerLon:t.longitude,centerLat:t.latitude,centerHeight:t.height,metersPerDegreeLon:o,currentPos:g};this.modelStates.push(f);const v=this.viewer.entities.add({position:new CallbackProperty((()=>f.currentPos),false),model:{uri:null!==(a=i.modelUri)&&void 0!==a?a:yo.modelUri,scale:null!==(l=i.modelScale)&&void 0!==l?l:yo.modelScale,minimumPixelSize:16}});this.modelEntities.push(v);}update(t){var i,e,s;if(void 0!==t.particleCount&&this.particleSystem&&this.particleSystem.update({emissionRate:t.particleCount}),void 0!==t.particleSize&&this.particleSystem&&this.particleSystem.update({imageSize:new Cartesian2(t.particleSize,t.particleSize)}),void 0!==t.maxDistance&&this.zoneSim){const i=Array.from(this.zoneSim.zones.keys());i[0]&&this.zoneSim.updateZone(i[0],{radius:t.maxDistance}),this.zoneSim.updateZoneLabel(0,t.maxDistance);}if(void 0!==t.showDangerZone&&this.zoneSim&&this.zoneSim.setVisible(t.showDangerZone),void 0!==t.dangerZoneColor&&this.zoneSim&&this.zoneSim.updateZoneColor(0,t.dangerZoneColor),void 0!==t.projectileType&&t.projectileType!==this.options.projectileType){const o=Object.assign(Object.assign({},this.options),t);this.clearParticleSystem(),this.clearModelEntities();const n={longitude:null!==(i=o.longitude)&&void 0!==i?i:107.56085388978732,latitude:null!==(e=o.latitude)&&void 0!==e?e:29.581785101550125,height:null!==(s=o.height)&&void 0!==s?s:.3647529238310357};"model"===t.projectileType?this.addModelProjectiles(n,o):this.addParticleProjectiles(n,o);} void 0!==t.show&&(this.particleSystem&&this.particleSystem.update({show:t.show}),this.zoneSim&&this.zoneSim.setVisible(t.show)),this.options=Object.assign(Object.assign({},this.options),t);}applyTimeState(t){this.update(t);}clearParticleSystem(){this.particleSystem&&(this.particleSystem.clear(),this.particleSystem.dispose(),this.particleSystem=null);}clearModelEntities(){var t;null!==this.modelAnimTimer&&(clearInterval(this.modelAnimTimer),this.modelAnimTimer=null),null!==this.modelRafId&&(cancelAnimationFrame(this.modelRafId),this.modelRafId=null);for(const i of this.modelEntities)null===(t=this.viewer)||void 0===t||t.entities.remove(i);this.modelEntities=[],this.modelStates=[];}clear(){this.clearParticleSystem(),this.clearModelEntities(),this.zoneSim&&this.zoneSim.clear(),this.isActive=false;}dispose(){this.clear(),this.zoneSim&&(this.zoneSim.dispose(),this.zoneSim=null),this.viewer=null,this.operator=null;}}const Co={deathRadius:50,seriousRadius:100,minorRadius:200,glassRadius:500,showShockwave:true,waveDuration:3e3};class bo extends ao{constructor(t,i,e={}){super(t,i,Object.assign(Object.assign({},Co),e)),this.zoneIds={death:"",serious:"",minor:"",glass:""};}add(){return Mt(this,arguments,void 0,(function*(t={}){var i,e,s;this.clear();const o=Object.assign(Object.assign(Object.assign({},Co),this.options),t);this.options=o;const n={longitude:null!==(i=o.longitude)&&void 0!==i?i:this.center.longitude,latitude:null!==(e=o.latitude)&&void 0!==e?e:this.center.latitude,height:null!==(s=o.height)&&void 0!==s?s:this.center.height},a=[{label:"\u73bb\u7483\u7834\u788e\u533a",radius:o.glassRadius,color:"#00cc00",opacity:.2,gradient:.75},{label:"\u8f7b\u4f24\u533a",radius:o.minorRadius,color:"#ffcc00",opacity:.3,gradient:.75},{label:"\u91cd\u4f24\u533a",radius:o.seriousRadius,color:"#ff6600",opacity:.4,gradient:.75},{label:"\u6b7b\u4ea1\u533a",radius:o.deathRadius,color:"#ff0000",opacity:.5,gradient:.75}];yield this.addZones(n,a);const r=Array.from(this.zones.keys());this.zoneIds.glass=r[0]||"",this.zoneIds.minor=r[1]||"",this.zoneIds.serious=r[2]||"",this.zoneIds.death=r[3]||"",o.showShockwave&&(yield this.addWaterwave(n,{maxRadius:o.glassRadius,duration:o.waveDuration,count:1,gradient:.3,color:"#ff4400",opacity:.8}));}))}update(t){ void 0!==t.deathRadius&&(this.updateZone(this.zoneIds.death,{radius:t.deathRadius}),this.updateZoneLabel(3,t.deathRadius)),void 0!==t.seriousRadius&&(this.updateZone(this.zoneIds.serious,{radius:t.seriousRadius}),this.updateZoneLabel(2,t.seriousRadius)),void 0!==t.minorRadius&&(this.updateZone(this.zoneIds.minor,{radius:t.minorRadius}),this.updateZoneLabel(1,t.minorRadius)),void 0!==t.glassRadius&&(this.updateZone(this.zoneIds.glass,{radius:t.glassRadius}),this.updateWaterwave({maxRadius:t.glassRadius}),this.updateZoneLabel(0,t.glassRadius)),void 0!==t.showShockwave&&this.waterwaveEntity&&this.waterwaveEntity.update({show:t.showShockwave}),void 0!==t.waveDuration&&this.updateWaterwave({duration:t.waveDuration}),void 0!==t.deathColor&&this.updateZoneColor(3,t.deathColor),void 0!==t.seriousColor&&this.updateZoneColor(2,t.seriousColor),void 0!==t.minorColor&&this.updateZoneColor(1,t.minorColor),void 0!==t.glassColor&&this.updateZoneColor(0,t.glassColor),void 0!==t.show&&this.setVisible(t.show),this.options=Object.assign(Object.assign({},this.options),t);}applyTimeState(t){this.update(t);}}const So={LNG:1.3,"\u82ef":1.1,"\u6db2\u5316\u70c3":1.25,"\u4e19\u70ef":1.15,"\u4e59\u70ef":1.2,"\u4e01\u4e8c\u70ef":1.18},To={poolRadius:30,flameHeight:20,lethalRadius:50,seriousRadius:100,safeRadius:200,showFlame:true,showRadiationZone:true,emissionRate:6,flameScale:20,particleLife:5,windSpeed:3,windDirection:0,materialType:"LNG",flameAngle:0};class Lo extends ao{constructor(t,i,e={}){super(t,i,Object.assign(Object.assign({},To),e)),this.zoneIds={lethal:"",serious:"",safe:""},this.fireSimulation=null,this.windParams={speed:To.windSpeed,directionRad:ho(To.windDirection)},this._windUpdateCallback=null;}getHeatFactor(t){return So[t]||1}createFlameUpdateCallback(){const t=this.windParams,i=new Cartesian3;return (e,s)=>{const o=co(t.speed,t.directionRad,s,5);Cartesian3.fromElements(o.x,o.y,0,i),e.position=Cartesian3.add(e.position,i,e.position);}}getOrCreateWindUpdateCallback(){return this._windUpdateCallback||(this._windUpdateCallback=this.createFlameUpdateCallback()),this._windUpdateCallback}calculateFlameAngle(t){return Math.min(Math.atan(t/10)*(180/Math.PI),45)}add(){return Mt(this,arguments,void 0,(function*(t={}){var i,e,s;this.clear();const o=Object.assign(Object.assign(Object.assign({},To),this.options),t);this.options=o,this.windParams.speed=o.windSpeed,this.windParams.directionRad=ho(o.windDirection);const n={longitude:null!==(i=o.longitude)&&void 0!==i?i:this.center.longitude,latitude:null!==(e=o.latitude)&&void 0!==e?e:this.center.latitude,height:null!==(s=o.height)&&void 0!==s?s:this.center.height},a=this.getHeatFactor(o.materialType),r=o.lethalRadius*a,l=o.seriousRadius*a,h=o.safeRadius*a;if(o.flameAngle||this.calculateFlameAngle(o.windSpeed),o.showRadiationZone){const t=[{label:"\u5b89\u5168\u533a",radius:h,color:"#00cc00",opacity:.2,gradient:.75},{label:"\u91cd\u4f24\u533a",radius:l,color:"#ff6600",opacity:.35,gradient:.75},{label:"\u81f4\u6b7b\u533a",radius:r,color:"#ff0000",opacity:.45,gradient:.75}];yield this.addZones(n,t);const i=Array.from(this.zones.keys());this.zoneIds.safe=i[0]||"",this.zoneIds.serious=i[1]||"",this.zoneIds.lethal=i[2]||"";}if(o.showFlame){const t=function(t){var i,e,s,o;const n=null!==(i=t.flameHeight)&&void 0!==i?i:To.flameHeight,a=null!==(e=t.particleLife)&&void 0!==e?e:To.particleLife,r=n/20;return {emissionRate:null!==(s=t.emissionRate)&&void 0!==s?s:To.emissionRate,startScale:0,endScale:null!==(o=t.flameScale)&&void 0!==o?o:To.flameScale,minimumSpeed:3*r,maximumSpeed:8*r,minimumParticleLife:.33*a,maximumParticleLife:a}}(o);this.fireSimulation=new to(this.viewer,{}),this.fireSimulation.add(Object.assign(Object.assign({longitude:n.longitude,latitude:n.latitude,height:n.height,emitter:"CircleEmitter",emitterRadius:o.poolRadius},t),{showSmoke:true,updateCallback:this.getOrCreateWindUpdateCallback()}));}}))}update(t){var i;const e=Object.assign(Object.assign({},this.options),t);if(void 0===t.windSpeed&&void 0===t.windDirection||(this.windParams.speed=e.windSpeed,this.windParams.directionRad=ho(e.windDirection),(null===(i=this.fireSimulation)||void 0===i?void 0:i.smokeSimulation)&&this.fireSimulation.smokeSimulation.update({updateCallback:this.getOrCreateWindUpdateCallback()})),void 0!==t.poolRadius&&this.fireSimulation&&this.fireSimulation.setEmitterParams({emitterRadius:t.poolRadius}),void 0!==t.flameHeight&&this.fireSimulation){const i=t.flameHeight/20;this.fireSimulation.update({minimumSpeed:3*i,maximumSpeed:8*i});}if(void 0!==t.materialType){const i=this.getHeatFactor(t.materialType),s=e.seriousRadius,o=e.safeRadius;this.updateZone(this.zoneIds.lethal,{radius:e.lethalRadius*i}),this.updateZone(this.zoneIds.serious,{radius:s*i}),this.updateZone(this.zoneIds.safe,{radius:o*i});}if(void 0!==t.lethalRadius){const i=this.getHeatFactor(e.materialType);this.updateZone(this.zoneIds.lethal,{radius:t.lethalRadius*i}),this.updateZoneLabel(2,t.lethalRadius);}if(void 0!==t.seriousRadius){const i=this.getHeatFactor(e.materialType);this.updateZone(this.zoneIds.serious,{radius:t.seriousRadius*i}),this.updateZoneLabel(1,t.seriousRadius);}if(void 0!==t.safeRadius){const i=this.getHeatFactor(e.materialType);this.updateZone(this.zoneIds.safe,{radius:t.safeRadius*i}),this.updateZoneLabel(0,t.safeRadius);} void 0!==t.showFlame&&this.fireSimulation&&this.fireSimulation.update({show:t.showFlame}),void 0!==t.showRadiationZone&&this.zones.forEach((i=>{null==i||i.update({show:t.showRadiationZone});})),void 0!==t.show&&(this.setVisible(t.show),this.fireSimulation&&this.fireSimulation.update({show:t.show})),void 0!==t.lethalColor&&this.updateZoneColor(2,t.lethalColor),void 0!==t.seriousColor&&this.updateZoneColor(1,t.seriousColor),void 0!==t.safeColor&&this.updateZoneColor(0,t.safeColor),void 0!==t.emissionRate&&this.fireSimulation&&this.fireSimulation.update({emissionRate:t.emissionRate}),void 0!==t.flameScale&&this.fireSimulation&&this.fireSimulation.update({endScale:t.flameScale}),void 0!==t.particleLife&&this.fireSimulation&&this.fireSimulation.update({minimumParticleLife:.33*t.particleLife,maximumParticleLife:t.particleLife}),this.options=e;}applyTimeState(t){this.update(t);}clear(){super.clear(),this.fireSimulation&&(this.fireSimulation.clear(),this.fireSimulation=null),this._windUpdateCallback=null;}dispose(){this.fireSimulation&&(this.fireSimulation.dispose(),this.fireSimulation=null),super.dispose();}}const Eo=101325,Do=[3e5,14e4,5e4,2e4],Mo=[.2,.3,.5,.75,1,1.5,2,3,4,6,8,10,15,20,30,40,60,80,100],Ro=[12,8,4.2,2.5,1.7,.95,.68,.42,.3,.18,.13,.1,.064,.045,.026,.018,.01,.007,.005],xo=[.18,.26,.36,.5,.68,.85,1,1.25,1.55,1.9],ko=[.18,.2,.24,.28,.33,.4,.48,.62,.76,1.02,1.24,1.45,1.9,2.3,3,3.6,4.8,5.8,6.8],Po=[1.12,1.08,1.05,1.02,1,.98,.96,.94,.92,.9],Oo={"\u5929\u7136\u6c14":{heatOfCombustion:5e7,gasDensity:.72,stoichiometricFuelFraction:.095,explosionYieldFactor:.08,cloudParticipationFraction:.1,strengthClass:7},"\u7532\u70f7":{heatOfCombustion:5e7,gasDensity:.72,stoichiometricFuelFraction:.095,explosionYieldFactor:.08,cloudParticipationFraction:.1,strengthClass:7},"\u6db2\u5316\u77f3\u6cb9\u6c14":{heatOfCombustion:463e5,gasDensity:1.9,stoichiometricFuelFraction:.04,explosionYieldFactor:.1,cloudParticipationFraction:.12,strengthClass:8},"\u4e19\u70f7":{heatOfCombustion:464e5,gasDensity:1.87,stoichiometricFuelFraction:.04,explosionYieldFactor:.1,cloudParticipationFraction:.12,strengthClass:8},"\u6c22\u6c14":{heatOfCombustion:12e7,gasDensity:.09,stoichiometricFuelFraction:.029,explosionYieldFactor:.12,cloudParticipationFraction:.08,strengthClass:8},"\u4e59\u70ef":{heatOfCombustion:472e5,gasDensity:1.18,stoichiometricFuelFraction:.063,explosionYieldFactor:.1,cloudParticipationFraction:.12,strengthClass:8}},Ao={fuelType:"\u5929\u7136\u6c14",inputMode:"manualMass",effectiveFuelMass:2e3,effectiveCloudVolume:0,calculatedLeakRate:0,unmitigatedTime:600,cloudParticipationFraction:.1,gasDensity:.72,stoichiometricFuelFraction:.095,heatOfCombustion:5e7,explosionYieldFactor:.08,strengthClass:7,ambientPressure:Eo,soundSpeed:340,overpressureThresholds:Do,deathOverpressure:14e4,seriousOverpressure:5e4,minorOverpressure:2e4,maxDistance:0,cloudMass:2e3,deathRadius:80,seriousRadius:160,minorRadius:320,showShockwave:true,shockwaveDuration:3e3,showFlame:true,emissionRate:6,flameSpeed:6,flameScale:15,particleLife:4,calculationResult:null,calculationDiagnosis:"",thresholdResults:[]};function Io(t,i,e){return Math.min(e,Math.max(i,t))}function _o(t){return ""+t}function Fo(t,i,e){if(t[0]>=e)return i[0];if(e>=t[t.length-1])return i[i.length-1];for(let s=0;t.length-1>s;s++){const o=t[s],n=t[s+1];if(e>=o&&n>=e){return i[s]+(i[s+1]-i[s])*((Math.log(e)-Math.log(o))/(Math.log(n)-Math.log(o)))}}return i[i.length-1]}function zo(t,i){return "number"==typeof t&&Number.isFinite(t)&&t>0?t:i}function Ho(t,i){return "number"==typeof t&&Number.isFinite(t)?t:i}function Vo(t){var i,e,s,o;const n=[...null!==(i=t.overpressureThresholds)&&void 0!==i?i:Do,null!==(e=t.deathOverpressure)&&void 0!==e?e:Ao.deathOverpressure,null!==(s=t.seriousOverpressure)&&void 0!==s?s:Ao.seriousOverpressure,null!==(o=t.minorOverpressure)&&void 0!==o?o:Ao.minorOverpressure].filter((t=>"number"==typeof t&&Number.isFinite(t)&&t>0)).map((t=>Number(t)));return Array.from(new Set(n)).sort(((t,i)=>i-t))}function Wo(t,i){return Math.cbrt(t/i)}function jo(t,i,e,s){const o=Wo(i,e),n=Math.max(t/o,Mo[0]),a=Fo(Mo,function(t){const i=xo[Io(Math.round(t),1,10)-1];return Ro.map((t=>t*i))}(s),n);return a*e}function Go(t,i,e,s,o){const n=Wo(i,e),a=Math.max(t/n,Mo[0]),r=Fo(Mo,function(t){const i=Po[Io(Math.round(t),1,10)-1];return ko.map((t=>t*i))}(o),a);return r*n/s}function Bo(t,i,e,s,o){if(0>=t)return null;if(t>jo(.1,i,e,s))return null;if(jo(o,i,e,s)>=t)return o;let n=.1,a=o;for(let o=0;50>o;o++){const o=(n+a)/2;t>jo(o,i,e,s)?a=o:n=o;}return Number(n.toFixed(2))}function Zo(t){var i,e,s,o,n,a;const r=function(t){var i;return null!==(i=Oo[t])&&void 0!==i?i:Oo["\u5929\u7136\u6c14"]}(null!==(i=t.fuelType)&&void 0!==i?i:Ao.fuelType),l={fuelType:null!==(e=t.fuelType)&&void 0!==e?e:Ao.fuelType,inputMode:null!==(s=t.inputMode)&&void 0!==s?s:Ao.inputMode,effectiveFuelMass:Ho(t.effectiveFuelMass,Ao.effectiveFuelMass),effectiveCloudVolume:Ho(t.effectiveCloudVolume,Ao.effectiveCloudVolume),calculatedLeakRate:Ho(t.calculatedLeakRate,Ao.calculatedLeakRate),unmitigatedTime:Ho(t.unmitigatedTime,Ao.unmitigatedTime),cloudParticipationFraction:Ho(t.cloudParticipationFraction,r.cloudParticipationFraction),gasDensity:Ho(t.gasDensity,r.gasDensity),stoichiometricFuelFraction:Ho(t.stoichiometricFuelFraction,r.stoichiometricFuelFraction),heatOfCombustion:Ho(t.heatOfCombustion,r.heatOfCombustion),explosionYieldFactor:Ho(t.explosionYieldFactor,r.explosionYieldFactor),strengthClass:Io(Math.round(Ho(t.strengthClass,r.strengthClass)),1,10),ambientPressure:Ho(t.ambientPressure,Eo),soundSpeed:Ho(t.soundSpeed,340),overpressureThresholds:Vo(t),deathOverpressure:Ho(t.deathOverpressure,Ao.deathOverpressure),seriousOverpressure:Ho(t.seriousOverpressure,Ao.seriousOverpressure),minorOverpressure:Ho(t.minorOverpressure,Ao.minorOverpressure),maxDistance:Ho(t.maxDistance,0)};if(0>=l.heatOfCombustion)throw Error("\u84b8\u6c7d\u4e91\u7206\u70b8\u8ba1\u7b97\u5931\u8d25\uff1a\u71c3\u70e7\u70ed\u5fc5\u987b\u5927\u4e8e 0\u3002");if(0>=l.explosionYieldFactor)throw Error("\u84b8\u6c7d\u4e91\u7206\u70b8\u8ba1\u7b97\u5931\u8d25\uff1a\u7206\u70b8\u6548\u7387\u5fc5\u987b\u5927\u4e8e 0\u3002");if(0>=l.gasDensity)throw Error("\u84b8\u6c7d\u4e91\u7206\u70b8\u8ba1\u7b97\u5931\u8d25\uff1a\u6c14\u4f53\u5bc6\u5ea6\u5fc5\u987b\u5927\u4e8e 0\u3002");if(0>=l.stoichiometricFuelFraction)throw Error("\u84b8\u6c7d\u4e91\u7206\u70b8\u8ba1\u7b97\u5931\u8d25\uff1a\u5316\u5b66\u8ba1\u91cf\u7cfb\u6570\u5fc5\u987b\u5927\u4e8e 0\u3002");if(0>=l.cloudParticipationFraction)throw Error("\u84b8\u6c7d\u4e91\u7206\u70b8\u8ba1\u7b97\u5931\u8d25\uff1a\u4e91\u56e2\u53c2\u4e0e\u7cfb\u6570\u5fc5\u987b\u5927\u4e8e 0\u3002");if(0>=l.unmitigatedTime&&"linked"===l.inputMode)throw Error("\u84b8\u6c7d\u4e91\u7206\u70b8\u8ba1\u7b97\u5931\u8d25\uff1a\u672a\u5904\u7f6e\u65f6\u95f4\u5fc5\u987b\u5927\u4e8e 0\u3002");if(0>=l.calculatedLeakRate&&"linked"===l.inputMode)throw Error("\u84b8\u6c7d\u4e91\u7206\u70b8\u8ba1\u7b97\u5931\u8d25\uff1a\u8054\u52a8\u6a21\u5f0f\u4e0b\u6cc4\u6f0f\u901f\u7387\u5fc5\u987b\u5927\u4e8e 0\u3002");if(0>=l.effectiveCloudVolume&&"manualVolume"===l.inputMode)throw Error("\u84b8\u6c7d\u4e91\u7206\u70b8\u8ba1\u7b97\u5931\u8d25\uff1a\u6709\u6548\u4e91\u56e2\u4f53\u79ef\u5fc5\u987b\u5927\u4e8e 0\u3002");const h=function(t){const i=[],e=t.inputMode;let s=0,o=0;if("manualVolume"===e)s=zo(t.effectiveCloudVolume,0),o=s*zo(t.gasDensity,Ao.gasDensity)*zo(t.stoichiometricFuelFraction,Ao.stoichiometricFuelFraction)*zo(t.cloudParticipationFraction,Ao.cloudParticipationFraction),i.push(`\u6309\u4f53\u79ef\u8f93\u5165\u4f30\u7b97\u6709\u6548\u53c2\u4e0e\u8d28\u91cf ${o.toFixed(2)}kg`);else if("linked"===e){const e=zo(t.calculatedLeakRate,0),n=zo(t.unmitigatedTime,Ao.unmitigatedTime);s=e*n,o=s*zo(t.cloudParticipationFraction,Ao.cloudParticipationFraction),i.push(`\u6309\u6cc4\u6f0f\u901f\u7387 ${e.toFixed(4)}kg/s \u4e0e\u672a\u5904\u7f6e\u65f6\u95f4 ${n.toFixed(1)}s \u4f30\u7b97`);}else s=zo(t.effectiveFuelMass,0),o=s,i.push(`\u6309\u4eba\u5de5\u8f93\u5165\u6709\u6548\u71c3\u6599\u8d28\u91cf ${o.toFixed(2)}kg \u8ba1\u7b97`);return {sourceMass:s,effectiveFuelMass:o,diagnostics:i}}(l),d=h.effectiveFuelMass;if(0>=d)throw Error("\u84b8\u6c7d\u4e91\u7206\u70b8\u8ba1\u7b97\u5931\u8d25\uff1a\u6709\u6548\u53c2\u4e0e\u71c3\u6599\u8d28\u91cf\u5fc5\u987b\u5927\u4e8e 0\u3002");const c=d*l.heatOfCombustion*l.explosionYieldFactor,u=Wo(c,l.ambientPressure),p=Math.max(l.maxDistance,100*u,500),m=Array.from({length:36},((t,i)=>{const e=Number((.5+i/35*(p-.5)).toFixed(2));return {distance:e,scaledDistance:Number((e/u).toFixed(4)),overpressure:Number(jo(e,c,l.ambientPressure,l.strengthClass).toFixed(2))}})),g=m.map((t=>({distance:t.distance,scaledDistance:t.scaledDistance,duration:Number(Go(t.distance,c,l.ambientPressure,l.soundSpeed,l.strengthClass).toFixed(4))}))),f=l.overpressureThresholds.map((t=>({threshold:t,radius:Bo(t,c,l.ambientPressure,l.strengthClass,p)}))),v=f.reduce(((t,i)=>(t[_o(i.threshold)]=i.radius,t)),{}),y=null!==(o=v[_o(l.deathOverpressure)])&&void 0!==o?o:0,w=null!==(n=v[_o(l.seriousOverpressure)])&&void 0!==n?n:0,C=null!==(a=v[_o(l.minorOverpressure)])&&void 0!==a?a:0,b=[...h.diagnostics,"\u5f3a\u5ea6\u7b49\u7ea7 "+l.strengthClass,`\u7206\u70b8\u80fd\u91cf ${(c/1e9).toFixed(4)}GJ`,`\u7279\u5f81\u957f\u5ea6 ${u.toFixed(3)}m`];return {inputMode:l.inputMode,sourceMass:Number(h.sourceMass.toFixed(4)),effectiveFuelMass:Number(d.toFixed(4)),explosionEnergy:Number(c.toFixed(2)),characteristicLength:Number(u.toFixed(4)),strengthClass:l.strengthClass,peakOverpressureCurve:m,positivePhaseDurationCurve:g,thresholdResults:f,radiiByThreshold:v,deathRadius:Number((null!=y?y:0).toFixed(2)),seriousRadius:Number((null!=w?w:0).toFixed(2)),minorRadius:Number((null!=C?C:0).toFixed(2)),inputSummary:{fuelType:l.fuelType,heatOfCombustion:l.heatOfCombustion,gasDensity:l.gasDensity,stoichiometricFuelFraction:l.stoichiometricFuelFraction,cloudParticipationFraction:l.cloudParticipationFraction,explosionYieldFactor:l.explosionYieldFactor,unmitigatedTime:l.unmitigatedTime,linkedLeakRate:l.calculatedLeakRate},diagnostics:b}}class No extends ao{constructor(t,i,e={}){super(t,i,Object.assign(Object.assign({},Ao),e)),this.zoneIds={death:"",serious:"",minor:""},this.fireSimulation=null;}getDisplayCenter(){var t,i,e;return {longitude:null!==(t=this.options.longitude)&&void 0!==t?t:this.center.longitude,latitude:null!==(i=this.options.latitude)&&void 0!==i?i:this.center.latitude,height:null!==(e=this.options.height)&&void 0!==e?e:this.center.height}}rememberZoneIds(){const t=Array.from(this.zones.keys());this.zoneIds.minor=t[0]||"",this.zoneIds.serious=t[1]||"",this.zoneIds.death=t[2]||"";}getZoneDefinitions(){return [{label:"\u8f7b\u4f24\u533a",radius:this.options.minorRadius,color:this.options.minorColor,opacity:.3,gradient:.75},{label:"\u91cd\u4f24\u533a",radius:this.options.seriousRadius,color:this.options.seriousColor,opacity:.4,gradient:.75},{label:"\u6b7b\u4ea1\u533a",radius:this.options.deathRadius,color:this.options.deathColor,opacity:.5,gradient:.75}]}calculateResult(){const t=Zo(this.options);return this.options.calculationResult=t,this.options.thresholdResults=t.thresholdResults,this.options.cloudMass=t.effectiveFuelMass,this.options.deathRadius=t.deathRadius,this.options.seriousRadius=t.seriousRadius,this.options.minorRadius=t.minorRadius,this.options.calculationDiagnosis=t.diagnostics.join(" | "),t}syncZoneRadii(){this.zoneIds.minor&&(this.updateZone(this.zoneIds.minor,{radius:Math.max(this.options.minorRadius,1)}),this.updateZoneLabel(0,this.options.minorRadius)),this.zoneIds.serious&&(this.updateZone(this.zoneIds.serious,{radius:Math.max(this.options.seriousRadius,1)}),this.updateZoneLabel(1,this.options.seriousRadius)),this.zoneIds.death&&(this.updateZone(this.zoneIds.death,{radius:Math.max(this.options.deathRadius,1)}),this.updateZoneLabel(2,this.options.deathRadius));}syncWave(t=this.center){var i;if(!this.options.showShockwave)return void(this.waterwaveEntity&&this.updateWaterwave({show:false}));const e={maxRadius:Math.max(this.options.minorRadius,1),duration:null!==(i=this.options.shockwaveDuration)&&void 0!==i?i:Ao.shockwaveDuration,count:1,gradient:.3,color:"#ff4400",opacity:.8,show:true};this.waterwaveEntity?this.updateWaterwave(e):this.addWaterwave(t,e);}syncFlame(t=this.center){if(!this.options.showFlame)return void(this.fireSimulation&&this.fireSimulation.update({show:false}));const i=function(t){const i=zo(t.flameSpeed,Ao.flameSpeed),e=zo(t.flameScale,Ao.flameScale),s=zo(t.particleLife,Ao.particleLife);return {emissionRate:zo(t.emissionRate,Ao.emissionRate),minimumSpeed:.33*i,maximumSpeed:i,endScale:e,minimumParticleLife:.25*s,maximumParticleLife:s}}(this.options),e=Object.assign({longitude:t.longitude,latitude:t.latitude,height:t.height,emitter:"SphereEmitter",emitterRadius:8,startScale:0,showSmoke:true},i);if(!this.fireSimulation)return this.fireSimulation=new to(this.viewer,{}),void this.fireSimulation.add(e);this.fireSimulation.update(Object.assign(Object.assign({},e),{show:true}));}syncVisualState(t=this.center){this.syncZoneRadii(),this.syncWave(t),this.syncFlame(t);}add(){return Mt(this,arguments,void 0,(function*(t={}){this.clear(),this.options=Object.assign(Object.assign(Object.assign({},Ao),this.options),t),this.calculateResult();const i=this.getDisplayCenter();yield this.addZones(i,this.getZoneDefinitions()),this.rememberZoneIds(),this.syncVisualState(i);}))}update(t){const i=void 0!==t.fuelType||void 0!==t.inputMode||void 0!==t.effectiveFuelMass||void 0!==t.effectiveCloudVolume||void 0!==t.calculatedLeakRate||void 0!==t.unmitigatedTime||void 0!==t.cloudParticipationFraction||void 0!==t.gasDensity||void 0!==t.stoichiometricFuelFraction||void 0!==t.heatOfCombustion||void 0!==t.explosionYieldFactor||void 0!==t.strengthClass||void 0!==t.ambientPressure||void 0!==t.soundSpeed||void 0!==t.overpressureThresholds||void 0!==t.deathOverpressure||void 0!==t.seriousOverpressure||void 0!==t.minorOverpressure||void 0!==t.maxDistance;this.options=Object.assign(Object.assign({},this.options),t),void 0!==t.deathColor&&this.updateZoneColor(2,t.deathColor),void 0!==t.seriousColor&&this.updateZoneColor(1,t.seriousColor),void 0!==t.minorColor&&this.updateZoneColor(0,t.minorColor),i&&(this.calculateResult(),this.syncZoneRadii(),this.syncWave()),void 0===t.minorRadius&&void 0===t.seriousRadius&&void 0===t.deathRadius||this.syncZoneRadii(),(i||void 0!==t.emissionRate||void 0!==t.flameSpeed||void 0!==t.flameScale||void 0!==t.particleLife||void 0!==t.showFlame)&&this.syncFlame(this.getDisplayCenter()),(void 0!==t.showShockwave||void 0!==t.shockwaveDuration||i)&&this.syncWave(this.getDisplayCenter()),void 0!==t.show&&(this.setVisible(t.show),this.fireSimulation&&this.fireSimulation.update({show:t.show&&this.options.showFlame}),this.waterwaveEntity&&this.updateWaterwave({show:t.show&&this.options.showShockwave}));}applyTimeState(t){this.update(t);}clear(){super.clear(),this.fireSimulation&&(this.fireSimulation.clear(),this.fireSimulation=null);}dispose(){this.fireSimulation&&(this.fireSimulation.dispose(),this.fireSimulation=null),super.dispose();}}var Uo={"\u6c2f\u6c14":{name:"\u6c2f\u6c14",formula:"Cl2",molecularWeight:70.9,boilingPoint:239.1,criticalTemperature:417,criticalPressure:771e4,density:3.214,state:"gas",storageModel:"pressure-liquefied-gas",k:1.35,LC50_1h:294,IDLH:88,MAC:1,heatOfCombustion:null,flashPoint:null,autoIgnitionTemperature:null,lowerExplosiveLimit:null,upperExplosiveLimit:null},"\u6c28\u6c14":{name:"\u6c28\u6c14",formula:"NH3",molecularWeight:17.03,boilingPoint:239.8,criticalTemperature:405.5,criticalPressure:1128e4,density:.771,state:"gas",storageModel:"pressure-liquefied-gas",k:1.31,LC50_1h:4e3,IDLH:300,MAC:20,heatOfCombustion:null,flashPoint:null,autoIgnitionTemperature:651,lowerExplosiveLimit:15,upperExplosiveLimit:28},"\u6db2\u5316\u77f3\u6cb9\u6c14":{name:"\u6db2\u5316\u77f3\u6cb9\u6c14",formula:"LPG",molecularWeight:44.1,boilingPoint:231,criticalTemperature:370,criticalPressure:425e4,density:2.35,state:"liquefied",storageModel:"pressure-liquefied-gas",k:1.15,LC50_1h:65e3,IDLH:2e3,MAC:1e3,heatOfCombustion:46e3,flashPoint:-104,autoIgnitionTemperature:450,lowerExplosiveLimit:2.1,upperExplosiveLimit:9.5},"\u5929\u7136\u6c14":{name:"\u5929\u7136\u6c14",formula:"CH4",molecularWeight:16.04,boilingPoint:111.7,criticalTemperature:190.6,criticalPressure:4599e3,density:.717,state:"gas",storageModel:"compressed-gas",k:1.31,LC50_1h:5e4,IDLH:5e3,MAC:1e3,heatOfCombustion:5e4,flashPoint:-188,autoIgnitionTemperature:537,lowerExplosiveLimit:5,upperExplosiveLimit:15},"\u82ef":{name:"\u82ef",formula:"C6H6",molecularWeight:78.11,boilingPoint:353.3,criticalTemperature:562,criticalPressure:489e4,density:879,state:"liquid",storageModel:"liquid",k:1.05,LC50_1h:1e4,IDLH:500,MAC:6,heatOfCombustion:40170,flashPoint:-11,autoIgnitionTemperature:498,lowerExplosiveLimit:1.2,upperExplosiveLimit:8},"\u786b\u5316\u6c22":{name:"\u786b\u5316\u6c22",formula:"H2S",molecularWeight:34.08,boilingPoint:212.8,criticalTemperature:373.2,criticalPressure:894e4,density:1.539,state:"gas",storageModel:"compressed-gas",k:1.32,LC50_1h:444,IDLH:100,MAC:10,heatOfCombustion:null,flashPoint:null,autoIgnitionTemperature:260,lowerExplosiveLimit:4,upperExplosiveLimit:46},"\u4e8c\u6c27\u5316\u786b":{name:"\u4e8c\u6c27\u5316\u786b",formula:"SO2",molecularWeight:64.07,boilingPoint:263,criticalTemperature:430.8,criticalPressure:778e4,density:2.927,state:"gas",storageModel:"pressure-liquefied-gas",k:1.29,LC50_1h:940,IDLH:100,MAC:5,heatOfCombustion:null,flashPoint:null,autoIgnitionTemperature:null,lowerExplosiveLimit:null,upperExplosiveLimit:null},"\u4e00\u6c27\u5316\u78b3":{name:"\u4e00\u6c27\u5316\u78b3",formula:"CO",molecularWeight:28.01,boilingPoint:81.7,criticalTemperature:132.9,criticalPressure:3499e3,density:1.25,state:"gas",storageModel:"compressed-gas",k:1.4,LC50_1h:1800,IDLH:1200,MAC:20,heatOfCombustion:10100,flashPoint:null,autoIgnitionTemperature:605,lowerExplosiveLimit:12.5,upperExplosiveLimit:74}};class qo{constructor(){this.chemicals=new Map,this.initialized=false;}static getInstance(){return qo.instance||(qo.instance=new qo),qo.instance}initialize(t){return Mt(this,void 0,void 0,(function*(){if(!this.initialized){if(t)for(const[i,e]of Object.entries(t.chemicals))this.chemicals.set(i,e);else try{for(const[t,i]of Object.entries(Uo))this.chemicals.set(t,i);}catch(t){}this.initialized=true;}}))}initializeSync(t){if(!this.initialized){for(const[i,e]of Object.entries(t.chemicals))this.chemicals.set(i,e);this.initialized=true;}}getChemical(t){return this.chemicals.get(t)}getChemicalNames(){return Array.from(this.chemicals.keys())}isInitialized(){return this.initialized}reset(){this.chemicals.clear(),this.initialized=false;}}qo.getInstance();const $o=101325,Yo=.65;function Ko(t){switch(t){case "pressure-liquefied-gas":return "\u538b\u529b\u6db2\u5316\u6c14";case "liquid":return "\u5e38\u538b\u6db2\u4f53";default:return "\u538b\u7f29\u6c14\u4f53"}}function Xo(t,i,e=$o){return Math.pow(2/(t+1),t/(t-1))>e/i}function Jo(t,i,e,s,o,n=.65,a=$o){const r=e/1e3;let l;if(Xo(s,t,a)){const e=Math.pow(2/(s+1),(s+1)/(s-1));l=n*o*t*Math.sqrt(r/(8.314*i))*Math.sqrt(s*e);}else {const e=a/t;l=n*o*t*Math.sqrt(2*r/(8.314*i)*s/(s-1)*(Math.pow(e,2/s)-Math.pow(e,(s+1)/s)));}return Math.max(0,l)}function Qo(t,i,e,s,o=.65,n=$o){const a=Math.max(0,i-n)+Math.max(0,9.81*t*s);if(0>=t||0>=a||0>=e)return 0;return Math.max(0,o*e*t*Math.sqrt(2*a/t))}function tn(t,i,e,s,o,n={}){var a,r,l;const h=Math.PI*Math.pow(t.holeDiameter/1e3,2)/4;const d=t.dischargeCoefficient||Yo,c=function(t){return "pressure-liquefied-gas"===t||"compressed-gas"===t||"liquid"===t?t:"liquefied"===t?"pressure-liquefied-gas":"liquid"===t?"liquid":"compressed-gas"}(o),u=null!==(r=null!==(a=n.orificeHeight)&&void 0!==a?a:t.orificeHeight)&&void 0!==r?r:0,p=Math.max(0,t.liquidLevel-u),m=["\u5b58\u50a8\u6a21\u578b: "+Ko(c)];let g,f,v,y=false;if("compressed-gas"===c)g=Jo(t.pressure,t.temperature,i,e,h,d),f="gas",y=Xo(e,t.pressure),v="vapor-space",m.push("\u91ca\u653e\u5de5\u51b5: \u6c14\u76f8\u7a7a\u95f4\u91ca\u653e"),m.push("\u6db2\u4f4d\u672a\u53c2\u4e0e\u6e90\u9879\u8ba1\u7b97");else if("liquid"===c)g=Qo(s,t.pressure,h,p,d),f="liquid",v="submerged-liquid",m.push("\u91ca\u653e\u5de5\u51b5: \u6d78\u6ca1\u6db2\u76f8\u91ca\u653e"),m.push(`\u6db2\u4f4d\u53c2\u4e0e\u9759\u538b\u5934\u8ba1\u7b97, \u6d78\u6ca1\u6df1\u5ea6 ${p.toFixed(2)}m`);else {const o=null!==(l=n.criticalTemperature)&&void 0!==l?l:1/0;t.temperature>=o?(g=Jo(t.pressure,t.temperature,i,e,h,d),f="gas",y=Xo(e,t.pressure),v="supercritical-gas",m.push("\u91ca\u653e\u5de5\u51b5: \u8d85\u4e34\u754c\u6c14\u4f53\u91ca\u653e"),m.push("\u6e29\u5ea6\u5df2\u8d85\u8fc7\u4e34\u754c\u6e29\u5ea6, \u6db2\u4f4d\u4e0d\u53c2\u4e0e\u6e90\u9879\u8ba1\u7b97")):p>0?(g=Qo(s,t.pressure,h,p,d),f="two-phase",v="submerged-liquid",m.push("\u91ca\u653e\u5de5\u51b5: \u6d78\u6ca1\u6db2\u76f8\u91ca\u653e"),m.push(`\u6db2\u4f4d\u53c2\u4e0e\u9759\u538b\u5934\u8ba1\u7b97, \u6d78\u6ca1\u6df1\u5ea6 ${p.toFixed(2)}m`)):(g=Jo(t.pressure,t.temperature,i,e,h,d),f="gas",y=Xo(e,t.pressure),v="vapor-space",m.push("\u91ca\u653e\u5de5\u51b5: \u6c14\u76f8\u7a7a\u95f4\u91ca\u653e"),m.push("\u5b54\u53e3\u9ad8\u4e8e\u6db2\u9762, \u6db2\u4f4d\u672a\u53c2\u4e0e\u6e90\u9879\u8ba1\u7b97"));}return m.push(`\u5b54\u53e3\u9ad8\u5ea6 ${u.toFixed(2)}m`),{leakRate:g,leakType:f,holeArea:h,isChoked:y,sourceRegime:v,storageModel:c,submergedDepth:p,diagnostics:m}}const en={A:{a:.22,b:.91,c:.2,d:1,f:0},B:{a:.16,b:.86,c:.12,d:1,f:0},C:{a:.11,b:.8,c:.08,d:.9,f:0},D:{a:.08,b:.76,c:.06,d:.8,f:0},E:{a:.06,b:.72,c:.03,d:.6,f:0},F:{a:.04,b:.68,c:.016,d:.5,f:0}};function sn(t,i,e,s){const{leakRate:o,windSpeed:n,stability:a,releaseHeight:r}=s;if(0>=t||0>=n||0>=o)return 0;const l=function(t,i){const e=en[t];return e?e.a*Math.pow(i,e.b):en.D.a*Math.pow(i,en.D.b)}(a,t),h=function(t,i){const e=en[t];return e?e.c*Math.pow(i,e.d)+e.f:en.D.c*Math.pow(i,en.D.d)+en.D.f}(a,t);if(0>=l||0>=h)return 0;return o/(2*Math.PI*n*l*h)*Math.exp(-0/(2*l*l))*Math.exp(-(e-r)*(e-r)/(2*h*h))}function on(t,i){return sn(t,0,0,i)}function nn(t,i){return t*i/24.45}function an(t,i){return Number.isFinite(t)&&t>0?t:i}function rn(t,i,e,s=80){return function(t,i,e){if(1>=e||t>=i)return [t,i];const s=[],o=Math.pow(i/t,1/(e-1));for(let i=0;e>i;i++)s.push(t*Math.pow(o,i));return s[0]=t,s[s.length-1]=i,s}(i,e,s).map((i=>({distance:i,concentration:on(i,t)})))}function ln(t){return "liquefied"===t.state||t.density>1.225}function hn(t,i,e,s,o,n){if(0>=t||0>=i.leakRate)return 0;const a=function(t,i,e){if(0>=t.leakRate)return 0;const s=i.density>0?i.density:1.225;if("gas"!==t.leakType)return 20*Math.sqrt(t.leakRate/i.molecularWeight);const o=Math.sqrt(4*t.holeArea/Math.PI),n=function(t,i){return t.holeArea>0&&i>0&&t.leakRate>0?t.leakRate/(i*t.holeArea):0}(t,s),a=Math.min(n,400/Math.sqrt(s)),r=e>0?e:293.15;return Math.max(0,37*Math.sqrt(t.leakRate*a/r)-3.3*o*a*Math.sqrt(i.molecularWeight/r))}(i,e,n),r=function(t,i){return 2>=t&&["E","F"].includes(i)?"F1.5":"D3"}(s,o),l=i.leakRate/(e.molecularWeight*t);if(0>=l)return 0;return Math.max(0,"F1.5"===r?88e3*Math.pow(l,.55)-a:2e4*Math.sqrt(l)-a)}function dn(t,i,e=.5,s=1e4,o=.5,n=100){var a,r;const l=t/1e6;if(0>=l)return 0;const h=an(e,.5),d=an(s,1e4);if(h>=d)return d;const c=rn(i,h,d),u=function(t){let i=0;for(let e=1;t.length>e;e++)t[e].concentration>t[i].concentration&&(i=e);return i}(c);if(l>(null!==(r=null===(a=c[u])||void 0===a?void 0:a.concentration)&&void 0!==r?r:0))return 0;const p=c[c.length-1];if(p&&p.concentration>=l)return d;let m=u>0?c[u].distance:h,g=d,f=false;for(let t=u;c.length-1>t;t++){const i=c[t],e=c[t+1];if(i.concentration>=l&&l>=e.concentration){m=i.distance,g=e.distance,f=true;break}}if(!f)return d;for(let t=0;n>t;t++){const t=(m+g)/2,e=on(t,i);if(.01*Math.abs(l)>Math.abs(e-l))return t;if(l>e?g=t:m=t,o>g-m)return (m+g)/2}return (m+g)/2}function cn(t,i="absolute"){return "gauge"===i?t+$o:t}function un(t,i=0){return ln(t)&&0>=i?"chef-dense-gas-screening":"gaussian-plume"}function pn(t){return Mt(this,void 0,void 0,(function*(){var i,e,s,o,n,a,r,l;try{const l=null!==(i=t.pressureMode)&&void 0!==i?i:"absolute",h=cn(t.tankPressure,l),d=qo.getInstance();d.isInitialized()||(yield d.initialize());const c=d.getChemical(t.gasType);if(!c)return {leakResult:{leakRate:0,leakType:"gas",holeArea:0,isChoked:!1},impactRadii:{lethalRadius:0,idlhRadius:0,warningRadius:0},chemical:void 0,success:!1,normalizedTankPressure:h,pressureMode:l,modelUsed:"gaussian-plume",storageModel:null,sourceRegime:null,submergedDepth:0,diagnostics:[],error:"Unknown chemical: "+t.gasType};const u=tn({pressure:h,temperature:t.tankTemperature,liquidLevel:t.liquidLevel,orificeHeight:t.orificeHeight,holeDiameter:t.holeDiameter,gasType:t.gasType,dischargeCoefficient:t.dischargeCoefficient},c.molecularWeight,c.k,c.density,c.storageModel,{orificeHeight:t.orificeHeight,criticalTemperature:c.criticalTemperature}),p=function(t,i,e,s,o=0,n=293.15){if(ln(i)&&0>=o)return {lethalRadius:hn(i.LC50_1h,t,i,e,s,n),idlhRadius:hn(i.IDLH,t,i,e,s,n),warningRadius:hn(i.MAC,t,i,e,s,n)};const a=nn(i.LC50_1h,i.molecularWeight),r=nn(i.IDLH,i.molecularWeight),l=nn(i.MAC,i.molecularWeight),h={leakRate:t.leakRate,windSpeed:e,stability:s,releaseHeight:o};return {lethalRadius:dn(a,h),idlhRadius:dn(r,h),warningRadius:dn(l,h)}}(u,c,t.windSpeed,t.stability,null!==(e=t.releaseHeight)&&void 0!==e?e:0,t.tankTemperature);return {leakResult:u,impactRadii:p,chemical:c,success:!0,normalizedTankPressure:h,pressureMode:l,modelUsed:un(c,null!==(s=t.releaseHeight)&&void 0!==s?s:0),storageModel:null!==(o=u.storageModel)&&void 0!==o?o:c.storageModel,sourceRegime:null!==(n=u.sourceRegime)&&void 0!==n?n:null,submergedDepth:null!==(a=u.submergedDepth)&&void 0!==a?a:0,diagnostics:null!==(r=u.diagnostics)&&void 0!==r?r:[]}}catch(i){const e=null!==(l=t.pressureMode)&&void 0!==l?l:"absolute";return {leakResult:{leakRate:0,leakType:"gas",holeArea:0,isChoked:false},impactRadii:{lethalRadius:0,idlhRadius:0,warningRadius:0},chemical:void 0,success:false,normalizedTankPressure:cn(t.tankPressure,e),pressureMode:e,modelUsed:"gaussian-plume",storageModel:null,sourceRegime:null,submergedDepth:0,diagnostics:[],error:i instanceof Error?i.message:i+""}}}))}const mn={A:25,B:22,C:18,D:15,E:12,F:10},gn=mn.D,fn={leakRate:10,windSpeed:3,windDirection:0,lethalRadius:150,idlhRadius:400,warningRadius:800,showDiffusionWave:true,waveDuration:8e3,lethalColor:"#ff0000",idlhColor:"#ff6600",warningColor:"#ffcc00",showParticles:true,stability:"D",tankPressure:202650,tankTemperature:293.15,liquidLevel:5,orificeHeight:0,holeDiameter:1,gasType:"\u6c2f\u6c14",dischargeCoefficient:.65,pressureMode:"absolute",releaseHeight:0,autoCalculated:false,calculatedLeakRate:0,normalizedTankPressure:202650,calculationModel:"gaussian-plume",calculationDiagnosis:"",storageModel:"",sourceRegime:"",submergedDepth:0,isSubmergedOrifice:false,diagnostics:[],holeSeverity:"",calculatedRadii:null};function vn(t,i,e){return Math.min(e,Math.max(i,t))}function yn(t,i,e=.01){return e>=Math.abs(t-i)}function wn(t,i,e){return yn(t,i)||void 0!==e&&yn(t,e)}const Cn=["tankPressure","tankTemperature","liquidLevel","orificeHeight","holeDiameter","dischargeCoefficient","releaseHeight"];function bn(t){return Cn.some((i=>void 0!==t[i]))}function Sn(t){const i=Object.assign({},t);return delete i.leakRate,delete i.lethalRadius,delete i.idlhRadius,delete i.warningRadius,i}function Tn(t){return 50>t?20>t?10>t?5>t?"\u5fae\u5c0f\u5b54\u5f84":"\u5c0f\u5b54\u5f84":"\u4e2d\u5b54\u5f84":"\u5927\u5b54\u5f84":"\u8d85\u5927\u5b54\u5f84"}function Ln(t,i){var e,s,o,n;const a=[],r=null!==(s=null===(e=i.leakResult)||void 0===e?void 0:e.leakRate)&&void 0!==s?s:0,l=null!==(n=null===(o=i.impactRadii)||void 0===o?void 0:o.warningRadius)&&void 0!==n?n:0;var h,d;return i.storageModel&&a.push("\u5b58\u50a8\u6a21\u578b "+("pressure-liquefied-gas"===(h=i.storageModel)?"\u538b\u529b\u6db2\u5316\u6c14":"liquid"===h?"\u5e38\u538b\u6db2\u4f53":"compressed-gas"===h?"\u538b\u7f29\u6c14\u4f53":h||"\u672a\u77e5")),i.sourceRegime&&a.push("\u91ca\u653e\u5de5\u51b5 "+("submerged-liquid"===(d=i.sourceRegime)?"\u6d78\u6ca1\u6db2\u76f8\u91ca\u653e":"supercritical-gas"===d?"\u8d85\u4e34\u754c\u6c14\u4f53\u91ca\u653e":"vapor-space"===d?"\u6c14\u76f8\u7a7a\u95f4\u91ca\u653e":d||"\u672a\u77e5")),a.push("chef-dense-gas-screening"===t.calculationModel?"\u91cd\u6c14\u7b5b\u9009\u6a21\u578b":"Gaussian plume"),a.push(`${Tn(t.holeDiameter)} ${t.holeDiameter}mm`),a.push(`\u6cc4\u6f0f\u901f\u7387 ${r.toFixed(4)}kg/s`),a.push("gauge"===t.pressureMode?`\u8868\u538b\u8f93\u5165, \u6309\u7edd\u538b ${Math.round(t.normalizedTankPressure)}Pa \u53c2\u4e0e\u8ba1\u7b97`:`\u7edd\u538b\u8f93\u5165 ${Math.round(t.normalizedTankPressure)}Pa`),1e4>l||a.push("\u9884\u8b66\u534a\u5f84\u5df2\u8fbe\u5230 10km \u641c\u7d22\u4e0a\u9650"),i.submergedDepth>0&&a.push(`\u6d78\u6ca1\u6df1\u5ea6 ${i.submergedDepth.toFixed(2)}m`),Array.isArray(i.diagnostics)&&a.push(...i.diagnostics),a.join(" | ")}function En(t,i){const e=i*Math.PI/180,s=Math.sin(e)*t,o=Math.cos(e)*t;return (t,i)=>{const e=Math.min(1,3*i);t.velocity.x+=(s-t.velocity.x)*e,t.velocity.y+=(o-t.velocity.y)*e,t.velocity.z=Math.max(t.velocity.z-1.2*i,-1.5);const n=.15*i;t.velocity.x+=(Math.random()-.5)*n,t.velocity.y+=(Math.random()-.5)*n;}}function Dn(t){var i,e,s,o,n;const a=function(t){var i;return vn(null!==(i=[t.idlhRadius,t.warningRadius,t.lethalRadius].filter((t=>"number"==typeof t&&t>0))[0])&&void 0!==i?i:fn.idlhRadius,10,300)}(t),r=vn((null!==(i=t.holeDiameter)&&void 0!==i?i:fn.holeDiameter)/1e3,.001,1),l=Math.max(null!==(e=t.windSpeed)&&void 0!==e?e:fn.windSpeed,.8),h=vn(.12*a,12,80),d=vn(h/l,2,8),c=vn(a/40*((null!==(s=mn[t.stability])&&void 0!==s?s:gn)/gn),2,12),u=vn(Math.max(4,1.2*function(t){return t.autoCalculated&&t.calculatedLeakRate>0?t.calculatedLeakRate:t.leakRate}(t)),4,80);return {emitter:"CircleEmitter",emitterRadius:vn(6*r,.5,3),emissionRate:u,startScale:1.5,endScale:c,minimumSpeed:vn(.6*l,.2,20),maximumSpeed:vn(1.1*l,.6,24),minimumParticleLife:Math.max(1.5,.6*d),maximumParticleLife:d,imageSize:new Cartesian2(6,6),updateCallback:En(null!==(o=t.windSpeed)&&void 0!==o?o:fn.windSpeed,null!==(n=t.windDirection)&&void 0!==n?n:fn.windDirection)}}class Mn extends ao{constructor(t,i,e={}){super(t,i,Object.assign(Object.assign({},fn),e)),this.zoneIds={lethal:"",idlh:"",warning:""},this.smokeSimulation=null,this.setLabelMode("aligned");}setLabelMode(t){super.setLabelMode("aligned");}getDisplayCenter(){var t,i,e;return {longitude:null!==(t=this.options.longitude)&&void 0!==t?t:this.center.longitude,latitude:null!==(i=this.options.latitude)&&void 0!==i?i:this.center.latitude,height:null!==(e=this.options.height)&&void 0!==e?e:this.center.height}}getCalculationReleaseHeight(){var t;return null!==(t=this.options.releaseHeight)&&void 0!==t?t:fn.releaseHeight}getZoneDefinitions(){return [{label:"\u9884\u8b66\u533a",radius:this.options.warningRadius,color:this.options.warningColor,opacity:.25,gradient:.75},{label:"IDLH\u533a",radius:this.options.idlhRadius,color:this.options.idlhColor,opacity:.35,gradient:.75},{label:"\u81f4\u6b7b\u6d53\u5ea6\u533a",radius:this.options.lethalRadius,color:this.options.lethalColor,opacity:.45,gradient:.75}]}rememberZoneIds(){const t=Array.from(this.zones.keys());this.zoneIds.warning=t[0]||"",this.zoneIds.idlh=t[1]||"",this.zoneIds.lethal=t[2]||"";}syncZoneRadii(){this.zoneIds.warning&&(this.updateZone(this.zoneIds.warning,{radius:Math.max(this.options.warningRadius,1)}),this.updateZoneLabel(0,this.options.warningRadius)),this.zoneIds.idlh&&(this.updateZone(this.zoneIds.idlh,{radius:Math.max(this.options.idlhRadius,1)}),this.updateZoneLabel(1,this.options.idlhRadius)),this.zoneIds.lethal&&(this.updateZone(this.zoneIds.lethal,{radius:Math.max(this.options.lethalRadius,1)}),this.updateZoneLabel(2,this.options.lethalRadius));}syncWave(t=this.center){if(!this.options.showDiffusionWave)return void(this.waterwaveEntity&&this.updateWaterwave({show:false}));const i={maxRadius:Math.max(this.options.warningRadius,1),duration:this.options.waveDuration,count:1,gradient:.5,color:this.options.warningColor,opacity:.4,show:true};this.waterwaveEntity?this.updateWaterwave(i):this.addWaterwave(t,i);}buildParticleOptions(t){return Object.assign({longitude:t.longitude,latitude:t.latitude,height:t.height,startColor:"#889988",startColorAlpha:.45,endColor:"#667766",endColorAlpha:.05},Dn(this.options))}syncParticles(t=this.getDisplayCenter()){if(!this.options.showParticles)return void(this.smokeSimulation&&(this.smokeSimulation.clear(),this.smokeSimulation=null));const i=this.buildParticleOptions(t);if(!this.smokeSimulation)return this.smokeSimulation=new Js(this.viewer,{}),void this.smokeSimulation.add(i);this.smokeSimulation.update(i);}syncVisualState(t=this.center){this.syncZoneRadii(),this.syncWave(t),this.syncParticles(t);}calculateFromTankParams(){return Mt(this,arguments,void 0,(function*(t=false){var i;const e=this.options;if(e.gasType&&e.holeDiameter)try{const s=this.options.calculatedRadii,o={tankPressure:e.tankPressure,tankTemperature:e.tankTemperature,liquidLevel:e.liquidLevel,orificeHeight:e.orificeHeight,holeDiameter:e.holeDiameter,gasType:e.gasType,windSpeed:e.windSpeed,stability:e.stability,releaseHeight:this.getCalculationReleaseHeight(),dischargeCoefficient:e.dischargeCoefficient,pressureMode:e.pressureMode},n=yield pn(o);if(!n.success)return;this.options.autoCalculated=!0,this.options.calculatedLeakRate=n.leakResult.leakRate,this.options.normalizedTankPressure=n.normalizedTankPressure,this.options.calculationModel=n.modelUsed,this.options.storageModel=n.storageModel,this.options.sourceRegime=n.sourceRegime,this.options.submergedDepth=n.submergedDepth,this.options.isSubmergedOrifice=(null!==(i=n.submergedDepth)&&void 0!==i?i:0)>0,this.options.diagnostics=n.diagnostics,this.options.holeSeverity=Tn(e.holeDiameter),this.options.calculatedRadii=n.impactRadii,this.options.calculationDiagnosis=Ln(this.options,n),(t||wn(e.lethalRadius,fn.lethalRadius,null==s?void 0:s.lethalRadius))&&(this.options.lethalRadius=n.impactRadii.lethalRadius),(t||wn(e.idlhRadius,fn.idlhRadius,null==s?void 0:s.idlhRadius))&&(this.options.idlhRadius=n.impactRadii.idlhRadius),(t||wn(e.warningRadius,fn.warningRadius,null==s?void 0:s.warningRadius))&&(this.options.warningRadius=n.impactRadii.warningRadius);}catch(t){}}))}add(){return Mt(this,arguments,void 0,(function*(t={}){this.clear(),this.options=Object.assign(Object.assign(Object.assign({},fn),this.options),t),this.options.gasType&&this.options.holeDiameter&&!this.options.autoCalculated&&(yield this.calculateFromTankParams());const i=this.getDisplayCenter();yield this.addZones(i,this.getZoneDefinitions()),this.rememberZoneIds(),this.syncWave(i),this.syncParticles(i);}))}update(t,i={}){const e=void 0!==t.tankPressure||void 0!==t.tankTemperature||void 0!==t.liquidLevel||void 0!==t.orificeHeight||void 0!==t.holeDiameter||void 0!==t.gasType||void 0!==t.dischargeCoefficient||void 0!==t.pressureMode||void 0!==t.releaseHeight,s=void 0!==t.leakRate||void 0!==t.windSpeed||void 0!==t.windDirection||void 0!==t.stability||void 0!==t.holeDiameter,o=void 0!==t.lethalRadius||void 0!==t.idlhRadius||void 0!==t.warningRadius,n=void 0!==t.warningRadius||void 0!==t.warningColor||void 0!==t.waveDuration||void 0!==t.showDiffusionWave,a=void 0!==t.showParticles,r=this.options.showParticles;if(this.options=Object.assign(Object.assign({},this.options),t),void 0!==t.lethalColor&&this.updateZoneColor(2,t.lethalColor),void 0!==t.idlhColor&&this.updateZoneColor(1,t.idlhColor),void 0!==t.warningColor&&this.updateZoneColor(0,t.warningColor),o&&this.syncZoneRadii(),n&&this.syncWave(),a&&(this.options.showParticles&&r||this.syncParticles()),(s||o)&&this.options.showParticles&&this.syncParticles(),void 0!==t.show&&(this.setVisible(t.show),this.smokeSimulation&&this.smokeSimulation.update({show:t.show}),this.waterwaveEntity&&this.updateWaterwave({show:t.show&&this.options.showDiffusionWave})),e&&this.options.gasType&&this.options.holeDiameter){const e=i.forceCalculatedRadii||void 0!==t.gasType;this.options.autoCalculated=false,this.calculateFromTankParams(e).then((()=>{this.syncVisualState(this.getDisplayCenter());})).catch((t=>{}));}}applyTimeState(t){const i=bn(t),e=i?Sn(t):t;this.update(e,{forceCalculatedRadii:i});}clear(){super.clear(),this.smokeSimulation&&(this.smokeSimulation.clear(),this.smokeSimulation=null);}dispose(){this.smokeSimulation&&(this.smokeSimulation.dispose(),this.smokeSimulation=null),super.dispose();}}const Rn={totalLeak:5e3,windSpeed:3,windDirection:0,stability:"D",lethalRadius:120,idlhRadius:350,warningRadius:700,showParticle:true,emissionRate:4,particleLife:8,particleScale:18,tankPressure:202650,tankTemperature:293.15,liquidLevel:5,orificeHeight:0,holeDiameter:1,gasType:"\u6c2f\u6c14",dischargeCoefficient:.65,pressureMode:"absolute",releaseHeight:0,releaseTime:600,autoCalculated:false,calculatedLeakRate:0,normalizedTankPressure:202650,calculationModel:"gaussian-plume",calculationDiagnosis:"",storageModel:"",sourceRegime:"",submergedDepth:0,isSubmergedOrifice:false,diagnostics:[],holeSeverity:"",calculatedRadii:null},xn=.001;class kn extends ao{constructor(t,i,e={}){super(t,i,Object.assign(Object.assign({},Rn),e)),this.zoneIds={lethal:"",idlh:"",warning:""},this.particleSystem=null,this.windParams={speed:3,directionRad:0,totalLeak:5e3};}getDisplayCenter(){var t,i,e;return {longitude:null!==(t=this.options.longitude)&&void 0!==t?t:this.center.longitude,latitude:null!==(i=this.options.latitude)&&void 0!==i?i:this.center.latitude,height:null!==(e=this.options.height)&&void 0!==e?e:this.center.height}}calculateFromTankParams(){return Mt(this,arguments,void 0,(function*(t=false){var i,e,s;const o=this.options;if(o.gasType&&o.holeDiameter)try{const n=this.options.calculatedRadii,a={tankPressure:o.tankPressure,tankTemperature:o.tankTemperature,liquidLevel:o.liquidLevel,orificeHeight:o.orificeHeight,holeDiameter:o.holeDiameter,gasType:o.gasType,windSpeed:o.windSpeed,stability:o.stability,releaseHeight:null!==(i=o.releaseHeight)&&void 0!==i?i:Rn.releaseHeight,dischargeCoefficient:o.dischargeCoefficient,pressureMode:o.pressureMode},r=yield pn(a);if(!r.success)return;this.options.autoCalculated=!0,this.options.calculatedLeakRate=r.leakResult.leakRate,this.options.normalizedTankPressure=r.normalizedTankPressure,this.options.calculationModel=r.modelUsed,this.options.storageModel=r.storageModel,this.options.sourceRegime=r.sourceRegime,this.options.submergedDepth=r.submergedDepth,this.options.isSubmergedOrifice=(null!==(e=r.submergedDepth)&&void 0!==e?e:0)>0,this.options.diagnostics=r.diagnostics,this.options.holeSeverity=Tn(o.holeDiameter),this.options.calculatedRadii=r.impactRadii,this.options.calculationDiagnosis=Ln(this.options,r);const l=null!==(s=o.releaseTime)&&void 0!==s?s:Rn.releaseTime,h=r.leakResult.leakRate*l;(t||wn(o.totalLeak,Rn.totalLeak))&&(this.options.totalLeak=h),(t||wn(o.lethalRadius,Rn.lethalRadius,null==n?void 0:n.lethalRadius))&&(this.options.lethalRadius=r.impactRadii.lethalRadius),(t||wn(o.idlhRadius,Rn.idlhRadius,null==n?void 0:n.idlhRadius))&&(this.options.idlhRadius=r.impactRadii.idlhRadius),(t||wn(o.warningRadius,Rn.warningRadius,null==n?void 0:n.warningRadius))&&(this.options.warningRadius=r.impactRadii.warningRadius);}catch(t){}}))}syncZoneRadii(){this.zoneIds.warning&&(this.updateZone(this.zoneIds.warning,{radius:this.options.warningRadius}),this.updateZoneLabel(0,this.options.warningRadius)),this.zoneIds.idlh&&(this.updateZone(this.zoneIds.idlh,{radius:this.options.idlhRadius}),this.updateZoneLabel(1,this.options.idlhRadius)),this.zoneIds.lethal&&(this.updateZone(this.zoneIds.lethal,{radius:this.options.lethalRadius}),this.updateZoneLabel(2,this.options.lethalRadius));}syncVisualState(){var t;if(this.syncZoneRadii(),this.particleSystem){const i=null!==(t=this.options.emissionRate)&&void 0!==t?t:Rn.emissionRate;this.particleSystem.update({emissionRate:i+this.options.totalLeak*xn}),this.particleSystem.setEmitterParams({emitterRadius:.3*this.options.lethalRadius});}}add(){return Mt(this,arguments,void 0,(function*(t={}){this.clear();const i=Object.assign(Object.assign(Object.assign({},Rn),this.options),t);this.options=i,this.windParams.speed=i.windSpeed,this.windParams.directionRad=i.windDirection*Math.PI/180,this.windParams.totalLeak=i.totalLeak,i.gasType&&i.holeDiameter&&!i.autoCalculated&&(yield this.calculateFromTankParams());const e=this.getDisplayCenter(),s=[{label:"\u9884\u8b66\u533a",radius:this.options.warningRadius,color:"#b8a060",opacity:.25,gradient:.75},{label:"IDLH\u533a",radius:this.options.idlhRadius,color:"#886644",opacity:.35,gradient:.75},{label:"\u81f4\u6b7b\u6d53\u5ea6\u533a",radius:this.options.lethalRadius,color:"#664422",opacity:.5,gradient:.75}];yield this.addZones(e,s);const o=Array.from(this.zones.keys());if(this.zoneIds.warning=o[0]||"",this.zoneIds.idlh=o[1]||"",this.zoneIds.lethal=o[2]||"",this.options.showParticle){this.particleSystem=new Ys(this.viewer,{});this.particleSystem.add({longitude:e.longitude,latitude:e.latitude,height:e.height,image:"/cesium-assets/SampleData/smoke.png",imageSize:[20,20],startColor:"#b8a060",startColorAlpha:.6,endColor:"#664422",endColorAlpha:.1,emitter:"CircleEmitter",emitterRadius:.3*this.options.lethalRadius,emissionRate:this.options.emissionRate+this.options.totalLeak*xn,startScale:1,endScale:this.options.particleScale,minimumSpeed:.3,maximumSpeed:1.5,minimumParticleLife:.4*this.options.particleLife,maximumParticleLife:this.options.particleLife,lifetime:60,loop:true,sizeInMeters:true,updateCallback:(n=this.windParams,(t,i)=>{t.velocity.z*=.85,t.velocity.x+=n.speed*Math.sin(n.directionRad)*i*3,t.velocity.y+=n.speed*Math.cos(n.directionRad)*i*3,t.velocity.x+=2*(Math.random()-.5)*i,t.velocity.y+=2*(Math.random()-.5)*i;})});}var n;}))}update(t,i={}){var e;const s=void 0!==t.tankPressure||void 0!==t.tankTemperature||void 0!==t.liquidLevel||void 0!==t.orificeHeight||void 0!==t.holeDiameter||void 0!==t.gasType||void 0!==t.dischargeCoefficient||void 0!==t.pressureMode||void 0!==t.releaseHeight;if(void 0!==t.windSpeed&&(this.windParams.speed=t.windSpeed),void 0!==t.windDirection&&(this.windParams.directionRad=t.windDirection*Math.PI/180),void 0!==t.totalLeak&&(this.windParams.totalLeak=t.totalLeak,this.particleSystem)){const i=null!==(e=this.options.emissionRate)&&void 0!==e?e:Rn.emissionRate;this.particleSystem.update({emissionRate:i+t.totalLeak*xn});}if(void 0!==t.lethalRadius&&(this.updateZone(this.zoneIds.lethal,{radius:t.lethalRadius}),this.updateZoneLabel(2,t.lethalRadius),this.particleSystem&&this.particleSystem.setEmitterParams({emitterRadius:.3*t.lethalRadius})),void 0!==t.idlhRadius&&(this.updateZone(this.zoneIds.idlh,{radius:t.idlhRadius}),this.updateZoneLabel(1,t.idlhRadius)),void 0!==t.warningRadius&&(this.updateZone(this.zoneIds.warning,{radius:t.warningRadius}),this.updateZoneLabel(0,t.warningRadius)),void 0!==t.lethalColor&&this.updateZoneColor(2,t.lethalColor),void 0!==t.idlhColor&&this.updateZoneColor(1,t.idlhColor),void 0!==t.warningColor&&this.updateZoneColor(0,t.warningColor),void 0!==t.show&&(this.setVisible(t.show),this.particleSystem&&this.particleSystem.update({show:t.show})),void 0!==t.showParticle&&this.particleSystem&&this.particleSystem.update({show:t.showParticle}),void 0!==t.emissionRate&&this.particleSystem&&this.particleSystem.update({emissionRate:t.emissionRate}),void 0!==t.particleLife&&this.particleSystem&&this.particleSystem.update({minimumParticleLife:.4*t.particleLife,maximumParticleLife:t.particleLife}),void 0!==t.particleScale&&this.particleSystem&&this.particleSystem.update({endScale:t.particleScale}),this.options=Object.assign(Object.assign({},this.options),t),s&&this.options.gasType&&this.options.holeDiameter){const e=i.forceCalculatedRadii||void 0!==t.gasType;this.options.autoCalculated=false,this.calculateFromTankParams(e).then((()=>{this.syncVisualState();})).catch((t=>{}));}}applyTimeState(t){const i=bn(t),e=i?Sn(t):t;this.update(e,{forceCalculatedRadii:i});}clear(){super.clear(),this.particleSystem&&(this.particleSystem.clear(),this.particleSystem=null);}dispose(){this.particleSystem&&(this.particleSystem.dispose(),this.particleSystem=null),super.dispose();}}const Pn={A:25,B:22,C:18,D:15,E:12,F:10},On={leakRate:10,windSpeed:3,windDirection:0,stability:"D",lethalRadius:100,idlhRadius:300,warningRadius:600,showParticles:true,showDiffusionWave:true,waveDuration:8e3,tankPressure:202650,tankTemperature:293.15,liquidLevel:5,orificeHeight:0,holeDiameter:1,gasType:"\u6c2f\u6c14",dischargeCoefficient:.65,pressureMode:"absolute",releaseHeight:0,autoCalculated:false,calculatedLeakRate:0,normalizedTankPressure:202650,calculationModel:"gaussian-plume",calculationDiagnosis:"",storageModel:"",sourceRegime:"",submergedDepth:0,isSubmergedOrifice:false,diagnostics:[],holeSeverity:"",calculatedRadii:null};class An extends ao{constructor(t,i,e={}){super(t,i,Object.assign(Object.assign({},On),e)),this.zoneIds={lethal:"",idlh:"",warning:""},this.particleSystem=null,this.windParams={speed:3,directionRad:0};}getDisplayCenter(){var t,i,e;return {longitude:null!==(t=this.options.longitude)&&void 0!==t?t:this.center.longitude,latitude:null!==(i=this.options.latitude)&&void 0!==i?i:this.center.latitude,height:null!==(e=this.options.height)&&void 0!==e?e:this.center.height}}calculateFromTankParams(){return Mt(this,arguments,void 0,(function*(t=false){var i,e;const s=this.options;if(s.gasType&&s.holeDiameter)try{const o=this.options.calculatedRadii,n=this.options.calculatedLeakRate,a={tankPressure:s.tankPressure,tankTemperature:s.tankTemperature,liquidLevel:s.liquidLevel,orificeHeight:s.orificeHeight,holeDiameter:s.holeDiameter,gasType:s.gasType,windSpeed:s.windSpeed,stability:s.stability,releaseHeight:null!==(i=s.releaseHeight)&&void 0!==i?i:On.releaseHeight,dischargeCoefficient:s.dischargeCoefficient,pressureMode:s.pressureMode},r=yield pn(a);if(!r.success)return;this.options.autoCalculated=!0,this.options.calculatedLeakRate=r.leakResult.leakRate,this.options.normalizedTankPressure=r.normalizedTankPressure,this.options.calculationModel=r.modelUsed,this.options.storageModel=r.storageModel,this.options.sourceRegime=r.sourceRegime,this.options.submergedDepth=r.submergedDepth,this.options.isSubmergedOrifice=(null!==(e=r.submergedDepth)&&void 0!==e?e:0)>0,this.options.diagnostics=r.diagnostics,this.options.holeSeverity=Tn(s.holeDiameter),this.options.calculatedRadii=r.impactRadii,this.options.calculationDiagnosis=Ln(this.options,r),(t||wn(s.leakRate,On.leakRate,n))&&(this.options.leakRate=r.leakResult.leakRate),(t||wn(s.lethalRadius,On.lethalRadius,null==o?void 0:o.lethalRadius))&&(this.options.lethalRadius=r.impactRadii.lethalRadius),(t||wn(s.idlhRadius,On.idlhRadius,null==o?void 0:o.idlhRadius))&&(this.options.idlhRadius=r.impactRadii.idlhRadius),(t||wn(s.warningRadius,On.warningRadius,null==o?void 0:o.warningRadius))&&(this.options.warningRadius=r.impactRadii.warningRadius);}catch(t){}}))}syncZoneRadii(){this.zoneIds.warning&&(this.updateZone(this.zoneIds.warning,{radius:this.options.warningRadius}),this.updateZoneLabel(0,this.options.warningRadius)),this.zoneIds.idlh&&(this.updateZone(this.zoneIds.idlh,{radius:this.options.idlhRadius}),this.updateZoneLabel(1,this.options.idlhRadius)),this.zoneIds.lethal&&(this.updateZone(this.zoneIds.lethal,{radius:this.options.lethalRadius}),this.updateZoneLabel(2,this.options.lethalRadius));}syncVisualState(){var t;this.syncZoneRadii(),this.updateWaterwave({maxRadius:this.options.warningRadius}),this.particleSystem&&this.particleSystem.update({emissionRate:1.5*this.options.leakRate,endScale:null!==(t=Pn[this.options.stability])&&void 0!==t?t:15});}add(){return Mt(this,arguments,void 0,(function*(t={}){this.clear();const i=Object.assign(Object.assign(Object.assign({},On),this.options),t);this.options=i,this.windParams.speed=i.windSpeed,this.windParams.directionRad=i.windDirection*Math.PI/180,i.gasType&&i.holeDiameter&&!i.autoCalculated&&(yield this.calculateFromTankParams());const e=this.getDisplayCenter(),s=[{label:"\u9884\u8b66\u533a",radius:this.options.warningRadius,color:"#ffcc00",opacity:.25,gradient:.75},{label:"IDLH\u533a",radius:this.options.idlhRadius,color:"#ff6600",opacity:.35,gradient:.75},{label:"\u81f4\u6b7b\u6d53\u5ea6\u533a",radius:this.options.lethalRadius,color:"#ff0000",opacity:.45,gradient:.75}];yield this.addZones(e,s);const o=Array.from(this.zones.keys());this.zoneIds.warning=o[0]||"",this.zoneIds.idlh=o[1]||"",this.zoneIds.lethal=o[2]||"",this.options.showParticles&&this.addSmokeParticles(e,this.options),this.options.showDiffusionWave&&(yield this.addWaterwave(e,{maxRadius:this.options.warningRadius,duration:this.options.waveDuration,count:1,gradient:.5,color:"#00cc44",opacity:.4}));}))}addSmokeParticles(t,i){var e;this.particleSystem=new Ys(this.viewer,{});const s=this.windParams,o=new Cartesian3;this.particleSystem.add({longitude:t.longitude,latitude:t.latitude,height:t.height,image:"/cesium-assets/SampleData/smoke.png",startColor:"#aaddaa",startColorAlpha:.4,endColor:"#88bb88",endColorAlpha:.05,emitter:"CircleEmitter",emitterRadius:8,emissionRate:1.5*i.leakRate,startScale:1,endScale:null!==(e=Pn[i.stability])&&void 0!==e?e:15,minimumSpeed:1,maximumSpeed:3,minimumParticleLife:3,maximumParticleLife:8,updateCallback:(t,i)=>{Cartesian3.fromElements(s.speed*Math.sin(s.directionRad)*i*8,s.speed*Math.cos(s.directionRad)*i*8,2*i,o),t.position=Cartesian3.add(t.position,o,t.position);}});}update(t,i={}){var e,s;const o=void 0!==t.tankPressure||void 0!==t.tankTemperature||void 0!==t.liquidLevel||void 0!==t.orificeHeight||void 0!==t.holeDiameter||void 0!==t.gasType||void 0!==t.dischargeCoefficient||void 0!==t.pressureMode||void 0!==t.releaseHeight;if(void 0!==t.windSpeed&&(this.windParams.speed=t.windSpeed),void 0!==t.windDirection&&(this.windParams.directionRad=t.windDirection*Math.PI/180),this.options=Object.assign(Object.assign({},this.options),t),void 0!==t.leakRate&&this.particleSystem&&this.particleSystem.update({emissionRate:1.5*t.leakRate}),void 0!==t.stability&&this.particleSystem&&this.particleSystem.update({endScale:null!==(e=Pn[t.stability])&&void 0!==e?e:15}),void 0!==t.lethalRadius&&(this.updateZone(this.zoneIds.lethal,{radius:t.lethalRadius}),this.updateZoneLabel(2,t.lethalRadius)),void 0!==t.idlhRadius&&(this.updateZone(this.zoneIds.idlh,{radius:t.idlhRadius}),this.updateZoneLabel(1,t.idlhRadius)),void 0!==t.warningRadius&&(this.updateZone(this.zoneIds.warning,{radius:t.warningRadius}),this.updateZoneLabel(0,t.warningRadius),this.updateWaterwave({maxRadius:t.warningRadius})),void 0!==t.showParticles&&this.particleSystem&&this.particleSystem.update({show:t.showParticles}),void 0!==t.show&&(this.setVisible(t.show),this.particleSystem&&this.particleSystem.update({show:t.show})),void 0!==t.lethalColor&&this.updateZoneColor(2,t.lethalColor),void 0!==t.idlhColor&&this.updateZoneColor(1,t.idlhColor),void 0!==t.warningColor&&this.updateZoneColor(0,t.warningColor),void 0!==t.showDiffusionWave)if(t.showDiffusionWave)if(this.waterwaveEntity)this.updateWaterwave({show:true});else {const t=this.getDisplayCenter();this.addWaterwave(t,{maxRadius:this.options.warningRadius,duration:null!==(s=this.options.waveDuration)&&void 0!==s?s:8e3,count:1,gradient:.5,color:"#00cc44",opacity:.4});}else this.updateWaterwave({show:false});if(void 0!==t.waveDuration&&this.updateWaterwave({duration:t.waveDuration}),o&&this.options.gasType&&this.options.holeDiameter){const e=i.forceCalculatedRadii||void 0!==t.gasType;this.options.autoCalculated=false,this.calculateFromTankParams(e).then((()=>{this.syncVisualState();})).catch((t=>{}));}}applyTimeState(t){const i=bn(t),e=i?Sn(t):t;this.update(e,{forceCalculatedRadii:i});}clear(){super.clear(),this.particleSystem&&(this.particleSystem.clear(),this.particleSystem=null);}dispose(){this.particleSystem&&(this.particleSystem.dispose(),this.particleSystem=null),super.dispose();}}const In={totalLeak:5e3,windSpeed:3,windDirection:0,stability:"D",lethalRadius:80,idlhRadius:250,warningRadius:500,lethalColor:"#ff0000",idlhColor:"#ff6600",warningColor:"#ffcc00",animationDuration:5e3,showParticle:true,emissionRate:4,particleLife:6,particleScale:16,tankPressure:202650,tankTemperature:293.15,liquidLevel:5,orificeHeight:0,holeDiameter:1,gasType:"\u6c2f\u6c14",dischargeCoefficient:.65,pressureMode:"absolute",releaseHeight:0,releaseTime:600,autoCalculated:false,calculatedLeakRate:0,normalizedTankPressure:202650,calculationModel:"gaussian-plume",calculationDiagnosis:"",storageModel:"",sourceRegime:"",submergedDepth:0,isSubmergedOrifice:false,diagnostics:[],holeSeverity:"",calculatedRadii:null};function _n(t,i,e){return Math.min(e,Math.max(i,t))}function Fn(t){var i,e,s,o,n,a,r,l,h;const d=Math.max(null!==(i=t.warningRadius)&&void 0!==i?i:In.warningRadius,null!==(e=t.idlhRadius)&&void 0!==e?e:0,null!==(s=t.lethalRadius)&&void 0!==s?s:0,1),c=null!==(o=t.particleLife)&&void 0!==o?o:In.particleLife,u=null!==(n=t.particleScale)&&void 0!==n?n:In.particleScale,m=Math.max(null!==(a=t.windSpeed)&&void 0!==a?a:In.windSpeed,.5),g=Math.max((null!==(r=t.animationDuration)&&void 0!==r?r:In.animationDuration)/1e3,.5),f=_n(Math.min((v=null!==(l=t.lethalRadius)&&void 0!==l?l:In.lethalRadius,Math.max(4,.18*v)),.12*d),.8,6);var v;const y=_n(Math.min(c,.35*g,d/(3.2*m)),1.2,3),w=_n(.08*d,3,8),C=_n(u/6,1.2,3.2);return {imageSize:new Cartesian2(w,w),emitter:"SphereEmitter",emitterRadius:f,emissionRate:_n(null!==(h=t.emissionRate)&&void 0!==h?h:In.emissionRate,2,12),startScale:1,endScale:C,minimumSpeed:_n(.12*m,.15,.6),maximumSpeed:_n(.3*m,.4,1.4),minimumParticleLife:Math.max(.8,.6*y),maximumParticleLife:y,lifetime:_n(.45*g,1.2,4),loop:false}}class zn extends ao{constructor(t,i,e={}){super(t,i,Object.assign(Object.assign({},In),e)),this.zoneIds={lethal:"",idlh:"",warning:""},this.animationTimer=null,this.targetRadii={lethal:0,idlh:0,warning:0},this.sourceCenter=null,this.particleSystem=null,this.windParams={speed:In.windSpeed,directionRad:ho(In.windDirection)};}getDisplayCenter(){var t,i,e;return {longitude:null!==(t=this.options.longitude)&&void 0!==t?t:this.center.longitude,latitude:null!==(i=this.options.latitude)&&void 0!==i?i:this.center.latitude,height:null!==(e=this.options.height)&&void 0!==e?e:this.center.height}}calculateFromTankParams(){return Mt(this,arguments,void 0,(function*(t=false){var i,e,s;const o=this.options;if(o.gasType&&o.holeDiameter)try{const n=this.options.calculatedRadii,a={tankPressure:o.tankPressure,tankTemperature:o.tankTemperature,liquidLevel:o.liquidLevel,orificeHeight:o.orificeHeight,holeDiameter:o.holeDiameter,gasType:o.gasType,windSpeed:o.windSpeed,stability:o.stability,releaseHeight:null!==(i=o.releaseHeight)&&void 0!==i?i:In.releaseHeight,dischargeCoefficient:o.dischargeCoefficient,pressureMode:o.pressureMode},r=yield pn(a);if(!r.success)return;this.options.autoCalculated=!0,this.options.calculatedLeakRate=r.leakResult.leakRate,this.options.normalizedTankPressure=r.normalizedTankPressure,this.options.calculationModel=r.modelUsed,this.options.storageModel=r.storageModel,this.options.sourceRegime=r.sourceRegime,this.options.submergedDepth=r.submergedDepth,this.options.isSubmergedOrifice=(null!==(e=r.submergedDepth)&&void 0!==e?e:0)>0,this.options.diagnostics=r.diagnostics,this.options.holeSeverity=Tn(o.holeDiameter),this.options.calculatedRadii=r.impactRadii,this.options.calculationDiagnosis=Ln(this.options,r);const l=null!==(s=o.releaseTime)&&void 0!==s?s:In.releaseTime,h=r.leakResult.leakRate*l;(t||wn(o.totalLeak,In.totalLeak))&&(this.options.totalLeak=h),(t||wn(o.lethalRadius,In.lethalRadius,null==n?void 0:n.lethalRadius))&&(this.options.lethalRadius=r.impactRadii.lethalRadius),(t||wn(o.idlhRadius,In.idlhRadius,null==n?void 0:n.idlhRadius))&&(this.options.idlhRadius=r.impactRadii.idlhRadius),(t||wn(o.warningRadius,In.warningRadius,null==n?void 0:n.warningRadius))&&(this.options.warningRadius=r.impactRadii.warningRadius),this.targetRadii={lethal:this.options.lethalRadius,idlh:this.options.idlhRadius,warning:this.options.warningRadius};}catch(t){}}))}syncZoneRadii(){this.zoneIds.warning&&(this.updateZone(this.zoneIds.warning,{radius:Math.max(this.options.warningRadius,1)}),this.updateZoneLabel(0,this.options.warningRadius)),this.zoneIds.idlh&&(this.updateZone(this.zoneIds.idlh,{radius:Math.max(this.options.idlhRadius,1)}),this.updateZoneLabel(1,this.options.idlhRadius)),this.zoneIds.lethal&&(this.updateZone(this.zoneIds.lethal,{radius:Math.max(this.options.lethalRadius,1)}),this.updateZoneLabel(2,this.options.lethalRadius));}getZoneDefinitions(t=1){return [{label:"\u9884\u8b66\u533a",radius:t,color:this.options.warningColor,opacity:.25,gradient:.75},{label:"IDLH\u533a",radius:t,color:this.options.idlhColor,opacity:.35,gradient:.75},{label:"\u81f4\u6b7b\u6d53\u5ea6\u533a",radius:t,color:this.options.lethalColor,opacity:.45,gradient:.75}]}syncVisualState(){this.syncZoneRadii(),this.particleSystem&&this.particleSystem.update(Fn(this.options));}addParticleSystem(t,i){var e;this.particleSystem&&this.particleSystem.clear(),this.particleSystem=new Ys(this.viewer,{}),this.particleSystem.add(Object.assign({longitude:t.longitude,latitude:t.latitude,height:t.height,image:"/cesium-assets/SampleData/smoke.png",startColor:"#d8de8a",startColorAlpha:.35,endColor:"#f4f1b4",endColorAlpha:.03,sizeInMeters:true,updateCallback:(e=this.windParams,(t,i)=>{const s=Math.sin(e.directionRad)*e.speed*1.2,o=Math.cos(e.directionRad)*e.speed*1.2,n=Math.min(1,2.5*i),a=.6*i;t.velocity.x+=(s-t.velocity.x)*n,t.velocity.y+=(o-t.velocity.y)*n,t.velocity.z=_n(t.velocity.z+.35*i+(Math.random()-.5)*a*.35,0,1.2),t.velocity.x+=(Math.random()-.5)*a,t.velocity.y+=(Math.random()-.5)*a;})},Fn(i)));}add(){return Mt(this,arguments,void 0,(function*(t={}){this.clear();const i=Object.assign(Object.assign(Object.assign({},In),this.options),t);this.options=i,this.windParams.speed=i.windSpeed,this.windParams.directionRad=ho(i.windDirection),i.gasType&&i.holeDiameter&&!i.autoCalculated&&(yield this.calculateFromTankParams()),this.sourceCenter=this.getDisplayCenter();const e=this.sourceCenter;this.targetRadii={lethal:this.options.lethalRadius,idlh:this.options.idlhRadius,warning:this.options.warningRadius},yield this.addZones(e,this.getZoneDefinitions());const s=Array.from(this.zones.keys());this.zoneIds.warning=s[0]||"",this.zoneIds.idlh=s[1]||"",this.zoneIds.lethal=s[2]||"",this.options.showParticle&&this.addParticleSystem(e,this.options),this.startAnimation(this.options.animationDuration);}))}startAnimation(t){if(this.stopAnimation(),0>=t)return void this.syncZoneRadii();const i=Date.now();this.animationTimer=setInterval((()=>{const e=Date.now()-i,s=Math.min(e/t,1),o=1-(1-s)*(1-s),n=Math.max(1,this.targetRadii.lethal*o),a=Math.max(1,this.targetRadii.idlh*o),r=Math.max(1,this.targetRadii.warning*o);this.updateZone(this.zoneIds.lethal,{radius:n}),this.updateZoneLabel(2,this.targetRadii.lethal*o),this.updateZone(this.zoneIds.idlh,{radius:a}),this.updateZoneLabel(1,this.targetRadii.idlh*o),this.updateZone(this.zoneIds.warning,{radius:r}),this.updateZoneLabel(0,this.targetRadii.warning*o),1>s||(this.syncZoneRadii(),this.stopAnimation());}),50);}stopAnimation(){this.animationTimer&&(clearInterval(this.animationTimer),this.animationTimer=null);}update(t,i={}){const e=void 0!==t.tankPressure||void 0!==t.tankTemperature||void 0!==t.liquidLevel||void 0!==t.orificeHeight||void 0!==t.holeDiameter||void 0!==t.gasType||void 0!==t.dischargeCoefficient||void 0!==t.pressureMode||void 0!==t.releaseHeight,s=void 0!==t.windSpeed||void 0!==t.windDirection||void 0!==t.lethalRadius||void 0!==t.idlhRadius||void 0!==t.warningRadius||void 0!==t.emissionRate||void 0!==t.particleLife||void 0!==t.particleScale||void 0!==t.animationDuration,o=Object.assign(Object.assign({},this.options),t);if(void 0!==t.windSpeed&&(this.windParams.speed=o.windSpeed),void 0!==t.windDirection&&(this.windParams.directionRad=ho(o.windDirection)),void 0!==t.lethalRadius&&(this.targetRadii.lethal=t.lethalRadius,this.updateZone(this.zoneIds.lethal,{radius:t.lethalRadius}),this.updateZoneLabel(2,t.lethalRadius)),void 0!==t.idlhRadius&&(this.targetRadii.idlh=t.idlhRadius,this.updateZone(this.zoneIds.idlh,{radius:t.idlhRadius}),this.updateZoneLabel(1,t.idlhRadius)),void 0!==t.warningRadius&&(this.targetRadii.warning=t.warningRadius,this.updateZone(this.zoneIds.warning,{radius:t.warningRadius}),this.updateZoneLabel(0,t.warningRadius)),void 0!==t.lethalColor&&this.updateZoneColor(2,t.lethalColor),void 0!==t.idlhColor&&this.updateZoneColor(1,t.idlhColor),void 0!==t.warningColor&&this.updateZoneColor(0,t.warningColor),void 0!==t.animationDuration&&this.startAnimation(t.animationDuration),void 0!==t.show&&this.setVisible(t.show),void 0!==t.showParticle&&t.showParticle&&this.sourceCenter&&this.addParticleSystem(this.sourceCenter,o),s&&this.particleSystem&&this.particleSystem.update(Fn(o)),void 0===t.show&&void 0===t.showParticle||!this.particleSystem||this.particleSystem.update({show:false!==o.show&&false!==o.showParticle}),this.options=o,e&&this.options.gasType&&this.options.holeDiameter){const e=i.forceCalculatedRadii||void 0!==t.gasType;this.options.autoCalculated=false,this.calculateFromTankParams(e).then((()=>{this.syncVisualState();})).catch((t=>{}));}}applyTimeState(t){const i=bn(t),e=i?Sn(t):t;this.update(e,{forceCalculatedRadii:i});}clear(){this.stopAnimation(),this.particleSystem&&(this.particleSystem.clear(),this.particleSystem=null),super.clear();}dispose(){this.stopAnimation(),this.particleSystem&&(this.particleSystem.dispose(),this.particleSystem=null),super.dispose();}}const Hn=["fire","heatRadiation","shockwave","projectile","accidentAnalysis","gasContinuousDiffusion","jetDiffusion","gasInstantDiffusion","adiabaticDiffusion","vaporCloudExplosion","jetFire","poolFire","solidFlame"];class Vn{constructor(t,i){this.records=new Map,this.activeIds=new Map,this.counters=new Map,this.viewer=t,this.operator=i;for(const t of Hn)this.records.set(t,new Map),this.counters.set(t,0);}getStore(t){var i;return null!==(i=this.records.get(t))&&void 0!==i?i:new Map}setStore(t,i){this.records.set(t,i);}generateId(t){var i;const e=(null!==(i=this.counters.get(t))&&void 0!==i?i:0)+1;return this.counters.set(t,e),`${t}-${e}`}getResolvedId(t,i){return null!=i?i:this.activeIds.get(t)}resolveRecord(t,i){const e=this.getResolvedId(t,i);if(e)return this.getStore(t).get(e)}createInstance(t,i){switch(t){case "fire":return new to(this.viewer,i);case "heatRadiation":return new lo(this.viewer,this.operator,i);case "shockwave":return new bo(this.viewer,this.operator,i);case "projectile":return new wo(this.viewer,this.operator,i);case "accidentAnalysis":return new qs(this.viewer,this.operator,i);case "gasContinuousDiffusion":return new An(this.viewer,this.operator,i);case "jetDiffusion":return new Mn(this.viewer,this.operator,i);case "gasInstantDiffusion":return new zn(this.viewer,this.operator,i);case "adiabaticDiffusion":return new kn(this.viewer,this.operator,i);case "vaporCloudExplosion":return new No(this.viewer,this.operator,i);case "jetFire":return new po(this.viewer,this.operator,i);case "poolFire":return new fo(this.viewer,this.operator,i);case "solidFlame":return new Lo(this.viewer,this.operator,i);default:throw Error("Unsupported simulation type: "+t)}}runCreate(t,i,e){return Mt(this,void 0,void 0,(function*(){"accidentAnalysis"!==t?yield Promise.resolve(i.add(e)):yield Promise.resolve(i.analyze(e));}))}runUpdate(t,i,e){return "accidentAnalysis"===t?i.analyze(e):"function"==typeof i.update?i.update(e):void 0}getFallbackActiveId(t){const i=Array.from(this.getStore(t).keys());return i.length>0?i[i.length-1]:void 0}create(t,i){return Mt(this,arguments,void 0,(function*(t,i,e={}){var s,o,n;const a=null!==(s=e.id)&&void 0!==s?s:this.generateId(t),r=null===(o=e.activate)||void 0===o||o,l=this.getStore(t);l.has(a)&&this.remove(t,a);const h=this.createInstance(t,i),d=Date.now(),c={id:a,type:t,instance:h,options:Object.assign({},i),createdAt:d,updatedAt:d};try{return yield this.runCreate(t,h,i),l.set(a,c),this.setStore(t,l),r&&this.activeIds.set(t,a),a}catch(t){throw null===(n=null==h?void 0:h.dispose)||void 0===n||n.call(h),t}}))}get(t,i){return this.resolveRecord(t,i)}getInstance(t,i){var e;return null===(e=this.resolveRecord(t,i))||void 0===e?void 0:e.instance}list(t){return t?Array.from(this.getStore(t).values()):Hn.flatMap((t=>Array.from(this.getStore(t).values())))}has(t,i){return !!this.resolveRecord(t,i)}setActive(t,i){this.getStore(t).has(i)&&this.activeIds.set(t,i);}update(t,i,e){const s=this.resolveRecord(t,e);if(s)return s.options=Object.assign(Object.assign({},s.options),i),s.updatedAt=Date.now(),this.runUpdate(t,s.instance,s.options)}remove(t,i){var e,s;const o=this.getResolvedId(t,i);if(!o)return;const n=this.getStore(t),a=n.get(o);if(a&&(null===(s=null===(e=a.instance)||void 0===e?void 0:e.dispose)||void 0===s||s.call(e),n.delete(o),this.setStore(t,n),this.activeIds.get(t)===o)){const i=this.getFallbackActiveId(t);i?this.activeIds.set(t,i):this.activeIds.delete(t);}}clear(t){if(t){for(const i of Array.from(this.getStore(t).keys()))this.remove(t,i);this.counters.set(t,0);}else for(const t of Hn)this.clear(t);}getCalculationResult(t,i){var e,s,o,n,a,r,l,h,d,c,u,p,m,g,f;const v=this.getInstance(t,i);return v?"vaporCloudExplosion"===t?null!==(s=null===(e=v.options)||void 0===e?void 0:e.calculationResult)&&void 0!==s?s:null:{autoCalculated:null===(o=v.options)||void 0===o?void 0:o.autoCalculated,calculatedLeakRate:null===(n=v.options)||void 0===n?void 0:n.calculatedLeakRate,calculatedRadii:null===(a=v.options)||void 0===a?void 0:a.calculatedRadii,calculationModel:null===(r=v.options)||void 0===r?void 0:r.calculationModel,pressureMode:null===(l=v.options)||void 0===l?void 0:l.pressureMode,normalizedTankPressure:null===(h=v.options)||void 0===h?void 0:h.normalizedTankPressure,storageModel:null===(d=v.options)||void 0===d?void 0:d.storageModel,sourceRegime:null===(c=v.options)||void 0===c?void 0:c.sourceRegime,submergedDepth:null===(u=v.options)||void 0===u?void 0:u.submergedDepth,isSubmergedOrifice:null===(p=v.options)||void 0===p?void 0:p.isSubmergedOrifice,diagnostics:null===(m=v.options)||void 0===m?void 0:m.diagnostics,holeSeverity:null===(g=v.options)||void 0===g?void 0:g.holeSeverity,calculationDiagnosis:null===(f=v.options)||void 0===f?void 0:f.calculationDiagnosis}:null}}class Wn extends vs{constructor(t){super(t),this.tilesMap=new Map,this.highlightManager=null,this.enableTerrain=false,this.has3DTiles=false,this._globalTileLoadHandler=null,this._globalTerrainUpdateTimer=null,this.heatmapSim=null,this.viewshedMap=new Map,this._viewshedCounter=0,this.showOpeningAnimationed=false,this.eventManager=new Rt(this),this.parsingGeojsonTools=new ti(this.viewer),this.simulationManager=new Vn(this.viewer,this);}init(){const t=Object.create(null,{init:{get:()=>super.init}});return Mt(this,void 0,void 0,(function*(){const{fog:i}=this.params.config;yield t.init.call(this),this.HFImageryLayersManager=new ze(this.viewer),this.params.config.imageryLayerType&&(this.params.config.offlineLayerUrl?this.HFImageryLayersManager.changeImageLayer(this.params.config.imageryLayerType,this.params.config.offlineLayerUrl):this.HFImageryLayersManager.changeImageLayer(this.params.config.imageryLayerType)),this.params.config.imageryAnnotationLayer&&this.HFImageryLayersManager.addTDTCLayer(),void 0!==i&&this.setFog("all",i),this.params.config.enableTerrain&&(this.enable3DTerrain(true),this.viewer.scene.primitives.add(createOsmBuildings())),this.initTools(),this.initMapLayer(),this.aroundView=new He(this.viewer,.2),this.highlightManager=new bs,this.showAnimation();}))}showAnimation(){this.setView("home");}dispose(){var t,i,e,s,o,n,a,r,l,h;window.CESIUM_BASE_URL=null,null===(t=this.HFImageryLayersManager)||void 0===t||t.dispose(),null===(i=this.measureArea)||void 0===i||i.clear(),null===(e=this.measureDistance)||void 0===e||e.clear(),null===(s=this.measureHeight)||void 0===s||s.clear(),null===(o=this.measurePoint)||void 0===o||o.clear(),this._stopGlobalTerrainWatching(),null===(n=this.drawTools)||void 0===n||n.dispose(),null===(a=this.eventManager)||void 0===a||a.dispose(),null===(r=this.simulationManager)||void 0===r||r.clear(),this.disposeHeatmap(),this.disposeAllViewsheds(),this.clear();this.scene.canvas.getContext("webgl");null===(l=this.viewer)||void 0===l||l.destroy(),this.container&&(null===(h=this.container.parentNode)||void 0===h||h.removeChild(this.container));}changeImageLayer(t,i,e=true){if(this.HFImageryLayersManager){let s=this.HFImageryLayersManager.changeImageLayer(t,i);s&&(s.show=e);}}changeBaseMapColor(t){this.HFImageryLayersManager&&this.HFImageryLayersManager.changeBaseMapColor(t);}showLayer(t,i=true){switch(t){case "basic":case "\u5e95\u56fe":let t=this.viewer.imageryLayers.get(0);t&&(t.show=i);break;case "terrain":case "\u5730\u5f62":this.enable3DTerrain(i);}}computeModelMatrix(t,i=[0,0,0],e=[1,1,1]){let s=Cartesian3.fromDegrees(t[0],t[1],t[2]),n=Matrix4.fromRotationTranslation(Matrix3.fromRotationX(Math$1.toRadians(i[0]))),a=Matrix4.fromRotationTranslation(Matrix3.fromRotationY(Math$1.toRadians(i[1]))),l=Matrix4.fromRotationTranslation(Matrix3.fromRotationZ(Math$1.toRadians(i[2]))),h=Transforms.eastNorthUpToFixedFrame(s);Matrix4.multiply(h,n,h),Matrix4.multiply(h,a,h),Matrix4.multiply(h,l,h);let d=Matrix4.fromScale(new Cartesian3(...e));return Matrix4.multiply(h,d,new Matrix4)}enable3DTerrain(t){var i,e,s,o;if(this.enableTerrain=t,t){const t=(null===(i=this.params.config)||void 0===i?void 0:i.terrainUrl)||"https://data.marsgis.cn/terrain";let e=new CesiumTerrainProvider({url:t,requestVertexNormals:true});this.viewer.terrainProvider=e,this._startGlobalTerrainWatching();}else this._stopGlobalTerrainWatching(),this.viewer.terrainProvider=new EllipsoidTerrainProvider({}),this.tilesMap.size>0&&this.tilesMap.forEach(((t,i)=>{var e,s;(null==t?void 0:t.tileset)&&!(null===(s=(e=t.tileset).isDestroyed)||void 0===s?void 0:s.call(e))&&(t.tileset.show=true);}));this.parsingGeojsonTools&&this.parsingGeojsonTools.refreshAllDataSources(),this.syncDrawToolsTerrainMode(t),null===(o=null===(s=null===(e=this.viewer)||void 0===e?void 0:e.scene)||void 0===s?void 0:s.requestRender)||void 0===o||o.call(s);}syncDrawToolsTerrainMode(t){var i;const e=null===(i=this.drawTools)||void 0===i?void 0:i.getEntitys();e&&0!==e.length&&e.forEach((i=>{try{if(!i||!i.options||!i.update)return;if(t)try{i.update({clampToTerrain:!0});}catch(t){}else if(this.has3DTiles){const t=i.options.center;i.update({clampToTerrain:!1,center:Array.isArray(t)&&t.length>=2?[t[0],t[1],.1]:t});try{"function"==typeof i.refreshWallHeightsAndCenter?(i.options.clampToTerrain=!0,i.refreshWallHeightsAndCenter().then((()=>{})).catch((t=>{var e,s,o,n;i.options.clampToTerrain=!1,i.options._terrainHeights=null,null===(e=i._setCenterHeightForFlatMode)||void 0===e||e.call(i),null===(n=null===(o=null===(s=this.viewer)||void 0===s?void 0:s.scene)||void 0===o?void 0:o.requestRender)||void 0===n||n.call(o);}))):"function"==typeof i.refreshCenterHeightFromSceneOrTerrain&&i.refreshCenterHeightFromSceneOrTerrain().catch((t=>{}));}catch(t){}}else {const t=i.options.center;if(Array.isArray(t)&&t.length>=2){i.update({clampToTerrain:!1,center:[t[0],t[1],.1]});}}}catch(t){}}));}_startGlobalTerrainWatching(){var t,i;if(this._globalTileLoadHandler)return;let e=0;this._globalTileLoadHandler=t=>{if(0!==t)return;3e3>Date.now()-e||(clearTimeout(this._globalTerrainUpdateTimer),this._globalTerrainUpdateTimer=setTimeout((()=>{e=Date.now(),this._batchRefreshTerrainEntities();}),1e3));},(null===(i=null===(t=this.viewer)||void 0===t?void 0:t.scene)||void 0===i?void 0:i.globe)&&this.viewer.scene.globe.tileLoadProgressEvent.addEventListener(this._globalTileLoadHandler);}_stopGlobalTerrainWatching(){var t,i,e,s;this._globalTileLoadHandler&&(null===(s=null===(e=null===(i=null===(t=this.viewer)||void 0===t?void 0:t.scene)||void 0===i?void 0:i.globe)||void 0===e?void 0:e.tileLoadProgressEvent)||void 0===s||s.removeEventListener(this._globalTileLoadHandler),this._globalTileLoadHandler=null),clearTimeout(this._globalTerrainUpdateTimer),this._globalTerrainUpdateTimer=null;}_batchRefreshTerrainEntities(){var t;const i=null===(t=this.drawTools)||void 0===t?void 0:t.getEntitys();i&&0!==i.length&&(i.forEach((t=>{var i;if(null===(i=null==t?void 0:t.options)||void 0===i?void 0:i.clampToTerrain)try{"function"==typeof t.refreshWallHeightsAndCenter?t.refreshWallHeightsAndCenter().catch((t=>{})):"function"==typeof t.refreshCenterHeightFromSceneOrTerrain&&t.refreshCenterHeightFromSceneOrTerrain().catch((t=>{}));}catch(t){}})),requestAnimationFrame((()=>{var t,i,e;null===(e=null===(i=null===(t=this.viewer)||void 0===t?void 0:t.scene)||void 0===i?void 0:i.requestRender)||void 0===e||e.call(i);})));}initTools(){var t,i;if(this.measureArea=new It(this.viewer),this.measureDistance=new Ft(this.viewer),this.measureHeight=new zt(this.viewer),this.measurePoint=new Vt(this.viewer),this.drawTools=new se(this.viewer,this.params.config),this.drawTools.rigistOperator(this),this.params.config&&this.params.config.drawEntityConfig){const{datas:e}=this.params.config.drawEntityConfig;e&&e.length&&(null===(t=this.drawTools)||void 0===t||t.setEnable(true),e.forEach((t=>{if(!t.type)return;t.type=t.type.toLowerCase();this.drawEntity(t);})),null===(i=this.drawTools)||void 0===i||i.setEnable(false));}this.params.config&&this.params.config.geojsonConfig&&(this.parsingGeojsonTools=new ti(this.viewer),this.parsingGeojsonTools.parsing(this.params.config.geojsonConfig));}initClusterConfig(){}initMapLayer(){this.mapLayer=new Cs(this.viewer,this.params.config);}addTiles(t){return Mt(this,void 0,void 0,(function*(){const i=new ws(this.viewer,t),e=yield i.init();return i&&this.tilesMap.set(t.id,i),this.has3DTiles=this.tilesMap.size>0,{success:true,data:e,tiles:i}}))}drawTiles(t){return Mt(this,void 0,void 0,(function*(){return yield this.addTiles(t)}))}getTilesById(t){return this.tilesMap.get(t)}getTilesInfo(t){const i=this.tilesMap.get(t);return i?i.getData():null}updateTiles(t,i){const e=this.tilesMap.get(t);e&&e.update(i);}flyToTiles(t){const i=this.tilesMap.get(t);i&&i.flyTo();}removeTiles(t){const i=this.tilesMap.get(t);i&&(i.remove(),this.tilesMap.delete(t),this.has3DTiles=this.tilesMap.size>0);}updateObjectById(t,i){var e,s,o;const n=this.tilesMap.get(t);return n?n.update(i):(null===(e=this.drawTools)||void 0===e?void 0:e.hasEntityById(t))?this.changeDrawType(t,i):(null===(s=this.parsingGeojsonTools)||void 0===s?void 0:s.hasDataSourceById(t))?null===(o=this.parsingGeojsonTools)||void 0===o?void 0:o.updateDataSourceById(t,i):null}deleteObjectById(t){var i;this.updateObjectById(t,{remove:true}),null===(i=this.drawTools)||void 0===i||i.remove(t);}getObjectInfoById(t){var i,e,s;const o=this.tilesMap.get(t);return o?o.getData():(null===(i=this.drawTools)||void 0===i?void 0:i.hasEntityById(t))?this.getDrawTypeInfo(t):(null===(e=this.parsingGeojsonTools)||void 0===e?void 0:e.hasDataSourceById(t))?null===(s=this.parsingGeojsonTools)||void 0===s?void 0:s.getDataSourceInfoById(t):void 0}flyToObjectById(t,i){var e,s,o,n;const a=this.tilesMap.get(t);a?a.flyTo(i):(null===(e=this.drawTools)||void 0===e?void 0:e.hasEntityById(t))?null===(s=this.drawTools)||void 0===s||s.flyTo(t,i):(null===(o=this.parsingGeojsonTools)||void 0===o?void 0:o.hasDataSourceById(t))&&(null===(n=this.parsingGeojsonTools)||void 0===n||n.flyToDataSourceById(t));}enableRoamFollow(t=false){}enableFirstView(t=false){}checkHas3DTiles(){return this.has3DTiles}getContainerParent(){return this.container||null}controlCamera(t=true){var i,e;const s=null===(e=null===(i=this.viewer)||void 0===i?void 0:i.scene)||void 0===e?void 0:e.screenSpaceCameraController;s&&(s.enableInputs=t,s.enableRotate=t,s.enableTranslate=t,s.enableZoom=t,s.enableTilt=t,s.enableLook=t);}startRoam(){}enableAroundViewer(t){this.aroundView&&t&&this.aroundView.start();}setView(t,i){const e=t.toLowerCase();if(this.params.config.viewConfig){const t=this.params.config.viewConfig[e];t&&this.flyTo(t,(()=>{i&&i();}));}}enableDraw(t=true){var i;t||this.stopDraw(),null===(i=this.drawTools)||void 0===i||i.setEnable(t);}drawEnd(){var t;null===(t=this.drawTools)||void 0===t||t.drawEnd();}drawEntity(t){return Mt(this,void 0,void 0,(function*(){var i,e,s;null===(i=this.drawTools)||void 0===i||i.setEnable(true);let o=[];if(t&&t.length)t.forEach((t=>Mt(this,void 0,void 0,(function*(){var i;if(!t.type)return;t.type=t.type.toLowerCase();const e=yield null===(i=this.drawTools)||void 0===i?void 0:i.drawEntity(t);o.push(e);}))));else {if(!t.type)return;t.type=t.type.toLowerCase();const i=yield null===(e=this.drawTools)||void 0===e?void 0:e.drawEntity(t);o.push(i);}return null===(s=this.drawTools)||void 0===s||s.setEnable(false),o}))}deleteDrawEntity(t){var i,e;const s=null===(i=this.drawTools)||void 0===i?void 0:i.getEntityById(t);s&&s.remove(),null===(e=this.drawTools)||void 0===e||e.remove(t);}setDrawType(t,i={}){var e;null===(e=this.drawTools)||void 0===e||e.active(t,i);}stopDraw(){var t;null===(t=this.drawTools)||void 0===t||t.stop();}changeDrawType(t,i){var e;return null===(e=this.drawTools)||void 0===e?void 0:e.change(t,i)}hasEntity(t){return this.hasEntityById(t)}hasEntityById(t){var i;return null===(i=this.drawTools)||void 0===i?void 0:i.hasEntityById(t)}getEntityById(t){var i;return null===(i=this.drawTools)||void 0===i?void 0:i.getEntityById(t)}getEntitys(){var t;return null===(t=this.drawTools)||void 0===t?void 0:t.getEntitys()}updateDrawTypeCenter(t,i){var e;return null===(e=this.drawTools)||void 0===e?void 0:e.updateDrawTypeCenter(t,i)}getDrawTypeInfo(t){var i;return null===(i=this.drawTools)||void 0===i?void 0:i.getEntityInfoById(t)}removeDraw(t){var i;null===(i=this.drawTools)||void 0===i||i.remove(t);}clearDraw(){var t;null===(t=this.drawTools)||void 0===t||t.clearAll();}toggleAnimation(t){var i;null===(i=this.drawTools)||void 0===i||i.toggleAnimation(t);}enableEdit(t){var i;null===(i=this.drawTools)||void 0===i||i.enableEdit(t);}enableDrag(t){var i;null===(i=this.drawTools)||void 0===i||i.enableDrag(t);}hasDragControl(){var t,i;return null===(i=null===(t=this.drawTools)||void 0===t?void 0:t.entityEdit)||void 0===i?void 0:i.dragControl}handleDragControlClick(t){var i,e;return null===(e=null===(i=this.drawTools)||void 0===i?void 0:i.entityEdit)||void 0===e?void 0:e.handleDragControlClick(t.entity)}clearDragControlClick(){var t,i;null===(i=null===(t=this.drawTools)||void 0===t?void 0:t.entityEdit)||void 0===i||i.clearDragControlClick();}registDrawEndCallback(t){var i;null===(i=this.drawTools)||void 0===i||i.drawEndCallback(t);}clearDrawEndCallback(){var t;null===(t=this.drawTools)||void 0===t||t.clearDrawEndCallback();}getDrawData(t){var i;return null===(i=this.drawTools)||void 0===i?void 0:i.getDrawData(t)}registClickCallback(t){var i;null===(i=this.eventManager)||void 0===i||i.setClickCallBack(t);}registVertexRightClickCallback(t){var i,e;null===(e=null===(i=this.drawTools)||void 0===i?void 0:i.entityEdit)||void 0===e||e.onVertexRightClick(t);}setFog(t,i){if("all"===(t=t.toLowerCase()))for(const t in i)(Object.prototype.hasOwnProperty.call(i,t)||this.viewer.scene.fog.hasOwnProperty(t))&&(this.viewer.scene.fog[t]=i[t]);else this.viewer.scene.fog.hasOwnProperty(t)&&(this.viewer.scene.fog[t]=i);}setEntityCluster(t,i=true){}focusToEntityById(t,i={}){var e;if(t){const{height:s=300,hpr:o=[0,-45,300]}=i,n=this.viewer.entities.getById(t);if(n){let t=null===(e=n.position)||void 0===e?void 0:e.getValue(this.viewer.clock.currentTime);t&&s&&(t=new Cartesian3(t.x,t.y,s||t.z)),t?this.viewer.camera.lookAt(t,new HeadingPitchRange(o[0],o[1],o[2])):n.userData&&n.userData.center?this.viewer.camera.lookAt(Cartesian3.fromDegrees(n.userData.center[0],n.userData.center[1],s||n.userData.center[2]),new HeadingPitchRange(o[0],o[1],o[2])):this.viewer.zoomTo(n,new HeadingPitchRange(o[0],o[1],o[2]));}}else this.viewer.camera.lookAtTransform(Matrix4.IDENTITY);}focusToLonLat(t,i=[0,-45,100]){t&&t.length?this.viewer.camera.lookAt(Cartesian3.fromDegrees(t[0],t[1],t[2]||300),new HeadingPitchRange(i[0],i[1],i[2])):this.viewer.camera.lookAtTransform(Matrix4.IDENTITY);}startRender(t){this.viewer.scene.requestRenderMode=t;}parseKML(t){return Mt(this,arguments,void 0,(function*(t,i={}){return yield oe(this.viewer,t,i)}))}parseGeoJson(t){return Mt(this,arguments,void 0,(function*(t,i={}){var e;return yield null===(e=this.parsingGeojsonTools)||void 0===e?void 0:e.parseGeoJson(t,i)}))}_recordHighlight(t,i=false){this.highlightManager&&this.highlightManager.add(t,i);}_unRecordHighlight(t){this.highlightManager&&this.highlightManager.remove(t);}_getHighlight(t){if(this.highlightManager)return this.highlightManager.get(t)}_clearHighlight(){this.highlightManager&&this.highlightManager.clear();}_hasHighlight(t){return !!this.highlightManager&&this.highlightManager.has(t)}addEvacuationTarget(t){return Mt(this,void 0,void 0,(function*(){this.evacuationRouteSimulation||(this.evacuationRouteSimulation=new Es(this)),yield this.evacuationRouteSimulation.addTarget(t);}))}addEvacuationLine(t){return Mt(this,void 0,void 0,(function*(){this.evacuationRouteSimulation||(this.evacuationRouteSimulation=new Es(this)),yield this.evacuationRouteSimulation.addLine(t);}))}simulateEvacuationRoute(){this.evacuationRouteSimulation&&this.evacuationRouteSimulation.simulate();}updateSimulation(t){this.evacuationRouteSimulation&&this.evacuationRouteSimulation.updateSimulation(t);}resumeAutoFollow(){this.evacuationRouteSimulation&&this.evacuationRouteSimulation.resumeAutoFollow();}pauseAutoFollow(){this.evacuationRouteSimulation&&this.evacuationRouteSimulation.pauseAutoFollow();}clearAllEvacuationRoute(){this.evacuationRouteSimulation&&this.evacuationRouteSimulation.clearAllRoutes();}addWindSimulation(t={}){this.windSimulation||(this.windSimulation=new Vs(this.viewer)),this.windSimulation.remove(),this.windSimulation.init(t);}updateWindSimulation(t){this.windSimulation&&this.windSimulation.updateOptions(t);}showWindSimulation(){this.windSimulation&&this.windSimulation.show();}hideWindSimulation(){this.windSimulation&&this.windSimulation.hide();}pauseWindSimulation(){this.windSimulation&&this.windSimulation.pause();}resumeWindSimulation(){this.windSimulation&&this.windSimulation.resume();}disposeWindSimulation(){this.windSimulation&&(this.windSimulation.dispose(),this.windSimulation=null);}showHeatmap(t){this.heatmapSim||(this.heatmapSim=new js(this.viewer,this,t)),this.heatmapSim.show(t);}updateHeatmap(t){var i;null===(i=this.heatmapSim)||void 0===i||i.update(t);}disposeHeatmap(){this.heatmapSim&&(this.heatmapSim.dispose(),this.heatmapSim=null);}addViewshed(t){return Mt(this,void 0,void 0,(function*(){const i=t.name||"viewShed - "+ ++this._viewshedCounter,e=new Zs(this.viewer,this,Object.assign(Object.assign({},t),{name:i})),s=this.viewshedMap.get(e.id);return s&&s.dispose(),yield e.show(t),this.viewshedMap.set(e.id,e),e.id}))}updateViewshed(t,i){return Mt(this,void 0,void 0,(function*(){var e;yield null===(e=this.viewshedMap.get(t))||void 0===e?void 0:e.update(i);}))}removeViewshed(t){const i=this.viewshedMap.get(t);i&&(i.dispose(),this.viewshedMap.delete(t));}disposeAllViewsheds(){this.viewshedMap.forEach((t=>t.dispose())),this.viewshedMap.clear(),this._viewshedCounter=0;}getViewshedData(){return {type:"graphic",show:true,data:Array.from(this.viewshedMap.values()).map((t=>t.getData()))}}importViewshedData(t){return Mt(this,void 0,void 0,(function*(){var i,e,s,o,n,a;const r=t.data||t,l=Array.isArray(r)?r:[r];for(const t of l)yield this.addViewshed({id:t.id,name:null===(i=t.attr)||void 0===i?void 0:i.name,longitude:t.position[0],latitude:t.position[1],height:(t.position[2]||0)+((null===(e=t.style)||void 0===e?void 0:e.addHeight)||0),radius:(null===(s=t.style)||void 0===s?void 0:s.distance)||500,heading:(null===(o=t.style)||void 0===o?void 0:o.heading)||0,fov:(null===(n=t.style)||void 0===n?void 0:n.angle)||120,opacity:(null===(a=t.style)||void 0===a?void 0:a.opacity)||.5});}))}}Wn.CustomInfoWindow=class{constructor(t){this.parentPosition={x:0,y:0},this.initOption={name:"info",offset:{x:0,y:0},opacity:1,innerHTML:"",component:null,zIndex:"",placement:"top"},this.showed=true,this.option=Object.assign(Object.assign({},this.initOption),t);}_setOption(t){}_addTo(t){}_setInstance(){}getInstance(){return this.instance}_setPosition(t){}_update(){}isShowed(){return this.showed}_show(){this.showed=true,this._update();}_hide(){this.showed=false,this._update();}_remove(){var t;this.viewer=null,this.option=null,this.initOption=null,null===(t=this.instance)||void 0===t||t.remove();}};class Gn{get CustomInfoWindow(){return this.operator.constructor.CustomInfoWindow}constructor(t){this.params=t,this.operator=new Wn(t);}init(){return Mt(this,void 0,void 0,(function*(){yield this.operator.init();}))}dispose(){this.operator.dispose();}getContainerParent(){var t,i;return null!==(i=null===(t=this.operator)||void 0===t?void 0:t.getContainerParent())&&void 0!==i?i:null}checkHas3DTiles(){return this.operator.checkHas3DTiles()}getCameraInfo(){return this.operator.getCameraInfo()}getViewInfo(){return this.operator.getViewInfo()}getWindowCoordinates(t){return this.operator.getWindowCoordinates(t)}setView(t,i){this.operator.setView(t,i);}focusToEntityById(t,i={}){return this.operator.focusToEntityById(t,i)}focusToLonLat(t,i){return this.operator.focusToLonLat(t,i)}enableAroundViewer(t){this.operator.enableAroundViewer(t);}flyto(t,i){this.operator.flyTo(t,i);}flyToObjectById(t,i){this.operator.flyToObjectById(t,i);}registCustomInfowindow(t){t&&(this.operator.customInfoWindow="function"==typeof t?t:t.constructor);}hasEntity(t){return this.operator.hasEntity(t)}hasEntityById(t){return this.operator.hasEntityById(t)}getEntityById(t){return this.operator.getEntityById(t)}getEntitys(){return this.operator.getEntitys()}changeImageLayer(t,i,e=true){return this.operator.changeImageLayer(t,i,e)}changeBaseMapColor(t){return this.operator.changeBaseMapColor(t)}showLayer(t,i=true){return this.operator.showLayer(t,i)}enable3DTerrain(t){return this.operator.enable3DTerrain(t)}addMapLayer(t,i){var e;return null===(e=this.operator.mapLayer)||void 0===e?void 0:e.add(t,i)}enableDraw(t=true){this.operator.enableDraw(t);}drawEnd(){this.operator.drawEnd();}drawEntity(t){return Mt(this,void 0,void 0,(function*(){return yield this.operator.drawEntity(t)}))}deleteDrawEntity(t){return this.operator.deleteDrawEntity(t)}setDrawType(t,i){this.operator.setDrawType(t,i);}stopDraw(){this.operator.stopDraw();}changeDrawType(t,i){return this.operator.changeDrawType(t,i)}getDrawTypeInfo(t){return this.operator.getDrawTypeInfo(t)}getDrawData(t){var i;return null===(i=this.operator)||void 0===i?void 0:i.getDrawData(t)}clearDraw(){this.operator.clearDraw();}toggleAnimation(t){this.operator.toggleAnimation(t);}updateObjectById(t,i){return this.operator.updateObjectById(t,i)}deleteObjectById(t){return this.operator.deleteObjectById(t)}getObjectInfoById(t){return this.operator.getObjectInfoById(t)}updateDrawTypeCenter(t,i){return this.operator.updateDrawTypeCenter(t,i)}enableEdit(t){this.operator.enableEdit(t);}enableDrag(t){this.operator.enableDrag(t);}handleDragControlClick(t){return this.operator.handleDragControlClick(t)}clearDragControlClick(){this.operator.clearDragControlClick();}registDrawEndCallback(t){this.operator.registDrawEndCallback(t);}registVertexRightClickCallback(t){this.operator.registVertexRightClickCallback(t);}clearDrawEndCallback(){this.operator.clearDrawEndCallback();}registClickCallback(t){this.operator.registClickCallback(t);}clearClickCallBack(){this.operator.eventManager.clearClickCallBack();}registEventHandlerCallback(t){return this.operator.eventManager.registEventHandlerCallback(t)}clearRegistEventHandler(){this.operator.eventManager.clearRegistEventHandler();}registOnDragCallback(t){var i;null===(i=this.operator.drawTools)||void 0===i||i.onDrag(t);}clearOnDragCallback(){var t;null===(t=this.operator.drawTools)||void 0===t||t.clearDrag();}clearHighlight(){this.operator._clearHighlight();}recordBatchHighlight(t,i=false){var e,s;null===(s=null===(e=this.operator)||void 0===e?void 0:e._recordHighlight)||void 0===s||s.call(e,t,i);}removeDrawObj(t){this.operator.deleteObjectById(t);}setEntityCluster(t,i=true){this.operator.setEntityCluster(t,i);}setFog(t,i){return this.operator.setFog(t,i)}setFogFar(t){}setFogNear(t){}setFogColor(t){}addTiles(t){return Mt(this,void 0,void 0,(function*(){try{return yield this.operator.addTiles(t)}catch(t){return null}}))}updateTiles(t,i){return this.operator.updateTiles(t,i)}getTilesById(t){return this.operator.getTilesById(t)}removeTiles(t){return this.operator.removeTiles(t)}flyToTiles(t){return this.operator.flyToTiles(t)}startRender(t){this.operator.startRender(t);}parseKML(t){return Mt(this,arguments,void 0,(function*(t,i={}){return yield this.operator.parseKML(t,i)}))}parseGeoJson(t){return Mt(this,arguments,void 0,(function*(t,i={}){var e;return yield null===(e=this.operator)||void 0===e?void 0:e.parseGeoJson(t,i)}))}measureAreaEnable(t=false){var i;null===(i=this.operator.measureArea)||void 0===i||i.active({isContinuous:t});}measureDistanceEnable(t=false){var i;null===(i=this.operator.measureDistance)||void 0===i||i.active({isContinuous:t});}measureHeightEnable(t=false){var i;null===(i=this.operator.measureHeight)||void 0===i||i.active({isContinuous:t});}measurePointEnable(t=false){var i;null===(i=this.operator.measurePoint)||void 0===i||i.active({isContinuous:t});}measureAreaClear(){var t;null===(t=this.operator.measureArea)||void 0===t||t.clear();}measureDistanceClear(){var t;null===(t=this.operator.measureDistance)||void 0===t||t.clear();}measureHeightClear(){var t;null===(t=this.operator.measureHeight)||void 0===t||t.clear();}measurePointClear(){var t;null===(t=this.operator.measurePoint)||void 0===t||t.clear();}measureAllClear(){var t,i,e,s;null===(t=this.operator.measureArea)||void 0===t||t.clear(),null===(i=this.operator.measureDistance)||void 0===i||i.clear(),null===(e=this.operator.measureHeight)||void 0===e||e.clear(),null===(s=this.operator.measurePoint)||void 0===s||s.clear();}get eventManager(){return this.operator.eventManager}get simulation(){return this.operator.simulationManager}createManagedSimulation(t,i){return Mt(this,arguments,void 0,(function*(t,i,e=false){if(this.simulation)return e||this.simulation.remove(t),yield this.simulation.create(t,i)}))}updateManagedSimulation(t,i){var e;return null===(e=this.simulation)||void 0===e?void 0:e.update(t,i)}clearManagedSimulation(t){var i;null===(i=this.simulation)||void 0===i||i.remove(t);}clearAllManagedSimulations(t){var i;null===(i=this.simulation)||void 0===i||i.clear(t);}getManagedSimulation(t){var i,e;return null!==(e=null===(i=this.simulation)||void 0===i?void 0:i.getInstance(t))&&void 0!==e?e:null}get viewshedMap(){return this.operator.viewshedMap}get heatRadiationSim(){return this.getManagedSimulation("heatRadiation")}get shockwaveSim(){return this.getManagedSimulation("shockwave")}get projectileSim(){return this.getManagedSimulation("projectile")}get accidentAnalysisSim(){return this.getManagedSimulation("accidentAnalysis")}get gasContinuousSim(){return this.getManagedSimulation("gasContinuousDiffusion")}get jetDiffusionSim(){return this.getManagedSimulation("jetDiffusion")}get gasInstantSim(){return this.getManagedSimulation("gasInstantDiffusion")}get adiabaticSim(){return this.getManagedSimulation("adiabaticDiffusion")}get vaporCloudSim(){return this.getManagedSimulation("vaporCloudExplosion")}get jetFireSim(){return this.getManagedSimulation("jetFire")}get poolFireSim(){return this.getManagedSimulation("poolFire")}get solidFlameSim(){return this.getManagedSimulation("solidFlame")}addEvacuationTarget(t){return Mt(this,void 0,void 0,(function*(){return yield this.operator.addEvacuationTarget(t)}))}addEvacuationLine(t){return Mt(this,void 0,void 0,(function*(){return yield this.operator.addEvacuationLine(t)}))}simulateEvacuationRoute(){this.operator.simulateEvacuationRoute();}updateSimulation(t){this.operator.updateSimulation(t);}clearAllEvacuationRoute(){this.operator.clearAllEvacuationRoute();}addWindSimulation(t={}){this.operator.addWindSimulation(t);}updateWindSimulation(t){this.operator.updateWindSimulation(t);}showWindSimulation(){this.operator.showWindSimulation();}hideWindSimulation(){this.operator.hideWindSimulation();}pauseWindSimulation(){this.operator.pauseWindSimulation();}resumeWindSimulation(){this.operator.resumeWindSimulation();}runFireSimulation(){return Mt(this,arguments,void 0,(function*(t={}){return yield this.createManagedSimulation("fire",t,true)}))}showFireSimulation(t={}){return this.runFireSimulation(t)}updateFireSimulation(t){return this.updateManagedSimulation("fire",t)}stopFireSimulation(){this.clearManagedSimulation("fire");}disposeFireSimulation(){this.clearAllManagedSimulations("fire");}runHeatRadiation(){return Mt(this,arguments,void 0,(function*(t={}){return yield this.createManagedSimulation("heatRadiation",t)}))}showHeatRadiation(t={}){return this.runHeatRadiation(t)}updateHeatRadiation(t){return this.updateManagedSimulation("heatRadiation",t)}clearHeatRadiation(){this.clearManagedSimulation("heatRadiation");}disposeHeatRadiation(){this.clearHeatRadiation();}runShockwave(){return Mt(this,arguments,void 0,(function*(t={}){return yield this.createManagedSimulation("shockwave",t)}))}showShockwave(t={}){return this.runShockwave(t)}updateShockwave(t){return this.updateManagedSimulation("shockwave",t)}clearShockwave(){this.clearManagedSimulation("shockwave");}disposeShockwave(){this.clearShockwave();}runProjectile(){return Mt(this,arguments,void 0,(function*(t={}){return yield this.createManagedSimulation("projectile",t)}))}showProjectile(t={}){return this.runProjectile(t)}updateProjectile(t){return this.updateManagedSimulation("projectile",t)}clearProjectile(){this.clearManagedSimulation("projectile");}disposeProjectile(){this.clearProjectile();}runAccidentAnalysis(){return Mt(this,arguments,void 0,(function*(t={}){return yield this.createManagedSimulation("accidentAnalysis",t)}))}analyzeAccident(t={}){return this.runAccidentAnalysis(t)}clearAccidentAnalysis(){this.clearManagedSimulation("accidentAnalysis");}disposeAccidentAnalysis(){this.clearAccidentAnalysis();}runGasContinuousDiffusion(){return Mt(this,arguments,void 0,(function*(t={}){return yield this.createManagedSimulation("gasContinuousDiffusion",t)}))}showGasContinuousDiffusion(t={}){return this.runGasContinuousDiffusion(t)}updateGasContinuousDiffusion(t){return this.updateManagedSimulation("gasContinuousDiffusion",t)}clearGasContinuousDiffusion(){this.clearManagedSimulation("gasContinuousDiffusion");}disposeGasContinuousDiffusion(){this.clearGasContinuousDiffusion();}runJetDiffusion(){return Mt(this,arguments,void 0,(function*(t={}){return yield this.createManagedSimulation("jetDiffusion",t)}))}showJetDiffusion(t={}){return this.runJetDiffusion(t)}updateJetDiffusion(t){return this.updateManagedSimulation("jetDiffusion",t)}clearJetDiffusion(){this.clearManagedSimulation("jetDiffusion");}disposeJetDiffusion(){this.clearJetDiffusion();}runGasInstantDiffusion(){return Mt(this,arguments,void 0,(function*(t={}){return yield this.createManagedSimulation("gasInstantDiffusion",t)}))}showGasInstantDiffusion(t={}){return this.runGasInstantDiffusion(t)}updateGasInstantDiffusion(t){return this.updateManagedSimulation("gasInstantDiffusion",t)}clearGasInstantDiffusion(){this.clearManagedSimulation("gasInstantDiffusion");}disposeGasInstantDiffusion(){this.clearGasInstantDiffusion();}runAdiabaticDiffusion(){return Mt(this,arguments,void 0,(function*(t={}){return yield this.createManagedSimulation("adiabaticDiffusion",t)}))}showAdiabaticDiffusion(t={}){return this.runAdiabaticDiffusion(t)}updateAdiabaticDiffusion(t){return this.updateManagedSimulation("adiabaticDiffusion",t)}clearAdiabaticDiffusion(){this.clearManagedSimulation("adiabaticDiffusion");}disposeAdiabaticDiffusion(){this.clearAdiabaticDiffusion();}runVaporCloudExplosion(){return Mt(this,arguments,void 0,(function*(t={}){return yield this.createManagedSimulation("vaporCloudExplosion",t)}))}showVaporCloudExplosion(t={}){return this.runVaporCloudExplosion(t)}updateVaporCloudExplosion(t){return this.updateManagedSimulation("vaporCloudExplosion",t)}clearVaporCloudExplosion(){this.clearManagedSimulation("vaporCloudExplosion");}disposeVaporCloudExplosion(){this.clearVaporCloudExplosion();}runJetFire(){return Mt(this,arguments,void 0,(function*(t={}){return yield this.createManagedSimulation("jetFire",t)}))}showJetFire(t={}){return this.runJetFire(t)}updateJetFire(t){return this.updateManagedSimulation("jetFire",t)}clearJetFire(){this.clearManagedSimulation("jetFire");}disposeJetFire(){this.clearJetFire();}runPoolFire(){return Mt(this,arguments,void 0,(function*(t={}){return yield this.createManagedSimulation("poolFire",t)}))}showPoolFire(t={}){return this.runPoolFire(t)}updatePoolFire(t){return this.updateManagedSimulation("poolFire",t)}clearPoolFire(){this.clearManagedSimulation("poolFire");}disposePoolFire(){this.clearPoolFire();}runSolidFlame(){return Mt(this,arguments,void 0,(function*(t={}){return yield this.createManagedSimulation("solidFlame",t)}))}showSolidFlame(t={}){return this.runSolidFlame(t)}updateSolidFlame(t){return this.updateManagedSimulation("solidFlame",t)}clearSolidFlame(){this.clearManagedSimulation("solidFlame");}disposeSolidFlame(){this.clearSolidFlame();}getSimulationCalculationResult(t,i){var e,s;return null!==(s=null===(e=this.simulation)||void 0===e?void 0:e.getCalculationResult(t,i))&&void 0!==s?s:null}getGasContinuousCalculationResult(t){return this.getSimulationCalculationResult("gasContinuousDiffusion",t)}getJetDiffusionCalculationResult(t){return this.getSimulationCalculationResult("jetDiffusion",t)}getGasInstantCalculationResult(t){return this.getSimulationCalculationResult("gasInstantDiffusion",t)}getAdiabaticCalculationResult(t){return this.getSimulationCalculationResult("adiabaticDiffusion",t)}getVaporCloudExplosionCalculationResult(t){return this.getSimulationCalculationResult("vaporCloudExplosion",t)}showHeatmap(t){this.operator.showHeatmap(t);}updateHeatmap(t){this.operator.updateHeatmap(t);}disposeHeatmap(){this.operator.disposeHeatmap();}addViewshed(t){return Mt(this,void 0,void 0,(function*(){return yield this.operator.addViewshed(t)}))}updateViewshed(t,i){return Mt(this,void 0,void 0,(function*(){return yield this.operator.updateViewshed(t,i)}))}getViewshedData(){return this.operator.getViewshedData()}importViewshedData(t){return Mt(this,void 0,void 0,(function*(){return yield this.operator.importViewshedData(t)}))}disposeAllViewsheds(){this.operator.disposeAllViewsheds();}}Gn.CustomInfoWindow=Wn.CustomInfoWindow;
213
+
214
+ const isAbsoluteUrl = (url) => /^(https?:)?\/\//.test(url) ||
215
+ url.startsWith('data:') ||
216
+ url.startsWith('blob:');
217
+ const getWindowValue = (readValue, fallback) => (typeof window === 'undefined' ? fallback : readValue(window));
218
+ const getWindowFileBaseUrl = () => getWindowValue(value => value
219
+ .appConfig?.fileBaseUrl || '', '');
220
+ const setCesiumBaseUrl = (cesiumBaseUrl) => {
221
+ if (typeof window === 'undefined')
222
+ return;
223
+ window.CESIUM_BASE_URL =
224
+ cesiumBaseUrl || '/cesium-assets';
225
+ };
226
+ const joinAssetUrl = (url, baseUrl) => {
227
+ if (!url || !baseUrl || isAbsoluteUrl(url)) {
228
+ return url;
229
+ }
230
+ return `${baseUrl.replace(/\/$/, '')}/${url.replace(/^\//, '')}`;
231
+ };
232
+ const resolveSceneData = (saveData) => {
233
+ if (!saveData)
234
+ return undefined;
235
+ return (saveData.gisVersionData || saveData.versionData || saveData.data || saveData);
236
+ };
237
+ const cloneConfig = (config) => JSON.parse(JSON.stringify(config));
238
+ class SdmGisEngine {
239
+ containerId;
240
+ config;
241
+ cesiumBaseUrl;
242
+ engine;
243
+ viewer;
244
+ sceneData;
245
+ constructor({ containerId, config, cesiumBaseUrl }) {
246
+ this.containerId = containerId;
247
+ this.config = config || HFGISEngineConfig;
248
+ this.cesiumBaseUrl = cesiumBaseUrl;
249
+ }
250
+ async init(saveData, baseUrl = '') {
251
+ const sceneData = resolveSceneData(saveData);
252
+ if (!sceneData)
253
+ return;
254
+ if (this.engine) {
255
+ this.dispose();
256
+ }
257
+ setCesiumBaseUrl(this.cesiumBaseUrl);
258
+ const gisConfig = this.createConfig(sceneData);
259
+ this.engine = new Gn({
260
+ containerId: this.containerId,
261
+ config: gisConfig
262
+ });
263
+ await this.engine.init();
264
+ this.viewer = this.engine.operator?.viewer;
265
+ this.sceneData = sceneData;
266
+ await this.dataInit(sceneData, baseUrl || getWindowFileBaseUrl());
267
+ }
268
+ createConfig(sceneData) {
269
+ const gisConfig = cloneConfig(this.config);
270
+ const cameraProperty = sceneData.cameraProperty;
271
+ if (cameraProperty) {
272
+ const { lng, lat, height, heading, pitch, roll } = cameraProperty;
273
+ gisConfig.viewConfig = {
274
+ ...(gisConfig.viewConfig || {}),
275
+ home: {
276
+ position: [lng, lat, height],
277
+ hpr: [heading, pitch, roll]
278
+ }
279
+ };
280
+ }
281
+ return gisConfig;
282
+ }
283
+ async dataInit(sceneData = {}, baseUrl = '') {
284
+ const { entityList, ImageLayerConfig, cameraProperty } = sceneData;
285
+ if (ImageLayerConfig) {
286
+ this.changeImageLayer(ImageLayerConfig.value);
287
+ if (ImageLayerConfig.color) {
288
+ this.engine?.changeBaseMapColor?.(ImageLayerConfig.color);
289
+ }
290
+ this.engine?.showLayer?.('basic', ImageLayerConfig.visible);
291
+ this.engine?.showLayer?.('terrain', ImageLayerConfig.terrain);
292
+ }
293
+ const tasks = (entityList || []).map(item => this.engine?.drawEntity?.(this.resolveEntityAssetUrls(item, baseUrl)));
294
+ if (cameraProperty && this.viewer?.scene?.screenSpaceCameraController) {
295
+ this.viewer.scene.screenSpaceCameraController.minimumZoomDistance =
296
+ cameraProperty.minimumZoomDistance || 1;
297
+ this.viewer.scene.screenSpaceCameraController.maximumZoomDistance =
298
+ cameraProperty.maximumZoomDistance || 50000000;
299
+ }
300
+ const viewshedData = this.getViewshedData(sceneData);
301
+ if (viewshedData?.data?.length) {
302
+ tasks.push(this.engine?.importViewshedData?.(viewshedData));
303
+ }
304
+ await Promise.all(tasks.filter(Boolean));
305
+ }
306
+ resolveEntityAssetUrls(entity, baseUrl) {
307
+ if (!entity || typeof entity !== 'object')
308
+ return entity;
309
+ return {
310
+ ...entity,
311
+ url: joinAssetUrl(entity.url, baseUrl),
312
+ mapUrl: joinAssetUrl(entity.mapUrl, baseUrl),
313
+ modelUrl: joinAssetUrl(entity.modelUrl, baseUrl)
314
+ };
315
+ }
316
+ getViewshedData(sceneData) {
317
+ if (sceneData.viewshedData?.data?.length) {
318
+ return sceneData.viewshedData;
319
+ }
320
+ return sceneData.entityLayerList?.find(item => item.viewshedData?.data?.length)?.viewshedData;
321
+ }
322
+ changeImageLayer(type) {
323
+ if (!type)
324
+ return;
325
+ return this.engine?.changeImageLayer?.(type);
326
+ }
327
+ getEntitys() {
328
+ return this.engine?.getEntitys?.();
329
+ }
330
+ getEntityById(id) {
331
+ return this.engine?.getEntityById?.(id);
332
+ }
333
+ dispose() {
334
+ this.engine?.dispose?.();
335
+ this.engine = undefined;
336
+ this.viewer = undefined;
337
+ this.sceneData = undefined;
338
+ }
339
+ }
340
+
341
+ export { SdmGisEngine as default };