@cesium/engine 7.0.0 → 9.0.0
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/Build/ThirdParty/Workers/z-worker-pako.js +1 -5
- package/Build/Workers/{chunk-7XEAYGZK.js → chunk-24YTYWNB.js} +10 -10
- package/Build/Workers/{chunk-IQBYFRVW.js → chunk-2632RVPI.js} +7 -7
- package/Build/Workers/chunk-2KACWKS4.js +501 -0
- package/Build/Workers/{chunk-QZAD5O7I.js → chunk-2XPLH3JY.js} +7 -7
- package/Build/Workers/{chunk-JY5YEZFA.js → chunk-2ZBL3MVO.js} +8 -8
- package/Build/Workers/{chunk-ZK5JOS3D.js → chunk-3NCVAGDA.js} +14 -14
- package/Build/Workers/{chunk-AR5DNBJ4.js → chunk-5R6VWLMH.js} +6 -6
- package/Build/Workers/{chunk-PTQQUQC3.js → chunk-5TIV3L26.js} +13 -13
- package/Build/Workers/{chunk-BZP4T2JJ.js → chunk-6WF3KIF5.js} +10 -10
- package/Build/Workers/{chunk-5WQ523AW.js → chunk-73FKKY52.js} +5 -5
- package/Build/Workers/{chunk-F6SE42BK.js → chunk-7COR472O.js} +15 -472
- package/Build/Workers/{chunk-72SANQJV.js → chunk-ADOVHYWO.js} +9 -5
- package/Build/Workers/{chunk-5YLJ77FF.js → chunk-BCU2LH5T.js} +12 -11
- package/Build/Workers/{chunk-4EBHOMFX.js → chunk-C3XBUYBO.js} +17 -17
- package/Build/Workers/{chunk-IX2JCCNM.js → chunk-C6OI26DR.js} +1 -1
- package/Build/Workers/{chunk-2HJWSU7B.js → chunk-CO35JNNE.js} +4 -4
- package/Build/Workers/{chunk-OVLG3FRS.js → chunk-DGDUKCJJ.js} +6 -6
- package/Build/Workers/{chunk-DTAIXKTO.js → chunk-DPUSFA7S.js} +6 -6
- package/Build/Workers/{chunk-R5X4OQT4.js → chunk-E6WXPSJS.js} +7 -7
- package/Build/Workers/{chunk-VK3EJHWI.js → chunk-EOXYZ34O.js} +2 -2
- package/Build/Workers/{chunk-RAEV7K66.js → chunk-EPKE7GE3.js} +5 -5
- package/Build/Workers/{chunk-GV56Q4LU.js → chunk-GFA4SMXV.js} +11 -11
- package/Build/Workers/{chunk-NKPBIX7F.js → chunk-GXUXEOE2.js} +1 -1
- package/Build/Workers/{chunk-NY3K4IM3.js → chunk-HBQPB6IH.js} +12 -12
- package/Build/Workers/{chunk-6HZQPRUS.js → chunk-I37B3MZ2.js} +1 -1
- package/Build/Workers/{chunk-VRGFV2UO.js → chunk-L4BW3RUA.js} +10 -10
- package/Build/Workers/{chunk-6VJVYK2V.js → chunk-LAQP3SCC.js} +2 -2
- package/Build/Workers/{chunk-PNBGBETF.js → chunk-LQJ5FFFR.js} +10 -10
- package/Build/Workers/{chunk-UAEW6HKG.js → chunk-M2AYBTNH.js} +13 -13
- package/Build/Workers/{chunk-YUCVWAY6.js → chunk-MWV7IZK4.js} +7 -7
- package/Build/Workers/{chunk-JXDC723O.js → chunk-N4KXMWQU.js} +2 -2
- package/Build/Workers/{chunk-XWXM2O2R.js → chunk-NP2GYYE5.js} +6 -6
- package/Build/Workers/{chunk-GEJTYLCO.js → chunk-NZWNZA6S.js} +5 -5
- package/Build/Workers/{chunk-LZGHD6NY.js → chunk-P2YAAMT2.js} +15 -15
- package/Build/Workers/{chunk-S6SKF6DT.js → chunk-P4XKB3QZ.js} +5 -5
- package/Build/Workers/{chunk-U2VCRRQW.js → chunk-PXB7T27O.js} +6 -6
- package/Build/Workers/{chunk-RV7ZYPFT.js → chunk-QCQUZGXI.js} +4 -4
- package/Build/Workers/{chunk-JJ4VBOQ3.js → chunk-QKBGRKKG.js} +4 -4
- package/Build/Workers/{chunk-ODW7WYM4.js → chunk-RMOEYCZW.js} +2 -2
- package/Build/Workers/{chunk-ZUA2UUNV.js → chunk-RSJXEO2A.js} +2 -2
- package/Build/Workers/{chunk-UDO6BFSF.js → chunk-RV7ZOSS6.js} +13 -13
- package/Build/Workers/{chunk-LZ7JIV3K.js → chunk-SE4PXOEA.js} +17 -17
- package/Build/Workers/{chunk-S4MAZ3SS.js → chunk-SS4ESNE3.js} +2 -2
- package/Build/Workers/{chunk-AIPU2VSX.js → chunk-TJBU6GML.js} +6 -6
- package/Build/Workers/{chunk-5M3U6ZMA.js → chunk-TZORKRNK.js} +1 -1
- package/Build/Workers/{chunk-MY3VNFGQ.js → chunk-VR5RBW52.js} +7 -7
- package/Build/Workers/{chunk-FP6GYBFX.js → chunk-WHUSTDIB.js} +10 -10
- package/Build/Workers/{chunk-5HDYHG3F.js → chunk-X2F6BEPY.js} +13 -13
- package/Build/Workers/{chunk-WZU2YLWG.js → chunk-X6XOMPWL.js} +3 -3
- package/Build/Workers/{chunk-UGK3FCDY.js → chunk-YDVSBWEO.js} +1 -1
- package/Build/Workers/{chunk-46UD5ABS.js → chunk-YV4H2Y7M.js} +4 -4
- package/Build/Workers/{chunk-WBQCVXR3.js → chunk-Z7FQLK6N.js} +4 -4
- package/Build/Workers/{chunk-L2ZN645J.js → chunk-ZNVSKMQ2.js} +6 -6
- package/Build/Workers/{chunk-JCNXK6EL.js → chunk-ZYPTP7GS.js} +11 -11
- package/Build/Workers/combineGeometry.js +24 -23
- package/Build/Workers/createBoxGeometry.js +18 -17
- package/Build/Workers/createBoxOutlineGeometry.js +16 -15
- package/Build/Workers/createCircleGeometry.js +26 -25
- package/Build/Workers/createCircleOutlineGeometry.js +19 -18
- package/Build/Workers/createCoplanarPolygonGeometry.js +33 -32
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -30
- package/Build/Workers/createCorridorGeometry.js +29 -28
- package/Build/Workers/createCorridorOutlineGeometry.js +28 -27
- package/Build/Workers/createCylinderGeometry.js +20 -19
- package/Build/Workers/createCylinderOutlineGeometry.js +18 -17
- package/Build/Workers/createEllipseGeometry.js +26 -25
- package/Build/Workers/createEllipseOutlineGeometry.js +19 -18
- package/Build/Workers/createEllipsoidGeometry.js +19 -18
- package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -17
- package/Build/Workers/createFrustumGeometry.js +18 -17
- package/Build/Workers/createFrustumOutlineGeometry.js +18 -17
- package/Build/Workers/createGeometry.js +54 -33
- package/Build/Workers/createGroundPolylineGeometry.js +22 -21
- package/Build/Workers/createPlaneGeometry.js +16 -15
- package/Build/Workers/createPlaneOutlineGeometry.js +15 -14
- package/Build/Workers/createPolygonGeometry.js +33 -32
- package/Build/Workers/createPolygonOutlineGeometry.js +30 -29
- package/Build/Workers/createPolylineGeometry.js +25 -24
- package/Build/Workers/createPolylineVolumeGeometry.js +31 -30
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -26
- package/Build/Workers/createRectangleGeometry.js +27 -26
- package/Build/Workers/createRectangleOutlineGeometry.js +20 -19
- package/Build/Workers/createSimplePolylineGeometry.js +23 -22
- package/Build/Workers/createSphereGeometry.js +19 -18
- package/Build/Workers/createSphereOutlineGeometry.js +18 -17
- package/Build/Workers/createTaskProcessorWorker.js +3 -3
- package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
- package/Build/Workers/createVectorTileGeometries.js +24 -23
- package/Build/Workers/createVectorTilePoints.js +12 -12
- package/Build/Workers/createVectorTilePolygons.js +22 -21
- package/Build/Workers/createVectorTilePolylines.js +14 -14
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -21
- package/Build/Workers/createVerticesFromHeightmap.js +22 -21
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +19 -18
- package/Build/Workers/createWallGeometry.js +24 -23
- package/Build/Workers/createWallOutlineGeometry.js +23 -22
- package/Build/Workers/decodeDraco.js +11 -11
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
- package/Build/Workers/decodeI3S.js +601 -92
- package/Build/Workers/transcodeKTX2.js +7 -7
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -21
- package/Source/Core/Check.d.ts +127 -0
- package/Source/Core/Check.js +0 -1
- package/Source/Core/Ellipsoid.js +6 -0
- package/Source/Core/Geometry.js +1 -1
- package/Source/Core/IntersectionTests.js +6 -3
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/PixelFormat.js +5 -0
- package/Source/Core/PolygonGeometry.js +1 -1
- package/Source/Core/Transforms.js +3 -0
- package/Source/Core/VerticalExaggeration.js +2 -1
- package/Source/Core/srgbToLinear.js +32 -0
- package/Source/DataSources/CzmlDataSource.js +51 -23
- package/Source/DataSources/DataSourceDisplay.js +27 -0
- package/Source/DataSources/Entity.js +20 -2
- package/Source/DataSources/GeometryUpdaterSet.js +114 -0
- package/Source/DataSources/GeometryVisualizer.js +19 -83
- package/Source/Renderer/Context.js +10 -0
- package/Source/Renderer/ContextLimits.js +2 -0
- package/Source/Renderer/demodernizeShader.js +4 -1
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/Axis.js +12 -7
- package/Source/Scene/Billboard.js +32 -0
- package/Source/Scene/BillboardCollection.js +1 -1
- package/Source/Scene/BingMapsImageryProvider.js +4 -0
- package/Source/Scene/Camera.js +46 -4
- package/Source/Scene/Cesium3DTilesVoxelProvider.js +2 -9
- package/Source/Scene/Cesium3DTileset.js +10 -7
- package/Source/Scene/Cesium3DTilesetBaseTraversal.js +2 -4
- package/Source/Scene/FrameState.js +5 -0
- package/Source/Scene/Globe.js +0 -67
- package/Source/Scene/GlobeTranslucencyState.js +1 -1
- package/Source/Scene/GltfPipeline/updateVersion.js +69 -68
- package/Source/Scene/I3SDataProvider.js +270 -53
- package/Source/Scene/I3SDecoder.js +8 -1
- package/Source/Scene/I3SFeature.js +2 -5
- package/Source/Scene/I3SField.js +136 -31
- package/Source/Scene/I3SGeometry.js +70 -2
- package/Source/Scene/I3SLayer.js +55 -10
- package/Source/Scene/I3SNode.js +175 -18
- package/Source/Scene/I3SStatistics.js +94 -0
- package/Source/Scene/I3SSublayer.js +176 -0
- package/Source/Scene/I3SSymbology.js +337 -0
- package/Source/Scene/KeyframeNode.js +1 -1
- package/Source/Scene/Label.js +33 -0
- package/Source/Scene/LabelCollection.js +2 -1
- package/Source/Scene/Model/pickModel.js +25 -7
- package/Source/Scene/PickFramebuffer.js +37 -2
- package/Source/Scene/Picking.js +113 -39
- package/Source/Scene/Primitive.js +6 -5
- package/Source/Scene/Scene.js +126 -42
- package/Source/Scene/ScreenSpaceCameraController.js +21 -7
- package/Source/Scene/SensorVolumePortionToDisplay.js +69 -0
- package/Source/Scene/SpatialNode.js +12 -19
- package/Source/Scene/StructuralMetadata.js +1 -1
- package/Source/Scene/VoxelBoxShape.js +67 -6
- package/Source/Scene/VoxelCell.js +273 -0
- package/Source/Scene/VoxelCylinderShape.js +117 -163
- package/Source/Scene/VoxelEllipsoidShape.js +255 -304
- package/Source/Scene/VoxelPrimitive.js +109 -15
- package/Source/Scene/VoxelRenderResources.js +12 -3
- package/Source/Scene/VoxelShape.js +7 -4
- package/Source/Scene/VoxelTraversal.js +76 -54
- package/Source/Scene/buildVoxelDrawCommands.js +23 -0
- package/Source/Scene/createGooglePhotorealistic3DTileset.js +1 -0
- package/Source/Scene/processVoxelProperties.js +3 -0
- package/Source/Shaders/Voxels/IntersectBox.glsl +21 -47
- package/Source/Shaders/Voxels/IntersectBox.js +21 -47
- package/Source/Shaders/Voxels/IntersectClippingPlanes.glsl +1 -1
- package/Source/Shaders/Voxels/IntersectClippingPlanes.js +1 -1
- package/Source/Shaders/Voxels/IntersectCylinder.glsl +76 -203
- package/Source/Shaders/Voxels/IntersectCylinder.js +76 -203
- package/Source/Shaders/Voxels/IntersectEllipsoid.glsl +220 -229
- package/Source/Shaders/Voxels/IntersectEllipsoid.js +220 -229
- package/Source/Shaders/Voxels/IntersectLongitude.glsl +102 -0
- package/Source/Shaders/Voxels/IntersectLongitude.js +104 -0
- package/Source/Shaders/Voxels/IntersectionUtils.glsl +33 -11
- package/Source/Shaders/Voxels/IntersectionUtils.js +33 -11
- package/Source/Shaders/Voxels/Megatexture.glsl +1 -2
- package/Source/Shaders/Voxels/Megatexture.js +1 -2
- package/Source/Shaders/Voxels/Octree.glsl +14 -9
- package/Source/Shaders/Voxels/Octree.js +14 -9
- package/Source/Shaders/Voxels/VoxelFS.glsl +128 -40
- package/Source/Shaders/Voxels/VoxelFS.js +128 -40
- package/Source/Shaders/Voxels/VoxelUtils.glsl +31 -0
- package/Source/Shaders/Voxels/VoxelUtils.js +33 -0
- package/Source/Shaders/Voxels/convertUvToBox.glsl +24 -3
- package/Source/Shaders/Voxels/convertUvToBox.js +24 -4
- package/Source/Shaders/Voxels/convertUvToCylinder.glsl +64 -40
- package/Source/Shaders/Voxels/convertUvToCylinder.js +64 -40
- package/Source/Shaders/Voxels/convertUvToEllipsoid.glsl +100 -91
- package/Source/Shaders/Voxels/convertUvToEllipsoid.js +100 -91
- package/Source/ThirdParty/Workers/z-worker-pako.js +1 -1
- package/Source/Workers/createGeometry.js +40 -11
- package/Source/Workers/decodeI3S.js +720 -94
- package/index.d.ts +542 -40
- package/index.js +75 -66
- package/package.json +2 -2
package/Source/Scene/I3SNode.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import Cartographic from "../Core/Cartographic.js";
|
|
2
|
+
import Check from "../Core/Check.js";
|
|
2
3
|
import defaultValue from "../Core/defaultValue.js";
|
|
3
4
|
import defined from "../Core/defined.js";
|
|
4
5
|
import Ellipsoid from "../Core/Ellipsoid.js";
|
|
@@ -15,6 +16,16 @@ import I3SFeature from "./I3SFeature.js";
|
|
|
15
16
|
import I3SField from "./I3SField.js";
|
|
16
17
|
import I3SGeometry from "./I3SGeometry.js";
|
|
17
18
|
|
|
19
|
+
/**
|
|
20
|
+
* @typedef {object} I3SNode.AttributeFilter
|
|
21
|
+
*
|
|
22
|
+
* A filter given by an attribute name and values.
|
|
23
|
+
* The 3D feature object should be hidden if its value for the attribute name is not specified in the collection of values.
|
|
24
|
+
*
|
|
25
|
+
* @property {string} name The name of the attribute
|
|
26
|
+
* @property {string[]|number[]} values The collection of values
|
|
27
|
+
*/
|
|
28
|
+
|
|
18
29
|
/**
|
|
19
30
|
* This class implements an I3S Node. In CesiumJS each I3SNode creates a Cesium3DTile.
|
|
20
31
|
* <p>
|
|
@@ -64,6 +75,7 @@ function I3SNode(parent, ref, isRoot) {
|
|
|
64
75
|
this._globalTransform = undefined;
|
|
65
76
|
this._inverseGlobalTransform = undefined;
|
|
66
77
|
this._inverseRotationMatrix = undefined;
|
|
78
|
+
this._symbologyData = undefined;
|
|
67
79
|
}
|
|
68
80
|
|
|
69
81
|
Object.defineProperties(I3SNode.prototype, {
|
|
@@ -192,10 +204,7 @@ I3SNode.prototype.load = async function () {
|
|
|
192
204
|
|
|
193
205
|
// If we don't have a nodepage index load from json
|
|
194
206
|
if (!defined(this._nodeIndex)) {
|
|
195
|
-
const data = await I3SDataProvider.loadJson(
|
|
196
|
-
this._resource,
|
|
197
|
-
this._dataProvider._traceFetches
|
|
198
|
-
);
|
|
207
|
+
const data = await I3SDataProvider.loadJson(this._resource);
|
|
199
208
|
that._data = data;
|
|
200
209
|
processData();
|
|
201
210
|
return;
|
|
@@ -217,6 +226,12 @@ I3SNode.prototype.load = async function () {
|
|
|
217
226
|
processData();
|
|
218
227
|
};
|
|
219
228
|
|
|
229
|
+
function createAndLoadField(node, storageInfo) {
|
|
230
|
+
const newField = new I3SField(node, storageInfo);
|
|
231
|
+
node._fields[storageInfo.name] = newField;
|
|
232
|
+
return newField.load();
|
|
233
|
+
}
|
|
234
|
+
|
|
220
235
|
/**
|
|
221
236
|
* Loads the node fields.
|
|
222
237
|
* @returns {Promise<void>} A promise that is resolved when the I3S Node fields are loaded
|
|
@@ -225,23 +240,50 @@ I3SNode.prototype.loadFields = function () {
|
|
|
225
240
|
// Check if we must load fields
|
|
226
241
|
const fields = this._layer._data.attributeStorageInfo;
|
|
227
242
|
|
|
228
|
-
const that = this;
|
|
229
|
-
function createAndLoadField(fields, index) {
|
|
230
|
-
const newField = new I3SField(that, fields[index]);
|
|
231
|
-
that._fields[newField._storageInfo.name] = newField;
|
|
232
|
-
return newField.load();
|
|
233
|
-
}
|
|
234
|
-
|
|
235
243
|
const promises = [];
|
|
236
244
|
if (defined(fields)) {
|
|
237
245
|
for (let i = 0; i < fields.length; i++) {
|
|
238
|
-
|
|
246
|
+
const storageInfo = fields[i];
|
|
247
|
+
const field = this._fields[storageInfo.name];
|
|
248
|
+
if (defined(field)) {
|
|
249
|
+
promises.push(field.load());
|
|
250
|
+
} else {
|
|
251
|
+
promises.push(createAndLoadField(this, storageInfo));
|
|
252
|
+
}
|
|
239
253
|
}
|
|
240
254
|
}
|
|
241
255
|
|
|
242
256
|
return Promise.all(promises);
|
|
243
257
|
};
|
|
244
258
|
|
|
259
|
+
/**
|
|
260
|
+
* Loads the node field.
|
|
261
|
+
* @param {string} name The field name
|
|
262
|
+
* @returns {Promise<void>} A promise that is resolved when the I3S Node field is loaded
|
|
263
|
+
*/
|
|
264
|
+
I3SNode.prototype.loadField = function (name) {
|
|
265
|
+
//>>includeStart('debug', pragmas.debug);
|
|
266
|
+
Check.defined("name", name);
|
|
267
|
+
//>>includeEnd('debug');
|
|
268
|
+
|
|
269
|
+
const field = this._fields[name];
|
|
270
|
+
if (defined(field)) {
|
|
271
|
+
return field.load();
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
const fields = this._layer._data.attributeStorageInfo;
|
|
275
|
+
if (defined(fields)) {
|
|
276
|
+
for (let i = 0; i < fields.length; i++) {
|
|
277
|
+
const storageInfo = fields[i];
|
|
278
|
+
if (storageInfo.name === name) {
|
|
279
|
+
return createAndLoadField(this, storageInfo);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
return Promise.resolve();
|
|
285
|
+
};
|
|
286
|
+
|
|
245
287
|
/**
|
|
246
288
|
* Returns the fields for a given picked position
|
|
247
289
|
* @param {Cartesian3} pickedPosition The picked position
|
|
@@ -608,6 +650,15 @@ I3SNode.prototype._create3DTileDefinition = function () {
|
|
|
608
650
|
return inPlaceTileDefinition;
|
|
609
651
|
};
|
|
610
652
|
|
|
653
|
+
/**
|
|
654
|
+
* @private
|
|
655
|
+
*/
|
|
656
|
+
I3SNode.prototype._loadSymbology = async function () {
|
|
657
|
+
if (!defined(this._symbologyData) && defined(this._layer._symbology)) {
|
|
658
|
+
this._symbologyData = await this._layer._symbology._getSymbology(this);
|
|
659
|
+
}
|
|
660
|
+
};
|
|
661
|
+
|
|
611
662
|
/**
|
|
612
663
|
* @private
|
|
613
664
|
*/
|
|
@@ -646,6 +697,10 @@ I3SNode.prototype._createContentURL = async function () {
|
|
|
646
697
|
await Promise.all(dataPromises);
|
|
647
698
|
// Binary glTF
|
|
648
699
|
if (defined(this._geometryData) && this._geometryData.length > 0) {
|
|
700
|
+
if (this._dataProvider._applySymbology) {
|
|
701
|
+
await this._loadSymbology();
|
|
702
|
+
}
|
|
703
|
+
|
|
649
704
|
const url = this._geometryData[0].resource.url;
|
|
650
705
|
const geometrySchema = this._layer._data.store.defaultGeometrySchema;
|
|
651
706
|
const geometryData = this._geometryData[0];
|
|
@@ -653,7 +708,8 @@ I3SNode.prototype._createContentURL = async function () {
|
|
|
653
708
|
url,
|
|
654
709
|
geometrySchema,
|
|
655
710
|
geometryData,
|
|
656
|
-
this._featureData[0]
|
|
711
|
+
this._featureData[0],
|
|
712
|
+
this._symbologyData
|
|
657
713
|
);
|
|
658
714
|
if (!defined(result)) {
|
|
659
715
|
// Postponed
|
|
@@ -666,7 +722,9 @@ I3SNode.prototype._createContentURL = async function () {
|
|
|
666
722
|
result.meshData.meshes,
|
|
667
723
|
result.meshData.buffers,
|
|
668
724
|
result.meshData.bufferViews,
|
|
669
|
-
result.meshData.accessors
|
|
725
|
+
result.meshData.accessors,
|
|
726
|
+
result.meshData.rootExtensions,
|
|
727
|
+
result.meshData.extensionsUsed
|
|
670
728
|
);
|
|
671
729
|
|
|
672
730
|
this._geometryData[0]._customAttributes = result.meshData._customAttributes;
|
|
@@ -679,6 +737,91 @@ I3SNode.prototype._createContentURL = async function () {
|
|
|
679
737
|
return URL.createObjectURL(glbDataBlob);
|
|
680
738
|
};
|
|
681
739
|
|
|
740
|
+
async function loadFilters(node) {
|
|
741
|
+
const filters = node._layer._filters;
|
|
742
|
+
const promises = [];
|
|
743
|
+
for (let i = 0; i < filters.length; i++) {
|
|
744
|
+
const promise = node.loadField(filters[i].name);
|
|
745
|
+
promises.push(promise);
|
|
746
|
+
}
|
|
747
|
+
await Promise.all(promises);
|
|
748
|
+
return filters;
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
function checkFeatureValue(featureIndex, field, filter) {
|
|
752
|
+
if (!defined(filter.values) || filter.values.length === 0) {
|
|
753
|
+
return false;
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
const fieldValues = defined(field) ? field.values : [];
|
|
757
|
+
let featureValue;
|
|
758
|
+
if (featureIndex < fieldValues.length) {
|
|
759
|
+
featureValue = fieldValues[featureIndex];
|
|
760
|
+
}
|
|
761
|
+
let matches = false;
|
|
762
|
+
for (let i = 0; i < filter.values.length; i++) {
|
|
763
|
+
if (filter.values[i] === featureValue) {
|
|
764
|
+
matches = true;
|
|
765
|
+
break;
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
return matches;
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
async function filterFeatures(node, contentModel) {
|
|
772
|
+
const batchTable = node._tile.content.batchTable;
|
|
773
|
+
if (defined(batchTable) && batchTable.featuresLength > 0) {
|
|
774
|
+
batchTable.setAllShow(true);
|
|
775
|
+
|
|
776
|
+
const filters = await loadFilters(node);
|
|
777
|
+
if (filters.length > 0) {
|
|
778
|
+
for (
|
|
779
|
+
let featureIndex = 0;
|
|
780
|
+
featureIndex < batchTable.featuresLength;
|
|
781
|
+
featureIndex++
|
|
782
|
+
) {
|
|
783
|
+
for (let filterIndex = 0; filterIndex < filters.length; filterIndex++) {
|
|
784
|
+
const filter = filters[filterIndex];
|
|
785
|
+
if (
|
|
786
|
+
!checkFeatureValue(featureIndex, node._fields[filter.name], filter)
|
|
787
|
+
) {
|
|
788
|
+
batchTable.setShow(featureIndex, false);
|
|
789
|
+
break;
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
contentModel.show = true;
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
/**
|
|
799
|
+
* @private
|
|
800
|
+
*/
|
|
801
|
+
I3SNode.prototype._filterFeatures = function () {
|
|
802
|
+
const promises = [];
|
|
803
|
+
// Forced filtering is required for loaded nodes only
|
|
804
|
+
for (let i = 0; i < this._children.length; i++) {
|
|
805
|
+
const promise = this._children[i]._filterFeatures();
|
|
806
|
+
promises.push(promise);
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
// Filters are applied for nodes with geometry data only
|
|
810
|
+
const contentModel = this._tile?.content?._model;
|
|
811
|
+
if (
|
|
812
|
+
defined(this._geometryData) &&
|
|
813
|
+
this._geometryData.length > 0 &&
|
|
814
|
+
defined(contentModel) &&
|
|
815
|
+
contentModel.ready
|
|
816
|
+
) {
|
|
817
|
+
// The model needs to be hidden till the filters are applied
|
|
818
|
+
contentModel.show = false;
|
|
819
|
+
const promise = filterFeatures(this, contentModel);
|
|
820
|
+
promises.push(promise);
|
|
821
|
+
}
|
|
822
|
+
return Promise.all(promises);
|
|
823
|
+
};
|
|
824
|
+
|
|
682
825
|
// Reimplement Cesium3DTile.prototype.requestContent so that
|
|
683
826
|
// We get a chance to load our own gltf from I3S data
|
|
684
827
|
Cesium3DTile.prototype._hookedRequestContent =
|
|
@@ -700,19 +843,33 @@ Cesium3DTile.prototype.requestContent = function () {
|
|
|
700
843
|
|
|
701
844
|
if (!this._isLoading) {
|
|
702
845
|
this._isLoading = true;
|
|
846
|
+
const that = this;
|
|
703
847
|
return this._i3sNode
|
|
704
848
|
._createContentURL()
|
|
705
849
|
.then((url) => {
|
|
706
850
|
if (!defined(url)) {
|
|
707
|
-
|
|
851
|
+
that._isLoading = false;
|
|
708
852
|
return;
|
|
709
853
|
}
|
|
710
854
|
|
|
711
|
-
|
|
712
|
-
return
|
|
855
|
+
that._contentResource = new Resource({ url: url });
|
|
856
|
+
return that._hookedRequestContent();
|
|
713
857
|
})
|
|
714
858
|
.then((content) => {
|
|
715
|
-
|
|
859
|
+
// Filters are applied for nodes with geometry data only
|
|
860
|
+
const contentModel = content?._model;
|
|
861
|
+
if (
|
|
862
|
+
defined(that._i3sNode._geometryData) &&
|
|
863
|
+
that._i3sNode._geometryData.length > 0 &&
|
|
864
|
+
defined(contentModel)
|
|
865
|
+
) {
|
|
866
|
+
// The model needs to be hidden till the filters are applied
|
|
867
|
+
contentModel.show = false;
|
|
868
|
+
contentModel.readyEvent.addEventListener(() => {
|
|
869
|
+
filterFeatures(that._i3sNode, contentModel);
|
|
870
|
+
});
|
|
871
|
+
}
|
|
872
|
+
that._isLoading = false;
|
|
716
873
|
return content;
|
|
717
874
|
});
|
|
718
875
|
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import defined from "../Core/defined.js";
|
|
2
|
+
import I3SDataProvider from "./I3SDataProvider.js";
|
|
3
|
+
import Resource from "../Core/Resource.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* This class implements an I3S statistics for Building Scene Layer.
|
|
7
|
+
* <p>
|
|
8
|
+
* Do not construct this directly, instead access statistics through {@link I3SDataProvider}.
|
|
9
|
+
* </p>
|
|
10
|
+
* @alias I3SStatistics
|
|
11
|
+
* @internalConstructor
|
|
12
|
+
*/
|
|
13
|
+
function I3SStatistics(dataProvider, uri) {
|
|
14
|
+
this._dataProvider = dataProvider;
|
|
15
|
+
|
|
16
|
+
this._resource = new Resource({ url: uri });
|
|
17
|
+
this._resource.setQueryParameters(dataProvider.resource.queryParameters);
|
|
18
|
+
this._resource.appendForwardSlash();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
Object.defineProperties(I3SStatistics.prototype, {
|
|
22
|
+
/**
|
|
23
|
+
* Gets the resource for the statistics
|
|
24
|
+
* @memberof I3SStatistics.prototype
|
|
25
|
+
* @type {Resource}
|
|
26
|
+
* @readonly
|
|
27
|
+
*/
|
|
28
|
+
resource: {
|
|
29
|
+
get: function () {
|
|
30
|
+
return this._resource;
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Gets the I3S data for this object.
|
|
36
|
+
* @memberof I3SStatistics.prototype
|
|
37
|
+
* @type {object}
|
|
38
|
+
* @readonly
|
|
39
|
+
*/
|
|
40
|
+
data: {
|
|
41
|
+
get: function () {
|
|
42
|
+
return this._data;
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Gets the collection of attribute names.
|
|
48
|
+
* @memberof I3SStatistics.prototype
|
|
49
|
+
* @type {string[]}
|
|
50
|
+
* @readonly
|
|
51
|
+
*/
|
|
52
|
+
names: {
|
|
53
|
+
get: function () {
|
|
54
|
+
const names = [];
|
|
55
|
+
const summary = this._data.summary;
|
|
56
|
+
if (defined(summary)) {
|
|
57
|
+
for (let i = 0; i < summary.length; ++i) {
|
|
58
|
+
names.push(summary[i].fieldName);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return names;
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Loads the content.
|
|
68
|
+
* @returns {Promise<object>} A promise that is resolved when the data of the I3S statistics is loaded
|
|
69
|
+
* @private
|
|
70
|
+
*/
|
|
71
|
+
I3SStatistics.prototype.load = async function () {
|
|
72
|
+
this._data = await I3SDataProvider.loadJson(this._resource);
|
|
73
|
+
return this._data;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* @private
|
|
78
|
+
*/
|
|
79
|
+
I3SStatistics.prototype._getValues = function (attributeName) {
|
|
80
|
+
const summary = this._data.summary;
|
|
81
|
+
if (defined(summary)) {
|
|
82
|
+
for (let i = 0; i < summary.length; ++i) {
|
|
83
|
+
const attribute = summary[i];
|
|
84
|
+
if (attribute.fieldName === attributeName) {
|
|
85
|
+
if (defined(attribute.mostFrequentValues)) {
|
|
86
|
+
return [...attribute.mostFrequentValues];
|
|
87
|
+
}
|
|
88
|
+
return [];
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export default I3SStatistics;
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import Check from "../Core/Check.js";
|
|
2
|
+
import defaultValue from "../Core/defaultValue.js";
|
|
3
|
+
import defined from "../Core/defined.js";
|
|
4
|
+
import I3SDataProvider from "./I3SDataProvider.js";
|
|
5
|
+
import I3SLayer from "./I3SLayer.js";
|
|
6
|
+
import Resource from "../Core/Resource.js";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* This class implements an I3S sublayer for Building Scene Layer.
|
|
10
|
+
* <p>
|
|
11
|
+
* This object is normally not instantiated directly, use {@link I3SSublayer.fromData}.
|
|
12
|
+
* </p>
|
|
13
|
+
* @alias I3SSublayer
|
|
14
|
+
* @internalConstructor
|
|
15
|
+
*/
|
|
16
|
+
function I3SSublayer(dataProvider, parent, sublayerData) {
|
|
17
|
+
this._dataProvider = dataProvider;
|
|
18
|
+
this._parent = parent;
|
|
19
|
+
this._data = sublayerData;
|
|
20
|
+
this._name = sublayerData.name;
|
|
21
|
+
this._modelName = sublayerData.modelName;
|
|
22
|
+
this._visibility = defaultValue(sublayerData.visibility, true);
|
|
23
|
+
this._resource = undefined;
|
|
24
|
+
this._sublayers = [];
|
|
25
|
+
this._i3sLayers = [];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
Object.defineProperties(I3SSublayer.prototype, {
|
|
29
|
+
/**
|
|
30
|
+
* Gets the resource for the sublayer
|
|
31
|
+
* @memberof I3SSublayer.prototype
|
|
32
|
+
* @type {Resource}
|
|
33
|
+
* @readonly
|
|
34
|
+
*/
|
|
35
|
+
resource: {
|
|
36
|
+
get: function () {
|
|
37
|
+
return this._resource;
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Gets the I3S data for this object.
|
|
43
|
+
* @memberof I3SSublayer.prototype
|
|
44
|
+
* @type {object}
|
|
45
|
+
* @readonly
|
|
46
|
+
*/
|
|
47
|
+
data: {
|
|
48
|
+
get: function () {
|
|
49
|
+
return this._data;
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Gets the name for the sublayer.
|
|
55
|
+
* @memberof I3SSublayer.prototype
|
|
56
|
+
* @type {string}
|
|
57
|
+
* @readonly
|
|
58
|
+
*/
|
|
59
|
+
name: {
|
|
60
|
+
get: function () {
|
|
61
|
+
return this._name;
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Gets the model name for the sublayer.
|
|
67
|
+
* @memberof I3SSublayer.prototype
|
|
68
|
+
* @type {string}
|
|
69
|
+
* @readonly
|
|
70
|
+
*/
|
|
71
|
+
modelName: {
|
|
72
|
+
get: function () {
|
|
73
|
+
return this._modelName;
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Gets the collection of child sublayers.
|
|
79
|
+
* @memberof I3SSublayer.prototype
|
|
80
|
+
* @type {I3SSublayer[]}
|
|
81
|
+
* @readonly
|
|
82
|
+
*/
|
|
83
|
+
sublayers: {
|
|
84
|
+
get: function () {
|
|
85
|
+
return this._sublayers;
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Gets or sets the sublayer visibility.
|
|
91
|
+
* @memberof I3SSublayer.prototype
|
|
92
|
+
* @type {boolean}
|
|
93
|
+
*/
|
|
94
|
+
visibility: {
|
|
95
|
+
get: function () {
|
|
96
|
+
return this._visibility;
|
|
97
|
+
},
|
|
98
|
+
set: function (value) {
|
|
99
|
+
//>>includeStart('debug', pragmas.debug);
|
|
100
|
+
Check.defined("value", value);
|
|
101
|
+
//>>includeEnd('debug');
|
|
102
|
+
|
|
103
|
+
if (this._visibility !== value) {
|
|
104
|
+
this._visibility = value;
|
|
105
|
+
for (let i = 0; i < this._i3sLayers.length; i++) {
|
|
106
|
+
this._i3sLayers[i]._updateVisibility();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Determines if the sublayer will be shown.
|
|
114
|
+
* @memberof I3SSublayer.prototype
|
|
115
|
+
* @type {boolean}
|
|
116
|
+
* @readonly
|
|
117
|
+
*/
|
|
118
|
+
show: {
|
|
119
|
+
get: function () {
|
|
120
|
+
return this._visibility && this._parent.show;
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* @private
|
|
127
|
+
*/
|
|
128
|
+
I3SSublayer._fromData = async function (
|
|
129
|
+
dataProvider,
|
|
130
|
+
buildingLayerUrl,
|
|
131
|
+
sublayerData,
|
|
132
|
+
parent
|
|
133
|
+
) {
|
|
134
|
+
const sublayer = new I3SSublayer(dataProvider, parent, sublayerData);
|
|
135
|
+
if (sublayer._data.layerType === "group") {
|
|
136
|
+
const sublayers = sublayer._data.sublayers;
|
|
137
|
+
if (defined(sublayers)) {
|
|
138
|
+
const promises = [];
|
|
139
|
+
for (let i = 0; i < sublayers.length; i++) {
|
|
140
|
+
const promise = I3SSublayer._fromData(
|
|
141
|
+
dataProvider,
|
|
142
|
+
buildingLayerUrl,
|
|
143
|
+
sublayers[i],
|
|
144
|
+
sublayer
|
|
145
|
+
);
|
|
146
|
+
promises.push(promise);
|
|
147
|
+
}
|
|
148
|
+
const childSublayers = await Promise.all(promises);
|
|
149
|
+
for (let i = 0; i < childSublayers.length; i++) {
|
|
150
|
+
const childSublayer = childSublayers[i];
|
|
151
|
+
sublayer._sublayers.push(childSublayer);
|
|
152
|
+
sublayer._i3sLayers.push(...childSublayer._i3sLayers);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
} else if (sublayer._data.layerType === "3DObject") {
|
|
156
|
+
const sublayerUrl = buildingLayerUrl.concat(
|
|
157
|
+
`/sublayers/${sublayer._data.id}`
|
|
158
|
+
);
|
|
159
|
+
const resource = new Resource({ url: sublayerUrl });
|
|
160
|
+
resource.setQueryParameters(dataProvider.resource.queryParameters);
|
|
161
|
+
resource.appendForwardSlash();
|
|
162
|
+
sublayer._resource = resource;
|
|
163
|
+
|
|
164
|
+
const layerData = await I3SDataProvider.loadJson(sublayer._resource);
|
|
165
|
+
const layer = new I3SLayer(dataProvider, layerData, sublayer);
|
|
166
|
+
sublayer._i3sLayers.push(layer);
|
|
167
|
+
} else {
|
|
168
|
+
// Filter other scene layer types out
|
|
169
|
+
console.log(
|
|
170
|
+
`${sublayer._data.layerType} layer ${sublayer._data.name} is skipped as not supported.`
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
return sublayer;
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
export default I3SSublayer;
|