@loaders.gl/i3s 4.2.0-alpha.4 → 4.2.0-alpha.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/arcgis-webscene-loader.d.ts +1 -1
- package/dist/arcgis-webscene-loader.d.ts.map +1 -1
- package/dist/arcgis-webscene-loader.js +20 -11
- package/dist/dist.dev.js +1244 -722
- package/dist/dist.min.js +9 -0
- package/dist/i3s-attribute-loader.d.ts +2 -2
- package/dist/i3s-attribute-loader.d.ts.map +1 -1
- package/dist/i3s-attribute-loader.js +146 -95
- package/dist/i3s-building-scene-layer-loader.d.ts +2 -2
- package/dist/i3s-building-scene-layer-loader.d.ts.map +1 -1
- package/dist/i3s-building-scene-layer-loader.js +18 -14
- package/dist/i3s-content-loader.d.ts +2 -2
- package/dist/i3s-content-loader.d.ts.map +1 -1
- package/dist/i3s-content-loader.js +24 -25
- package/dist/i3s-content-worker-node.js +46 -46
- package/dist/i3s-content-worker-node.js.map +4 -4
- package/dist/i3s-content-worker.js +15 -27
- package/dist/i3s-loader.d.ts +2 -2
- package/dist/i3s-loader.d.ts.map +1 -1
- package/dist/i3s-loader.js +78 -66
- package/dist/i3s-node-page-loader.d.ts +2 -2
- package/dist/i3s-node-page-loader.d.ts.map +1 -1
- package/dist/i3s-node-page-loader.js +17 -13
- package/dist/i3s-slpk-loader.js +19 -15
- package/dist/index.cjs +92 -163
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +14 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/lib/helpers/i3s-nodepages-tiles.d.ts +1 -1
- package/dist/lib/helpers/i3s-nodepages-tiles.d.ts.map +1 -1
- package/dist/lib/helpers/i3s-nodepages-tiles.js +230 -184
- package/dist/lib/parsers/constants.js +72 -45
- package/dist/lib/parsers/parse-arcgis-webscene.d.ts +1 -1
- package/dist/lib/parsers/parse-arcgis-webscene.d.ts.map +1 -1
- package/dist/lib/parsers/parse-arcgis-webscene.js +80 -59
- package/dist/lib/parsers/parse-i3s-attribute.js +83 -46
- package/dist/lib/parsers/parse-i3s-building-scene-layer.d.ts +1 -1
- package/dist/lib/parsers/parse-i3s-building-scene-layer.d.ts.map +1 -1
- package/dist/lib/parsers/parse-i3s-building-scene-layer.js +36 -33
- package/dist/lib/parsers/parse-i3s-tile-content.d.ts +1 -1
- package/dist/lib/parsers/parse-i3s-tile-content.d.ts.map +1 -1
- package/dist/lib/parsers/parse-i3s-tile-content.js +433 -388
- package/dist/lib/parsers/parse-i3s.d.ts +1 -1
- package/dist/lib/parsers/parse-i3s.d.ts.map +1 -1
- package/dist/lib/parsers/parse-i3s.js +84 -81
- package/dist/lib/parsers/parse-slpk/parse-slpk.d.ts +1 -1
- package/dist/lib/parsers/parse-slpk/parse-slpk.d.ts.map +1 -1
- package/dist/lib/parsers/parse-slpk/parse-slpk.js +23 -16
- package/dist/lib/parsers/parse-slpk/slpk-archieve.js +134 -97
- package/dist/lib/utils/convert-i3s-obb-to-mbs.js +12 -5
- package/dist/lib/utils/customize-colors.d.ts +1 -1
- package/dist/lib/utils/customize-colors.d.ts.map +1 -1
- package/dist/lib/utils/customize-colors.js +95 -81
- package/dist/lib/utils/url-utils.d.ts +1 -1
- package/dist/lib/utils/url-utils.d.ts.map +1 -1
- package/dist/lib/utils/url-utils.js +48 -28
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +5 -6
- package/dist/workers/i3s-content-worker-node.js +1 -1
- package/dist/workers/i3s-content-worker.js +0 -1
- package/package.json +15 -12
- package/src/i3s-loader.ts +2 -1
- package/src/lib/helpers/i3s-nodepages-tiles.ts +1 -3
- package/src/lib/parsers/parse-i3s-tile-content.ts +4 -26
- package/dist/arcgis-webscene-loader.js.map +0 -1
- package/dist/i3s-attribute-loader.js.map +0 -1
- package/dist/i3s-building-scene-layer-loader.js.map +0 -1
- package/dist/i3s-content-loader.js.map +0 -1
- package/dist/i3s-loader.js.map +0 -1
- package/dist/i3s-node-page-loader.js.map +0 -1
- package/dist/i3s-slpk-loader.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/helpers/i3s-nodepages-tiles.js.map +0 -1
- package/dist/lib/parsers/constants.js.map +0 -1
- package/dist/lib/parsers/parse-arcgis-webscene.js.map +0 -1
- package/dist/lib/parsers/parse-i3s-attribute.js.map +0 -1
- package/dist/lib/parsers/parse-i3s-building-scene-layer.js.map +0 -1
- package/dist/lib/parsers/parse-i3s-tile-content.js.map +0 -1
- package/dist/lib/parsers/parse-i3s.js.map +0 -1
- package/dist/lib/parsers/parse-slpk/parse-slpk.js.map +0 -1
- package/dist/lib/parsers/parse-slpk/slpk-archieve.js.map +0 -1
- package/dist/lib/utils/convert-i3s-obb-to-mbs.js.map +0 -1
- package/dist/lib/utils/customize-colors.js.map +0 -1
- package/dist/lib/utils/url-utils.js.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/workers/i3s-content-worker-node.js.map +0 -1
- package/dist/workers/i3s-content-worker.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -17,9 +17,9 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
|
-
//
|
|
21
|
-
var
|
|
22
|
-
__export(
|
|
20
|
+
// dist/index.js
|
|
21
|
+
var dist_exports = {};
|
|
22
|
+
__export(dist_exports, {
|
|
23
23
|
ArcGISWebSceneLoader: () => ArcGISWebSceneLoader,
|
|
24
24
|
COORDINATE_SYSTEM: () => COORDINATE_SYSTEM,
|
|
25
25
|
I3SAttributeLoader: () => I3SAttributeLoader,
|
|
@@ -34,9 +34,9 @@ __export(src_exports, {
|
|
|
34
34
|
loadFeatureAttributes: () => loadFeatureAttributes,
|
|
35
35
|
parseSLPKArchive: () => parseSLPKArchive
|
|
36
36
|
});
|
|
37
|
-
module.exports = __toCommonJS(
|
|
37
|
+
module.exports = __toCommonJS(dist_exports);
|
|
38
38
|
|
|
39
|
-
//
|
|
39
|
+
// dist/lib/parsers/constants.js
|
|
40
40
|
var import_math = require("@loaders.gl/math");
|
|
41
41
|
function getConstructorForDataFormat(dataType) {
|
|
42
42
|
switch (dataType) {
|
|
@@ -84,19 +84,19 @@ var STRING_ATTRIBUTE_TYPE = "String";
|
|
|
84
84
|
var OBJECT_ID_ATTRIBUTE_TYPE = "Oid32";
|
|
85
85
|
var FLOAT_64_TYPE = "Float64";
|
|
86
86
|
var INT_16_ATTRIBUTE_TYPE = "Int16";
|
|
87
|
-
var COORDINATE_SYSTEM
|
|
87
|
+
var COORDINATE_SYSTEM;
|
|
88
|
+
(function(COORDINATE_SYSTEM2) {
|
|
88
89
|
COORDINATE_SYSTEM2[COORDINATE_SYSTEM2["DEFAULT"] = -1] = "DEFAULT";
|
|
89
90
|
COORDINATE_SYSTEM2[COORDINATE_SYSTEM2["LNGLAT"] = 1] = "LNGLAT";
|
|
90
91
|
COORDINATE_SYSTEM2[COORDINATE_SYSTEM2["METER_OFFSETS"] = 2] = "METER_OFFSETS";
|
|
91
92
|
COORDINATE_SYSTEM2[COORDINATE_SYSTEM2["LNGLAT_OFFSETS"] = 3] = "LNGLAT_OFFSETS";
|
|
92
93
|
COORDINATE_SYSTEM2[COORDINATE_SYSTEM2["CARTESIAN"] = 0] = "CARTESIAN";
|
|
93
|
-
|
|
94
|
-
})(COORDINATE_SYSTEM || {});
|
|
94
|
+
})(COORDINATE_SYSTEM || (COORDINATE_SYSTEM = {}));
|
|
95
95
|
|
|
96
|
-
//
|
|
96
|
+
// dist/i3s-loader.js
|
|
97
97
|
var import_core5 = require("@loaders.gl/core");
|
|
98
98
|
|
|
99
|
-
//
|
|
99
|
+
// dist/lib/parsers/parse-i3s-tile-content.js
|
|
100
100
|
var import_core = require("@loaders.gl/core");
|
|
101
101
|
var import_core2 = require("@math.gl/core");
|
|
102
102
|
var import_geospatial = require("@math.gl/geospatial");
|
|
@@ -105,7 +105,14 @@ var import_images = require("@loaders.gl/images");
|
|
|
105
105
|
var import_draco = require("@loaders.gl/draco");
|
|
106
106
|
var import_textures = require("@loaders.gl/textures");
|
|
107
107
|
|
|
108
|
-
//
|
|
108
|
+
// dist/types.js
|
|
109
|
+
var HeaderAttributeProperty;
|
|
110
|
+
(function(HeaderAttributeProperty2) {
|
|
111
|
+
HeaderAttributeProperty2["vertexCount"] = "vertexCount";
|
|
112
|
+
HeaderAttributeProperty2["featureCount"] = "featureCount";
|
|
113
|
+
})(HeaderAttributeProperty || (HeaderAttributeProperty = {}));
|
|
114
|
+
|
|
115
|
+
// dist/lib/utils/url-utils.js
|
|
109
116
|
function getUrlWithoutParams(url) {
|
|
110
117
|
let urlWithoutParams;
|
|
111
118
|
try {
|
|
@@ -137,7 +144,7 @@ function generateTilesetAttributeUrls(tileset, url, resource) {
|
|
|
137
144
|
return attributeUrls;
|
|
138
145
|
}
|
|
139
146
|
|
|
140
|
-
//
|
|
147
|
+
// dist/lib/parsers/parse-i3s-tile-content.js
|
|
141
148
|
var scratchVector = new import_core2.Vector3([0, 0, 0]);
|
|
142
149
|
function getLoaderForTextureFormat(textureFormat) {
|
|
143
150
|
switch (textureFormat) {
|
|
@@ -166,11 +173,7 @@ async function parseI3STileContent(arrayBuffer, tileOptions, tilesetOptions, opt
|
|
|
166
173
|
texture: null
|
|
167
174
|
};
|
|
168
175
|
if (tileOptions.textureUrl) {
|
|
169
|
-
const url = getUrlWithToken(
|
|
170
|
-
getInternalPathFromUrl(tileOptions.textureUrl),
|
|
171
|
-
// @ts-expect-error options is not properly typed
|
|
172
|
-
(_a = options == null ? void 0 : options.i3s) == null ? void 0 : _a.token
|
|
173
|
-
);
|
|
176
|
+
const url = getUrlWithToken(tileOptions.textureUrl, (_a = options == null ? void 0 : options.i3s) == null ? void 0 : _a.token);
|
|
174
177
|
const loader = getLoaderForTextureFormat(tileOptions.textureFormat);
|
|
175
178
|
const fetchFunc = (context == null ? void 0 : context.fetch) || fetch;
|
|
176
179
|
const response = await fetchFunc(url);
|
|
@@ -208,18 +211,6 @@ async function parseI3STileContent(arrayBuffer, tileOptions, tilesetOptions, opt
|
|
|
208
211
|
}
|
|
209
212
|
return await parseI3SNodeGeometry(arrayBuffer, content, tileOptions, tilesetOptions, options);
|
|
210
213
|
}
|
|
211
|
-
function getInternalPathFromUrl(url) {
|
|
212
|
-
const slpkUrlParts = url.split(".slpk");
|
|
213
|
-
let filename;
|
|
214
|
-
if (slpkUrlParts.length === 1) {
|
|
215
|
-
filename = url;
|
|
216
|
-
} else if (slpkUrlParts.length === 2) {
|
|
217
|
-
filename = slpkUrlParts[1].slice(1);
|
|
218
|
-
} else {
|
|
219
|
-
filename = url;
|
|
220
|
-
}
|
|
221
|
-
return filename;
|
|
222
|
-
}
|
|
223
214
|
async function parseI3SNodeGeometry(arrayBuffer, content, tileOptions, tilesetOptions, options) {
|
|
224
215
|
var _a, _b;
|
|
225
216
|
const contentByteLength = arrayBuffer.byteLength;
|
|
@@ -236,14 +227,7 @@ async function parseI3SNodeGeometry(arrayBuffer, content, tileOptions, tilesetOp
|
|
|
236
227
|
});
|
|
237
228
|
vertexCount = decompressedGeometry.header.vertexCount;
|
|
238
229
|
indices = (_a = decompressedGeometry.indices) == null ? void 0 : _a.value;
|
|
239
|
-
const {
|
|
240
|
-
POSITION,
|
|
241
|
-
NORMAL,
|
|
242
|
-
COLOR_0,
|
|
243
|
-
TEXCOORD_0,
|
|
244
|
-
["feature-index"]: featureIndex,
|
|
245
|
-
["uv-region"]: uvRegion
|
|
246
|
-
} = decompressedGeometry.attributes;
|
|
230
|
+
const { POSITION, NORMAL, COLOR_0, TEXCOORD_0, ["feature-index"]: featureIndex, ["uv-region"]: uvRegion } = decompressedGeometry.attributes;
|
|
247
231
|
attributes = {
|
|
248
232
|
position: POSITION,
|
|
249
233
|
normal: NORMAL,
|
|
@@ -258,41 +242,24 @@ async function parseI3SNodeGeometry(arrayBuffer, content, tileOptions, tilesetOp
|
|
|
258
242
|
flattenFeatureIdsByFeatureIndices(attributes, featureIds);
|
|
259
243
|
}
|
|
260
244
|
} else {
|
|
261
|
-
const {
|
|
262
|
-
vertexAttributes,
|
|
263
|
-
ordering: attributesOrder,
|
|
264
|
-
featureAttributes,
|
|
265
|
-
featureAttributeOrder
|
|
266
|
-
} = tilesetOptions.store.defaultGeometrySchema;
|
|
245
|
+
const { vertexAttributes, ordering: attributesOrder, featureAttributes, featureAttributeOrder } = tilesetOptions.store.defaultGeometrySchema;
|
|
267
246
|
const headers = parseHeaders(arrayBuffer, tilesetOptions);
|
|
268
247
|
byteOffset = headers.byteOffset;
|
|
269
248
|
vertexCount = headers.vertexCount;
|
|
270
249
|
featureCount = headers.featureCount;
|
|
271
|
-
const { attributes: normalizedVertexAttributes, byteOffset: offset } = normalizeAttributes(
|
|
272
|
-
|
|
273
|
-
byteOffset,
|
|
274
|
-
vertexAttributes,
|
|
275
|
-
vertexCount,
|
|
276
|
-
attributesOrder
|
|
277
|
-
);
|
|
278
|
-
const { attributes: normalizedFeatureAttributes } = normalizeAttributes(
|
|
279
|
-
arrayBuffer,
|
|
280
|
-
offset,
|
|
281
|
-
featureAttributes,
|
|
282
|
-
featureCount,
|
|
283
|
-
featureAttributeOrder
|
|
284
|
-
);
|
|
250
|
+
const { attributes: normalizedVertexAttributes, byteOffset: offset } = normalizeAttributes(arrayBuffer, byteOffset, vertexAttributes, vertexCount, attributesOrder);
|
|
251
|
+
const { attributes: normalizedFeatureAttributes } = normalizeAttributes(arrayBuffer, offset, featureAttributes, featureCount, featureAttributeOrder);
|
|
285
252
|
flattenFeatureIdsByFaceRanges(normalizedFeatureAttributes);
|
|
286
253
|
attributes = concatAttributes(normalizedVertexAttributes, normalizedFeatureAttributes);
|
|
287
254
|
}
|
|
288
255
|
if (!((_b = options == null ? void 0 : options.i3s) == null ? void 0 : _b.coordinateSystem) || // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison
|
|
289
|
-
options.i3s.coordinateSystem ===
|
|
256
|
+
options.i3s.coordinateSystem === COORDINATE_SYSTEM.METER_OFFSETS) {
|
|
290
257
|
const enuMatrix = parsePositions(attributes.position, tileOptions);
|
|
291
258
|
content.modelMatrix = enuMatrix.invert();
|
|
292
|
-
content.coordinateSystem =
|
|
259
|
+
content.coordinateSystem = COORDINATE_SYSTEM.METER_OFFSETS;
|
|
293
260
|
} else {
|
|
294
261
|
content.modelMatrix = getModelMatrix(attributes.position);
|
|
295
|
-
content.coordinateSystem =
|
|
262
|
+
content.coordinateSystem = COORDINATE_SYSTEM.LNGLAT_OFFSETS;
|
|
296
263
|
}
|
|
297
264
|
content.attributes = {
|
|
298
265
|
positions: attributes.position,
|
|
@@ -348,11 +315,11 @@ function parseHeaders(arrayBuffer, options) {
|
|
|
348
315
|
for (const { property, type } of options.store.defaultGeometrySchema.header) {
|
|
349
316
|
const TypedArrayTypeHeader = getConstructorForDataFormat(type);
|
|
350
317
|
switch (property) {
|
|
351
|
-
case
|
|
318
|
+
case HeaderAttributeProperty.vertexCount.toString():
|
|
352
319
|
vertexCount = new TypedArrayTypeHeader(arrayBuffer, 0, 4)[0];
|
|
353
320
|
byteOffset += sizeOf(type);
|
|
354
321
|
break;
|
|
355
|
-
case
|
|
322
|
+
case HeaderAttributeProperty.featureCount.toString():
|
|
356
323
|
featureCount = new TypedArrayTypeHeader(arrayBuffer, 4, 4)[0];
|
|
357
324
|
byteOffset += sizeOf(type);
|
|
358
325
|
break;
|
|
@@ -479,9 +446,7 @@ function makePbrMaterial(materialDefinition, texture) {
|
|
|
479
446
|
pbrMaterial.emissiveFactor = convertColorFormat(pbrMaterial.emissiveFactor);
|
|
480
447
|
}
|
|
481
448
|
if (pbrMaterial.pbrMetallicRoughness && pbrMaterial.pbrMetallicRoughness.baseColorFactor) {
|
|
482
|
-
pbrMaterial.pbrMetallicRoughness.baseColorFactor = convertColorFormat(
|
|
483
|
-
pbrMaterial.pbrMetallicRoughness.baseColorFactor
|
|
484
|
-
);
|
|
449
|
+
pbrMaterial.pbrMetallicRoughness.baseColorFactor = convertColorFormat(pbrMaterial.pbrMetallicRoughness.baseColorFactor);
|
|
485
450
|
}
|
|
486
451
|
if (texture) {
|
|
487
452
|
setMaterialTexture(pbrMaterial, texture);
|
|
@@ -551,8 +516,8 @@ function getFeatureIdsFromFeatureIndexMetadata(featureIndex) {
|
|
|
551
516
|
return (_b = (_a = featureIndex == null ? void 0 : featureIndex.metadata) == null ? void 0 : _a["i3s-feature-ids"]) == null ? void 0 : _b.intArray;
|
|
552
517
|
}
|
|
553
518
|
|
|
554
|
-
//
|
|
555
|
-
var VERSION =
|
|
519
|
+
// dist/i3s-content-loader.js
|
|
520
|
+
var VERSION = true ? "4.2.0-alpha.5" : "latest";
|
|
556
521
|
var I3SContentLoader = {
|
|
557
522
|
name: "I3S Content (Indexed Scene Layers)",
|
|
558
523
|
id: "i3s-content",
|
|
@@ -573,27 +538,21 @@ async function parse2(data, options, context) {
|
|
|
573
538
|
if (!tileOptions || !tilesetOptions) {
|
|
574
539
|
return null;
|
|
575
540
|
}
|
|
576
|
-
return await parseI3STileContent(
|
|
577
|
-
data,
|
|
578
|
-
tileOptions,
|
|
579
|
-
tilesetOptions,
|
|
580
|
-
options,
|
|
581
|
-
context
|
|
582
|
-
);
|
|
541
|
+
return await parseI3STileContent(data, tileOptions, tilesetOptions, options, context);
|
|
583
542
|
}
|
|
584
543
|
|
|
585
|
-
//
|
|
544
|
+
// dist/lib/parsers/parse-i3s.js
|
|
586
545
|
var import_culling = require("@math.gl/culling");
|
|
587
546
|
var import_geospatial2 = require("@math.gl/geospatial");
|
|
588
547
|
var import_core4 = require("@loaders.gl/core");
|
|
589
548
|
var import_tiles = require("@loaders.gl/tiles");
|
|
590
549
|
|
|
591
|
-
//
|
|
550
|
+
// dist/lib/helpers/i3s-nodepages-tiles.js
|
|
592
551
|
var import_core3 = require("@loaders.gl/core");
|
|
593
552
|
var import_textures2 = require("@loaders.gl/textures");
|
|
594
553
|
|
|
595
|
-
//
|
|
596
|
-
var VERSION2 =
|
|
554
|
+
// dist/i3s-node-page-loader.js
|
|
555
|
+
var VERSION2 = true ? "4.2.0-alpha.5" : "latest";
|
|
597
556
|
var I3SNodePageLoader = {
|
|
598
557
|
name: "I3S Node Page",
|
|
599
558
|
id: "i3s-node-page",
|
|
@@ -610,8 +569,18 @@ async function parseNodePage(data, options) {
|
|
|
610
569
|
return JSON.parse(new TextDecoder().decode(data));
|
|
611
570
|
}
|
|
612
571
|
|
|
613
|
-
//
|
|
572
|
+
// dist/lib/helpers/i3s-nodepages-tiles.js
|
|
614
573
|
var I3SNodePagesTiles = class {
|
|
574
|
+
tileset;
|
|
575
|
+
nodePages = [];
|
|
576
|
+
pendingNodePages = [];
|
|
577
|
+
nodesPerPage;
|
|
578
|
+
options;
|
|
579
|
+
lodSelectionMetricType;
|
|
580
|
+
textureDefinitionsSelectedFormats = [];
|
|
581
|
+
nodesInNodePages;
|
|
582
|
+
url;
|
|
583
|
+
textureLoaderOptions = {};
|
|
615
584
|
/**
|
|
616
585
|
* @constructs
|
|
617
586
|
* Create a I3SNodePagesTiles instance.
|
|
@@ -620,10 +589,6 @@ var I3SNodePagesTiles = class {
|
|
|
620
589
|
* @param options - i3s loader options
|
|
621
590
|
*/
|
|
622
591
|
constructor(tileset, url = "", options) {
|
|
623
|
-
this.nodePages = [];
|
|
624
|
-
this.pendingNodePages = [];
|
|
625
|
-
this.textureDefinitionsSelectedFormats = [];
|
|
626
|
-
this.textureLoaderOptions = {};
|
|
627
592
|
var _a, _b;
|
|
628
593
|
this.tileset = { ...tileset };
|
|
629
594
|
this.url = url;
|
|
@@ -642,7 +607,7 @@ var I3SNodePagesTiles = class {
|
|
|
642
607
|
const pageIndex = Math.floor(id / this.nodesPerPage);
|
|
643
608
|
if (!this.nodePages[pageIndex] && !this.pendingNodePages[pageIndex]) {
|
|
644
609
|
const nodePageUrl = getUrlWithToken(
|
|
645
|
-
|
|
610
|
+
`${this.url}/nodepages/${pageIndex}`,
|
|
646
611
|
// @ts-expect-error this.options is not properly typed
|
|
647
612
|
(_a = this.options.i3s) == null ? void 0 : _a.token
|
|
648
613
|
);
|
|
@@ -696,11 +661,7 @@ var I3SNodePagesTiles = class {
|
|
|
696
661
|
textureUrl = `${this.url}/nodes/${node.mesh.material.resource}/textures/${textureData.name}`;
|
|
697
662
|
}
|
|
698
663
|
if (this.tileset.attributeStorageInfo) {
|
|
699
|
-
attributeUrls = generateTilesetAttributeUrls(
|
|
700
|
-
this.tileset,
|
|
701
|
-
this.url,
|
|
702
|
-
node.mesh.attribute.resource
|
|
703
|
-
);
|
|
664
|
+
attributeUrls = generateTilesetAttributeUrls(this.tileset, this.url, node.mesh.attribute.resource);
|
|
704
665
|
}
|
|
705
666
|
}
|
|
706
667
|
const lodSelection = this.getLodSelection(node);
|
|
@@ -730,19 +691,13 @@ var I3SNodePagesTiles = class {
|
|
|
730
691
|
const geometryDefinition = this.tileset.geometryDefinitions[meshGeometryData.definition];
|
|
731
692
|
let geometryIndex = -1;
|
|
732
693
|
if (this.options.i3s && this.options.i3s.useDracoGeometry) {
|
|
733
|
-
geometryIndex = geometryDefinition.geometryBuffers.findIndex(
|
|
734
|
-
(buffer) => buffer.compressedAttributes && buffer.compressedAttributes.encoding === "draco"
|
|
735
|
-
);
|
|
694
|
+
geometryIndex = geometryDefinition.geometryBuffers.findIndex((buffer) => buffer.compressedAttributes && buffer.compressedAttributes.encoding === "draco");
|
|
736
695
|
}
|
|
737
696
|
if (geometryIndex === -1) {
|
|
738
|
-
geometryIndex = geometryDefinition.geometryBuffers.findIndex(
|
|
739
|
-
(buffer) => !buffer.compressedAttributes
|
|
740
|
-
);
|
|
697
|
+
geometryIndex = geometryDefinition.geometryBuffers.findIndex((buffer) => !buffer.compressedAttributes);
|
|
741
698
|
}
|
|
742
699
|
if (geometryIndex !== -1) {
|
|
743
|
-
const isDracoGeometry = Boolean(
|
|
744
|
-
geometryDefinition.geometryBuffers[geometryIndex].compressedAttributes
|
|
745
|
-
);
|
|
700
|
+
const isDracoGeometry = Boolean(geometryDefinition.geometryBuffers[geometryIndex].compressedAttributes);
|
|
746
701
|
result = {
|
|
747
702
|
url: `${this.url}/nodes/${meshGeometryData.resource}/geometries/${geometryIndex}`,
|
|
748
703
|
isDracoGeometry
|
|
@@ -845,7 +800,7 @@ var I3SNodePagesTiles = class {
|
|
|
845
800
|
}
|
|
846
801
|
};
|
|
847
802
|
|
|
848
|
-
//
|
|
803
|
+
// dist/lib/parsers/parse-i3s.js
|
|
849
804
|
function normalizeTileData(tile, context) {
|
|
850
805
|
const url = context.url || "";
|
|
851
806
|
let contentUrl;
|
|
@@ -894,11 +849,7 @@ function normalizeTileNonUrlData(tile) {
|
|
|
894
849
|
...tile.obb.quaternion
|
|
895
850
|
// quaternion
|
|
896
851
|
];
|
|
897
|
-
const obb = new import_culling.OrientedBoundingBox().fromCenterHalfSizeQuaternion(
|
|
898
|
-
boundingVolume.box.slice(0, 3),
|
|
899
|
-
tile.obb.halfSize,
|
|
900
|
-
tile.obb.quaternion
|
|
901
|
-
);
|
|
852
|
+
const obb = new import_culling.OrientedBoundingBox().fromCenterHalfSizeQuaternion(boundingVolume.box.slice(0, 3), tile.obb.halfSize, tile.obb.quaternion);
|
|
902
853
|
const boundingSphere = obb.getBoundingSphere();
|
|
903
854
|
boundingVolume.sphere = [...boundingSphere.center, boundingSphere.radius];
|
|
904
855
|
mbs = [...tile.obb.center, boundingSphere.radius];
|
|
@@ -944,9 +895,10 @@ async function normalizeTilesetData(tileset, options, context) {
|
|
|
944
895
|
};
|
|
945
896
|
}
|
|
946
897
|
|
|
947
|
-
//
|
|
948
|
-
var VERSION3 =
|
|
898
|
+
// dist/i3s-loader.js
|
|
899
|
+
var VERSION3 = true ? "4.2.0-alpha.5" : "latest";
|
|
949
900
|
var TILESET_REGEX = /layers\/[0-9]+$/;
|
|
901
|
+
var LOCAL_SLPK_REGEX = /\.slpk$/;
|
|
950
902
|
var TILE_HEADER_REGEX = /nodes\/([0-9-]+|root)$/;
|
|
951
903
|
var SLPK_HEX = "504b0304";
|
|
952
904
|
var POINT_CLOUD = "PointCloud";
|
|
@@ -970,7 +922,7 @@ var I3SLoader = {
|
|
|
970
922
|
useDracoGeometry: true,
|
|
971
923
|
useCompressedTextures: true,
|
|
972
924
|
decodeTextures: true,
|
|
973
|
-
coordinateSystem:
|
|
925
|
+
coordinateSystem: COORDINATE_SYSTEM.METER_OFFSETS
|
|
974
926
|
}
|
|
975
927
|
}
|
|
976
928
|
};
|
|
@@ -984,7 +936,7 @@ async function parseI3S(data, options = {}, context) {
|
|
|
984
936
|
const urlWithoutParams = getUrlWithoutParams(url);
|
|
985
937
|
let isTileset;
|
|
986
938
|
if (options.i3s.isTileset === "auto") {
|
|
987
|
-
isTileset = TILESET_REGEX.test(urlWithoutParams);
|
|
939
|
+
isTileset = TILESET_REGEX.test(urlWithoutParams) || LOCAL_SLPK_REGEX.test(urlWithoutParams);
|
|
988
940
|
} else {
|
|
989
941
|
isTileset = options.i3s.isTileset;
|
|
990
942
|
}
|
|
@@ -1025,13 +977,13 @@ function getMagicNumber(data) {
|
|
|
1025
977
|
return null;
|
|
1026
978
|
}
|
|
1027
979
|
|
|
1028
|
-
//
|
|
980
|
+
// dist/i3s-slpk-loader.js
|
|
1029
981
|
var import_loader_utils2 = require("@loaders.gl/loader-utils");
|
|
1030
982
|
|
|
1031
|
-
//
|
|
983
|
+
// dist/lib/parsers/parse-slpk/parse-slpk.js
|
|
1032
984
|
var import_zip2 = require("@loaders.gl/zip");
|
|
1033
985
|
|
|
1034
|
-
//
|
|
986
|
+
// dist/lib/parsers/parse-slpk/slpk-archieve.js
|
|
1035
987
|
var import_crypto = require("@loaders.gl/crypto");
|
|
1036
988
|
var import_zip = require("@loaders.gl/zip");
|
|
1037
989
|
var import_compression = require("@loaders.gl/compression");
|
|
@@ -1070,6 +1022,11 @@ var PATH_DESCRIPTIONS = [
|
|
|
1070
1022
|
}
|
|
1071
1023
|
];
|
|
1072
1024
|
var SLPKArchive = class extends import_zip.IndexedArchive {
|
|
1025
|
+
// Maps hex-encoded md5 filename hashes to bigint offsets into the archive
|
|
1026
|
+
hashTable;
|
|
1027
|
+
_textEncoder = new TextEncoder();
|
|
1028
|
+
_textDecoder = new TextDecoder();
|
|
1029
|
+
_md5Hash = new import_crypto.MD5Hash();
|
|
1073
1030
|
/**
|
|
1074
1031
|
* Constructor
|
|
1075
1032
|
* @param fileProvider - instance of a binary data reader
|
|
@@ -1078,9 +1035,6 @@ var SLPKArchive = class extends import_zip.IndexedArchive {
|
|
|
1078
1035
|
*/
|
|
1079
1036
|
constructor(fileProvider, hashTable, fileName) {
|
|
1080
1037
|
super(fileProvider, hashTable, fileName);
|
|
1081
|
-
this._textEncoder = new TextEncoder();
|
|
1082
|
-
this._textDecoder = new TextDecoder();
|
|
1083
|
-
this._md5Hash = new import_crypto.MD5Hash();
|
|
1084
1038
|
this.hashTable = hashTable;
|
|
1085
1039
|
}
|
|
1086
1040
|
/**
|
|
@@ -1156,10 +1110,7 @@ var SLPKArchive = class extends import_zip.IndexedArchive {
|
|
|
1156
1110
|
if (!localFileHeader) {
|
|
1157
1111
|
return void 0;
|
|
1158
1112
|
}
|
|
1159
|
-
compressedFile = await this.fileProvider.slice(
|
|
1160
|
-
localFileHeader.fileDataOffset,
|
|
1161
|
-
localFileHeader.fileDataOffset + localFileHeader.compressedSize
|
|
1162
|
-
);
|
|
1113
|
+
compressedFile = await this.fileProvider.slice(localFileHeader.fileDataOffset, localFileHeader.fileDataOffset + localFileHeader.compressedSize);
|
|
1163
1114
|
} else {
|
|
1164
1115
|
try {
|
|
1165
1116
|
compressedFile = await this.getFileWithoutHash(path);
|
|
@@ -1171,36 +1122,28 @@ var SLPKArchive = class extends import_zip.IndexedArchive {
|
|
|
1171
1122
|
}
|
|
1172
1123
|
};
|
|
1173
1124
|
|
|
1174
|
-
//
|
|
1125
|
+
// dist/lib/parsers/parse-slpk/parse-slpk.js
|
|
1175
1126
|
async function parseSLPKArchive(fileProvider, cb, fileName) {
|
|
1176
1127
|
const hashCDOffset = await (0, import_zip2.searchFromTheEnd)(fileProvider, import_zip2.CD_HEADER_SIGNATURE);
|
|
1177
1128
|
const cdFileHeader = await (0, import_zip2.parseZipCDFileHeader)(hashCDOffset, fileProvider);
|
|
1178
1129
|
let hashTable;
|
|
1179
1130
|
if ((cdFileHeader == null ? void 0 : cdFileHeader.fileName) !== "@specialIndexFileHASH128@") {
|
|
1180
1131
|
hashTable = await (0, import_zip2.makeHashTableFromZipHeaders)(fileProvider);
|
|
1181
|
-
cb == null ? void 0 : cb(
|
|
1182
|
-
"SLPK doesnt contain hash file, hash info has been composed according to zip archive headers"
|
|
1183
|
-
);
|
|
1132
|
+
cb == null ? void 0 : cb("SLPK doesnt contain hash file, hash info has been composed according to zip archive headers");
|
|
1184
1133
|
} else {
|
|
1185
|
-
const localFileHeader = await (0, import_zip2.parseZipLocalFileHeader)(
|
|
1186
|
-
cdFileHeader.localHeaderOffset,
|
|
1187
|
-
fileProvider
|
|
1188
|
-
);
|
|
1134
|
+
const localFileHeader = await (0, import_zip2.parseZipLocalFileHeader)(cdFileHeader.localHeaderOffset, fileProvider);
|
|
1189
1135
|
if (!localFileHeader) {
|
|
1190
1136
|
throw new Error("corrupted SLPK");
|
|
1191
1137
|
}
|
|
1192
1138
|
const fileDataOffset = localFileHeader.fileDataOffset;
|
|
1193
|
-
const hashFile = await fileProvider.slice(
|
|
1194
|
-
fileDataOffset,
|
|
1195
|
-
fileDataOffset + localFileHeader.compressedSize
|
|
1196
|
-
);
|
|
1139
|
+
const hashFile = await fileProvider.slice(fileDataOffset, fileDataOffset + localFileHeader.compressedSize);
|
|
1197
1140
|
hashTable = (0, import_zip2.parseHashTable)(hashFile);
|
|
1198
1141
|
}
|
|
1199
1142
|
return new SLPKArchive(fileProvider, hashTable, fileName);
|
|
1200
1143
|
}
|
|
1201
1144
|
|
|
1202
|
-
//
|
|
1203
|
-
var VERSION4 =
|
|
1145
|
+
// dist/i3s-slpk-loader.js
|
|
1146
|
+
var VERSION4 = true ? "4.2.0-alpha.5" : "latest";
|
|
1204
1147
|
var SLPKLoader = {
|
|
1205
1148
|
name: "I3S SLPK (Scene Layer Package)",
|
|
1206
1149
|
id: "slpk",
|
|
@@ -1216,10 +1159,10 @@ var SLPKLoader = {
|
|
|
1216
1159
|
}
|
|
1217
1160
|
};
|
|
1218
1161
|
|
|
1219
|
-
//
|
|
1162
|
+
// dist/i3s-attribute-loader.js
|
|
1220
1163
|
var import_core6 = require("@loaders.gl/core");
|
|
1221
1164
|
|
|
1222
|
-
//
|
|
1165
|
+
// dist/lib/parsers/parse-i3s-attribute.js
|
|
1223
1166
|
function parseI3STileAttribute(arrayBuffer, options) {
|
|
1224
1167
|
const { attributeName, attributeType } = options;
|
|
1225
1168
|
if (!attributeName) {
|
|
@@ -1261,11 +1204,7 @@ function parseStringsAttribute(arrayBuffer) {
|
|
|
1261
1204
|
const bytesPerStringSize = 4;
|
|
1262
1205
|
const stringsArray = [];
|
|
1263
1206
|
try {
|
|
1264
|
-
const stringsCount = new DataView(
|
|
1265
|
-
arrayBuffer,
|
|
1266
|
-
stringsCountOffset,
|
|
1267
|
-
bytesPerStringSize
|
|
1268
|
-
).getUint32(stringsCountOffset, true);
|
|
1207
|
+
const stringsCount = new DataView(arrayBuffer, stringsCountOffset, bytesPerStringSize).getUint32(stringsCountOffset, true);
|
|
1269
1208
|
const stringSizes = new Uint32Array(arrayBuffer, dataOffset, stringsCount);
|
|
1270
1209
|
let stringOffset = dataOffset + stringsCount * bytesPerStringSize;
|
|
1271
1210
|
for (const stringByteSize of stringSizes) {
|
|
@@ -1280,8 +1219,8 @@ function parseStringsAttribute(arrayBuffer) {
|
|
|
1280
1219
|
return stringsArray;
|
|
1281
1220
|
}
|
|
1282
1221
|
|
|
1283
|
-
//
|
|
1284
|
-
var VERSION5 =
|
|
1222
|
+
// dist/i3s-attribute-loader.js
|
|
1223
|
+
var VERSION5 = true ? "4.2.0-alpha.5" : "latest";
|
|
1285
1224
|
var EMPTY_VALUE = "";
|
|
1286
1225
|
var REJECTED_STATUS = "rejected";
|
|
1287
1226
|
var I3SAttributeLoader = {
|
|
@@ -1385,7 +1324,7 @@ function formatAttributeValue(attribute, featureIdIndex, codedValues) {
|
|
|
1385
1324
|
return value;
|
|
1386
1325
|
}
|
|
1387
1326
|
|
|
1388
|
-
//
|
|
1327
|
+
// dist/lib/parsers/parse-i3s-building-scene-layer.js
|
|
1389
1328
|
var OBJECT_3D_LAYER_TYPE = "3DObject";
|
|
1390
1329
|
async function parseBuildingSceneLayer(data, url) {
|
|
1391
1330
|
const layer0 = JSON.parse(new TextDecoder().decode(data));
|
|
@@ -1418,8 +1357,8 @@ function parseSublayersTree(sublayers, url) {
|
|
|
1418
1357
|
return layers;
|
|
1419
1358
|
}
|
|
1420
1359
|
|
|
1421
|
-
//
|
|
1422
|
-
var VERSION6 =
|
|
1360
|
+
// dist/i3s-building-scene-layer-loader.js
|
|
1361
|
+
var VERSION6 = true ? "4.2.0-alpha.5" : "latest";
|
|
1423
1362
|
var I3SBuildingSceneLayerLoader = {
|
|
1424
1363
|
name: "I3S Building Scene Layer",
|
|
1425
1364
|
id: "i3s-building-scene-layer",
|
|
@@ -1437,7 +1376,7 @@ async function parse4(data, options, context) {
|
|
|
1437
1376
|
return parseBuildingSceneLayer(data, context.url);
|
|
1438
1377
|
}
|
|
1439
1378
|
|
|
1440
|
-
//
|
|
1379
|
+
// dist/lib/parsers/parse-arcgis-webscene.js
|
|
1441
1380
|
var import_core7 = require("@loaders.gl/core");
|
|
1442
1381
|
var SUPPORTED_WKID = 4326;
|
|
1443
1382
|
var ARCGIS_SCENE_SERVER_LAYER_TYPE = "ArcGISSceneServiceLayer";
|
|
@@ -1453,6 +1392,7 @@ var SUPPORTED_LAYERS_TYPES = [
|
|
|
1453
1392
|
var NO_AVAILABLE_SUPPORTED_LAYERS_ERROR = "NO_AVAILABLE_SUPPORTED_LAYERS_ERROR";
|
|
1454
1393
|
var NOT_SUPPORTED_CRS_ERROR = "NOT_SUPPORTED_CRS_ERROR";
|
|
1455
1394
|
var LayerError = class extends Error {
|
|
1395
|
+
details;
|
|
1456
1396
|
constructor(message, details) {
|
|
1457
1397
|
super(message);
|
|
1458
1398
|
this.details = details;
|
|
@@ -1509,8 +1449,8 @@ async function checkSupportedIndexCRS(layer) {
|
|
|
1509
1449
|
}
|
|
1510
1450
|
}
|
|
1511
1451
|
|
|
1512
|
-
//
|
|
1513
|
-
var VERSION7 =
|
|
1452
|
+
// dist/arcgis-webscene-loader.js
|
|
1453
|
+
var VERSION7 = true ? "4.2.0-alpha.5" : "latest";
|
|
1514
1454
|
var ArcGISWebSceneLoader = {
|
|
1515
1455
|
name: "ArcGIS Web Scene Loader",
|
|
1516
1456
|
id: "arcgis-web-scene",
|
|
@@ -1525,7 +1465,7 @@ async function parse5(data) {
|
|
|
1525
1465
|
return parseWebscene(data);
|
|
1526
1466
|
}
|
|
1527
1467
|
|
|
1528
|
-
//
|
|
1468
|
+
// dist/lib/utils/customize-colors.js
|
|
1529
1469
|
var import_core8 = require("@loaders.gl/core");
|
|
1530
1470
|
async function customizeColors(colors, featureIds, attributeUrls, fields, attributeStorageInfo, colorsByAttribute, token) {
|
|
1531
1471
|
if (!colorsByAttribute) {
|
|
@@ -1536,17 +1476,10 @@ async function customizeColors(colors, featureIds, attributeUrls, fields, attrib
|
|
|
1536
1476
|
value: new Uint8Array(colors.value)
|
|
1537
1477
|
};
|
|
1538
1478
|
const colorizeAttributeField = fields.find(({ name }) => name === (colorsByAttribute == null ? void 0 : colorsByAttribute.attributeName));
|
|
1539
|
-
if (!colorizeAttributeField || !["esriFieldTypeDouble", "esriFieldTypeInteger", "esriFieldTypeSmallInteger"].includes(
|
|
1540
|
-
colorizeAttributeField.type
|
|
1541
|
-
)) {
|
|
1479
|
+
if (!colorizeAttributeField || !["esriFieldTypeDouble", "esriFieldTypeInteger", "esriFieldTypeSmallInteger"].includes(colorizeAttributeField.type)) {
|
|
1542
1480
|
return colors;
|
|
1543
1481
|
}
|
|
1544
|
-
const colorizeAttributeData = await loadFeatureAttributeData(
|
|
1545
|
-
colorizeAttributeField.name,
|
|
1546
|
-
attributeUrls,
|
|
1547
|
-
attributeStorageInfo,
|
|
1548
|
-
token
|
|
1549
|
-
);
|
|
1482
|
+
const colorizeAttributeData = await loadFeatureAttributeData(colorizeAttributeField.name, attributeUrls, attributeStorageInfo, token);
|
|
1550
1483
|
if (!colorizeAttributeData) {
|
|
1551
1484
|
return colors;
|
|
1552
1485
|
}
|
|
@@ -1554,12 +1487,7 @@ async function customizeColors(colors, featureIds, attributeUrls, fields, attrib
|
|
|
1554
1487
|
if (!objectIdField) {
|
|
1555
1488
|
return colors;
|
|
1556
1489
|
}
|
|
1557
|
-
const objectIdAttributeData = await loadFeatureAttributeData(
|
|
1558
|
-
objectIdField.name,
|
|
1559
|
-
attributeUrls,
|
|
1560
|
-
attributeStorageInfo,
|
|
1561
|
-
token
|
|
1562
|
-
);
|
|
1490
|
+
const objectIdAttributeData = await loadFeatureAttributeData(objectIdField.name, attributeUrls, attributeStorageInfo, token);
|
|
1563
1491
|
if (!objectIdAttributeData) {
|
|
1564
1492
|
return colors;
|
|
1565
1493
|
}
|
|
@@ -1611,3 +1539,4 @@ async function loadFeatureAttributeData(attributeName, attributeUrls, attributeS
|
|
|
1611
1539
|
});
|
|
1612
1540
|
return objectIdAttributeData;
|
|
1613
1541
|
}
|
|
1542
|
+
//# sourceMappingURL=index.cjs.map
|