@xingm/vmap-cesium-toolbar 0.0.2-alpha.12 → 0.0.2-alpha.14
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/useDrawHelper.d.ts +7 -0
- package/dist/hooks/useDynamicRing.d.ts +44 -0
- package/dist/hooks/useOverlayHelper.d.ts +34 -3
- package/dist/index.d.ts +90 -8
- package/dist/index.js +3889 -1486
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +22 -22
- package/dist/index.umd.js.map +1 -1
- package/dist/libs/CesiumMapDraw.d.ts +48 -0
- package/dist/libs/CesiumMapLoader.d.ts +3 -0
- package/dist/libs/CesiumOverlayService.d.ts +50 -1
- package/dist/libs/drawHelper/BaseDraw.d.ts +22 -0
- package/dist/libs/drawHelper/DrawPolgon.d.ts +1 -0
- package/dist/libs/overlay/MapCircle.d.ts +44 -1
- package/dist/libs/overlay/MapIcon.d.ts +10 -0
- package/dist/libs/overlay/MapLabel.d.ts +10 -0
- package/dist/libs/overlay/MapMarker.d.ts +10 -0
- package/dist/libs/overlay/MapPolygon.d.ts +32 -1
- package/dist/libs/overlay/MapPolyline.d.ts +10 -0
- package/dist/libs/overlay/MapRectangle.d.ts +32 -0
- package/dist/libs/overlay/MapRing.d.ts +10 -0
- package/dist/libs/overlay/MapSVG.d.ts +10 -0
- package/dist/libs/overlay/primitives/CirclePrimitiveBatch.d.ts +35 -0
- package/dist/libs/overlay/primitives/PolygonPrimitiveBatch.d.ts +36 -0
- package/dist/libs/overlay/primitives/RectanglePrimitiveBatch.d.ts +34 -0
- package/dist/libs/overlay/types.d.ts +72 -0
- package/dist/package.json +1 -1
- package/dist/utils/calc.d.ts +6 -0
- package/dist/utils/selfIntersection.d.ts +13 -0
- package/package.json +1 -1
|
@@ -18,6 +18,7 @@ export declare function useDrawHelper(viewer: Ref<Cesium.Viewer | undefined>, me
|
|
|
18
18
|
clearAllEntities: () => void;
|
|
19
19
|
clearAllPoints: () => void;
|
|
20
20
|
removeEntity: (entity: Cesium.Entity) => void;
|
|
21
|
+
getEntityLabelEntities: (entity: Cesium.Entity) => Cesium.Entity[];
|
|
21
22
|
getFinishedEntities: () => Cesium.Entity[];
|
|
22
23
|
onMeasureComplete: (callback: (result: {
|
|
23
24
|
type: "line" | "polygon" | "rectangle" | "circle";
|
|
@@ -41,6 +42,7 @@ export declare function useDrawHelper(viewer: Ref<Cesium.Viewer | undefined>, me
|
|
|
41
42
|
clearAllEntities: () => void;
|
|
42
43
|
clearAllPoints: () => void;
|
|
43
44
|
removeEntity: (entity: Cesium.Entity) => void;
|
|
45
|
+
getEntityLabelEntities: (entity: Cesium.Entity) => Cesium.Entity[];
|
|
44
46
|
getFinishedEntities: () => Cesium.Entity[];
|
|
45
47
|
onMeasureComplete: (callback: (result: {
|
|
46
48
|
type: "line" | "polygon" | "rectangle" | "circle";
|
|
@@ -59,7 +61,12 @@ export declare function useDrawHelper(viewer: Ref<Cesium.Viewer | undefined>, me
|
|
|
59
61
|
endDrawing: () => void;
|
|
60
62
|
addDrawLine: () => void;
|
|
61
63
|
addDrawArea: () => void;
|
|
64
|
+
addDrawAreaNoLabel: () => void;
|
|
62
65
|
addDrawCircle: () => void;
|
|
66
|
+
addDrawCircleNoLabel: () => void;
|
|
63
67
|
addDrawPolygon: () => void;
|
|
68
|
+
addDrawPolygonNoLabel: () => void;
|
|
69
|
+
addDrawPolygon_PointIntercept: () => void;
|
|
70
|
+
addDrawPolygon_FinishFallback: () => void;
|
|
64
71
|
destroyDrawHelper: () => void;
|
|
65
72
|
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Viewer } from '../../node_modules/cesium';
|
|
2
|
+
import * as Cesium from "cesium";
|
|
3
|
+
export type CleanupFn = () => void;
|
|
4
|
+
export type RingDirection = "outward" | "inward";
|
|
5
|
+
export type AddDynamicRingOptions = {
|
|
6
|
+
position: Cesium.Cartesian3;
|
|
7
|
+
color?: Cesium.Color;
|
|
8
|
+
width?: number;
|
|
9
|
+
height?: number;
|
|
10
|
+
scale?: number;
|
|
11
|
+
direction?: RingDirection;
|
|
12
|
+
imageSize?: number;
|
|
13
|
+
disableDepthTestDistance?: number;
|
|
14
|
+
};
|
|
15
|
+
export type DynamicRingInstance = {
|
|
16
|
+
billboard: Cesium.Billboard;
|
|
17
|
+
color: Cesium.Color;
|
|
18
|
+
direction: RingDirection;
|
|
19
|
+
};
|
|
20
|
+
export declare function getRingCanvas(size?: number): HTMLCanvasElement;
|
|
21
|
+
export declare function addDynamicRing(collection: Cesium.BillboardCollection, options: AddDynamicRingOptions): DynamicRingInstance;
|
|
22
|
+
export type StartDynamicRingOptions = {
|
|
23
|
+
lon: number;
|
|
24
|
+
lat: number;
|
|
25
|
+
/** 任选其一:radiusMeters / diameterMeters / widthMeters+heightMeters */
|
|
26
|
+
radiusMeters?: number;
|
|
27
|
+
diameterMeters?: number;
|
|
28
|
+
widthMeters?: number;
|
|
29
|
+
heightMeters?: number;
|
|
30
|
+
color?: Cesium.Color;
|
|
31
|
+
/** 发散方向:outward(由小到大) / inward(由大到小) */
|
|
32
|
+
direction?: RingDirection;
|
|
33
|
+
heightOffset?: number;
|
|
34
|
+
imageSize?: number;
|
|
35
|
+
disableDepthTestDistance?: number;
|
|
36
|
+
period?: number;
|
|
37
|
+
baseScale?: number;
|
|
38
|
+
scaleRange?: number;
|
|
39
|
+
baseAlpha?: number;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* 一站式:创建光圈 + 贴地采样 + preRender 动画,并返回 cleanup
|
|
43
|
+
*/
|
|
44
|
+
export declare function startDynamicRing(viewer: Viewer, options: StartDynamicRingOptions): CleanupFn;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Ref } from 'vue';
|
|
2
2
|
import { Entity } from '../../node_modules/cesium';
|
|
3
|
+
import { OverlayEntity } from '../libs/overlay/types';
|
|
3
4
|
import { CesiumOverlayService } from '../libs/overlay';
|
|
4
5
|
import * as Cesium from "cesium";
|
|
5
6
|
/**
|
|
@@ -60,12 +61,18 @@ export declare function useOverlayHelper(viewer: Ref<Cesium.Viewer | undefined>,
|
|
|
60
61
|
updatePositions: (entity: Entity, positions: import('../libs/overlay').OverlayPosition[]) => void;
|
|
61
62
|
updateStyle: (entity: Entity, options: Partial<Pick<import('../libs/overlay').PolygonOptions, "material" | "outline" | "outlineColor" | "outlineWidth">>) => void;
|
|
62
63
|
remove: (entityOrId: Entity | string) => boolean;
|
|
64
|
+
setPrimitiveVisible: (entity: Entity, visible: boolean) => void;
|
|
65
|
+
applyPrimitiveHighlight: (entity: OverlayEntity, hlColor: Cesium.Color, fillAlpha: number) => void;
|
|
66
|
+
restorePrimitiveHighlight: (entity: OverlayEntity) => void;
|
|
63
67
|
};
|
|
64
68
|
readonly rectangle: {
|
|
65
69
|
add: (options: import('../libs/overlay').RectangleOptions) => Entity;
|
|
66
70
|
updateCoordinates: (entity: Entity, coordinates: Cesium.Rectangle) => void;
|
|
67
71
|
updateStyle: (entity: Entity, options: Partial<Pick<import('../libs/overlay').RectangleOptions, "material" | "outline" | "outlineColor" | "outlineWidth">>) => void;
|
|
68
72
|
remove: (entityOrId: Entity | string) => boolean;
|
|
73
|
+
setPrimitiveVisible: (entity: Entity, visible: boolean) => void;
|
|
74
|
+
applyPrimitiveHighlight: (entity: OverlayEntity, hlColor: Cesium.Color, fillAlpha: number) => void;
|
|
75
|
+
restorePrimitiveHighlight: (entity: OverlayEntity) => void;
|
|
69
76
|
};
|
|
70
77
|
readonly circle: {
|
|
71
78
|
add: (options: import('../libs/overlay').CircleOptions) => Entity;
|
|
@@ -73,6 +80,9 @@ export declare function useOverlayHelper(viewer: Ref<Cesium.Viewer | undefined>,
|
|
|
73
80
|
updateRadius: (entity: Entity, radius: number) => void;
|
|
74
81
|
updateStyle: (entity: Entity, options: Partial<Pick<import('../libs/overlay').CircleOptions, "material" | "outline" | "outlineColor" | "outlineWidth">>) => void;
|
|
75
82
|
remove: (entityOrId: Entity | string) => boolean;
|
|
83
|
+
setPrimitiveVisible: (entity: Entity, visible: boolean) => void;
|
|
84
|
+
applyPrimitiveHighlight: (entity: OverlayEntity, hlColor: Cesium.Color, fillAlpha: number) => void;
|
|
85
|
+
restorePrimitiveHighlight: (entity: OverlayEntity) => void;
|
|
76
86
|
};
|
|
77
87
|
readonly ring: {
|
|
78
88
|
add: (options: import('../libs/overlay').RingOptions) => Entity;
|
|
@@ -82,6 +92,8 @@ export declare function useOverlayHelper(viewer: Ref<Cesium.Viewer | undefined>,
|
|
|
82
92
|
setVisible: (entity: Entity, visible: boolean) => void;
|
|
83
93
|
remove: (entityOrId: Entity | string) => boolean;
|
|
84
94
|
};
|
|
95
|
+
toggleOverlayHighlight: (entity: OverlayEntity, reason?: "click" | "hover") => void;
|
|
96
|
+
setOverlayHighlight: (entityOrId: OverlayEntity | string, enabled: boolean, reason?: "click" | "hover") => boolean;
|
|
85
97
|
addMarker: (options: import('../libs/overlay').MarkerOptions) => Entity;
|
|
86
98
|
addLabel: (options: import('../libs/overlay').LabelOptions) => Entity;
|
|
87
99
|
addIcon: (options: import('../libs/overlay').IconOptions) => Entity;
|
|
@@ -152,12 +164,18 @@ export declare function useOverlayHelper(viewer: Ref<Cesium.Viewer | undefined>,
|
|
|
152
164
|
updatePositions: (entity: Entity, positions: import('../libs/overlay').OverlayPosition[]) => void;
|
|
153
165
|
updateStyle: (entity: Entity, options: Partial<Pick<import('../libs/overlay').PolygonOptions, "material" | "outline" | "outlineColor" | "outlineWidth">>) => void;
|
|
154
166
|
remove: (entityOrId: Entity | string) => boolean;
|
|
167
|
+
setPrimitiveVisible: (entity: Entity, visible: boolean) => void;
|
|
168
|
+
applyPrimitiveHighlight: (entity: OverlayEntity, hlColor: Cesium.Color, fillAlpha: number) => void;
|
|
169
|
+
restorePrimitiveHighlight: (entity: OverlayEntity) => void;
|
|
155
170
|
};
|
|
156
171
|
readonly rectangle: {
|
|
157
172
|
add: (options: import('../libs/overlay').RectangleOptions) => Entity;
|
|
158
173
|
updateCoordinates: (entity: Entity, coordinates: Cesium.Rectangle) => void;
|
|
159
174
|
updateStyle: (entity: Entity, options: Partial<Pick<import('../libs/overlay').RectangleOptions, "material" | "outline" | "outlineColor" | "outlineWidth">>) => void;
|
|
160
175
|
remove: (entityOrId: Entity | string) => boolean;
|
|
176
|
+
setPrimitiveVisible: (entity: Entity, visible: boolean) => void;
|
|
177
|
+
applyPrimitiveHighlight: (entity: OverlayEntity, hlColor: Cesium.Color, fillAlpha: number) => void;
|
|
178
|
+
restorePrimitiveHighlight: (entity: OverlayEntity) => void;
|
|
161
179
|
};
|
|
162
180
|
readonly circle: {
|
|
163
181
|
add: (options: import('../libs/overlay').CircleOptions) => Entity;
|
|
@@ -165,6 +183,9 @@ export declare function useOverlayHelper(viewer: Ref<Cesium.Viewer | undefined>,
|
|
|
165
183
|
updateRadius: (entity: Entity, radius: number) => void;
|
|
166
184
|
updateStyle: (entity: Entity, options: Partial<Pick<import('../libs/overlay').CircleOptions, "material" | "outline" | "outlineColor" | "outlineWidth">>) => void;
|
|
167
185
|
remove: (entityOrId: Entity | string) => boolean;
|
|
186
|
+
setPrimitiveVisible: (entity: Entity, visible: boolean) => void;
|
|
187
|
+
applyPrimitiveHighlight: (entity: OverlayEntity, hlColor: Cesium.Color, fillAlpha: number) => void;
|
|
188
|
+
restorePrimitiveHighlight: (entity: OverlayEntity) => void;
|
|
168
189
|
};
|
|
169
190
|
readonly ring: {
|
|
170
191
|
add: (options: import('../libs/overlay').RingOptions) => Entity;
|
|
@@ -174,6 +195,8 @@ export declare function useOverlayHelper(viewer: Ref<Cesium.Viewer | undefined>,
|
|
|
174
195
|
setVisible: (entity: Entity, visible: boolean) => void;
|
|
175
196
|
remove: (entityOrId: Entity | string) => boolean;
|
|
176
197
|
};
|
|
198
|
+
toggleOverlayHighlight: (entity: OverlayEntity, reason?: "click" | "hover") => void;
|
|
199
|
+
setOverlayHighlight: (entityOrId: OverlayEntity | string, enabled: boolean, reason?: "click" | "hover") => boolean;
|
|
177
200
|
addMarker: (options: import('../libs/overlay').MarkerOptions) => Entity;
|
|
178
201
|
addLabel: (options: import('../libs/overlay').LabelOptions) => Entity;
|
|
179
202
|
addIcon: (options: import('../libs/overlay').IconOptions) => Entity;
|
|
@@ -197,16 +220,24 @@ export declare function useOverlayHelper(viewer: Ref<Cesium.Viewer | undefined>,
|
|
|
197
220
|
addMarker: () => void;
|
|
198
221
|
addMarkerWithLabel: () => void;
|
|
199
222
|
addLabel: (options: any) => void;
|
|
200
|
-
addIcon: (
|
|
201
|
-
|
|
223
|
+
addIcon: (coords?: {
|
|
224
|
+
longitude: number;
|
|
225
|
+
latitude: number;
|
|
226
|
+
}) => void;
|
|
227
|
+
addSvg: (coords?: {
|
|
228
|
+
longitude: number;
|
|
229
|
+
latitude: number;
|
|
230
|
+
}) => void;
|
|
202
231
|
addPolyline: () => void;
|
|
203
232
|
addLine: () => void;
|
|
204
233
|
addArea: () => void;
|
|
205
234
|
addCircle: () => void;
|
|
206
|
-
addRing: () =>
|
|
235
|
+
addRing: (i?: number) => Cesium.Entity | undefined;
|
|
207
236
|
addPolygon: () => void;
|
|
208
237
|
addRectangle: () => void;
|
|
209
238
|
addInfoWindow: () => void;
|
|
239
|
+
testSetOverlayHighlight: () => void;
|
|
240
|
+
testToggleOverlayHighlight: () => void;
|
|
210
241
|
cancelMarkerMode: () => void;
|
|
211
242
|
destroyOverlayService: () => void;
|
|
212
243
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -198,6 +198,9 @@ export interface InitOptions {
|
|
|
198
198
|
requestRenderMode?: boolean;
|
|
199
199
|
token?: string;
|
|
200
200
|
cesiumToken?: string;
|
|
201
|
+
orderIndependentTranslucency?: boolean // 无序半透明度,
|
|
202
|
+
fxaa?: boolean, // 启用FXAA后处理抗锯齿
|
|
203
|
+
msaaSamples?: number, // MSAA采样数(推荐4或8),
|
|
201
204
|
success?: () => void;
|
|
202
205
|
cancel?: () => void;
|
|
203
206
|
mapCenter?: MapCenter;
|
|
@@ -265,6 +268,11 @@ export type OverlayPosition = Cartesian3 | [number, number] | [number, number, n
|
|
|
265
268
|
// 覆盖物扩展实体类型(与 libs/overlay/types.ts 保持一致)
|
|
266
269
|
export interface OverlayEntity extends Entity {
|
|
267
270
|
_onClick?: (entity: Entity) => void;
|
|
271
|
+
_clickHighlight?: boolean | { color?: any | string; fillAlpha?: number };
|
|
272
|
+
_hoverHighlight?: boolean | { color?: any | string; fillAlpha?: number };
|
|
273
|
+
_highlightEntities?: Entity[];
|
|
274
|
+
_isHighlighted?: boolean;
|
|
275
|
+
_highlightState?: { click?: boolean; hover?: boolean };
|
|
268
276
|
_overlayType?: string;
|
|
269
277
|
_infoWindow?: HTMLElement;
|
|
270
278
|
_borderEntity?: Entity;
|
|
@@ -289,6 +297,13 @@ export interface OverlayEntity extends Entity {
|
|
|
289
297
|
_outerRadius?: number;
|
|
290
298
|
_innerRadius?: number;
|
|
291
299
|
_outerRectangle?: Cesium.Rectangle;
|
|
300
|
+
|
|
301
|
+
/** primitive circle: 内部使用的纯色缓存(用于高亮恢复) */
|
|
302
|
+
_primitiveRingBaseColor?: any;
|
|
303
|
+
_primitiveFillBaseColor?: any;
|
|
304
|
+
|
|
305
|
+
/** primitive polygon/rectangle: 边框纯色缓存(用于高亮恢复) */
|
|
306
|
+
_primitiveBorderBaseColor?: any;
|
|
292
307
|
}
|
|
293
308
|
|
|
294
309
|
export type PositionOffset =
|
|
@@ -341,6 +356,8 @@ export interface MarkerOptions {
|
|
|
341
356
|
heightReference?: any;
|
|
342
357
|
scaleByDistance?: Cesium.NearFarScalar;
|
|
343
358
|
disableDepthTestDistance?: number;
|
|
359
|
+
clickHighlight?: boolean | { color?: any | string; fillAlpha?: number };
|
|
360
|
+
hoverHighlight?: boolean | { color?: any | string; fillAlpha?: number };
|
|
344
361
|
onClick?: (entity: Entity) => void;
|
|
345
362
|
id?: string;
|
|
346
363
|
}
|
|
@@ -363,6 +380,8 @@ export interface LabelOptions {
|
|
|
363
380
|
backgroundColor?: any | string;
|
|
364
381
|
backgroundPadding?: Cesium.Cartesian2;
|
|
365
382
|
disableDepthTestDistance?: number;
|
|
383
|
+
clickHighlight?: boolean | { color?: any | string; fillAlpha?: number };
|
|
384
|
+
hoverHighlight?: boolean | { color?: any | string; fillAlpha?: number };
|
|
366
385
|
onClick?: (entity: Entity) => void;
|
|
367
386
|
id?: string;
|
|
368
387
|
}
|
|
@@ -381,6 +400,8 @@ export interface IconOptions {
|
|
|
381
400
|
heightReference?: any;
|
|
382
401
|
disableDepthTestDistance?: number;
|
|
383
402
|
color?: any | string;
|
|
403
|
+
clickHighlight?: boolean | { color?: any | string; fillAlpha?: number };
|
|
404
|
+
hoverHighlight?: boolean | { color?: any | string; fillAlpha?: number };
|
|
384
405
|
onClick?: (entity: Entity) => void;
|
|
385
406
|
id?: string;
|
|
386
407
|
}
|
|
@@ -399,6 +420,8 @@ export interface SvgOptions {
|
|
|
399
420
|
heightReference?: any;
|
|
400
421
|
disableDepthTestDistance?: number;
|
|
401
422
|
color?: any | string;
|
|
423
|
+
clickHighlight?: boolean | { color?: any | string; fillAlpha?: number };
|
|
424
|
+
hoverHighlight?: boolean | { color?: any | string; fillAlpha?: number };
|
|
402
425
|
onClick?: (entity: Entity) => void;
|
|
403
426
|
id?: string;
|
|
404
427
|
}
|
|
@@ -408,30 +431,43 @@ export interface PolylineOptions {
|
|
|
408
431
|
width?: number;
|
|
409
432
|
material?: Cesium.MaterialProperty | any | string;
|
|
410
433
|
clampToGround?: boolean;
|
|
434
|
+
clickHighlight?: boolean | { color?: any | string; fillAlpha?: number };
|
|
435
|
+
hoverHighlight?: boolean | { color?: any | string; fillAlpha?: number };
|
|
411
436
|
onClick?: (entity: Entity) => void;
|
|
412
437
|
id?: string;
|
|
413
438
|
}
|
|
414
439
|
|
|
415
440
|
export interface PolygonOptions {
|
|
416
441
|
positions: OverlayPosition[];
|
|
442
|
+
/** 渲染模式:auto(默认) / entity / primitive(贴地粗边框纯色场景支持) */
|
|
443
|
+
renderMode?: 'auto' | 'entity' | 'primitive';
|
|
417
444
|
material?: Cesium.MaterialProperty | any | string;
|
|
418
445
|
outline?: boolean;
|
|
419
446
|
outlineColor?: any | string;
|
|
420
447
|
outlineWidth?: number;
|
|
448
|
+
clampToGround?: boolean;
|
|
421
449
|
heightReference?: any;
|
|
422
450
|
extrudedHeight?: number;
|
|
451
|
+
clickHighlight?: boolean | { color?: any | string; fillAlpha?: number };
|
|
452
|
+
hoverHighlight?: boolean | { color?: any | string; fillAlpha?: number };
|
|
423
453
|
onClick?: (entity: Entity) => void;
|
|
424
454
|
id?: string;
|
|
425
455
|
}
|
|
426
456
|
|
|
427
457
|
export interface RectangleOptions {
|
|
428
458
|
coordinates: Cesium.Rectangle;
|
|
459
|
+
renderMode?: 'auto' | 'entity' | 'primitive';
|
|
429
460
|
material?: Cesium.MaterialProperty | any | string;
|
|
430
461
|
outline?: boolean;
|
|
431
462
|
outlineColor?: any | string;
|
|
432
463
|
outlineWidth?: number;
|
|
464
|
+
clampToGround?: boolean;
|
|
465
|
+
height?: number;
|
|
433
466
|
heightReference?: any;
|
|
434
467
|
extrudedHeight?: number;
|
|
468
|
+
heightEpsilon?: number;
|
|
469
|
+
clickHighlight?: boolean | { color?: any | string; fillAlpha?: number };
|
|
470
|
+
hoverHighlight?: boolean | { color?: any | string; fillAlpha?: number };
|
|
435
471
|
onClick?: (entity: Entity) => void;
|
|
436
472
|
id?: string;
|
|
437
473
|
}
|
|
@@ -439,13 +475,19 @@ export interface RectangleOptions {
|
|
|
439
475
|
export interface CircleOptions {
|
|
440
476
|
position: OverlayPosition;
|
|
441
477
|
radius: number;
|
|
478
|
+
/** 渲染模式:auto(默认) / entity / primitive(预留) */
|
|
479
|
+
renderMode?: 'auto' | 'entity' | 'primitive';
|
|
442
480
|
material?: Cesium.MaterialProperty | any | string;
|
|
443
481
|
outline?: boolean;
|
|
444
482
|
outlineColor?: any | string;
|
|
445
483
|
outlineWidth?: number;
|
|
484
|
+
segments?: number;
|
|
485
|
+
clampToGround?: boolean;
|
|
446
486
|
heightReference?: any;
|
|
447
487
|
extrudedHeight?: number;
|
|
448
488
|
heightEpsilon?: number; // 高度容差,用于环形方案
|
|
489
|
+
clickHighlight?: boolean | { color?: any | string; fillAlpha?: number };
|
|
490
|
+
hoverHighlight?: boolean | { color?: any | string; fillAlpha?: number };
|
|
449
491
|
onClick?: (entity: Entity) => void;
|
|
450
492
|
id?: string;
|
|
451
493
|
}
|
|
@@ -485,6 +527,8 @@ export interface RingOptions {
|
|
|
485
527
|
clampToGround?: boolean;
|
|
486
528
|
/** 圆环分段数(默认 128),越大越圆滑 */
|
|
487
529
|
segments?: number;
|
|
530
|
+
clickHighlight?: boolean | { color?: any | string; fillAlpha?: number };
|
|
531
|
+
hoverHighlight?: boolean | { color?: any | string; fillAlpha?: number };
|
|
488
532
|
/** 覆盖物点击回调 */
|
|
489
533
|
onClick?: (entity: Entity) => void;
|
|
490
534
|
id?: string;
|
|
@@ -492,21 +536,23 @@ export interface RingOptions {
|
|
|
492
536
|
|
|
493
537
|
export declare class CesiumOverlayService {
|
|
494
538
|
constructor(viewer: Viewer);
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
539
|
+
toggleOverlayHighlight(entity: any, reason?: 'click' | 'hover'): void;
|
|
540
|
+
addMarker(options: MarkerOptions): any; // 返回 Cesium.Entity
|
|
541
|
+
addLabel(options: LabelOptions): any; // 返回 Cesium.Entity
|
|
542
|
+
addIcon(options: IconOptions): any; // 返回 Cesium.Entity
|
|
543
|
+
addSvg(options: SvgOptions): any; // 返回 Cesium.Entity
|
|
499
544
|
addInfoWindow(options: InfoWindowOptions): any; // 返回 Cesium.Entity
|
|
500
|
-
addPolyline(options:
|
|
501
|
-
addPolygon(options:
|
|
502
|
-
addRectangle(options:
|
|
503
|
-
addCircle(options:
|
|
545
|
+
addPolyline(options: PolylineOptions): any; // 返回 Cesium.Entity
|
|
546
|
+
addPolygon(options: PolygonOptions): any; // 返回 Cesium.Entity
|
|
547
|
+
addRectangle(options: RectangleOptions): any; // 返回 Cesium.Entity
|
|
548
|
+
addCircle(options: CircleOptions): any; // 返回 Cesium.Entity
|
|
504
549
|
addRing(options: RingOptions): any; // 返回 Cesium.Entity
|
|
505
550
|
getOverlay(id: string): any | undefined; // 返回 Cesium.Entity | undefined
|
|
506
551
|
removeOverlay(id: string): boolean;
|
|
507
552
|
removeAllOverlays(): void;
|
|
508
553
|
updateOverlayPosition(id: string, position: Cartesian3 | [number, number, number?]): boolean;
|
|
509
554
|
setOverlayVisible(id: string, visible: boolean): boolean;
|
|
555
|
+
setOverlayHighlight(entityOrId: any | string, enabled: boolean, reason?: 'click' | 'hover'): boolean;
|
|
510
556
|
getAllOverlayIds(): string[];
|
|
511
557
|
getAllOverlays(): any[]; // Cesium.Entity[]
|
|
512
558
|
destroy(): void;
|
|
@@ -728,9 +774,43 @@ export interface DrawOptions {
|
|
|
728
774
|
outlineColor?: Cesium.Color | string;
|
|
729
775
|
outlineWidth?: number;
|
|
730
776
|
};
|
|
777
|
+
/**
|
|
778
|
+
* 是否显示面积标签(适用于 polygon/rectangle/circle)。
|
|
779
|
+
* 默认 true;设为 false 可禁用绘制完成后自动创建的面积标签。
|
|
780
|
+
*/
|
|
781
|
+
showAreaLabel?: boolean;
|
|
782
|
+
/**
|
|
783
|
+
* 多边形自相交校验:是否允许“擦边/顶点落在旧边上”等仅接触(touch)情况。
|
|
784
|
+
* - false/未设置:touch 也视为不合法
|
|
785
|
+
* - true:允许 touch,但仍不允许重叠(overlap)与真正穿越(cross)
|
|
786
|
+
*/
|
|
787
|
+
selfIntersectionAllowTouch?: boolean;
|
|
788
|
+
|
|
789
|
+
/**
|
|
790
|
+
* 多边形自相交校验:当即将产生自相交时,是否仍允许继续绘制/完成绘制。
|
|
791
|
+
* - false/未设置:检测到自相交则阻止落点/阻止完成
|
|
792
|
+
* - true:检测到自相交不拦截(由业务自行承担后续面积/中心等偏差风险)
|
|
793
|
+
*/
|
|
794
|
+
selfIntersectionAllowContinue?: boolean;
|
|
731
795
|
onClick?: (entity: Entity, type?: 'line' | 'polygon' | 'rectangle' | 'circle', positions?: Cartesian3[]) => void;
|
|
732
796
|
}
|
|
733
797
|
|
|
798
|
+
/**
|
|
799
|
+
* 绘制模块扩展实体类型(用于在 Entity 上挂载绘图相关元数据)
|
|
800
|
+
*/
|
|
801
|
+
export interface DrawEntity extends Entity {
|
|
802
|
+
_drawType?: 'line' | 'polygon' | 'rectangle' | 'circle';
|
|
803
|
+
_drawOptions?: DrawOptions;
|
|
804
|
+
_groundPositions?: Cartesian3[];
|
|
805
|
+
_groundPosition?: Cartesian3;
|
|
806
|
+
_groundRectangle?: Cesium.Rectangle;
|
|
807
|
+
_radius?: number;
|
|
808
|
+
_borderEntity?: Entity;
|
|
809
|
+
/** 关联的测量/提示标签实体(例如面积标签) */
|
|
810
|
+
_labelEntities?: Entity[];
|
|
811
|
+
_onClick?: (entity: Entity, ...args: any[]) => void;
|
|
812
|
+
}
|
|
813
|
+
|
|
734
814
|
export declare class DrawHelper {
|
|
735
815
|
constructor(viewer: Viewer);
|
|
736
816
|
// 开始绘制(可选样式参数)
|
|
@@ -746,6 +826,8 @@ export declare class DrawHelper {
|
|
|
746
826
|
clearAllPoints(): void;
|
|
747
827
|
removeEntity(entity: Entity): void;
|
|
748
828
|
getFinishedEntities(): Entity[];
|
|
829
|
+
/** 获取绘制实体关联的标签实体(例如面积标签) */
|
|
830
|
+
getEntityLabelEntities(entity: Entity): Entity[];
|
|
749
831
|
// 事件回调注册
|
|
750
832
|
onMeasureComplete(callback: (result: DrawResult) => void): void;
|
|
751
833
|
onDrawStart(callback: () => void): void;
|