@xingm/vmap-cesium-toolbar 0.0.4-alpha.2 → 0.0.5
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 +1 -1
- package/dist/index.es.js +687 -511
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +9 -9
- package/dist/index.umd.js.map +1 -1
- package/dist/libs/CesiumMapModel.d.ts +3 -3
- package/dist/libs/overlay/OverlayEditController.d.ts +42 -1
- package/dist/libs/overlay/OverlayEditHandles.d.ts +43 -5
- package/dist/libs/toolBar/MapLayersService.d.ts +1 -1
- package/dist/package.json +1 -1
- package/package.json +1 -1
|
@@ -80,11 +80,11 @@ export interface MapType {
|
|
|
80
80
|
id: string;
|
|
81
81
|
name: string;
|
|
82
82
|
nameKey?: string;
|
|
83
|
-
/**
|
|
83
|
+
/** 选中态左上角“路网”文案(可选,未配置时走 i18n 默认 key) */
|
|
84
84
|
placeNameLabel?: string;
|
|
85
|
-
/**
|
|
85
|
+
/** 选中态左上角“路网”文案 i18n key(可选) */
|
|
86
86
|
placeNameLabelKey?: string;
|
|
87
|
-
/**
|
|
87
|
+
/** 是否强制始终显示路网层(不受 placeName 开关影响) */
|
|
88
88
|
forcePlaceName?: boolean;
|
|
89
89
|
thumbnail: string;
|
|
90
90
|
provider: (token: string) => Cesium.ImageryProvider[];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Viewer } from '../../../node_modules/cesium';
|
|
2
2
|
import { DrawEntity } from '../drawHelper';
|
|
3
3
|
import { OverlayEntity } from './types';
|
|
4
|
+
import { OverlayEditOptions } from './OverlayEditHandles';
|
|
4
5
|
import * as Cesium from "cesium";
|
|
5
6
|
export type OverlayEditChangeCallback = (entity: DrawEntity & OverlayEntity) => void;
|
|
6
7
|
export interface OverlayEditControllerOptions {
|
|
@@ -9,6 +10,8 @@ export interface OverlayEditControllerOptions {
|
|
|
9
10
|
* 回调参数为“已回写后的覆盖物 entity”。
|
|
10
11
|
*/
|
|
11
12
|
onChange?: OverlayEditChangeCallback;
|
|
13
|
+
/** 编辑功能配置项,默认为全开(除 rotate) */
|
|
14
|
+
editCapabilities?: OverlayEditOptions;
|
|
12
15
|
}
|
|
13
16
|
export interface OverlayEditHost {
|
|
14
17
|
getViewer(): Viewer;
|
|
@@ -27,6 +30,10 @@ export interface OverlayEditHost {
|
|
|
27
30
|
applyPolylinePositions(entity: DrawEntity & OverlayEntity, positions: Cesium.Cartesian3[]): void;
|
|
28
31
|
applyPointPosition(entity: DrawEntity & OverlayEntity, position: Cesium.Cartesian3): void;
|
|
29
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* 覆盖物编辑控制器类,用于管理地图上覆盖物的编辑操作
|
|
35
|
+
* 支持多边形、矩形、圆形、折线和点等类型的编辑
|
|
36
|
+
*/
|
|
30
37
|
export declare class OverlayEditController {
|
|
31
38
|
private readonly host;
|
|
32
39
|
private enabled;
|
|
@@ -35,6 +42,7 @@ export declare class OverlayEditController {
|
|
|
35
42
|
private onChange;
|
|
36
43
|
private editingTarget;
|
|
37
44
|
private editingKind;
|
|
45
|
+
private editingOptions;
|
|
38
46
|
private editingPositions;
|
|
39
47
|
private editingCircleCenter;
|
|
40
48
|
private editingCircleRadiusMeters;
|
|
@@ -50,11 +58,35 @@ export declare class OverlayEditController {
|
|
|
50
58
|
private rotateStartAngle;
|
|
51
59
|
private scaleStartDistance;
|
|
52
60
|
private cameraBackup;
|
|
61
|
+
/**
|
|
62
|
+
* 构造函数
|
|
63
|
+
* @param host 覆盖物编辑宿主对象
|
|
64
|
+
* @param options 配置选项
|
|
65
|
+
*/
|
|
53
66
|
constructor(host: OverlayEditHost, options?: OverlayEditControllerOptions);
|
|
67
|
+
/**
|
|
68
|
+
* 设置编辑变化回调函数
|
|
69
|
+
* @param cb 回调函数
|
|
70
|
+
*/
|
|
54
71
|
setOnChange(cb?: OverlayEditChangeCallback | null): void;
|
|
72
|
+
/**
|
|
73
|
+
* 设置编辑器启用状态
|
|
74
|
+
* @param enabled 是否启用
|
|
75
|
+
*/
|
|
55
76
|
setEnabled(enabled: boolean): void;
|
|
77
|
+
/**
|
|
78
|
+
* 获取编辑器启用状态
|
|
79
|
+
* @returns 是否启用
|
|
80
|
+
*/
|
|
56
81
|
getEnabled(): boolean;
|
|
82
|
+
/**
|
|
83
|
+
* 判断是否正在编辑
|
|
84
|
+
* @returns 是否正在编辑
|
|
85
|
+
*/
|
|
57
86
|
isEditing(): boolean;
|
|
87
|
+
/**
|
|
88
|
+
* 销毁编辑器
|
|
89
|
+
*/
|
|
58
90
|
destroy(): void;
|
|
59
91
|
/** 停止当前正在编辑的覆盖物(不会关闭全局编辑模式) */
|
|
60
92
|
stop(): void;
|
|
@@ -62,7 +94,12 @@ export declare class OverlayEditController {
|
|
|
62
94
|
* 主动开始编辑某个覆盖物。
|
|
63
95
|
* @returns true 表示成功进入编辑
|
|
64
96
|
*/
|
|
65
|
-
start(entityOrId: (DrawEntity & OverlayEntity) | string): boolean;
|
|
97
|
+
start(entityOrId: (DrawEntity & OverlayEntity) | string, options?: OverlayEditOptions): boolean;
|
|
98
|
+
/**
|
|
99
|
+
* 解析编辑目标实体,根据特定条件返回合适的实体对象
|
|
100
|
+
* @param entity 输入的实体对象,需要同时满足DrawEntity和OverlayEntity类型
|
|
101
|
+
* @returns 返回解析后的实体对象,可能是原始实体或符合条件的其他实体
|
|
102
|
+
*/
|
|
66
103
|
private resolveEditTarget;
|
|
67
104
|
private detectEditableKind;
|
|
68
105
|
private getPropertyValue;
|
|
@@ -96,6 +133,10 @@ export declare class OverlayEditController {
|
|
|
96
133
|
private lockCameraController;
|
|
97
134
|
private restoreCameraController;
|
|
98
135
|
private clearHandles;
|
|
136
|
+
/**
|
|
137
|
+
* 重建处理句柄的方法
|
|
138
|
+
* 根据当前编辑的几何图形类型,调用相应的构建函数创建处理句柄
|
|
139
|
+
*/
|
|
99
140
|
private rebuildHandles;
|
|
100
141
|
private getHandleHelpers;
|
|
101
142
|
private createHandle;
|
|
@@ -11,6 +11,44 @@ export type HandleStyle = {
|
|
|
11
11
|
* 创建编辑句柄实体
|
|
12
12
|
*/
|
|
13
13
|
export type CreateHandle = (position: Cesium.Cartesian3, style: HandleStyle, meta: any) => Cesium.Entity;
|
|
14
|
+
export interface OverlayEditOptions {
|
|
15
|
+
vertex: {
|
|
16
|
+
enable?: boolean;
|
|
17
|
+
color?: Cesium.Color;
|
|
18
|
+
outlineColor?: Cesium.Color;
|
|
19
|
+
outlineWidth?: number;
|
|
20
|
+
pixelSize?: number;
|
|
21
|
+
} | boolean;
|
|
22
|
+
mid: {
|
|
23
|
+
enable?: boolean;
|
|
24
|
+
color?: Cesium.Color;
|
|
25
|
+
outlineColor?: Cesium.Color;
|
|
26
|
+
outlineWidth?: number;
|
|
27
|
+
pixelSize?: number;
|
|
28
|
+
} | boolean;
|
|
29
|
+
move: {
|
|
30
|
+
enable?: boolean;
|
|
31
|
+
color?: Cesium.Color;
|
|
32
|
+
outlineColor?: Cesium.Color;
|
|
33
|
+
outlineWidth?: number;
|
|
34
|
+
pixelSize?: number;
|
|
35
|
+
} | boolean;
|
|
36
|
+
rotate: {
|
|
37
|
+
enable?: boolean;
|
|
38
|
+
color?: Cesium.Color;
|
|
39
|
+
outlineColor?: Cesium.Color;
|
|
40
|
+
outlineWidth?: number;
|
|
41
|
+
pixelSize?: number;
|
|
42
|
+
} | boolean;
|
|
43
|
+
scale: {
|
|
44
|
+
enable?: boolean;
|
|
45
|
+
color?: Cesium.Color;
|
|
46
|
+
outlineColor?: Cesium.Color;
|
|
47
|
+
outlineWidth?: number;
|
|
48
|
+
pixelSize?: number;
|
|
49
|
+
} | boolean;
|
|
50
|
+
}
|
|
51
|
+
export declare const DEFAULT_OPTIONS: OverlayEditOptions;
|
|
14
52
|
/**
|
|
15
53
|
* 构建/更新句柄所需的依赖函数集合
|
|
16
54
|
*/
|
|
@@ -24,23 +62,23 @@ export interface HandleHelpers {
|
|
|
24
62
|
/**
|
|
25
63
|
* 构建多边形编辑句柄(顶点/中点/整体移动)
|
|
26
64
|
*/
|
|
27
|
-
export declare function buildPolygonHandles(verts: Cesium.Cartesian3[], helpers: HandleHelpers): Cesium.Entity[];
|
|
65
|
+
export declare function buildPolygonHandles(verts: Cesium.Cartesian3[], helpers: HandleHelpers, options: OverlayEditOptions): Cesium.Entity[];
|
|
28
66
|
/**
|
|
29
67
|
* 构建矩形编辑句柄(顶点/边中点/整体移动)
|
|
30
68
|
*/
|
|
31
|
-
export declare function buildRectangleHandles(verts: Cesium.Cartesian3[], helpers: HandleHelpers): Cesium.Entity[];
|
|
69
|
+
export declare function buildRectangleHandles(verts: Cesium.Cartesian3[], helpers: HandleHelpers, options: OverlayEditOptions): Cesium.Entity[];
|
|
32
70
|
/**
|
|
33
71
|
* 构建折线编辑句柄(顶点/中点/整体移动/旋转/缩放)
|
|
34
72
|
*/
|
|
35
|
-
export declare function buildPolylineHandles(verts: Cesium.Cartesian3[], helpers: HandleHelpers): Cesium.Entity[];
|
|
73
|
+
export declare function buildPolylineHandles(verts: Cesium.Cartesian3[], helpers: HandleHelpers, options: OverlayEditOptions): Cesium.Entity[];
|
|
36
74
|
/**
|
|
37
75
|
* 构建点编辑句柄
|
|
38
76
|
*/
|
|
39
|
-
export declare function buildPointHandles(pos: Cesium.Cartesian3 | null, helpers: HandleHelpers): Cesium.Entity[];
|
|
77
|
+
export declare function buildPointHandles(pos: Cesium.Cartesian3 | null, helpers: HandleHelpers, options: OverlayEditOptions): Cesium.Entity[];
|
|
40
78
|
/**
|
|
41
79
|
* 构建圆形编辑句柄(圆心/半径)
|
|
42
80
|
*/
|
|
43
|
-
export declare function buildCircleHandles(center: Cesium.Cartesian3 | null, radiusMeters: number, helpers: HandleHelpers): Cesium.Entity[];
|
|
81
|
+
export declare function buildCircleHandles(center: Cesium.Cartesian3 | null, radiusMeters: number, helpers: HandleHelpers, options: OverlayEditOptions): Cesium.Entity[];
|
|
44
82
|
/**
|
|
45
83
|
* 更新多边形句柄位置
|
|
46
84
|
* @returns false 表示句柄数量不匹配,需重建
|
|
@@ -35,7 +35,7 @@ export declare class MapLayersService {
|
|
|
35
35
|
private useI18n;
|
|
36
36
|
constructor(viewer: Viewer, toolbarElement: HTMLElement, config: MapLayersServiceConfig);
|
|
37
37
|
/**
|
|
38
|
-
* 初始化当前地图上下文:用于“初始底图不是通过 switchMapType
|
|
38
|
+
* 初始化当前地图上下文:用于“初始底图不是通过 switchMapType 加载”时的路网层识别。
|
|
39
39
|
*/
|
|
40
40
|
private bootstrapCurrentMapContext;
|
|
41
41
|
/**
|
package/dist/package.json
CHANGED
package/package.json
CHANGED