@loaders.gl/i3s 3.4.0-alpha.1 → 3.4.0-alpha.3
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 +421 -210
- package/dist/es5/arcgis-webscene-loader.js +7 -11
- package/dist/es5/arcgis-webscene-loader.js.map +1 -1
- package/dist/es5/i3s-attribute-loader.js +51 -63
- package/dist/es5/i3s-attribute-loader.js.map +1 -1
- package/dist/es5/i3s-building-scene-layer-loader.js +13 -16
- package/dist/es5/i3s-building-scene-layer-loader.js.map +1 -1
- package/dist/es5/i3s-content-loader.js +19 -22
- package/dist/es5/i3s-content-loader.js.map +1 -1
- package/dist/es5/i3s-loader.js +86 -94
- package/dist/es5/i3s-loader.js.map +1 -1
- package/dist/es5/i3s-node-page-loader.js +14 -18
- package/dist/es5/i3s-node-page-loader.js.map +1 -1
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/lib/helpers/i3s-nodepages-tiles.js +109 -124
- package/dist/es5/lib/helpers/i3s-nodepages-tiles.js.map +1 -1
- package/dist/es5/lib/parsers/constants.js +4 -5
- package/dist/es5/lib/parsers/constants.js.map +1 -1
- package/dist/es5/lib/parsers/parse-arcgis-webscene.js +99 -107
- package/dist/es5/lib/parsers/parse-arcgis-webscene.js.map +1 -1
- package/dist/es5/lib/parsers/parse-i3s-attribute.js +14 -21
- package/dist/es5/lib/parsers/parse-i3s-attribute.js.map +1 -1
- package/dist/es5/lib/parsers/parse-i3s-building-scene-layer.js +13 -17
- package/dist/es5/lib/parsers/parse-i3s-building-scene-layer.js.map +1 -1
- package/dist/es5/lib/parsers/parse-i3s-tile-content.js +166 -187
- package/dist/es5/lib/parsers/parse-i3s-tile-content.js.map +1 -1
- package/dist/es5/lib/parsers/parse-i3s.js +31 -35
- package/dist/es5/lib/parsers/parse-i3s.js.map +1 -1
- package/dist/es5/lib/utils/convert-i3s-obb-to-mbs.js.map +1 -1
- package/dist/es5/lib/utils/customizeColors.js +102 -107
- package/dist/es5/lib/utils/customizeColors.js.map +1 -1
- package/dist/es5/lib/utils/url-utils.js +0 -2
- package/dist/es5/lib/utils/url-utils.js.map +1 -1
- package/dist/es5/types.js +8 -8
- package/dist/es5/types.js.map +1 -1
- package/dist/es5/workers/i3s-content-nodejs-worker.js.map +1 -1
- package/dist/es5/workers/i3s-content-worker.js.map +1 -1
- package/dist/esm/arcgis-webscene-loader.js +1 -4
- package/dist/esm/arcgis-webscene-loader.js.map +1 -1
- package/dist/esm/bundle.js +0 -1
- package/dist/esm/bundle.js.map +1 -1
- package/dist/esm/i3s-attribute-loader.js +2 -14
- package/dist/esm/i3s-attribute-loader.js.map +1 -1
- package/dist/esm/i3s-building-scene-layer-loader.js +1 -2
- package/dist/esm/i3s-building-scene-layer-loader.js.map +1 -1
- package/dist/esm/i3s-content-loader.js +1 -2
- package/dist/esm/i3s-content-loader.js.map +1 -1
- package/dist/esm/i3s-loader.js +1 -3
- package/dist/esm/i3s-loader.js.map +1 -1
- package/dist/esm/i3s-node-page-loader.js +1 -3
- package/dist/esm/i3s-node-page-loader.js.map +1 -1
- package/dist/esm/lib/helpers/i3s-nodepages-tiles.js +0 -8
- package/dist/esm/lib/helpers/i3s-nodepages-tiles.js.map +1 -1
- package/dist/esm/lib/parsers/constants.js +3 -4
- package/dist/esm/lib/parsers/constants.js.map +1 -1
- package/dist/esm/lib/parsers/parse-arcgis-webscene.js +0 -4
- package/dist/esm/lib/parsers/parse-arcgis-webscene.js.map +1 -1
- package/dist/esm/lib/parsers/parse-i3s-attribute.js +0 -7
- package/dist/esm/lib/parsers/parse-i3s-attribute.js.map +1 -1
- package/dist/esm/lib/parsers/parse-i3s-building-scene-layer.js +0 -3
- package/dist/esm/lib/parsers/parse-i3s-building-scene-layer.js.map +1 -1
- package/dist/esm/lib/parsers/parse-i3s-tile-content.js +0 -20
- package/dist/esm/lib/parsers/parse-i3s-tile-content.js.map +1 -1
- package/dist/esm/lib/parsers/parse-i3s.js +2 -8
- package/dist/esm/lib/parsers/parse-i3s.js.map +1 -1
- package/dist/esm/lib/utils/convert-i3s-obb-to-mbs.js.map +1 -1
- package/dist/esm/lib/utils/customizeColors.js +0 -4
- package/dist/esm/lib/utils/customizeColors.js.map +1 -1
- package/dist/esm/lib/utils/url-utils.js +0 -3
- package/dist/esm/lib/utils/url-utils.js.map +1 -1
- package/dist/esm/types.js +6 -6
- package/dist/esm/types.js.map +1 -1
- package/dist/i3s-content-nodejs-worker.js +59 -62
- package/dist/i3s-content-nodejs-worker.js.map +3 -3
- package/dist/i3s-content-worker.js +328 -146
- package/dist/lib/helpers/i3s-nodepages-tiles.d.ts.map +1 -1
- package/dist/lib/helpers/i3s-nodepages-tiles.js +5 -1
- package/dist/lib/parsers/parse-i3s-tile-content.d.ts.map +1 -1
- package/dist/lib/parsers/parse-i3s-tile-content.js +2 -0
- package/dist/lib/parsers/parse-i3s.d.ts.map +1 -1
- package/dist/lib/parsers/parse-i3s.js +2 -0
- package/dist/types.d.ts +5 -5
- package/dist/types.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/lib/helpers/i3s-nodepages-tiles.ts +3 -0
- package/src/lib/parsers/parse-i3s-tile-content.ts +2 -0
- package/src/lib/parsers/parse-i3s.ts +2 -0
- package/src/types.ts +6 -5
|
@@ -8,8 +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.4.0-alpha.
|
|
12
|
-
|
|
11
|
+
var VERSION = typeof "3.4.0-alpha.3" !== 'undefined' ? "3.4.0-alpha.3" : 'beta';
|
|
13
12
|
var ArcGisWebSceneLoader = {
|
|
14
13
|
name: 'ArcGIS Web Scene Loader',
|
|
15
14
|
id: 'arcgis-web-scene',
|
|
@@ -20,7 +19,6 @@ var ArcGisWebSceneLoader = {
|
|
|
20
19
|
extensions: ['json'],
|
|
21
20
|
options: {}
|
|
22
21
|
};
|
|
23
|
-
|
|
24
22
|
exports.ArcGisWebSceneLoader = ArcGisWebSceneLoader;
|
|
25
23
|
function parse(_x) {
|
|
26
24
|
return _parse.apply(this, arguments);
|
|
@@ -28,14 +26,12 @@ function parse(_x) {
|
|
|
28
26
|
function _parse() {
|
|
29
27
|
_parse = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(data) {
|
|
30
28
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
31
|
-
while (1) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return _context.stop();
|
|
38
|
-
}
|
|
29
|
+
while (1) switch (_context.prev = _context.next) {
|
|
30
|
+
case 0:
|
|
31
|
+
return _context.abrupt("return", (0, _parseArcgisWebscene.parseWebscene)(data));
|
|
32
|
+
case 1:
|
|
33
|
+
case "end":
|
|
34
|
+
return _context.stop();
|
|
39
35
|
}
|
|
40
36
|
}, _callee);
|
|
41
37
|
}));
|
|
@@ -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,
|
|
1
|
+
{"version":3,"file":"arcgis-webscene-loader.js","names":["_parseArcgisWebscene","require","VERSION","ArcGisWebSceneLoader","name","id","module","version","mimeTypes","parse","extensions","options","exports","_x","_parse","apply","arguments","_asyncToGenerator2","default","_regenerator","mark","_callee","data","wrap","_callee$","_context","prev","next","abrupt","parseWebscene","stop"],"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,IAAAA,oBAAA,GAAAC,OAAA;AAIA,IAAMC,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;AAACC,OAAA,CAAAT,oBAAA,GAAAA,oBAAA;AAAA,SAMaM,KAAKA,CAAAI,EAAA;EAAA,OAAAC,MAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA;AAAA,SAAAF,OAAA;EAAAA,MAAA,OAAAG,kBAAA,CAAAC,OAAA,EAAAC,YAAA,CAAAD,OAAA,CAAAE,IAAA,CAApB,SAAAC,QAAqBC,IAAiB;IAAA,OAAAH,YAAA,CAAAD,OAAA,CAAAK,IAAA,UAAAC,SAAAC,QAAA;MAAA,kBAAAA,QAAA,CAAAC,IAAA,GAAAD,QAAA,CAAAE,IAAA;QAAA;UAAA,OAAAF,QAAA,CAAAG,MAAA,WAC7B,IAAAC,kCAAa,EAACP,IAAI,CAAC;QAAA;QAAA;UAAA,OAAAG,QAAA,CAAAK,IAAA;MAAA;IAAA,GAAAT,OAAA;EAAA,CAC3B;EAAA,OAAAP,MAAA,CAAAC,KAAA,OAAAC,SAAA;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.4.0-alpha.
|
|
18
|
+
var VERSION = typeof "3.4.0-alpha.3" !== 'undefined' ? "3.4.0-alpha.3" : 'latest';
|
|
19
19
|
var EMPTY_VALUE = '';
|
|
20
20
|
var REJECTED_STATUS = 'rejected';
|
|
21
21
|
var I3SAttributeLoader = {
|
|
@@ -36,15 +36,13 @@ function parse(_x, _x2) {
|
|
|
36
36
|
function _parse() {
|
|
37
37
|
_parse = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(data, options) {
|
|
38
38
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
39
|
-
while (1) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return _context.stop();
|
|
47
|
-
}
|
|
39
|
+
while (1) switch (_context.prev = _context.next) {
|
|
40
|
+
case 0:
|
|
41
|
+
data = (0, _parseI3sAttribute.parseI3STileAttribute)(data, options);
|
|
42
|
+
return _context.abrupt("return", data);
|
|
43
|
+
case 2:
|
|
44
|
+
case "end":
|
|
45
|
+
return _context.stop();
|
|
48
46
|
}
|
|
49
47
|
}, _callee);
|
|
50
48
|
}));
|
|
@@ -71,52 +69,50 @@ function _loadFeatureAttributes() {
|
|
|
71
69
|
promise,
|
|
72
70
|
_args2 = arguments;
|
|
73
71
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
74
|
-
while (1) {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
_context2.next = 4;
|
|
81
|
-
break;
|
|
82
|
-
}
|
|
83
|
-
return _context2.abrupt("return", null);
|
|
84
|
-
case 4:
|
|
85
|
-
attributes = [];
|
|
86
|
-
attributeLoadPromises = [];
|
|
87
|
-
for (index = 0; index < attributeStorageInfo.length; index++) {
|
|
88
|
-
url = (0, _urlUtils.getUrlWithToken)(attributeUrls[index], (_options$i3s = options.i3s) === null || _options$i3s === void 0 ? void 0 : _options$i3s.token);
|
|
89
|
-
attributeName = attributeStorageInfo[index].name;
|
|
90
|
-
attributeType = getAttributeValueType(attributeStorageInfo[index]);
|
|
91
|
-
loadOptions = _objectSpread(_objectSpread({}, options), {}, {
|
|
92
|
-
attributeName: attributeName,
|
|
93
|
-
attributeType: attributeType
|
|
94
|
-
});
|
|
95
|
-
promise = (0, _core.load)(url, I3SAttributeLoader, loadOptions);
|
|
96
|
-
attributeLoadPromises.push(promise);
|
|
97
|
-
}
|
|
98
|
-
_context2.prev = 7;
|
|
99
|
-
_context2.next = 10;
|
|
100
|
-
return Promise.allSettled(attributeLoadPromises);
|
|
101
|
-
case 10:
|
|
102
|
-
attributes = _context2.sent;
|
|
103
|
-
_context2.next = 15;
|
|
72
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
73
|
+
case 0:
|
|
74
|
+
options = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : {};
|
|
75
|
+
_getAttributesData = getAttributesData(tile), attributeStorageInfo = _getAttributesData.attributeStorageInfo, attributeUrls = _getAttributesData.attributeUrls, tilesetFields = _getAttributesData.tilesetFields;
|
|
76
|
+
if (!(!attributeStorageInfo || !attributeUrls || featureId < 0)) {
|
|
77
|
+
_context2.next = 4;
|
|
104
78
|
break;
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
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();
|
|
120
116
|
}
|
|
121
117
|
}, _callee2, null, [[7, 13]]);
|
|
122
118
|
}));
|
|
@@ -133,7 +129,6 @@ function getAttributesData(tile) {
|
|
|
133
129
|
tilesetFields: tilesetFields
|
|
134
130
|
};
|
|
135
131
|
}
|
|
136
|
-
|
|
137
132
|
function getAttributeValueType(attribute) {
|
|
138
133
|
if (attribute.hasOwnProperty('objectIds')) {
|
|
139
134
|
return 'Oid32';
|
|
@@ -142,14 +137,12 @@ function getAttributeValueType(attribute) {
|
|
|
142
137
|
}
|
|
143
138
|
return '';
|
|
144
139
|
}
|
|
145
|
-
|
|
146
140
|
function getFeatureIdsAttributeName(attributeStorageInfo) {
|
|
147
141
|
var objectIdsAttribute = attributeStorageInfo.find(function (attribute) {
|
|
148
142
|
return attribute.name.includes('OBJECTID');
|
|
149
143
|
});
|
|
150
144
|
return objectIdsAttribute === null || objectIdsAttribute === void 0 ? void 0 : objectIdsAttribute.name;
|
|
151
145
|
}
|
|
152
|
-
|
|
153
146
|
function generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields) {
|
|
154
147
|
var objectIdsAttributeName = getFeatureIdsAttributeName(attributeStorageInfo);
|
|
155
148
|
var objectIds = attributes.find(function (attribute) {
|
|
@@ -164,7 +157,6 @@ function generateAttributesByFeatureId(attributes, attributeStorageInfo, feature
|
|
|
164
157
|
}
|
|
165
158
|
return getFeatureAttributesByIndex(attributes, attributeIndex, attributeStorageInfo, tilesetFields);
|
|
166
159
|
}
|
|
167
|
-
|
|
168
160
|
function getFeatureAttributesByIndex(attributes, featureIdIndex, attributeStorageInfo, tilesetFields) {
|
|
169
161
|
var attributesObject = {};
|
|
170
162
|
for (var index = 0; index < attributeStorageInfo.length; index++) {
|
|
@@ -175,7 +167,6 @@ function getFeatureAttributesByIndex(attributes, featureIdIndex, attributeStorag
|
|
|
175
167
|
}
|
|
176
168
|
return attributesObject;
|
|
177
169
|
}
|
|
178
|
-
|
|
179
170
|
function getAttributeCodedValues(attributeName, tilesetFields) {
|
|
180
171
|
var _attributeField$domai;
|
|
181
172
|
var attributeField = tilesetFields.find(function (field) {
|
|
@@ -183,7 +174,6 @@ function getAttributeCodedValues(attributeName, tilesetFields) {
|
|
|
183
174
|
});
|
|
184
175
|
return (attributeField === null || attributeField === void 0 ? void 0 : (_attributeField$domai = attributeField.domain) === null || _attributeField$domai === void 0 ? void 0 : _attributeField$domai.codedValues) || [];
|
|
185
176
|
}
|
|
186
|
-
|
|
187
177
|
function getAttributeByIndexAndAttributeName(attributes, index, attributesName) {
|
|
188
178
|
var attributeObject = attributes[index];
|
|
189
179
|
if (attributeObject.status === REJECTED_STATUS) {
|
|
@@ -191,13 +181,11 @@ function getAttributeByIndexAndAttributeName(attributes, index, attributesName)
|
|
|
191
181
|
}
|
|
192
182
|
return attributeObject.value[attributesName];
|
|
193
183
|
}
|
|
194
|
-
|
|
195
184
|
function formatAttributeValue(attribute, featureIdIndex, codedValues) {
|
|
196
185
|
var value = EMPTY_VALUE;
|
|
197
186
|
if (attribute && featureIdIndex in attribute) {
|
|
198
187
|
value = String(attribute[featureIdIndex]).replace(/\u0000|NaN/g, '').trim();
|
|
199
188
|
}
|
|
200
|
-
|
|
201
189
|
if (codedValues.length) {
|
|
202
190
|
var codeValue = codedValues.find(function (codedValue) {
|
|
203
191
|
return codedValue.code === Number(value);
|
|
@@ -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,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,EAAE;AACV,CAAC;AAAC;AAAA,SAEaH,KAAK;EAAA;AAAA;AAAA;EAA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,OAAOoD,KAAK;AACd"}
|
|
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 = codeValue?.name || EMPTY_VALUE;\n }\n\n return value;\n}\n"],"mappings":";;;;;;;;;;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAAsD,SAAAG,QAAAC,MAAA,EAAAC,cAAA,QAAAC,IAAA,GAAAC,MAAA,CAAAD,IAAA,CAAAF,MAAA,OAAAG,MAAA,CAAAC,qBAAA,QAAAC,OAAA,GAAAF,MAAA,CAAAC,qBAAA,CAAAJ,MAAA,GAAAC,cAAA,KAAAI,OAAA,GAAAA,OAAA,CAAAC,MAAA,WAAAC,GAAA,WAAAJ,MAAA,CAAAK,wBAAA,CAAAR,MAAA,EAAAO,GAAA,EAAAE,UAAA,OAAAP,IAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,IAAA,EAAAG,OAAA,YAAAH,IAAA;AAAA,SAAAU,cAAAC,MAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAF,CAAA,UAAAG,MAAA,WAAAF,SAAA,CAAAD,CA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I,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"}
|
|
@@ -8,8 +8,7 @@ exports.I3SBuildingSceneLayerLoader = void 0;
|
|
|
8
8
|
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
|
-
|
|
12
|
-
var VERSION = typeof "3.4.0-alpha.1" !== 'undefined' ? "3.4.0-alpha.1" : 'beta';
|
|
11
|
+
var VERSION = typeof "3.4.0-alpha.3" !== 'undefined' ? "3.4.0-alpha.3" : 'beta';
|
|
13
12
|
var I3SBuildingSceneLayerLoader = {
|
|
14
13
|
name: 'I3S Building Scene Layer',
|
|
15
14
|
id: 'i3s-building-scene-layer',
|
|
@@ -27,20 +26,18 @@ function parse(_x, _x2, _x3) {
|
|
|
27
26
|
function _parse() {
|
|
28
27
|
_parse = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(data, options, context) {
|
|
29
28
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
30
|
-
while (1) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
return _context.stop();
|
|
43
|
-
}
|
|
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();
|
|
44
41
|
}
|
|
45
42
|
}, _callee);
|
|
46
43
|
}));
|
|
@@ -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
|
|
1
|
+
{"version":3,"file":"i3s-building-scene-layer-loader.js","names":["_parseI3sBuildingSceneLayer","require","VERSION","I3SBuildingSceneLayerLoader","name","id","module","version","mimeTypes","parse","extensions","options","exports","_x","_x2","_x3","_parse","apply","arguments","_asyncToGenerator2","default","_regenerator","mark","_callee","data","context","wrap","_callee$","_context","prev","next","url","Error","abrupt","parseBuildingSceneLayer","stop"],"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,IAAAA,2BAAA,GAAAC,OAAA;AAKA,IAAMC,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;AAACC,OAAA,CAAAT,2BAAA,GAAAA,2BAAA;AAAA,SAEaM,KAAKA,CAAAI,EAAA,EAAAC,GAAA,EAAAC,GAAA;EAAA,OAAAC,MAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA;AAAA,SAAAF,OAAA;EAAAA,MAAA,OAAAG,kBAAA,CAAAC,OAAA,EAAAC,YAAA,CAAAD,OAAA,CAAAE,IAAA,CAApB,SAAAC,QACEC,IAAiB,EACjBb,OAAuB,EACvBc,OAAuB;IAAA,OAAAJ,YAAA,CAAAD,OAAA,CAAAM,IAAA,UAAAC,SAAAC,QAAA;MAAA,kBAAAA,QAAA,CAAAC,IAAA,GAAAD,QAAA,CAAAE,IAAA;QAAA;UAAA,IAElBL,OAAO,aAAPA,OAAO,eAAPA,OAAO,CAAEM,GAAG;YAAAH,QAAA,CAAAE,IAAA;YAAA;UAAA;UAAA,MACT,IAAIE,KAAK,CAAC,qBAAqB,CAAC;QAAA;UAAA,OAAAJ,QAAA,CAAAK,MAAA,WAGjC,IAAAC,mDAAuB,EAACV,IAAI,EAAEC,OAAO,CAACM,GAAG,CAAC;QAAA;QAAA;UAAA,OAAAH,QAAA,CAAAO,IAAA;MAAA;IAAA,GAAAZ,OAAA;EAAA,CAClD;EAAA,OAAAP,MAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA"}
|
|
@@ -9,8 +9,7 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
|
|
|
9
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
10
|
var _workerUtils = require("@loaders.gl/worker-utils");
|
|
11
11
|
var _parseI3sTileContent = require("./lib/parsers/parse-i3s-tile-content");
|
|
12
|
-
|
|
13
|
-
var VERSION = typeof "3.4.0-alpha.1" !== 'undefined' ? "3.4.0-alpha.1" : 'beta';
|
|
12
|
+
var VERSION = typeof "3.4.0-alpha.3" !== 'undefined' ? "3.4.0-alpha.3" : 'beta';
|
|
14
13
|
var I3SContentLoader = {
|
|
15
14
|
name: 'I3S Content (Indexed Scene Layers)',
|
|
16
15
|
id: _workerUtils.isBrowser ? 'i3s-content' : 'i3s-content-nodejs',
|
|
@@ -32,26 +31,24 @@ function _parse() {
|
|
|
32
31
|
_parse = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(data, options, context) {
|
|
33
32
|
var _ref, tile, _tileOptions, tileset, _tilesetOptions, tileOptions, tilesetOptions;
|
|
34
33
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
35
|
-
while (1) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return _context.stop();
|
|
54
|
-
}
|
|
34
|
+
while (1) switch (_context.prev = _context.next) {
|
|
35
|
+
case 0:
|
|
36
|
+
_ref = (options === null || options === void 0 ? void 0 : options.i3s) || {}, tile = _ref.tile, _tileOptions = _ref._tileOptions, tileset = _ref.tileset, _tilesetOptions = _ref._tilesetOptions;
|
|
37
|
+
tileOptions = _tileOptions || tile;
|
|
38
|
+
tilesetOptions = _tilesetOptions || tileset;
|
|
39
|
+
if (!(!tileOptions || !tilesetOptions)) {
|
|
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();
|
|
55
52
|
}
|
|
56
53
|
}, _callee);
|
|
57
54
|
}));
|
|
@@ -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","
|
|
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","_x","_x2","_x3","_parse","apply","arguments","_asyncToGenerator2","default","_regenerator","mark","_callee","data","context","_ref","tile","_tileOptions","tileset","_tilesetOptions","tileOptions","tilesetOptions","wrap","_callee$","_context","prev","next","i3s","abrupt","parseI3STileContent","sent","stop"],"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,IAAAA,YAAA,GAAAC,OAAA;AAGA,IAAAC,oBAAA,GAAAD,OAAA;AAMA,IAAME,OAAO,GAAG,sBAAkB,KAAK,WAAW,qBAAiB,MAAM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