cesium-alpha-earth 1.0.72 → 1.0.74

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.
Files changed (58) hide show
  1. package/dist/assets/geojson2Line-D52oeUm7.js +165 -0
  2. package/dist/assets/icon/geojson2Line.ts +113 -0
  3. package/dist/assets/icon/heightSimple.ts +110 -0
  4. package/dist/cesium-alpha-earth.css +14 -14
  5. package/dist/index.js +101511 -109604
  6. package/dist/types/components/WellSiteSelection/utilFun/createSidloop.d.ts +1 -0
  7. package/dist/types/components/WellSiteSelection/utilFun/createSidloop.js +1 -1
  8. package/dist/types/components/WellSiteSelection/utilFun/createSidloop.js.map +1 -1
  9. package/dist/types/core/CesiumAlphaGeoJsonLayer/index.js +0 -1
  10. package/dist/types/core/CesiumAlphaGeoJsonLayer/index.js.map +1 -1
  11. package/dist/types/core/CesiumAlphaGeoJsonLayer/method/batchFun.js +4 -10
  12. package/dist/types/core/CesiumAlphaGeoJsonLayer/method/batchFun.js.map +1 -1
  13. package/dist/types/core/CesiumAlphaGeoJsonLayer/type.d.ts +0 -1
  14. package/dist/types/core/CesiumAlphaVideoFusion/index.js.map +1 -1
  15. package/dist/types/core/CesiumAlphaViewer/index.js.map +1 -1
  16. package/dist/types/core/CesiumAlphaViewer/method/createViewer.js +0 -2
  17. package/dist/types/core/CesiumAlphaViewer/method/createViewer.js.map +1 -1
  18. package/dist/types/index.d.ts +3 -2
  19. package/dist/types/index.js +3 -2
  20. package/dist/types/index.js.map +1 -1
  21. package/dist/types/main.d.ts +0 -1
  22. package/dist/types/main.js +1 -6
  23. package/dist/types/main.js.map +1 -1
  24. package/dist/types/util/LineSuperposition/index.d.ts +58 -0
  25. package/dist/types/util/LineSuperposition/index.js +124 -0
  26. package/dist/types/util/LineSuperposition/index.js.map +1 -0
  27. package/dist/types/util/createImageryLayer/index.js +2 -2
  28. package/dist/types/util/createImageryLayer/index.js.map +1 -1
  29. package/dist/types/util/graphUtil/index.d.ts +10 -0
  30. package/dist/types/util/graphUtil/index.js +134 -0
  31. package/dist/types/util/graphUtil/index.js.map +1 -0
  32. package/dist/types/util/{geojson2graph → graphUtil}/type.d.ts +3 -2
  33. package/dist/types/util/{geojson2graph → graphUtil}/type.js.map +1 -1
  34. package/dist/types/viewTest/AppComponentTest/scene.d.ts +13 -0
  35. package/dist/types/viewTest/AppComponentTest/scene.js +133 -0
  36. package/dist/types/viewTest/AppComponentTest/scene.js.map +1 -0
  37. package/dist/types/worker/geojson2Line.d.ts +2 -0
  38. package/dist/types/worker/geojson2Line.js +79 -0
  39. package/dist/types/worker/geojson2Line.js.map +1 -0
  40. package/dist/types/worker/geojson2LineWorker/index.d.ts +7 -0
  41. package/dist/types/worker/geojson2LineWorker/index.js +16 -0
  42. package/dist/types/worker/geojson2LineWorker/index.js.map +1 -0
  43. package/package.json +4 -6
  44. package/dist/ZLMRTCClient.js +0 -9472
  45. package/dist/types/core/CesiumAlphaRouter/index.d.ts +0 -5
  46. package/dist/types/core/CesiumAlphaRouter/index.js +0 -9
  47. package/dist/types/core/CesiumAlphaRouter/index.js.map +0 -1
  48. package/dist/types/util/geojson2graph/index.d.ts +0 -5
  49. package/dist/types/util/geojson2graph/index.js +0 -132
  50. package/dist/types/util/geojson2graph/index.js.map +0 -1
  51. package/dist/types/util/geojson2graph/indextest.d.ts +0 -2
  52. package/dist/types/util/geojson2graph/indextest.js +0 -110
  53. package/dist/types/util/geojson2graph/indextest.js.map +0 -1
  54. package/dist/tzgx.json +0 -1104
  55. package/dist/tzlw.json +0 -31888
  56. package/dist/wrj.glb +0 -0
  57. package/dist//346/265/213/350/257/225/350/267/257.json +0 -7934
  58. /package/dist/types/util/{geojson2graph → graphUtil}/type.js +0 -0
@@ -0,0 +1,165 @@
1
+ (function() {
2
+ "use strict";
3
+ var earthRadius = 63710088e-1;
4
+ var factors = {
5
+ centimeters: earthRadius * 100,
6
+ centimetres: earthRadius * 100,
7
+ degrees: 360 / (2 * Math.PI),
8
+ feet: earthRadius * 3.28084,
9
+ inches: earthRadius * 39.37,
10
+ kilometers: earthRadius / 1e3,
11
+ kilometres: earthRadius / 1e3,
12
+ meters: earthRadius,
13
+ metres: earthRadius,
14
+ miles: earthRadius / 1609.344,
15
+ millimeters: earthRadius * 1e3,
16
+ millimetres: earthRadius * 1e3,
17
+ nauticalmiles: earthRadius / 1852,
18
+ radians: 1,
19
+ yards: earthRadius * 1.0936
20
+ };
21
+ function feature(geom, properties, options = {}) {
22
+ const feat = { type: "Feature" };
23
+ if (options.id === 0 || options.id) {
24
+ feat.id = options.id;
25
+ }
26
+ if (options.bbox) {
27
+ feat.bbox = options.bbox;
28
+ }
29
+ feat.properties = {};
30
+ feat.geometry = geom;
31
+ return feat;
32
+ }
33
+ function point(coordinates, properties, options = {}) {
34
+ if (!coordinates) {
35
+ throw new Error("coordinates is required");
36
+ }
37
+ if (!Array.isArray(coordinates)) {
38
+ throw new Error("coordinates must be an Array");
39
+ }
40
+ if (coordinates.length < 2) {
41
+ throw new Error("coordinates must be at least 2 numbers long");
42
+ }
43
+ if (!isNumber(coordinates[0]) || !isNumber(coordinates[1])) {
44
+ throw new Error("coordinates must contain numbers");
45
+ }
46
+ const geom = {
47
+ type: "Point",
48
+ coordinates
49
+ };
50
+ return feature(geom, properties, options);
51
+ }
52
+ function radiansToLength(radians, units = "kilometers") {
53
+ const factor = factors[units];
54
+ if (!factor) {
55
+ throw new Error(units + " units is invalid");
56
+ }
57
+ return radians * factor;
58
+ }
59
+ function degreesToRadians(degrees) {
60
+ const normalisedDegrees = degrees % 360;
61
+ return normalisedDegrees * Math.PI / 180;
62
+ }
63
+ function isNumber(num) {
64
+ return !isNaN(num) && num !== null && !Array.isArray(num);
65
+ }
66
+ function getCoord(coord) {
67
+ if (!coord) {
68
+ throw new Error("coord is required");
69
+ }
70
+ if (!Array.isArray(coord)) {
71
+ if (coord.type === "Feature" && coord.geometry !== null && coord.geometry.type === "Point") {
72
+ return [...coord.geometry.coordinates];
73
+ }
74
+ if (coord.type === "Point") {
75
+ return [...coord.coordinates];
76
+ }
77
+ }
78
+ if (Array.isArray(coord) && coord.length >= 2 && !Array.isArray(coord[0]) && !Array.isArray(coord[1])) {
79
+ return [...coord];
80
+ }
81
+ throw new Error("coord must be GeoJSON Point or an Array of numbers");
82
+ }
83
+ function distance(from, to, options = {}) {
84
+ var coordinates1 = getCoord(from);
85
+ var coordinates2 = getCoord(to);
86
+ var dLat = degreesToRadians(coordinates2[1] - coordinates1[1]);
87
+ var dLon = degreesToRadians(coordinates2[0] - coordinates1[0]);
88
+ var lat1 = degreesToRadians(coordinates1[1]);
89
+ var lat2 = degreesToRadians(coordinates2[1]);
90
+ var a = Math.pow(Math.sin(dLat / 2), 2) + Math.pow(Math.sin(dLon / 2), 2) * Math.cos(lat1) * Math.cos(lat2);
91
+ return radiansToLength(
92
+ 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)),
93
+ options.units
94
+ );
95
+ }
96
+ self.onmessage = (e) => {
97
+ let data = convertGeoJsonToGraph(e.data.geoJson, e.data.snapThreshold);
98
+ self.postMessage(data);
99
+ };
100
+ function convertGeoJsonToGraph(geoJson, snapThreshold) {
101
+ var _a;
102
+ let projectedFeatureCollection = {
103
+ features: [],
104
+ type: "FeatureCollection"
105
+ };
106
+ const nodes = /* @__PURE__ */ new Map();
107
+ let featureIndex = 0;
108
+ for (let feature2 of geoJson.features) {
109
+ if (!["LineString", "MultiLineString"].includes((_a = feature2.geometry) == null ? void 0 : _a.type)) {
110
+ console.warn(`Feature ${featureIndex} 不是线数据,跳过`);
111
+ return;
112
+ }
113
+ let coordinates = [];
114
+ if (feature2.geometry.type === "LineString") {
115
+ coordinates = [feature2.geometry.coordinates];
116
+ } else if (feature2.geometry.type === "MultiLineString") {
117
+ coordinates = feature2.geometry.coordinates;
118
+ }
119
+ for (const line of coordinates) {
120
+ let currentNodesLine = [];
121
+ for (const [index, position] of line.entries()) {
122
+ const [lng, lat] = position;
123
+ let currentNodeId = null;
124
+ let longitude = lng;
125
+ let latitude = lat;
126
+ if (index === 0 || index === line.length - 1) {
127
+ currentNodeId = findMatchedNode(nodes, [lng, lat], snapThreshold);
128
+ if (currentNodeId) {
129
+ let positionCoord = currentNodeId.split(",");
130
+ longitude = positionCoord[0];
131
+ latitude = positionCoord[1];
132
+ }
133
+ }
134
+ currentNodesLine.push([parseFloat(longitude), parseFloat(latitude)]);
135
+ projectedFeatureCollection.features.push({
136
+ type: "Feature",
137
+ geometry: {
138
+ type: "LineString",
139
+ coordinates: currentNodesLine
140
+ },
141
+ properties: {}
142
+ });
143
+ nodes.set(`${longitude},${latitude}`, {
144
+ id: `${longitude},${latitude}`,
145
+ coord: [longitude, latitude],
146
+ properties: feature2.properties
147
+ });
148
+ }
149
+ }
150
+ featureIndex += 1;
151
+ }
152
+ return projectedFeatureCollection;
153
+ }
154
+ function findMatchedNode(nodeCoordMap, coord, snapThreshold) {
155
+ let nearestNodeId = null;
156
+ nodeCoordMap.forEach((nodeId, coordKey) => {
157
+ const [lng, lat] = coordKey.split(",").map(Number);
158
+ const distance$1 = distance(point([lng, lat]), point(coord)) * 1e3;
159
+ if (distance$1 < snapThreshold) {
160
+ nearestNodeId = coordKey;
161
+ }
162
+ });
163
+ return nearestNodeId;
164
+ }
165
+ })();
@@ -0,0 +1,113 @@
1
+ import createGraph from "ngraph.graph";
2
+ import * as turf from "@turf/turf"
3
+ import { FeatureCollection, LineString } from "geojson";
4
+ import { NodeData } from "@/util/graphUtil/type";
5
+
6
+ self.onmessage = (e: MessageEvent<{ geoJson: GeoJSON.FeatureCollection<GeoJSON.MultiLineString | GeoJSON.LineString>; snapThreshold: number }>) => {
7
+
8
+ let data:any = convertGeoJsonToGraph(e.data.geoJson, e.data.snapThreshold)
9
+
10
+ self.postMessage(data)
11
+
12
+ }
13
+
14
+
15
+
16
+
17
+ export function convertGeoJsonToGraph(
18
+ geoJson: GeoJSON.FeatureCollection<
19
+ GeoJSON.MultiLineString | GeoJSON.LineString
20
+ >,
21
+ snapThreshold: number
22
+ ) {
23
+ let projectedFeatureCollection: FeatureCollection<LineString> = {
24
+ features: [],
25
+ type: 'FeatureCollection'
26
+ }
27
+ //所有节点集合
28
+ const nodes = new Map<string, NodeData>();
29
+
30
+ let featureIndex = 0
31
+ for (let feature of geoJson.features) {
32
+ //判断类型
33
+ if (!['LineString', 'MultiLineString'].includes(feature.geometry?.type)) {
34
+ console.warn(`Feature ${featureIndex} 不是线数据,跳过`);
35
+ return;
36
+ }
37
+ //标准化坐标结构
38
+ let coordinates: any[] = [];
39
+
40
+ if (feature.geometry.type === 'LineString') {
41
+ coordinates = [feature.geometry.coordinates];
42
+ } else if (feature.geometry.type === 'MultiLineString') {
43
+ coordinates = feature.geometry.coordinates;
44
+ }
45
+
46
+ // 循环每一条线路 (替换forEach为for...of)
47
+ for (const line of coordinates) {
48
+ let currentNodesLine: any[] = [];
49
+
50
+ // 循环每一条线路的节点 (替换forEach为for...of,需要手动维护index)
51
+ for (const [index, position] of line.entries()) {
52
+ const [lng, lat] = position;
53
+ let currentNodeId: any = null;
54
+
55
+ let longitude = lng
56
+ let latitude = lat
57
+
58
+ // 判断是否是线路的第一个或最后一个节点
59
+ if (index === 0 || index === line.length - 1) {
60
+ currentNodeId = findMatchedNode(nodes, [lng, lat], snapThreshold);
61
+ if (currentNodeId) {
62
+ let positionCoord = currentNodeId.split(',')
63
+ longitude = positionCoord[0]
64
+ latitude = positionCoord[1]
65
+ }
66
+ }
67
+
68
+ currentNodesLine.push([parseFloat(longitude), parseFloat(latitude)])
69
+
70
+ projectedFeatureCollection.features.push({
71
+ type: 'Feature',
72
+ geometry: {
73
+ type: 'LineString',
74
+ coordinates: currentNodesLine
75
+ },
76
+ properties: {}
77
+ })
78
+
79
+
80
+
81
+ // 往nodes Map中添加节点数据
82
+ nodes.set(`${longitude},${latitude}`, {
83
+ id: `${longitude},${latitude}`,
84
+ coord: [longitude, latitude],
85
+ properties: feature.properties
86
+ });
87
+ }
88
+
89
+
90
+ }
91
+
92
+ featureIndex += 1
93
+ }
94
+
95
+ return projectedFeatureCollection;
96
+
97
+ }
98
+
99
+
100
+
101
+ function findMatchedNode(nodeCoordMap: Map<string, NodeData>, coord: number[], snapThreshold: number) {
102
+ let nearestNodeId: string | null = null;
103
+
104
+ nodeCoordMap.forEach((nodeId, coordKey) => {
105
+ const [lng, lat] = coordKey.split(',').map(Number);
106
+ const distance = turf.distance(turf.point([lng, lat]), turf.point(coord)) * 1000;
107
+ if (distance < snapThreshold) {
108
+ nearestNodeId = coordKey
109
+ }
110
+ })
111
+
112
+ return nearestNodeId;
113
+ }
@@ -0,0 +1,110 @@
1
+ import { Cartesian3 } from "cesium";
2
+ import * as THREE from "three";
3
+ import {
4
+ computeBoundsTree,
5
+ disposeBoundsTree,
6
+ computeBatchedBoundsTree,
7
+ disposeBatchedBoundsTree,
8
+ acceleratedRaycast,
9
+ } from "three-mesh-bvh";
10
+
11
+ // Add the extension functions
12
+ THREE.BufferGeometry.prototype.computeBoundsTree = computeBoundsTree;
13
+ THREE.BufferGeometry.prototype.disposeBoundsTree = disposeBoundsTree;
14
+ THREE.Mesh.prototype.raycast = acceleratedRaycast;
15
+
16
+ THREE.BatchedMesh.prototype.computeBoundsTree = computeBatchedBoundsTree;
17
+ THREE.BatchedMesh.prototype.disposeBoundsTree = disposeBatchedBoundsTree;
18
+ THREE.BatchedMesh.prototype.raycast = acceleratedRaycast;
19
+
20
+ self.onmessage = async (e: any) => {
21
+ let props: {
22
+ graphicsObjectUrl: string[];
23
+ rayPositions: Array<{
24
+ startPosition: Cartesian3;
25
+ endPosition: Cartesian3;
26
+ originPosition: Cartesian3;
27
+ }>;
28
+ } = e.data;
29
+
30
+
31
+ let graphicsObjectLoader = new THREE.ObjectLoader();
32
+
33
+ let graphicsObject3DCollection: THREE.Object3D<THREE.Object3DEventMap>[] = [];
34
+
35
+
36
+ for (let index = 0; index < props.graphicsObjectUrl.length; index++) {
37
+ const url = props.graphicsObjectUrl[index];
38
+ let modelResolveFun: ((arg0: boolean) => void) | undefined = undefined;
39
+ //等待模型对象构建完成
40
+ graphicsObjectLoader.load(url, (modelGroup) => {
41
+ graphicsObject3DCollection.push(modelGroup);
42
+ if (modelResolveFun) {
43
+ modelResolveFun(true);
44
+ }
45
+ });
46
+ await new Promise((resolve) => (modelResolveFun = resolve));
47
+ }
48
+
49
+ let result = actionRay(props.rayPositions, graphicsObject3DCollection);
50
+
51
+ self.postMessage(result)
52
+ };
53
+
54
+ function actionRay(
55
+ rayPositions: Array<{
56
+ startPosition: Cartesian3;
57
+ endPosition: Cartesian3;
58
+ originPosition: Cartesian3;
59
+ }>,
60
+ graphicsObject3D: THREE.Object3D<THREE.Object3DEventMap>[]
61
+ ) {
62
+ graphicsObject3D.forEach((obj) => {
63
+ obj.updateMatrixWorld();
64
+ });
65
+
66
+ let tilesGroundPositions: any[] = [];
67
+ let index = 0;
68
+ for (let info of rayPositions) {
69
+ const startPoint = new THREE.Vector3(
70
+ info.startPosition.x,
71
+ info.startPosition.y,
72
+ info.startPosition.z
73
+ ); // 起点坐标
74
+ const endPoint = new THREE.Vector3(
75
+ info.endPosition.x,
76
+ info.endPosition.y,
77
+ info.endPosition.z
78
+ ); // 终点坐标
79
+ const direction = new THREE.Vector3().subVectors(endPoint, startPoint);
80
+ direction.normalize();
81
+ const raycaster = new THREE.Raycaster();
82
+ raycaster.far=999999999
83
+ raycaster.near=0
84
+ raycaster.params.Line={
85
+ threshold:0.1
86
+ }
87
+ raycaster.params.Line2 = {
88
+ threshold: 0.1, // 检测阈值,数值越大检测范围越宽
89
+ };
90
+ raycaster.set(startPoint, direction);
91
+
92
+ let point = raycaster.intersectObjects([...graphicsObject3D]);
93
+
94
+ if (point.length > 0) {
95
+ tilesGroundPositions.push({
96
+ index,
97
+ position: point[0].point,
98
+ });
99
+ }else{
100
+ tilesGroundPositions.push({
101
+ index,
102
+ undefined,
103
+ });
104
+ }
105
+
106
+ index += 1;
107
+ }
108
+
109
+ return tilesGroundPositions;
110
+ }
@@ -3002,7 +3002,7 @@ canvas[data-v-b994ab5a] {
3002
3002
  --el-button-active-bg-color: rgba(40, 40, 60, 0.8);
3003
3003
  --el-button-active-border-color: rgba(60, 60, 80, 0.5);
3004
3004
  }
3005
- .component-ui[data-v-7c97192c] {
3005
+ .component-ui[data-v-acaf6e87] {
3006
3006
  border-radius: 8px;
3007
3007
  padding: 16px;
3008
3008
  position: absolute;
@@ -3017,37 +3017,37 @@ canvas[data-v-b994ab5a] {
3017
3017
  width: 330px;
3018
3018
  font-family: "Microsoft YaHei", sans-serif;
3019
3019
  }
3020
- .component-ui .header[data-v-7c97192c] {
3020
+ .component-ui .header[data-v-acaf6e87] {
3021
3021
  display: flex;
3022
3022
  justify-content: space-between;
3023
3023
  align-items: center;
3024
3024
  width: 100%;
3025
3025
  margin-bottom: 12px;
3026
3026
  }
3027
- .component-ui .header span[data-v-7c97192c] {
3027
+ .component-ui .header span[data-v-acaf6e87] {
3028
3028
  font-size: 18px;
3029
3029
  font-weight: 600;
3030
3030
  }
3031
- .component-ui .header .tip-icon[data-v-7c97192c] {
3031
+ .component-ui .header .tip-icon[data-v-acaf6e87] {
3032
3032
  width: 16px;
3033
3033
  height: 16px;
3034
3034
  margin: -2px 8px;
3035
3035
  cursor: help;
3036
3036
  color: #ccc;
3037
3037
  }
3038
- .component-ui .header .tip-icon[data-v-7c97192c]:hover {
3038
+ .component-ui .header .tip-icon[data-v-acaf6e87]:hover {
3039
3039
  color: #fff;
3040
3040
  }
3041
- .component-ui .header .closeBth[data-v-7c97192c] {
3041
+ .component-ui .header .closeBth[data-v-acaf6e87] {
3042
3042
  width: 24px;
3043
3043
  height: 24px;
3044
3044
  cursor: pointer;
3045
3045
  color: #ccc;
3046
3046
  }
3047
- .component-ui .header .closeBth[data-v-7c97192c]:hover {
3047
+ .component-ui .header .closeBth[data-v-acaf6e87]:hover {
3048
3048
  color: #fff;
3049
3049
  }
3050
- .component-ui .container[data-v-7c97192c] {
3050
+ .component-ui .container[data-v-acaf6e87] {
3051
3051
  display: flex;
3052
3052
  flex-direction: column;
3053
3053
  width: 100%;
@@ -3055,27 +3055,27 @@ canvas[data-v-b994ab5a] {
3055
3055
  align-items: center;
3056
3056
  justify-content: center;
3057
3057
  }
3058
- .fileSelectContainer[data-v-7c97192c] {
3058
+ .fileSelectContainer[data-v-acaf6e87] {
3059
3059
  display: flex;
3060
3060
  flex-direction: column;
3061
3061
  }
3062
- .treeContainer[data-v-7c97192c] {
3062
+ .treeContainer[data-v-acaf6e87] {
3063
3063
  min-width: 300px;
3064
3064
  margin-top: 15px;
3065
3065
  }
3066
- .treeContainer .icon[data-v-7c97192c] {
3066
+ .treeContainer .icon[data-v-acaf6e87] {
3067
3067
  color: aqua;
3068
3068
  width: 20px;
3069
3069
  height: 20px;
3070
3070
  cursor: pointer;
3071
3071
  }
3072
- .treeContainer[data-v-7c97192c] .el-tree__empty-block {
3072
+ .treeContainer[data-v-acaf6e87] .el-tree__empty-block {
3073
3073
  background-color: rgb(0, 0, 0);
3074
3074
  }
3075
- .treeContainer[data-v-7c97192c] .el-tree-node__content {
3075
+ .treeContainer[data-v-acaf6e87] .el-tree-node__content {
3076
3076
  background-color: rgb(0, 0, 0);
3077
3077
  }
3078
- [data-v-7c97192c] .el-button {
3078
+ [data-v-acaf6e87] .el-button {
3079
3079
  --el-button-text-color: #f0f0f0;
3080
3080
  --el-button-bg-color: rgba(60, 60, 80, 0.8);
3081
3081
  --el-button-border-color: rgba(80, 80, 100, 0.5);