itowns 2.44.3-next.27 → 2.44.3-next.28
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/examples/entwine_3d_loader.html +3 -1
- package/examples/entwine_simple_loader.html +1 -1
- package/lib/Core/Geographic/Crs.js +9 -3
- package/lib/Layer/PointCloudLayer.js +5 -7
- package/lib/Source/CopcSource.js +13 -2
- package/lib/Source/EntwinePointTileSource.js +14 -4
- package/package.json +1 -1
|
@@ -87,8 +87,10 @@
|
|
|
87
87
|
eptSource = new itowns.EntwinePointTileSource({ url });
|
|
88
88
|
|
|
89
89
|
if (eptLayer) {
|
|
90
|
-
|
|
90
|
+
debugGui.removeFolder(eptLayer.debugUI);
|
|
91
|
+
view.removeLayer('Entwine Point Tile');
|
|
91
92
|
view.notifyChange();
|
|
93
|
+
eptLayer.delete();
|
|
92
94
|
}
|
|
93
95
|
|
|
94
96
|
eptLayer = new itowns.EntwinePointTileLayer('Entwine Point Tile', {
|
|
@@ -35,7 +35,11 @@ export const UNIT = {
|
|
|
35
35
|
/**
|
|
36
36
|
* Distance unit in meter.
|
|
37
37
|
*/
|
|
38
|
-
METER: 2
|
|
38
|
+
METER: 2,
|
|
39
|
+
/**
|
|
40
|
+
* Distance unit in foot.
|
|
41
|
+
*/
|
|
42
|
+
FOOT: 3
|
|
39
43
|
};
|
|
40
44
|
|
|
41
45
|
/**
|
|
@@ -50,8 +54,10 @@ export function is4326(crs) {
|
|
|
50
54
|
function unitFromProj4Unit(proj) {
|
|
51
55
|
if (proj.units === 'degrees') {
|
|
52
56
|
return UNIT.DEGREE;
|
|
53
|
-
} else if (proj.units === 'm') {
|
|
57
|
+
} else if (proj.units === 'm' || proj.units === 'meter') {
|
|
54
58
|
return UNIT.METER;
|
|
59
|
+
} else if (proj.units === 'foot') {
|
|
60
|
+
return UNIT.FOOT;
|
|
55
61
|
} else if (proj.units === undefined && proj.to_meter === undefined) {
|
|
56
62
|
// See https://proj.org/en/9.4/usage/projections.html [17/10/2024]
|
|
57
63
|
// > The default unit for projected coordinates is the meter.
|
|
@@ -65,7 +71,7 @@ function unitFromProj4Unit(proj) {
|
|
|
65
71
|
* Returns the horizontal coordinates system units associated with this CRS.
|
|
66
72
|
*
|
|
67
73
|
* @param crs - The CRS to extract the unit from.
|
|
68
|
-
* @returns Either `UNIT.METER`, `UNIT.DEGREE` or `undefined`.
|
|
74
|
+
* @returns Either `UNIT.METER`, `UNIT.DEGREE`, `UNIT.FOOT` or `undefined`.
|
|
69
75
|
*/
|
|
70
76
|
export function getUnit(crs) {
|
|
71
77
|
mustBeString(crs);
|
|
@@ -291,9 +291,6 @@ class PointCloudLayer extends GeometryLayer {
|
|
|
291
291
|
redraw: true,
|
|
292
292
|
earlyDropFunction: cmd => !cmd.requester.visible || !this.visible
|
|
293
293
|
}).then(pts => {
|
|
294
|
-
if (this.onPointsCreated) {
|
|
295
|
-
this.onPointsCreated(layer, pts);
|
|
296
|
-
}
|
|
297
294
|
elt.obj = pts;
|
|
298
295
|
// store tightbbox to avoid ping-pong (bbox = larger => visible, tight => invisible)
|
|
299
296
|
elt.tightbbox = pts.tightbbox;
|
|
@@ -302,11 +299,12 @@ class PointCloudLayer extends GeometryLayer {
|
|
|
302
299
|
// be added nor cleaned
|
|
303
300
|
this.group.add(elt.obj);
|
|
304
301
|
elt.obj.updateMatrixWorld(true);
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
elt.promise = null;
|
|
302
|
+
}).catch(err => {
|
|
303
|
+
if (!err.isCancelledCommandException) {
|
|
304
|
+
return err;
|
|
309
305
|
}
|
|
306
|
+
}).finally(() => {
|
|
307
|
+
elt.promise = null;
|
|
310
308
|
});
|
|
311
309
|
}
|
|
312
310
|
}
|
package/lib/Source/CopcSource.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import proj4 from 'proj4';
|
|
1
2
|
import { Binary, Info, Las } from 'copc';
|
|
2
3
|
import Extent from "../Core/Geographic/Extent.js";
|
|
3
4
|
import Fetcher from "../Provider/Fetcher.js";
|
|
@@ -102,8 +103,18 @@ class CopcSource extends Source {
|
|
|
102
103
|
this.header = metadata.header;
|
|
103
104
|
this.info = metadata.info;
|
|
104
105
|
this.eb = metadata.eb;
|
|
105
|
-
|
|
106
|
-
|
|
106
|
+
proj4.defs('unknown', metadata.wkt);
|
|
107
|
+
let projCS;
|
|
108
|
+
if (proj4.defs('unknown').type === 'COMPD_CS') {
|
|
109
|
+
console.warn('CopcSource: compound coordinate system is not yet supported.');
|
|
110
|
+
projCS = proj4.defs('unknown').PROJCS;
|
|
111
|
+
} else {
|
|
112
|
+
projCS = proj4.defs('unknown');
|
|
113
|
+
}
|
|
114
|
+
this.crs = projCS.title || projCS.name || 'EPSG:4326';
|
|
115
|
+
if (!(this.crs in proj4.defs)) {
|
|
116
|
+
proj4.defs(this.crs, projCS);
|
|
117
|
+
}
|
|
107
118
|
const bbox = new THREE.Box3();
|
|
108
119
|
bbox.min.fromArray(this.info.cube, 0);
|
|
109
120
|
bbox.max.fromArray(this.info.cube, 3);
|
|
@@ -38,10 +38,19 @@ class EntwinePointTileSource extends Source {
|
|
|
38
38
|
// Set parser and its configuration from schema
|
|
39
39
|
this.parse = metadata.dataType === 'laszip' ? LASParser.parse : PotreeBinParser.parse;
|
|
40
40
|
this.extension = metadata.dataType === 'laszip' ? 'laz' : 'bin';
|
|
41
|
-
if (metadata.srs
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
proj4.defs(this.crs
|
|
41
|
+
if (metadata.srs) {
|
|
42
|
+
if (metadata.srs.authority && metadata.srs.horizontal) {
|
|
43
|
+
this.crs = `${metadata.srs.authority}:${metadata.srs.horizontal}`;
|
|
44
|
+
if (!proj4.defs(this.crs)) {
|
|
45
|
+
proj4.defs(this.crs, metadata.srs.wkt);
|
|
46
|
+
}
|
|
47
|
+
} else if (metadata.srs.wkt) {
|
|
48
|
+
proj4.defs('unknown', metadata.srs.wkt);
|
|
49
|
+
const projCS = proj4.defs('unknown');
|
|
50
|
+
this.crs = projCS.title || projCS.name;
|
|
51
|
+
if (!(this.crs in proj4.defs)) {
|
|
52
|
+
proj4.defs(this.crs, projCS);
|
|
53
|
+
}
|
|
45
54
|
}
|
|
46
55
|
if (metadata.srs.vertical && metadata.srs.vertical !== metadata.srs.horizontal) {
|
|
47
56
|
console.warn('EntwinePointTileSource: Vertical coordinates system code is not yet supported.');
|
|
@@ -53,6 +62,7 @@ class EntwinePointTileSource extends Source {
|
|
|
53
62
|
// span in ept.json. This needs improvements.
|
|
54
63
|
this.spacing = (Math.abs(metadata.boundsConforming[3] - metadata.boundsConforming[0]) + Math.abs(metadata.boundsConforming[4] - metadata.boundsConforming[1])) / (2 * metadata.span);
|
|
55
64
|
this.boundsConforming = metadata.boundsConforming;
|
|
65
|
+
this.bounds = metadata.bounds;
|
|
56
66
|
this.span = metadata.span;
|
|
57
67
|
return this;
|
|
58
68
|
});
|