@loaders.gl/i3s 3.3.0 → 3.4.0-alpha.1
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/dist.min.js +54 -54
- package/dist/es5/arcgis-webscene-loader.js +1 -1
- package/dist/es5/arcgis-webscene-loader.js.map +1 -1
- package/dist/es5/i3s-attribute-loader.js +1 -1
- package/dist/es5/i3s-attribute-loader.js.map +1 -1
- package/dist/es5/i3s-building-scene-layer-loader.js +1 -1
- package/dist/es5/i3s-building-scene-layer-loader.js.map +1 -1
- package/dist/es5/i3s-content-loader.js +1 -1
- package/dist/es5/i3s-content-loader.js.map +1 -1
- package/dist/es5/i3s-loader.js +1 -1
- package/dist/es5/i3s-loader.js.map +1 -1
- package/dist/es5/i3s-node-page-loader.js +1 -1
- package/dist/es5/i3s-node-page-loader.js.map +1 -1
- package/dist/esm/arcgis-webscene-loader.js +1 -1
- package/dist/esm/arcgis-webscene-loader.js.map +1 -1
- package/dist/esm/i3s-attribute-loader.js +1 -1
- package/dist/esm/i3s-attribute-loader.js.map +1 -1
- package/dist/esm/i3s-building-scene-layer-loader.js +1 -1
- package/dist/esm/i3s-building-scene-layer-loader.js.map +1 -1
- package/dist/esm/i3s-content-loader.js +1 -1
- package/dist/esm/i3s-content-loader.js.map +1 -1
- package/dist/esm/i3s-loader.js +1 -1
- package/dist/esm/i3s-loader.js.map +1 -1
- package/dist/esm/i3s-node-page-loader.js +1 -1
- package/dist/esm/i3s-node-page-loader.js.map +1 -1
- package/dist/i3s-content-nodejs-worker.js +49 -49
- package/dist/i3s-content-nodejs-worker.js.map +3 -3
- package/dist/i3s-content-worker.js +45 -38
- package/package.json +8 -8
package/dist/dist.min.js
CHANGED
|
@@ -709,7 +709,46 @@
|
|
|
709
709
|
}
|
|
710
710
|
});
|
|
711
711
|
|
|
712
|
+
// ../loader-utils/src/lib/binary-utils/buffer-utils.ts
|
|
713
|
+
function isBuffer(value) {
|
|
714
|
+
return value && typeof value === "object" && value.isBuffer;
|
|
715
|
+
}
|
|
716
|
+
function bufferToArrayBuffer(buffer) {
|
|
717
|
+
if (isBuffer(buffer)) {
|
|
718
|
+
const typedArray = new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.length);
|
|
719
|
+
return typedArray.slice().buffer;
|
|
720
|
+
}
|
|
721
|
+
return buffer;
|
|
722
|
+
}
|
|
723
|
+
var init_buffer_utils = __esm({
|
|
724
|
+
"../loader-utils/src/lib/binary-utils/buffer-utils.ts"() {
|
|
725
|
+
}
|
|
726
|
+
});
|
|
727
|
+
|
|
712
728
|
// ../loader-utils/src/lib/binary-utils/array-buffer-utils.ts
|
|
729
|
+
function toArrayBuffer(data) {
|
|
730
|
+
if (isBuffer(data)) {
|
|
731
|
+
return bufferToArrayBuffer(data);
|
|
732
|
+
}
|
|
733
|
+
if (data instanceof ArrayBuffer) {
|
|
734
|
+
return data;
|
|
735
|
+
}
|
|
736
|
+
if (ArrayBuffer.isView(data)) {
|
|
737
|
+
if (data.byteOffset === 0 && data.byteLength === data.buffer.byteLength) {
|
|
738
|
+
return data.buffer;
|
|
739
|
+
}
|
|
740
|
+
return data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);
|
|
741
|
+
}
|
|
742
|
+
if (typeof data === "string") {
|
|
743
|
+
const text = data;
|
|
744
|
+
const uint8Array = new TextEncoder().encode(text);
|
|
745
|
+
return uint8Array.buffer;
|
|
746
|
+
}
|
|
747
|
+
if (data && typeof data === "object" && data._toArrayBuffer) {
|
|
748
|
+
return data._toArrayBuffer();
|
|
749
|
+
}
|
|
750
|
+
throw new Error("toArrayBuffer");
|
|
751
|
+
}
|
|
713
752
|
function compareArrayBuffers(arrayBuffer1, arrayBuffer2, byteLength) {
|
|
714
753
|
byteLength = byteLength || arrayBuffer1.byteLength;
|
|
715
754
|
if (arrayBuffer1.byteLength < byteLength || arrayBuffer2.byteLength < byteLength) {
|
|
@@ -737,6 +776,7 @@
|
|
|
737
776
|
}
|
|
738
777
|
var init_array_buffer_utils = __esm({
|
|
739
778
|
"../loader-utils/src/lib/binary-utils/array-buffer-utils.ts"() {
|
|
779
|
+
init_buffer_utils();
|
|
740
780
|
}
|
|
741
781
|
});
|
|
742
782
|
|
|
@@ -818,45 +858,6 @@
|
|
|
818
858
|
}
|
|
819
859
|
});
|
|
820
860
|
|
|
821
|
-
// (disabled):../loader-utils/src/lib/node/buffer
|
|
822
|
-
var init_buffer = __esm({
|
|
823
|
-
"(disabled):../loader-utils/src/lib/node/buffer"() {
|
|
824
|
-
}
|
|
825
|
-
});
|
|
826
|
-
|
|
827
|
-
// ../loader-utils/src/lib/binary-utils/memory-conversion-utils.ts
|
|
828
|
-
function isBuffer(value) {
|
|
829
|
-
return value && typeof value === "object" && value.isBuffer;
|
|
830
|
-
}
|
|
831
|
-
function toArrayBuffer2(data) {
|
|
832
|
-
if (isBuffer(data)) {
|
|
833
|
-
return node2.toArrayBuffer(data);
|
|
834
|
-
}
|
|
835
|
-
if (data instanceof ArrayBuffer) {
|
|
836
|
-
return data;
|
|
837
|
-
}
|
|
838
|
-
if (ArrayBuffer.isView(data)) {
|
|
839
|
-
if (data.byteOffset === 0 && data.byteLength === data.buffer.byteLength) {
|
|
840
|
-
return data.buffer;
|
|
841
|
-
}
|
|
842
|
-
return data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);
|
|
843
|
-
}
|
|
844
|
-
if (typeof data === "string") {
|
|
845
|
-
const text = data;
|
|
846
|
-
const uint8Array = new TextEncoder().encode(text);
|
|
847
|
-
return uint8Array.buffer;
|
|
848
|
-
}
|
|
849
|
-
if (data && typeof data === "object" && data._toArrayBuffer) {
|
|
850
|
-
return data._toArrayBuffer();
|
|
851
|
-
}
|
|
852
|
-
throw new Error("toArrayBuffer");
|
|
853
|
-
}
|
|
854
|
-
var init_memory_conversion_utils = __esm({
|
|
855
|
-
"../loader-utils/src/lib/binary-utils/memory-conversion-utils.ts"() {
|
|
856
|
-
init_buffer();
|
|
857
|
-
}
|
|
858
|
-
});
|
|
859
|
-
|
|
860
861
|
// ../loader-utils/src/lib/path-utils/path.ts
|
|
861
862
|
var path_exports = {};
|
|
862
863
|
__export(path_exports, {
|
|
@@ -900,7 +901,6 @@
|
|
|
900
901
|
init_async_iteration();
|
|
901
902
|
init_file_aliases();
|
|
902
903
|
init_json_loader();
|
|
903
|
-
init_memory_conversion_utils();
|
|
904
904
|
init_path();
|
|
905
905
|
}
|
|
906
906
|
});
|
|
@@ -2262,7 +2262,7 @@
|
|
|
2262
2262
|
if (done) {
|
|
2263
2263
|
return;
|
|
2264
2264
|
}
|
|
2265
|
-
yield
|
|
2265
|
+
yield toArrayBuffer(value);
|
|
2266
2266
|
}
|
|
2267
2267
|
} catch (error) {
|
|
2268
2268
|
reader.releaseLock();
|
|
@@ -2270,7 +2270,7 @@
|
|
|
2270
2270
|
}
|
|
2271
2271
|
async function* makeNodeStreamIterator(stream, options) {
|
|
2272
2272
|
for await (const chunk of stream) {
|
|
2273
|
-
yield
|
|
2273
|
+
yield toArrayBuffer(chunk);
|
|
2274
2274
|
}
|
|
2275
2275
|
}
|
|
2276
2276
|
var init_make_stream_iterator = __esm({
|
|
@@ -10400,10 +10400,10 @@
|
|
|
10400
10400
|
return this.nodePages[pageIndex].nodes[nodeIndex];
|
|
10401
10401
|
}
|
|
10402
10402
|
async formTileFromNodePages(id) {
|
|
10403
|
-
const
|
|
10403
|
+
const node2 = await this.getNodeById(id);
|
|
10404
10404
|
const children = [];
|
|
10405
10405
|
const childNodesPromises = [];
|
|
10406
|
-
for (const child of
|
|
10406
|
+
for (const child of node2.children || []) {
|
|
10407
10407
|
childNodesPromises.push(this.getNodeById(child));
|
|
10408
10408
|
}
|
|
10409
10409
|
const childNodes = await Promise.all(childNodesPromises);
|
|
@@ -10419,25 +10419,25 @@
|
|
|
10419
10419
|
let textureFormat = "jpg";
|
|
10420
10420
|
let attributeUrls = [];
|
|
10421
10421
|
let isDracoGeometry = false;
|
|
10422
|
-
if (
|
|
10423
|
-
const { url, isDracoGeometry: isDracoGeometryResult } =
|
|
10422
|
+
if (node2 && node2.mesh) {
|
|
10423
|
+
const { url, isDracoGeometry: isDracoGeometryResult } = node2.mesh.geometry && this.getContentUrl(node2.mesh.geometry) || { isDracoGeometry: false };
|
|
10424
10424
|
contentUrl = url;
|
|
10425
10425
|
isDracoGeometry = isDracoGeometryResult;
|
|
10426
|
-
const { textureData, materialDefinition: nodeMaterialDefinition } = this.getInformationFromMaterial(
|
|
10426
|
+
const { textureData, materialDefinition: nodeMaterialDefinition } = this.getInformationFromMaterial(node2.mesh.material);
|
|
10427
10427
|
materialDefinition = nodeMaterialDefinition;
|
|
10428
10428
|
textureFormat = textureData.format || textureFormat;
|
|
10429
10429
|
if (textureData.name) {
|
|
10430
|
-
textureUrl = `${this.tileset.url}/nodes/${
|
|
10430
|
+
textureUrl = `${this.tileset.url}/nodes/${node2.mesh.material.resource}/textures/${textureData.name}`;
|
|
10431
10431
|
}
|
|
10432
10432
|
if (this.tileset.attributeStorageInfo) {
|
|
10433
|
-
attributeUrls = generateTilesetAttributeUrls(this.tileset,
|
|
10433
|
+
attributeUrls = generateTilesetAttributeUrls(this.tileset, node2.mesh.attribute.resource);
|
|
10434
10434
|
}
|
|
10435
10435
|
}
|
|
10436
|
-
const lodSelection = this.getLodSelection(
|
|
10436
|
+
const lodSelection = this.getLodSelection(node2);
|
|
10437
10437
|
return normalizeTileNonUrlData({
|
|
10438
10438
|
id: id.toString(),
|
|
10439
10439
|
lodSelection,
|
|
10440
|
-
obb:
|
|
10440
|
+
obb: node2.obb,
|
|
10441
10441
|
contentUrl,
|
|
10442
10442
|
textureUrl,
|
|
10443
10443
|
attributeUrls,
|
|
@@ -10467,17 +10467,17 @@
|
|
|
10467
10467
|
}
|
|
10468
10468
|
return result;
|
|
10469
10469
|
}
|
|
10470
|
-
getLodSelection(
|
|
10470
|
+
getLodSelection(node2) {
|
|
10471
10471
|
const lodSelection = [];
|
|
10472
10472
|
if (this.lodSelectionMetricType === "maxScreenThresholdSQ") {
|
|
10473
10473
|
lodSelection.push({
|
|
10474
10474
|
metricType: "maxScreenThreshold",
|
|
10475
|
-
maxError: Math.sqrt(
|
|
10475
|
+
maxError: Math.sqrt(node2.lodThreshold / (Math.PI * 0.25))
|
|
10476
10476
|
});
|
|
10477
10477
|
}
|
|
10478
10478
|
lodSelection.push({
|
|
10479
10479
|
metricType: this.lodSelectionMetricType,
|
|
10480
|
-
maxError:
|
|
10480
|
+
maxError: node2.lodThreshold
|
|
10481
10481
|
});
|
|
10482
10482
|
return lodSelection;
|
|
10483
10483
|
}
|
|
@@ -8,7 +8,7 @@ exports.ArcGisWebSceneLoader = void 0;
|
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
10
|
var _parseArcgisWebscene = require("./lib/parsers/parse-arcgis-webscene");
|
|
11
|
-
var VERSION = typeof "3.
|
|
11
|
+
var VERSION = typeof "3.4.0-alpha.1" !== 'undefined' ? "3.4.0-alpha.1" : 'beta';
|
|
12
12
|
|
|
13
13
|
var ArcGisWebSceneLoader = {
|
|
14
14
|
name: 'ArcGIS Web Scene Loader',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arcgis-webscene-loader.js","names":["VERSION","ArcGisWebSceneLoader","name","id","module","version","mimeTypes","parse","extensions","options","data","parseWebscene"],"sources":["../../src/arcgis-webscene-loader.ts"],"sourcesContent":["import type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport type {ArcGisWebSceneData} from './types';\n\nimport {parseWebscene} from './lib/parsers/parse-arcgis-webscene';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'beta';\n\n/**\n * Loader for ArcGis WebScene\n * Spec - https://developers.arcgis.com/web-scene-specification/objects/webscene/\n */\nexport const ArcGisWebSceneLoader: LoaderWithParser = {\n name: 'ArcGIS Web Scene Loader',\n id: 'arcgis-web-scene',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/json'],\n parse,\n extensions: ['json'],\n options: {}\n};\n\n/**\n * Parse ArcGis webscene\n * @param data\n */\nasync function parse(data: ArrayBuffer): Promise<ArcGisWebSceneData> {\n return parseWebscene(data);\n}\n"],"mappings":";;;;;;;;;AAGA;AAIA,IAAMA,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"arcgis-webscene-loader.js","names":["VERSION","ArcGisWebSceneLoader","name","id","module","version","mimeTypes","parse","extensions","options","data","parseWebscene"],"sources":["../../src/arcgis-webscene-loader.ts"],"sourcesContent":["import type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport type {ArcGisWebSceneData} from './types';\n\nimport {parseWebscene} from './lib/parsers/parse-arcgis-webscene';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'beta';\n\n/**\n * Loader for ArcGis WebScene\n * Spec - https://developers.arcgis.com/web-scene-specification/objects/webscene/\n */\nexport const ArcGisWebSceneLoader: LoaderWithParser = {\n name: 'ArcGIS Web Scene Loader',\n id: 'arcgis-web-scene',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/json'],\n parse,\n extensions: ['json'],\n options: {}\n};\n\n/**\n * Parse ArcGis webscene\n * @param data\n */\nasync function parse(data: ArrayBuffer): Promise<ArcGisWebSceneData> {\n return parseWebscene(data);\n}\n"],"mappings":";;;;;;;;;AAGA;AAIA,IAAMA,OAAO,GAAG,sBAAkB,KAAK,WAAW,qBAAiB,MAAM;;AAMlE,IAAMC,oBAAsC,GAAG;EACpDC,IAAI,EAAE,yBAAyB;EAC/BC,EAAE,EAAE,kBAAkB;EACtBC,MAAM,EAAE,KAAK;EACbC,OAAO,EAAEL,OAAO;EAChBM,SAAS,EAAE,CAAC,kBAAkB,CAAC;EAC/BC,KAAK,EAALA,KAAK;EACLC,UAAU,EAAE,CAAC,MAAM,CAAC;EACpBC,OAAO,EAAE,CAAC;AACZ,CAAC;;AAAC;AAAA,SAMaF,KAAK;EAAA;AAAA;AAAA;EAAA,mEAApB,iBAAqBG,IAAiB;IAAA;MAAA;QAAA;UAAA;YAAA,iCAC7B,IAAAC,kCAAa,EAACD,IAAI,CAAC;UAAA;UAAA;YAAA;QAAA;MAAA;IAAA;EAAA,CAC3B;EAAA;AAAA"}
|
|
@@ -15,7 +15,7 @@ var _parseI3sAttribute = require("./lib/parsers/parse-i3s-attribute");
|
|
|
15
15
|
var _urlUtils = require("./lib/utils/url-utils");
|
|
16
16
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
17
17
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
18
|
-
var VERSION = typeof "3.
|
|
18
|
+
var VERSION = typeof "3.4.0-alpha.1" !== 'undefined' ? "3.4.0-alpha.1" : 'latest';
|
|
19
19
|
var EMPTY_VALUE = '';
|
|
20
20
|
var REJECTED_STATUS = 'rejected';
|
|
21
21
|
var I3SAttributeLoader = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i3s-attribute-loader.js","names":["VERSION","EMPTY_VALUE","REJECTED_STATUS","I3SAttributeLoader","name","id","module","version","mimeTypes","parse","extensions","options","binary","data","parseI3STileAttribute","loadFeatureAttributes","tile","featureId","getAttributesData","attributeStorageInfo","attributeUrls","tilesetFields","attributes","attributeLoadPromises","index","length","url","getUrlWithToken","i3s","token","attributeName","attributeType","getAttributeValueType","loadOptions","promise","load","push","Promise","allSettled","generateAttributesByFeatureId","tileset","header","fields","attribute","hasOwnProperty","attributeValues","valueType","getFeatureIdsAttributeName","objectIdsAttribute","find","includes","objectIdsAttributeName","objectIds","value","attributeIndex","indexOf","getFeatureAttributesByIndex","featureIdIndex","attributesObject","codedValues","getAttributeCodedValues","getAttributeByIndexAndAttributeName","formatAttributeValue","attributeField","field","alias","domain","attributesName","attributeObject","status","String","replace","trim","codeValue","codedValue","code","Number"],"sources":["../../src/i3s-attribute-loader.ts"],"sourcesContent":["import type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {load} from '@loaders.gl/core';\nimport {parseI3STileAttribute} from './lib/parsers/parse-i3s-attribute';\nimport {getUrlWithToken} from './lib/utils/url-utils';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\nconst EMPTY_VALUE = '';\nconst REJECTED_STATUS = 'rejected';\n/**\n * Loader for I3S attributes\n */\nexport const I3SAttributeLoader: LoaderWithParser = {\n name: 'I3S Attribute',\n id: 'i3s-attribute',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/binary'],\n parse,\n extensions: ['bin'],\n options: {},\n binary: true\n};\n\nasync function parse(data, options) {\n data = parseI3STileAttribute(data, options);\n return data;\n}\n\n/**\n * Load attributes based on feature id\n * @param {Object} tile\n * @param {number} featureId\n * @param {Object} options\n * @returns {Promise}\n */\n// eslint-disable-next-line complexity\nexport async function loadFeatureAttributes(tile, featureId, options = {}) {\n const {attributeStorageInfo, attributeUrls, tilesetFields} = getAttributesData(tile);\n\n if (!attributeStorageInfo || !attributeUrls || featureId < 0) {\n return null;\n }\n\n let attributes: object[] = [];\n const attributeLoadPromises: Promise<object>[] = [];\n\n for (let index = 0; index < attributeStorageInfo.length; index++) {\n // @ts-ignore\n const url = getUrlWithToken(attributeUrls[index], options.i3s?.token);\n const attributeName = attributeStorageInfo[index].name;\n const attributeType = getAttributeValueType(attributeStorageInfo[index]);\n const loadOptions = {...options, attributeName, attributeType};\n const promise = load(url, I3SAttributeLoader, loadOptions);\n\n attributeLoadPromises.push(promise);\n }\n try {\n attributes = await Promise.allSettled(attributeLoadPromises);\n } catch (error) {\n // do nothing\n }\n\n if (!attributes.length) {\n return null;\n }\n\n return generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields);\n}\n\n/**\n * Gets attributes data from tile.\n * @param tile \n * @returns \n */\nfunction getAttributesData(tile) {\n const attributeStorageInfo = tile.tileset?.tileset?.attributeStorageInfo;\n const attributeUrls = tile.header?.attributeUrls;\n const tilesetFields = tile.tileset?.tileset?.fields || [];\n\n return {attributeStorageInfo, attributeUrls, tilesetFields};\n}\n\n/**\n * Get attribute value type based on property names\n * @param {Object} attribute\n * @returns {String}\n */\nexport function getAttributeValueType(attribute) {\n if (attribute.hasOwnProperty('objectIds')) {\n return 'Oid32';\n } else if (attribute.hasOwnProperty('attributeValues')) {\n return attribute.attributeValues.valueType;\n }\n return '';\n}\n\n/**\n * Find in attributeStorageInfo attribute name responsible for feature ids list.\n * @param attributeStorageInfo \n * @returns Feature ids attribute name\n */\nfunction getFeatureIdsAttributeName(attributeStorageInfo) {\n const objectIdsAttribute = attributeStorageInfo.find(attribute => attribute.name.includes('OBJECTID'));\n\n return objectIdsAttribute?.name;\n}\n\n/**\n * Generates mapping featureId to feature attributes\n * @param {Array} attributes\n * @param {Object} attributeStorageInfo\n * @param {number} featureId\n * @returns {Object}\n */\nfunction generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields) {\n const objectIdsAttributeName = getFeatureIdsAttributeName(attributeStorageInfo);\n const objectIds = attributes.find((attribute) => attribute.value[objectIdsAttributeName]);\n\n if (!objectIds) {\n return null;\n }\n\n const attributeIndex = objectIds.value[objectIdsAttributeName].indexOf(featureId);\n\n if (attributeIndex < 0) {\n return null;\n }\n\n return getFeatureAttributesByIndex(attributes, attributeIndex, attributeStorageInfo, tilesetFields);\n}\n\n/**\n * Generates attribute object for feature mapping by feature id\n * @param {Array} attributes\n * @param {Number} featureIdIndex\n * @param {Object} attributeStorageInfo\n * @returns {Object}\n */\nfunction getFeatureAttributesByIndex(attributes, featureIdIndex, attributeStorageInfo, tilesetFields) {\n const attributesObject = {};\n\n for (let index = 0; index < attributeStorageInfo.length; index++) {\n const attributeName = attributeStorageInfo[index].name;\n const codedValues = getAttributeCodedValues(attributeName, tilesetFields);\n const attribute = getAttributeByIndexAndAttributeName(attributes, index, attributeName);\n attributesObject[attributeName] = formatAttributeValue(attribute, featureIdIndex, codedValues);\n }\n\n return attributesObject;\n}\n\n/**\n * Get coded values list from tileset.\n * @param attributeName \n * @param tilesetFields \n */\nfunction getAttributeCodedValues(attributeName, tilesetFields) {\n const attributeField = tilesetFields\n .find(field => field.name === attributeName || field.alias === attributeName);\n\n return attributeField?.domain?.codedValues || [];\n}\n\n/**\n * Return attribute value if it presents in atrributes list\n * @param {array} attributes\n * @param {number} index\n * @param {string} attributesName\n */\nfunction getAttributeByIndexAndAttributeName(attributes, index, attributesName) {\n const attributeObject = attributes[index];\n\n if (attributeObject.status === REJECTED_STATUS) {\n return null;\n }\n\n return attributeObject.value[attributesName];\n}\n\n/**\n * Do formatting of attribute values or return empty string.\n * @param {Array} attribute\n * @param {Number} featureIdIndex\n * @returns {String}\n */\nfunction formatAttributeValue(attribute, featureIdIndex, codedValues) {\n let value = EMPTY_VALUE;\n\n if (attribute && (featureIdIndex in attribute)) {\n // eslint-disable-next-line no-control-regex\n value = String(attribute[featureIdIndex]).replace(/\\u0000|NaN/g, '').trim();\n }\n\n // Check if coded values are existed. If so we use them.\n if (codedValues.length) {\n const codeValue = codedValues.find(codedValue => codedValue.code === Number(value));\n value = codeValue?.name || EMPTY_VALUE;\n }\n\n return value;\n}\n"],"mappings":";;;;;;;;;;;;AACA;AACA;AACA;AAAsD;AAAA;AAItD,IAAMA,OAAO,GAAG,cAAkB,KAAK,WAAW,aAAiB,QAAQ;AAC3E,IAAMC,WAAW,GAAG,EAAE;AACtB,IAAMC,eAAe,GAAG,UAAU;AAI3B,IAAMC,kBAAoC,GAAG;EAClDC,IAAI,EAAE,eAAe;EACrBC,EAAE,EAAE,eAAe;EACnBC,MAAM,EAAE,KAAK;EACbC,OAAO,EAAEP,OAAO;EAChBQ,SAAS,EAAE,CAAC,oBAAoB,CAAC;EACjCC,KAAK,EAALA,KAAK;EACLC,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,OAAO,EAAE,CAAC,CAAC;EACXC,MAAM,EAAE;AACV,CAAC;AAAC;AAAA,SAEaH,KAAK;EAAA;AAAA;AAAA;EAAA,mEAApB,iBAAqBI,IAAI,EAAEF,OAAO;IAAA;MAAA;QAAA;UAAA;YAChCE,IAAI,GAAG,IAAAC,wCAAqB,EAACD,IAAI,EAAEF,OAAO,CAAC;YAAC,iCACrCE,IAAI;UAAA;UAAA;YAAA;QAAA;MAAA;IAAA;EAAA,CACZ;EAAA;AAAA;AAAA,SAUqBE,qBAAqB;EAAA;AAAA;AAAA;EAAA,mFAApC,kBAAqCC,IAAI,EAAEC,SAAS;IAAA;MAAA;MAAA;MAAA;MAAA;MAAA;MAAA;MAAA;MAAA;MAAA;MAAA;MAAA;MAAA;MAAA;MAAA;IAAA;MAAA;QAAA;UAAA;YAAEN,OAAO,8DAAG,CAAC,CAAC;YAAA,qBACVO,iBAAiB,CAACF,IAAI,CAAC,EAA7EG,oBAAoB,sBAApBA,oBAAoB,EAAEC,aAAa,sBAAbA,aAAa,EAAEC,aAAa,sBAAbA,aAAa;YAAA,MAErD,CAACF,oBAAoB,IAAI,CAACC,aAAa,IAAIH,SAAS,GAAG,CAAC;cAAA;cA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cAAc,CAAC;AAC9C;;AAQA,SAASL,oBAAoB,CAACnB,SAAS,EAAEc,cAAc,EAAEE,WAAW,EAAE;EACpE,IAAIN,KAAK,GAAGpD,WAAW;EAEvB,IAAI0C,SAAS,IAAKc,cAAc,IAAId,SAAU,EAAE;IAE9CU,KAAK,GAAGiB,MAAM,CAAC3B,SAAS,CAACc,cAAc,CAAC,CAAC,CAACc,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAACC,IAAI,EAAE;EAC7E;;EAGA,IAAIb,WAAW,CAAClC,MAAM,EAAE;IACtB,IAAMgD,SAAS,GAAGd,WAAW,CAACV,IAAI,CAAC,UAAAyB,UAAU;MAAA,OAAIA,UAAU,CAACC,IAAI,KAAKC,MAAM,CAACvB,KAAK,CAAC;IAAA,EAAC;IACnFA,KAAK,GAAG,CAAAoB,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAErE,IAAI,KAAIH,WAAW;EACxC;EAEA,OAAOoD,KAAK;AACd"}
|
|
1
|
+
{"version":3,"file":"i3s-attribute-loader.js","names":["VERSION","EMPTY_VALUE","REJECTED_STATUS","I3SAttributeLoader","name","id","module","version","mimeTypes","parse","extensions","options","binary","data","parseI3STileAttribute","loadFeatureAttributes","tile","featureId","getAttributesData","attributeStorageInfo","attributeUrls","tilesetFields","attributes","attributeLoadPromises","index","length","url","getUrlWithToken","i3s","token","attributeName","attributeType","getAttributeValueType","loadOptions","promise","load","push","Promise","allSettled","generateAttributesByFeatureId","tileset","header","fields","attribute","hasOwnProperty","attributeValues","valueType","getFeatureIdsAttributeName","objectIdsAttribute","find","includes","objectIdsAttributeName","objectIds","value","attributeIndex","indexOf","getFeatureAttributesByIndex","featureIdIndex","attributesObject","codedValues","getAttributeCodedValues","getAttributeByIndexAndAttributeName","formatAttributeValue","attributeField","field","alias","domain","attributesName","attributeObject","status","String","replace","trim","codeValue","codedValue","code","Number"],"sources":["../../src/i3s-attribute-loader.ts"],"sourcesContent":["import type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {load} from '@loaders.gl/core';\nimport {parseI3STileAttribute} from './lib/parsers/parse-i3s-attribute';\nimport {getUrlWithToken} from './lib/utils/url-utils';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\nconst EMPTY_VALUE = '';\nconst REJECTED_STATUS = 'rejected';\n/**\n * Loader for I3S attributes\n */\nexport const I3SAttributeLoader: LoaderWithParser = {\n name: 'I3S Attribute',\n id: 'i3s-attribute',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/binary'],\n parse,\n extensions: ['bin'],\n options: {},\n binary: true\n};\n\nasync function parse(data, options) {\n data = parseI3STileAttribute(data, options);\n return data;\n}\n\n/**\n * Load attributes based on feature id\n * @param {Object} tile\n * @param {number} featureId\n * @param {Object} options\n * @returns {Promise}\n */\n// eslint-disable-next-line complexity\nexport async function loadFeatureAttributes(tile, featureId, options = {}) {\n const {attributeStorageInfo, attributeUrls, tilesetFields} = getAttributesData(tile);\n\n if (!attributeStorageInfo || !attributeUrls || featureId < 0) {\n return null;\n }\n\n let attributes: object[] = [];\n const attributeLoadPromises: Promise<object>[] = [];\n\n for (let index = 0; index < attributeStorageInfo.length; index++) {\n // @ts-ignore\n const url = getUrlWithToken(attributeUrls[index], options.i3s?.token);\n const attributeName = attributeStorageInfo[index].name;\n const attributeType = getAttributeValueType(attributeStorageInfo[index]);\n const loadOptions = {...options, attributeName, attributeType};\n const promise = load(url, I3SAttributeLoader, loadOptions);\n\n attributeLoadPromises.push(promise);\n }\n try {\n attributes = await Promise.allSettled(attributeLoadPromises);\n } catch (error) {\n // do nothing\n }\n\n if (!attributes.length) {\n return null;\n }\n\n return generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields);\n}\n\n/**\n * Gets attributes data from tile.\n * @param tile \n * @returns \n */\nfunction getAttributesData(tile) {\n const attributeStorageInfo = tile.tileset?.tileset?.attributeStorageInfo;\n const attributeUrls = tile.header?.attributeUrls;\n const tilesetFields = tile.tileset?.tileset?.fields || [];\n\n return {attributeStorageInfo, attributeUrls, tilesetFields};\n}\n\n/**\n * Get attribute value type based on property names\n * @param {Object} attribute\n * @returns {String}\n */\nexport function getAttributeValueType(attribute) {\n if (attribute.hasOwnProperty('objectIds')) {\n return 'Oid32';\n } else if (attribute.hasOwnProperty('attributeValues')) {\n return attribute.attributeValues.valueType;\n }\n return '';\n}\n\n/**\n * Find in attributeStorageInfo attribute name responsible for feature ids list.\n * @param attributeStorageInfo \n * @returns Feature ids attribute name\n */\nfunction getFeatureIdsAttributeName(attributeStorageInfo) {\n const objectIdsAttribute = attributeStorageInfo.find(attribute => attribute.name.includes('OBJECTID'));\n\n return objectIdsAttribute?.name;\n}\n\n/**\n * Generates mapping featureId to feature attributes\n * @param {Array} attributes\n * @param {Object} attributeStorageInfo\n * @param {number} featureId\n * @returns {Object}\n */\nfunction generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields) {\n const objectIdsAttributeName = getFeatureIdsAttributeName(attributeStorageInfo);\n const objectIds = attributes.find((attribute) => attribute.value[objectIdsAttributeName]);\n\n if (!objectIds) {\n return null;\n }\n\n const attributeIndex = objectIds.value[objectIdsAttributeName].indexOf(featureId);\n\n if (attributeIndex < 0) {\n return null;\n }\n\n return getFeatureAttributesByIndex(attributes, attributeIndex, attributeStorageInfo, tilesetFields);\n}\n\n/**\n * Generates attribute object for feature mapping by feature id\n * @param {Array} attributes\n * @param {Number} featureIdIndex\n * @param {Object} attributeStorageInfo\n * @returns {Object}\n */\nfunction getFeatureAttributesByIndex(attributes, featureIdIndex, attributeStorageInfo, tilesetFields) {\n const attributesObject = {};\n\n for (let index = 0; index < attributeStorageInfo.length; index++) {\n const attributeName = attributeStorageInfo[index].name;\n const codedValues = getAttributeCodedValues(attributeName, tilesetFields);\n const attribute = getAttributeByIndexAndAttributeName(attributes, index, attributeName);\n attributesObject[attributeName] = formatAttributeValue(attribute, featureIdIndex, codedValues);\n }\n\n return attributesObject;\n}\n\n/**\n * Get coded values list from tileset.\n * @param attributeName \n * @param tilesetFields \n */\nfunction getAttributeCodedValues(attributeName, tilesetFields) {\n const attributeField = tilesetFields\n .find(field => field.name === attributeName || field.alias === attributeName);\n\n return attributeField?.domain?.codedValues || [];\n}\n\n/**\n * Return attribute value if it presents in atrributes list\n * @param {array} attributes\n * @param {number} index\n * @param {string} attributesName\n */\nfunction getAttributeByIndexAndAttributeName(attributes, index, attributesName) {\n const attributeObject = attributes[index];\n\n if (attributeObject.status === REJECTED_STATUS) {\n return null;\n }\n\n return attributeObject.value[attributesName];\n}\n\n/**\n * Do formatting of attribute values or return empty string.\n * @param {Array} attribute\n * @param {Number} featureIdIndex\n * @returns {String}\n */\nfunction formatAttributeValue(attribute, featureIdIndex, codedValues) {\n let value = EMPTY_VALUE;\n\n if (attribute && (featureIdIndex in attribute)) {\n // eslint-disable-next-line no-control-regex\n value = String(attribute[featureIdIndex]).replace(/\\u0000|NaN/g, '').trim();\n }\n\n // Check if coded values are existed. If so we use them.\n if (codedValues.length) {\n const codeValue = codedValues.find(codedValue => codedValue.code === Number(value));\n value = codeValue?.name || EMPTY_VALUE;\n }\n\n return value;\n}\n"],"mappings":";;;;;;;;;;;;AACA;AACA;AACA;AAAsD;AAAA;AAItD,IAAMA,OAAO,GAAG,sBAAkB,KAAK,WAAW,qBAAiB,QAAQ;AAC3E,IAAMC,WAAW,GAAG,EAAE;AACtB,IAAMC,eAAe,GAAG,UAAU;AAI3B,IAAMC,kBAAoC,GAAG;EAClDC,IAAI,EAAE,eAAe;EACrBC,EAAE,EAAE,eAAe;EACnBC,MAAM,EAAE,KAAK;EACbC,OAAO,EAAEP,OAAO;EAChBQ,SAAS,EAAE,CAAC,oBAAoB,CAAC;EACjCC,KAAK,EAALA,KAAK;EACLC,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,OAAO,EAAE,CAAC,CAAC;EACXC,MAAM,E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aAATA,SAAS,uBAATA,SAAS,CAAErE,IAAI,KAAIH,WAAW;EACxC;EAEA,OAAOoD,KAAK;AACd"}
|
|
@@ -9,7 +9,7 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
|
|
|
9
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
10
|
var _parseI3sBuildingSceneLayer = require("./lib/parsers/parse-i3s-building-scene-layer");
|
|
11
11
|
|
|
12
|
-
var VERSION = typeof "3.
|
|
12
|
+
var VERSION = typeof "3.4.0-alpha.1" !== 'undefined' ? "3.4.0-alpha.1" : 'beta';
|
|
13
13
|
var I3SBuildingSceneLayerLoader = {
|
|
14
14
|
name: 'I3S Building Scene Layer',
|
|
15
15
|
id: 'i3s-building-scene-layer',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i3s-building-scene-layer-loader.js","names":["VERSION","I3SBuildingSceneLayerLoader","name","id","module","version","mimeTypes","parse","extensions","options","data","context","url","Error","parseBuildingSceneLayer"],"sources":["../../src/i3s-building-scene-layer-loader.ts"],"sourcesContent":["import type {LoaderWithParser, LoaderOptions, LoaderContext} from '@loaders.gl/loader-utils';\nimport type {BuildingSceneLayerTileset} from './types';\n\nimport {parseBuildingSceneLayer} from './lib/parsers/parse-i3s-building-scene-layer';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\n\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'beta';\n/**\n * Loader for I3S - Building Scene Layer\n */\nexport const I3SBuildingSceneLayerLoader: LoaderWithParser = {\n name: 'I3S Building Scene Layer',\n id: 'i3s-building-scene-layer',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/json'],\n parse,\n extensions: ['json'],\n options: {}\n};\n\nasync function parse(\n data: ArrayBuffer,\n options?: LoaderOptions,\n context?: LoaderContext\n): Promise<BuildingSceneLayerTileset> {\n if (!context?.url) {\n throw new Error('Url is not provided');\n }\n\n return parseBuildingSceneLayer(data, context.url);\n}\n"],"mappings":";;;;;;;;;AAGA;;AAKA,IAAMA,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"i3s-building-scene-layer-loader.js","names":["VERSION","I3SBuildingSceneLayerLoader","name","id","module","version","mimeTypes","parse","extensions","options","data","context","url","Error","parseBuildingSceneLayer"],"sources":["../../src/i3s-building-scene-layer-loader.ts"],"sourcesContent":["import type {LoaderWithParser, LoaderOptions, LoaderContext} from '@loaders.gl/loader-utils';\nimport type {BuildingSceneLayerTileset} from './types';\n\nimport {parseBuildingSceneLayer} from './lib/parsers/parse-i3s-building-scene-layer';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\n\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'beta';\n/**\n * Loader for I3S - Building Scene Layer\n */\nexport const I3SBuildingSceneLayerLoader: LoaderWithParser = {\n name: 'I3S Building Scene Layer',\n id: 'i3s-building-scene-layer',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/json'],\n parse,\n extensions: ['json'],\n options: {}\n};\n\nasync function parse(\n data: ArrayBuffer,\n options?: LoaderOptions,\n context?: LoaderContext\n): Promise<BuildingSceneLayerTileset> {\n if (!context?.url) {\n throw new Error('Url is not provided');\n }\n\n return parseBuildingSceneLayer(data, context.url);\n}\n"],"mappings":";;;;;;;;;AAGA;;AAKA,IAAMA,OAAO,GAAG,sBAAkB,KAAK,WAAW,qBAAiB,MAAM;AAIlE,IAAMC,2BAA6C,GAAG;EAC3DC,IAAI,EAAE,0BAA0B;EAChCC,EAAE,EAAE,0BAA0B;EAC9BC,MAAM,EAAE,KAAK;EACbC,OAAO,EAAEL,OAAO;EAChBM,SAAS,EAAE,CAAC,kBAAkB,CAAC;EAC/BC,KAAK,EAALA,KAAK;EACLC,UAAU,EAAE,CAAC,MAAM,CAAC;EACpBC,OAAO,EAAE,CAAC;AACZ,CAAC;AAAC;AAAA,SAEaF,KAAK;EAAA;AAAA;AAAA;EAAA,mEAApB,iBACEG,IAAiB,EACjBD,OAAuB,EACvBE,OAAuB;IAAA;MAAA;QAAA;UAAA;YAAA,IAElBA,OAAO,aAAPA,OAAO,eAAPA,OAAO,CAAEC,GAAG;cAAA;cAAA;YAAA;YAAA,MACT,IAAIC,KAAK,CAAC,qBAAqB,CAAC;UAAA;YAAA,iCAGjC,IAAAC,mDAAuB,EAACJ,IAAI,EAAEC,OAAO,CAACC,GAAG,CAAC;UAAA;UAAA;YAAA;QAAA;MAAA;IAAA;EAAA,CAClD;EAAA;AAAA"}
|
|
@@ -10,7 +10,7 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
|
|
|
10
10
|
var _workerUtils = require("@loaders.gl/worker-utils");
|
|
11
11
|
var _parseI3sTileContent = require("./lib/parsers/parse-i3s-tile-content");
|
|
12
12
|
|
|
13
|
-
var VERSION = typeof "3.
|
|
13
|
+
var VERSION = typeof "3.4.0-alpha.1" !== 'undefined' ? "3.4.0-alpha.1" : 'beta';
|
|
14
14
|
var I3SContentLoader = {
|
|
15
15
|
name: 'I3S Content (Indexed Scene Layers)',
|
|
16
16
|
id: _workerUtils.isBrowser ? 'i3s-content' : 'i3s-content-nodejs',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i3s-content-loader.js","names":["VERSION","I3SContentLoader","name","id","isBrowser","module","worker","version","mimeTypes","parse","extensions","options","data","context","i3s","tile","_tileOptions","tileset","_tilesetOptions","tileOptions","tilesetOptions","parseI3STileContent"],"sources":["../../src/i3s-content-loader.ts"],"sourcesContent":["import {isBrowser} from '@loaders.gl/worker-utils';\nimport type {LoaderWithParser, LoaderContext} from '@loaders.gl/loader-utils';\nimport type {I3SLoaderOptions} from './i3s-loader';\nimport {parseI3STileContent} from './lib/parsers/parse-i3s-tile-content';\nimport {I3STileOptions, I3STilesetOptions} from './types';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\n\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'beta';\n/**\n * Loader for I3S - Indexed 3D Scene Layer\n */\nexport const I3SContentLoader: LoaderWithParser = {\n name: 'I3S Content (Indexed Scene Layers)',\n id: isBrowser ? 'i3s-content' : 'i3s-content-nodejs',\n module: 'i3s',\n worker: true,\n version: VERSION,\n mimeTypes: ['application/octet-stream'],\n parse,\n extensions: ['bin'],\n options: {\n 'i3s-content': {}\n }\n};\n\nasync function parse(data, options?: I3SLoaderOptions, context?: LoaderContext) {\n const {tile, _tileOptions, tileset, _tilesetOptions} = options?.i3s || {};\n const tileOptions = _tileOptions || tile;\n const tilesetOptions = _tilesetOptions || tileset;\n if (!tileOptions || !tilesetOptions) {\n return null;\n }\n return await parseI3STileContent(\n data,\n tileOptions as I3STileOptions,\n tilesetOptions as I3STilesetOptions,\n options,\n context\n );\n}\n"],"mappings":";;;;;;;;;AAAA;AAGA;;AAMA,IAAMA,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"i3s-content-loader.js","names":["VERSION","I3SContentLoader","name","id","isBrowser","module","worker","version","mimeTypes","parse","extensions","options","data","context","i3s","tile","_tileOptions","tileset","_tilesetOptions","tileOptions","tilesetOptions","parseI3STileContent"],"sources":["../../src/i3s-content-loader.ts"],"sourcesContent":["import {isBrowser} from '@loaders.gl/worker-utils';\nimport type {LoaderWithParser, LoaderContext} from '@loaders.gl/loader-utils';\nimport type {I3SLoaderOptions} from './i3s-loader';\nimport {parseI3STileContent} from './lib/parsers/parse-i3s-tile-content';\nimport {I3STileOptions, I3STilesetOptions} from './types';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\n\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'beta';\n/**\n * Loader for I3S - Indexed 3D Scene Layer\n */\nexport const I3SContentLoader: LoaderWithParser = {\n name: 'I3S Content (Indexed Scene Layers)',\n id: isBrowser ? 'i3s-content' : 'i3s-content-nodejs',\n module: 'i3s',\n worker: true,\n version: VERSION,\n mimeTypes: ['application/octet-stream'],\n parse,\n extensions: ['bin'],\n options: {\n 'i3s-content': {}\n }\n};\n\nasync function parse(data, options?: I3SLoaderOptions, context?: LoaderContext) {\n const {tile, _tileOptions, tileset, _tilesetOptions} = options?.i3s || {};\n const tileOptions = _tileOptions || tile;\n const tilesetOptions = _tilesetOptions || tileset;\n if (!tileOptions || !tilesetOptions) {\n return null;\n }\n return await parseI3STileContent(\n data,\n tileOptions as I3STileOptions,\n tilesetOptions as I3STilesetOptions,\n options,\n context\n );\n}\n"],"mappings":";;;;;;;;;AAAA;AAGA;;AAMA,IAAMA,OAAO,GAAG,sBAAkB,KAAK,WAAW,qBAAiB,MAAM;AAIlE,IAAMC,gBAAkC,GAAG;EAChDC,IAAI,EAAE,oCAAoC;EAC1CC,EAAE,EAAEC,sBAAS,GAAG,aAAa,GAAG,oBAAoB;EACpDC,MAAM,EAAE,KAAK;EACbC,MAAM,EAAE,IAAI;EACZC,OAAO,EAAEP,OAAO;EAChBQ,SAAS,EAAE,CAAC,0BAA0B,CAAC;EACvCC,KAAK,EAALA,KAAK;EACLC,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,OAAO,EAAE;IACP,aAAa,EAAE,CAAC;EAClB;AACF,CAAC;AAAC;AAAA,SAEaF,KAAK;EAAA;AAAA;AAAA;EAAA,mEAApB,iBAAqBG,IAAI,EAAED,OAA0B,EAAEE,OAAuB;IAAA;IAAA;MAAA;QAAA;UAAA;YAAA,OACrB,CAAAF,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEG,GAAG,KAAI,CAAC,CAAC,EAAlEC,IAAI,QAAJA,IAAI,EAAEC,YAAY,QAAZA,YAAY,EAAEC,OAAO,QAAPA,OAAO,EAAEC,eAAe,QAAfA,eAAe;YAC7CC,WAAW,GAAGH,YAAY,IAAID,IAAI;YAClCK,cAAc,GAAGF,eAAe,IAAID,OAAO;YAAA,MAC7C,CAACE,WAAW,IAAI,CAACC,cAAc;cAAA;cAAA;YAAA;YAAA,iCAC1B,IAAI;UAAA;YAAA;YAAA,OAEA,IAAAC,wCAAmB,EAC9BT,IAAI,EACJO,WAAW,EACXC,cAAc,EACdT,OAAO,EACPE,OAAO,CACR;UAAA;YAAA;UAAA;UAAA;YAAA;QAAA;MAAA;IAAA;EAAA,CACF;EAAA;AAAA"}
|
package/dist/es5/i3s-loader.js
CHANGED
|
@@ -12,7 +12,7 @@ var _core = require("@loaders.gl/core");
|
|
|
12
12
|
var _i3sContentLoader = require("./i3s-content-loader");
|
|
13
13
|
var _parseI3s = require("./lib/parsers/parse-i3s");
|
|
14
14
|
var _constants = require("./lib/parsers/constants");
|
|
15
|
-
var VERSION = typeof "3.
|
|
15
|
+
var VERSION = typeof "3.4.0-alpha.1" !== 'undefined' ? "3.4.0-alpha.1" : 'latest';
|
|
16
16
|
var TILESET_REGEX = /layers\/[0-9]+$/;
|
|
17
17
|
var TILE_HEADER_REGEX = /nodes\/([0-9-]+|root)$/;
|
|
18
18
|
var SLPK_HEX = '504b0304';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i3s-loader.js","names":["VERSION","TILESET_REGEX","TILE_HEADER_REGEX","SLPK_HEX","POINT_CLOUD","I3SLoader","name","id","module","version","mimeTypes","parse","parseI3S","extensions","options","i3s","token","isTileset","isTileHeader","tile","tileset","_tileOptions","_tilesetOptions","useDracoGeometry","useCompressedTextures","decodeTextures","coordinateSystem","COORDINATE_SYSTEM","METER_OFFSETS","colorsByAttribute","data","context","url","magicNumber","getMagicNumber","Error","test","parseTileset","parseTile","parseTileContent","arrayBuffer","I3SContentLoader","tilesetJson","JSON","TextDecoder","decode","layerType","loader","normalizeTilesetData","normalizeTileData","ArrayBuffer","Uint8Array","map","value","toString","padStart","join"],"sources":["../../src/i3s-loader.ts"],"sourcesContent":["import type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {parse} from '@loaders.gl/core';\nimport {I3SContentLoader} from './i3s-content-loader';\nimport {normalizeTileData, normalizeTilesetData} from './lib/parsers/parse-i3s';\nimport {COORDINATE_SYSTEM} from './lib/parsers/constants';\nimport {I3SParseOptions} from './types';\nimport {LoaderOptions} from './../../loader-utils/src/types';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nconst TILESET_REGEX = /layers\\/[0-9]+$/;\nconst TILE_HEADER_REGEX = /nodes\\/([0-9-]+|root)$/;\nconst SLPK_HEX = '504b0304';\nconst POINT_CLOUD = 'PointCloud';\n\nexport type I3SLoaderOptions = LoaderOptions & {\n i3s?: I3SParseOptions;\n};\n\n/**\n * Loader for I3S - Indexed 3D Scene Layer\n */\nexport const I3SLoader: LoaderWithParser = {\n name: 'I3S (Indexed Scene Layers)',\n id: 'i3s',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/octet-stream'],\n parse: parseI3S,\n extensions: ['bin'],\n options: {\n i3s: {\n token: null,\n isTileset: 'auto',\n isTileHeader: 'auto',\n tile: null,\n tileset: null,\n _tileOptions: null,\n _tilesetOptions: null,\n useDracoGeometry: true,\n useCompressedTextures: true,\n decodeTextures: true,\n coordinateSystem: COORDINATE_SYSTEM.METER_OFFSETS,\n colorsByAttribute: null\n }\n }\n};\n\nasync function parseI3S(data, options: I3SLoaderOptions = {}, context) {\n const url = context.url;\n options.i3s = options.i3s || {};\n const magicNumber = getMagicNumber(data);\n\n // check if file is slpk\n if (magicNumber === SLPK_HEX) {\n throw new Error('Files with .slpk extention currently are not supported by I3SLoader');\n }\n\n // auto detect file type based on url\n let isTileset;\n if (options.i3s.isTileset === 'auto') {\n isTileset = TILESET_REGEX.test(url);\n } else {\n isTileset = options.i3s.isTileset;\n }\n\n let isTileHeader;\n if (options.isTileHeader === 'auto') {\n isTileHeader = TILE_HEADER_REGEX.test(url);\n } else {\n isTileHeader = options.i3s.isTileHeader;\n }\n\n if (isTileset) {\n data = await parseTileset(data, options, context);\n } else if (isTileHeader) {\n data = await parseTile(data, context);\n } else {\n data = await parseTileContent(data, options);\n }\n\n return data;\n}\n\nasync function parseTileContent(arrayBuffer, options: I3SLoaderOptions) {\n return await parse(arrayBuffer, I3SContentLoader, options);\n}\n\nasync function parseTileset(data, options: I3SLoaderOptions, context) {\n const tilesetJson = JSON.parse(new TextDecoder().decode(data));\n\n if (tilesetJson?.layerType === POINT_CLOUD) {\n throw new Error('Point Cloud layers currently are not supported by I3SLoader');\n }\n // eslint-disable-next-line no-use-before-define\n tilesetJson.loader = I3SLoader;\n await normalizeTilesetData(tilesetJson, options, context);\n\n return tilesetJson;\n}\n\nasync function parseTile(data, context) {\n data = JSON.parse(new TextDecoder().decode(data));\n return normalizeTileData(data, context);\n}\n\nfunction getMagicNumber(data) {\n if (data instanceof ArrayBuffer) {\n // slice binary data (4 bytes from the beginning) and transform it to hexadecimal numeral system\n return [...new Uint8Array(data, 0, 4)]\n .map((value) => value.toString(16).padStart(2, '0'))\n .join('');\n }\n return null;\n}\n"],"mappings":";;;;;;;;;;AACA;AACA;AACA;AACA;AAMA,IAAMA,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"i3s-loader.js","names":["VERSION","TILESET_REGEX","TILE_HEADER_REGEX","SLPK_HEX","POINT_CLOUD","I3SLoader","name","id","module","version","mimeTypes","parse","parseI3S","extensions","options","i3s","token","isTileset","isTileHeader","tile","tileset","_tileOptions","_tilesetOptions","useDracoGeometry","useCompressedTextures","decodeTextures","coordinateSystem","COORDINATE_SYSTEM","METER_OFFSETS","colorsByAttribute","data","context","url","magicNumber","getMagicNumber","Error","test","parseTileset","parseTile","parseTileContent","arrayBuffer","I3SContentLoader","tilesetJson","JSON","TextDecoder","decode","layerType","loader","normalizeTilesetData","normalizeTileData","ArrayBuffer","Uint8Array","map","value","toString","padStart","join"],"sources":["../../src/i3s-loader.ts"],"sourcesContent":["import type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {parse} from '@loaders.gl/core';\nimport {I3SContentLoader} from './i3s-content-loader';\nimport {normalizeTileData, normalizeTilesetData} from './lib/parsers/parse-i3s';\nimport {COORDINATE_SYSTEM} from './lib/parsers/constants';\nimport {I3SParseOptions} from './types';\nimport {LoaderOptions} from './../../loader-utils/src/types';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nconst TILESET_REGEX = /layers\\/[0-9]+$/;\nconst TILE_HEADER_REGEX = /nodes\\/([0-9-]+|root)$/;\nconst SLPK_HEX = '504b0304';\nconst POINT_CLOUD = 'PointCloud';\n\nexport type I3SLoaderOptions = LoaderOptions & {\n i3s?: I3SParseOptions;\n};\n\n/**\n * Loader for I3S - Indexed 3D Scene Layer\n */\nexport const I3SLoader: LoaderWithParser = {\n name: 'I3S (Indexed Scene Layers)',\n id: 'i3s',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/octet-stream'],\n parse: parseI3S,\n extensions: ['bin'],\n options: {\n i3s: {\n token: null,\n isTileset: 'auto',\n isTileHeader: 'auto',\n tile: null,\n tileset: null,\n _tileOptions: null,\n _tilesetOptions: null,\n useDracoGeometry: true,\n useCompressedTextures: true,\n decodeTextures: true,\n coordinateSystem: COORDINATE_SYSTEM.METER_OFFSETS,\n colorsByAttribute: null\n }\n }\n};\n\nasync function parseI3S(data, options: I3SLoaderOptions = {}, context) {\n const url = context.url;\n options.i3s = options.i3s || {};\n const magicNumber = getMagicNumber(data);\n\n // check if file is slpk\n if (magicNumber === SLPK_HEX) {\n throw new Error('Files with .slpk extention currently are not supported by I3SLoader');\n }\n\n // auto detect file type based on url\n let isTileset;\n if (options.i3s.isTileset === 'auto') {\n isTileset = TILESET_REGEX.test(url);\n } else {\n isTileset = options.i3s.isTileset;\n }\n\n let isTileHeader;\n if (options.isTileHeader === 'auto') {\n isTileHeader = TILE_HEADER_REGEX.test(url);\n } else {\n isTileHeader = options.i3s.isTileHeader;\n }\n\n if (isTileset) {\n data = await parseTileset(data, options, context);\n } else if (isTileHeader) {\n data = await parseTile(data, context);\n } else {\n data = await parseTileContent(data, options);\n }\n\n return data;\n}\n\nasync function parseTileContent(arrayBuffer, options: I3SLoaderOptions) {\n return await parse(arrayBuffer, I3SContentLoader, options);\n}\n\nasync function parseTileset(data, options: I3SLoaderOptions, context) {\n const tilesetJson = JSON.parse(new TextDecoder().decode(data));\n\n if (tilesetJson?.layerType === POINT_CLOUD) {\n throw new Error('Point Cloud layers currently are not supported by I3SLoader');\n }\n // eslint-disable-next-line no-use-before-define\n tilesetJson.loader = I3SLoader;\n await normalizeTilesetData(tilesetJson, options, context);\n\n return tilesetJson;\n}\n\nasync function parseTile(data, context) {\n data = JSON.parse(new TextDecoder().decode(data));\n return normalizeTileData(data, context);\n}\n\nfunction getMagicNumber(data) {\n if (data instanceof ArrayBuffer) {\n // slice binary data (4 bytes from the beginning) and transform it to hexadecimal numeral system\n return [...new Uint8Array(data, 0, 4)]\n .map((value) => value.toString(16).padStart(2, '0'))\n .join('');\n }\n return null;\n}\n"],"mappings":";;;;;;;;;;AACA;AACA;AACA;AACA;AAMA,IAAMA,OAAO,GAAG,sBAAkB,KAAK,WAAW,qBAAiB,QAAQ;AAE3E,IAAMC,aAAa,GAAG,iBAAiB;AACvC,IAAMC,iBAAiB,GAAG,wBAAwB;AAClD,IAAMC,QAAQ,GAAG,UAAU;AAC3B,IAAMC,WAAW,GAAG,YAAY;AASzB,IAAMC,SAA2B,GAAG;EACzCC,IAAI,EAAE,4BAA4B;EAClCC,EAAE,EAAE,KAAK;EACTC,MAAM,EAAE,KAAK;EACbC,OAAO,EAAET,OAAO;EAChBU,SAAS,EAAE,CAAC,0BAA0B,CAAC;EACvCC,KAAK,EAAEC,QAAQ;EACfC,UAAU,EAAE,CAAC,KAAK,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AAW;UAAA;UAAA;YAAA;QAAA;MAAA;IAAA;EAAA,CACnB;EAAA;AAAA;AAAA,SAEcJ,SAAS;EAAA;AAAA;AAAA;EAAA,uEAAxB,kBAAyBR,IAAI,EAAEC,OAAO;IAAA;MAAA;QAAA;UAAA;YACpCD,IAAI,GAAGa,IAAI,CAAChC,KAAK,CAAC,IAAIiC,WAAW,EAAE,CAACC,MAAM,CAACf,IAAI,CAAC,CAAC;YAAC,kCAC3C,IAAAmB,2BAAiB,EAACnB,IAAI,EAAEC,OAAO,CAAC;UAAA;UAAA;YAAA;QAAA;MAAA;IAAA;EAAA,CACxC;EAAA;AAAA;AAED,SAASG,cAAc,CAACJ,IAAI,EAAE;EAC5B,IAAIA,IAAI,YAAYoB,WAAW,EAAE;IAE/B,OAAO,iCAAI,IAAIC,UAAU,CAACrB,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,EAClCsB,GAAG,CAAC,UAACC,KAAK;MAAA,OAAKA,KAAK,CAACC,QAAQ,CAAC,EAAE,CAAC,CAACC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;IAAA,EAAC,CACnDC,IAAI,CAAC,EAAE,CAAC;EACb;EACA,OAAO,IAAI;AACb"}
|
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.I3SNodePageLoader = void 0;
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
|
-
var VERSION = typeof "3.
|
|
10
|
+
var VERSION = typeof "3.4.0-alpha.1" !== 'undefined' ? "3.4.0-alpha.1" : 'latest';
|
|
11
11
|
function parseNodePage(_x) {
|
|
12
12
|
return _parseNodePage.apply(this, arguments);
|
|
13
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i3s-node-page-loader.js","names":["VERSION","parseNodePage","data","JSON","parse","TextDecoder","decode","I3SNodePageLoader","name","id","module","version","mimeTypes","extensions","options"],"sources":["../../src/i3s-node-page-loader.ts"],"sourcesContent":["import type {LoaderWithParser} from '@loaders.gl/loader-utils';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nasync function parseNodePage(data) {\n return JSON.parse(new TextDecoder().decode(data));\n}\n\n/**\n * Loader for I3S node pages\n */\nexport const I3SNodePageLoader: LoaderWithParser = {\n name: 'I3S Node Page',\n id: 'i3s-node-page',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/json'],\n parse,\n extensions: ['json'],\n options: {}\n};\n\nasync function parse(data) {\n data = parseNodePage(data);\n return data;\n}\n"],"mappings":";;;;;;;;;AAIA,IAAMA,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"i3s-node-page-loader.js","names":["VERSION","parseNodePage","data","JSON","parse","TextDecoder","decode","I3SNodePageLoader","name","id","module","version","mimeTypes","extensions","options"],"sources":["../../src/i3s-node-page-loader.ts"],"sourcesContent":["import type {LoaderWithParser} from '@loaders.gl/loader-utils';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nasync function parseNodePage(data) {\n return JSON.parse(new TextDecoder().decode(data));\n}\n\n/**\n * Loader for I3S node pages\n */\nexport const I3SNodePageLoader: LoaderWithParser = {\n name: 'I3S Node Page',\n id: 'i3s-node-page',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/json'],\n parse,\n extensions: ['json'],\n options: {}\n};\n\nasync function parse(data) {\n data = parseNodePage(data);\n return data;\n}\n"],"mappings":";;;;;;;;;AAIA,IAAMA,OAAO,GAAG,sBAAkB,KAAK,WAAW,qBAAiB,QAAQ;AAAC,SAE7DC,aAAa;EAAA;AAAA;AAAA;EAAA,2EAA5B,iBAA6BC,IAAI;IAAA;MAAA;QAAA;UAAA;YAAA,iCACxBC,IAAI,CAACC,KAAK,CAAC,IAAIC,WAAW,EAAE,CAACC,MAAM,CAACJ,IAAI,CAAC,CAAC;UAAA;UAAA;YAAA;QAAA;MAAA;IAAA;EAAA,CAClD;EAAA;AAAA;AAKM,IAAMK,iBAAmC,GAAG;EACjDC,IAAI,EAAE,eAAe;EACrBC,EAAE,EAAE,eAAe;EACnBC,MAAM,EAAE,KAAK;EACbC,OAAO,EAAEX,OAAO;EAChBY,SAAS,EAAE,CAAC,kBAAkB,CAAC;EAC/BR,KAAK,EAALA,KAAK;EACLS,UAAU,EAAE,CAAC,MAAM,CAAC;EACpBC,OAAO,EAAE,CAAC;AACZ,CAAC;AAAC;AAAA,SAEaV,KAAK;EAAA;AAAA;AAAA;EAAA,mEAApB,kBAAqBF,IAAI;IAAA;MAAA;QAAA;UAAA;YACvBA,IAAI,GAAGD,aAAa,CAACC,IAAI,CAAC;YAAC,kCACpBA,IAAI;UAAA;UAAA;YAAA;QAAA;MAAA;IAAA;EAAA,CACZ;EAAA;AAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { parseWebscene } from './lib/parsers/parse-arcgis-webscene';
|
|
2
2
|
|
|
3
|
-
const VERSION = typeof "3.
|
|
3
|
+
const VERSION = typeof "3.4.0-alpha.1" !== 'undefined' ? "3.4.0-alpha.1" : 'beta';
|
|
4
4
|
|
|
5
5
|
export const ArcGisWebSceneLoader = {
|
|
6
6
|
name: 'ArcGIS Web Scene Loader',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arcgis-webscene-loader.js","names":["parseWebscene","VERSION","ArcGisWebSceneLoader","name","id","module","version","mimeTypes","parse","extensions","options","data"],"sources":["../../src/arcgis-webscene-loader.ts"],"sourcesContent":["import type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport type {ArcGisWebSceneData} from './types';\n\nimport {parseWebscene} from './lib/parsers/parse-arcgis-webscene';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'beta';\n\n/**\n * Loader for ArcGis WebScene\n * Spec - https://developers.arcgis.com/web-scene-specification/objects/webscene/\n */\nexport const ArcGisWebSceneLoader: LoaderWithParser = {\n name: 'ArcGIS Web Scene Loader',\n id: 'arcgis-web-scene',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/json'],\n parse,\n extensions: ['json'],\n options: {}\n};\n\n/**\n * Parse ArcGis webscene\n * @param data\n */\nasync function parse(data: ArrayBuffer): Promise<ArcGisWebSceneData> {\n return parseWebscene(data);\n}\n"],"mappings":"AAGA,SAAQA,aAAa,QAAO,qCAAqC;;AAIjE,MAAMC,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"arcgis-webscene-loader.js","names":["parseWebscene","VERSION","ArcGisWebSceneLoader","name","id","module","version","mimeTypes","parse","extensions","options","data"],"sources":["../../src/arcgis-webscene-loader.ts"],"sourcesContent":["import type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport type {ArcGisWebSceneData} from './types';\n\nimport {parseWebscene} from './lib/parsers/parse-arcgis-webscene';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'beta';\n\n/**\n * Loader for ArcGis WebScene\n * Spec - https://developers.arcgis.com/web-scene-specification/objects/webscene/\n */\nexport const ArcGisWebSceneLoader: LoaderWithParser = {\n name: 'ArcGIS Web Scene Loader',\n id: 'arcgis-web-scene',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/json'],\n parse,\n extensions: ['json'],\n options: {}\n};\n\n/**\n * Parse ArcGis webscene\n * @param data\n */\nasync function parse(data: ArrayBuffer): Promise<ArcGisWebSceneData> {\n return parseWebscene(data);\n}\n"],"mappings":"AAGA,SAAQA,aAAa,QAAO,qCAAqC;;AAIjE,MAAMC,OAAO,GAAG,sBAAkB,KAAK,WAAW,qBAAiB,MAAM;;AAMzE,OAAO,MAAMC,oBAAsC,GAAG;EACpDC,IAAI,EAAE,yBAAyB;EAC/BC,EAAE,EAAE,kBAAkB;EACtBC,MAAM,EAAE,KAAK;EACbC,OAAO,EAAEL,OAAO;EAChBM,SAAS,EAAE,CAAC,kBAAkB,CAAC;EAC/BC,KAAK;EACLC,UAAU,EAAE,CAAC,MAAM,CAAC;EACpBC,OAAO,EAAE,CAAC;AACZ,CAAC;;AAMD,eAAeF,KAAK,CAACG,IAAiB,EAA+B;EACnE,OAAOX,aAAa,CAACW,IAAI,CAAC;AAC5B"}
|
|
@@ -2,7 +2,7 @@ import { load } from '@loaders.gl/core';
|
|
|
2
2
|
import { parseI3STileAttribute } from './lib/parsers/parse-i3s-attribute';
|
|
3
3
|
import { getUrlWithToken } from './lib/utils/url-utils';
|
|
4
4
|
|
|
5
|
-
const VERSION = typeof "3.
|
|
5
|
+
const VERSION = typeof "3.4.0-alpha.1" !== 'undefined' ? "3.4.0-alpha.1" : 'latest';
|
|
6
6
|
const EMPTY_VALUE = '';
|
|
7
7
|
const REJECTED_STATUS = 'rejected';
|
|
8
8
|
export const I3SAttributeLoader = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i3s-attribute-loader.js","names":["load","parseI3STileAttribute","getUrlWithToken","VERSION","EMPTY_VALUE","REJECTED_STATUS","I3SAttributeLoader","name","id","module","version","mimeTypes","parse","extensions","options","binary","data","loadFeatureAttributes","tile","featureId","attributeStorageInfo","attributeUrls","tilesetFields","getAttributesData","attributes","attributeLoadPromises","index","length","url","i3s","token","attributeName","attributeType","getAttributeValueType","loadOptions","promise","push","Promise","allSettled","error","generateAttributesByFeatureId","tileset","header","fields","attribute","hasOwnProperty","attributeValues","valueType","getFeatureIdsAttributeName","objectIdsAttribute","find","includes","objectIdsAttributeName","objectIds","value","attributeIndex","indexOf","getFeatureAttributesByIndex","featureIdIndex","attributesObject","codedValues","getAttributeCodedValues","getAttributeByIndexAndAttributeName","formatAttributeValue","attributeField","field","alias","domain","attributesName","attributeObject","status","String","replace","trim","codeValue","codedValue","code","Number"],"sources":["../../src/i3s-attribute-loader.ts"],"sourcesContent":["import type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {load} from '@loaders.gl/core';\nimport {parseI3STileAttribute} from './lib/parsers/parse-i3s-attribute';\nimport {getUrlWithToken} from './lib/utils/url-utils';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\nconst EMPTY_VALUE = '';\nconst REJECTED_STATUS = 'rejected';\n/**\n * Loader for I3S attributes\n */\nexport const I3SAttributeLoader: LoaderWithParser = {\n name: 'I3S Attribute',\n id: 'i3s-attribute',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/binary'],\n parse,\n extensions: ['bin'],\n options: {},\n binary: true\n};\n\nasync function parse(data, options) {\n data = parseI3STileAttribute(data, options);\n return data;\n}\n\n/**\n * Load attributes based on feature id\n * @param {Object} tile\n * @param {number} featureId\n * @param {Object} options\n * @returns {Promise}\n */\n// eslint-disable-next-line complexity\nexport async function loadFeatureAttributes(tile, featureId, options = {}) {\n const {attributeStorageInfo, attributeUrls, tilesetFields} = getAttributesData(tile);\n\n if (!attributeStorageInfo || !attributeUrls || featureId < 0) {\n return null;\n }\n\n let attributes: object[] = [];\n const attributeLoadPromises: Promise<object>[] = [];\n\n for (let index = 0; index < attributeStorageInfo.length; index++) {\n // @ts-ignore\n const url = getUrlWithToken(attributeUrls[index], options.i3s?.token);\n const attributeName = attributeStorageInfo[index].name;\n const attributeType = getAttributeValueType(attributeStorageInfo[index]);\n const loadOptions = {...options, attributeName, attributeType};\n const promise = load(url, I3SAttributeLoader, loadOptions);\n\n attributeLoadPromises.push(promise);\n }\n try {\n attributes = await Promise.allSettled(attributeLoadPromises);\n } catch (error) {\n // do nothing\n }\n\n if (!attributes.length) {\n return null;\n }\n\n return generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields);\n}\n\n/**\n * Gets attributes data from tile.\n * @param tile \n * @returns \n */\nfunction getAttributesData(tile) {\n const attributeStorageInfo = tile.tileset?.tileset?.attributeStorageInfo;\n const attributeUrls = tile.header?.attributeUrls;\n const tilesetFields = tile.tileset?.tileset?.fields || [];\n\n return {attributeStorageInfo, attributeUrls, tilesetFields};\n}\n\n/**\n * Get attribute value type based on property names\n * @param {Object} attribute\n * @returns {String}\n */\nexport function getAttributeValueType(attribute) {\n if (attribute.hasOwnProperty('objectIds')) {\n return 'Oid32';\n } else if (attribute.hasOwnProperty('attributeValues')) {\n return attribute.attributeValues.valueType;\n }\n return '';\n}\n\n/**\n * Find in attributeStorageInfo attribute name responsible for feature ids list.\n * @param attributeStorageInfo \n * @returns Feature ids attribute name\n */\nfunction getFeatureIdsAttributeName(attributeStorageInfo) {\n const objectIdsAttribute = attributeStorageInfo.find(attribute => attribute.name.includes('OBJECTID'));\n\n return objectIdsAttribute?.name;\n}\n\n/**\n * Generates mapping featureId to feature attributes\n * @param {Array} attributes\n * @param {Object} attributeStorageInfo\n * @param {number} featureId\n * @returns {Object}\n */\nfunction generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields) {\n const objectIdsAttributeName = getFeatureIdsAttributeName(attributeStorageInfo);\n const objectIds = attributes.find((attribute) => attribute.value[objectIdsAttributeName]);\n\n if (!objectIds) {\n return null;\n }\n\n const attributeIndex = objectIds.value[objectIdsAttributeName].indexOf(featureId);\n\n if (attributeIndex < 0) {\n return null;\n }\n\n return getFeatureAttributesByIndex(attributes, attributeIndex, attributeStorageInfo, tilesetFields);\n}\n\n/**\n * Generates attribute object for feature mapping by feature id\n * @param {Array} attributes\n * @param {Number} featureIdIndex\n * @param {Object} attributeStorageInfo\n * @returns {Object}\n */\nfunction getFeatureAttributesByIndex(attributes, featureIdIndex, attributeStorageInfo, tilesetFields) {\n const attributesObject = {};\n\n for (let index = 0; index < attributeStorageInfo.length; index++) {\n const attributeName = attributeStorageInfo[index].name;\n const codedValues = getAttributeCodedValues(attributeName, tilesetFields);\n const attribute = getAttributeByIndexAndAttributeName(attributes, index, attributeName);\n attributesObject[attributeName] = formatAttributeValue(attribute, featureIdIndex, codedValues);\n }\n\n return attributesObject;\n}\n\n/**\n * Get coded values list from tileset.\n * @param attributeName \n * @param tilesetFields \n */\nfunction getAttributeCodedValues(attributeName, tilesetFields) {\n const attributeField = tilesetFields\n .find(field => field.name === attributeName || field.alias === attributeName);\n\n return attributeField?.domain?.codedValues || [];\n}\n\n/**\n * Return attribute value if it presents in atrributes list\n * @param {array} attributes\n * @param {number} index\n * @param {string} attributesName\n */\nfunction getAttributeByIndexAndAttributeName(attributes, index, attributesName) {\n const attributeObject = attributes[index];\n\n if (attributeObject.status === REJECTED_STATUS) {\n return null;\n }\n\n return attributeObject.value[attributesName];\n}\n\n/**\n * Do formatting of attribute values or return empty string.\n * @param {Array} attribute\n * @param {Number} featureIdIndex\n * @returns {String}\n */\nfunction formatAttributeValue(attribute, featureIdIndex, codedValues) {\n let value = EMPTY_VALUE;\n\n if (attribute && (featureIdIndex in attribute)) {\n // eslint-disable-next-line no-control-regex\n value = String(attribute[featureIdIndex]).replace(/\\u0000|NaN/g, '').trim();\n }\n\n // Check if coded values are existed. If so we use them.\n if (codedValues.length) {\n const codeValue = codedValues.find(codedValue => codedValue.code === Number(value));\n value = codeValue?.name || EMPTY_VALUE;\n }\n\n return value;\n}\n"],"mappings":"AACA,SAAQA,IAAI,QAAO,kBAAkB;AACrC,SAAQC,qBAAqB,QAAO,mCAAmC;AACvE,SAAQC,eAAe,QAAO,uBAAuB;;AAIrD,MAAMC,OAAO,GAAG,cAAkB,KAAK,WAAW,aAAiB,QAAQ;AAC3E,MAAMC,WAAW,GAAG,EAAE;AACtB,MAAMC,eAAe,GAAG,U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","EMPTY_VALUE","REJECTED_STATUS","I3SAttributeLoader","name","id","module","version","mimeTypes","parse","extensions","options","binary","data","loadFeatureAttributes","tile","featureId","attributeStorageInfo","attributeUrls","tilesetFields","getAttributesData","attributes","attributeLoadPromises","index","length","url","i3s","token","attributeName","attributeType","getAttributeValueType","loadOptions","promise","push","Promise","allSettled","error","generateAttributesByFeatureId","tileset","header","fields","attribute","hasOwnProperty","attributeValues","valueType","getFeatureIdsAttributeName","objectIdsAttribute","find","includes","objectIdsAttributeName","objectIds","value","attributeIndex","indexOf","getFeatureAttributesByIndex","featureIdIndex","attributesObject","codedValues","getAttributeCodedValues","getAttributeByIndexAndAttributeName","formatAttributeValue","attributeField","field","alias","domain","attributesName","attributeObject","status","String","replace","trim","codeValue","codedValue","code","Number"],"sources":["../../src/i3s-attribute-loader.ts"],"sourcesContent":["import type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {load} from '@loaders.gl/core';\nimport {parseI3STileAttribute} from './lib/parsers/parse-i3s-attribute';\nimport {getUrlWithToken} from './lib/utils/url-utils';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\nconst EMPTY_VALUE = '';\nconst REJECTED_STATUS = 'rejected';\n/**\n * Loader for I3S attributes\n */\nexport const I3SAttributeLoader: LoaderWithParser = {\n name: 'I3S Attribute',\n id: 'i3s-attribute',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/binary'],\n parse,\n extensions: ['bin'],\n options: {},\n binary: true\n};\n\nasync function parse(data, options) {\n data = parseI3STileAttribute(data, options);\n return data;\n}\n\n/**\n * Load attributes based on feature id\n * @param {Object} tile\n * @param {number} featureId\n * @param {Object} options\n * @returns {Promise}\n */\n// eslint-disable-next-line complexity\nexport async function loadFeatureAttributes(tile, featureId, options = {}) {\n const {attributeStorageInfo, attributeUrls, tilesetFields} = getAttributesData(tile);\n\n if (!attributeStorageInfo || !attributeUrls || featureId < 0) {\n return null;\n }\n\n let attributes: object[] = [];\n const attributeLoadPromises: Promise<object>[] = [];\n\n for (let index = 0; index < attributeStorageInfo.length; index++) {\n // @ts-ignore\n const url = getUrlWithToken(attributeUrls[index], options.i3s?.token);\n const attributeName = attributeStorageInfo[index].name;\n const attributeType = getAttributeValueType(attributeStorageInfo[index]);\n const loadOptions = {...options, attributeName, attributeType};\n const promise = load(url, I3SAttributeLoader, loadOptions);\n\n attributeLoadPromises.push(promise);\n }\n try {\n attributes = await Promise.allSettled(attributeLoadPromises);\n } catch (error) {\n // do nothing\n }\n\n if (!attributes.length) {\n return null;\n }\n\n return generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields);\n}\n\n/**\n * Gets attributes data from tile.\n * @param tile \n * @returns \n */\nfunction getAttributesData(tile) {\n const attributeStorageInfo = tile.tileset?.tileset?.attributeStorageInfo;\n const attributeUrls = tile.header?.attributeUrls;\n const tilesetFields = tile.tileset?.tileset?.fields || [];\n\n return {attributeStorageInfo, attributeUrls, tilesetFields};\n}\n\n/**\n * Get attribute value type based on property names\n * @param {Object} attribute\n * @returns {String}\n */\nexport function getAttributeValueType(attribute) {\n if (attribute.hasOwnProperty('objectIds')) {\n return 'Oid32';\n } else if (attribute.hasOwnProperty('attributeValues')) {\n return attribute.attributeValues.valueType;\n }\n return '';\n}\n\n/**\n * Find in attributeStorageInfo attribute name responsible for feature ids list.\n * @param attributeStorageInfo \n * @returns Feature ids attribute name\n */\nfunction getFeatureIdsAttributeName(attributeStorageInfo) {\n const objectIdsAttribute = attributeStorageInfo.find(attribute => attribute.name.includes('OBJECTID'));\n\n return objectIdsAttribute?.name;\n}\n\n/**\n * Generates mapping featureId to feature attributes\n * @param {Array} attributes\n * @param {Object} attributeStorageInfo\n * @param {number} featureId\n * @returns {Object}\n */\nfunction generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields) {\n const objectIdsAttributeName = getFeatureIdsAttributeName(attributeStorageInfo);\n const objectIds = attributes.find((attribute) => attribute.value[objectIdsAttributeName]);\n\n if (!objectIds) {\n return null;\n }\n\n const attributeIndex = objectIds.value[objectIdsAttributeName].indexOf(featureId);\n\n if (attributeIndex < 0) {\n return null;\n }\n\n return getFeatureAttributesByIndex(attributes, attributeIndex, attributeStorageInfo, tilesetFields);\n}\n\n/**\n * Generates attribute object for feature mapping by feature id\n * @param {Array} attributes\n * @param {Number} featureIdIndex\n * @param {Object} attributeStorageInfo\n * @returns {Object}\n */\nfunction getFeatureAttributesByIndex(attributes, featureIdIndex, attributeStorageInfo, tilesetFields) {\n const attributesObject = {};\n\n for (let index = 0; index < attributeStorageInfo.length; index++) {\n const attributeName = attributeStorageInfo[index].name;\n const codedValues = getAttributeCodedValues(attributeName, tilesetFields);\n const attribute = getAttributeByIndexAndAttributeName(attributes, index, attributeName);\n attributesObject[attributeName] = formatAttributeValue(attribute, featureIdIndex, codedValues);\n }\n\n return attributesObject;\n}\n\n/**\n * Get coded values list from tileset.\n * @param attributeName \n * @param tilesetFields \n */\nfunction getAttributeCodedValues(attributeName, tilesetFields) {\n const attributeField = tilesetFields\n .find(field => field.name === attributeName || field.alias === attributeName);\n\n return attributeField?.domain?.codedValues || [];\n}\n\n/**\n * Return attribute value if it presents in atrributes list\n * @param {array} attributes\n * @param {number} index\n * @param {string} attributesName\n */\nfunction getAttributeByIndexAndAttributeName(attributes, index, attributesName) {\n const attributeObject = attributes[index];\n\n if (attributeObject.status === REJECTED_STATUS) {\n return null;\n }\n\n return attributeObject.value[attributesName];\n}\n\n/**\n * Do formatting of attribute values or return empty string.\n * @param {Array} attribute\n * @param {Number} featureIdIndex\n * @returns {String}\n */\nfunction formatAttributeValue(attribute, featureIdIndex, codedValues) {\n let value = EMPTY_VALUE;\n\n if (attribute && (featureIdIndex in attribute)) {\n // eslint-disable-next-line no-control-regex\n value = String(attribute[featureIdIndex]).replace(/\\u0000|NaN/g, '').trim();\n }\n\n // Check if coded values are existed. If so we use them.\n if (codedValues.length) {\n const codeValue = codedValues.find(codedValue => codedValue.code === Number(value));\n value = codeValue?.name || EMPTY_VALUE;\n }\n\n return value;\n}\n"],"mappings":"AACA,SAAQA,IAAI,QAAO,kBAAkB;AACrC,SAAQC,qBAAqB,QAAO,mCAAmC;AACvE,SAAQC,eAAe,QAAO,uBAAuB;;AAIrD,MAAMC,OAAO,GAAG,sBAAkB,KAAK,WAAW,qBAAiB,QAAQ;AAC3E,MAAMC,WAAW,GAAG,EAAE;AACtB,MAAMC,eAAe,GAAG,UAAU;AAIlC,OAAO,MAAMC,kBAAoC,GAAG;EAClDC,IAAI,EAAE,eAAe;EACrBC,EAAE,EAAE,eAAe;EACnBC,MAAM,EAAE,KAAK;EACbC,OAAO,EAAEP,OAAO;EAChBQ,SAAS,EAAE,CAAC,oBAAoB,CAAC;EACjCC,KAAK;EACLC,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,OAAO,EAAE,CAAC,CAAC;EACXC,MAAM,EAAE;AACV,CAAC;AAED,eAAeH,KAAK,CAACI,IAAI,EAAEF,OAAO,EAAE;EAClCE,IAAI,GAAGf,qBAAqB,CAACe,IAAI,EAAEF,OAAO,CAAC;EAC3C,OAAOE,IAAI;AACb;;AAUA,OAAO,eAAeC,qBAAqB,CAACC,IAAI,EAAEC,SAAS,EAAgB;EAAA,IAAdL,OAAO,uEAAG,CAAC,CAAC;EACvE,MAAM;IAACM,oBAAoB;IAAEC,aAAa;IAAEC;EAAa,CAAC,GAAGC,iBAAiB,CAACL,IAAI,CAAC;EAEpF,IAAI,CAACE,oBAAoB,IAAI,CAACC,aAAa,IAAIF,SAAS,GAAG,CAAC,EAAE;IAC5D,OAAO,IAAI;EACb;EAEA,IAAIK,UAAoB,GAAG,EAAE;EAC7B,MAAMC,qBAAwC,GAAG,EAAE;EAEnD,KAAK,IAAIC,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAGN,oBAAoB,CAACO,MAAM,EAAED,KAAK,EAAE,EAAE;IAAA;IA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jC,MAAM,EAAE;IACtB,MAAM+C,SAAS,GAAGd,WAAW,CAACV,IAAI,CAACyB,UAAU,IAAIA,UAAU,CAACC,IAAI,KAAKC,MAAM,CAACvB,KAAK,CAAC,CAAC;IACnFA,KAAK,GAAG,CAAAoB,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAEnE,IAAI,KAAIH,WAAW;EACxC;EAEA,OAAOkD,KAAK;AACd"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { parseBuildingSceneLayer } from './lib/parsers/parse-i3s-building-scene-layer';
|
|
2
2
|
|
|
3
|
-
const VERSION = typeof "3.
|
|
3
|
+
const VERSION = typeof "3.4.0-alpha.1" !== 'undefined' ? "3.4.0-alpha.1" : 'beta';
|
|
4
4
|
export const I3SBuildingSceneLayerLoader = {
|
|
5
5
|
name: 'I3S Building Scene Layer',
|
|
6
6
|
id: 'i3s-building-scene-layer',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i3s-building-scene-layer-loader.js","names":["parseBuildingSceneLayer","VERSION","I3SBuildingSceneLayerLoader","name","id","module","version","mimeTypes","parse","extensions","options","data","context","url","Error"],"sources":["../../src/i3s-building-scene-layer-loader.ts"],"sourcesContent":["import type {LoaderWithParser, LoaderOptions, LoaderContext} from '@loaders.gl/loader-utils';\nimport type {BuildingSceneLayerTileset} from './types';\n\nimport {parseBuildingSceneLayer} from './lib/parsers/parse-i3s-building-scene-layer';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\n\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'beta';\n/**\n * Loader for I3S - Building Scene Layer\n */\nexport const I3SBuildingSceneLayerLoader: LoaderWithParser = {\n name: 'I3S Building Scene Layer',\n id: 'i3s-building-scene-layer',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/json'],\n parse,\n extensions: ['json'],\n options: {}\n};\n\nasync function parse(\n data: ArrayBuffer,\n options?: LoaderOptions,\n context?: LoaderContext\n): Promise<BuildingSceneLayerTileset> {\n if (!context?.url) {\n throw new Error('Url is not provided');\n }\n\n return parseBuildingSceneLayer(data, context.url);\n}\n"],"mappings":"AAGA,SAAQA,uBAAuB,QAAO,8CAA8C;;AAKpF,MAAMC,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"i3s-building-scene-layer-loader.js","names":["parseBuildingSceneLayer","VERSION","I3SBuildingSceneLayerLoader","name","id","module","version","mimeTypes","parse","extensions","options","data","context","url","Error"],"sources":["../../src/i3s-building-scene-layer-loader.ts"],"sourcesContent":["import type {LoaderWithParser, LoaderOptions, LoaderContext} from '@loaders.gl/loader-utils';\nimport type {BuildingSceneLayerTileset} from './types';\n\nimport {parseBuildingSceneLayer} from './lib/parsers/parse-i3s-building-scene-layer';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\n\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'beta';\n/**\n * Loader for I3S - Building Scene Layer\n */\nexport const I3SBuildingSceneLayerLoader: LoaderWithParser = {\n name: 'I3S Building Scene Layer',\n id: 'i3s-building-scene-layer',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/json'],\n parse,\n extensions: ['json'],\n options: {}\n};\n\nasync function parse(\n data: ArrayBuffer,\n options?: LoaderOptions,\n context?: LoaderContext\n): Promise<BuildingSceneLayerTileset> {\n if (!context?.url) {\n throw new Error('Url is not provided');\n }\n\n return parseBuildingSceneLayer(data, context.url);\n}\n"],"mappings":"AAGA,SAAQA,uBAAuB,QAAO,8CAA8C;;AAKpF,MAAMC,OAAO,GAAG,sBAAkB,KAAK,WAAW,qBAAiB,MAAM;AAIzE,OAAO,MAAMC,2BAA6C,GAAG;EAC3DC,IAAI,EAAE,0BAA0B;EAChCC,EAAE,EAAE,0BAA0B;EAC9BC,MAAM,EAAE,KAAK;EACbC,OAAO,EAAEL,OAAO;EAChBM,SAAS,EAAE,CAAC,kBAAkB,CAAC;EAC/BC,KAAK;EACLC,UAAU,EAAE,CAAC,MAAM,CAAC;EACpBC,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,eAAeF,KAAK,CAClBG,IAAiB,EACjBD,OAAuB,EACvBE,OAAuB,EACa;EACpC,IAAI,EAACA,OAAO,aAAPA,OAAO,eAAPA,OAAO,CAAEC,GAAG,GAAE;IACjB,MAAM,IAAIC,KAAK,CAAC,qBAAqB,CAAC;EACxC;EAEA,OAAOd,uBAAuB,CAACW,IAAI,EAAEC,OAAO,CAACC,GAAG,CAAC;AACnD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isBrowser } from '@loaders.gl/worker-utils';
|
|
2
2
|
import { parseI3STileContent } from './lib/parsers/parse-i3s-tile-content';
|
|
3
3
|
|
|
4
|
-
const VERSION = typeof "3.
|
|
4
|
+
const VERSION = typeof "3.4.0-alpha.1" !== 'undefined' ? "3.4.0-alpha.1" : 'beta';
|
|
5
5
|
export const I3SContentLoader = {
|
|
6
6
|
name: 'I3S Content (Indexed Scene Layers)',
|
|
7
7
|
id: isBrowser ? 'i3s-content' : 'i3s-content-nodejs',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i3s-content-loader.js","names":["isBrowser","parseI3STileContent","VERSION","I3SContentLoader","name","id","module","worker","version","mimeTypes","parse","extensions","options","data","context","tile","_tileOptions","tileset","_tilesetOptions","i3s","tileOptions","tilesetOptions"],"sources":["../../src/i3s-content-loader.ts"],"sourcesContent":["import {isBrowser} from '@loaders.gl/worker-utils';\nimport type {LoaderWithParser, LoaderContext} from '@loaders.gl/loader-utils';\nimport type {I3SLoaderOptions} from './i3s-loader';\nimport {parseI3STileContent} from './lib/parsers/parse-i3s-tile-content';\nimport {I3STileOptions, I3STilesetOptions} from './types';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\n\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'beta';\n/**\n * Loader for I3S - Indexed 3D Scene Layer\n */\nexport const I3SContentLoader: LoaderWithParser = {\n name: 'I3S Content (Indexed Scene Layers)',\n id: isBrowser ? 'i3s-content' : 'i3s-content-nodejs',\n module: 'i3s',\n worker: true,\n version: VERSION,\n mimeTypes: ['application/octet-stream'],\n parse,\n extensions: ['bin'],\n options: {\n 'i3s-content': {}\n }\n};\n\nasync function parse(data, options?: I3SLoaderOptions, context?: LoaderContext) {\n const {tile, _tileOptions, tileset, _tilesetOptions} = options?.i3s || {};\n const tileOptions = _tileOptions || tile;\n const tilesetOptions = _tilesetOptions || tileset;\n if (!tileOptions || !tilesetOptions) {\n return null;\n }\n return await parseI3STileContent(\n data,\n tileOptions as I3STileOptions,\n tilesetOptions as I3STilesetOptions,\n options,\n context\n );\n}\n"],"mappings":"AAAA,SAAQA,SAAS,QAAO,0BAA0B;AAGlD,SAAQC,mBAAmB,QAAO,sCAAsC;;AAMxE,MAAMC,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"i3s-content-loader.js","names":["isBrowser","parseI3STileContent","VERSION","I3SContentLoader","name","id","module","worker","version","mimeTypes","parse","extensions","options","data","context","tile","_tileOptions","tileset","_tilesetOptions","i3s","tileOptions","tilesetOptions"],"sources":["../../src/i3s-content-loader.ts"],"sourcesContent":["import {isBrowser} from '@loaders.gl/worker-utils';\nimport type {LoaderWithParser, LoaderContext} from '@loaders.gl/loader-utils';\nimport type {I3SLoaderOptions} from './i3s-loader';\nimport {parseI3STileContent} from './lib/parsers/parse-i3s-tile-content';\nimport {I3STileOptions, I3STilesetOptions} from './types';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\n\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'beta';\n/**\n * Loader for I3S - Indexed 3D Scene Layer\n */\nexport const I3SContentLoader: LoaderWithParser = {\n name: 'I3S Content (Indexed Scene Layers)',\n id: isBrowser ? 'i3s-content' : 'i3s-content-nodejs',\n module: 'i3s',\n worker: true,\n version: VERSION,\n mimeTypes: ['application/octet-stream'],\n parse,\n extensions: ['bin'],\n options: {\n 'i3s-content': {}\n }\n};\n\nasync function parse(data, options?: I3SLoaderOptions, context?: LoaderContext) {\n const {tile, _tileOptions, tileset, _tilesetOptions} = options?.i3s || {};\n const tileOptions = _tileOptions || tile;\n const tilesetOptions = _tilesetOptions || tileset;\n if (!tileOptions || !tilesetOptions) {\n return null;\n }\n return await parseI3STileContent(\n data,\n tileOptions as I3STileOptions,\n tilesetOptions as I3STilesetOptions,\n options,\n context\n );\n}\n"],"mappings":"AAAA,SAAQA,SAAS,QAAO,0BAA0B;AAGlD,SAAQC,mBAAmB,QAAO,sCAAsC;;AAMxE,MAAMC,OAAO,GAAG,sBAAkB,KAAK,WAAW,qBAAiB,MAAM;AAIzE,OAAO,MAAMC,gBAAkC,GAAG;EAChDC,IAAI,EAAE,oCAAoC;EAC1CC,EAAE,EAAEL,SAAS,GAAG,aAAa,GAAG,oBAAoB;EACpDM,MAAM,EAAE,KAAK;EACbC,MAAM,EAAE,IAAI;EACZC,OAAO,EAAEN,OAAO;EAChBO,SAAS,EAAE,CAAC,0BAA0B,CAAC;EACvCC,KAAK;EACLC,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,OAAO,EAAE;IACP,aAAa,EAAE,CAAC;EAClB;AACF,CAAC;AAED,eAAeF,KAAK,CAACG,IAAI,EAAED,OAA0B,EAAEE,OAAuB,EAAE;EAC9E,MAAM;IAACC,IAAI;IAAEC,YAAY;IAAEC,OAAO;IAAEC;EAAe,CAAC,GAAG,CAAAN,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEO,GAAG,KAAI,CAAC,CAAC;EACzE,MAAMC,WAAW,GAAGJ,YAAY,IAAID,IAAI;EACxC,MAAMM,cAAc,GAAGH,eAAe,IAAID,OAAO;EACjD,IAAI,CAACG,WAAW,IAAI,CAACC,cAAc,EAAE;IACnC,OAAO,IAAI;EACb;EACA,OAAO,MAAMpB,mBAAmB,CAC9BY,IAAI,EACJO,WAAW,EACXC,cAAc,EACdT,OAAO,EACPE,OAAO,CACR;AACH"}
|
package/dist/esm/i3s-loader.js
CHANGED
|
@@ -2,7 +2,7 @@ import { parse } from '@loaders.gl/core';
|
|
|
2
2
|
import { I3SContentLoader } from './i3s-content-loader';
|
|
3
3
|
import { normalizeTileData, normalizeTilesetData } from './lib/parsers/parse-i3s';
|
|
4
4
|
import { COORDINATE_SYSTEM } from './lib/parsers/constants';
|
|
5
|
-
const VERSION = typeof "3.
|
|
5
|
+
const VERSION = typeof "3.4.0-alpha.1" !== 'undefined' ? "3.4.0-alpha.1" : 'latest';
|
|
6
6
|
const TILESET_REGEX = /layers\/[0-9]+$/;
|
|
7
7
|
const TILE_HEADER_REGEX = /nodes\/([0-9-]+|root)$/;
|
|
8
8
|
const SLPK_HEX = '504b0304';
|