@inweb/viewer-visualize 25.3.17 → 25.3.19
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/viewer-visualize.js +143 -131
- package/dist/viewer-visualize.js.map +1 -1
- package/dist/viewer-visualize.min.js +1 -1
- package/dist/viewer-visualize.module.js +156 -139
- package/dist/viewer-visualize.module.js.map +1 -1
- package/lib/ConvetMath.d.ts +28 -0
- package/lib/Viewer/Loaders/BaseLoader.d.ts +3 -3
- package/lib/Viewer/Loaders/LoaderFactory.d.ts +2 -2
- package/lib/Viewer/Viewer.d.ts +3 -3
- package/lib/index.d.ts +1 -1
- package/package.json +4 -4
- package/src/ConvetMath.ts +372 -0
- package/src/Viewer/Loaders/BaseLoader.ts +3 -3
- package/src/Viewer/Loaders/LoaderFactory.ts +3 -2
- package/src/Viewer/Loaders/TCSLoader.ts +1 -1
- package/src/Viewer/Loaders/VsfXLoader.ts +13 -5
- package/src/Viewer/Loaders/VsfXPartialLoader.ts +47 -48
- package/src/Viewer/Loaders/VsfXStreamingLoader.ts +5 -5
- package/src/Viewer/Viewer.ts +8 -8
- package/src/index.ts +1 -1
package/dist/viewer-visualize.js
CHANGED
|
@@ -65,54 +65,62 @@
|
|
|
65
65
|
|
|
66
66
|
commands("ThreeJS").registerCommand("noop", (() => {}));
|
|
67
67
|
|
|
68
|
+
function defaultOptions() {
|
|
69
|
+
return {
|
|
70
|
+
showWCS: true,
|
|
71
|
+
cameraAnimation: true,
|
|
72
|
+
antialiasing: true,
|
|
73
|
+
groundShadow: false,
|
|
74
|
+
shadows: false,
|
|
75
|
+
cameraAxisXSpeed: 4,
|
|
76
|
+
cameraAxisYSpeed: 1,
|
|
77
|
+
ambientOcclusion: false,
|
|
78
|
+
enableStreamingMode: true,
|
|
79
|
+
enablePartialMode: false,
|
|
80
|
+
memoryLimit: 3294967296,
|
|
81
|
+
cuttingPlaneFillColor: {
|
|
82
|
+
red: 255,
|
|
83
|
+
green: 152,
|
|
84
|
+
blue: 0
|
|
85
|
+
},
|
|
86
|
+
edgesColor: {
|
|
87
|
+
r: 255,
|
|
88
|
+
g: 152,
|
|
89
|
+
b: 0
|
|
90
|
+
},
|
|
91
|
+
facesColor: {
|
|
92
|
+
r: 255,
|
|
93
|
+
g: 152,
|
|
94
|
+
b: 0
|
|
95
|
+
},
|
|
96
|
+
edgesVisibility: true,
|
|
97
|
+
edgesOverlap: true,
|
|
98
|
+
facesOverlap: false,
|
|
99
|
+
facesTransparancy: 200,
|
|
100
|
+
enableCustomHighlight: true,
|
|
101
|
+
sceneGraph: false,
|
|
102
|
+
edgeModel: true,
|
|
103
|
+
reverseZoomWheel: false,
|
|
104
|
+
enableZoomWheel: true,
|
|
105
|
+
enableGestures: true,
|
|
106
|
+
geometryType: "vsfx"
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
|
|
68
110
|
class Options {
|
|
69
111
|
constructor(emitter) {
|
|
70
112
|
this._emitter = emitter;
|
|
71
|
-
this._data =
|
|
113
|
+
this._data = defaultOptions();
|
|
72
114
|
this.loadFromStorage();
|
|
73
115
|
}
|
|
74
116
|
static defaults() {
|
|
75
|
-
return
|
|
76
|
-
showWCS: true,
|
|
77
|
-
cameraAnimation: true,
|
|
78
|
-
antialiasing: true,
|
|
79
|
-
groundShadow: false,
|
|
80
|
-
shadows: false,
|
|
81
|
-
cameraAxisXSpeed: 4,
|
|
82
|
-
cameraAxisYSpeed: 1,
|
|
83
|
-
ambientOcclusion: false,
|
|
84
|
-
enableStreamingMode: true,
|
|
85
|
-
enablePartialMode: false,
|
|
86
|
-
memoryLimit: 3294967296,
|
|
87
|
-
cuttingPlaneFillColor: {
|
|
88
|
-
red: 255,
|
|
89
|
-
green: 152,
|
|
90
|
-
blue: 0
|
|
91
|
-
},
|
|
92
|
-
edgesColor: {
|
|
93
|
-
r: 255,
|
|
94
|
-
g: 152,
|
|
95
|
-
b: 0
|
|
96
|
-
},
|
|
97
|
-
facesColor: {
|
|
98
|
-
r: 255,
|
|
99
|
-
g: 152,
|
|
100
|
-
b: 0
|
|
101
|
-
},
|
|
102
|
-
edgesVisibility: true,
|
|
103
|
-
edgesOverlap: true,
|
|
104
|
-
facesOverlap: false,
|
|
105
|
-
facesTransparancy: 200,
|
|
106
|
-
enableCustomHighlight: true,
|
|
107
|
-
sceneGraph: false,
|
|
108
|
-
edgeModel: true,
|
|
109
|
-
reverseZoomWheel: false,
|
|
110
|
-
enableZoomWheel: true,
|
|
111
|
-
enableGestures: true,
|
|
112
|
-
geometryType: "vsfx"
|
|
113
|
-
};
|
|
117
|
+
return defaultOptions();
|
|
114
118
|
}
|
|
115
119
|
notifierChangeEvent() {
|
|
120
|
+
console.warn("Options.notifierChangeEvent() has been deprecated since 25.3 and will be removed in a future release, use Options.change() instead.");
|
|
121
|
+
this.change();
|
|
122
|
+
}
|
|
123
|
+
change() {
|
|
116
124
|
if (this._emitter !== undefined) {
|
|
117
125
|
this.saveToStorage();
|
|
118
126
|
this._emitter.emit({
|
|
@@ -163,151 +171,154 @@
|
|
|
163
171
|
return this._data;
|
|
164
172
|
}
|
|
165
173
|
set data(value) {
|
|
166
|
-
const
|
|
174
|
+
const enablePartialMode = value.enableStreamingMode ? value.enablePartialMode : false;
|
|
175
|
+
const sceneGraph = enablePartialMode ? false : value.sceneGraph;
|
|
167
176
|
this._data = {
|
|
168
177
|
...Options.defaults(),
|
|
169
178
|
...this._data,
|
|
170
179
|
...value,
|
|
180
|
+
enablePartialMode: enablePartialMode,
|
|
171
181
|
sceneGraph: sceneGraph
|
|
172
182
|
};
|
|
173
|
-
this.
|
|
183
|
+
this.change();
|
|
174
184
|
}
|
|
175
185
|
get showWCS() {
|
|
176
186
|
return this._data.showWCS;
|
|
177
187
|
}
|
|
178
188
|
set showWCS(value) {
|
|
179
189
|
this._data.showWCS = value;
|
|
180
|
-
this.
|
|
190
|
+
this.change();
|
|
181
191
|
}
|
|
182
192
|
get cameraAnimation() {
|
|
183
193
|
return this._data.cameraAnimation;
|
|
184
194
|
}
|
|
185
195
|
set cameraAnimation(value) {
|
|
186
196
|
this._data.cameraAnimation = value;
|
|
187
|
-
this.
|
|
197
|
+
this.change();
|
|
188
198
|
}
|
|
189
199
|
get antialiasing() {
|
|
190
200
|
return this._data.antialiasing;
|
|
191
201
|
}
|
|
192
202
|
set antialiasing(value) {
|
|
193
203
|
this._data.antialiasing = value;
|
|
194
|
-
this.
|
|
204
|
+
this.change();
|
|
195
205
|
}
|
|
196
206
|
get groundShadow() {
|
|
197
207
|
return this._data.groundShadow;
|
|
198
208
|
}
|
|
199
209
|
set groundShadow(value) {
|
|
200
210
|
this._data.groundShadow = value;
|
|
201
|
-
this.
|
|
211
|
+
this.change();
|
|
202
212
|
}
|
|
203
213
|
get shadows() {
|
|
204
214
|
return this._data.shadows;
|
|
205
215
|
}
|
|
206
216
|
set shadows(value) {
|
|
207
217
|
this._data.shadows = value;
|
|
208
|
-
this.
|
|
218
|
+
this.change();
|
|
209
219
|
}
|
|
210
220
|
get cameraAxisXSpeed() {
|
|
211
221
|
return this._data.cameraAxisXSpeed;
|
|
212
222
|
}
|
|
213
223
|
set cameraAxisXSpeed(value) {
|
|
214
224
|
this._data.cameraAxisXSpeed = value;
|
|
215
|
-
this.
|
|
225
|
+
this.change();
|
|
216
226
|
}
|
|
217
227
|
get cameraAxisYSpeed() {
|
|
218
228
|
return this._data.cameraAxisYSpeed;
|
|
219
229
|
}
|
|
220
230
|
set cameraAxisYSpeed(value) {
|
|
221
231
|
this.cameraAxisYSpeed = value;
|
|
222
|
-
this.
|
|
232
|
+
this.change();
|
|
223
233
|
}
|
|
224
234
|
get ambientOcclusion() {
|
|
225
235
|
return this._data.ambientOcclusion;
|
|
226
236
|
}
|
|
227
237
|
set ambientOcclusion(value) {
|
|
228
238
|
this._data.ambientOcclusion = value;
|
|
229
|
-
this.
|
|
239
|
+
this.change();
|
|
230
240
|
}
|
|
231
241
|
get enableStreamingMode() {
|
|
232
242
|
return this._data.enableStreamingMode;
|
|
233
243
|
}
|
|
234
244
|
set enableStreamingMode(value) {
|
|
235
245
|
this._data.enableStreamingMode = value;
|
|
236
|
-
if (this._data.
|
|
237
|
-
|
|
238
|
-
}
|
|
239
|
-
this.notifierChangeEvent();
|
|
246
|
+
if (!value) this._data.enablePartialMode = false;
|
|
247
|
+
this.change();
|
|
240
248
|
}
|
|
241
249
|
get enablePartialMode() {
|
|
242
250
|
return this._data.enablePartialMode;
|
|
243
251
|
}
|
|
244
252
|
set enablePartialMode(value) {
|
|
245
253
|
this._data.enablePartialMode = value;
|
|
246
|
-
if (value)
|
|
247
|
-
|
|
254
|
+
if (value) {
|
|
255
|
+
this._data.enableStreamingMode = true;
|
|
256
|
+
this._data.sceneGraph = false;
|
|
257
|
+
}
|
|
258
|
+
this.change();
|
|
248
259
|
}
|
|
249
260
|
get memoryLimit() {
|
|
250
261
|
return this._data.memoryLimit;
|
|
251
262
|
}
|
|
252
263
|
set memoryLimit(value) {
|
|
253
264
|
this._data.memoryLimit = value;
|
|
254
|
-
this.
|
|
265
|
+
this.change();
|
|
255
266
|
}
|
|
256
267
|
get cuttingPlaneFillColor() {
|
|
257
268
|
return this._data.cuttingPlaneFillColor;
|
|
258
269
|
}
|
|
259
270
|
set cuttingPlaneFillColor(value) {
|
|
260
271
|
this._data.cuttingPlaneFillColor = value;
|
|
261
|
-
this.
|
|
272
|
+
this.change();
|
|
262
273
|
}
|
|
263
274
|
get edgesColor() {
|
|
264
275
|
return this._data.edgesColor;
|
|
265
276
|
}
|
|
266
277
|
set edgesColor(value) {
|
|
267
278
|
this._data.edgesColor = value;
|
|
268
|
-
this.
|
|
279
|
+
this.change();
|
|
269
280
|
}
|
|
270
281
|
get facesColor() {
|
|
271
282
|
return this._data.facesColor;
|
|
272
283
|
}
|
|
273
284
|
set facesColor(value) {
|
|
274
285
|
this._data.facesColor = value;
|
|
275
|
-
this.
|
|
286
|
+
this.change();
|
|
276
287
|
}
|
|
277
288
|
get edgesVisibility() {
|
|
278
289
|
return this._data.edgesVisibility;
|
|
279
290
|
}
|
|
280
291
|
set edgesVisibility(value) {
|
|
281
292
|
this._data.edgesVisibility = value;
|
|
282
|
-
this.
|
|
293
|
+
this.change();
|
|
283
294
|
}
|
|
284
295
|
get edgesOverlap() {
|
|
285
296
|
return this._data.edgesOverlap;
|
|
286
297
|
}
|
|
287
298
|
set edgesOverlap(value) {
|
|
288
299
|
this._data.edgesOverlap = value;
|
|
289
|
-
this.
|
|
300
|
+
this.change();
|
|
290
301
|
}
|
|
291
302
|
get facesOverlap() {
|
|
292
303
|
return this._data.facesOverlap;
|
|
293
304
|
}
|
|
294
305
|
set facesOverlap(value) {
|
|
295
306
|
this._data.facesOverlap = value;
|
|
296
|
-
this.
|
|
307
|
+
this.change();
|
|
297
308
|
}
|
|
298
309
|
get facesTransparancy() {
|
|
299
310
|
return this._data.facesTransparancy;
|
|
300
311
|
}
|
|
301
312
|
set facesTransparancy(value) {
|
|
302
313
|
this._data.facesTransparancy = value;
|
|
303
|
-
this.
|
|
314
|
+
this.change();
|
|
304
315
|
}
|
|
305
316
|
get enableCustomHighlight() {
|
|
306
317
|
return this._data.enableCustomHighlight;
|
|
307
318
|
}
|
|
308
319
|
set enableCustomHighlight(value) {
|
|
309
320
|
this._data.enableCustomHighlight = value;
|
|
310
|
-
this.
|
|
321
|
+
this.change();
|
|
311
322
|
}
|
|
312
323
|
get sceneGraph() {
|
|
313
324
|
return this._data.sceneGraph;
|
|
@@ -315,42 +326,42 @@
|
|
|
315
326
|
set sceneGraph(value) {
|
|
316
327
|
this._data.sceneGraph = value;
|
|
317
328
|
if (value) this._data.enablePartialMode = false;
|
|
318
|
-
this.
|
|
329
|
+
this.change();
|
|
319
330
|
}
|
|
320
331
|
get edgeModel() {
|
|
321
332
|
return Boolean(this._data.edgeModel);
|
|
322
333
|
}
|
|
323
334
|
set edgeModel(value) {
|
|
324
335
|
this._data.edgeModel = Boolean(value);
|
|
325
|
-
this.
|
|
336
|
+
this.change();
|
|
326
337
|
}
|
|
327
338
|
get reverseZoomWheel() {
|
|
328
339
|
return this._data.reverseZoomWheel;
|
|
329
340
|
}
|
|
330
341
|
set reverseZoomWheel(value) {
|
|
331
342
|
this._data.reverseZoomWheel = !!value;
|
|
332
|
-
this.
|
|
343
|
+
this.change();
|
|
333
344
|
}
|
|
334
345
|
get enableZoomWheel() {
|
|
335
346
|
return this._data.enableZoomWheel;
|
|
336
347
|
}
|
|
337
348
|
set enableZoomWheel(value) {
|
|
338
349
|
this._data.enableZoomWheel = !!value;
|
|
339
|
-
this.
|
|
350
|
+
this.change();
|
|
340
351
|
}
|
|
341
352
|
get enableGestures() {
|
|
342
353
|
return this._data.enableGestures;
|
|
343
354
|
}
|
|
344
355
|
set enableGestures(value) {
|
|
345
356
|
this._data.enableGestures = !!value;
|
|
346
|
-
this.
|
|
357
|
+
this.change();
|
|
347
358
|
}
|
|
348
359
|
get geometryType() {
|
|
349
360
|
return this._data.geometryType;
|
|
350
361
|
}
|
|
351
362
|
set geometryType(value) {
|
|
352
363
|
this._data.geometryType = value;
|
|
353
|
-
this.
|
|
364
|
+
this.change();
|
|
354
365
|
}
|
|
355
366
|
}
|
|
356
367
|
|
|
@@ -2777,10 +2788,10 @@
|
|
|
2777
2788
|
updaterController.initialize(this.viewer);
|
|
2778
2789
|
this.viewer._abortController = abortController;
|
|
2779
2790
|
let isFireDatabaseChunk = false;
|
|
2780
|
-
const chunkLoadHandler = (progress,
|
|
2791
|
+
const chunkLoadHandler = (progress, chunk) => {
|
|
2781
2792
|
if (!this.viewer.visualizeJs)
|
|
2782
2793
|
return;
|
|
2783
|
-
const status = visViewer.parseVsfx(
|
|
2794
|
+
const status = visViewer.parseVsfx(chunk);
|
|
2784
2795
|
updaterController.update(UpdateType.kDelay);
|
|
2785
2796
|
this.viewer.emitEvent({ type: "geometryprogress", data: progress, model: this.model });
|
|
2786
2797
|
let state = false;
|
|
@@ -2794,16 +2805,16 @@
|
|
|
2794
2805
|
this.viewer.syncOpenCloudVisualStyle(false);
|
|
2795
2806
|
this.viewer.syncOptions();
|
|
2796
2807
|
this.viewer.resize();
|
|
2797
|
-
this.viewer.emitEvent({ type: "databasechunk", data, model: this.model });
|
|
2808
|
+
this.viewer.emitEvent({ type: "databasechunk", data: chunk, model: this.model });
|
|
2798
2809
|
}
|
|
2799
2810
|
else {
|
|
2800
|
-
this.viewer.emitEvent({ type: "geometrychunk", data, model: this.model });
|
|
2811
|
+
this.viewer.emitEvent({ type: "geometrychunk", data: chunk, model: this.model });
|
|
2801
2812
|
}
|
|
2802
2813
|
};
|
|
2803
2814
|
console.time("File load time");
|
|
2804
2815
|
try {
|
|
2805
2816
|
this.viewer.emitEvent({ type: "geometrystart", model: this.model });
|
|
2806
|
-
await this.model.
|
|
2817
|
+
await this.model.downloadResource(this.model.database, chunkLoadHandler, abortController.signal);
|
|
2807
2818
|
console.timeEnd("File load time");
|
|
2808
2819
|
updaterController.update(UpdateType.kNormal);
|
|
2809
2820
|
this.viewer.emitEvent({ type: "geometryend", model: this.model });
|
|
@@ -2816,6 +2827,8 @@
|
|
|
2816
2827
|
}
|
|
2817
2828
|
|
|
2818
2829
|
///////////////////////////////////////////////////////////////////////////////
|
|
2830
|
+
const PENDING_REQUESTS_SIZE = 50;
|
|
2831
|
+
const PENDING_REQUESTS_TIMEOUT = 250;
|
|
2819
2832
|
class VsfXPartialLoader extends BaseLoader {
|
|
2820
2833
|
async load() {
|
|
2821
2834
|
if (!this.viewer.visualizeJs)
|
|
@@ -2826,8 +2839,6 @@
|
|
|
2826
2839
|
const abortControllerForRequestMap = new Map();
|
|
2827
2840
|
let servicePartAborted = false;
|
|
2828
2841
|
const pendingRequestsMap = new Map();
|
|
2829
|
-
const PENDING_REQUESTS_SIZE = 50;
|
|
2830
|
-
const PENDING_REQUESTS_TIMEOUT = 250;
|
|
2831
2842
|
let pendingRequestsTimerId = 0;
|
|
2832
2843
|
const pendingRequestsAbortHandler = () => clearTimeout(pendingRequestsTimerId);
|
|
2833
2844
|
const pendingRequestsAbortController = new AbortController();
|
|
@@ -2837,10 +2848,10 @@
|
|
|
2837
2848
|
this.viewer._abortController = abortController;
|
|
2838
2849
|
this.viewer._abortControllerForRequestMap = abortControllerForRequestMap;
|
|
2839
2850
|
visViewer.memoryLimit = this.options.memoryLimit;
|
|
2840
|
-
const
|
|
2851
|
+
const chunkLoadHandler = (progress, chunk, requestId = 0) => {
|
|
2841
2852
|
if (!this.viewer.visualizeJs)
|
|
2842
2853
|
return;
|
|
2843
|
-
const state = visViewer.parseVsfxInPartialMode(requestId,
|
|
2854
|
+
const state = visViewer.parseVsfxInPartialMode(requestId, chunk);
|
|
2844
2855
|
updaterController.update(UpdateType.kDelay);
|
|
2845
2856
|
this.viewer.emitEvent({ type: "geometryprogress", data: progress, model: this.model });
|
|
2846
2857
|
if (state) {
|
|
@@ -2848,41 +2859,39 @@
|
|
|
2848
2859
|
this.viewer.syncOpenCloudVisualStyle(false);
|
|
2849
2860
|
this.viewer.syncOptions();
|
|
2850
2861
|
this.viewer.resize();
|
|
2851
|
-
this.viewer.emitEvent({ type: "databasechunk", data, model: this.model });
|
|
2862
|
+
this.viewer.emitEvent({ type: "databasechunk", data: chunk, model: this.model });
|
|
2852
2863
|
}
|
|
2853
2864
|
else {
|
|
2854
|
-
this.viewer.emitEvent({ type: "geometrychunk", data, model: this.model });
|
|
2865
|
+
this.viewer.emitEvent({ type: "geometrychunk", data: chunk, model: this.model });
|
|
2855
2866
|
}
|
|
2856
2867
|
};
|
|
2857
|
-
const
|
|
2868
|
+
const downloadResourceRange = async (dataId, requestId, ranges) => {
|
|
2858
2869
|
const abortCtrl = new AbortController();
|
|
2859
2870
|
abortControllerForRequestMap.set(requestId, abortCtrl);
|
|
2860
2871
|
try {
|
|
2861
|
-
await this.model.
|
|
2872
|
+
await this.model.downloadResourceRange(dataId, ranges, requestId, chunkLoadHandler, abortCtrl.signal);
|
|
2862
2873
|
}
|
|
2863
2874
|
catch (error) {
|
|
2864
2875
|
this.viewer.emitEvent({ type: "geometryerror", data: error, model: this.model });
|
|
2865
2876
|
}
|
|
2866
2877
|
finally {
|
|
2867
|
-
|
|
2868
|
-
requests.forEach((requestId) => visViewer.onRequestResponseComplete(requestId));
|
|
2878
|
+
ranges.forEach((range) => visViewer.onRequestResponseComplete(range.requestId));
|
|
2869
2879
|
abortControllerForRequestMap.delete(requestId);
|
|
2870
2880
|
updaterController.update(UpdateType.kNormal);
|
|
2871
2881
|
}
|
|
2872
2882
|
};
|
|
2873
|
-
const
|
|
2874
|
-
const
|
|
2883
|
+
const requestRecordsToRanges = (requestId, records) => {
|
|
2884
|
+
const ranges = [];
|
|
2875
2885
|
for (let i = 0; i < records.size(); i++) {
|
|
2876
2886
|
const record = records.get(i);
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
begin: record.begin,
|
|
2880
|
-
end: record.end,
|
|
2881
|
-
size: parseInt(record.end, 10) - parseInt(record.begin, 10),
|
|
2887
|
+
ranges.push({
|
|
2888
|
+
requestId,
|
|
2889
|
+
begin: Number(record.begin),
|
|
2890
|
+
end: Number(record.end),
|
|
2882
2891
|
});
|
|
2883
2892
|
record.delete();
|
|
2884
2893
|
}
|
|
2885
|
-
return
|
|
2894
|
+
return ranges;
|
|
2886
2895
|
};
|
|
2887
2896
|
const objectHandler = {
|
|
2888
2897
|
onServicePartReceived: (bHasIndex) => {
|
|
@@ -2892,11 +2901,11 @@
|
|
|
2892
2901
|
}
|
|
2893
2902
|
},
|
|
2894
2903
|
onRequest: (requestId, records) => {
|
|
2895
|
-
|
|
2904
|
+
const ranges = requestRecordsToRanges(requestId, records);
|
|
2905
|
+
downloadResourceRange(this.model.database, requestId, ranges);
|
|
2896
2906
|
},
|
|
2897
2907
|
onFullLoaded: () => {
|
|
2898
2908
|
updaterController.update(UpdateType.kNormal);
|
|
2899
|
-
console.timeEnd("File load time");
|
|
2900
2909
|
},
|
|
2901
2910
|
onRequestResponseParsed: (requestId) => {
|
|
2902
2911
|
abortControllerForRequestMap.delete(requestId);
|
|
@@ -2907,44 +2916,43 @@
|
|
|
2907
2916
|
if (abortCtrl)
|
|
2908
2917
|
abortCtrl.abort();
|
|
2909
2918
|
},
|
|
2910
|
-
onRequestResourceFile:
|
|
2919
|
+
onRequestResourceFile: (requestId, _, records) => {
|
|
2911
2920
|
const dataId = `${this.model.fileId}${this.model.file.type}`;
|
|
2912
|
-
|
|
2913
|
-
let
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2921
|
+
const ranges = requestRecordsToRanges(requestId, records);
|
|
2922
|
+
let pendingRanges = [];
|
|
2923
|
+
let requestNumber = 0;
|
|
2924
|
+
const pendingRequest = pendingRequestsMap.get(dataId);
|
|
2925
|
+
if (pendingRequest) {
|
|
2926
|
+
pendingRanges = pendingRequest.ranges;
|
|
2927
|
+
requestNumber = pendingRequest.number;
|
|
2918
2928
|
}
|
|
2919
2929
|
// first several records of each file are processed without grouping (they usually require to be processed sequentially)
|
|
2920
|
-
if (
|
|
2921
|
-
pendingRequestsMap.set(dataId, {
|
|
2922
|
-
|
|
2930
|
+
if (requestNumber <= 5) {
|
|
2931
|
+
pendingRequestsMap.set(dataId, { ranges: [], number: requestNumber + 1 });
|
|
2932
|
+
downloadResourceRange(dataId, requestId, ranges);
|
|
2923
2933
|
return;
|
|
2924
2934
|
}
|
|
2935
|
+
pendingRanges = pendingRanges.concat(ranges);
|
|
2925
2936
|
// group requests to each file to launch a combined server request
|
|
2926
|
-
if (
|
|
2937
|
+
if (pendingRanges.length >= PENDING_REQUESTS_SIZE) {
|
|
2927
2938
|
if (pendingRequestsTimerId) {
|
|
2928
2939
|
window.clearTimeout(pendingRequestsTimerId);
|
|
2929
2940
|
pendingRequestsTimerId = 0;
|
|
2930
2941
|
}
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
else {
|
|
2935
|
-
pendingRequests = [...pendingRequests, ...recordsToArray(requestId, records)];
|
|
2942
|
+
pendingRequestsMap.set(dataId, { ranges: [], number: requestNumber + 1 });
|
|
2943
|
+
downloadResourceRange(dataId, requestId, pendingRanges);
|
|
2944
|
+
return;
|
|
2936
2945
|
}
|
|
2937
|
-
pendingRequestsMap.set(dataId, {
|
|
2946
|
+
pendingRequestsMap.set(dataId, { ranges: pendingRanges, number: requestNumber + 1 });
|
|
2938
2947
|
// set timeout to wait for the new requests, after that process the remaining requests
|
|
2939
2948
|
if (pendingRequestsTimerId === 0) {
|
|
2940
2949
|
pendingRequestsTimerId = window.setTimeout(() => {
|
|
2941
2950
|
pendingRequestsAbortController.signal.removeEventListener("abort", pendingRequestsAbortHandler);
|
|
2942
2951
|
pendingRequestsTimerId = 0;
|
|
2943
|
-
pendingRequestsMap.forEach((
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
pendingRequestsMap.set(keyFileName, { array: [], number: requestsRecord.number + 1 });
|
|
2952
|
+
pendingRequestsMap.forEach((request, dataId) => {
|
|
2953
|
+
if (request.ranges.length > 0) {
|
|
2954
|
+
pendingRequestsMap.set(dataId, { ranges: [], number: request.number + 1 });
|
|
2955
|
+
downloadResourceRange(dataId, requestId, request.ranges);
|
|
2948
2956
|
}
|
|
2949
2957
|
});
|
|
2950
2958
|
}, PENDING_REQUESTS_TIMEOUT);
|
|
@@ -2953,11 +2961,10 @@
|
|
|
2953
2961
|
},
|
|
2954
2962
|
};
|
|
2955
2963
|
visViewer.attachPartialResolver(objectHandler);
|
|
2956
|
-
console.time("File load time");
|
|
2957
2964
|
try {
|
|
2958
2965
|
this.viewer.emitEvent({ type: "geometrystart", model: this.model });
|
|
2959
2966
|
await this.model
|
|
2960
|
-
.
|
|
2967
|
+
.downloadResource(this.model.database, chunkLoadHandler, abortController.signal)
|
|
2961
2968
|
.catch((error) => {
|
|
2962
2969
|
if (!servicePartAborted)
|
|
2963
2970
|
throw error;
|
|
@@ -2984,22 +2991,25 @@
|
|
|
2984
2991
|
const visViewer = visLib.getViewer();
|
|
2985
2992
|
const abortController = new AbortController();
|
|
2986
2993
|
this.viewer._abortController = abortController;
|
|
2994
|
+
const chunkLoadHandler = (progress) => {
|
|
2995
|
+
this.viewer.emitEvent({ type: "geometryprogress", data: progress, model: this.model });
|
|
2996
|
+
};
|
|
2987
2997
|
console.time("File load time");
|
|
2988
2998
|
try {
|
|
2989
2999
|
this.viewer.emitEvent({ type: "geometrystart", model: this.model });
|
|
2990
|
-
const
|
|
2991
|
-
const arrayBuffer = await this.model.downloadResource(this.model.database, progressCb, abortController.signal);
|
|
3000
|
+
const arrayBuffer = await this.model.downloadResource(this.model.database, chunkLoadHandler, abortController.signal);
|
|
2992
3001
|
if (abortController.signal.aborted) {
|
|
2993
3002
|
await Promise.reject(new Error(`Open model aborted ${this.model.name}`));
|
|
2994
3003
|
}
|
|
3004
|
+
const data = new Uint8Array(arrayBuffer);
|
|
2995
3005
|
if (this.viewer.visualizeJs) {
|
|
2996
|
-
visViewer.parseVsfx(
|
|
2997
|
-
this.viewer.update(true);
|
|
3006
|
+
visViewer.parseVsfx(data);
|
|
2998
3007
|
this.viewer.syncOpenCloudVisualStyle(false);
|
|
2999
3008
|
this.viewer.syncOptions();
|
|
3000
3009
|
this.viewer.resize();
|
|
3001
3010
|
}
|
|
3002
3011
|
console.timeEnd("File load time");
|
|
3012
|
+
this.viewer.emitEvent({ type: "databasechunk", data, model: this.model });
|
|
3003
3013
|
this.viewer.emitEvent({ type: "geometryend", model: this.model });
|
|
3004
3014
|
}
|
|
3005
3015
|
catch (error) {
|
|
@@ -16662,9 +16672,9 @@
|
|
|
16662
16672
|
visualStyleId = visViewer.findVisualStyle("OpenCloud");
|
|
16663
16673
|
}
|
|
16664
16674
|
catch (e) {
|
|
16665
|
-
if (!isInitializing) {
|
|
16666
|
-
|
|
16667
|
-
}
|
|
16675
|
+
// if (!isInitializing) {
|
|
16676
|
+
// console.log("OpenCloud visual style not found, creating it on client side");
|
|
16677
|
+
// }
|
|
16668
16678
|
visualStyleId = visViewer.createVisualStyle("OpenCloud");
|
|
16669
16679
|
const colorDef = new visLib.OdTvColorDef(66, 66, 66);
|
|
16670
16680
|
const shadedVsId = visViewer.findVisualStyle("Realistic");
|
|
@@ -16684,7 +16694,7 @@
|
|
|
16684
16694
|
device.delete();
|
|
16685
16695
|
return this;
|
|
16686
16696
|
}
|
|
16687
|
-
syncOptions(options = this.options
|
|
16697
|
+
syncOptions(options = this.options) {
|
|
16688
16698
|
if (!this.visualizeJs)
|
|
16689
16699
|
return this;
|
|
16690
16700
|
const visLib = this.visLib();
|
|
@@ -16736,7 +16746,7 @@
|
|
|
16736
16746
|
this.update();
|
|
16737
16747
|
return this;
|
|
16738
16748
|
}
|
|
16739
|
-
syncHighlightingOptions(options = this.options
|
|
16749
|
+
syncHighlightingOptions(options = this.options) {
|
|
16740
16750
|
if (!this.visualizeJs)
|
|
16741
16751
|
return this;
|
|
16742
16752
|
const params = options.enableCustomHighlight ? options : Options.defaults();
|
|
@@ -17023,12 +17033,12 @@
|
|
|
17023
17033
|
throw new Error("No default model found");
|
|
17024
17034
|
const overrideOptions = new Options();
|
|
17025
17035
|
overrideOptions.data = this.options.data;
|
|
17026
|
-
if (file.type === ".rcs") {
|
|
17036
|
+
if (file.type === ".rcs" && !overrideOptions.enablePartialMode) {
|
|
17027
17037
|
console.log("Partial load mode is forced for RCS file");
|
|
17028
17038
|
overrideOptions.enablePartialMode = true;
|
|
17029
17039
|
}
|
|
17030
17040
|
const loaderFactory = new LoaderFactory();
|
|
17031
|
-
const loader = loaderFactory.create(this, model, overrideOptions
|
|
17041
|
+
const loader = loaderFactory.create(this, model, overrideOptions);
|
|
17032
17042
|
await this.loadReferences(model);
|
|
17033
17043
|
await loader.load();
|
|
17034
17044
|
if (this.visualizeJs) {
|
|
@@ -17283,10 +17293,12 @@
|
|
|
17283
17293
|
}
|
|
17284
17294
|
}
|
|
17285
17295
|
|
|
17296
|
+
exports.CANVAS_EVENTS = CANVAS_EVENTS;
|
|
17286
17297
|
exports.OdBaseDragger = OdBaseDragger;
|
|
17287
17298
|
exports.Options = Options;
|
|
17288
17299
|
exports.Viewer = Viewer;
|
|
17289
17300
|
exports.commands = commands;
|
|
17301
|
+
exports.defaultOptions = defaultOptions;
|
|
17290
17302
|
|
|
17291
17303
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
17292
17304
|
|