@inweb/viewer-visualize 25.3.18 → 25.3.20
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 +150 -147
- package/dist/viewer-visualize.js.map +1 -1
- package/dist/viewer-visualize.min.js +1 -1
- package/dist/viewer-visualize.module.js +167 -166
- 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 +3 -3
- package/lib/Viewer/Viewer.d.ts +4 -4
- package/lib/Viewer/utils.d.ts +2 -3
- package/lib/index.d.ts +1 -1
- package/package.json +4 -4
- package/src/ConvetMath.ts +373 -0
- package/src/Viewer/Loaders/BaseLoader.ts +3 -3
- package/src/Viewer/Loaders/LoaderFactory.ts +4 -3
- package/src/Viewer/Loaders/TCSLoader.ts +12 -12
- package/src/Viewer/Loaders/UpdaterController.ts +1 -0
- package/src/Viewer/Loaders/VsfXLoader.ts +1 -1
- package/src/Viewer/Loaders/VsfXPartialLoader.ts +5 -28
- package/src/Viewer/Loaders/VsfXStreamingLoader.ts +1 -1
- package/src/Viewer/Viewer.ts +16 -16
- package/src/Viewer/utils.ts +3 -12
- 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
|
|
|
@@ -669,27 +680,24 @@
|
|
|
669
680
|
|
|
670
681
|
class EventEmitter2 {
|
|
671
682
|
constructor() {
|
|
672
|
-
this._listeners =
|
|
683
|
+
this._listeners = {};
|
|
673
684
|
}
|
|
674
685
|
addEventListener(type, listener) {
|
|
675
|
-
if (this._listeners === undefined) this._listeners = {};
|
|
676
686
|
if (this._listeners[type] === undefined) this._listeners[type] = [];
|
|
677
687
|
this._listeners[type].push(listener);
|
|
678
688
|
return this;
|
|
679
689
|
}
|
|
680
690
|
removeEventListener(type, listener) {
|
|
681
|
-
if (this._listeners === undefined) return this;
|
|
682
691
|
if (this._listeners[type] === undefined) return this;
|
|
683
692
|
const listeners = this._listeners[type].filter((x => x !== listener));
|
|
684
|
-
this._listeners[type] = listeners
|
|
693
|
+
if (listeners.length !== 0) this._listeners[type] = listeners; else delete this._listeners[type];
|
|
685
694
|
return this;
|
|
686
695
|
}
|
|
687
696
|
removeAllListeners(type) {
|
|
688
|
-
if (type) this._listeners[type]
|
|
697
|
+
if (type) delete this._listeners[type]; else this._listeners = {};
|
|
689
698
|
return this;
|
|
690
699
|
}
|
|
691
700
|
emitEvent(event) {
|
|
692
|
-
if (this._listeners === undefined) return false;
|
|
693
701
|
if (this._listeners[event.type] === undefined) return false;
|
|
694
702
|
const invoke = this._listeners[event.type].slice();
|
|
695
703
|
invoke.forEach((listener => listener.call(this, event)));
|
|
@@ -2698,20 +2706,18 @@
|
|
|
2698
2706
|
const visLib = this.viewer.visLib();
|
|
2699
2707
|
const visViewer = visLib.getViewer();
|
|
2700
2708
|
const abortController = new AbortController();
|
|
2701
|
-
const
|
|
2702
|
-
const chunksProgress = listFileForDownload.map(() => 0);
|
|
2703
|
-
const calcProgress = (index, progress) => {
|
|
2704
|
-
chunksProgress[index] = progress;
|
|
2705
|
-
const fileProgress = chunksProgress.reduce((acc, progress) => (acc += progress)) / (chunksProgress.length || 1);
|
|
2706
|
-
this.viewer.emitEvent({ type: "geometryprogress", data: fileProgress, model: this.model });
|
|
2707
|
-
};
|
|
2709
|
+
const filesToDownload = [this.model.database, ...this.model.geometry];
|
|
2708
2710
|
this.viewer._abortController = abortController;
|
|
2711
|
+
console.time("File load time");
|
|
2709
2712
|
try {
|
|
2710
2713
|
this.viewer.emitEvent({ type: "geometrystart", model: this.model });
|
|
2711
|
-
for (let i = 0; i <
|
|
2712
|
-
const
|
|
2713
|
-
const
|
|
2714
|
-
|
|
2714
|
+
for (let i = 0; i < filesToDownload.length; i++) {
|
|
2715
|
+
const dataId = filesToDownload[i];
|
|
2716
|
+
const chunkLoadHandler = (progress) => {
|
|
2717
|
+
const data = (i + progress) / filesToDownload.length;
|
|
2718
|
+
this.viewer.emitEvent({ type: "geometryprogress", data, model: this.model });
|
|
2719
|
+
};
|
|
2720
|
+
const arrayBuffer = await this.model.downloadResource(dataId, chunkLoadHandler, abortController.signal);
|
|
2715
2721
|
if (abortController.signal.aborted) {
|
|
2716
2722
|
await Promise.reject(new Error(`Open model aborted ${this.model.name}`));
|
|
2717
2723
|
}
|
|
@@ -2729,6 +2735,44 @@
|
|
|
2729
2735
|
this.viewer.emitEvent({ type: "geometrychunk", data, model: this.model });
|
|
2730
2736
|
}
|
|
2731
2737
|
}
|
|
2738
|
+
console.timeEnd("File load time");
|
|
2739
|
+
this.viewer.emitEvent({ type: "geometryend", model: this.model });
|
|
2740
|
+
}
|
|
2741
|
+
catch (error) {
|
|
2742
|
+
this.viewer.emitEvent({ type: "geometryerror", data: error, model: this.model });
|
|
2743
|
+
throw error;
|
|
2744
|
+
}
|
|
2745
|
+
}
|
|
2746
|
+
}
|
|
2747
|
+
|
|
2748
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
2749
|
+
class VsfXLoader extends BaseLoader {
|
|
2750
|
+
async load() {
|
|
2751
|
+
if (!this.viewer.visualizeJs)
|
|
2752
|
+
return;
|
|
2753
|
+
const visLib = this.viewer.visLib();
|
|
2754
|
+
const visViewer = visLib.getViewer();
|
|
2755
|
+
const abortController = new AbortController();
|
|
2756
|
+
this.viewer._abortController = abortController;
|
|
2757
|
+
const chunkLoadHandler = (progress) => {
|
|
2758
|
+
this.viewer.emitEvent({ type: "geometryprogress", data: progress, model: this.model });
|
|
2759
|
+
};
|
|
2760
|
+
console.time("File load time");
|
|
2761
|
+
try {
|
|
2762
|
+
this.viewer.emitEvent({ type: "geometrystart", model: this.model });
|
|
2763
|
+
const arrayBuffer = await this.model.downloadResource(this.model.database, chunkLoadHandler, abortController.signal);
|
|
2764
|
+
if (abortController.signal.aborted) {
|
|
2765
|
+
await Promise.reject(new Error(`Open model aborted ${this.model.name}`));
|
|
2766
|
+
}
|
|
2767
|
+
const data = new Uint8Array(arrayBuffer);
|
|
2768
|
+
if (this.viewer.visualizeJs) {
|
|
2769
|
+
visViewer.parseVsfx(data);
|
|
2770
|
+
this.viewer.syncOpenCloudVisualStyle(false);
|
|
2771
|
+
this.viewer.syncOptions();
|
|
2772
|
+
this.viewer.resize();
|
|
2773
|
+
}
|
|
2774
|
+
console.timeEnd("File load time");
|
|
2775
|
+
this.viewer.emitEvent({ type: "databasechunk", data, model: this.model });
|
|
2732
2776
|
this.viewer.emitEvent({ type: "geometryend", model: this.model });
|
|
2733
2777
|
}
|
|
2734
2778
|
catch (error) {
|
|
@@ -2748,6 +2792,7 @@
|
|
|
2748
2792
|
})(UpdateType || (UpdateType = {}));
|
|
2749
2793
|
class UpdaterController {
|
|
2750
2794
|
constructor() {
|
|
2795
|
+
this.lastUpdate = 0;
|
|
2751
2796
|
this.delayUpdateTime = START_UPDATE_TIME;
|
|
2752
2797
|
}
|
|
2753
2798
|
initialize(viewer) {
|
|
@@ -2855,14 +2900,12 @@
|
|
|
2855
2900
|
}
|
|
2856
2901
|
};
|
|
2857
2902
|
const downloadResourceRange = async (dataId, requestId, ranges) => {
|
|
2858
|
-
console.log("--- VsfXPartialLoader.downloadResourceRange", dataId, requestId, ranges);
|
|
2859
2903
|
const abortCtrl = new AbortController();
|
|
2860
2904
|
abortControllerForRequestMap.set(requestId, abortCtrl);
|
|
2861
2905
|
try {
|
|
2862
|
-
await this.model.downloadResourceRange(dataId,
|
|
2906
|
+
await this.model.downloadResourceRange(dataId, requestId, ranges, chunkLoadHandler, abortCtrl.signal);
|
|
2863
2907
|
}
|
|
2864
2908
|
catch (error) {
|
|
2865
|
-
console.log("--- VsfXPartialLoader.downloadResourceRange error", dataId, requestId, error);
|
|
2866
2909
|
this.viewer.emitEvent({ type: "geometryerror", data: error, model: this.model });
|
|
2867
2910
|
}
|
|
2868
2911
|
finally {
|
|
@@ -2886,7 +2929,6 @@
|
|
|
2886
2929
|
};
|
|
2887
2930
|
const objectHandler = {
|
|
2888
2931
|
onServicePartReceived: (bHasIndex) => {
|
|
2889
|
-
console.log("--- VsfXPartialLoader.onServicePartReceived", bHasIndex);
|
|
2890
2932
|
if (bHasIndex) {
|
|
2891
2933
|
servicePartAborted = true;
|
|
2892
2934
|
abortController.abort();
|
|
@@ -2894,28 +2936,23 @@
|
|
|
2894
2936
|
},
|
|
2895
2937
|
onRequest: (requestId, records) => {
|
|
2896
2938
|
const ranges = requestRecordsToRanges(requestId, records);
|
|
2897
|
-
console.log("--- VsfXPartialLoader.onRequest", this.model.database, requestId, ranges);
|
|
2898
2939
|
downloadResourceRange(this.model.database, requestId, ranges);
|
|
2899
2940
|
},
|
|
2900
2941
|
onFullLoaded: () => {
|
|
2901
|
-
console.log("--- VsfXPartialLoader.onFullLoaded");
|
|
2902
2942
|
updaterController.update(UpdateType.kNormal);
|
|
2903
2943
|
},
|
|
2904
2944
|
onRequestResponseParsed: (requestId) => {
|
|
2905
|
-
console.log("--- VsfXPartialLoader.onRequestResponseParsed", requestId);
|
|
2906
2945
|
abortControllerForRequestMap.delete(requestId);
|
|
2907
2946
|
updaterController.update(UpdateType.kNormal);
|
|
2908
2947
|
},
|
|
2909
2948
|
onRequestAborted: (requestId) => {
|
|
2910
|
-
console.log("--- VsfXPartialLoader.onRequestAborted", requestId);
|
|
2911
2949
|
const abortCtrl = abortControllerForRequestMap.get(requestId);
|
|
2912
2950
|
if (abortCtrl)
|
|
2913
2951
|
abortCtrl.abort();
|
|
2914
2952
|
},
|
|
2915
|
-
onRequestResourceFile: (requestId,
|
|
2916
|
-
|
|
2953
|
+
onRequestResourceFile: (requestId, _, records) => {
|
|
2954
|
+
const dataId = `${this.model.fileId}${this.model.file.type}`;
|
|
2917
2955
|
const ranges = requestRecordsToRanges(requestId, records);
|
|
2918
|
-
console.log("--- VsfXPartialLoader.onRequestResourceFile", dataId, requestId, ranges);
|
|
2919
2956
|
let pendingRanges = [];
|
|
2920
2957
|
let requestNumber = 0;
|
|
2921
2958
|
const pendingRequest = pendingRequestsMap.get(dataId);
|
|
@@ -2925,7 +2962,6 @@
|
|
|
2925
2962
|
}
|
|
2926
2963
|
// first several records of each file are processed without grouping (they usually require to be processed sequentially)
|
|
2927
2964
|
if (requestNumber <= 5) {
|
|
2928
|
-
console.log("--- VsfXPartialLoader.onRequestResourceFile: requestNumber <= 5");
|
|
2929
2965
|
pendingRequestsMap.set(dataId, { ranges: [], number: requestNumber + 1 });
|
|
2930
2966
|
downloadResourceRange(dataId, requestId, ranges);
|
|
2931
2967
|
return;
|
|
@@ -2933,7 +2969,6 @@
|
|
|
2933
2969
|
pendingRanges = pendingRanges.concat(ranges);
|
|
2934
2970
|
// group requests to each file to launch a combined server request
|
|
2935
2971
|
if (pendingRanges.length >= PENDING_REQUESTS_SIZE) {
|
|
2936
|
-
console.log("--- VsfXPartialLoader.onRequestResourceFile: pendingRanges.length >", PENDING_REQUESTS_SIZE);
|
|
2937
2972
|
if (pendingRequestsTimerId) {
|
|
2938
2973
|
window.clearTimeout(pendingRequestsTimerId);
|
|
2939
2974
|
pendingRequestsTimerId = 0;
|
|
@@ -2946,7 +2981,6 @@
|
|
|
2946
2981
|
// set timeout to wait for the new requests, after that process the remaining requests
|
|
2947
2982
|
if (pendingRequestsTimerId === 0) {
|
|
2948
2983
|
pendingRequestsTimerId = window.setTimeout(() => {
|
|
2949
|
-
console.log("--- VsfXPartialLoader.onRequestResourceFile: timer", PENDING_REQUESTS_SIZE);
|
|
2950
2984
|
pendingRequestsAbortController.signal.removeEventListener("abort", pendingRequestsAbortHandler);
|
|
2951
2985
|
pendingRequestsTimerId = 0;
|
|
2952
2986
|
pendingRequestsMap.forEach((request, dataId) => {
|
|
@@ -2982,43 +3016,6 @@
|
|
|
2982
3016
|
}
|
|
2983
3017
|
}
|
|
2984
3018
|
|
|
2985
|
-
///////////////////////////////////////////////////////////////////////////////
|
|
2986
|
-
class VsfXLoader extends BaseLoader {
|
|
2987
|
-
async load() {
|
|
2988
|
-
if (!this.viewer.visualizeJs)
|
|
2989
|
-
return;
|
|
2990
|
-
const visLib = this.viewer.visLib();
|
|
2991
|
-
const visViewer = visLib.getViewer();
|
|
2992
|
-
const abortController = new AbortController();
|
|
2993
|
-
this.viewer._abortController = abortController;
|
|
2994
|
-
const chunkLoadHandler = (progress) => {
|
|
2995
|
-
this.viewer.emitEvent({ type: "geometryprogress", data: progress, model: this.model });
|
|
2996
|
-
};
|
|
2997
|
-
console.time("File load time");
|
|
2998
|
-
try {
|
|
2999
|
-
this.viewer.emitEvent({ type: "geometrystart", model: this.model });
|
|
3000
|
-
const arrayBuffer = await this.model.downloadResource(this.model.database, chunkLoadHandler, abortController.signal);
|
|
3001
|
-
if (abortController.signal.aborted) {
|
|
3002
|
-
await Promise.reject(new Error(`Open model aborted ${this.model.name}`));
|
|
3003
|
-
}
|
|
3004
|
-
const data = new Uint8Array(arrayBuffer);
|
|
3005
|
-
if (this.viewer.visualizeJs) {
|
|
3006
|
-
visViewer.parseVsfx(data);
|
|
3007
|
-
this.viewer.syncOpenCloudVisualStyle(false);
|
|
3008
|
-
this.viewer.syncOptions();
|
|
3009
|
-
this.viewer.resize();
|
|
3010
|
-
}
|
|
3011
|
-
console.timeEnd("File load time");
|
|
3012
|
-
this.viewer.emitEvent({ type: "databasechunk", data, model: this.model });
|
|
3013
|
-
this.viewer.emitEvent({ type: "geometryend", model: this.model });
|
|
3014
|
-
}
|
|
3015
|
-
catch (error) {
|
|
3016
|
-
this.viewer.emitEvent({ type: "geometryerror", data: error, model: this.model });
|
|
3017
|
-
throw error;
|
|
3018
|
-
}
|
|
3019
|
-
}
|
|
3020
|
-
}
|
|
3021
|
-
|
|
3022
3019
|
///////////////////////////////////////////////////////////////////////////////
|
|
3023
3020
|
class LoaderFactory {
|
|
3024
3021
|
create(viewer, model, options) {
|
|
@@ -16401,15 +16398,17 @@
|
|
|
16401
16398
|
* the auto-update is disabled, you need to update the `VisualizeJS` viewer and the active
|
|
16402
16399
|
* dragger manually using the `update` event. Default is `true`.
|
|
16403
16400
|
*/
|
|
16404
|
-
constructor(client, params = {
|
|
16405
|
-
markupType: MarkupType.Konva,
|
|
16406
|
-
}) {
|
|
16401
|
+
constructor(client, params = {}) {
|
|
16407
16402
|
var _a, _b;
|
|
16408
16403
|
super();
|
|
16404
|
+
this._visualizeJsUrl = "";
|
|
16405
|
+
this.frameId = 0;
|
|
16409
16406
|
this.configure(params);
|
|
16410
16407
|
this._options = new Options(this);
|
|
16411
16408
|
this.client = client;
|
|
16412
16409
|
this._activeDragger = null;
|
|
16410
|
+
this._zoomWheelDragger = null;
|
|
16411
|
+
this._gestureManager = null;
|
|
16413
16412
|
this._renderTime = 0;
|
|
16414
16413
|
this.markup = MarkupFactory.createMarkup((_a = params.markupType) !== null && _a !== void 0 ? _a : MarkupType.Konva);
|
|
16415
16414
|
this.draggerFactory = new Map();
|
|
@@ -16586,7 +16585,7 @@
|
|
|
16586
16585
|
* @param force - If `true` updates the viewer immidietly. Otherwise updates on next
|
|
16587
16586
|
* animation frame. Default is `false`.
|
|
16588
16587
|
*/
|
|
16589
|
-
update(force) {
|
|
16588
|
+
update(force = false) {
|
|
16590
16589
|
var _a, _b;
|
|
16591
16590
|
if (this._enableAutoUpdate) {
|
|
16592
16591
|
if (force) {
|
|
@@ -16694,7 +16693,7 @@
|
|
|
16694
16693
|
device.delete();
|
|
16695
16694
|
return this;
|
|
16696
16695
|
}
|
|
16697
|
-
syncOptions(options = this.options
|
|
16696
|
+
syncOptions(options = this.options) {
|
|
16698
16697
|
if (!this.visualizeJs)
|
|
16699
16698
|
return this;
|
|
16700
16699
|
const visLib = this.visLib();
|
|
@@ -16746,7 +16745,7 @@
|
|
|
16746
16745
|
this.update();
|
|
16747
16746
|
return this;
|
|
16748
16747
|
}
|
|
16749
|
-
syncHighlightingOptions(options = this.options
|
|
16748
|
+
syncHighlightingOptions(options = this.options) {
|
|
16750
16749
|
if (!this.visualizeJs)
|
|
16751
16750
|
return this;
|
|
16752
16751
|
const params = options.enableCustomHighlight ? options : Options.defaults();
|
|
@@ -16961,6 +16960,8 @@
|
|
|
16961
16960
|
var _a;
|
|
16962
16961
|
if (!this.visualizeJs)
|
|
16963
16962
|
return this;
|
|
16963
|
+
if (!this.client)
|
|
16964
|
+
return this;
|
|
16964
16965
|
const abortController = new AbortController();
|
|
16965
16966
|
(_a = this._abortControllerForReferences) === null || _a === void 0 ? void 0 : _a.abort();
|
|
16966
16967
|
this._abortControllerForReferences = abortController;
|
|
@@ -17024,7 +17025,7 @@
|
|
|
17024
17025
|
this.cancel();
|
|
17025
17026
|
this.clear();
|
|
17026
17027
|
this.emitEvent({ type: "open", file, model: file });
|
|
17027
|
-
let model;
|
|
17028
|
+
let model = undefined;
|
|
17028
17029
|
if (file) {
|
|
17029
17030
|
const models = (await file.getModels()) || [];
|
|
17030
17031
|
model = models.find((model) => model.default) || models[0];
|
|
@@ -17038,7 +17039,7 @@
|
|
|
17038
17039
|
overrideOptions.enablePartialMode = true;
|
|
17039
17040
|
}
|
|
17040
17041
|
const loaderFactory = new LoaderFactory();
|
|
17041
|
-
const loader = loaderFactory.create(this, model, overrideOptions
|
|
17042
|
+
const loader = loaderFactory.create(this, model, overrideOptions);
|
|
17042
17043
|
await this.loadReferences(model);
|
|
17043
17044
|
await loader.load();
|
|
17044
17045
|
if (this.visualizeJs) {
|
|
@@ -17293,10 +17294,12 @@
|
|
|
17293
17294
|
}
|
|
17294
17295
|
}
|
|
17295
17296
|
|
|
17297
|
+
exports.CANVAS_EVENTS = CANVAS_EVENTS;
|
|
17296
17298
|
exports.OdBaseDragger = OdBaseDragger;
|
|
17297
17299
|
exports.Options = Options;
|
|
17298
17300
|
exports.Viewer = Viewer;
|
|
17299
17301
|
exports.commands = commands;
|
|
17302
|
+
exports.defaultOptions = defaultOptions;
|
|
17300
17303
|
|
|
17301
17304
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
17302
17305
|
|