@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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/i3s",
|
|
3
|
-
"version": "3.1.0-
|
|
3
|
+
"version": "3.1.0-beta.5",
|
|
4
4
|
"description": "i3s .",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"tile",
|
|
18
18
|
"mesh"
|
|
19
19
|
],
|
|
20
|
-
"types": "
|
|
20
|
+
"types": "dist/index.d.ts",
|
|
21
21
|
"main": "dist/es5/index.js",
|
|
22
22
|
"module": "dist/esm/index.js",
|
|
23
23
|
"sideEffects": false,
|
|
@@ -28,22 +28,24 @@
|
|
|
28
28
|
],
|
|
29
29
|
"scripts": {
|
|
30
30
|
"pre-build": "npm run build-bundle && npm run build-worker",
|
|
31
|
-
"build-bundle": "
|
|
32
|
-
"build-worker": "
|
|
31
|
+
"build-bundle": "esbuild src/bundle.ts --bundle --outfile=dist/bundle.js",
|
|
32
|
+
"build-worker": "esbuild src/workers/i3s-content-worker.ts --bundle --outfile=dist/i3s-content-worker.js"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@loaders.gl/
|
|
36
|
-
"@loaders.gl/
|
|
37
|
-
"@loaders.gl/
|
|
38
|
-
"@loaders.gl/
|
|
39
|
-
"@loaders.gl/
|
|
40
|
-
"@loaders.gl/
|
|
41
|
-
"@loaders.gl/tiles": "3.1.0-alpha.4",
|
|
35
|
+
"@loaders.gl/draco": "3.1.0-beta.5",
|
|
36
|
+
"@loaders.gl/images": "3.1.0-beta.5",
|
|
37
|
+
"@loaders.gl/loader-utils": "3.1.0-beta.5",
|
|
38
|
+
"@loaders.gl/schema": "3.1.0-beta.5",
|
|
39
|
+
"@loaders.gl/textures": "3.1.0-beta.5",
|
|
40
|
+
"@loaders.gl/tiles": "3.1.0-beta.5",
|
|
42
41
|
"@luma.gl/constants": "^8.5.4",
|
|
43
42
|
"@math.gl/core": "^3.5.1",
|
|
44
43
|
"@math.gl/culling": "^3.5.1",
|
|
45
44
|
"@math.gl/geospatial": "^3.5.1",
|
|
46
45
|
"probe.gl": "^3.4.0"
|
|
47
46
|
},
|
|
48
|
-
"
|
|
47
|
+
"peerDependencies": {
|
|
48
|
+
"@loaders.gl/core": "3.1.0-beta.1"
|
|
49
|
+
},
|
|
50
|
+
"gitHead": "5d66468457cc878d2dbff3d7807d737ceb181c9a"
|
|
49
51
|
}
|
|
@@ -37,7 +37,7 @@ async function parse(data, options) {
|
|
|
37
37
|
*/
|
|
38
38
|
// eslint-disable-next-line complexity
|
|
39
39
|
export async function loadFeatureAttributes(tile, featureId, options = {}) {
|
|
40
|
-
const {attributeStorageInfo, attributeUrls} = getAttributesData(tile);
|
|
40
|
+
const {attributeStorageInfo, attributeUrls, tilesetFields} = getAttributesData(tile);
|
|
41
41
|
|
|
42
42
|
if (!attributeStorageInfo || !attributeUrls || !featureId) {
|
|
43
43
|
return null;
|
|
@@ -66,15 +66,20 @@ export async function loadFeatureAttributes(tile, featureId, options = {}) {
|
|
|
66
66
|
return null;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
return generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId);
|
|
69
|
+
return generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
/**
|
|
73
|
+
* Gets attributes data from tile.
|
|
74
|
+
* @param tile
|
|
75
|
+
* @returns
|
|
76
|
+
*/
|
|
72
77
|
function getAttributesData(tile) {
|
|
73
|
-
const attributeStorageInfo =
|
|
74
|
-
|
|
75
|
-
const
|
|
78
|
+
const attributeStorageInfo = tile.tileset?.tileset?.attributeStorageInfo;
|
|
79
|
+
const attributeUrls = tile.header?.attributeUrls;
|
|
80
|
+
const tilesetFields = tile.tileset?.tileset?.fields || [];
|
|
76
81
|
|
|
77
|
-
return {attributeStorageInfo, attributeUrls};
|
|
82
|
+
return {attributeStorageInfo, attributeUrls, tilesetFields};
|
|
78
83
|
}
|
|
79
84
|
|
|
80
85
|
/**
|
|
@@ -91,6 +96,17 @@ function getAttributeValueType(attribute) {
|
|
|
91
96
|
return '';
|
|
92
97
|
}
|
|
93
98
|
|
|
99
|
+
/**
|
|
100
|
+
* Find in attributeStorageInfo attribute name responsible for feature ids list.
|
|
101
|
+
* @param attributeStorageInfo
|
|
102
|
+
* @returns Feature ids attribute name
|
|
103
|
+
*/
|
|
104
|
+
function getFeatureIdsAttributeName(attributeStorageInfo) {
|
|
105
|
+
const objectIdsAttribute = attributeStorageInfo.find(attribute => attribute.name.includes('OBJECTID'));
|
|
106
|
+
|
|
107
|
+
return objectIdsAttribute?.name;
|
|
108
|
+
}
|
|
109
|
+
|
|
94
110
|
/**
|
|
95
111
|
* Generates mapping featureId to feature attributes
|
|
96
112
|
* @param {Array} attributes
|
|
@@ -98,20 +114,21 @@ function getAttributeValueType(attribute) {
|
|
|
98
114
|
* @param {number} featureId
|
|
99
115
|
* @returns {Object}
|
|
100
116
|
*/
|
|
101
|
-
function generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId) {
|
|
102
|
-
const
|
|
117
|
+
function generateAttributesByFeatureId(attributes, attributeStorageInfo, featureId, tilesetFields) {
|
|
118
|
+
const objectIdsAttributeName = getFeatureIdsAttributeName(attributeStorageInfo);
|
|
119
|
+
const objectIds = attributes.find((attribute) => attribute.value[objectIdsAttributeName]);
|
|
103
120
|
|
|
104
121
|
if (!objectIds) {
|
|
105
122
|
return null;
|
|
106
123
|
}
|
|
107
124
|
|
|
108
|
-
const attributeIndex = objectIds.value.
|
|
125
|
+
const attributeIndex = objectIds.value[objectIdsAttributeName].indexOf(featureId);
|
|
109
126
|
|
|
110
127
|
if (attributeIndex < 0) {
|
|
111
128
|
return null;
|
|
112
129
|
}
|
|
113
130
|
|
|
114
|
-
return getFeatureAttributesByIndex(attributes, attributeIndex, attributeStorageInfo);
|
|
131
|
+
return getFeatureAttributesByIndex(attributes, attributeIndex, attributeStorageInfo, tilesetFields);
|
|
115
132
|
}
|
|
116
133
|
|
|
117
134
|
/**
|
|
@@ -121,18 +138,31 @@ function generateAttributesByFeatureId(attributes, attributeStorageInfo, feature
|
|
|
121
138
|
* @param {Object} attributeStorageInfo
|
|
122
139
|
* @returns {Object}
|
|
123
140
|
*/
|
|
124
|
-
function getFeatureAttributesByIndex(attributes, featureIdIndex, attributeStorageInfo) {
|
|
141
|
+
function getFeatureAttributesByIndex(attributes, featureIdIndex, attributeStorageInfo, tilesetFields) {
|
|
125
142
|
const attributesObject = {};
|
|
126
143
|
|
|
127
144
|
for (let index = 0; index < attributeStorageInfo.length; index++) {
|
|
128
145
|
const attributeName = attributeStorageInfo[index].name;
|
|
146
|
+
const codedValues = getAttributeCodedValues(attributeName, tilesetFields);
|
|
129
147
|
const attribute = getAttributeByIndexAndAttributeName(attributes, index, attributeName);
|
|
130
|
-
attributesObject[attributeName] = formatAttributeValue(attribute, featureIdIndex);
|
|
148
|
+
attributesObject[attributeName] = formatAttributeValue(attribute, featureIdIndex, codedValues);
|
|
131
149
|
}
|
|
132
150
|
|
|
133
151
|
return attributesObject;
|
|
134
152
|
}
|
|
135
153
|
|
|
154
|
+
/**
|
|
155
|
+
* Get coded values list from tileset.
|
|
156
|
+
* @param attributeName
|
|
157
|
+
* @param tilesetFields
|
|
158
|
+
*/
|
|
159
|
+
function getAttributeCodedValues(attributeName, tilesetFields) {
|
|
160
|
+
const attributeField = tilesetFields
|
|
161
|
+
.find(field => field.name === attributeName || field.alias === attributeName);
|
|
162
|
+
|
|
163
|
+
return attributeField?.domain?.codedValues || [];
|
|
164
|
+
}
|
|
165
|
+
|
|
136
166
|
/**
|
|
137
167
|
* Return attribute value if it presents in atrributes list
|
|
138
168
|
* @param {array} attributes
|
|
@@ -155,12 +185,19 @@ function getAttributeByIndexAndAttributeName(attributes, index, attributesName)
|
|
|
155
185
|
* @param {Number} featureIdIndex
|
|
156
186
|
* @returns {String}
|
|
157
187
|
*/
|
|
158
|
-
function formatAttributeValue(attribute, featureIdIndex) {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
188
|
+
function formatAttributeValue(attribute, featureIdIndex, codedValues) {
|
|
189
|
+
let value = EMPTY_VALUE;
|
|
190
|
+
|
|
191
|
+
if (attribute && (featureIdIndex in attribute)) {
|
|
162
192
|
// eslint-disable-next-line no-control-regex
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
193
|
+
value = String(attribute[featureIdIndex]).replace(/\u0000|NaN/g, '').trim();
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// Check if coded values are existed. If so we use them.
|
|
197
|
+
if (codedValues.length) {
|
|
198
|
+
const codeValue = codedValues.find(codedValue => codedValue.code === Number(value));
|
|
199
|
+
value = codeValue?.name || EMPTY_VALUE;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
return value;
|
|
166
203
|
}
|
package/src/i3s-loader.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type {LoaderWithParser} from '@loaders.gl/loader-utils';
|
|
|
2
2
|
import {load, parse} from '@loaders.gl/core';
|
|
3
3
|
import {I3SContentLoader} from './i3s-content-loader';
|
|
4
4
|
import {normalizeTileData, normalizeTilesetData} from './lib/parsers/parse-i3s';
|
|
5
|
+
import {COORDINATE_SYSTEM} from './lib/parsers/constants';
|
|
5
6
|
|
|
6
7
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
7
8
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
@@ -31,7 +32,9 @@ export const I3SLoader: LoaderWithParser = {
|
|
|
31
32
|
tile: null,
|
|
32
33
|
tileset: null,
|
|
33
34
|
useDracoGeometry: true,
|
|
34
|
-
useCompressedTextures: true
|
|
35
|
+
useCompressedTextures: true,
|
|
36
|
+
decodeTextures: true,
|
|
37
|
+
coordinateSystem: COORDINATE_SYSTEM.METER_OFFSETS
|
|
35
38
|
}
|
|
36
39
|
}
|
|
37
40
|
};
|
package/src/index.ts
CHANGED
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
import GL from '@luma.gl/constants';
|
|
2
|
+
import {DATA_TYPE} from '../../types';
|
|
2
3
|
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
export function getConstructorForDataFormat(dataType: string) {
|
|
5
|
+
switch (dataType) {
|
|
6
|
+
case DATA_TYPE.UInt8:
|
|
7
|
+
return Uint8Array;
|
|
8
|
+
case DATA_TYPE.UInt16:
|
|
9
|
+
return Uint16Array;
|
|
10
|
+
case DATA_TYPE.UInt32:
|
|
11
|
+
return Uint32Array;
|
|
12
|
+
case DATA_TYPE.Float32:
|
|
13
|
+
return Float32Array;
|
|
14
|
+
case DATA_TYPE.UInt64:
|
|
15
|
+
return Float64Array;
|
|
16
|
+
default:
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
10
20
|
|
|
11
|
-
export const GL_TYPE_MAP = {
|
|
21
|
+
export const GL_TYPE_MAP: {[key: string]: number} = {
|
|
12
22
|
UInt8: GL.UNSIGNED_BYTE,
|
|
13
23
|
UInt16: GL.UNSIGNED_INT,
|
|
14
24
|
Float32: GL.FLOAT,
|
|
@@ -29,21 +39,66 @@ export const I3S_NAMED_GEOMETRY_ATTRIBUTES = {
|
|
|
29
39
|
featureAttributeOrder: 'featureAttributeOrder',
|
|
30
40
|
featureAttributes: 'featureAttributes'
|
|
31
41
|
};
|
|
32
|
-
|
|
42
|
+
// TODO Remove Named Attributes and replase with Typescipt types
|
|
33
43
|
export const I3S_NAMED_HEADER_ATTRIBUTES = {
|
|
34
|
-
header: 'header',
|
|
44
|
+
// header: 'header',
|
|
35
45
|
vertexCount: 'vertexCount',
|
|
36
46
|
featureCount: 'featureCount'
|
|
37
47
|
};
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
48
|
+
/**
|
|
49
|
+
* Returns how many bytes a type occupies
|
|
50
|
+
* @param dataType
|
|
51
|
+
* @returns
|
|
52
|
+
*/
|
|
53
|
+
export function sizeOf(dataType: string): number {
|
|
54
|
+
switch (dataType) {
|
|
55
|
+
case DATA_TYPE.UInt8:
|
|
56
|
+
return 1;
|
|
57
|
+
case DATA_TYPE.UInt16:
|
|
58
|
+
case DATA_TYPE.Int16:
|
|
59
|
+
return 2;
|
|
60
|
+
case DATA_TYPE.UInt32:
|
|
61
|
+
case DATA_TYPE.Int32:
|
|
62
|
+
case DATA_TYPE.Float32:
|
|
63
|
+
return 4;
|
|
64
|
+
case DATA_TYPE.UInt64:
|
|
65
|
+
case DATA_TYPE.Int64:
|
|
66
|
+
case DATA_TYPE.Float64:
|
|
67
|
+
return 8;
|
|
68
|
+
default:
|
|
69
|
+
return NaN;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
46
72
|
|
|
47
73
|
export const STRING_ATTRIBUTE_TYPE = 'String';
|
|
48
74
|
export const OBJECT_ID_ATTRIBUTE_TYPE = 'Oid32';
|
|
49
75
|
export const FLOAT_64_TYPE = 'Float64';
|
|
76
|
+
export const INT_16_ATTRIBUTE_TYPE = 'Int16';
|
|
77
|
+
|
|
78
|
+
// https://github.com/visgl/deck.gl/blob/9548f43cba2234a1f4877b6b17f6c88eb35b2e08/modules/core/src/lib/constants.js#L27
|
|
79
|
+
// Describes the format of positions
|
|
80
|
+
export enum COORDINATE_SYSTEM {
|
|
81
|
+
/**
|
|
82
|
+
* `LNGLAT` if rendering into a geospatial viewport, `CARTESIAN` otherwise
|
|
83
|
+
*/
|
|
84
|
+
DEFAULT = -1,
|
|
85
|
+
/**
|
|
86
|
+
* Positions are interpreted as [lng, lat, elevation]
|
|
87
|
+
* lng lat are degrees, elevation is meters. distances as meters.
|
|
88
|
+
*/
|
|
89
|
+
LNGLAT = 1,
|
|
90
|
+
/**
|
|
91
|
+
* Positions are interpreted as meter offsets, distances as meters
|
|
92
|
+
*/
|
|
93
|
+
METER_OFFSETS = 2,
|
|
94
|
+
/**
|
|
95
|
+
* Positions are interpreted as lng lat offsets: [deltaLng, deltaLat, elevation]
|
|
96
|
+
* deltaLng, deltaLat are delta degrees, elevation is meters.
|
|
97
|
+
* distances as meters.
|
|
98
|
+
*/
|
|
99
|
+
LNGLAT_OFFSETS = 3,
|
|
100
|
+
/**
|
|
101
|
+
* Non-geospatial
|
|
102
|
+
*/
|
|
103
|
+
CARTESIAN = 0
|
|
104
|
+
}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
STRING_ATTRIBUTE_TYPE,
|
|
3
|
+
OBJECT_ID_ATTRIBUTE_TYPE,
|
|
4
|
+
FLOAT_64_TYPE,
|
|
5
|
+
INT_16_ATTRIBUTE_TYPE
|
|
6
|
+
} from './constants';
|
|
2
7
|
|
|
3
8
|
/**
|
|
4
9
|
* Get particular tile and creates attribute object inside.
|
|
@@ -31,6 +36,8 @@ function parseAttribute(attributeType, arrayBuffer) {
|
|
|
31
36
|
return parseShortNumberAttribute(arrayBuffer);
|
|
32
37
|
case FLOAT_64_TYPE:
|
|
33
38
|
return parseFloatAttribute(arrayBuffer);
|
|
39
|
+
case INT_16_ATTRIBUTE_TYPE:
|
|
40
|
+
return parseInt16ShortNumberAttribute(arrayBuffer);
|
|
34
41
|
default:
|
|
35
42
|
return parseShortNumberAttribute(arrayBuffer);
|
|
36
43
|
}
|
|
@@ -47,6 +54,17 @@ function parseShortNumberAttribute(arrayBuffer) {
|
|
|
47
54
|
return new Uint32Array(arrayBuffer, countOffset);
|
|
48
55
|
}
|
|
49
56
|
|
|
57
|
+
/**
|
|
58
|
+
* Parse Int16 short number attribute.
|
|
59
|
+
* Parsing of such data is not documented. Added to handle Building Scene Layer Tileset attributes data.
|
|
60
|
+
* @param {ArrayBuffer} arrayBuffer
|
|
61
|
+
* @returns {Int16Array}
|
|
62
|
+
*/
|
|
63
|
+
function parseInt16ShortNumberAttribute(arrayBuffer) {
|
|
64
|
+
const countOffset = 4;
|
|
65
|
+
return new Int16Array(arrayBuffer, countOffset);
|
|
66
|
+
}
|
|
67
|
+
|
|
50
68
|
/**
|
|
51
69
|
* Parse float attribute.
|
|
52
70
|
* Double Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.7/attributeStorageInfo.cmn.md
|
|
@@ -34,7 +34,7 @@ function parseSublayersTree(
|
|
|
34
34
|
|
|
35
35
|
for (let index = 0; index < sublayers.length; index++) {
|
|
36
36
|
const subLayer = sublayers[index];
|
|
37
|
-
const {id, layerType, ...rest} = subLayer;
|
|
37
|
+
const {id, layerType, visibility = true, ...rest} = subLayer;
|
|
38
38
|
|
|
39
39
|
// Add support only for 3DObject layer type for I3S purposes.
|
|
40
40
|
if (layerType === OBJECT_3D_LAYER_TYPE) {
|
|
@@ -44,6 +44,7 @@ function parseSublayersTree(
|
|
|
44
44
|
url: sublayerUrl,
|
|
45
45
|
id,
|
|
46
46
|
layerType,
|
|
47
|
+
visibility,
|
|
47
48
|
...rest
|
|
48
49
|
});
|
|
49
50
|
}
|