@xingm/vmap-cesium-toolbar 0.0.1 → 0.0.2-alpha.10
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/dist/hooks/toolBarConfig.d.ts +6 -3
- package/dist/hooks/useDrawHelper.d.ts +65 -0
- package/dist/hooks/useHeatmapHelper.d.ts +34 -0
- package/dist/hooks/useOverlayHelper.d.ts +212 -0
- package/dist/index.d.ts +664 -36
- package/dist/index.js +5078 -1840
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +215 -128
- package/dist/index.umd.js.map +1 -1
- package/dist/libs/CesiumHeatmapLayer.d.ts +109 -0
- package/dist/libs/{CesiumMapHelper.d.ts → CesiumMapDraw.d.ts} +34 -51
- package/dist/libs/CesiumMapLoader.d.ts +11 -2
- package/dist/libs/CesiumMapModel.d.ts +5 -2
- package/dist/libs/CesiumMapToolbar.d.ts +23 -67
- package/dist/libs/CesiumOverlayService.d.ts +117 -0
- package/dist/libs/{CesiumMapConfig.d.ts → config/CesiumMapConfig.d.ts} +3 -3
- package/dist/libs/drawHelper/BaseDraw.d.ts +170 -0
- package/dist/libs/drawHelper/DrawCircle.d.ts +30 -0
- package/dist/libs/drawHelper/DrawLine.d.ts +44 -0
- package/dist/libs/drawHelper/DrawPolgon.d.ts +29 -0
- package/dist/libs/drawHelper/DrawRectangle.d.ts +24 -0
- package/dist/libs/drawHelper/index.d.ts +5 -0
- package/dist/libs/overlay/MapCircle.d.ts +64 -0
- package/dist/libs/overlay/MapIcon.d.ts +59 -0
- package/dist/libs/overlay/MapInfoWindow.d.ts +100 -0
- package/dist/libs/overlay/MapLabel.d.ts +63 -0
- package/dist/libs/overlay/MapMarker.d.ts +50 -0
- package/dist/libs/overlay/MapPolygon.d.ts +70 -0
- package/dist/libs/overlay/MapPolyline.d.ts +50 -0
- package/dist/libs/overlay/MapRectangle.d.ts +56 -0
- package/dist/libs/overlay/MapRing.d.ts +95 -0
- package/dist/libs/overlay/MapSVG.d.ts +63 -0
- package/dist/libs/overlay/index.d.ts +22 -0
- package/dist/libs/overlay/types.d.ts +41 -0
- package/dist/libs/toolBar/CesiumMapController.d.ts +78 -0
- package/dist/libs/toolBar/MapLayersService.d.ts +67 -0
- package/dist/libs/toolBar/MapSearchService.d.ts +41 -0
- package/dist/libs/toolBar/MapToolBarConfig.d.ts +3 -0
- package/dist/libs/toolBar/MeasurementService.d.ts +16 -0
- package/dist/libs/toolBar/NotFlyZonesService.d.ts +46 -0
- package/dist/package.json +5 -5
- package/dist/utils/calc.d.ts +44 -0
- package/dist/utils/common.d.ts +1 -0
- package/dist/z.const.d.ts +24 -0
- package/package.json +7 -7
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Viewer, Entity, Color, HeightReference } from '../../../node_modules/cesium';
|
|
2
|
+
import { OverlayPosition } from './types';
|
|
3
|
+
import * as Cesium from "cesium";
|
|
4
|
+
/**
|
|
5
|
+
* Polygon 选项
|
|
6
|
+
*/
|
|
7
|
+
export interface PolygonOptions {
|
|
8
|
+
positions: OverlayPosition[];
|
|
9
|
+
material?: Cesium.MaterialProperty | Color | string;
|
|
10
|
+
outline?: boolean;
|
|
11
|
+
outlineColor?: Color | string;
|
|
12
|
+
outlineWidth?: number;
|
|
13
|
+
heightReference?: HeightReference;
|
|
14
|
+
extrudedHeight?: number;
|
|
15
|
+
onClick?: (entity: Entity) => void;
|
|
16
|
+
id?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Polygon 工具类
|
|
20
|
+
*/
|
|
21
|
+
export declare class MapPolygon {
|
|
22
|
+
private viewer;
|
|
23
|
+
private entities;
|
|
24
|
+
constructor(viewer: Viewer);
|
|
25
|
+
/**
|
|
26
|
+
* 转换位置为 Cartesian3
|
|
27
|
+
*/
|
|
28
|
+
private convertPosition;
|
|
29
|
+
/**
|
|
30
|
+
* 转换颜色
|
|
31
|
+
*/
|
|
32
|
+
private resolveColor;
|
|
33
|
+
/**
|
|
34
|
+
* 解析材质
|
|
35
|
+
*/
|
|
36
|
+
private resolveMaterial;
|
|
37
|
+
/**
|
|
38
|
+
* 计算二维多边形方向(正值为 CCW)
|
|
39
|
+
*/
|
|
40
|
+
private polygonArea2D;
|
|
41
|
+
/**
|
|
42
|
+
* 向内偏移二维多边形顶点(线偏移 + 邻边相交)。厚度单位:米。
|
|
43
|
+
* 对复杂凹形可能產生伪影,更适合凸多边形或温和凹形。
|
|
44
|
+
*/
|
|
45
|
+
private offsetPolygon2DInward;
|
|
46
|
+
/**
|
|
47
|
+
* 计算内偏移后的 3D 顶点:使用切平面近似进行 2D 偏移再投回椭球,并统一高度。
|
|
48
|
+
*/
|
|
49
|
+
private computeInnerOffsetPositions;
|
|
50
|
+
/**
|
|
51
|
+
* 为多边形顶点统一高度(含微小抬升)
|
|
52
|
+
*/
|
|
53
|
+
private elevatePositions;
|
|
54
|
+
/**
|
|
55
|
+
* 添加 Polygon(多边形)
|
|
56
|
+
*/
|
|
57
|
+
add(options: PolygonOptions): Entity;
|
|
58
|
+
/**
|
|
59
|
+
* 更新 Polygon 位置
|
|
60
|
+
*/
|
|
61
|
+
updatePositions(entity: Entity, positions: OverlayPosition[]): void;
|
|
62
|
+
/**
|
|
63
|
+
* 更新 Polygon 样式
|
|
64
|
+
*/
|
|
65
|
+
updateStyle(entity: Entity, options: Partial<Pick<PolygonOptions, 'material' | 'outline' | 'outlineColor' | 'outlineWidth'>>): void;
|
|
66
|
+
/**
|
|
67
|
+
* 移除 Polygon(通过实体或实体 id)
|
|
68
|
+
*/
|
|
69
|
+
remove(entityOrId: Entity | string): boolean;
|
|
70
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
onClick?: (entity: Entity) => void;
|
|
13
|
+
id?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Polyline 工具类
|
|
17
|
+
*/
|
|
18
|
+
export declare class MapPolyline {
|
|
19
|
+
private viewer;
|
|
20
|
+
private entities;
|
|
21
|
+
constructor(viewer: Viewer);
|
|
22
|
+
/**
|
|
23
|
+
* 转换位置为 Cartesian3
|
|
24
|
+
*/
|
|
25
|
+
private convertPosition;
|
|
26
|
+
/**
|
|
27
|
+
* 转换颜色
|
|
28
|
+
*/
|
|
29
|
+
private resolveColor;
|
|
30
|
+
/**
|
|
31
|
+
* 解析材质
|
|
32
|
+
*/
|
|
33
|
+
private resolveMaterial;
|
|
34
|
+
/**
|
|
35
|
+
* 添加 Polyline(折线)
|
|
36
|
+
*/
|
|
37
|
+
add(options: PolylineOptions): Entity;
|
|
38
|
+
/**
|
|
39
|
+
* 更新 Polyline 位置
|
|
40
|
+
*/
|
|
41
|
+
updatePositions(entity: Entity, positions: OverlayPosition[]): void;
|
|
42
|
+
/**
|
|
43
|
+
* 更新 Polyline 样式
|
|
44
|
+
*/
|
|
45
|
+
updateStyle(entity: Entity, options: Partial<Pick<PolylineOptions, 'width' | 'material'>>): void;
|
|
46
|
+
/**
|
|
47
|
+
* 移除 Polyline(通过实体或实体 id)
|
|
48
|
+
*/
|
|
49
|
+
remove(entityOrId: Entity | string): boolean;
|
|
50
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Viewer, Entity, Color, HeightReference } from '../../../node_modules/cesium';
|
|
2
|
+
import * as Cesium from "cesium";
|
|
3
|
+
/**
|
|
4
|
+
* Rectangle 选项
|
|
5
|
+
*/
|
|
6
|
+
export interface RectangleOptions {
|
|
7
|
+
coordinates: Cesium.Rectangle;
|
|
8
|
+
material?: Cesium.MaterialProperty | Color | string;
|
|
9
|
+
outline?: boolean;
|
|
10
|
+
outlineColor?: Color | string;
|
|
11
|
+
outlineWidth?: number;
|
|
12
|
+
heightReference?: HeightReference;
|
|
13
|
+
extrudedHeight?: number;
|
|
14
|
+
onClick?: (entity: Entity) => void;
|
|
15
|
+
id?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Rectangle 工具类
|
|
19
|
+
*/
|
|
20
|
+
export declare class MapRectangle {
|
|
21
|
+
private viewer;
|
|
22
|
+
private entities;
|
|
23
|
+
constructor(viewer: Viewer);
|
|
24
|
+
/**
|
|
25
|
+
* 转换颜色
|
|
26
|
+
*/
|
|
27
|
+
private resolveColor;
|
|
28
|
+
/**
|
|
29
|
+
* 解析材质
|
|
30
|
+
*/
|
|
31
|
+
private resolveMaterial;
|
|
32
|
+
/**
|
|
33
|
+
* 将 Rectangle 转为四点多边形顶点(按西南→东南→东北→西北顺序)
|
|
34
|
+
*/
|
|
35
|
+
private rectangleToPositions;
|
|
36
|
+
/**
|
|
37
|
+
* 按米单位向内收缩矩形边界,返回新的 Rectangle
|
|
38
|
+
*/
|
|
39
|
+
private shrinkRectangle;
|
|
40
|
+
/**
|
|
41
|
+
* 添加 Rectangle(矩形)
|
|
42
|
+
*/
|
|
43
|
+
add(options: RectangleOptions): Entity;
|
|
44
|
+
/**
|
|
45
|
+
* 更新 Rectangle 坐标
|
|
46
|
+
*/
|
|
47
|
+
updateCoordinates(entity: Entity, coordinates: Cesium.Rectangle): void;
|
|
48
|
+
/**
|
|
49
|
+
* 更新 Rectangle 样式
|
|
50
|
+
*/
|
|
51
|
+
updateStyle(entity: Entity, options: Partial<Pick<RectangleOptions, 'material' | 'outline' | 'outlineColor' | 'outlineWidth'>>): void;
|
|
52
|
+
/**
|
|
53
|
+
* 移除 Rectangle(通过实体或实体 id)
|
|
54
|
+
*/
|
|
55
|
+
remove(entityOrId: Entity | string): boolean;
|
|
56
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
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
|
+
/** 圆环分段数(默认 128),越大越圆滑 */
|
|
40
|
+
segments?: number;
|
|
41
|
+
/** 覆盖物点击回调 */
|
|
42
|
+
onClick?: (entity: Entity) => void;
|
|
43
|
+
id?: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Ring 工具类:使用 polyline + PolylineGlowMaterialProperty 实现发光圆环
|
|
47
|
+
*/
|
|
48
|
+
export declare class MapRing {
|
|
49
|
+
private viewer;
|
|
50
|
+
private entities;
|
|
51
|
+
constructor(viewer: Viewer);
|
|
52
|
+
/**
|
|
53
|
+
* 转换位置为 Cartesian3
|
|
54
|
+
*/
|
|
55
|
+
private convertPosition;
|
|
56
|
+
/**
|
|
57
|
+
* 转换颜色
|
|
58
|
+
*/
|
|
59
|
+
private resolveColor;
|
|
60
|
+
private resolveLineMaterial;
|
|
61
|
+
private resolveGlowMaterial;
|
|
62
|
+
private getInnerWidth;
|
|
63
|
+
private addInnerEntity;
|
|
64
|
+
private removeInnerEntity;
|
|
65
|
+
private rebuildRingPositions;
|
|
66
|
+
/**
|
|
67
|
+
* 生成近似圆顶点(Cartesian3 数组)。segments 越大越平滑。
|
|
68
|
+
* 这里沿用 MapCircle 的大圆航线近似,保证在经纬度空间更稳定。
|
|
69
|
+
*/
|
|
70
|
+
private generateCirclePositions;
|
|
71
|
+
/**
|
|
72
|
+
* 添加 Ring(边缘发光圆环)
|
|
73
|
+
*/
|
|
74
|
+
add(options: RingOptions): Entity;
|
|
75
|
+
/**
|
|
76
|
+
* 更新 Ring 中心
|
|
77
|
+
*/
|
|
78
|
+
updatePosition(entity: Entity, position: OverlayPosition): void;
|
|
79
|
+
/**
|
|
80
|
+
* 更新 Ring 半径
|
|
81
|
+
*/
|
|
82
|
+
updateRadius(entity: Entity, radius: number): void;
|
|
83
|
+
/**
|
|
84
|
+
* 更新 Ring 样式
|
|
85
|
+
*/
|
|
86
|
+
updateStyle(entity: Entity, options: Partial<Pick<RingOptions, "color" | "showInnerLine" | "lineColor" | "lineStyle" | "lineMaterialMode" | "stripeRepeat" | "dashLength" | "dashPattern" | "gapColor" | "width" | "glowWidth" | "lineWidth" | "glowPower" | "clampToGround" | "segments">>): void;
|
|
87
|
+
/**
|
|
88
|
+
* 显示/隐藏 Ring
|
|
89
|
+
*/
|
|
90
|
+
setVisible(entity: Entity, visible: boolean): void;
|
|
91
|
+
/**
|
|
92
|
+
* 移除 Ring(通过实体或实体 id)
|
|
93
|
+
*/
|
|
94
|
+
remove(entityOrId: Entity | string): boolean;
|
|
95
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
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
|
+
onClick?: (entity: Entity) => void;
|
|
22
|
+
id?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* SVG 工具类
|
|
26
|
+
*/
|
|
27
|
+
export declare class MapSVG {
|
|
28
|
+
private viewer;
|
|
29
|
+
private entities;
|
|
30
|
+
constructor(viewer: Viewer);
|
|
31
|
+
/**
|
|
32
|
+
* 转换位置为 Cartesian3
|
|
33
|
+
*/
|
|
34
|
+
private convertPosition;
|
|
35
|
+
/**
|
|
36
|
+
* 转换颜色
|
|
37
|
+
*/
|
|
38
|
+
private resolveColor;
|
|
39
|
+
/**
|
|
40
|
+
* 将 SVG 字符串转换为 data URL
|
|
41
|
+
*/
|
|
42
|
+
private svgToDataUrl;
|
|
43
|
+
/**
|
|
44
|
+
* 添加 SVG(使用 Billboard)
|
|
45
|
+
*/
|
|
46
|
+
add(options: SvgOptions): Entity;
|
|
47
|
+
/**
|
|
48
|
+
* 更新 SVG 位置
|
|
49
|
+
*/
|
|
50
|
+
updatePosition(entity: Entity, position: OverlayPosition): void;
|
|
51
|
+
/**
|
|
52
|
+
* 更新 SVG 内容
|
|
53
|
+
*/
|
|
54
|
+
updateSvg(entity: Entity, svg: string): void;
|
|
55
|
+
/**
|
|
56
|
+
* 更新 SVG 样式
|
|
57
|
+
*/
|
|
58
|
+
updateStyle(entity: Entity, options: Partial<Pick<SvgOptions, 'scale' | 'rotation' | 'color'>>): void;
|
|
59
|
+
/**
|
|
60
|
+
* 移除 SVG(通过实体或实体 id)
|
|
61
|
+
*/
|
|
62
|
+
remove(entityOrId: Entity | string): boolean;
|
|
63
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export { CesiumOverlayService } from '../CesiumOverlayService';
|
|
2
|
+
export { MapMarker } from './MapMarker';
|
|
3
|
+
export { MapLabel } from './MapLabel';
|
|
4
|
+
export { MapIcon } from './MapIcon';
|
|
5
|
+
export { MapSVG } from './MapSVG';
|
|
6
|
+
export { MapInfoWindow } from './MapInfoWindow';
|
|
7
|
+
export { MapPolyline } from './MapPolyline';
|
|
8
|
+
export { MapPolygon } from './MapPolygon';
|
|
9
|
+
export { MapRectangle } from './MapRectangle';
|
|
10
|
+
export { MapCircle } from './MapCircle';
|
|
11
|
+
export { MapRing } from './MapRing';
|
|
12
|
+
export type { OverlayPosition } from './types';
|
|
13
|
+
export type { MarkerOptions } from './MapMarker';
|
|
14
|
+
export type { LabelOptions } from './MapLabel';
|
|
15
|
+
export type { IconOptions } from './MapIcon';
|
|
16
|
+
export type { SvgOptions } from './MapSVG';
|
|
17
|
+
export type { InfoWindowOptions } from './MapInfoWindow';
|
|
18
|
+
export type { PolylineOptions } from './MapPolyline';
|
|
19
|
+
export type { PolygonOptions } from './MapPolygon';
|
|
20
|
+
export type { RectangleOptions } from './MapRectangle';
|
|
21
|
+
export type { CircleOptions } from './MapCircle';
|
|
22
|
+
export type { RingOptions } from './MapRing';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Cartesian3, Entity, Color, MaterialProperty, Rectangle, Cartographic } from '../../../node_modules/cesium';
|
|
2
|
+
/**
|
|
3
|
+
* 覆盖物位置类型
|
|
4
|
+
*/
|
|
5
|
+
export type OverlayPosition = Cartesian3 | [number, number] | [number, number, number];
|
|
6
|
+
/**
|
|
7
|
+
* 覆盖物扩展实体类型
|
|
8
|
+
* 用于在 Cesium.Entity 上挂载覆盖物相关的元数据
|
|
9
|
+
*/
|
|
10
|
+
export interface OverlayEntity extends Entity {
|
|
11
|
+
/** 覆盖物点击回调(由各 Map* 工具类设置) */
|
|
12
|
+
_onClick?: (entity: Entity) => void;
|
|
13
|
+
/** 覆盖物类型标识(用于 CesiumOverlayService 做差异化更新/删除) */
|
|
14
|
+
_overlayType?: string;
|
|
15
|
+
/** 信息窗口根 DOM(由 MapInfoWindow / CesiumOverlayService 使用) */
|
|
16
|
+
_infoWindow?: HTMLElement;
|
|
17
|
+
/** 复合图形的内层实体或边框实体等关联引用 */
|
|
18
|
+
_borderEntity?: Entity;
|
|
19
|
+
_innerEntity?: Entity;
|
|
20
|
+
/** 粗边框 / 环形等形状相关元数据 */
|
|
21
|
+
_isThickOutline?: boolean;
|
|
22
|
+
_outlineWidth?: number;
|
|
23
|
+
_isRing?: boolean;
|
|
24
|
+
_ringThickness?: number;
|
|
25
|
+
_ringSegments?: number;
|
|
26
|
+
_ringGlowPower?: number;
|
|
27
|
+
_ringLineColor?: Color | string;
|
|
28
|
+
_ringLineStyle?: 'solid' | 'dashed';
|
|
29
|
+
_ringLineMaterialMode?: 'stripe' | 'dash';
|
|
30
|
+
_ringStripeRepeat?: number;
|
|
31
|
+
_ringDashLength?: number;
|
|
32
|
+
_ringDashPattern?: number;
|
|
33
|
+
_ringGapColor?: Color | string;
|
|
34
|
+
_ringShowInnerLine?: boolean;
|
|
35
|
+
_fillMaterial?: MaterialProperty | Color | string;
|
|
36
|
+
_ringHeightEpsilon?: number;
|
|
37
|
+
_centerCartographic?: Cartographic;
|
|
38
|
+
_outerRadius?: number;
|
|
39
|
+
_innerRadius?: number;
|
|
40
|
+
_outerRectangle?: Rectangle;
|
|
41
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { Viewer } from '../../../node_modules/cesium';
|
|
2
|
+
import { MapType, ZoomCallback } from '../CesiumMapModel';
|
|
3
|
+
interface MapInitialCenter {
|
|
4
|
+
longitude: number;
|
|
5
|
+
latitude: number;
|
|
6
|
+
height: number;
|
|
7
|
+
}
|
|
8
|
+
interface CesiumMapControllerOptions {
|
|
9
|
+
initialCenter?: MapInitialCenter;
|
|
10
|
+
/** 当前可用的地图类型列表(由外部维护),用于读取 maximumLevel 等配置 */
|
|
11
|
+
getMapTypes?: () => MapType[];
|
|
12
|
+
/** 获取当前底图类型 id(由外部维护) */
|
|
13
|
+
getCurrentMapTypeId?: () => string;
|
|
14
|
+
/** 获取当前天地图 token(用于从 provider 读取 maximumLevel 时保持行为一致) */
|
|
15
|
+
getToken?: () => string;
|
|
16
|
+
/** 缩放回调(来自 Toolbar 的 ZoomCallback) */
|
|
17
|
+
zoomCallback?: ZoomCallback;
|
|
18
|
+
/** 场景模式切换后回调(例如通知 DrawHelper 重新计算偏移) */
|
|
19
|
+
onSceneModeChanged?: () => void;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* 负责地图相机控制、缩放层级和 2D/3D 切换等逻辑的控制器
|
|
23
|
+
* 与 UI(工具栏)解耦,避免 Cesium 细节散落在各处。
|
|
24
|
+
*/
|
|
25
|
+
export declare class CesiumMapController {
|
|
26
|
+
private viewer;
|
|
27
|
+
private initialCenter?;
|
|
28
|
+
private getMapTypes?;
|
|
29
|
+
private getCurrentMapTypeId?;
|
|
30
|
+
private getToken?;
|
|
31
|
+
private zoomCallback?;
|
|
32
|
+
private onSceneModeChanged?;
|
|
33
|
+
constructor(viewer: Viewer, options?: CesiumMapControllerOptions);
|
|
34
|
+
/**
|
|
35
|
+
* 监听相机缩放,限制层级范围到 [1, 18],并参考当前底图的 maximumLevel
|
|
36
|
+
*/
|
|
37
|
+
setupCameraZoomLimitListener(): void;
|
|
38
|
+
/**
|
|
39
|
+
* 获取当前地图层级(1-18)
|
|
40
|
+
*/
|
|
41
|
+
getCurrentZoomLevel(): number;
|
|
42
|
+
/**
|
|
43
|
+
* 设置地图层级
|
|
44
|
+
* @param zoomLevel 目标层级(1-18)
|
|
45
|
+
*/
|
|
46
|
+
setZoomLevel(zoomLevel: number): void;
|
|
47
|
+
/** 放大 */
|
|
48
|
+
zoomIn(): void;
|
|
49
|
+
/** 缩小 */
|
|
50
|
+
zoomOut(): void;
|
|
51
|
+
/**
|
|
52
|
+
* 2D/3D 切换
|
|
53
|
+
*/
|
|
54
|
+
toggle2D3D(buttonElement: HTMLElement): void;
|
|
55
|
+
/**
|
|
56
|
+
* 复位到初始位置
|
|
57
|
+
*/
|
|
58
|
+
resetLocation(): void;
|
|
59
|
+
setInitialCenter(center: MapInitialCenter): void;
|
|
60
|
+
getInitialCenter(): MapInitialCenter | undefined;
|
|
61
|
+
/**
|
|
62
|
+
* 切换全屏
|
|
63
|
+
*/
|
|
64
|
+
toggleFullscreen(): void;
|
|
65
|
+
/**
|
|
66
|
+
* 检查是否处于全屏状态
|
|
67
|
+
*/
|
|
68
|
+
isFullscreen(): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* 进入全屏
|
|
71
|
+
*/
|
|
72
|
+
enterFullscreen(): void;
|
|
73
|
+
/**
|
|
74
|
+
* 退出全屏
|
|
75
|
+
*/
|
|
76
|
+
exitFullscreen(): void;
|
|
77
|
+
}
|
|
78
|
+
export {};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Viewer } from '../../../node_modules/cesium';
|
|
2
|
+
import { MapType } from '../CesiumMapModel';
|
|
3
|
+
/**
|
|
4
|
+
* 图层服务配置接口
|
|
5
|
+
*/
|
|
6
|
+
export interface MapLayersServiceConfig {
|
|
7
|
+
mapTypes: MapType[];
|
|
8
|
+
currentMapType: string;
|
|
9
|
+
token: string;
|
|
10
|
+
isNoFlyZoneChecked: boolean;
|
|
11
|
+
isNoFlyZoneVisible: boolean;
|
|
12
|
+
onMapTypeChange?: (mapTypeId: string) => void;
|
|
13
|
+
onNoFlyZoneToggle?: (isChecked: boolean) => void;
|
|
14
|
+
onShowNoFlyZones?: () => Promise<void> | void;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* 图层服务类
|
|
18
|
+
* 负责处理地图图层切换相关的所有逻辑
|
|
19
|
+
*/
|
|
20
|
+
export declare class MapLayersService {
|
|
21
|
+
private viewer;
|
|
22
|
+
private toolbarElement;
|
|
23
|
+
private config;
|
|
24
|
+
private currentGeoWTFS;
|
|
25
|
+
constructor(viewer: Viewer, toolbarElement: HTMLElement, config: MapLayersServiceConfig);
|
|
26
|
+
/**
|
|
27
|
+
* 更新配置
|
|
28
|
+
*/
|
|
29
|
+
updateConfig(config: Partial<MapLayersServiceConfig>): void;
|
|
30
|
+
adjustMenuPosition: (menu: HTMLElement) => void;
|
|
31
|
+
/**
|
|
32
|
+
* 切换图层菜单
|
|
33
|
+
*/
|
|
34
|
+
toggleLayers(buttonElement: HTMLElement): void;
|
|
35
|
+
/**
|
|
36
|
+
* 创建地图类型部分
|
|
37
|
+
*/
|
|
38
|
+
private createMapTypeSection;
|
|
39
|
+
/**
|
|
40
|
+
* 创建地图类型项
|
|
41
|
+
*/
|
|
42
|
+
private createMapTypeItem;
|
|
43
|
+
/**
|
|
44
|
+
* 创建叠加图层部分
|
|
45
|
+
*/
|
|
46
|
+
private createOverlaySection;
|
|
47
|
+
/**
|
|
48
|
+
* 创建叠加图层项
|
|
49
|
+
*/
|
|
50
|
+
private createOverlayItem;
|
|
51
|
+
/**
|
|
52
|
+
* 切换地图类型
|
|
53
|
+
*/
|
|
54
|
+
switchMapType(mapTypeId: string): void;
|
|
55
|
+
/**
|
|
56
|
+
* 获取当前地图类型
|
|
57
|
+
*/
|
|
58
|
+
getCurrentMapType(): string;
|
|
59
|
+
/**
|
|
60
|
+
* 关闭图层菜单
|
|
61
|
+
*/
|
|
62
|
+
closeLayersMenu(): void;
|
|
63
|
+
/**
|
|
64
|
+
* 销毁图层服务
|
|
65
|
+
*/
|
|
66
|
+
destroy(): void;
|
|
67
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Viewer } from '../../../node_modules/cesium';
|
|
2
|
+
import { SearchResult, SearchCallback } from '../CesiumMapModel';
|
|
3
|
+
/**
|
|
4
|
+
* 搜索服务类
|
|
5
|
+
* 负责处理地图搜索相关的所有逻辑
|
|
6
|
+
*/
|
|
7
|
+
export declare class SearchService {
|
|
8
|
+
private viewer;
|
|
9
|
+
private toolbarElement;
|
|
10
|
+
private searchCallback?;
|
|
11
|
+
private searchContainer;
|
|
12
|
+
constructor(viewer: Viewer, toolbarElement: HTMLElement, searchCallback?: SearchCallback);
|
|
13
|
+
/**
|
|
14
|
+
* 设置搜索回调
|
|
15
|
+
*/
|
|
16
|
+
setSearchCallback(callback: SearchCallback): void;
|
|
17
|
+
/**
|
|
18
|
+
* 切换搜索功能
|
|
19
|
+
*/
|
|
20
|
+
toggleSearch(buttonElement: HTMLElement): void;
|
|
21
|
+
/**
|
|
22
|
+
* 执行默认搜索(使用天地图 API)
|
|
23
|
+
*/
|
|
24
|
+
private performDefaultSearch;
|
|
25
|
+
/**
|
|
26
|
+
* 显示搜索结果
|
|
27
|
+
*/
|
|
28
|
+
displaySearchResults(results: SearchResult[], container: HTMLElement): void;
|
|
29
|
+
/**
|
|
30
|
+
* 选择搜索结果
|
|
31
|
+
*/
|
|
32
|
+
selectSearchResult(result: SearchResult): void;
|
|
33
|
+
/**
|
|
34
|
+
* 关闭搜索框
|
|
35
|
+
*/
|
|
36
|
+
closeSearchContainer(): void;
|
|
37
|
+
/**
|
|
38
|
+
* 销毁搜索服务
|
|
39
|
+
*/
|
|
40
|
+
destroy(): void;
|
|
41
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Viewer } from '../../../node_modules/cesium';
|
|
2
|
+
import { default as DrawHelper } from '../CesiumMapDraw';
|
|
3
|
+
import { MeasurementCallback } from '../CesiumMapModel';
|
|
4
|
+
export type MeasureMode = 'none' | 'distance' | 'area';
|
|
5
|
+
export declare class MeasurementService {
|
|
6
|
+
private viewer;
|
|
7
|
+
private drawHelper;
|
|
8
|
+
private measurementCallback?;
|
|
9
|
+
private currentMode;
|
|
10
|
+
constructor(viewer: Viewer, drawHelper: DrawHelper, measurementCallback?: MeasurementCallback);
|
|
11
|
+
getMeasureMode(): MeasureMode;
|
|
12
|
+
setupDrawHelperCallbacks(): void;
|
|
13
|
+
startAreaMeasurement(): void;
|
|
14
|
+
startDistanceMeasurement(): void;
|
|
15
|
+
clearMeasurements(): void;
|
|
16
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Viewer } from '../../../node_modules/cesium';
|
|
2
|
+
/**
|
|
3
|
+
* 禁飞区服务配置接口
|
|
4
|
+
*/
|
|
5
|
+
export interface NotFlyZonesServiceConfig {
|
|
6
|
+
extrudedHeight?: number;
|
|
7
|
+
autoLoad?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* 禁飞区服务类
|
|
11
|
+
* 负责处理机场禁飞区相关的所有逻辑
|
|
12
|
+
*/
|
|
13
|
+
export declare class NotFlyZonesService {
|
|
14
|
+
private viewer;
|
|
15
|
+
private noFlyZoneEntities;
|
|
16
|
+
private isNoFlyZoneVisible;
|
|
17
|
+
private isNoFlyZoneLoading;
|
|
18
|
+
private readonly extrudedHeight;
|
|
19
|
+
constructor(viewer: Viewer, config?: NotFlyZonesServiceConfig);
|
|
20
|
+
/**
|
|
21
|
+
* 加载并显示机场禁飞区
|
|
22
|
+
*/
|
|
23
|
+
showNoFlyZones(): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* 隐藏机场禁飞区
|
|
26
|
+
*/
|
|
27
|
+
hideNoFlyZones(): void;
|
|
28
|
+
/**
|
|
29
|
+
* 切换机场禁飞区显示状态
|
|
30
|
+
*/
|
|
31
|
+
toggleNoFlyZones(): Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* 获取禁飞区显示状态
|
|
34
|
+
*/
|
|
35
|
+
getNoFlyZoneVisible(): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* 创建禁飞区多边形配置选项
|
|
38
|
+
* @param positions - 多边形的顶点坐标数组,使用笛卡尔坐标系
|
|
39
|
+
* @returns 返回一个包含多边形图形配置选项的对象
|
|
40
|
+
*/
|
|
41
|
+
private createNoFlyZonePolygonOptions;
|
|
42
|
+
/**
|
|
43
|
+
* 销毁禁飞区服务
|
|
44
|
+
*/
|
|
45
|
+
destroy(): void;
|
|
46
|
+
}
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xingm/vmap-cesium-toolbar",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2-alpha.10",
|
|
4
4
|
"description": "A powerful Cesium map toolbar plugin with drawing, measurement, and interaction features",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -32,14 +32,14 @@
|
|
|
32
32
|
"vue3",
|
|
33
33
|
"typescript"
|
|
34
34
|
],
|
|
35
|
-
"author": "
|
|
35
|
+
"author": "pengxueyou",
|
|
36
36
|
"license": "MIT",
|
|
37
37
|
"repository": {
|
|
38
38
|
"type": "git",
|
|
39
|
-
"url": "https://github.com/
|
|
39
|
+
"url": "git+https://github.com/benxueyou/vmap-cesium-toolbar.git"
|
|
40
40
|
},
|
|
41
41
|
"bugs": {
|
|
42
|
-
"url": "https://github.com/
|
|
42
|
+
"url": "https://github.com/benxueyou/vmap-cesium-toolbar/issues"
|
|
43
43
|
},
|
|
44
|
-
"homepage": "https://github.com/
|
|
44
|
+
"homepage": "https://github.com/benxueyou/vmap-cesium-toolbar#readme"
|
|
45
45
|
}
|