@xingm/vmap-cesium-toolbar 0.0.6 → 1.0.0

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 +160 -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 +45 -0
  36. package/dist/core/layers/index.d.ts +15 -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 +586 -0
  69. package/dist/i18n/en-US.d.ts +46 -0
  70. package/dist/i18n/index.d.ts +45 -2
  71. package/dist/i18n/zh-CN.d.ts +46 -0
  72. package/dist/index.d.ts +37 -42
  73. package/dist/index.es.js +6874 -9666
  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 +19 -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 +1 -1
  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,100 +0,0 @@
1
- import { Viewer, Entity } from '../../../node_modules/cesium';
2
- import { OverlayPosition } from './types';
3
- import * as Cesium from 'cesium';
4
- export interface InfoWindowOptions {
5
- position: OverlayPosition;
6
- content: string | HTMLElement;
7
- width?: number;
8
- height?: number;
9
- pixelOffset?: Cesium.Cartesian2;
10
- show?: boolean;
11
- onClick?: (entity: Entity) => void;
12
- id?: string;
13
- closable?: boolean;
14
- onClose?: (entity: Entity) => void;
15
- backgroundColor?: string;
16
- color?: string;
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';
23
- hideWhenOutOfView?: boolean;
24
- anchorHeight?: number;
25
- anchorPixel?: number;
26
- tailGap?: number;
27
- updateInterval?: number;
28
- }
29
- /**
30
- * 面向 Cesium 的 HTML 信息窗口管理器
31
- * 要求 container 为 position: relative 的 DOM 容器(通常与 viewer.canvas 同级或包裹)
32
- */
33
- export declare class MapInfoWindow {
34
- private viewer;
35
- private container;
36
- private entityMap;
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;
47
- constructor(viewer: Viewer, container: HTMLElement);
48
- /**
49
- * 设置默认的位置更新间隔(毫秒):当 InfoWindow 未指定 `updateInterval` 时使用。
50
- * 0 表示每帧更新。
51
- */
52
- setDefaultUpdateInterval(ms: number): void;
53
- /**
54
- * 强制立即更新(重新计算位置)所有已管理的信息窗。
55
- */
56
- forceUpdateAll(): void;
57
- private convertPosition;
58
- /**
59
- * 将世界坐标转换为相对于 container 的 CSS 像素坐标
60
- */
61
- private getContainerPixelPosition;
62
- /**
63
- * 更新单个 infoWindow 的显示状态和位置
64
- */
65
- private updateDomPosition;
66
- /**
67
- * 创建 DOM 元素
68
- */
69
- private createDomElement;
70
- /**
71
- * 将指定 InfoWindow 置于最前
72
- */
73
- bringToFront(entity: Entity): void;
74
- /**
75
- * 添加信息窗口
76
- */
77
- add(options: InfoWindowOptions): Entity;
78
- /**
79
- * 更新位置
80
- */
81
- updatePosition(entity: Entity, position: OverlayPosition): void;
82
- /**
83
- * 更新内容
84
- */
85
- updateContent(entity: Entity, content: string | HTMLElement): void;
86
- /**
87
- * 显示/隐藏
88
- */
89
- setVisible(entity: Entity, visible: boolean): void;
90
- show(entity: Entity): void;
91
- hide(entity: Entity): void;
92
- /**
93
- * 移除信息窗口(清理 DOM + 监听器 + 实体)
94
- */
95
- remove(entity: Entity): void;
96
- /**
97
- * 销毁整个管理器(清理所有 infoWindow)
98
- */
99
- destroy(): void;
100
- }
@@ -1,73 +0,0 @@
1
- import { Viewer, Entity, Color, HeightReference, LabelStyle, VerticalOrigin, HorizontalOrigin } from '../../../node_modules/cesium';
2
- import { OverlayPosition } from './types';
3
- import * as Cesium from "cesium";
4
- /**
5
- * Label 选项
6
- */
7
- export interface LabelOptions {
8
- position: OverlayPosition;
9
- text: string;
10
- font?: string;
11
- fillColor?: Color | string;
12
- outlineColor?: Color | string;
13
- outlineWidth?: number;
14
- style?: LabelStyle;
15
- pixelOffset?: Cesium.Cartesian2;
16
- eyeOffset?: Cesium.Cartesian3;
17
- horizontalOrigin?: HorizontalOrigin;
18
- verticalOrigin?: VerticalOrigin;
19
- heightReference?: HeightReference;
20
- scale?: number;
21
- showBackground?: boolean;
22
- backgroundColor?: Color | string;
23
- backgroundPadding?: Cesium.Cartesian2;
24
- disableDepthTestDistance?: number;
25
- /** 点击该覆盖物时是否高亮显示(默认 false)。支持传入自定义颜色等参数 */
26
- clickHighlight?: boolean | {
27
- color?: Color | string;
28
- fillAlpha?: number;
29
- };
30
- /** 鼠标移入该覆盖物时是否高亮显示(默认 false)。支持传入自定义颜色等参数 */
31
- hoverHighlight?: boolean | {
32
- color?: Color | string;
33
- fillAlpha?: number;
34
- };
35
- onClick?: (entity: Entity) => void;
36
- id?: string;
37
- }
38
- /**
39
- * Label 工具类
40
- */
41
- export declare class MapLabel {
42
- private viewer;
43
- private entities;
44
- constructor(viewer: Viewer);
45
- /**
46
- * 转换位置为 Cartesian3
47
- */
48
- private convertPosition;
49
- /**
50
- * 转换颜色
51
- */
52
- private resolveColor;
53
- /**
54
- * 添加 Label(文本标签)
55
- */
56
- add(options: LabelOptions): Entity;
57
- /**
58
- * 更新 Label 位置
59
- */
60
- updatePosition(entity: Entity, position: OverlayPosition): void;
61
- /**
62
- * 更新 Label 文本
63
- */
64
- updateText(entity: Entity, text: string): void;
65
- /**
66
- * 更新 Label 样式
67
- */
68
- updateStyle(entity: Entity, options: Partial<Pick<LabelOptions, 'fillColor' | 'outlineColor' | 'outlineWidth' | 'font' | 'scale'>>): void;
69
- /**
70
- * 移除 Label(通过实体或实体 id)
71
- */
72
- remove(entityOrId: Entity | string): boolean;
73
- }
@@ -1,60 +0,0 @@
1
- import { Viewer, Entity, Color, HeightReference } from '../../../node_modules/cesium';
2
- import { OverlayPosition } from './types';
3
- import * as Cesium from "cesium";
4
- /**
5
- * Marker 选项
6
- */
7
- export interface MarkerOptions {
8
- position: OverlayPosition;
9
- pixelSize?: number;
10
- color?: Color | string;
11
- outlineColor?: Color | string;
12
- outlineWidth?: number;
13
- heightReference?: HeightReference;
14
- scaleByDistance?: Cesium.NearFarScalar;
15
- disableDepthTestDistance?: number;
16
- /** 点击该覆盖物时是否高亮显示(默认 false)。支持传入自定义颜色等参数 */
17
- clickHighlight?: boolean | {
18
- color?: Color | string;
19
- fillAlpha?: number;
20
- };
21
- /** 鼠标移入该覆盖物时是否高亮显示(默认 false)。支持传入自定义颜色等参数 */
22
- hoverHighlight?: boolean | {
23
- color?: Color | string;
24
- fillAlpha?: number;
25
- };
26
- onClick?: (entity: Entity) => void;
27
- id?: string;
28
- }
29
- /**
30
- * Marker 工具类
31
- */
32
- export declare class MapMarker {
33
- private viewer;
34
- private entities;
35
- constructor(viewer: Viewer);
36
- /**
37
- * 转换位置为 Cartesian3
38
- */
39
- private convertPosition;
40
- /**
41
- * 转换颜色
42
- */
43
- private resolveColor;
44
- /**
45
- * 添加 Marker(点标记)
46
- */
47
- add(options: MarkerOptions): Entity;
48
- /**
49
- * 更新 Marker 位置
50
- */
51
- updatePosition(entity: Entity, position: OverlayPosition): void;
52
- /**
53
- * 更新 Marker 样式
54
- */
55
- updateStyle(entity: Entity, options: Partial<Pick<MarkerOptions, 'color' | 'outlineColor' | 'outlineWidth' | 'pixelSize'>>): void;
56
- /**
57
- * 移除 Marker(通过实体或实体 id)
58
- */
59
- remove(entityOrId: Entity | string): boolean;
60
- }
@@ -1,114 +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
- * Polygon 选项
6
- */
7
- export interface PolygonOptions {
8
- positions: OverlayPosition[];
9
- /**
10
- * 渲染模式:
11
- * - auto:自动选择(默认;当前仅在“粗边框+贴地+纯色”场景下会切到 primitive)
12
- * - entity:使用 Cesium Entity
13
- * - primitive:使用 Cesium GroundPrimitive / GroundPolylinePrimitive(大批量静态贴地场景)
14
- */
15
- renderMode?: 'auto' | 'entity' | 'primitive';
16
- material?: Cesium.MaterialProperty | Color | string;
17
- outline?: boolean;
18
- outlineColor?: Color | string;
19
- outlineWidth?: number;
20
- /**
21
- * 是否贴地(默认:在粗边框模式下为 true)。
22
- * - true:填充与边框都贴地(避免一贴地一悬空导致缝隙)。
23
- * - false:填充与边框都在统一的 baseHeight 上悬空。
24
- */
25
- clampToGround?: boolean;
26
- /** 贴地抬高量(米,clampToGround=true 时生效) */
27
- groundHeightEpsilon?: number;
28
- heightReference?: HeightReference;
29
- extrudedHeight?: number;
30
- /** 点击该覆盖物时是否高亮显示(默认 false)。支持传入自定义颜色等参数 */
31
- clickHighlight?: boolean | {
32
- color?: Color | string;
33
- fillAlpha?: number;
34
- };
35
- /** 鼠标移入该覆盖物时是否高亮显示(默认 false)。支持传入自定义颜色等参数 */
36
- hoverHighlight?: boolean | {
37
- color?: Color | string;
38
- fillAlpha?: number;
39
- };
40
- onClick?: (entity: Entity) => void;
41
- /**
42
- * Primitive 模式分层渲染 key。
43
- * - 相同 layerKey 的 polygon 会被合并到同一个批次中(更高性能)
44
- * - 不同 layerKey 会进入不同的“图层空间”,并按首次出现顺序确定上下层
45
- * - 只对 primitive 生效;entity 模式忽略
46
- */
47
- layerKey?: string;
48
- id?: string;
49
- }
50
- /**
51
- * Polygon 工具类
52
- */
53
- export declare class MapPolygon {
54
- private viewer;
55
- private entities;
56
- private primitiveBatch;
57
- private primitiveLayerStack;
58
- private primitiveBatchesByLayer;
59
- constructor(viewer: Viewer);
60
- private getPrimitiveBatch;
61
- private getLayeredPrimitiveBatch;
62
- private getPrimitiveBatchForOverlay;
63
- private resolveMaterialColor;
64
- private canUsePrimitive;
65
- private addPrimitivePolygon;
66
- /**
67
- * 转换位置为 Cartesian3
68
- */
69
- private convertPosition;
70
- /**
71
- * 转换颜色
72
- */
73
- private resolveColor;
74
- /**
75
- * 解析材质
76
- */
77
- private resolveMaterial;
78
- /**
79
- * 计算二维多边形方向(正值为 CCW)
80
- */
81
- private polygonArea2D;
82
- /**
83
- * 向内偏移二维多边形顶点(线偏移 + 邻边相交)。厚度单位:米。
84
- * 对复杂凹形可能產生伪影,更适合凸多边形或温和凹形。
85
- */
86
- private offsetPolygon2DInward;
87
- /**
88
- * 计算内偏移后的 3D 顶点:使用切平面近似进行 2D 偏移再投回椭球,并统一高度。
89
- */
90
- private computeInnerOffsetPositions;
91
- /**
92
- * 为多边形顶点统一高度(含微小抬升)
93
- */
94
- private elevatePositions;
95
- /**
96
- * 添加 Polygon(多边形)
97
- */
98
- add(options: PolygonOptions): Entity;
99
- /**
100
- * 更新 Polygon 位置
101
- */
102
- updatePositions(entity: Entity, positions: OverlayPosition[]): void;
103
- /**
104
- * 更新 Polygon 样式
105
- */
106
- updateStyle(entity: Entity, options: Partial<Pick<PolygonOptions, 'material' | 'outline' | 'outlineColor' | 'outlineWidth'>>): void;
107
- /**
108
- * 移除 Polygon(通过实体或实体 id)
109
- */
110
- remove(entityOrId: Entity | string): boolean;
111
- setPrimitiveVisible(entity: Entity, visible: boolean): void;
112
- applyPrimitiveHighlight(entity: OverlayEntity, hlColor: Cesium.Color, fillAlpha: number): void;
113
- restorePrimitiveHighlight(entity: OverlayEntity): void;
114
- }
@@ -1,64 +0,0 @@
1
- import { Viewer, Entity, Color } from '../../../node_modules/cesium';
2
- import { OverlayPosition } from './types';
3
- import * as Cesium from "cesium";
4
- /**
5
- * Polyline 选项
6
- */
7
- export interface PolylineOptions {
8
- positions: OverlayPosition[];
9
- width?: number;
10
- material?: Cesium.MaterialProperty | Color | string;
11
- clampToGround?: boolean;
12
- /** 贴地抬高量(米,clampToGround=true 时生效) */
13
- groundHeightEpsilon?: number;
14
- /** 点击该覆盖物时是否高亮显示(默认 false)。支持传入自定义颜色等参数 */
15
- clickHighlight?: boolean | {
16
- color?: Color | string;
17
- fillAlpha?: number;
18
- };
19
- /** 鼠标移入该覆盖物时是否高亮显示(默认 false)。支持传入自定义颜色等参数 */
20
- hoverHighlight?: boolean | {
21
- color?: Color | string;
22
- fillAlpha?: number;
23
- };
24
- onClick?: (entity: Entity) => void;
25
- id?: string;
26
- }
27
- /**
28
- * Polyline 工具类
29
- */
30
- export declare class MapPolyline {
31
- private viewer;
32
- private entities;
33
- private readonly avoidGroundPipeline;
34
- constructor(viewer: Viewer);
35
- /**
36
- * 转换位置为 Cartesian3
37
- */
38
- private convertPosition;
39
- /**
40
- * 转换颜色
41
- */
42
- private resolveColor;
43
- /**
44
- * 解析材质
45
- */
46
- private resolveMaterial;
47
- private elevatePositions;
48
- /**
49
- * 添加 Polyline(折线)
50
- */
51
- add(options: PolylineOptions): Entity;
52
- /**
53
- * 更新 Polyline 位置
54
- */
55
- updatePositions(entity: Entity, positions: OverlayPosition[]): void;
56
- /**
57
- * 更新 Polyline 样式
58
- */
59
- updateStyle(entity: Entity, options: Partial<Pick<PolylineOptions, 'width' | 'material'>>): void;
60
- /**
61
- * 移除 Polyline(通过实体或实体 id)
62
- */
63
- remove(entityOrId: Entity | string): boolean;
64
- }
@@ -1,101 +0,0 @@
1
- import { Viewer, Entity, Color, HeightReference } from '../../../node_modules/cesium';
2
- import { OverlayEntity } from './types';
3
- import * as Cesium from "cesium";
4
- /**
5
- * Rectangle 选项
6
- */
7
- export interface RectangleOptions {
8
- coordinates: Cesium.Rectangle;
9
- /**
10
- * 渲染模式:
11
- * - auto:自动选择(默认;当前仅在“粗边框+贴地+纯色”场景下会切到 primitive)
12
- * - entity:使用 Cesium Entity
13
- * - primitive:使用 Cesium GroundPrimitive(大批量静态贴地场景)
14
- */
15
- renderMode?: 'auto' | 'entity' | 'primitive';
16
- material?: Cesium.MaterialProperty | Color | string;
17
- outline?: boolean;
18
- outlineColor?: Color | string;
19
- outlineWidth?: number;
20
- /** 是否贴地(默认:在粗边框模式下为 true) */
21
- clampToGround?: boolean;
22
- /** 贴地抬高量(米,clampToGround=true 时生效) */
23
- groundHeightEpsilon?: number;
24
- /** 悬空时的基准高度(米,clampToGround=false 时有效) */
25
- height?: number;
26
- heightReference?: HeightReference;
27
- extrudedHeight?: number;
28
- /** 高度容差(米):用于避免共面深度冲突;会同时作用于边框与填充以保证一致 */
29
- heightEpsilon?: number;
30
- /** 点击该覆盖物时是否高亮显示(默认 false)。支持传入自定义颜色等参数 */
31
- clickHighlight?: boolean | {
32
- color?: Color | string;
33
- fillAlpha?: number;
34
- };
35
- /** 鼠标移入该覆盖物时是否高亮显示(默认 false)。支持传入自定义颜色等参数 */
36
- hoverHighlight?: boolean | {
37
- color?: Color | string;
38
- fillAlpha?: number;
39
- };
40
- onClick?: (entity: Entity) => void;
41
- /**
42
- * Primitive 模式分层渲染 key。
43
- * - 相同 layerKey 的 rectangle 会被合并到同一个批次中(更高性能)
44
- * - 不同 layerKey 会进入不同的“图层空间”,并按首次出现顺序确定上下层
45
- * - 只对 primitive 生效;entity 模式忽略
46
- */
47
- layerKey?: string;
48
- id?: string;
49
- }
50
- /**
51
- * Rectangle 工具类
52
- */
53
- export declare class MapRectangle {
54
- private viewer;
55
- private entities;
56
- private primitiveBatch;
57
- private primitiveLayerStack;
58
- private primitiveBatchesByLayer;
59
- constructor(viewer: Viewer);
60
- private getPrimitiveBatch;
61
- private getLayeredPrimitiveBatch;
62
- private getPrimitiveBatchForOverlay;
63
- private resolveMaterialColor;
64
- private canUsePrimitive;
65
- private addPrimitiveRectangle;
66
- /**
67
- * 转换颜色
68
- */
69
- private resolveColor;
70
- /**
71
- * 解析材质
72
- */
73
- private resolveMaterial;
74
- /**
75
- * 将 Rectangle 转为四点多边形顶点(按西南→东南→东北→西北顺序)
76
- */
77
- private rectangleToPositions;
78
- /**
79
- * 按米单位向内收缩矩形边界,返回新的 Rectangle
80
- */
81
- private shrinkRectangle;
82
- /**
83
- * 添加 Rectangle(矩形)
84
- */
85
- add(options: RectangleOptions): Entity;
86
- /**
87
- * 更新 Rectangle 坐标
88
- */
89
- updateCoordinates(entity: Entity, coordinates: Cesium.Rectangle): void;
90
- /**
91
- * 更新 Rectangle 样式
92
- */
93
- updateStyle(entity: Entity, options: Partial<Pick<RectangleOptions, 'material' | 'outline' | 'outlineColor' | 'outlineWidth'>>): void;
94
- /**
95
- * 移除 Rectangle(通过实体或实体 id)
96
- */
97
- remove(entityOrId: Entity | string): boolean;
98
- setPrimitiveVisible(entity: Entity, visible: boolean): void;
99
- applyPrimitiveHighlight(entity: OverlayEntity, hlColor: Cesium.Color, fillAlpha: number): void;
100
- restorePrimitiveHighlight(entity: OverlayEntity): void;
101
- }
@@ -1,107 +0,0 @@
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
- /** 贴地抬高量(米,clampToGround=true 时生效) */
40
- groundHeightEpsilon?: number;
41
- /** 圆环分段数(默认 128),越大越圆滑 */
42
- segments?: number;
43
- /** 覆盖物点击回调 */
44
- onClick?: (entity: Entity) => void;
45
- /** 点击该覆盖物时是否高亮显示(默认 false)。支持传入自定义颜色等参数 */
46
- clickHighlight?: boolean | {
47
- color?: Color | string;
48
- fillAlpha?: number;
49
- };
50
- /** 鼠标移入该覆盖物时是否高亮显示(默认 false)。支持传入自定义颜色等参数 */
51
- hoverHighlight?: boolean | {
52
- color?: Color | string;
53
- fillAlpha?: number;
54
- };
55
- id?: string;
56
- }
57
- /**
58
- * Ring 工具类:使用 polyline + PolylineGlowMaterialProperty 实现发光圆环
59
- */
60
- export declare class MapRing {
61
- private viewer;
62
- private entities;
63
- constructor(viewer: Viewer);
64
- /**
65
- * 转换位置为 Cartesian3
66
- */
67
- private convertPosition;
68
- /**
69
- * 转换颜色
70
- */
71
- private resolveColor;
72
- private resolveLineMaterial;
73
- private resolveGlowMaterial;
74
- private getInnerWidth;
75
- private addInnerEntity;
76
- private removeInnerEntity;
77
- private rebuildRingPositions;
78
- /**
79
- * 生成近似圆顶点(Cartesian3 数组)。segments 越大越平滑。
80
- * 这里沿用 MapCircle 的大圆航线近似,保证在经纬度空间更稳定。
81
- */
82
- private generateCirclePositions;
83
- /**
84
- * 添加 Ring(边缘发光圆环)
85
- */
86
- add(options: RingOptions): Entity;
87
- /**
88
- * 更新 Ring 中心
89
- */
90
- updatePosition(entity: Entity, position: OverlayPosition): void;
91
- /**
92
- * 更新 Ring 半径
93
- */
94
- updateRadius(entity: Entity, radius: number): void;
95
- /**
96
- * 更新 Ring 样式
97
- */
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;
99
- /**
100
- * 显示/隐藏 Ring
101
- */
102
- setVisible(entity: Entity, visible: boolean): void;
103
- /**
104
- * 移除 Ring(通过实体或实体 id)
105
- */
106
- remove(entityOrId: Entity | string): boolean;
107
- }
@@ -1,73 +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
- * SVG 选项
6
- */
7
- export interface SvgOptions {
8
- position: OverlayPosition;
9
- svg: 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
- * SVG 工具类
36
- */
37
- export declare class MapSVG {
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
- * 将 SVG 字符串转换为 data URL
51
- */
52
- private svgToDataUrl;
53
- /**
54
- * 添加 SVG(使用 Billboard)
55
- */
56
- add(options: SvgOptions): Entity;
57
- /**
58
- * 更新 SVG 位置
59
- */
60
- updatePosition(entity: Entity, position: OverlayPosition): void;
61
- /**
62
- * 更新 SVG 内容
63
- */
64
- updateSvg(entity: Entity, svg: string): void;
65
- /**
66
- * 更新 SVG 样式
67
- */
68
- updateStyle(entity: Entity, options: Partial<Pick<SvgOptions, 'scale' | 'rotation' | 'color'>>): void;
69
- /**
70
- * 移除 SVG(通过实体或实体 id)
71
- */
72
- remove(entityOrId: Entity | string): boolean;
73
- }