@loaders.gl/i3s 3.4.14 → 3.4.15
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 +93 -92
- package/dist/es5/arcgis-webscene-loader.js +5 -22
- package/dist/es5/arcgis-webscene-loader.js.map +1 -1
- package/dist/es5/bundle.js +1 -1
- package/dist/es5/bundle.js.map +1 -1
- package/dist/es5/i3s-attribute-loader.js +58 -123
- package/dist/es5/i3s-attribute-loader.js.map +1 -1
- package/dist/es5/i3s-building-scene-layer-loader.js +8 -28
- package/dist/es5/i3s-building-scene-layer-loader.js.map +1 -1
- package/dist/es5/i3s-content-loader.js +16 -35
- package/dist/es5/i3s-content-loader.js.map +1 -1
- package/dist/es5/i3s-loader.js +49 -148
- package/dist/es5/i3s-loader.js.map +1 -1
- package/dist/es5/i3s-node-page-loader.js +8 -39
- package/dist/es5/i3s-node-page-loader.js.map +1 -1
- package/dist/es5/i3s-slpk-loader.js +2 -2
- package/dist/es5/i3s-slpk-loader.js.map +1 -1
- package/dist/es5/index.js +8 -8
- package/dist/es5/lib/helpers/i3s-nodepages-tiles.js +161 -267
- package/dist/es5/lib/helpers/i3s-nodepages-tiles.js.map +1 -1
- package/dist/es5/lib/parsers/constants.js +6 -6
- package/dist/es5/lib/parsers/constants.js.map +1 -1
- package/dist/es5/lib/parsers/parse-arcgis-webscene.js +64 -146
- package/dist/es5/lib/parsers/parse-arcgis-webscene.js.map +1 -1
- package/dist/es5/lib/parsers/parse-i3s-attribute.js +26 -55
- package/dist/es5/lib/parsers/parse-i3s-attribute.js.map +1 -1
- package/dist/es5/lib/parsers/parse-i3s-building-scene-layer.js +27 -47
- package/dist/es5/lib/parsers/parse-i3s-building-scene-layer.js.map +1 -1
- package/dist/es5/lib/parsers/parse-i3s-tile-content.js +278 -347
- package/dist/es5/lib/parsers/parse-i3s-tile-content.js.map +1 -1
- package/dist/es5/lib/parsers/parse-i3s.js +55 -79
- package/dist/es5/lib/parsers/parse-i3s.js.map +1 -1
- package/dist/es5/lib/parsers/parse-slpk/parse-slpk.js +30 -81
- package/dist/es5/lib/parsers/parse-slpk/parse-slpk.js.map +1 -1
- package/dist/es5/lib/parsers/parse-slpk/slpk-archieve.js +44 -90
- package/dist/es5/lib/parsers/parse-slpk/slpk-archieve.js.map +1 -1
- package/dist/es5/lib/parsers/parse-zip/cd-file-header.js +17 -17
- package/dist/es5/lib/parsers/parse-zip/cd-file-header.js.map +1 -1
- package/dist/es5/lib/parsers/parse-zip/local-file-header.js +10 -10
- package/dist/es5/lib/parsers/parse-zip/local-file-header.js.map +1 -1
- package/dist/es5/lib/utils/convert-i3s-obb-to-mbs.js +4 -6
- package/dist/es5/lib/utils/convert-i3s-obb-to-mbs.js.map +1 -1
- package/dist/es5/lib/utils/customizeColors.js +79 -140
- package/dist/es5/lib/utils/customizeColors.js.map +1 -1
- package/dist/es5/lib/utils/url-utils.js +14 -11
- package/dist/es5/lib/utils/url-utils.js.map +1 -1
- package/dist/es5/types.js +2 -2
- package/dist/esm/arcgis-webscene-loader.js +1 -1
- package/dist/esm/i3s-attribute-loader.js +1 -1
- package/dist/esm/i3s-building-scene-layer-loader.js +1 -1
- package/dist/esm/i3s-content-loader.js +1 -1
- package/dist/esm/i3s-loader.js +1 -1
- package/dist/esm/i3s-node-page-loader.js +1 -1
- package/dist/esm/i3s-slpk-loader.js +1 -1
- package/dist/i3s-content-nodejs-worker.js +61 -59
- package/dist/i3s-content-nodejs-worker.js.map +3 -3
- package/dist/i3s-content-worker.js +54 -53
- package/package.json +9 -9
|
@@ -1,132 +1,75 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.I3SAttributeLoader = void 0;
|
|
8
7
|
exports.getAttributeValueType = getAttributeValueType;
|
|
9
8
|
exports.loadFeatureAttributes = loadFeatureAttributes;
|
|
10
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
9
|
var _core = require("@loaders.gl/core");
|
|
14
10
|
var _parseI3sAttribute = require("./lib/parsers/parse-i3s-attribute");
|
|
15
11
|
var _urlUtils = require("./lib/utils/url-utils");
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var REJECTED_STATUS = 'rejected';
|
|
21
|
-
var I3SAttributeLoader = {
|
|
12
|
+
const VERSION = typeof "3.4.15" !== 'undefined' ? "3.4.15" : 'latest';
|
|
13
|
+
const EMPTY_VALUE = '';
|
|
14
|
+
const REJECTED_STATUS = 'rejected';
|
|
15
|
+
const I3SAttributeLoader = {
|
|
22
16
|
name: 'I3S Attribute',
|
|
23
17
|
id: 'i3s-attribute',
|
|
24
18
|
module: 'i3s',
|
|
25
19
|
version: VERSION,
|
|
26
20
|
mimeTypes: ['application/binary'],
|
|
27
|
-
parse
|
|
21
|
+
parse,
|
|
28
22
|
extensions: ['bin'],
|
|
29
23
|
options: {},
|
|
30
24
|
binary: true
|
|
31
25
|
};
|
|
32
26
|
exports.I3SAttributeLoader = I3SAttributeLoader;
|
|
33
|
-
function parse(
|
|
34
|
-
|
|
27
|
+
async function parse(data, options) {
|
|
28
|
+
data = (0, _parseI3sAttribute.parseI3STileAttribute)(data, options);
|
|
29
|
+
return data;
|
|
35
30
|
}
|
|
36
|
-
function
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
_loadFeatureAttributes = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee2(tile, featureId) {
|
|
56
|
-
var options,
|
|
57
|
-
_getAttributesData,
|
|
58
|
-
attributeStorageInfo,
|
|
59
|
-
attributeUrls,
|
|
60
|
-
tilesetFields,
|
|
61
|
-
attributes,
|
|
62
|
-
attributeLoadPromises,
|
|
63
|
-
index,
|
|
64
|
-
_options$i3s,
|
|
65
|
-
url,
|
|
31
|
+
async function loadFeatureAttributes(tile, featureId) {
|
|
32
|
+
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
33
|
+
const {
|
|
34
|
+
attributeStorageInfo,
|
|
35
|
+
attributeUrls,
|
|
36
|
+
tilesetFields
|
|
37
|
+
} = getAttributesData(tile);
|
|
38
|
+
if (!attributeStorageInfo || !attributeUrls || featureId < 0) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
let attributes = [];
|
|
42
|
+
const attributeLoadPromises = [];
|
|
43
|
+
for (let index = 0; index < attributeStorageInfo.length; index++) {
|
|
44
|
+
var _options$i3s;
|
|
45
|
+
const url = (0, _urlUtils.getUrlWithToken)(attributeUrls[index], (_options$i3s = options.i3s) === null || _options$i3s === void 0 ? void 0 : _options$i3s.token);
|
|
46
|
+
const attributeName = attributeStorageInfo[index].name;
|
|
47
|
+
const attributeType = getAttributeValueType(attributeStorageInfo[index]);
|
|
48
|
+
const loadOptions = {
|
|
49
|
+
...options,
|
|
66
50
|
attributeName,
|
|
67
|
-
attributeType
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
return _context2.abrupt("return", null);
|
|
81
|
-
case 4:
|
|
82
|
-
attributes = [];
|
|
83
|
-
attributeLoadPromises = [];
|
|
84
|
-
for (index = 0; index < attributeStorageInfo.length; index++) {
|
|
85
|
-
url = (0, _urlUtils.getUrlWithToken)(attributeUrls[index], (_options$i3s = options.i3s) === null || _options$i3s === void 0 ? void 0 : _options$i3s.token);
|
|
86
|
-
attributeName = attributeStorageInfo[index].name;
|
|
87
|
-
attributeType = getAttributeValueType(attributeStorageInfo[index]);
|
|
88
|
-
loadOptions = _objectSpread(_objectSpread({}, options), {}, {
|
|
89
|
-
attributeName: attributeName,
|
|
90
|
-
attributeType: attributeType
|
|
91
|
-
});
|
|
92
|
-
promise = (0, _core.load)(url, I3SAttributeLoader, loadOptions);
|
|
93
|
-
attributeLoadPromises.push(promise);
|
|
94
|
-
}
|
|
95
|
-
_context2.prev = 7;
|
|
96
|
-
_context2.next = 10;
|
|
97
|
-
return Promise.allSettled(attributeLoadPromises);
|
|
98
|
-
case 10:
|
|
99
|
-
attributes = _context2.sent;
|
|
100
|
-
_context2.next = 15;
|
|
101
|
-
break;
|
|
102
|
-
case 13:
|
|
103
|
-
_context2.prev = 13;
|
|
104
|
-
_context2.t0 = _context2["catch"](7);
|
|
105
|
-
case 15:
|
|
106
|
-
if (attributes.length) {
|
|
107
|
-
_context2.next = 17;
|
|
108
|
-
break;
|
|
109
|
-
}
|
|
110
|
-
return _context2.abrupt("return", null);
|
|
111
|
-
case 17:
|
|
112
|
-
return _context2.abrupt("return", generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields));
|
|
113
|
-
case 18:
|
|
114
|
-
case "end":
|
|
115
|
-
return _context2.stop();
|
|
116
|
-
}
|
|
117
|
-
}, _callee2, null, [[7, 13]]);
|
|
118
|
-
}));
|
|
119
|
-
return _loadFeatureAttributes.apply(this, arguments);
|
|
51
|
+
attributeType
|
|
52
|
+
};
|
|
53
|
+
const promise = (0, _core.load)(url, I3SAttributeLoader, loadOptions);
|
|
54
|
+
attributeLoadPromises.push(promise);
|
|
55
|
+
}
|
|
56
|
+
try {
|
|
57
|
+
attributes = await Promise.allSettled(attributeLoadPromises);
|
|
58
|
+
} catch (error) {}
|
|
59
|
+
if (!attributes.length) {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
return generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields);
|
|
120
63
|
}
|
|
121
64
|
function getAttributesData(tile) {
|
|
122
65
|
var _tile$tileset, _tile$tileset$tileset, _tile$header, _tile$tileset2, _tile$tileset2$tilese;
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
66
|
+
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;
|
|
67
|
+
const attributeUrls = (_tile$header = tile.header) === null || _tile$header === void 0 ? void 0 : _tile$header.attributeUrls;
|
|
68
|
+
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) || [];
|
|
126
69
|
return {
|
|
127
|
-
attributeStorageInfo
|
|
128
|
-
attributeUrls
|
|
129
|
-
tilesetFields
|
|
70
|
+
attributeStorageInfo,
|
|
71
|
+
attributeUrls,
|
|
72
|
+
tilesetFields
|
|
130
73
|
};
|
|
131
74
|
}
|
|
132
75
|
function getAttributeValueType(attribute) {
|
|
@@ -138,58 +81,50 @@ function getAttributeValueType(attribute) {
|
|
|
138
81
|
return '';
|
|
139
82
|
}
|
|
140
83
|
function getFeatureIdsAttributeName(attributeStorageInfo) {
|
|
141
|
-
|
|
142
|
-
return attribute.name.includes('OBJECTID');
|
|
143
|
-
});
|
|
84
|
+
const objectIdsAttribute = attributeStorageInfo.find(attribute => attribute.name.includes('OBJECTID'));
|
|
144
85
|
return objectIdsAttribute === null || objectIdsAttribute === void 0 ? void 0 : objectIdsAttribute.name;
|
|
145
86
|
}
|
|
146
87
|
function generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields) {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
return attribute.value[objectIdsAttributeName];
|
|
150
|
-
});
|
|
88
|
+
const objectIdsAttributeName = getFeatureIdsAttributeName(attributeStorageInfo);
|
|
89
|
+
const objectIds = attributes.find(attribute => attribute.value[objectIdsAttributeName]);
|
|
151
90
|
if (!objectIds) {
|
|
152
91
|
return null;
|
|
153
92
|
}
|
|
154
|
-
|
|
93
|
+
const attributeIndex = objectIds.value[objectIdsAttributeName].indexOf(featureId);
|
|
155
94
|
if (attributeIndex < 0) {
|
|
156
95
|
return null;
|
|
157
96
|
}
|
|
158
97
|
return getFeatureAttributesByIndex(attributes, attributeIndex, attributeStorageInfo, tilesetFields);
|
|
159
98
|
}
|
|
160
99
|
function getFeatureAttributesByIndex(attributes, featureIdIndex, attributeStorageInfo, tilesetFields) {
|
|
161
|
-
|
|
162
|
-
for (
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
100
|
+
const attributesObject = {};
|
|
101
|
+
for (let index = 0; index < attributeStorageInfo.length; index++) {
|
|
102
|
+
const attributeName = attributeStorageInfo[index].name;
|
|
103
|
+
const codedValues = getAttributeCodedValues(attributeName, tilesetFields);
|
|
104
|
+
const attribute = getAttributeByIndexAndAttributeName(attributes, index, attributeName);
|
|
166
105
|
attributesObject[attributeName] = formatAttributeValue(attribute, featureIdIndex, codedValues);
|
|
167
106
|
}
|
|
168
107
|
return attributesObject;
|
|
169
108
|
}
|
|
170
109
|
function getAttributeCodedValues(attributeName, tilesetFields) {
|
|
171
110
|
var _attributeField$domai;
|
|
172
|
-
|
|
173
|
-
return field.name === attributeName || field.alias === attributeName;
|
|
174
|
-
});
|
|
111
|
+
const attributeField = tilesetFields.find(field => field.name === attributeName || field.alias === attributeName);
|
|
175
112
|
return (attributeField === null || attributeField === void 0 ? void 0 : (_attributeField$domai = attributeField.domain) === null || _attributeField$domai === void 0 ? void 0 : _attributeField$domai.codedValues) || [];
|
|
176
113
|
}
|
|
177
114
|
function getAttributeByIndexAndAttributeName(attributes, index, attributesName) {
|
|
178
|
-
|
|
115
|
+
const attributeObject = attributes[index];
|
|
179
116
|
if (attributeObject.status === REJECTED_STATUS) {
|
|
180
117
|
return null;
|
|
181
118
|
}
|
|
182
119
|
return attributeObject.value[attributesName];
|
|
183
120
|
}
|
|
184
121
|
function formatAttributeValue(attribute, featureIdIndex, codedValues) {
|
|
185
|
-
|
|
122
|
+
let value = EMPTY_VALUE;
|
|
186
123
|
if (attribute && featureIdIndex in attribute) {
|
|
187
124
|
value = String(attribute[featureIdIndex]).replace(/\u0000|NaN/g, '').trim();
|
|
188
125
|
}
|
|
189
126
|
if (codedValues.length) {
|
|
190
|
-
|
|
191
|
-
return codedValue.code === Number(value);
|
|
192
|
-
});
|
|
127
|
+
const codeValue = codedValues.find(codedValue => codedValue.code === Number(value));
|
|
193
128
|
value = (codeValue === null || codeValue === void 0 ? void 0 : codeValue.name) || EMPTY_VALUE;
|
|
194
129
|
}
|
|
195
130
|
return value;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i3s-attribute-loader.js","names":["_core","require","_parseI3sAttribute","_urlUtils","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","VERSION","EMPTY_VALUE","REJECTED_STATUS","I3SAttributeLoader","name","id","module","version","mimeTypes","parse","extensions","options","binary","exports","_x","_x2","_parse","_asyncToGenerator2","_regenerator","mark","_callee","data","wrap","_callee$","_context","prev","next","parseI3STileAttribute","abrupt","stop","loadFeatureAttributes","_x3","_x4","_loadFeatureAttributes","_callee2","tile","featureId","_getAttributesData","attributeStorageInfo","attributeUrls","tilesetFields","attributes","attributeLoadPromises","index","_options$i3s","url","attributeName","attributeType","loadOptions","promise","_args2","_callee2$","_context2","undefined","getAttributesData","getUrlWithToken","i3s","token","getAttributeValueType","load","Promise","allSettled","sent","t0","generateAttributesByFeatureId","_tile$tileset","_tile$tileset$tileset","_tile$header","_tile$tileset2","_tile$tileset2$tilese","tileset","header","fields","attribute","hasOwnProperty","attributeValues","valueType","getFeatureIdsAttributeName","objectIdsAttribute","find","includes","objectIdsAttributeName","objectIds","value","attributeIndex","indexOf","getFeatureAttributesByIndex","featureIdIndex","attributesObject","codedValues","getAttributeCodedValues","getAttributeByIndexAndAttributeName","formatAttributeValue","_attributeField$domai","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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uBAAtBA,qBAAA,CAAwBJ,WAAW,KAAI,EAAE;AAClD;AAQA,SAASE,mCAAmCA,CAAClD,UAAU,EAAEE,KAAK,EAAEuD,cAAc,EAAE;EAC9E,IAAMC,eAAe,GAAG1D,UAAU,CAACE,KAAK,CAAC;EAEzC,IAAIwD,eAAe,CAACC,MAAM,KAAKlG,eAAe,EAAE;IAC9C,OAAO,IAAI;EACb;EAEA,OAAOiG,eAAe,CAAChB,KAAK,CAACe,cAAc,CAAC;AAC9C;AAQA,SAASN,oBAAoBA,CAACnB,SAAS,EAAEc,cAAc,EAAEE,WAAW,EAAE;EACpE,IAAIN,KAAK,GAAGlF,WAAW;EAEvB,IAAIwE,SAAS,IAAKc,cAAc,IAAId,SAAU,EAAE;IAE9CU,KAAK,GAAGkB,MAAM,CAAC5B,SAAS,CAACc,cAAc,CAAC,CAAC,CAACe,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAACC,IAAI,CAAC,CAAC;EAC7E;EAGA,IAAId,WAAW,CAAClG,MAAM,EAAE;IACtB,IAAMiH,SAAS,GAAGf,WAAW,CAACV,IAAI,CAAC,UAAA0B,UAAU;MAAA,OAAIA,UAAU,CAACC,IAAI,KAAKC,MAAM,CAACxB,KAAK,CAAC;IAAA,EAAC;IACnFA,KAAK,GAAG,CAAAqB,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAEpG,IAAI,KAAIH,WAAW;EACxC;EAEA,OAAOkF,KAAK;AACd"}
|
|
1
|
+
{"version":3,"file":"i3s-attribute-loader.js","names":["_core","require","_parseI3sAttribute","_urlUtils","VERSION","EMPTY_VALUE","REJECTED_STATUS","I3SAttributeLoader","name","id","module","version","mimeTypes","parse","extensions","options","binary","exports","data","parseI3STileAttribute","loadFeatureAttributes","tile","featureId","arguments","length","undefined","attributeStorageInfo","attributeUrls","tilesetFields","getAttributesData","attributes","attributeLoadPromises","index","_options$i3s","url","getUrlWithToken","i3s","token","attributeName","attributeType","getAttributeValueType","loadOptions","promise","load","push","Promise","allSettled","error","generateAttributesByFeatureId","_tile$tileset","_tile$tileset$tileset","_tile$header","_tile$tileset2","_tile$tileset2$tilese","tileset","header","fields","attribute","hasOwnProperty","attributeValues","valueType","getFeatureIdsAttributeName","objectIdsAttribute","find","includes","objectIdsAttributeName","objectIds","value","attributeIndex","indexOf","getFeatureAttributesByIndex","featureIdIndex","attributesObject","codedValues","getAttributeCodedValues","getAttributeByIndexAndAttributeName","formatAttributeValue","_attributeField$domai","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,IAAAA,KAAA,G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AAc,CAAC;AAC9C;AAQA,SAASN,oBAAoBA,CAACnB,SAAS,EAAEc,cAAc,EAAEE,WAAW,EAAE;EACpE,IAAIN,KAAK,GAAG9D,WAAW;EAEvB,IAAIoD,SAAS,IAAKc,cAAc,IAAId,SAAU,EAAE;IAE9CU,KAAK,GAAGkB,MAAM,CAAC5B,SAAS,CAACc,cAAc,CAAC,CAAC,CAACe,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAACC,IAAI,CAAC,CAAC;EAC7E;EAGA,IAAId,WAAW,CAACjD,MAAM,EAAE;IACtB,MAAMgE,SAAS,GAAGf,WAAW,CAACV,IAAI,CAAC0B,UAAU,IAAIA,UAAU,CAACC,IAAI,KAAKC,MAAM,CAACxB,KAAK,CAAC,CAAC;IACnFA,KAAK,GAAG,CAAAqB,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAEhF,IAAI,KAAIH,WAAW;EACxC;EAEA,OAAO8D,KAAK;AACd"}
|
|
@@ -1,46 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.I3SBuildingSceneLayerLoader = void 0;
|
|
8
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
7
|
var _parseI3sBuildingSceneLayer = require("./lib/parsers/parse-i3s-building-scene-layer");
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
const VERSION = typeof "3.4.15" !== 'undefined' ? "3.4.15" : 'latest';
|
|
9
|
+
const I3SBuildingSceneLayerLoader = {
|
|
13
10
|
name: 'I3S Building Scene Layer',
|
|
14
11
|
id: 'i3s-building-scene-layer',
|
|
15
12
|
module: 'i3s',
|
|
16
13
|
version: VERSION,
|
|
17
14
|
mimeTypes: ['application/json'],
|
|
18
|
-
parse
|
|
15
|
+
parse,
|
|
19
16
|
extensions: ['json'],
|
|
20
17
|
options: {}
|
|
21
18
|
};
|
|
22
19
|
exports.I3SBuildingSceneLayerLoader = I3SBuildingSceneLayerLoader;
|
|
23
|
-
function parse(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
29
|
-
while (1) switch (_context.prev = _context.next) {
|
|
30
|
-
case 0:
|
|
31
|
-
if (context !== null && context !== void 0 && context.url) {
|
|
32
|
-
_context.next = 2;
|
|
33
|
-
break;
|
|
34
|
-
}
|
|
35
|
-
throw new Error('Url is not provided');
|
|
36
|
-
case 2:
|
|
37
|
-
return _context.abrupt("return", (0, _parseI3sBuildingSceneLayer.parseBuildingSceneLayer)(data, context.url));
|
|
38
|
-
case 3:
|
|
39
|
-
case "end":
|
|
40
|
-
return _context.stop();
|
|
41
|
-
}
|
|
42
|
-
}, _callee);
|
|
43
|
-
}));
|
|
44
|
-
return _parse.apply(this, arguments);
|
|
20
|
+
async function parse(data, options, context) {
|
|
21
|
+
if (!(context !== null && context !== void 0 && context.url)) {
|
|
22
|
+
throw new Error('Url is not provided');
|
|
23
|
+
}
|
|
24
|
+
return (0, _parseI3sBuildingSceneLayer.parseBuildingSceneLayer)(data, context.url);
|
|
45
25
|
}
|
|
46
26
|
//# sourceMappingURL=i3s-building-scene-layer-loader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i3s-building-scene-layer-loader.js","names":["_parseI3sBuildingSceneLayer","require","VERSION","I3SBuildingSceneLayerLoader","name","id","module","version","mimeTypes","parse","extensions","options","exports","
|
|
1
|
+
{"version":3,"file":"i3s-building-scene-layer-loader.js","names":["_parseI3sBuildingSceneLayer","require","VERSION","I3SBuildingSceneLayerLoader","name","id","module","version","mimeTypes","parse","extensions","options","exports","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__ : 'latest';\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,IAAAA,2BAAA,GAAAC,OAAA;AAKA,MAAMC,OAAO,GAAG,eAAkB,KAAK,WAAW,cAAiB,QAAQ;AAIpE,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;AAACC,OAAA,CAAAT,2BAAA,GAAAA,2BAAA;AAEF,eAAeM,KAAKA,CAClBI,IAAiB,EACjBF,OAAuB,EACvBG,OAAuB,EACa;EACpC,IAAI,EAACA,OAAO,aAAPA,OAAO,eAAPA,OAAO,CAAEC,GAAG,GAAE;IACjB,MAAM,IAAIC,KAAK,CAAC,qBAAqB,CAAC;EACxC;EAEA,OAAO,IAAAC,mDAAuB,EAACJ,IAAI,EAAEC,OAAO,CAACC,GAAG,CAAC;AACnD"}
|
|
@@ -1,57 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.I3SContentLoader = void 0;
|
|
8
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
7
|
var _workerUtils = require("@loaders.gl/worker-utils");
|
|
11
8
|
var _parseI3sTileContent = require("./lib/parsers/parse-i3s-tile-content");
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
const VERSION = typeof "3.4.15" !== 'undefined' ? "3.4.15" : 'latest';
|
|
10
|
+
const I3SContentLoader = {
|
|
14
11
|
name: 'I3S Content (Indexed Scene Layers)',
|
|
15
12
|
id: _workerUtils.isBrowser ? 'i3s-content' : 'i3s-content-nodejs',
|
|
16
13
|
module: 'i3s',
|
|
17
14
|
worker: true,
|
|
18
15
|
version: VERSION,
|
|
19
16
|
mimeTypes: ['application/octet-stream'],
|
|
20
|
-
parse
|
|
17
|
+
parse,
|
|
21
18
|
extensions: ['bin'],
|
|
22
19
|
options: {
|
|
23
20
|
'i3s-content': {}
|
|
24
21
|
}
|
|
25
22
|
};
|
|
26
23
|
exports.I3SContentLoader = I3SContentLoader;
|
|
27
|
-
function parse(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
_context.next = 5;
|
|
41
|
-
break;
|
|
42
|
-
}
|
|
43
|
-
return _context.abrupt("return", null);
|
|
44
|
-
case 5:
|
|
45
|
-
_context.next = 7;
|
|
46
|
-
return (0, _parseI3sTileContent.parseI3STileContent)(data, tileOptions, tilesetOptions, options, context);
|
|
47
|
-
case 7:
|
|
48
|
-
return _context.abrupt("return", _context.sent);
|
|
49
|
-
case 8:
|
|
50
|
-
case "end":
|
|
51
|
-
return _context.stop();
|
|
52
|
-
}
|
|
53
|
-
}, _callee);
|
|
54
|
-
}));
|
|
55
|
-
return _parse.apply(this, arguments);
|
|
24
|
+
async function parse(data, options, context) {
|
|
25
|
+
const {
|
|
26
|
+
tile,
|
|
27
|
+
_tileOptions,
|
|
28
|
+
tileset,
|
|
29
|
+
_tilesetOptions
|
|
30
|
+
} = (options === null || options === void 0 ? void 0 : options.i3s) || {};
|
|
31
|
+
const tileOptions = _tileOptions || tile;
|
|
32
|
+
const tilesetOptions = _tilesetOptions || tileset;
|
|
33
|
+
if (!tileOptions || !tilesetOptions) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
return await (0, _parseI3sTileContent.parseI3STileContent)(data, tileOptions, tilesetOptions, options, context);
|
|
56
37
|
}
|
|
57
38
|
//# sourceMappingURL=i3s-content-loader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i3s-content-loader.js","names":["_workerUtils","require","_parseI3sTileContent","VERSION","I3SContentLoader","name","id","isBrowser","module","worker","version","mimeTypes","parse","extensions","options","exports","
|
|
1
|
+
{"version":3,"file":"i3s-content-loader.js","names":["_workerUtils","require","_parseI3sTileContent","VERSION","I3SContentLoader","name","id","isBrowser","module","worker","version","mimeTypes","parse","extensions","options","exports","data","context","tile","_tileOptions","tileset","_tilesetOptions","i3s","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__ : 'latest';\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,IAAAA,YAAA,GAAAC,OAAA;AAGA,IAAAC,oBAAA,GAAAD,OAAA;AAMA,MAAME,OAAO,GAAG,eAAkB,KAAK,WAAW,cAAiB,QAAQ;AAIpE,MAAMC,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;EACLC,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,OAAO,EAAE;IACP,aAAa,EAAE,CAAC;EAClB;AACF,CAAC;AAACC,OAAA,CAAAX,gBAAA,GAAAA,gBAAA;AAEF,eAAeQ,KAAKA,CAACI,IAAI,EAAEF,OAA0B,EAAEG,OAAuB,EAAE;EAC9E,MAAM;IAACC,IAAI;IAAEC,YAAY;IAAEC,OAAO;IAAEC;EAAe,CAAC,GAAG,CAAAP,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEQ,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,MAAM,IAAAC,wCAAmB,EAC9BT,IAAI,EACJO,WAAW,EACXC,cAAc,EACdV,OAAO,EACPG,OACF,CAAC;AACH"}
|