@loaders.gl/i3s 4.0.0-alpha.5 → 4.0.0-alpha.7
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/arcgis-webscene-loader.d.ts +7 -0
- package/dist/arcgis-webscene-loader.d.ts.map +1 -0
- package/dist/arcgis-webscene-loader.js +28 -0
- package/dist/bundle.js +2 -2
- package/dist/dist.min.js +9390 -8570
- package/dist/es5/arcgis-webscene-loader.js +40 -0
- package/dist/es5/arcgis-webscene-loader.js.map +1 -0
- package/dist/es5/bundle.js +6 -0
- package/dist/es5/bundle.js.map +1 -0
- package/dist/es5/i3s-attribute-loader.js +195 -0
- package/dist/es5/i3s-attribute-loader.js.map +1 -0
- package/dist/es5/i3s-building-scene-layer-loader.js +46 -0
- package/dist/es5/i3s-building-scene-layer-loader.js.map +1 -0
- package/dist/es5/i3s-content-loader.js +56 -0
- package/dist/es5/i3s-content-loader.js.map +1 -0
- package/dist/es5/i3s-loader.js +193 -0
- package/dist/es5/i3s-loader.js.map +1 -0
- package/dist/es5/i3s-node-page-loader.js +39 -0
- package/dist/es5/i3s-node-page-loader.js.map +1 -0
- package/dist/es5/i3s-slpk-loader.js +20 -0
- package/dist/es5/i3s-slpk-loader.js.map +1 -0
- package/dist/es5/index.js +68 -0
- package/dist/es5/index.js.map +1 -0
- package/dist/es5/lib/helpers/i3s-nodepages-tiles.js +312 -0
- package/dist/es5/lib/helpers/i3s-nodepages-tiles.js.map +1 -0
- package/dist/es5/lib/parsers/constants.js +72 -0
- package/dist/es5/lib/parsers/constants.js.map +1 -0
- package/dist/es5/lib/parsers/parse-arcgis-webscene.js +158 -0
- package/dist/es5/lib/parsers/parse-arcgis-webscene.js.map +1 -0
- package/dist/es5/lib/parsers/parse-i3s-attribute.js +76 -0
- package/dist/es5/lib/parsers/parse-i3s-attribute.js.map +1 -0
- package/dist/es5/lib/parsers/parse-i3s-building-scene-layer.js +65 -0
- package/dist/es5/lib/parsers/parse-i3s-building-scene-layer.js.map +1 -0
- package/dist/es5/lib/parsers/parse-i3s-tile-content.js +510 -0
- package/dist/es5/lib/parsers/parse-i3s-tile-content.js.map +1 -0
- package/dist/es5/lib/parsers/parse-i3s.js +116 -0
- package/dist/es5/lib/parsers/parse-i3s.js.map +1 -0
- package/dist/es5/lib/parsers/parse-slpk/parse-slpk.js +94 -0
- package/dist/es5/lib/parsers/parse-slpk/parse-slpk.js.map +1 -0
- package/dist/es5/lib/parsers/parse-slpk/slpk-archieve.js +112 -0
- package/dist/es5/lib/parsers/parse-slpk/slpk-archieve.js.map +1 -0
- package/dist/es5/lib/parsers/parse-zip/cd-file-header.js +44 -0
- package/dist/es5/lib/parsers/parse-zip/cd-file-header.js.map +1 -0
- package/dist/es5/lib/parsers/parse-zip/local-file-header.js +26 -0
- package/dist/es5/lib/parsers/parse-zip/local-file-header.js.map +1 -0
- package/dist/es5/lib/utils/convert-i3s-obb-to-mbs.js +17 -0
- package/dist/es5/lib/utils/convert-i3s-obb-to-mbs.js.map +1 -0
- package/dist/es5/lib/utils/customizeColors.js +159 -0
- package/dist/es5/lib/utils/customizeColors.js.map +1 -0
- package/dist/es5/lib/utils/url-utils.js +33 -0
- package/dist/es5/lib/utils/url-utils.js.map +1 -0
- package/dist/es5/types.js +26 -0
- package/dist/es5/types.js.map +1 -0
- package/dist/es5/workers/i3s-content-worker-node.js +7 -0
- package/dist/es5/workers/i3s-content-worker-node.js.map +1 -0
- package/dist/es5/workers/i3s-content-worker.js +6 -0
- package/dist/es5/workers/i3s-content-worker.js.map +1 -0
- package/dist/esm/arcgis-webscene-loader.js +16 -0
- package/dist/esm/arcgis-webscene-loader.js.map +1 -0
- package/dist/esm/bundle.js +4 -0
- package/dist/esm/bundle.js.map +1 -0
- package/dist/esm/i3s-attribute-loader.js +119 -0
- package/dist/esm/i3s-attribute-loader.js.map +1 -0
- package/dist/esm/i3s-building-scene-layer-loader.js +19 -0
- package/dist/esm/i3s-building-scene-layer-loader.js.map +1 -0
- package/dist/esm/i3s-content-loader.js +30 -0
- package/dist/esm/i3s-content-loader.js.map +1 -0
- package/dist/esm/i3s-loader.js +87 -0
- package/dist/esm/i3s-loader.js.map +1 -0
- package/dist/esm/i3s-node-page-loader.js +15 -0
- package/dist/esm/i3s-node-page-loader.js.map +1 -0
- package/dist/esm/i3s-slpk-loader.js +13 -0
- package/dist/esm/i3s-slpk-loader.js.map +1 -0
- package/dist/esm/index.js +9 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/lib/helpers/i3s-nodepages-tiles.js +198 -0
- package/dist/esm/lib/helpers/i3s-nodepages-tiles.js.map +1 -0
- package/dist/esm/lib/parsers/constants.js +57 -0
- package/dist/esm/lib/parsers/constants.js.map +1 -0
- package/dist/esm/lib/parsers/parse-arcgis-webscene.js +70 -0
- package/dist/esm/lib/parsers/parse-arcgis-webscene.js.map +1 -0
- package/dist/esm/lib/parsers/parse-i3s-attribute.js +60 -0
- package/dist/esm/lib/parsers/parse-i3s-attribute.js.map +1 -0
- package/dist/esm/lib/parsers/parse-i3s-building-scene-layer.js +39 -0
- package/dist/esm/lib/parsers/parse-i3s-building-scene-layer.js.map +1 -0
- package/dist/esm/lib/parsers/parse-i3s-tile-content.js +435 -0
- package/dist/esm/lib/parsers/parse-i3s-tile-content.js.map +1 -0
- package/dist/esm/lib/parsers/parse-i3s.js +83 -0
- package/dist/esm/lib/parsers/parse-i3s.js.map +1 -0
- package/dist/esm/lib/parsers/parse-slpk/parse-slpk.js +37 -0
- package/dist/esm/lib/parsers/parse-slpk/parse-slpk.js.map +1 -0
- package/dist/esm/lib/parsers/parse-slpk/slpk-archieve.js +58 -0
- package/dist/esm/lib/parsers/parse-slpk/slpk-archieve.js.map +1 -0
- package/dist/esm/lib/parsers/parse-zip/cd-file-header.js +37 -0
- package/dist/esm/lib/parsers/parse-zip/cd-file-header.js.map +1 -0
- package/dist/esm/lib/parsers/parse-zip/local-file-header.js +19 -0
- package/dist/esm/lib/parsers/parse-zip/local-file-header.js.map +1 -0
- package/dist/esm/lib/utils/convert-i3s-obb-to-mbs.js +9 -0
- package/dist/esm/lib/utils/convert-i3s-obb-to-mbs.js.map +1 -0
- package/dist/esm/lib/utils/customizeColors.js +92 -0
- package/dist/esm/lib/utils/customizeColors.js.map +1 -0
- package/dist/esm/lib/utils/url-utils.js +28 -0
- package/dist/esm/lib/utils/url-utils.js.map +1 -0
- package/dist/esm/types.js +18 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/esm/workers/i3s-content-worker-node.js +5 -0
- package/dist/esm/workers/i3s-content-worker-node.js.map +1 -0
- package/dist/esm/workers/i3s-content-worker.js +4 -0
- package/dist/esm/workers/i3s-content-worker.js.map +1 -0
- package/dist/i3s-attribute-loader.d.ts +9 -2
- package/dist/i3s-attribute-loader.d.ts.map +1 -1
- package/dist/i3s-attribute-loader.js +155 -132
- package/dist/i3s-building-scene-layer-loader.js +23 -18
- package/dist/i3s-content-loader.d.ts.map +1 -1
- package/dist/i3s-content-loader.js +29 -22
- package/dist/i3s-content-worker-node.js +197 -0
- package/dist/i3s-content-worker-node.js.map +7 -0
- package/dist/i3s-content-worker.js +1178 -1137
- package/dist/i3s-loader.d.ts +5 -0
- package/dist/i3s-loader.d.ts.map +1 -1
- package/dist/i3s-loader.js +88 -83
- package/dist/i3s-node-page-loader.d.ts +3 -2
- package/dist/i3s-node-page-loader.d.ts.map +1 -1
- package/dist/i3s-node-page-loader.js +20 -20
- package/dist/i3s-slpk-loader.d.ts +10 -0
- package/dist/i3s-slpk-loader.d.ts.map +1 -0
- package/dist/i3s-slpk-loader.js +20 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +21 -6
- package/dist/lib/helpers/i3s-nodepages-tiles.d.ts +1 -0
- package/dist/lib/helpers/i3s-nodepages-tiles.d.ts.map +1 -1
- package/dist/lib/helpers/i3s-nodepages-tiles.js +231 -228
- package/dist/lib/parsers/constants.js +85 -63
- package/dist/lib/parsers/parse-arcgis-webscene.d.ts +7 -0
- package/dist/lib/parsers/parse-arcgis-webscene.d.ts.map +1 -0
- package/dist/lib/parsers/parse-arcgis-webscene.js +88 -0
- package/dist/lib/parsers/parse-i3s-attribute.d.ts +6 -4
- package/dist/lib/parsers/parse-i3s-attribute.d.ts.map +1 -1
- package/dist/lib/parsers/parse-i3s-attribute.js +87 -62
- package/dist/lib/parsers/parse-i3s-building-scene-layer.js +41 -40
- package/dist/lib/parsers/parse-i3s-tile-content.d.ts +2 -2
- package/dist/lib/parsers/parse-i3s-tile-content.d.ts.map +1 -1
- package/dist/lib/parsers/parse-i3s-tile-content.js +454 -454
- package/dist/lib/parsers/parse-i3s.d.ts +1 -1
- package/dist/lib/parsers/parse-i3s.d.ts.map +1 -1
- package/dist/lib/parsers/parse-i3s.js +92 -88
- package/dist/lib/parsers/parse-slpk/parse-slpk.d.ts +4 -0
- package/dist/lib/parsers/parse-slpk/parse-slpk.d.ts.map +1 -0
- package/dist/lib/parsers/parse-slpk/parse-slpk.js +50 -0
- package/dist/lib/parsers/parse-slpk/slpk-archieve.d.ts +32 -0
- package/dist/lib/parsers/parse-slpk/slpk-archieve.d.ts.map +1 -0
- package/dist/lib/parsers/parse-slpk/slpk-archieve.js +79 -0
- package/dist/lib/parsers/parse-zip/cd-file-header.d.ts +38 -0
- package/dist/lib/parsers/parse-zip/cd-file-header.d.ts.map +1 -0
- package/dist/lib/parsers/parse-zip/cd-file-header.js +48 -0
- package/dist/lib/parsers/parse-zip/local-file-header.d.ts +30 -0
- package/dist/lib/parsers/parse-zip/local-file-header.d.ts.map +1 -0
- package/dist/lib/parsers/parse-zip/local-file-header.js +28 -0
- package/dist/lib/utils/convert-i3s-obb-to-mbs.js +19 -8
- package/dist/lib/utils/customizeColors.d.ts +14 -0
- package/dist/lib/utils/customizeColors.d.ts.map +1 -0
- package/dist/lib/utils/customizeColors.js +94 -0
- package/dist/lib/utils/url-utils.js +41 -28
- package/dist/types.d.ts +518 -97
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +18 -19
- package/dist/workers/i3s-content-worker-node.d.ts +2 -0
- package/dist/workers/i3s-content-worker-node.d.ts.map +1 -0
- package/dist/workers/i3s-content-worker-node.js +7 -0
- package/dist/workers/i3s-content-worker.js +5 -4
- package/package.json +16 -14
- package/src/arcgis-webscene-loader.ts +31 -0
- package/src/i3s-attribute-loader.ts +9 -9
- package/src/i3s-content-loader.ts +17 -5
- package/src/i3s-loader.ts +22 -13
- package/src/i3s-node-page-loader.ts +6 -10
- package/src/i3s-slpk-loader.ts +25 -0
- package/src/index.ts +22 -5
- package/src/lib/helpers/i3s-nodepages-tiles.ts +14 -3
- package/src/lib/parsers/constants.ts +1 -1
- package/src/lib/parsers/parse-arcgis-webscene.ts +102 -0
- package/src/lib/parsers/parse-i3s-attribute.ts +21 -14
- package/src/lib/parsers/parse-i3s-tile-content.ts +99 -76
- package/src/lib/parsers/parse-i3s.ts +8 -3
- package/src/lib/parsers/parse-slpk/parse-slpk.ts +61 -0
- package/src/lib/parsers/parse-slpk/slpk-archieve.ts +108 -0
- package/src/lib/parsers/parse-zip/cd-file-header.ts +93 -0
- package/src/lib/parsers/parse-zip/local-file-header.ts +56 -0
- package/src/lib/utils/customizeColors.ts +134 -0
- package/src/types.ts +482 -33
- package/src/workers/i3s-content-worker-node.ts +6 -0
- package/dist/bundle.js.map +0 -1
- package/dist/i3s-attribute-loader.js.map +0 -1
- package/dist/i3s-building-scene-layer-loader.js.map +0 -1
- package/dist/i3s-content-loader.js.map +0 -1
- package/dist/i3s-loader.js.map +0 -1
- package/dist/i3s-node-page-loader.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/helpers/i3s-nodepages-tiles.js.map +0 -1
- package/dist/lib/parsers/constants.js.map +0 -1
- package/dist/lib/parsers/parse-i3s-attribute.js.map +0 -1
- package/dist/lib/parsers/parse-i3s-building-scene-layer.js.map +0 -1
- package/dist/lib/parsers/parse-i3s-tile-content.js.map +0 -1
- package/dist/lib/parsers/parse-i3s.js.map +0 -1
- package/dist/lib/utils/convert-i3s-obb-to-mbs.js.map +0 -1
- package/dist/lib/utils/url-utils.js.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/workers/i3s-content-worker.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i3s-content-worker.js","names":["createLoaderWorker","I3SContentLoader"],"sources":["../../../src/workers/i3s-content-worker.ts"],"sourcesContent":["import {createLoaderWorker} from '@loaders.gl/loader-utils';\nimport {I3SContentLoader} from '../i3s-content-loader';\n\ncreateLoaderWorker(I3SContentLoader);\n"],"mappings":"AAAA,SAAQA,kBAAkB,QAAO,0BAA0B;AAC3D,SAAQC,gBAAgB,QAAO,uBAAuB;AAEtDD,kBAAkB,CAACC,gBAAgB,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type { LoaderWithParser } from '@loaders.gl/loader-utils';
|
|
1
|
+
import type { LoaderOptions, LoaderWithParser } from '@loaders.gl/loader-utils';
|
|
2
|
+
import type { I3STileAttributes } from './lib/parsers/parse-i3s-attribute';
|
|
2
3
|
/**
|
|
3
4
|
* Loader for I3S attributes
|
|
4
5
|
*/
|
|
5
|
-
export declare const I3SAttributeLoader: LoaderWithParser
|
|
6
|
+
export declare const I3SAttributeLoader: LoaderWithParser<I3STileAttributes, never, LoaderOptions>;
|
|
6
7
|
/**
|
|
7
8
|
* Load attributes based on feature id
|
|
8
9
|
* @param {Object} tile
|
|
@@ -11,4 +12,10 @@ export declare const I3SAttributeLoader: LoaderWithParser;
|
|
|
11
12
|
* @returns {Promise}
|
|
12
13
|
*/
|
|
13
14
|
export declare function loadFeatureAttributes(tile: any, featureId: any, options?: {}): Promise<{} | null>;
|
|
15
|
+
/**
|
|
16
|
+
* Get attribute value type based on property names
|
|
17
|
+
* @param {Object} attribute
|
|
18
|
+
* @returns {String}
|
|
19
|
+
*/
|
|
20
|
+
export declare function getAttributeValueType(attribute: any): any;
|
|
14
21
|
//# sourceMappingURL=i3s-attribute-loader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i3s-attribute-loader.d.ts","sourceRoot":"","sources":["../src/i3s-attribute-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"i3s-attribute-loader.d.ts","sourceRoot":"","sources":["../src/i3s-attribute-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAE,gBAAgB,EAAC,MAAM,0BAA0B,CAAC;AAE9E,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,mCAAmC,CAAC;AAUzE;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,gBAAgB,CAAC,iBAAiB,EAAE,KAAK,EAAE,aAAa,CAUxF,CAAC;AAKF;;;;;;GAMG;AAEH,wBAAsB,qBAAqB,CAAC,IAAI,KAAA,EAAE,SAAS,KAAA,EAAE,OAAO,KAAK,sBA+BxE;AAeD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,KAAA,OAO9C"}
|
|
@@ -1,152 +1,175 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAttributeValueType = exports.loadFeatureAttributes = exports.I3SAttributeLoader = void 0;
|
|
4
|
+
const core_1 = require("@loaders.gl/core");
|
|
5
|
+
const parse_i3s_attribute_1 = require("./lib/parsers/parse-i3s-attribute");
|
|
6
|
+
const url_utils_1 = require("./lib/utils/url-utils");
|
|
7
|
+
// __VERSION__ is injected by babel-plugin-version-inline
|
|
8
|
+
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
9
|
+
const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
|
|
5
10
|
const EMPTY_VALUE = '';
|
|
6
11
|
const REJECTED_STATUS = 'rejected';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Loader for I3S attributes
|
|
14
|
+
*/
|
|
15
|
+
exports.I3SAttributeLoader = {
|
|
16
|
+
name: 'I3S Attribute',
|
|
17
|
+
id: 'i3s-attribute',
|
|
18
|
+
module: 'i3s',
|
|
19
|
+
version: VERSION,
|
|
20
|
+
mimeTypes: ['application/binary'],
|
|
21
|
+
parse: async (arrayBuffer, options) => (0, parse_i3s_attribute_1.parseI3STileAttribute)(arrayBuffer, options),
|
|
22
|
+
extensions: ['bin'],
|
|
23
|
+
options: {},
|
|
24
|
+
binary: true
|
|
17
25
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
26
|
+
// TODO - these seem to use the loader rather than being part of the loader. Move to different file...
|
|
27
|
+
/**
|
|
28
|
+
* Load attributes based on feature id
|
|
29
|
+
* @param {Object} tile
|
|
30
|
+
* @param {number} featureId
|
|
31
|
+
* @param {Object} options
|
|
32
|
+
* @returns {Promise}
|
|
33
|
+
*/
|
|
34
|
+
// eslint-disable-next-line complexity
|
|
35
|
+
async function loadFeatureAttributes(tile, featureId, options = {}) {
|
|
36
|
+
const { attributeStorageInfo, attributeUrls, tilesetFields } = getAttributesData(tile);
|
|
37
|
+
if (!attributeStorageInfo || !attributeUrls || featureId < 0) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
let attributes = [];
|
|
41
|
+
const attributeLoadPromises = [];
|
|
42
|
+
for (let index = 0; index < attributeStorageInfo.length; index++) {
|
|
43
|
+
// @ts-ignore
|
|
44
|
+
const url = (0, url_utils_1.getUrlWithToken)(attributeUrls[index], options.i3s?.token);
|
|
45
|
+
const attributeName = attributeStorageInfo[index].name;
|
|
46
|
+
const attributeType = getAttributeValueType(attributeStorageInfo[index]);
|
|
47
|
+
const loadOptions = { ...options, attributeName, attributeType };
|
|
48
|
+
const promise = (0, core_1.load)(url, exports.I3SAttributeLoader, loadOptions);
|
|
49
|
+
attributeLoadPromises.push(promise);
|
|
50
|
+
}
|
|
51
|
+
try {
|
|
52
|
+
attributes = await Promise.allSettled(attributeLoadPromises);
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
// do nothing
|
|
56
|
+
}
|
|
57
|
+
if (!attributes.length) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
return generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields);
|
|
22
61
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
} = getAttributesData(tile);
|
|
30
|
-
|
|
31
|
-
if (!attributeStorageInfo || !attributeUrls || !featureId) {
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
let attributes = [];
|
|
36
|
-
const attributeLoadPromises = [];
|
|
37
|
-
|
|
38
|
-
for (let index = 0; index < attributeStorageInfo.length; index++) {
|
|
39
|
-
var _options$i3s;
|
|
40
|
-
|
|
41
|
-
const url = getUrlWithToken(attributeUrls[index], (_options$i3s = options.i3s) === null || _options$i3s === void 0 ? void 0 : _options$i3s.token);
|
|
42
|
-
const attributeName = attributeStorageInfo[index].name;
|
|
43
|
-
const attributeType = getAttributeValueType(attributeStorageInfo[index]);
|
|
44
|
-
const loadOptions = { ...options,
|
|
45
|
-
attributeName,
|
|
46
|
-
attributeType
|
|
47
|
-
};
|
|
48
|
-
const promise = load(url, I3SAttributeLoader, loadOptions);
|
|
49
|
-
attributeLoadPromises.push(promise);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
try {
|
|
53
|
-
attributes = await Promise.allSettled(attributeLoadPromises);
|
|
54
|
-
} catch (error) {}
|
|
55
|
-
|
|
56
|
-
if (!attributes.length) {
|
|
57
|
-
return null;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
return generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields);
|
|
61
|
-
}
|
|
62
|
-
|
|
62
|
+
exports.loadFeatureAttributes = loadFeatureAttributes;
|
|
63
|
+
/**
|
|
64
|
+
* Gets attributes data from tile.
|
|
65
|
+
* @param tile
|
|
66
|
+
* @returns
|
|
67
|
+
*/
|
|
63
68
|
function getAttributesData(tile) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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) || [];
|
|
69
|
-
return {
|
|
70
|
-
attributeStorageInfo,
|
|
71
|
-
attributeUrls,
|
|
72
|
-
tilesetFields
|
|
73
|
-
};
|
|
69
|
+
const attributeStorageInfo = tile.tileset?.tileset?.attributeStorageInfo;
|
|
70
|
+
const attributeUrls = tile.header?.attributeUrls;
|
|
71
|
+
const tilesetFields = tile.tileset?.tileset?.fields || [];
|
|
72
|
+
return { attributeStorageInfo, attributeUrls, tilesetFields };
|
|
74
73
|
}
|
|
75
|
-
|
|
74
|
+
/**
|
|
75
|
+
* Get attribute value type based on property names
|
|
76
|
+
* @param {Object} attribute
|
|
77
|
+
* @returns {String}
|
|
78
|
+
*/
|
|
76
79
|
function getAttributeValueType(attribute) {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
80
|
+
if (attribute.hasOwnProperty('objectIds')) {
|
|
81
|
+
return 'Oid32';
|
|
82
|
+
}
|
|
83
|
+
else if (attribute.hasOwnProperty('attributeValues')) {
|
|
84
|
+
return attribute.attributeValues.valueType;
|
|
85
|
+
}
|
|
86
|
+
return '';
|
|
84
87
|
}
|
|
85
|
-
|
|
88
|
+
exports.getAttributeValueType = getAttributeValueType;
|
|
89
|
+
/**
|
|
90
|
+
* Find in attributeStorageInfo attribute name responsible for feature ids list.
|
|
91
|
+
* @param attributeStorageInfo
|
|
92
|
+
* @returns Feature ids attribute name
|
|
93
|
+
*/
|
|
86
94
|
function getFeatureIdsAttributeName(attributeStorageInfo) {
|
|
87
|
-
|
|
88
|
-
|
|
95
|
+
const objectIdsAttribute = attributeStorageInfo.find(attribute => attribute.name.includes('OBJECTID'));
|
|
96
|
+
return objectIdsAttribute?.name;
|
|
89
97
|
}
|
|
90
|
-
|
|
98
|
+
/**
|
|
99
|
+
* Generates mapping featureId to feature attributes
|
|
100
|
+
* @param {Array} attributes
|
|
101
|
+
* @param {Object} attributeStorageInfo
|
|
102
|
+
* @param {number} featureId
|
|
103
|
+
* @returns {Object}
|
|
104
|
+
*/
|
|
91
105
|
function generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
return null;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
return getFeatureAttributesByIndex(attributes, attributeIndex, attributeStorageInfo, tilesetFields);
|
|
106
|
+
const objectIdsAttributeName = getFeatureIdsAttributeName(attributeStorageInfo);
|
|
107
|
+
const objectIds = attributes.find((attribute) => attribute.value[objectIdsAttributeName]);
|
|
108
|
+
if (!objectIds) {
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
const attributeIndex = objectIds.value[objectIdsAttributeName].indexOf(featureId);
|
|
112
|
+
if (attributeIndex < 0) {
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
return getFeatureAttributesByIndex(attributes, attributeIndex, attributeStorageInfo, tilesetFields);
|
|
106
116
|
}
|
|
107
|
-
|
|
117
|
+
/**
|
|
118
|
+
* Generates attribute object for feature mapping by feature id
|
|
119
|
+
* @param {Array} attributes
|
|
120
|
+
* @param {Number} featureIdIndex
|
|
121
|
+
* @param {Object} attributeStorageInfo
|
|
122
|
+
* @returns {Object}
|
|
123
|
+
*/
|
|
108
124
|
function getFeatureAttributesByIndex(attributes, featureIdIndex, attributeStorageInfo, tilesetFields) {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
return attributesObject;
|
|
125
|
+
const attributesObject = {};
|
|
126
|
+
for (let index = 0; index < attributeStorageInfo.length; index++) {
|
|
127
|
+
const attributeName = attributeStorageInfo[index].name;
|
|
128
|
+
const codedValues = getAttributeCodedValues(attributeName, tilesetFields);
|
|
129
|
+
const attribute = getAttributeByIndexAndAttributeName(attributes, index, attributeName);
|
|
130
|
+
attributesObject[attributeName] = formatAttributeValue(attribute, featureIdIndex, codedValues);
|
|
131
|
+
}
|
|
132
|
+
return attributesObject;
|
|
119
133
|
}
|
|
120
|
-
|
|
134
|
+
/**
|
|
135
|
+
* Get coded values list from tileset.
|
|
136
|
+
* @param attributeName
|
|
137
|
+
* @param tilesetFields
|
|
138
|
+
*/
|
|
121
139
|
function getAttributeCodedValues(attributeName, tilesetFields) {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
return (attributeField === null || attributeField === void 0 ? void 0 : (_attributeField$domai = attributeField.domain) === null || _attributeField$domai === void 0 ? void 0 : _attributeField$domai.codedValues) || [];
|
|
140
|
+
const attributeField = tilesetFields
|
|
141
|
+
.find(field => field.name === attributeName || field.alias === attributeName);
|
|
142
|
+
return attributeField?.domain?.codedValues || [];
|
|
126
143
|
}
|
|
127
|
-
|
|
144
|
+
/**
|
|
145
|
+
* Return attribute value if it presents in atrributes list
|
|
146
|
+
* @param {array} attributes
|
|
147
|
+
* @param {number} index
|
|
148
|
+
* @param {string} attributesName
|
|
149
|
+
*/
|
|
128
150
|
function getAttributeByIndexAndAttributeName(attributes, index, attributesName) {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
return attributeObject.value[attributesName];
|
|
151
|
+
const attributeObject = attributes[index];
|
|
152
|
+
if (attributeObject.status === REJECTED_STATUS) {
|
|
153
|
+
return null;
|
|
154
|
+
}
|
|
155
|
+
return attributeObject.value[attributesName];
|
|
136
156
|
}
|
|
137
|
-
|
|
157
|
+
/**
|
|
158
|
+
* Do formatting of attribute values or return empty string.
|
|
159
|
+
* @param {Array} attribute
|
|
160
|
+
* @param {Number} featureIdIndex
|
|
161
|
+
* @returns {String}
|
|
162
|
+
*/
|
|
138
163
|
function formatAttributeValue(attribute, featureIdIndex, codedValues) {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
return value;
|
|
164
|
+
let value = EMPTY_VALUE;
|
|
165
|
+
if (attribute && (featureIdIndex in attribute)) {
|
|
166
|
+
// eslint-disable-next-line no-control-regex
|
|
167
|
+
value = String(attribute[featureIdIndex]).replace(/\u0000|NaN/g, '').trim();
|
|
168
|
+
}
|
|
169
|
+
// Check if coded values are existed. If so we use them.
|
|
170
|
+
if (codedValues.length) {
|
|
171
|
+
const codeValue = codedValues.find(codedValue => codedValue.code === Number(value));
|
|
172
|
+
value = codeValue?.name || EMPTY_VALUE;
|
|
173
|
+
}
|
|
174
|
+
return value;
|
|
151
175
|
}
|
|
152
|
-
//# sourceMappingURL=i3s-attribute-loader.js.map
|
|
@@ -1,21 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.I3SBuildingSceneLayerLoader = void 0;
|
|
4
|
+
const parse_i3s_building_scene_layer_1 = require("./lib/parsers/parse-i3s-building-scene-layer");
|
|
5
|
+
// __VERSION__ is injected by babel-plugin-version-inline
|
|
6
|
+
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
7
|
+
const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'beta';
|
|
8
|
+
/**
|
|
9
|
+
* Loader for I3S - Building Scene Layer
|
|
10
|
+
*/
|
|
11
|
+
exports.I3SBuildingSceneLayerLoader = {
|
|
12
|
+
name: 'I3S Building Scene Layer',
|
|
13
|
+
id: 'i3s-building-scene-layer',
|
|
14
|
+
module: 'i3s',
|
|
15
|
+
version: VERSION,
|
|
16
|
+
mimeTypes: ['application/json'],
|
|
17
|
+
parse,
|
|
18
|
+
extensions: ['json'],
|
|
19
|
+
options: {}
|
|
12
20
|
};
|
|
13
|
-
|
|
14
21
|
async function parse(data, options, context) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return parseBuildingSceneLayer(data, context.url);
|
|
22
|
+
if (!context?.url) {
|
|
23
|
+
throw new Error('Url is not provided');
|
|
24
|
+
}
|
|
25
|
+
return (0, parse_i3s_building_scene_layer_1.parseBuildingSceneLayer)(data, context.url);
|
|
20
26
|
}
|
|
21
|
-
//# sourceMappingURL=i3s-building-scene-layer-loader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i3s-content-loader.d.ts","sourceRoot":"","sources":["../src/i3s-content-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,
|
|
1
|
+
{"version":3,"file":"i3s-content-loader.d.ts","sourceRoot":"","sources":["../src/i3s-content-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAAgB,MAAM,0BAA0B,CAAC;AAS9E;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,gBAY9B,CAAC"}
|
|
@@ -1,25 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
'i3s-content'
|
|
14
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.I3SContentLoader = void 0;
|
|
4
|
+
const parse_i3s_tile_content_1 = require("./lib/parsers/parse-i3s-tile-content");
|
|
5
|
+
// __VERSION__ is injected by babel-plugin-version-inline
|
|
6
|
+
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
7
|
+
const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'beta';
|
|
8
|
+
/**
|
|
9
|
+
* Loader for I3S - Indexed 3D Scene Layer
|
|
10
|
+
*/
|
|
11
|
+
exports.I3SContentLoader = {
|
|
12
|
+
name: 'I3S Content (Indexed Scene Layers)',
|
|
13
|
+
id: 'i3s-content',
|
|
14
|
+
module: 'i3s',
|
|
15
|
+
worker: true,
|
|
16
|
+
version: VERSION,
|
|
17
|
+
mimeTypes: ['application/octet-stream'],
|
|
18
|
+
parse,
|
|
19
|
+
extensions: ['bin'],
|
|
20
|
+
options: {
|
|
21
|
+
'i3s-content': {}
|
|
22
|
+
}
|
|
15
23
|
};
|
|
16
|
-
|
|
17
24
|
async function parse(data, options, context) {
|
|
18
|
-
|
|
19
|
-
tile
|
|
20
|
-
tileset
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
25
|
+
const { tile, _tileOptions, tileset, _tilesetOptions } = options?.i3s || {};
|
|
26
|
+
const tileOptions = _tileOptions || tile;
|
|
27
|
+
const tilesetOptions = _tilesetOptions || tileset;
|
|
28
|
+
if (!tileOptions || !tilesetOptions) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
return await (0, parse_i3s_tile_content_1.parseI3STileContent)(data, tileOptions, tilesetOptions, options, context);
|
|
24
32
|
}
|
|
25
|
-
//# sourceMappingURL=i3s-content-loader.js.map
|