@vesium/plot 1.0.1-beta.64 → 1.0.1-beta.68
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.cjs +27 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.iife.js +27 -27
- package/dist/index.iife.js.map +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.map +1 -1
- package/dist/index.mjs +27 -27
- 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
|
* 默认插值算法
|
|
@@ -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
|
/**
|
|
@@ -463,11 +463,11 @@ var PlotFeature = class {
|
|
|
463
463
|
* - HOVER 悬停状态
|
|
464
464
|
* - ACTIVE 激活状态
|
|
465
465
|
*/
|
|
466
|
-
let PlotAction = /* @__PURE__ */ function(PlotAction
|
|
467
|
-
PlotAction
|
|
468
|
-
PlotAction
|
|
469
|
-
PlotAction
|
|
470
|
-
return PlotAction
|
|
466
|
+
let PlotAction = /* @__PURE__ */ function(PlotAction) {
|
|
467
|
+
PlotAction[PlotAction["IDLE"] = 0] = "IDLE";
|
|
468
|
+
PlotAction[PlotAction["HOVER"] = 1] = "HOVER";
|
|
469
|
+
PlotAction[PlotAction["ACTIVE"] = 2] = "ACTIVE";
|
|
470
|
+
return PlotAction;
|
|
471
471
|
}({});
|
|
472
472
|
/**
|
|
473
473
|
* 标绘框架点 Entity
|
|
@@ -819,8 +819,8 @@ function usePlot(options) {
|
|
|
819
819
|
watch(current, (plot, previous) => {
|
|
820
820
|
if (previous) {
|
|
821
821
|
if (previous.defining) {
|
|
822
|
-
const packable
|
|
823
|
-
if (previous.scheme.allowManualComplete?.(packable
|
|
822
|
+
const packable = previous.sampled.getValue(getCurrentTime());
|
|
823
|
+
if (previous.scheme.allowManualComplete?.(packable)) {
|
|
824
824
|
PlotFeature.setDefining(previous, false);
|
|
825
825
|
operateResolve?.(previous);
|
|
826
826
|
} else collection.delete(previous);
|
|
@@ -904,9 +904,9 @@ function control() {
|
|
|
904
904
|
const newHeading = (viewer.camera.heading + headingAdjust) % (2 * Math.PI);
|
|
905
905
|
const positions = [...packable.positions ?? []];
|
|
906
906
|
const cartographic = toCartographic(positions[index]);
|
|
907
|
-
const distance
|
|
908
|
-
cartographic.latitude += distance
|
|
909
|
-
cartographic.longitude += distance
|
|
907
|
+
const distance = height / 1e5 * Math.PI / 180 / 1e3;
|
|
908
|
+
cartographic.latitude += distance * Math.cos(newHeading);
|
|
909
|
+
cartographic.longitude += distance * Math.sin(newHeading);
|
|
910
910
|
positions[index] = toCartesian3(cartographic);
|
|
911
911
|
sampled.setSample({
|
|
912
912
|
time: packable.time,
|
|
@@ -1317,9 +1317,9 @@ async function distance(positions, options) {
|
|
|
1317
1317
|
positions.forEach((position, index) => {
|
|
1318
1318
|
if (index !== positions.length - 1) {
|
|
1319
1319
|
const next = positions[index + 1];
|
|
1320
|
-
const distance
|
|
1321
|
-
stages.push(distance
|
|
1322
|
-
count += distance
|
|
1320
|
+
const distance = Cartesian3.distance(position, next);
|
|
1321
|
+
stages.push(distance);
|
|
1322
|
+
count += distance;
|
|
1323
1323
|
}
|
|
1324
1324
|
});
|
|
1325
1325
|
if (!_options.clampToGround) return {
|
|
@@ -1331,27 +1331,27 @@ async function distance(positions, options) {
|
|
|
1331
1331
|
const densities = stages.map((stage) => {
|
|
1332
1332
|
return Math.floor(stage / count * density);
|
|
1333
1333
|
});
|
|
1334
|
-
const diff = density - densities.reduce((count
|
|
1334
|
+
const diff = density - densities.reduce((count, current) => count += current, 0);
|
|
1335
1335
|
if (diff) densities[densities.length - 1] += diff;
|
|
1336
|
-
const positionListPromises = densities.map((density
|
|
1336
|
+
const positionListPromises = densities.map((density, i) => {
|
|
1337
1337
|
return lerpArray({
|
|
1338
1338
|
scene: _options.scene,
|
|
1339
1339
|
start: positions[i],
|
|
1340
1340
|
end: positions[i + 1],
|
|
1341
|
-
count: density
|
|
1341
|
+
count: density,
|
|
1342
1342
|
clampToGround: true,
|
|
1343
1343
|
classificationType: _options.classificationType,
|
|
1344
1344
|
terrainProvider: _options.terrainProvider
|
|
1345
1345
|
});
|
|
1346
1346
|
});
|
|
1347
|
-
const stagePromises = (await Promise.all(positionListPromises)).map(async (positions
|
|
1348
|
-
const { count
|
|
1349
|
-
return count
|
|
1347
|
+
const stagePromises = (await Promise.all(positionListPromises)).map(async (positions) => {
|
|
1348
|
+
const { count } = await distance(positions);
|
|
1349
|
+
return count;
|
|
1350
1350
|
});
|
|
1351
1351
|
const groundStages = await Promise.all(stagePromises);
|
|
1352
1352
|
return {
|
|
1353
1353
|
stages: groundStages,
|
|
1354
|
-
count: groundStages.reduce((count
|
|
1354
|
+
count: groundStages.reduce((count, current) => count += current, 0)
|
|
1355
1355
|
};
|
|
1356
1356
|
}
|
|
1357
1357
|
|