@vesium/plot 1.0.1-beta.54 → 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 +67 -32
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.iife.js +65 -30
- 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.map +1 -1
- package/dist/index.mjs +36 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -7
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
|
@@ -6,12 +6,16 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
8
|
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function")
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
13
|
+
__defProp(to, key, {
|
|
14
|
+
get: ((k) => from[k]).bind(null, key),
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
15
19
|
}
|
|
16
20
|
return to;
|
|
17
21
|
};
|
|
@@ -22,17 +26,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
22
26
|
|
|
23
27
|
//#endregion
|
|
24
28
|
let cesium = require("cesium");
|
|
25
|
-
cesium = __toESM(cesium);
|
|
26
29
|
let vesium = require("vesium");
|
|
27
|
-
|
|
28
|
-
let __vueuse_core = require("@vueuse/core");
|
|
29
|
-
__vueuse_core = __toESM(__vueuse_core);
|
|
30
|
+
let _vueuse_core = require("@vueuse/core");
|
|
30
31
|
let vue = require("vue");
|
|
31
|
-
|
|
32
|
-
let
|
|
33
|
-
|
|
34
|
-
let __turf_turf = require("@turf/turf");
|
|
35
|
-
__turf_turf = __toESM(__turf_turf);
|
|
32
|
+
let _vesium_geometry = require("@vesium/geometry");
|
|
33
|
+
let _turf_turf = require("@turf/turf");
|
|
34
|
+
_turf_turf = __toESM(_turf_turf);
|
|
36
35
|
|
|
37
36
|
//#region usePlot/PlotScheme.ts
|
|
38
37
|
var PlotScheme = class PlotScheme {
|
|
@@ -105,7 +104,7 @@ var PlotScheme = class PlotScheme {
|
|
|
105
104
|
static resolve(maybeScheme) {
|
|
106
105
|
if (typeof maybeScheme === "string") {
|
|
107
106
|
const _scheme = PlotScheme.getCache(maybeScheme);
|
|
108
|
-
(0,
|
|
107
|
+
(0, _vueuse_core.assert)(!!_scheme, `scheme ${maybeScheme} not found`);
|
|
109
108
|
return _scheme;
|
|
110
109
|
} else if (!(maybeScheme instanceof PlotScheme)) return new PlotScheme(maybeScheme);
|
|
111
110
|
else return maybeScheme;
|
|
@@ -521,7 +520,7 @@ function useRender(plots, current, getCurrentTime) {
|
|
|
521
520
|
(0, vesium.useScreenSpaceEventHandler)(cesium.ScreenSpaceEventType.MOUSE_MOVE, (event) => {
|
|
522
521
|
mouseCartesian.value = (0, vesium.canvasCoordToCartesian)(event?.endPosition, viewer.value.scene);
|
|
523
522
|
});
|
|
524
|
-
(0,
|
|
523
|
+
(0, _vueuse_core.watchArray)(plots, (_value, _oldValue, added, removed = []) => {
|
|
525
524
|
removed.forEach((plot) => {
|
|
526
525
|
entityScope.removeWhere((item) => plot.entities.includes(item));
|
|
527
526
|
primitiveScope.removeWhere((item) => plot.primitives.includes(item));
|
|
@@ -605,7 +604,7 @@ function useSampled(current, getCurrentTime) {
|
|
|
605
604
|
return current.value?.sampled.getValue(getCurrentTime());
|
|
606
605
|
});
|
|
607
606
|
(0, vesium.useScreenSpaceEventHandler)(cesium.ScreenSpaceEventType.LEFT_CLICK, async (ctx) => {
|
|
608
|
-
await (0,
|
|
607
|
+
await (0, _vueuse_core.promiseTimeout)(1);
|
|
609
608
|
if (!current.value || !packable.value) return;
|
|
610
609
|
if (doubleClicking.value) return;
|
|
611
610
|
const { scheme, defining, sampled } = current.value;
|
|
@@ -620,7 +619,7 @@ function useSampled(current, getCurrentTime) {
|
|
|
620
619
|
(0, vesium.useScreenSpaceEventHandler)(cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK, async (ctx) => {
|
|
621
620
|
if (!current.value || !packable.value) return;
|
|
622
621
|
doubleClicking.value = true;
|
|
623
|
-
await (0,
|
|
622
|
+
await (0, _vueuse_core.promiseTimeout)(2);
|
|
624
623
|
doubleClicking.value = false;
|
|
625
624
|
const { scheme, defining } = current.value;
|
|
626
625
|
if (!defining) return;
|
|
@@ -743,7 +742,7 @@ function useSkeleton(plots, current, getCurrentTime) {
|
|
|
743
742
|
}
|
|
744
743
|
}));
|
|
745
744
|
});
|
|
746
|
-
(0,
|
|
745
|
+
(0, _vueuse_core.onKeyStroke)((keyEvent) => {
|
|
747
746
|
if (activeEntity.value) {
|
|
748
747
|
const entity = activeEntity.value;
|
|
749
748
|
const plot = entity.plot;
|
|
@@ -786,7 +785,7 @@ function useSkeleton(plots, current, getCurrentTime) {
|
|
|
786
785
|
} else activeEntity.value = void 0;
|
|
787
786
|
}));
|
|
788
787
|
});
|
|
789
|
-
(0,
|
|
788
|
+
(0, _vueuse_core.watchArray)(plots, (value, oldValue, added, removed = []) => {
|
|
790
789
|
added.forEach((plot) => update(plot));
|
|
791
790
|
removed.forEach((plot) => update(plot, true));
|
|
792
791
|
});
|
|
@@ -1481,6 +1480,9 @@ const schemeMeasureDistance = new PlotScheme({
|
|
|
1481
1480
|
|
|
1482
1481
|
//#endregion
|
|
1483
1482
|
//#region scheme/Billboard.ts
|
|
1483
|
+
/**
|
|
1484
|
+
* billboard标绘配置
|
|
1485
|
+
*/
|
|
1484
1486
|
const PlotSchemeBillboard = new PlotScheme({
|
|
1485
1487
|
type: "Billboard",
|
|
1486
1488
|
complete: (packable) => packable.positions.length >= 1,
|
|
@@ -1503,6 +1505,9 @@ const PlotSchemeBillboard = new PlotScheme({
|
|
|
1503
1505
|
|
|
1504
1506
|
//#endregion
|
|
1505
1507
|
//#region scheme/BillboardPinBuilder.ts
|
|
1508
|
+
/**
|
|
1509
|
+
* billboard-pin-builder标绘配置
|
|
1510
|
+
*/
|
|
1506
1511
|
const PlotSchemeBillboardPinBuilder = new PlotScheme({
|
|
1507
1512
|
type: "BillboardPinBuilder",
|
|
1508
1513
|
complete: (packable) => packable.positions.length >= 1,
|
|
@@ -1520,6 +1525,9 @@ const PlotSchemeBillboardPinBuilder = new PlotScheme({
|
|
|
1520
1525
|
|
|
1521
1526
|
//#endregion
|
|
1522
1527
|
//#region scheme/Cylinder.ts
|
|
1528
|
+
/**
|
|
1529
|
+
* cylinder标绘配置
|
|
1530
|
+
*/
|
|
1523
1531
|
const PlotSchemeCylinder = new PlotScheme({
|
|
1524
1532
|
type: "Cylinder",
|
|
1525
1533
|
complete: (packable) => packable.positions.length >= 2,
|
|
@@ -1546,6 +1554,9 @@ const PlotSchemeCylinder = new PlotScheme({
|
|
|
1546
1554
|
|
|
1547
1555
|
//#endregion
|
|
1548
1556
|
//#region scheme/Ellipse.ts
|
|
1557
|
+
/**
|
|
1558
|
+
* ellipse标绘配置 圆形扩散波
|
|
1559
|
+
*/
|
|
1549
1560
|
const PlotSchemeEllipse = new PlotScheme({
|
|
1550
1561
|
type: "Ellipse",
|
|
1551
1562
|
complete: (packable) => packable.positions.length >= 2,
|
|
@@ -1572,6 +1583,9 @@ const PlotSchemeEllipse = new PlotScheme({
|
|
|
1572
1583
|
|
|
1573
1584
|
//#endregion
|
|
1574
1585
|
//#region scheme/Label.ts
|
|
1586
|
+
/**
|
|
1587
|
+
* 基础label标绘配置
|
|
1588
|
+
*/
|
|
1575
1589
|
const PlotSchemeLabel = new PlotScheme({
|
|
1576
1590
|
type: "Label",
|
|
1577
1591
|
complete: (packable) => packable.positions.length >= 1,
|
|
@@ -1589,6 +1603,9 @@ const PlotSchemeLabel = new PlotScheme({
|
|
|
1589
1603
|
|
|
1590
1604
|
//#endregion
|
|
1591
1605
|
//#region scheme/Point.ts
|
|
1606
|
+
/**
|
|
1607
|
+
* 基础point标绘配置
|
|
1608
|
+
*/
|
|
1592
1609
|
const PlotSchemePoint = new PlotScheme({
|
|
1593
1610
|
type: "Point",
|
|
1594
1611
|
complete: (packable) => packable.positions.length >= 1,
|
|
@@ -1609,6 +1626,9 @@ const PlotSchemePoint = new PlotScheme({
|
|
|
1609
1626
|
|
|
1610
1627
|
//#endregion
|
|
1611
1628
|
//#region scheme/Polygon.ts
|
|
1629
|
+
/**
|
|
1630
|
+
* 基础Polygon标绘配置
|
|
1631
|
+
*/
|
|
1612
1632
|
const PlotSchemePolygon = new PlotScheme({
|
|
1613
1633
|
type: "Polygon",
|
|
1614
1634
|
allowManualComplete: (packable) => packable.positions.length >= 2,
|
|
@@ -1647,6 +1667,9 @@ const PlotSchemePolygon = new PlotScheme({
|
|
|
1647
1667
|
|
|
1648
1668
|
//#endregion
|
|
1649
1669
|
//#region scheme/PolygonArc.ts
|
|
1670
|
+
/**
|
|
1671
|
+
* 弓形
|
|
1672
|
+
*/
|
|
1650
1673
|
const PlotSchemePolygonArc = new PlotScheme({
|
|
1651
1674
|
type: "PolygonArc",
|
|
1652
1675
|
complete: (packable) => packable.positions.length >= 3,
|
|
@@ -1663,7 +1686,7 @@ const PlotSchemePolygonArc = new PlotScheme({
|
|
|
1663
1686
|
entity.polygon.hierarchy = void 0;
|
|
1664
1687
|
return context.previous;
|
|
1665
1688
|
}
|
|
1666
|
-
const hierarchy = new cesium.PolygonHierarchy((0,
|
|
1689
|
+
const hierarchy = new cesium.PolygonHierarchy((0, _vesium_geometry.arc)(coords).map((item) => (0, vesium.toCartesian3)(item)));
|
|
1667
1690
|
entity.polygon.hierarchy = new cesium.CallbackProperty(() => hierarchy, false);
|
|
1668
1691
|
return { entities: [entity] };
|
|
1669
1692
|
}
|
|
@@ -1691,7 +1714,7 @@ const PlotSchemePolygonArrowAttackDirection = new PlotScheme({
|
|
|
1691
1714
|
entity.polygon.hierarchy = void 0;
|
|
1692
1715
|
return context.previous;
|
|
1693
1716
|
}
|
|
1694
|
-
const hierarchy = new cesium.PolygonHierarchy((0,
|
|
1717
|
+
const hierarchy = new cesium.PolygonHierarchy((0, _vesium_geometry.arrowAttackDirection)(coords).map((item) => (0, vesium.toCartesian3)(item)));
|
|
1695
1718
|
entity.polygon.hierarchy = new cesium.CallbackProperty(() => hierarchy, false);
|
|
1696
1719
|
return { entities: [entity] };
|
|
1697
1720
|
}
|
|
@@ -1719,7 +1742,7 @@ const PlotSchemePolygonArrowAttackDirectionTailed = new PlotScheme({
|
|
|
1719
1742
|
entity.polygon.hierarchy = void 0;
|
|
1720
1743
|
return context.previous;
|
|
1721
1744
|
}
|
|
1722
|
-
const hierarchy = new cesium.PolygonHierarchy((0,
|
|
1745
|
+
const hierarchy = new cesium.PolygonHierarchy((0, _vesium_geometry.arrowAttackDirectionTailed)(coords).map((item) => (0, vesium.toCartesian3)(item)));
|
|
1723
1746
|
entity.polygon.hierarchy = new cesium.CallbackProperty(() => hierarchy, false);
|
|
1724
1747
|
return { entities: [entity] };
|
|
1725
1748
|
}
|
|
@@ -1743,7 +1766,7 @@ const PlotSchemePolygonArrowClamped = new PlotScheme({
|
|
|
1743
1766
|
}
|
|
1744
1767
|
const coords = points.map((e) => (0, vesium.toCoord)(e));
|
|
1745
1768
|
if (coords.length >= 3) {
|
|
1746
|
-
const hierarchy = new cesium.PolygonHierarchy((0,
|
|
1769
|
+
const hierarchy = new cesium.PolygonHierarchy((0, _vesium_geometry.arrowClamped)(coords).map((item) => (0, vesium.toCartesian3)(item)));
|
|
1747
1770
|
entity.polygon.hierarchy = new cesium.CallbackProperty(() => hierarchy, false);
|
|
1748
1771
|
} else entity.polygon.hierarchy = void 0;
|
|
1749
1772
|
return { entities: [entity] };
|
|
@@ -1768,7 +1791,7 @@ const PlotSchemePolygonArrowStraight = new PlotScheme({
|
|
|
1768
1791
|
}
|
|
1769
1792
|
const coords = points.map((e) => (0, vesium.toCoord)(e));
|
|
1770
1793
|
if (coords.length >= 2) {
|
|
1771
|
-
const hierarchy = new cesium.PolygonHierarchy((0,
|
|
1794
|
+
const hierarchy = new cesium.PolygonHierarchy((0, _vesium_geometry.arrowStraight)(coords).map((item) => (0, vesium.toCartesian3)(item)));
|
|
1772
1795
|
entity.polygon.hierarchy = new cesium.CallbackProperty(() => hierarchy, false);
|
|
1773
1796
|
} else entity.polygon.hierarchy = void 0;
|
|
1774
1797
|
return { entities: [entity] };
|
|
@@ -1793,7 +1816,7 @@ const PlotSchemePolygonArrowStraightSharp = new PlotScheme({
|
|
|
1793
1816
|
}
|
|
1794
1817
|
const coords = points.map((e) => (0, vesium.toCoord)(e));
|
|
1795
1818
|
if (coords.length >= 2) {
|
|
1796
|
-
const hierarchy = new cesium.PolygonHierarchy((0,
|
|
1819
|
+
const hierarchy = new cesium.PolygonHierarchy((0, _vesium_geometry.arrowStraightSharp)(coords).map((item) => (0, vesium.toCartesian3)(item)));
|
|
1797
1820
|
entity.polygon.hierarchy = new cesium.CallbackProperty(() => hierarchy, false);
|
|
1798
1821
|
} else entity.polygon.hierarchy = void 0;
|
|
1799
1822
|
return { entities: [entity] };
|
|
@@ -1822,7 +1845,7 @@ const PlotSchemePolygonArrowUnitCombatOperation = new PlotScheme({
|
|
|
1822
1845
|
entity.polygon.hierarchy = void 0;
|
|
1823
1846
|
return context.previous;
|
|
1824
1847
|
}
|
|
1825
|
-
const hierarchy = new cesium.PolygonHierarchy((0,
|
|
1848
|
+
const hierarchy = new cesium.PolygonHierarchy((0, _vesium_geometry.arrowUnitCombatOperation)(coords).map((item) => (0, vesium.toCartesian3)(item)));
|
|
1826
1849
|
entity.polygon.hierarchy = new cesium.CallbackProperty(() => hierarchy, false);
|
|
1827
1850
|
return { entities: [entity] };
|
|
1828
1851
|
}
|
|
@@ -1850,7 +1873,7 @@ const PlotSchemePolygonArrowUnitCombatOperationTailed = new PlotScheme({
|
|
|
1850
1873
|
entity.polygon.hierarchy = void 0;
|
|
1851
1874
|
return context.previous;
|
|
1852
1875
|
}
|
|
1853
|
-
const hierarchy = new cesium.PolygonHierarchy((0,
|
|
1876
|
+
const hierarchy = new cesium.PolygonHierarchy((0, _vesium_geometry.arrowUnitCombatOperationTailed)(coords).map((item) => (0, vesium.toCartesian3)(item)));
|
|
1854
1877
|
entity.polygon.hierarchy = new cesium.CallbackProperty(() => hierarchy, false);
|
|
1855
1878
|
return { entities: [entity] };
|
|
1856
1879
|
}
|
|
@@ -1886,7 +1909,7 @@ const PlotSchemePolygonAssemblingPlace = new PlotScheme({
|
|
|
1886
1909
|
const longitude = c1.longitude - (c0.longitude - c1.longitude);
|
|
1887
1910
|
coords.push((0, vesium.toCoord)(new cesium.Cartographic(longitude, latitude, height)));
|
|
1888
1911
|
}
|
|
1889
|
-
const hierarchy = new cesium.PolygonHierarchy((0,
|
|
1912
|
+
const hierarchy = new cesium.PolygonHierarchy((0, _vesium_geometry.assemblingPlace)(coords).map((item) => (0, vesium.toCartesian3)(item)));
|
|
1890
1913
|
entity.polygon.hierarchy = new cesium.CallbackProperty(() => hierarchy, false);
|
|
1891
1914
|
return { entities: [entity] };
|
|
1892
1915
|
}
|
|
@@ -1894,6 +1917,9 @@ const PlotSchemePolygonAssemblingPlace = new PlotScheme({
|
|
|
1894
1917
|
|
|
1895
1918
|
//#endregion
|
|
1896
1919
|
//#region scheme/PolygonSmooth.ts
|
|
1920
|
+
/**
|
|
1921
|
+
* polygon-smooth 标绘配置 平滑闭合面
|
|
1922
|
+
*/
|
|
1897
1923
|
const PlotSchemePolygonSmooth = new PlotScheme({
|
|
1898
1924
|
type: "PolygonSmooth",
|
|
1899
1925
|
allowManualComplete: (packable) => packable.positions.length >= 3,
|
|
@@ -1916,7 +1942,7 @@ const PlotSchemePolygonSmooth = new PlotScheme({
|
|
|
1916
1942
|
}
|
|
1917
1943
|
const wgs84s = positions.map((e) => (0, vesium.toCoord)(e));
|
|
1918
1944
|
wgs84s.push(wgs84s[0]);
|
|
1919
|
-
const { features } =
|
|
1945
|
+
const { features } = _turf_turf.polygonSmooth(_turf_turf.polygon([wgs84s]), { iterations: 3 });
|
|
1920
1946
|
const hierarchy = new cesium.PolygonHierarchy(features[0].geometry.coordinates[0].map((item) => (0, vesium.toCartesian3)(item)).filter((e) => !!e));
|
|
1921
1947
|
entity.polygon.hierarchy = new cesium.CallbackProperty(() => hierarchy, false);
|
|
1922
1948
|
return { entities: [entity] };
|
|
@@ -1925,6 +1951,9 @@ const PlotSchemePolygonSmooth = new PlotScheme({
|
|
|
1925
1951
|
|
|
1926
1952
|
//#endregion
|
|
1927
1953
|
//#region scheme/Polyline.ts
|
|
1954
|
+
/**
|
|
1955
|
+
* polyline
|
|
1956
|
+
*/
|
|
1928
1957
|
const PlotSchemePolyline = new PlotScheme({
|
|
1929
1958
|
type: "Polyline",
|
|
1930
1959
|
allowManualComplete: (packable) => packable.positions.length > 1,
|
|
@@ -1952,6 +1981,9 @@ const PlotSchemePolyline = new PlotScheme({
|
|
|
1952
1981
|
|
|
1953
1982
|
//#endregion
|
|
1954
1983
|
//#region scheme/PolylineCurve.ts
|
|
1984
|
+
/**
|
|
1985
|
+
* polyline-Curve
|
|
1986
|
+
*/
|
|
1955
1987
|
const PlotSchemePolylineCurve = new PlotScheme({
|
|
1956
1988
|
type: "PolylineCurve",
|
|
1957
1989
|
allowManualComplete: (packable) => packable.positions.length > 1,
|
|
@@ -1976,7 +2008,7 @@ const PlotSchemePolylineCurve = new PlotScheme({
|
|
|
1976
2008
|
return context.previous;
|
|
1977
2009
|
}
|
|
1978
2010
|
const coords = positions.map((position) => (0, vesium.toCoord)(position));
|
|
1979
|
-
const { geometry: { coordinates } } =
|
|
2011
|
+
const { geometry: { coordinates } } = _turf_turf.bezierSpline(_turf_turf.lineString(coords));
|
|
1980
2012
|
entity.polyline.positions = new cesium.CallbackProperty(() => coordinates.map(vesium.toCartesian3), false);
|
|
1981
2013
|
return { entities: [entity] };
|
|
1982
2014
|
}
|
|
@@ -1984,6 +2016,9 @@ const PlotSchemePolylineCurve = new PlotScheme({
|
|
|
1984
2016
|
|
|
1985
2017
|
//#endregion
|
|
1986
2018
|
//#region scheme/Rectangle.ts
|
|
2019
|
+
/**
|
|
2020
|
+
* rectangle
|
|
2021
|
+
*/
|
|
1987
2022
|
const PlotSchemeRectangle = new PlotScheme({
|
|
1988
2023
|
type: "Rectangle",
|
|
1989
2024
|
complete: (packable) => packable.positions.length >= 2,
|