@loaders.gl/i3s 4.2.0-alpha.4 → 4.2.0-alpha.5

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.
Files changed (86) hide show
  1. package/dist/arcgis-webscene-loader.d.ts +1 -1
  2. package/dist/arcgis-webscene-loader.d.ts.map +1 -1
  3. package/dist/arcgis-webscene-loader.js +19 -10
  4. package/dist/dist.dev.js +1244 -731
  5. package/dist/dist.min.js +9 -0
  6. package/dist/i3s-attribute-loader.d.ts +2 -2
  7. package/dist/i3s-attribute-loader.d.ts.map +1 -1
  8. package/dist/i3s-attribute-loader.js +145 -94
  9. package/dist/i3s-building-scene-layer-loader.d.ts +2 -2
  10. package/dist/i3s-building-scene-layer-loader.d.ts.map +1 -1
  11. package/dist/i3s-building-scene-layer-loader.js +17 -13
  12. package/dist/i3s-content-loader.d.ts +2 -2
  13. package/dist/i3s-content-loader.d.ts.map +1 -1
  14. package/dist/i3s-content-loader.js +23 -24
  15. package/dist/i3s-content-worker-node.js +1 -1
  16. package/dist/i3s-content-worker-node.js.map +2 -2
  17. package/dist/i3s-content-worker.js +3 -1
  18. package/dist/i3s-loader.d.ts +2 -2
  19. package/dist/i3s-loader.d.ts.map +1 -1
  20. package/dist/i3s-loader.js +76 -65
  21. package/dist/i3s-node-page-loader.d.ts +2 -2
  22. package/dist/i3s-node-page-loader.d.ts.map +1 -1
  23. package/dist/i3s-node-page-loader.js +16 -12
  24. package/dist/i3s-slpk-loader.js +18 -14
  25. package/dist/index.cjs +73 -138
  26. package/dist/index.cjs.map +7 -0
  27. package/dist/index.d.ts +14 -14
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +3 -1
  30. package/dist/lib/helpers/i3s-nodepages-tiles.d.ts +1 -1
  31. package/dist/lib/helpers/i3s-nodepages-tiles.d.ts.map +1 -1
  32. package/dist/lib/helpers/i3s-nodepages-tiles.js +226 -184
  33. package/dist/lib/parsers/constants.js +72 -45
  34. package/dist/lib/parsers/parse-arcgis-webscene.d.ts +1 -1
  35. package/dist/lib/parsers/parse-arcgis-webscene.d.ts.map +1 -1
  36. package/dist/lib/parsers/parse-arcgis-webscene.js +79 -59
  37. package/dist/lib/parsers/parse-i3s-attribute.js +83 -46
  38. package/dist/lib/parsers/parse-i3s-building-scene-layer.d.ts +1 -1
  39. package/dist/lib/parsers/parse-i3s-building-scene-layer.d.ts.map +1 -1
  40. package/dist/lib/parsers/parse-i3s-building-scene-layer.js +36 -33
  41. package/dist/lib/parsers/parse-i3s-tile-content.d.ts +1 -1
  42. package/dist/lib/parsers/parse-i3s-tile-content.d.ts.map +1 -1
  43. package/dist/lib/parsers/parse-i3s-tile-content.js +460 -394
  44. package/dist/lib/parsers/parse-i3s.d.ts +1 -1
  45. package/dist/lib/parsers/parse-i3s.d.ts.map +1 -1
  46. package/dist/lib/parsers/parse-i3s.js +84 -81
  47. package/dist/lib/parsers/parse-slpk/parse-slpk.d.ts +1 -1
  48. package/dist/lib/parsers/parse-slpk/parse-slpk.d.ts.map +1 -1
  49. package/dist/lib/parsers/parse-slpk/parse-slpk.js +23 -16
  50. package/dist/lib/parsers/parse-slpk/slpk-archieve.js +132 -97
  51. package/dist/lib/utils/convert-i3s-obb-to-mbs.js +12 -5
  52. package/dist/lib/utils/customize-colors.d.ts +1 -1
  53. package/dist/lib/utils/customize-colors.d.ts.map +1 -1
  54. package/dist/lib/utils/customize-colors.js +95 -81
  55. package/dist/lib/utils/url-utils.d.ts +1 -1
  56. package/dist/lib/utils/url-utils.d.ts.map +1 -1
  57. package/dist/lib/utils/url-utils.js +48 -28
  58. package/dist/types.d.ts +1 -1
  59. package/dist/types.d.ts.map +1 -1
  60. package/dist/types.js +5 -6
  61. package/dist/workers/i3s-content-worker-node.js +1 -1
  62. package/dist/workers/i3s-content-worker.js +0 -1
  63. package/package.json +13 -12
  64. package/dist/arcgis-webscene-loader.js.map +0 -1
  65. package/dist/i3s-attribute-loader.js.map +0 -1
  66. package/dist/i3s-building-scene-layer-loader.js.map +0 -1
  67. package/dist/i3s-content-loader.js.map +0 -1
  68. package/dist/i3s-loader.js.map +0 -1
  69. package/dist/i3s-node-page-loader.js.map +0 -1
  70. package/dist/i3s-slpk-loader.js.map +0 -1
  71. package/dist/index.js.map +0 -1
  72. package/dist/lib/helpers/i3s-nodepages-tiles.js.map +0 -1
  73. package/dist/lib/parsers/constants.js.map +0 -1
  74. package/dist/lib/parsers/parse-arcgis-webscene.js.map +0 -1
  75. package/dist/lib/parsers/parse-i3s-attribute.js.map +0 -1
  76. package/dist/lib/parsers/parse-i3s-building-scene-layer.js.map +0 -1
  77. package/dist/lib/parsers/parse-i3s-tile-content.js.map +0 -1
  78. package/dist/lib/parsers/parse-i3s.js.map +0 -1
  79. package/dist/lib/parsers/parse-slpk/parse-slpk.js.map +0 -1
  80. package/dist/lib/parsers/parse-slpk/slpk-archieve.js.map +0 -1
  81. package/dist/lib/utils/convert-i3s-obb-to-mbs.js.map +0 -1
  82. package/dist/lib/utils/customize-colors.js.map +0 -1
  83. package/dist/lib/utils/url-utils.js.map +0 -1
  84. package/dist/types.js.map +0 -1
  85. package/dist/workers/i3s-content-worker-node.js.map +0 -1
  86. package/dist/workers/i3s-content-worker.js.map +0 -1
@@ -1,119 +1,170 @@
1
1
  import { load } from '@loaders.gl/core';
2
2
  import { parseI3STileAttribute } from "./lib/parsers/parse-i3s-attribute.js";
3
3
  import { getUrlWithToken } from "./lib/utils/url-utils.js";
4
+ // __VERSION__ is injected by babel-plugin-version-inline
5
+ // @ts-ignore TS2304: Cannot find name '__VERSION__'.
4
6
  const VERSION = typeof "4.2.0-alpha.4" !== 'undefined' ? "4.2.0-alpha.4" : 'latest';
5
7
  const EMPTY_VALUE = '';
6
8
  const REJECTED_STATUS = 'rejected';
9
+ /**
10
+ * Loader for I3S attributes
11
+ */
7
12
  export const I3SAttributeLoader = {
8
- name: 'I3S Attribute',
9
- id: 'i3s-attribute',
10
- module: 'i3s',
11
- version: VERSION,
12
- mimeTypes: ['application/binary'],
13
- parse: async (arrayBuffer, options) => parseI3STileAttribute(arrayBuffer, options),
14
- extensions: ['bin'],
15
- options: {},
16
- binary: true
13
+ name: 'I3S Attribute',
14
+ id: 'i3s-attribute',
15
+ module: 'i3s',
16
+ version: VERSION,
17
+ mimeTypes: ['application/binary'],
18
+ parse: async (arrayBuffer, options) => parseI3STileAttribute(arrayBuffer, options),
19
+ extensions: ['bin'],
20
+ options: {},
21
+ binary: true
17
22
  };
18
- export async function loadFeatureAttributes(tile, featureId) {
19
- let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
20
- const {
21
- attributeStorageInfo,
22
- attributeUrls,
23
- tilesetFields
24
- } = getAttributesData(tile);
25
- if (!attributeStorageInfo || !attributeUrls || featureId < 0) {
26
- return null;
27
- }
28
- let attributes = [];
29
- const attributeLoadPromises = [];
30
- for (let index = 0; index < attributeStorageInfo.length; index++) {
31
- var _options$i3s;
32
- const url = getUrlWithToken(attributeUrls[index], (_options$i3s = options.i3s) === null || _options$i3s === void 0 ? void 0 : _options$i3s.token);
33
- const attributeName = attributeStorageInfo[index].name;
34
- const attributeType = getAttributeValueType(attributeStorageInfo[index]);
35
- const loadOptions = {
36
- ...options,
37
- attributeName,
38
- attributeType
39
- };
40
- const promise = load(url, I3SAttributeLoader, loadOptions);
41
- attributeLoadPromises.push(promise);
42
- }
43
- try {
44
- attributes = await Promise.allSettled(attributeLoadPromises);
45
- } catch (error) {}
46
- if (!attributes.length) {
47
- return null;
48
- }
49
- return generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields);
23
+ // TODO - these seem to use the loader rather than being part of the loader. Move to different file...
24
+ /**
25
+ * Load attributes based on feature id
26
+ * @param {Object} tile
27
+ * @param {number} featureId
28
+ * @param {Object} options
29
+ * @returns {Promise}
30
+ */
31
+ // eslint-disable-next-line complexity
32
+ export async function loadFeatureAttributes(tile, featureId, options = {}) {
33
+ const { attributeStorageInfo, attributeUrls, tilesetFields } = getAttributesData(tile);
34
+ if (!attributeStorageInfo || !attributeUrls || featureId < 0) {
35
+ return null;
36
+ }
37
+ let attributes = [];
38
+ const attributeLoadPromises = [];
39
+ for (let index = 0; index < attributeStorageInfo.length; index++) {
40
+ // @ts-ignore
41
+ const url = getUrlWithToken(attributeUrls[index], options.i3s?.token);
42
+ const attributeName = attributeStorageInfo[index].name;
43
+ const attributeType = getAttributeValueType(attributeStorageInfo[index]);
44
+ const loadOptions = { ...options, attributeName, attributeType };
45
+ const promise = load(url, I3SAttributeLoader, loadOptions);
46
+ attributeLoadPromises.push(promise);
47
+ }
48
+ try {
49
+ attributes = await Promise.allSettled(attributeLoadPromises);
50
+ }
51
+ catch (error) {
52
+ // do nothing
53
+ }
54
+ if (!attributes.length) {
55
+ return null;
56
+ }
57
+ return generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields);
50
58
  }
59
+ /**
60
+ * Gets attributes data from tile.
61
+ * @param tile
62
+ * @returns
63
+ */
51
64
  function getAttributesData(tile) {
52
- var _tile$tileset, _tile$tileset$tileset, _tile$header, _tile$tileset2, _tile$tileset2$tilese;
53
- const attributeStorageInfo = (_tile$tileset = tile.tileset) === null || _tile$tileset === void 0 ? void 0 : (_tile$tileset$tileset = _tile$tileset.tileset) === null || _tile$tileset$tileset === void 0 ? void 0 : _tile$tileset$tileset.attributeStorageInfo;
54
- const attributeUrls = (_tile$header = tile.header) === null || _tile$header === void 0 ? void 0 : _tile$header.attributeUrls;
55
- const tilesetFields = ((_tile$tileset2 = tile.tileset) === null || _tile$tileset2 === void 0 ? void 0 : (_tile$tileset2$tilese = _tile$tileset2.tileset) === null || _tile$tileset2$tilese === void 0 ? void 0 : _tile$tileset2$tilese.fields) || [];
56
- return {
57
- attributeStorageInfo,
58
- attributeUrls,
59
- tilesetFields
60
- };
65
+ const attributeStorageInfo = tile.tileset?.tileset?.attributeStorageInfo;
66
+ const attributeUrls = tile.header?.attributeUrls;
67
+ const tilesetFields = tile.tileset?.tileset?.fields || [];
68
+ return { attributeStorageInfo, attributeUrls, tilesetFields };
61
69
  }
70
+ /**
71
+ * Get attribute value type based on property names
72
+ * @param {Object} attribute
73
+ * @returns {String}
74
+ */
62
75
  export function getAttributeValueType(attribute) {
63
- if (attribute.hasOwnProperty('objectIds')) {
64
- return 'Oid32';
65
- } else if (attribute.hasOwnProperty('attributeValues')) {
66
- return attribute.attributeValues.valueType;
67
- }
68
- return '';
76
+ if (attribute.hasOwnProperty('objectIds')) {
77
+ return 'Oid32';
78
+ }
79
+ else if (attribute.hasOwnProperty('attributeValues')) {
80
+ return attribute.attributeValues.valueType;
81
+ }
82
+ return '';
69
83
  }
84
+ /**
85
+ * Find in attributeStorageInfo attribute name responsible for feature ids list.
86
+ * @param attributeStorageInfo
87
+ * @returns Feature ids attribute name
88
+ */
70
89
  function getFeatureIdsAttributeName(attributeStorageInfo) {
71
- const objectIdsAttribute = attributeStorageInfo.find(attribute => attribute.name.includes('OBJECTID'));
72
- return objectIdsAttribute === null || objectIdsAttribute === void 0 ? void 0 : objectIdsAttribute.name;
90
+ const objectIdsAttribute = attributeStorageInfo.find(attribute => attribute.name.includes('OBJECTID'));
91
+ return objectIdsAttribute?.name;
73
92
  }
93
+ /**
94
+ * Generates mapping featureId to feature attributes
95
+ * @param {Array} attributes
96
+ * @param {Object} attributeStorageInfo
97
+ * @param {number} featureId
98
+ * @returns {Object}
99
+ */
74
100
  function generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields) {
75
- const objectIdsAttributeName = getFeatureIdsAttributeName(attributeStorageInfo);
76
- const objectIds = attributes.find(attribute => attribute.value[objectIdsAttributeName]);
77
- if (!objectIds) {
78
- return null;
79
- }
80
- const attributeIndex = objectIds.value[objectIdsAttributeName].indexOf(featureId);
81
- if (attributeIndex < 0) {
82
- return null;
83
- }
84
- return getFeatureAttributesByIndex(attributes, attributeIndex, attributeStorageInfo, tilesetFields);
101
+ const objectIdsAttributeName = getFeatureIdsAttributeName(attributeStorageInfo);
102
+ const objectIds = attributes.find((attribute) => attribute.value[objectIdsAttributeName]);
103
+ if (!objectIds) {
104
+ return null;
105
+ }
106
+ const attributeIndex = objectIds.value[objectIdsAttributeName].indexOf(featureId);
107
+ if (attributeIndex < 0) {
108
+ return null;
109
+ }
110
+ return getFeatureAttributesByIndex(attributes, attributeIndex, attributeStorageInfo, tilesetFields);
85
111
  }
112
+ /**
113
+ * Generates attribute object for feature mapping by feature id
114
+ * @param {Array} attributes
115
+ * @param {Number} featureIdIndex
116
+ * @param {Object} attributeStorageInfo
117
+ * @returns {Object}
118
+ */
86
119
  function getFeatureAttributesByIndex(attributes, featureIdIndex, attributeStorageInfo, tilesetFields) {
87
- const attributesObject = {};
88
- for (let index = 0; index < attributeStorageInfo.length; index++) {
89
- const attributeName = attributeStorageInfo[index].name;
90
- const codedValues = getAttributeCodedValues(attributeName, tilesetFields);
91
- const attribute = getAttributeByIndexAndAttributeName(attributes, index, attributeName);
92
- attributesObject[attributeName] = formatAttributeValue(attribute, featureIdIndex, codedValues);
93
- }
94
- return attributesObject;
120
+ const attributesObject = {};
121
+ for (let index = 0; index < attributeStorageInfo.length; index++) {
122
+ const attributeName = attributeStorageInfo[index].name;
123
+ const codedValues = getAttributeCodedValues(attributeName, tilesetFields);
124
+ const attribute = getAttributeByIndexAndAttributeName(attributes, index, attributeName);
125
+ attributesObject[attributeName] = formatAttributeValue(attribute, featureIdIndex, codedValues);
126
+ }
127
+ return attributesObject;
95
128
  }
129
+ /**
130
+ * Get coded values list from tileset.
131
+ * @param attributeName
132
+ * @param tilesetFields
133
+ */
96
134
  function getAttributeCodedValues(attributeName, tilesetFields) {
97
- var _attributeField$domai;
98
- const attributeField = tilesetFields.find(field => field.name === attributeName || field.alias === attributeName);
99
- return (attributeField === null || attributeField === void 0 ? void 0 : (_attributeField$domai = attributeField.domain) === null || _attributeField$domai === void 0 ? void 0 : _attributeField$domai.codedValues) || [];
135
+ const attributeField = tilesetFields
136
+ .find(field => field.name === attributeName || field.alias === attributeName);
137
+ return attributeField?.domain?.codedValues || [];
100
138
  }
139
+ /**
140
+ * Return attribute value if it presents in atrributes list
141
+ * @param {array} attributes
142
+ * @param {number} index
143
+ * @param {string} attributesName
144
+ */
101
145
  function getAttributeByIndexAndAttributeName(attributes, index, attributesName) {
102
- const attributeObject = attributes[index];
103
- if (attributeObject.status === REJECTED_STATUS) {
104
- return null;
105
- }
106
- return attributeObject.value[attributesName];
146
+ const attributeObject = attributes[index];
147
+ if (attributeObject.status === REJECTED_STATUS) {
148
+ return null;
149
+ }
150
+ return attributeObject.value[attributesName];
107
151
  }
152
+ /**
153
+ * Do formatting of attribute values or return empty string.
154
+ * @param {Array} attribute
155
+ * @param {Number} featureIdIndex
156
+ * @returns {String}
157
+ */
108
158
  function formatAttributeValue(attribute, featureIdIndex, codedValues) {
109
- let value = EMPTY_VALUE;
110
- if (attribute && featureIdIndex in attribute) {
111
- value = String(attribute[featureIdIndex]).replace(/\u0000|NaN/g, '').trim();
112
- }
113
- if (codedValues.length) {
114
- const codeValue = codedValues.find(codedValue => codedValue.code === Number(value));
115
- value = (codeValue === null || codeValue === void 0 ? void 0 : codeValue.name) || EMPTY_VALUE;
116
- }
117
- return value;
159
+ let value = EMPTY_VALUE;
160
+ if (attribute && (featureIdIndex in attribute)) {
161
+ // eslint-disable-next-line no-control-regex
162
+ value = String(attribute[featureIdIndex]).replace(/\u0000|NaN/g, '').trim();
163
+ }
164
+ // Check if coded values are existed. If so we use them.
165
+ if (codedValues.length) {
166
+ const codeValue = codedValues.find(codedValue => codedValue.code === Number(value));
167
+ value = codeValue?.name || EMPTY_VALUE;
168
+ }
169
+ return value;
118
170
  }
119
- //# sourceMappingURL=i3s-attribute-loader.js.map
@@ -1,6 +1,6 @@
1
1
  import type { LoaderWithParser } from '@loaders.gl/loader-utils';
2
- import type { I3SLoaderOptions } from './i3s-loader';
3
- import type { BuildingSceneLayerTileset } from './types';
2
+ import type { I3SLoaderOptions } from "./i3s-loader.js";
3
+ import type { BuildingSceneLayerTileset } from "./types.js";
4
4
  /**
5
5
  * Loader for I3S - Building Scene Layer
6
6
  */
@@ -1 +1 @@
1
- {"version":3,"file":"i3s-building-scene-layer-loader.d.ts","sourceRoot":"","sources":["../src/i3s-building-scene-layer-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAA+B,MAAM,0BAA0B,CAAC;AAC7F,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,EAAC,yBAAyB,EAAC,MAAM,SAAS,CAAC;AAQvD;;GAEG;AACH,eAAO,MAAM,2BAA2B,EAAE,gBAAgB,CACxD,yBAAyB,EACzB,KAAK,EACL,gBAAgB,CAUjB,CAAC"}
1
+ {"version":3,"file":"i3s-building-scene-layer-loader.d.ts","sourceRoot":"","sources":["../src/i3s-building-scene-layer-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAA+B,MAAM,0BAA0B,CAAC;AAC7F,OAAO,KAAK,EAAC,gBAAgB,EAAC,wBAAqB;AACnD,OAAO,KAAK,EAAC,yBAAyB,EAAC,mBAAgB;AAQvD;;GAEG;AACH,eAAO,MAAM,2BAA2B,EAAE,gBAAgB,CACxD,yBAAyB,EACzB,KAAK,EACL,gBAAgB,CAUjB,CAAC"}
@@ -1,19 +1,23 @@
1
1
  import { parseBuildingSceneLayer } from "./lib/parsers/parse-i3s-building-scene-layer.js";
2
+ // __VERSION__ is injected by babel-plugin-version-inline
3
+ // @ts-ignore TS2304: Cannot find name '__VERSION__'.
2
4
  const VERSION = typeof "4.2.0-alpha.4" !== 'undefined' ? "4.2.0-alpha.4" : 'latest';
5
+ /**
6
+ * Loader for I3S - Building Scene Layer
7
+ */
3
8
  export const I3SBuildingSceneLayerLoader = {
4
- name: 'I3S Building Scene Layer',
5
- id: 'i3s-building-scene-layer',
6
- module: 'i3s',
7
- version: VERSION,
8
- mimeTypes: ['application/json'],
9
- parse,
10
- extensions: ['json'],
11
- options: {}
9
+ name: 'I3S Building Scene Layer',
10
+ id: 'i3s-building-scene-layer',
11
+ module: 'i3s',
12
+ version: VERSION,
13
+ mimeTypes: ['application/json'],
14
+ parse,
15
+ extensions: ['json'],
16
+ options: {}
12
17
  };
13
18
  async function parse(data, options, context) {
14
- if (!(context !== null && context !== void 0 && context.url)) {
15
- throw new Error('Url is not provided');
16
- }
17
- return parseBuildingSceneLayer(data, context.url);
19
+ if (!context?.url) {
20
+ throw new Error('Url is not provided');
21
+ }
22
+ return parseBuildingSceneLayer(data, context.url);
18
23
  }
19
- //# sourceMappingURL=i3s-building-scene-layer-loader.js.map
@@ -1,6 +1,6 @@
1
1
  import type { LoaderWithParser } from '@loaders.gl/loader-utils';
2
- import type { I3SLoaderOptions } from './i3s-loader';
3
- import { I3STileContent } from './types';
2
+ import type { I3SLoaderOptions } from "./i3s-loader.js";
3
+ import { I3STileContent } from "./types.js";
4
4
  /**
5
5
  * Loader for I3S - Indexed 3D Scene Layer
6
6
  */
@@ -1 +1 @@
1
- {"version":3,"file":"i3s-content-loader.d.ts","sourceRoot":"","sources":["../src/i3s-content-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAAgB,MAAM,0BAA0B,CAAC;AAC9E,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,cAAc,CAAC;AAEnD,OAAO,EAAC,cAAc,EAAoC,MAAM,SAAS,CAAC;AAO1E;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,gBAAgB,CAAC,cAAc,GAAG,IAAI,EAAE,KAAK,EAAE,gBAAgB,CAY7F,CAAC"}
1
+ {"version":3,"file":"i3s-content-loader.d.ts","sourceRoot":"","sources":["../src/i3s-content-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAAgB,MAAM,0BAA0B,CAAC;AAC9E,OAAO,KAAK,EAAC,gBAAgB,EAAC,wBAAqB;AAEnD,OAAO,EAAC,cAAc,EAAoC,mBAAgB;AAO1E;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,gBAAgB,CAAC,cAAc,GAAG,IAAI,EAAE,KAAK,EAAE,gBAAgB,CAY7F,CAAC"}
@@ -1,30 +1,29 @@
1
1
  import { parseI3STileContent } from "./lib/parsers/parse-i3s-tile-content.js";
2
+ // __VERSION__ is injected by babel-plugin-version-inline
3
+ // @ts-ignore TS2304: Cannot find name '__VERSION__'.
2
4
  const VERSION = typeof "4.2.0-alpha.4" !== 'undefined' ? "4.2.0-alpha.4" : 'latest';
5
+ /**
6
+ * Loader for I3S - Indexed 3D Scene Layer
7
+ */
3
8
  export const I3SContentLoader = {
4
- name: 'I3S Content (Indexed Scene Layers)',
5
- id: 'i3s-content',
6
- module: 'i3s',
7
- worker: true,
8
- version: VERSION,
9
- mimeTypes: ['application/octet-stream'],
10
- parse,
11
- extensions: ['bin'],
12
- options: {
13
- 'i3s-content': {}
14
- }
9
+ name: 'I3S Content (Indexed Scene Layers)',
10
+ id: 'i3s-content',
11
+ module: 'i3s',
12
+ worker: true,
13
+ version: VERSION,
14
+ mimeTypes: ['application/octet-stream'],
15
+ parse,
16
+ extensions: ['bin'],
17
+ options: {
18
+ 'i3s-content': {}
19
+ }
15
20
  };
16
21
  async function parse(data, options, context) {
17
- const {
18
- tile,
19
- _tileOptions,
20
- tileset,
21
- _tilesetOptions
22
- } = (options === null || options === void 0 ? void 0 : options.i3s) || {};
23
- const tileOptions = _tileOptions || tile;
24
- const tilesetOptions = _tilesetOptions || tileset;
25
- if (!tileOptions || !tilesetOptions) {
26
- return null;
27
- }
28
- return await parseI3STileContent(data, tileOptions, tilesetOptions, options, context);
22
+ const { tile, _tileOptions, tileset, _tilesetOptions } = options?.i3s || {};
23
+ const tileOptions = _tileOptions || tile;
24
+ const tilesetOptions = _tilesetOptions || tileset;
25
+ if (!tileOptions || !tilesetOptions) {
26
+ return null;
27
+ }
28
+ return await parseI3STileContent(data, tileOptions, tilesetOptions, options, context);
29
29
  }
30
- //# sourceMappingURL=i3s-content-loader.js.map