@loaders.gl/tile-converter 4.2.0-alpha.3 → 4.2.0-alpha.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/3d-tiles-converter/3d-tiles-converter.d.ts +3 -3
- package/dist/3d-tiles-converter/3d-tiles-converter.d.ts.map +1 -1
- package/dist/3d-tiles-converter/3d-tiles-converter.js +329 -293
- package/dist/3d-tiles-converter/helpers/b3dm-converter.js +257 -200
- package/dist/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js +14 -5
- package/dist/3d-tiles-converter/helpers/load-i3s.js +106 -75
- package/dist/3d-tiles-converter/helpers/texture-atlas.js +44 -21
- package/dist/3d-tiles-converter/json-templates/tileset.js +32 -33
- package/dist/constants.js +0 -1
- package/dist/converter-cli.js +255 -234
- package/dist/converter.min.cjs +80 -90
- package/dist/deps-installer/deps-installer.js +73 -59
- package/dist/i3s-converter/helpers/attribute-metadata-info.js +207 -153
- package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts +1 -1
- package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/batch-ids-extensions.js +145 -103
- package/dist/i3s-converter/helpers/coordinate-converter.js +100 -65
- package/dist/i3s-converter/helpers/create-scene-server-path.js +14 -9
- package/dist/i3s-converter/helpers/feature-attributes.js +168 -105
- package/dist/i3s-converter/helpers/geometry-attributes.d.ts +1 -1
- package/dist/i3s-converter/helpers/geometry-attributes.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/geometry-attributes.js +204 -212
- package/dist/i3s-converter/helpers/geometry-converter.d.ts +2 -2
- package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/geometry-converter.js +1148 -829
- package/dist/i3s-converter/helpers/gltf-attributes.d.ts +1 -1
- package/dist/i3s-converter/helpers/gltf-attributes.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/gltf-attributes.js +111 -97
- package/dist/i3s-converter/helpers/load-3d-tiles.js +103 -66
- package/dist/i3s-converter/helpers/node-debug.js +98 -54
- package/dist/i3s-converter/helpers/node-index-document.d.ts +3 -3
- package/dist/i3s-converter/helpers/node-index-document.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/node-index-document.js +248 -177
- package/dist/i3s-converter/helpers/node-pages.d.ts +1 -1
- package/dist/i3s-converter/helpers/node-pages.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/node-pages.js +299 -194
- package/dist/i3s-converter/helpers/preprocess-3d-tiles.d.ts +1 -1
- package/dist/i3s-converter/helpers/preprocess-3d-tiles.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/preprocess-3d-tiles.js +92 -60
- package/dist/i3s-converter/helpers/progress.js +134 -83
- package/dist/i3s-converter/helpers/tileset-traversal.d.ts +1 -1
- package/dist/i3s-converter/helpers/tileset-traversal.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/tileset-traversal.js +24 -13
- package/dist/i3s-converter/i3s-converter.d.ts +7 -7
- package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
- package/dist/i3s-converter/i3s-converter.js +1044 -898
- package/dist/i3s-converter/json-templates/geometry-definitions.js +70 -79
- package/dist/i3s-converter/json-templates/layers.js +120 -121
- package/dist/i3s-converter/json-templates/metadata.js +19 -20
- package/dist/i3s-converter/json-templates/node.js +73 -71
- package/dist/i3s-converter/json-templates/scene-server.js +25 -26
- package/dist/i3s-converter/json-templates/shared-resources.js +107 -108
- package/dist/i3s-converter/json-templates/store.js +96 -94
- package/dist/i3s-converter/types.js +35 -23
- package/dist/i3s-server/app.js +15 -12
- package/dist/i3s-server/bin/www.js +14 -7
- package/dist/i3s-server/controllers/index-controller.js +18 -15
- package/dist/i3s-server/controllers/slpk-controller.js +22 -11
- package/dist/i3s-server/routes/index.js +9 -8
- package/dist/i3s-server/routes/slpk-router.js +18 -17
- package/dist/i3s-server/utils/create-scene-server.js +15 -10
- package/dist/i3s-server/utils/server-utils.js +49 -32
- package/dist/index.cjs +292 -851
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/lib/json-schemas/conversion-dump-json-schema.js +243 -421
- package/dist/lib/utils/cli-utils.js +63 -36
- package/dist/lib/utils/compress-util.js +20 -15
- package/dist/lib/utils/conversion-dump.d.ts +1 -1
- package/dist/lib/utils/conversion-dump.d.ts.map +1 -1
- package/dist/lib/utils/conversion-dump.js +209 -187
- package/dist/lib/utils/file-utils.js +122 -74
- package/dist/lib/utils/geometry-utils.js +13 -7
- package/dist/lib/utils/lod-conversion-utils.js +65 -33
- package/dist/lib/utils/queue.js +12 -13
- package/dist/lib/utils/statistic-utills.d.ts +6 -23
- package/dist/lib/utils/statistic-utills.js +64 -59
- package/dist/lib/utils/write-queue.d.ts +2 -2
- package/dist/lib/utils/write-queue.d.ts.map +1 -1
- package/dist/lib/utils/write-queue.js +68 -86
- package/dist/pgm-loader.js +17 -13
- package/dist/slpk-extractor/slpk-extractor.js +59 -50
- package/dist/slpk-extractor-cli.js +82 -59
- package/package.json +18 -18
- package/dist/3d-tiles-converter/3d-tiles-converter.js.map +0 -1
- package/dist/3d-tiles-converter/helpers/b3dm-converter.js.map +0 -1
- package/dist/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js.map +0 -1
- package/dist/3d-tiles-converter/helpers/load-i3s.js.map +0 -1
- package/dist/3d-tiles-converter/helpers/texture-atlas.js.map +0 -1
- package/dist/3d-tiles-converter/json-templates/tileset.js.map +0 -1
- package/dist/constants.js.map +0 -1
- package/dist/converter-cli.js.map +0 -1
- package/dist/deps-installer/deps-installer.js.map +0 -1
- package/dist/i3s-converter/helpers/attribute-metadata-info.js.map +0 -1
- package/dist/i3s-converter/helpers/batch-ids-extensions.js.map +0 -1
- package/dist/i3s-converter/helpers/coordinate-converter.js.map +0 -1
- package/dist/i3s-converter/helpers/create-scene-server-path.js.map +0 -1
- package/dist/i3s-converter/helpers/feature-attributes.js.map +0 -1
- package/dist/i3s-converter/helpers/geometry-attributes.js.map +0 -1
- package/dist/i3s-converter/helpers/geometry-converter.js.map +0 -1
- package/dist/i3s-converter/helpers/gltf-attributes.js.map +0 -1
- package/dist/i3s-converter/helpers/load-3d-tiles.js.map +0 -1
- package/dist/i3s-converter/helpers/node-debug.js.map +0 -1
- package/dist/i3s-converter/helpers/node-index-document.js.map +0 -1
- package/dist/i3s-converter/helpers/node-pages.js.map +0 -1
- package/dist/i3s-converter/helpers/preprocess-3d-tiles.js.map +0 -1
- package/dist/i3s-converter/helpers/progress.js.map +0 -1
- package/dist/i3s-converter/helpers/tileset-traversal.js.map +0 -1
- package/dist/i3s-converter/i3s-converter.js.map +0 -1
- package/dist/i3s-converter/json-templates/geometry-definitions.js.map +0 -1
- package/dist/i3s-converter/json-templates/layers.js.map +0 -1
- package/dist/i3s-converter/json-templates/metadata.js.map +0 -1
- package/dist/i3s-converter/json-templates/node.js.map +0 -1
- package/dist/i3s-converter/json-templates/scene-server.js.map +0 -1
- package/dist/i3s-converter/json-templates/shared-resources.js.map +0 -1
- package/dist/i3s-converter/json-templates/store.js.map +0 -1
- package/dist/i3s-converter/types.js.map +0 -1
- package/dist/i3s-server/README.md +0 -63
- package/dist/i3s-server/app.js.map +0 -1
- package/dist/i3s-server/bin/www.js.map +0 -1
- package/dist/i3s-server/certs/cert.pem +0 -19
- package/dist/i3s-server/certs/key.pem +0 -27
- package/dist/i3s-server/controllers/index-controller.js.map +0 -1
- package/dist/i3s-server/controllers/slpk-controller.js.map +0 -1
- package/dist/i3s-server/routes/index.js.map +0 -1
- package/dist/i3s-server/routes/slpk-router.js.map +0 -1
- package/dist/i3s-server/utils/create-scene-server.js.map +0 -1
- package/dist/i3s-server/utils/server-utils.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/json-schemas/conversion-dump-json-schema.js.map +0 -1
- package/dist/lib/utils/cli-utils.js.map +0 -1
- package/dist/lib/utils/compress-util.js.map +0 -1
- package/dist/lib/utils/conversion-dump.js.map +0 -1
- package/dist/lib/utils/file-utils.js.map +0 -1
- package/dist/lib/utils/geometry-utils.js.map +0 -1
- package/dist/lib/utils/lod-conversion-utils.js.map +0 -1
- package/dist/lib/utils/queue.js.map +0 -1
- package/dist/lib/utils/statistic-utills.js.map +0 -1
- package/dist/lib/utils/write-queue.js.map +0 -1
- package/dist/pgm-loader.js.map +0 -1
- package/dist/slpk-extractor/slpk-extractor.js.map +0 -1
- package/dist/slpk-extractor-cli.js.map +0 -1
|
@@ -1,92 +1,143 @@
|
|
|
1
1
|
import process from 'process';
|
|
2
2
|
import { timeConverter } from "../../lib/utils/statistic-utills.js";
|
|
3
|
+
/** Defines a threshold that is used to check if the process velocity can be consifered trust. */
|
|
3
4
|
const THRESHOLD_DEFAULT = 0.2;
|
|
5
|
+
/**
|
|
6
|
+
* Implements methods to keep track on the progress of a long process.
|
|
7
|
+
*/
|
|
4
8
|
export class Progress {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
get stepsDone() {
|
|
28
|
-
return this._stepsDone;
|
|
29
|
-
}
|
|
30
|
-
set stepsDone(stepsDone) {
|
|
31
|
-
this._stepsDone = stepsDone;
|
|
32
|
-
this.timeOfUpdatingStepsDone = this.getCurrentTimeInMilliSeconds();
|
|
33
|
-
if (this._stepsDone) {
|
|
34
|
-
const diff = this.timeOfUpdatingStepsDone - this.startTime;
|
|
35
|
-
const milliSecForOneStep = diff / this._stepsDone;
|
|
36
|
-
this.trust = this.isVelocityTrust(milliSecForOneStep, this.milliSecForOneStep);
|
|
37
|
-
this.milliSecForOneStep = milliSecForOneStep;
|
|
9
|
+
constructor(options = {}) {
|
|
10
|
+
/** Total amount of work, e.g. number of files to save or number of bytes to send */
|
|
11
|
+
this._stepsTotal = 0;
|
|
12
|
+
/** Amount of work already done */
|
|
13
|
+
this._stepsDone = 0;
|
|
14
|
+
/** Time in milli-seconds when the process started */
|
|
15
|
+
this.startTime = 0;
|
|
16
|
+
/** Time in milli-seconds when the process stopped */
|
|
17
|
+
this.stopTime = 0;
|
|
18
|
+
/** Time in milli-seconds when stepsDone was updated */
|
|
19
|
+
this.timeOfUpdatingStepsDone = 0;
|
|
20
|
+
/** Time in milli-seconds spent for performing one step*/
|
|
21
|
+
this.milliSecForOneStep = 0;
|
|
22
|
+
this.trust = false;
|
|
23
|
+
/**
|
|
24
|
+
* The number of digits to appear after decimal point in the string representation of the count of steps already done.
|
|
25
|
+
* It's calculated based on the total count of steps.
|
|
26
|
+
*/
|
|
27
|
+
this.numberOfDigitsInPercentage = 0;
|
|
28
|
+
this.getTime = options.getTime || process.hrtime.bigint;
|
|
29
|
+
this.threshold = options.threshold || THRESHOLD_DEFAULT;
|
|
38
30
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
this.milliSecForOneStep = 0;
|
|
43
|
-
this.trust = false;
|
|
44
|
-
this.timeOfUpdatingStepsDone = 0;
|
|
45
|
-
this.stopTime = 0;
|
|
46
|
-
this.stepsDone = 0;
|
|
47
|
-
}
|
|
48
|
-
stopMonitoring() {
|
|
49
|
-
this.stopTime = this.getCurrentTimeInMilliSeconds();
|
|
50
|
-
}
|
|
51
|
-
getPercent() {
|
|
52
|
-
if (!this._stepsTotal) {
|
|
53
|
-
return null;
|
|
31
|
+
/** Total amount of work, e.g. number of files to save or number of bytes to send */
|
|
32
|
+
get stepsTotal() {
|
|
33
|
+
return this._stepsTotal;
|
|
54
34
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const percent = this.getPercent();
|
|
60
|
-
return percent !== null ? percent.toFixed(this.numberOfDigitsInPercentage) : '';
|
|
61
|
-
}
|
|
62
|
-
getTimeCurrentlyElapsed() {
|
|
63
|
-
const currentTime = this.stopTime ? this.stopTime : this.getCurrentTimeInMilliSeconds();
|
|
64
|
-
const diff = currentTime - this.startTime;
|
|
65
|
-
return diff;
|
|
66
|
-
}
|
|
67
|
-
getTimeRemaining() {
|
|
68
|
-
if (!this._stepsTotal || !this._stepsDone || !this.startTime) {
|
|
69
|
-
return null;
|
|
35
|
+
set stepsTotal(stepsTotal) {
|
|
36
|
+
this._stepsTotal = stepsTotal;
|
|
37
|
+
this.numberOfDigitsInPercentage =
|
|
38
|
+
this.stepsTotal > 100 ? Math.ceil(Math.log10(this.stepsTotal)) - 2 : 0;
|
|
70
39
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
40
|
+
/** Amount of work already done */
|
|
41
|
+
get stepsDone() {
|
|
42
|
+
return this._stepsDone;
|
|
43
|
+
}
|
|
44
|
+
set stepsDone(stepsDone) {
|
|
45
|
+
this._stepsDone = stepsDone;
|
|
46
|
+
this.timeOfUpdatingStepsDone = this.getCurrentTimeInMilliSeconds();
|
|
47
|
+
if (this._stepsDone) {
|
|
48
|
+
const diff = this.timeOfUpdatingStepsDone - this.startTime;
|
|
49
|
+
const milliSecForOneStep = diff / this._stepsDone;
|
|
50
|
+
this.trust = this.isVelocityTrust(milliSecForOneStep, this.milliSecForOneStep);
|
|
51
|
+
this.milliSecForOneStep = milliSecForOneStep;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Saves the current time as we start monitoring the process.
|
|
56
|
+
*/
|
|
57
|
+
startMonitoring() {
|
|
58
|
+
this.startTime = this.getCurrentTimeInMilliSeconds();
|
|
59
|
+
this.milliSecForOneStep = 0;
|
|
60
|
+
this.trust = false;
|
|
61
|
+
this.timeOfUpdatingStepsDone = 0;
|
|
62
|
+
this.stopTime = 0;
|
|
63
|
+
this.stepsDone = 0;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Saves the current time as we stop monitoring the process.
|
|
67
|
+
*/
|
|
68
|
+
stopMonitoring() {
|
|
69
|
+
this.stopTime = this.getCurrentTimeInMilliSeconds();
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Gets percentage of the work already done.
|
|
73
|
+
* @returns percentage of the work already done.
|
|
74
|
+
*/
|
|
75
|
+
getPercent() {
|
|
76
|
+
if (!this._stepsTotal) {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
const percent = (this._stepsDone / this._stepsTotal) * 100.0;
|
|
80
|
+
return percent;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Gets string representation of percentage of the work already done.
|
|
84
|
+
* @returns string representation of percentage or an empty string if the percetage value cannot be calculated.
|
|
85
|
+
*/
|
|
86
|
+
getPercentString() {
|
|
87
|
+
const percent = this.getPercent();
|
|
88
|
+
return percent !== null ? percent.toFixed(this.numberOfDigitsInPercentage) : '';
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Gets the time elapsed since the monitoring started
|
|
92
|
+
* @returns Number of milliseconds elapsed
|
|
93
|
+
*/
|
|
94
|
+
getTimeCurrentlyElapsed() {
|
|
95
|
+
const currentTime = this.stopTime ? this.stopTime : this.getCurrentTimeInMilliSeconds();
|
|
96
|
+
const diff = currentTime - this.startTime;
|
|
97
|
+
return diff;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Gets the time remaining (expected at the moment of updating 'stepsDone') to complete the work.
|
|
101
|
+
* @returns Number of milliseconds remaining
|
|
102
|
+
*/
|
|
103
|
+
getTimeRemaining() {
|
|
104
|
+
if (!this._stepsTotal || !this._stepsDone || !this.startTime) {
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
const timeRemainingInMilliSeconds = (this._stepsTotal - this._stepsDone) * this.milliSecForOneStep;
|
|
108
|
+
return { timeRemaining: timeRemainingInMilliSeconds, trust: this.trust };
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Gets the string representation of the time remaining (expected at the moment of updating 'stepsDone') to complete the work.
|
|
112
|
+
* @returns string representation of the time remaining.
|
|
113
|
+
* It's an empty string if the time cannot be pedicted or it's still being calculated.
|
|
114
|
+
*/
|
|
115
|
+
getTimeRemainingString() {
|
|
116
|
+
const timeRemainingObject = this.getTimeRemaining();
|
|
117
|
+
return timeRemainingObject?.trust ? timeConverter(timeRemainingObject.timeRemaining) : '';
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Check if the computed velociy of the process can be considered trust.
|
|
121
|
+
* At the beginning of the process the number of samples collected ('time necessary to perform one step' averaged) is too small,
|
|
122
|
+
* which results in huge deviation of the cumputed velocity of the process.
|
|
123
|
+
* It makes sense to perform the check before reporting the time remainig so the end user is not confused.
|
|
124
|
+
* @param current - current value
|
|
125
|
+
* @param previous - previous value
|
|
126
|
+
* @returns true if the computed velociy can be considered trust, or false otherwise
|
|
127
|
+
*/
|
|
128
|
+
isVelocityTrust(current, previous) {
|
|
129
|
+
if (previous) {
|
|
130
|
+
const dev = Math.abs((current - previous) / previous);
|
|
131
|
+
return dev < this.threshold;
|
|
132
|
+
}
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Gets current time in milliseconds.
|
|
137
|
+
* @returns current time in milliseconds.
|
|
138
|
+
*/
|
|
139
|
+
getCurrentTimeInMilliSeconds() {
|
|
140
|
+
// process.hrtime.bigint() returns the time in nanoseconds. We need the time in milliseconds.
|
|
141
|
+
return Number(this.getTime() / BigInt(1e6));
|
|
85
142
|
}
|
|
86
|
-
return false;
|
|
87
|
-
}
|
|
88
|
-
getCurrentTimeInMilliSeconds() {
|
|
89
|
-
return Number(this.getTime() / BigInt(1e6));
|
|
90
|
-
}
|
|
91
143
|
}
|
|
92
|
-
//# sourceMappingURL=progress.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Tiles3DTileJSONPostprocessed } from '@loaders.gl/3d-tiles';
|
|
2
|
-
import { NodeIndexDocument } from
|
|
2
|
+
import { NodeIndexDocument } from "./node-index-document.js";
|
|
3
3
|
import { Matrix4 } from '@math.gl/core';
|
|
4
4
|
/** Traversal props for the conversion stage */
|
|
5
5
|
export type TraversalConversionProps = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tileset-traversal.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/tileset-traversal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,4BAA4B,EAAC,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAC,iBAAiB,EAAC,
|
|
1
|
+
{"version":3,"file":"tileset-traversal.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/tileset-traversal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,4BAA4B,EAAC,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAC,iBAAiB,EAAC,iCAA8B;AACxD,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAC;AAEtC,+CAA+C;AAC/C,MAAM,MAAM,wBAAwB,GAAG;IACrC,kDAAkD;IAClD,SAAS,EAAE,OAAO,CAAC;IACnB,0GAA0G;IAC1G,WAAW,EAAE,iBAAiB,EAAE,CAAC;CAClC,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,mBAAmB,iBACxB,4BAA4B,8CAEd,4BAA4B,8HAC+B,QAAQ,IAAI,CAAC,0BACjF,MAAM,qBAEhB,QAAQ,IAAI,CAkBd,CAAC"}
|
|
@@ -1,14 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Travesal of 3DTile tiles tree with making specific actions with each tile
|
|
3
|
+
* @param tile - 3DTiles tile JSON metadata
|
|
4
|
+
* @param traversalProps - traversal props used to pass data through recursive calls
|
|
5
|
+
* @param processTile - callback to make some actions with the current tile
|
|
6
|
+
* @param postprocessTile - callback to make some action after processing of the current tile and all the subtree
|
|
7
|
+
* @param maxDepth - max recursive calls number the travesal function will do. If not set, the traversal function will
|
|
8
|
+
* go through all the tree.
|
|
9
|
+
* This value is used to limit the convertion with only partial number of levels of the tileset
|
|
10
|
+
* @param level - counter to keep recursive calls number of the tiles tree. This value used to be able to break
|
|
11
|
+
* traversal at the some level of the tree
|
|
12
|
+
* @returns void
|
|
13
|
+
*/
|
|
14
|
+
export const traverseDatasetWith = async (tile, traversalProps, processTile, postprocessTile, maxDepth, level = 0) => {
|
|
15
|
+
if (maxDepth && level > maxDepth) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const processResults = [];
|
|
19
|
+
const newTraversalProps = await processTile(tile, traversalProps);
|
|
20
|
+
processResults.push(newTraversalProps);
|
|
21
|
+
for (const childTile of tile.children) {
|
|
22
|
+
await traverseDatasetWith(childTile, newTraversalProps, processTile, postprocessTile, maxDepth, level + 1);
|
|
23
|
+
}
|
|
24
|
+
postprocessTile && (await postprocessTile(processResults, traversalProps));
|
|
13
25
|
};
|
|
14
|
-
//# sourceMappingURL=tileset-traversal.js.map
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { AttributeMetadataInfo } from
|
|
1
|
+
import { AttributeMetadataInfo } from "./helpers/attribute-metadata-info.js";
|
|
2
2
|
import type { Tiles3DLoaderOptions, Tiles3DTilesetJSONPostprocessed } from '@loaders.gl/3d-tiles';
|
|
3
|
-
import type { WriteQueueItem } from
|
|
3
|
+
import type { WriteQueueItem } from "../lib/utils/write-queue.js";
|
|
4
4
|
import type { SceneLayer3D } from '@loaders.gl/i3s';
|
|
5
5
|
import { Geoid } from '@math.gl/geoid';
|
|
6
|
-
import NodePages from
|
|
6
|
+
import NodePages from "./helpers/node-pages.js";
|
|
7
7
|
import { LoaderWithParser } from '@loaders.gl/loader-utils';
|
|
8
8
|
import { I3SMaterialDefinition } from '@loaders.gl/i3s';
|
|
9
|
-
import { PreprocessData } from
|
|
10
|
-
import WriteQueue from
|
|
11
|
-
import { Progress } from
|
|
12
|
-
import { ConversionDump } from
|
|
9
|
+
import { PreprocessData } from "./types.js";
|
|
10
|
+
import WriteQueue from "../lib/utils/write-queue.js";
|
|
11
|
+
import { Progress } from "./helpers/progress.js";
|
|
12
|
+
import { ConversionDump } from "../lib/utils/conversion-dump.js";
|
|
13
13
|
/**
|
|
14
14
|
* Converter from 3d-tiles tileset to i3s layer
|
|
15
15
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i3s-converter.d.ts","sourceRoot":"","sources":["../../src/i3s-converter/i3s-converter.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,qBAAqB,EAAC,
|
|
1
|
+
{"version":3,"file":"i3s-converter.d.ts","sourceRoot":"","sources":["../../src/i3s-converter/i3s-converter.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,qBAAqB,EAAC,6CAA0C;AAExE,OAAO,KAAK,EAEV,oBAAoB,EAGpB,+BAA+B,EAChC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAC,cAAc,EAAC,oCAAiC;AAC7D,OAAO,KAAK,EACV,YAAY,EAMb,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAC,KAAK,EAAC,MAAM,gBAAgB,CAAC;AAOrC,OAAO,SAAS,gCAA6B;AAkB7C,OAAO,EAAC,gBAAgB,EAAC,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAC,qBAAqB,EAA8B,MAAM,iBAAiB,CAAC;AAGnF,OAAO,EAGL,cAAc,EAGf,m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