itowns 2.44.3-next.21 → 2.44.3-next.23
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/examples/layers/JSONLayers/GeoidMNT.json +3 -1
- package/examples/source_file_geojson_3d.html +0 -1
- package/examples/source_stream_wfs_raster.html +0 -7
- package/lib/Converter/Feature2Mesh.js +1 -2
- package/lib/Converter/Feature2Texture.js +3 -1
- package/lib/Converter/convertToTile.js +3 -3
- package/lib/Converter/textureConverter.js +1 -2
- package/lib/Core/Feature.js +1 -2
- package/lib/Core/Geographic/Coordinates.js +1 -1
- package/lib/Core/Geographic/Crs.js +114 -144
- package/lib/Core/Geographic/Extent.js +2 -5
- package/lib/Core/Geographic/GeoidGrid.js +1 -1
- package/lib/Core/Prefab/Globe/Atmosphere.js +4 -2
- package/lib/Core/Prefab/Globe/GlobeLayer.js +21 -14
- package/lib/Core/Prefab/Globe/GlobeTileBuilder.js +111 -0
- package/lib/Core/Prefab/GlobeView.js +2 -3
- package/lib/Core/Prefab/Planar/PlanarLayer.js +16 -10
- package/lib/Core/Prefab/Planar/PlanarTileBuilder.js +43 -43
- package/lib/Core/Prefab/TileBuilder.js +27 -32
- package/lib/Core/Prefab/computeBufferTileGeometry.js +189 -130
- package/lib/Core/Tile/Tile.js +4 -4
- package/lib/Core/Tile/TileGrid.js +7 -10
- package/lib/Core/TileGeometry.js +112 -28
- package/lib/Core/TileMesh.js +1 -2
- package/lib/Core/View.js +2 -2
- package/lib/Layer/C3DTilesLayer.js +7 -4
- package/lib/Layer/ColorLayer.js +35 -9
- package/lib/Layer/CopcLayer.js +5 -0
- package/lib/Layer/ElevationLayer.js +39 -7
- package/lib/Layer/EntwinePointTileLayer.js +12 -5
- package/lib/Layer/FeatureGeometryLayer.js +20 -6
- package/lib/Layer/GeometryLayer.js +42 -11
- package/lib/Layer/LabelLayer.js +11 -5
- package/lib/Layer/Layer.js +83 -57
- package/lib/Layer/OGC3DTilesLayer.js +3 -2
- package/lib/Layer/OrientedImageLayer.js +12 -4
- package/lib/Layer/PointCloudLayer.js +69 -23
- package/lib/Layer/Potree2Layer.js +7 -2
- package/lib/Layer/PotreeLayer.js +8 -3
- package/lib/Layer/RasterLayer.js +12 -2
- package/lib/Layer/TiledGeometryLayer.js +69 -13
- package/lib/Main.js +1 -1
- package/lib/Provider/Fetcher.js +5 -1
- package/lib/Renderer/OBB.js +11 -13
- package/lib/Renderer/RasterTile.js +1 -2
- package/lib/Source/FileSource.js +1 -2
- package/lib/Source/Source.js +1 -1
- package/lib/Source/TMSSource.js +2 -3
- package/lib/Source/WFSSource.js +1 -2
- package/package.json +3 -3
- package/lib/Core/Prefab/Globe/BuilderEllipsoidTile.js +0 -110
package/lib/Core/Tile/Tile.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
|
+
import * as CRS from "../Geographic/Crs.js";
|
|
2
3
|
import Coordinates from "../Geographic/Coordinates.js";
|
|
3
|
-
import CRS from "../Geographic/Crs.js";
|
|
4
4
|
import Extent from "../Geographic/Extent.js";
|
|
5
5
|
import { getInfoTms, getCountTiles } from "./TileGrid.js";
|
|
6
6
|
const _tmsCoord = new THREE.Vector2();
|
|
@@ -169,14 +169,14 @@ class Tile {
|
|
|
169
169
|
* @returns {Tile[]}
|
|
170
170
|
*/
|
|
171
171
|
export function tiledCovering(e, tms) {
|
|
172
|
-
if (e.crs == 'EPSG:4326' && tms ==
|
|
172
|
+
if (e.crs == 'EPSG:4326' && tms == 'EPSG:3857') {
|
|
173
173
|
const WMTS_PM = [];
|
|
174
|
-
const extent = _extent.copy(e).as(
|
|
174
|
+
const extent = _extent.copy(e).as(tms, _extent2);
|
|
175
175
|
const {
|
|
176
176
|
globalExtent,
|
|
177
177
|
globalDimension,
|
|
178
178
|
sTs
|
|
179
|
-
} = getInfoTms(
|
|
179
|
+
} = getInfoTms(tms);
|
|
180
180
|
extent.clampByExtent(globalExtent);
|
|
181
181
|
extent.planarDimensions(_dimensionTile);
|
|
182
182
|
const zoom = e.zoom + 1 || Math.floor(Math.log2(Math.round(globalDimension.x / (_dimensionTile.x * sTs.x))));
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
|
-
import CRS from "../Geographic/Crs.js";
|
|
3
2
|
import Extent from "../Geographic/Extent.js";
|
|
4
3
|
const _countTiles = new THREE.Vector2();
|
|
5
4
|
const _dim = new THREE.Vector2();
|
|
@@ -15,23 +14,21 @@ const extent3857 = extent4326.as('EPSG:3857');
|
|
|
15
14
|
extent3857.clampSouthNorth(extent3857.west, extent3857.east);
|
|
16
15
|
globalExtentTMS.set('EPSG:3857', extent3857);
|
|
17
16
|
schemeTiles.set('default', new THREE.Vector2(1, 1));
|
|
18
|
-
schemeTiles.set(
|
|
19
|
-
schemeTiles.set(
|
|
17
|
+
schemeTiles.set('EPSG:3857', schemeTiles.get('default'));
|
|
18
|
+
schemeTiles.set('EPSG:4326', new THREE.Vector2(2, 1));
|
|
20
19
|
export function getInfoTms(/** @type {string} */crs) {
|
|
21
|
-
const
|
|
22
|
-
const globalExtent = globalExtentTMS.get(epsg);
|
|
20
|
+
const globalExtent = globalExtentTMS.get(crs);
|
|
23
21
|
const globalDimension = globalExtent.planarDimensions(_dim);
|
|
24
|
-
const
|
|
25
|
-
const sTs = schemeTiles.get(tms) || schemeTiles.get('default');
|
|
22
|
+
const sTs = schemeTiles.get(crs) || schemeTiles.get('default');
|
|
26
23
|
// The isInverted parameter is to be set to the correct value, true or false
|
|
27
24
|
// (default being false) if the computation of the coordinates needs to be
|
|
28
25
|
// inverted to match the same scheme as OSM, Google Maps or other system.
|
|
29
26
|
// See link below for more information
|
|
30
27
|
// https://alastaira.wordpress.com/2011/07/06/converting-tms-tile-coordinates-to-googlebingosm-tile-coordinates/
|
|
31
28
|
// in crs includes ':NI' => tms isn't inverted (NOT INVERTED)
|
|
32
|
-
const isInverted = !
|
|
29
|
+
const isInverted = !crs.includes(':NI');
|
|
33
30
|
return {
|
|
34
|
-
epsg,
|
|
31
|
+
epsg: crs,
|
|
35
32
|
globalExtent,
|
|
36
33
|
globalDimension,
|
|
37
34
|
sTs,
|
|
@@ -39,7 +36,7 @@ export function getInfoTms(/** @type {string} */crs) {
|
|
|
39
36
|
};
|
|
40
37
|
}
|
|
41
38
|
export function getCountTiles(/** @type {string} */crs, /** @type {number} */zoom) {
|
|
42
|
-
const sTs = schemeTiles.get(
|
|
39
|
+
const sTs = schemeTiles.get(crs) || schemeTiles.get('default');
|
|
43
40
|
const count = 2 ** zoom;
|
|
44
41
|
_countTiles.set(count, count).multiply(sTs);
|
|
45
42
|
return _countTiles;
|
package/lib/Core/TileGeometry.js
CHANGED
|
@@ -1,40 +1,124 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
|
-
import computeBuffers,
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
2
|
+
import { computeBuffers, getBufferIndexSize } from "./Prefab/computeBufferTileGeometry.js";
|
|
3
|
+
import Coordinates from "./Geographic/Coordinates.js";
|
|
4
|
+
function defaultBuffers(builder, params) {
|
|
5
|
+
const fullParams = {
|
|
6
|
+
disableSkirt: false,
|
|
7
|
+
hideSkirt: false,
|
|
8
|
+
buildIndexAndUv_0: true,
|
|
9
|
+
segments: 16,
|
|
10
|
+
coordinates: new Coordinates(builder.crs),
|
|
11
|
+
center: builder.center(params.extent).clone(),
|
|
12
|
+
...params
|
|
13
|
+
};
|
|
14
|
+
const buffers = computeBuffers(builder, fullParams);
|
|
15
|
+
const bufferAttributes = {
|
|
16
|
+
index: buffers.index ? new THREE.BufferAttribute(buffers.index, 1) : null,
|
|
17
|
+
uvs: [...(buffers.uvs[0] ? [new THREE.BufferAttribute(buffers.uvs[0], 2)] : []), ...(buffers.uvs[1] ? [new THREE.BufferAttribute(buffers.uvs[1], 1)] : [])],
|
|
18
|
+
position: new THREE.BufferAttribute(buffers.position, 3),
|
|
19
|
+
normal: new THREE.BufferAttribute(buffers.normal, 3)
|
|
20
|
+
};
|
|
21
|
+
return bufferAttributes;
|
|
15
22
|
}
|
|
16
|
-
class TileGeometry extends THREE.BufferGeometry {
|
|
17
|
-
|
|
18
|
-
|
|
23
|
+
export class TileGeometry extends THREE.BufferGeometry {
|
|
24
|
+
/** Oriented Bounding Box of the tile geometry. */
|
|
25
|
+
|
|
26
|
+
/** Ground area covered by this tile geometry. */
|
|
27
|
+
|
|
28
|
+
/** Resolution of the tile geometry in segments per side. */
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* [TileGeometry] instances are shared between tiles. Since a geometry
|
|
32
|
+
* handles its own GPU resource, it needs a reference counter to dispose of
|
|
33
|
+
* that resource only when it is discarded by every single owner of a
|
|
34
|
+
* reference to the geometry.
|
|
35
|
+
*/
|
|
36
|
+
// https://github.com/iTowns/itowns/pull/2440#discussion_r1860743294
|
|
37
|
+
// TODO: Remove nullability by reworking OBB:setFromExtent
|
|
38
|
+
|
|
39
|
+
constructor(builder, params) {
|
|
40
|
+
let bufferAttributes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultBuffers(builder, params);
|
|
19
41
|
super();
|
|
20
|
-
this.center = params.center;
|
|
21
42
|
this.extent = params.extent;
|
|
22
43
|
this.segments = params.segments;
|
|
23
|
-
this.setIndex(
|
|
24
|
-
this.setAttribute('position',
|
|
25
|
-
this.setAttribute('normal',
|
|
26
|
-
this.setAttribute('uv',
|
|
27
|
-
for (let i = 1; i <
|
|
28
|
-
this.setAttribute(`uv_${i}`,
|
|
44
|
+
this.setIndex(bufferAttributes.index);
|
|
45
|
+
this.setAttribute('position', bufferAttributes.position);
|
|
46
|
+
this.setAttribute('normal', bufferAttributes.normal);
|
|
47
|
+
this.setAttribute('uv', bufferAttributes.uvs[0]);
|
|
48
|
+
for (let i = 1; i < bufferAttributes.uvs.length; i++) {
|
|
49
|
+
this.setAttribute(`uv_${i}`, bufferAttributes.uvs[i]);
|
|
29
50
|
}
|
|
30
51
|
this.computeBoundingBox();
|
|
31
|
-
this.OBB =
|
|
52
|
+
this.OBB = null;
|
|
32
53
|
if (params.hideSkirt) {
|
|
33
54
|
this.hideSkirt = params.hideSkirt;
|
|
34
55
|
}
|
|
56
|
+
this._refCount = null;
|
|
35
57
|
}
|
|
36
|
-
|
|
37
|
-
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Enables or disables skirt rendering.
|
|
61
|
+
*
|
|
62
|
+
* @param toggle - Whether to hide the skirt; true hides, false shows.
|
|
63
|
+
*/
|
|
64
|
+
set hideSkirt(toggle) {
|
|
65
|
+
this.setDrawRange(0, getBufferIndexSize(this.segments, toggle));
|
|
38
66
|
}
|
|
39
|
-
|
|
40
|
-
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Initialize reference count for this geometry if it is currently null.
|
|
70
|
+
*
|
|
71
|
+
* @param cacheTile - The [Cache] used to store this geometry.
|
|
72
|
+
* @param keys - The [south, level, epsg] key of this geometry.
|
|
73
|
+
*/
|
|
74
|
+
initRefCount(cacheTile, keys) {
|
|
75
|
+
if (this._refCount !== null) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
this._refCount = {
|
|
79
|
+
count: 0,
|
|
80
|
+
fn: () => {
|
|
81
|
+
this._refCount.count--;
|
|
82
|
+
if (this._refCount.count <= 0) {
|
|
83
|
+
// To avoid remove index buffer and attribute buffer uv
|
|
84
|
+
// error un-bound buffer in webgl with VAO rendering.
|
|
85
|
+
// Could be removed if the attribute buffer deleting is
|
|
86
|
+
// taken into account in the buffer binding state
|
|
87
|
+
// (in THREE.WebGLBindingStates code).
|
|
88
|
+
this.index = null;
|
|
89
|
+
delete this.attributes.uv;
|
|
90
|
+
cacheTile.delete(...keys);
|
|
91
|
+
super.dispose();
|
|
92
|
+
// THREE.BufferGeometry.prototype.dispose.call(this);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Increase reference count.
|
|
100
|
+
*
|
|
101
|
+
* @throws If reference count has not been initialized.
|
|
102
|
+
*/
|
|
103
|
+
increaseRefCount() {
|
|
104
|
+
if (this._refCount === null) {
|
|
105
|
+
throw new Error('[TileGeometry::increaseRefCount] ' + 'Tried to increment an unitialized reference count.');
|
|
106
|
+
}
|
|
107
|
+
this._refCount.count++;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* The current reference count of this [TileGeometry] if it has been
|
|
112
|
+
* initialized.
|
|
113
|
+
*/
|
|
114
|
+
get refCount() {
|
|
115
|
+
return this._refCount?.count;
|
|
116
|
+
}
|
|
117
|
+
dispose() {
|
|
118
|
+
if (this._refCount == null) {
|
|
119
|
+
super.dispose();
|
|
120
|
+
} else {
|
|
121
|
+
this._refCount.fn();
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
package/lib/Core/TileMesh.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
|
-
import CRS from "./Geographic/Crs.js";
|
|
3
2
|
import { geoidLayerIsVisible } from "../Layer/GeoidLayer.js";
|
|
4
3
|
import { tiledCovering } from "./Tile/Tile.js";
|
|
5
4
|
|
|
@@ -71,7 +70,7 @@ class TileMesh extends THREE.Mesh {
|
|
|
71
70
|
this.obb.box3D.getBoundingSphere(this.boundingSphere);
|
|
72
71
|
}
|
|
73
72
|
getExtentsByProjection(crs) {
|
|
74
|
-
return this.#_tms.get(
|
|
73
|
+
return this.#_tms.get(crs);
|
|
75
74
|
}
|
|
76
75
|
|
|
77
76
|
/**
|
package/lib/Core/View.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
|
+
import * as CRS from "./Geographic/Crs.js";
|
|
2
3
|
import Camera from "../Renderer/Camera.js";
|
|
3
4
|
import initializeWebXR from "../Renderer/WebXR.js";
|
|
4
5
|
import MainLoop, { MAIN_LOOP_EVENTS, RENDERING_PAUSED } from "./MainLoop.js";
|
|
@@ -6,7 +7,6 @@ import Capabilities from "./System/Capabilities.js";
|
|
|
6
7
|
import { COLOR_LAYERS_ORDER_CHANGED } from "../Renderer/ColorLayersOrdering.js";
|
|
7
8
|
import c3DEngine from "../Renderer/c3DEngine.js";
|
|
8
9
|
import RenderMode from "../Renderer/RenderMode.js";
|
|
9
|
-
import CRS from "./Geographic/Crs.js";
|
|
10
10
|
import Coordinates from "./Geographic/Coordinates.js";
|
|
11
11
|
import FeaturesUtils from "../Utils/FeaturesUtils.js";
|
|
12
12
|
import { getMaxColorSamplerUnitsCount } from "../Renderer/LayeredMaterial.js";
|
|
@@ -53,7 +53,7 @@ function _preprocessLayer(view, layer, parentLayer) {
|
|
|
53
53
|
// Find crs projection layer, this is projection destination
|
|
54
54
|
layer.crs = view.referenceCrs;
|
|
55
55
|
} else if (!layer.crs) {
|
|
56
|
-
if (parentLayer && parentLayer.tileMatrixSets && parentLayer.tileMatrixSets.includes(
|
|
56
|
+
if (parentLayer && parentLayer.tileMatrixSets && parentLayer.tileMatrixSets.includes(source.crs)) {
|
|
57
57
|
layer.crs = source.crs;
|
|
58
58
|
} else {
|
|
59
59
|
layer.crs = parentLayer && parentLayer.extent.crs;
|
|
@@ -51,11 +51,14 @@ function findTileID(object) {
|
|
|
51
51
|
function object3DHasFeature(object3d) {
|
|
52
52
|
return object3d.geometry && object3d.geometry.attributes._BATCHID;
|
|
53
53
|
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* @extends GeometryLayer
|
|
57
|
+
*/
|
|
54
58
|
class C3DTilesLayer extends GeometryLayer {
|
|
55
59
|
#fillColorMaterialsBuffer;
|
|
56
60
|
/**
|
|
57
61
|
* @deprecated Deprecated 3D Tiles layer. Use {@link OGC3DTilesLayer} instead.
|
|
58
|
-
* @extends GeometryLayer
|
|
59
62
|
*
|
|
60
63
|
* @example
|
|
61
64
|
* // Create a new 3d-tiles layer from a web server
|
|
@@ -83,7 +86,7 @@ class C3DTilesLayer extends GeometryLayer {
|
|
|
83
86
|
* {@link View} that already has a layer going by that id.
|
|
84
87
|
* @param {object} config configuration, all elements in it
|
|
85
88
|
* will be merged as is in the layer.
|
|
86
|
-
* @param {
|
|
89
|
+
* @param {C3DTilesSource} config.source The source of 3d Tiles.
|
|
87
90
|
*
|
|
88
91
|
* name.
|
|
89
92
|
* @param {Number} [config.sseThreshold=16] The [Screen Space Error](https://github.com/CesiumGS/3d-tiles/blob/main/specification/README.md#geometric-error)
|
|
@@ -143,8 +146,8 @@ class C3DTilesLayer extends GeometryLayer {
|
|
|
143
146
|
}
|
|
144
147
|
}
|
|
145
148
|
|
|
146
|
-
/** @type {Style} */
|
|
147
|
-
this.
|
|
149
|
+
/** @type {Style | null} */
|
|
150
|
+
this._style = config.style || null;
|
|
148
151
|
|
|
149
152
|
/** @type {Map<string, THREE.MeshStandardMaterial>} */
|
|
150
153
|
this.#fillColorMaterialsBuffer = new Map();
|
package/lib/Layer/ColorLayer.js
CHANGED
|
@@ -44,6 +44,8 @@ import { deprecatedColorLayerOptions } from "../Core/Deprecated/Undeprecator.js"
|
|
|
44
44
|
* * `1`: used to amplify the transparency effect.
|
|
45
45
|
* * `2`: unused.
|
|
46
46
|
* * `3`: could be used by your own glsl code.
|
|
47
|
+
*
|
|
48
|
+
* @extends RasterLayer
|
|
47
49
|
*/
|
|
48
50
|
class ColorLayer extends RasterLayer {
|
|
49
51
|
/**
|
|
@@ -51,8 +53,6 @@ class ColorLayer extends RasterLayer {
|
|
|
51
53
|
* it can be an aerial view of the ground or a simple transparent layer with the
|
|
52
54
|
* roads displayed.
|
|
53
55
|
*
|
|
54
|
-
* @extends Layer
|
|
55
|
-
*
|
|
56
56
|
* @param {string} id - The id of the layer, that should be unique. It is
|
|
57
57
|
* not mandatory, but an error will be emitted if this layer is added a
|
|
58
58
|
* {@link View} that already has a layer going by that id.
|
|
@@ -92,15 +92,41 @@ class ColorLayer extends RasterLayer {
|
|
|
92
92
|
constructor(id) {
|
|
93
93
|
let config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
94
94
|
deprecatedColorLayerOptions(config);
|
|
95
|
-
|
|
95
|
+
const {
|
|
96
|
+
effect_type = 0,
|
|
97
|
+
effect_parameter = 1.0,
|
|
98
|
+
transparent,
|
|
99
|
+
...rasterConfig
|
|
100
|
+
} = config;
|
|
101
|
+
super(id, rasterConfig);
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* @type {boolean}
|
|
105
|
+
* @readonly
|
|
106
|
+
*/
|
|
96
107
|
this.isColorLayer = true;
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* @type {boolean}
|
|
111
|
+
*/
|
|
112
|
+
this.visible = true;
|
|
113
|
+
this.defineLayerProperty('visible', this.visible);
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* @type {number}
|
|
117
|
+
*/
|
|
118
|
+
this.opacity = 1.0;
|
|
119
|
+
this.defineLayerProperty('opacity', this.opacity);
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* @type {number}
|
|
123
|
+
*/
|
|
124
|
+
this.sequence = 0;
|
|
125
|
+
this.defineLayerProperty('sequence', this.sequence);
|
|
126
|
+
this.transparent = transparent || this.opacity < 1.0;
|
|
101
127
|
this.noTextureParentOutsideLimit = config.source ? config.source.isFileSource : false;
|
|
102
|
-
this.effect_type =
|
|
103
|
-
this.effect_parameter =
|
|
128
|
+
this.effect_type = effect_type;
|
|
129
|
+
this.effect_parameter = effect_parameter;
|
|
104
130
|
|
|
105
131
|
// Feature options
|
|
106
132
|
this.buildExtent = true;
|
package/lib/Layer/CopcLayer.js
CHANGED
|
@@ -30,6 +30,11 @@ class CopcLayer extends PointCloudLayer {
|
|
|
30
30
|
*/
|
|
31
31
|
constructor(id, config) {
|
|
32
32
|
super(id, config);
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @type {boolean}
|
|
36
|
+
* @readonly
|
|
37
|
+
*/
|
|
33
38
|
this.isCopcLayer = true;
|
|
34
39
|
const resolve = () => this;
|
|
35
40
|
this.whenReady = this.source.whenReady.then((/** @type {CopcSource} */source) => {
|
|
@@ -22,14 +22,14 @@ import { RasterElevationTile } from "../Renderer/RasterTile.js";
|
|
|
22
22
|
* ```
|
|
23
23
|
* @property {number} colorTextureElevationMinZ - elevation minimum in `useColorTextureElevation` mode.
|
|
24
24
|
* @property {number} colorTextureElevationMaxZ - elevation maximum in `useColorTextureElevation` mode.
|
|
25
|
+
*
|
|
26
|
+
* @extends RasterLayer
|
|
25
27
|
*/
|
|
26
28
|
class ElevationLayer extends RasterLayer {
|
|
27
29
|
/**
|
|
28
30
|
* A simple layer, managing an elevation texture to add some reliefs on the
|
|
29
31
|
* plane or globe view for example.
|
|
30
32
|
*
|
|
31
|
-
* @extends Layer
|
|
32
|
-
*
|
|
33
33
|
* @param {string} id - The id of the layer, that should be unique. It is
|
|
34
34
|
* not mandatory, but an error will be emitted if this layer is added a
|
|
35
35
|
* {@link View} that already has a layer going by that id.
|
|
@@ -60,14 +60,46 @@ class ElevationLayer extends RasterLayer {
|
|
|
60
60
|
*/
|
|
61
61
|
constructor(id) {
|
|
62
62
|
let config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
63
|
-
|
|
63
|
+
const {
|
|
64
|
+
scale = 1.0,
|
|
65
|
+
noDataValue,
|
|
66
|
+
clampValues,
|
|
67
|
+
useRgbaTextureElevation,
|
|
68
|
+
useColorTextureElevation,
|
|
69
|
+
colorTextureElevationMinZ,
|
|
70
|
+
colorTextureElevationMaxZ,
|
|
71
|
+
bias,
|
|
72
|
+
mode,
|
|
73
|
+
...rasterConfig
|
|
74
|
+
} = config;
|
|
75
|
+
super(id, rasterConfig);
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* @type {boolean}
|
|
79
|
+
* @readonly
|
|
80
|
+
*/
|
|
81
|
+
this.isElevationLayer = true;
|
|
82
|
+
this.noDataValue = noDataValue;
|
|
64
83
|
if (config.zmin || config.zmax) {
|
|
65
84
|
console.warn('Config using zmin and zmax are deprecated, use {clampValues: {min, max}} structure.');
|
|
66
85
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* @type {number | undefined}
|
|
89
|
+
*/
|
|
90
|
+
this.zmin = clampValues?.min ?? config.zmin;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* @type {number | undefined}
|
|
94
|
+
*/
|
|
95
|
+
this.zmax = clampValues?.max ?? config.zmax;
|
|
96
|
+
this.defineLayerProperty('scale', scale);
|
|
97
|
+
this.useRgbaTextureElevation = useRgbaTextureElevation;
|
|
98
|
+
this.useColorTextureElevation = useColorTextureElevation;
|
|
99
|
+
this.colorTextureElevationMinZ = colorTextureElevationMinZ;
|
|
100
|
+
this.colorTextureElevationMaxZ = colorTextureElevationMaxZ;
|
|
101
|
+
this.bias = bias;
|
|
102
|
+
this.mode = mode;
|
|
71
103
|
}
|
|
72
104
|
|
|
73
105
|
/**
|
|
@@ -10,13 +10,13 @@ bboxMesh.geometry.boundingBox = box3;
|
|
|
10
10
|
* @property {boolean} isEntwinePointTileLayer - Used to checkout whether this
|
|
11
11
|
* layer is a EntwinePointTileLayer. Default is `true`. You should not change
|
|
12
12
|
* this, as it is used internally for optimisation.
|
|
13
|
+
*
|
|
14
|
+
* @extends PointCloudLayer
|
|
13
15
|
*/
|
|
14
16
|
class EntwinePointTileLayer extends PointCloudLayer {
|
|
15
17
|
/**
|
|
16
18
|
* Constructs a new instance of Entwine Point Tile layer.
|
|
17
19
|
*
|
|
18
|
-
* @extends PointCloudLayer
|
|
19
|
-
*
|
|
20
20
|
* @example
|
|
21
21
|
* // Create a new point cloud layer
|
|
22
22
|
* const points = new EntwinePointTileLayer('EPT',
|
|
@@ -36,15 +36,22 @@ class EntwinePointTileLayer extends PointCloudLayer {
|
|
|
36
36
|
* contains three elements `name, protocol, extent`, these elements will be
|
|
37
37
|
* available using `layer.name` or something else depending on the property
|
|
38
38
|
* name. See the list of properties to know which one can be specified.
|
|
39
|
-
* @param {string} [config.crs=ESPG:4326] - The CRS of the {@link View} this
|
|
39
|
+
* @param {string} [config.crs='ESPG:4326'] - The CRS of the {@link View} this
|
|
40
40
|
* layer will be attached to. This is used to determine the extent of this
|
|
41
41
|
* layer. Default to `EPSG:4326`.
|
|
42
|
-
* @param {number} [config.skip=1] - Read one point from every `skip` points
|
|
43
|
-
* - see {@link LASParser}.
|
|
44
42
|
*/
|
|
45
43
|
constructor(id, config) {
|
|
46
44
|
super(id, config);
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* @type {boolean}
|
|
48
|
+
* @readonly
|
|
49
|
+
*/
|
|
47
50
|
this.isEntwinePointTileLayer = true;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* @type {THREE.Vector3}
|
|
54
|
+
*/
|
|
48
55
|
this.scale = new THREE.Vector3(1, 1, 1);
|
|
49
56
|
const resolve = this.addInitializationStep();
|
|
50
57
|
this.whenReady = this.source.whenReady.then(() => {
|
|
@@ -12,10 +12,11 @@ import Feature2Mesh from "../Converter/Feature2Mesh.js";
|
|
|
12
12
|
* @property {boolean} isFeatureGeometryLayer - Used to checkout whether this layer is
|
|
13
13
|
* a FeatureGeometryLayer. Default is true. You should not change this, as it is used
|
|
14
14
|
* internally for optimisation.
|
|
15
|
+
*
|
|
16
|
+
* @extends GeometryLayer
|
|
15
17
|
*/
|
|
16
18
|
class FeatureGeometryLayer extends GeometryLayer {
|
|
17
19
|
/**
|
|
18
|
-
* @extends GeometryLayer
|
|
19
20
|
*
|
|
20
21
|
* @param {string} id - The id of the layer, that should be unique. It is
|
|
21
22
|
* not mandatory, but an error will be emitted if this layer is added a
|
|
@@ -28,6 +29,9 @@ class FeatureGeometryLayer extends GeometryLayer {
|
|
|
28
29
|
* @param {THREE.Object3D} [options.object3d=new THREE.Group()] root object3d layer.
|
|
29
30
|
* @param {function} [options.onMeshCreated] this callback is called when the mesh is created. The callback parameters are the
|
|
30
31
|
* `mesh` and the `context`.
|
|
32
|
+
* @param {function} [options.filter] callback which filters the features of
|
|
33
|
+
* this layer. It takes an object with a `properties` property as argument
|
|
34
|
+
* and shall return a boolean.
|
|
31
35
|
* @param {boolean} [options.accurate=TRUE] If `accurate` is `true`, data are re-projected with maximum geographical accuracy.
|
|
32
36
|
* With `true`, `proj4` is used to transform data source.
|
|
33
37
|
*
|
|
@@ -45,14 +49,24 @@ class FeatureGeometryLayer extends GeometryLayer {
|
|
|
45
49
|
*/
|
|
46
50
|
constructor(id) {
|
|
47
51
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
batchId
|
|
52
|
+
const {
|
|
53
|
+
object3d,
|
|
54
|
+
batchId,
|
|
55
|
+
onMeshCreated,
|
|
56
|
+
accurate = true,
|
|
57
|
+
filter,
|
|
58
|
+
...geometryOptions
|
|
59
|
+
} = options;
|
|
60
|
+
super(id, object3d || new Group(), geometryOptions);
|
|
61
|
+
this.update = FeatureProcessing.update;
|
|
62
|
+
this.convert = Feature2Mesh.convert({
|
|
63
|
+
batchId
|
|
51
64
|
});
|
|
52
|
-
|
|
65
|
+
this.onMeshCreated = onMeshCreated;
|
|
53
66
|
this.isFeatureGeometryLayer = true;
|
|
54
|
-
this.accurate =
|
|
67
|
+
this.accurate = accurate;
|
|
55
68
|
this.buildExtent = !this.accurate;
|
|
69
|
+
this.filter = filter;
|
|
56
70
|
}
|
|
57
71
|
preUpdate(context, sources) {
|
|
58
72
|
if (sources.has(this.parent)) {
|
|
@@ -23,8 +23,6 @@ class GeometryLayer extends Layer {
|
|
|
23
23
|
* A layer usually managing a geometry to display on a view. For example, it
|
|
24
24
|
* can be a layer of buildings extruded from a a WFS stream.
|
|
25
25
|
*
|
|
26
|
-
* @extends Layer
|
|
27
|
-
*
|
|
28
26
|
* @param {string} id - The id of the layer, that should be unique. It is
|
|
29
27
|
* not mandatory, but an error will be emitted if this layer is added a
|
|
30
28
|
* {@link View} that already has a layer going by that id.
|
|
@@ -36,7 +34,10 @@ class GeometryLayer extends Layer {
|
|
|
36
34
|
* contains three elements `name, protocol, extent`, these elements will be
|
|
37
35
|
* available using `layer.name` or something else depending on the property
|
|
38
36
|
* name.
|
|
39
|
-
* @param {Source}
|
|
37
|
+
* @param {Source} config.source - Description and options of the source.
|
|
38
|
+
* @param {number} [config.cacheLifeTime=Infinity] - set life time value in cache.
|
|
39
|
+
* This value is used for [Cache]{@link Cache} expiration mechanism.
|
|
40
|
+
* @param {boolean} [config.visible]
|
|
40
41
|
*
|
|
41
42
|
* @throws {Error} `object3d` must be a valid `THREE.Object3d`.
|
|
42
43
|
*
|
|
@@ -55,12 +56,21 @@ class GeometryLayer extends Layer {
|
|
|
55
56
|
*/
|
|
56
57
|
constructor(id, object3d) {
|
|
57
58
|
let config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
58
|
-
|
|
59
|
+
const {
|
|
60
|
+
cacheLifeTime = CACHE_POLICIES.GEOMETRY,
|
|
61
|
+
visible = true,
|
|
62
|
+
opacity = 1.0,
|
|
63
|
+
...layerConfig
|
|
64
|
+
} = config;
|
|
65
|
+
super(id, {
|
|
66
|
+
...layerConfig,
|
|
67
|
+
cacheLifeTime
|
|
68
|
+
});
|
|
59
69
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
70
|
+
/**
|
|
71
|
+
* @type {boolean}
|
|
72
|
+
* @readonly
|
|
73
|
+
*/
|
|
64
74
|
this.isGeometryLayer = true;
|
|
65
75
|
if (!object3d || !object3d.isObject3D) {
|
|
66
76
|
throw new Error(`Missing/Invalid object3d parameter (must be a
|
|
@@ -69,15 +79,36 @@ class GeometryLayer extends Layer {
|
|
|
69
79
|
if (object3d.type === 'Group' && object3d.name === '') {
|
|
70
80
|
object3d.name = id;
|
|
71
81
|
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* @type {THREE.Object3D}
|
|
85
|
+
* @readonly
|
|
86
|
+
*/
|
|
87
|
+
this.object3d = object3d;
|
|
72
88
|
Object.defineProperty(this, 'object3d', {
|
|
73
|
-
value: object3d,
|
|
74
89
|
writable: false,
|
|
75
90
|
configurable: true
|
|
76
91
|
});
|
|
77
|
-
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* @type {number}
|
|
95
|
+
*/
|
|
96
|
+
this.opacity = opacity;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* @type {boolean}
|
|
100
|
+
*/
|
|
78
101
|
this.wireframe = false;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* @type {Layer[]}
|
|
105
|
+
*/
|
|
79
106
|
this.attachedLayers = [];
|
|
80
|
-
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* @type {boolean}
|
|
110
|
+
*/
|
|
111
|
+
this.visible = visible;
|
|
81
112
|
Object.defineProperty(this.zoom, 'max', {
|
|
82
113
|
value: Infinity,
|
|
83
114
|
writable: false
|
package/lib/Layer/LabelLayer.js
CHANGED
|
@@ -168,17 +168,23 @@ class LabelLayer extends GeometryLayer {
|
|
|
168
168
|
*/
|
|
169
169
|
constructor(id) {
|
|
170
170
|
let config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
171
|
-
const
|
|
172
|
-
|
|
173
|
-
|
|
171
|
+
const {
|
|
172
|
+
domElement,
|
|
173
|
+
performance = true,
|
|
174
|
+
forceClampToTerrain = false,
|
|
175
|
+
margin,
|
|
176
|
+
...geometryConfig
|
|
177
|
+
} = config;
|
|
178
|
+
super(id, config.object3d || new THREE.Group(), geometryConfig);
|
|
174
179
|
this.isLabelLayer = true;
|
|
175
180
|
this.domElement = new DomNode();
|
|
176
181
|
this.domElement.show();
|
|
177
182
|
this.domElement.dom.id = `itowns-label-${this.id}`;
|
|
178
183
|
this.buildExtent = true;
|
|
179
184
|
this.crs = config.source.crs;
|
|
180
|
-
this.performance =
|
|
181
|
-
this.forceClampToTerrain =
|
|
185
|
+
this.performance = performance;
|
|
186
|
+
this.forceClampToTerrain = forceClampToTerrain;
|
|
187
|
+
this.margin = margin;
|
|
182
188
|
this.toHide = new THREE.Group();
|
|
183
189
|
this.labelDomelement = domElement;
|
|
184
190
|
|