itowns 2.42.1-next.11 → 2.42.1-next.13
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/source_stream_wfs_25d.html +11 -11
- package/examples/source_stream_wfs_3d.html +1 -1
- package/examples/view_25d_map.html +2 -2
- package/examples/view_3d_map.html +2 -2
- package/examples/view_3d_mns_map.html +2 -2
- package/examples/view_immersive.html +1 -1
- package/examples/widgets_searchbar.html +2 -2
- package/lib/Core/Style.js +3 -4
- package/lib/Layer/C3DTilesLayer.js +4 -4
- package/lib/Layer/EntwinePointTileLayer.js +1 -0
- package/lib/Parser/LASLoader.js +8 -4
- package/lib/Parser/LASParser.js +1 -0
- package/lib/Parser/PotreeBinParser.js +5 -5
- package/lib/Provider/PointCloudProvider.js +2 -4
- package/package.json +3 -1
|
@@ -273,7 +273,7 @@
|
|
|
273
273
|
var wfsCartoSource = new itowns.WFSSource({
|
|
274
274
|
url: 'https://data.geopf.fr/wfs/ows?',
|
|
275
275
|
version: '2.0.0',
|
|
276
|
-
typeName: '
|
|
276
|
+
typeName: 'BDCARTO_V5:zone_d_habitation',
|
|
277
277
|
crs: 'EPSG:3946',
|
|
278
278
|
ipr: 'IGN',
|
|
279
279
|
format: 'application/json',
|
|
@@ -284,24 +284,24 @@
|
|
|
284
284
|
text: {
|
|
285
285
|
field: '{toponyme}',
|
|
286
286
|
color: (p) => {
|
|
287
|
-
switch (p.
|
|
288
|
-
case 'Quartier
|
|
289
|
-
return 'Cornsilk';
|
|
290
|
-
case 'Hameau':
|
|
287
|
+
switch (p.nature) {
|
|
288
|
+
case 'Quartier':
|
|
291
289
|
return 'WhiteSmoke';
|
|
292
|
-
case '
|
|
290
|
+
case 'Château':
|
|
291
|
+
return 'Cornsilk';
|
|
292
|
+
case 'Lieu-dit habité':
|
|
293
293
|
default:
|
|
294
294
|
return 'white';
|
|
295
295
|
}
|
|
296
296
|
},
|
|
297
297
|
transform: 'uppercase',
|
|
298
298
|
size: (p) => {
|
|
299
|
-
switch (p.
|
|
300
|
-
case 'Quartier
|
|
301
|
-
return 11;
|
|
302
|
-
case 'Hameau':
|
|
299
|
+
switch (p.nature) {
|
|
300
|
+
case 'Quartier':
|
|
303
301
|
return 13;
|
|
304
|
-
case '
|
|
302
|
+
case 'Château':
|
|
303
|
+
return 11;
|
|
304
|
+
case 'Lieu-dit habité':
|
|
305
305
|
default:
|
|
306
306
|
return 18;
|
|
307
307
|
}
|
|
@@ -175,7 +175,7 @@
|
|
|
175
175
|
view.addFrameRequester(itowns.MAIN_LOOP_EVENTS.BEFORE_RENDER, scaler);
|
|
176
176
|
|
|
177
177
|
var wfsBuildingSource = new itowns.WFSSource({
|
|
178
|
-
url: 'https://
|
|
178
|
+
url: 'https://data.geopf.fr/wfs/ows?',
|
|
179
179
|
version: '2.0.0',
|
|
180
180
|
typeName: 'BDTOPO_V3:batiment',
|
|
181
181
|
crs: 'EPSG:4326',
|
|
@@ -98,9 +98,9 @@
|
|
|
98
98
|
view.addLayer(wmsElevationLayer);
|
|
99
99
|
|
|
100
100
|
var wfsCartoSource = new itowns.WFSSource({
|
|
101
|
-
url: 'https://
|
|
101
|
+
url: 'https://data.geopf.fr/wfs/ows?',
|
|
102
102
|
version: '2.0.0',
|
|
103
|
-
typeName: '
|
|
103
|
+
typeName: 'BDCARTO_V5:zone_d_habitation',
|
|
104
104
|
crs: 'EPSG:3946',
|
|
105
105
|
ipr: 'IGN',
|
|
106
106
|
format: 'application/json',
|
|
@@ -110,8 +110,8 @@
|
|
|
110
110
|
// Define options for geocoding service that should be used by the searchbar.
|
|
111
111
|
const geocodingOptions = {
|
|
112
112
|
url: new URL(
|
|
113
|
-
'https://
|
|
114
|
-
'PositionOfInterest',
|
|
113
|
+
'https://data.geopf.fr/geocodage/completion?' +
|
|
114
|
+
'text=&type=StreetAddress,PositionOfInterest',
|
|
115
115
|
),
|
|
116
116
|
parser: (response) => {
|
|
117
117
|
const map = new Map();
|
|
@@ -109,8 +109,8 @@
|
|
|
109
109
|
// Define options for geocoding service that should be used by the searchbar.
|
|
110
110
|
const geocodingOptions = {
|
|
111
111
|
url: new URL(
|
|
112
|
-
'https://
|
|
113
|
-
'PositionOfInterest',
|
|
112
|
+
'https://data.geopf.fr/geocodage/completion?' +
|
|
113
|
+
'text=&type=StreetAddress,PositionOfInterest',
|
|
114
114
|
),
|
|
115
115
|
parser: (response) => {
|
|
116
116
|
const map = new Map();
|
|
@@ -117,7 +117,7 @@
|
|
|
117
117
|
view.addLayer(olayer, view.tileLayer).then(function addWfsLayer(orientedImageLayer) {
|
|
118
118
|
// prepare WFS source for the buildings
|
|
119
119
|
var wfsBuildingSource = new itowns.WFSSource({
|
|
120
|
-
url: 'https://
|
|
120
|
+
url: 'https://data.geopf.fr/wfs/ows?',
|
|
121
121
|
version: '2.0.0',
|
|
122
122
|
typeName: 'BDTOPO_V3:batiment',
|
|
123
123
|
crs: 'EPSG:4326',
|
|
@@ -88,8 +88,8 @@
|
|
|
88
88
|
// Define options for geocoding service that should be used by the searchbar.
|
|
89
89
|
const geocodingOptions = {
|
|
90
90
|
url: new URL(
|
|
91
|
-
'https://
|
|
92
|
-
'PositionOfInterest',
|
|
91
|
+
'https://data.geopf.fr/geocodage/completion?' +
|
|
92
|
+
'text=&type=StreetAddress,PositionOfInterest',
|
|
93
93
|
),
|
|
94
94
|
// As precised in the doc (http://www.itowns-project.org/itowns/docs/#api/Widgets/Searchbar), the parser
|
|
95
95
|
// method must parse the geocoding service response into a Map object. For each item of this Map, the
|
package/lib/Core/Style.js
CHANGED
|
@@ -19,10 +19,9 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
19
19
|
const itowns_stroke_single_before = ".itowns-stroke-single:before {\n display: var(--text_stroke_display);\n content: attr(data-before);\n opacity: 1;\n position: absolute;\n -webkit-text-stroke-width: var(--text_stroke_width);\n -webkit-text-stroke-color: var(--text_stroke_color);\n left: 0;\n right: 0;\n bottom: 0;\n top: 0;\n z-index: -1;\n white-space: inherit;\n overflow-wrap: inherit;\n letter-spacing: inherit;\n text-align: inherit;\n padding: inherit;\n font-family: inherit;\n text-transform: inherit;\n max-width: inherit;\n font-size: inherit;\n}\n";
|
|
20
20
|
const cacheStyle = new _Cache.default();
|
|
21
21
|
exports.cacheStyle = cacheStyle;
|
|
22
|
-
const
|
|
23
|
-
const
|
|
22
|
+
const matrix = document.createElementNS('http://www.w3.org/2000/svg', 'svg').createSVGMatrix();
|
|
23
|
+
const canvas = document.createElement('canvas');
|
|
24
24
|
const inv255 = 1 / 255;
|
|
25
|
-
const canvas = typeof document !== 'undefined' ? document.createElement('canvas') : {};
|
|
26
25
|
function baseAltitudeDefault(properties, ctx) {
|
|
27
26
|
var _ctx$coordinates;
|
|
28
27
|
return (ctx === null || ctx === void 0 ? void 0 : (_ctx$coordinates = ctx.coordinates) === null || _ctx$coordinates === void 0 ? void 0 : _ctx$coordinates.z) || 0;
|
|
@@ -1131,7 +1130,7 @@ class Style {
|
|
|
1131
1130
|
const CustomStyle = {
|
|
1132
1131
|
itowns_stroke_single_before
|
|
1133
1132
|
};
|
|
1134
|
-
const customStyleSheet =
|
|
1133
|
+
const customStyleSheet = document.createElement('style');
|
|
1135
1134
|
customStyleSheet.type = 'text/css';
|
|
1136
1135
|
Object.keys(CustomStyle).forEach(key => {
|
|
1137
1136
|
customStyleSheet.innerHTML += `${CustomStyle[key]}\n\n`;
|
|
@@ -39,8 +39,8 @@ const update = (0, _dTilesProcessing.process3dTilesNode)();
|
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
41
|
* Find tileId of object
|
|
42
|
-
*
|
|
43
42
|
* @param {THREE.Object3D} object - object
|
|
43
|
+
*
|
|
44
44
|
* @returns {number} tileId
|
|
45
45
|
*/
|
|
46
46
|
function findTileID(object) {
|
|
@@ -55,8 +55,8 @@ function findTileID(object) {
|
|
|
55
55
|
|
|
56
56
|
/**
|
|
57
57
|
* Check if object3d has feature
|
|
58
|
-
*
|
|
59
58
|
* @param {THREE.Object3D} object3d - object3d to check
|
|
59
|
+
*
|
|
60
60
|
* @returns {boolean} - true if object3d has feature
|
|
61
61
|
*/
|
|
62
62
|
function object3DHasFeature(object3d) {
|
|
@@ -229,6 +229,7 @@ class C3DTilesLayer extends _GeometryLayer.default {
|
|
|
229
229
|
* targets picked under specified coordinates. Intersects can be
|
|
230
230
|
* computed with view.pickObjectsAt(..). See fillHTMLWithPickingInfo()
|
|
231
231
|
* in 3dTilesHelper.js for an example.
|
|
232
|
+
*
|
|
232
233
|
* @returns {C3DTileFeature} - the closest C3DTileFeature of the intersects array
|
|
233
234
|
*/
|
|
234
235
|
getC3DTileFeatureFromIntersectsArray(intersects) {
|
|
@@ -274,7 +275,6 @@ class C3DTilesLayer extends _GeometryLayer.default {
|
|
|
274
275
|
|
|
275
276
|
/**
|
|
276
277
|
* Initialize C3DTileFeatures from tileContent
|
|
277
|
-
*
|
|
278
278
|
* @param {THREE.Object3D} tileContent - tile as THREE.Object3D
|
|
279
279
|
*/
|
|
280
280
|
initC3DTileFeatures(tileContent) {
|
|
@@ -339,8 +339,8 @@ class C3DTilesLayer extends _GeometryLayer.default {
|
|
|
339
339
|
/**
|
|
340
340
|
* Update style of the C3DTFeatures, an allowList of tile id can be passed to only update certain tile.
|
|
341
341
|
* Note that this function only update THREE.Object3D materials, in order to see style changes you should call view.notifyChange()
|
|
342
|
-
*
|
|
343
342
|
* @param {Array<number>|null} [allowTileIdList] - tile ids to allow in updateStyle computation if null all tiles are updated
|
|
343
|
+
*
|
|
344
344
|
* @returns {boolean} true if style updated false otherwise
|
|
345
345
|
*/
|
|
346
346
|
updateStyle() {
|
|
@@ -55,6 +55,7 @@ class EntwinePointTileLayer extends _PointCloudLayer.default {
|
|
|
55
55
|
constructor(id, config) {
|
|
56
56
|
super(id, config);
|
|
57
57
|
this.isEntwinePointTileLayer = true;
|
|
58
|
+
this.scale = new THREE.Vector3(1, 1, 1);
|
|
58
59
|
const resolve = this.addInitializationStep();
|
|
59
60
|
this.whenReady = this.source.whenReady.then(() => {
|
|
60
61
|
this.root = new _EntwinePointTileNode.default(0, 0, 0, 0, this, -1);
|
package/lib/Parser/LASLoader.js
CHANGED
|
@@ -67,13 +67,16 @@ class LASLoader {
|
|
|
67
67
|
The copc.js library does the degree convertion and stores it as a `Float32`.
|
|
68
68
|
*/
|
|
69
69
|
const scanAngles = new Float32Array(view.pointCount);
|
|
70
|
+
|
|
71
|
+
// For precision we take the first point that will be use as origin for a local referentiel.
|
|
72
|
+
const origin = getPosition.map(f => f(0)).map(val => Math.floor(val));
|
|
70
73
|
for (let i = 0; i < view.pointCount; i++) {
|
|
71
74
|
// `getPosition` apply scale and offset transform to the X, Y, Z
|
|
72
75
|
// values. See https://github.com/connormanning/copc.js/blob/master/src/las/extractor.ts.
|
|
73
76
|
const [x, y, z] = getPosition.map(f => f(i));
|
|
74
|
-
positions[i * 3] = x;
|
|
75
|
-
positions[i * 3 + 1] = y;
|
|
76
|
-
positions[i * 3 + 2] = z;
|
|
77
|
+
positions[i * 3] = x - origin[0];
|
|
78
|
+
positions[i * 3 + 1] = y - origin[1];
|
|
79
|
+
positions[i * 3 + 2] = z - origin[2];
|
|
77
80
|
intensities[i] = getIntensity(i);
|
|
78
81
|
returnNumbers[i] = getReturnNumber(i);
|
|
79
82
|
numberOfReturns[i] = getNumberOfReturns(i);
|
|
@@ -104,7 +107,8 @@ class LASLoader {
|
|
|
104
107
|
classification: classifications,
|
|
105
108
|
pointSourceID: pointSourceIDs,
|
|
106
109
|
color: colors,
|
|
107
|
-
scanAngle: scanAngles
|
|
110
|
+
scanAngle: scanAngles,
|
|
111
|
+
origin
|
|
108
112
|
};
|
|
109
113
|
}
|
|
110
114
|
|
package/lib/Parser/LASParser.js
CHANGED
|
@@ -75,6 +75,7 @@ var _default = {
|
|
|
75
75
|
const scanAngle = new THREE.BufferAttribute(attributes.scanAngle, 1);
|
|
76
76
|
geometry.setAttribute('scanAngle', scanAngle);
|
|
77
77
|
geometry.computeBoundingBox();
|
|
78
|
+
geometry.userData.origin = new THREE.Vector3().fromArray(attributes.origin);
|
|
78
79
|
return geometry;
|
|
79
80
|
});
|
|
80
81
|
}
|
|
@@ -9,7 +9,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
9
9
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
10
10
|
// See the different constants holding ordinal, name, numElements, byteSize in PointAttributes.cpp in PotreeConverter
|
|
11
11
|
// elementByteSize is byteSize / numElements
|
|
12
|
-
const
|
|
12
|
+
const POINT_ATTRIBUTES = {
|
|
13
13
|
POSITION_CARTESIAN: {
|
|
14
14
|
numElements: 3,
|
|
15
15
|
arrayType: Float32Array,
|
|
@@ -55,8 +55,8 @@ const POINT_ATTTRIBUTES = {
|
|
|
55
55
|
attributeName: 'normal'
|
|
56
56
|
}
|
|
57
57
|
};
|
|
58
|
-
for (const potreeName of Object.keys(
|
|
59
|
-
const attr =
|
|
58
|
+
for (const potreeName of Object.keys(POINT_ATTRIBUTES)) {
|
|
59
|
+
const attr = POINT_ATTRIBUTES[potreeName];
|
|
60
60
|
attr.potreeName = potreeName;
|
|
61
61
|
attr.numByte = attr.numByte || attr.arrayType.BYTES_PER_ELEMENT;
|
|
62
62
|
attr.byteSize = attr.numElements * attr.numByte;
|
|
@@ -87,14 +87,14 @@ var _default = {
|
|
|
87
87
|
// Format: X1,Y1,Z1,R1,G1,B1,A1,[...],XN,YN,ZN,RN,GN,BN,AN
|
|
88
88
|
let pointByteSize = 0;
|
|
89
89
|
for (const potreeName of options.in.pointAttributes) {
|
|
90
|
-
pointByteSize +=
|
|
90
|
+
pointByteSize += POINT_ATTRIBUTES[potreeName].byteSize;
|
|
91
91
|
}
|
|
92
92
|
const numPoints = Math.floor(buffer.byteLength / pointByteSize);
|
|
93
93
|
const geometry = new THREE.BufferGeometry();
|
|
94
94
|
let elemOffset = 0;
|
|
95
95
|
let attrOffset = 0;
|
|
96
96
|
for (const potreeName of options.in.pointAttributes) {
|
|
97
|
-
const attr =
|
|
97
|
+
const attr = POINT_ATTRIBUTES[potreeName];
|
|
98
98
|
const arrayLength = attr.numElements * numPoints;
|
|
99
99
|
const array = new attr.arrayType(arrayLength);
|
|
100
100
|
for (let arrayOffset = 0; arrayOffset < arrayLength; arrayOffset += attr.numElements) {
|
|
@@ -41,10 +41,8 @@ var _default = {
|
|
|
41
41
|
addPickingAttribute(points);
|
|
42
42
|
points.frustumCulled = false;
|
|
43
43
|
points.matrixAutoUpdate = false;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
points.scale.copy(layer.scale);
|
|
47
|
-
}
|
|
44
|
+
points.position.copy(geometry.userData.origin || node.bbox.min);
|
|
45
|
+
points.scale.copy(layer.scale);
|
|
48
46
|
points.updateMatrix();
|
|
49
47
|
points.tightbbox = geometry.boundingBox.applyMatrix4(points.matrix);
|
|
50
48
|
points.layer = layer;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "itowns",
|
|
3
|
-
"version": "2.42.1-next.
|
|
3
|
+
"version": "2.42.1-next.13",
|
|
4
4
|
"description": "A JS/WebGL framework for 3D geospatial data visualization",
|
|
5
5
|
"main": "lib/Main.js",
|
|
6
6
|
"exports": {
|
|
@@ -76,6 +76,7 @@
|
|
|
76
76
|
"@babel/preset-env": "^7.22.5",
|
|
77
77
|
"@babel/register": "^7.22.5",
|
|
78
78
|
"@types/three": "^0.159.0",
|
|
79
|
+
"@xmldom/xmldom": "^0.8.10",
|
|
79
80
|
"babel-inline-import-loader": "^1.0.1",
|
|
80
81
|
"babel-loader": "^9.1.3",
|
|
81
82
|
"babel-plugin-inline-import": "^3.0.0",
|
|
@@ -107,6 +108,7 @@
|
|
|
107
108
|
"puppeteer": "^21.6.0",
|
|
108
109
|
"q": "^1.5.1",
|
|
109
110
|
"replace-in-file": "^7.0.2",
|
|
111
|
+
"sinon": "^17.0.1",
|
|
110
112
|
"three": "^0.159.0",
|
|
111
113
|
"typescript": "^5.3.3",
|
|
112
114
|
"webpack": "^5.89.0",
|