@vesium/plot 1.0.1-beta.57 → 1.0.1-beta.59
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 +21 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.iife.js +19 -19
- package/dist/index.iife.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
|
|
26
26
|
## Documentation
|
|
27
27
|
|
|
28
|
-
To view the documentation, visit <a href="https://vesium.
|
|
28
|
+
To view the documentation, visit <a href="https://vesium.js.org" target="__blank">vesium.js.org</a>
|
|
29
29
|
|
|
30
30
|
## Features
|
|
31
31
|
|
package/dist/index.cjs
CHANGED
|
@@ -27,11 +27,11 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
27
|
//#endregion
|
|
28
28
|
let cesium = require("cesium");
|
|
29
29
|
let vesium = require("vesium");
|
|
30
|
-
let
|
|
30
|
+
let _vueuse_core = require("@vueuse/core");
|
|
31
31
|
let vue = require("vue");
|
|
32
|
-
let
|
|
33
|
-
let
|
|
34
|
-
|
|
32
|
+
let _vesium_geometry = require("@vesium/geometry");
|
|
33
|
+
let _turf_turf = require("@turf/turf");
|
|
34
|
+
_turf_turf = __toESM(_turf_turf);
|
|
35
35
|
|
|
36
36
|
//#region usePlot/PlotScheme.ts
|
|
37
37
|
var PlotScheme = class PlotScheme {
|
|
@@ -104,7 +104,7 @@ var PlotScheme = class PlotScheme {
|
|
|
104
104
|
static resolve(maybeScheme) {
|
|
105
105
|
if (typeof maybeScheme === "string") {
|
|
106
106
|
const _scheme = PlotScheme.getCache(maybeScheme);
|
|
107
|
-
(0,
|
|
107
|
+
(0, _vueuse_core.assert)(!!_scheme, `scheme ${maybeScheme} not found`);
|
|
108
108
|
return _scheme;
|
|
109
109
|
} else if (!(maybeScheme instanceof PlotScheme)) return new PlotScheme(maybeScheme);
|
|
110
110
|
else return maybeScheme;
|
|
@@ -520,7 +520,7 @@ function useRender(plots, current, getCurrentTime) {
|
|
|
520
520
|
(0, vesium.useScreenSpaceEventHandler)(cesium.ScreenSpaceEventType.MOUSE_MOVE, (event) => {
|
|
521
521
|
mouseCartesian.value = (0, vesium.canvasCoordToCartesian)(event?.endPosition, viewer.value.scene);
|
|
522
522
|
});
|
|
523
|
-
(0,
|
|
523
|
+
(0, _vueuse_core.watchArray)(plots, (_value, _oldValue, added, removed = []) => {
|
|
524
524
|
removed.forEach((plot) => {
|
|
525
525
|
entityScope.removeWhere((item) => plot.entities.includes(item));
|
|
526
526
|
primitiveScope.removeWhere((item) => plot.primitives.includes(item));
|
|
@@ -604,7 +604,7 @@ function useSampled(current, getCurrentTime) {
|
|
|
604
604
|
return current.value?.sampled.getValue(getCurrentTime());
|
|
605
605
|
});
|
|
606
606
|
(0, vesium.useScreenSpaceEventHandler)(cesium.ScreenSpaceEventType.LEFT_CLICK, async (ctx) => {
|
|
607
|
-
await (0,
|
|
607
|
+
await (0, _vueuse_core.promiseTimeout)(1);
|
|
608
608
|
if (!current.value || !packable.value) return;
|
|
609
609
|
if (doubleClicking.value) return;
|
|
610
610
|
const { scheme, defining, sampled } = current.value;
|
|
@@ -619,7 +619,7 @@ function useSampled(current, getCurrentTime) {
|
|
|
619
619
|
(0, vesium.useScreenSpaceEventHandler)(cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK, async (ctx) => {
|
|
620
620
|
if (!current.value || !packable.value) return;
|
|
621
621
|
doubleClicking.value = true;
|
|
622
|
-
await (0,
|
|
622
|
+
await (0, _vueuse_core.promiseTimeout)(2);
|
|
623
623
|
doubleClicking.value = false;
|
|
624
624
|
const { scheme, defining } = current.value;
|
|
625
625
|
if (!defining) return;
|
|
@@ -742,7 +742,7 @@ function useSkeleton(plots, current, getCurrentTime) {
|
|
|
742
742
|
}
|
|
743
743
|
}));
|
|
744
744
|
});
|
|
745
|
-
(0,
|
|
745
|
+
(0, _vueuse_core.onKeyStroke)((keyEvent) => {
|
|
746
746
|
if (activeEntity.value) {
|
|
747
747
|
const entity = activeEntity.value;
|
|
748
748
|
const plot = entity.plot;
|
|
@@ -785,7 +785,7 @@ function useSkeleton(plots, current, getCurrentTime) {
|
|
|
785
785
|
} else activeEntity.value = void 0;
|
|
786
786
|
}));
|
|
787
787
|
});
|
|
788
|
-
(0,
|
|
788
|
+
(0, _vueuse_core.watchArray)(plots, (value, oldValue, added, removed = []) => {
|
|
789
789
|
added.forEach((plot) => update(plot));
|
|
790
790
|
removed.forEach((plot) => update(plot, true));
|
|
791
791
|
});
|
|
@@ -1686,7 +1686,7 @@ const PlotSchemePolygonArc = new PlotScheme({
|
|
|
1686
1686
|
entity.polygon.hierarchy = void 0;
|
|
1687
1687
|
return context.previous;
|
|
1688
1688
|
}
|
|
1689
|
-
const hierarchy = new cesium.PolygonHierarchy((0,
|
|
1689
|
+
const hierarchy = new cesium.PolygonHierarchy((0, _vesium_geometry.arc)(coords).map((item) => (0, vesium.toCartesian3)(item)));
|
|
1690
1690
|
entity.polygon.hierarchy = new cesium.CallbackProperty(() => hierarchy, false);
|
|
1691
1691
|
return { entities: [entity] };
|
|
1692
1692
|
}
|
|
@@ -1714,7 +1714,7 @@ const PlotSchemePolygonArrowAttackDirection = new PlotScheme({
|
|
|
1714
1714
|
entity.polygon.hierarchy = void 0;
|
|
1715
1715
|
return context.previous;
|
|
1716
1716
|
}
|
|
1717
|
-
const hierarchy = new cesium.PolygonHierarchy((0,
|
|
1717
|
+
const hierarchy = new cesium.PolygonHierarchy((0, _vesium_geometry.arrowAttackDirection)(coords).map((item) => (0, vesium.toCartesian3)(item)));
|
|
1718
1718
|
entity.polygon.hierarchy = new cesium.CallbackProperty(() => hierarchy, false);
|
|
1719
1719
|
return { entities: [entity] };
|
|
1720
1720
|
}
|
|
@@ -1742,7 +1742,7 @@ const PlotSchemePolygonArrowAttackDirectionTailed = new PlotScheme({
|
|
|
1742
1742
|
entity.polygon.hierarchy = void 0;
|
|
1743
1743
|
return context.previous;
|
|
1744
1744
|
}
|
|
1745
|
-
const hierarchy = new cesium.PolygonHierarchy((0,
|
|
1745
|
+
const hierarchy = new cesium.PolygonHierarchy((0, _vesium_geometry.arrowAttackDirectionTailed)(coords).map((item) => (0, vesium.toCartesian3)(item)));
|
|
1746
1746
|
entity.polygon.hierarchy = new cesium.CallbackProperty(() => hierarchy, false);
|
|
1747
1747
|
return { entities: [entity] };
|
|
1748
1748
|
}
|
|
@@ -1766,7 +1766,7 @@ const PlotSchemePolygonArrowClamped = new PlotScheme({
|
|
|
1766
1766
|
}
|
|
1767
1767
|
const coords = points.map((e) => (0, vesium.toCoord)(e));
|
|
1768
1768
|
if (coords.length >= 3) {
|
|
1769
|
-
const hierarchy = new cesium.PolygonHierarchy((0,
|
|
1769
|
+
const hierarchy = new cesium.PolygonHierarchy((0, _vesium_geometry.arrowClamped)(coords).map((item) => (0, vesium.toCartesian3)(item)));
|
|
1770
1770
|
entity.polygon.hierarchy = new cesium.CallbackProperty(() => hierarchy, false);
|
|
1771
1771
|
} else entity.polygon.hierarchy = void 0;
|
|
1772
1772
|
return { entities: [entity] };
|
|
@@ -1791,7 +1791,7 @@ const PlotSchemePolygonArrowStraight = new PlotScheme({
|
|
|
1791
1791
|
}
|
|
1792
1792
|
const coords = points.map((e) => (0, vesium.toCoord)(e));
|
|
1793
1793
|
if (coords.length >= 2) {
|
|
1794
|
-
const hierarchy = new cesium.PolygonHierarchy((0,
|
|
1794
|
+
const hierarchy = new cesium.PolygonHierarchy((0, _vesium_geometry.arrowStraight)(coords).map((item) => (0, vesium.toCartesian3)(item)));
|
|
1795
1795
|
entity.polygon.hierarchy = new cesium.CallbackProperty(() => hierarchy, false);
|
|
1796
1796
|
} else entity.polygon.hierarchy = void 0;
|
|
1797
1797
|
return { entities: [entity] };
|
|
@@ -1816,7 +1816,7 @@ const PlotSchemePolygonArrowStraightSharp = new PlotScheme({
|
|
|
1816
1816
|
}
|
|
1817
1817
|
const coords = points.map((e) => (0, vesium.toCoord)(e));
|
|
1818
1818
|
if (coords.length >= 2) {
|
|
1819
|
-
const hierarchy = new cesium.PolygonHierarchy((0,
|
|
1819
|
+
const hierarchy = new cesium.PolygonHierarchy((0, _vesium_geometry.arrowStraightSharp)(coords).map((item) => (0, vesium.toCartesian3)(item)));
|
|
1820
1820
|
entity.polygon.hierarchy = new cesium.CallbackProperty(() => hierarchy, false);
|
|
1821
1821
|
} else entity.polygon.hierarchy = void 0;
|
|
1822
1822
|
return { entities: [entity] };
|
|
@@ -1845,7 +1845,7 @@ const PlotSchemePolygonArrowUnitCombatOperation = new PlotScheme({
|
|
|
1845
1845
|
entity.polygon.hierarchy = void 0;
|
|
1846
1846
|
return context.previous;
|
|
1847
1847
|
}
|
|
1848
|
-
const hierarchy = new cesium.PolygonHierarchy((0,
|
|
1848
|
+
const hierarchy = new cesium.PolygonHierarchy((0, _vesium_geometry.arrowUnitCombatOperation)(coords).map((item) => (0, vesium.toCartesian3)(item)));
|
|
1849
1849
|
entity.polygon.hierarchy = new cesium.CallbackProperty(() => hierarchy, false);
|
|
1850
1850
|
return { entities: [entity] };
|
|
1851
1851
|
}
|
|
@@ -1873,7 +1873,7 @@ const PlotSchemePolygonArrowUnitCombatOperationTailed = new PlotScheme({
|
|
|
1873
1873
|
entity.polygon.hierarchy = void 0;
|
|
1874
1874
|
return context.previous;
|
|
1875
1875
|
}
|
|
1876
|
-
const hierarchy = new cesium.PolygonHierarchy((0,
|
|
1876
|
+
const hierarchy = new cesium.PolygonHierarchy((0, _vesium_geometry.arrowUnitCombatOperationTailed)(coords).map((item) => (0, vesium.toCartesian3)(item)));
|
|
1877
1877
|
entity.polygon.hierarchy = new cesium.CallbackProperty(() => hierarchy, false);
|
|
1878
1878
|
return { entities: [entity] };
|
|
1879
1879
|
}
|
|
@@ -1909,7 +1909,7 @@ const PlotSchemePolygonAssemblingPlace = new PlotScheme({
|
|
|
1909
1909
|
const longitude = c1.longitude - (c0.longitude - c1.longitude);
|
|
1910
1910
|
coords.push((0, vesium.toCoord)(new cesium.Cartographic(longitude, latitude, height)));
|
|
1911
1911
|
}
|
|
1912
|
-
const hierarchy = new cesium.PolygonHierarchy((0,
|
|
1912
|
+
const hierarchy = new cesium.PolygonHierarchy((0, _vesium_geometry.assemblingPlace)(coords).map((item) => (0, vesium.toCartesian3)(item)));
|
|
1913
1913
|
entity.polygon.hierarchy = new cesium.CallbackProperty(() => hierarchy, false);
|
|
1914
1914
|
return { entities: [entity] };
|
|
1915
1915
|
}
|
|
@@ -1942,7 +1942,7 @@ const PlotSchemePolygonSmooth = new PlotScheme({
|
|
|
1942
1942
|
}
|
|
1943
1943
|
const wgs84s = positions.map((e) => (0, vesium.toCoord)(e));
|
|
1944
1944
|
wgs84s.push(wgs84s[0]);
|
|
1945
|
-
const { features } =
|
|
1945
|
+
const { features } = _turf_turf.polygonSmooth(_turf_turf.polygon([wgs84s]), { iterations: 3 });
|
|
1946
1946
|
const hierarchy = new cesium.PolygonHierarchy(features[0].geometry.coordinates[0].map((item) => (0, vesium.toCartesian3)(item)).filter((e) => !!e));
|
|
1947
1947
|
entity.polygon.hierarchy = new cesium.CallbackProperty(() => hierarchy, false);
|
|
1948
1948
|
return { entities: [entity] };
|
|
@@ -2008,7 +2008,7 @@ const PlotSchemePolylineCurve = new PlotScheme({
|
|
|
2008
2008
|
return context.previous;
|
|
2009
2009
|
}
|
|
2010
2010
|
const coords = positions.map((position) => (0, vesium.toCoord)(position));
|
|
2011
|
-
const { geometry: { coordinates } } =
|
|
2011
|
+
const { geometry: { coordinates } } = _turf_turf.bezierSpline(_turf_turf.lineString(coords));
|
|
2012
2012
|
entity.polyline.positions = new cesium.CallbackProperty(() => coordinates.map(vesium.toCartesian3), false);
|
|
2013
2013
|
return { entities: [entity] };
|
|
2014
2014
|
}
|