@loaders.gl/i3s 3.1.0-alpha.4 → 3.1.0-beta.5
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/bundle.d.ts +2 -0
- package/dist/bundle.d.ts.map +1 -0
- package/dist/bundle.js +10364 -0
- package/dist/es5/bundle.js +1 -1
- package/dist/es5/bundle.js.map +1 -1
- package/dist/es5/i3s-attribute-loader.js +89 -138
- package/dist/es5/i3s-attribute-loader.js.map +1 -1
- package/dist/es5/i3s-building-scene-layer-loader.js +8 -36
- package/dist/es5/i3s-building-scene-layer-loader.js.map +1 -1
- package/dist/es5/i3s-content-loader.js +10 -36
- package/dist/es5/i3s-content-loader.js.map +1 -1
- package/dist/es5/i3s-loader.js +56 -176
- package/dist/es5/i3s-loader.js.map +1 -1
- package/dist/es5/i3s-node-page-loader.js +8 -51
- package/dist/es5/i3s-node-page-loader.js.map +1 -1
- package/dist/es5/index.js +13 -5
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/lib/helpers/i3s-nodepages-tiles.js +172 -325
- package/dist/es5/lib/helpers/i3s-nodepages-tiles.js.map +1 -1
- package/dist/es5/lib/parsers/constants.js +71 -25
- package/dist/es5/lib/parsers/constants.js.map +1 -1
- package/dist/es5/lib/parsers/parse-i3s-attribute.js +34 -68
- package/dist/es5/lib/parsers/parse-i3s-attribute.js.map +1 -1
- package/dist/es5/lib/parsers/parse-i3s-building-scene-layer.js +28 -59
- package/dist/es5/lib/parsers/parse-i3s-building-scene-layer.js.map +1 -1
- package/dist/es5/lib/parsers/parse-i3s-tile-content.js +314 -415
- package/dist/es5/lib/parsers/parse-i3s-tile-content.js.map +1 -1
- package/dist/es5/lib/parsers/parse-i3s.js +31 -70
- package/dist/es5/lib/parsers/parse-i3s.js.map +1 -1
- package/dist/es5/lib/utils/convert-i3s-obb-to-mbs.js +4 -8
- package/dist/es5/lib/utils/convert-i3s-obb-to-mbs.js.map +1 -1
- package/dist/es5/lib/utils/url-utils.js +17 -14
- package/dist/es5/lib/utils/url-utils.js.map +1 -1
- package/dist/es5/types.js +19 -0
- package/dist/es5/types.js.map +1 -1
- package/dist/esm/i3s-attribute-loader.js +44 -14
- package/dist/esm/i3s-attribute-loader.js.map +1 -1
- package/dist/esm/i3s-building-scene-layer-loader.js +1 -1
- package/dist/esm/i3s-building-scene-layer-loader.js.map +1 -1
- package/dist/esm/i3s-content-loader.js +1 -1
- package/dist/esm/i3s-content-loader.js.map +1 -1
- package/dist/esm/i3s-loader.js +5 -2
- package/dist/esm/i3s-loader.js.map +1 -1
- package/dist/esm/i3s-node-page-loader.js +1 -1
- package/dist/esm/i3s-node-page-loader.js.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/helpers/i3s-nodepages-tiles.js +3 -3
- package/dist/esm/lib/helpers/i3s-nodepages-tiles.js.map +1 -1
- package/dist/esm/lib/parsers/constants.js +55 -15
- package/dist/esm/lib/parsers/constants.js.map +1 -1
- package/dist/esm/lib/parsers/parse-i3s-attribute.js +9 -1
- package/dist/esm/lib/parsers/parse-i3s-attribute.js.map +1 -1
- package/dist/esm/lib/parsers/parse-i3s-building-scene-layer.js +3 -1
- package/dist/esm/lib/parsers/parse-i3s-building-scene-layer.js.map +1 -1
- package/dist/esm/lib/parsers/parse-i3s-tile-content.js +87 -61
- package/dist/esm/lib/parsers/parse-i3s-tile-content.js.map +1 -1
- package/dist/esm/lib/parsers/parse-i3s.js +4 -4
- package/dist/esm/lib/parsers/parse-i3s.js.map +1 -1
- package/dist/esm/lib/utils/url-utils.js +3 -3
- package/dist/esm/lib/utils/url-utils.js.map +1 -1
- package/dist/esm/types.js +13 -1
- package/dist/esm/types.js.map +1 -1
- package/dist/i3s-attribute-loader.d.ts +14 -0
- package/dist/i3s-attribute-loader.d.ts.map +1 -0
- package/dist/i3s-attribute-loader.js +177 -0
- package/dist/i3s-building-scene-layer-loader.d.ts +6 -0
- package/dist/i3s-building-scene-layer-loader.d.ts.map +1 -0
- package/dist/i3s-building-scene-layer-loader.js +26 -0
- package/dist/i3s-content-loader.d.ts +6 -0
- package/dist/i3s-content-loader.d.ts.map +1 -0
- package/dist/i3s-content-loader.js +28 -0
- package/dist/i3s-content-worker.js +7657 -2
- package/dist/i3s-loader.d.ts +6 -0
- package/dist/i3s-loader.d.ts.map +1 -0
- package/dist/i3s-loader.js +100 -0
- package/dist/i3s-node-page-loader.d.ts +6 -0
- package/dist/i3s-node-page-loader.d.ts.map +1 -0
- package/dist/i3s-node-page-loader.js +26 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/lib/helpers/i3s-nodepages-tiles.d.ts +73 -0
- package/dist/lib/helpers/i3s-nodepages-tiles.d.ts.map +1 -0
- package/dist/lib/helpers/i3s-nodepages-tiles.js +231 -0
- package/dist/lib/parsers/constants.d.ts +56 -0
- package/dist/lib/parsers/constants.d.ts.map +1 -0
- package/dist/lib/parsers/constants.js +107 -0
- package/dist/lib/parsers/parse-i3s-attribute.d.ts +10 -0
- package/dist/lib/parsers/parse-i3s-attribute.d.ts.map +1 -0
- package/dist/lib/parsers/parse-i3s-attribute.js +98 -0
- package/dist/lib/parsers/parse-i3s-building-scene-layer.d.ts +9 -0
- package/dist/lib/parsers/parse-i3s-building-scene-layer.d.ts.map +1 -0
- package/dist/lib/parsers/parse-i3s-building-scene-layer.js +46 -0
- package/dist/lib/parsers/parse-i3s-tile-content.d.ts +4 -0
- package/dist/lib/parsers/parse-i3s-tile-content.d.ts.map +1 -0
- package/dist/lib/parsers/parse-i3s-tile-content.js +508 -0
- package/dist/lib/parsers/parse-i3s.d.ts +4 -0
- package/dist/lib/parsers/parse-i3s.d.ts.map +1 -0
- package/dist/lib/parsers/parse-i3s.js +84 -0
- package/dist/lib/utils/convert-i3s-obb-to-mbs.d.ts +2 -0
- package/dist/lib/utils/convert-i3s-obb-to-mbs.d.ts.map +1 -0
- package/dist/lib/utils/convert-i3s-obb-to-mbs.js +20 -0
- package/dist/lib/utils/url-utils.d.ts +22 -0
- package/dist/lib/utils/url-utils.d.ts.map +1 -0
- package/dist/lib/utils/url-utils.js +44 -0
- package/dist/types.d.ts +429 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +15 -0
- package/dist/workers/i3s-content-worker.d.ts +2 -0
- package/dist/workers/i3s-content-worker.d.ts.map +1 -0
- package/dist/workers/i3s-content-worker.js +5 -0
- package/package.json +14 -12
- package/src/i3s-attribute-loader.ts +56 -19
- package/src/i3s-loader.ts +4 -1
- package/src/index.ts +1 -0
- package/src/lib/parsers/constants.ts +73 -18
- package/src/lib/parsers/parse-i3s-attribute.ts +19 -1
- package/src/lib/parsers/parse-i3s-building-scene-layer.ts +2 -1
- package/src/lib/parsers/parse-i3s-tile-content.ts +159 -109
- package/src/lib/utils/url-utils.ts +1 -1
- package/src/types.ts +153 -22
- package/dist/dist.min.js +0 -2
- package/dist/dist.min.js.map +0 -1
- package/dist/i3s-content-worker.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { load } from '@loaders.gl/core';
|
|
2
2
|
import { parseI3STileAttribute } from './lib/parsers/parse-i3s-attribute';
|
|
3
3
|
import { getUrlWithToken } from './lib/utils/url-utils';
|
|
4
|
-
const VERSION = typeof "3.1.0-
|
|
4
|
+
const VERSION = typeof "3.1.0-beta.5" !== 'undefined' ? "3.1.0-beta.5" : 'latest';
|
|
5
5
|
const EMPTY_VALUE = '';
|
|
6
6
|
const REJECTED_STATUS = 'rejected';
|
|
7
7
|
export const I3SAttributeLoader = {
|
|
@@ -24,7 +24,8 @@ async function parse(data, options) {
|
|
|
24
24
|
export async function loadFeatureAttributes(tile, featureId, options = {}) {
|
|
25
25
|
const {
|
|
26
26
|
attributeStorageInfo,
|
|
27
|
-
attributeUrls
|
|
27
|
+
attributeUrls,
|
|
28
|
+
tilesetFields
|
|
28
29
|
} = getAttributesData(tile);
|
|
29
30
|
|
|
30
31
|
if (!attributeStorageInfo || !attributeUrls || !featureId) {
|
|
@@ -56,15 +57,19 @@ export async function loadFeatureAttributes(tile, featureId, options = {}) {
|
|
|
56
57
|
return null;
|
|
57
58
|
}
|
|
58
59
|
|
|
59
|
-
return generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId);
|
|
60
|
+
return generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields);
|
|
60
61
|
}
|
|
61
62
|
|
|
62
63
|
function getAttributesData(tile) {
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
var _tile$tileset, _tile$tileset$tileset, _tile$header, _tile$tileset2, _tile$tileset2$tilese;
|
|
65
|
+
|
|
66
|
+
const attributeStorageInfo = (_tile$tileset = tile.tileset) === null || _tile$tileset === void 0 ? void 0 : (_tile$tileset$tileset = _tile$tileset.tileset) === null || _tile$tileset$tileset === void 0 ? void 0 : _tile$tileset$tileset.attributeStorageInfo;
|
|
67
|
+
const attributeUrls = (_tile$header = tile.header) === null || _tile$header === void 0 ? void 0 : _tile$header.attributeUrls;
|
|
68
|
+
const tilesetFields = ((_tile$tileset2 = tile.tileset) === null || _tile$tileset2 === void 0 ? void 0 : (_tile$tileset2$tilese = _tile$tileset2.tileset) === null || _tile$tileset2$tilese === void 0 ? void 0 : _tile$tileset2$tilese.fields) || [];
|
|
65
69
|
return {
|
|
66
70
|
attributeStorageInfo,
|
|
67
|
-
attributeUrls
|
|
71
|
+
attributeUrls,
|
|
72
|
+
tilesetFields
|
|
68
73
|
};
|
|
69
74
|
}
|
|
70
75
|
|
|
@@ -78,34 +83,48 @@ function getAttributeValueType(attribute) {
|
|
|
78
83
|
return '';
|
|
79
84
|
}
|
|
80
85
|
|
|
81
|
-
function
|
|
82
|
-
const
|
|
86
|
+
function getFeatureIdsAttributeName(attributeStorageInfo) {
|
|
87
|
+
const objectIdsAttribute = attributeStorageInfo.find(attribute => attribute.name.includes('OBJECTID'));
|
|
88
|
+
return objectIdsAttribute === null || objectIdsAttribute === void 0 ? void 0 : objectIdsAttribute.name;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields) {
|
|
92
|
+
const objectIdsAttributeName = getFeatureIdsAttributeName(attributeStorageInfo);
|
|
93
|
+
const objectIds = attributes.find(attribute => attribute.value[objectIdsAttributeName]);
|
|
83
94
|
|
|
84
95
|
if (!objectIds) {
|
|
85
96
|
return null;
|
|
86
97
|
}
|
|
87
98
|
|
|
88
|
-
const attributeIndex = objectIds.value.
|
|
99
|
+
const attributeIndex = objectIds.value[objectIdsAttributeName].indexOf(featureId);
|
|
89
100
|
|
|
90
101
|
if (attributeIndex < 0) {
|
|
91
102
|
return null;
|
|
92
103
|
}
|
|
93
104
|
|
|
94
|
-
return getFeatureAttributesByIndex(attributes, attributeIndex, attributeStorageInfo);
|
|
105
|
+
return getFeatureAttributesByIndex(attributes, attributeIndex, attributeStorageInfo, tilesetFields);
|
|
95
106
|
}
|
|
96
107
|
|
|
97
|
-
function getFeatureAttributesByIndex(attributes, featureIdIndex, attributeStorageInfo) {
|
|
108
|
+
function getFeatureAttributesByIndex(attributes, featureIdIndex, attributeStorageInfo, tilesetFields) {
|
|
98
109
|
const attributesObject = {};
|
|
99
110
|
|
|
100
111
|
for (let index = 0; index < attributeStorageInfo.length; index++) {
|
|
101
112
|
const attributeName = attributeStorageInfo[index].name;
|
|
113
|
+
const codedValues = getAttributeCodedValues(attributeName, tilesetFields);
|
|
102
114
|
const attribute = getAttributeByIndexAndAttributeName(attributes, index, attributeName);
|
|
103
|
-
attributesObject[attributeName] = formatAttributeValue(attribute, featureIdIndex);
|
|
115
|
+
attributesObject[attributeName] = formatAttributeValue(attribute, featureIdIndex, codedValues);
|
|
104
116
|
}
|
|
105
117
|
|
|
106
118
|
return attributesObject;
|
|
107
119
|
}
|
|
108
120
|
|
|
121
|
+
function getAttributeCodedValues(attributeName, tilesetFields) {
|
|
122
|
+
var _attributeField$domai;
|
|
123
|
+
|
|
124
|
+
const attributeField = tilesetFields.find(field => field.name === attributeName || field.alias === attributeName);
|
|
125
|
+
return (attributeField === null || attributeField === void 0 ? void 0 : (_attributeField$domai = attributeField.domain) === null || _attributeField$domai === void 0 ? void 0 : _attributeField$domai.codedValues) || [];
|
|
126
|
+
}
|
|
127
|
+
|
|
109
128
|
function getAttributeByIndexAndAttributeName(attributes, index, attributesName) {
|
|
110
129
|
const attributeObject = attributes[index];
|
|
111
130
|
|
|
@@ -116,7 +135,18 @@ function getAttributeByIndexAndAttributeName(attributes, index, attributesName)
|
|
|
116
135
|
return attributeObject.value[attributesName];
|
|
117
136
|
}
|
|
118
137
|
|
|
119
|
-
function formatAttributeValue(attribute, featureIdIndex) {
|
|
120
|
-
|
|
138
|
+
function formatAttributeValue(attribute, featureIdIndex, codedValues) {
|
|
139
|
+
let value = EMPTY_VALUE;
|
|
140
|
+
|
|
141
|
+
if (attribute && featureIdIndex in attribute) {
|
|
142
|
+
value = String(attribute[featureIdIndex]).replace(/\u0000|NaN/g, '').trim();
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if (codedValues.length) {
|
|
146
|
+
const codeValue = codedValues.find(codedValue => codedValue.code === Number(value));
|
|
147
|
+
value = (codeValue === null || codeValue === void 0 ? void 0 : codeValue.name) || EMPTY_VALUE;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
return value;
|
|
121
151
|
}
|
|
122
152
|
//# sourceMappingURL=i3s-attribute-loader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/i3s-attribute-loader.ts"],"names":["load","parseI3STileAttribute","getUrlWithToken","VERSION","EMPTY_VALUE","REJECTED_STATUS","I3SAttributeLoader","name","id","module","version","mimeTypes","parse","extensions","options","binary","data","loadFeatureAttributes","tile","featureId","attributeStorageInfo","attributeUrls","getAttributesData","attributes","attributeLoadPromises","index","length","url","i3s","token","attributeName","attributeType","getAttributeValueType","loadOptions","promise","push","Promise","allSettled","error","generateAttributesByFeatureId","tileset","header","attribute","hasOwnProperty","attributeValues","valueType","objectIds","find","value","OBJECTID","attributeIndex","indexOf","getFeatureAttributesByIndex","featureIdIndex","attributesObject","getAttributeByIndexAndAttributeName","formatAttributeValue","attributesName","attributeObject","status","toString","replace","trim"],"mappings":"AACA,SAAQA,IAAR,QAAmB,kBAAnB;AACA,SAAQC,qBAAR,QAAoC,mCAApC;AACA,SAAQC,eAAR,QAA8B,uBAA9B;AAIA,MAAMC,OAAO,GAAG,2BAAuB,WAAvB,qBAAmD,QAAnE;AACA,MAAMC,WAAW,GAAG,EAApB;AACA,MAAMC,eAAe,GAAG,UAAxB;AAIA,OAAO,MAAMC,kBAAoC,GAAG;AAClDC,EAAAA,IAAI,EAAE,eAD4C;AAElDC,EAAAA,EAAE,EAAE,eAF8C;AAGlDC,EAAAA,MAAM,EAAE,KAH0C;AAIlDC,EAAAA,OAAO,EAAEP,OAJyC;AAKlDQ,EAAAA,SAAS,EAAE,CAAC,oBAAD,CALuC;AAMlDC,EAAAA,KANkD;AAOlDC,EAAAA,UAAU,EAAE,CAAC,KAAD,CAPsC;AAQlDC,EAAAA,OAAO,EAAE,EARyC;AASlDC,EAAAA,MAAM,EAAE;AAT0C,CAA7C;;AAYP,eAAeH,KAAf,CAAqBI,IAArB,EAA2BF,OAA3B,EAAoC;AAClCE,EAAAA,IAAI,GAAGf,qBAAqB,CAACe,IAAD,EAAOF,OAAP,CAA5B;AACA,SAAOE,IAAP;AACD;;AAUD,OAAO,eAAeC,qBAAf,CAAqCC,IAArC,EAA2CC,SAA3C,EAAsDL,OAAO,GAAG,EAAhE,EAAoE;AACzE,QAAM;AAACM,IAAAA,oBAAD;AAAuBC,IAAAA;AAAvB,MAAwCC,iBAAiB,CAACJ,IAAD,CAA/D;;AAEA,MAAI,CAACE,oBAAD,IAAyB,CAACC,aAA1B,IAA2C,CAACF,SAAhD,EAA2D;AACzD,WAAO,IAAP;AACD;;AAED,MAAII,UAAoB,GAAG,EAA3B;AACA,QAAMC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B,GAAkC0B,oBAAoB,CAACd,SAAD,EAAYW,cAAZ,CAAtD;AACD;;AAED,SAAOC,gBAAP;AACD;;AAQD,SAASC,mCAAT,CAA6ChC,UAA7C,EAAyDE,KAAzD,EAAgEgC,cAAhE,EAAgF;AAC9E,QAAMC,eAAe,GAAGnC,UAAU,CAACE,KAAD,CAAlC;;AAEA,MAAIiC,eAAe,CAACC,MAAhB,KAA2BtD,eAA/B,EAAgD;AAC9C,WAAO,IAAP;AACD;;AAED,SAAOqD,eAAe,CAACV,KAAhB,CAAsBS,cAAtB,CAAP;AACD;;AAQD,SAASD,oBAAT,CAA8Bd,SAA9B,EAAyCW,cAAzC,EAAyD;AACvD,SAAOX,SAAS,IAAIA,SAAS,CAACW,cAAD,CAAtB,GACHX,SAAS,CAACW,cAAD,CAAT,CACCO,QADD,GAGCC,OAHD,CAGS,SAHT,EAGoB,EAHpB,EAICC,IAJD,EADG,GAMH1D,WANJ;AAOD","sourcesContent":["import type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {load} from '@loaders.gl/core';\nimport {parseI3STileAttribute} from './lib/parsers/parse-i3s-attribute';\nimport {getUrlWithToken} from './lib/utils/url-utils';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\nconst EMPTY_VALUE = '';\nconst REJECTED_STATUS = 'rejected';\n/**\n * Loader for I3S attributes\n */\nexport const I3SAttributeLoader: LoaderWithParser = {\n name: 'I3S Attribute',\n id: 'i3s-attribute',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/binary'],\n parse,\n extensions: ['bin'],\n options: {},\n binary: true\n};\n\nasync function parse(data, options) {\n data = parseI3STileAttribute(data, options);\n return data;\n}\n\n/**\n * Load attributes based on feature id\n * @param {Object} tile\n * @param {number} featureId\n * @param {Object} options\n * @returns {Promise}\n */\n// eslint-disable-next-line complexity\nexport async function loadFeatureAttributes(tile, featureId, options = {}) {\n const {attributeStorageInfo, attributeUrls} = getAttributesData(tile);\n\n if (!attributeStorageInfo || !attributeUrls || !featureId) {\n return null;\n }\n\n let attributes: object[] = [];\n const attributeLoadPromises: Promise<object>[] = [];\n\n for (let index = 0; index < attributeStorageInfo.length; index++) {\n // @ts-ignore\n const url = getUrlWithToken(attributeUrls[index], options.i3s?.token);\n const attributeName = attributeStorageInfo[index].name;\n const attributeType = getAttributeValueType(attributeStorageInfo[index]);\n const loadOptions = {...options, attributeName, attributeType};\n const promise = load(url, I3SAttributeLoader, loadOptions);\n\n attributeLoadPromises.push(promise);\n }\n try {\n attributes = await Promise.allSettled(attributeLoadPromises);\n } catch (error) {\n // do nothing\n }\n\n if (!attributes.length) {\n return null;\n }\n\n return generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId);\n}\n\nfunction getAttributesData(tile) {\n const attributeStorageInfo =\n tile && tile.tileset && tile.tileset.tileset && tile.tileset.tileset.attributeStorageInfo;\n const attributeUrls = tile && tile.header && tile.header.attributeUrls;\n\n return {attributeStorageInfo, attributeUrls};\n}\n\n/**\n * Get attribute value type based on property names\n * @param {Object} attribute\n * @returns {String}\n */\nfunction getAttributeValueType(attribute) {\n if (attribute.hasOwnProperty('objectIds')) {\n return 'Oid32';\n } else if (attribute.hasOwnProperty('attributeValues')) {\n return attribute.attributeValues.valueType;\n }\n return '';\n}\n\n/**\n * Generates mapping featureId to feature attributes\n * @param {Array} attributes\n * @param {Object} attributeStorageInfo\n * @param {number} featureId\n * @returns {Object}\n */\nfunction generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId) {\n const objectIds = attributes.find((attribute) => attribute.value.OBJECTID);\n\n if (!objectIds) {\n return null;\n }\n\n const attributeIndex = objectIds.value.OBJECTID.indexOf(featureId);\n\n if (attributeIndex < 0) {\n return null;\n }\n\n return getFeatureAttributesByIndex(attributes, attributeIndex, attributeStorageInfo);\n}\n\n/**\n * Generates attribute object for feature mapping by feature id\n * @param {Array} attributes\n * @param {Number} featureIdIndex\n * @param {Object} attributeStorageInfo\n * @returns {Object}\n */\nfunction getFeatureAttributesByIndex(attributes, featureIdIndex, attributeStorageInfo) {\n const attributesObject = {};\n\n for (let index = 0; index < attributeStorageInfo.length; index++) {\n const attributeName = attributeStorageInfo[index].name;\n const attribute = getAttributeByIndexAndAttributeName(attributes, index, attributeName);\n attributesObject[attributeName] = formatAttributeValue(attribute, featureIdIndex);\n }\n\n return attributesObject;\n}\n\n/**\n * Return attribute value if it presents in atrributes list\n * @param {array} attributes\n * @param {number} index\n * @param {string} attributesName\n */\nfunction getAttributeByIndexAndAttributeName(attributes, index, attributesName) {\n const attributeObject = attributes[index];\n\n if (attributeObject.status === REJECTED_STATUS) {\n return null;\n }\n\n return attributeObject.value[attributesName];\n}\n\n/**\n * Do formatting of attribute values or return empty string.\n * @param {Array} attribute\n * @param {Number} featureIdIndex\n * @returns {String}\n */\nfunction formatAttributeValue(attribute, featureIdIndex) {\n return attribute && attribute[featureIdIndex]\n ? attribute[featureIdIndex]\n .toString()\n // eslint-disable-next-line no-control-regex\n .replace(/\\u0000/g, '')\n .trim()\n : EMPTY_VALUE;\n}\n"],"file":"i3s-attribute-loader.js"}
|
|
1
|
+
{"version":3,"sources":["../../src/i3s-attribute-loader.ts"],"names":["load","parseI3STileAttribute","getUrlWithToken","VERSION","EMPTY_VALUE","REJECTED_STATUS","I3SAttributeLoader","name","id","module","version","mimeTypes","parse","extensions","options","binary","data","loadFeatureAttributes","tile","featureId","attributeStorageInfo","attributeUrls","tilesetFields","getAttributesData","attributes","attributeLoadPromises","index","length","url","i3s","token","attributeName","attributeType","getAttributeValueType","loadOptions","promise","push","Promise","allSettled","error","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"],"mappings":"AACA,SAAQA,IAAR,QAAmB,kBAAnB;AACA,SAAQC,qBAAR,QAAoC,mCAApC;AACA,SAAQC,eAAR,QAA8B,uBAA9B;AAIA,MAAMC,OAAO,GAAG,0BAAuB,WAAvB,oBAAmD,QAAnE;AACA,MAAMC,WAAW,GAAG,EAApB;AACA,MAAMC,eAAe,GAAG,UAAxB;AAIA,OAAO,MAAMC,kBAAoC,GAAG;AAClDC,EAAAA,IAAI,EAAE,eAD4C;AAElDC,EAAAA,EAAE,EAAE,eAF8C;AAGlDC,EAAAA,MAAM,EAAE,KAH0C;AAIlDC,EAAAA,OAAO,EAAEP,OAJyC;AAKlDQ,EAAAA,SAAS,EAAE,CAAC,oBAAD,CALuC;AAMlDC,EAAAA,KANkD;AAOlDC,EAAAA,UAAU,EAAE,CAAC,KAAD,CAPsC;AAQlDC,EAAAA,OAAO,EAAE,EARyC;AASlDC,EAAAA,MAAM,EAAE;AAT0C,CAA7C;;AAYP,eAAeH,KAAf,CAAqBI,IAArB,EAA2BF,OAA3B,EAAoC;AAClCE,EAAAA,IAAI,GAAGf,qBAAqB,CAACe,IAAD,EAAOF,OAAP,CAA5B;AACA,SAAOE,IAAP;AACD;;AAUD,OAAO,eAAeC,qBAAf,CAAqCC,IAArC,EAA2CC,SAA3C,EAAsDL,OAAO,GAAG,EAAhE,EAAoE;AACzE,QAAM;AAACM,IAAAA,oBAAD;AAAuBC,IAAAA,aAAvB;AAAsCC,IAAAA;AAAtC,MAAuDC,iBAAiB,CAACL,IAAD,CAA9E;;AAEA,MAAI,CAACE,oBAAD,IAAyB,CAACC,aAA1B,IAA2C,CAACF,SAAhD,EAA2D;AACzD,WAAO,IAAP;AACD;;AAED,MAAIK,UAAoB,GAAG,EAA3B;AACA,QAAMC,qBAAwC,GAAG,EAAjD;;AAEA,OAAK,IAAIC,KAAK,GAAG,CAAjB,EA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KAAK,GAAGlD,WAAZ;;AAEA,MAAIwC,SAAS,IAAKc,cAAc,IAAId,SAApC,EAAgD;AAE9CU,IAAAA,KAAK,GAAGiB,MAAM,CAAC3B,SAAS,CAACc,cAAD,CAAV,CAAN,CAAkCc,OAAlC,CAA0C,aAA1C,EAAyD,EAAzD,EAA6DC,IAA7D,EAAR;AACD;;AAGD,MAAIb,WAAW,CAACjC,MAAhB,EAAwB;AACtB,UAAM+C,SAAS,GAAGd,WAAW,CAACV,IAAZ,CAAiByB,UAAU,IAAIA,UAAU,CAACC,IAAX,KAAoBC,MAAM,CAACvB,KAAD,CAAzD,CAAlB;AACAA,IAAAA,KAAK,GAAG,CAAAoB,SAAS,SAAT,IAAAA,SAAS,WAAT,YAAAA,SAAS,CAAEnE,IAAX,KAAmBH,WAA3B;AACD;;AAED,SAAOkD,KAAP;AACD","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) {\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 */\nfunction getAttributeValueType(attribute) {\n if (attribute.hasOwnProperty('objectIds')) {\n return 'Oid32';\n } else if (attribute.hasOwnProperty('attributeValues')) {\n return attribute.attributeValues.valueType;\n }\n return '';\n}\n\n/**\n * 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"],"file":"i3s-attribute-loader.js"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { parseBuildingSceneLayer } from './lib/parsers/parse-i3s-building-scene-layer';
|
|
2
|
-
const VERSION = typeof "3.1.0-
|
|
2
|
+
const VERSION = typeof "3.1.0-beta.5" !== 'undefined' ? "3.1.0-beta.5" : 'beta';
|
|
3
3
|
export const I3SBuildingSceneLayerLoader = {
|
|
4
4
|
name: 'I3S Building Scene Layer',
|
|
5
5
|
id: 'i3s-building-scene-layer',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/i3s-building-scene-layer-loader.ts"],"names":["parseBuildingSceneLayer","VERSION","I3SBuildingSceneLayerLoader","name","id","module","version","mimeTypes","parse","extensions","options","data","context","url","Error"],"mappings":"AAGA,SAAQA,uBAAR,QAAsC,8CAAtC;AAKA,MAAMC,OAAO,GAAG,
|
|
1
|
+
{"version":3,"sources":["../../src/i3s-building-scene-layer-loader.ts"],"names":["parseBuildingSceneLayer","VERSION","I3SBuildingSceneLayerLoader","name","id","module","version","mimeTypes","parse","extensions","options","data","context","url","Error"],"mappings":"AAGA,SAAQA,uBAAR,QAAsC,8CAAtC;AAKA,MAAMC,OAAO,GAAG,0BAAuB,WAAvB,oBAAmD,MAAnE;AAIA,OAAO,MAAMC,2BAA6C,GAAG;AAC3DC,EAAAA,IAAI,EAAE,0BADqD;AAE3DC,EAAAA,EAAE,EAAE,0BAFuD;AAG3DC,EAAAA,MAAM,EAAE,KAHmD;AAI3DC,EAAAA,OAAO,EAAEL,OAJkD;AAK3DM,EAAAA,SAAS,EAAE,CAAC,kBAAD,CALgD;AAM3DC,EAAAA,KAN2D;AAO3DC,EAAAA,UAAU,EAAE,CAAC,MAAD,CAP+C;AAQ3DC,EAAAA,OAAO,EAAE;AARkD,CAAtD;;AAWP,eAAeF,KAAf,CACEG,IADF,EAEED,OAFF,EAGEE,OAHF,EAIsC;AACpC,MAAI,EAACA,OAAD,aAACA,OAAD,eAACA,OAAO,CAAEC,GAAV,CAAJ,EAAmB;AACjB,UAAM,IAAIC,KAAJ,CAAU,qBAAV,CAAN;AACD;;AAED,SAAOd,uBAAuB,CAACW,IAAD,EAAOC,OAAO,CAACC,GAAf,CAA9B;AACD","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"],"file":"i3s-building-scene-layer-loader.js"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { parseI3STileContent } from './lib/parsers/parse-i3s-tile-content';
|
|
2
|
-
const VERSION = typeof "3.1.0-
|
|
2
|
+
const VERSION = typeof "3.1.0-beta.5" !== 'undefined' ? "3.1.0-beta.5" : 'beta';
|
|
3
3
|
export const I3SContentLoader = {
|
|
4
4
|
name: 'I3S Content (Indexed Scene Layers)',
|
|
5
5
|
id: 'i3s-content',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/i3s-content-loader.ts"],"names":["parseI3STileContent","VERSION","I3SContentLoader","name","id","module","worker","version","mimeTypes","parse","extensions","options","data","context","tile","tileset","i3s","content"],"mappings":"AACA,SAAQA,mBAAR,QAAkC,sCAAlC;AAKA,MAAMC,OAAO,GAAG,
|
|
1
|
+
{"version":3,"sources":["../../src/i3s-content-loader.ts"],"names":["parseI3STileContent","VERSION","I3SContentLoader","name","id","module","worker","version","mimeTypes","parse","extensions","options","data","context","tile","tileset","i3s","content"],"mappings":"AACA,SAAQA,mBAAR,QAAkC,sCAAlC;AAKA,MAAMC,OAAO,GAAG,0BAAuB,WAAvB,oBAAmD,MAAnE;AAIA,OAAO,MAAMC,gBAAkC,GAAG;AAChDC,EAAAA,IAAI,EAAE,oCAD0C;AAEhDC,EAAAA,EAAE,EAAE,aAF4C;AAGhDC,EAAAA,MAAM,EAAE,KAHwC;AAIhDC,EAAAA,MAAM,EAAE,IAJwC;AAKhDC,EAAAA,OAAO,EAAEN,OALuC;AAMhDO,EAAAA,SAAS,EAAE,CAAC,0BAAD,CANqC;AAOhDC,EAAAA,KAPgD;AAQhDC,EAAAA,UAAU,EAAE,CAAC,KAAD,CARoC;AAShDC,EAAAA,OAAO,EAAE;AACP,mBAAe;AADR;AATuC,CAA3C;;AAcP,eAAeF,KAAf,CAAqBG,IAArB,EAA2BD,OAA3B,EAAoDE,OAApD,EAA6E;AAC3E,QAAM;AAACC,IAAAA,IAAD;AAAOC,IAAAA;AAAP,MAAkB,CAAAJ,OAAO,SAAP,IAAAA,OAAO,WAAP,YAAAA,OAAO,CAAEK,GAAT,KAAgB,EAAxC;AACA,QAAMhB,mBAAmB,CAACY,IAAD,EAAOE,IAAP,EAAaC,OAAb,EAAsBJ,OAAtB,EAA+BE,OAA/B,CAAzB;AACA,SAAOC,IAAI,CAACG,OAAZ;AACD","sourcesContent":["import type {LoaderWithParser, LoaderOptions, LoaderContext} from '@loaders.gl/loader-utils';\nimport {parseI3STileContent} from './lib/parsers/parse-i3s-tile-content';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\n\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'beta';\n/**\n * Loader for I3S - Indexed 3D Scene Layer\n */\nexport const I3SContentLoader: LoaderWithParser = {\n name: 'I3S Content (Indexed Scene Layers)',\n id: 'i3s-content',\n module: 'i3s',\n worker: true,\n version: VERSION,\n mimeTypes: ['application/octet-stream'],\n parse,\n extensions: ['bin'],\n options: {\n 'i3s-content': {}\n }\n};\n\nasync function parse(data, options?: LoaderOptions, context?: LoaderContext) {\n const {tile, tileset} = options?.i3s || {};\n await parseI3STileContent(data, tile, tileset, options, context);\n return tile.content;\n}\n"],"file":"i3s-content-loader.js"}
|
package/dist/esm/i3s-loader.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { load, parse } from '@loaders.gl/core';
|
|
2
2
|
import { I3SContentLoader } from './i3s-content-loader';
|
|
3
3
|
import { normalizeTileData, normalizeTilesetData } from './lib/parsers/parse-i3s';
|
|
4
|
-
|
|
4
|
+
import { COORDINATE_SYSTEM } from './lib/parsers/constants';
|
|
5
|
+
const VERSION = typeof "3.1.0-beta.5" !== 'undefined' ? "3.1.0-beta.5" : 'latest';
|
|
5
6
|
const TILESET_REGEX = /layers\/[0-9]+$/;
|
|
6
7
|
const TILE_HEADER_REGEX = /nodes\/([0-9-]+|root)$/;
|
|
7
8
|
const SLPK_HEX = '504b0304';
|
|
@@ -22,7 +23,9 @@ export const I3SLoader = {
|
|
|
22
23
|
tile: null,
|
|
23
24
|
tileset: null,
|
|
24
25
|
useDracoGeometry: true,
|
|
25
|
-
useCompressedTextures: true
|
|
26
|
+
useCompressedTextures: true,
|
|
27
|
+
decodeTextures: true,
|
|
28
|
+
coordinateSystem: COORDINATE_SYSTEM.METER_OFFSETS
|
|
26
29
|
}
|
|
27
30
|
}
|
|
28
31
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/i3s-loader.ts"],"names":["load","parse","I3SContentLoader","normalizeTileData","normalizeTilesetData","VERSION","TILESET_REGEX","TILE_HEADER_REGEX","SLPK_HEX","I3SLoader","name","id","module","version","mimeTypes","parseI3S","extensions","options","i3s","loadContent","token","isTileset","isTileHeader","tile","tileset","useDracoGeometry","useCompressedTextures","data","context","url","magicNumber","getMagicNumber","Error","test","parseTileset","parseTile","contentUrl","parseTileContent","arrayBuffer","tilesetJson","JSON","TextDecoder","decode","loader","ArrayBuffer","Uint8Array","map","value","toString","padStart","join"],"mappings":"AACA,SAAQA,IAAR,EAAcC,KAAd,QAA0B,kBAA1B;AACA,SAAQC,gBAAR,QAA+B,sBAA/B;AACA,SAAQC,iBAAR,EAA2BC,oBAA3B,QAAsD,yBAAtD;AAIA,MAAMC,OAAO,GAAG,
|
|
1
|
+
{"version":3,"sources":["../../src/i3s-loader.ts"],"names":["load","parse","I3SContentLoader","normalizeTileData","normalizeTilesetData","COORDINATE_SYSTEM","VERSION","TILESET_REGEX","TILE_HEADER_REGEX","SLPK_HEX","I3SLoader","name","id","module","version","mimeTypes","parseI3S","extensions","options","i3s","loadContent","token","isTileset","isTileHeader","tile","tileset","useDracoGeometry","useCompressedTextures","decodeTextures","coordinateSystem","METER_OFFSETS","data","context","url","magicNumber","getMagicNumber","Error","test","parseTileset","parseTile","contentUrl","parseTileContent","arrayBuffer","tilesetJson","JSON","TextDecoder","decode","loader","ArrayBuffer","Uint8Array","map","value","toString","padStart","join"],"mappings":"AACA,SAAQA,IAAR,EAAcC,KAAd,QAA0B,kBAA1B;AACA,SAAQC,gBAAR,QAA+B,sBAA/B;AACA,SAAQC,iBAAR,EAA2BC,oBAA3B,QAAsD,yBAAtD;AACA,SAAQC,iBAAR,QAAgC,yBAAhC;AAIA,MAAMC,OAAO,GAAG,0BAAuB,WAAvB,oBAAmD,QAAnE;AAEA,MAAMC,aAAa,GAAG,iBAAtB;AACA,MAAMC,iBAAiB,GAAG,wBAA1B;AACA,MAA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,CAACI,MAAZ,GAAqBrC,SAArB;AACA,QAAMN,oBAAoB,CAACuC,WAAD,EAAczB,OAAd,EAAuBc,OAAvB,CAA1B;AAEA,SAAOW,WAAP;AACD;;AAED,eAAeJ,SAAf,CAAyBR,IAAzB,EAA+Bb,OAA/B,EAAwCc,OAAxC,EAAiD;AAC/CD,EAAAA,IAAI,GAAGa,IAAI,CAAC3C,KAAL,CAAW,IAAI4C,WAAJ,GAAkBC,MAAlB,CAAyBf,IAAzB,CAAX,CAAP;AACA,SAAO5B,iBAAiB,CAAC4B,IAAD,EAAOb,OAAP,EAAgBc,OAAhB,CAAxB;AACD;;AAED,SAASG,cAAT,CAAwBJ,IAAxB,EAA8B;AAC5B,MAAIA,IAAI,YAAYiB,WAApB,EAAiC;AAE/B,WAAO,CAAC,GAAG,IAAIC,UAAJ,CAAelB,IAAf,EAAqB,CAArB,EAAwB,CAAxB,CAAJ,EACJmB,GADI,CACCC,KAAD,IAAWA,KAAK,CAACC,QAAN,CAAe,EAAf,EAAmBC,QAAnB,CAA4B,CAA5B,EAA+B,GAA/B,CADX,EAEJC,IAFI,CAEC,EAFD,CAAP;AAGD;;AACD,SAAO,IAAP;AACD","sourcesContent":["import type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {load, parse} from '@loaders.gl/core';\nimport {I3SContentLoader} from './i3s-content-loader';\nimport {normalizeTileData, normalizeTilesetData} from './lib/parsers/parse-i3s';\nimport {COORDINATE_SYSTEM} from './lib/parsers/constants';\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';\n\nconst TILESET_REGEX = /layers\\/[0-9]+$/;\nconst TILE_HEADER_REGEX = /nodes\\/([0-9-]+|root)$/;\nconst SLPK_HEX = '504b0304';\n\n/**\n * Loader for I3S - Indexed 3D Scene Layer\n */\nexport const I3SLoader: LoaderWithParser = {\n name: 'I3S (Indexed Scene Layers)',\n id: 'i3s',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/octet-stream'],\n parse: parseI3S,\n extensions: ['bin'],\n options: {\n i3s: {\n loadContent: true,\n token: null,\n isTileset: 'auto',\n isTileHeader: 'auto',\n tile: null,\n tileset: null,\n useDracoGeometry: true,\n useCompressedTextures: true,\n decodeTextures: true,\n coordinateSystem: COORDINATE_SYSTEM.METER_OFFSETS\n }\n }\n};\n\nasync function parseI3S(data, options, context) {\n const url = context.url;\n options.i3s = options.i3s || {};\n const magicNumber = getMagicNumber(data);\n\n // check if file is slpk\n if (magicNumber === SLPK_HEX) {\n throw new Error('Files with .slpk extention currently are not supported by I3SLoader');\n }\n\n // auto detect file type based on url\n let isTileset;\n if (options.i3s.isTileset === 'auto') {\n isTileset = TILESET_REGEX.test(url);\n } else {\n isTileset = options.i3s.isTileset;\n }\n\n let isTileHeader;\n if (options.isTileHeader === 'auto') {\n isTileHeader = TILE_HEADER_REGEX.test(url);\n } else {\n isTileHeader = options.i3s.isTileHeader;\n }\n\n if (isTileset) {\n data = await parseTileset(data, options, context);\n } else if (isTileHeader) {\n data = await parseTile(data, options, context);\n if (options.i3s.loadContent) {\n options.i3s.tile = data;\n await load(data.contentUrl, I3SLoader, options);\n }\n } else {\n data = await parseTileContent(data, options);\n }\n\n return data;\n}\n\nasync function parseTileContent(arrayBuffer, options) {\n return await parse(arrayBuffer, I3SContentLoader, options);\n}\n\nasync function parseTileset(data, options, context) {\n const tilesetJson = JSON.parse(new TextDecoder().decode(data));\n // eslint-disable-next-line no-use-before-define\n tilesetJson.loader = I3SLoader;\n await normalizeTilesetData(tilesetJson, options, context);\n\n return tilesetJson;\n}\n\nasync function parseTile(data, options, context) {\n data = JSON.parse(new TextDecoder().decode(data));\n return normalizeTileData(data, options, context);\n}\n\nfunction getMagicNumber(data) {\n if (data instanceof ArrayBuffer) {\n // slice binary data (4 bytes from the beginning) and transform it to hexadecimal numeral system\n return [...new Uint8Array(data, 0, 4)]\n .map((value) => value.toString(16).padStart(2, '0'))\n .join('');\n }\n return null;\n}\n"],"file":"i3s-loader.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/i3s-node-page-loader.ts"],"names":["VERSION","parseNodePage","data","JSON","parse","TextDecoder","decode","I3SNodePageLoader","name","id","module","version","mimeTypes","extensions","options"],"mappings":"AAIA,MAAMA,OAAO,GAAG,
|
|
1
|
+
{"version":3,"sources":["../../src/i3s-node-page-loader.ts"],"names":["VERSION","parseNodePage","data","JSON","parse","TextDecoder","decode","I3SNodePageLoader","name","id","module","version","mimeTypes","extensions","options"],"mappings":"AAIA,MAAMA,OAAO,GAAG,0BAAuB,WAAvB,oBAAmD,QAAnE;;AAEA,eAAeC,aAAf,CAA6BC,IAA7B,EAAmC;AACjC,SAAOC,IAAI,CAACC,KAAL,CAAW,IAAIC,WAAJ,GAAkBC,MAAlB,CAAyBJ,IAAzB,CAAX,CAAP;AACD;;AAKD,OAAO,MAAMK,iBAAmC,GAAG;AACjDC,EAAAA,IAAI,EAAE,eAD2C;AAEjDC,EAAAA,EAAE,EAAE,eAF6C;AAGjDC,EAAAA,MAAM,EAAE,KAHyC;AAIjDC,EAAAA,OAAO,EAAEX,OAJwC;AAKjDY,EAAAA,SAAS,EAAE,CAAC,kBAAD,CALsC;AAMjDR,EAAAA,KANiD;AAOjDS,EAAAA,UAAU,EAAE,CAAC,MAAD,CAPqC;AAQjDC,EAAAA,OAAO,EAAE;AARwC,CAA5C;;AAWP,eAAeV,KAAf,CAAqBF,IAArB,EAA2B;AACzBA,EAAAA,IAAI,GAAGD,aAAa,CAACC,IAAD,CAApB;AACA,SAAOA,IAAP;AACD","sourcesContent":["import type {LoaderWithParser} from '@loaders.gl/loader-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';\n\nasync function parseNodePage(data) {\n return JSON.parse(new TextDecoder().decode(data));\n}\n\n/**\n * Loader for I3S node pages\n */\nexport const I3SNodePageLoader: LoaderWithParser = {\n name: 'I3S Node Page',\n id: 'i3s-node-page',\n module: 'i3s',\n version: VERSION,\n mimeTypes: ['application/json'],\n parse,\n extensions: ['json'],\n options: {}\n};\n\nasync function parse(data) {\n data = parseNodePage(data);\n return data;\n}\n"],"file":"i3s-node-page-loader.js"}
|
package/dist/esm/index.js
CHANGED
|
@@ -2,4 +2,5 @@ export { I3SLoader } from './i3s-loader';
|
|
|
2
2
|
export { I3SContentLoader } from './i3s-content-loader';
|
|
3
3
|
export { I3SAttributeLoader, loadFeatureAttributes } from './i3s-attribute-loader';
|
|
4
4
|
export { I3SBuildingSceneLayerLoader } from './i3s-building-scene-layer-loader';
|
|
5
|
+
export { COORDINATE_SYSTEM } from './lib/parsers/constants';
|
|
5
6
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"names":["I3SLoader","I3SContentLoader","I3SAttributeLoader","loadFeatureAttributes","I3SBuildingSceneLayerLoader"],"mappings":"AAAA,SAAQA,SAAR,QAAwB,cAAxB;AACA,SAAQC,gBAAR,QAA+B,sBAA/B;AACA,SAAQC,kBAAR,EAA4BC,qBAA5B,QAAwD,wBAAxD;AACA,SAAQC,2BAAR,QAA0C,mCAA1C","sourcesContent":["export {I3SLoader} from './i3s-loader';\nexport {I3SContentLoader} from './i3s-content-loader';\nexport {I3SAttributeLoader, loadFeatureAttributes} from './i3s-attribute-loader';\nexport {I3SBuildingSceneLayerLoader} from './i3s-building-scene-layer-loader';\nexport type {\n BoundingVolumes,\n Mbs,\n Obb,\n SceneLayer3D,\n AttributeStorageInfo,\n Field,\n ESRIField,\n PopupInfo,\n Node3DIndexDocument,\n LodSelection,\n NodeReference,\n Resource,\n I3SGeometry,\n MaxScreenThresholdSQ,\n NodeInPage,\n SharedResources,\n TextureImage,\n Attribute,\n Extent,\n FeatureAttribute\n} from './types';\n"],"file":"index.js"}
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"names":["I3SLoader","I3SContentLoader","I3SAttributeLoader","loadFeatureAttributes","I3SBuildingSceneLayerLoader","COORDINATE_SYSTEM"],"mappings":"AAAA,SAAQA,SAAR,QAAwB,cAAxB;AACA,SAAQC,gBAAR,QAA+B,sBAA/B;AACA,SAAQC,kBAAR,EAA4BC,qBAA5B,QAAwD,wBAAxD;AACA,SAAQC,2BAAR,QAA0C,mCAA1C;AAuBA,SAAQC,iBAAR,QAAgC,yBAAhC","sourcesContent":["export {I3SLoader} from './i3s-loader';\nexport {I3SContentLoader} from './i3s-content-loader';\nexport {I3SAttributeLoader, loadFeatureAttributes} from './i3s-attribute-loader';\nexport {I3SBuildingSceneLayerLoader} from './i3s-building-scene-layer-loader';\nexport type {\n BoundingVolumes,\n Mbs,\n Obb,\n SceneLayer3D,\n AttributeStorageInfo,\n Field,\n ESRIField,\n PopupInfo,\n Node3DIndexDocument,\n LodSelection,\n NodeReference,\n Resource,\n I3SGeometry,\n MaxScreenThresholdSQ,\n NodeInPage,\n SharedResources,\n TextureImage,\n Attribute,\n Extent,\n FeatureAttribute\n} from './types';\nexport {COORDINATE_SYSTEM} from './lib/parsers/constants';\n"],"file":"index.js"}
|
|
@@ -36,7 +36,7 @@ export default class I3SNodePagesTiles {
|
|
|
36
36
|
if (!this.nodePages[pageIndex] && !this.pendingNodePages[pageIndex]) {
|
|
37
37
|
var _this$options$i3s;
|
|
38
38
|
|
|
39
|
-
const nodePageUrl = getUrlWithToken(
|
|
39
|
+
const nodePageUrl = getUrlWithToken("".concat(this.tileset.url, "/nodepages/").concat(pageIndex), (_this$options$i3s = this.options.i3s) === null || _this$options$i3s === void 0 ? void 0 : _this$options$i3s.token);
|
|
40
40
|
this.pendingNodePages[pageIndex] = {
|
|
41
41
|
status: 'Pending',
|
|
42
42
|
promise: load(nodePageUrl, I3SNodePageLoader, this.options)
|
|
@@ -87,7 +87,7 @@ export default class I3SNodePagesTiles {
|
|
|
87
87
|
textureFormat = textureData.format || textureFormat;
|
|
88
88
|
|
|
89
89
|
if (textureData.name) {
|
|
90
|
-
textureUrl =
|
|
90
|
+
textureUrl = "".concat(this.tileset.url, "/nodes/").concat(node.mesh.material.resource, "/textures/").concat(textureData.name);
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
if (this.tileset.attributeStorageInfo) {
|
|
@@ -127,7 +127,7 @@ export default class I3SNodePagesTiles {
|
|
|
127
127
|
if (geometryIndex !== -1) {
|
|
128
128
|
const isDracoGeometry = Boolean(geometryDefinition.geometryBuffers[geometryIndex].compressedAttributes);
|
|
129
129
|
result = {
|
|
130
|
-
url:
|
|
130
|
+
url: "".concat(this.tileset.url, "/nodes/").concat(meshGeometryData.resource, "/geometries/").concat(geometryIndex),
|
|
131
131
|
isDracoGeometry
|
|
132
132
|
};
|
|
133
133
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/helpers/i3s-nodepages-tiles.ts"],"names":["load","getSupportedGPUTextureFormats","selectSupportedBasisFormat","I3SNodePageLoader","normalizeTileNonUrlData","getUrlWithToken","generateTilesetAttributeUrls","I3SNodePagesTiles","constructor","tileset","options","nodesPerPage","nodePages","lodSelectionMetricType","initSelectedFormatsForTextureDefinitions","getNodeById","id","pageIndex","Math","floor","pendingNodePages","nodePageUrl","url","i3s","token","status","promise","nodeIndex","nodes","formTileFromNodePages","node","children","child","childNode","push","obb","contentUrl","textureUrl","materialDefinition","textureFormat","attributeUrls","isDracoGeometry","mesh","isDracoGeometryResult","geometry","getContentUrl","textureData","nodeMaterialDefinition","getInformationFromMaterial","material","format","name","resource","attributeStorageInfo","attribute","lodSelection","getLodSelection","textureLoaderOptions","meshGeometryData","result","geometryDefinition","geometryDefinitions","definition","geometryIndex","useDracoGeometry","geometryBuffers","findIndex","buffer","compressedAttributes","encoding","Boolean","metricType","maxError","sqrt","lodThreshold","PI","textureDataDefault","materialDefinitions","textureSetDefinitionIndex","pbrMetallicRoughness","baseColorTexture","textureSetDefinitionId","textureDefinitionsSelectedFormats","possibleI3sFormats","getSupportedTextureFormats","textureSetDefinitions","textureSetDefinition","formats","selectedFormat","i3sFormat","find","value","basis","containerFormat","module","useCompressedTextures","supportedCompressedFormats","has"],"mappings":";AAAA,SAAQA,IAAR,QAAmB,kBAAnB;AACA,SAAQC,6BAAR,EAAuCC,0BAAvC,QAAwE,sBAAxE;AAEA,SAAQC,iBAAR,QAAgC,4BAAhC;AACA,SAAQC,uBAAR,QAAsC,sBAAtC;AACA,SAAQC,eAAR,EAAyBC,4BAAzB,QAA4D,oBAA5D;AAKA,eAAe,MAAMC,iBAAN,CAAwB;AAgBrCC,EAAAA,WAAW,CAACC,OAAD,EAAmBC,OAAnB,EAAoC;AAAA;;AAAA,uCAdvB,EAcuB;;AAAA,8CAbgC,EAahC;;AAAA;;AAAA;;AAAA;;AAAA,+DATJ,EASI;;AAAA,kDARM,EAQN;;AAC7C,SAAKD,OAAL,GAAe,EAAC,GAAGA;AAAJ,KAAf;AACA,SAAKE,YAAL,GAAoBF,OAAO,CAACG,SAAR,CAAkBD,YAAtC;AACA,SAAKE,sBAAL,GAA8BJ,OAAO,CAACG,SAAR,CAAkBC,sBAAhD;AACA,SAAKH,OAAL,GAAeA,OAAf;AAEA,SAAKI,wCAAL,CAA8CL,OAA9C;AACD;;AAMgB,QAAXM,WAAW,CAACC,EAAD,EAAa;AAC5B,UAAMC,SAAS,GAAGC,IAAI,CAACC,KAAL,CAAWH,EAAE,GAAG,KAAKL,YAArB,CAAlB;;AACA,QAAI,CAAC,KAAKC,SAAL,CAAeK,SAAf,CAAD,IAA8B,CAAC,KAAKG,gBAAL,CAAsBH,SAAtB,CAAnC,EAAqE;AAAA;;AACnE,YAAMI,WAAW,GAAGhB,eAAe,CAChC,GAAE,KAAKI,OAAL,CAAaa,GAAI,cAAaL,SAAU,EADV,uBAEjC,KAAKP,OAAL,CAAaa,G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B,CAA+B,KAA/B,CAAJ,EAA2C;AACzCV,QAAAA,OAAO,CAACrD,IAAR,CAAa,KAAb;AACD;;AAIDqD,MAAAA,OAAO,CAACrD,IAAR,CAAa,MAAb;AACD;;AAEDqD,IAAAA,OAAO,CAACrD,IAAR,CAAa,KAAb;AACAqD,IAAAA,OAAO,CAACrD,IAAR,CAAa,KAAb;AACA,WAAOqD,OAAP;AACD;;AA7PoC","sourcesContent":["import {load} from '@loaders.gl/core';\nimport {getSupportedGPUTextureFormats, selectSupportedBasisFormat} from '@loaders.gl/textures';\nimport {Tileset, NodePage} from '../../types';\nimport {I3SNodePageLoader} from '../../i3s-node-page-loader';\nimport {normalizeTileNonUrlData} from '../parsers/parse-i3s';\nimport {getUrlWithToken, generateTilesetAttributeUrls} from '../utils/url-utils';\n\n/**\n * class I3SNodePagesTiles - loads nodePages and form i3s tiles from them\n */\nexport default class I3SNodePagesTiles {\n tileset: Tileset;\n nodePages: NodePage[] = [];\n pendingNodePages: {promise: Promise<NodePage>; status: 'Pending' | 'Done'}[] = [];\n nodesPerPage: number;\n options: {[key: string]: any};\n lodSelectionMetricType: any;\n textureDefinitionsSelectedFormats: any[] = [];\n private textureLoaderOptions: {[key: string]: any} = {};\n\n /**\n * @constructs\n * Create a I3SNodePagesTiles instance.\n * @param tileset - i3s tileset header ('layers/0')\n * @param options - i3s loader options\n */\n constructor(tileset: Tileset, options: object) {\n this.tileset = {...tileset}; // spread the tileset to avoid circular reference\n this.nodesPerPage = tileset.nodePages.nodesPerPage;\n this.lodSelectionMetricType = tileset.nodePages.lodSelectionMetricType;\n this.options = options;\n\n this.initSelectedFormatsForTextureDefinitions(tileset);\n }\n\n /**\n * Loads some nodePage and return a particular node from it\n * @param id - id of node through all node pages\n */\n async getNodeById(id: number) {\n const pageIndex = Math.floor(id / this.nodesPerPage);\n if (!this.nodePages[pageIndex] && !this.pendingNodePages[pageIndex]) {\n const nodePageUrl = getUrlWithToken(\n `${this.tileset.url}/nodepages/${pageIndex}`,\n this.options.i3s?.token\n );\n this.pendingNodePages[pageIndex] = {\n status: 'Pending',\n promise: load(nodePageUrl, I3SNodePageLoader, this.options)\n };\n this.nodePages[pageIndex] = await this.pendingNodePages[pageIndex].promise;\n this.pendingNodePages[pageIndex].status = 'Done';\n }\n if (this.pendingNodePages[pageIndex].status === 'Pending') {\n this.nodePages[pageIndex] = await this.pendingNodePages[pageIndex].promise;\n }\n const nodeIndex = id % this.nodesPerPage;\n return this.nodePages[pageIndex].nodes[nodeIndex];\n }\n\n /**\n * Forms tile header using node and tileset data\n * @param id - id of node through all node pages\n */\n // eslint-disable-next-line complexity\n async formTileFromNodePages(id: number) {\n const node = await this.getNodeById(id);\n const children: any[] = [];\n for (const child of node.children || []) {\n const childNode = await this.getNodeById(child);\n children.push({\n id: child,\n obb: childNode.obb\n });\n }\n\n let contentUrl = null;\n let textureUrl: string | null = null;\n let materialDefinition = null;\n let textureFormat = 'jpeg';\n let attributeUrls: string[] = [];\n let isDracoGeometry = false;\n\n if (node && node.mesh) {\n // Get geometry resource URL and type (compressed / non-compressed)\n const {url, isDracoGeometry: isDracoGeometryResult} = (node.mesh.geometry &&\n this.getContentUrl(node.mesh.geometry)) || {url: null, isDracoGeometry: null};\n contentUrl = url;\n isDracoGeometry = isDracoGeometryResult;\n\n const [textureData, nodeMaterialDefinition] = this.getInformationFromMaterial(\n node.mesh.material\n );\n materialDefinition = nodeMaterialDefinition;\n textureFormat = textureData.format || textureFormat;\n if (textureData.name) {\n textureUrl = `${this.tileset.url}/nodes/${node.mesh.material.resource}/textures/${textureData.name}`;\n }\n\n if (this.tileset.attributeStorageInfo) {\n attributeUrls = generateTilesetAttributeUrls(this.tileset, node.mesh.attribute.resource);\n }\n }\n\n const lodSelection = this.getLodSelection(node);\n\n return normalizeTileNonUrlData({\n id,\n lodSelection,\n obb: node.obb,\n contentUrl,\n textureUrl,\n attributeUrls,\n materialDefinition,\n textureFormat,\n textureLoaderOptions: this.textureLoaderOptions,\n children,\n isDracoGeometry\n });\n }\n\n /**\n * Forms url and type of geometry resource by nodepage's data and `geometryDefinitions` in the tileset\n * @param {Object} meshGeometryData - data about the node's mesh from the nodepage\n * @returns {Object} -\n * {string} url - url to the geometry resource\n * {boolean} isDracoGeometry - whether the geometry resource contain DRACO compressed geometry\n */\n private getContentUrl(meshGeometryData) {\n let result = {};\n const geometryDefinition = this.tileset.geometryDefinitions[meshGeometryData.definition];\n let geometryIndex = -1;\n // Try to find DRACO geometryDefinition of `useDracoGeometry` option is set\n if (this.options.i3s && this.options.i3s.useDracoGeometry) {\n geometryIndex = geometryDefinition.geometryBuffers.findIndex(\n (buffer) => buffer.compressedAttributes && buffer.compressedAttributes.encoding === 'draco'\n );\n }\n // If DRACO geometry is not applicable try to select non-compressed geometry\n if (geometryIndex === -1) {\n geometryIndex = geometryDefinition.geometryBuffers.findIndex(\n (buffer) => !buffer.compressedAttributes\n );\n }\n if (geometryIndex !== -1) {\n const isDracoGeometry = Boolean(\n geometryDefinition.geometryBuffers[geometryIndex].compressedAttributes\n );\n result = {\n url: `${this.tileset.url}/nodes/${meshGeometryData.resource}/geometries/${geometryIndex}`,\n isDracoGeometry\n };\n }\n return result;\n }\n\n /**\n * Forms 1.6 compatible LOD selection object from a nodepage's node data\n * @param {Object} node - a node from nodepage\n * @returns {Object[]} - Array of object of following properties:\n * {string} metricType - the label of the LOD metric\n * {number} maxError - the value of the metric\n */\n private getLodSelection(node): object[] {\n const lodSelection: object[] = [];\n if (this.lodSelectionMetricType === 'maxScreenThresholdSQ') {\n lodSelection.push({\n metricType: 'maxScreenThreshold',\n maxError: Math.sqrt(node.lodThreshold / (Math.PI * 0.25))\n });\n }\n lodSelection.push({\n metricType: this.lodSelectionMetricType,\n maxError: node.lodThreshold\n });\n return lodSelection;\n }\n\n /**\n * Returns information about texture and material from `materialDefinitions`\n * @param {Object} material - material data from nodepage\n * @returns {Object[]} - Couple [textureData, materialDefinition]\n * {string} textureData.name - path name of the texture\n * {string} textureData.format - format of the texture\n * materialDefinition - PBR-like material definition from `materialDefinitions`\n */\n private getInformationFromMaterial(material) {\n const textureDataDefault = {name: null, format: null};\n if (material) {\n const materialDefinition = this.tileset.materialDefinitions[material.definition];\n const textureSetDefinitionIndex =\n materialDefinition &&\n materialDefinition.pbrMetallicRoughness &&\n materialDefinition.pbrMetallicRoughness.baseColorTexture &&\n materialDefinition.pbrMetallicRoughness.baseColorTexture.textureSetDefinitionId;\n if (textureSetDefinitionIndex || textureSetDefinitionIndex === 0) {\n const textureData =\n this.textureDefinitionsSelectedFormats[textureSetDefinitionIndex] || textureDataDefault;\n return [textureData, materialDefinition];\n }\n return [textureDataDefault, materialDefinition];\n }\n return [textureDataDefault, null];\n }\n\n /**\n * Sets preferable and supported format for each textureDefinition of the tileset\n * @param {Object} tileset - I3S layer data\n * @returns {void}\n */\n private initSelectedFormatsForTextureDefinitions(tileset) {\n this.textureDefinitionsSelectedFormats = [];\n const possibleI3sFormats = this.getSupportedTextureFormats();\n const textureSetDefinitions = tileset.textureSetDefinitions || [];\n for (const textureSetDefinition of textureSetDefinitions) {\n const formats = (textureSetDefinition && textureSetDefinition.formats) || [];\n let selectedFormat: {format: string; name: string} | null = null;\n for (const i3sFormat of possibleI3sFormats) {\n const format = formats.find((value) => value.format === i3sFormat);\n if (format) {\n selectedFormat = format;\n break;\n }\n }\n // For I3S 1.8 need to define basis target format to decode\n if (selectedFormat && selectedFormat.format === 'ktx2') {\n this.textureLoaderOptions.basis = {\n format: selectSupportedBasisFormat(),\n containerFormat: 'ktx2',\n module: 'encoder'\n };\n }\n\n this.textureDefinitionsSelectedFormats.push(selectedFormat);\n }\n }\n\n /**\n * Returns the array of supported texture format\n * @returns list of format strings\n */\n private getSupportedTextureFormats(): string[] {\n const formats: string[] = [];\n if (!this.options.i3s || this.options.i3s.useCompressedTextures) {\n // I3S 1.7 selection\n const supportedCompressedFormats = getSupportedGPUTextureFormats();\n // List of possible in i3s formats:\n // https://github.com/Esri/i3s-spec/blob/master/docs/1.7/textureSetDefinitionFormat.cmn.md\n if (supportedCompressedFormats.has('etc2')) {\n formats.push('ktx-etc2');\n }\n if (supportedCompressedFormats.has('dxt')) {\n formats.push('dds');\n }\n\n // I3S 1.8 selection\n // ktx2 wraps basis texture which at the edge case can be decoded as uncompressed image\n formats.push('ktx2');\n }\n\n formats.push('jpg');\n formats.push('png');\n return formats;\n }\n}\n"],"file":"i3s-nodepages-tiles.js"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/helpers/i3s-nodepages-tiles.ts"],"names":["load","getSupportedGPUTextureFormats","selectSupportedBasisFormat","I3SNodePageLoader","normalizeTileNonUrlData","getUrlWithToken","generateTilesetAttributeUrls","I3SNodePagesTiles","constructor","tileset","options","nodesPerPage","nodePages","lodSelectionMetricType","initSelectedFormatsForTextureDefinitions","getNodeById","id","pageIndex","Math","floor","pendingNodePages","nodePageUrl","url","i3s","token","status","promise","nodeIndex","nodes","formTileFromNodePages","node","children","child","childNode","push","obb","contentUrl","textureUrl","materialDefinition","textureFormat","attributeUrls","isDracoGeometry","mesh","isDracoGeometryResult","geometry","getContentUrl","textureData","nodeMaterialDefinition","getInformationFromMaterial","material","format","name","resource","attributeStorageInfo","attribute","lodSelection","getLodSelection","textureLoaderOptions","meshGeometryData","result","geometryDefinition","geometryDefinitions","definition","geometryIndex","useDracoGeometry","geometryBuffers","findIndex","buffer","compressedAttributes","encoding","Boolean","metricType","maxError","sqrt","lodThreshold","PI","textureDataDefault","materialDefinitions","textureSetDefinitionIndex","pbrMetallicRoughness","baseColorTexture","textureSetDefinitionId","textureDefinitionsSelectedFormats","possibleI3sFormats","getSupportedTextureFormats","textureSetDefinitions","textureSetDefinition","formats","selectedFormat","i3sFormat","find","value","basis","containerFormat","module","useCompressedTextures","supportedCompressedFormats","has"],"mappings":";AAAA,SAAQA,IAAR,QAAmB,kBAAnB;AACA,SAAQC,6BAAR,EAAuCC,0BAAvC,QAAwE,sBAAxE;AAEA,SAAQC,iBAAR,QAAgC,4BAAhC;AACA,SAAQ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wBN,kBAAxB,EAA4C;AAC1C,cAAMjC,MAAM,GAAGqC,OAAO,CAACG,IAAR,CAAcC,KAAD,IAAWA,KAAK,CAACzC,MAAN,KAAiBuC,SAAzC,CAAf;;AACA,YAAIvC,MAAJ,EAAY;AACVsC,UAAAA,cAAc,GAAGtC,MAAjB;AACA;AACD;AACF;;AAED,UAAIsC,cAAc,IAAIA,cAAc,CAACtC,MAAf,KAA0B,MAAhD,EAAwD;AACtD,aAAKO,oBAAL,CAA0BmC,KAA1B,GAAkC;AAChC1C,UAAAA,MAAM,EAAEhD,0BAA0B,EADF;AAEhC2F,UAAAA,eAAe,EAAE,MAFe;AAGhCC,UAAAA,MAAM,EAAE;AAHwB,SAAlC;AAKD;;AAED,WAAKZ,iCAAL,CAAuChD,IAAvC,CAA4CsD,cAA5C;AACD;AACF;;AAMOJ,EAAAA,0BAA0B,GAAa;AAC7C,UAAMG,OAAiB,GAAG,EAA1B;;AACA,QAAI,CAAC,KAAK7E,OAAL,CAAaa,GAAd,IAAqB,KAAKb,OAAL,CAAaa,GAAb,CAAiBwE,qBAA1C,EAAiE;AAE/D,YAAMC,0BAA0B,GAAG/F,6BAA6B,EAAhE;;AAGA,UAAI+F,0BAA0B,CAACC,GAA3B,CAA+B,MAA/B,CAAJ,EAA4C;AAC1CV,QAAAA,OAAO,CAACrD,IAAR,CAAa,UAAb;AACD;;AACD,UAAI8D,0BAA0B,CAACC,GAA3B,CAA+B,KAA/B,CAAJ,EAA2C;AACzCV,QAAAA,OAAO,CAACrD,IAAR,CAAa,KAAb;AACD;;AAIDqD,MAAAA,OAAO,CAACrD,IAAR,CAAa,MAAb;AACD;;AAEDqD,IAAAA,OAAO,CAACrD,IAAR,CAAa,KAAb;AACAqD,IAAAA,OAAO,CAACrD,IAAR,CAAa,KAAb;AACA,WAAOqD,OAAP;AACD;;AA7PoC","sourcesContent":["import {load} from '@loaders.gl/core';\nimport {getSupportedGPUTextureFormats, selectSupportedBasisFormat} from '@loaders.gl/textures';\nimport {Tileset, NodePage} from '../../types';\nimport {I3SNodePageLoader} from '../../i3s-node-page-loader';\nimport {normalizeTileNonUrlData} from '../parsers/parse-i3s';\nimport {getUrlWithToken, generateTilesetAttributeUrls} from '../utils/url-utils';\n\n/**\n * class I3SNodePagesTiles - loads nodePages and form i3s tiles from them\n */\nexport default class I3SNodePagesTiles {\n tileset: Tileset;\n nodePages: NodePage[] = [];\n pendingNodePages: {promise: Promise<NodePage>; status: 'Pending' | 'Done'}[] = [];\n nodesPerPage: number;\n options: {[key: string]: any};\n lodSelectionMetricType: any;\n textureDefinitionsSelectedFormats: any[] = [];\n private textureLoaderOptions: {[key: string]: any} = {};\n\n /**\n * @constructs\n * Create a I3SNodePagesTiles instance.\n * @param tileset - i3s tileset header ('layers/0')\n * @param options - i3s loader options\n */\n constructor(tileset: Tileset, options: object) {\n this.tileset = {...tileset}; // spread the tileset to avoid circular reference\n this.nodesPerPage = tileset.nodePages.nodesPerPage;\n this.lodSelectionMetricType = tileset.nodePages.lodSelectionMetricType;\n this.options = options;\n\n this.initSelectedFormatsForTextureDefinitions(tileset);\n }\n\n /**\n * Loads some nodePage and return a particular node from it\n * @param id - id of node through all node pages\n */\n async getNodeById(id: number) {\n const pageIndex = Math.floor(id / this.nodesPerPage);\n if (!this.nodePages[pageIndex] && !this.pendingNodePages[pageIndex]) {\n const nodePageUrl = getUrlWithToken(\n `${this.tileset.url}/nodepages/${pageIndex}`,\n this.options.i3s?.token\n );\n this.pendingNodePages[pageIndex] = {\n status: 'Pending',\n promise: load(nodePageUrl, I3SNodePageLoader, this.options)\n };\n this.nodePages[pageIndex] = await this.pendingNodePages[pageIndex].promise;\n this.pendingNodePages[pageIndex].status = 'Done';\n }\n if (this.pendingNodePages[pageIndex].status === 'Pending') {\n this.nodePages[pageIndex] = await this.pendingNodePages[pageIndex].promise;\n }\n const nodeIndex = id % this.nodesPerPage;\n return this.nodePages[pageIndex].nodes[nodeIndex];\n }\n\n /**\n * Forms tile header using node and tileset data\n * @param id - id of node through all node pages\n */\n // eslint-disable-next-line complexity\n async formTileFromNodePages(id: number) {\n const node = await this.getNodeById(id);\n const children: any[] = [];\n for (const child of node.children || []) {\n const childNode = await this.getNodeById(child);\n children.push({\n id: child,\n obb: childNode.obb\n });\n }\n\n let contentUrl = null;\n let textureUrl: string | null = null;\n let materialDefinition = null;\n let textureFormat = 'jpeg';\n let attributeUrls: string[] = [];\n let isDracoGeometry = false;\n\n if (node && node.mesh) {\n // Get geometry resource URL and type (compressed / non-compressed)\n const {url, isDracoGeometry: isDracoGeometryResult} = (node.mesh.geometry &&\n this.getContentUrl(node.mesh.geometry)) || {url: null, isDracoGeometry: null};\n contentUrl = url;\n isDracoGeometry = isDracoGeometryResult;\n\n const [textureData, nodeMaterialDefinition] = this.getInformationFromMaterial(\n node.mesh.material\n );\n materialDefinition = nodeMaterialDefinition;\n textureFormat = textureData.format || textureFormat;\n if (textureData.name) {\n textureUrl = `${this.tileset.url}/nodes/${node.mesh.material.resource}/textures/${textureData.name}`;\n }\n\n if (this.tileset.attributeStorageInfo) {\n attributeUrls = generateTilesetAttributeUrls(this.tileset, node.mesh.attribute.resource);\n }\n }\n\n const lodSelection = this.getLodSelection(node);\n\n return normalizeTileNonUrlData({\n id,\n lodSelection,\n obb: node.obb,\n contentUrl,\n textureUrl,\n attributeUrls,\n materialDefinition,\n textureFormat,\n textureLoaderOptions: this.textureLoaderOptions,\n children,\n isDracoGeometry\n });\n }\n\n /**\n * Forms url and type of geometry resource by nodepage's data and `geometryDefinitions` in the tileset\n * @param {Object} meshGeometryData - data about the node's mesh from the nodepage\n * @returns {Object} -\n * {string} url - url to the geometry resource\n * {boolean} isDracoGeometry - whether the geometry resource contain DRACO compressed geometry\n */\n private getContentUrl(meshGeometryData) {\n let result = {};\n const geometryDefinition = this.tileset.geometryDefinitions[meshGeometryData.definition];\n let geometryIndex = -1;\n // Try to find DRACO geometryDefinition of `useDracoGeometry` option is set\n if (this.options.i3s && this.options.i3s.useDracoGeometry) {\n geometryIndex = geometryDefinition.geometryBuffers.findIndex(\n (buffer) => buffer.compressedAttributes && buffer.compressedAttributes.encoding === 'draco'\n );\n }\n // If DRACO geometry is not applicable try to select non-compressed geometry\n if (geometryIndex === -1) {\n geometryIndex = geometryDefinition.geometryBuffers.findIndex(\n (buffer) => !buffer.compressedAttributes\n );\n }\n if (geometryIndex !== -1) {\n const isDracoGeometry = Boolean(\n geometryDefinition.geometryBuffers[geometryIndex].compressedAttributes\n );\n result = {\n url: `${this.tileset.url}/nodes/${meshGeometryData.resource}/geometries/${geometryIndex}`,\n isDracoGeometry\n };\n }\n return result;\n }\n\n /**\n * Forms 1.6 compatible LOD selection object from a nodepage's node data\n * @param {Object} node - a node from nodepage\n * @returns {Object[]} - Array of object of following properties:\n * {string} metricType - the label of the LOD metric\n * {number} maxError - the value of the metric\n */\n private getLodSelection(node): object[] {\n const lodSelection: object[] = [];\n if (this.lodSelectionMetricType === 'maxScreenThresholdSQ') {\n lodSelection.push({\n metricType: 'maxScreenThreshold',\n maxError: Math.sqrt(node.lodThreshold / (Math.PI * 0.25))\n });\n }\n lodSelection.push({\n metricType: this.lodSelectionMetricType,\n maxError: node.lodThreshold\n });\n return lodSelection;\n }\n\n /**\n * Returns information about texture and material from `materialDefinitions`\n * @param {Object} material - material data from nodepage\n * @returns {Object[]} - Couple [textureData, materialDefinition]\n * {string} textureData.name - path name of the texture\n * {string} textureData.format - format of the texture\n * materialDefinition - PBR-like material definition from `materialDefinitions`\n */\n private getInformationFromMaterial(material) {\n const textureDataDefault = {name: null, format: null};\n if (material) {\n const materialDefinition = this.tileset.materialDefinitions[material.definition];\n const textureSetDefinitionIndex =\n materialDefinition &&\n materialDefinition.pbrMetallicRoughness &&\n materialDefinition.pbrMetallicRoughness.baseColorTexture &&\n materialDefinition.pbrMetallicRoughness.baseColorTexture.textureSetDefinitionId;\n if (textureSetDefinitionIndex || textureSetDefinitionIndex === 0) {\n const textureData =\n this.textureDefinitionsSelectedFormats[textureSetDefinitionIndex] || textureDataDefault;\n return [textureData, materialDefinition];\n }\n return [textureDataDefault, materialDefinition];\n }\n return [textureDataDefault, null];\n }\n\n /**\n * Sets preferable and supported format for each textureDefinition of the tileset\n * @param {Object} tileset - I3S layer data\n * @returns {void}\n */\n private initSelectedFormatsForTextureDefinitions(tileset) {\n this.textureDefinitionsSelectedFormats = [];\n const possibleI3sFormats = this.getSupportedTextureFormats();\n const textureSetDefinitions = tileset.textureSetDefinitions || [];\n for (const textureSetDefinition of textureSetDefinitions) {\n const formats = (textureSetDefinition && textureSetDefinition.formats) || [];\n let selectedFormat: {format: string; name: string} | null = null;\n for (const i3sFormat of possibleI3sFormats) {\n const format = formats.find((value) => value.format === i3sFormat);\n if (format) {\n selectedFormat = format;\n break;\n }\n }\n // For I3S 1.8 need to define basis target format to decode\n if (selectedFormat && selectedFormat.format === 'ktx2') {\n this.textureLoaderOptions.basis = {\n format: selectSupportedBasisFormat(),\n containerFormat: 'ktx2',\n module: 'encoder'\n };\n }\n\n this.textureDefinitionsSelectedFormats.push(selectedFormat);\n }\n }\n\n /**\n * Returns the array of supported texture format\n * @returns list of format strings\n */\n private getSupportedTextureFormats(): string[] {\n const formats: string[] = [];\n if (!this.options.i3s || this.options.i3s.useCompressedTextures) {\n // I3S 1.7 selection\n const supportedCompressedFormats = getSupportedGPUTextureFormats();\n // List of possible in i3s formats:\n // https://github.com/Esri/i3s-spec/blob/master/docs/1.7/textureSetDefinitionFormat.cmn.md\n if (supportedCompressedFormats.has('etc2')) {\n formats.push('ktx-etc2');\n }\n if (supportedCompressedFormats.has('dxt')) {\n formats.push('dds');\n }\n\n // I3S 1.8 selection\n // ktx2 wraps basis texture which at the edge case can be decoded as uncompressed image\n formats.push('ktx2');\n }\n\n formats.push('jpg');\n formats.push('png');\n return formats;\n }\n}\n"],"file":"i3s-nodepages-tiles.js"}
|
|
@@ -1,11 +1,26 @@
|
|
|
1
1
|
import GL from '@luma.gl/constants';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
import { DATA_TYPE } from '../../types';
|
|
3
|
+
export function getConstructorForDataFormat(dataType) {
|
|
4
|
+
switch (dataType) {
|
|
5
|
+
case DATA_TYPE.UInt8:
|
|
6
|
+
return Uint8Array;
|
|
7
|
+
|
|
8
|
+
case DATA_TYPE.UInt16:
|
|
9
|
+
return Uint16Array;
|
|
10
|
+
|
|
11
|
+
case DATA_TYPE.UInt32:
|
|
12
|
+
return Uint32Array;
|
|
13
|
+
|
|
14
|
+
case DATA_TYPE.Float32:
|
|
15
|
+
return Float32Array;
|
|
16
|
+
|
|
17
|
+
case DATA_TYPE.UInt64:
|
|
18
|
+
return Float64Array;
|
|
19
|
+
|
|
20
|
+
default:
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
9
24
|
export const GL_TYPE_MAP = {
|
|
10
25
|
UInt8: GL.UNSIGNED_BYTE,
|
|
11
26
|
UInt16: GL.UNSIGNED_INT,
|
|
@@ -26,18 +41,43 @@ export const I3S_NAMED_GEOMETRY_ATTRIBUTES = {
|
|
|
26
41
|
featureAttributes: 'featureAttributes'
|
|
27
42
|
};
|
|
28
43
|
export const I3S_NAMED_HEADER_ATTRIBUTES = {
|
|
29
|
-
header: 'header',
|
|
30
44
|
vertexCount: 'vertexCount',
|
|
31
45
|
featureCount: 'featureCount'
|
|
32
46
|
};
|
|
33
|
-
export
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
47
|
+
export function sizeOf(dataType) {
|
|
48
|
+
switch (dataType) {
|
|
49
|
+
case DATA_TYPE.UInt8:
|
|
50
|
+
return 1;
|
|
51
|
+
|
|
52
|
+
case DATA_TYPE.UInt16:
|
|
53
|
+
case DATA_TYPE.Int16:
|
|
54
|
+
return 2;
|
|
55
|
+
|
|
56
|
+
case DATA_TYPE.UInt32:
|
|
57
|
+
case DATA_TYPE.Int32:
|
|
58
|
+
case DATA_TYPE.Float32:
|
|
59
|
+
return 4;
|
|
60
|
+
|
|
61
|
+
case DATA_TYPE.UInt64:
|
|
62
|
+
case DATA_TYPE.Int64:
|
|
63
|
+
case DATA_TYPE.Float64:
|
|
64
|
+
return 8;
|
|
65
|
+
|
|
66
|
+
default:
|
|
67
|
+
return NaN;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
40
70
|
export const STRING_ATTRIBUTE_TYPE = 'String';
|
|
41
71
|
export const OBJECT_ID_ATTRIBUTE_TYPE = 'Oid32';
|
|
42
72
|
export const FLOAT_64_TYPE = 'Float64';
|
|
73
|
+
export const INT_16_ATTRIBUTE_TYPE = 'Int16';
|
|
74
|
+
export let COORDINATE_SYSTEM;
|
|
75
|
+
|
|
76
|
+
(function (COORDINATE_SYSTEM) {
|
|
77
|
+
COORDINATE_SYSTEM[COORDINATE_SYSTEM["DEFAULT"] = -1] = "DEFAULT";
|
|
78
|
+
COORDINATE_SYSTEM[COORDINATE_SYSTEM["LNGLAT"] = 1] = "LNGLAT";
|
|
79
|
+
COORDINATE_SYSTEM[COORDINATE_SYSTEM["METER_OFFSETS"] = 2] = "METER_OFFSETS";
|
|
80
|
+
COORDINATE_SYSTEM[COORDINATE_SYSTEM["LNGLAT_OFFSETS"] = 3] = "LNGLAT_OFFSETS";
|
|
81
|
+
COORDINATE_SYSTEM[COORDINATE_SYSTEM["CARTESIAN"] = 0] = "CARTESIAN";
|
|
82
|
+
})(COORDINATE_SYSTEM || (COORDINATE_SYSTEM = {}));
|
|
43
83
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/parsers/constants.ts"],"names":["GL","
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/parsers/constants.ts"],"names":["GL","DATA_TYPE","getConstructorForDataFormat","dataType","UInt8","Uint8Array","UInt16","Uint16Array","UInt32","Uint32Array","Float32","Float32Array","UInt64","Float64Array","GL_TYPE_MAP","UNSIGNED_BYTE","UNSIGNED_INT","FLOAT","DOUBLE","I3S_NAMED_VERTEX_ATTRIBUTES","position","normal","uv0","color","region","I3S_NAMED_GEOMETRY_ATTRIBUTES","vertexAttributes","featureAttributeOrder","featureAttributes","I3S_NAMED_HEADER_ATTRIBUTES","vertexCount","featureCount","sizeOf","Int16","Int32","Int64","Float64","NaN","STRING_ATTRIBUTE_TYPE","OBJECT_ID_ATTRIBUTE_TYPE","FLOAT_64_TYPE","INT_16_ATTRIBUTE_TYPE","COORDINATE_SYSTEM"],"mappings":"AAAA,OAAOA,EAAP,MAAe,oBAAf;AACA,SAAQC,SAAR,QAAwB,aAAxB;AAEA,OAAO,SAASC,2BAAT,CAAqCC,QAArC,EAAuD;AAC5D,UAAQA,QAAR;AACE,SAAKF,SAAS,CAACG,KAAf;AACE,aAAOC,UAAP;;AACF,SAAKJ,SAAS,CAACK,MAAf;AACE,aAAOC,WAAP;;AACF,SAAKN,SAAS,CAACO,MAAf;AACE,aAAOC,WAAP;;AACF,SAAKR,SAAS,CAACS,OAAf;AACE,aAAOC,YAAP;;AACF,SAAKV,SAAS,CAACW,MAAf;AACE,aAAOC,YAAP;;AACF;AACE,aAAO,IAAP;AAZJ;AAcD;AAED,OAAO,MAAMC,WAAoC,GAAG;AAClDV,EAAAA,KAAK,EAAEJ,EAAE,CAACe,aADwC;AAElDT,EAAAA,MAAM,EAAEN,EAAE,CAACgB,YAFuC;AAGlDN,EAAAA,OAAO,EAAEV,EAAE,CAACiB,KAHsC;AAIlDT,EAAAA,MAAM,EAAER,EAAE,CAACgB,YAJuC;AAKlDJ,EAAAA,MAAM,EAAEZ,EAAE,CAACkB;AALuC,CAA7C;AAQP,OAAO,MAAMC,2BAA2B,GAAG;AACzCC,EAAAA,QAAQ,EAAE,UAD+B;AAEzCC,EAAAA,MAAM,EAAE,QAFiC;AAGzCC,EAAAA,GAAG,EAAE,KAHoC;AAIzCC,EAAAA,KAAK,EAAE,OAJkC;AAKzCC,EAAAA,MAAM,EAAE;AALiC,CAApC;AAQP,OAAO,MAAMC,6BAA6B,GAAG;AAC3CC,EAAAA,gBAAgB,EAAE,kBADyB;AAE3CC,EAAAA,qBAAqB,EAAE,uBAFoB;AAG3CC,EAAAA,iBAAiB,EAAE;AAHwB,CAAtC;AAMP,OAAO,MAAMC,2BAA2B,GAAG;AAEzCC,EAAAA,WAAW,EAAE,aAF4B;AAGzCC,EAAAA,YAAY,EAAE;AAH2B,CAApC;AAUP,OAAO,SAASC,MAAT,CAAgB7B,QAAhB,EAA0C;AAC/C,UAAQA,QAAR;AACE,SAAKF,SAAS,CAACG,KAAf;AACE,aAAO,CAAP;;AACF,SAAKH,SAAS,CAACK,MAAf;AACA,SAAKL,SAAS,CAACgC,KAAf;AACE,aAAO,CAAP;;AACF,SAAKhC,SAAS,CAACO,MAAf;AACA,SAAKP,SAAS,CAACiC,KAAf;AACA,SAAKjC,SAAS,CAACS,OAAf;AACE,aAAO,CAAP;;AACF,SAAKT,SAAS,CAACW,MAAf;AACA,SAAKX,SAAS,CAACkC,KAAf;AACA,SAAKlC,SAAS,CAACmC,OAAf;AACE,aAAO,CAAP;;AACF;AACE,aAAOC,GAAP;AAfJ;AAiBD;AAED,OAAO,MAAMC,qBAAqB,GAAG,QAA9B;AACP,OAAO,MAAMC,wBAAwB,GAAG,OAAjC;AACP,OAAO,MAAMC,aAAa,GAAG,SAAtB;AACP,OAAO,MAAMC,qBAAqB,GAAG,OAA9B;AAIP,WAAYC,iBAAZ;;WAAYA,iB;AAAAA,EAAAA,iB,CAAAA,iB;AAAAA,EAAAA,iB,CAAAA,iB;AAAAA,EAAAA,iB,CAAAA,iB;AAAAA,EAAAA,iB,CAAAA,iB;AAAAA,EAAAA,iB,CAAAA,iB;GAAAA,iB,KAAAA,iB","sourcesContent":["import GL from '@luma.gl/constants';\nimport {DATA_TYPE} from '../../types';\n\nexport function getConstructorForDataFormat(dataType: string) {\n switch (dataType) {\n case DATA_TYPE.UInt8:\n return Uint8Array;\n case DATA_TYPE.UInt16:\n return Uint16Array;\n case DATA_TYPE.UInt32:\n return Uint32Array;\n case DATA_TYPE.Float32:\n return Float32Array;\n case DATA_TYPE.UInt64:\n return Float64Array;\n default:\n return null;\n }\n}\n\nexport const GL_TYPE_MAP: {[key: string]: number} = {\n UInt8: GL.UNSIGNED_BYTE,\n UInt16: GL.UNSIGNED_INT,\n Float32: GL.FLOAT,\n UInt32: GL.UNSIGNED_INT,\n UInt64: GL.DOUBLE\n};\n\nexport const I3S_NAMED_VERTEX_ATTRIBUTES = {\n position: 'position',\n normal: 'normal',\n uv0: 'uv0',\n color: 'color',\n region: 'region'\n};\n\nexport const I3S_NAMED_GEOMETRY_ATTRIBUTES = {\n vertexAttributes: 'vertexAttributes',\n featureAttributeOrder: 'featureAttributeOrder',\n featureAttributes: 'featureAttributes'\n};\n// TODO Remove Named Attributes and replase with Typescipt types\nexport const I3S_NAMED_HEADER_ATTRIBUTES = {\n // header: 'header',\n vertexCount: 'vertexCount',\n featureCount: 'featureCount'\n};\n/**\n * Returns how many bytes a type occupies\n * @param dataType\n * @returns\n */\nexport function sizeOf(dataType: string): number {\n switch (dataType) {\n case DATA_TYPE.UInt8:\n return 1;\n case DATA_TYPE.UInt16:\n case DATA_TYPE.Int16:\n return 2;\n case DATA_TYPE.UInt32:\n case DATA_TYPE.Int32:\n case DATA_TYPE.Float32:\n return 4;\n case DATA_TYPE.UInt64:\n case DATA_TYPE.Int64:\n case DATA_TYPE.Float64:\n return 8;\n default:\n return NaN;\n }\n}\n\nexport const STRING_ATTRIBUTE_TYPE = 'String';\nexport const OBJECT_ID_ATTRIBUTE_TYPE = 'Oid32';\nexport const FLOAT_64_TYPE = 'Float64';\nexport const INT_16_ATTRIBUTE_TYPE = 'Int16';\n\n// https://github.com/visgl/deck.gl/blob/9548f43cba2234a1f4877b6b17f6c88eb35b2e08/modules/core/src/lib/constants.js#L27\n// Describes the format of positions\nexport enum COORDINATE_SYSTEM {\n /**\n * `LNGLAT` if rendering into a geospatial viewport, `CARTESIAN` otherwise\n */\n DEFAULT = -1,\n /**\n * Positions are interpreted as [lng, lat, elevation]\n * lng lat are degrees, elevation is meters. distances as meters.\n */\n LNGLAT = 1,\n /**\n * Positions are interpreted as meter offsets, distances as meters\n */\n METER_OFFSETS = 2,\n /**\n * Positions are interpreted as lng lat offsets: [deltaLng, deltaLat, elevation]\n * deltaLng, deltaLat are delta degrees, elevation is meters.\n * distances as meters.\n */\n LNGLAT_OFFSETS = 3,\n /**\n * Non-geospatial\n */\n CARTESIAN = 0\n}\n"],"file":"constants.js"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { STRING_ATTRIBUTE_TYPE, OBJECT_ID_ATTRIBUTE_TYPE, FLOAT_64_TYPE } from './constants';
|
|
1
|
+
import { STRING_ATTRIBUTE_TYPE, OBJECT_ID_ATTRIBUTE_TYPE, FLOAT_64_TYPE, INT_16_ATTRIBUTE_TYPE } from './constants';
|
|
2
2
|
export async function parseI3STileAttribute(arrayBuffer, options) {
|
|
3
3
|
const {
|
|
4
4
|
attributeName,
|
|
@@ -25,6 +25,9 @@ function parseAttribute(attributeType, arrayBuffer) {
|
|
|
25
25
|
case FLOAT_64_TYPE:
|
|
26
26
|
return parseFloatAttribute(arrayBuffer);
|
|
27
27
|
|
|
28
|
+
case INT_16_ATTRIBUTE_TYPE:
|
|
29
|
+
return parseInt16ShortNumberAttribute(arrayBuffer);
|
|
30
|
+
|
|
28
31
|
default:
|
|
29
32
|
return parseShortNumberAttribute(arrayBuffer);
|
|
30
33
|
}
|
|
@@ -35,6 +38,11 @@ function parseShortNumberAttribute(arrayBuffer) {
|
|
|
35
38
|
return new Uint32Array(arrayBuffer, countOffset);
|
|
36
39
|
}
|
|
37
40
|
|
|
41
|
+
function parseInt16ShortNumberAttribute(arrayBuffer) {
|
|
42
|
+
const countOffset = 4;
|
|
43
|
+
return new Int16Array(arrayBuffer, countOffset);
|
|
44
|
+
}
|
|
45
|
+
|
|
38
46
|
function parseFloatAttribute(arrayBuffer) {
|
|
39
47
|
const countOffset = 8;
|
|
40
48
|
return new Float64Array(arrayBuffer, countOffset);
|