@xingm/vmap-cesium-toolbar 0.0.3 → 0.0.4-alpha.2

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.
Files changed (40) hide show
  1. package/README.md +7 -0
  2. package/dist/hooks/useDrawHelper.d.ts +1 -49
  3. package/dist/hooks/useHeatmapHelper.d.ts +1 -17
  4. package/dist/hooks/useOverlayHelper.d.ts +1 -221
  5. package/dist/hooks/usePointClusterHelper.d.ts +1 -11
  6. package/dist/i18n/en-US.d.ts +5 -0
  7. package/dist/i18n/zh-CN.d.ts +5 -0
  8. package/dist/index.es.js +2125 -1571
  9. package/dist/index.es.js.map +1 -1
  10. package/dist/index.umd.js +45 -14
  11. package/dist/index.umd.js.map +1 -1
  12. package/dist/libs/CesiumMapDraw.d.ts +20 -31
  13. package/dist/libs/CesiumMapLoader.d.ts +1 -0
  14. package/dist/libs/CesiumMapModel.d.ts +6 -0
  15. package/dist/libs/CesiumOverlayService.d.ts +16 -24
  16. package/dist/libs/CesiumPointClusterLayer.d.ts +21 -1
  17. package/dist/libs/PickGovernor.d.ts +23 -0
  18. package/dist/libs/drawHelper/DrawCircle.d.ts +1 -0
  19. package/dist/libs/drawHelper/DrawHint.d.ts +32 -0
  20. package/dist/libs/drawHelper/DrawLine.d.ts +1 -0
  21. package/dist/libs/drawHelper/index.d.ts +1 -0
  22. package/dist/libs/i18n/en-US.d.ts +3 -0
  23. package/dist/libs/i18n/zh-CN.d.ts +3 -0
  24. package/dist/libs/overlay/MapCircle.d.ts +2 -0
  25. package/dist/libs/overlay/MapPolygon.d.ts +2 -0
  26. package/dist/libs/overlay/MapPolyline.d.ts +4 -0
  27. package/dist/libs/overlay/MapRectangle.d.ts +2 -0
  28. package/dist/libs/overlay/MapRing.d.ts +3 -1
  29. package/dist/libs/overlay/OverlayEditController.d.ts +18 -20
  30. package/dist/libs/overlay/OverlayEditHandles.d.ts +63 -0
  31. package/dist/libs/overlay/OverlayHighlight.d.ts +40 -0
  32. package/dist/libs/overlay/primitives/CirclePrimitiveBatch.d.ts +1 -0
  33. package/dist/libs/overlay/primitives/PolygonPrimitiveBatch.d.ts +1 -0
  34. package/dist/libs/overlay/primitives/RectanglePrimitiveBatch.d.ts +1 -0
  35. package/dist/libs/overlay/types.d.ts +2 -0
  36. package/dist/libs/toolBar/MapLayersService.d.ts +18 -1
  37. package/dist/package.json +46 -0
  38. package/dist/style.css +162 -0
  39. package/dist/utils/selfIntersection.d.ts +2 -0
  40. package/package.json +1 -1
@@ -20,11 +20,7 @@ declare class DrawHelper {
20
20
  private publicEntities;
21
21
  private _doubleClickPending;
22
22
  private lastPreviewPosition;
23
- private drawHintEntity;
24
- private drawHintText;
25
- private drawHintLastPosition;
26
- private drawHintOverrideText;
27
- private drawHintOverrideUntil;
23
+ private drawHintHelper;
28
24
  private lastLeftClickDebug;
29
25
  private static activeDrawingHelper;
30
26
  private drawLine;
@@ -34,6 +30,7 @@ declare class DrawHelper {
34
30
  private currentDrawer;
35
31
  private screenSpaceEventHandler;
36
32
  private entityClickHandler;
33
+ private readonly pickGovernor;
37
34
  private terrainRefineQueue;
38
35
  private terrainRefineInFlight;
39
36
  private terrainRefineLastTick;
@@ -56,6 +53,10 @@ declare class DrawHelper {
56
53
  * 其它模块(如覆盖物服务)继续触发 pick,引发 ground/worker 相关异常。
57
54
  */
58
55
  private setPickCooldown;
56
+ /**
57
+ * 检查当前是否处于拾取(blocked)状态
58
+ * @returns {boolean} 如果当前时间小于设定的阻塞时间,则返回true表示拾取被阻塞,否则返回false
59
+ */
59
60
  private isPickBlocked;
60
61
  /**
61
62
  * 在实体被加入场景后、渲染循环更新前做一次快速校验。
@@ -73,6 +74,11 @@ declare class DrawHelper {
73
74
  * @param viewer Cesium Viewer 实例
74
75
  */
75
76
  constructor(viewer: Cesium.Viewer);
77
+ /**
78
+ * 检测并输出可能存在高度限制问题的实体信息
79
+ * @param tag 标识本次检测的唯一标签
80
+ * @returns 返回包含检测结果的报告对象
81
+ */
76
82
  private dumpPotentialClampingEntities;
77
83
  /**
78
84
  * 对新创建的实体进行净化处理,确保其符合渲染要求
@@ -80,7 +86,16 @@ declare class DrawHelper {
80
86
  * @param tag - 用于标识来源的标签,会在控制台警告时显示
81
87
  */
82
88
  private sanitizeNewEntity;
89
+ /**
90
+ * 安装实体添加钩子函数,用于在实体被添加到EntityCollection时进行安全检查和处理
91
+ * 这是一个私有方法,主要用于拦截和修改Cesium中EntityCollection的add方法
92
+ */
83
93
  private installEntitiesAddHook;
94
+ /**
95
+ * 卸载实体集合添加钩子函数
96
+ * 该方法用于移除之前添加到EntityCollection原型中的自定义add方法
97
+ * 恢复原始的add方法实现
98
+ */
84
99
  private uninstallEntitiesAddHook;
85
100
  /**
86
101
  * 安装地面几何更新器调试钩子
@@ -95,32 +110,6 @@ declare class DrawHelper {
95
110
  * 根据场景模式更新偏移高度
96
111
  */
97
112
  private updateOffsetHeight;
98
- /**
99
- * 计算提示文本(随绘制模式 + 点数量变化)
100
- */
101
- private getDrawHintText;
102
- /**
103
- * 设置绘制提示覆盖文本及其持续时间
104
- * @param text 要显示的提示文本
105
- * @param ms 提示文本显示的持续时间(毫秒),默认为1200毫秒
106
- */
107
- private setDrawHintOverride;
108
- /**
109
- * 将提示位置转换为显示位置(按当前模式做轻微抬高,避免被地形遮挡)
110
- */
111
- private toHintDisplayPosition;
112
- /**
113
- * 创建或更新提示实体的位置与文本
114
- */
115
- private updateDrawHintPosition;
116
- /**
117
- * 更新提示文本(不改变位置;通常在点数变化时调用)
118
- */
119
- private refreshDrawHintTextOnly;
120
- /**
121
- * 清除绘制提示实体
122
- */
123
- private clearDrawHint;
124
113
  /**
125
114
  * 开始绘制线条
126
115
  */
@@ -8,6 +8,7 @@ interface InitOptions {
8
8
  terrain?: Terrain;
9
9
  terrainProvider?: TerrainProvider;
10
10
  mapType?: string;
11
+ tdtMapTypeId?: string;
11
12
  imageryProvider?: Cesium.UrlTemplateImageryProvider;
12
13
  imageryLayers?: Cesium.ImageryLayerCollection;
13
14
  terrainShadows?: Cesium.ShadowMode;
@@ -80,6 +80,12 @@ export interface MapType {
80
80
  id: string;
81
81
  name: string;
82
82
  nameKey?: string;
83
+ /** 选中态左上角“地名”文案(可选,未配置时走 i18n 默认 key) */
84
+ placeNameLabel?: string;
85
+ /** 选中态左上角“地名”文案 i18n key(可选) */
86
+ placeNameLabelKey?: string;
87
+ /** 是否强制始终显示地名层(不受 placeName 开关影响) */
88
+ forcePlaceName?: boolean;
83
89
  thumbnail: string;
84
90
  provider: (token: string) => Cesium.ImageryProvider[];
85
91
  terrainProvider?: (token: string) => Cesium.TerrainProvider | null;
@@ -23,6 +23,12 @@ export interface CesiumOverlayServiceOptions {
23
23
  * 参数为“已回写后的覆盖物 entity”。
24
24
  */
25
25
  onOverlayEditChange?: (entity: DrawEntity & OverlayEntity) => void;
26
+ /**
27
+ * 点击 pick 节流间隔(毫秒)。
28
+ * 用于降低 “贴地几何 + pick + ground pipeline” 的偶发 DataCloneError 风险。
29
+ * @default 120
30
+ */
31
+ clickPickMinIntervalMs?: number;
26
32
  }
27
33
  /**
28
34
  * Cesium 覆盖物服务类
@@ -36,21 +42,17 @@ export declare class CesiumOverlayService {
36
42
  /** 构造参数(用于开关 hover handler 等运行时策略) */
37
43
  private readonly options;
38
44
  private overlayEditor;
45
+ private overlayHighlight;
39
46
  private lastHoverTargets;
40
47
  private hoverPickRAF;
41
48
  private hoverPickPos;
42
49
  private overlayMutationRevision;
43
50
  private hoverSuspendUntil;
44
- private lastHoverPickTime;
45
- private lastHoverPickPos;
46
51
  private bulkUpdateDepth;
47
- private static readonly DEFAULT_HIGHLIGHT_COLOR;
48
- private static readonly DEFAULT_HIGHLIGHT_FILL_ALPHA;
49
- private static readonly DEFAULT_HIGHLIGHT_GLOW_POWER;
50
- private static readonly GLOW_OUTLINE_ROOT_ID_PROP;
51
- private static readonly HOVER_PICK_MIN_INTERVAL_MS;
52
- private static readonly HOVER_PICK_MIN_MOVE_PX;
52
+ private readonly clickPickMinIntervalMs;
53
+ private readonly pickGovernor;
53
54
  private static readonly HOVER_SUSPEND_AFTER_MUTATION_MS;
55
+ private static readonly CLICK_PICK_MIN_INTERVAL_MS;
54
56
  private markOverlayMutated;
55
57
  /**
56
58
  * 显式开始一次批量更新:在 begin/end 期间暂停 hover pick。
@@ -70,12 +72,6 @@ export declare class CesiumOverlayService {
70
72
  * 需要映射回 overlayMap 内的根覆盖物 id。
71
73
  */
72
74
  private normalizeOverlayPickId;
73
- private getEntityPropertyString;
74
- private mapGlowOutlineEntityToRoot;
75
- private getClosedPositions;
76
- private generateEllipseOutlinePositions;
77
- private ensureGlowOutline;
78
- private removeGlowOutline;
79
75
  private resolveOverlayByPickId;
80
76
  private resolvePickedOverlayEntity;
81
77
  readonly marker: MapMarker;
@@ -117,6 +113,12 @@ export declare class CesiumOverlayService {
117
113
  * 设置实体点击处理器
118
114
  */
119
115
  private setupEntityClickHandler;
116
+ /**
117
+ * 开启或是关闭覆盖物的Hover高亮(鼠标移入高亮,移出取消)。
118
+ * - 开启后:覆盖物会触发高亮,且高亮状态会在鼠标移出时取消。
119
+ * - 关闭后:覆盖物不再触发 hover 高亮。
120
+ */
121
+ toggleOverlayHoverHighlight(enabled: boolean): void;
120
122
  /**
121
123
  * 开启/关闭覆盖物编辑模式。
122
124
  * - 开启后:点击覆盖物会进入编辑,并显示可拖拽控制点。
@@ -138,16 +140,6 @@ export declare class CesiumOverlayService {
138
140
  private setupEntityHoverHandler;
139
141
  private getPropertyValue;
140
142
  private getNumberProperty;
141
- private resolveHighlightOptions;
142
- private getActiveHighlightOptions;
143
- private setOverlayHighlightReason;
144
- private applyOverlayHighlightStyle;
145
- /**
146
- * 恢复覆盖物的高亮样式
147
- * @param entity - 覆盖物实体对象
148
- * @returns 无返回值
149
- */
150
- private restoreOverlayHighlightStyle;
151
143
  /**
152
144
  * 生成唯一ID
153
145
  */
@@ -1,4 +1,4 @@
1
- import { Viewer } from '../../node_modules/cesium';
1
+ import { Viewer, Entity } from '../../node_modules/cesium';
2
2
  import * as Cesium from 'cesium';
3
3
  export interface ClusterPoint {
4
4
  /** 业务 id(可选,建议传以便稳定更新) */
@@ -40,6 +40,17 @@ export interface PointClusterLayerOptions {
40
40
  clusterPixelSize?: number;
41
41
  /** 聚合点样式分段:用 count 决定颜色/大小 */
42
42
  clusterStyleSteps?: ClusterStyleStep[];
43
+ /** 自定义聚合点渲染(直接修改 cluster entity) */
44
+ renderCluster?: (args: {
45
+ cluster: Entity;
46
+ clusteredEntities: Entity[];
47
+ count: number;
48
+ }) => void;
49
+ /** 自定义单点渲染(直接修改 point entity) */
50
+ renderSinglePoint?: (args: {
51
+ entity: Entity;
52
+ point: ClusterPoint;
53
+ }) => void;
43
54
  /** 点击聚合点回调:返回该聚合内的原始点 */
44
55
  onClusterClick?: (points: ClusterPoint[], ctx: {
45
56
  screenPosition: Cesium.Cartesian2;
@@ -54,18 +65,27 @@ export interface PointClusterLayerOptions {
54
65
  idPrefix?: string;
55
66
  }
56
67
  export default class CesiumPointClusterLayer {
68
+ private static readonly CLUSTER_STYLE_MIN_INTERVAL_MS;
69
+ private static readonly CLICK_PICK_MIN_INTERVAL_MS;
57
70
  private viewer;
58
71
  private readonly options;
59
72
  private dataSource;
60
73
  private entityIdToPoint;
61
74
  private clickHandler;
62
75
  private readonly layerId;
76
+ private pendingClusterStyles;
77
+ private clusterStyleRAF;
78
+ private clusterStyleTimer;
79
+ private lastClusterStyleFlushTime;
80
+ private readonly pickGovernor;
63
81
  constructor(viewer: Viewer, options?: PointClusterLayerOptions);
64
82
  /** 设置/替换点数据(经纬度单位:度) */
65
83
  setData(points: ClusterPoint[]): void;
66
84
  setVisible(visible: boolean): void;
67
85
  setClusteringEnabled(enabled: boolean): void;
68
86
  destroy(): void;
87
+ private enqueueClusterStyle;
88
+ private flushClusterStyles;
69
89
  private applyClusterStyle;
70
90
  private pickStyle;
71
91
  private installClickHandler;
@@ -0,0 +1,23 @@
1
+ export type PickGovernorKind = 'hover' | 'click' | 'cluster' | 'draw' | 'edit';
2
+ export interface PickGovernorProfile {
3
+ minIntervalMs: number;
4
+ minMovePx: number;
5
+ }
6
+ export interface PickGovernorOptions {
7
+ profiles?: Partial<Record<PickGovernorKind, Partial<PickGovernorProfile>>>;
8
+ }
9
+ type PointLike = {
10
+ x: number;
11
+ y: number;
12
+ };
13
+ export declare function isMacPlatform(): boolean;
14
+ export declare class PickGovernor {
15
+ private readonly profiles;
16
+ private readonly lastByKind;
17
+ private suspendUntil;
18
+ constructor(options?: PickGovernorOptions);
19
+ shouldPick(kind: PickGovernorKind, point: PointLike, nowMs?: number): boolean;
20
+ suspend(ms: number): void;
21
+ private isFinitePoint;
22
+ }
23
+ export {};
@@ -11,6 +11,7 @@ export declare class DrawCircle extends BaseDraw {
11
11
  * 开始绘制
12
12
  */
13
13
  startDrawing(options?: DrawOptions): void;
14
+ addPoint(position: Cartesian3): void;
14
15
  /**
15
16
  * 更新绘制实体(预览)
16
17
  */
@@ -0,0 +1,32 @@
1
+ import * as Cesium from "cesium";
2
+ type DrawMode = "line" | "polygon" | "rectangle" | "circle" | null;
3
+ type DrawHintState = {
4
+ isDrawing: boolean;
5
+ drawMode: DrawMode;
6
+ tempPositions: Cesium.Cartesian3[];
7
+ offsetHeight: number;
8
+ };
9
+ export declare class DrawHintHelper {
10
+ private entities;
11
+ private getState;
12
+ private translate;
13
+ private drawHintEntity;
14
+ private drawHintText;
15
+ private drawHintLastPosition;
16
+ private drawHintOverrideText;
17
+ private drawHintOverrideUntil;
18
+ constructor(entities: Cesium.EntityCollection, getState: () => DrawHintState, translate: (key: string, params?: Record<string, any>) => string);
19
+ handleSceneModeChanged(): void;
20
+ setOverride(options: Cesium.LabelGraphics | Cesium.LabelGraphics.ConstructorOptions, ms?: number): void;
21
+ updatePosition(position: Cesium.Cartesian3): void;
22
+ refreshTextOnly(): void;
23
+ clear(): void;
24
+ /**
25
+ * 获取绘图提示文本的公共方法
26
+ * 根据当前的绘图状态和模式返回相应的提示信息
27
+ * @returns {string} 返回对应的提示文本,如果不在绘图状态则返回空字符串
28
+ */
29
+ getDrawHintText(): string;
30
+ private toHintDisplayPosition;
31
+ }
32
+ export {};
@@ -9,6 +9,7 @@ export declare class DrawLine extends BaseDraw {
9
9
  private currentTotalLabel;
10
10
  private currentLinePositions;
11
11
  private isTotalLabelWarmedUp;
12
+ private readonly avoidGroundPipeline;
12
13
  /**
13
14
  * 清理当前线段/总距离标签(不影响线实体本身)
14
15
  */
@@ -3,3 +3,4 @@ export { DrawLine } from './DrawLine';
3
3
  export { DrawPolygon } from './DrawPolgon';
4
4
  export { DrawRectangle } from './DrawRectangle';
5
5
  export { DrawCircle } from './DrawCircle';
6
+ export { DrawHintHelper } from './DrawHint';
@@ -32,6 +32,9 @@ declare const enUS: {
32
32
  overlay: {
33
33
  airport: string;
34
34
  };
35
+ map_type: {
36
+ place_name: string;
37
+ };
35
38
  };
36
39
  map_type: {
37
40
  normal: string;
@@ -32,6 +32,9 @@ declare const zhCN: {
32
32
  overlay: {
33
33
  airport: string;
34
34
  };
35
+ map_type: {
36
+ place_name: string;
37
+ };
35
38
  };
36
39
  map_type: {
37
40
  normal: string;
@@ -29,6 +29,8 @@ export interface CircleOptions {
29
29
  * - false:填充与边框都使用 position 高度悬空。
30
30
  */
31
31
  clampToGround?: boolean;
32
+ /** 贴地抬高量(米,clampToGround=true 时生效) */
33
+ groundHeightEpsilon?: number;
32
34
  heightReference?: HeightReference;
33
35
  extrudedHeight?: number;
34
36
  heightEpsilon?: number;
@@ -23,6 +23,8 @@ export interface PolygonOptions {
23
23
  * - false:填充与边框都在统一的 baseHeight 上悬空。
24
24
  */
25
25
  clampToGround?: boolean;
26
+ /** 贴地抬高量(米,clampToGround=true 时生效) */
27
+ groundHeightEpsilon?: number;
26
28
  heightReference?: HeightReference;
27
29
  extrudedHeight?: number;
28
30
  /** 点击该覆盖物时是否高亮显示(默认 false)。支持传入自定义颜色等参数 */
@@ -9,6 +9,8 @@ export interface PolylineOptions {
9
9
  width?: number;
10
10
  material?: Cesium.MaterialProperty | Color | string;
11
11
  clampToGround?: boolean;
12
+ /** 贴地抬高量(米,clampToGround=true 时生效) */
13
+ groundHeightEpsilon?: number;
12
14
  /** 点击该覆盖物时是否高亮显示(默认 false)。支持传入自定义颜色等参数 */
13
15
  clickHighlight?: boolean | {
14
16
  color?: Color | string;
@@ -28,6 +30,7 @@ export interface PolylineOptions {
28
30
  export declare class MapPolyline {
29
31
  private viewer;
30
32
  private entities;
33
+ private readonly avoidGroundPipeline;
31
34
  constructor(viewer: Viewer);
32
35
  /**
33
36
  * 转换位置为 Cartesian3
@@ -41,6 +44,7 @@ export declare class MapPolyline {
41
44
  * 解析材质
42
45
  */
43
46
  private resolveMaterial;
47
+ private elevatePositions;
44
48
  /**
45
49
  * 添加 Polyline(折线)
46
50
  */
@@ -19,6 +19,8 @@ export interface RectangleOptions {
19
19
  outlineWidth?: number;
20
20
  /** 是否贴地(默认:在粗边框模式下为 true) */
21
21
  clampToGround?: boolean;
22
+ /** 贴地抬高量(米,clampToGround=true 时生效) */
23
+ groundHeightEpsilon?: number;
22
24
  /** 悬空时的基准高度(米,clampToGround=false 时有效) */
23
25
  height?: number;
24
26
  heightReference?: HeightReference;
@@ -36,6 +36,8 @@ export interface RingOptions {
36
36
  glowPower?: number;
37
37
  /** 是否贴地(默认 true) */
38
38
  clampToGround?: boolean;
39
+ /** 贴地抬高量(米,clampToGround=true 时生效) */
40
+ groundHeightEpsilon?: number;
39
41
  /** 圆环分段数(默认 128),越大越圆滑 */
40
42
  segments?: number;
41
43
  /** 覆盖物点击回调 */
@@ -93,7 +95,7 @@ export declare class MapRing {
93
95
  /**
94
96
  * 更新 Ring 样式
95
97
  */
96
- updateStyle(entity: Entity, options: Partial<Pick<RingOptions, "color" | "showInnerLine" | "lineColor" | "lineStyle" | "lineMaterialMode" | "stripeRepeat" | "dashLength" | "dashPattern" | "gapColor" | "width" | "glowWidth" | "lineWidth" | "glowPower" | "clampToGround" | "segments">>): void;
98
+ updateStyle(entity: Entity, options: Partial<Pick<RingOptions, "color" | "showInnerLine" | "lineColor" | "lineStyle" | "lineMaterialMode" | "stripeRepeat" | "dashLength" | "dashPattern" | "gapColor" | "width" | "glowWidth" | "lineWidth" | "glowPower" | "clampToGround" | "segments" | "groundHeightEpsilon">>): void;
97
99
  /**
98
100
  * 显示/隐藏 Ring
99
101
  */
@@ -31,6 +31,7 @@ export declare class OverlayEditController {
31
31
  private readonly host;
32
32
  private enabled;
33
33
  private handler;
34
+ private readonly pickGovernor;
34
35
  private onChange;
35
36
  private editingTarget;
36
37
  private editingKind;
@@ -62,6 +63,7 @@ export declare class OverlayEditController {
62
63
  * @returns true 表示成功进入编辑
63
64
  */
64
65
  start(entityOrId: (DrawEntity & OverlayEntity) | string): boolean;
66
+ private resolveEditTarget;
65
67
  private detectEditableKind;
66
68
  private getPropertyValue;
67
69
  private getNumberProperty;
@@ -72,21 +74,22 @@ export declare class OverlayEditController {
72
74
  private getEditablePointPosition;
73
75
  private getEditableRectangle;
74
76
  private getEditableCircleInfo;
75
- /**
76
- * 确保编辑处理器已初始化
77
- * 如果处理器不存在,则创建一个新的 ScreenSpaceEventHandler 并设置各种交互事件处理函数
78
- * @private
79
- */
80
- /**
81
- * 确保事件处理器已初始化
82
- * 如果处理器不存在,则创建并设置各种事件处理函数
83
- * @private
84
- */
85
77
  /**
86
78
  * 确保屏幕空间事件处理器已初始化
87
79
  * 如果处理器不存在,则创建一个新的处理器并设置各种交互事件
88
80
  */
89
81
  private ensureHandler;
82
+ private beginDrag;
83
+ private beginMoveDrag;
84
+ private computeMovedPositions;
85
+ private emitChange;
86
+ private prepareOnChangeTarget;
87
+ private resolveOverlayTypeFromId;
88
+ private attachMarkerLngLat;
89
+ private attachPolylineLngLat;
90
+ private attachCircleLngLat;
91
+ private attachPolygonLngLat;
92
+ private attachRectangleLngLat;
90
93
  private captureDragSnapshot;
91
94
  private isGeometryChangedSinceSnapshot;
92
95
  private destroyHandler;
@@ -94,17 +97,8 @@ export declare class OverlayEditController {
94
97
  private restoreCameraController;
95
98
  private clearHandles;
96
99
  private rebuildHandles;
100
+ private getHandleHelpers;
97
101
  private createHandle;
98
- private buildPolygonHandles;
99
- private buildRectangleHandles;
100
- private buildPolylineHandles;
101
- private buildPointHandles;
102
- private buildCircleHandles;
103
- private updatePolygonHandlePositions;
104
- private updateRectangleHandlePositions;
105
- private updatePolylineHandlePositions;
106
- private updatePointHandlePositions;
107
- private updateCircleHandlePositions;
108
102
  private applyEditedPolygon;
109
103
  private applyEditedRectangle;
110
104
  private applyEditedCircle;
@@ -112,10 +106,14 @@ export declare class OverlayEditController {
112
106
  private applyEditedPoint;
113
107
  private getEditingClampToGround;
114
108
  private getCartesianHeight;
109
+ private convertOutlineToLngLat;
110
+ private convertPositionToLngLat;
111
+ private convertCartoToLngLat;
115
112
  private pickCartesianOnGlobe;
116
113
  private computeSurfaceDistanceMeters;
117
114
  private circleRadiusHandlePosition;
118
115
  private rectangleToPositions;
116
+ private rectangleToLngLatPositions;
119
117
  private positionsToRectangle;
120
118
  private getRectangleEditHeight;
121
119
  private computePolygonCenterCartesian;
@@ -0,0 +1,63 @@
1
+ import * as Cesium from "cesium";
2
+ /**
3
+ * 句柄样式(颜色/描边/像素大小)
4
+ */
5
+ export type HandleStyle = {
6
+ color: Cesium.Color;
7
+ outlineColor: Cesium.Color;
8
+ pixelSize: number;
9
+ };
10
+ /**
11
+ * 创建编辑句柄实体
12
+ */
13
+ export type CreateHandle = (position: Cesium.Cartesian3, style: HandleStyle, meta: any) => Cesium.Entity;
14
+ /**
15
+ * 构建/更新句柄所需的依赖函数集合
16
+ */
17
+ export interface HandleHelpers {
18
+ createHandle: CreateHandle;
19
+ computePolygonCenterCartesian: (positions: Cesium.Cartesian3[]) => Cesium.Cartesian3;
20
+ computePolylineHandleRadius: (positions: Cesium.Cartesian3[], center: Cesium.Cartesian3) => number;
21
+ offsetByMeters: (center: Cesium.Cartesian3, meters: number, bearingDeg: number) => Cesium.Cartesian3;
22
+ circleRadiusHandlePosition: (center: Cesium.Cartesian3, radiusMeters: number) => Cesium.Cartesian3;
23
+ }
24
+ /**
25
+ * 构建多边形编辑句柄(顶点/中点/整体移动)
26
+ */
27
+ export declare function buildPolygonHandles(verts: Cesium.Cartesian3[], helpers: HandleHelpers): Cesium.Entity[];
28
+ /**
29
+ * 构建矩形编辑句柄(顶点/边中点/整体移动)
30
+ */
31
+ export declare function buildRectangleHandles(verts: Cesium.Cartesian3[], helpers: HandleHelpers): Cesium.Entity[];
32
+ /**
33
+ * 构建折线编辑句柄(顶点/中点/整体移动/旋转/缩放)
34
+ */
35
+ export declare function buildPolylineHandles(verts: Cesium.Cartesian3[], helpers: HandleHelpers): Cesium.Entity[];
36
+ /**
37
+ * 构建点编辑句柄
38
+ */
39
+ export declare function buildPointHandles(pos: Cesium.Cartesian3 | null, helpers: HandleHelpers): Cesium.Entity[];
40
+ /**
41
+ * 构建圆形编辑句柄(圆心/半径)
42
+ */
43
+ export declare function buildCircleHandles(center: Cesium.Cartesian3 | null, radiusMeters: number, helpers: HandleHelpers): Cesium.Entity[];
44
+ /**
45
+ * 更新多边形句柄位置
46
+ * @returns false 表示句柄数量不匹配,需重建
47
+ */
48
+ export declare function updatePolygonHandlePositions(verts: Cesium.Cartesian3[], handles: Cesium.Entity[], helpers: HandleHelpers): boolean;
49
+ /**
50
+ * 更新折线句柄位置
51
+ * @returns false 表示句柄数量不匹配,需重建
52
+ */
53
+ export declare function updatePolylineHandlePositions(verts: Cesium.Cartesian3[], handles: Cesium.Entity[], helpers: HandleHelpers): boolean;
54
+ /**
55
+ * 更新点句柄位置
56
+ * @returns false 表示句柄数量不匹配或参数为空
57
+ */
58
+ export declare function updatePointHandlePositions(pos: Cesium.Cartesian3 | null, handles: Cesium.Entity[]): boolean;
59
+ /**
60
+ * 更新圆形句柄位置
61
+ * @returns false 表示句柄数量不匹配或参数为空
62
+ */
63
+ export declare function updateCircleHandlePositions(center: Cesium.Cartesian3 | null, radiusMeters: number, handles: Cesium.Entity[], helpers: HandleHelpers): boolean;
@@ -0,0 +1,40 @@
1
+ import { Entity } from '../../../node_modules/cesium';
2
+ import { DrawEntity } from '../drawHelper';
3
+ import { OverlayEntity } from './types';
4
+ import { MapCircle } from './MapCircle';
5
+ import { MapPolygon } from './MapPolygon';
6
+ import { MapRectangle } from './MapRectangle';
7
+ import * as Cesium from "cesium";
8
+ export interface OverlayHighlightHost {
9
+ getEntities(): Cesium.EntityCollection;
10
+ getOverlayById(id: string): (DrawEntity & OverlayEntity) | undefined;
11
+ getPropertyValue<T>(prop: any, fallback: T): T;
12
+ getNumberProperty(prop: any, fallback: number): number;
13
+ getCircle(): MapCircle;
14
+ getPolygon(): MapPolygon;
15
+ getRectangle(): MapRectangle;
16
+ }
17
+ export declare class OverlayHighlight {
18
+ private readonly host;
19
+ private static readonly DEFAULT_HIGHLIGHT_COLOR;
20
+ private static readonly DEFAULT_HIGHLIGHT_FILL_ALPHA;
21
+ private static readonly DEFAULT_HIGHLIGHT_GLOW_POWER;
22
+ private static readonly GLOW_OUTLINE_ROOT_ID_PROP;
23
+ private readonly entities;
24
+ constructor(host: OverlayHighlightHost);
25
+ mapGlowOutlineEntityToRoot(entity: Cesium.Entity): (DrawEntity & OverlayEntity) | null;
26
+ setOverlayHighlightReason(targets: Entity[], reason: "click" | "hover", enabled: boolean): void;
27
+ toggleOverlayHighlight(entity: OverlayEntity, reason?: "click" | "hover"): void;
28
+ setOverlayHighlight(entityOrId: OverlayEntity | string, enabled: boolean, reason?: "click" | "hover"): boolean;
29
+ private getEntityPropertyString;
30
+ private getPropertyValue;
31
+ private getNumberProperty;
32
+ private resolveHighlightOptions;
33
+ private getActiveHighlightOptions;
34
+ private getClosedPositions;
35
+ private generateEllipseOutlinePositions;
36
+ private ensureGlowOutline;
37
+ private removeGlowOutline;
38
+ private applyOverlayHighlightStyle;
39
+ private restoreOverlayHighlightStyle;
40
+ }
@@ -36,6 +36,7 @@ export declare class CirclePrimitiveBatch {
36
36
  setColors(circleId: string, ringColor: Cesium.Color, fillColor: Cesium.Color): void;
37
37
  private scheduleApplyColors;
38
38
  private scheduleRebuild;
39
+ private assertCloneableInstanceId;
39
40
  private rebuild;
40
41
  private applyCurrentColors;
41
42
  }
@@ -37,6 +37,7 @@ export declare class PolygonPrimitiveBatch {
37
37
  private scheduleApplyColors;
38
38
  setBorderWidth(polygonId: string, borderWidth: number): void;
39
39
  private scheduleRebuild;
40
+ private assertCloneableInstanceId;
40
41
  private rebuild;
41
42
  private applyCurrentColors;
42
43
  }
@@ -35,6 +35,7 @@ export declare class RectanglePrimitiveBatch {
35
35
  setColors(rectangleId: string, ringColor: Cesium.Color, fillColor: Cesium.Color): void;
36
36
  private scheduleApplyColors;
37
37
  private scheduleRebuild;
38
+ private assertCloneableInstanceId;
38
39
  private rebuild;
39
40
  private applyCurrentColors;
40
41
  }
@@ -87,6 +87,8 @@ export interface OverlayEntity extends Entity {
87
87
  _clampToGround?: boolean;
88
88
  /** 复合形状的基准高度(米,clampToGround=false 时有效) */
89
89
  _baseHeight?: number;
90
+ /** 贴地抬高量(米,clampToGround=true 时有效) */
91
+ _groundHeightEpsilon?: number;
90
92
  _isThickOutline?: boolean;
91
93
  _outlineWidth?: number;
92
94
  _isRing?: boolean;