@vesium/plot 1.0.1-beta.65 → 1.0.1-beta.70

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/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  <p align="center">
2
- <img src="https://github.com/vesiumjs/vesium/raw/main/assets/logo.svg" align="center" width="15%" />
2
+ <img src="https://github.com/vesiumjs/vesium/raw/main/assets/logo.svg" align="center" width="15%" alt="Vesium Logo" />
3
3
  </p>
4
4
 
5
5
  <h1 align="center">
package/dist/index.cjs CHANGED
@@ -1,4 +1,5 @@
1
- //#region rolldown:runtime
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ //#region \0rolldown/runtime.js
2
3
  var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -113,11 +114,11 @@ var PlotScheme = class PlotScheme {
113
114
 
114
115
  //#endregion
115
116
  //#region usePlot/SampledPlotProperty.ts
116
- let SampledPlotStrategy = /* @__PURE__ */ function(SampledPlotStrategy$1) {
117
- SampledPlotStrategy$1[SampledPlotStrategy$1["NEAR"] = 0] = "NEAR";
118
- SampledPlotStrategy$1[SampledPlotStrategy$1["CYCLE"] = 1] = "CYCLE";
119
- SampledPlotStrategy$1[SampledPlotStrategy$1["STRICT"] = 2] = "STRICT";
120
- return SampledPlotStrategy$1;
117
+ let SampledPlotStrategy = /* @__PURE__ */ function(SampledPlotStrategy) {
118
+ SampledPlotStrategy[SampledPlotStrategy["NEAR"] = 0] = "NEAR";
119
+ SampledPlotStrategy[SampledPlotStrategy["CYCLE"] = 1] = "CYCLE";
120
+ SampledPlotStrategy[SampledPlotStrategy["STRICT"] = 2] = "STRICT";
121
+ return SampledPlotStrategy;
121
122
  }({});
122
123
  /**
123
124
  * 默认插值算法
@@ -279,7 +280,7 @@ var SampledPlotProperty = class SampledPlotProperty {
279
280
  * @param value 样本数据对象,包含时间、位置和导数信息
280
281
  */
281
282
  setSample(value) {
282
- const time = value.time?.clone() ?? this._times[0].clone();
283
+ const time = value.time?.clone() ?? this._times[0]?.clone() ?? new cesium.JulianDate(0, 0);
283
284
  const positions = value.positions?.map((item) => item.clone()) ?? [];
284
285
  const derivative = value.derivative;
285
286
  const index = this._times.findIndex((t) => cesium.JulianDate.equals(time, t));
@@ -333,10 +334,10 @@ var SampledPlotProperty = class SampledPlotProperty {
333
334
  *
334
335
  * @param interval 要移除样本的时间间隔
335
336
  */
336
- removeSamples(interval$1) {
337
+ removeSamples(interval) {
337
338
  for (let i = 0; i < this._times.length; i++) {
338
339
  const time = this._times[i];
339
- cesium.TimeInterval.contains(interval$1, time) && this.removeSample(time);
340
+ cesium.TimeInterval.contains(interval, time) && this.removeSample(time);
340
341
  }
341
342
  }
342
343
  /**
@@ -358,10 +359,11 @@ var PlotFeature = class {
358
359
  this._id = id || (0, cesium.createGuid)();
359
360
  this._scheme = PlotScheme.resolve(options.scheme);
360
361
  this._definitionChanged = new cesium.Event();
361
- this._defining = true;
362
362
  this._disabled = disabled;
363
363
  this._sampled = sampled instanceof SampledPlotProperty ? sampled : new SampledPlotProperty(sampled);
364
364
  this._sampled.definitionChanged.addEventListener((property) => this._definitionChanged.raiseEvent(this, "sampled", property, property), this);
365
+ const packable = this._sampled.getValue();
366
+ this._defining = !(packable.positions && packable.positions.length > 0);
365
367
  const init = this._scheme.initRender?.() ?? {};
366
368
  this._entities = [...init.entities ?? []];
367
369
  this._primitives = [...init.primitives ?? []];
@@ -419,7 +421,10 @@ var PlotFeature = class {
419
421
  return this._disabled;
420
422
  }
421
423
  set disabled(value) {
422
- this.disabled = value;
424
+ if (this._disabled !== value) {
425
+ this._definitionChanged.raiseEvent(this, "disabled", value, this._disabled);
426
+ this._disabled = value;
427
+ }
423
428
  }
424
429
  /**
425
430
  * @internal
@@ -491,11 +496,11 @@ var PlotFeature = class {
491
496
  * - HOVER 悬停状态
492
497
  * - ACTIVE 激活状态
493
498
  */
494
- let PlotAction = /* @__PURE__ */ function(PlotAction$1) {
495
- PlotAction$1[PlotAction$1["IDLE"] = 0] = "IDLE";
496
- PlotAction$1[PlotAction$1["HOVER"] = 1] = "HOVER";
497
- PlotAction$1[PlotAction$1["ACTIVE"] = 2] = "ACTIVE";
498
- return PlotAction$1;
499
+ let PlotAction = /* @__PURE__ */ function(PlotAction) {
500
+ PlotAction[PlotAction["IDLE"] = 0] = "IDLE";
501
+ PlotAction[PlotAction["HOVER"] = 1] = "HOVER";
502
+ PlotAction[PlotAction["ACTIVE"] = 2] = "ACTIVE";
503
+ return PlotAction;
499
504
  }({});
500
505
  /**
501
506
  * 标绘框架点 Entity
@@ -847,8 +852,8 @@ function usePlot(options) {
847
852
  (0, vue.watch)(current, (plot, previous) => {
848
853
  if (previous) {
849
854
  if (previous.defining) {
850
- const packable$1 = previous.sampled.getValue(getCurrentTime());
851
- if (previous.scheme.allowManualComplete?.(packable$1)) {
855
+ const packable = previous.sampled.getValue(getCurrentTime());
856
+ if (previous.scheme.allowManualComplete?.(packable)) {
852
857
  PlotFeature.setDefining(previous, false);
853
858
  operateResolve?.(previous);
854
859
  } else collection.delete(previous);
@@ -932,9 +937,9 @@ function control() {
932
937
  const newHeading = (viewer.camera.heading + headingAdjust) % (2 * Math.PI);
933
938
  const positions = [...packable.positions ?? []];
934
939
  const cartographic = (0, vesium.toCartographic)(positions[index]);
935
- const distance$1 = height / 1e5 * Math.PI / 180 / 1e3;
936
- cartographic.latitude += distance$1 * Math.cos(newHeading);
937
- cartographic.longitude += distance$1 * Math.sin(newHeading);
940
+ const distance = height / 1e5 * Math.PI / 180 / 1e3;
941
+ cartographic.latitude += distance * Math.cos(newHeading);
942
+ cartographic.longitude += distance * Math.sin(newHeading);
938
943
  positions[index] = (0, vesium.toCartesian3)(cartographic);
939
944
  sampled.setSample({
940
945
  time: packable.time,
@@ -1345,9 +1350,9 @@ async function distance(positions, options) {
1345
1350
  positions.forEach((position, index) => {
1346
1351
  if (index !== positions.length - 1) {
1347
1352
  const next = positions[index + 1];
1348
- const distance$1 = cesium.Cartesian3.distance(position, next);
1349
- stages.push(distance$1);
1350
- count += distance$1;
1353
+ const distance = cesium.Cartesian3.distance(position, next);
1354
+ stages.push(distance);
1355
+ count += distance;
1351
1356
  }
1352
1357
  });
1353
1358
  if (!_options.clampToGround) return {
@@ -1359,27 +1364,27 @@ async function distance(positions, options) {
1359
1364
  const densities = stages.map((stage) => {
1360
1365
  return Math.floor(stage / count * density);
1361
1366
  });
1362
- const diff = density - densities.reduce((count$1, current) => count$1 += current, 0);
1367
+ const diff = density - densities.reduce((count, current) => count += current, 0);
1363
1368
  if (diff) densities[densities.length - 1] += diff;
1364
- const positionListPromises = densities.map((density$1, i) => {
1369
+ const positionListPromises = densities.map((density, i) => {
1365
1370
  return lerpArray({
1366
1371
  scene: _options.scene,
1367
1372
  start: positions[i],
1368
1373
  end: positions[i + 1],
1369
- count: density$1,
1374
+ count: density,
1370
1375
  clampToGround: true,
1371
1376
  classificationType: _options.classificationType,
1372
1377
  terrainProvider: _options.terrainProvider
1373
1378
  });
1374
1379
  });
1375
- const stagePromises = (await Promise.all(positionListPromises)).map(async (positions$1) => {
1376
- const { count: count$1 } = await distance(positions$1);
1377
- return count$1;
1380
+ const stagePromises = (await Promise.all(positionListPromises)).map(async (positions) => {
1381
+ const { count } = await distance(positions);
1382
+ return count;
1378
1383
  });
1379
1384
  const groundStages = await Promise.all(stagePromises);
1380
1385
  return {
1381
1386
  stages: groundStages,
1382
- count: groundStages.reduce((count$1, current) => count$1 += current, 0)
1387
+ count: groundStages.reduce((count, current) => count += current, 0)
1383
1388
  };
1384
1389
  }
1385
1390