@loaders.gl/i3s 4.0.0-alpha.6 → 4.0.0-alpha.8

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.
Files changed (105) hide show
  1. package/dist/dist.min.js +764 -133
  2. package/dist/es5/arcgis-webscene-loader.js +1 -1
  3. package/dist/es5/i3s-attribute-loader.js +1 -1
  4. package/dist/es5/i3s-building-scene-layer-loader.js +1 -1
  5. package/dist/es5/i3s-content-loader.js +2 -3
  6. package/dist/es5/i3s-content-loader.js.map +1 -1
  7. package/dist/es5/i3s-loader.js +1 -1
  8. package/dist/es5/i3s-node-page-loader.js +1 -1
  9. package/dist/es5/i3s-slpk-loader.js +20 -0
  10. package/dist/es5/i3s-slpk-loader.js.map +1 -0
  11. package/dist/es5/index.js +8 -1
  12. package/dist/es5/index.js.map +1 -1
  13. package/dist/es5/lib/parsers/parse-i3s-tile-content.js +2 -2
  14. package/dist/es5/lib/parsers/parse-i3s-tile-content.js.map +1 -1
  15. package/dist/es5/lib/parsers/parse-slpk/parse-slpk.js +94 -0
  16. package/dist/es5/lib/parsers/parse-slpk/parse-slpk.js.map +1 -0
  17. package/dist/es5/lib/parsers/parse-slpk/slpk-archieve.js +229 -0
  18. package/dist/es5/lib/parsers/parse-slpk/slpk-archieve.js.map +1 -0
  19. package/dist/es5/lib/parsers/parse-zip/cd-file-header.js +44 -0
  20. package/dist/es5/lib/parsers/parse-zip/cd-file-header.js.map +1 -0
  21. package/dist/es5/lib/parsers/parse-zip/local-file-header.js +26 -0
  22. package/dist/es5/lib/parsers/parse-zip/local-file-header.js.map +1 -0
  23. package/dist/es5/lib/utils/{customizeColors.js → customize-/321/201olors.js} +65 -40
  24. package/dist/es5/lib/utils/customize-/321/201olors.js.map +1 -0
  25. package/dist/es5/types.js.map +1 -1
  26. package/dist/es5/workers/{i3s-content-nodejs-worker.js → i3s-content-worker-node.js} +2 -2
  27. package/dist/es5/workers/i3s-content-worker-node.js.map +1 -0
  28. package/dist/esm/arcgis-webscene-loader.js +1 -1
  29. package/dist/esm/i3s-attribute-loader.js +1 -1
  30. package/dist/esm/i3s-building-scene-layer-loader.js +1 -1
  31. package/dist/esm/i3s-content-loader.js +2 -3
  32. package/dist/esm/i3s-content-loader.js.map +1 -1
  33. package/dist/esm/i3s-loader.js +1 -1
  34. package/dist/esm/i3s-node-page-loader.js +1 -1
  35. package/dist/esm/i3s-slpk-loader.js +13 -0
  36. package/dist/esm/i3s-slpk-loader.js.map +1 -0
  37. package/dist/esm/index.js +2 -1
  38. package/dist/esm/index.js.map +1 -1
  39. package/dist/esm/lib/parsers/parse-i3s-tile-content.js +1 -1
  40. package/dist/esm/lib/parsers/parse-i3s-tile-content.js.map +1 -1
  41. package/dist/esm/lib/parsers/parse-slpk/parse-slpk.js +37 -0
  42. package/dist/esm/lib/parsers/parse-slpk/parse-slpk.js.map +1 -0
  43. package/dist/esm/lib/parsers/parse-slpk/slpk-archieve.js +108 -0
  44. package/dist/esm/lib/parsers/parse-slpk/slpk-archieve.js.map +1 -0
  45. package/dist/esm/lib/parsers/parse-zip/cd-file-header.js +37 -0
  46. package/dist/esm/lib/parsers/parse-zip/cd-file-header.js.map +1 -0
  47. package/dist/esm/lib/parsers/parse-zip/local-file-header.js +19 -0
  48. package/dist/esm/lib/parsers/parse-zip/local-file-header.js.map +1 -0
  49. package/dist/esm/lib/utils/{customizeColors.js → customize-/321/201olors.js} +9 -3
  50. package/dist/esm/lib/utils/customize-/321/201olors.js.map +1 -0
  51. package/dist/esm/types.js.map +1 -1
  52. package/dist/esm/workers/{i3s-content-nodejs-worker.js → i3s-content-worker-node.js} +2 -2
  53. package/dist/esm/workers/i3s-content-worker-node.js.map +1 -0
  54. package/dist/i3s-content-loader.d.ts.map +1 -1
  55. package/dist/i3s-content-loader.js +1 -2
  56. package/dist/i3s-content-worker-node.js +197 -0
  57. package/dist/{i3s-content-nodejs-worker.js.map → i3s-content-worker-node.js.map} +3 -3
  58. package/dist/i3s-content-worker.js +85 -57
  59. package/dist/i3s-slpk-loader.d.ts +13 -0
  60. package/dist/i3s-slpk-loader.d.ts.map +1 -0
  61. package/dist/i3s-slpk-loader.js +20 -0
  62. package/dist/index.d.ts +3 -2
  63. package/dist/index.d.ts.map +1 -1
  64. package/dist/index.js +5 -3
  65. package/dist/lib/parsers/parse-i3s-tile-content.js +2 -2
  66. package/dist/lib/parsers/parse-slpk/parse-slpk.d.ts +4 -0
  67. package/dist/lib/parsers/parse-slpk/parse-slpk.d.ts.map +1 -0
  68. package/dist/lib/parsers/parse-slpk/parse-slpk.js +50 -0
  69. package/dist/lib/parsers/parse-slpk/slpk-archieve.d.ts +38 -0
  70. package/dist/lib/parsers/parse-slpk/slpk-archieve.d.ts.map +1 -0
  71. package/dist/lib/parsers/parse-slpk/slpk-archieve.js +142 -0
  72. package/dist/lib/parsers/parse-zip/cd-file-header.d.ts +38 -0
  73. package/dist/lib/parsers/parse-zip/cd-file-header.d.ts.map +1 -0
  74. package/dist/lib/parsers/parse-zip/cd-file-header.js +48 -0
  75. package/dist/lib/parsers/parse-zip/local-file-header.d.ts +30 -0
  76. package/dist/lib/parsers/parse-zip/local-file-header.d.ts.map +1 -0
  77. package/dist/lib/parsers/parse-zip/local-file-header.js +28 -0
  78. package/dist/lib/utils/{customizeColors.d.ts → customize-/321/201olors.d.ts} +1 -1
  79. package/dist/lib/utils/customize-/321/201olors.d.ts.map +1 -0
  80. package/dist/lib/utils/{customizeColors.js → customize-/321/201olors.js} +12 -2
  81. package/dist/types.d.ts +1 -0
  82. package/dist/types.d.ts.map +1 -1
  83. package/dist/workers/i3s-content-worker-node.d.ts +2 -0
  84. package/dist/workers/i3s-content-worker-node.d.ts.map +1 -0
  85. package/dist/workers/{i3s-content-nodejs-worker.js → i3s-content-worker-node.js} +2 -1
  86. package/package.json +15 -13
  87. package/src/i3s-content-loader.ts +1 -2
  88. package/src/i3s-slpk-loader.ts +27 -0
  89. package/src/index.ts +4 -3
  90. package/src/lib/parsers/parse-i3s-tile-content.ts +1 -1
  91. package/src/lib/parsers/parse-slpk/parse-slpk.ts +64 -0
  92. package/src/lib/parsers/parse-slpk/slpk-archieve.ts +172 -0
  93. package/src/lib/parsers/parse-zip/cd-file-header.ts +93 -0
  94. package/src/lib/parsers/parse-zip/local-file-header.ts +56 -0
  95. package/src/lib/utils/{customizeColors.ts → customize-/321/201olors.ts} +12 -2
  96. package/src/types.ts +1 -0
  97. package/src/workers/{i3s-content-nodejs-worker.ts → i3s-content-worker-node.ts} +2 -1
  98. package/dist/es5/lib/utils/customizeColors.js.map +0 -1
  99. package/dist/es5/workers/i3s-content-nodejs-worker.js.map +0 -1
  100. package/dist/esm/lib/utils/customizeColors.js.map +0 -1
  101. package/dist/esm/workers/i3s-content-nodejs-worker.js.map +0 -1
  102. package/dist/i3s-content-nodejs-worker.js +0 -198
  103. package/dist/lib/utils/customizeColors.d.ts.map +0 -1
  104. package/dist/workers/i3s-content-nodejs-worker.d.ts +0 -2
  105. package/dist/workers/i3s-content-nodejs-worker.d.ts.map +0 -1
@@ -0,0 +1,64 @@
1
+ import type {SLPKLoaderOptions} from '../../../i3s-slpk-loader';
2
+ import {parseZipCDFileHeader} from '../parse-zip/cd-file-header';
3
+ import {parseZipLocalFileHeader} from '../parse-zip/local-file-header';
4
+ import {SLPKArchive} from './slpk-archieve';
5
+
6
+ /**
7
+ * Returns one byte from the provided buffer at the provided position
8
+ * @param offset - position where to read
9
+ * @param buffer - buffer to read
10
+ * @returns one byte from the provided buffer at the provided position
11
+ */
12
+ const getByteAt = (offset: number, buffer: DataView): number => {
13
+ return buffer.getUint8(buffer.byteOffset + offset);
14
+ };
15
+
16
+ export async function parseSLPK(data: ArrayBuffer, options: SLPKLoaderOptions = {}) {
17
+ const archive = new DataView(data);
18
+ const cdFileHeaderSignature = [80, 75, 1, 2];
19
+
20
+ const searchWindow = [
21
+ getByteAt(archive.byteLength - 1, archive),
22
+ getByteAt(archive.byteLength - 2, archive),
23
+ getByteAt(archive.byteLength - 3, archive),
24
+ undefined
25
+ ];
26
+
27
+ let hashCDOffset = 0;
28
+
29
+ // looking for the last record in the central directory
30
+ for (let i = archive.byteLength - 4; i > -1; i--) {
31
+ searchWindow[3] = searchWindow[2];
32
+ searchWindow[2] = searchWindow[1];
33
+ searchWindow[1] = searchWindow[0];
34
+ searchWindow[0] = getByteAt(i, archive);
35
+ if (searchWindow.every((val, index) => val === cdFileHeaderSignature[index])) {
36
+ hashCDOffset = i;
37
+ break;
38
+ }
39
+ }
40
+
41
+ const cdFileHeader = parseZipCDFileHeader(hashCDOffset, archive);
42
+
43
+ const textDecoder = new TextDecoder();
44
+ if (textDecoder.decode(cdFileHeader.fileName) !== '@specialIndexFileHASH128@') {
45
+ throw new Error('No hash file in slpk');
46
+ }
47
+
48
+ const localFileHeader = parseZipLocalFileHeader(cdFileHeader.localHeaderOffset, archive);
49
+
50
+ const fileDataOffset = localFileHeader.fileDataOffset;
51
+ const hashFile = archive.buffer.slice(
52
+ fileDataOffset,
53
+ fileDataOffset + localFileHeader.compressedSize
54
+ );
55
+
56
+ if (!hashFile) {
57
+ throw new Error('No hash file in slpk');
58
+ }
59
+
60
+ return await new SLPKArchive(data, hashFile).getFile(
61
+ options.slpk?.path ?? '',
62
+ options.slpk?.pathMode
63
+ );
64
+ }
@@ -0,0 +1,172 @@
1
+ import {processOnWorker} from '@loaders.gl/worker-utils';
2
+ import md5 from 'md5';
3
+ import {CompressionWorker} from '@loaders.gl/compression';
4
+ import {parseZipLocalFileHeader} from '../parse-zip/local-file-header';
5
+
6
+ /** Element of hash array */
7
+ type HashElement = {
8
+ /**
9
+ * File name hash
10
+ */
11
+ hash: Buffer;
12
+ /**
13
+ * File offset in the archive
14
+ */
15
+ offset: number;
16
+ };
17
+
18
+ const PATH_DESCRIPTIONS: {test: RegExp; extensions: string[]}[] = [
19
+ {
20
+ test: /^$/,
21
+ extensions: ['3dSceneLayer.json.gz']
22
+ },
23
+ {
24
+ test: /^nodepages\/\d+$/,
25
+ extensions: ['.json.gz']
26
+ },
27
+ {
28
+ test: /^nodes\/\d+$/,
29
+ extensions: ['/3dNodeIndexDocument.json.gz']
30
+ },
31
+ {
32
+ test: /^nodes\/\d+\/textures\/.+$/,
33
+ extensions: ['.jpg', '.png', '.bin.dds.gz', '.ktx']
34
+ },
35
+ {
36
+ test: /^nodes\/\d+\/geometries\/\d+$/,
37
+ extensions: ['.bin.gz', '.draco.gz']
38
+ },
39
+ {
40
+ test: /^nodes\/\d+\/attributes\/f_\d+\/\d+$/,
41
+ extensions: ['.bin.gz']
42
+ },
43
+ {
44
+ test: /^statistics\/f_\d+\/\d+$/,
45
+ extensions: ['.json.gz']
46
+ },
47
+ {
48
+ test: /^nodes\/\d+\/shared$/,
49
+ extensions: ['/sharedResource.json.gz']
50
+ }
51
+ ];
52
+
53
+ /**
54
+ * Class for handling information about slpk file
55
+ */
56
+ export class SLPKArchive {
57
+ slpkArchive: DataView;
58
+ hashArray: {hash: Buffer; offset: number}[];
59
+ constructor(slpkArchiveBuffer: ArrayBuffer, hashFile: ArrayBuffer) {
60
+ this.slpkArchive = new DataView(slpkArchiveBuffer);
61
+ this.hashArray = this.parseHashFile(hashFile);
62
+ }
63
+
64
+ /**
65
+ * Reads hash file from buffer and returns it in ready-to-use form
66
+ * @param hashFile - bufer containing hash file
67
+ * @returns Array containing file info
68
+ */
69
+ private parseHashFile(hashFile: ArrayBuffer): HashElement[] {
70
+ const hashFileBuffer = Buffer.from(hashFile);
71
+ const hashArray: HashElement[] = [];
72
+ for (let i = 0; i < hashFileBuffer.buffer.byteLength; i = i + 24) {
73
+ const offsetBuffer = new DataView(
74
+ hashFileBuffer.buffer.slice(
75
+ hashFileBuffer.byteOffset + i + 16,
76
+ hashFileBuffer.byteOffset + i + 24
77
+ )
78
+ );
79
+ const offset = offsetBuffer.getUint32(offsetBuffer.byteOffset, true);
80
+ hashArray.push({
81
+ hash: Buffer.from(
82
+ hashFileBuffer.subarray(hashFileBuffer.byteOffset + i, hashFileBuffer.byteOffset + i + 16)
83
+ ),
84
+ offset
85
+ });
86
+ }
87
+ return hashArray;
88
+ }
89
+
90
+ /**
91
+ * Returns file with the given path from slpk archive
92
+ * @param path - path inside the slpk
93
+ * @param mode - currently only raw mode supported
94
+ * @returns buffer with ready to use file
95
+ */
96
+ async getFile(path: string, mode: 'http' | 'raw' = 'raw'): Promise<Buffer> {
97
+ if (mode === 'http') {
98
+ const extensions = PATH_DESCRIPTIONS.find((val) => val.test.test(path))?.extensions;
99
+ if (extensions) {
100
+ let data: ArrayBuffer | undefined;
101
+ for (const ext of extensions) {
102
+ data = await this.getDataByPath(`${path}${ext}`);
103
+ if (data) {
104
+ break;
105
+ }
106
+ }
107
+ if (data) {
108
+ return Buffer.from(data);
109
+ }
110
+ }
111
+ }
112
+ if (mode === 'raw') {
113
+ const decompressedFile = await this.getDataByPath(`${path}.gz`);
114
+ if (decompressedFile) {
115
+ return Buffer.from(decompressedFile);
116
+ }
117
+ const fileWithoutCompression = this.getFileBytes(path);
118
+ if (fileWithoutCompression) {
119
+ return Buffer.from(fileWithoutCompression);
120
+ }
121
+ }
122
+
123
+ throw new Error('No such file in the archieve');
124
+ }
125
+
126
+ /**
127
+ * returning uncompressed data for paths that ends with .gz and raw data for all other paths
128
+ * @param path - path inside the archive
129
+ * @returns buffer with the file data
130
+ */
131
+ private async getDataByPath(path: string): Promise<ArrayBuffer | undefined> {
132
+ const data = this.getFileBytes(path);
133
+ if (!data) {
134
+ return undefined;
135
+ }
136
+ if (/\.gz$/.test(path)) {
137
+ const decompressedData = await processOnWorker(CompressionWorker, data, {
138
+ compression: 'gzip',
139
+ operation: 'decompress',
140
+ _workerType: 'test',
141
+ gzip: {}
142
+ });
143
+ return decompressedData;
144
+ }
145
+ return Buffer.from(data);
146
+ }
147
+
148
+ /**
149
+ * Trying to get raw file data by adress
150
+ * @param path - path inside the archive
151
+ * @returns buffer with the raw file data
152
+ */
153
+ private getFileBytes(path: string): ArrayBuffer | undefined {
154
+ const nameHash = Buffer.from(md5(path), 'hex');
155
+ const fileInfo = this.hashArray.find((val) => Buffer.compare(val.hash, nameHash) === 0);
156
+ if (!fileInfo) {
157
+ return undefined;
158
+ }
159
+
160
+ const localFileHeader = parseZipLocalFileHeader(
161
+ this.slpkArchive.byteOffset + fileInfo?.offset,
162
+ this.slpkArchive
163
+ );
164
+
165
+ const compressedFile = this.slpkArchive.buffer.slice(
166
+ localFileHeader.fileDataOffset,
167
+ localFileHeader.fileDataOffset + localFileHeader.compressedSize
168
+ );
169
+
170
+ return compressedFile;
171
+ }
172
+ }
@@ -0,0 +1,93 @@
1
+ /**
2
+ * zip central directory file header info
3
+ * according to https://en.wikipedia.org/wiki/ZIP_(file_format)
4
+ */
5
+ export type ZipCDFileHeader = {
6
+ /**
7
+ * Compressed size
8
+ */
9
+ compressedSize: number;
10
+ /**
11
+ * Uncompressed size
12
+ */
13
+ uncompressedSize: number;
14
+ /**
15
+ * File name length
16
+ */
17
+ fileNameLength: number;
18
+ /**
19
+ * File name
20
+ */
21
+ fileName: ArrayBuffer;
22
+ /**
23
+ * Extra field offset
24
+ */
25
+ extraOffset: number;
26
+ /**
27
+ * Relative offset of local file header
28
+ */
29
+ localHeaderOffset: number;
30
+ };
31
+
32
+ /**
33
+ * Parses central directory file header of zip file
34
+ * @param headerOffset - offset in the archive where header starts
35
+ * @param buffer - buffer containing whole array
36
+ * @returns Info from the header
37
+ */
38
+ export const parseZipCDFileHeader = (headerOffset: number, buffer: DataView): ZipCDFileHeader => {
39
+ const offsets = {
40
+ CD_COMPRESSED_SIZE_OFFSET: 20,
41
+ CD_UNCOMPRESSED_SIZE_OFFSET: 24,
42
+ CD_FILE_NAME_LENGTH_OFFSET: 28,
43
+ CD_EXTRA_FIELD_LENGTH_OFFSET: 30,
44
+ CD_LOCAL_HEADER_OFFSET_OFFSET: 42,
45
+ CD_FILE_NAME_OFFSET: 46
46
+ };
47
+
48
+ const compressedSize = buffer.getUint32(headerOffset + offsets.CD_COMPRESSED_SIZE_OFFSET, true);
49
+
50
+ const uncompressedSize = buffer.getUint32(
51
+ headerOffset + offsets.CD_UNCOMPRESSED_SIZE_OFFSET,
52
+ true
53
+ );
54
+
55
+ const fileNameLength = buffer.getUint16(headerOffset + offsets.CD_FILE_NAME_LENGTH_OFFSET, true);
56
+
57
+ const fileName = buffer.buffer.slice(
58
+ headerOffset + offsets.CD_FILE_NAME_OFFSET,
59
+ headerOffset + offsets.CD_FILE_NAME_OFFSET + fileNameLength
60
+ );
61
+
62
+ const extraOffset = headerOffset + offsets.CD_FILE_NAME_OFFSET + fileNameLength;
63
+
64
+ const oldFormatOffset = buffer.getUint32(
65
+ headerOffset + offsets.CD_LOCAL_HEADER_OFFSET_OFFSET,
66
+ true
67
+ );
68
+
69
+ let fileDataOffset = oldFormatOffset;
70
+ if (fileDataOffset === 0xffffffff) {
71
+ let offsetInZip64Data = 4;
72
+ // looking for info that might be also be in zip64 extra field
73
+ if (compressedSize === 0xffffffff) {
74
+ offsetInZip64Data += 8;
75
+ }
76
+ if (uncompressedSize === 0xffffffff) {
77
+ offsetInZip64Data += 8;
78
+ }
79
+
80
+ // getUint32 needs to be replaced with getBigUint64 for archieves bigger than 2gb
81
+ fileDataOffset = buffer.getUint32(extraOffset + offsetInZip64Data, true); // setting it to the one from zip64
82
+ }
83
+ const localHeaderOffset = fileDataOffset;
84
+
85
+ return {
86
+ compressedSize,
87
+ uncompressedSize,
88
+ fileNameLength,
89
+ fileName,
90
+ extraOffset,
91
+ localHeaderOffset
92
+ };
93
+ };
@@ -0,0 +1,56 @@
1
+ /**
2
+ * zip local file header info
3
+ * according to https://en.wikipedia.org/wiki/ZIP_(file_format)
4
+ */
5
+ export type ZipLocalFileHeader = {
6
+ /**
7
+ * File name length
8
+ */
9
+ fileNameLength: number;
10
+ /**
11
+ * Extra field length
12
+ */
13
+ extraFieldLength: number;
14
+ /**
15
+ * Offset of the file data
16
+ */
17
+ fileDataOffset: number;
18
+ /**
19
+ * Compressed size
20
+ */
21
+ compressedSize: number;
22
+ };
23
+
24
+ /**
25
+ * Parses local file header of zip file
26
+ * @param headerOffset - offset in the archive where header starts
27
+ * @param buffer - buffer containing whole array
28
+ * @returns Info from the header
29
+ */
30
+ export const parseZipLocalFileHeader = (
31
+ headerOffset: number,
32
+ buffer: DataView
33
+ ): ZipLocalFileHeader => {
34
+ const offsets = {
35
+ COMPRESSED_SIZE_OFFSET: 18,
36
+ FILE_NAME_LENGTH_OFFSET: 26,
37
+ EXTRA_FIELD_LENGTH_OFFSET: 28,
38
+ FILE_NAME_OFFSET: 30
39
+ };
40
+
41
+ const fileNameLength = buffer.getUint16(headerOffset + offsets.FILE_NAME_LENGTH_OFFSET, true);
42
+
43
+ const extraFieldLength = buffer.getUint16(headerOffset + offsets.EXTRA_FIELD_LENGTH_OFFSET, true);
44
+
45
+ const fileDataOffset =
46
+ headerOffset + offsets.FILE_NAME_OFFSET + fileNameLength + extraFieldLength;
47
+
48
+ const compressedSize = buffer.getUint32(headerOffset + offsets.COMPRESSED_SIZE_OFFSET, true);
49
+
50
+ return {
51
+ fileNameLength,
52
+ extraFieldLength,
53
+ fileDataOffset,
54
+ compressedSize
55
+ };
56
+ };
@@ -4,7 +4,7 @@ import type {COLOR, I3STileOptions, I3STilesetOptions} from '../../types';
4
4
  import {load} from '@loaders.gl/core';
5
5
  import {getAttributeValueType, I3SAttributeLoader} from '../../i3s-attribute-loader';
6
6
  import {I3SLoaderOptions} from '../../i3s-loader';
7
- import {getUrlWithToken} from '../utils/url-utils';
7
+ import {getUrlWithToken} from './url-utils';
8
8
 
9
9
  /**
10
10
  * Modify vertex colors array to visualize 3D objects in a attribute driven way
@@ -79,7 +79,17 @@ export async function customizeColors(
79
79
  if (!color) {
80
80
  continue; // eslint-disable-line no-continue
81
81
  }
82
- colors.value.set(color, i * 4);
82
+
83
+ /* eslint max-statements: ["error", 30] */
84
+ /* eslint complexity: ["error", 12] */
85
+ if (options.i3s.colorsByAttribute.mode === 'multiply') {
86
+ // multiplying original mesh and calculated for attribute rgba colors in range 0-255
87
+ color.forEach((colorItem, index) => {
88
+ colors.value[i * 4 + index] = (colors.value[i * 4 + index] * colorItem) / 255;
89
+ });
90
+ } else {
91
+ colors.value.set(color, i * 4);
92
+ }
83
93
  }
84
94
 
85
95
  return colors;
package/src/types.ts CHANGED
@@ -114,6 +114,7 @@ export type I3SParseOptions = {
114
114
  maxValue: number;
115
115
  minColor: COLOR;
116
116
  maxColor: COLOR;
117
+ mode: string;
117
118
  };
118
119
 
119
120
  /** @deprecated */
@@ -1,5 +1,6 @@
1
- import {createLoaderWorker} from '@loaders.gl/loader-utils';
1
+ // Polyfills increases the bundle size significantly. Use it for NodeJS worker only
2
2
  import '@loaders.gl/polyfills';
3
+ import {createLoaderWorker} from '@loaders.gl/loader-utils';
3
4
  import {I3SContentLoader} from '../i3s-content-loader';
4
5
 
5
6
  createLoaderWorker(I3SContentLoader);
@@ -1 +0,0 @@
1
- {"version":3,"file":"customizeColors.js","names":["_core","require","_i3sAttributeLoader","_urlUtils","customizeColors","_x","_x2","_x3","_x4","_x5","_customizeColors","apply","arguments","_asyncToGenerator2","default","_regenerator","mark","_callee","colors","featureIds","tileOptions","tilesetOptions","options","_options$i3s2","colorizeAttributeField","colorizeAttributeData","objectIdField","objectIdAttributeData","attributeValuesMap","i","_i","color","wrap","_callee$","_context","prev","next","i3s","colorsByAttribute","abrupt","fields","find","_ref3","_options$i3s3","_options$i3s3$colorsB","name","attributeName","includes","type","loadFeatureAttributeData","sent","_ref4","length","calculateColorForAttribute","value","set","stop","attributeValue","_options$i3s","_options$i3s$colorsBy","minValue","maxValue","minColor","maxColor","rate","Math","round","_x6","_x7","_x8","_x9","_loadFeatureAttributeData","_callee2","_ref","_ref2","_options$i3s4","attributeUrls","attributeStorageInfo","attributeIndex","objectIdAttributeUrl","attributeType","_callee2$","_context2","findIndex","_ref5","getUrlWithToken","token","getAttributeValueType","load","I3SAttributeLoader"],"sources":["../../../../src/lib/utils/customizeColors.ts"],"sourcesContent":["import type {MeshAttribute} from '@loaders.gl/schema';\nimport type {COLOR, I3STileOptions, I3STilesetOptions} from '../../types';\n\nimport {load} from '@loaders.gl/core';\nimport {getAttributeValueType, I3SAttributeLoader} from '../../i3s-attribute-loader';\nimport {I3SLoaderOptions} from '../../i3s-loader';\nimport {getUrlWithToken} from '../utils/url-utils';\n\n/**\n * Modify vertex colors array to visualize 3D objects in a attribute driven way\n * @param colors - vertex colors attribute\n * @param featureIds - feature Ids attribute\n * @param tileOptions - tile - related options\n * @param tilesetOptions - tileset-related options\n * @param options - loader options\n * @returns midified colors attribute\n */\nexport async function customizeColors(\n colors: MeshAttribute,\n featureIds: MeshAttribute,\n tileOptions: I3STileOptions,\n tilesetOptions: I3STilesetOptions,\n options?: I3SLoaderOptions\n): Promise<MeshAttribute> {\n if (!options?.i3s?.colorsByAttribute) {\n return colors;\n }\n\n const colorizeAttributeField = tilesetOptions.fields.find(\n ({name}) => name === options?.i3s?.colorsByAttribute?.attributeName\n );\n if (\n !colorizeAttributeField ||\n !['esriFieldTypeDouble', 'esriFieldTypeInteger', 'esriFieldTypeSmallInteger'].includes(\n colorizeAttributeField.type\n )\n ) {\n return colors;\n }\n\n const colorizeAttributeData = await loadFeatureAttributeData(\n colorizeAttributeField.name,\n tileOptions,\n tilesetOptions,\n options\n );\n if (!colorizeAttributeData) {\n return colors;\n }\n\n const objectIdField = tilesetOptions.fields.find(({type}) => type === 'esriFieldTypeOID');\n if (!objectIdField) {\n return colors;\n }\n\n const objectIdAttributeData = await loadFeatureAttributeData(\n objectIdField.name,\n tileOptions,\n tilesetOptions,\n options\n );\n if (!objectIdAttributeData) {\n return colors;\n }\n\n const attributeValuesMap: {[key: number]: COLOR} = {};\n // @ts-expect-error\n for (let i = 0; i < objectIdAttributeData[objectIdField.name].length; i++) {\n // @ts-expect-error\n attributeValuesMap[objectIdAttributeData[objectIdField.name][i]] = calculateColorForAttribute(\n // @ts-expect-error\n colorizeAttributeData[colorizeAttributeField.name][i] as number,\n options\n );\n }\n\n for (let i = 0; i < featureIds.value.length; i++) {\n const color = attributeValuesMap[featureIds.value[i]];\n if (!color) {\n continue; // eslint-disable-line no-continue\n }\n colors.value.set(color, i * 4);\n }\n\n return colors;\n}\n\n/**\n * Calculate rgba color from the attribute value\n * @param attributeValue - value of the attribute\n * @param options - loader options\n * @returns - color array for a specific attribute value\n */\nfunction calculateColorForAttribute(attributeValue: number, options?: I3SLoaderOptions): COLOR {\n if (!options?.i3s?.colorsByAttribute) {\n return [255, 255, 255, 255];\n }\n const {minValue, maxValue, minColor, maxColor} = options.i3s.colorsByAttribute;\n const rate = (attributeValue - minValue) / (maxValue - minValue);\n const color: COLOR = [255, 255, 255, 255];\n for (let i = 0; i < minColor.length; i++) {\n color[i] = Math.round((maxColor[i] - minColor[i]) * rate + minColor[i]);\n }\n return color;\n}\n\n/**\n * Load feature attribute data from the ArcGIS rest service\n * @param attributeName - attribute name\n * @param tileOptions - tile-related options\n * @param tilesetOptions - tileset-related options\n * @param options - loader options\n * @returns - Array-like list of the attribute values\n */\nasync function loadFeatureAttributeData(\n attributeName: string,\n {attributeUrls}: I3STileOptions,\n {attributeStorageInfo}: I3STilesetOptions,\n options?: I3SLoaderOptions\n): Promise<{[key: string]: string[] | Uint32Array | Uint16Array | Float64Array | null} | null> {\n const attributeIndex = attributeStorageInfo.findIndex(({name}) => attributeName === name);\n if (attributeIndex === -1) {\n return null;\n }\n const objectIdAttributeUrl = getUrlWithToken(attributeUrls[attributeIndex], options?.i3s?.token);\n const attributeType = getAttributeValueType(attributeStorageInfo[attributeIndex]);\n const objectIdAttributeData = await load(objectIdAttributeUrl, I3SAttributeLoader, {\n attributeName,\n attributeType\n });\n\n // @ts-expect-error TODO action engine\n return objectIdAttributeData;\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AAEA,IAAAE,SAAA,GAAAF,OAAA;AAAmD,SAW7BG,eAAeA,CAAAC,EAAA,EAAAC,GAAA,EAAAC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GAAAuC,KAAA,CAAJvC,IAAI;YAAA,OAAMC,aAAa,KAAKD,IAAI;UAAA,EAAC;UAAA,MACrFiC,cAAc,KAAK,CAAC,CAAC;YAAAI,SAAA,CAAA9C,IAAA;YAAA;UAAA;UAAA,OAAA8C,SAAA,CAAA3C,MAAA,WAChB,IAAI;QAAA;UAEPwC,oBAAoB,GAAG,IAAAM,yBAAe,EAACT,aAAa,CAACE,cAAc,CAAC,EAAExD,OAAO,aAAPA,OAAO,wBAAAqD,aAAA,GAAPrD,OAAO,CAAEe,GAAG,cAAAsC,aAAA,uBAAZA,aAAA,CAAcW,KAAK,CAAC;UAC1FN,aAAa,GAAG,IAAAO,yCAAqB,EAACV,oBAAoB,CAACC,cAAc,CAAC,CAAC;UAAAI,SAAA,CAAA9C,IAAA;UAAA,OAC7C,IAAAoD,UAAI,EAACT,oBAAoB,EAAEU,sCAAkB,EAAE;YACjF3C,aAAa,EAAbA,aAAa;YACbkC,aAAa,EAAbA;UACF,CAAC,CAAC;QAAA;UAHIrD,qBAAqB,GAAAuD,SAAA,CAAAhC,IAAA;UAAA,OAAAgC,SAAA,CAAA3C,MAAA,WAMpBZ,qBAAqB;QAAA;QAAA;UAAA,OAAAuD,SAAA,CAAA1B,IAAA;MAAA;IAAA,GAAAgB,QAAA;EAAA,CAC7B;EAAA,OAAAD,yBAAA,CAAA5D,KAAA,OAAAC,SAAA;AAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"i3s-content-nodejs-worker.js","names":["_loaderUtils","require","_i3sContentLoader","createLoaderWorker","I3SContentLoader"],"sources":["../../../src/workers/i3s-content-nodejs-worker.ts"],"sourcesContent":["import {createLoaderWorker} from '@loaders.gl/loader-utils';\nimport '@loaders.gl/polyfills';\nimport {I3SContentLoader} from '../i3s-content-loader';\n\ncreateLoaderWorker(I3SContentLoader);\n"],"mappings":";;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACAA,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AAEA,IAAAE,+BAAkB,EAACC,kCAAgB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"customizeColors.js","names":["load","getAttributeValueType","I3SAttributeLoader","getUrlWithToken","customizeColors","colors","featureIds","tileOptions","tilesetOptions","options","_options$i3s","i3s","colorsByAttribute","colorizeAttributeField","fields","find","_ref","_options$i3s2","_options$i3s2$colorsB","name","attributeName","includes","type","colorizeAttributeData","loadFeatureAttributeData","objectIdField","_ref2","objectIdAttributeData","attributeValuesMap","i","length","calculateColorForAttribute","value","color","set","attributeValue","_options$i3s3","minValue","maxValue","minColor","maxColor","rate","Math","round","_ref3","_ref4","_options$i3s4","attributeUrls","attributeStorageInfo","attributeIndex","findIndex","_ref5","objectIdAttributeUrl","token","attributeType"],"sources":["../../../../src/lib/utils/customizeColors.ts"],"sourcesContent":["import type {MeshAttribute} from '@loaders.gl/schema';\nimport type {COLOR, I3STileOptions, I3STilesetOptions} from '../../types';\n\nimport {load} from '@loaders.gl/core';\nimport {getAttributeValueType, I3SAttributeLoader} from '../../i3s-attribute-loader';\nimport {I3SLoaderOptions} from '../../i3s-loader';\nimport {getUrlWithToken} from '../utils/url-utils';\n\n/**\n * Modify vertex colors array to visualize 3D objects in a attribute driven way\n * @param colors - vertex colors attribute\n * @param featureIds - feature Ids attribute\n * @param tileOptions - tile - related options\n * @param tilesetOptions - tileset-related options\n * @param options - loader options\n * @returns midified colors attribute\n */\nexport async function customizeColors(\n colors: MeshAttribute,\n featureIds: MeshAttribute,\n tileOptions: I3STileOptions,\n tilesetOptions: I3STilesetOptions,\n options?: I3SLoaderOptions\n): Promise<MeshAttribute> {\n if (!options?.i3s?.colorsByAttribute) {\n return colors;\n }\n\n const colorizeAttributeField = tilesetOptions.fields.find(\n ({name}) => name === options?.i3s?.colorsByAttribute?.attributeName\n );\n if (\n !colorizeAttributeField ||\n !['esriFieldTypeDouble', 'esriFieldTypeInteger', 'esriFieldTypeSmallInteger'].includes(\n colorizeAttributeField.type\n )\n ) {\n return colors;\n }\n\n const colorizeAttributeData = await loadFeatureAttributeData(\n colorizeAttributeField.name,\n tileOptions,\n tilesetOptions,\n options\n );\n if (!colorizeAttributeData) {\n return colors;\n }\n\n const objectIdField = tilesetOptions.fields.find(({type}) => type === 'esriFieldTypeOID');\n if (!objectIdField) {\n return colors;\n }\n\n const objectIdAttributeData = await loadFeatureAttributeData(\n objectIdField.name,\n tileOptions,\n tilesetOptions,\n options\n );\n if (!objectIdAttributeData) {\n return colors;\n }\n\n const attributeValuesMap: {[key: number]: COLOR} = {};\n // @ts-expect-error\n for (let i = 0; i < objectIdAttributeData[objectIdField.name].length; i++) {\n // @ts-expect-error\n attributeValuesMap[objectIdAttributeData[objectIdField.name][i]] = calculateColorForAttribute(\n // @ts-expect-error\n colorizeAttributeData[colorizeAttributeField.name][i] as number,\n options\n );\n }\n\n for (let i = 0; i < featureIds.value.length; i++) {\n const color = attributeValuesMap[featureIds.value[i]];\n if (!color) {\n continue; // eslint-disable-line no-continue\n }\n colors.value.set(color, i * 4);\n }\n\n return colors;\n}\n\n/**\n * Calculate rgba color from the attribute value\n * @param attributeValue - value of the attribute\n * @param options - loader options\n * @returns - color array for a specific attribute value\n */\nfunction calculateColorForAttribute(attributeValue: number, options?: I3SLoaderOptions): COLOR {\n if (!options?.i3s?.colorsByAttribute) {\n return [255, 255, 255, 255];\n }\n const {minValue, maxValue, minColor, maxColor} = options.i3s.colorsByAttribute;\n const rate = (attributeValue - minValue) / (maxValue - minValue);\n const color: COLOR = [255, 255, 255, 255];\n for (let i = 0; i < minColor.length; i++) {\n color[i] = Math.round((maxColor[i] - minColor[i]) * rate + minColor[i]);\n }\n return color;\n}\n\n/**\n * Load feature attribute data from the ArcGIS rest service\n * @param attributeName - attribute name\n * @param tileOptions - tile-related options\n * @param tilesetOptions - tileset-related options\n * @param options - loader options\n * @returns - Array-like list of the attribute values\n */\nasync function loadFeatureAttributeData(\n attributeName: string,\n {attributeUrls}: I3STileOptions,\n {attributeStorageInfo}: I3STilesetOptions,\n options?: I3SLoaderOptions\n): Promise<{[key: string]: string[] | Uint32Array | Uint16Array | Float64Array | null} | null> {\n const attributeIndex = attributeStorageInfo.findIndex(({name}) => attributeName === name);\n if (attributeIndex === -1) {\n return null;\n }\n const objectIdAttributeUrl = getUrlWithToken(attributeUrls[attributeIndex], options?.i3s?.token);\n const attributeType = getAttributeValueType(attributeStorageInfo[attributeIndex]);\n const objectIdAttributeData = await load(objectIdAttributeUrl, I3SAttributeLoader, {\n attributeName,\n attributeType\n });\n\n // @ts-expect-error TODO action engine\n return objectIdAttributeData;\n}\n"],"mappings":"AAGA,SAAQA,IAAI,QAAO,kBAAkB;AACrC,SAAQC,qBAAqB,EAAEC,kBAAkB,QAAO,4BAA4B;AAEpF,SAAQC,eAAe,QAAO,oBAAoB;AAWlD,OAAO,eAAeC,eAAeA,CACnCC,MAAqB,EACrBC,UAAyB,EACzBC,WAA2B,EAC3BC,cAAiC,EACjCC,OAA0B,EACF;EAAA,IAAAC,YAAA;EACxB,IAAI,EAACD,OAAO,aAAPA,OAAO,gBAAAC,YAAA,GAAPD,OAAO,CAAEE,GAAG,cAAAD,YAAA,eAAZA,YAAA,CAAcE,iBAAiB,GAAE;IACpC,OAAOP,MAAM;EACf;EAEA,MAAMQ,sBAAsB,GAAGL,cAAc,CAACM,MAAM,CAACC,IAAI,CACvDC,IAAA;IAAA,IAAAC,aAAA,EAAAC,qBAAA;IAAA,IAAC;MAACC;IAAI,CAAC,GAAAH,IAAA;IAAA,OAAKG,IAAI,MAAKV,OAAO,aAAPA,OAAO,wBAAAQ,aAAA,GAAPR,OAAO,CAAEE,GAAG,cAAAM,aAAA,wBAAAC,qBAAA,GAAZD,aAAA,CAAcL,iBAAiB,cAAAM,qBAAA,uBAA/BA,qBAAA,CAAiCE,aAAa;EAAA,CACrE,CAAC;EACD,IACE,CAACP,sBAAsB,IACvB,CAAC,CAAC,qBAAqB,EAAE,sBAAsB,EAAE,2BAA2B,CAAC,CAACQ,QAAQ,CACpFR,sBAA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E,SAAS,CAACC,KAAA;IAAA,IAAC;MAAChC;IAAI,CAAC,GAAAgC,KAAA;IAAA,OAAK/B,aAAa,KAAKD,IAAI;EAAA,EAAC;EACzF,IAAI8B,cAAc,KAAK,CAAC,CAAC,EAAE;IACzB,OAAO,IAAI;EACb;EACA,MAAMG,oBAAoB,GAAGjD,eAAe,CAAC4C,aAAa,CAACE,cAAc,CAAC,EAAExC,OAAO,aAAPA,OAAO,wBAAAqC,aAAA,GAAPrC,OAAO,CAAEE,GAAG,cAAAmC,aAAA,uBAAZA,aAAA,CAAcO,KAAK,CAAC;EAChG,MAAMC,aAAa,GAAGrD,qBAAqB,CAAC+C,oBAAoB,CAACC,cAAc,CAAC,CAAC;EACjF,MAAMtB,qBAAqB,GAAG,MAAM3B,IAAI,CAACoD,oBAAoB,EAAElD,kBAAkB,EAAE;IACjFkB,aAAa;IACbkC;EACF,CAAC,CAAC;EAGF,OAAO3B,qBAAqB;AAC9B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"i3s-content-nodejs-worker.js","names":["createLoaderWorker","I3SContentLoader"],"sources":["../../../src/workers/i3s-content-nodejs-worker.ts"],"sourcesContent":["import {createLoaderWorker} from '@loaders.gl/loader-utils';\nimport '@loaders.gl/polyfills';\nimport {I3SContentLoader} from '../i3s-content-loader';\n\ncreateLoaderWorker(I3SContentLoader);\n"],"mappings":"AAAA,SAAQA,kBAAkB,QAAO,0BAA0B;AAC3D,OAAO,uBAAuB;AAC9B,SAAQC,gBAAgB,QAAO,uBAAuB;AAEtDD,kBAAkB,CAACC,gBAAgB,CAAC"}