itowns 2.43.2-next.4 → 2.43.2-next.6
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/debug.js +1 -1
- package/dist/debug.js.map +1 -1
- package/dist/itowns.js +1 -1
- package/dist/itowns.js.map +1 -1
- package/dist/itowns_widgets.js +1 -1
- package/dist/itowns_widgets.js.map +1 -1
- package/examples/js/plugins/COGParser.js +84 -50
- package/examples/js/plugins/COGSource.js +7 -4
- package/examples/source_file_cog.html +22 -5
- package/lib/Controls/FirstPersonControls.js +0 -1
- package/lib/Controls/FlyControls.js +0 -1
- package/lib/Converter/Feature2Mesh.js +2 -4
- package/lib/Core/3DTiles/C3DTBatchTable.js +1 -1
- package/lib/Core/3DTiles/C3DTFeature.js +0 -1
- package/lib/Core/Feature.js +1 -2
- package/lib/Core/Geographic/CoordStars.js +0 -1
- package/lib/Core/Label.js +0 -1
- package/lib/Core/MainLoop.js +0 -1
- package/lib/Core/Prefab/Globe/Atmosphere.js +0 -4
- package/lib/Core/Style.js +2 -4
- package/lib/Core/View.js +2 -4
- package/lib/Layer/ElevationLayer.js +2 -3
- package/lib/Layer/GeoidLayer.js +1 -2
- package/lib/Layer/LabelLayer.js +8 -17
- package/lib/Layer/Layer.js +1 -2
- package/lib/Layer/PointCloudLayer.js +3 -6
- package/lib/Layer/ReferencingLayerProperties.js +1 -2
- package/lib/Parser/GeoJsonParser.js +2 -3
- package/lib/Parser/LASParser.js +2 -3
- package/lib/Parser/deprecated/LegacyGLTFLoader.js +1 -2
- package/lib/Process/FeatureProcessing.js +1 -2
- package/lib/Process/LayeredMaterialNodeProcessing.js +3 -7
- package/lib/Process/ObjectRemovalHelper.js +1 -2
- package/lib/Renderer/ColorLayersOrdering.js +1 -2
- package/lib/Renderer/Label2DRenderer.js +1 -4
- package/lib/Renderer/RenderMode.js +0 -1
- package/lib/ThreeExtended/loaders/DDSLoader.js +11 -1
- package/lib/ThreeExtended/loaders/DRACOLoader.js +0 -1
- package/lib/ThreeExtended/loaders/GLTFLoader.js +1 -0
- package/lib/Utils/DEMUtils.js +2 -2
- package/lib/Utils/OrientationUtils.js +0 -1
- package/lib/Utils/gui/Searchbar.js +1 -2
- package/package.json +6 -5
|
@@ -15,6 +15,9 @@
|
|
|
15
15
|
* @property {string} url - The URL of the COG.
|
|
16
16
|
* @property {GeoTIFF.Pool} pool - Pool use to decode GeoTiff.
|
|
17
17
|
* @property {number} defaultAlpha - Alpha byte value used if no alpha is present in COG. Default value is 255.
|
|
18
|
+
* @property {number} tileWidth - Tile width in pixels. Default value use 'geotiff.getTileWidth()'.
|
|
19
|
+
* @property {number} tileHeight - Tile height in pixels. Default value use 'geotiff.getTileHeight()'.
|
|
20
|
+
* @property {number} resampleMethod - The desired resampling method. Default is 'nearest'.
|
|
18
21
|
*
|
|
19
22
|
* @example
|
|
20
23
|
* // Create the source
|
|
@@ -59,9 +62,9 @@ class COGSource extends itowns.Source {
|
|
|
59
62
|
this.firstImage = await geotiff.getImage();
|
|
60
63
|
this.origin = this.firstImage.getOrigin();
|
|
61
64
|
this.dataType = this.selectDataType(this.firstImage.getSampleFormat(), this.firstImage.getBitsPerSample());
|
|
62
|
-
|
|
63
|
-
this.
|
|
64
|
-
this.
|
|
65
|
+
this.tileWidth = source.tileWidth || this.firstImage.getTileWidth();
|
|
66
|
+
this.tileHeight = source.tileHeight || this.firstImage.getTileHeight();
|
|
67
|
+
this.resampleMethod = source.resampleMethod || 'nearest';
|
|
65
68
|
|
|
66
69
|
// Compute extent
|
|
67
70
|
const [minX, minY, maxX, maxY] = this.firstImage.getBoundingBox();
|
|
@@ -80,7 +83,7 @@ class COGSource extends itowns.Source {
|
|
|
80
83
|
.then(image => this.makeLevel(image, image.getResolution(this.firstImage)));
|
|
81
84
|
promises.push(promise);
|
|
82
85
|
}
|
|
83
|
-
this.levels.
|
|
86
|
+
this.levels = this.levels.concat(await Promise.all(promises));
|
|
84
87
|
});
|
|
85
88
|
}
|
|
86
89
|
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
itowns.proj4.defs('EPSG:2154', '+proj=lcc +lat_1=49 +lat_2=44 +lat_0=46.5 +lon_0=3 +x_0=700000 +y_0=6600000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs');
|
|
37
37
|
|
|
38
38
|
var viewerDiv = document.getElementById('viewerDiv');
|
|
39
|
+
var view;
|
|
39
40
|
|
|
40
41
|
function readCOGURL() {
|
|
41
42
|
var url = document.getElementById('cog_url').value || new URLSearchParams(window.location.search).get('geotiff');
|
|
@@ -47,7 +48,7 @@
|
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
function loadRGBSample() {
|
|
50
|
-
document.getElementById('cog_url').value = 'https://cdn.jsdelivr.net/gh/
|
|
51
|
+
document.getElementById('cog_url').value = 'https://cdn.jsdelivr.net/gh/iTowns/iTowns2-sample-data/cog/nantes/nantes.tif';
|
|
51
52
|
readCOGURL();
|
|
52
53
|
}
|
|
53
54
|
|
|
@@ -56,17 +57,33 @@
|
|
|
56
57
|
readCOGURL();
|
|
57
58
|
}
|
|
58
59
|
|
|
59
|
-
function
|
|
60
|
+
function removeAllChildNodes(parent) {
|
|
61
|
+
while (parent.firstChild) {
|
|
62
|
+
parent.removeChild(parent.firstChild);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function loadCOG(url) {
|
|
60
67
|
// create a source from a Cloud Optimized GeoTiff
|
|
61
68
|
var cogSource = new COGSource({
|
|
62
69
|
url: url,
|
|
63
|
-
crs: "EPSG:2154"
|
|
70
|
+
crs: "EPSG:2154",
|
|
71
|
+
// Default resample method is 'nearest', 'bilinear' looks better when zoomed
|
|
72
|
+
resampleMethod: 'bilinear'
|
|
64
73
|
});
|
|
65
74
|
|
|
66
75
|
cogSource.whenReady.then(() => {
|
|
67
|
-
|
|
76
|
+
if (view !== undefined) {
|
|
77
|
+
view.dispose(true);
|
|
78
|
+
removeAllChildNodes(viewerDiv);
|
|
79
|
+
}
|
|
80
|
+
view = new itowns.PlanarView(viewerDiv, cogSource.extent, {
|
|
81
|
+
// Default maxSubdivisionLevel is 5, so with huge geotiff it's not enough to see details when zoomed
|
|
82
|
+
maxSubdivisionLevel: 10,
|
|
83
|
+
disableSkirt: true,
|
|
84
|
+
placement: { tilt: 90 }
|
|
85
|
+
});
|
|
68
86
|
setupLoadingScreen(viewerDiv, view);
|
|
69
|
-
new itowns.PlanarControls(view, {});
|
|
70
87
|
var cogLayer = new itowns.ColorLayer('cog', {
|
|
71
88
|
source: cogSource,
|
|
72
89
|
});
|
|
@@ -416,7 +416,6 @@ function featureToExtrudedPolygon(feature, options) {
|
|
|
416
416
|
meshColor.toArray(colors, t); // top
|
|
417
417
|
meshColor.multiplyScalar(0.5).toArray(colors, i); // base is half dark
|
|
418
418
|
}
|
|
419
|
-
|
|
420
419
|
featureId++;
|
|
421
420
|
const geomVertices = vertices.slice(startTop * 3, (end + totalVertices) * 3);
|
|
422
421
|
const holesOffsets = geometry.indices.map(i => i.offset - start).slice(1);
|
|
@@ -496,14 +495,13 @@ function pointsToInstancedMeshes(feature) {
|
|
|
496
495
|
* @return {THREE.Mesh} mesh or GROUP of THREE.InstancedMesh
|
|
497
496
|
*/
|
|
498
497
|
function featureToMesh(feature, options) {
|
|
499
|
-
var _style$point, _style$point$model;
|
|
500
498
|
if (!feature.vertices) {
|
|
501
499
|
return;
|
|
502
500
|
}
|
|
503
501
|
let mesh;
|
|
504
502
|
switch (feature.type) {
|
|
505
503
|
case FEATURE_TYPES.POINT:
|
|
506
|
-
if (
|
|
504
|
+
if (style.point?.model?.object) {
|
|
507
505
|
try {
|
|
508
506
|
mesh = pointsToInstancedMeshes(feature);
|
|
509
507
|
mesh.isInstancedMesh = true;
|
|
@@ -592,7 +590,7 @@ export default {
|
|
|
592
590
|
// style properties (@link StyleOptions) using options.style.
|
|
593
591
|
// This is usually done in some tests and if you want to use Feature2Mesh.convert()
|
|
594
592
|
// as in examples/source_file_gpx_3d.html.
|
|
595
|
-
style =
|
|
593
|
+
style = this?.style || (options.style ? new Style(options.style) : defaultStyle);
|
|
596
594
|
context.setCollection(collection);
|
|
597
595
|
const features = collection.features;
|
|
598
596
|
if (!features || features.length == 0) {
|
|
@@ -52,7 +52,7 @@ class C3DTBatchTable {
|
|
|
52
52
|
if (Array.isArray(propVal)) {
|
|
53
53
|
continue;
|
|
54
54
|
}
|
|
55
|
-
if (typeof
|
|
55
|
+
if (typeof propVal?.byteOffset !== 'undefined' && typeof propVal?.componentType !== 'undefined' && typeof propVal?.type !== 'undefined') {
|
|
56
56
|
jsonContent[propKey] = binaryPropertyAccessor(binaryBuffer, this.batchLength, propVal.byteOffset, propVal.componentType, propVal.type);
|
|
57
57
|
} else {
|
|
58
58
|
console.error('Invalid 3D Tiles batch table property that is neither a JSON array nor a valid ' + 'accessor to a binary body');
|
package/lib/Core/Feature.js
CHANGED
|
@@ -338,10 +338,9 @@ export class FeatureCollection extends THREE.Object3D {
|
|
|
338
338
|
* @param {FeatureBuildingOptions|Layer} options The building options .
|
|
339
339
|
*/
|
|
340
340
|
constructor(options) {
|
|
341
|
-
var _options$source;
|
|
342
341
|
super();
|
|
343
342
|
this.isFeatureCollection = true;
|
|
344
|
-
this.crs = CRS.formatToEPSG(options.accurate || !
|
|
343
|
+
this.crs = CRS.formatToEPSG(options.accurate || !options.source?.crs ? options.crs : options.source.crs);
|
|
345
344
|
this.features = [];
|
|
346
345
|
this.mergeFeatures = options.mergeFeatures === undefined ? true : options.mergeFeatures;
|
|
347
346
|
this.size = options.structure == '3d' ? 3 : 2;
|
package/lib/Core/Label.js
CHANGED
package/lib/Core/MainLoop.js
CHANGED
|
@@ -72,7 +72,6 @@ class Atmosphere extends GeometryLayer {
|
|
|
72
72
|
value: new THREE.Vector2(window.innerWidth, window.innerHeight)
|
|
73
73
|
} // Should be updated on screen resize...
|
|
74
74
|
},
|
|
75
|
-
|
|
76
75
|
vertexShader: GlowVS,
|
|
77
76
|
fragmentShader: GlowFS,
|
|
78
77
|
side: THREE.BackSide,
|
|
@@ -100,7 +99,6 @@ class Atmosphere extends GeometryLayer {
|
|
|
100
99
|
value: new THREE.Vector2(window.innerWidth, window.innerHeight)
|
|
101
100
|
} // Should be updated on screen resize...
|
|
102
101
|
},
|
|
103
|
-
|
|
104
102
|
vertexShader: GlowVS,
|
|
105
103
|
fragmentShader: GlowFS,
|
|
106
104
|
side: THREE.FrontSide,
|
|
@@ -135,7 +133,6 @@ class Atmosphere extends GeometryLayer {
|
|
|
135
133
|
scaleDepth: 0.25
|
|
136
134
|
// mieScaleDepth: 0.1,
|
|
137
135
|
};
|
|
138
|
-
|
|
139
136
|
this.object3d.updateMatrixWorld();
|
|
140
137
|
}
|
|
141
138
|
update(context, layer, node) {
|
|
@@ -288,7 +285,6 @@ class Atmosphere extends GeometryLayer {
|
|
|
288
285
|
skyDome.material.uniforms.mieDirectionalG.value = effectController.mieDirectionalG;
|
|
289
286
|
skyDome.material.uniforms.up.value = new THREE.Vector3(); // no more necessary, estimate normal from cam..
|
|
290
287
|
}
|
|
291
|
-
|
|
292
288
|
setRealisticOn(bool) {
|
|
293
289
|
if (bool) {
|
|
294
290
|
if (!this.realisticAtmosphere.children.length) {
|
package/lib/Core/Style.js
CHANGED
|
@@ -12,8 +12,7 @@ const matrix = document.createElementNS('http://www.w3.org/2000/svg', 'svg').cre
|
|
|
12
12
|
const canvas = document.createElement('canvas');
|
|
13
13
|
const inv255 = 1 / 255;
|
|
14
14
|
function baseAltitudeDefault(properties, ctx) {
|
|
15
|
-
|
|
16
|
-
return (ctx === null || ctx === void 0 ? void 0 : (_ctx$coordinates = ctx.coordinates) === null || _ctx$coordinates === void 0 ? void 0 : _ctx$coordinates.z) || 0;
|
|
15
|
+
return ctx?.coordinates?.z || 0;
|
|
17
16
|
}
|
|
18
17
|
export function readExpression(property, ctx) {
|
|
19
18
|
if (property != undefined) {
|
|
@@ -154,7 +153,6 @@ function defineStyleProperty(style, category, parameter, userValue, defaultValue
|
|
|
154
153
|
Object.defineProperty(style[category], parameter, {
|
|
155
154
|
enumerable: true,
|
|
156
155
|
get: () => {
|
|
157
|
-
var _style$context$featur, _style$context$featur2;
|
|
158
156
|
// != to check for 'undefined' and 'null' value)
|
|
159
157
|
if (property != undefined) {
|
|
160
158
|
return property;
|
|
@@ -162,7 +160,7 @@ function defineStyleProperty(style, category, parameter, userValue, defaultValue
|
|
|
162
160
|
if (userValue != undefined) {
|
|
163
161
|
return readExpression(userValue, style.context);
|
|
164
162
|
}
|
|
165
|
-
const dataValue =
|
|
163
|
+
const dataValue = style.context.featureStyle?.[category]?.[parameter];
|
|
166
164
|
if (dataValue != undefined) {
|
|
167
165
|
return readExpression(dataValue, style.context);
|
|
168
166
|
}
|
package/lib/Core/View.js
CHANGED
|
@@ -232,8 +232,7 @@ class View extends THREE.EventDispatcher {
|
|
|
232
232
|
* @returns {THREE.WebGLRenderer} the WebGLRenderer used to render this view.
|
|
233
233
|
*/
|
|
234
234
|
get renderer() {
|
|
235
|
-
|
|
236
|
-
return (_this$mainLoop = this.mainLoop) === null || _this$mainLoop === void 0 ? void 0 : (_this$mainLoop$gfxEng = _this$mainLoop.gfxEngine) === null || _this$mainLoop$gfxEng === void 0 ? void 0 : _this$mainLoop$gfxEng.getRenderer();
|
|
235
|
+
return this.mainLoop?.gfxEngine?.getRenderer();
|
|
237
236
|
}
|
|
238
237
|
|
|
239
238
|
/**
|
|
@@ -241,8 +240,7 @@ class View extends THREE.EventDispatcher {
|
|
|
241
240
|
* @returns {THREE.Camera} the threejs camera of this view
|
|
242
241
|
*/
|
|
243
242
|
get camera3D() {
|
|
244
|
-
|
|
245
|
-
return (_this$camera = this.camera) === null || _this$camera === void 0 ? void 0 : _this$camera.camera3D;
|
|
243
|
+
return this.camera?.camera3D;
|
|
246
244
|
}
|
|
247
245
|
|
|
248
246
|
/**
|
|
@@ -60,14 +60,13 @@ class ElevationLayer extends RasterLayer {
|
|
|
60
60
|
* view.addLayer(elevation);
|
|
61
61
|
*/
|
|
62
62
|
constructor(id) {
|
|
63
|
-
var _config$clampValues, _config$clampValues2;
|
|
64
63
|
let config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
65
64
|
super(id, config);
|
|
66
65
|
if (config.zmin || config.zmax) {
|
|
67
66
|
console.warn('Config using zmin and zmax are deprecated, use {clampValues: {min, max}} structure.');
|
|
68
67
|
}
|
|
69
|
-
this.zmin =
|
|
70
|
-
this.zmax =
|
|
68
|
+
this.zmin = config.clampValues?.min ?? config.zmin;
|
|
69
|
+
this.zmax = config.clampValues?.max ?? config.zmax;
|
|
71
70
|
this.isElevationLayer = true;
|
|
72
71
|
this.defineLayerProperty('scale', this.scale || 1.0);
|
|
73
72
|
}
|
package/lib/Layer/GeoidLayer.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import Layer from "./Layer.js";
|
|
2
2
|
import LayerUpdateState from "./LayerUpdateState.js";
|
|
3
3
|
export function geoidLayerIsVisible(tilelayer) {
|
|
4
|
-
|
|
5
|
-
return tilelayer === null || tilelayer === void 0 ? void 0 : (_tilelayer$attachedLa = tilelayer.attachedLayers.filter(l => l.isGeoidLayer)[0]) === null || _tilelayer$attachedLa === void 0 ? void 0 : _tilelayer$attachedLa.visible;
|
|
4
|
+
return tilelayer?.attachedLayers.filter(l => l.isGeoidLayer)[0]?.visible;
|
|
6
5
|
}
|
|
7
6
|
|
|
8
7
|
/**
|
package/lib/Layer/LabelLayer.js
CHANGED
|
@@ -195,11 +195,9 @@ class LabelLayer extends GeometryLayer {
|
|
|
195
195
|
set visible(value) {
|
|
196
196
|
super.visible = value;
|
|
197
197
|
if (value) {
|
|
198
|
-
|
|
199
|
-
(_this$domElement = this.domElement) === null || _this$domElement === void 0 ? void 0 : _this$domElement.show();
|
|
198
|
+
this.domElement?.show();
|
|
200
199
|
} else {
|
|
201
|
-
|
|
202
|
-
(_this$domElement2 = this.domElement) === null || _this$domElement2 === void 0 ? void 0 : _this$domElement2.hide();
|
|
200
|
+
this.domElement?.hide();
|
|
203
201
|
}
|
|
204
202
|
}
|
|
205
203
|
get submittedLabelNodes() {
|
|
@@ -231,16 +229,15 @@ class LabelLayer extends GeometryLayer {
|
|
|
231
229
|
coord.crs = data.crs;
|
|
232
230
|
context.setZoom(extent.zoom);
|
|
233
231
|
data.features.forEach(f => {
|
|
234
|
-
var _f$style, _f$style$text, _f$style2, _f$style2$point;
|
|
235
232
|
// TODO: add support for LINE and POLYGON
|
|
236
233
|
if (f.type !== FEATURE_TYPES.POINT) {
|
|
237
234
|
return;
|
|
238
235
|
}
|
|
239
236
|
context.setFeature(f);
|
|
240
|
-
const featureField =
|
|
237
|
+
const featureField = f.style?.text?.field;
|
|
241
238
|
|
|
242
239
|
// determine if altitude style is specified by the user
|
|
243
|
-
const altitudeStyle =
|
|
240
|
+
const altitudeStyle = f.style?.point?.base_altitude;
|
|
244
241
|
const isDefaultElevationStyle = altitudeStyle instanceof Function && altitudeStyle.name == 'baseAltitudeDefault';
|
|
245
242
|
|
|
246
243
|
// determine if the altitude needs update with ElevationLayer
|
|
@@ -292,19 +289,14 @@ class LabelLayer extends GeometryLayer {
|
|
|
292
289
|
this.toHide.add(labelsNode);
|
|
293
290
|
}
|
|
294
291
|
#findClosestDomElement(node) {
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
var _node$parent$link$thi;
|
|
298
|
-
return ((_node$parent$link$thi = node.parent.link[this.id]) === null || _node$parent$link$thi === void 0 ? void 0 : _node$parent$link$thi.domElements) || this.#findClosestDomElement(node.parent);
|
|
292
|
+
if (node.parent?.isTileMesh) {
|
|
293
|
+
return node.parent.link[this.id]?.domElements || this.#findClosestDomElement(node.parent);
|
|
299
294
|
} else {
|
|
300
295
|
return this.domElement;
|
|
301
296
|
}
|
|
302
297
|
}
|
|
303
298
|
#hasLabelChildren(object) {
|
|
304
|
-
return object.children.every(c =>
|
|
305
|
-
var _c$layerUpdateState$t;
|
|
306
|
-
return c.layerUpdateState && ((_c$layerUpdateState$t = c.layerUpdateState[this.id]) === null || _c$layerUpdateState$t === void 0 ? void 0 : _c$layerUpdateState$t.hasFinished());
|
|
307
|
-
});
|
|
299
|
+
return object.children.every(c => c.layerUpdateState && c.layerUpdateState[this.id]?.hasFinished());
|
|
308
300
|
}
|
|
309
301
|
|
|
310
302
|
// Remove all labels invisible with pre-culling with screen grid
|
|
@@ -439,8 +431,7 @@ class LabelLayer extends GeometryLayer {
|
|
|
439
431
|
this.removeNodeDomElement(node);
|
|
440
432
|
}
|
|
441
433
|
removeNodeDomElement(node) {
|
|
442
|
-
|
|
443
|
-
if ((_node$link$this$id = node.link[this.id]) !== null && _node$link$this$id !== void 0 && _node$link$this$id.domElements) {
|
|
434
|
+
if (node.link[this.id]?.domElements) {
|
|
444
435
|
const child = node.link[this.id].domElements.dom;
|
|
445
436
|
child.parentElement.removeChild(child);
|
|
446
437
|
delete node.link[this.id].domElements;
|
package/lib/Layer/Layer.js
CHANGED
|
@@ -100,8 +100,7 @@ class Layer extends THREE.EventDispatcher {
|
|
|
100
100
|
super();
|
|
101
101
|
this.isLayer = true;
|
|
102
102
|
if (config.style && !(config.style instanceof Style)) {
|
|
103
|
-
|
|
104
|
-
if (typeof ((_config$style$fill = config.style.fill) === null || _config$style$fill === void 0 ? void 0 : _config$style$fill.pattern) === 'string') {
|
|
103
|
+
if (typeof config.style.fill?.pattern === 'string') {
|
|
105
104
|
console.warn('Using style.fill.pattern = { source: Img|url } is adviced');
|
|
106
105
|
config.style.fill.pattern = {
|
|
107
106
|
source: config.style.fill.pattern
|
|
@@ -73,16 +73,13 @@ function markForDeletion(elt) {
|
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
function changeIntensityRange(layer) {
|
|
76
|
-
|
|
77
|
-
(_layer$material$inten = layer.material.intensityRange) === null || _layer$material$inten === void 0 ? void 0 : _layer$material$inten.set(layer.minIntensityRange, layer.maxIntensityRange);
|
|
76
|
+
layer.material.intensityRange?.set(layer.minIntensityRange, layer.maxIntensityRange);
|
|
78
77
|
}
|
|
79
78
|
function changeElevationRange(layer) {
|
|
80
|
-
|
|
81
|
-
(_layer$material$eleva = layer.material.elevationRange) === null || _layer$material$eleva === void 0 ? void 0 : _layer$material$eleva.set(layer.minElevationRange, layer.maxElevationRange);
|
|
79
|
+
layer.material.elevationRange?.set(layer.minElevationRange, layer.maxElevationRange);
|
|
82
80
|
}
|
|
83
81
|
function changeAngleRange(layer) {
|
|
84
|
-
|
|
85
|
-
(_layer$material$angle = layer.material.angleRange) === null || _layer$material$angle === void 0 ? void 0 : _layer$material$angle.set(layer.minAngleRange, layer.maxAngleRange);
|
|
82
|
+
layer.material.angleRange?.set(layer.minAngleRange, layer.maxAngleRange);
|
|
86
83
|
}
|
|
87
84
|
|
|
88
85
|
/**
|
|
@@ -43,8 +43,7 @@ function ReferLayerProperties(material, layer) {
|
|
|
43
43
|
});
|
|
44
44
|
Object.defineProperty(material, 'transparent', {
|
|
45
45
|
get: () => {
|
|
46
|
-
|
|
47
|
-
const needTransparency = ((_material$userData$ne = material.userData.needTransparency) === null || _material$userData$ne === void 0 ? void 0 : _material$userData$ne[material.mode]) || material.layer.opacity < 1.0;
|
|
46
|
+
const needTransparency = material.userData.needTransparency?.[material.mode] || material.layer.opacity < 1.0;
|
|
48
47
|
if (transparent != needTransparency) {
|
|
49
48
|
material.needsUpdate = true;
|
|
50
49
|
transparent = needTransparency;
|
|
@@ -132,8 +132,7 @@ function toFeatureType(jsonType) {
|
|
|
132
132
|
const keyProperties = ['type', 'geometry', 'properties'];
|
|
133
133
|
const firstCoordinates = a => a === undefined || Array.isArray(a) && !isNaN(a[0]) ? a : firstCoordinates(a[0]);
|
|
134
134
|
function jsonFeatureToFeature(crsIn, json, collection) {
|
|
135
|
-
|
|
136
|
-
if (!((_json$geometry = json.geometry) !== null && _json$geometry !== void 0 && _json$geometry.type)) {
|
|
135
|
+
if (!json.geometry?.type) {
|
|
137
136
|
console.warn('No geometry provided');
|
|
138
137
|
return null;
|
|
139
138
|
}
|
|
@@ -142,7 +141,7 @@ function jsonFeatureToFeature(crsIn, json, collection) {
|
|
|
142
141
|
const feature = collection.requestFeatureByType(featureType);
|
|
143
142
|
const coordinates = jsonType != 'point' ? json.geometry.coordinates : [json.geometry.coordinates];
|
|
144
143
|
const properties = json.properties || {};
|
|
145
|
-
feature.hasRawElevationData =
|
|
144
|
+
feature.hasRawElevationData = firstCoordinates(coordinates)?.length === 3;
|
|
146
145
|
|
|
147
146
|
// copy other properties
|
|
148
147
|
for (const key of Object.keys(json)) {
|
package/lib/Parser/LASParser.js
CHANGED
|
@@ -89,13 +89,12 @@ export default {
|
|
|
89
89
|
* header of the file is contained in `userData`.
|
|
90
90
|
*/
|
|
91
91
|
parse(data) {
|
|
92
|
-
var _options$out, _options$in;
|
|
93
92
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
94
|
-
if (
|
|
93
|
+
if (options.out?.skip) {
|
|
95
94
|
console.warn("Warning: options 'skip' not supported anymore");
|
|
96
95
|
}
|
|
97
96
|
return lasLoader.parseFile(data, {
|
|
98
|
-
colorDepth:
|
|
97
|
+
colorDepth: options.in?.colorDepth
|
|
99
98
|
}).then(parsedData => {
|
|
100
99
|
const geometry = buildBufferGeometry(parsedData.attributes);
|
|
101
100
|
geometry.userData.header = parsedData.header;
|
|
@@ -321,7 +321,6 @@ threeExamples.LegacyGLTFLoader = function () {
|
|
|
321
321
|
1029: THREE.FrontSide // Culling back
|
|
322
322
|
//1032: THREE.NoSide // Culling front and back, what to do?
|
|
323
323
|
};
|
|
324
|
-
|
|
325
324
|
var WEBGL_DEPTH_FUNCS = {
|
|
326
325
|
512: THREE.NeverDepth,
|
|
327
326
|
513: THREE.LessDepth,
|
|
@@ -355,7 +354,6 @@ threeExamples.LegacyGLTFLoader = function () {
|
|
|
355
354
|
//32771: CONSTANT_ALPHA,
|
|
356
355
|
//32772: ONE_MINUS_CONSTANT_COLOR
|
|
357
356
|
};
|
|
358
|
-
|
|
359
357
|
var WEBGL_TYPE_SIZES = {
|
|
360
358
|
'SCALAR': 1,
|
|
361
359
|
'VEC2': 2,
|
|
@@ -1116,6 +1114,7 @@ threeExamples.LegacyGLTFLoader = function () {
|
|
|
1116
1114
|
|
|
1117
1115
|
// According to COLLADA spec...
|
|
1118
1116
|
// aspectRatio = xfov / yfov
|
|
1117
|
+
|
|
1119
1118
|
var _camera = new THREE.PerspectiveCamera(THREE.MathUtils.radToDeg(yfov * aspectRatio), aspectRatio, camera.perspective.znear || 1, camera.perspective.zfar || 2e6);
|
|
1120
1119
|
if (camera.name !== undefined) _camera.name = camera.name;
|
|
1121
1120
|
if (camera.extras) _camera.userData = camera.extras;
|
|
@@ -17,9 +17,8 @@ export default {
|
|
|
17
17
|
if (node.layerUpdateState[layer.id] === undefined) {
|
|
18
18
|
node.layerUpdateState[layer.id] = new LayerUpdateState();
|
|
19
19
|
} else if (!node.layerUpdateState[layer.id].canTryUpdate()) {
|
|
20
|
-
var _node$link$layer$id;
|
|
21
20
|
// toggle visibility features
|
|
22
|
-
|
|
21
|
+
node.link[layer.id]?.forEach(f => {
|
|
23
22
|
f.layer.object3d.add(f);
|
|
24
23
|
f.meshes.position.z = geoidLayerIsVisible(layer.parent) ? node.geoidHeight : 0;
|
|
25
24
|
f.meshes.updateMatrixWorld();
|
|
@@ -62,14 +62,12 @@ export function updateLayeredMaterialNodeImagery(context, layer, node, parent) {
|
|
|
62
62
|
return;
|
|
63
63
|
} // ok, we're going to inherit our parent's texture
|
|
64
64
|
}
|
|
65
|
-
|
|
66
65
|
if (!nodeLayer) {
|
|
67
|
-
var _parent$material;
|
|
68
66
|
// Create new raster node
|
|
69
67
|
nodeLayer = layer.setupRasterNode(node);
|
|
70
68
|
|
|
71
69
|
// Init the node by parent
|
|
72
|
-
const parentLayer =
|
|
70
|
+
const parentLayer = parent.material?.getLayer(layer.id);
|
|
73
71
|
nodeLayer.initFromParent(parentLayer, extentsDestination);
|
|
74
72
|
}
|
|
75
73
|
|
|
@@ -158,9 +156,8 @@ export function updateLayeredMaterialNodeElevation(context, layer, node, parent)
|
|
|
158
156
|
nodeLayer = layer.setupRasterNode(node);
|
|
159
157
|
}
|
|
160
158
|
if (node.layerUpdateState[layer.id] === undefined) {
|
|
161
|
-
var _parent$material2;
|
|
162
159
|
node.layerUpdateState[layer.id] = new LayerUpdateState();
|
|
163
|
-
const parentLayer =
|
|
160
|
+
const parentLayer = parent.material?.getLayer(layer.id);
|
|
164
161
|
nodeLayer.initFromParent(parentLayer, extentsDestination);
|
|
165
162
|
if (nodeLayer.level >= layer.source.zoom.min) {
|
|
166
163
|
context.view.notifyChange(node, false);
|
|
@@ -210,8 +207,7 @@ export function removeLayeredMaterialNodeLayer(layerId) {
|
|
|
210
207
|
* @param {TileMesh} node - The node to udpate.
|
|
211
208
|
*/
|
|
212
209
|
return function (node) {
|
|
213
|
-
|
|
214
|
-
if ((_node$material = node.material) !== null && _node$material !== void 0 && _node$material.removeLayer) {
|
|
210
|
+
if (node.material?.removeLayer) {
|
|
215
211
|
if (node.material.elevationLayerIds.indexOf(layerId) > -1) {
|
|
216
212
|
node.setBBoxZ({
|
|
217
213
|
min: 0,
|
|
@@ -28,7 +28,6 @@ export default {
|
|
|
28
28
|
// see https://github.com/iTowns/itowns/issues/869
|
|
29
29
|
// obj.geometry = null;
|
|
30
30
|
}
|
|
31
|
-
|
|
32
31
|
if (obj.material) {
|
|
33
32
|
if (Array.isArray(obj.material)) {
|
|
34
33
|
for (const material of obj.material) {
|
|
@@ -82,7 +81,7 @@ export default {
|
|
|
82
81
|
// of the objects which have their own removal logic
|
|
83
82
|
let toRemove = obj.children.filter(c => c.layer && c.layer.id === layer.id);
|
|
84
83
|
const linked = obj.link && obj.link[layer.id];
|
|
85
|
-
if (linked
|
|
84
|
+
if (linked?.children.length) {
|
|
86
85
|
toRemove = toRemove.concat(linked.children);
|
|
87
86
|
delete obj.link[layer.id];
|
|
88
87
|
}
|
|
@@ -2,8 +2,7 @@ import { ImageryLayers } from "../Layer/Layer.js";
|
|
|
2
2
|
function updateLayersOrdering(geometryLayer, imageryLayers) {
|
|
3
3
|
const sequence = ImageryLayers.getColorLayersIdOrderedBySequence(imageryLayers);
|
|
4
4
|
const cO = function (object) {
|
|
5
|
-
|
|
6
|
-
if ((_object$material = object.material) !== null && _object$material !== void 0 && _object$material.setSequence) {
|
|
5
|
+
if (object.material?.setSequence) {
|
|
7
6
|
object.material.setSequence(sequence);
|
|
8
7
|
}
|
|
9
8
|
};
|
|
@@ -157,10 +157,7 @@ class Label2DRenderer {
|
|
|
157
157
|
}
|
|
158
158
|
});
|
|
159
159
|
labelLayers.forEach(labelLayer => {
|
|
160
|
-
labelLayer.toHide.children.forEach(labelsNode =>
|
|
161
|
-
var _labelsNode$domElemen;
|
|
162
|
-
return (_labelsNode$domElemen = labelsNode.domElements) === null || _labelsNode$domElemen === void 0 ? void 0 : _labelsNode$domElemen.labels.hide();
|
|
163
|
-
});
|
|
160
|
+
labelLayer.toHide.children.forEach(labelsNode => labelsNode.domElements?.labels.hide());
|
|
164
161
|
labelLayer.toHide.clear();
|
|
165
162
|
});
|
|
166
163
|
}
|
|
@@ -17,23 +17,29 @@ class DDSLoader extends CompressedTextureLoader {
|
|
|
17
17
|
|
|
18
18
|
// All values and structures referenced from:
|
|
19
19
|
// http://msdn.microsoft.com/en-us/library/bb943991.aspx/
|
|
20
|
+
|
|
20
21
|
// const DDSD_CAPS = 0x1;
|
|
21
22
|
// const DDSD_HEIGHT = 0x2;
|
|
22
23
|
// const DDSD_WIDTH = 0x4;
|
|
23
24
|
// const DDSD_PITCH = 0x8;
|
|
24
25
|
// const DDSD_PIXELFORMAT = 0x1000;
|
|
26
|
+
|
|
25
27
|
// const DDSD_LINEARSIZE = 0x80000;
|
|
26
28
|
// const DDSD_DEPTH = 0x800000;
|
|
29
|
+
|
|
27
30
|
// const DDSCAPS_COMPLEX = 0x8;
|
|
28
31
|
// const DDSCAPS_MIPMAP = 0x400000;
|
|
29
32
|
// const DDSCAPS_TEXTURE = 0x1000;
|
|
33
|
+
|
|
30
34
|
// const DDSCAPS2_VOLUME = 0x200000;
|
|
35
|
+
|
|
31
36
|
// const DDPF_ALPHAPIXELS = 0x1;
|
|
32
37
|
// const DDPF_ALPHA = 0x2;
|
|
33
38
|
// const DDPF_FOURCC = 0x4;
|
|
34
39
|
// const DDPF_RGB = 0x40;
|
|
35
40
|
// const DDPF_YUV = 0x200;
|
|
36
41
|
// const DDPF_LUMINANCE = 0x20000;
|
|
42
|
+
|
|
37
43
|
function fourCCToInt32(value) {
|
|
38
44
|
return value.charCodeAt(0) + (value.charCodeAt(1) << 8) + (value.charCodeAt(2) << 16) + (value.charCodeAt(3) << 24);
|
|
39
45
|
}
|
|
@@ -66,7 +72,6 @@ class DDSLoader extends CompressedTextureLoader {
|
|
|
66
72
|
dst++; //a
|
|
67
73
|
}
|
|
68
74
|
}
|
|
69
|
-
|
|
70
75
|
return byteArray;
|
|
71
76
|
}
|
|
72
77
|
const FOURCC_DXT1 = fourCCToInt32('DXT1');
|
|
@@ -78,11 +83,16 @@ class DDSLoader extends CompressedTextureLoader {
|
|
|
78
83
|
const extendedHeaderLengthInt = 5; // The extended header length in 32 bit ints
|
|
79
84
|
|
|
80
85
|
// Offsets into the header array
|
|
86
|
+
|
|
81
87
|
// const off_pfFlags = 20;
|
|
88
|
+
|
|
82
89
|
// const off_caps = 27;
|
|
90
|
+
|
|
83
91
|
// const off_caps3 = 29;
|
|
84
92
|
// const off_caps4 = 30;
|
|
93
|
+
|
|
85
94
|
// If fourCC = DX10, the extended header starts after 32
|
|
95
|
+
|
|
86
96
|
// Parse header
|
|
87
97
|
|
|
88
98
|
const header = new Int32Array(buffer, 0, headerLengthInt);
|