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/Layer/Layer.js
CHANGED
|
@@ -90,62 +90,96 @@ class Layer extends THREE.EventDispatcher {
|
|
|
90
90
|
*/
|
|
91
91
|
constructor(id) {
|
|
92
92
|
let config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
93
|
+
const {
|
|
94
|
+
source,
|
|
95
|
+
name,
|
|
96
|
+
style = {},
|
|
97
|
+
subdivisionThreshold = 256,
|
|
98
|
+
addLabelLayer = false,
|
|
99
|
+
cacheLifeTime,
|
|
100
|
+
options = {},
|
|
101
|
+
updateStrategy,
|
|
102
|
+
zoom,
|
|
103
|
+
mergeFeatures = true,
|
|
104
|
+
crs
|
|
105
|
+
} = config;
|
|
101
106
|
super();
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* @type {boolean}
|
|
110
|
+
* @readonly
|
|
111
|
+
*/
|
|
102
112
|
this.isLayer = true;
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}
|
|
110
|
-
config.style = new Style(config.style);
|
|
111
|
-
}
|
|
112
|
-
this.style = config.style || new Style();
|
|
113
|
-
this.subdivisionThreshold = config.subdivisionThreshold || 256;
|
|
114
|
-
this.sizeDiagonalTexture = (2 * (this.subdivisionThreshold * this.subdivisionThreshold)) ** 0.5;
|
|
115
|
-
Object.assign(this, config);
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* @type {string}
|
|
116
|
+
* @readonly
|
|
117
|
+
*/
|
|
118
|
+
this.id = id;
|
|
116
119
|
Object.defineProperty(this, 'id', {
|
|
117
|
-
value: id,
|
|
118
120
|
writable: false
|
|
119
121
|
});
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
};
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* @type {string}
|
|
125
|
+
*/
|
|
126
|
+
this.name = name;
|
|
127
|
+
if (source === undefined || source === true) {
|
|
128
|
+
throw new Error(`Layer ${id} needs Source`);
|
|
127
129
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
130
|
+
/**
|
|
131
|
+
* @type {Source}
|
|
132
|
+
*/
|
|
133
|
+
this.source = source || new Source({
|
|
134
|
+
url: 'none'
|
|
135
|
+
});
|
|
136
|
+
this.crs = crs;
|
|
137
|
+
if (style && !(style instanceof Style)) {
|
|
138
|
+
if (typeof style.fill?.pattern === 'string') {
|
|
139
|
+
console.warn('Using style.fill.pattern = { source: Img|url } is adviced');
|
|
140
|
+
style.fill.pattern = {
|
|
141
|
+
source: style.fill.pattern
|
|
142
|
+
};
|
|
136
143
|
}
|
|
144
|
+
this.style = new Style(style);
|
|
137
145
|
} else {
|
|
138
|
-
this.
|
|
139
|
-
max: Infinity,
|
|
140
|
-
min: 0
|
|
141
|
-
};
|
|
146
|
+
this.style = style || new Style();
|
|
142
147
|
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* @type {number}
|
|
151
|
+
*/
|
|
152
|
+
this.subdivisionThreshold = subdivisionThreshold;
|
|
153
|
+
this.sizeDiagonalTexture = (2 * (this.subdivisionThreshold * this.subdivisionThreshold)) ** 0.5;
|
|
154
|
+
this.addLabelLayer = addLabelLayer;
|
|
155
|
+
|
|
156
|
+
// Default properties
|
|
157
|
+
this.options = options;
|
|
158
|
+
this.updateStrategy = updateStrategy ?? {
|
|
159
|
+
type: STRATEGY_MIN_NETWORK_TRAFFIC,
|
|
160
|
+
options: {}
|
|
161
|
+
};
|
|
162
|
+
this.defineLayerProperty('frozen', false);
|
|
163
|
+
this.zoom = {
|
|
164
|
+
min: zoom?.min ?? 0,
|
|
165
|
+
max: zoom?.max ?? Infinity
|
|
166
|
+
};
|
|
143
167
|
this.info = new InfoLayer(this);
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* @type {boolean}
|
|
171
|
+
*/
|
|
147
172
|
this.ready = false;
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* @type {Array<Promise<any>>}
|
|
176
|
+
* @protected
|
|
177
|
+
*/
|
|
148
178
|
this._promises = [];
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* @type {Promise<this>}
|
|
182
|
+
*/
|
|
149
183
|
this.whenReady = new Promise((re, rj) => {
|
|
150
184
|
this._resolve = re;
|
|
151
185
|
this._reject = rj;
|
|
@@ -157,11 +191,12 @@ class Layer extends THREE.EventDispatcher {
|
|
|
157
191
|
return this;
|
|
158
192
|
});
|
|
159
193
|
this._promises.push(this.source.whenReady);
|
|
160
|
-
this.cache = new Cache(config.cacheLifeTime);
|
|
161
|
-
this.mergeFeatures = this.mergeFeatures === undefined ? true : config.mergeFeatures;
|
|
162
194
|
|
|
163
|
-
|
|
164
|
-
|
|
195
|
+
/**
|
|
196
|
+
* @type {Cache}
|
|
197
|
+
*/
|
|
198
|
+
this.cache = new Cache(cacheLifeTime);
|
|
199
|
+
this.mergeFeatures = mergeFeatures;
|
|
165
200
|
}
|
|
166
201
|
addInitializationStep() {
|
|
167
202
|
// Possibility to add rejection handler, if it's necessary.
|
|
@@ -243,15 +278,6 @@ class Layer extends THREE.EventDispatcher {
|
|
|
243
278
|
return data;
|
|
244
279
|
}
|
|
245
280
|
|
|
246
|
-
/**
|
|
247
|
-
* Determines whether the specified feature is valid data.
|
|
248
|
-
*
|
|
249
|
-
* @param {Feature} feature The feature
|
|
250
|
-
* @returns {Feature} the feature is returned if it's valided
|
|
251
|
-
*/
|
|
252
|
-
// eslint-disable-next-line
|
|
253
|
-
isValidData() {}
|
|
254
|
-
|
|
255
281
|
/**
|
|
256
282
|
* Remove and dispose all objects from layer.
|
|
257
283
|
* @param {boolean} [clearCache=false] Whether to clear the layer cache or not
|
|
@@ -335,7 +335,8 @@ class OGC3DTilesLayer extends GeometryLayer {
|
|
|
335
335
|
const {
|
|
336
336
|
face,
|
|
337
337
|
index,
|
|
338
|
-
object
|
|
338
|
+
object,
|
|
339
|
+
instanceId
|
|
339
340
|
} = intersects[0];
|
|
340
341
|
|
|
341
342
|
/** @type{number|null} */
|
|
@@ -343,7 +344,7 @@ class OGC3DTilesLayer extends GeometryLayer {
|
|
|
343
344
|
if (object.isPoints && index) {
|
|
344
345
|
batchId = object.geometry.getAttribute('_BATCHID')?.getX(index) ?? index;
|
|
345
346
|
} else if (object.isMesh && face) {
|
|
346
|
-
batchId = object.geometry.getAttribute('_BATCHID')?.getX(face.a);
|
|
347
|
+
batchId = object.geometry.getAttribute('_BATCHID')?.getX(face.a) ?? instanceId;
|
|
347
348
|
}
|
|
348
349
|
if (batchId === undefined) {
|
|
349
350
|
return null;
|
|
@@ -96,14 +96,22 @@ class OrientedImageLayer extends GeometryLayer {
|
|
|
96
96
|
*/
|
|
97
97
|
constructor(id) {
|
|
98
98
|
let config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
99
|
+
const {
|
|
100
|
+
backgroundDistance,
|
|
101
|
+
background = createBackground(backgroundDistance),
|
|
102
|
+
onPanoChanged = () => {},
|
|
103
|
+
getCamerasNameFromFeature = () => {},
|
|
104
|
+
...geometryOptions
|
|
105
|
+
} = config;
|
|
106
|
+
|
|
99
107
|
/* istanbul ignore next */
|
|
100
108
|
if (config.projection) {
|
|
101
109
|
console.warn('OrientedImageLayer projection parameter is deprecated, use crs instead.');
|
|
102
110
|
config.crs = config.crs || config.projection;
|
|
103
111
|
}
|
|
104
|
-
super(id, new THREE.Group(),
|
|
112
|
+
super(id, new THREE.Group(), geometryOptions);
|
|
105
113
|
this.isOrientedImageLayer = true;
|
|
106
|
-
this.background =
|
|
114
|
+
this.background = background;
|
|
107
115
|
if (this.background) {
|
|
108
116
|
// Add layer id to easily identify the objects later on (e.g. to delete the geometries when deleting the layer)
|
|
109
117
|
this.background.layer = this.background.layer ?? {};
|
|
@@ -115,10 +123,10 @@ class OrientedImageLayer extends GeometryLayer {
|
|
|
115
123
|
this.currentPano = undefined;
|
|
116
124
|
|
|
117
125
|
// store a callback to fire event when current panoramic change
|
|
118
|
-
this.onPanoChanged =
|
|
126
|
+
this.onPanoChanged = onPanoChanged;
|
|
119
127
|
|
|
120
128
|
// function to get cameras name from panoramic feature
|
|
121
|
-
this.getCamerasNameFromFeature =
|
|
129
|
+
this.getCamerasNameFromFeature = getCamerasNameFromFeature;
|
|
122
130
|
const resolve = this.addInitializationStep();
|
|
123
131
|
this.mergeFeatures = false;
|
|
124
132
|
this.filteringExtent = false;
|
|
@@ -113,6 +113,8 @@ function changeAngleRange(layer) {
|
|
|
113
113
|
* @property {number} [maxIntensityRange=1] - The maximal intensity of the
|
|
114
114
|
* layer. Changing this value will affect the material, if it has the
|
|
115
115
|
* corresponding uniform. The value is normalized between 0 and 1.
|
|
116
|
+
*
|
|
117
|
+
* @extends GeometryLayer
|
|
116
118
|
*/
|
|
117
119
|
class PointCloudLayer extends GeometryLayer {
|
|
118
120
|
/**
|
|
@@ -120,8 +122,6 @@ class PointCloudLayer extends GeometryLayer {
|
|
|
120
122
|
* Constructs a new instance of a Point Cloud Layer. This should not be used
|
|
121
123
|
* directly, but rather implemented using `extends`.
|
|
122
124
|
*
|
|
123
|
-
* @extends GeometryLayer
|
|
124
|
-
*
|
|
125
125
|
* @param {string} id - The id of the layer, that should be unique. It is
|
|
126
126
|
* not mandatory, but an error will be emitted if this layer is added a
|
|
127
127
|
* {@link View} that already has a layer going by that id.
|
|
@@ -130,40 +130,86 @@ class PointCloudLayer extends GeometryLayer {
|
|
|
130
130
|
* contains three elements `name, protocol, extent`, these elements will be
|
|
131
131
|
* available using `layer.name` or something else depending on the property
|
|
132
132
|
* name. See the list of properties to know which one can be specified.
|
|
133
|
+
* @param {Source} config.source - Description and options of the source.
|
|
133
134
|
*/
|
|
134
135
|
constructor(id) {
|
|
135
136
|
let config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
136
|
-
|
|
137
|
+
const {
|
|
138
|
+
object3d = new THREE.Group(),
|
|
139
|
+
group = new THREE.Group(),
|
|
140
|
+
bboxes = new THREE.Group(),
|
|
141
|
+
octreeDepthLimit = -1,
|
|
142
|
+
pointBudget = 2000000,
|
|
143
|
+
pointSize = 2,
|
|
144
|
+
sseThreshold = 2,
|
|
145
|
+
minIntensityRange = 1,
|
|
146
|
+
maxIntensityRange = 65536,
|
|
147
|
+
minElevationRange = 0,
|
|
148
|
+
maxElevationRange = 1000,
|
|
149
|
+
minAngleRange = -90,
|
|
150
|
+
maxAngleRange = 90,
|
|
151
|
+
material = {},
|
|
152
|
+
mode = PNTS_MODE.COLOR,
|
|
153
|
+
...geometryLayerConfig
|
|
154
|
+
} = config;
|
|
155
|
+
super(id, object3d, geometryLayerConfig);
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* @type {boolean}
|
|
159
|
+
* @readonly
|
|
160
|
+
*/
|
|
137
161
|
this.isPointCloudLayer = true;
|
|
138
162
|
this.protocol = 'pointcloud';
|
|
139
|
-
this.group =
|
|
163
|
+
this.group = group;
|
|
140
164
|
this.object3d.add(this.group);
|
|
141
|
-
this.bboxes =
|
|
165
|
+
this.bboxes = bboxes || new THREE.Group();
|
|
142
166
|
this.bboxes.visible = false;
|
|
143
167
|
this.object3d.add(this.bboxes);
|
|
144
168
|
this.group.updateMatrixWorld();
|
|
145
169
|
|
|
146
170
|
// default config
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
this.
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
this.
|
|
156
|
-
|
|
157
|
-
|
|
171
|
+
/**
|
|
172
|
+
* @type {number}
|
|
173
|
+
*/
|
|
174
|
+
this.octreeDepthLimit = octreeDepthLimit;
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* @type {number}
|
|
178
|
+
*/
|
|
179
|
+
this.pointBudget = pointBudget;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* @type {number}
|
|
183
|
+
*/
|
|
184
|
+
this.pointSize = pointSize;
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* @type {number}
|
|
188
|
+
*/
|
|
189
|
+
this.sseThreshold = sseThreshold;
|
|
190
|
+
this.defineLayerProperty('minIntensityRange', minIntensityRange, changeIntensityRange);
|
|
191
|
+
this.defineLayerProperty('maxIntensityRange', maxIntensityRange, changeIntensityRange);
|
|
192
|
+
this.defineLayerProperty('minElevationRange', minElevationRange, changeElevationRange);
|
|
193
|
+
this.defineLayerProperty('maxElevationRange', maxElevationRange, changeElevationRange);
|
|
194
|
+
this.defineLayerProperty('minAngleRange', minAngleRange, changeAngleRange);
|
|
195
|
+
this.defineLayerProperty('maxAngleRange', maxAngleRange, changeAngleRange);
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* @type {THREE.Material}
|
|
199
|
+
*/
|
|
200
|
+
this.material = material;
|
|
158
201
|
if (!this.material.isMaterial) {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
this.material = new PointsMaterial(config.material);
|
|
202
|
+
this.material.intensityRange = new THREE.Vector2(this.minIntensityRange, this.maxIntensityRange);
|
|
203
|
+
this.material.elevationRange = new THREE.Vector2(this.minElevationRange, this.maxElevationRange);
|
|
204
|
+
this.material.angleRange = new THREE.Vector2(this.minAngleRange, this.maxAngleRange);
|
|
205
|
+
this.material = new PointsMaterial(this.material);
|
|
164
206
|
}
|
|
165
|
-
this.
|
|
166
|
-
|
|
207
|
+
this.mode = mode || PNTS_MODE.COLOR;
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* @type {PointCloudNode | undefined}
|
|
211
|
+
*/
|
|
212
|
+
this.root = undefined;
|
|
167
213
|
}
|
|
168
214
|
preUpdate(context, changeSources) {
|
|
169
215
|
// See https://cesiumjs.org/hosted-apps/massiveworlds/downloads/Ring/WorldScaleTerrainRendering.pptx
|
|
@@ -99,13 +99,13 @@ function parseAttributes(jsonAttributes) {
|
|
|
99
99
|
* @property {boolean} isPotreeLayer - Used to checkout whether this layer
|
|
100
100
|
* is a Potree2Layer. Default is `true`. You should not change this, as it is
|
|
101
101
|
* used internally for optimisation.
|
|
102
|
+
*
|
|
103
|
+
* @extends PointCloudLayer
|
|
102
104
|
*/
|
|
103
105
|
class Potree2Layer extends PointCloudLayer {
|
|
104
106
|
/**
|
|
105
107
|
* Constructs a new instance of Potree2 layer.
|
|
106
108
|
*
|
|
107
|
-
* @extends PointCloudLayer
|
|
108
|
-
*
|
|
109
109
|
* @example
|
|
110
110
|
* // Create a new point cloud layer
|
|
111
111
|
* const points = new Potree2Layer('points',
|
|
@@ -132,6 +132,11 @@ class Potree2Layer extends PointCloudLayer {
|
|
|
132
132
|
*/
|
|
133
133
|
constructor(id, config) {
|
|
134
134
|
super(id, config);
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* @type {boolean}
|
|
138
|
+
* @readonly
|
|
139
|
+
*/
|
|
135
140
|
this.isPotreeLayer = true;
|
|
136
141
|
const resolve = this.addInitializationStep();
|
|
137
142
|
this.source.whenReady.then(metadata => {
|
package/lib/Layer/PotreeLayer.js
CHANGED
|
@@ -10,13 +10,13 @@ bboxMesh.geometry.boundingBox = box3;
|
|
|
10
10
|
* @property {boolean} isPotreeLayer - Used to checkout whether this layer
|
|
11
11
|
* is a PotreeLayer. Default is `true`. You should not change this, as it is
|
|
12
12
|
* used internally for optimisation.
|
|
13
|
+
*
|
|
14
|
+
* @extends PointCloudLayer
|
|
13
15
|
*/
|
|
14
16
|
class PotreeLayer extends PointCloudLayer {
|
|
15
17
|
/**
|
|
16
18
|
* Constructs a new instance of Potree layer.
|
|
17
19
|
*
|
|
18
|
-
* @extends PointCloudLayer
|
|
19
|
-
*
|
|
20
20
|
* @example
|
|
21
21
|
* // Create a new point cloud layer
|
|
22
22
|
* const points = new PotreeLayer('points',
|
|
@@ -37,12 +37,17 @@ class PotreeLayer extends PointCloudLayer {
|
|
|
37
37
|
* contains three elements `name, protocol, extent`, these elements will be
|
|
38
38
|
* available using `layer.name` or something else depending on the property
|
|
39
39
|
* name. See the list of properties to know which one can be specified.
|
|
40
|
-
* @param {string} [config.crs=ESPG:4326] - The CRS of the {@link View} this
|
|
40
|
+
* @param {string} [config.crs='ESPG:4326'] - The CRS of the {@link View} this
|
|
41
41
|
* layer will be attached to. This is used to determine the extent of this
|
|
42
42
|
* layer. Default to `EPSG:4326`.
|
|
43
43
|
*/
|
|
44
44
|
constructor(id, config) {
|
|
45
45
|
super(id, config);
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @type {boolean}
|
|
49
|
+
* @readonly
|
|
50
|
+
*/
|
|
46
51
|
this.isPotreeLayer = true;
|
|
47
52
|
const resolve = this.addInitializationStep();
|
|
48
53
|
this.source.whenReady.then(cloud => {
|
package/lib/Layer/RasterLayer.js
CHANGED
|
@@ -4,8 +4,18 @@ import textureConverter from "../Converter/textureConverter.js";
|
|
|
4
4
|
import { CACHE_POLICIES } from "../Core/Scheduler/Cache.js";
|
|
5
5
|
class RasterLayer extends Layer {
|
|
6
6
|
constructor(id, config) {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
const {
|
|
8
|
+
cacheLifeTime = CACHE_POLICIES.TEXTURE,
|
|
9
|
+
minFilter,
|
|
10
|
+
magFilter,
|
|
11
|
+
...layerConfig
|
|
12
|
+
} = config;
|
|
13
|
+
super(id, {
|
|
14
|
+
...layerConfig,
|
|
15
|
+
cacheLifeTime
|
|
16
|
+
});
|
|
17
|
+
this.minFilter = minFilter;
|
|
18
|
+
this.magFilter = magFilter;
|
|
9
19
|
}
|
|
10
20
|
convert(data, extentDestination) {
|
|
11
21
|
return textureConverter.convert(data, extentDestination, this);
|
|
@@ -16,6 +16,8 @@ const boundingSphereCenter = new THREE.Vector3();
|
|
|
16
16
|
* as it is used internally for optimisation.
|
|
17
17
|
* @property {boolean} hideSkirt (default false) - Used to hide the skirt (tile borders).
|
|
18
18
|
* Useful when the layer opacity < 1
|
|
19
|
+
*
|
|
20
|
+
* @extends GeometryLayer
|
|
19
21
|
*/
|
|
20
22
|
class TiledGeometryLayer extends GeometryLayer {
|
|
21
23
|
/**
|
|
@@ -38,12 +40,10 @@ class TiledGeometryLayer extends GeometryLayer {
|
|
|
38
40
|
* It corresponds at meters by pixel. If the projection tile exceeds a certain pixel size (on screen)
|
|
39
41
|
* then it is subdivided into 4 tiles with a zoom greater than 1.
|
|
40
42
|
*
|
|
41
|
-
* @extends GeometryLayer
|
|
42
|
-
*
|
|
43
43
|
* @param {string} id - The id of the layer, that should be unique. It is
|
|
44
44
|
* not mandatory, but an error will be emitted if this layer is added a
|
|
45
45
|
* {@link View} that already has a layer going by that id.
|
|
46
|
-
* @param {THREE.
|
|
46
|
+
* @param {THREE.Object3D} object3d - The object3d used to contain the
|
|
47
47
|
* geometry of the TiledGeometryLayer. It is usually a `THREE.Group`, but it
|
|
48
48
|
* can be anything inheriting from a `THREE.Object3d`.
|
|
49
49
|
* @param {Array} schemeTile - extents Array of root tiles
|
|
@@ -58,16 +58,63 @@ class TiledGeometryLayer extends GeometryLayer {
|
|
|
58
58
|
* @throws {Error} `object3d` must be a valid `THREE.Object3d`.
|
|
59
59
|
*/
|
|
60
60
|
constructor(id, object3d, schemeTile, builder, config) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
const {
|
|
62
|
+
sseSubdivisionThreshold = 1.0,
|
|
63
|
+
minSubdivisionLevel,
|
|
64
|
+
maxSubdivisionLevel,
|
|
65
|
+
maxDeltaElevationLevel,
|
|
66
|
+
tileMatrixSets,
|
|
67
|
+
diffuse,
|
|
68
|
+
showOutline = false,
|
|
69
|
+
segments,
|
|
70
|
+
disableSkirt = false,
|
|
71
|
+
materialOptions,
|
|
72
|
+
...configGeometryLayer
|
|
73
|
+
} = config;
|
|
74
|
+
super(id, object3d, {
|
|
75
|
+
...configGeometryLayer,
|
|
76
|
+
// cacheLifeTime = CACHE_POLICIES.INFINITE because the cache is handled by the builder
|
|
77
|
+
cacheLifeTime: CACHE_POLICIES.INFINITE,
|
|
78
|
+
source: false
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* @type {boolean}
|
|
83
|
+
* @readonly
|
|
84
|
+
*/
|
|
65
85
|
this.isTiledGeometryLayer = true;
|
|
86
|
+
this.protocol = 'tile';
|
|
87
|
+
|
|
66
88
|
// TODO : this should be add in a preprocess method specific to GeoidLayer.
|
|
67
89
|
this.object3d.geoidHeight = 0;
|
|
68
|
-
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* @type {boolean}
|
|
93
|
+
*/
|
|
94
|
+
this.disableSkirt = disableSkirt;
|
|
69
95
|
this._hideSkirt = !!config.hideSkirt;
|
|
70
|
-
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* @type {number}
|
|
99
|
+
*/
|
|
100
|
+
this.sseSubdivisionThreshold = sseSubdivisionThreshold;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* @type {number}
|
|
104
|
+
*/
|
|
105
|
+
this.minSubdivisionLevel = minSubdivisionLevel;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* @type {number}
|
|
109
|
+
*/
|
|
110
|
+
this.maxSubdivisionLevel = maxSubdivisionLevel;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* @type {number}
|
|
114
|
+
* @deprecated
|
|
115
|
+
*/
|
|
116
|
+
this.maxDeltaElevationLevel = maxDeltaElevationLevel;
|
|
117
|
+
this.segments = segments;
|
|
71
118
|
this.schemeTile = schemeTile;
|
|
72
119
|
this.builder = builder;
|
|
73
120
|
this.info = new InfoTiledGeometryLayer(this);
|
|
@@ -77,9 +124,19 @@ class TiledGeometryLayer extends GeometryLayer {
|
|
|
77
124
|
if (!this.builder) {
|
|
78
125
|
throw new Error(`Cannot init tiled layer without builder for layer ${this.id}`);
|
|
79
126
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
127
|
+
this.maxScreenSizeNode = this.sseSubdivisionThreshold * (this.sizeDiagonalTexture * 2);
|
|
128
|
+
this.tileMatrixSets = tileMatrixSets;
|
|
129
|
+
this.materialOptions = materialOptions;
|
|
130
|
+
|
|
131
|
+
/*
|
|
132
|
+
* @type {boolean}
|
|
133
|
+
*/
|
|
134
|
+
this.showOutline = showOutline;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* @type {THREE.Vector3 | undefined}
|
|
138
|
+
*/
|
|
139
|
+
this.diffuse = diffuse;
|
|
83
140
|
this.level0Nodes = [];
|
|
84
141
|
const promises = [];
|
|
85
142
|
for (const root of this.schemeTile) {
|
|
@@ -90,7 +147,6 @@ class TiledGeometryLayer extends GeometryLayer {
|
|
|
90
147
|
this.object3d.add(...level0s);
|
|
91
148
|
this.object3d.updateMatrixWorld();
|
|
92
149
|
}));
|
|
93
|
-
this.maxScreenSizeNode = this.sseSubdivisionThreshold * (this.sizeDiagonalTexture * 2);
|
|
94
150
|
}
|
|
95
151
|
get hideSkirt() {
|
|
96
152
|
return this._hideSkirt;
|
package/lib/Main.js
CHANGED
|
@@ -7,7 +7,7 @@ export const REVISION = conf.version;
|
|
|
7
7
|
export { default as Extent } from "./Core/Geographic/Extent.js";
|
|
8
8
|
export { default as Coordinates } from "./Core/Geographic/Coordinates.js";
|
|
9
9
|
export { default as GeoidGrid } from "./Core/Geographic/GeoidGrid.js";
|
|
10
|
-
export
|
|
10
|
+
export * as CRS from "./Core/Geographic/Crs.js";
|
|
11
11
|
export { default as Ellipsoid, ellipsoidSizes } from "./Core/Math/Ellipsoid.js";
|
|
12
12
|
export { default as GlobeView, GLOBE_VIEW_EVENTS } from "./Core/Prefab/GlobeView.js";
|
|
13
13
|
export { default as PlanarView } from "./Core/Prefab/PlanarView.js";
|
package/lib/Provider/Fetcher.js
CHANGED
|
@@ -102,7 +102,11 @@ export default {
|
|
|
102
102
|
res = resolve;
|
|
103
103
|
rej = reject;
|
|
104
104
|
});
|
|
105
|
-
textureLoader.load(url, res, () => {},
|
|
105
|
+
textureLoader.load(url, res, () => {}, event => {
|
|
106
|
+
const error = new Error(`Failed to load texture from URL: \`${url}\``);
|
|
107
|
+
error.originalEvent = event;
|
|
108
|
+
rej(error);
|
|
109
|
+
});
|
|
106
110
|
return promise;
|
|
107
111
|
},
|
|
108
112
|
/**
|
package/lib/Renderer/OBB.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import * as CRS from "../Core/Geographic/Crs.js";
|
|
3
|
+
import { TileGeometry } from "../Core/TileGeometry.js";
|
|
4
|
+
import { GlobeTileBuilder } from "../Core/Prefab/Globe/GlobeTileBuilder.js";
|
|
4
5
|
import Coordinates from "../Core/Geographic/Coordinates.js";
|
|
5
|
-
import CRS from "../Core/Geographic/Crs.js";
|
|
6
6
|
|
|
7
7
|
// get oriented bounding box of tile
|
|
8
|
-
const builder = new
|
|
9
|
-
crs: 'EPSG:4978',
|
|
8
|
+
const builder = new GlobeTileBuilder({
|
|
10
9
|
uvCount: 1
|
|
11
10
|
});
|
|
12
11
|
const size = new THREE.Vector3();
|
|
@@ -114,18 +113,17 @@ class OBB extends THREE.Object3D {
|
|
|
114
113
|
let maxHeight = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : extent.max || 0;
|
|
115
114
|
if (extent.crs == 'EPSG:4326') {
|
|
116
115
|
const {
|
|
117
|
-
|
|
116
|
+
shareableExtent,
|
|
118
117
|
quaternion,
|
|
119
118
|
position
|
|
120
|
-
} = builder.
|
|
119
|
+
} = builder.computeShareableExtent(extent);
|
|
121
120
|
// Compute the minimum count of segment to build tile
|
|
122
|
-
const segments = Math.max(Math.floor(
|
|
123
|
-
const geometry = new TileGeometry({
|
|
124
|
-
extent:
|
|
121
|
+
const segments = Math.max(Math.floor(shareableExtent.planarDimensions(dimension).x / 90 + 1), 2);
|
|
122
|
+
const geometry = new TileGeometry(builder, {
|
|
123
|
+
extent: shareableExtent,
|
|
125
124
|
level: 0,
|
|
126
125
|
segments,
|
|
127
|
-
disableSkirt: true
|
|
128
|
-
builder
|
|
126
|
+
disableSkirt: true
|
|
129
127
|
});
|
|
130
128
|
obb.box3D.copy(geometry.boundingBox);
|
|
131
129
|
obb.natBox.copy(geometry.boundingBox);
|
|
@@ -137,7 +135,7 @@ class OBB extends THREE.Object3D {
|
|
|
137
135
|
this.position.copy(position);
|
|
138
136
|
this.quaternion.copy(quaternion);
|
|
139
137
|
this.updateMatrixWorld(true);
|
|
140
|
-
} else if (
|
|
138
|
+
} else if (CRS.isMetricUnit(extent.crs)) {
|
|
141
139
|
extent.center(coord).toVector3(this.position);
|
|
142
140
|
extent.planarDimensions(dimension);
|
|
143
141
|
size.set(dimension.x, dimension.y, Math.abs(maxHeight - minHeight));
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
2
|
import { ELEVATION_MODES } from "./LayeredMaterial.js";
|
|
3
3
|
import { checkNodeElevationTextureValidity, insertSignificantValuesFromParent, computeMinMaxElevation } from "../Parser/XbilParser.js";
|
|
4
|
-
import CRS from "../Core/Geographic/Crs.js";
|
|
5
4
|
export const EMPTY_TEXTURE_ZOOM = -1;
|
|
6
5
|
const pitch = new THREE.Vector4();
|
|
7
6
|
function getIndiceWithPitch(i, pitch, w) {
|
|
@@ -29,7 +28,7 @@ class RasterTile extends THREE.EventDispatcher {
|
|
|
29
28
|
constructor(material, layer) {
|
|
30
29
|
super();
|
|
31
30
|
this.layer = layer;
|
|
32
|
-
this.crs = layer.parent.tileMatrixSets.indexOf(
|
|
31
|
+
this.crs = layer.parent.tileMatrixSets.indexOf(layer.crs);
|
|
33
32
|
if (this.crs == -1) {
|
|
34
33
|
console.error('Unknown crs:', layer.crs);
|
|
35
34
|
}
|
package/lib/Source/FileSource.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import Source from "./Source.js";
|
|
2
2
|
import Cache from "../Core/Scheduler/Cache.js";
|
|
3
|
-
import CRS from "../Core/Geographic/Crs.js";
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* An object defining the source of a single resource to get from a direct
|
|
@@ -155,7 +154,7 @@ class FileSource extends Source {
|
|
|
155
154
|
if (!features) {
|
|
156
155
|
options.out.buildExtent = this.crs != 'EPSG:4978';
|
|
157
156
|
if (options.out.buildExtent) {
|
|
158
|
-
options.out.forcedExtentCrs = options.out.crs != 'EPSG:4978' ? options.out.crs :
|
|
157
|
+
options.out.forcedExtentCrs = options.out.crs != 'EPSG:4978' ? options.out.crs : this.crs;
|
|
159
158
|
}
|
|
160
159
|
features = this.parser(this.fetchedData, options);
|
|
161
160
|
this._featuresCaches[options.out.crs].setByArray(features, [0]);
|