@loaders.gl/tile-converter 4.4.0-alpha.1 → 4.4.0-alpha.9

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 (166) hide show
  1. package/dist/converter.min.cjs +89 -98
  2. package/dist/i3s-server/bin/i3s-server.min.cjs +78 -78
  3. package/package.json +17 -17
  4. package/src/3d-tiles-converter/3d-tiles-converter.ts +11 -7
  5. package/src/3d-tiles-converter/helpers/load-i3s.ts +5 -5
  6. package/src/converter-cli.ts +2 -2
  7. package/src/i3s-converter/helpers/geometry-converter.ts +17 -1
  8. package/src/i3s-converter/helpers/load-3d-tiles.ts +24 -9
  9. package/src/i3s-converter/i3s-converter.ts +25 -9
  10. package/src/i3s-server/controllers/slpk-controller.ts +2 -2
  11. package/src/lib/utils/compress-util.ts +1 -0
  12. package/dist/3d-tiles-converter/3d-tiles-converter.d.ts +0 -115
  13. package/dist/3d-tiles-converter/3d-tiles-converter.d.ts.map +0 -1
  14. package/dist/3d-tiles-converter/3d-tiles-converter.js +0 -388
  15. package/dist/3d-tiles-converter/helpers/3d-tiles-content-converter.d.ts +0 -88
  16. package/dist/3d-tiles-converter/helpers/3d-tiles-content-converter.d.ts.map +0 -1
  17. package/dist/3d-tiles-converter/helpers/3d-tiles-content-converter.js +0 -380
  18. package/dist/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.d.ts +0 -13
  19. package/dist/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.d.ts.map +0 -1
  20. package/dist/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js +0 -19
  21. package/dist/3d-tiles-converter/helpers/load-i3s.d.ts +0 -37
  22. package/dist/3d-tiles-converter/helpers/load-i3s.d.ts.map +0 -1
  23. package/dist/3d-tiles-converter/helpers/load-i3s.js +0 -98
  24. package/dist/3d-tiles-converter/helpers/texture-atlas.d.ts +0 -10
  25. package/dist/3d-tiles-converter/helpers/texture-atlas.d.ts.map +0 -1
  26. package/dist/3d-tiles-converter/helpers/texture-atlas.js +0 -50
  27. package/dist/3d-tiles-converter/json-templates/tileset.d.ts +0 -15
  28. package/dist/3d-tiles-converter/json-templates/tileset.d.ts.map +0 -1
  29. package/dist/3d-tiles-converter/json-templates/tileset.js +0 -39
  30. package/dist/constants.d.ts +0 -3
  31. package/dist/constants.d.ts.map +0 -1
  32. package/dist/constants.js +0 -2
  33. package/dist/converter-cli.d.ts +0 -2
  34. package/dist/converter-cli.d.ts.map +0 -1
  35. package/dist/converter-cli.js +0 -290
  36. package/dist/deps-installer/deps-installer.d.ts +0 -19
  37. package/dist/deps-installer/deps-installer.d.ts.map +0 -1
  38. package/dist/deps-installer/deps-installer.js +0 -95
  39. package/dist/i3s-converter/helpers/attribute-metadata-info.d.ts +0 -84
  40. package/dist/i3s-converter/helpers/attribute-metadata-info.d.ts.map +0 -1
  41. package/dist/i3s-converter/helpers/attribute-metadata-info.js +0 -219
  42. package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts +0 -26
  43. package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts.map +0 -1
  44. package/dist/i3s-converter/helpers/batch-ids-extensions.js +0 -165
  45. package/dist/i3s-converter/helpers/coordinate-converter.d.ts +0 -39
  46. package/dist/i3s-converter/helpers/coordinate-converter.d.ts.map +0 -1
  47. package/dist/i3s-converter/helpers/coordinate-converter.js +0 -118
  48. package/dist/i3s-converter/helpers/create-scene-server-path.d.ts +0 -9
  49. package/dist/i3s-converter/helpers/create-scene-server-path.d.ts.map +0 -1
  50. package/dist/i3s-converter/helpers/create-scene-server-path.js +0 -21
  51. package/dist/i3s-converter/helpers/feature-attributes.d.ts +0 -54
  52. package/dist/i3s-converter/helpers/feature-attributes.d.ts.map +0 -1
  53. package/dist/i3s-converter/helpers/feature-attributes.js +0 -193
  54. package/dist/i3s-converter/helpers/geometry-attributes.d.ts +0 -8
  55. package/dist/i3s-converter/helpers/geometry-attributes.d.ts.map +0 -1
  56. package/dist/i3s-converter/helpers/geometry-attributes.js +0 -226
  57. package/dist/i3s-converter/helpers/geometry-converter.d.ts +0 -60
  58. package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +0 -1
  59. package/dist/i3s-converter/helpers/geometry-converter.js +0 -1309
  60. package/dist/i3s-converter/helpers/gltf-attributes.d.ts +0 -28
  61. package/dist/i3s-converter/helpers/gltf-attributes.d.ts.map +0 -1
  62. package/dist/i3s-converter/helpers/gltf-attributes.js +0 -122
  63. package/dist/i3s-converter/helpers/load-3d-tiles.d.ts +0 -33
  64. package/dist/i3s-converter/helpers/load-3d-tiles.d.ts.map +0 -1
  65. package/dist/i3s-converter/helpers/load-3d-tiles.js +0 -121
  66. package/dist/i3s-converter/helpers/node-debug.d.ts +0 -8
  67. package/dist/i3s-converter/helpers/node-debug.d.ts.map +0 -1
  68. package/dist/i3s-converter/helpers/node-debug.js +0 -116
  69. package/dist/i3s-converter/helpers/node-index-document.d.ts +0 -111
  70. package/dist/i3s-converter/helpers/node-index-document.d.ts.map +0 -1
  71. package/dist/i3s-converter/helpers/node-index-document.js +0 -269
  72. package/dist/i3s-converter/helpers/node-pages.d.ts +0 -156
  73. package/dist/i3s-converter/helpers/node-pages.d.ts.map +0 -1
  74. package/dist/i3s-converter/helpers/node-pages.js +0 -285
  75. package/dist/i3s-converter/helpers/preprocess-3d-tiles.d.ts +0 -22
  76. package/dist/i3s-converter/helpers/preprocess-3d-tiles.d.ts.map +0 -1
  77. package/dist/i3s-converter/helpers/preprocess-3d-tiles.js +0 -104
  78. package/dist/i3s-converter/helpers/progress.d.ts +0 -90
  79. package/dist/i3s-converter/helpers/progress.d.ts.map +0 -1
  80. package/dist/i3s-converter/helpers/progress.js +0 -148
  81. package/dist/i3s-converter/helpers/tileset-traversal.d.ts +0 -32
  82. package/dist/i3s-converter/helpers/tileset-traversal.d.ts.map +0 -1
  83. package/dist/i3s-converter/helpers/tileset-traversal.js +0 -34
  84. package/dist/i3s-converter/i3s-converter.d.ts +0 -312
  85. package/dist/i3s-converter/i3s-converter.d.ts.map +0 -1
  86. package/dist/i3s-converter/i3s-converter.js +0 -1191
  87. package/dist/i3s-converter/json-templates/geometry-definitions.d.ts +0 -7
  88. package/dist/i3s-converter/json-templates/geometry-definitions.d.ts.map +0 -1
  89. package/dist/i3s-converter/json-templates/geometry-definitions.js +0 -80
  90. package/dist/i3s-converter/json-templates/layers.d.ts +0 -70
  91. package/dist/i3s-converter/json-templates/layers.d.ts.map +0 -1
  92. package/dist/i3s-converter/json-templates/layers.js +0 -132
  93. package/dist/i3s-converter/json-templates/metadata.d.ts +0 -22
  94. package/dist/i3s-converter/json-templates/metadata.d.ts.map +0 -1
  95. package/dist/i3s-converter/json-templates/metadata.js +0 -21
  96. package/dist/i3s-converter/json-templates/node.d.ts +0 -61
  97. package/dist/i3s-converter/json-templates/node.d.ts.map +0 -1
  98. package/dist/i3s-converter/json-templates/node.js +0 -82
  99. package/dist/i3s-converter/json-templates/scene-server.d.ts +0 -28
  100. package/dist/i3s-converter/json-templates/scene-server.d.ts.map +0 -1
  101. package/dist/i3s-converter/json-templates/scene-server.js +0 -27
  102. package/dist/i3s-converter/json-templates/shared-resources.d.ts +0 -14
  103. package/dist/i3s-converter/json-templates/shared-resources.d.ts.map +0 -1
  104. package/dist/i3s-converter/json-templates/shared-resources.js +0 -122
  105. package/dist/i3s-converter/json-templates/store.d.ts +0 -95
  106. package/dist/i3s-converter/json-templates/store.d.ts.map +0 -1
  107. package/dist/i3s-converter/json-templates/store.js +0 -100
  108. package/dist/i3s-converter/types.d.ts +0 -226
  109. package/dist/i3s-converter/types.d.ts.map +0 -1
  110. package/dist/i3s-converter/types.js +0 -37
  111. package/dist/i3s-server/app.d.ts +0 -3
  112. package/dist/i3s-server/app.d.ts.map +0 -1
  113. package/dist/i3s-server/app.js +0 -31
  114. package/dist/i3s-server/bin/www.d.ts +0 -3
  115. package/dist/i3s-server/bin/www.d.ts.map +0 -1
  116. package/dist/i3s-server/bin/www.js +0 -46
  117. package/dist/i3s-server/controllers/slpk-controller.d.ts +0 -13
  118. package/dist/i3s-server/controllers/slpk-controller.d.ts.map +0 -1
  119. package/dist/i3s-server/controllers/slpk-controller.js +0 -32
  120. package/dist/i3s-server/routes/slpk-router.d.ts +0 -3
  121. package/dist/i3s-server/routes/slpk-router.d.ts.map +0 -1
  122. package/dist/i3s-server/routes/slpk-router.js +0 -40
  123. package/dist/i3s-server/utils/create-scene-server.d.ts +0 -17
  124. package/dist/i3s-server/utils/create-scene-server.d.ts.map +0 -1
  125. package/dist/i3s-server/utils/create-scene-server.js +0 -18
  126. package/dist/i3s-server/utils/server-utils.d.ts +0 -21
  127. package/dist/i3s-server/utils/server-utils.d.ts.map +0 -1
  128. package/dist/i3s-server/utils/server-utils.js +0 -60
  129. package/dist/index.cjs +0 -6228
  130. package/dist/index.cjs.map +0 -7
  131. package/dist/index.d.ts +0 -3
  132. package/dist/index.d.ts.map +0 -1
  133. package/dist/index.js +0 -2
  134. package/dist/lib/json-schemas/conversion-dump-json-schema.d.ts +0 -463
  135. package/dist/lib/json-schemas/conversion-dump-json-schema.d.ts.map +0 -1
  136. package/dist/lib/json-schemas/conversion-dump-json-schema.js +0 -285
  137. package/dist/lib/utils/cli-utils.d.ts +0 -34
  138. package/dist/lib/utils/cli-utils.d.ts.map +0 -1
  139. package/dist/lib/utils/cli-utils.js +0 -76
  140. package/dist/lib/utils/compress-util.d.ts +0 -8
  141. package/dist/lib/utils/compress-util.d.ts.map +0 -1
  142. package/dist/lib/utils/compress-util.js +0 -25
  143. package/dist/lib/utils/conversion-dump.d.ts +0 -147
  144. package/dist/lib/utils/conversion-dump.d.ts.map +0 -1
  145. package/dist/lib/utils/conversion-dump.js +0 -257
  146. package/dist/lib/utils/file-utils.d.ts +0 -57
  147. package/dist/lib/utils/file-utils.d.ts.map +0 -1
  148. package/dist/lib/utils/file-utils.js +0 -140
  149. package/dist/lib/utils/geometry-utils.d.ts +0 -9
  150. package/dist/lib/utils/geometry-utils.d.ts.map +0 -1
  151. package/dist/lib/utils/geometry-utils.js +0 -14
  152. package/dist/lib/utils/lod-conversion-utils.d.ts +0 -42
  153. package/dist/lib/utils/lod-conversion-utils.d.ts.map +0 -1
  154. package/dist/lib/utils/lod-conversion-utils.js +0 -71
  155. package/dist/lib/utils/queue.d.ts +0 -7
  156. package/dist/lib/utils/queue.d.ts.map +0 -1
  157. package/dist/lib/utils/queue.js +0 -14
  158. package/dist/lib/utils/statistic-utils.d.ts +0 -20
  159. package/dist/lib/utils/statistic-utils.d.ts.map +0 -1
  160. package/dist/lib/utils/statistic-utils.js +0 -88
  161. package/dist/lib/utils/write-queue.d.ts +0 -44
  162. package/dist/lib/utils/write-queue.d.ts.map +0 -1
  163. package/dist/lib/utils/write-queue.js +0 -82
  164. package/dist/pgm-loader.d.ts +0 -28
  165. package/dist/pgm-loader.d.ts.map +0 -1
  166. package/dist/pgm-loader.js +0 -24
@@ -1,269 +0,0 @@
1
- import { join } from 'path';
2
- import transform from 'json-map-transform';
3
- import { v4 as uuidv4 } from 'uuid';
4
- import { openJson, writeFileForSlpk } from "../../lib/utils/file-utils.js";
5
- import { NODE as nodeTemplate } from "../json-templates/node.js";
6
- /**
7
- * Wrapper for https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DNodeIndexDocument.cmn.md data
8
- * The class allows working with 3DNodeIndexDocument in 2 modes:
9
- * in memory: the data is stored in `data` field
10
- * on disk: the data is written on disk in a file. The file can be rewritten when new childrend or neighbors have to be added
11
- */
12
- export class NodeIndexDocument {
13
- /** Node id */
14
- id;
15
- /** Id in node pages */
16
- inPageId;
17
- /** 3DNodeIndexDocument data */
18
- data = null;
19
- /** children */
20
- children = [];
21
- /** converter instance */
22
- converter;
23
- /**
24
- * Finalized property. It means that all child nodes are saved and their data
25
- * is unloaded
26
- */
27
- _finalized = false;
28
- get finalized() {
29
- return this._finalized;
30
- }
31
- /**
32
- * Constructor
33
- * @param id - id of the node in node pages
34
- * @param converter - converter instance
35
- */
36
- constructor(id, converter) {
37
- this.inPageId = id;
38
- this.id = id === 0 ? 'root' : id.toString();
39
- this.converter = converter;
40
- }
41
- /**
42
- * Add Node3DIndexDocument data to the node
43
- * @param data Node3DIndexDocument data
44
- * @returns this NodeIndexDocument instance (to recurring with constructor)
45
- */
46
- async addData(data) {
47
- if (this.converter.options.instantNodeWriting) {
48
- await this.write(data);
49
- }
50
- else {
51
- this.data = data;
52
- }
53
- return this;
54
- }
55
- /**
56
- * Add child node references
57
- * @param childNodes - child NodeIndexDocument instances
58
- */
59
- async addChildren(childNodes) {
60
- const newChildren = [];
61
- for (const node of childNodes) {
62
- const nodeData = await node.load();
63
- newChildren.push({
64
- id: node.id,
65
- href: `../${node.id}`,
66
- obb: nodeData.obb,
67
- mbs: nodeData.mbs
68
- });
69
- }
70
- this.children = this.children.concat(childNodes);
71
- let data = this.data;
72
- if (this.converter.options.instantNodeWriting) {
73
- data = await this.load();
74
- }
75
- if (data) {
76
- data.children = data.children ?? [];
77
- data.children = data.children.concat(newChildren);
78
- }
79
- if (this.converter.options.instantNodeWriting && data) {
80
- await this.write(data);
81
- }
82
- }
83
- /**
84
- * Add neighbors to child nodes of this node
85
- */
86
- async addNeighbors() {
87
- if (this.finalized) {
88
- return;
89
- }
90
- const nodeData = await this.load();
91
- for (const childNode of this.children) {
92
- const childNodeData = await childNode.load();
93
- childNodeData.neighbors = childNodeData.neighbors ?? [];
94
- // Don't do large amount of "neightbors" to avoid big memory consumption
95
- if (Number(nodeData?.children?.length) < 1000) {
96
- for (const neighbor of nodeData.children || []) {
97
- if (childNode.id === neighbor.id) {
98
- continue; // eslint-disable-line
99
- }
100
- childNodeData.neighbors.push({ ...neighbor });
101
- }
102
- }
103
- else {
104
- // eslint-disable-next-line no-console, no-undef
105
- console.warn(`Node ${childNode.id}: neighbors attribute is omited because of large number of neigbors`);
106
- delete childNodeData.neighbors;
107
- }
108
- if (this.converter.options.instantNodeWriting && childNodeData) {
109
- await childNode.write(childNodeData);
110
- }
111
- await childNode.save();
112
- }
113
- // The save after adding neighbors is the last one. Finalize the the node
114
- this.finalize();
115
- }
116
- /** Save 3DNodeIndexDocument in file on disk */
117
- async save() {
118
- if (this.data) {
119
- await this.write(this.data);
120
- }
121
- }
122
- /** Finalize the node */
123
- finalize() {
124
- this._finalized = true;
125
- for (const child of this.children) {
126
- child.flush();
127
- }
128
- }
129
- /**
130
- * Write 3DNodeIndexDocument https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DNodeIndexDocument.cmn.md
131
- * @param node - Node3DIndexDocument object
132
- */
133
- async write(node) {
134
- const path = join(this.converter.layers0Path, 'nodes', this.id);
135
- await this.converter.writeQueue.enqueue({
136
- archiveKey: `nodes/${this.id}/3dNodeIndexDocument.json.gz`,
137
- writePromise: () => writeFileForSlpk(path, JSON.stringify(node), '3dNodeIndexDocument.json', true, this.converter.compressList)
138
- }, true);
139
- }
140
- /**
141
- * Load 3DNodeIndexDocument data from file on disk
142
- * @returns 3DNodeIndexDocument object
143
- */
144
- async load() {
145
- if (this.data) {
146
- return this.data;
147
- }
148
- const path = this.id;
149
- const parentNodePath = join(this.converter.layers0Path, 'nodes', path);
150
- const parentNodeFileName = '3dNodeIndexDocument.json';
151
- return (await openJson(parentNodePath, parentNodeFileName));
152
- }
153
- /**
154
- * Unload the Node data
155
- */
156
- flush() {
157
- this.data = null;
158
- }
159
- /**
160
- * Create root node of the tree
161
- * @param boundingVolumes - MBS and OOB bounding volumes data
162
- * @param converter - I3SConverter instance
163
- * @returns instance of NodeIndexDocument
164
- */
165
- static async createRootNode(boundingVolumes, converter) {
166
- const rootData = NodeIndexDocument.createRootNodeIndexDocument(boundingVolumes);
167
- const rootNode = await new NodeIndexDocument(0, converter).addData(rootData);
168
- return rootNode;
169
- }
170
- /**
171
- * Create NodeIndexDocument instance
172
- * @param parentNode - parent NodeIndexDocument
173
- * @param boundingVolumes - MBS and OOB bounding volumes data
174
- * @param lodSelection - LOD metrics data
175
- * @param nodeInPage - node data in node pages
176
- * @param resources - resources extracted from gltf/b3dm file
177
- * @param converter - I3SConverter instance
178
- * @returns NodeIndexDocument instance
179
- */
180
- static async createNode({ parentNode, boundingVolumes, lodSelection, nodeInPage, resources, converter }) {
181
- const data = await NodeIndexDocument.createNodeIndexDocument(parentNode, boundingVolumes, lodSelection, nodeInPage, resources);
182
- const node = await new NodeIndexDocument(nodeInPage.index, converter).addData(data);
183
- return node;
184
- }
185
- /**
186
- * Form 3DNodeIndexDocument data for the root node
187
- * @param boundingVolumes - mbs and obb data about node's bounding volume
188
- * @return 3DNodeIndexDocument data https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DNodeIndexDocument.cmn.md
189
- */
190
- static createRootNodeIndexDocument(boundingVolumes) {
191
- const root0data = {
192
- version: `{${uuidv4().toUpperCase()}}`,
193
- id: 'root',
194
- level: 0,
195
- lodSelection: [
196
- {
197
- metricType: 'maxScreenThresholdSQ',
198
- maxError: 0
199
- },
200
- {
201
- metricType: 'maxScreenThreshold',
202
- maxError: 0
203
- }
204
- ],
205
- ...boundingVolumes,
206
- children: []
207
- };
208
- return transform(root0data, nodeTemplate());
209
- }
210
- /**
211
- * Create a new Node3DIndexDocument
212
- * @param parentNode - 3DNodeIndexDocument https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DNodeIndexDocument.cmn.md object of the parent node
213
- * @param boundingVolumes - Bounding volumes
214
- * @param lodSelection - Level of Details (LOD) metrics
215
- * @param nodeInPage - corresponding node object in a node page
216
- * @param resources - the node resources data
217
- * @param resources.texture - texture image
218
- * @param resources.attributes - feature attributes
219
- * @return 3DNodeIndexDocument https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DNodeIndexDocument.cmn.md object
220
- */
221
- // eslint-disable-next-line complexity
222
- static async createNodeIndexDocument(parentNode, boundingVolumes, lodSelection, nodeInPage, resources) {
223
- const nodeId = nodeInPage.index;
224
- const parentNodeData = await parentNode.load();
225
- const nodeData = {
226
- version: parentNodeData.version,
227
- id: nodeId.toString(),
228
- level: parentNodeData.level + 1,
229
- ...boundingVolumes,
230
- lodSelection,
231
- parentNode: {
232
- id: parentNode.id,
233
- href: `../${parentNode.id}`,
234
- mbs: parentNodeData.mbs,
235
- obb: parentNodeData.obb
236
- },
237
- children: [],
238
- neighbors: []
239
- };
240
- const node = transform(nodeData, nodeTemplate());
241
- if (nodeInPage.mesh) {
242
- node.geometryData = [{ href: './geometries/0' }];
243
- node.sharedResource = { href: './shared' };
244
- if (('texture' in resources && resources.texture) ||
245
- ('texelCountHint' in resources && resources.texelCountHint)) {
246
- node.textureData = [{ href: './textures/0' }, { href: './textures/1' }];
247
- }
248
- if (('attributes' in resources &&
249
- resources.attributes &&
250
- resources.attributes.length &&
251
- parentNode.converter.layers0?.attributeStorageInfo?.length) ||
252
- ('attributesCount' in resources &&
253
- resources.attributesCount &&
254
- parentNode.converter.layers0?.attributeStorageInfo?.length)) {
255
- const attributesLength = ('attributes' in resources ? resources.attributes?.length : resources.attributesCount) ||
256
- 0;
257
- node.attributeData = [];
258
- const minimumLength = attributesLength < parentNode.converter.layers0.attributeStorageInfo.length
259
- ? attributesLength
260
- : parentNode.converter.layers0.attributeStorageInfo.length;
261
- for (let index = 0; index < minimumLength; index++) {
262
- const folderName = parentNode.converter.layers0.attributeStorageInfo[index].key;
263
- node.attributeData.push({ href: `./attributes/${folderName}/0` });
264
- }
265
- }
266
- }
267
- return node;
268
- }
269
- }
@@ -1,156 +0,0 @@
1
- import { NodeInPage } from '@loaders.gl/i3s';
2
- import I3SConverter from "../i3s-converter.js";
3
- /**
4
- * class NodePages - wrapper of nodePages array
5
- *
6
- * @example
7
- * import {writeFile} from './helpers/write-file';
8
- *
9
- * // create an instance of the class
10
- * const nodePages = new NodePages(writeFile, HARDCODED_NODES_PER_PAGE);
11
- * ...
12
- * // push root node
13
- * const parent = await nodePages.push({
14
- lodThreshold: HARDCODED_MAX_SCREEN_THRESHOLD_SQ,
15
- obb: coordinates.obb,
16
- children: []
17
- });
18
- * ...
19
- * // push node with parent relation
20
- * const nodeInPage = {
21
- lodThreshold: HARDCODED_MAX_SCREEN_THRESHOLD_SQ,
22
- obb: coordinates.obb,
23
- children: [],
24
- mesh: {
25
- geometry: {
26
- definition: 0
27
- }
28
- }
29
- };
30
- * const node = await this.nodePages.push(nodeInPage, parent.index);
31
- * ...
32
- * // save all the nodePages in the end of pushing all the nodes
33
- * await this.nodePages.save(layers0path);
34
- */
35
- export default class NodePages {
36
- readonly nodesPerPage: number;
37
- nodesCounter: number;
38
- writeFile: (...args: any[]) => Promise<null | string>;
39
- converter: I3SConverter;
40
- readonly nodePages: {
41
- nodes: NodeInPage[];
42
- }[];
43
- readonly length: number;
44
- /**
45
- * @constructs
46
- * Create a nodePages instance.
47
- * @param writeFileFunc - function to save one nodePage into a file
48
- * @param nodesPerPage - length limit for one nodePage. An additional nodePage is created when this limit is met
49
- */
50
- constructor(writeFileFunc: any, nodesPerPage: number, converter: I3SConverter);
51
- /**
52
- * Setup function to save node pages
53
- * @param func - function which should be used to save node pages
54
- */
55
- useWriteFunction(func: (...args: any[]) => Promise<null | string>): void;
56
- /**
57
- * Get file path and file name of the node page with the particular id
58
- * @param nodePageId - node page id
59
- * @returns file path and file name
60
- */
61
- private getNodePageFileName;
62
- /**
63
- * Load node page from a file on the disk
64
- * @param nodePageId - node page id
65
- * @returns - node page data
66
- */
67
- private loadNodePage;
68
- /**
69
- * Get nodepage id by node id
70
- * @param id node id
71
- * @returns node page id
72
- */
73
- private getPageIndexByNodeId;
74
- /**
75
- * Get node page data by node id
76
- * @param id node id
77
- * @returns node page data
78
- */
79
- private getPageByNodeId;
80
- /**
81
- * Get the node by its end-to-end index
82
- * @param id - end-to-end index of the node
83
- * @return the node object
84
- */
85
- getNodeById(id: number, nodePage?: {
86
- nodes: NodeInPage[];
87
- }): Promise<NodeInPage>;
88
- /**
89
- * Add a child id into the parent node.children array
90
- * @param parentId - end-to-end parent node index
91
- * @param childId - end-to-end child node index
92
- */
93
- private addChildRelation;
94
- /**
95
- * Put new node in nodePages array
96
- * @param node - node object
97
- * @param parentId - index of parent node
98
- * @return
99
- */
100
- push(node: NodeInPage, parentId?: number): Promise<NodeInPage>;
101
- /**
102
- * Save node to the file on the disk
103
- * @param node - node data
104
- */
105
- saveNode(node: NodeInPage): Promise<void>;
106
- /**
107
- * Save metadata file (for slpk only)
108
- */
109
- saveMetadata(): Promise<void>;
110
- /**
111
- * Save all the node pages
112
- * Run this method when all nodes is pushed in nodePages
113
- */
114
- save(): Promise<void>;
115
- /**
116
- * Update resource index in node.mesh object
117
- * @param node - node object
118
- */
119
- static updateResourceInMesh(node: NodeInPage): void;
120
- /**
121
- * Update all fields in the node excluding id
122
- * @param node - node object
123
- * @param data - NodeInPage data to replace original data
124
- */
125
- static updateAll(node: NodeInPage, data: NodeInPage): NodeInPage;
126
- /**
127
- * Update material in node.mesh object by node id
128
- * @param id - end-to-end index of the node
129
- * @param materialId - id from scene layer materialDefinitions
130
- */
131
- static updateMaterialByNodeId(node: NodeInPage, materialId: number): void;
132
- /**
133
- * Update vertexCount in node.mesh.geometry object by node id
134
- * @param id - end-to-end index of the node
135
- * @param vertexCount - vertex count for particular node
136
- */
137
- static updateVertexCountByNodeId(node: NodeInPage, vertexCount: number): void;
138
- /**
139
- * Update resource in node.mesh.attribute object by node id
140
- * @param node - node object
141
- */
142
- static updateNodeAttributeByNodeId(node: NodeInPage): void;
143
- /**
144
- * Update featureCount in node.mesh.geometry object by node id
145
- * @param node - node object
146
- * @param featureCount - features count of the node
147
- */
148
- static updateFeatureCountByNodeId(node: NodeInPage, featureCount: number): void;
149
- /**
150
- * Update texelCountHint in node.mesh.material object by node id
151
- * @param node - node object
152
- * @param texelCountHint - texelCountHint of particular node
153
- */
154
- static updateTexelCountHintByNodeId(node: NodeInPage, texelCountHint: number): void;
155
- }
156
- //# sourceMappingURL=node-pages.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"node-pages.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/node-pages.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,UAAU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