@vesium/plot 1.0.1-beta.34 → 1.0.1-beta.37

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
@@ -2,11 +2,12 @@ import { Cartesian3 } from 'cesium';
2
2
  import { ComputedRef } from 'vue';
3
3
  import { CSSProperties } from 'vue';
4
4
  import { Entity } from 'cesium';
5
+ import { EntityCollection } from 'cesium';
5
6
  import { Event as Event_2 } from 'cesium';
6
7
  import { JulianDate } from 'cesium';
7
- import { MaybeRef } from '@vueuse/core';
8
- import { MaybeRef as MaybeRef_2 } from 'vue';
8
+ import { MaybeRef } from 'vue';
9
9
  import { Nullable } from '@vesium/shared';
10
+ import { PrimitiveCollection } from 'cesium';
10
11
  import { Property } from 'cesium';
11
12
  import { ScreenSpaceEventHandler } from 'cesium';
12
13
  import { ShallowRef } from 'vue';
@@ -14,7 +15,27 @@ import { TimeInterval } from 'cesium';
14
15
  import { Viewer } from 'cesium';
15
16
  import { VNode } from 'vue';
16
17
 
17
- declare interface OnKeyPressedOptions {
18
+ /**
19
+ * 绘制控制的框架点,拖拽时,将更新该控制点的实时位置
20
+ */
21
+ export declare function control(): PlotSkeleton;
22
+
23
+ /**
24
+ * 绘制封闭的间隔框架点,如多边形。拖拽时,会在两点之间插入一个控制点,并持续拖拽该点。
25
+ */
26
+ export declare function interval(): PlotSkeleton;
27
+
28
+ /**
29
+ * 绘制非封闭的间隔框架点,如线段。拖拽时,会在两点之间插入一个控制点,并持续拖拽该点。
30
+ */
31
+ export declare function intervalNonclosed(): PlotSkeleton;
32
+
33
+ /**
34
+ * 绘制非封闭的间隔框架点,如线段。拖拽时,会在两点之间插入一个控制点,并持续拖拽该点。
35
+ */
36
+ export declare function moved(): PlotSkeleton;
37
+
38
+ export declare interface OnKeyPressedOptions {
18
39
  viewer: Viewer;
19
40
  /**
20
41
  * 当前标绘属性数据
@@ -34,7 +55,7 @@ declare interface OnKeyPressedOptions {
34
55
  keyEvent: KeyboardEvent;
35
56
  }
36
57
 
37
- declare interface OnSkeletonClickOptions {
58
+ export declare interface OnSkeletonClickOptions {
38
59
  viewer: Viewer;
39
60
  /**
40
61
  * 当前标绘属性数据
@@ -59,10 +80,10 @@ declare interface OnSkeletonClickOptions {
59
80
  /**
60
81
  * 鼠标点击事件上下文信息
61
82
  */
62
- context: ScreenSpaceEventHandler.PositionedEvent;
83
+ event: ScreenSpaceEventHandler.PositionedEvent;
63
84
  }
64
85
 
65
- declare interface OnSkeletonDragOptions {
86
+ export declare interface OnSkeletonDragOptions {
66
87
  viewer: Viewer;
67
88
  /***
68
89
  * 当前标绘属性数据
@@ -83,7 +104,7 @@ declare interface OnSkeletonDragOptions {
83
104
  /**
84
105
  * 鼠标拖拽事件上下文信息
85
106
  */
86
- context: ScreenSpaceEventHandler.MotionEvent;
107
+ event: ScreenSpaceEventHandler.MotionEvent;
87
108
  /**
88
109
  * 当前的拖拽状态
89
110
  */
@@ -94,104 +115,63 @@ declare interface OnSkeletonDragOptions {
94
115
  lockCamera: () => void;
95
116
  }
96
117
 
97
- export declare class Plot {
98
- constructor(options: PlotConstructorOptions);
99
- /**
100
- * An event that is raised when a property is changed.
101
- */
102
- get definitionChanged(): Event_2<(scope: Plot, key: keyof Plot, newValue: Plot[typeof key], oldValue: Plot[typeof key]) => void>;
103
- time?: JulianDate;
104
- /**
105
- * A unique identifier for the plot.
106
- */
107
- id: string;
108
- /**
109
- * Whether the plot is disabled.
110
- */
111
- disabled: boolean;
112
- /**
113
- * The scheme for the plot.
114
- */
115
- readonly scheme: PlotScheme;
116
- /**
117
- * Sampled plot property.
118
- */
119
- sampled: SampledPlotProperty;
120
- /**
121
- * 当前标绘是否处于定义态
122
- */
123
- isDefining(): boolean;
124
- /**
125
- * 获取当前标绘的entity数组
126
- */
127
- getEntities(): Entity[];
128
- /**
129
- * 获取当前标绘的primitive数组
130
- */
131
- getPrimitives(): any[];
132
- /**
133
- * 获取当前标绘的贴地primitive数组
134
- */
135
- getGroundPrimitives(): any[];
136
- /**
137
- * 获取当前标绘标绘的骨架点entity数组
138
- */
139
- getSkeletonEntities(): PlotSkeletonEntity[];
140
- }
141
-
142
- /**
143
- * 广告牌标绘方案
144
- */
145
- export declare const PLOT_BILLBOARD_SCHEME: PlotConstructorOptions;
146
-
147
- /**
148
- * 标签文字标绘方案
149
- */
150
- export declare const PLOT_LABEL_SCHEME: PlotConstructorOptions;
151
-
152
- /**
153
- * 内置的线段标绘方案
154
- */
155
- export declare const PLOT_LINE_STRING_SCHEME: PlotConstructorOptions;
156
-
157
- /**
158
- * 内置的多边形标绘方案
159
- */
160
- export declare const PLOT_POLYGON_SCHEME: PlotConstructorOptions;
161
-
162
118
  /**
163
119
  * 框架点执行状态枚举
164
120
  * - IDLE 空闲状态
165
121
  * - HOVER 悬停状态
166
122
  * - ACTIVE 激活状态
167
123
  */
168
- declare enum PlotAction {
124
+ export declare enum PlotAction {
169
125
  IDLE = 0,
170
126
  HOVER = 1,
171
127
  ACTIVE = 2
172
128
  }
173
129
 
174
- /**
175
- * Options for constructing a Plot instance.
176
- */
177
- export declare interface PlotConstructorOptions {
178
- /**
179
- * A unique identifier for the plot.
180
- */
130
+ export declare type PlotCollectionChanged = (scope: PlotFeatureCollection, added: PlotFeature[], removed: PlotFeature[]) => void;
131
+
132
+ export declare interface PlotCollectionConstructorOptions {
133
+ id?: string;
134
+ }
135
+
136
+ export declare type PlotDefinitionChangedCallback = (scope: PlotFeature, key: keyof PlotFeature, newValue: PlotFeature[typeof key], oldValue: PlotFeature[typeof key]) => void;
137
+
138
+ export declare class PlotFeature {
139
+ constructor(options: PlotFeatureConstructorOptions);
140
+ get id(): string;
141
+ get scheme(): PlotScheme;
142
+ get definitionChanged(): Event_2<PlotDefinitionChangedCallback>;
143
+ get defining(): boolean;
144
+ private _disabled;
145
+ get disabled(): boolean;
146
+ set disabled(value: string);
147
+ get sampled(): SampledPlotProperty;
148
+ get entities(): Entity[];
149
+ set entities(value: Entity[]);
150
+ get primitives(): any[];
151
+ get groundPrimitives(): any[];
152
+ get skeletons(): PlotSkeletonEntity[];
153
+ }
154
+
155
+ export declare class PlotFeatureCollection {
156
+ constructor(options?: PlotCollectionConstructorOptions);
157
+ get id(): string;
158
+ get collectionChanged(): Event_2<PlotCollectionChanged>;
159
+ get values(): PlotFeature[];
160
+ add(value: PlotFeature): boolean;
161
+ remove(value: PlotFeature): boolean;
162
+ get entities(): EntityCollection;
163
+ get primitives(): PrimitiveCollection;
164
+ get groundPrimitives(): PrimitiveCollection;
165
+ get skeletons(): EntityCollection;
166
+ isDestroyed(): boolean;
167
+ destroy(): void;
168
+ }
169
+
170
+ export declare interface PlotFeatureConstructorOptions {
181
171
  id?: string;
182
- /**
183
- * Whether the plot is disabled.
184
- */
185
- disabled?: boolean;
186
- /**
187
- * The scheme for the plot.
188
- * If it is a string, it will attempt to retrieve the corresponding `PlotScheme.type` object from the cache internally.
189
- */
190
172
  scheme: string | PlotScheme | PlotSchemeConstructorOptions;
191
- /**
192
- * Sampled plot property.
193
- */
194
173
  sampled?: SampledPlotProperty | SampledPlotPropertyConstructorOptions;
174
+ disabled?: boolean;
195
175
  }
196
176
 
197
177
  export declare interface PlotRenderOptions<D = any> {
@@ -221,60 +201,40 @@ export declare class PlotScheme {
221
201
  */
222
202
  forceComplete?: (packable: SampledPlotPackable) => boolean;
223
203
  /**
224
- * 处于定义态时的鼠标样式
225
204
  * @default 'crosshair'
226
205
  */
227
- definingCursor?: MaybeRef<Nullable<CSSProperties['cursor']>> | ((packable: SampledPlotPackable) => Nullable<CSSProperties['cursor']>);
228
- /**
229
- * 框架点渲染配置
230
- */
206
+ definingCursor?: Nullable<CSSProperties['cursor']> | ((packable: SampledPlotPackable) => Nullable<CSSProperties['cursor']>);
231
207
  skeletons: PlotSkeleton[];
232
- /**
233
- */
208
+ initEntites?: () => (Entity[] | undefined);
209
+ initPrimitives?: () => (any[] | undefined);
210
+ initGroundPrimitives?: () => (any[] | undefined);
234
211
  render?: (options: PlotRenderOptions) => PlotRenderResult | Promise<PlotRenderResult>;
212
+ private static _record;
235
213
  static getCacheTypes(): string[];
236
214
  static getCache(type: string): PlotScheme | undefined;
237
- /**
238
- * 设置标绘方案
239
- * @param scheme
240
- */
241
215
  static setCache(scheme: PlotScheme): void;
242
- /**
243
- * 解析传入的 scheme,并返回 PlotScheme 实例
244
- */
245
216
  static resolve(maybeScheme: string | PlotScheme | PlotSchemeConstructorOptions): PlotScheme;
246
217
  }
247
218
 
248
219
  export declare interface PlotSchemeConstructorOptions {
249
220
  type: string;
250
- /**
251
- * 是否立即执行完成标绘操作
252
- * 每次控制点发生变变化时,执行该回调函数,如果返回`true`则标绘完成
253
- */
254
221
  complete?: (packable: SampledPlotPackable) => boolean;
255
- /**
256
- * 双击时,是否执行完成标绘操作
257
- * 每次控制点发生变变化时,执行该回调函数,如果返回 true 则下一次双击事件执行完成
258
- */
259
222
  forceComplete?: (packable: SampledPlotPackable) => boolean;
260
223
  /**
261
- * 处于定义态时的鼠标样式
262
224
  * @default 'crosshair'
263
225
  */
264
- definingCursor?: MaybeRef<Nullable<CSSProperties['cursor']>> | ((packable: SampledPlotPackable) => Nullable<CSSProperties['cursor']>);
265
- /**
266
- * 框架点渲染配置
267
- */
226
+ definingCursor?: Nullable<CSSProperties['cursor']> | ((packable: SampledPlotPackable) => Nullable<CSSProperties['cursor']>);
268
227
  skeletons?: (() => PlotSkeleton)[];
269
- /**
270
- */
228
+ initEntites?: () => (Entity[] | undefined);
229
+ initPrimitives?: () => (any[] | undefined);
230
+ initGroundPrimitives?: () => (any[] | undefined);
271
231
  render?: (options: PlotRenderOptions) => PlotRenderResult | Promise<PlotRenderResult>;
272
232
  }
273
233
 
274
234
  /**
275
235
  * 控制点配置项
276
236
  */
277
- declare interface PlotSkeleton {
237
+ export declare interface PlotSkeleton {
278
238
  /**
279
239
  * 是否禁用控制点
280
240
  */
@@ -291,11 +251,11 @@ declare interface PlotSkeleton {
291
251
  /**
292
252
  * Cursor style when hovering.
293
253
  */
294
- cursor?: MaybeRef_2<Nullable<CSSProperties['cursor']>> | ((pick: any) => Nullable<CSSProperties['cursor']>);
254
+ cursor?: MaybeRef<Nullable<CSSProperties['cursor']>> | ((pick: any) => Nullable<CSSProperties['cursor']>);
295
255
  /**
296
256
  * Cursor style when dragging.
297
257
  */
298
- dragCursor?: MaybeRef_2<Nullable<CSSProperties['cursor']>> | ((pick: any) => Nullable<CSSProperties['cursor']>);
258
+ dragCursor?: MaybeRef<Nullable<CSSProperties['cursor']>> | ((pick: any) => Nullable<CSSProperties['cursor']>);
299
259
  /**
300
260
  * 鼠标悬停在框架点时显示的提示信息
301
261
  */
@@ -317,7 +277,7 @@ declare interface PlotSkeleton {
317
277
  /**
318
278
  * 标绘框架点 Entity
319
279
  */
320
- declare class PlotSkeletonEntity extends Entity {
280
+ export declare class PlotSkeletonEntity extends Entity {
321
281
  constructor(options: Entity.ConstructorOptions);
322
282
  }
323
283
 
@@ -397,7 +357,29 @@ export declare enum SampledPlotStrategy {
397
357
  STRICT = 2
398
358
  }
399
359
 
400
- declare interface SkeletonDisabledOptions {
360
+ /**
361
+ * 广告牌标绘方案
362
+ */
363
+ export declare const schemeBillboard: PlotScheme;
364
+
365
+ /**
366
+ * 标签文字标绘方案
367
+ */
368
+ export declare const schemeLabel: PlotScheme;
369
+
370
+ export declare const schemeMeasureArea: PlotScheme;
371
+
372
+ /**
373
+ * 内置的多边形标绘方案
374
+ */
375
+ export declare const schemePolygon: PlotScheme;
376
+
377
+ /**
378
+ * 内置的线段标绘方案
379
+ */
380
+ export declare const schemePolyline: PlotScheme;
381
+
382
+ export declare interface SkeletonDisabledOptions {
401
383
  /**
402
384
  * 当前标绘是否是否正在激活,即正在编辑状态
403
385
  */
@@ -408,7 +390,7 @@ declare interface SkeletonDisabledOptions {
408
390
  defining: boolean;
409
391
  }
410
392
 
411
- declare interface SkeletonRenderOptions {
393
+ export declare interface SkeletonRenderOptions {
412
394
  /**
413
395
  * 标绘采集到的数据,通过该数据可以获取到当前标绘的所有点位信息
414
396
  */
@@ -440,14 +422,14 @@ declare interface SkeletonRenderOptions {
440
422
  }
441
423
 
442
424
  export declare function usePlot(options?: UsePlotOptions): {
443
- plots: ComputedRef<Plot[]>;
425
+ plots: ComputedRef<PlotFeature[]>;
444
426
  time: ShallowRef<JulianDate | undefined>;
445
427
  operate: UsePlotOperate;
446
- remove: (plot: Plot) => boolean;
428
+ remove: (plot: PlotFeature) => boolean;
447
429
  cancel: (() => void) | undefined;
448
430
  };
449
431
 
450
- export declare type UsePlotOperate = (plot: Plot | PlotConstructorOptions) => Promise<Plot>;
432
+ export declare type UsePlotOperate = (plot: PlotFeature | PlotFeatureConstructorOptions) => Promise<PlotFeature>;
451
433
 
452
434
  export declare interface UsePlotOptions {
453
435
  time?: ShallowRef<JulianDate | undefined>;
@@ -455,8 +437,8 @@ export declare interface UsePlotOptions {
455
437
 
456
438
  export declare interface UsePlotRetrun {
457
439
  time: ShallowRef<JulianDate | undefined>;
458
- data?: ShallowRef<Plot[]>;
459
- current?: ShallowRef<Plot | undefined>;
440
+ data?: ShallowRef<PlotFeature[]>;
441
+ current?: ShallowRef<PlotFeature | undefined>;
460
442
  /**
461
443
  * 触发标绘
462
444
  */