@xingm/vmap-cesium-toolbar 0.0.6 → 1.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.
Files changed (133) hide show
  1. package/README.md +126 -230
  2. package/dist/README.md +172 -0
  3. package/dist/adapters/DrawHelperAdapter.d.ts +143 -0
  4. package/dist/adapters/MapLoaderAdapter.d.ts +44 -0
  5. package/dist/adapters/OverlayServiceAdapter.d.ts +102 -0
  6. package/dist/adapters/ToolbarAdapter.d.ts +71 -0
  7. package/dist/adapters/index.d.ts +23 -0
  8. package/dist/components/BaseComponent.d.ts +116 -0
  9. package/dist/components/SearchBox.d.ts +136 -0
  10. package/dist/components/Toolbar.d.ts +115 -0
  11. package/dist/components/ToolbarButton.d.ts +100 -0
  12. package/dist/components/index.d.ts +33 -0
  13. package/dist/core/MapPlugin.d.ts +164 -0
  14. package/dist/core/constants.d.ts +88 -0
  15. package/dist/core/entities/BaseOverlay.d.ts +156 -0
  16. package/dist/core/entities/Circle.d.ts +102 -0
  17. package/dist/core/entities/Icon.d.ts +86 -0
  18. package/dist/core/entities/InfoWindow.d.ts +116 -0
  19. package/dist/core/entities/Label.d.ts +92 -0
  20. package/dist/core/entities/Marker.d.ts +66 -0
  21. package/dist/core/entities/Polygon.d.ts +93 -0
  22. package/dist/core/entities/Polyline.d.ts +72 -0
  23. package/dist/core/entities/Rectangle.d.ts +99 -0
  24. package/dist/core/entities/Ring.d.ts +114 -0
  25. package/dist/core/entities/SVG.d.ts +89 -0
  26. package/dist/core/entities/index.d.ts +27 -0
  27. package/dist/core/index.d.ts +25 -0
  28. package/dist/core/layers/BaiduMapLayer.d.ts +37 -0
  29. package/dist/core/layers/CustomMapLayer.d.ts +43 -0
  30. package/dist/core/layers/GaodeMapLayer.d.ts +41 -0
  31. package/dist/core/layers/HeatmapLayer.d.ts +118 -0
  32. package/dist/core/layers/MapLayer.d.ts +37 -0
  33. package/dist/core/layers/OSMMapLayer.d.ts +37 -0
  34. package/dist/core/layers/PointClusterLayer.d.ts +119 -0
  35. package/dist/core/layers/TDTMapLayer.d.ts +61 -0
  36. package/dist/core/layers/index.d.ts +16 -0
  37. package/dist/core/services/draw/DrawInteractionController.d.ts +16 -0
  38. package/dist/core/services/draw/DrawService.d.ts +38 -0
  39. package/dist/core/services/draw/DrawSessionStore.d.ts +28 -0
  40. package/dist/core/services/draw/drawDefaults.d.ts +16 -0
  41. package/dist/core/services/draw/entities/drawEntityFactory.d.ts +10 -0
  42. package/dist/core/services/draw/entities/drawEntityRegistry.d.ts +8 -0
  43. package/dist/core/services/draw/entities/drawFinalFactory.d.ts +14 -0
  44. package/dist/core/services/draw/entities/drawPreviewFactory.d.ts +15 -0
  45. package/dist/core/services/draw/geometry/drawGeometry.d.ts +11 -0
  46. package/dist/core/services/draw/geometry/drawPosition.d.ts +6 -0
  47. package/dist/core/services/draw/index.d.ts +7 -0
  48. package/dist/core/services/draw/labels/drawHint.d.ts +16 -0
  49. package/dist/core/services/draw/labels/measurementCanvas.d.ts +8 -0
  50. package/dist/core/services/draw/labels/measurementLabelFactory.d.ts +18 -0
  51. package/dist/core/services/draw/measurementThemeResolver.d.ts +9 -0
  52. package/dist/core/services/draw/types/drawState.d.ts +37 -0
  53. package/dist/core/services/draw/types/drawTypes.d.ts +97 -0
  54. package/dist/core/services/index.d.ts +10 -0
  55. package/dist/core/services/overlay/OverlayService.d.ts +188 -0
  56. package/dist/core/services/overlay/index.d.ts +7 -0
  57. package/dist/core/services/toolbar/ToolbarService.d.ts +175 -0
  58. package/dist/core/services/toolbar/buttons/BaseButtonHandler.d.ts +111 -0
  59. package/dist/core/services/toolbar/buttons/LayersButtonHandler.d.ts +47 -0
  60. package/dist/core/services/toolbar/buttons/MeasureButtonHandler.d.ts +94 -0
  61. package/dist/core/services/toolbar/buttons/SearchButtonHandler.d.ts +111 -0
  62. package/dist/core/services/toolbar/buttons/SimpleButtonHandler.d.ts +79 -0
  63. package/dist/core/services/toolbar/config.d.ts +7 -0
  64. package/dist/core/services/toolbar/index.d.ts +30 -0
  65. package/dist/core/services/toolbar/menus/BaseMenu.d.ts +99 -0
  66. package/dist/core/services/toolbar/menus/MeasureMenu.d.ts +44 -0
  67. package/dist/core/services/toolbar/types.d.ts +198 -0
  68. package/dist/core/types.d.ts +592 -0
  69. package/dist/i18n/en-US.d.ts +47 -0
  70. package/dist/i18n/index.d.ts +45 -2
  71. package/dist/i18n/zh-CN.d.ts +47 -0
  72. package/dist/index.d.ts +37 -42
  73. package/dist/index.es.js +6952 -9670
  74. package/dist/index.es.js.map +1 -1
  75. package/dist/libs/CesiumMapModel.d.ts +1 -172
  76. package/dist/libs/CesiumMapToolbar.d.ts +1 -1
  77. package/dist/libs/CesiumOverlayService.d.ts +9 -222
  78. package/dist/libs/config/CesiumMapConfig.d.ts +5 -12
  79. package/dist/libs/drawHelper/DrawHint.d.ts +15 -27
  80. package/dist/libs/drawHelper/index.d.ts +67 -6
  81. package/dist/libs/toolBar/CesiumMapController.d.ts +38 -64
  82. package/dist/libs/toolBar/MapLayersService.d.ts +10 -61
  83. package/dist/libs/toolBar/MapSearchService.d.ts +8 -29
  84. package/dist/libs/toolBar/MapToolBarConfig.d.ts +33 -5
  85. package/dist/libs/toolBar/MeasurementService.d.ts +13 -5
  86. package/dist/libs/toolBar/NotFlyZonesService.d.ts +6 -41
  87. package/dist/package.json +20 -6
  88. package/dist/styles/ComponentStyles.d.ts +82 -0
  89. package/dist/styles/StyleManager.d.ts +142 -0
  90. package/dist/styles/index.d.ts +128 -0
  91. package/dist/utils/common.d.ts +4 -0
  92. package/package.json +79 -73
  93. package/dist/hooks/toolBarConfig.d.ts +0 -75
  94. package/dist/hooks/useDrawHelper.d.ts +0 -24
  95. package/dist/hooks/useDynamicRing.d.ts +0 -44
  96. package/dist/hooks/useHeatmapHelper.d.ts +0 -18
  97. package/dist/hooks/useMap.d.ts +0 -14
  98. package/dist/hooks/useMapInit.d.ts +0 -14
  99. package/dist/hooks/useOverlayHelper.d.ts +0 -48
  100. package/dist/hooks/usePointClusterHelper.d.ts +0 -14
  101. package/dist/index.umd.js +0 -326
  102. package/dist/index.umd.js.map +0 -1
  103. package/dist/libs/drawHelper/BaseDraw.d.ts +0 -194
  104. package/dist/libs/drawHelper/DrawCircle.d.ts +0 -31
  105. package/dist/libs/drawHelper/DrawLine.d.ts +0 -49
  106. package/dist/libs/drawHelper/DrawPolgon.d.ts +0 -35
  107. package/dist/libs/drawHelper/DrawRectangle.d.ts +0 -24
  108. package/dist/libs/i18n/en-US.d.ts +0 -69
  109. package/dist/libs/i18n/index.d.ts +0 -25
  110. package/dist/libs/i18n/zh-CN.d.ts +0 -69
  111. package/dist/libs/overlay/MapCircle.d.ts +0 -130
  112. package/dist/libs/overlay/MapIcon.d.ts +0 -69
  113. package/dist/libs/overlay/MapInfoWindow.d.ts +0 -100
  114. package/dist/libs/overlay/MapLabel.d.ts +0 -73
  115. package/dist/libs/overlay/MapMarker.d.ts +0 -60
  116. package/dist/libs/overlay/MapPolygon.d.ts +0 -114
  117. package/dist/libs/overlay/MapPolyline.d.ts +0 -64
  118. package/dist/libs/overlay/MapRectangle.d.ts +0 -101
  119. package/dist/libs/overlay/MapRing.d.ts +0 -107
  120. package/dist/libs/overlay/MapSVG.d.ts +0 -73
  121. package/dist/libs/overlay/OverlayEditController.d.ts +0 -167
  122. package/dist/libs/overlay/OverlayEditHandles.d.ts +0 -101
  123. package/dist/libs/overlay/OverlayHighlight.d.ts +0 -40
  124. package/dist/libs/overlay/index.d.ts +0 -23
  125. package/dist/libs/overlay/primitives/CirclePrimitiveBatch.d.ts +0 -42
  126. package/dist/libs/overlay/primitives/CirclePrimitiveLayerStack.d.ts +0 -24
  127. package/dist/libs/overlay/primitives/PolygonPrimitiveBatch.d.ts +0 -43
  128. package/dist/libs/overlay/primitives/PolygonPrimitiveLayerStack.d.ts +0 -24
  129. package/dist/libs/overlay/primitives/RectanglePrimitiveBatch.d.ts +0 -41
  130. package/dist/libs/overlay/primitives/RectanglePrimitiveLayerStack.d.ts +0 -24
  131. package/dist/libs/overlay/types.d.ts +0 -121
  132. package/dist/z.const.d.ts +0 -24
  133. /package/dist/{libs → utils}/PickGovernor.d.ts +0 -0
@@ -1,194 +0,0 @@
1
- import { Viewer, Entity, Cartesian3 } from '../../../node_modules/cesium';
2
- import * as Cesium from "cesium";
3
- /**
4
- * 绘制结果接口
5
- */
6
- export interface DrawResult {
7
- entity: Entity | null;
8
- type: "line" | "polygon" | "rectangle" | "circle";
9
- positions: Cartesian3[];
10
- distance?: number;
11
- areaKm2?: number;
12
- }
13
- /**
14
- * 绘制回调接口
15
- */
16
- export interface DrawCallbacks {
17
- onDrawStart?: () => void;
18
- onDrawEnd?: (entity: Entity | null, result: DrawResult) => void;
19
- onEntityRemoved?: (entity: Entity) => void;
20
- onMeasureComplete?: (result: DrawResult) => void;
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
- /** 关联的测量/提示标签实体(例如面积标签) */
35
- _labelEntities?: Entity[];
36
- _onClick?: (entity: Entity, ...args: any[]) => void;
37
- _isSelected?: boolean;
38
- _originalStyle?: {
39
- material?: any;
40
- width?: any;
41
- outlineColor?: any;
42
- outlineWidth?: any;
43
- };
44
- };
45
- /**
46
- * 绘制时可选的样式和事件回调
47
- */
48
- export interface DrawOptions {
49
- strokeColor?: Cesium.Color | string;
50
- strokeWidth?: number;
51
- fillColor?: Cesium.Color | string;
52
- outlineColor?: Cesium.Color | string;
53
- outlineWidth?: number;
54
- selected?: {
55
- color?: Cesium.Color | string;
56
- width?: number;
57
- outlineColor?: Cesium.Color | string;
58
- outlineWidth?: number;
59
- };
60
- /** 是否显示面积标签(多边形/矩形)。默认 true */
61
- showAreaLabel?: boolean;
62
- /** 是否显示长度标签(线条)。默认 true */
63
- showDistanceLabel?: boolean;
64
- /**
65
- * 是否启用多边形自相交校验。
66
- * - false/未设置:默认允许交叉(不做校验)
67
- * - true:启用自相交校验(结合 selfIntersectionAllowTouch/AllowContinue 控制行为)
68
- */
69
- selfIntersectionEnabled?: boolean;
70
- /**
71
- * 多边形自相交校验:是否允许“擦边/顶点落在旧边上”等仅接触(touch)情况。
72
- * - false/未设置:touch 也视为不合法
73
- * - true:允许 touch,但仍不允许重叠(overlap)与真正穿越(cross)
74
- */
75
- selfIntersectionAllowTouch?: boolean;
76
- /**
77
- * 多边形自相交校验:当即将产生自相交时,是否仍允许继续绘制/完成绘制。
78
- * - false/未设置:检测到自相交则阻止落点/阻止完成
79
- * - true:检测到自相交不拦截(由业务自行承担后续面积/中心等偏差风险)
80
- */
81
- selfIntersectionAllowContinue?: boolean;
82
- onClick?: (entity: Entity, type?: "line" | "polygon" | "rectangle" | "circle", positions?: Cartesian3[]) => void;
83
- }
84
- /**
85
- * 基础绘制类
86
- * 包含所有绘制类型的通用逻辑
87
- */
88
- export declare abstract class BaseDraw {
89
- protected viewer: Viewer;
90
- protected scene: Cesium.Scene;
91
- protected entities: Cesium.EntityCollection;
92
- protected offsetHeight: number;
93
- protected originalDepthTestAgainstTerrain: boolean | null;
94
- /**
95
- * 当场景启用了 requestRenderMode(手动渲染)时,绘制过程中需要关闭该模式以保证动画和交互正常。
96
- * 在绘制结束或取消时应恢复为原始值。
97
- */
98
- protected originalRequestRenderMode: boolean | null;
99
- protected callbacks: DrawCallbacks;
100
- protected tempPositions: Cesium.Cartesian3[];
101
- protected tempEntities: Cesium.Entity[];
102
- protected tempLabelEntities: Cesium.Entity[];
103
- protected finishedPointEntities: Cesium.Entity[];
104
- /** 当前绘制的选项(如果有) */
105
- protected drawOptions?: DrawOptions;
106
- /**
107
- * 公开只读访问当前临时数据,供调度器使用
108
- */
109
- getTempPositions(): Cartesian3[];
110
- getTempEntities(): Entity[];
111
- getTempLabelEntities(): Entity[];
112
- getFinishedPointEntities(): Entity[];
113
- /**
114
- * 允许调度器安全地重建临时数据
115
- */
116
- setTempPositions(positions: Cartesian3[]): void;
117
- setTempEntities(entities: Entity[]): void;
118
- setTempLabelEntities(entities: Entity[]): void;
119
- /**
120
- * 供调度器调用的公开包装方法
121
- */
122
- addPointForHelper(position: Cartesian3): void;
123
- clearTempEntitiesForHelper(): void;
124
- /**
125
- * 清除当前绘制过程中的临时点实体
126
- * 仅删除带有 point 组件的临时实体,保留其它临时线/面实体
127
- */
128
- clearTempPointEntitiesForHelper(): void;
129
- /**
130
- * 删除最后一个点并根据剩余点重建预览实体
131
- * 供调度器在右键删除点时调用,具体重建逻辑仍由各子类的 updateDrawingEntity 实现
132
- */
133
- removeLastPointAndRedraw(): void;
134
- /**
135
- * 将任意颜色输入解析为 Cesium.Color
136
- */
137
- protected resolveColor(input?: Cesium.Color | string): Cesium.Color;
138
- /**
139
- * 应用/切换选中样式(统一逻辑,供调度器和子类共用)
140
- */
141
- protected applySelectedStyleToEntity(entity: Entity): void;
142
- /**
143
- * 恢复原始样式(兼容旧接口,内部仍走统一逻辑)
144
- */
145
- protected restoreOriginalStyleForEntity(entity: Entity): void;
146
- abstract updateDrawingEntity(previewPoint?: Cesium.Cartesian3): void;
147
- abstract startDrawing(options?: DrawOptions): void;
148
- /**
149
- * 抽象方法:完成绘制
150
- */
151
- abstract finishDrawing(): DrawResult | null;
152
- /**
153
- * 抽象方法:获取绘制类型
154
- */
155
- abstract getDrawType(): "line" | "polygon" | "rectangle" | "circle";
156
- constructor(viewer: Viewer, callbacks?: DrawCallbacks);
157
- /**
158
- * 根据场景模式更新偏移高度
159
- */
160
- protected updateOffsetHeight(): void;
161
- /**
162
- * 拾取地形或椭球体上的位置
163
- */
164
- protected pickGlobePosition(windowPosition: Cesium.Cartesian2): Cesium.Cartesian3 | null;
165
- /**
166
- * 如果场景启用了 requestRenderMode(手动渲染),在开始绘制时临时关闭以保证动画/交互正常。
167
- */
168
- protected enableContinuousRenderingIfNeeded(): void;
169
- /**
170
- * 在绘制完成或取消时恢复 requestRenderMode 到原始状态(如果曾被修改过)。
171
- */
172
- protected restoreRequestRenderModeIfNeeded(): void;
173
- /**
174
- * 添加一个点到临时位置数组并创建点实体
175
- */
176
- protected addPoint(position: Cesium.Cartesian3): void;
177
- /**
178
- * 创建总长/面积标签图片
179
- */
180
- protected createTotalLengthBillboardImage(text: string): HTMLCanvasElement;
181
- /**
182
- * 创建分段长度标签图片
183
- */
184
- protected createSegmentLengthBillboardImage(text: string): HTMLCanvasElement;
185
- /**
186
- * 清理临时实体
187
- */
188
- protected clearTempEntities(): void;
189
- }
190
- /**
191
- * 静态工具方法:切换实体的选中样式
192
- * 用于避免在多个模块中重复实现相同逻辑
193
- */
194
- export declare function toggleSelectedStyle(entity: DrawEntity): void;
@@ -1,31 +0,0 @@
1
- import { Cartesian3 } from '../../../node_modules/cesium';
2
- import { BaseDraw, DrawResult, DrawOptions } from './BaseDraw';
3
- /**
4
- * 画圆绘制类
5
- */
6
- export declare class DrawCircle extends BaseDraw {
7
- private currentCircleEntity;
8
- private currentBorderEntity;
9
- private centerPosition;
10
- /**
11
- * 开始绘制
12
- */
13
- startDrawing(options?: DrawOptions): void;
14
- addPoint(position: Cartesian3): void;
15
- /**
16
- * 更新绘制实体(预览)
17
- */
18
- updateDrawingEntity(previewPoint?: Cartesian3): void;
19
- /**
20
- * 完成绘制
21
- */
22
- finishDrawing(): DrawResult | null;
23
- /**
24
- * 获取绘制类型
25
- */
26
- getDrawType(): "line" | "polygon" | "rectangle" | "circle";
27
- /**
28
- * 生成近似圆(多边形)顶点
29
- */
30
- private generateCirclePositions;
31
- }
@@ -1,49 +0,0 @@
1
- import { Cartesian3 } from '../../../node_modules/cesium';
2
- import { BaseDraw, DrawResult, DrawOptions } from './BaseDraw';
3
- /**
4
- * 画线绘制类
5
- */
6
- export declare class DrawLine extends BaseDraw {
7
- private currentLineEntity;
8
- private currentSegmentLabels;
9
- private currentTotalLabel;
10
- private currentLinePositions;
11
- private isTotalLabelWarmedUp;
12
- private readonly avoidGroundPipeline;
13
- /**
14
- * 清理当前线段/总距离标签(不影响线实体本身)
15
- */
16
- private clearDistanceLabels;
17
- /**
18
- * 开始绘制
19
- */
20
- startDrawing(options?: DrawOptions): void;
21
- /**
22
- * 更新绘制实体(预览)
23
- */
24
- updateDrawingEntity(previewPoint?: Cartesian3): void;
25
- /**
26
- * 完成绘制
27
- */
28
- finishDrawing(): DrawResult | null;
29
- /**
30
- * 获取绘制类型
31
- */
32
- getDrawType(): "line" | "polygon" | "rectangle" | "circle";
33
- /**
34
- * 清理线条实体
35
- */
36
- private clearLineEntity;
37
- /**
38
- * 更新分段标签
39
- */
40
- private updateSegmentLabels;
41
- /**
42
- * 更新总距离标签
43
- */
44
- private updateTotalLabel;
45
- /**
46
- * 总长标签预热
47
- */
48
- private warmupTotalLengthLabel;
49
- }
@@ -1,35 +0,0 @@
1
- import { Cartesian3 } from '../../../node_modules/cesium';
2
- import { BaseDraw, DrawResult, DrawOptions } from './BaseDraw';
3
- /**
4
- * 画多边形绘制类
5
- */
6
- export declare class DrawPolygon extends BaseDraw {
7
- private currentPolygonEntity;
8
- private currentBorderEntity;
9
- /**
10
- * 结束绘制但未生成最终结果(例如点数不足/自相交被拦截)时的统一清理。
11
- * 目标:不留下临时实体/状态副作用(尤其是 depthTestAgainstTerrain)。
12
- */
13
- private abortFinishCleanup;
14
- /**
15
- * 开始绘制
16
- */
17
- startDrawing(options?: DrawOptions): void;
18
- /**
19
- * 更新绘制实体(预览)
20
- */
21
- updateDrawingEntity(previewPoint?: Cartesian3): void;
22
- /**
23
- * 完成绘制
24
- */
25
- finishDrawing(): DrawResult | null;
26
- /**
27
- * 清理所有绘制相关的实体
28
- */
29
- clear(): void;
30
- /**
31
- * 获取绘制类型
32
- */
33
- getDrawType(): "line" | "polygon" | "rectangle" | "circle";
34
- addPoint(position: Cartesian3): void;
35
- }
@@ -1,24 +0,0 @@
1
- import { Cartesian3 } from '../../../node_modules/cesium';
2
- import { BaseDraw, DrawResult, DrawOptions } from './BaseDraw';
3
- /**
4
- * 画矩形绘制类
5
- */
6
- export declare class DrawRectangle extends BaseDraw {
7
- private currentRectangleEntity;
8
- /**
9
- * 开始绘制
10
- */
11
- startDrawing(options?: DrawOptions): void;
12
- /**
13
- * 更新绘制实体(预览)
14
- */
15
- updateDrawingEntity(previewPoint?: Cartesian3): void;
16
- /**
17
- * 完成绘制
18
- */
19
- finishDrawing(): DrawResult | null;
20
- /**
21
- * 获取绘制类型
22
- */
23
- getDrawType(): "line" | "polygon" | "rectangle" | "circle";
24
- }
@@ -1,69 +0,0 @@
1
- declare const enUS: {
2
- locale: string;
3
- toolbar: {
4
- search: string;
5
- measure: string;
6
- view2d3d: string;
7
- layers: string;
8
- location: string;
9
- zoom_in: string;
10
- zoom_out: string;
11
- fullscreen: string;
12
- };
13
- measurement: {
14
- start: string;
15
- distance_done: string;
16
- area_done: string;
17
- cleared: string;
18
- menu: {
19
- area: string;
20
- distance: string;
21
- clear: string;
22
- };
23
- };
24
- search: {
25
- placeholder: string;
26
- failed: string;
27
- no_results: string;
28
- };
29
- layers: {
30
- title: string;
31
- overlay_title: string;
32
- overlay: {
33
- airport: string;
34
- };
35
- map_type: {
36
- place_name: string;
37
- };
38
- };
39
- map_type: {
40
- normal: string;
41
- "3d": string;
42
- imagery: string;
43
- terrain: string;
44
- };
45
- no_fly: {
46
- description: string;
47
- };
48
- draw: {
49
- hint: {
50
- circle_start: string;
51
- circle_radius: string;
52
- rectangle_start: string;
53
- rectangle_end: string;
54
- finish_or_undo: string;
55
- polygon_start: string;
56
- polygon_add: string;
57
- polygon_continue: string;
58
- line_start: string;
59
- line_add: string;
60
- line_continue: string;
61
- polygon_no_intersection: string;
62
- };
63
- label: {
64
- total_length: string;
65
- area: string;
66
- };
67
- };
68
- };
69
- export default enUS;
@@ -1,25 +0,0 @@
1
- type Locale = "zh-CN" | "en-US" | (string & {});
2
- type I18nDict = Record<string, any>;
3
- interface I18nLike {
4
- getLocale(): Locale;
5
- setLocale(locale: Locale, options?: {
6
- persist?: boolean;
7
- }): void;
8
- t(key: string, params?: Record<string, any>, localeOverride?: Locale): string;
9
- onLocaleChange(cb: (locale: Locale) => void): () => void;
10
- bindElement(el: HTMLElement, key: string, attr?: "text" | "title" | "placeholder", params?: Record<string, any>): void;
11
- updateElement(el: HTMLElement): void;
12
- updateTree(root: HTMLElement): void;
13
- addMessages?(locale: Locale, dict: I18nDict, options?: {
14
- merge?: boolean;
15
- }): void;
16
- setFallbackLocale?(locale: Locale): void;
17
- configure?(options: {
18
- persist?: boolean;
19
- useStoredLocale?: boolean;
20
- fallbackLocale?: Locale;
21
- locale?: Locale;
22
- }): void;
23
- }
24
- export declare const i18n: I18nLike;
25
- export type { Locale, I18nLike };
@@ -1,69 +0,0 @@
1
- declare const zhCN: {
2
- locale: string;
3
- toolbar: {
4
- search: string;
5
- measure: string;
6
- view2d3d: string;
7
- layers: string;
8
- location: string;
9
- zoom_in: string;
10
- zoom_out: string;
11
- fullscreen: string;
12
- };
13
- measurement: {
14
- start: string;
15
- distance_done: string;
16
- area_done: string;
17
- cleared: string;
18
- menu: {
19
- area: string;
20
- distance: string;
21
- clear: string;
22
- };
23
- };
24
- search: {
25
- placeholder: string;
26
- failed: string;
27
- no_results: string;
28
- };
29
- layers: {
30
- title: string;
31
- overlay_title: string;
32
- overlay: {
33
- airport: string;
34
- };
35
- map_type: {
36
- place_name: string;
37
- };
38
- };
39
- map_type: {
40
- normal: string;
41
- "3d": string;
42
- imagery: string;
43
- terrain: string;
44
- };
45
- no_fly: {
46
- description: string;
47
- };
48
- draw: {
49
- hint: {
50
- circle_start: string;
51
- circle_radius: string;
52
- rectangle_start: string;
53
- rectangle_end: string;
54
- finish_or_undo: string;
55
- polygon_start: string;
56
- polygon_add: string;
57
- polygon_continue: string;
58
- line_start: string;
59
- line_add: string;
60
- line_continue: string;
61
- polygon_no_intersection: string;
62
- };
63
- label: {
64
- total_length: string;
65
- area: string;
66
- };
67
- };
68
- };
69
- export default zhCN;
@@ -1,130 +0,0 @@
1
- import { Viewer, Entity, Color, HeightReference } from '../../../node_modules/cesium';
2
- import { OverlayPosition, OverlayEntity } from './types';
3
- import * as Cesium from "cesium";
4
- /**
5
- * Circle 选项
6
- */
7
- export interface CircleOptions {
8
- position: OverlayPosition;
9
- radius: number;
10
- /**
11
- * 渲染模式:
12
- * - auto:自动选择(默认;当前实现等同于 entity)
13
- * - entity:使用 Cesium Entity
14
- * - primitive:使用 Cesium Primitive(为大批量静态覆盖物预留)
15
- */
16
- renderMode?: 'auto' | 'entity' | 'primitive';
17
- material?: Cesium.MaterialProperty | Color | string;
18
- outline?: boolean;
19
- outlineColor?: Color | string;
20
- outlineWidth?: number;
21
- /**
22
- * 粗边框(outlineWidth>1)模式下用于近似圆的分段数,越大越圆滑但更耗性能。
23
- * 默认 256。
24
- */
25
- segments?: number;
26
- /**
27
- * 是否贴地(默认:在粗边框模式下为 true)。
28
- * - true:填充与边框都贴地。
29
- * - false:填充与边框都使用 position 高度悬空。
30
- */
31
- clampToGround?: boolean;
32
- /** 贴地抬高量(米,clampToGround=true 时生效) */
33
- groundHeightEpsilon?: number;
34
- heightReference?: HeightReference;
35
- extrudedHeight?: number;
36
- heightEpsilon?: number;
37
- /** 点击该覆盖物时是否高亮显示(默认 false)。支持传入自定义颜色等参数 */
38
- clickHighlight?: boolean | {
39
- color?: Color | string;
40
- fillAlpha?: number;
41
- };
42
- /** 鼠标移入该覆盖物时是否高亮显示(默认 false)。支持传入自定义颜色等参数 */
43
- hoverHighlight?: boolean | {
44
- color?: Color | string;
45
- fillAlpha?: number;
46
- };
47
- onClick?: (entity: Entity) => void;
48
- /**
49
- * Primitive 模式分层渲染 key。
50
- * - 相同 layerKey 的 circle 会被合并到同一个批次中(更高性能)
51
- * - 不同 layerKey 会进入不同的“图层空间”,并按首次出现顺序确定上下层
52
- * - 只对 primitive 生效;entity 模式忽略
53
- */
54
- layerKey?: string;
55
- id?: string;
56
- }
57
- /**
58
- * Circle 工具类
59
- */
60
- export declare class MapCircle {
61
- private viewer;
62
- private entities;
63
- private primitiveBatch;
64
- private primitiveLayerStack;
65
- private primitiveBatchesByLayer;
66
- private static bearingTableCache;
67
- constructor(viewer: Viewer);
68
- private getPrimitiveBatch;
69
- private getLayeredPrimitiveBatch;
70
- private getPrimitiveBatchForOverlay;
71
- private resolveMaterialColor;
72
- private canUsePrimitive;
73
- /**
74
- * 添加一个基础的圆形图元
75
- * @param options 圆形配置选项
76
- * @returns 返回创建的实体对象
77
- */
78
- private addPrimitiveCircle;
79
- /**
80
- * 转换位置为 Cartesian3
81
- */
82
- private convertPosition;
83
- /**
84
- * 转换颜色
85
- */
86
- private resolveColor;
87
- /**
88
- * 解析材质
89
- */
90
- private resolveMaterial;
91
- /**
92
- * 添加 Circle(圆形)
93
- */
94
- add(options: CircleOptions): Entity;
95
- /**
96
- * 生成近似圆(多边形)顶点,返回 Cartesian3 数组。
97
- * 使用大圆航线公式,segments 越大越平滑。
98
- */
99
- private generateCirclePositions;
100
- /**
101
- * 获取方位角查找表,用于存储正弦和余弦值
102
- * @param segments 分段数量,用于确定查找表的精度
103
- * @returns 返回一个包含正弦和余弦数组的对象
104
- */
105
- private getBearingTable;
106
- /**
107
- * 粗边框模式的默认分段数:平衡“圆滑程度/性能”。
108
- * 用户如果传了 options.segments,则完全尊重用户设置。
109
- */
110
- private getDefaultSegmentsForRadius;
111
- /**
112
- * 更新 Circle 位置
113
- */
114
- updatePosition(entity: Entity, position: OverlayPosition): void;
115
- /**
116
- * 更新 Circle 半径
117
- */
118
- updateRadius(entity: Entity, radius: number): void;
119
- /**
120
- * 更新 Circle 样式
121
- */
122
- updateStyle(entity: Entity, options: Partial<Pick<CircleOptions, 'material' | 'outline' | 'outlineColor' | 'outlineWidth'>>): void;
123
- /**
124
- * 移除 Circle(通过实体或实体 id)
125
- */
126
- remove(entityOrId: Entity | string): boolean;
127
- setPrimitiveVisible(entity: Entity, visible: boolean): void;
128
- applyPrimitiveHighlight(entity: OverlayEntity, hlColor: Cesium.Color, fillAlpha: number): void;
129
- restorePrimitiveHighlight(entity: OverlayEntity): void;
130
- }
@@ -1,69 +0,0 @@
1
- import { Viewer, Entity, Color, HeightReference, VerticalOrigin, HorizontalOrigin } from '../../../node_modules/cesium';
2
- import { OverlayPosition } from './types';
3
- import * as Cesium from "cesium";
4
- /**
5
- * Icon 选项
6
- */
7
- export interface IconOptions {
8
- position: OverlayPosition;
9
- image: string;
10
- width?: number;
11
- height?: number;
12
- scale?: number;
13
- rotation?: number;
14
- pixelOffset?: Cesium.Cartesian2;
15
- eyeOffset?: Cesium.Cartesian3;
16
- horizontalOrigin?: HorizontalOrigin;
17
- verticalOrigin?: VerticalOrigin;
18
- heightReference?: HeightReference;
19
- disableDepthTestDistance?: number;
20
- color?: Color | string;
21
- /** 点击该覆盖物时是否高亮显示(默认 false)。支持传入自定义颜色等参数 */
22
- clickHighlight?: boolean | {
23
- color?: Color | string;
24
- fillAlpha?: number;
25
- };
26
- /** 鼠标移入该覆盖物时是否高亮显示(默认 false)。支持传入自定义颜色等参数 */
27
- hoverHighlight?: boolean | {
28
- color?: Color | string;
29
- fillAlpha?: number;
30
- };
31
- onClick?: (entity: Entity) => void;
32
- id?: string;
33
- }
34
- /**
35
- * Icon 工具类
36
- */
37
- export declare class MapIcon {
38
- private viewer;
39
- private entities;
40
- constructor(viewer: Viewer);
41
- /**
42
- * 转换位置为 Cartesian3
43
- */
44
- private convertPosition;
45
- /**
46
- * 转换颜色
47
- */
48
- private resolveColor;
49
- /**
50
- * 添加 Icon(图标,使用 Billboard)
51
- */
52
- add(options: IconOptions): Entity;
53
- /**
54
- * 更新 Icon 位置
55
- */
56
- updatePosition(entity: Entity, position: OverlayPosition): void;
57
- /**
58
- * 更新 Icon 图片
59
- */
60
- updateImage(entity: Entity, image: string): void;
61
- /**
62
- * 更新 Icon 样式
63
- */
64
- updateStyle(entity: Entity, options: Partial<Pick<IconOptions, 'scale' | 'rotation' | 'color'>>): void;
65
- /**
66
- * 移除 Icon(通过实体或实体 id)
67
- */
68
- remove(entityOrId: Entity | string): boolean;
69
- }