itowns 2.43.2-next.10 → 2.43.2-next.12
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/itowns.js +1 -1
- package/dist/itowns.js.map +1 -1
- package/dist/itowns_potree2worker.js +2 -0
- package/dist/itowns_potree2worker.js.map +1 -0
- package/examples/config.json +1 -0
- package/examples/potree2_25d_map.html +127 -0
- package/lib/Core/Potree2Node.js +201 -0
- package/lib/Core/Potree2PointAttributes.js +139 -0
- package/lib/Core/Scheduler/Scheduler.js +1 -1
- package/lib/Layer/Potree2Layer.js +165 -0
- package/lib/Loader/Potree2BrotliLoader.js +261 -0
- package/lib/Loader/Potree2Loader.js +207 -0
- package/lib/Main.js +2 -0
- package/lib/Parser/LASParser.js +1 -1
- package/lib/Parser/Potree2BinParser.js +92 -0
- package/lib/Renderer/PointsMaterial.js +1 -1
- package/lib/Source/FileSource.js +1 -1
- package/lib/Source/Potree2Source.js +172 -0
- package/lib/Worker/Potree2Worker.js +21 -0
- package/package.json +4 -2
- /package/lib/{Parser → Loader}/LASLoader.js +0 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import Source from "./Source.js";
|
|
2
|
+
import Fetcher from "../Provider/Fetcher.js";
|
|
3
|
+
import Potree2BinParser from "../Parser/Potree2BinParser.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @classdesc
|
|
7
|
+
* Potree2Source are object containing informations on how to fetch potree 2.0 points cloud resources.
|
|
8
|
+
*
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
class Potree2Source extends Source {
|
|
13
|
+
/**
|
|
14
|
+
* @param {Object} source - An object that can contain all properties of a
|
|
15
|
+
* Potree2Source
|
|
16
|
+
* @param {string} source.url - folder url.
|
|
17
|
+
* @param {string} source.file - metadata file name.
|
|
18
|
+
*
|
|
19
|
+
* This `metadata` file stores information about the potree cloud 2.0 in JSON format. the structure is :
|
|
20
|
+
*
|
|
21
|
+
* * __`version`__ - The metadata.json format may change over time. The version number is
|
|
22
|
+
* necessary so that parsers know how to interpret the data.
|
|
23
|
+
* * __`name`__ - Point cloud name.
|
|
24
|
+
* * __`description`__ - Point cloud description.
|
|
25
|
+
* * __`points`__ - Total number of points.
|
|
26
|
+
* * __`projection`__ - Point cloud geographic projection system.
|
|
27
|
+
* * __`hierarchy`__ - Information about point cloud hierarchy (first chunk size, step size, octree depth).
|
|
28
|
+
* * __`offset`__ - Position offset used to determine the global point position.
|
|
29
|
+
* * __`scale`__ - Point cloud scale.
|
|
30
|
+
* * __`spacing`__ - The minimum distance between points at root level.
|
|
31
|
+
* * __`boundingBox`__ - Contains the minimum and maximum of the axis aligned bounding box. This bounding box is cubic and aligned to fit to the octree root.
|
|
32
|
+
* * __`encoding`__ - Encoding type: BROTLI or DEFAULT (uncompressed).
|
|
33
|
+
* * __`attributes`__ - Array of attributes (position, intensity, return number, number of returns, classification, scan angle rank, user data, point source id, gps-time, rgb).
|
|
34
|
+
* ```
|
|
35
|
+
* {
|
|
36
|
+
* version: '2.0',
|
|
37
|
+
* name: "sample",
|
|
38
|
+
* description: "",
|
|
39
|
+
* points: 534909153,
|
|
40
|
+
* projection: "",
|
|
41
|
+
* hierarchy: {
|
|
42
|
+
* firstChunkSize: 1276,
|
|
43
|
+
* stepSize: 4,
|
|
44
|
+
* depth: 16
|
|
45
|
+
* },
|
|
46
|
+
* offset: [1339072.07, 7238866.339, 85.281],
|
|
47
|
+
* scale: [0.001, 0.001, 0.002],
|
|
48
|
+
* spacing: 24.476062500005355,
|
|
49
|
+
* boundingBox: {
|
|
50
|
+
* min: [1339072.07, 7238866.339, 85.281],
|
|
51
|
+
* max: [1342205.0060000008, 7241999.275, 3218.2170000006854]
|
|
52
|
+
* },
|
|
53
|
+
* encoding: "BROTLI",
|
|
54
|
+
* attributes: [
|
|
55
|
+
* {
|
|
56
|
+
* name: "position",
|
|
57
|
+
* description: "",
|
|
58
|
+
* size: 12,
|
|
59
|
+
* numElements: 3,
|
|
60
|
+
* elementSize: 4,
|
|
61
|
+
* type: "int32",
|
|
62
|
+
* min: [-0.74821299314498901, -2.7804059982299805, 2.5478212833404541],
|
|
63
|
+
* max: [2.4514148223438199, 1.4893437627414672, 7.1957106576508663]
|
|
64
|
+
* },
|
|
65
|
+
* {
|
|
66
|
+
* name: "intensity",
|
|
67
|
+
* description: "",
|
|
68
|
+
* size: 2,
|
|
69
|
+
* numElements: 1,
|
|
70
|
+
* elementSize: 2,
|
|
71
|
+
* type: "uint16",
|
|
72
|
+
* min: [0],
|
|
73
|
+
* max: [0]
|
|
74
|
+
* },{
|
|
75
|
+
* name: "return number",
|
|
76
|
+
* description: "",
|
|
77
|
+
* size: 1,
|
|
78
|
+
* numElements: 1,
|
|
79
|
+
* elementSize: 1,
|
|
80
|
+
* type: "uint8",
|
|
81
|
+
* min: [0],
|
|
82
|
+
* max: [0]
|
|
83
|
+
* },{
|
|
84
|
+
* name: "number of returns",
|
|
85
|
+
* description: "",
|
|
86
|
+
* size: 1,
|
|
87
|
+
* numElements: 1,
|
|
88
|
+
* elementSize: 1,
|
|
89
|
+
* type: "uint8",
|
|
90
|
+
* min: [0],
|
|
91
|
+
* max: [0]
|
|
92
|
+
* },{
|
|
93
|
+
* name: "classification",
|
|
94
|
+
* description: "",
|
|
95
|
+
* size: 1,
|
|
96
|
+
* numElements: 1,
|
|
97
|
+
* elementSize: 1,
|
|
98
|
+
* type: "uint8",
|
|
99
|
+
* min: [0],
|
|
100
|
+
* max: [0]
|
|
101
|
+
* },{
|
|
102
|
+
* name: "scan angle rank",
|
|
103
|
+
* description: "",
|
|
104
|
+
* size: 1,
|
|
105
|
+
* numElements: 1,
|
|
106
|
+
* elementSize: 1,
|
|
107
|
+
* type: "uint8",
|
|
108
|
+
* min: [0],
|
|
109
|
+
* max: [0]
|
|
110
|
+
* },{
|
|
111
|
+
* name: "user data",
|
|
112
|
+
* description: "",
|
|
113
|
+
* size: 1,
|
|
114
|
+
* numElements: 1,
|
|
115
|
+
* elementSize: 1,
|
|
116
|
+
* type: "uint8",
|
|
117
|
+
* min: [0],
|
|
118
|
+
* max: [0]
|
|
119
|
+
* },{
|
|
120
|
+
* name: "point source id",
|
|
121
|
+
* description: "",
|
|
122
|
+
* size: 2,
|
|
123
|
+
* numElements: 1,
|
|
124
|
+
* elementSize: 2,
|
|
125
|
+
* type: "uint16",
|
|
126
|
+
* min: [0],
|
|
127
|
+
* max: [0]
|
|
128
|
+
* },{
|
|
129
|
+
* name: "gps-time",
|
|
130
|
+
* description: "",
|
|
131
|
+
* size: 8,
|
|
132
|
+
* numElements: 1,
|
|
133
|
+
* elementSize: 8,
|
|
134
|
+
* type: "double",
|
|
135
|
+
* min: [0],
|
|
136
|
+
* max: [0]
|
|
137
|
+
* },{
|
|
138
|
+
* name: "rgb",
|
|
139
|
+
* description: "",
|
|
140
|
+
* size: 6,
|
|
141
|
+
* numElements: 3,
|
|
142
|
+
* elementSize: 2,
|
|
143
|
+
* type: "uint16",
|
|
144
|
+
* min: [5632, 5376, 4864],
|
|
145
|
+
* max: [65280, 65280, 65280]
|
|
146
|
+
* }
|
|
147
|
+
* ]
|
|
148
|
+
* }
|
|
149
|
+
* ```
|
|
150
|
+
*
|
|
151
|
+
* @extends Source
|
|
152
|
+
*
|
|
153
|
+
* @constructor
|
|
154
|
+
*/
|
|
155
|
+
constructor(source) {
|
|
156
|
+
if (!source.file) {
|
|
157
|
+
throw new Error('New Potree2Source: file is required');
|
|
158
|
+
}
|
|
159
|
+
super(source);
|
|
160
|
+
this.file = source.file;
|
|
161
|
+
this.fetcher = Fetcher.arrayBuffer;
|
|
162
|
+
this.whenReady = (source.metadata ? Promise.resolve(source.metadata) : Fetcher.json(`${this.url}/${this.file}`, this.networkOptions)).then(metadata => {
|
|
163
|
+
this.metadata = metadata;
|
|
164
|
+
this.pointAttributes = metadata.attributes;
|
|
165
|
+
this.baseurl = `${this.url}`;
|
|
166
|
+
this.extension = 'bin';
|
|
167
|
+
this.parser = Potree2BinParser.parse;
|
|
168
|
+
return metadata;
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
export default Potree2Source;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import load from "../Loader/Potree2Loader.js";
|
|
2
|
+
import loadBrotli from "../Loader/Potree2BrotliLoader.js";
|
|
3
|
+
import { expose, Transfer } from 'threads/worker';
|
|
4
|
+
function transfer(buffer, data) {
|
|
5
|
+
const transferables = [];
|
|
6
|
+
Object.keys(data.attributeBuffers).forEach(property => {
|
|
7
|
+
transferables.push(data.attributeBuffers[property].buffer);
|
|
8
|
+
});
|
|
9
|
+
transferables.push(buffer);
|
|
10
|
+
return transferables;
|
|
11
|
+
}
|
|
12
|
+
expose({
|
|
13
|
+
async parse(buffer, options) {
|
|
14
|
+
const data = await load(buffer, options);
|
|
15
|
+
return Transfer(data, transfer(buffer, data));
|
|
16
|
+
},
|
|
17
|
+
async parseBrotli(buffer, options) {
|
|
18
|
+
const data = await loadBrotli(buffer, options);
|
|
19
|
+
return Transfer(data, transfer(buffer, data));
|
|
20
|
+
}
|
|
21
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "itowns",
|
|
3
|
-
"version": "2.43.2-next.
|
|
3
|
+
"version": "2.43.2-next.12",
|
|
4
4
|
"description": "A JS/WebGL framework for 3D geospatial data visualization",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/Main.js",
|
|
@@ -61,11 +61,13 @@
|
|
|
61
61
|
"@mapbox/vector-tile": "^1.3.1",
|
|
62
62
|
"@tmcw/togeojson": "^5.8.1",
|
|
63
63
|
"@tweenjs/tween.js": "^18.6.4",
|
|
64
|
+
"brotli-compress": "^1.3.3",
|
|
64
65
|
"copc": "^0.0.6",
|
|
65
66
|
"earcut": "^2.2.4",
|
|
66
67
|
"js-priority-queue": "^0.1.5",
|
|
67
68
|
"pbf": "^3.2.1",
|
|
68
|
-
"shpjs": "^4.0.4"
|
|
69
|
+
"shpjs": "^4.0.4",
|
|
70
|
+
"threads": "^1.7.0"
|
|
69
71
|
},
|
|
70
72
|
"peerDependencies": {
|
|
71
73
|
"proj4": "^2.9.2",
|
|
File without changes
|