@vesium/plot 1.0.1-beta.46 → 1.0.1-beta.48

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
@@ -287,7 +287,7 @@ export declare type SampledPlotInterpolationAlgorithm<D = any> = (time: JulianDa
287
287
  * 标绘采集到的数据
288
288
  */
289
289
  export declare interface SampledPlotPackable<D = any> {
290
- time: JulianDate;
290
+ time?: JulianDate;
291
291
  positions?: Cartesian3[];
292
292
  derivative?: D;
293
293
  }
@@ -316,7 +316,7 @@ export declare class SampledPlotProperty<D = any> {
316
316
  * @returns 插值后的样本点数据,存储在提供的或新创建的result容器中。
317
317
  * @template D 数据类型。
318
318
  */
319
- getValue(time: JulianDate, result?: SampledPlotPackable): SampledPlotPackable<D>;
319
+ getValue(time?: JulianDate, result?: SampledPlotPackable): SampledPlotPackable<D>;
320
320
  /**
321
321
  * 设置样本数据
322
322
  *
@@ -379,6 +379,11 @@ export declare const schemePolygon: PlotScheme;
379
379
  */
380
380
  export declare const schemePolyline: PlotScheme;
381
381
 
382
+ /**
383
+ * 内置的多边形标绘方案
384
+ */
385
+ export declare const schemeRectangle: PlotScheme;
386
+
382
387
  export declare interface SkeletonDisabledOptions {
383
388
  /**
384
389
  * 当前标绘是否是否正在激活,即正在编辑状态
@@ -117,7 +117,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
117
117
  (_a = options == null ? void 0 : options.packables) == null ? void 0 : _a.forEach((packable) => this.setSample(packable));
118
118
  if (!this._times.length) {
119
119
  this.setSample({
120
- time: cesium.JulianDate.now(),
120
+ time: new cesium.JulianDate(0, 0),
121
121
  positions: [],
122
122
  derivative: void 0
123
123
  });
@@ -191,16 +191,16 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
191
191
  * @template D 数据类型。
192
192
  */
193
193
  getValue(time, result) {
194
- var _a, _b;
194
+ var _a;
195
195
  result ?? (result = { time });
196
196
  Object.assign(result, {
197
- time: time.clone(),
197
+ time: time == null ? void 0 : time.clone(),
198
198
  positions: void 0,
199
199
  derivative: void 0
200
200
  });
201
201
  if (!time) {
202
- result.time = (_a = this._times[0]) == null ? void 0 : _a.clone();
203
- result.positions = (_b = this._sampleds[0]) == null ? void 0 : _b.map((c) => c.clone(c));
202
+ result.time = this._times[0].clone();
203
+ result.positions = (_a = this._sampleds[0]) == null ? void 0 : _a.map((c) => c.clone(c));
204
204
  result.derivative = this._derivatives[0];
205
205
  return result;
206
206
  }
@@ -230,9 +230,9 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
230
230
  * @param value 样本数据对象,包含时间、位置和导数信息
231
231
  */
232
232
  setSample(value) {
233
- var _a;
234
- const time = value.time.clone();
235
- const positions = ((_a = value.positions) == null ? void 0 : _a.map((item) => item.clone())) ?? [];
233
+ var _a, _b;
234
+ const time = ((_a = value.time) == null ? void 0 : _a.clone()) ?? this._times[0].clone();
235
+ const positions = ((_b = value.positions) == null ? void 0 : _b.map((item) => item.clone())) ?? [];
236
236
  const derivative = value.derivative;
237
237
  const index = this._times.findIndex((t) => cesium.JulianDate.equals(time, t));
238
238
  if (index !== -1) {
@@ -859,8 +859,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
859
859
  const time = (options == null ? void 0 : options.time) || vue.shallowRef();
860
860
  const viewer = vesium.useViewer();
861
861
  const getCurrentTime = () => {
862
- var _a, _b, _c;
863
- return ((_a = time.value) == null ? void 0 : _a.clone()) || ((_c = (_b = viewer.value) == null ? void 0 : _b.clock.currentTime) == null ? void 0 : _c.clone()) || cesium.JulianDate.now();
862
+ var _a;
863
+ return ((_a = time.value) == null ? void 0 : _a.clone()) || new cesium.JulianDate(0, 0);
864
864
  };
865
865
  const collection = vue.shallowReactive(/* @__PURE__ */ new Set());
866
866
  const plots = vue.computed(() => Array.from(collection));
@@ -1431,6 +1431,41 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1431
1431
  }
1432
1432
  }
1433
1433
  );
1434
+ const schemeRectangle = new PlotScheme({
1435
+ type: "rectangle",
1436
+ complete: (packable) => packable.positions.length >= 2,
1437
+ skeletons: [
1438
+ control,
1439
+ interval,
1440
+ moved
1441
+ ],
1442
+ initEntites: () => [
1443
+ new cesium.Entity({
1444
+ rectangle: {
1445
+ material: cesium.Color.YELLOW.withAlpha(0.5)
1446
+ }
1447
+ })
1448
+ ],
1449
+ render(options) {
1450
+ var _a;
1451
+ const { mouse, packable } = options;
1452
+ const entity = ((_a = options.previous.entities) == null ? void 0 : _a[0]) ?? new cesium.Entity({
1453
+ rectangle: {
1454
+ material: cesium.Color.YELLOW.withAlpha(0.5)
1455
+ }
1456
+ });
1457
+ const positions = [...packable.positions ?? []];
1458
+ mouse && positions.push(mouse);
1459
+ if (positions.length >= 2) {
1460
+ entity.rectangle.coordinates = new cesium.CallbackProperty(() => cesium.Rectangle.fromCartesianArray(positions), false);
1461
+ } else {
1462
+ entity.rectangle.coordinates = void 0;
1463
+ }
1464
+ return {
1465
+ entities: [entity]
1466
+ };
1467
+ }
1468
+ });
1434
1469
  exports.PlotAction = PlotAction;
1435
1470
  exports.PlotFeature = PlotFeature;
1436
1471
  exports.PlotFeatureCollection = PlotFeatureCollection;
@@ -1447,6 +1482,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1447
1482
  exports.schemeMeasureArea = schemeMeasureArea;
1448
1483
  exports.schemePolygon = schemePolygon;
1449
1484
  exports.schemePolyline = schemePolyline;
1485
+ exports.schemeRectangle = schemeRectangle;
1450
1486
  exports.usePlot = usePlot;
1451
1487
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
1452
1488
  return exports;