@file-viewer/renderer-3d 3.3.0 → 3.3.3
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/GEO3D.md +11 -5
- package/GEO3D_THIRD_PARTY_NOTICES.md +53 -1
- package/IFC.md +1 -1
- package/bin/copy-geo3d-assets.mjs +7 -3
- package/bin/copy-ifc-assets.mjs +5 -5
- package/dist/geo3d-workers/las-worker.js +1 -1
- package/dist/geo3d-workers/manifest.json +1 -1
- package/dist/geo3dCrs.js +4 -0
- package/dist/geo3dCrsAliases.generated.d.ts +38 -0
- package/dist/geo3dCrsAliases.generated.js +38 -0
- package/dist/geo3dCrsCatalog.d.ts +2 -0
- package/dist/geo3dCrsCatalog.js +51 -0
- package/dist/geo3dLasCrs.js +44 -1
- package/licenses/PROJ-COPYING.txt +34 -0
- package/licenses/PROJ-NOTICE.txt +35 -0
- package/package.json +12 -5
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import catalog from 'epsg-index/all.json' with { type: 'json' };
|
|
2
|
+
import { crsAliases } from './geo3dCrsAliases.generated.js';
|
|
3
|
+
const normalize = (name) => name.normalize('NFKC').toLowerCase().replace(/\s+/g, '').trim();
|
|
4
|
+
const names = new Map();
|
|
5
|
+
const add = (name, code) => {
|
|
6
|
+
const key = normalize(name);
|
|
7
|
+
if (!names.has(key))
|
|
8
|
+
names.set(key, new Set());
|
|
9
|
+
names.get(key).add(code);
|
|
10
|
+
};
|
|
11
|
+
for (const entry of Object.values(catalog))
|
|
12
|
+
add(entry.name, entry.code);
|
|
13
|
+
for (const [kind, code, name] of crsAliases) {
|
|
14
|
+
const entry = catalog[code];
|
|
15
|
+
if (entry && (kind !== 'projected_crs' || entry.kind === 'CRS-PROJCRS'))
|
|
16
|
+
add(name, code);
|
|
17
|
+
}
|
|
18
|
+
export function offlineEpsgDefinition(id) {
|
|
19
|
+
const entry = /^EPSG:(\d+)$/.exec(id);
|
|
20
|
+
const definition = entry ? catalog[entry[1]]?.proj4 || catalog[entry[1]]?.wkt : undefined;
|
|
21
|
+
if (definition && /\+nadgrids=(?!@?null(?:\s|$))/.test(definition))
|
|
22
|
+
throw new Error(`Geo3D CRS ${id} requires its offline datum grids; register the complete verified definition before loading.`);
|
|
23
|
+
return definition;
|
|
24
|
+
}
|
|
25
|
+
export function resolveCitedCrs(citation, model, units) {
|
|
26
|
+
const expectedKind = model === 1 ? 'CRS-PROJCRS' : model === 2 ? 'CRS-GEOGCRS' : model === 3 ? 'CRS-GCENCRS' : undefined;
|
|
27
|
+
if (model !== undefined && !expectedKind)
|
|
28
|
+
return undefined;
|
|
29
|
+
const candidates = new Map();
|
|
30
|
+
for (const name of [citation, ...citation.split(/[,|\0]/)]) {
|
|
31
|
+
const authority = /^(?:EPSG\s*:\s*|urn:ogc:def:crs:EPSG::|https?:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/)(\d+)$/i.exec(name.trim());
|
|
32
|
+
for (const code of authority ? [authority[1]] : names.get(normalize(name)) || []) {
|
|
33
|
+
if (!catalog[code])
|
|
34
|
+
continue;
|
|
35
|
+
const entry = catalog[code];
|
|
36
|
+
if (!expectedKind || entry.kind === expectedKind)
|
|
37
|
+
candidates.set(code, entry);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (candidates.size > 1)
|
|
41
|
+
throw new Error('Conflicting or ambiguous LAS CRS citation names.');
|
|
42
|
+
const entry = [...candidates.values()][0];
|
|
43
|
+
if (!entry)
|
|
44
|
+
return undefined;
|
|
45
|
+
if (entry.kind === 'CRS-PROJCRS' && units !== undefined) {
|
|
46
|
+
const unit = { 9001: 'metre', 9002: 'foot', 9003: 'US survey foot' }[units];
|
|
47
|
+
if (!unit || entry.unit !== unit)
|
|
48
|
+
throw new Error('LAS CRS citation conflicts with its declared linear units.');
|
|
49
|
+
}
|
|
50
|
+
return `EPSG:${entry.code}`;
|
|
51
|
+
}
|
package/dist/geo3dLasCrs.js
CHANGED
|
@@ -12,7 +12,7 @@ export function parseLasGeoKeys(bytes) {
|
|
|
12
12
|
for (let i = 0; i < count; i++) {
|
|
13
13
|
const offset = 8 + i * 8;
|
|
14
14
|
const key = data.getUint16(offset, true);
|
|
15
|
-
if (![1024, 2048, 3072].includes(key))
|
|
15
|
+
if (![1024, 2048, 3072, 3076].includes(key))
|
|
16
16
|
continue;
|
|
17
17
|
if (data.getUint16(offset + 2, true) !== 0 || data.getUint16(offset + 4, true) !== 1)
|
|
18
18
|
throw new Error('Unsupported LAS GeoKey CRS value encoding.');
|
|
@@ -48,17 +48,25 @@ export async function inspectLasCrsRangeSource(getter) {
|
|
|
48
48
|
throw new Error('Invalid LAS VLR metadata bounds.');
|
|
49
49
|
let crs;
|
|
50
50
|
let hasCrsMetadata = false;
|
|
51
|
+
const directories = [];
|
|
52
|
+
let ascii;
|
|
51
53
|
const inspectPayload = async (userId, id, begin, end) => {
|
|
52
54
|
if (userId !== 'LASF_Projection' || ![2112, 34735, 34736, 34737].includes(id) || end === begin)
|
|
53
55
|
return;
|
|
54
56
|
const payload = await exact(begin, end);
|
|
55
57
|
hasCrsMetadata ||= id === 34735 || id === 34736 || !!text(payload);
|
|
56
58
|
if (id === 34735) {
|
|
59
|
+
directories.push(payload);
|
|
57
60
|
const candidate = parseLasGeoKeys(payload);
|
|
58
61
|
if (crs && candidate && crs !== candidate)
|
|
59
62
|
throw new Error('Conflicting LAS GeoKey CRS directories.');
|
|
60
63
|
crs = candidate ?? crs;
|
|
61
64
|
}
|
|
65
|
+
if (id === 34737) {
|
|
66
|
+
if (ascii && (ascii.length !== payload.length || ascii.some((byte, i) => byte !== payload[i])))
|
|
67
|
+
throw new Error('Conflicting LAS GeoASCII CRS metadata.');
|
|
68
|
+
ascii = payload;
|
|
69
|
+
}
|
|
62
70
|
};
|
|
63
71
|
for (let i = 0; i < count; i++) {
|
|
64
72
|
if (offset + 54 > end)
|
|
@@ -92,5 +100,40 @@ export async function inspectLasCrsRangeSource(getter) {
|
|
|
92
100
|
offset = next;
|
|
93
101
|
}
|
|
94
102
|
}
|
|
103
|
+
if (ascii) {
|
|
104
|
+
for (const directory of directories) {
|
|
105
|
+
const data = view(directory), count = data.getUint16(6, true);
|
|
106
|
+
const inline = new Map();
|
|
107
|
+
const citations = [];
|
|
108
|
+
for (let i = 0; i < count; i++) {
|
|
109
|
+
const offset = 8 + i * 8, key = data.getUint16(offset, true);
|
|
110
|
+
const location = data.getUint16(offset + 2, true), length = data.getUint16(offset + 4, true), begin = data.getUint16(offset + 6, true);
|
|
111
|
+
if (key === 3076 && (location !== 0 || length !== 1))
|
|
112
|
+
throw new Error('Unsupported LAS linear-unit GeoKey encoding.');
|
|
113
|
+
if (location === 0 && length === 1) {
|
|
114
|
+
if (inline.has(key) && inline.get(key) !== begin)
|
|
115
|
+
throw new Error('Conflicting LAS GeoKey values.');
|
|
116
|
+
inline.set(key, begin);
|
|
117
|
+
}
|
|
118
|
+
if (![1026, 2049, 3073].includes(key))
|
|
119
|
+
continue;
|
|
120
|
+
if (location !== 34737 || !length || begin + length > ascii.length)
|
|
121
|
+
throw new Error('Invalid LAS CRS citation bounds.');
|
|
122
|
+
citations.push({ key, value: text(ascii.subarray(begin, begin + length)) });
|
|
123
|
+
}
|
|
124
|
+
if (!citations.length)
|
|
125
|
+
continue;
|
|
126
|
+
const { resolveCitedCrs } = await import('./geo3dCrsCatalog.js');
|
|
127
|
+
for (const citation of citations) {
|
|
128
|
+
const model = inline.get(1024);
|
|
129
|
+
if (model === 1 && citation.key === 2049)
|
|
130
|
+
continue;
|
|
131
|
+
const candidate = resolveCitedCrs(citation.value, model ?? (citation.key === 3073 ? 1 : citation.key === 2049 ? 2 : undefined), inline.get(3076));
|
|
132
|
+
if (crs && candidate && crs !== candidate)
|
|
133
|
+
throw new Error('LAS CRS citation conflicts with its authoritative GeoKey.');
|
|
134
|
+
crs = candidate ?? crs;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
95
138
|
return { crs, hasCrsMetadata };
|
|
96
139
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
|
|
2
|
+
All source, data files and other contents of the PROJ package are
|
|
3
|
+
available under the following terms. Note that the PROJ 4.3 and earlier
|
|
4
|
+
was "public domain" as is common with US government work, but apparently
|
|
5
|
+
this is not a well defined legal term in many countries. Frank Warmerdam placed
|
|
6
|
+
everything under the following MIT style license because he believed it is
|
|
7
|
+
effectively the same as public domain, allowing anyone to use the code as
|
|
8
|
+
they wish, including making proprietary derivatives.
|
|
9
|
+
|
|
10
|
+
Initial PROJ 4.3 public domain code was put as Frank Warmerdam as copyright
|
|
11
|
+
holder, but he didn't mean to imply he did the work. Essentially all work was
|
|
12
|
+
done by Gerald Evenden.
|
|
13
|
+
|
|
14
|
+
Copyright information can be found in source files.
|
|
15
|
+
|
|
16
|
+
--------------
|
|
17
|
+
|
|
18
|
+
Permission is hereby granted, free of charge, to any person obtaining a
|
|
19
|
+
copy of this software and associated documentation files (the "Software"),
|
|
20
|
+
to deal in the Software without restriction, including without limitation
|
|
21
|
+
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
22
|
+
and/or sell copies of the Software, and to permit persons to whom the
|
|
23
|
+
Software is furnished to do so, subject to the following conditions:
|
|
24
|
+
|
|
25
|
+
The above copyright notice and this permission notice shall be included
|
|
26
|
+
in all copies or substantial portions of the Software.
|
|
27
|
+
|
|
28
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
29
|
+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
30
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
31
|
+
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
32
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
33
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
34
|
+
DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
PROJ 9.9.0 CRS aliases; upstream commit 1df2be61c0e4732aa1326126113776b291ae7657.
|
|
2
|
+
|
|
3
|
+
All source, data files and other contents of the PROJ package are
|
|
4
|
+
available under the following terms. Note that the PROJ 4.3 and earlier
|
|
5
|
+
was "public domain" as is common with US government work, but apparently
|
|
6
|
+
this is not a well defined legal term in many countries. Frank Warmerdam placed
|
|
7
|
+
everything under the following MIT style license because he believed it is
|
|
8
|
+
effectively the same as public domain, allowing anyone to use the code as
|
|
9
|
+
they wish, including making proprietary derivatives.
|
|
10
|
+
|
|
11
|
+
Initial PROJ 4.3 public domain code was put as Frank Warmerdam as copyright
|
|
12
|
+
holder, but he didn't mean to imply he did the work. Essentially all work was
|
|
13
|
+
done by Gerald Evenden.
|
|
14
|
+
|
|
15
|
+
Copyright information can be found in source files.
|
|
16
|
+
|
|
17
|
+
--------------
|
|
18
|
+
|
|
19
|
+
Permission is hereby granted, free of charge, to any person obtaining a
|
|
20
|
+
copy of this software and associated documentation files (the "Software"),
|
|
21
|
+
to deal in the Software without restriction, including without limitation
|
|
22
|
+
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
23
|
+
and/or sell copies of the Software, and to permit persons to whom the
|
|
24
|
+
Software is furnished to do so, subject to the following conditions:
|
|
25
|
+
|
|
26
|
+
The above copyright notice and this permission notice shall be included
|
|
27
|
+
in all copies or substantial portions of the Software.
|
|
28
|
+
|
|
29
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
30
|
+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
31
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
32
|
+
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
33
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
34
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
35
|
+
DEALINGS IN THE SOFTWARE.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@file-viewer/renderer-3d",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Standalone 3D model renderer plugin for File Viewer powered by Three.js loaders and OrbitControls.",
|
|
@@ -98,6 +98,10 @@
|
|
|
98
98
|
"dist/geo3dCityJson.js",
|
|
99
99
|
"dist/geo3dCrs.d.ts",
|
|
100
100
|
"dist/geo3dCrs.js",
|
|
101
|
+
"dist/geo3dCrsAliases.generated.d.ts",
|
|
102
|
+
"dist/geo3dCrsAliases.generated.js",
|
|
103
|
+
"dist/geo3dCrsCatalog.d.ts",
|
|
104
|
+
"dist/geo3dCrsCatalog.js",
|
|
101
105
|
"dist/geo3dHooks.d.ts",
|
|
102
106
|
"dist/geo3dHooks.js",
|
|
103
107
|
"dist/geo3dInspect.d.ts",
|
|
@@ -145,6 +149,8 @@
|
|
|
145
149
|
"licenses/lerc-LICENSE",
|
|
146
150
|
"licenses/lerc-NOTICE",
|
|
147
151
|
"licenses/lerc-PROVENANCE.md",
|
|
152
|
+
"licenses/PROJ-COPYING.txt",
|
|
153
|
+
"licenses/PROJ-NOTICE.txt",
|
|
148
154
|
"licenses/thatopen-components-MIT.txt",
|
|
149
155
|
"licenses/thatopen-fragments-MIT.txt",
|
|
150
156
|
"README.en.md",
|
|
@@ -152,8 +158,9 @@
|
|
|
152
158
|
"README.zh-CN.md"
|
|
153
159
|
],
|
|
154
160
|
"dependencies": {
|
|
155
|
-
"@file-viewer/core": "3.3.
|
|
156
|
-
"@file-viewer/geometry-engine": "3.3.
|
|
161
|
+
"@file-viewer/core": "3.3.3",
|
|
162
|
+
"@file-viewer/geometry-engine": "3.3.3",
|
|
163
|
+
"epsg-index": "2.0.0",
|
|
157
164
|
"@types/emscripten": "^1.41.6",
|
|
158
165
|
"three": "^0.186.0"
|
|
159
166
|
},
|
|
@@ -163,8 +170,8 @@
|
|
|
163
170
|
"file-viewer-geo3d-assets": "./bin/copy-geo3d-assets.mjs"
|
|
164
171
|
},
|
|
165
172
|
"peerDependencies": {
|
|
166
|
-
"@thatopen/components": "3.
|
|
167
|
-
"@thatopen/fragments": "3.
|
|
173
|
+
"@thatopen/components": "3.6.0",
|
|
174
|
+
"@thatopen/fragments": "3.6.0",
|
|
168
175
|
"web-ifc": "0.0.77",
|
|
169
176
|
"esbuild": "^0.28.2",
|
|
170
177
|
"@giro3d/giro3d": "2.0.5",
|