@loaders.gl/i3s 3.0.13 → 3.0.14
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.es5.min.js +1 -1
- package/dist/dist.es5.min.js.map +1 -1
- package/dist/dist.min.js +1 -1
- package/dist/dist.min.js.map +1 -1
- package/dist/es5/bundle.js +2 -2
- package/dist/es5/bundle.js.map +1 -1
- package/dist/es5/i3s-attribute-loader.js +132 -53
- package/dist/es5/i3s-attribute-loader.js.map +1 -1
- package/dist/es5/i3s-content-loader.js +36 -10
- package/dist/es5/i3s-content-loader.js.map +1 -1
- package/dist/es5/i3s-loader.js +175 -51
- package/dist/es5/i3s-loader.js.map +1 -1
- package/dist/es5/i3s-node-page-loader.js +51 -8
- package/dist/es5/i3s-node-page-loader.js.map +1 -1
- package/dist/es5/index.js +4 -4
- package/dist/es5/lib/helpers/i3s-nodepages-tiles.js +313 -163
- package/dist/es5/lib/helpers/i3s-nodepages-tiles.js.map +1 -1
- package/dist/es5/lib/parsers/constants.js +9 -9
- package/dist/es5/lib/parsers/constants.js.map +1 -1
- package/dist/es5/lib/parsers/parse-i3s-attribute.js +68 -26
- package/dist/es5/lib/parsers/parse-i3s-attribute.js.map +1 -1
- package/dist/es5/lib/parsers/parse-i3s-tile-content.js +405 -276
- package/dist/es5/lib/parsers/parse-i3s-tile-content.js.map +1 -1
- package/dist/es5/lib/parsers/parse-i3s.js +70 -31
- package/dist/es5/lib/parsers/parse-i3s.js.map +1 -1
- package/dist/es5/lib/utils/convert-i3s-obb-to-mbs.js +8 -4
- package/dist/es5/lib/utils/convert-i3s-obb-to-mbs.js.map +1 -1
- package/dist/es5/lib/utils/url-utils.js +14 -17
- package/dist/es5/lib/utils/url-utils.js.map +1 -1
- package/dist/esm/i3s-attribute-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/i3s-content-worker.js +1 -1
- package/dist/i3s-content-worker.js.map +1 -1
- package/package.json +9 -9
package/dist/es5/bundle.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
var moduleExports = require('./index');
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
var _global = typeof window === 'undefined' ? global : window;
|
|
6
6
|
|
|
7
7
|
_global.loaders = _global.loaders || {};
|
|
8
8
|
module.exports = Object.assign(_global.loaders, moduleExports);
|
package/dist/es5/bundle.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/bundle.ts"],"names":["moduleExports","require","_global","window","global","loaders","module","exports","Object","assign"],"mappings":";;AACA,
|
|
1
|
+
{"version":3,"sources":["../../src/bundle.ts"],"names":["moduleExports","require","_global","window","global","loaders","module","exports","Object","assign"],"mappings":";;AACA,IAAMA,aAAa,GAAGC,OAAO,CAAC,SAAD,CAA7B;;AACA,IAAMC,OAAO,GAAG,OAAOC,MAAP,KAAkB,WAAlB,GAAgCC,MAAhC,GAAyCD,MAAzD;;AACAD,OAAO,CAACG,OAAR,GAAkBH,OAAO,CAACG,OAAR,IAAmB,EAArC;AACAC,MAAM,CAACC,OAAP,GAAiBC,MAAM,CAACC,MAAP,CAAcP,OAAO,CAACG,OAAtB,EAA+BL,aAA/B,CAAjB","sourcesContent":["// @ts-nocheck\nconst moduleExports = require('./index');\nconst _global = typeof window === 'undefined' ? global : window;\n_global.loaders = _global.loaders || {};\nmodule.exports = Object.assign(_global.loaders, moduleExports);\n"],"file":"bundle.js"}
|
|
@@ -1,82 +1,159 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
8
|
exports.loadFeatureAttributes = loadFeatureAttributes;
|
|
7
9
|
exports.I3SAttributeLoader = void 0;
|
|
8
10
|
|
|
11
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
12
|
+
|
|
13
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
14
|
+
|
|
15
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
16
|
+
|
|
9
17
|
var _core = require("@loaders.gl/core");
|
|
10
18
|
|
|
11
19
|
var _parseI3sAttribute = require("./lib/parsers/parse-i3s-attribute");
|
|
12
20
|
|
|
13
21
|
var _urlUtils = require("./lib/utils/url-utils");
|
|
14
22
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
23
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
24
|
+
|
|
25
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
26
|
+
|
|
27
|
+
var VERSION = typeof "3.0.14" !== 'undefined' ? "3.0.14" : 'latest';
|
|
28
|
+
var EMPTY_VALUE = '';
|
|
29
|
+
var REJECTED_STATUS = 'rejected';
|
|
30
|
+
var I3SAttributeLoader = {
|
|
19
31
|
name: 'I3S Attribute',
|
|
20
32
|
id: 'i3s-attribute',
|
|
21
33
|
module: 'i3s',
|
|
22
34
|
version: VERSION,
|
|
23
35
|
mimeTypes: ['application/binary'],
|
|
24
|
-
parse,
|
|
36
|
+
parse: parse,
|
|
25
37
|
extensions: ['bin'],
|
|
26
38
|
options: {},
|
|
27
39
|
binary: true
|
|
28
40
|
};
|
|
29
41
|
exports.I3SAttributeLoader = I3SAttributeLoader;
|
|
30
42
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return data;
|
|
43
|
+
function parse(_x, _x2) {
|
|
44
|
+
return _parse.apply(this, arguments);
|
|
34
45
|
}
|
|
35
46
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
const attributeType = getAttributeValueType(attributeStorageInfo[index]);
|
|
55
|
-
const loadOptions = { ...options,
|
|
56
|
-
attributeName,
|
|
57
|
-
attributeType
|
|
58
|
-
};
|
|
59
|
-
const promise = (0, _core.load)(url, I3SAttributeLoader, loadOptions);
|
|
60
|
-
attributeLoadPromises.push(promise);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
try {
|
|
64
|
-
attributes = await Promise.allSettled(attributeLoadPromises);
|
|
65
|
-
} catch (error) {}
|
|
47
|
+
function _parse() {
|
|
48
|
+
_parse = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(data, options) {
|
|
49
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
50
|
+
while (1) {
|
|
51
|
+
switch (_context.prev = _context.next) {
|
|
52
|
+
case 0:
|
|
53
|
+
data = (0, _parseI3sAttribute.parseI3STileAttribute)(data, options);
|
|
54
|
+
return _context.abrupt("return", data);
|
|
55
|
+
|
|
56
|
+
case 2:
|
|
57
|
+
case "end":
|
|
58
|
+
return _context.stop();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}, _callee);
|
|
62
|
+
}));
|
|
63
|
+
return _parse.apply(this, arguments);
|
|
64
|
+
}
|
|
66
65
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
function loadFeatureAttributes(_x3, _x4) {
|
|
67
|
+
return _loadFeatureAttributes.apply(this, arguments);
|
|
68
|
+
}
|
|
70
69
|
|
|
71
|
-
|
|
70
|
+
function _loadFeatureAttributes() {
|
|
71
|
+
_loadFeatureAttributes = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee2(tile, featureId) {
|
|
72
|
+
var options,
|
|
73
|
+
_getAttributesData,
|
|
74
|
+
attributeStorageInfo,
|
|
75
|
+
attributeUrls,
|
|
76
|
+
attributes,
|
|
77
|
+
attributeLoadPromises,
|
|
78
|
+
index,
|
|
79
|
+
_options$i3s,
|
|
80
|
+
url,
|
|
81
|
+
attributeName,
|
|
82
|
+
attributeType,
|
|
83
|
+
loadOptions,
|
|
84
|
+
promise,
|
|
85
|
+
_args2 = arguments;
|
|
86
|
+
|
|
87
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
88
|
+
while (1) {
|
|
89
|
+
switch (_context2.prev = _context2.next) {
|
|
90
|
+
case 0:
|
|
91
|
+
options = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : {};
|
|
92
|
+
_getAttributesData = getAttributesData(tile), attributeStorageInfo = _getAttributesData.attributeStorageInfo, attributeUrls = _getAttributesData.attributeUrls;
|
|
93
|
+
|
|
94
|
+
if (!(!attributeStorageInfo || !attributeUrls || !featureId)) {
|
|
95
|
+
_context2.next = 4;
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return _context2.abrupt("return", null);
|
|
100
|
+
|
|
101
|
+
case 4:
|
|
102
|
+
attributes = [];
|
|
103
|
+
attributeLoadPromises = [];
|
|
104
|
+
|
|
105
|
+
for (index = 0; index < attributeStorageInfo.length; index++) {
|
|
106
|
+
url = (0, _urlUtils.getUrlWithToken)(attributeUrls[index], (_options$i3s = options.i3s) === null || _options$i3s === void 0 ? void 0 : _options$i3s.token);
|
|
107
|
+
attributeName = attributeStorageInfo[index].name;
|
|
108
|
+
attributeType = getAttributeValueType(attributeStorageInfo[index]);
|
|
109
|
+
loadOptions = _objectSpread(_objectSpread({}, options), {}, {
|
|
110
|
+
attributeName: attributeName,
|
|
111
|
+
attributeType: attributeType
|
|
112
|
+
});
|
|
113
|
+
promise = (0, _core.load)(url, I3SAttributeLoader, loadOptions);
|
|
114
|
+
attributeLoadPromises.push(promise);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
_context2.prev = 7;
|
|
118
|
+
_context2.next = 10;
|
|
119
|
+
return Promise.allSettled(attributeLoadPromises);
|
|
120
|
+
|
|
121
|
+
case 10:
|
|
122
|
+
attributes = _context2.sent;
|
|
123
|
+
_context2.next = 15;
|
|
124
|
+
break;
|
|
125
|
+
|
|
126
|
+
case 13:
|
|
127
|
+
_context2.prev = 13;
|
|
128
|
+
_context2.t0 = _context2["catch"](7);
|
|
129
|
+
|
|
130
|
+
case 15:
|
|
131
|
+
if (attributes.length) {
|
|
132
|
+
_context2.next = 17;
|
|
133
|
+
break;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
return _context2.abrupt("return", null);
|
|
137
|
+
|
|
138
|
+
case 17:
|
|
139
|
+
return _context2.abrupt("return", generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId));
|
|
140
|
+
|
|
141
|
+
case 18:
|
|
142
|
+
case "end":
|
|
143
|
+
return _context2.stop();
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}, _callee2, null, [[7, 13]]);
|
|
147
|
+
}));
|
|
148
|
+
return _loadFeatureAttributes.apply(this, arguments);
|
|
72
149
|
}
|
|
73
150
|
|
|
74
151
|
function getAttributesData(tile) {
|
|
75
|
-
|
|
76
|
-
|
|
152
|
+
var attributeStorageInfo = tile && tile.tileset && tile.tileset.tileset && tile.tileset.tileset.attributeStorageInfo;
|
|
153
|
+
var attributeUrls = tile && tile.header && tile.header.attributeUrls;
|
|
77
154
|
return {
|
|
78
|
-
attributeStorageInfo,
|
|
79
|
-
attributeUrls
|
|
155
|
+
attributeStorageInfo: attributeStorageInfo,
|
|
156
|
+
attributeUrls: attributeUrls
|
|
80
157
|
};
|
|
81
158
|
}
|
|
82
159
|
|
|
@@ -91,13 +168,15 @@ function getAttributeValueType(attribute) {
|
|
|
91
168
|
}
|
|
92
169
|
|
|
93
170
|
function generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId) {
|
|
94
|
-
|
|
171
|
+
var objectIds = attributes.find(function (attribute) {
|
|
172
|
+
return attribute.value.OBJECTID;
|
|
173
|
+
});
|
|
95
174
|
|
|
96
175
|
if (!objectIds) {
|
|
97
176
|
return null;
|
|
98
177
|
}
|
|
99
178
|
|
|
100
|
-
|
|
179
|
+
var attributeIndex = objectIds.value.OBJECTID.indexOf(featureId);
|
|
101
180
|
|
|
102
181
|
if (attributeIndex < 0) {
|
|
103
182
|
return null;
|
|
@@ -107,11 +186,11 @@ function generateAttributesByFeatureId(attributes, attributeStorageInfo, feature
|
|
|
107
186
|
}
|
|
108
187
|
|
|
109
188
|
function getFeatureAttributesByIndex(attributes, featureIdIndex, attributeStorageInfo) {
|
|
110
|
-
|
|
189
|
+
var attributesObject = {};
|
|
111
190
|
|
|
112
|
-
for (
|
|
113
|
-
|
|
114
|
-
|
|
191
|
+
for (var index = 0; index < attributeStorageInfo.length; index++) {
|
|
192
|
+
var attributeName = attributeStorageInfo[index].name;
|
|
193
|
+
var attribute = getAttributeByIndexAndAttributeName(attributes, index, attributeName);
|
|
115
194
|
attributesObject[attributeName] = formatAttributeValue(attribute, featureIdIndex);
|
|
116
195
|
}
|
|
117
196
|
|
|
@@ -119,7 +198,7 @@ function getFeatureAttributesByIndex(attributes, featureIdIndex, attributeStorag
|
|
|
119
198
|
}
|
|
120
199
|
|
|
121
200
|
function getAttributeByIndexAndAttributeName(attributes, index, attributesName) {
|
|
122
|
-
|
|
201
|
+
var attributeObject = attributes[index];
|
|
123
202
|
|
|
124
203
|
if (attributeObject.status === REJECTED_STATUS) {
|
|
125
204
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/i3s-attribute-loader.ts"],"names":["VERSION","EMPTY_VALUE","REJECTED_STATUS","I3SAttributeLoader","name","id","module","version","mimeTypes","parse","extensions","options","binary","data","loadFeatureAttributes","tile","featureId","
|
|
1
|
+
{"version":3,"sources":["../../src/i3s-attribute-loader.ts"],"names":["VERSION","EMPTY_VALUE","REJECTED_STATUS","I3SAttributeLoader","name","id","module","version","mimeTypes","parse","extensions","options","binary","data","loadFeatureAttributes","tile","featureId","getAttributesData","attributeStorageInfo","attributeUrls","attributes","attributeLoadPromises","index","length","url","i3s","token","attributeName","attributeType","getAttributeValueType","loadOptions","promise","push","Promise","allSettled","generateAttributesByFeatureId","tileset","header","attribute","hasOwnProperty","attributeValues","valueType","objectIds","find","value","OBJECTID","attributeIndex","indexOf","getFeatureAttributesByIndex","featureIdIndex","attributesObject","getAttributeByIndexAndAttributeName","formatAttributeValue","attributesName","attributeObject","status","toString","replace","trim"],"mappings":";;;;;;;;;;;;;;;;AACA;;AACA;;AACA;;;;;;AAIA,IAAMA,OAAO,GAAG,oBAAuB,WAAvB,cAAmD,QAAnE;AACA,IAAMC,WAAW,GAAG,EAApB;AACA,IAAMC,eAAe,GAAG,UAAxB;AAIO,IAAMC,kBAAoC,GAAG;AAClDC,EAAAA,IAAI,EAAE,eAD4C;AAElDC,EAAAA,EAAE,EAAE,eAF8C;AAGlDC,EAAAA,MAAM,EAAE,KAH0C;AAIlDC,EAAAA,OAAO,EAAEP,OAJyC;AAKlDQ,EAAAA,SAAS,EAAE,CAAC,oBAAD,CALuC;AAMlDC,EAAAA,KAAK,EAALA,KANkD;AAOlDC,EAAAA,UAAU,EAAE,CAAC,KAAD,CAPsC;AAQlDC,EAAAA,OAAO,EAAE,EAR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QD,SAASD,oBAAT,CAA8Bd,SAA9B,EAAyCW,cAAzC,EAAyD;AACvD,SAAOX,SAAS,IAAIA,SAAS,CAACW,cAAD,CAAtB,GACHX,SAAS,CAACW,cAAD,CAAT,CACCO,QADD,GAGCC,OAHD,CAGS,SAHT,EAGoB,EAHpB,EAICC,IAJD,EADG,GAMHzD,WANJ;AAOD","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} = getAttributesData(tile);\n\n if (!attributeStorageInfo || !attributeUrls || !featureId) {\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);\n}\n\nfunction getAttributesData(tile) {\n const attributeStorageInfo =\n tile && tile.tileset && tile.tileset.tileset && tile.tileset.tileset.attributeStorageInfo;\n const attributeUrls = tile && tile.header && tile.header.attributeUrls;\n\n return {attributeStorageInfo, attributeUrls};\n}\n\n/**\n * Get attribute value type based on property names\n * @param {Object} attribute\n * @returns {String}\n */\nfunction 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 * 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) {\n const objectIds = attributes.find((attribute) => attribute.value.OBJECTID);\n\n if (!objectIds) {\n return null;\n }\n\n const attributeIndex = objectIds.value.OBJECTID.indexOf(featureId);\n\n if (attributeIndex < 0) {\n return null;\n }\n\n return getFeatureAttributesByIndex(attributes, attributeIndex, attributeStorageInfo);\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) {\n const attributesObject = {};\n\n for (let index = 0; index < attributeStorageInfo.length; index++) {\n const attributeName = attributeStorageInfo[index].name;\n const attribute = getAttributeByIndexAndAttributeName(attributes, index, attributeName);\n attributesObject[attributeName] = formatAttributeValue(attribute, featureIdIndex);\n }\n\n return attributesObject;\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) {\n return attribute && attribute[featureIdIndex]\n ? attribute[featureIdIndex]\n .toString()\n // eslint-disable-next-line no-control-regex\n .replace(/\\u0000/g, '')\n .trim()\n : EMPTY_VALUE;\n}\n"],"file":"i3s-attribute-loader.js"}
|
|
@@ -1,21 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
8
|
exports.I3SContentLoader = void 0;
|
|
7
9
|
|
|
10
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
+
|
|
12
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
+
|
|
8
14
|
var _parseI3sTileContent = require("./lib/parsers/parse-i3s-tile-content");
|
|
9
15
|
|
|
10
|
-
|
|
11
|
-
|
|
16
|
+
var VERSION = typeof "3.0.14" !== 'undefined' ? "3.0.14" : 'latest';
|
|
17
|
+
var I3SContentLoader = {
|
|
12
18
|
name: 'I3S Content (Indexed Scene Layers)',
|
|
13
19
|
id: 'i3s-content',
|
|
14
20
|
module: 'i3s',
|
|
15
21
|
worker: true,
|
|
16
22
|
version: VERSION,
|
|
17
23
|
mimeTypes: ['application/octet-stream'],
|
|
18
|
-
parse,
|
|
24
|
+
parse: parse,
|
|
19
25
|
extensions: ['bin'],
|
|
20
26
|
options: {
|
|
21
27
|
'i3s-content': {}
|
|
@@ -23,12 +29,32 @@ const I3SContentLoader = {
|
|
|
23
29
|
};
|
|
24
30
|
exports.I3SContentLoader = I3SContentLoader;
|
|
25
31
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
function parse(_x, _x2, _x3) {
|
|
33
|
+
return _parse.apply(this, arguments);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function _parse() {
|
|
37
|
+
_parse = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(data, options, context) {
|
|
38
|
+
var _ref, tile, tileset;
|
|
39
|
+
|
|
40
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
41
|
+
while (1) {
|
|
42
|
+
switch (_context.prev = _context.next) {
|
|
43
|
+
case 0:
|
|
44
|
+
_ref = (options === null || options === void 0 ? void 0 : options.i3s) || {}, tile = _ref.tile, tileset = _ref.tileset;
|
|
45
|
+
_context.next = 3;
|
|
46
|
+
return (0, _parseI3sTileContent.parseI3STileContent)(data, tile, tileset, options, context);
|
|
47
|
+
|
|
48
|
+
case 3:
|
|
49
|
+
return _context.abrupt("return", tile.content);
|
|
50
|
+
|
|
51
|
+
case 4:
|
|
52
|
+
case "end":
|
|
53
|
+
return _context.stop();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}, _callee);
|
|
57
|
+
}));
|
|
58
|
+
return _parse.apply(this, arguments);
|
|
33
59
|
}
|
|
34
60
|
//# sourceMappingURL=i3s-content-loader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/i3s-content-loader.ts"],"names":["VERSION","I3SContentLoader","name","id","module","worker","version","mimeTypes","parse","extensions","options","data","context","
|
|
1
|
+
{"version":3,"sources":["../../src/i3s-content-loader.ts"],"names":["VERSION","I3SContentLoader","name","id","module","worker","version","mimeTypes","parse","extensions","options","data","context","i3s","tile","tileset","content"],"mappings":";;;;;;;;;;;;;AACA;;AAKA,IAAMA,OAAO,GAAG,oBAAuB,WAAvB,cAAmD,QAAnE;AAIO,IAAMC,gBAAkC,GAAG;AAChDC,EAAAA,IAAI,EAAE,oCAD0C;AAEhDC,EAAAA,EAAE,EAAE,aAF4C;AAGhDC,EAAAA,MAAM,EAAE,KAHwC;AAIhDC,EAAAA,MAAM,EAAE,IAJwC;AAKhDC,EAAAA,OAAO,EAAEN,OALuC;AAMhDO,EAAAA,SAAS,EAAE,CAAC,0BAAD,CANqC;AAOhDC,EAAAA,KAAK,EAALA,KAPgD;AAQhDC,EAAAA,UAAU,EAAE,CAAC,KAAD,CARoC;AAShDC,EAAAA,OAAO,EAAE;AACP,mBAAe;AADR;AATuC,CAA3C;;;SAcQF,K;;;;;qEAAf,iBAAqBG,IAArB,EAA2BD,OAA3B,EAAoDE,OAApD;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA,mBAC0B,CAAAF,OAAO,SAAP,IAAAA,OAAO,WAAP,YAAAA,OAAO,CAAEG,GAAT,KAAgB,EAD1C,EACSC,IADT,QACSA,IADT,EACeC,OADf,QACeA,OADf;AAAA;AAAA,mBAEQ,8CAAoBJ,IAApB,EAA0BG,IAA1B,EAAgCC,OAAhC,EAAyCL,OAAzC,EAAkDE,OAAlD,CAFR;;AAAA;AAAA,6CAGSE,IAAI,CAACE,OAHd;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G","sourcesContent":["import type {LoaderWithParser, LoaderOptions, LoaderContext} from '@loaders.gl/loader-utils';\nimport {parseI3STileContent} from './lib/parsers/parse-i3s-tile-content';\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: 'i3s-content',\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?: LoaderOptions, context?: LoaderContext) {\n const {tile, tileset} = options?.i3s || {};\n await parseI3STileContent(data, tile, tileset, options, context);\n return tile.content;\n}\n"],"file":"i3s-content-loader.js"}
|