@xingm/vmap-cesium-toolbar 0.0.2-alpha.4 → 0.0.2-alpha.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/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  // VMap Cesium Toolbar Plugin Type Definitions
2
2
 
3
- import type { Viewer, Cartesian3, Cartographic, Entity } from 'cesium';
3
+ import type * as Cesium from 'cesium';
4
+ import type { Viewer, Cartesian3, Cartographic, Entity, Cartesian2 } from 'cesium';
4
5
 
5
6
  // 工具栏配置接口
6
7
  export interface ToolbarConfig {
@@ -188,6 +189,9 @@ export declare class CesiumMapToolbar {
188
189
  }
189
190
 
190
191
  // 覆盖物服务:对外暴露的简化类型声明
192
+ // 覆盖物位置类型(与 overlay/types.ts 保持一致)
193
+ export type OverlayPosition = Cartesian3 | [number, number] | [number, number, number];
194
+
191
195
  export type PositionOffset =
192
196
  | 'top'
193
197
  | 'bottom'
@@ -203,11 +207,11 @@ export type PositionOffset =
203
207
  | 'right-bottom';
204
208
 
205
209
  export interface InfoWindowOptions {
206
- position: Cartesian3 | [number, number, number?];
210
+ position: OverlayPosition;
207
211
  content: string | HTMLElement;
208
212
  width?: number;
209
213
  height?: number;
210
- pixelOffset?: { x: number; y: number };
214
+ pixelOffset?: Cesium.Cartesian2 | { x: number; y: number };
211
215
  show?: boolean;
212
216
  id?: string;
213
217
  closable?: boolean;
@@ -228,6 +232,124 @@ export interface InfoWindowOptions {
228
232
  positionOffset?: PositionOffset;
229
233
  }
230
234
 
235
+ // Overlay: 选项类型(与各实现保持一致)
236
+ export interface MarkerOptions {
237
+ position: OverlayPosition;
238
+ pixelSize?: number;
239
+ color?: any | string;
240
+ outlineColor?: any | string;
241
+ outlineWidth?: number;
242
+ heightReference?: any;
243
+ scaleByDistance?: Cesium.NearFarScalar;
244
+ disableDepthTestDistance?: number;
245
+ onClick?: (entity: Entity) => void;
246
+ id?: string;
247
+ }
248
+
249
+ export interface LabelOptions {
250
+ position: OverlayPosition;
251
+ text: string;
252
+ font?: string;
253
+ fillColor?: any | string;
254
+ outlineColor?: any | string;
255
+ outlineWidth?: number;
256
+ style?: any;
257
+ pixelOffset?: Cesium.Cartesian2;
258
+ eyeOffset?: Cesium.Cartesian3;
259
+ horizontalOrigin?: any;
260
+ verticalOrigin?: any;
261
+ heightReference?: any;
262
+ scale?: number;
263
+ showBackground?: boolean;
264
+ backgroundColor?: any | string;
265
+ backgroundPadding?: Cesium.Cartesian2;
266
+ disableDepthTestDistance?: number;
267
+ onClick?: (entity: Entity) => void;
268
+ id?: string;
269
+ }
270
+
271
+ export interface IconOptions {
272
+ position: OverlayPosition;
273
+ image: string;
274
+ width?: number;
275
+ height?: number;
276
+ scale?: number;
277
+ rotation?: number;
278
+ pixelOffset?: Cesium.Cartesian2;
279
+ eyeOffset?: Cesium.Cartesian3;
280
+ horizontalOrigin?: any;
281
+ verticalOrigin?: any;
282
+ heightReference?: any;
283
+ disableDepthTestDistance?: number;
284
+ color?: any | string;
285
+ onClick?: (entity: Entity) => void;
286
+ id?: string;
287
+ }
288
+
289
+ export interface SvgOptions {
290
+ position: OverlayPosition;
291
+ svg: string;
292
+ width?: number;
293
+ height?: number;
294
+ scale?: number;
295
+ rotation?: number;
296
+ pixelOffset?: Cesium.Cartesian2;
297
+ eyeOffset?: Cesium.Cartesian3;
298
+ horizontalOrigin?: any;
299
+ verticalOrigin?: any;
300
+ heightReference?: any;
301
+ disableDepthTestDistance?: number;
302
+ color?: any | string;
303
+ onClick?: (entity: Entity) => void;
304
+ id?: string;
305
+ }
306
+
307
+ export interface PolylineOptions {
308
+ positions: OverlayPosition[];
309
+ width?: number;
310
+ material?: Cesium.MaterialProperty | any | string;
311
+ clampToGround?: boolean;
312
+ onClick?: (entity: Entity) => void;
313
+ id?: string;
314
+ }
315
+
316
+ export interface PolygonOptions {
317
+ positions: OverlayPosition[];
318
+ material?: Cesium.MaterialProperty | any | string;
319
+ outline?: boolean;
320
+ outlineColor?: any | string;
321
+ outlineWidth?: number;
322
+ heightReference?: any;
323
+ extrudedHeight?: number;
324
+ onClick?: (entity: Entity) => void;
325
+ id?: string;
326
+ }
327
+
328
+ export interface RectangleOptions {
329
+ coordinates: Cesium.Rectangle;
330
+ material?: Cesium.MaterialProperty | any | string;
331
+ outline?: boolean;
332
+ outlineColor?: any | string;
333
+ outlineWidth?: number;
334
+ heightReference?: any;
335
+ extrudedHeight?: number;
336
+ onClick?: (entity: Entity) => void;
337
+ id?: string;
338
+ }
339
+
340
+ export interface CircleOptions {
341
+ position: OverlayPosition;
342
+ radius: number;
343
+ material?: Cesium.MaterialProperty | any | string;
344
+ outline?: boolean;
345
+ outlineColor?: any | string;
346
+ outlineWidth?: number;
347
+ heightReference?: any;
348
+ extrudedHeight?: number;
349
+ onClick?: (entity: Entity) => void;
350
+ id?: string;
351
+ }
352
+
231
353
  export declare class CesiumOverlayService {
232
354
  constructor(viewer: Viewer);
233
355
  addMarker(options: any): any; // 返回 Cesium.Entity
@@ -249,6 +371,64 @@ export declare class CesiumOverlayService {
249
371
  destroy(): void;
250
372
  }
251
373
 
374
+ // Overlay: 工具类声明(只暴露主要方法)
375
+ export declare class MapMarker {
376
+ constructor(viewer: Viewer);
377
+ add(options: MarkerOptions): Entity;
378
+ updatePosition(entity: Entity, position: OverlayPosition): void;
379
+ updateStyle(entity: Entity, options: Partial<Pick<MarkerOptions, 'color' | 'outlineColor' | 'outlineWidth' | 'pixelSize'>>): void;
380
+ }
381
+
382
+ export declare class MapLabel {
383
+ constructor(viewer: Viewer);
384
+ add(options: LabelOptions): Entity;
385
+ updatePosition(entity: Entity, position: OverlayPosition): void;
386
+ }
387
+
388
+ export declare class MapIcon {
389
+ constructor(viewer: Viewer);
390
+ add(options: IconOptions): Entity;
391
+ updatePosition(entity: Entity, position: OverlayPosition): void;
392
+ updateImage(entity: Entity, image: string): void;
393
+ }
394
+
395
+ export declare class MapSVG {
396
+ constructor(viewer: Viewer);
397
+ add(options: SvgOptions): Entity;
398
+ updatePosition(entity: Entity, position: OverlayPosition): void;
399
+ }
400
+
401
+ export declare class MapPolyline {
402
+ constructor(viewer: Viewer);
403
+ add(options: PolylineOptions): Entity;
404
+ updatePositions(entity: Entity, positions: OverlayPosition[]): void;
405
+ updateStyle(entity: Entity, options: Partial<Pick<PolylineOptions, 'width' | 'material'>>): void;
406
+ }
407
+
408
+ export declare class MapPolygon {
409
+ constructor(viewer: Viewer);
410
+ add(options: PolygonOptions): Entity;
411
+ updatePositions(entity: Entity, positions: OverlayPosition[]): void;
412
+ updateStyle(entity: Entity, options: Partial<Pick<PolygonOptions, 'material' | 'outline' | 'outlineColor' | 'outlineWidth'>>): void;
413
+ remove(entityOrId: Entity | string): boolean;
414
+ }
415
+
416
+ export declare class MapRectangle {
417
+ constructor(viewer: Viewer);
418
+ add(options: RectangleOptions): Entity;
419
+ updateCoordinates(entity: Entity, coordinates: Cesium.Rectangle): void;
420
+ updateStyle(entity: Entity, options: Partial<Pick<RectangleOptions, 'material' | 'outline' | 'outlineColor' | 'outlineWidth'>>): void;
421
+ remove(entityOrId: Entity | string): boolean;
422
+ }
423
+
424
+ export declare class MapCircle {
425
+ constructor(viewer: Viewer);
426
+ add(options: CircleOptions): Entity;
427
+ updatePosition(entity: Entity, position: OverlayPosition): void;
428
+ updateRadius(entity: Entity, radius: number): void;
429
+ updateStyle(entity: Entity, options: Partial<Pick<CircleOptions, 'material' | 'outline' | 'outlineColor' | 'outlineWidth'>>): void;
430
+ }
431
+
252
432
  // 绘制相关类型(与内部实现保持一致)
253
433
  export interface DrawOptions {
254
434
  strokeColor?: any | string;
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xingm/vmap-cesium-toolbar",
3
- "version": "0.0.2-alpha.3",
3
+ "version": "0.0.2-alpha.4",
4
4
  "description": "A powerful Cesium map toolbar plugin with drawing, measurement, and interaction features",
5
5
  "type": "module",
6
6
  "main": "index.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xingm/vmap-cesium-toolbar",
3
- "version": "0.0.2-alpha.4",
3
+ "version": "0.0.2-alpha.5",
4
4
  "description": "A powerful Cesium map toolbar plugin with drawing, measurement, and interaction features",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",