@loaders.gl/i3s 3.4.11 → 3.4.13
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/es5/arcgis-webscene-loader.js +1 -1
- package/dist/es5/i3s-attribute-loader.js +1 -1
- package/dist/es5/i3s-building-scene-layer-loader.js +1 -1
- package/dist/es5/i3s-content-loader.js +1 -1
- package/dist/es5/i3s-loader.js +1 -1
- package/dist/es5/i3s-node-page-loader.js +1 -1
- package/dist/es5/i3s-slpk-loader.js +1 -1
- package/dist/esm/arcgis-webscene-loader.js +1 -1
- package/dist/esm/i3s-attribute-loader.js +1 -1
- package/dist/esm/i3s-building-scene-layer-loader.js +1 -1
- package/dist/esm/i3s-content-loader.js +1 -1
- package/dist/esm/i3s-loader.js +1 -1
- package/dist/esm/i3s-node-page-loader.js +1 -1
- package/dist/esm/i3s-slpk-loader.js +1 -1
- package/dist/i3s-content-nodejs-worker.js +2 -2
- package/dist/i3s-content-worker.js +8 -8
- package/package.json +9 -9
- package/dist/arcgis-webscene-loader.js +0 -28
- package/dist/bundle.js +0 -5
- package/dist/i3s-attribute-loader.js +0 -178
- package/dist/i3s-building-scene-layer-loader.js +0 -26
- package/dist/i3s-content-loader.js +0 -33
- package/dist/i3s-loader.js +0 -102
- package/dist/i3s-node-page-loader.js +0 -26
- package/dist/i3s-slpk-loader.js +0 -20
- package/dist/index.js +0 -18
- package/dist/lib/helpers/i3s-nodepages-tiles.js +0 -242
- package/dist/lib/parsers/constants.js +0 -89
- package/dist/lib/parsers/parse-arcgis-webscene.js +0 -87
- package/dist/lib/parsers/parse-i3s-attribute.js +0 -98
- package/dist/lib/parsers/parse-i3s-building-scene-layer.js +0 -46
- package/dist/lib/parsers/parse-i3s-tile-content.js +0 -494
- package/dist/lib/parsers/parse-i3s.js +0 -95
- package/dist/lib/parsers/parse-slpk/parse-slpk.js +0 -50
- package/dist/lib/parsers/parse-slpk/slpk-archieve.js +0 -79
- package/dist/lib/parsers/parse-zip/cd-file-header.js +0 -48
- package/dist/lib/parsers/parse-zip/local-file-header.js +0 -28
- package/dist/lib/utils/convert-i3s-obb-to-mbs.js +0 -20
- package/dist/lib/utils/customizeColors.js +0 -89
- package/dist/lib/utils/url-utils.js +0 -44
- package/dist/types.js +0 -20
- package/dist/workers/i3s-content-nodejs-worker.js +0 -6
- package/dist/workers/i3s-content-worker.js +0 -5
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
var nodeVersion = matches && parseFloat(matches[1]) || 0;
|
|
56
56
|
|
|
57
57
|
// ../worker-utils/src/lib/env-utils/version.ts
|
|
58
|
-
var VERSION = true ? "3.4.
|
|
58
|
+
var VERSION = true ? "3.4.13" : DEFAULT_VERSION;
|
|
59
59
|
if (false) {
|
|
60
60
|
console.error("loaders.gl: The __VERSION__ variable is not injected using babel plugin. Latest unstable workers would be fetched from the CDN.");
|
|
61
61
|
}
|
|
@@ -1234,7 +1234,7 @@
|
|
|
1234
1234
|
var navigator_ = globalThis.navigator || {};
|
|
1235
1235
|
|
|
1236
1236
|
// ../core/node_modules/@probe.gl/env/dist/utils/globals.js
|
|
1237
|
-
var VERSION3 = true ? "3.4.
|
|
1237
|
+
var VERSION3 = true ? "3.4.13" : "untranspiled source";
|
|
1238
1238
|
var isBrowser4 = isBrowser3();
|
|
1239
1239
|
|
|
1240
1240
|
// ../core/node_modules/@probe.gl/log/dist/utils/local-storage.js
|
|
@@ -4577,7 +4577,7 @@
|
|
|
4577
4577
|
_defineProperty(Ellipsoid, "WGS84", new Ellipsoid(WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z));
|
|
4578
4578
|
|
|
4579
4579
|
// ../images/src/lib/utils/version.ts
|
|
4580
|
-
var VERSION4 = true ? "3.4.
|
|
4580
|
+
var VERSION4 = true ? "3.4.13" : "latest";
|
|
4581
4581
|
|
|
4582
4582
|
// ../images/src/lib/category-api/image-type.ts
|
|
4583
4583
|
var { _parseImageNode } = globalThis;
|
|
@@ -4974,7 +4974,7 @@
|
|
|
4974
4974
|
};
|
|
4975
4975
|
|
|
4976
4976
|
// ../draco/src/lib/utils/version.ts
|
|
4977
|
-
var VERSION5 = true ? "3.4.
|
|
4977
|
+
var VERSION5 = true ? "3.4.13" : "latest";
|
|
4978
4978
|
|
|
4979
4979
|
// ../draco/src/draco-loader.ts
|
|
4980
4980
|
var DEFAULT_DRACO_OPTIONS = {
|
|
@@ -5960,10 +5960,10 @@
|
|
|
5960
5960
|
}
|
|
5961
5961
|
|
|
5962
5962
|
// ../textures/src/lib/utils/version.ts
|
|
5963
|
-
var VERSION6 = true ? "3.4.
|
|
5963
|
+
var VERSION6 = true ? "3.4.13" : "latest";
|
|
5964
5964
|
|
|
5965
5965
|
// ../textures/src/lib/parsers/basis-module-loader.ts
|
|
5966
|
-
var VERSION7 = true ? "3.4.
|
|
5966
|
+
var VERSION7 = true ? "3.4.13" : "latest";
|
|
5967
5967
|
var BASIS_CDN_ENCODER_WASM = `https://unpkg.com/@loaders.gl/textures@${VERSION7}/dist/libs/basis_encoder.wasm`;
|
|
5968
5968
|
var BASIS_CDN_ENCODER_JS = `https://unpkg.com/@loaders.gl/textures@${VERSION7}/dist/libs/basis_encoder.js`;
|
|
5969
5969
|
var loadBasisTranscoderPromise;
|
|
@@ -7661,7 +7661,7 @@
|
|
|
7661
7661
|
}
|
|
7662
7662
|
|
|
7663
7663
|
// src/i3s-attribute-loader.ts
|
|
7664
|
-
var VERSION8 = true ? "3.4.
|
|
7664
|
+
var VERSION8 = true ? "3.4.13" : "latest";
|
|
7665
7665
|
var I3SAttributeLoader = {
|
|
7666
7666
|
name: "I3S Attribute",
|
|
7667
7667
|
id: "i3s-attribute",
|
|
@@ -8122,7 +8122,7 @@
|
|
|
8122
8122
|
}
|
|
8123
8123
|
|
|
8124
8124
|
// src/i3s-content-loader.ts
|
|
8125
|
-
var VERSION9 = true ? "3.4.
|
|
8125
|
+
var VERSION9 = true ? "3.4.13" : "latest";
|
|
8126
8126
|
var I3SContentLoader = {
|
|
8127
8127
|
name: "I3S Content (Indexed Scene Layers)",
|
|
8128
8128
|
id: isBrowser2 ? "i3s-content" : "i3s-content-nodejs",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/i3s",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.13",
|
|
4
4
|
"description": "i3s .",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -33,13 +33,13 @@
|
|
|
33
33
|
"build-loader-worker-nodejs": "esbuild src/workers/i3s-content-nodejs-worker.ts --outfile=dist/i3s-content-nodejs-worker.js --platform=node --target=esnext,node12 --minify --bundle --sourcemap --define:__VERSION__=\\\"$npm_package_version\\\""
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@loaders.gl/compression": "3.4.
|
|
37
|
-
"@loaders.gl/draco": "3.4.
|
|
38
|
-
"@loaders.gl/images": "3.4.
|
|
39
|
-
"@loaders.gl/loader-utils": "3.4.
|
|
40
|
-
"@loaders.gl/schema": "3.4.
|
|
41
|
-
"@loaders.gl/textures": "3.4.
|
|
42
|
-
"@loaders.gl/tiles": "3.4.
|
|
36
|
+
"@loaders.gl/compression": "3.4.13",
|
|
37
|
+
"@loaders.gl/draco": "3.4.13",
|
|
38
|
+
"@loaders.gl/images": "3.4.13",
|
|
39
|
+
"@loaders.gl/loader-utils": "3.4.13",
|
|
40
|
+
"@loaders.gl/schema": "3.4.13",
|
|
41
|
+
"@loaders.gl/textures": "3.4.13",
|
|
42
|
+
"@loaders.gl/tiles": "3.4.13",
|
|
43
43
|
"@luma.gl/constants": "^8.5.4",
|
|
44
44
|
"@math.gl/core": "^3.5.1",
|
|
45
45
|
"@math.gl/culling": "^3.5.1",
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"@loaders.gl/core": "^3.4.0"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "be8849c02972ce541e01720d29b976f830d6af92"
|
|
53
53
|
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ArcGisWebSceneLoader = void 0;
|
|
4
|
-
const parse_arcgis_webscene_1 = require("./lib/parsers/parse-arcgis-webscene");
|
|
5
|
-
// __VERSION__ is injected by babel-plugin-version-inline
|
|
6
|
-
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
7
|
-
const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
|
|
8
|
-
/**
|
|
9
|
-
* Loader for ArcGis WebScene
|
|
10
|
-
* Spec - https://developers.arcgis.com/web-scene-specification/objects/webscene/
|
|
11
|
-
*/
|
|
12
|
-
exports.ArcGisWebSceneLoader = {
|
|
13
|
-
name: 'ArcGIS Web Scene Loader',
|
|
14
|
-
id: 'arcgis-web-scene',
|
|
15
|
-
module: 'i3s',
|
|
16
|
-
version: VERSION,
|
|
17
|
-
mimeTypes: ['application/json'],
|
|
18
|
-
parse,
|
|
19
|
-
extensions: ['json'],
|
|
20
|
-
options: {}
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* Parse ArcGis webscene
|
|
24
|
-
* @param data
|
|
25
|
-
*/
|
|
26
|
-
async function parse(data) {
|
|
27
|
-
return (0, parse_arcgis_webscene_1.parseWebscene)(data);
|
|
28
|
-
}
|
package/dist/bundle.js
DELETED
|
@@ -1,178 +0,0 @@
|
|
|
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';
|
|
10
|
-
const EMPTY_VALUE = '';
|
|
11
|
-
const REJECTED_STATUS = 'rejected';
|
|
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,
|
|
22
|
-
extensions: ['bin'],
|
|
23
|
-
options: {},
|
|
24
|
-
binary: true
|
|
25
|
-
};
|
|
26
|
-
async function parse(data, options) {
|
|
27
|
-
data = (0, parse_i3s_attribute_1.parseI3STileAttribute)(data, options);
|
|
28
|
-
return data;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Load attributes based on feature id
|
|
32
|
-
* @param {Object} tile
|
|
33
|
-
* @param {number} featureId
|
|
34
|
-
* @param {Object} options
|
|
35
|
-
* @returns {Promise}
|
|
36
|
-
*/
|
|
37
|
-
// eslint-disable-next-line complexity
|
|
38
|
-
async function loadFeatureAttributes(tile, featureId, options = {}) {
|
|
39
|
-
const { attributeStorageInfo, attributeUrls, tilesetFields } = getAttributesData(tile);
|
|
40
|
-
if (!attributeStorageInfo || !attributeUrls || featureId < 0) {
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
43
|
-
let attributes = [];
|
|
44
|
-
const attributeLoadPromises = [];
|
|
45
|
-
for (let index = 0; index < attributeStorageInfo.length; index++) {
|
|
46
|
-
// @ts-ignore
|
|
47
|
-
const url = (0, url_utils_1.getUrlWithToken)(attributeUrls[index], options.i3s?.token);
|
|
48
|
-
const attributeName = attributeStorageInfo[index].name;
|
|
49
|
-
const attributeType = getAttributeValueType(attributeStorageInfo[index]);
|
|
50
|
-
const loadOptions = { ...options, attributeName, attributeType };
|
|
51
|
-
const promise = (0, core_1.load)(url, exports.I3SAttributeLoader, loadOptions);
|
|
52
|
-
attributeLoadPromises.push(promise);
|
|
53
|
-
}
|
|
54
|
-
try {
|
|
55
|
-
attributes = await Promise.allSettled(attributeLoadPromises);
|
|
56
|
-
}
|
|
57
|
-
catch (error) {
|
|
58
|
-
// do nothing
|
|
59
|
-
}
|
|
60
|
-
if (!attributes.length) {
|
|
61
|
-
return null;
|
|
62
|
-
}
|
|
63
|
-
return generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields);
|
|
64
|
-
}
|
|
65
|
-
exports.loadFeatureAttributes = loadFeatureAttributes;
|
|
66
|
-
/**
|
|
67
|
-
* Gets attributes data from tile.
|
|
68
|
-
* @param tile
|
|
69
|
-
* @returns
|
|
70
|
-
*/
|
|
71
|
-
function getAttributesData(tile) {
|
|
72
|
-
const attributeStorageInfo = tile.tileset?.tileset?.attributeStorageInfo;
|
|
73
|
-
const attributeUrls = tile.header?.attributeUrls;
|
|
74
|
-
const tilesetFields = tile.tileset?.tileset?.fields || [];
|
|
75
|
-
return { attributeStorageInfo, attributeUrls, tilesetFields };
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Get attribute value type based on property names
|
|
79
|
-
* @param {Object} attribute
|
|
80
|
-
* @returns {String}
|
|
81
|
-
*/
|
|
82
|
-
function getAttributeValueType(attribute) {
|
|
83
|
-
if (attribute.hasOwnProperty('objectIds')) {
|
|
84
|
-
return 'Oid32';
|
|
85
|
-
}
|
|
86
|
-
else if (attribute.hasOwnProperty('attributeValues')) {
|
|
87
|
-
return attribute.attributeValues.valueType;
|
|
88
|
-
}
|
|
89
|
-
return '';
|
|
90
|
-
}
|
|
91
|
-
exports.getAttributeValueType = getAttributeValueType;
|
|
92
|
-
/**
|
|
93
|
-
* Find in attributeStorageInfo attribute name responsible for feature ids list.
|
|
94
|
-
* @param attributeStorageInfo
|
|
95
|
-
* @returns Feature ids attribute name
|
|
96
|
-
*/
|
|
97
|
-
function getFeatureIdsAttributeName(attributeStorageInfo) {
|
|
98
|
-
const objectIdsAttribute = attributeStorageInfo.find(attribute => attribute.name.includes('OBJECTID'));
|
|
99
|
-
return objectIdsAttribute?.name;
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Generates mapping featureId to feature attributes
|
|
103
|
-
* @param {Array} attributes
|
|
104
|
-
* @param {Object} attributeStorageInfo
|
|
105
|
-
* @param {number} featureId
|
|
106
|
-
* @returns {Object}
|
|
107
|
-
*/
|
|
108
|
-
function generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields) {
|
|
109
|
-
const objectIdsAttributeName = getFeatureIdsAttributeName(attributeStorageInfo);
|
|
110
|
-
const objectIds = attributes.find((attribute) => attribute.value[objectIdsAttributeName]);
|
|
111
|
-
if (!objectIds) {
|
|
112
|
-
return null;
|
|
113
|
-
}
|
|
114
|
-
const attributeIndex = objectIds.value[objectIdsAttributeName].indexOf(featureId);
|
|
115
|
-
if (attributeIndex < 0) {
|
|
116
|
-
return null;
|
|
117
|
-
}
|
|
118
|
-
return getFeatureAttributesByIndex(attributes, attributeIndex, attributeStorageInfo, tilesetFields);
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Generates attribute object for feature mapping by feature id
|
|
122
|
-
* @param {Array} attributes
|
|
123
|
-
* @param {Number} featureIdIndex
|
|
124
|
-
* @param {Object} attributeStorageInfo
|
|
125
|
-
* @returns {Object}
|
|
126
|
-
*/
|
|
127
|
-
function getFeatureAttributesByIndex(attributes, featureIdIndex, attributeStorageInfo, tilesetFields) {
|
|
128
|
-
const attributesObject = {};
|
|
129
|
-
for (let index = 0; index < attributeStorageInfo.length; index++) {
|
|
130
|
-
const attributeName = attributeStorageInfo[index].name;
|
|
131
|
-
const codedValues = getAttributeCodedValues(attributeName, tilesetFields);
|
|
132
|
-
const attribute = getAttributeByIndexAndAttributeName(attributes, index, attributeName);
|
|
133
|
-
attributesObject[attributeName] = formatAttributeValue(attribute, featureIdIndex, codedValues);
|
|
134
|
-
}
|
|
135
|
-
return attributesObject;
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Get coded values list from tileset.
|
|
139
|
-
* @param attributeName
|
|
140
|
-
* @param tilesetFields
|
|
141
|
-
*/
|
|
142
|
-
function getAttributeCodedValues(attributeName, tilesetFields) {
|
|
143
|
-
const attributeField = tilesetFields
|
|
144
|
-
.find(field => field.name === attributeName || field.alias === attributeName);
|
|
145
|
-
return attributeField?.domain?.codedValues || [];
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Return attribute value if it presents in atrributes list
|
|
149
|
-
* @param {array} attributes
|
|
150
|
-
* @param {number} index
|
|
151
|
-
* @param {string} attributesName
|
|
152
|
-
*/
|
|
153
|
-
function getAttributeByIndexAndAttributeName(attributes, index, attributesName) {
|
|
154
|
-
const attributeObject = attributes[index];
|
|
155
|
-
if (attributeObject.status === REJECTED_STATUS) {
|
|
156
|
-
return null;
|
|
157
|
-
}
|
|
158
|
-
return attributeObject.value[attributesName];
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Do formatting of attribute values or return empty string.
|
|
162
|
-
* @param {Array} attribute
|
|
163
|
-
* @param {Number} featureIdIndex
|
|
164
|
-
* @returns {String}
|
|
165
|
-
*/
|
|
166
|
-
function formatAttributeValue(attribute, featureIdIndex, codedValues) {
|
|
167
|
-
let value = EMPTY_VALUE;
|
|
168
|
-
if (attribute && (featureIdIndex in attribute)) {
|
|
169
|
-
// eslint-disable-next-line no-control-regex
|
|
170
|
-
value = String(attribute[featureIdIndex]).replace(/\u0000|NaN/g, '').trim();
|
|
171
|
-
}
|
|
172
|
-
// Check if coded values are existed. If so we use them.
|
|
173
|
-
if (codedValues.length) {
|
|
174
|
-
const codeValue = codedValues.find(codedValue => codedValue.code === Number(value));
|
|
175
|
-
value = codeValue?.name || EMPTY_VALUE;
|
|
176
|
-
}
|
|
177
|
-
return value;
|
|
178
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
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__ : 'latest';
|
|
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: {}
|
|
20
|
-
};
|
|
21
|
-
async function parse(data, options, context) {
|
|
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);
|
|
26
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.I3SContentLoader = void 0;
|
|
4
|
-
const worker_utils_1 = require("@loaders.gl/worker-utils");
|
|
5
|
-
const parse_i3s_tile_content_1 = require("./lib/parsers/parse-i3s-tile-content");
|
|
6
|
-
// __VERSION__ is injected by babel-plugin-version-inline
|
|
7
|
-
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
8
|
-
const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
|
|
9
|
-
/**
|
|
10
|
-
* Loader for I3S - Indexed 3D Scene Layer
|
|
11
|
-
*/
|
|
12
|
-
exports.I3SContentLoader = {
|
|
13
|
-
name: 'I3S Content (Indexed Scene Layers)',
|
|
14
|
-
id: worker_utils_1.isBrowser ? 'i3s-content' : 'i3s-content-nodejs',
|
|
15
|
-
module: 'i3s',
|
|
16
|
-
worker: true,
|
|
17
|
-
version: VERSION,
|
|
18
|
-
mimeTypes: ['application/octet-stream'],
|
|
19
|
-
parse,
|
|
20
|
-
extensions: ['bin'],
|
|
21
|
-
options: {
|
|
22
|
-
'i3s-content': {}
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
async function parse(data, options, context) {
|
|
26
|
-
const { tile, _tileOptions, tileset, _tilesetOptions } = options?.i3s || {};
|
|
27
|
-
const tileOptions = _tileOptions || tile;
|
|
28
|
-
const tilesetOptions = _tilesetOptions || tileset;
|
|
29
|
-
if (!tileOptions || !tilesetOptions) {
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
return await (0, parse_i3s_tile_content_1.parseI3STileContent)(data, tileOptions, tilesetOptions, options, context);
|
|
33
|
-
}
|
package/dist/i3s-loader.js
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.I3SLoader = void 0;
|
|
4
|
-
const core_1 = require("@loaders.gl/core");
|
|
5
|
-
const i3s_content_loader_1 = require("./i3s-content-loader");
|
|
6
|
-
const parse_i3s_1 = require("./lib/parsers/parse-i3s");
|
|
7
|
-
const constants_1 = require("./lib/parsers/constants");
|
|
8
|
-
// __VERSION__ is injected by babel-plugin-version-inline
|
|
9
|
-
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
10
|
-
const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
|
|
11
|
-
const TILESET_REGEX = /layers\/[0-9]+$/;
|
|
12
|
-
const TILE_HEADER_REGEX = /nodes\/([0-9-]+|root)$/;
|
|
13
|
-
const SLPK_HEX = '504b0304';
|
|
14
|
-
const POINT_CLOUD = 'PointCloud';
|
|
15
|
-
/**
|
|
16
|
-
* Loader for I3S - Indexed 3D Scene Layer
|
|
17
|
-
*/
|
|
18
|
-
exports.I3SLoader = {
|
|
19
|
-
name: 'I3S (Indexed Scene Layers)',
|
|
20
|
-
id: 'i3s',
|
|
21
|
-
module: 'i3s',
|
|
22
|
-
version: VERSION,
|
|
23
|
-
mimeTypes: ['application/octet-stream'],
|
|
24
|
-
parse: parseI3S,
|
|
25
|
-
extensions: ['bin'],
|
|
26
|
-
options: {
|
|
27
|
-
i3s: {
|
|
28
|
-
token: null,
|
|
29
|
-
isTileset: 'auto',
|
|
30
|
-
isTileHeader: 'auto',
|
|
31
|
-
tile: null,
|
|
32
|
-
tileset: null,
|
|
33
|
-
_tileOptions: null,
|
|
34
|
-
_tilesetOptions: null,
|
|
35
|
-
useDracoGeometry: true,
|
|
36
|
-
useCompressedTextures: true,
|
|
37
|
-
decodeTextures: true,
|
|
38
|
-
coordinateSystem: constants_1.COORDINATE_SYSTEM.METER_OFFSETS,
|
|
39
|
-
colorsByAttribute: null
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
async function parseI3S(data, options = {}, context) {
|
|
44
|
-
const url = context.url;
|
|
45
|
-
options.i3s = options.i3s || {};
|
|
46
|
-
const magicNumber = getMagicNumber(data);
|
|
47
|
-
// check if file is slpk
|
|
48
|
-
if (magicNumber === SLPK_HEX) {
|
|
49
|
-
throw new Error('Files with .slpk extention currently are not supported by I3SLoader');
|
|
50
|
-
}
|
|
51
|
-
// auto detect file type based on url
|
|
52
|
-
let isTileset;
|
|
53
|
-
if (options.i3s.isTileset === 'auto') {
|
|
54
|
-
isTileset = TILESET_REGEX.test(url);
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
isTileset = options.i3s.isTileset;
|
|
58
|
-
}
|
|
59
|
-
let isTileHeader;
|
|
60
|
-
if (options.isTileHeader === 'auto') {
|
|
61
|
-
isTileHeader = TILE_HEADER_REGEX.test(url);
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
isTileHeader = options.i3s.isTileHeader;
|
|
65
|
-
}
|
|
66
|
-
if (isTileset) {
|
|
67
|
-
data = await parseTileset(data, options, context);
|
|
68
|
-
}
|
|
69
|
-
else if (isTileHeader) {
|
|
70
|
-
data = await parseTile(data, context);
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
data = await parseTileContent(data, options);
|
|
74
|
-
}
|
|
75
|
-
return data;
|
|
76
|
-
}
|
|
77
|
-
async function parseTileContent(arrayBuffer, options) {
|
|
78
|
-
return await (0, core_1.parse)(arrayBuffer, i3s_content_loader_1.I3SContentLoader, options);
|
|
79
|
-
}
|
|
80
|
-
async function parseTileset(data, options, context) {
|
|
81
|
-
const tilesetJson = JSON.parse(new TextDecoder().decode(data));
|
|
82
|
-
if (tilesetJson?.layerType === POINT_CLOUD) {
|
|
83
|
-
throw new Error('Point Cloud layers currently are not supported by I3SLoader');
|
|
84
|
-
}
|
|
85
|
-
// eslint-disable-next-line no-use-before-define
|
|
86
|
-
tilesetJson.loader = exports.I3SLoader;
|
|
87
|
-
await (0, parse_i3s_1.normalizeTilesetData)(tilesetJson, options, context);
|
|
88
|
-
return tilesetJson;
|
|
89
|
-
}
|
|
90
|
-
async function parseTile(data, context) {
|
|
91
|
-
data = JSON.parse(new TextDecoder().decode(data));
|
|
92
|
-
return (0, parse_i3s_1.normalizeTileData)(data, context);
|
|
93
|
-
}
|
|
94
|
-
function getMagicNumber(data) {
|
|
95
|
-
if (data instanceof ArrayBuffer) {
|
|
96
|
-
// slice binary data (4 bytes from the beginning) and transform it to hexadecimal numeral system
|
|
97
|
-
return [...new Uint8Array(data, 0, 4)]
|
|
98
|
-
.map((value) => value.toString(16).padStart(2, '0'))
|
|
99
|
-
.join('');
|
|
100
|
-
}
|
|
101
|
-
return null;
|
|
102
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.I3SNodePageLoader = void 0;
|
|
4
|
-
// __VERSION__ is injected by babel-plugin-version-inline
|
|
5
|
-
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
6
|
-
const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
|
|
7
|
-
async function parseNodePage(data) {
|
|
8
|
-
return JSON.parse(new TextDecoder().decode(data));
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Loader for I3S node pages
|
|
12
|
-
*/
|
|
13
|
-
exports.I3SNodePageLoader = {
|
|
14
|
-
name: 'I3S Node Page',
|
|
15
|
-
id: 'i3s-node-page',
|
|
16
|
-
module: 'i3s',
|
|
17
|
-
version: VERSION,
|
|
18
|
-
mimeTypes: ['application/json'],
|
|
19
|
-
parse,
|
|
20
|
-
extensions: ['json'],
|
|
21
|
-
options: {}
|
|
22
|
-
};
|
|
23
|
-
async function parse(data) {
|
|
24
|
-
data = parseNodePage(data);
|
|
25
|
-
return data;
|
|
26
|
-
}
|
package/dist/i3s-slpk-loader.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SLPKLoader = void 0;
|
|
4
|
-
const parse_slpk_1 = require("./lib/parsers/parse-slpk/parse-slpk");
|
|
5
|
-
// __VERSION__ is injected by babel-plugin-version-inline
|
|
6
|
-
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
7
|
-
const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
|
|
8
|
-
/**
|
|
9
|
-
* Loader for SLPK - Scene Layer Package
|
|
10
|
-
*/
|
|
11
|
-
exports.SLPKLoader = {
|
|
12
|
-
name: 'I3S SLPK (Scene Layer Package)',
|
|
13
|
-
id: 'slpk',
|
|
14
|
-
module: 'i3s',
|
|
15
|
-
version: VERSION,
|
|
16
|
-
mimeTypes: ['application/octet-stream'],
|
|
17
|
-
parse: parse_slpk_1.parseSLPK,
|
|
18
|
-
extensions: ['slpk'],
|
|
19
|
-
options: {}
|
|
20
|
-
};
|
package/dist/index.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.COORDINATE_SYSTEM = exports.ArcGisWebSceneLoader = exports.I3SBuildingSceneLayerLoader = exports.loadFeatureAttributes = exports.I3SAttributeLoader = exports.I3SContentLoader = exports.SLPKLoader = exports.I3SLoader = void 0;
|
|
4
|
-
var i3s_loader_1 = require("./i3s-loader");
|
|
5
|
-
Object.defineProperty(exports, "I3SLoader", { enumerable: true, get: function () { return i3s_loader_1.I3SLoader; } });
|
|
6
|
-
var i3s_slpk_loader_1 = require("./i3s-slpk-loader");
|
|
7
|
-
Object.defineProperty(exports, "SLPKLoader", { enumerable: true, get: function () { return i3s_slpk_loader_1.SLPKLoader; } });
|
|
8
|
-
var i3s_content_loader_1 = require("./i3s-content-loader");
|
|
9
|
-
Object.defineProperty(exports, "I3SContentLoader", { enumerable: true, get: function () { return i3s_content_loader_1.I3SContentLoader; } });
|
|
10
|
-
var i3s_attribute_loader_1 = require("./i3s-attribute-loader");
|
|
11
|
-
Object.defineProperty(exports, "I3SAttributeLoader", { enumerable: true, get: function () { return i3s_attribute_loader_1.I3SAttributeLoader; } });
|
|
12
|
-
Object.defineProperty(exports, "loadFeatureAttributes", { enumerable: true, get: function () { return i3s_attribute_loader_1.loadFeatureAttributes; } });
|
|
13
|
-
var i3s_building_scene_layer_loader_1 = require("./i3s-building-scene-layer-loader");
|
|
14
|
-
Object.defineProperty(exports, "I3SBuildingSceneLayerLoader", { enumerable: true, get: function () { return i3s_building_scene_layer_loader_1.I3SBuildingSceneLayerLoader; } });
|
|
15
|
-
var arcgis_webscene_loader_1 = require("./arcgis-webscene-loader");
|
|
16
|
-
Object.defineProperty(exports, "ArcGisWebSceneLoader", { enumerable: true, get: function () { return arcgis_webscene_loader_1.ArcGisWebSceneLoader; } });
|
|
17
|
-
var constants_1 = require("./lib/parsers/constants");
|
|
18
|
-
Object.defineProperty(exports, "COORDINATE_SYSTEM", { enumerable: true, get: function () { return constants_1.COORDINATE_SYSTEM; } });
|