cesium-alpha-earth 1.0.73 → 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.
@@ -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
+ }
package/dist/index.js CHANGED
@@ -273553,6 +273553,15 @@ function createPolyLineArrowPrimitive(positions2, options) {
273553
273553
  });
273554
273554
  return primitive;
273555
273555
  }
273556
+ function createMyWorker() {
273557
+ let worker;
273558
+ worker = new Worker(new URL(
273559
+ /* @vite-ignore */
273560
+ "/assets/geojson2Line-D52oeUm7.js",
273561
+ import.meta.url
273562
+ ));
273563
+ return worker;
273564
+ }
273556
273565
  /**
273557
273566
  * @license
273558
273567
  * Copyright 2010-2025 Three.js Authors
@@ -371849,6 +371858,7 @@ export {
371849
371858
  createGuid,
371850
371859
  createImageryLayer,
371851
371860
  createMaterialPropertyDescriptor,
371861
+ createMyWorker,
371852
371862
  createOsmBuildingsAsync,
371853
371863
  createPolyLineArrowPrimitive,
371854
371864
  createPropertyDescriptor,
@@ -10,6 +10,7 @@ export { default as DrawEntity } from "./core/CesiumAlphaDraw/index";
10
10
  export { default as Tooltip } from "./util/tooltip";
11
11
  export * from "./util/graphUtil/index";
12
12
  export { createPolyLineArrowPrimitive } from "./util/primitiveCreater/index";
13
+ export { createMyWorker } from "./worker/geojson2LineWorker/index";
13
14
  export { windowToCartesian, cartesianToWindow, cartesianToDegrees, cartesianToWGS84, degreesToCartesian } from "./util/coordinateMethods";
14
15
  import { App } from "vue";
15
16
  import MeasureDistance from "./core/CesiumAlphaMeasure/MeasureDistance";
@@ -8,6 +8,7 @@ export { default as DrawEntity } from "./core/CesiumAlphaDraw/index";
8
8
  export { default as Tooltip } from "./util/tooltip";
9
9
  export * from "./util/graphUtil/index";
10
10
  export { createPolyLineArrowPrimitive } from "./util/primitiveCreater/index";
11
+ export { createMyWorker } from "./worker/geojson2LineWorker/index";
11
12
  export { windowToCartesian, cartesianToWindow, cartesianToDegrees, cartesianToWGS84, degreesToCartesian } from "./util/coordinateMethods";
12
13
  //组件部分===============================================================================
13
14
  import PositionInfoBar from "./components/PositionInfoBar/index.vue";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AAEvB,OAAO,yCAAyC,CAAC;AACjD,OAAO,6BAA6B,CAAC;AAErC,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAExE,OAAO,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEpF,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAM1E,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAErE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEpD,cAAc,wBAAwB,CAAA;AAEtC,OAAO,EAAC,4BAA4B,EAAC,MAAM,+BAA+B,CAAA;AAE1E,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAC,kBAAkB,EAAC,gBAAgB,EAAC,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAKvI,qFAAqF;AACrF,OAAO,eAAe,MAAM,wCAAwC,CAAC;AACrE,OAAO,eAAe,MAAM,2CAA2C,CAAC;AACxE,OAAO,qBAAqB,MAAM,sCAAsC,CAAC;AACzE,OAAO,cAAc,MAAM,mCAAmC,CAAC;AAC/D,OAAO,OAAO,MAAM,4BAA4B,CAAC;AACjD,OAAO,uBAAuB,MAAM,wCAAwC,CAAC;AAC7E,OAAO,mBAAmB,MAAM,oCAAoC,CAAC;AACrE,OAAO,qBAAqB,MAAM,sCAAsC,CAAC;AACzE,OAAO,eAAe,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,CAAC;AAErE,IAAI,KAAK,GAAU;IACjB,YAAY;IACZ,qBAAqB;IACrB,SAAS;IACT,eAAe;IACf,cAAc;IACd,OAAO;IACP,uBAAuB;IACvB,mBAAmB;IACnB,qBAAqB;IACrB,eAAe;IACf,mBAAmB;IACnB,MAAM;IACN,mBAAmB;IACnB,kBAAkB;IAClB,kBAAkB;IAClB,oBAAoB;IACpB,cAAc;IACd,eAAe;CAChB,CAAC;AAEF,MAAM,oBAAoB,GAAG,CAAC,GAAQ,EAAE,EAAE;IACxC,KAAK,CAAC,GAAG,CAAC,CAAC,SAAc,EAAE,EAAE;QAC3B,GAAG,CAAC,SAAS,CAAC,CAAC,OAAO,GAAG,SAAS,CAAC,IAAI,CAAW,EAAE,SAAS,CAAC,CAAC;IACjE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * 封装创建 Worker 的函数,对外暴露
3
+ * @param {Object} options - 可选配置(如 Worker 路径自定义)
4
+ * @returns {Worker} 实例化的 Worker 对象
5
+ */
6
+ declare function createMyWorker(): Worker;
7
+ export { createMyWorker };
@@ -0,0 +1,16 @@
1
+ // index.js (库的入口文件,封装 Worker 导出逻辑)
2
+ /**
3
+ * 封装创建 Worker 的函数,对外暴露
4
+ * @param {Object} options - 可选配置(如 Worker 路径自定义)
5
+ * @returns {Worker} 实例化的 Worker 对象
6
+ */
7
+ function createMyWorker() {
8
+ // 处理模块化场景(如 Webpack 等打包工具)
9
+ let worker;
10
+ // 方案1:适配打包工具(如 Webpack 的 worker-loader)
11
+ worker = new Worker(new URL('../geojson2Line.ts', import.meta.url));
12
+ return worker;
13
+ }
14
+ // 导出方式1:ES 模块导出(兼容 import/export)
15
+ export { createMyWorker };
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/worker/geojson2LineWorker/index.ts"],"names":[],"mappings":"AAAA,mCAAmC;AAEnC;;;;GAIG;AACH,SAAS,cAAc;IACrB,2BAA2B;IAC3B,IAAI,MAAM,CAAC;IACX,wCAAwC;IACxC,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,GAAG,CAAC,oBAAoB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IACpE,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,kCAAkC;AAClC,OAAO,EAAE,cAAc,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cesium-alpha-earth",
3
- "version": "1.0.73",
3
+ "version": "1.0.74",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist/*"