@xingm/vmap-cesium-toolbar 0.0.2-alpha.1 → 0.0.2-alpha.11

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,109 @@
1
+ import * as Cesium from "cesium";
2
+ export interface HeatPoint {
3
+ /** 经度(度) */
4
+ lon: number;
5
+ /** 纬度(度) */
6
+ lat: number;
7
+ /** 强度值,用于控制热度(0~maxValue) */
8
+ value: number;
9
+ }
10
+ export interface HeatmapGradient {
11
+ /**
12
+ * 0~1 的比例到颜色字符串的映射,例如:
13
+ * { 0.0: "#0000ff", 0.5: "#ffff00", 1.0: "#ff0000" }
14
+ */
15
+ [stop: number]: string;
16
+ }
17
+ export interface HeatmapOptions {
18
+ /** Canvas 分辨率,越大越清晰但开销越大 */
19
+ width?: number;
20
+ height?: number;
21
+ /** 单个点的影响半径(像素) */
22
+ radius?: number;
23
+ /** 最小/最大值,用于归一化 value,如果不传则自动根据数据计算 */
24
+ minValue?: number;
25
+ maxValue?: number;
26
+ /** 全局不透明度 0~1 */
27
+ opacity?: number;
28
+ /** 颜色梯度 */
29
+ gradient?: HeatmapGradient;
30
+ }
31
+ export interface HeatmapAutoUpdateOptions {
32
+ /** 是否启用随视角变化自动重绘(默认 true) */
33
+ enabled?: boolean;
34
+ /** 视域范围 padding(比例,默认 0.15) */
35
+ viewPaddingRatio?: number;
36
+ /** 聚合网格边长(米)。不传则根据相机高度自动估算 */
37
+ cellSizeMeters?: number;
38
+ /** 根据相机高度(米)动态返回网格边长(米)。优先级高于 cellSizeMeters */
39
+ cellSizeMetersByHeight?: (cameraHeightMeters: number) => number;
40
+ }
41
+ /**
42
+ * Cesium 热力图图层封装
43
+ * - 使用离屏 Canvas 绘制热力图
44
+ * - 通过 SingleTileImageryProvider 叠加到地球上
45
+ */
46
+ export default class CesiumHeatmapLayer {
47
+ private viewer;
48
+ private imageryLayer;
49
+ private rectangle;
50
+ private canvas;
51
+ private ctx;
52
+ private options;
53
+ private data;
54
+ private gradientLUT;
55
+ private autoUpdateEnabled;
56
+ private autoUpdateOptions;
57
+ private removeMoveEndListener;
58
+ private aggregateWorker;
59
+ private workerReady;
60
+ private pendingUpdate;
61
+ private lastUpdateKey;
62
+ constructor(viewer: Cesium.Viewer, options?: HeatmapOptions);
63
+ /**
64
+ * 设置/替换热力图数据(度为单位)
65
+ */
66
+ setData(points: HeatPoint[]): void;
67
+ /**
68
+ * 更新调色板
69
+ */
70
+ setGradient(gradient: HeatmapGradient): void;
71
+ /**
72
+ * 设置透明度
73
+ */
74
+ setOpacity(opacity: number): void;
75
+ /**
76
+ * 显隐控制
77
+ */
78
+ setVisible(visible: boolean): void;
79
+ /**
80
+ * 销毁并移除图层
81
+ */
82
+ destroy(): void;
83
+ /**
84
+ * 启用/关闭基于视域与缩放的自动聚合重绘(方格聚合 + moveEnd + WebWorker)。
85
+ * - 启用后:热力图仅渲染当前视域范围内的聚合结果,缩放/平移后自动更新。
86
+ * - 关闭后:回退为 setData() 时按全量范围绘制一张 SingleTile。
87
+ */
88
+ setAutoUpdate(options?: HeatmapAutoUpdateOptions): void;
89
+ stopAutoUpdate(): void;
90
+ private clearLayer;
91
+ private startAutoUpdateInternal;
92
+ private requestAutoUpdate;
93
+ private getPaddedViewRectangleDegrees;
94
+ private ensureWorker;
95
+ private pushDataToWorker;
96
+ /**
97
+ * 构建颜色查找表(0-255 -> RGBA)
98
+ */
99
+ private buildGradientLUT;
100
+ /**
101
+ * 在离屏 canvas 上绘制热力图,并更新到 Cesium 图层
102
+ */
103
+ private renderHeatmap;
104
+ /**
105
+ * 将当前 canvas 映射为 Cesium 影像图层
106
+ */
107
+ private updateImageryLayer;
108
+ }
109
+ export { CesiumHeatmapLayer };
@@ -9,7 +9,6 @@ declare class DrawHelper {
9
9
  private viewer;
10
10
  private scene;
11
11
  private entities;
12
- private frustumPrimitives;
13
12
  private drawMode;
14
13
  private isDrawing;
15
14
  private tempPositions;
@@ -20,6 +19,8 @@ declare class DrawHelper {
20
19
  private finishedPointEntities;
21
20
  private publicEntities;
22
21
  private _doubleClickPending;
22
+ private lastPreviewPosition;
23
+ private static activeDrawingHelper;
23
24
  private drawLine;
24
25
  private drawPolygon;
25
26
  private drawRectangle;
@@ -86,11 +87,6 @@ declare class DrawHelper {
86
87
  * 删除最后一个添加的点及其相关的临时实体
87
88
  */
88
89
  private removeLastPoint;
89
- /**
90
- * 重新创建剩余的点实体和绘制实体
91
- * 用于右键删除点后的重建
92
- */
93
- private recreateRemainingEntities;
94
90
  /**
95
91
  * 更新预览线/面
96
92
  * @param currentMousePosition 当前鼠标位置世界坐标
@@ -114,6 +110,12 @@ declare class DrawHelper {
114
110
  * 公共方法:结束当前绘制(如果正在进行)
115
111
  */
116
112
  endDrawing(): void;
113
+ /**
114
+ * 公共方法:取消当前正在进行的绘制(不触发完成回调,不生成实体)
115
+ * 主要用于在外部开启新的绘制前,保证旧的未完成绘制被安全终止,
116
+ * 避免同时存在多个绘制事件处理器。
117
+ */
118
+ cancelDrawing(): void;
117
119
  /**
118
120
  * 销毁事件处理器
119
121
  */
@@ -142,15 +144,6 @@ declare class DrawHelper {
142
144
  * @returns 实体数组
143
145
  */
144
146
  getFinishedEntities(): Cesium.Entity[];
145
- /**
146
- * 使用 Canvas 绘制总长文本,生成用于 billboard 的图片
147
- */
148
- private createTotalLengthBillboardImage;
149
- /**
150
- * 使用 Canvas 绘制分段长度文本,生成用于 billboard 的图片
151
- * 样式与总长保持一致,便于统一视觉
152
- */
153
- private createSegmentLengthBillboardImage;
154
147
  onMeasureComplete(callback: (result: {
155
148
  type: "line" | "polygon" | "rectangle" | "circle";
156
149
  positions: Cesium.Cartesian3[];
@@ -40,6 +40,7 @@ interface InitOptions {
40
40
  terrainExaggeration?: number;
41
41
  maximumScreenSpaceError?: number;
42
42
  maximumNumberOfLoadedTiles?: number;
43
+ requestRenderMode?: boolean;
43
44
  token?: string;
44
45
  cesiumToken?: string;
45
46
  success?: () => void;
@@ -53,6 +54,8 @@ interface MapCenter {
53
54
  pitch?: number;
54
55
  heading?: number;
55
56
  }
57
+ export declare const setCameraView: (viewer: CesiumViewer, center: MapCenter) => void;
58
+ export declare const setCameraFlyTo: (viewer: CesiumViewer, center: MapCenter, options: InitOptions) => void;
56
59
  export declare function initCesium(containerId: string, options: InitOptions, mapCenterOrCesiumToken?: MapCenter | string, cesiumToken?: string): Promise<{
57
60
  viewer: CesiumViewer;
58
61
  initialCenter: MapCenter;
@@ -8,6 +8,7 @@ import { MapPolyline, PolylineOptions } from './overlay/MapPolyline';
8
8
  import { MapPolygon, PolygonOptions } from './overlay/MapPolygon';
9
9
  import { MapRectangle, RectangleOptions } from './overlay/MapRectangle';
10
10
  import { MapCircle, CircleOptions } from './overlay/MapCircle';
11
+ import { MapRing, RingOptions } from './overlay/MapRing';
11
12
  import { OverlayPosition } from './overlay/types';
12
13
  /**
13
14
  * Cesium 覆盖物服务类
@@ -27,6 +28,7 @@ export declare class CesiumOverlayService {
27
28
  readonly polygon: MapPolygon;
28
29
  readonly rectangle: MapRectangle;
29
30
  readonly circle: MapCircle;
31
+ readonly ring: MapRing;
30
32
  constructor(viewer: Viewer);
31
33
  /**
32
34
  * 初始化信息窗口容器
@@ -76,6 +78,10 @@ export declare class CesiumOverlayService {
76
78
  * 添加 Circle
77
79
  */
78
80
  addCircle(options: CircleOptions): Entity;
81
+ /**
82
+ * 添加 Ring
83
+ */
84
+ addRing(options: RingOptions): Entity;
79
85
  /**
80
86
  * 根据ID获取覆盖物
81
87
  */
@@ -15,10 +15,31 @@ export interface DrawResult {
15
15
  */
16
16
  export interface DrawCallbacks {
17
17
  onDrawStart?: () => void;
18
- onDrawEnd?: (entity: Entity | null) => void;
18
+ onDrawEnd?: (entity: Entity | null, result: DrawResult) => void;
19
19
  onEntityRemoved?: (entity: Entity) => void;
20
20
  onMeasureComplete?: (result: DrawResult) => void;
21
21
  }
22
+ /**
23
+ * 扩展后的绘制实体类型
24
+ * 用于在 Entity 上挂载绘图相关的元数据
25
+ */
26
+ export type DrawEntity = Entity & {
27
+ _drawType?: "line" | "polygon" | "rectangle" | "circle";
28
+ _drawOptions?: DrawOptions;
29
+ _groundPositions?: Cartesian3[];
30
+ _groundPosition?: Cartesian3;
31
+ _groundRectangle?: Cesium.Rectangle;
32
+ _radius?: number;
33
+ _borderEntity?: Entity;
34
+ _onClick?: (entity: Entity, ...args: any[]) => void;
35
+ _isSelected?: boolean;
36
+ _originalStyle?: {
37
+ material?: any;
38
+ width?: any;
39
+ outlineColor?: any;
40
+ outlineWidth?: any;
41
+ };
42
+ };
22
43
  /**
23
44
  * 绘制时可选的样式和事件回调
24
45
  */
@@ -58,16 +79,44 @@ export declare abstract class BaseDraw {
58
79
  protected finishedPointEntities: Cesium.Entity[];
59
80
  /** 当前绘制的选项(如果有) */
60
81
  protected drawOptions?: DrawOptions;
82
+ /**
83
+ * 公开只读访问当前临时数据,供调度器使用
84
+ */
85
+ getTempPositions(): Cartesian3[];
86
+ getTempEntities(): Entity[];
87
+ getTempLabelEntities(): Entity[];
88
+ getFinishedPointEntities(): Entity[];
89
+ /**
90
+ * 允许调度器安全地重建临时数据
91
+ */
92
+ setTempPositions(positions: Cartesian3[]): void;
93
+ setTempEntities(entities: Entity[]): void;
94
+ setTempLabelEntities(entities: Entity[]): void;
95
+ /**
96
+ * 供调度器调用的公开包装方法
97
+ */
98
+ addPointForHelper(position: Cartesian3): void;
99
+ clearTempEntitiesForHelper(): void;
100
+ /**
101
+ * 清除当前绘制过程中的临时点实体
102
+ * 仅删除带有 point 组件的临时实体,保留其它临时线/面实体
103
+ */
104
+ clearTempPointEntitiesForHelper(): void;
105
+ /**
106
+ * 删除最后一个点并根据剩余点重建预览实体
107
+ * 供调度器在右键删除点时调用,具体重建逻辑仍由各子类的 updateDrawingEntity 实现
108
+ */
109
+ removeLastPointAndRedraw(): void;
61
110
  /**
62
111
  * 将任意颜色输入解析为 Cesium.Color
63
112
  */
64
113
  protected resolveColor(input?: Cesium.Color | string): Cesium.Color;
65
114
  /**
66
- * 应用选中样式(可切换)
115
+ * 应用/切换选中样式(统一逻辑,供调度器和子类共用)
67
116
  */
68
117
  protected applySelectedStyleToEntity(entity: Entity): void;
69
118
  /**
70
- * 恢复原始样式
119
+ * 恢复原始样式(兼容旧接口,内部仍走统一逻辑)
71
120
  */
72
121
  protected restoreOriginalStyleForEntity(entity: Entity): void;
73
122
  abstract updateDrawingEntity(previewPoint?: Cesium.Cartesian3): void;
@@ -114,3 +163,8 @@ export declare abstract class BaseDraw {
114
163
  */
115
164
  protected clearTempEntities(): void;
116
165
  }
166
+ /**
167
+ * 静态工具方法:切换实体的选中样式
168
+ * 用于避免在多个模块中重复实现相同逻辑
169
+ */
170
+ export declare function toggleSelectedStyle(entity: DrawEntity): void;
@@ -5,6 +5,7 @@ import { BaseDraw, DrawResult, DrawOptions } from './BaseDraw';
5
5
  */
6
6
  export declare class DrawCircle extends BaseDraw {
7
7
  private currentCircleEntity;
8
+ private currentBorderEntity;
8
9
  private centerPosition;
9
10
  /**
10
11
  * 开始绘制
@@ -22,4 +23,8 @@ export declare class DrawCircle extends BaseDraw {
22
23
  * 获取绘制类型
23
24
  */
24
25
  getDrawType(): "line" | "polygon" | "rectangle" | "circle";
26
+ /**
27
+ * 生成近似圆(多边形)顶点
28
+ */
29
+ private generateCirclePositions;
25
30
  }
@@ -5,6 +5,7 @@ import { BaseDraw, DrawResult, DrawOptions } from './BaseDraw';
5
5
  */
6
6
  export declare class DrawPolygon extends BaseDraw {
7
7
  private currentPolygonEntity;
8
+ private currentBorderEntity;
8
9
  /**
9
10
  * 开始绘制
10
11
  */
@@ -17,6 +18,10 @@ export declare class DrawPolygon extends BaseDraw {
17
18
  * 完成绘制
18
19
  */
19
20
  finishDrawing(): DrawResult | null;
21
+ /**
22
+ * 清理所有绘制相关的实体
23
+ */
24
+ clear(): void;
20
25
  /**
21
26
  * 获取绘制类型
22
27
  */
@@ -1,4 +1,4 @@
1
- export { BaseDraw, type DrawResult, type DrawCallbacks, type DrawOptions } from './BaseDraw';
1
+ export { BaseDraw, type DrawResult, type DrawCallbacks, type DrawOptions, type DrawEntity, toggleSelectedStyle } from './BaseDraw';
2
2
  export { DrawLine } from './DrawLine';
3
3
  export { DrawPolygon } from './DrawPolgon';
4
4
  export { DrawRectangle } from './DrawRectangle';
@@ -13,6 +13,7 @@ export interface CircleOptions {
13
13
  outlineWidth?: number;
14
14
  heightReference?: HeightReference;
15
15
  extrudedHeight?: number;
16
+ heightEpsilon?: number;
16
17
  onClick?: (entity: Entity) => void;
17
18
  id?: string;
18
19
  }
@@ -39,6 +40,11 @@ export declare class MapCircle {
39
40
  * 添加 Circle(圆形)
40
41
  */
41
42
  add(options: CircleOptions): Entity;
43
+ /**
44
+ * 生成近似圆(多边形)顶点,返回 Cartesian3 数组。
45
+ * 使用大圆航线公式,segments 越大越平滑。
46
+ */
47
+ private generateCirclePositions;
42
48
  /**
43
49
  * 更新 Circle 位置
44
50
  */
@@ -51,4 +57,8 @@ export declare class MapCircle {
51
57
  * 更新 Circle 样式
52
58
  */
53
59
  updateStyle(entity: Entity, options: Partial<Pick<CircleOptions, 'material' | 'outline' | 'outlineColor' | 'outlineWidth'>>): void;
60
+ /**
61
+ * 移除 Circle(通过实体或实体 id)
62
+ */
63
+ remove(entityOrId: Entity | string): boolean;
54
64
  }
@@ -52,4 +52,8 @@ export declare class MapIcon {
52
52
  * 更新 Icon 样式
53
53
  */
54
54
  updateStyle(entity: Entity, options: Partial<Pick<IconOptions, 'scale' | 'rotation' | 'color'>>): void;
55
+ /**
56
+ * 移除 Icon(通过实体或实体 id)
57
+ */
58
+ remove(entityOrId: Entity | string): boolean;
55
59
  }
@@ -15,7 +15,16 @@ export interface InfoWindowOptions {
15
15
  backgroundColor?: string;
16
16
  color?: string;
17
17
  font?: string;
18
+ className?: string;
19
+ style?: Partial<CSSStyleDeclaration>;
20
+ showArrow?: boolean;
21
+ arrowSize?: number;
22
+ positionOffset?: 'top' | 'bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'left-top' | 'left-bottom' | 'right-top' | 'right-bottom';
18
23
  hideWhenOutOfView?: boolean;
24
+ anchorHeight?: number;
25
+ anchorPixel?: number;
26
+ tailGap?: number;
27
+ updateInterval?: number;
19
28
  }
20
29
  /**
21
30
  * 面向 Cesium 的 HTML 信息窗口管理器
@@ -26,7 +35,25 @@ export declare class MapInfoWindow {
26
35
  private container;
27
36
  private entityMap;
28
37
  private currentTopZIndex;
38
+ private defaultUpdateInterval;
39
+ private isCameraMoving;
40
+ private cameraMoveStartListener?;
41
+ private cameraMoveEndListener?;
42
+ /**
43
+ * 合并用户传入的 InfoWindowOptions 与默认值,提升入参灵活性。
44
+ * 注意:必填项 position / content 由调用方提供,不在默认值内。
45
+ */
46
+ private mergeOptions;
29
47
  constructor(viewer: Viewer, container: HTMLElement);
48
+ /**
49
+ * Set default update interval (ms) for position updates when an InfoWindow doesn't specify `updateInterval`.
50
+ * 0 means update every frame.
51
+ */
52
+ setDefaultUpdateInterval(ms: number): void;
53
+ /**
54
+ * Force immediate update (recompute positions) of all managed info windows.
55
+ */
56
+ forceUpdateAll(): void;
30
57
  private convertPosition;
31
58
  /**
32
59
  * 将世界坐标转换为相对于 container 的 CSS 像素坐标
@@ -56,4 +56,8 @@ export declare class MapLabel {
56
56
  * 更新 Label 样式
57
57
  */
58
58
  updateStyle(entity: Entity, options: Partial<Pick<LabelOptions, 'fillColor' | 'outlineColor' | 'outlineWidth' | 'font' | 'scale'>>): void;
59
+ /**
60
+ * 移除 Label(通过实体或实体 id)
61
+ */
62
+ remove(entityOrId: Entity | string): boolean;
59
63
  }
@@ -43,4 +43,8 @@ export declare class MapMarker {
43
43
  * 更新 Marker 样式
44
44
  */
45
45
  updateStyle(entity: Entity, options: Partial<Pick<MarkerOptions, 'color' | 'outlineColor' | 'outlineWidth' | 'pixelSize'>>): void;
46
+ /**
47
+ * 移除 Marker(通过实体或实体 id)
48
+ */
49
+ remove(entityOrId: Entity | string): boolean;
46
50
  }
@@ -34,6 +34,23 @@ export declare class MapPolygon {
34
34
  * 解析材质
35
35
  */
36
36
  private resolveMaterial;
37
+ /**
38
+ * 计算二维多边形方向(正值为 CCW)
39
+ */
40
+ private polygonArea2D;
41
+ /**
42
+ * 向内偏移二维多边形顶点(线偏移 + 邻边相交)。厚度单位:米。
43
+ * 对复杂凹形可能產生伪影,更适合凸多边形或温和凹形。
44
+ */
45
+ private offsetPolygon2DInward;
46
+ /**
47
+ * 计算内偏移后的 3D 顶点:使用切平面近似进行 2D 偏移再投回椭球,并统一高度。
48
+ */
49
+ private computeInnerOffsetPositions;
50
+ /**
51
+ * 为多边形顶点统一高度(含微小抬升)
52
+ */
53
+ private elevatePositions;
37
54
  /**
38
55
  * 添加 Polygon(多边形)
39
56
  */
@@ -46,4 +63,8 @@ export declare class MapPolygon {
46
63
  * 更新 Polygon 样式
47
64
  */
48
65
  updateStyle(entity: Entity, options: Partial<Pick<PolygonOptions, 'material' | 'outline' | 'outlineColor' | 'outlineWidth'>>): void;
66
+ /**
67
+ * 移除 Polygon(通过实体或实体 id)
68
+ */
69
+ remove(entityOrId: Entity | string): boolean;
49
70
  }
@@ -43,4 +43,8 @@ export declare class MapPolyline {
43
43
  * 更新 Polyline 样式
44
44
  */
45
45
  updateStyle(entity: Entity, options: Partial<Pick<PolylineOptions, 'width' | 'material'>>): void;
46
+ /**
47
+ * 移除 Polyline(通过实体或实体 id)
48
+ */
49
+ remove(entityOrId: Entity | string): boolean;
46
50
  }
@@ -29,6 +29,14 @@ export declare class MapRectangle {
29
29
  * 解析材质
30
30
  */
31
31
  private resolveMaterial;
32
+ /**
33
+ * 将 Rectangle 转为四点多边形顶点(按西南→东南→东北→西北顺序)
34
+ */
35
+ private rectangleToPositions;
36
+ /**
37
+ * 按米单位向内收缩矩形边界,返回新的 Rectangle
38
+ */
39
+ private shrinkRectangle;
32
40
  /**
33
41
  * 添加 Rectangle(矩形)
34
42
  */
@@ -41,4 +49,8 @@ export declare class MapRectangle {
41
49
  * 更新 Rectangle 样式
42
50
  */
43
51
  updateStyle(entity: Entity, options: Partial<Pick<RectangleOptions, 'material' | 'outline' | 'outlineColor' | 'outlineWidth'>>): void;
52
+ /**
53
+ * 移除 Rectangle(通过实体或实体 id)
54
+ */
55
+ remove(entityOrId: Entity | string): boolean;
44
56
  }
@@ -0,0 +1,95 @@
1
+ import { Viewer, Entity, Color } from '../../../node_modules/cesium';
2
+ import { OverlayPosition } from './types';
3
+ /**
4
+ * Ring(边缘发光圆环)选项
5
+ */
6
+ export interface RingOptions {
7
+ /** 中心点(经纬度/高度 或 Cartesian3) */
8
+ position: OverlayPosition;
9
+ /** 半径(米) */
10
+ radius: number;
11
+ /** 边缘发光颜色 */
12
+ color?: Color | string;
13
+ /** 是否绘制内层线(默认 true)。关闭可去掉“白色芯子” */
14
+ showInnerLine?: boolean;
15
+ /** 实线颜色 */
16
+ lineColor?: Color | string;
17
+ /** 内层线型:实线/虚线(默认 solid) */
18
+ lineStyle?: "solid" | "dashed";
19
+ /** 虚线材质方案:stripe(默认) / dash */
20
+ lineMaterialMode?: "stripe" | "dash";
21
+ /** stripe 模式:条纹重复次数(默认 32) */
22
+ stripeRepeat?: number;
23
+ /** 虚线长度(像素,默认 16) */
24
+ dashLength?: number;
25
+ /** 虚线模式(16bit pattern,可选) */
26
+ dashPattern?: number;
27
+ /** 虚线间隙颜色(默认透明) */
28
+ gapColor?: Color | string;
29
+ /** 线宽(像素) */
30
+ width?: number;
31
+ /** 外层发光线宽(像素)。优先于 width */
32
+ glowWidth?: number;
33
+ /** 内层实线线宽(像素)。不传则使用自动计算 */
34
+ lineWidth?: number;
35
+ /** 发光强度(0-1),越大越“亮/粗” */
36
+ glowPower?: number;
37
+ /** 是否贴地(默认 true) */
38
+ clampToGround?: boolean;
39
+ /** 圆环分段数(默认 128),越大越圆滑 */
40
+ segments?: number;
41
+ /** 覆盖物点击回调 */
42
+ onClick?: (entity: Entity) => void;
43
+ id?: string;
44
+ }
45
+ /**
46
+ * Ring 工具类:使用 polyline + PolylineGlowMaterialProperty 实现发光圆环
47
+ */
48
+ export declare class MapRing {
49
+ private viewer;
50
+ private entities;
51
+ constructor(viewer: Viewer);
52
+ /**
53
+ * 转换位置为 Cartesian3
54
+ */
55
+ private convertPosition;
56
+ /**
57
+ * 转换颜色
58
+ */
59
+ private resolveColor;
60
+ private resolveLineMaterial;
61
+ private resolveGlowMaterial;
62
+ private getInnerWidth;
63
+ private addInnerEntity;
64
+ private removeInnerEntity;
65
+ private rebuildRingPositions;
66
+ /**
67
+ * 生成近似圆顶点(Cartesian3 数组)。segments 越大越平滑。
68
+ * 这里沿用 MapCircle 的大圆航线近似,保证在经纬度空间更稳定。
69
+ */
70
+ private generateCirclePositions;
71
+ /**
72
+ * 添加 Ring(边缘发光圆环)
73
+ */
74
+ add(options: RingOptions): Entity;
75
+ /**
76
+ * 更新 Ring 中心
77
+ */
78
+ updatePosition(entity: Entity, position: OverlayPosition): void;
79
+ /**
80
+ * 更新 Ring 半径
81
+ */
82
+ updateRadius(entity: Entity, radius: number): void;
83
+ /**
84
+ * 更新 Ring 样式
85
+ */
86
+ updateStyle(entity: Entity, options: Partial<Pick<RingOptions, "color" | "showInnerLine" | "lineColor" | "lineStyle" | "lineMaterialMode" | "stripeRepeat" | "dashLength" | "dashPattern" | "gapColor" | "width" | "glowWidth" | "lineWidth" | "glowPower" | "clampToGround" | "segments">>): void;
87
+ /**
88
+ * 显示/隐藏 Ring
89
+ */
90
+ setVisible(entity: Entity, visible: boolean): void;
91
+ /**
92
+ * 移除 Ring(通过实体或实体 id)
93
+ */
94
+ remove(entityOrId: Entity | string): boolean;
95
+ }
@@ -56,4 +56,8 @@ export declare class MapSVG {
56
56
  * 更新 SVG 样式
57
57
  */
58
58
  updateStyle(entity: Entity, options: Partial<Pick<SvgOptions, 'scale' | 'rotation' | 'color'>>): void;
59
+ /**
60
+ * 移除 SVG(通过实体或实体 id)
61
+ */
62
+ remove(entityOrId: Entity | string): boolean;
59
63
  }
@@ -8,6 +8,7 @@ export { MapPolyline } from './MapPolyline';
8
8
  export { MapPolygon } from './MapPolygon';
9
9
  export { MapRectangle } from './MapRectangle';
10
10
  export { MapCircle } from './MapCircle';
11
+ export { MapRing } from './MapRing';
11
12
  export type { OverlayPosition } from './types';
12
13
  export type { MarkerOptions } from './MapMarker';
13
14
  export type { LabelOptions } from './MapLabel';
@@ -18,3 +19,4 @@ export type { PolylineOptions } from './MapPolyline';
18
19
  export type { PolygonOptions } from './MapPolygon';
19
20
  export type { RectangleOptions } from './MapRectangle';
20
21
  export type { CircleOptions } from './MapCircle';
22
+ export type { RingOptions } from './MapRing';
@@ -1,5 +1,41 @@
1
- import { Cartesian3 } from '../../../node_modules/cesium';
1
+ import { Cartesian3, Entity, Color, MaterialProperty, Rectangle, Cartographic } from '../../../node_modules/cesium';
2
2
  /**
3
3
  * 覆盖物位置类型
4
4
  */
5
5
  export type OverlayPosition = Cartesian3 | [number, number] | [number, number, number];
6
+ /**
7
+ * 覆盖物扩展实体类型
8
+ * 用于在 Cesium.Entity 上挂载覆盖物相关的元数据
9
+ */
10
+ export interface OverlayEntity extends Entity {
11
+ /** 覆盖物点击回调(由各 Map* 工具类设置) */
12
+ _onClick?: (entity: Entity) => void;
13
+ /** 覆盖物类型标识(用于 CesiumOverlayService 做差异化更新/删除) */
14
+ _overlayType?: string;
15
+ /** 信息窗口根 DOM(由 MapInfoWindow / CesiumOverlayService 使用) */
16
+ _infoWindow?: HTMLElement;
17
+ /** 复合图形的内层实体或边框实体等关联引用 */
18
+ _borderEntity?: Entity;
19
+ _innerEntity?: Entity;
20
+ /** 粗边框 / 环形等形状相关元数据 */
21
+ _isThickOutline?: boolean;
22
+ _outlineWidth?: number;
23
+ _isRing?: boolean;
24
+ _ringThickness?: number;
25
+ _ringSegments?: number;
26
+ _ringGlowPower?: number;
27
+ _ringLineColor?: Color | string;
28
+ _ringLineStyle?: 'solid' | 'dashed';
29
+ _ringLineMaterialMode?: 'stripe' | 'dash';
30
+ _ringStripeRepeat?: number;
31
+ _ringDashLength?: number;
32
+ _ringDashPattern?: number;
33
+ _ringGapColor?: Color | string;
34
+ _ringShowInnerLine?: boolean;
35
+ _fillMaterial?: MaterialProperty | Color | string;
36
+ _ringHeightEpsilon?: number;
37
+ _centerCartographic?: Cartographic;
38
+ _outerRadius?: number;
39
+ _innerRadius?: number;
40
+ _outerRectangle?: Rectangle;
41
+ }