@xingm/vmap-cesium-toolbar 0.0.5 → 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.
- package/README.md +126 -230
- package/dist/README.md +172 -0
- package/dist/adapters/DrawHelperAdapter.d.ts +143 -0
- package/dist/adapters/MapLoaderAdapter.d.ts +44 -0
- package/dist/adapters/OverlayServiceAdapter.d.ts +102 -0
- package/dist/adapters/ToolbarAdapter.d.ts +71 -0
- package/dist/adapters/index.d.ts +23 -0
- package/dist/components/BaseComponent.d.ts +116 -0
- package/dist/components/SearchBox.d.ts +136 -0
- package/dist/components/Toolbar.d.ts +115 -0
- package/dist/components/ToolbarButton.d.ts +100 -0
- package/dist/components/index.d.ts +33 -0
- package/dist/core/MapPlugin.d.ts +160 -0
- package/dist/core/constants.d.ts +88 -0
- package/dist/core/entities/BaseOverlay.d.ts +156 -0
- package/dist/core/entities/Circle.d.ts +102 -0
- package/dist/core/entities/Icon.d.ts +86 -0
- package/dist/core/entities/InfoWindow.d.ts +116 -0
- package/dist/core/entities/Label.d.ts +92 -0
- package/dist/core/entities/Marker.d.ts +66 -0
- package/dist/core/entities/Polygon.d.ts +93 -0
- package/dist/core/entities/Polyline.d.ts +72 -0
- package/dist/core/entities/Rectangle.d.ts +99 -0
- package/dist/core/entities/Ring.d.ts +114 -0
- package/dist/core/entities/SVG.d.ts +89 -0
- package/dist/core/entities/index.d.ts +27 -0
- package/dist/core/index.d.ts +25 -0
- package/dist/core/layers/BaiduMapLayer.d.ts +37 -0
- package/dist/core/layers/CustomMapLayer.d.ts +43 -0
- package/dist/core/layers/GaodeMapLayer.d.ts +41 -0
- package/dist/core/layers/HeatmapLayer.d.ts +118 -0
- package/dist/core/layers/MapLayer.d.ts +37 -0
- package/dist/core/layers/OSMMapLayer.d.ts +37 -0
- package/dist/core/layers/PointClusterLayer.d.ts +119 -0
- package/dist/core/layers/TDTMapLayer.d.ts +45 -0
- package/dist/core/layers/index.d.ts +15 -0
- package/dist/core/services/draw/DrawInteractionController.d.ts +16 -0
- package/dist/core/services/draw/DrawService.d.ts +38 -0
- package/dist/core/services/draw/DrawSessionStore.d.ts +28 -0
- package/dist/core/services/draw/drawDefaults.d.ts +16 -0
- package/dist/core/services/draw/entities/drawEntityFactory.d.ts +10 -0
- package/dist/core/services/draw/entities/drawEntityRegistry.d.ts +8 -0
- package/dist/core/services/draw/entities/drawFinalFactory.d.ts +14 -0
- package/dist/core/services/draw/entities/drawPreviewFactory.d.ts +15 -0
- package/dist/core/services/draw/geometry/drawGeometry.d.ts +11 -0
- package/dist/core/services/draw/geometry/drawPosition.d.ts +6 -0
- package/dist/core/services/draw/index.d.ts +7 -0
- package/dist/core/services/draw/labels/drawHint.d.ts +16 -0
- package/dist/core/services/draw/labels/measurementCanvas.d.ts +8 -0
- package/dist/core/services/draw/labels/measurementLabelFactory.d.ts +18 -0
- package/dist/core/services/draw/measurementThemeResolver.d.ts +9 -0
- package/dist/core/services/draw/types/drawState.d.ts +37 -0
- package/dist/core/services/draw/types/drawTypes.d.ts +97 -0
- package/dist/core/services/index.d.ts +10 -0
- package/dist/core/services/overlay/OverlayService.d.ts +188 -0
- package/dist/core/services/overlay/index.d.ts +7 -0
- package/dist/core/services/toolbar/ToolbarService.d.ts +175 -0
- package/dist/core/services/toolbar/buttons/BaseButtonHandler.d.ts +111 -0
- package/dist/core/services/toolbar/buttons/LayersButtonHandler.d.ts +47 -0
- package/dist/core/services/toolbar/buttons/MeasureButtonHandler.d.ts +94 -0
- package/dist/core/services/toolbar/buttons/SearchButtonHandler.d.ts +111 -0
- package/dist/core/services/toolbar/buttons/SimpleButtonHandler.d.ts +79 -0
- package/dist/core/services/toolbar/config.d.ts +7 -0
- package/dist/core/services/toolbar/index.d.ts +30 -0
- package/dist/core/services/toolbar/menus/BaseMenu.d.ts +99 -0
- package/dist/core/services/toolbar/menus/MeasureMenu.d.ts +44 -0
- package/dist/core/services/toolbar/types.d.ts +198 -0
- package/dist/core/types.d.ts +586 -0
- package/dist/i18n/en-US.d.ts +46 -0
- package/dist/i18n/index.d.ts +45 -2
- package/dist/i18n/zh-CN.d.ts +46 -0
- package/dist/index.d.ts +37 -42
- package/dist/index.es.js +7056 -9844
- package/dist/index.es.js.map +1 -1
- package/dist/libs/CesiumMapModel.d.ts +1 -172
- package/dist/libs/CesiumMapToolbar.d.ts +1 -1
- package/dist/libs/CesiumOverlayService.d.ts +9 -222
- package/dist/libs/config/CesiumMapConfig.d.ts +5 -12
- package/dist/libs/drawHelper/DrawHint.d.ts +15 -27
- package/dist/libs/drawHelper/index.d.ts +67 -6
- package/dist/libs/toolBar/CesiumMapController.d.ts +38 -64
- package/dist/libs/toolBar/MapLayersService.d.ts +10 -61
- package/dist/libs/toolBar/MapSearchService.d.ts +8 -29
- package/dist/libs/toolBar/MapToolBarConfig.d.ts +33 -5
- package/dist/libs/toolBar/MeasurementService.d.ts +13 -5
- package/dist/libs/toolBar/NotFlyZonesService.d.ts +6 -41
- package/dist/package.json +19 -6
- package/dist/styles/ComponentStyles.d.ts +82 -0
- package/dist/styles/StyleManager.d.ts +142 -0
- package/dist/styles/index.d.ts +128 -0
- package/dist/utils/common.d.ts +4 -0
- package/package.json +1 -1
- package/dist/hooks/toolBarConfig.d.ts +0 -75
- package/dist/hooks/useDrawHelper.d.ts +0 -24
- package/dist/hooks/useDynamicRing.d.ts +0 -44
- package/dist/hooks/useHeatmapHelper.d.ts +0 -18
- package/dist/hooks/useMap.d.ts +0 -14
- package/dist/hooks/useMapInit.d.ts +0 -14
- package/dist/hooks/useOverlayHelper.d.ts +0 -48
- package/dist/hooks/usePointClusterHelper.d.ts +0 -14
- package/dist/index.umd.js +0 -326
- package/dist/index.umd.js.map +0 -1
- package/dist/libs/drawHelper/BaseDraw.d.ts +0 -194
- package/dist/libs/drawHelper/DrawCircle.d.ts +0 -31
- package/dist/libs/drawHelper/DrawLine.d.ts +0 -49
- package/dist/libs/drawHelper/DrawPolgon.d.ts +0 -35
- package/dist/libs/drawHelper/DrawRectangle.d.ts +0 -24
- package/dist/libs/i18n/en-US.d.ts +0 -69
- package/dist/libs/i18n/index.d.ts +0 -25
- package/dist/libs/i18n/zh-CN.d.ts +0 -69
- package/dist/libs/overlay/MapCircle.d.ts +0 -130
- package/dist/libs/overlay/MapIcon.d.ts +0 -69
- package/dist/libs/overlay/MapInfoWindow.d.ts +0 -100
- package/dist/libs/overlay/MapLabel.d.ts +0 -73
- package/dist/libs/overlay/MapMarker.d.ts +0 -60
- package/dist/libs/overlay/MapPolygon.d.ts +0 -114
- package/dist/libs/overlay/MapPolyline.d.ts +0 -64
- package/dist/libs/overlay/MapRectangle.d.ts +0 -101
- package/dist/libs/overlay/MapRing.d.ts +0 -107
- package/dist/libs/overlay/MapSVG.d.ts +0 -73
- package/dist/libs/overlay/OverlayEditController.d.ts +0 -166
- package/dist/libs/overlay/OverlayEditHandles.d.ts +0 -101
- package/dist/libs/overlay/OverlayHighlight.d.ts +0 -40
- package/dist/libs/overlay/index.d.ts +0 -23
- package/dist/libs/overlay/primitives/CirclePrimitiveBatch.d.ts +0 -42
- package/dist/libs/overlay/primitives/CirclePrimitiveLayerStack.d.ts +0 -24
- package/dist/libs/overlay/primitives/PolygonPrimitiveBatch.d.ts +0 -43
- package/dist/libs/overlay/primitives/PolygonPrimitiveLayerStack.d.ts +0 -24
- package/dist/libs/overlay/primitives/RectanglePrimitiveBatch.d.ts +0 -41
- package/dist/libs/overlay/primitives/RectanglePrimitiveLayerStack.d.ts +0 -24
- package/dist/libs/overlay/types.d.ts +0 -121
- package/dist/z.const.d.ts +0 -24
- /package/dist/{libs → utils}/PickGovernor.d.ts +0 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { Viewer, Entity, Cartesian3 } from '../../node_modules/cesium';
|
|
2
|
+
import { DrawMode, MeasurementTheme, MeasurementSummaryLabelStyle } from '../core/services/draw/DrawService';
|
|
3
|
+
import * as Cesium from 'cesium';
|
|
4
|
+
/**
|
|
5
|
+
* 旧版绘制回调接口(保持向后兼容)
|
|
6
|
+
*/
|
|
7
|
+
export interface LegacyDrawCallbacks {
|
|
8
|
+
onDrawStart?: () => void;
|
|
9
|
+
onDrawEnd?: (entity: Entity | null) => void;
|
|
10
|
+
onEntityRemoved?: (entity: Entity) => void;
|
|
11
|
+
onMeasureComplete?: (result: {
|
|
12
|
+
type: 'line' | 'polygon' | 'rectangle' | 'circle';
|
|
13
|
+
positions: Cartesian3[];
|
|
14
|
+
distance?: number;
|
|
15
|
+
areaKm2?: number;
|
|
16
|
+
}) => void;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* 旧版绘制选项接口(保持向后兼容)
|
|
20
|
+
*/
|
|
21
|
+
export interface LegacyDrawOptions {
|
|
22
|
+
measurementTheme?: MeasurementTheme;
|
|
23
|
+
lineColor?: Cesium.Color | string;
|
|
24
|
+
lineWidth?: number;
|
|
25
|
+
fillColor?: Cesium.Color | string;
|
|
26
|
+
clampToGround?: boolean;
|
|
27
|
+
segmentDistanceLabelStyle?: MeasurementSummaryLabelStyle;
|
|
28
|
+
totalDistanceLabelStyle?: MeasurementSummaryLabelStyle;
|
|
29
|
+
previewAreaLabelStyle?: MeasurementSummaryLabelStyle;
|
|
30
|
+
totalAreaLabelStyle?: MeasurementSummaryLabelStyle;
|
|
31
|
+
hintBubbleStyle?: MeasurementSummaryLabelStyle;
|
|
32
|
+
onClick?: (entity: Entity, positions?: Cartesian3[]) => void;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* 旧版绘制实体类型(保持向后兼容)
|
|
36
|
+
*/
|
|
37
|
+
export interface LegacyDrawEntity extends Entity {
|
|
38
|
+
_drawType?: string;
|
|
39
|
+
_drawOptions?: LegacyDrawOptions;
|
|
40
|
+
_groundPositions?: Cartesian3[];
|
|
41
|
+
_groundPosition?: Cartesian3;
|
|
42
|
+
_labelEntities?: Entity[];
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* DrawHelper 适配器
|
|
46
|
+
*
|
|
47
|
+
* 基于新的 DrawService 架构,提供与旧版 DrawHelper 兼容的 API。
|
|
48
|
+
* 用于平滑迁移,让现有代码无需修改即可使用新架构。
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```typescript
|
|
52
|
+
* // 旧代码可以继续使用,无需修改
|
|
53
|
+
* const drawHelper = new DrawHelperAdapter(viewer);
|
|
54
|
+
* drawHelper.startDrawingLine({ lineColor: '#FF0000' });
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export declare class DrawHelperAdapter {
|
|
58
|
+
private viewer;
|
|
59
|
+
private drawService;
|
|
60
|
+
private callbacks;
|
|
61
|
+
constructor(viewer: Viewer);
|
|
62
|
+
/**
|
|
63
|
+
* 映射绘制模式到类型字符串
|
|
64
|
+
*/
|
|
65
|
+
private mapDrawModeToType;
|
|
66
|
+
/**
|
|
67
|
+
* 转换选项格式
|
|
68
|
+
*/
|
|
69
|
+
private convertOptions;
|
|
70
|
+
/**
|
|
71
|
+
* 开始绘制线
|
|
72
|
+
*/
|
|
73
|
+
startDrawingLine(options?: LegacyDrawOptions): void;
|
|
74
|
+
/**
|
|
75
|
+
* 开始绘制多边形
|
|
76
|
+
*/
|
|
77
|
+
startDrawingPolygon(options?: LegacyDrawOptions): void;
|
|
78
|
+
/**
|
|
79
|
+
* 开始绘制矩形
|
|
80
|
+
*/
|
|
81
|
+
startDrawingRectangle(options?: LegacyDrawOptions): void;
|
|
82
|
+
/**
|
|
83
|
+
* 开始绘制圆形
|
|
84
|
+
*/
|
|
85
|
+
startDrawingCircle(options?: LegacyDrawOptions): void;
|
|
86
|
+
/**
|
|
87
|
+
* 结束绘制
|
|
88
|
+
*/
|
|
89
|
+
endDrawing(): void;
|
|
90
|
+
/**
|
|
91
|
+
* 取消绘制
|
|
92
|
+
*/
|
|
93
|
+
cancelDrawing(): void;
|
|
94
|
+
/**
|
|
95
|
+
* 清除所有绘制
|
|
96
|
+
*/
|
|
97
|
+
clearAll(): void;
|
|
98
|
+
/**
|
|
99
|
+
* 删除指定实体
|
|
100
|
+
*/
|
|
101
|
+
removeEntity(entity: Entity): void;
|
|
102
|
+
/**
|
|
103
|
+
* 获取已完成的实体
|
|
104
|
+
*/
|
|
105
|
+
getFinishedEntities(): Entity[];
|
|
106
|
+
/**
|
|
107
|
+
* 检查是否正在绘制
|
|
108
|
+
*/
|
|
109
|
+
isDrawing(): boolean;
|
|
110
|
+
/**
|
|
111
|
+
* 获取当前绘制模式
|
|
112
|
+
*/
|
|
113
|
+
getCurrentDrawMode(): DrawMode;
|
|
114
|
+
/**
|
|
115
|
+
* 设置绘制开始回调
|
|
116
|
+
*/
|
|
117
|
+
onDrawStart(callback: () => void): void;
|
|
118
|
+
/**
|
|
119
|
+
* 设置绘制结束回调
|
|
120
|
+
*/
|
|
121
|
+
onDrawEnd(callback: (entity: Entity | null) => void): void;
|
|
122
|
+
/**
|
|
123
|
+
* 设置实体移除回调
|
|
124
|
+
*/
|
|
125
|
+
onEntityRemoved(callback: (entity: Entity) => void): void;
|
|
126
|
+
/**
|
|
127
|
+
* 设置测量完成回调
|
|
128
|
+
*/
|
|
129
|
+
onMeasureComplete(callback: (result: {
|
|
130
|
+
type: 'line' | 'polygon' | 'rectangle' | 'circle';
|
|
131
|
+
positions: Cartesian3[];
|
|
132
|
+
distance?: number;
|
|
133
|
+
areaKm2?: number;
|
|
134
|
+
}) => void): void;
|
|
135
|
+
/**
|
|
136
|
+
* 销毁助手
|
|
137
|
+
*/
|
|
138
|
+
destroy(): void;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* 创建 DrawHelperAdapter 的工厂函数
|
|
142
|
+
*/
|
|
143
|
+
export declare function createDrawHelperAdapter(viewer: Viewer): DrawHelperAdapter;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Viewer } from '../../node_modules/cesium';
|
|
2
|
+
import { MapPlugin } from '../core/MapPlugin';
|
|
3
|
+
import * as Cesium from 'cesium';
|
|
4
|
+
export interface LegacyMapCenter {
|
|
5
|
+
latitude: number;
|
|
6
|
+
longitude: number;
|
|
7
|
+
height: number;
|
|
8
|
+
pitch?: number;
|
|
9
|
+
heading?: number;
|
|
10
|
+
}
|
|
11
|
+
export interface LegacyInitOptions {
|
|
12
|
+
viewerOptions?: Cesium.Viewer.ConstructorOptions;
|
|
13
|
+
mapType?: string;
|
|
14
|
+
tdtMapTypeId?: string;
|
|
15
|
+
token?: string;
|
|
16
|
+
cesiumToken?: string;
|
|
17
|
+
loadNoFlyZonesOnInit?: boolean;
|
|
18
|
+
mapCenter?: LegacyMapCenter;
|
|
19
|
+
isFly?: boolean;
|
|
20
|
+
flyDuration?: number;
|
|
21
|
+
success?: () => void;
|
|
22
|
+
cancel?: () => void;
|
|
23
|
+
animation?: boolean;
|
|
24
|
+
timeline?: boolean;
|
|
25
|
+
navigationHelpButton?: boolean;
|
|
26
|
+
fullscreenButton?: boolean;
|
|
27
|
+
geocoder?: boolean;
|
|
28
|
+
homeButton?: boolean;
|
|
29
|
+
infoBox?: boolean;
|
|
30
|
+
sceneModePicker?: boolean;
|
|
31
|
+
baseLayerPicker?: boolean;
|
|
32
|
+
selectionIndicator?: boolean;
|
|
33
|
+
[key: string]: unknown;
|
|
34
|
+
}
|
|
35
|
+
export interface LegacyInitResult {
|
|
36
|
+
viewer: Viewer;
|
|
37
|
+
initialCenter: LegacyMapCenter;
|
|
38
|
+
mapPlugin: MapPlugin;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* initCesium 兼容适配器。
|
|
42
|
+
* 旧函数签名保持不变,内部切换到 MapPlugin。
|
|
43
|
+
*/
|
|
44
|
+
export declare function initCesium(containerId: string, options?: LegacyInitOptions, mapCenterOrCesiumToken?: LegacyMapCenter | string, cesiumToken?: string): Promise<LegacyInitResult>;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { Viewer, Entity } from '../../node_modules/cesium';
|
|
2
|
+
import { OverlayService, OverlayServiceOptions } from '../core/services/overlay/OverlayService';
|
|
3
|
+
import { MarkerOptions, LabelOptions, IconOptions, SvgOptions, InfoWindowOptions, PolylineOptions, PolygonOptions, RectangleOptions, CircleOptions, RingOptions, OverlayEntity } from '../core/entities';
|
|
4
|
+
/**
|
|
5
|
+
* 旧版覆盖物服务选项(保持向后兼容)
|
|
6
|
+
*/
|
|
7
|
+
export interface LegacyCesiumOverlayServiceOptions extends OverlayServiceOptions {
|
|
8
|
+
/** 是否启用 hover 处理器 */
|
|
9
|
+
enableHoverHandler?: boolean;
|
|
10
|
+
/** 点击节流间隔 */
|
|
11
|
+
clickPickMinIntervalMs?: number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* OverlayService 适配器
|
|
15
|
+
*
|
|
16
|
+
* 基于新的 OverlayService 架构,提供与旧版 CesiumOverlayService 兼容的 API。
|
|
17
|
+
* 用于平滑迁移,让现有代码无需修改即可使用新架构。
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* // 旧代码可以继续使用,无需修改
|
|
22
|
+
* const overlayService = new OverlayServiceAdapter(viewer);
|
|
23
|
+
* const marker = overlayService.addMarker({ position: [120.1, 30.2] });
|
|
24
|
+
* const polygon = overlayService.addPolygon({ positions: [[120.1, 30.2], [120.2, 30.3]] });
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare class OverlayServiceAdapter {
|
|
28
|
+
private viewer;
|
|
29
|
+
private overlayService;
|
|
30
|
+
constructor(viewer: Viewer, options?: LegacyCesiumOverlayServiceOptions);
|
|
31
|
+
/**
|
|
32
|
+
* 添加 Marker
|
|
33
|
+
*/
|
|
34
|
+
addMarker(options: MarkerOptions): Entity;
|
|
35
|
+
/**
|
|
36
|
+
* 添加 Label
|
|
37
|
+
*/
|
|
38
|
+
addLabel(options: LabelOptions): Entity;
|
|
39
|
+
/**
|
|
40
|
+
* 添加 Icon
|
|
41
|
+
*/
|
|
42
|
+
addIcon(options: IconOptions): Entity;
|
|
43
|
+
/**
|
|
44
|
+
* 添加 SVG
|
|
45
|
+
*/
|
|
46
|
+
addSvg(options: SvgOptions): Entity;
|
|
47
|
+
/**
|
|
48
|
+
* 添加 InfoWindow
|
|
49
|
+
*/
|
|
50
|
+
addInfoWindow(options: InfoWindowOptions): Entity;
|
|
51
|
+
/**
|
|
52
|
+
* 添加 Polyline
|
|
53
|
+
*/
|
|
54
|
+
addPolyline(options: PolylineOptions): Entity;
|
|
55
|
+
/**
|
|
56
|
+
* 添加 Polygon
|
|
57
|
+
*/
|
|
58
|
+
addPolygon(options: PolygonOptions): Entity;
|
|
59
|
+
/**
|
|
60
|
+
* 添加 Rectangle
|
|
61
|
+
*/
|
|
62
|
+
addRectangle(options: RectangleOptions): Entity;
|
|
63
|
+
/**
|
|
64
|
+
* 添加 Circle
|
|
65
|
+
*/
|
|
66
|
+
addCircle(options: CircleOptions): Entity;
|
|
67
|
+
/**
|
|
68
|
+
* 添加 Ring
|
|
69
|
+
*/
|
|
70
|
+
addRing(options: RingOptions): Entity;
|
|
71
|
+
/**
|
|
72
|
+
* 根据 ID 获取覆盖物
|
|
73
|
+
*/
|
|
74
|
+
getOverlay(id: string): Entity | undefined;
|
|
75
|
+
/**
|
|
76
|
+
* 根据 ID 删除覆盖物
|
|
77
|
+
*/
|
|
78
|
+
removeOverlay(id: string): boolean;
|
|
79
|
+
/**
|
|
80
|
+
* 删除所有覆盖物
|
|
81
|
+
*/
|
|
82
|
+
removeAllOverlays(): void;
|
|
83
|
+
/**
|
|
84
|
+
* 设置覆盖物可见性
|
|
85
|
+
*/
|
|
86
|
+
setOverlayVisible(id: string, visible: boolean): boolean;
|
|
87
|
+
/**
|
|
88
|
+
* 获取所有覆盖物 ID
|
|
89
|
+
*/
|
|
90
|
+
getAllOverlayIds(): string[];
|
|
91
|
+
toggleOverlayHighlight(entityOrId: OverlayEntity | Entity | string, reason?: 'click' | 'hover'): boolean;
|
|
92
|
+
setOverlayHighlight(entityOrId: OverlayEntity | Entity | string, enabled: boolean, reason?: 'click' | 'hover'): boolean;
|
|
93
|
+
getCoreService(): OverlayService;
|
|
94
|
+
/**
|
|
95
|
+
* 销毁服务
|
|
96
|
+
*/
|
|
97
|
+
destroy(): void;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* 创建 OverlayServiceAdapter 的工厂函数
|
|
101
|
+
*/
|
|
102
|
+
export declare function createOverlayServiceAdapter(viewer: Viewer, options?: LegacyCesiumOverlayServiceOptions): OverlayServiceAdapter;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Viewer } from '../../node_modules/cesium';
|
|
2
|
+
import { CustomButtonConfig, MapType, MeasurementCallback, SearchCallback, ToolbarConfig, ZoomCallback } from '../core/types';
|
|
3
|
+
import { ToolbarService } from '../core/services/toolbar/ToolbarService';
|
|
4
|
+
interface LegacyInitialCenter {
|
|
5
|
+
longitude: number;
|
|
6
|
+
latitude: number;
|
|
7
|
+
height: number;
|
|
8
|
+
}
|
|
9
|
+
export interface LegacyCesiumMapToolbarCallbacks {
|
|
10
|
+
search?: SearchCallback;
|
|
11
|
+
measurement?: MeasurementCallback;
|
|
12
|
+
zoom?: ZoomCallback;
|
|
13
|
+
fullscreen?: (isFullscreen: boolean) => void;
|
|
14
|
+
resetLocation?: () => void;
|
|
15
|
+
}
|
|
16
|
+
declare class ToolbarAdapterMapController {
|
|
17
|
+
private readonly viewer;
|
|
18
|
+
private initialCenter;
|
|
19
|
+
private readonly callbacks?;
|
|
20
|
+
constructor(viewer: Viewer, initialCenter: LegacyInitialCenter, callbacks?: {
|
|
21
|
+
zoom?: ZoomCallback;
|
|
22
|
+
fullscreen?: (isFullscreen: boolean) => void;
|
|
23
|
+
resetLocation?: () => void;
|
|
24
|
+
} | undefined);
|
|
25
|
+
toggle2D3D(): void;
|
|
26
|
+
resetLocation(): void;
|
|
27
|
+
zoomIn(): void;
|
|
28
|
+
zoomOut(): void;
|
|
29
|
+
toggleFullscreen(): void;
|
|
30
|
+
setInitialCenter(center: LegacyInitialCenter): void;
|
|
31
|
+
getInitialCenter(): LegacyInitialCenter;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* CesiumMapToolbar 兼容适配器。
|
|
35
|
+
* 旧类名仍可继续使用,但内部已经转调新的 ToolbarService。
|
|
36
|
+
*/
|
|
37
|
+
export declare class ToolbarAdapter {
|
|
38
|
+
private readonly viewer;
|
|
39
|
+
private readonly container;
|
|
40
|
+
private readonly config;
|
|
41
|
+
private readonly callbacks?;
|
|
42
|
+
private readonly toolbarService;
|
|
43
|
+
private readonly drawHelper;
|
|
44
|
+
private readonly mapController;
|
|
45
|
+
private readonly i18nInstance;
|
|
46
|
+
private currentMapType;
|
|
47
|
+
TD_Token: string;
|
|
48
|
+
mapTypes: MapType[];
|
|
49
|
+
constructor(viewer: Viewer, container: HTMLElement, config?: ToolbarConfig, callbacks?: LegacyCesiumMapToolbarCallbacks, initialCenter?: LegacyInitialCenter);
|
|
50
|
+
private applyMapType;
|
|
51
|
+
private syncLayersHandler;
|
|
52
|
+
setMapType(mapTypeId: string): void;
|
|
53
|
+
getToolbarService(): ToolbarService;
|
|
54
|
+
getToolbarElement(): HTMLElement | null;
|
|
55
|
+
getCesiumMapCtrl(): ToolbarAdapterMapController;
|
|
56
|
+
setMapTypes(mapTypes: MapType[]): void;
|
|
57
|
+
setTDToken(token: string): void;
|
|
58
|
+
setInitialCenter(center: LegacyInitialCenter): void;
|
|
59
|
+
getInitialCenter(): LegacyInitialCenter;
|
|
60
|
+
resetToInitialLocation(): void;
|
|
61
|
+
updateButtonConfig(buttonId: string, config: Partial<CustomButtonConfig>): void;
|
|
62
|
+
addCustomButton(config: CustomButtonConfig): void;
|
|
63
|
+
removeButton(buttonId: string): void;
|
|
64
|
+
showButton(buttonId: string): void;
|
|
65
|
+
hideButton(buttonId: string): void;
|
|
66
|
+
enableButton(buttonId: string): void;
|
|
67
|
+
disableButton(buttonId: string): void;
|
|
68
|
+
destroy(): void;
|
|
69
|
+
}
|
|
70
|
+
export declare function createToolbarAdapter(viewer: Viewer, container: HTMLElement, config?: ToolbarConfig, callbacks?: LegacyCesiumMapToolbarCallbacks, initialCenter?: LegacyInitialCenter): ToolbarAdapter;
|
|
71
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 适配器模块入口
|
|
3
|
+
*
|
|
4
|
+
* 提供基于新框架架构的适配器,保持与旧 libs 代码的 API 兼容性。
|
|
5
|
+
*
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
*/
|
|
8
|
+
export { ToolbarAdapter, createToolbarAdapter } from './ToolbarAdapter';
|
|
9
|
+
export type { LegacyCesiumMapToolbarCallbacks } from './ToolbarAdapter';
|
|
10
|
+
export { initCesium } from './MapLoaderAdapter';
|
|
11
|
+
export type { LegacyInitOptions, LegacyInitResult, LegacyMapCenter } from './MapLoaderAdapter';
|
|
12
|
+
export { DrawHelperAdapter, createDrawHelperAdapter } from './DrawHelperAdapter';
|
|
13
|
+
export type { LegacyDrawCallbacks, LegacyDrawOptions, LegacyDrawEntity } from './DrawHelperAdapter';
|
|
14
|
+
export { OverlayServiceAdapter, createOverlayServiceAdapter } from './OverlayServiceAdapter';
|
|
15
|
+
export type { LegacyCesiumOverlayServiceOptions } from './OverlayServiceAdapter';
|
|
16
|
+
/**
|
|
17
|
+
* 适配器模块版本信息
|
|
18
|
+
*/
|
|
19
|
+
export declare const ADAPTERS_VERSION = "1.0.0";
|
|
20
|
+
/**
|
|
21
|
+
* 适配器模块描述
|
|
22
|
+
*/
|
|
23
|
+
export declare const ADAPTERS_DESCRIPTION = "VMap Cesium Tool \u9002\u914D\u5668\u6A21\u5757 - \u63D0\u4F9B\u57FA\u4E8E\u65B0\u6846\u67B6\u67B6\u6784\u7684\u9002\u914D\u5668\uFF0C\u4FDD\u6301\u4E0E\u65E7 libs \u4EE3\u7801\u7684 API \u517C\u5BB9\u6027";
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { StyleConfig } from '../core/types';
|
|
2
|
+
/**
|
|
3
|
+
* 组件基础类
|
|
4
|
+
* 提供样式管理、事件处理等通用功能
|
|
5
|
+
*/
|
|
6
|
+
export declare abstract class BaseComponent {
|
|
7
|
+
protected element: HTMLElement;
|
|
8
|
+
protected styleConfig: StyleConfig;
|
|
9
|
+
protected isMounted: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* 构造函数
|
|
12
|
+
* @param tagName 元素标签名
|
|
13
|
+
* @param styleConfig 样式配置
|
|
14
|
+
*/
|
|
15
|
+
constructor(tagName?: string, styleConfig?: StyleConfig);
|
|
16
|
+
/**
|
|
17
|
+
* 应用样式配置
|
|
18
|
+
*/
|
|
19
|
+
protected applyStyle(): void;
|
|
20
|
+
/**
|
|
21
|
+
* 更新样式配置
|
|
22
|
+
* @param styleConfig 新的样式配置
|
|
23
|
+
*/
|
|
24
|
+
updateStyle(styleConfig: Partial<StyleConfig>): void;
|
|
25
|
+
/**
|
|
26
|
+
* 获取元素
|
|
27
|
+
*/
|
|
28
|
+
getElement(): HTMLElement;
|
|
29
|
+
/**
|
|
30
|
+
* 挂载到父元素
|
|
31
|
+
* @param parent 父元素或选择器
|
|
32
|
+
*/
|
|
33
|
+
mount(parent: HTMLElement | string): void;
|
|
34
|
+
/**
|
|
35
|
+
* 从父元素卸载
|
|
36
|
+
*/
|
|
37
|
+
unmount(): void;
|
|
38
|
+
/**
|
|
39
|
+
* 显示组件
|
|
40
|
+
*/
|
|
41
|
+
show(): void;
|
|
42
|
+
/**
|
|
43
|
+
* 隐藏组件
|
|
44
|
+
*/
|
|
45
|
+
hide(): void;
|
|
46
|
+
/**
|
|
47
|
+
* 切换显示状态
|
|
48
|
+
*/
|
|
49
|
+
toggle(): void;
|
|
50
|
+
/**
|
|
51
|
+
* 添加事件监听器
|
|
52
|
+
* @param event 事件类型
|
|
53
|
+
* @param handler 事件处理函数
|
|
54
|
+
* @param options 事件选项
|
|
55
|
+
*/
|
|
56
|
+
addEventListener(event: string, handler: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
57
|
+
/**
|
|
58
|
+
* 移除事件监听器
|
|
59
|
+
* @param event 事件类型
|
|
60
|
+
* @param handler 事件处理函数
|
|
61
|
+
* @param options 事件选项
|
|
62
|
+
*/
|
|
63
|
+
removeEventListener(event: string, handler: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
64
|
+
/**
|
|
65
|
+
* 设置属性
|
|
66
|
+
* @param name 属性名
|
|
67
|
+
* @param value 属性值
|
|
68
|
+
*/
|
|
69
|
+
setAttribute(name: string, value: string): void;
|
|
70
|
+
/**
|
|
71
|
+
* 获取属性
|
|
72
|
+
* @param name 属性名
|
|
73
|
+
*/
|
|
74
|
+
getAttribute(name: string): string | null;
|
|
75
|
+
/**
|
|
76
|
+
* 移除属性
|
|
77
|
+
* @param name 属性名
|
|
78
|
+
*/
|
|
79
|
+
removeAttribute(name: string): void;
|
|
80
|
+
/**
|
|
81
|
+
* 添加CSS类
|
|
82
|
+
* @param className CSS类名
|
|
83
|
+
*/
|
|
84
|
+
addClass(className: string): void;
|
|
85
|
+
/**
|
|
86
|
+
* 移除CSS类
|
|
87
|
+
* @param className CSS类名
|
|
88
|
+
*/
|
|
89
|
+
removeClass(className: string): void;
|
|
90
|
+
/**
|
|
91
|
+
* 切换CSS类
|
|
92
|
+
* @param className CSS类名
|
|
93
|
+
*/
|
|
94
|
+
toggleClass(className: string): void;
|
|
95
|
+
/**
|
|
96
|
+
* 检查是否包含CSS类
|
|
97
|
+
* @param className CSS类名
|
|
98
|
+
*/
|
|
99
|
+
hasClass(className: string): boolean;
|
|
100
|
+
/**
|
|
101
|
+
* 挂载后的回调(子类可重写)
|
|
102
|
+
*/
|
|
103
|
+
protected onMount(): void;
|
|
104
|
+
/**
|
|
105
|
+
* 卸载后的回调(子类可重写)
|
|
106
|
+
*/
|
|
107
|
+
protected onUnmount(): void;
|
|
108
|
+
/**
|
|
109
|
+
* 销毁组件
|
|
110
|
+
*/
|
|
111
|
+
destroy(): void;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* 创建组件实例的工厂函数
|
|
115
|
+
*/
|
|
116
|
+
export declare function createComponent<T extends BaseComponent>(ComponentClass: new (...args: any[]) => T, ...args: any[]): T;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { BaseComponent } from './BaseComponent';
|
|
2
|
+
import { SearchResult, StyleConfig } from '../core/types';
|
|
3
|
+
/**
|
|
4
|
+
* 搜索框组件配置
|
|
5
|
+
*/
|
|
6
|
+
export interface SearchBoxConfig {
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
debounceTime?: number;
|
|
9
|
+
minQueryLength?: number;
|
|
10
|
+
maxResults?: number;
|
|
11
|
+
showClearButton?: boolean;
|
|
12
|
+
autoFocus?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* 搜索框组件
|
|
16
|
+
*/
|
|
17
|
+
export declare class SearchBox extends BaseComponent {
|
|
18
|
+
private config;
|
|
19
|
+
private inputElement;
|
|
20
|
+
private clearButton;
|
|
21
|
+
private resultsContainer;
|
|
22
|
+
private debounceTimer;
|
|
23
|
+
private onSearchCallback?;
|
|
24
|
+
private onSelectCallback?;
|
|
25
|
+
private currentResults;
|
|
26
|
+
/**
|
|
27
|
+
* 构造函数
|
|
28
|
+
* @param config 搜索框配置
|
|
29
|
+
* @param styleConfig 样式配置
|
|
30
|
+
*/
|
|
31
|
+
constructor(config?: SearchBoxConfig, styleConfig?: StyleConfig);
|
|
32
|
+
/**
|
|
33
|
+
* 设置输入框
|
|
34
|
+
*/
|
|
35
|
+
private setupInput;
|
|
36
|
+
/**
|
|
37
|
+
* 设置清除按钮
|
|
38
|
+
*/
|
|
39
|
+
private setupClearButton;
|
|
40
|
+
/**
|
|
41
|
+
* 设置结果容器
|
|
42
|
+
*/
|
|
43
|
+
private setupResultsContainer;
|
|
44
|
+
/**
|
|
45
|
+
* 处理输入事件
|
|
46
|
+
*/
|
|
47
|
+
private handleInput;
|
|
48
|
+
/**
|
|
49
|
+
* 处理键盘事件
|
|
50
|
+
*/
|
|
51
|
+
private handleKeyDown;
|
|
52
|
+
/**
|
|
53
|
+
* 处理聚焦事件
|
|
54
|
+
*/
|
|
55
|
+
private handleFocus;
|
|
56
|
+
/**
|
|
57
|
+
* 处理失焦事件
|
|
58
|
+
*/
|
|
59
|
+
private handleBlur;
|
|
60
|
+
/**
|
|
61
|
+
* 执行搜索
|
|
62
|
+
*/
|
|
63
|
+
private performSearch;
|
|
64
|
+
/**
|
|
65
|
+
* 显示搜索结果
|
|
66
|
+
*/
|
|
67
|
+
private displayResults;
|
|
68
|
+
/**
|
|
69
|
+
* 显示错误信息
|
|
70
|
+
*/
|
|
71
|
+
private displayError;
|
|
72
|
+
/**
|
|
73
|
+
* 创建结果元素
|
|
74
|
+
*/
|
|
75
|
+
private createResultElement;
|
|
76
|
+
/**
|
|
77
|
+
* 导航结果
|
|
78
|
+
*/
|
|
79
|
+
private navigateResults;
|
|
80
|
+
/**
|
|
81
|
+
* 选择结果
|
|
82
|
+
*/
|
|
83
|
+
private selectResult;
|
|
84
|
+
/**
|
|
85
|
+
* 显示结果容器
|
|
86
|
+
*/
|
|
87
|
+
private showResults;
|
|
88
|
+
/**
|
|
89
|
+
* 隐藏结果容器
|
|
90
|
+
*/
|
|
91
|
+
private hideResults;
|
|
92
|
+
/**
|
|
93
|
+
* 设置搜索回调
|
|
94
|
+
*/
|
|
95
|
+
setOnSearch(callback: (query: string) => Promise<SearchResult[]>): void;
|
|
96
|
+
/**
|
|
97
|
+
* 设置选择回调
|
|
98
|
+
*/
|
|
99
|
+
setOnSelect(callback: (result: SearchResult) => void): void;
|
|
100
|
+
/**
|
|
101
|
+
* 获取当前查询
|
|
102
|
+
*/
|
|
103
|
+
getQuery(): string;
|
|
104
|
+
/**
|
|
105
|
+
* 设置查询
|
|
106
|
+
*/
|
|
107
|
+
setQuery(query: string): void;
|
|
108
|
+
/**
|
|
109
|
+
* 清空搜索框
|
|
110
|
+
*/
|
|
111
|
+
clear(): void;
|
|
112
|
+
/**
|
|
113
|
+
* 聚焦输入框
|
|
114
|
+
*/
|
|
115
|
+
focus(): void;
|
|
116
|
+
/**
|
|
117
|
+
* 失焦输入框
|
|
118
|
+
*/
|
|
119
|
+
blur(): void;
|
|
120
|
+
/**
|
|
121
|
+
* 更新配置
|
|
122
|
+
*/
|
|
123
|
+
updateConfig(config: Partial<SearchBoxConfig>): void;
|
|
124
|
+
/**
|
|
125
|
+
* 获取配置
|
|
126
|
+
*/
|
|
127
|
+
getConfig(): SearchBoxConfig;
|
|
128
|
+
/**
|
|
129
|
+
* 销毁组件
|
|
130
|
+
*/
|
|
131
|
+
destroy(): void;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* 创建搜索框的工厂函数
|
|
135
|
+
*/
|
|
136
|
+
export declare function createSearchBox(config?: SearchBoxConfig, styleConfig?: StyleConfig): SearchBox;
|