@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 +1 -1
- package/dist/index.cjs +36 -31
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -5
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +5 -5
- package/dist/index.d.mts.map +1 -1
- package/dist/index.iife.js +36 -31
- package/dist/index.iife.js.map +1 -1
- package/dist/index.iife.min.js +1 -1
- package/dist/index.iife.min.js.map +1 -1
- package/dist/index.min.cjs +1 -1
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.mjs +1 -1
- package/dist/index.min.mjs.map +1 -1
- package/dist/index.mjs +34 -30
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -7
package/dist/index.mjs
CHANGED
|
@@ -85,11 +85,11 @@ var PlotScheme = class PlotScheme {
|
|
|
85
85
|
|
|
86
86
|
//#endregion
|
|
87
87
|
//#region usePlot/SampledPlotProperty.ts
|
|
88
|
-
let SampledPlotStrategy = /* @__PURE__ */ function(SampledPlotStrategy
|
|
89
|
-
SampledPlotStrategy
|
|
90
|
-
SampledPlotStrategy
|
|
91
|
-
SampledPlotStrategy
|
|
92
|
-
return SampledPlotStrategy
|
|
88
|
+
let SampledPlotStrategy = /* @__PURE__ */ function(SampledPlotStrategy) {
|
|
89
|
+
SampledPlotStrategy[SampledPlotStrategy["NEAR"] = 0] = "NEAR";
|
|
90
|
+
SampledPlotStrategy[SampledPlotStrategy["CYCLE"] = 1] = "CYCLE";
|
|
91
|
+
SampledPlotStrategy[SampledPlotStrategy["STRICT"] = 2] = "STRICT";
|
|
92
|
+
return SampledPlotStrategy;
|
|
93
93
|
}({});
|
|
94
94
|
/**
|
|
95
95
|
* 默认插值算法
|
|
@@ -251,7 +251,7 @@ var SampledPlotProperty = class SampledPlotProperty {
|
|
|
251
251
|
* @param value 样本数据对象,包含时间、位置和导数信息
|
|
252
252
|
*/
|
|
253
253
|
setSample(value) {
|
|
254
|
-
const time = value.time?.clone() ?? this._times[0]
|
|
254
|
+
const time = value.time?.clone() ?? this._times[0]?.clone() ?? new JulianDate(0, 0);
|
|
255
255
|
const positions = value.positions?.map((item) => item.clone()) ?? [];
|
|
256
256
|
const derivative = value.derivative;
|
|
257
257
|
const index = this._times.findIndex((t) => JulianDate.equals(time, t));
|
|
@@ -305,10 +305,10 @@ var SampledPlotProperty = class SampledPlotProperty {
|
|
|
305
305
|
*
|
|
306
306
|
* @param interval 要移除样本的时间间隔
|
|
307
307
|
*/
|
|
308
|
-
removeSamples(interval
|
|
308
|
+
removeSamples(interval) {
|
|
309
309
|
for (let i = 0; i < this._times.length; i++) {
|
|
310
310
|
const time = this._times[i];
|
|
311
|
-
TimeInterval.contains(interval
|
|
311
|
+
TimeInterval.contains(interval, time) && this.removeSample(time);
|
|
312
312
|
}
|
|
313
313
|
}
|
|
314
314
|
/**
|
|
@@ -330,10 +330,11 @@ var PlotFeature = class {
|
|
|
330
330
|
this._id = id || createGuid();
|
|
331
331
|
this._scheme = PlotScheme.resolve(options.scheme);
|
|
332
332
|
this._definitionChanged = new Event();
|
|
333
|
-
this._defining = true;
|
|
334
333
|
this._disabled = disabled;
|
|
335
334
|
this._sampled = sampled instanceof SampledPlotProperty ? sampled : new SampledPlotProperty(sampled);
|
|
336
335
|
this._sampled.definitionChanged.addEventListener((property) => this._definitionChanged.raiseEvent(this, "sampled", property, property), this);
|
|
336
|
+
const packable = this._sampled.getValue();
|
|
337
|
+
this._defining = !(packable.positions && packable.positions.length > 0);
|
|
337
338
|
const init = this._scheme.initRender?.() ?? {};
|
|
338
339
|
this._entities = [...init.entities ?? []];
|
|
339
340
|
this._primitives = [...init.primitives ?? []];
|
|
@@ -391,7 +392,10 @@ var PlotFeature = class {
|
|
|
391
392
|
return this._disabled;
|
|
392
393
|
}
|
|
393
394
|
set disabled(value) {
|
|
394
|
-
this.
|
|
395
|
+
if (this._disabled !== value) {
|
|
396
|
+
this._definitionChanged.raiseEvent(this, "disabled", value, this._disabled);
|
|
397
|
+
this._disabled = value;
|
|
398
|
+
}
|
|
395
399
|
}
|
|
396
400
|
/**
|
|
397
401
|
* @internal
|
|
@@ -463,11 +467,11 @@ var PlotFeature = class {
|
|
|
463
467
|
* - HOVER 悬停状态
|
|
464
468
|
* - ACTIVE 激活状态
|
|
465
469
|
*/
|
|
466
|
-
let PlotAction = /* @__PURE__ */ function(PlotAction
|
|
467
|
-
PlotAction
|
|
468
|
-
PlotAction
|
|
469
|
-
PlotAction
|
|
470
|
-
return PlotAction
|
|
470
|
+
let PlotAction = /* @__PURE__ */ function(PlotAction) {
|
|
471
|
+
PlotAction[PlotAction["IDLE"] = 0] = "IDLE";
|
|
472
|
+
PlotAction[PlotAction["HOVER"] = 1] = "HOVER";
|
|
473
|
+
PlotAction[PlotAction["ACTIVE"] = 2] = "ACTIVE";
|
|
474
|
+
return PlotAction;
|
|
471
475
|
}({});
|
|
472
476
|
/**
|
|
473
477
|
* 标绘框架点 Entity
|
|
@@ -819,8 +823,8 @@ function usePlot(options) {
|
|
|
819
823
|
watch(current, (plot, previous) => {
|
|
820
824
|
if (previous) {
|
|
821
825
|
if (previous.defining) {
|
|
822
|
-
const packable
|
|
823
|
-
if (previous.scheme.allowManualComplete?.(packable
|
|
826
|
+
const packable = previous.sampled.getValue(getCurrentTime());
|
|
827
|
+
if (previous.scheme.allowManualComplete?.(packable)) {
|
|
824
828
|
PlotFeature.setDefining(previous, false);
|
|
825
829
|
operateResolve?.(previous);
|
|
826
830
|
} else collection.delete(previous);
|
|
@@ -904,9 +908,9 @@ function control() {
|
|
|
904
908
|
const newHeading = (viewer.camera.heading + headingAdjust) % (2 * Math.PI);
|
|
905
909
|
const positions = [...packable.positions ?? []];
|
|
906
910
|
const cartographic = toCartographic(positions[index]);
|
|
907
|
-
const distance
|
|
908
|
-
cartographic.latitude += distance
|
|
909
|
-
cartographic.longitude += distance
|
|
911
|
+
const distance = height / 1e5 * Math.PI / 180 / 1e3;
|
|
912
|
+
cartographic.latitude += distance * Math.cos(newHeading);
|
|
913
|
+
cartographic.longitude += distance * Math.sin(newHeading);
|
|
910
914
|
positions[index] = toCartesian3(cartographic);
|
|
911
915
|
sampled.setSample({
|
|
912
916
|
time: packable.time,
|
|
@@ -1317,9 +1321,9 @@ async function distance(positions, options) {
|
|
|
1317
1321
|
positions.forEach((position, index) => {
|
|
1318
1322
|
if (index !== positions.length - 1) {
|
|
1319
1323
|
const next = positions[index + 1];
|
|
1320
|
-
const distance
|
|
1321
|
-
stages.push(distance
|
|
1322
|
-
count += distance
|
|
1324
|
+
const distance = Cartesian3.distance(position, next);
|
|
1325
|
+
stages.push(distance);
|
|
1326
|
+
count += distance;
|
|
1323
1327
|
}
|
|
1324
1328
|
});
|
|
1325
1329
|
if (!_options.clampToGround) return {
|
|
@@ -1331,27 +1335,27 @@ async function distance(positions, options) {
|
|
|
1331
1335
|
const densities = stages.map((stage) => {
|
|
1332
1336
|
return Math.floor(stage / count * density);
|
|
1333
1337
|
});
|
|
1334
|
-
const diff = density - densities.reduce((count
|
|
1338
|
+
const diff = density - densities.reduce((count, current) => count += current, 0);
|
|
1335
1339
|
if (diff) densities[densities.length - 1] += diff;
|
|
1336
|
-
const positionListPromises = densities.map((density
|
|
1340
|
+
const positionListPromises = densities.map((density, i) => {
|
|
1337
1341
|
return lerpArray({
|
|
1338
1342
|
scene: _options.scene,
|
|
1339
1343
|
start: positions[i],
|
|
1340
1344
|
end: positions[i + 1],
|
|
1341
|
-
count: density
|
|
1345
|
+
count: density,
|
|
1342
1346
|
clampToGround: true,
|
|
1343
1347
|
classificationType: _options.classificationType,
|
|
1344
1348
|
terrainProvider: _options.terrainProvider
|
|
1345
1349
|
});
|
|
1346
1350
|
});
|
|
1347
|
-
const stagePromises = (await Promise.all(positionListPromises)).map(async (positions
|
|
1348
|
-
const { count
|
|
1349
|
-
return count
|
|
1351
|
+
const stagePromises = (await Promise.all(positionListPromises)).map(async (positions) => {
|
|
1352
|
+
const { count } = await distance(positions);
|
|
1353
|
+
return count;
|
|
1350
1354
|
});
|
|
1351
1355
|
const groundStages = await Promise.all(stagePromises);
|
|
1352
1356
|
return {
|
|
1353
1357
|
stages: groundStages,
|
|
1354
|
-
count: groundStages.reduce((count
|
|
1358
|
+
count: groundStages.reduce((count, current) => count += current, 0)
|
|
1355
1359
|
};
|
|
1356
1360
|
}
|
|
1357
1361
|
|