@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,119 @@
|
|
|
1
|
+
import { Viewer } from '../../../node_modules/cesium';
|
|
2
|
+
import * as Cesium from 'cesium';
|
|
3
|
+
/**
|
|
4
|
+
* 聚类点数据
|
|
5
|
+
*/
|
|
6
|
+
export interface ClusterPoint {
|
|
7
|
+
/** 业务 id */
|
|
8
|
+
id?: string;
|
|
9
|
+
/** 经度(度) */
|
|
10
|
+
lon: number;
|
|
11
|
+
/** 纬度(度) */
|
|
12
|
+
lat: number;
|
|
13
|
+
/** 高度(米) */
|
|
14
|
+
height?: number;
|
|
15
|
+
/** 权重值 */
|
|
16
|
+
value?: number;
|
|
17
|
+
/** 业务属性 */
|
|
18
|
+
properties?: Record<string, unknown>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* 聚类样式分段
|
|
22
|
+
*/
|
|
23
|
+
export interface ClusterStyleStep {
|
|
24
|
+
/** 最小聚合数量 */
|
|
25
|
+
minCount: number;
|
|
26
|
+
/** 颜色 */
|
|
27
|
+
color: Cesium.Color | string;
|
|
28
|
+
/** 像素大小 */
|
|
29
|
+
pixelSize?: number;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* 点聚合图层选项
|
|
33
|
+
*/
|
|
34
|
+
export interface PointClusterLayerOptions {
|
|
35
|
+
/** 图层 id */
|
|
36
|
+
id?: string;
|
|
37
|
+
/** 单点像素大小(默认 8) */
|
|
38
|
+
pointPixelSize?: number;
|
|
39
|
+
/** 单点颜色(默认青色) */
|
|
40
|
+
pointColor?: Cesium.Color | string;
|
|
41
|
+
/** 是否贴地(默认 true) */
|
|
42
|
+
clampToGround?: boolean;
|
|
43
|
+
/** 启用聚类(默认 true) */
|
|
44
|
+
clusteringEnabled?: boolean;
|
|
45
|
+
/** 聚类像素范围(默认 50) */
|
|
46
|
+
pixelRange?: number;
|
|
47
|
+
/** 最小聚类数量(默认 2) */
|
|
48
|
+
minimumClusterSize?: number;
|
|
49
|
+
/** 聚合点默认大小(默认 18) */
|
|
50
|
+
clusterPixelSize?: number;
|
|
51
|
+
/** 聚合点样式分段 */
|
|
52
|
+
clusterStyleSteps?: ClusterStyleStep[];
|
|
53
|
+
/** 点击聚合点回调 */
|
|
54
|
+
onClusterClick?: (points: ClusterPoint[]) => void;
|
|
55
|
+
/** 点击单点回调 */
|
|
56
|
+
onPointClick?: (point: ClusterPoint) => void;
|
|
57
|
+
/** 实体 ID 前缀 */
|
|
58
|
+
idPrefix?: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* 点聚合图层
|
|
62
|
+
*
|
|
63
|
+
* 用于在地图上创建点聚合效果,将密集的点聚合成簇显示。
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```typescript
|
|
67
|
+
* const clusterLayer = new PointClusterLayer(viewer, {
|
|
68
|
+
* pixelRange: 50,
|
|
69
|
+
* minimumClusterSize: 2,
|
|
70
|
+
* clusterStyleSteps: [
|
|
71
|
+
* { minCount: 100, color: Cesium.Color.RED, pixelSize: 28 },
|
|
72
|
+
* { minCount: 50, color: Cesium.Color.ORANGE, pixelSize: 24 },
|
|
73
|
+
* { minCount: 20, color: Cesium.Color.YELLOW, pixelSize: 20 },
|
|
74
|
+
* { minCount: 2, color: Cesium.Color.DODGERBLUE, pixelSize: 18 }
|
|
75
|
+
* ]
|
|
76
|
+
* });
|
|
77
|
+
* clusterLayer.setData([
|
|
78
|
+
* { lon: 120.1, lat: 30.2 },
|
|
79
|
+
* { lon: 120.2, lat: 30.3 }
|
|
80
|
+
* ]);
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
export declare class PointClusterLayer {
|
|
84
|
+
private viewer;
|
|
85
|
+
private options;
|
|
86
|
+
private dataSource;
|
|
87
|
+
private entityIdToPoint;
|
|
88
|
+
private clickHandler;
|
|
89
|
+
private readonly layerId;
|
|
90
|
+
constructor(viewer: Viewer, options?: PointClusterLayerOptions);
|
|
91
|
+
/**
|
|
92
|
+
* 设置点数据
|
|
93
|
+
*/
|
|
94
|
+
setData(points: ClusterPoint[]): void;
|
|
95
|
+
/**
|
|
96
|
+
* 应用聚类样式
|
|
97
|
+
*/
|
|
98
|
+
private applyClusterStyle;
|
|
99
|
+
/**
|
|
100
|
+
* 选择样式
|
|
101
|
+
*/
|
|
102
|
+
private pickStyle;
|
|
103
|
+
/**
|
|
104
|
+
* 安装点击处理器
|
|
105
|
+
*/
|
|
106
|
+
private installClickHandler;
|
|
107
|
+
/**
|
|
108
|
+
* 设置可见性
|
|
109
|
+
*/
|
|
110
|
+
setVisible(visible: boolean): void;
|
|
111
|
+
/**
|
|
112
|
+
* 设置聚类开关
|
|
113
|
+
*/
|
|
114
|
+
setClusteringEnabled(enabled: boolean): void;
|
|
115
|
+
/**
|
|
116
|
+
* 销毁图层
|
|
117
|
+
*/
|
|
118
|
+
destroy(): void;
|
|
119
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { TDTLayerConfig } from '../types';
|
|
2
|
+
import { MapLayer } from './MapLayer';
|
|
3
|
+
import * as Cesium from 'cesium';
|
|
4
|
+
/**
|
|
5
|
+
* 天地图影像图层配置(带注记)
|
|
6
|
+
*/
|
|
7
|
+
export declare const createTDTImageryConfig: (token: string) => Cesium.ImageryProvider[];
|
|
8
|
+
/**
|
|
9
|
+
* 天地图矢量图层配置(带注记)
|
|
10
|
+
*/
|
|
11
|
+
export declare const createTDTVectorConfig: (token: string) => Cesium.ImageryProvider[];
|
|
12
|
+
/**
|
|
13
|
+
* 天地图地形图层配置(带注记)
|
|
14
|
+
*/
|
|
15
|
+
export declare const createTDTTerrainConfig: (token: string) => Cesium.ImageryProvider[];
|
|
16
|
+
/**
|
|
17
|
+
* 天地图图层类
|
|
18
|
+
* 支持矢量、影像、地形三种类型的天地图图层
|
|
19
|
+
*/
|
|
20
|
+
export declare class TDTMapLayer extends MapLayer {
|
|
21
|
+
private config;
|
|
22
|
+
/**
|
|
23
|
+
* 构造函数
|
|
24
|
+
* @param viewer Cesium Viewer 实例
|
|
25
|
+
* @param config 天地图图层配置
|
|
26
|
+
*/
|
|
27
|
+
constructor(viewer: Cesium.Viewer, config: TDTLayerConfig);
|
|
28
|
+
/**
|
|
29
|
+
* 获取影像提供者数组
|
|
30
|
+
*/
|
|
31
|
+
protected getProviders(): Cesium.ImageryProvider[];
|
|
32
|
+
/**
|
|
33
|
+
* 添加图层到 Viewer
|
|
34
|
+
*/
|
|
35
|
+
addToViewer(): void;
|
|
36
|
+
/**
|
|
37
|
+
* 更新图层配置
|
|
38
|
+
* @param config 新的天地图图层配置
|
|
39
|
+
*/
|
|
40
|
+
updateConfig(config: Partial<TDTLayerConfig>): void;
|
|
41
|
+
/**
|
|
42
|
+
* 获取当前配置
|
|
43
|
+
*/
|
|
44
|
+
getConfig(): TDTLayerConfig;
|
|
45
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 图层模块入口
|
|
3
|
+
*
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
*/
|
|
6
|
+
export { MapLayer } from './MapLayer';
|
|
7
|
+
export { TDTMapLayer } from './TDTMapLayer';
|
|
8
|
+
export { GaodeMapLayer } from './GaodeMapLayer';
|
|
9
|
+
export { BaiduMapLayer } from './BaiduMapLayer';
|
|
10
|
+
export { OSMMapLayer } from './OSMMapLayer';
|
|
11
|
+
export { CustomMapLayer } from './CustomMapLayer';
|
|
12
|
+
export { HeatmapLayer } from './HeatmapLayer';
|
|
13
|
+
export type { HeatPoint, HeatmapGradient, HeatmapOptions } from './HeatmapLayer';
|
|
14
|
+
export { PointClusterLayer } from './PointClusterLayer';
|
|
15
|
+
export type { ClusterPoint, ClusterStyleStep, PointClusterLayerOptions } from './PointClusterLayer';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Cartesian3, Viewer } from '../../../../node_modules/cesium';
|
|
2
|
+
import * as Cesium from 'cesium';
|
|
3
|
+
export declare class DrawInteractionController {
|
|
4
|
+
private readonly viewer;
|
|
5
|
+
private screenSpaceEventHandler;
|
|
6
|
+
constructor(viewer: Viewer);
|
|
7
|
+
activate(handlers: {
|
|
8
|
+
onLeftClick(position: Cartesian3): void;
|
|
9
|
+
onRightClick(): void;
|
|
10
|
+
onMouseMove(position: Cartesian3): void;
|
|
11
|
+
onDoubleClick(position: Cartesian3): void;
|
|
12
|
+
}): void;
|
|
13
|
+
deactivate(): void;
|
|
14
|
+
pickGlobePosition(windowPosition: Cesium.Cartesian2): Cartesian3 | null;
|
|
15
|
+
destroy(): void;
|
|
16
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Entity, Viewer } from '../../../../node_modules/cesium';
|
|
2
|
+
import { DrawMode, DrawOptions, DrawResult, DrawServiceOptions } from './types/drawTypes';
|
|
3
|
+
export type { DrawArtifacts, DrawMode, DrawOptions, DrawResult, DrawServiceOptions, MeasurementFillStyle, MeasurementLabelOffset, MeasurementStrokeStyle, MeasurementSummaryLabelStyle, MeasurementTheme, MeasurementVertexStyle, } from './types/drawTypes';
|
|
4
|
+
export declare class DrawService {
|
|
5
|
+
private readonly viewer;
|
|
6
|
+
private readonly store;
|
|
7
|
+
private readonly interactionController;
|
|
8
|
+
private readonly labelFactory;
|
|
9
|
+
private readonly hintController;
|
|
10
|
+
private readonly entityFactory;
|
|
11
|
+
private readonly entityRegistry;
|
|
12
|
+
private readonly options;
|
|
13
|
+
private readonly i18n;
|
|
14
|
+
private readonly useI18n;
|
|
15
|
+
private callbacks;
|
|
16
|
+
constructor(viewer: Viewer, options?: DrawServiceOptions);
|
|
17
|
+
private t;
|
|
18
|
+
startDrawing(mode: DrawMode, options?: DrawOptions): void;
|
|
19
|
+
startDrawingLine(options?: DrawOptions): void;
|
|
20
|
+
startDrawingPolygon(options?: DrawOptions): void;
|
|
21
|
+
startDrawingRectangle(options?: DrawOptions): void;
|
|
22
|
+
startDrawingCircle(options?: DrawOptions): void;
|
|
23
|
+
endDrawing(): void;
|
|
24
|
+
cancelDrawing(): void;
|
|
25
|
+
getFinishedEntities(): Entity[];
|
|
26
|
+
clearAll(): void;
|
|
27
|
+
removeEntity(entity: Entity): void;
|
|
28
|
+
onDrawStart(callback: () => void): void;
|
|
29
|
+
onDrawEnd(callback: (result: DrawResult | null) => void): void;
|
|
30
|
+
onEntityRemoved(callback: (entity: Entity) => void): void;
|
|
31
|
+
isDrawingMode(): boolean;
|
|
32
|
+
getCurrentDrawMode(): DrawMode;
|
|
33
|
+
destroy(): void;
|
|
34
|
+
private finishDrawing;
|
|
35
|
+
private renderPreview;
|
|
36
|
+
private resetCurrentSession;
|
|
37
|
+
private emitDrawEnd;
|
|
38
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Cartesian3, Entity } from '../../../../node_modules/cesium';
|
|
2
|
+
import { DrawMode, DrawOptions } from './types/drawTypes';
|
|
3
|
+
import { FinishedDrawRecord } from './types/drawState';
|
|
4
|
+
export declare class DrawSessionStore {
|
|
5
|
+
private state;
|
|
6
|
+
private finishedRecords;
|
|
7
|
+
start(mode: DrawMode, options: DrawOptions): void;
|
|
8
|
+
stop(): void;
|
|
9
|
+
resetTemp(): void;
|
|
10
|
+
setPreviewPosition(position: Cartesian3 | null): void;
|
|
11
|
+
pushTempPosition(position: Cartesian3): void;
|
|
12
|
+
popTempPosition(): Cartesian3 | undefined;
|
|
13
|
+
replaceTempEntities(entities: Entity[]): void;
|
|
14
|
+
setHintEntity(entity: Entity | null): void;
|
|
15
|
+
registerFinished(primary: Entity, auxiliary: Entity[]): void;
|
|
16
|
+
unregisterFinished(primary: Entity): FinishedDrawRecord | null;
|
|
17
|
+
clearFinished(): FinishedDrawRecord[];
|
|
18
|
+
getTempPositions(): Cartesian3[];
|
|
19
|
+
getSanitizedTempPositions(): Cartesian3[];
|
|
20
|
+
getTempEntities(): Entity[];
|
|
21
|
+
getFinishedEntities(): Entity[];
|
|
22
|
+
getFinishedAuxEntities(): Entity[];
|
|
23
|
+
getHintEntity(): Entity | null;
|
|
24
|
+
isDrawing(): boolean;
|
|
25
|
+
getMode(): DrawMode;
|
|
26
|
+
getOptions(): DrawOptions | null;
|
|
27
|
+
getPreviewPosition(): Cartesian3 | null;
|
|
28
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { MeasurementLabelOffset, ResolvedMeasurementFillStyle, ResolvedMeasurementLabelStyle, ResolvedMeasurementStrokeStyle, ResolvedMeasurementVertexStyle } from './types/drawTypes';
|
|
2
|
+
import * as Cesium from 'cesium';
|
|
3
|
+
export declare const DEFAULT_LINE_WIDTH = 2;
|
|
4
|
+
export declare const DEFAULT_CLAMP_TO_GROUND = true;
|
|
5
|
+
export declare const DEFAULT_LINE_COLOR: Cesium.Color;
|
|
6
|
+
export declare const DEFAULT_FILL_COLOR: Cesium.Color;
|
|
7
|
+
export declare const DEFAULT_CIRCLE_SEGMENTS = 64;
|
|
8
|
+
export declare const DEFAULT_STROKE_STYLE: ResolvedMeasurementStrokeStyle;
|
|
9
|
+
export declare const DEFAULT_FILL_STYLE: ResolvedMeasurementFillStyle;
|
|
10
|
+
export declare const DEFAULT_VERTEX_STYLE: ResolvedMeasurementVertexStyle;
|
|
11
|
+
export declare const DEFAULT_SEGMENT_DISTANCE_LABEL_STYLE: ResolvedMeasurementLabelStyle;
|
|
12
|
+
export declare const DEFAULT_TOTAL_DISTANCE_LABEL_STYLE: ResolvedMeasurementLabelStyle;
|
|
13
|
+
export declare const DEFAULT_PREVIEW_AREA_LABEL_STYLE: ResolvedMeasurementLabelStyle;
|
|
14
|
+
export declare const DEFAULT_TOTAL_AREA_LABEL_STYLE: ResolvedMeasurementLabelStyle;
|
|
15
|
+
export declare const DEFAULT_HINT_OFFSET: MeasurementLabelOffset;
|
|
16
|
+
export declare const DEFAULT_HINT_BUBBLE_STYLE: ResolvedMeasurementLabelStyle;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Cartesian3, Viewer } from '../../../../../node_modules/cesium';
|
|
2
|
+
import { MeasurementLabelFactory } from '../labels/measurementLabelFactory';
|
|
3
|
+
import { DrawArtifacts, DrawMode, ResolvedMeasurementTheme } from '../types/drawTypes';
|
|
4
|
+
export declare class DrawEntityFactory {
|
|
5
|
+
private readonly previewFactory;
|
|
6
|
+
private readonly finalFactory;
|
|
7
|
+
constructor(viewer: Viewer, labelFactory: MeasurementLabelFactory);
|
|
8
|
+
createPreview(mode: DrawMode, positions: Cartesian3[], previewPoint: Cartesian3 | undefined, theme: ResolvedMeasurementTheme): import('../../../../../node_modules/cesium').Entity[];
|
|
9
|
+
createFinal(mode: DrawMode, positions: Cartesian3[], theme: ResolvedMeasurementTheme): DrawArtifacts | null;
|
|
10
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Entity, Viewer } from '../../../../../node_modules/cesium';
|
|
2
|
+
export declare class DrawEntityRegistry {
|
|
3
|
+
private readonly groups;
|
|
4
|
+
bindAuxiliary(primary: Entity, auxiliary: Entity[]): void;
|
|
5
|
+
getAuxiliary(primary: Entity): Entity[];
|
|
6
|
+
removeGroup(viewer: Viewer, primary: Entity): Entity[];
|
|
7
|
+
clear(viewer: Viewer, entities: Entity[], auxiliaryEntities: Entity[]): void;
|
|
8
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Cartesian3, Viewer } from '../../../../../node_modules/cesium';
|
|
2
|
+
import { MeasurementLabelFactory } from '../labels/measurementLabelFactory';
|
|
3
|
+
import { DrawArtifacts, ResolvedMeasurementTheme } from '../types/drawTypes';
|
|
4
|
+
import { DrawPreviewFactory } from './drawPreviewFactory';
|
|
5
|
+
export declare class DrawFinalFactory {
|
|
6
|
+
private readonly viewer;
|
|
7
|
+
private readonly labelFactory;
|
|
8
|
+
private readonly previewFactory;
|
|
9
|
+
constructor(viewer: Viewer, labelFactory: MeasurementLabelFactory, previewFactory: DrawPreviewFactory);
|
|
10
|
+
createFinalLine(positions: Cartesian3[], theme: ResolvedMeasurementTheme): DrawArtifacts;
|
|
11
|
+
createFinalPolygon(positions: Cartesian3[], theme: ResolvedMeasurementTheme): DrawArtifacts;
|
|
12
|
+
createFinalRectangle(positions: Cartesian3[], theme: ResolvedMeasurementTheme): DrawArtifacts | null;
|
|
13
|
+
createFinalCircle(positions: Cartesian3[], theme: ResolvedMeasurementTheme): DrawArtifacts | null;
|
|
14
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Cartesian3, Entity, Viewer } from '../../../../../node_modules/cesium';
|
|
2
|
+
import { MeasurementLabelFactory } from '../labels/measurementLabelFactory';
|
|
3
|
+
import { ResolvedMeasurementTheme } from '../types/drawTypes';
|
|
4
|
+
import * as Cesium from 'cesium';
|
|
5
|
+
export declare class DrawPreviewFactory {
|
|
6
|
+
private readonly viewer;
|
|
7
|
+
private readonly labelFactory;
|
|
8
|
+
constructor(viewer: Viewer, labelFactory: MeasurementLabelFactory);
|
|
9
|
+
createPreviewLine(positions: Cartesian3[], theme: ResolvedMeasurementTheme): Entity[];
|
|
10
|
+
createPreviewPolygon(basePositions: Cartesian3[], previewPoint: Cartesian3 | undefined, theme: ResolvedMeasurementTheme): Entity[];
|
|
11
|
+
createPreviewRectangle(start: Cartesian3, end: Cartesian3, theme: ResolvedMeasurementTheme): Entity[];
|
|
12
|
+
createPreviewCircle(center: Cartesian3, edge: Cartesian3, theme: ResolvedMeasurementTheme): Entity[];
|
|
13
|
+
createPolylineEntity(positions: Cartesian3[], color: Cesium.Color, width: number, clampToGround: boolean, closeLoop: boolean): Entity;
|
|
14
|
+
createPolygonFillEntity(positions: Cartesian3[], fill: Cesium.Color, clampToGround: boolean): Entity;
|
|
15
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Cartesian3 } from '../../../../../node_modules/cesium';
|
|
2
|
+
import { DrawMode } from '../types/drawTypes';
|
|
3
|
+
import * as Cesium from 'cesium';
|
|
4
|
+
export declare function calculateDistance(cart1: Cesium.Cartographic, cart2: Cesium.Cartographic): number;
|
|
5
|
+
export declare function calculateTotalDistance(positions: Cartesian3[]): number;
|
|
6
|
+
export declare function calculatePolygonArea(positions: Cartesian3[]): number;
|
|
7
|
+
export declare function getRectangleCornerPositions(start: Cartesian3, end: Cartesian3): Cartesian3[];
|
|
8
|
+
export declare function generateCirclePositions(center: Cesium.Cartographic, radius: number, segments?: number): Cartesian3[];
|
|
9
|
+
export declare function formatDistance(distance: number): string;
|
|
10
|
+
export declare function formatArea(area: number): string;
|
|
11
|
+
export declare function getMinimumPointCount(mode: DrawMode): number;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Cartesian3 } from '../../../../../node_modules/cesium';
|
|
2
|
+
import * as Cesium from 'cesium';
|
|
3
|
+
export declare function isValidCartesian3(position: Cartesian3 | null | undefined): position is Cartesian3;
|
|
4
|
+
export declare function sanitizePositions(positions: Cartesian3[]): Cartesian3[];
|
|
5
|
+
export declare function toCartographic(position: Cartesian3): Cesium.Cartographic | null;
|
|
6
|
+
export declare function clonePositions(positions: Cartesian3[]): Cartesian3[];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 绘制服务模块入口
|
|
3
|
+
*
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
*/
|
|
6
|
+
export { DrawService } from './DrawService';
|
|
7
|
+
export type { DrawArtifacts, DrawMode, DrawOptions, DrawResult, DrawServiceOptions, MeasurementFillStyle, MeasurementLabelOffset, MeasurementStrokeStyle, MeasurementSummaryLabelStyle, MeasurementTheme, MeasurementVertexStyle, } from './types/drawTypes';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Cartesian3, Entity, Viewer } from '../../../../../node_modules/cesium';
|
|
2
|
+
import { DrawMode, ResolvedMeasurementLabelStyle } from '../types/drawTypes';
|
|
3
|
+
import * as Cesium from 'cesium';
|
|
4
|
+
export interface DrawHintTextOptions {
|
|
5
|
+
t?: (key: string) => string;
|
|
6
|
+
}
|
|
7
|
+
export declare function buildHintText(mode: DrawMode, pointCount: number, options?: DrawHintTextOptions): string;
|
|
8
|
+
export declare class DrawHintController {
|
|
9
|
+
private readonly viewer;
|
|
10
|
+
constructor(viewer: Viewer);
|
|
11
|
+
createHintBillboardGraphics(text: string, style: ResolvedMeasurementLabelStyle): Cesium.BillboardGraphics;
|
|
12
|
+
createHintBubbleCanvas(text: string, style: ResolvedMeasurementLabelStyle): HTMLCanvasElement;
|
|
13
|
+
show(position: Cartesian3, text: string, style: ResolvedMeasurementLabelStyle): Entity;
|
|
14
|
+
update(entity: Entity, position: Cartesian3, text: string, style: ResolvedMeasurementLabelStyle): void;
|
|
15
|
+
remove(entity: Entity | null): null;
|
|
16
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type * as Cesium from 'cesium';
|
|
2
|
+
export declare function createRoundedLabelCanvas(text: string, options: {
|
|
3
|
+
font: string;
|
|
4
|
+
textColor: Cesium.Color;
|
|
5
|
+
backgroundColor: Cesium.Color;
|
|
6
|
+
borderRadius: number;
|
|
7
|
+
}): HTMLCanvasElement;
|
|
8
|
+
export declare function drawRoundedRect(context: CanvasRenderingContext2D, x: number, y: number, width: number, height: number, radius: number): void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Cartesian3, Entity, Viewer } from '../../../../../node_modules/cesium';
|
|
2
|
+
import { I18nLike } from '../../../../i18n';
|
|
3
|
+
import { ResolvedMeasurementLabelStyle, ResolvedMeasurementTheme } from '../types/drawTypes';
|
|
4
|
+
export interface MeasurementLabelFactoryOptions {
|
|
5
|
+
i18n?: I18nLike;
|
|
6
|
+
useI18n?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare class MeasurementLabelFactory {
|
|
9
|
+
private readonly viewer;
|
|
10
|
+
private readonly i18n?;
|
|
11
|
+
private readonly useI18n;
|
|
12
|
+
constructor(viewer: Viewer, options?: MeasurementLabelFactoryOptions);
|
|
13
|
+
private t;
|
|
14
|
+
createVertexMarkerEntities(positions: Cartesian3[], theme: ResolvedMeasurementTheme): Entity[];
|
|
15
|
+
createMeasurementBillboardEntity(position: Cartesian3, text: string, style: ResolvedMeasurementLabelStyle): Entity;
|
|
16
|
+
createDistanceLabelEntities(positions: Cartesian3[], theme: ResolvedMeasurementTheme): Entity[];
|
|
17
|
+
createAreaLabelEntity(positions: Cartesian3[], area: number, variant: 'preview' | 'final', theme: ResolvedMeasurementTheme): Entity | null;
|
|
18
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DrawOptions, MeasurementLabelKind, MeasurementLabelOffset, MeasurementSummaryLabelStyle, ResolvedMeasurementFillStyle, ResolvedMeasurementLabelStyle, ResolvedMeasurementStrokeStyle, ResolvedMeasurementTheme, ResolvedMeasurementVertexStyle } from './types/drawTypes';
|
|
2
|
+
import * as Cesium from 'cesium';
|
|
3
|
+
export declare function resolveColor(color: Cesium.Color | string, fallback: Cesium.Color): Cesium.Color;
|
|
4
|
+
export declare function resolveMeasurementPixelOffset(offset: MeasurementSummaryLabelStyle['pixelOffset'] | undefined, fallback: Cesium.Cartesian2 | MeasurementLabelOffset): Cesium.Cartesian2;
|
|
5
|
+
export declare function resolveMeasurementTheme(options?: DrawOptions | null): ResolvedMeasurementTheme;
|
|
6
|
+
export declare function resolveLabelStyle(theme: ResolvedMeasurementTheme, kind: MeasurementLabelKind): ResolvedMeasurementLabelStyle;
|
|
7
|
+
export declare function resolveStrokeStyle(theme: ResolvedMeasurementTheme): ResolvedMeasurementStrokeStyle;
|
|
8
|
+
export declare function resolveFillStyle(theme: ResolvedMeasurementTheme): ResolvedMeasurementFillStyle;
|
|
9
|
+
export declare function resolveVertexStyle(theme: ResolvedMeasurementTheme): ResolvedMeasurementVertexStyle;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Cartesian3, Entity } from '../../../../../node_modules/cesium';
|
|
2
|
+
import { DrawMode, DrawOptions, DrawResult, ResolvedMeasurementTheme } from './drawTypes';
|
|
3
|
+
export interface DrawSessionState {
|
|
4
|
+
isDrawing: boolean;
|
|
5
|
+
drawMode: DrawMode;
|
|
6
|
+
options: DrawOptions | null;
|
|
7
|
+
tempPositions: Cartesian3[];
|
|
8
|
+
tempEntities: Entity[];
|
|
9
|
+
finishedEntities: Entity[];
|
|
10
|
+
finishedAuxEntities: Entity[];
|
|
11
|
+
hintEntity: Entity | null;
|
|
12
|
+
currentPreviewPosition: Cartesian3 | null;
|
|
13
|
+
}
|
|
14
|
+
export interface DrawCallbacks {
|
|
15
|
+
onDrawStart?: () => void;
|
|
16
|
+
onDrawEnd?: (result: DrawResult | null) => void;
|
|
17
|
+
onEntityRemoved?: (entity: Entity) => void;
|
|
18
|
+
}
|
|
19
|
+
export interface FinishedDrawRecord {
|
|
20
|
+
primary: Entity;
|
|
21
|
+
auxiliary: Entity[];
|
|
22
|
+
}
|
|
23
|
+
export interface PreviewRenderContext {
|
|
24
|
+
mode: DrawMode;
|
|
25
|
+
positions: Cartesian3[];
|
|
26
|
+
previewPoint?: Cartesian3;
|
|
27
|
+
theme: ResolvedMeasurementTheme;
|
|
28
|
+
}
|
|
29
|
+
export interface FinalRenderContext {
|
|
30
|
+
mode: Exclude<DrawMode, null>;
|
|
31
|
+
positions: Cartesian3[];
|
|
32
|
+
theme: ResolvedMeasurementTheme;
|
|
33
|
+
}
|
|
34
|
+
export interface EntityGroupRecord {
|
|
35
|
+
primary: Entity;
|
|
36
|
+
auxiliary: Entity[];
|
|
37
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { Cartesian3, Entity } from '../../../../../node_modules/cesium';
|
|
2
|
+
import { I18nLike } from '../../../../i18n';
|
|
3
|
+
import * as Cesium from 'cesium';
|
|
4
|
+
export type DrawMode = 'point' | 'line' | 'polygon' | 'rectangle' | 'circle' | null;
|
|
5
|
+
export interface MeasurementLabelOffset {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
}
|
|
9
|
+
export interface MeasurementSummaryLabelStyle {
|
|
10
|
+
font?: string;
|
|
11
|
+
textColor?: Cesium.Color | string;
|
|
12
|
+
backgroundColor?: Cesium.Color | string;
|
|
13
|
+
borderRadius?: number;
|
|
14
|
+
pixelOffset?: Cesium.Cartesian2 | MeasurementLabelOffset;
|
|
15
|
+
}
|
|
16
|
+
export interface MeasurementVertexStyle {
|
|
17
|
+
pixelSize?: number;
|
|
18
|
+
color?: Cesium.Color | string;
|
|
19
|
+
outlineColor?: Cesium.Color | string;
|
|
20
|
+
outlineWidth?: number;
|
|
21
|
+
}
|
|
22
|
+
export interface MeasurementStrokeStyle {
|
|
23
|
+
color?: Cesium.Color | string;
|
|
24
|
+
width?: number;
|
|
25
|
+
clampToGround?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface MeasurementFillStyle {
|
|
28
|
+
color?: Cesium.Color | string;
|
|
29
|
+
}
|
|
30
|
+
export interface MeasurementTheme {
|
|
31
|
+
stroke?: MeasurementStrokeStyle;
|
|
32
|
+
fill?: MeasurementFillStyle;
|
|
33
|
+
vertex?: MeasurementVertexStyle;
|
|
34
|
+
segmentDistanceLabel?: MeasurementSummaryLabelStyle;
|
|
35
|
+
totalDistanceLabel?: MeasurementSummaryLabelStyle;
|
|
36
|
+
previewAreaLabel?: MeasurementSummaryLabelStyle;
|
|
37
|
+
totalAreaLabel?: MeasurementSummaryLabelStyle;
|
|
38
|
+
hintBubble?: MeasurementSummaryLabelStyle;
|
|
39
|
+
}
|
|
40
|
+
export interface DrawOptions {
|
|
41
|
+
mode?: DrawMode;
|
|
42
|
+
measurementTheme?: MeasurementTheme;
|
|
43
|
+
lineColor?: Cesium.Color | string;
|
|
44
|
+
lineWidth?: number;
|
|
45
|
+
fillColor?: Cesium.Color | string;
|
|
46
|
+
clampToGround?: boolean;
|
|
47
|
+
segmentDistanceLabelStyle?: MeasurementSummaryLabelStyle;
|
|
48
|
+
totalDistanceLabelStyle?: MeasurementSummaryLabelStyle;
|
|
49
|
+
previewAreaLabelStyle?: MeasurementSummaryLabelStyle;
|
|
50
|
+
totalAreaLabelStyle?: MeasurementSummaryLabelStyle;
|
|
51
|
+
hintBubbleStyle?: MeasurementSummaryLabelStyle;
|
|
52
|
+
onClick?: (entity: Entity, positions?: Cartesian3[]) => void;
|
|
53
|
+
}
|
|
54
|
+
export interface DrawServiceOptions {
|
|
55
|
+
i18n?: I18nLike;
|
|
56
|
+
useI18n?: boolean;
|
|
57
|
+
}
|
|
58
|
+
export interface DrawResult {
|
|
59
|
+
entity: Entity;
|
|
60
|
+
positions: Cartesian3[];
|
|
61
|
+
}
|
|
62
|
+
export interface DrawArtifacts {
|
|
63
|
+
primary: Entity;
|
|
64
|
+
auxiliary: Entity[];
|
|
65
|
+
}
|
|
66
|
+
export type MeasurementLabelKind = 'segmentDistanceLabel' | 'totalDistanceLabel' | 'previewAreaLabel' | 'totalAreaLabel' | 'hintBubble';
|
|
67
|
+
export interface ResolvedMeasurementLabelStyle {
|
|
68
|
+
font: string;
|
|
69
|
+
textColor: Cesium.Color;
|
|
70
|
+
backgroundColor: Cesium.Color;
|
|
71
|
+
borderRadius: number;
|
|
72
|
+
pixelOffset: Cesium.Cartesian2;
|
|
73
|
+
}
|
|
74
|
+
export interface ResolvedMeasurementVertexStyle {
|
|
75
|
+
pixelSize: number;
|
|
76
|
+
color: Cesium.Color;
|
|
77
|
+
outlineColor: Cesium.Color;
|
|
78
|
+
outlineWidth: number;
|
|
79
|
+
}
|
|
80
|
+
export interface ResolvedMeasurementStrokeStyle {
|
|
81
|
+
color: Cesium.Color;
|
|
82
|
+
width: number;
|
|
83
|
+
clampToGround: boolean;
|
|
84
|
+
}
|
|
85
|
+
export interface ResolvedMeasurementFillStyle {
|
|
86
|
+
color: Cesium.Color;
|
|
87
|
+
}
|
|
88
|
+
export interface ResolvedMeasurementTheme {
|
|
89
|
+
stroke: ResolvedMeasurementStrokeStyle;
|
|
90
|
+
fill: ResolvedMeasurementFillStyle;
|
|
91
|
+
vertex: ResolvedMeasurementVertexStyle;
|
|
92
|
+
segmentDistanceLabel: ResolvedMeasurementLabelStyle;
|
|
93
|
+
totalDistanceLabel: ResolvedMeasurementLabelStyle;
|
|
94
|
+
previewAreaLabel: ResolvedMeasurementLabelStyle;
|
|
95
|
+
totalAreaLabel: ResolvedMeasurementLabelStyle;
|
|
96
|
+
hintBubble: ResolvedMeasurementLabelStyle;
|
|
97
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 服务模块入口
|
|
3
|
+
*
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
*/
|
|
6
|
+
export { OverlayService } from './overlay/OverlayService';
|
|
7
|
+
export type { OverlayServiceOptions } from './overlay/OverlayService';
|
|
8
|
+
export { DrawService } from './draw';
|
|
9
|
+
export type { DrawMode, DrawOptions, DrawResult, DrawServiceOptions, MeasurementFillStyle, MeasurementLabelOffset, MeasurementStrokeStyle, MeasurementSummaryLabelStyle, MeasurementTheme, MeasurementVertexStyle } from './draw';
|
|
10
|
+
export * from './toolbar/index';
|