@jorgmoritz/gis-manager 0.1.50 → 0.1.52

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.
package/dist/index.cjs CHANGED
@@ -13,7 +13,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
13
13
  // package.json
14
14
  var package_default = {
15
15
  name: "@jorgmoritz/gis-manager",
16
- version: "0.1.50"};
16
+ version: "0.1.52"};
17
17
 
18
18
  // src/utils/version.ts
19
19
  var version = package_default.version;
@@ -342,13 +342,10 @@ var LayerManager = class {
342
342
  const minLevel = typeof zr?.min === "number" ? zr.min : void 0;
343
343
  const maxLevel = typeof zr?.max === "number" ? zr.max : void 0;
344
344
  let bounds = options.rectangle;
345
- console.log("[demo] bounds!!", bounds);
346
- if (Math.abs(bounds[1]) > 90 && Math.abs(bounds[2]) <= 90) {
345
+ if (bounds && bounds.length >= 4 && Math.abs(bounds[1]) > 90 && Math.abs(bounds[2]) <= 90) {
347
346
  bounds = [bounds[0], bounds[2], bounds[1], bounds[3]];
348
- console.warn("[demo] Reordered bounds to [W,S,E,N]:", bounds);
349
347
  }
350
- const rectDeg = bounds;
351
- const rectangle = rectDeg ? C.Rectangle.fromDegrees(rectDeg[0], rectDeg[1], rectDeg[2], rectDeg[3]) : void 0;
348
+ const rectangle = bounds ? C.Rectangle.fromDegrees(bounds[0], bounds[1], bounds[2], bounds[3]) : void 0;
352
349
  switch (options.provider) {
353
350
  case "urlTemplate":
354
351
  return new C.UrlTemplateImageryProvider({
@@ -358,14 +355,19 @@ var LayerManager = class {
358
355
  maximumLevel: maxLevel,
359
356
  rectangle
360
357
  });
361
- case "wmts":
358
+ case "wmts": {
359
+ const tilingSchemeType = options.tilingScheme;
360
+ const tilingScheme = tilingSchemeType === "geographic" ? new C.GeographicTilingScheme() : tilingSchemeType === "webMercator" ? new C.WebMercatorTilingScheme() : void 0;
362
361
  return new C.WebMapTileServiceImageryProvider({
363
362
  url: options.url,
364
363
  layer: options.layer,
365
364
  style: options.style ?? "default",
366
365
  tileMatrixSetID: options.tileMatrixSetID,
367
- format: options.format ?? "image/png"
366
+ format: options.format ?? "image/png",
367
+ tilingScheme,
368
+ maximumLevel: options.maximumLevel
368
369
  });
370
+ }
369
371
  case "wms":
370
372
  return new C.WebMapServiceImageryProvider({
371
373
  url: options.url,
@@ -8527,7 +8529,16 @@ function convertSinoflyWayline(data, options) {
8527
8529
  }
8528
8530
  const lat = parseCoordinate(wp.latitude);
8529
8531
  const lon = parseCoordinate(wp.longitude);
8530
- const alt = parseCoordinate(wp.altitude);
8532
+ let alt;
8533
+ const ellipsoidHeightValue = wp.ellipsoidHeight;
8534
+ if (ellipsoidHeightValue !== void 0 && ellipsoidHeightValue !== null && ellipsoidHeightValue !== "") {
8535
+ alt = parseCoordinate(ellipsoidHeightValue);
8536
+ if (isNaN(alt)) {
8537
+ alt = parseCoordinate(wp.altitude);
8538
+ }
8539
+ } else {
8540
+ alt = parseCoordinate(wp.altitude);
8541
+ }
8531
8542
  if (isNaN(lat) || isNaN(lon) || isNaN(alt)) {
8532
8543
  throw new Error(`\u822A\u70B9 ${idx} \u5750\u6807\u89E3\u6790\u5931\u8D25: lat=${wp.latitude}, lon=${wp.longitude}, alt=${wp.altitude}`);
8533
8544
  }
@@ -8685,9 +8696,47 @@ function renderFlightPath(CesiumNS, viewer, options) {
8685
8696
  }
8686
8697
  return entity;
8687
8698
  }
8688
- function renderFlightPathPreview(CesiumNS, viewer, options) {
8699
+ async function renderFlightPathPreview(CesiumNS, viewer, options) {
8689
8700
  const C = CesiumNS;
8690
- const entity = renderFlightPath(CesiumNS, viewer, options);
8701
+ const terrainAware = options.terrainAware !== false;
8702
+ const minSafeHeight = options.minSafeHeight ?? 10;
8703
+ let processedOptions = options;
8704
+ if (terrainAware && options.data?.waypointInfo?.length > 0) {
8705
+ try {
8706
+ const waypointPositions = options.data.waypointInfo.map((wp) => {
8707
+ const lon = parseFloat(wp.longitude);
8708
+ const lat = parseFloat(wp.latitude);
8709
+ const alt = parseFloat(wp.altitude);
8710
+ return C.Cartesian3.fromDegrees(lon, lat, alt);
8711
+ });
8712
+ const terrainHeights = await queryTerrainHeights(CesiumNS, viewer, waypointPositions);
8713
+ const adjustedWaypointInfo = options.data.waypointInfo.map((wp, index) => {
8714
+ const originalAlt = parseFloat(wp.altitude);
8715
+ const terrainHeight = terrainHeights[index] ?? 0;
8716
+ const adjustedAlt = originalAlt < terrainHeight ? terrainHeight + minSafeHeight : originalAlt;
8717
+ if (originalAlt < terrainHeight) {
8718
+ console.log(`[renderFlightPathPreview] \u822A\u70B9 ${index} \u9AD8\u5EA6\u8C03\u6574: ${originalAlt.toFixed(1)}m -> ${adjustedAlt.toFixed(1)}m (\u5730\u5F62: ${terrainHeight.toFixed(1)}m)`);
8719
+ }
8720
+ return {
8721
+ ...wp,
8722
+ altitude: String(adjustedAlt)
8723
+ };
8724
+ });
8725
+ processedOptions = {
8726
+ ...options,
8727
+ data: {
8728
+ ...options.data,
8729
+ waypointInfo: adjustedWaypointInfo
8730
+ }
8731
+ };
8732
+ } catch (error) {
8733
+ console.warn("[renderFlightPathPreview] \u5730\u5F62\u9AD8\u5EA6\u67E5\u8BE2\u5931\u8D25\uFF0C\u4F7F\u7528\u539F\u59CB\u9AD8\u5EA6:", error);
8734
+ }
8735
+ }
8736
+ const entity = renderFlightPath(CesiumNS, viewer, processedOptions);
8737
+ if (entity.polyline) {
8738
+ entity.polyline.depthFailMaterial = C.Color.fromCssColorString("#00E676").withAlpha(0.3);
8739
+ }
8691
8740
  const vertexLabelManager = entity._vertexLabelManager;
8692
8741
  let selectedWaypointIndex = options.initialSelectedIndex ?? null;
8693
8742
  const polyline = entity.polyline;
@@ -8704,7 +8753,7 @@ function renderFlightPathPreview(CesiumNS, viewer, options) {
8704
8753
  CesiumNS,
8705
8754
  ...options.adapterOptions
8706
8755
  };
8707
- const converted = convertSinoflyWayline(options.data, adapterOptions);
8756
+ const converted = convertSinoflyWayline(processedOptions.data, adapterOptions);
8708
8757
  if (converted && converted.waypointData) {
8709
8758
  waypointDataArray = [...converted.waypointData].sort((a, b) => a.index - b.index);
8710
8759
  }
@@ -9143,18 +9192,21 @@ var _CZMLPathManager = class _CZMLPathManager {
9143
9192
  * - 航点点击事件回调
9144
9193
  * - 程序化设置选中航点(高亮显示)
9145
9194
  * - 列表与地图双向联动
9195
+ * - 地形感知:自动调整航点高度,确保航线不会渲染在地形之下
9146
9196
  *
9147
9197
  * @param options 预览选项
9148
- * @returns 包含实体和控制器的对象
9198
+ * @returns Promise,包含实体和控制器的对象
9149
9199
  *
9150
9200
  * @example
9151
9201
  * ```typescript
9152
- * const { entity, controller } = pathManager.renderFlightPathPreview({
9202
+ * const { entity, controller } = await pathManager.renderFlightPathPreview({
9153
9203
  * data: sinoflyData,
9154
9204
  * onWaypointClick: (index, waypoint) => {
9155
9205
  * console.log('点击了航点', index, waypoint);
9156
9206
  * },
9157
- * initialSelectedIndex: 0
9207
+ * initialSelectedIndex: 0,
9208
+ * terrainAware: true, // 启用地形感知
9209
+ * minSafeHeight: 10 // 最小安全高度
9158
9210
  * });
9159
9211
  *
9160
9212
  * // 程序化设置选中航点
@@ -12289,9 +12341,10 @@ var CZMLManager = class {
12289
12341
  * - 航点点击事件回调
12290
12342
  * - 程序化设置选中航点(高亮显示)
12291
12343
  * - 列表与地图双向联动
12344
+ * - 地形感知:自动调整航点高度,确保航线不会渲染在地形之下
12292
12345
  *
12293
12346
  * @param options 预览选项
12294
- * @returns 包含实体和控制器的对象
12347
+ * @returns Promise,包含实体和控制器的对象
12295
12348
  */
12296
12349
  renderFlightPathPreview(options) {
12297
12350
  return this.pathMgr.renderFlightPathPreview(options);
@@ -14128,6 +14181,24 @@ var MassPolygonManager = class {
14128
14181
  __publicField(this, "pickThrottleMs", 50);
14129
14182
  // 悬停标签
14130
14183
  __publicField(this, "hoverLabel");
14184
+ // 静态标签(每个多边形的名称标签)
14185
+ __publicField(this, "staticLabelCollection");
14186
+ __publicField(this, "staticLabelsVisible", false);
14187
+ __publicField(this, "staticLabelStyle", {
14188
+ font: "12px sans-serif",
14189
+ fillColor: "#000000",
14190
+ // 黑色字
14191
+ outlineColor: "#ffffff",
14192
+ // 白色描边
14193
+ outlineWidth: 2,
14194
+ showBackground: false,
14195
+ backgroundColor: "rgba(0,0,0,0.5)",
14196
+ backgroundPadding: [4, 2],
14197
+ pixelOffset: [0, 0],
14198
+ scale: 1
14199
+ });
14200
+ // 地形高度缓存(用于 hover 标签等需要快速访问地形高度的场景)
14201
+ __publicField(this, "terrainHeightCache", /* @__PURE__ */ new Map());
14131
14202
  // 销毁标志
14132
14203
  __publicField(this, "isDestroyed", false);
14133
14204
  // ========== 编辑支持方法 ==========
@@ -14223,6 +14294,20 @@ var MassPolygonManager = class {
14223
14294
  this.isClampToGround = options?.clampToGround ?? false;
14224
14295
  const asynchronous = options?.asynchronous ?? true;
14225
14296
  this.polygonHeight = options?.height ?? 0;
14297
+ if (options?.staticLabelStyle) {
14298
+ const labelStyle = options.staticLabelStyle;
14299
+ this.staticLabelStyle = {
14300
+ font: labelStyle.font ?? this.staticLabelStyle.font,
14301
+ fillColor: labelStyle.fillColor ?? this.staticLabelStyle.fillColor,
14302
+ outlineColor: labelStyle.outlineColor ?? this.staticLabelStyle.outlineColor,
14303
+ outlineWidth: labelStyle.outlineWidth ?? this.staticLabelStyle.outlineWidth,
14304
+ showBackground: labelStyle.showBackground ?? this.staticLabelStyle.showBackground,
14305
+ backgroundColor: labelStyle.backgroundColor ?? this.staticLabelStyle.backgroundColor,
14306
+ backgroundPadding: labelStyle.backgroundPadding ?? this.staticLabelStyle.backgroundPadding,
14307
+ pixelOffset: labelStyle.pixelOffset ?? this.staticLabelStyle.pixelOffset,
14308
+ scale: labelStyle.scale ?? this.staticLabelStyle.scale
14309
+ };
14310
+ }
14226
14311
  if (this.isClampToGround && this.viewer.scene.globe) {
14227
14312
  this.viewer.scene.globe.depthTestAgainstTerrain = true;
14228
14313
  }
@@ -14335,8 +14420,10 @@ var MassPolygonManager = class {
14335
14420
  this.layerCollection.add(this.outlinePrimitive);
14336
14421
  }
14337
14422
  }
14338
- this.labelCollection = new C.LabelCollection();
14423
+ this.labelCollection = new C.LabelCollection({ scene: this.viewer.scene });
14339
14424
  this.layerCollection.add(this.labelCollection);
14425
+ this.staticLabelCollection = new C.LabelCollection({ scene: this.viewer.scene });
14426
+ this.layerCollection.add(this.staticLabelCollection);
14340
14427
  if (this.interactionOptions.enableHover) {
14341
14428
  this.setupHoverHandler();
14342
14429
  }
@@ -14714,7 +14801,7 @@ var MassPolygonManager = class {
14714
14801
  return this.selectedId ?? null;
14715
14802
  }
14716
14803
  /**
14717
- * 计算多边形中心点
14804
+ * 计算多边形中心点(简单平均)
14718
14805
  */
14719
14806
  calculatePolygonCenter(points) {
14720
14807
  let sumLon = 0, sumLat = 0, sumHeight = 0;
@@ -14729,8 +14816,45 @@ var MassPolygonManager = class {
14729
14816
  height: sumHeight / points.length
14730
14817
  };
14731
14818
  }
14819
+ /**
14820
+ * 计算多边形质心(更准确的中心点算法)
14821
+ * 使用多边形质心公式,对于凹多边形也能得到正确的中心位置
14822
+ */
14823
+ calculatePolygonCentroid(points) {
14824
+ if (points.length < 3) {
14825
+ return this.calculatePolygonCenter(points);
14826
+ }
14827
+ let signedArea = 0;
14828
+ let cx = 0;
14829
+ let cy = 0;
14830
+ let sumHeight = 0;
14831
+ const n = points.length;
14832
+ for (let i = 0; i < n; i++) {
14833
+ const x0 = points[i].lon;
14834
+ const y0 = points[i].lat;
14835
+ const x1 = points[(i + 1) % n].lon;
14836
+ const y1 = points[(i + 1) % n].lat;
14837
+ const a = x0 * y1 - x1 * y0;
14838
+ signedArea += a;
14839
+ cx += (x0 + x1) * a;
14840
+ cy += (y0 + y1) * a;
14841
+ sumHeight += points[i].height ?? 0;
14842
+ }
14843
+ signedArea *= 0.5;
14844
+ if (Math.abs(signedArea) < 1e-10) {
14845
+ return this.calculatePolygonCenter(points);
14846
+ }
14847
+ cx = cx / (6 * signedArea);
14848
+ cy = cy / (6 * signedArea);
14849
+ return {
14850
+ lon: cx,
14851
+ lat: cy,
14852
+ height: sumHeight / n
14853
+ };
14854
+ }
14732
14855
  /**
14733
14856
  * 显示悬停标签
14857
+ * 使用缓存的地形高度(如果可用)来正确放置标签
14734
14858
  */
14735
14859
  showLabel(polygonData) {
14736
14860
  if (!this.interactionOptions.showHoverLabel || !polygonData.name) return;
@@ -14739,7 +14863,24 @@ var MassPolygonManager = class {
14739
14863
  const style = this.interactionOptions.hoverLabelStyle;
14740
14864
  this.hideLabel();
14741
14865
  const center = this.calculatePolygonCenter(polygonData.points);
14742
- const position = C.Cartesian3.fromDegrees(center.lon, center.lat, this.polygonHeight);
14866
+ let labelHeight;
14867
+ if (this.isClampToGround) {
14868
+ const cachedHeight = this.terrainHeightCache.get(polygonData.id);
14869
+ if (cachedHeight !== void 0) {
14870
+ labelHeight = cachedHeight + 2;
14871
+ } else {
14872
+ const terrainHeight = queryTerrainHeightByLonLatSync(
14873
+ this.CesiumNS,
14874
+ this.viewer,
14875
+ center.lon,
14876
+ center.lat
14877
+ );
14878
+ labelHeight = terrainHeight + 2;
14879
+ }
14880
+ } else {
14881
+ labelHeight = this.polygonHeight;
14882
+ }
14883
+ const position = C.Cartesian3.fromDegrees(center.lon, center.lat, labelHeight);
14743
14884
  this.hoverLabel = this.labelCollection.add({
14744
14885
  position,
14745
14886
  text: polygonData.name,
@@ -14986,6 +15127,178 @@ var MassPolygonManager = class {
14986
15127
  }
14987
15128
  }
14988
15129
  }
15130
+ /**
15131
+ * 获取图层可见性
15132
+ */
15133
+ getVisibility() {
15134
+ return this.layerCollection?.show ?? false;
15135
+ }
15136
+ /**
15137
+ * 隐藏整个图层
15138
+ */
15139
+ hide() {
15140
+ this.setVisibility(false);
15141
+ }
15142
+ /**
15143
+ * 显示整个图层
15144
+ */
15145
+ show() {
15146
+ this.setVisibility(true);
15147
+ }
15148
+ /**
15149
+ * 切换图层可见性
15150
+ * @returns 切换后的可见性状态
15151
+ */
15152
+ toggleVisibility() {
15153
+ const newVisibility = !this.getVisibility();
15154
+ this.setVisibility(newVisibility);
15155
+ return newVisibility;
15156
+ }
15157
+ // ==================== 静态标签管理 ====================
15158
+ /**
15159
+ * 显示所有多边形的静态标签(异步版本)
15160
+ * 在每个多边形的中心点显示其名称
15161
+ *
15162
+ * 注意:
15163
+ * 1. LabelCollection 不支持 heightReference 属性
15164
+ * 2. 贴地模式下,使用异步方法查询地形高度来正确放置标签
15165
+ * 3. 通过 disableDepthTestDistance 确保标签始终可见
15166
+ * 4. 查询的地形高度会被缓存,供 hover 标签使用
15167
+ */
15168
+ async showStaticLabels() {
15169
+ if (!this.staticLabelCollection) return;
15170
+ const C = this.CesiumNS;
15171
+ this.staticLabelCollection.removeAll();
15172
+ const polygonsWithCenters = [];
15173
+ for (const polygon of this.polygonDataMap.values()) {
15174
+ if (!polygon.name) continue;
15175
+ const center = this.calculatePolygonCentroid(polygon.points);
15176
+ polygonsWithCenters.push({ polygon, center });
15177
+ }
15178
+ if (polygonsWithCenters.length === 0) {
15179
+ this.staticLabelsVisible = true;
15180
+ return;
15181
+ }
15182
+ let labelHeights;
15183
+ if (this.isClampToGround) {
15184
+ const coordinates = polygonsWithCenters.map(({ center }) => ({
15185
+ lon: center.lon,
15186
+ lat: center.lat
15187
+ }));
15188
+ try {
15189
+ const terrainHeights = await queryTerrainHeightsByLonLat(
15190
+ this.CesiumNS,
15191
+ this.viewer,
15192
+ coordinates
15193
+ );
15194
+ labelHeights = terrainHeights.map((h) => h + 2);
15195
+ for (let i = 0; i < polygonsWithCenters.length; i++) {
15196
+ const polygonId = polygonsWithCenters[i].polygon.id;
15197
+ this.terrainHeightCache.set(polygonId, terrainHeights[i]);
15198
+ }
15199
+ console.log(`[MassPolygonManager] \u5F02\u6B65\u67E5\u8BE2\u5730\u5F62\u9AD8\u5EA6\u5B8C\u6210\uFF0C\u8303\u56F4: ${Math.min(...terrainHeights).toFixed(1)}m ~ ${Math.max(...terrainHeights).toFixed(1)}m`);
15200
+ } catch (error) {
15201
+ console.warn("[MassPolygonManager] \u5F02\u6B65\u67E5\u8BE2\u5730\u5F62\u9AD8\u5EA6\u5931\u8D25\uFF0C\u4F7F\u7528\u9ED8\u8BA4\u9AD8\u5EA6:", error);
15202
+ labelHeights = polygonsWithCenters.map(() => 2);
15203
+ }
15204
+ } else {
15205
+ labelHeights = polygonsWithCenters.map(() => this.polygonHeight);
15206
+ }
15207
+ if (this.isDestroyed || !this.staticLabelCollection) {
15208
+ console.warn("[MassPolygonManager] \u5B9E\u4F8B\u5DF2\u9500\u6BC1\uFF0C\u8DF3\u8FC7\u521B\u5EFA\u6807\u7B7E");
15209
+ return;
15210
+ }
15211
+ for (let i = 0; i < polygonsWithCenters.length; i++) {
15212
+ const { polygon, center } = polygonsWithCenters[i];
15213
+ const labelHeight = labelHeights[i];
15214
+ const position = C.Cartesian3.fromDegrees(center.lon, center.lat, labelHeight);
15215
+ this.staticLabelCollection.add({
15216
+ position,
15217
+ text: polygon.name,
15218
+ font: this.staticLabelStyle.font,
15219
+ fillColor: C.Color.fromCssColorString(this.staticLabelStyle.fillColor),
15220
+ outlineColor: C.Color.fromCssColorString(this.staticLabelStyle.outlineColor),
15221
+ outlineWidth: this.staticLabelStyle.outlineWidth,
15222
+ style: C.LabelStyle.FILL_AND_OUTLINE,
15223
+ showBackground: this.staticLabelStyle.showBackground,
15224
+ backgroundColor: C.Color.fromCssColorString(this.staticLabelStyle.backgroundColor),
15225
+ backgroundPadding: new C.Cartesian2(this.staticLabelStyle.backgroundPadding[0], this.staticLabelStyle.backgroundPadding[1]),
15226
+ pixelOffset: new C.Cartesian2(this.staticLabelStyle.pixelOffset[0], this.staticLabelStyle.pixelOffset[1]),
15227
+ scale: this.staticLabelStyle.scale,
15228
+ verticalOrigin: C.VerticalOrigin.CENTER,
15229
+ horizontalOrigin: C.HorizontalOrigin.CENTER,
15230
+ // 禁用深度测试,确保标签始终可见(不会被地形遮挡)
15231
+ disableDepthTestDistance: Number.POSITIVE_INFINITY
15232
+ });
15233
+ }
15234
+ this.staticLabelsVisible = true;
15235
+ this.viewer.scene.requestRender();
15236
+ console.log(`[MassPolygonManager] \u5DF2\u663E\u793A ${this.staticLabelCollection.length} \u4E2A\u9759\u6001\u6807\u7B7E`);
15237
+ }
15238
+ /**
15239
+ * 预加载所有多边形质心的地形高度(用于 hover 标签)
15240
+ * 在贴地模式下,建议在 create() 后调用此方法
15241
+ */
15242
+ async preloadTerrainHeights() {
15243
+ if (!this.isClampToGround) return;
15244
+ const polygons = Array.from(this.polygonDataMap.values());
15245
+ if (polygons.length === 0) return;
15246
+ const coordinates = polygons.map((polygon) => {
15247
+ const center = this.calculatePolygonCentroid(polygon.points);
15248
+ return { lon: center.lon, lat: center.lat };
15249
+ });
15250
+ try {
15251
+ const terrainHeights = await queryTerrainHeightsByLonLat(
15252
+ this.CesiumNS,
15253
+ this.viewer,
15254
+ coordinates
15255
+ );
15256
+ for (let i = 0; i < polygons.length; i++) {
15257
+ this.terrainHeightCache.set(polygons[i].id, terrainHeights[i]);
15258
+ }
15259
+ console.log(`[MassPolygonManager] \u9884\u52A0\u8F7D\u5730\u5F62\u9AD8\u5EA6\u5B8C\u6210: ${polygons.length} \u4E2A\u591A\u8FB9\u5F62`);
15260
+ } catch (error) {
15261
+ console.warn("[MassPolygonManager] \u9884\u52A0\u8F7D\u5730\u5F62\u9AD8\u5EA6\u5931\u8D25:", error);
15262
+ }
15263
+ }
15264
+ /**
15265
+ * 隐藏所有多边形的静态标签
15266
+ */
15267
+ hideStaticLabels() {
15268
+ if (!this.staticLabelCollection) return;
15269
+ this.staticLabelCollection.removeAll();
15270
+ this.staticLabelsVisible = false;
15271
+ this.viewer.scene.requestRender();
15272
+ console.log("[MassPolygonManager] \u5DF2\u9690\u85CF\u9759\u6001\u6807\u7B7E");
15273
+ }
15274
+ /**
15275
+ * 切换静态标签显示状态
15276
+ * @returns 切换后的显示状态
15277
+ */
15278
+ async toggleStaticLabels() {
15279
+ if (this.staticLabelsVisible) {
15280
+ this.hideStaticLabels();
15281
+ } else {
15282
+ await this.showStaticLabels();
15283
+ }
15284
+ return this.staticLabelsVisible;
15285
+ }
15286
+ /**
15287
+ * 获取静态标签显示状态
15288
+ */
15289
+ getStaticLabelsVisible() {
15290
+ return this.staticLabelsVisible;
15291
+ }
15292
+ /**
15293
+ * 设置静态标签样式
15294
+ * @param style 样式配置(部分)
15295
+ */
15296
+ async setStaticLabelStyle(style) {
15297
+ this.staticLabelStyle = { ...this.staticLabelStyle, ...style };
15298
+ if (this.staticLabelsVisible) {
15299
+ await this.showStaticLabels();
15300
+ }
15301
+ }
14989
15302
  /**
14990
15303
  * 更新样式(需要重新创建所有多边形)
14991
15304
  */
@@ -15032,7 +15345,10 @@ var MassPolygonManager = class {
15032
15345
  this.outlinePrimitive = void 0;
15033
15346
  this.groundOutlinePrimitive = void 0;
15034
15347
  this.labelCollection = void 0;
15348
+ this.staticLabelCollection = void 0;
15349
+ this.staticLabelsVisible = false;
15035
15350
  this.polygonDataMap.clear();
15351
+ this.terrainHeightCache.clear();
15036
15352
  if (this.viewer?.scene) {
15037
15353
  try {
15038
15354
  this.viewer.scene.requestRender();