@inweb/viewer-visualize 25.3.18 → 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 +89 -87
- package/dist/viewer-visualize.js.map +1 -1
- package/dist/viewer-visualize.min.js +1 -1
- package/dist/viewer-visualize.module.js +88 -87
- 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/VsfXPartialLoader.ts +2 -25
- package/src/Viewer/Viewer.ts +4 -4
- package/src/index.ts +1 -1
|
@@ -61,54 +61,62 @@ commands("VisualizeJS").registerCommand("noop", (() => {}));
|
|
|
61
61
|
|
|
62
62
|
commands("ThreeJS").registerCommand("noop", (() => {}));
|
|
63
63
|
|
|
64
|
+
function defaultOptions() {
|
|
65
|
+
return {
|
|
66
|
+
showWCS: true,
|
|
67
|
+
cameraAnimation: true,
|
|
68
|
+
antialiasing: true,
|
|
69
|
+
groundShadow: false,
|
|
70
|
+
shadows: false,
|
|
71
|
+
cameraAxisXSpeed: 4,
|
|
72
|
+
cameraAxisYSpeed: 1,
|
|
73
|
+
ambientOcclusion: false,
|
|
74
|
+
enableStreamingMode: true,
|
|
75
|
+
enablePartialMode: false,
|
|
76
|
+
memoryLimit: 3294967296,
|
|
77
|
+
cuttingPlaneFillColor: {
|
|
78
|
+
red: 255,
|
|
79
|
+
green: 152,
|
|
80
|
+
blue: 0
|
|
81
|
+
},
|
|
82
|
+
edgesColor: {
|
|
83
|
+
r: 255,
|
|
84
|
+
g: 152,
|
|
85
|
+
b: 0
|
|
86
|
+
},
|
|
87
|
+
facesColor: {
|
|
88
|
+
r: 255,
|
|
89
|
+
g: 152,
|
|
90
|
+
b: 0
|
|
91
|
+
},
|
|
92
|
+
edgesVisibility: true,
|
|
93
|
+
edgesOverlap: true,
|
|
94
|
+
facesOverlap: false,
|
|
95
|
+
facesTransparancy: 200,
|
|
96
|
+
enableCustomHighlight: true,
|
|
97
|
+
sceneGraph: false,
|
|
98
|
+
edgeModel: true,
|
|
99
|
+
reverseZoomWheel: false,
|
|
100
|
+
enableZoomWheel: true,
|
|
101
|
+
enableGestures: true,
|
|
102
|
+
geometryType: "vsfx"
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
|
|
64
106
|
class Options {
|
|
65
107
|
constructor(emitter) {
|
|
66
108
|
this._emitter = emitter;
|
|
67
|
-
this._data =
|
|
109
|
+
this._data = defaultOptions();
|
|
68
110
|
this.loadFromStorage();
|
|
69
111
|
}
|
|
70
112
|
static defaults() {
|
|
71
|
-
return
|
|
72
|
-
showWCS: true,
|
|
73
|
-
cameraAnimation: true,
|
|
74
|
-
antialiasing: true,
|
|
75
|
-
groundShadow: false,
|
|
76
|
-
shadows: false,
|
|
77
|
-
cameraAxisXSpeed: 4,
|
|
78
|
-
cameraAxisYSpeed: 1,
|
|
79
|
-
ambientOcclusion: false,
|
|
80
|
-
enableStreamingMode: true,
|
|
81
|
-
enablePartialMode: false,
|
|
82
|
-
memoryLimit: 3294967296,
|
|
83
|
-
cuttingPlaneFillColor: {
|
|
84
|
-
red: 255,
|
|
85
|
-
green: 152,
|
|
86
|
-
blue: 0
|
|
87
|
-
},
|
|
88
|
-
edgesColor: {
|
|
89
|
-
r: 255,
|
|
90
|
-
g: 152,
|
|
91
|
-
b: 0
|
|
92
|
-
},
|
|
93
|
-
facesColor: {
|
|
94
|
-
r: 255,
|
|
95
|
-
g: 152,
|
|
96
|
-
b: 0
|
|
97
|
-
},
|
|
98
|
-
edgesVisibility: true,
|
|
99
|
-
edgesOverlap: true,
|
|
100
|
-
facesOverlap: false,
|
|
101
|
-
facesTransparancy: 200,
|
|
102
|
-
enableCustomHighlight: true,
|
|
103
|
-
sceneGraph: false,
|
|
104
|
-
edgeModel: true,
|
|
105
|
-
reverseZoomWheel: false,
|
|
106
|
-
enableZoomWheel: true,
|
|
107
|
-
enableGestures: true,
|
|
108
|
-
geometryType: "vsfx"
|
|
109
|
-
};
|
|
113
|
+
return defaultOptions();
|
|
110
114
|
}
|
|
111
115
|
notifierChangeEvent() {
|
|
116
|
+
console.warn("Options.notifierChangeEvent() has been deprecated since 25.3 and will be removed in a future release, use Options.change() instead.");
|
|
117
|
+
this.change();
|
|
118
|
+
}
|
|
119
|
+
change() {
|
|
112
120
|
if (this._emitter !== undefined) {
|
|
113
121
|
this.saveToStorage();
|
|
114
122
|
this._emitter.emit({
|
|
@@ -159,151 +167,154 @@ class Options {
|
|
|
159
167
|
return this._data;
|
|
160
168
|
}
|
|
161
169
|
set data(value) {
|
|
162
|
-
const
|
|
170
|
+
const enablePartialMode = value.enableStreamingMode ? value.enablePartialMode : false;
|
|
171
|
+
const sceneGraph = enablePartialMode ? false : value.sceneGraph;
|
|
163
172
|
this._data = {
|
|
164
173
|
...Options.defaults(),
|
|
165
174
|
...this._data,
|
|
166
175
|
...value,
|
|
176
|
+
enablePartialMode: enablePartialMode,
|
|
167
177
|
sceneGraph: sceneGraph
|
|
168
178
|
};
|
|
169
|
-
this.
|
|
179
|
+
this.change();
|
|
170
180
|
}
|
|
171
181
|
get showWCS() {
|
|
172
182
|
return this._data.showWCS;
|
|
173
183
|
}
|
|
174
184
|
set showWCS(value) {
|
|
175
185
|
this._data.showWCS = value;
|
|
176
|
-
this.
|
|
186
|
+
this.change();
|
|
177
187
|
}
|
|
178
188
|
get cameraAnimation() {
|
|
179
189
|
return this._data.cameraAnimation;
|
|
180
190
|
}
|
|
181
191
|
set cameraAnimation(value) {
|
|
182
192
|
this._data.cameraAnimation = value;
|
|
183
|
-
this.
|
|
193
|
+
this.change();
|
|
184
194
|
}
|
|
185
195
|
get antialiasing() {
|
|
186
196
|
return this._data.antialiasing;
|
|
187
197
|
}
|
|
188
198
|
set antialiasing(value) {
|
|
189
199
|
this._data.antialiasing = value;
|
|
190
|
-
this.
|
|
200
|
+
this.change();
|
|
191
201
|
}
|
|
192
202
|
get groundShadow() {
|
|
193
203
|
return this._data.groundShadow;
|
|
194
204
|
}
|
|
195
205
|
set groundShadow(value) {
|
|
196
206
|
this._data.groundShadow = value;
|
|
197
|
-
this.
|
|
207
|
+
this.change();
|
|
198
208
|
}
|
|
199
209
|
get shadows() {
|
|
200
210
|
return this._data.shadows;
|
|
201
211
|
}
|
|
202
212
|
set shadows(value) {
|
|
203
213
|
this._data.shadows = value;
|
|
204
|
-
this.
|
|
214
|
+
this.change();
|
|
205
215
|
}
|
|
206
216
|
get cameraAxisXSpeed() {
|
|
207
217
|
return this._data.cameraAxisXSpeed;
|
|
208
218
|
}
|
|
209
219
|
set cameraAxisXSpeed(value) {
|
|
210
220
|
this._data.cameraAxisXSpeed = value;
|
|
211
|
-
this.
|
|
221
|
+
this.change();
|
|
212
222
|
}
|
|
213
223
|
get cameraAxisYSpeed() {
|
|
214
224
|
return this._data.cameraAxisYSpeed;
|
|
215
225
|
}
|
|
216
226
|
set cameraAxisYSpeed(value) {
|
|
217
227
|
this.cameraAxisYSpeed = value;
|
|
218
|
-
this.
|
|
228
|
+
this.change();
|
|
219
229
|
}
|
|
220
230
|
get ambientOcclusion() {
|
|
221
231
|
return this._data.ambientOcclusion;
|
|
222
232
|
}
|
|
223
233
|
set ambientOcclusion(value) {
|
|
224
234
|
this._data.ambientOcclusion = value;
|
|
225
|
-
this.
|
|
235
|
+
this.change();
|
|
226
236
|
}
|
|
227
237
|
get enableStreamingMode() {
|
|
228
238
|
return this._data.enableStreamingMode;
|
|
229
239
|
}
|
|
230
240
|
set enableStreamingMode(value) {
|
|
231
241
|
this._data.enableStreamingMode = value;
|
|
232
|
-
if (this._data.
|
|
233
|
-
|
|
234
|
-
}
|
|
235
|
-
this.notifierChangeEvent();
|
|
242
|
+
if (!value) this._data.enablePartialMode = false;
|
|
243
|
+
this.change();
|
|
236
244
|
}
|
|
237
245
|
get enablePartialMode() {
|
|
238
246
|
return this._data.enablePartialMode;
|
|
239
247
|
}
|
|
240
248
|
set enablePartialMode(value) {
|
|
241
249
|
this._data.enablePartialMode = value;
|
|
242
|
-
if (value)
|
|
243
|
-
|
|
250
|
+
if (value) {
|
|
251
|
+
this._data.enableStreamingMode = true;
|
|
252
|
+
this._data.sceneGraph = false;
|
|
253
|
+
}
|
|
254
|
+
this.change();
|
|
244
255
|
}
|
|
245
256
|
get memoryLimit() {
|
|
246
257
|
return this._data.memoryLimit;
|
|
247
258
|
}
|
|
248
259
|
set memoryLimit(value) {
|
|
249
260
|
this._data.memoryLimit = value;
|
|
250
|
-
this.
|
|
261
|
+
this.change();
|
|
251
262
|
}
|
|
252
263
|
get cuttingPlaneFillColor() {
|
|
253
264
|
return this._data.cuttingPlaneFillColor;
|
|
254
265
|
}
|
|
255
266
|
set cuttingPlaneFillColor(value) {
|
|
256
267
|
this._data.cuttingPlaneFillColor = value;
|
|
257
|
-
this.
|
|
268
|
+
this.change();
|
|
258
269
|
}
|
|
259
270
|
get edgesColor() {
|
|
260
271
|
return this._data.edgesColor;
|
|
261
272
|
}
|
|
262
273
|
set edgesColor(value) {
|
|
263
274
|
this._data.edgesColor = value;
|
|
264
|
-
this.
|
|
275
|
+
this.change();
|
|
265
276
|
}
|
|
266
277
|
get facesColor() {
|
|
267
278
|
return this._data.facesColor;
|
|
268
279
|
}
|
|
269
280
|
set facesColor(value) {
|
|
270
281
|
this._data.facesColor = value;
|
|
271
|
-
this.
|
|
282
|
+
this.change();
|
|
272
283
|
}
|
|
273
284
|
get edgesVisibility() {
|
|
274
285
|
return this._data.edgesVisibility;
|
|
275
286
|
}
|
|
276
287
|
set edgesVisibility(value) {
|
|
277
288
|
this._data.edgesVisibility = value;
|
|
278
|
-
this.
|
|
289
|
+
this.change();
|
|
279
290
|
}
|
|
280
291
|
get edgesOverlap() {
|
|
281
292
|
return this._data.edgesOverlap;
|
|
282
293
|
}
|
|
283
294
|
set edgesOverlap(value) {
|
|
284
295
|
this._data.edgesOverlap = value;
|
|
285
|
-
this.
|
|
296
|
+
this.change();
|
|
286
297
|
}
|
|
287
298
|
get facesOverlap() {
|
|
288
299
|
return this._data.facesOverlap;
|
|
289
300
|
}
|
|
290
301
|
set facesOverlap(value) {
|
|
291
302
|
this._data.facesOverlap = value;
|
|
292
|
-
this.
|
|
303
|
+
this.change();
|
|
293
304
|
}
|
|
294
305
|
get facesTransparancy() {
|
|
295
306
|
return this._data.facesTransparancy;
|
|
296
307
|
}
|
|
297
308
|
set facesTransparancy(value) {
|
|
298
309
|
this._data.facesTransparancy = value;
|
|
299
|
-
this.
|
|
310
|
+
this.change();
|
|
300
311
|
}
|
|
301
312
|
get enableCustomHighlight() {
|
|
302
313
|
return this._data.enableCustomHighlight;
|
|
303
314
|
}
|
|
304
315
|
set enableCustomHighlight(value) {
|
|
305
316
|
this._data.enableCustomHighlight = value;
|
|
306
|
-
this.
|
|
317
|
+
this.change();
|
|
307
318
|
}
|
|
308
319
|
get sceneGraph() {
|
|
309
320
|
return this._data.sceneGraph;
|
|
@@ -311,42 +322,42 @@ class Options {
|
|
|
311
322
|
set sceneGraph(value) {
|
|
312
323
|
this._data.sceneGraph = value;
|
|
313
324
|
if (value) this._data.enablePartialMode = false;
|
|
314
|
-
this.
|
|
325
|
+
this.change();
|
|
315
326
|
}
|
|
316
327
|
get edgeModel() {
|
|
317
328
|
return Boolean(this._data.edgeModel);
|
|
318
329
|
}
|
|
319
330
|
set edgeModel(value) {
|
|
320
331
|
this._data.edgeModel = Boolean(value);
|
|
321
|
-
this.
|
|
332
|
+
this.change();
|
|
322
333
|
}
|
|
323
334
|
get reverseZoomWheel() {
|
|
324
335
|
return this._data.reverseZoomWheel;
|
|
325
336
|
}
|
|
326
337
|
set reverseZoomWheel(value) {
|
|
327
338
|
this._data.reverseZoomWheel = !!value;
|
|
328
|
-
this.
|
|
339
|
+
this.change();
|
|
329
340
|
}
|
|
330
341
|
get enableZoomWheel() {
|
|
331
342
|
return this._data.enableZoomWheel;
|
|
332
343
|
}
|
|
333
344
|
set enableZoomWheel(value) {
|
|
334
345
|
this._data.enableZoomWheel = !!value;
|
|
335
|
-
this.
|
|
346
|
+
this.change();
|
|
336
347
|
}
|
|
337
348
|
get enableGestures() {
|
|
338
349
|
return this._data.enableGestures;
|
|
339
350
|
}
|
|
340
351
|
set enableGestures(value) {
|
|
341
352
|
this._data.enableGestures = !!value;
|
|
342
|
-
this.
|
|
353
|
+
this.change();
|
|
343
354
|
}
|
|
344
355
|
get geometryType() {
|
|
345
356
|
return this._data.geometryType;
|
|
346
357
|
}
|
|
347
358
|
set geometryType(value) {
|
|
348
359
|
this._data.geometryType = value;
|
|
349
|
-
this.
|
|
360
|
+
this.change();
|
|
350
361
|
}
|
|
351
362
|
}
|
|
352
363
|
|
|
@@ -2779,13 +2790,11 @@ class VsfXPartialLoader extends BaseLoader {
|
|
|
2779
2790
|
}
|
|
2780
2791
|
};
|
|
2781
2792
|
const downloadResourceRange = async (dataId, requestId, ranges) => {
|
|
2782
|
-
console.log("--- VsfXPartialLoader.downloadResourceRange", dataId, requestId, ranges);
|
|
2783
2793
|
const abortCtrl = new AbortController;
|
|
2784
2794
|
abortControllerForRequestMap.set(requestId, abortCtrl);
|
|
2785
2795
|
try {
|
|
2786
2796
|
await this.model.downloadResourceRange(dataId, ranges, requestId, chunkLoadHandler, abortCtrl.signal);
|
|
2787
2797
|
} catch (error) {
|
|
2788
|
-
console.log("--- VsfXPartialLoader.downloadResourceRange error", dataId, requestId, error);
|
|
2789
2798
|
this.viewer.emitEvent({
|
|
2790
2799
|
type: "geometryerror",
|
|
2791
2800
|
data: error,
|
|
@@ -2812,7 +2821,6 @@ class VsfXPartialLoader extends BaseLoader {
|
|
|
2812
2821
|
};
|
|
2813
2822
|
const objectHandler = {
|
|
2814
2823
|
onServicePartReceived: bHasIndex => {
|
|
2815
|
-
console.log("--- VsfXPartialLoader.onServicePartReceived", bHasIndex);
|
|
2816
2824
|
if (bHasIndex) {
|
|
2817
2825
|
servicePartAborted = true;
|
|
2818
2826
|
abortController.abort();
|
|
@@ -2820,26 +2828,22 @@ class VsfXPartialLoader extends BaseLoader {
|
|
|
2820
2828
|
},
|
|
2821
2829
|
onRequest: (requestId, records) => {
|
|
2822
2830
|
const ranges = requestRecordsToRanges(requestId, records);
|
|
2823
|
-
console.log("--- VsfXPartialLoader.onRequest", this.model.database, requestId, ranges);
|
|
2824
2831
|
downloadResourceRange(this.model.database, requestId, ranges);
|
|
2825
2832
|
},
|
|
2826
2833
|
onFullLoaded: () => {
|
|
2827
|
-
console.log("--- VsfXPartialLoader.onFullLoaded");
|
|
2828
2834
|
updaterController.update(UpdateType.kNormal);
|
|
2829
2835
|
},
|
|
2830
2836
|
onRequestResponseParsed: requestId => {
|
|
2831
|
-
console.log("--- VsfXPartialLoader.onRequestResponseParsed", requestId);
|
|
2832
2837
|
abortControllerForRequestMap.delete(requestId);
|
|
2833
2838
|
updaterController.update(UpdateType.kNormal);
|
|
2834
2839
|
},
|
|
2835
2840
|
onRequestAborted: requestId => {
|
|
2836
|
-
console.log("--- VsfXPartialLoader.onRequestAborted", requestId);
|
|
2837
2841
|
const abortCtrl = abortControllerForRequestMap.get(requestId);
|
|
2838
2842
|
if (abortCtrl) abortCtrl.abort();
|
|
2839
2843
|
},
|
|
2840
|
-
onRequestResourceFile: (requestId,
|
|
2844
|
+
onRequestResourceFile: (requestId, _, records) => {
|
|
2845
|
+
const dataId = `${this.model.fileId}${this.model.file.type}`;
|
|
2841
2846
|
const ranges = requestRecordsToRanges(requestId, records);
|
|
2842
|
-
console.log("--- VsfXPartialLoader.onRequestResourceFile", dataId, requestId, ranges);
|
|
2843
2847
|
let pendingRanges = [];
|
|
2844
2848
|
let requestNumber = 0;
|
|
2845
2849
|
const pendingRequest = pendingRequestsMap.get(dataId);
|
|
@@ -2848,7 +2852,6 @@ class VsfXPartialLoader extends BaseLoader {
|
|
|
2848
2852
|
requestNumber = pendingRequest.number;
|
|
2849
2853
|
}
|
|
2850
2854
|
if (requestNumber <= 5) {
|
|
2851
|
-
console.log("--- VsfXPartialLoader.onRequestResourceFile: requestNumber <= 5");
|
|
2852
2855
|
pendingRequestsMap.set(dataId, {
|
|
2853
2856
|
ranges: [],
|
|
2854
2857
|
number: requestNumber + 1
|
|
@@ -2858,7 +2861,6 @@ class VsfXPartialLoader extends BaseLoader {
|
|
|
2858
2861
|
}
|
|
2859
2862
|
pendingRanges = pendingRanges.concat(ranges);
|
|
2860
2863
|
if (pendingRanges.length >= PENDING_REQUESTS_SIZE) {
|
|
2861
|
-
console.log("--- VsfXPartialLoader.onRequestResourceFile: pendingRanges.length >", PENDING_REQUESTS_SIZE);
|
|
2862
2864
|
if (pendingRequestsTimerId) {
|
|
2863
2865
|
window.clearTimeout(pendingRequestsTimerId);
|
|
2864
2866
|
pendingRequestsTimerId = 0;
|
|
@@ -2876,7 +2878,6 @@ class VsfXPartialLoader extends BaseLoader {
|
|
|
2876
2878
|
});
|
|
2877
2879
|
if (pendingRequestsTimerId === 0) {
|
|
2878
2880
|
pendingRequestsTimerId = window.setTimeout((() => {
|
|
2879
|
-
console.log("--- VsfXPartialLoader.onRequestResourceFile: timer", PENDING_REQUESTS_SIZE);
|
|
2880
2881
|
pendingRequestsAbortController.signal.removeEventListener("abort", pendingRequestsAbortHandler);
|
|
2881
2882
|
pendingRequestsTimerId = 0;
|
|
2882
2883
|
pendingRequestsMap.forEach(((request, dataId) => {
|
|
@@ -5145,7 +5146,7 @@ class Viewer extends EventEmitter2 {
|
|
|
5145
5146
|
device.delete();
|
|
5146
5147
|
return this;
|
|
5147
5148
|
}
|
|
5148
|
-
syncOptions(options = this.options
|
|
5149
|
+
syncOptions(options = this.options) {
|
|
5149
5150
|
if (!this.visualizeJs) return this;
|
|
5150
5151
|
const visLib = this.visLib();
|
|
5151
5152
|
const visViewer = visLib.getViewer();
|
|
@@ -5195,7 +5196,7 @@ class Viewer extends EventEmitter2 {
|
|
|
5195
5196
|
this.update();
|
|
5196
5197
|
return this;
|
|
5197
5198
|
}
|
|
5198
|
-
syncHighlightingOptions(options = this.options
|
|
5199
|
+
syncHighlightingOptions(options = this.options) {
|
|
5199
5200
|
if (!this.visualizeJs) return this;
|
|
5200
5201
|
const params = options.enableCustomHighlight ? options : Options.defaults();
|
|
5201
5202
|
const visLib = this.visLib();
|
|
@@ -5376,7 +5377,7 @@ class Viewer extends EventEmitter2 {
|
|
|
5376
5377
|
overrideOptions.enablePartialMode = true;
|
|
5377
5378
|
}
|
|
5378
5379
|
const loaderFactory = new LoaderFactory;
|
|
5379
|
-
const loader = loaderFactory.create(this, model, overrideOptions
|
|
5380
|
+
const loader = loaderFactory.create(this, model, overrideOptions);
|
|
5380
5381
|
await this.loadReferences(model);
|
|
5381
5382
|
await loader.load();
|
|
5382
5383
|
if (this.visualizeJs) {
|
|
@@ -5607,5 +5608,5 @@ class Viewer extends EventEmitter2 {
|
|
|
5607
5608
|
}
|
|
5608
5609
|
}
|
|
5609
5610
|
|
|
5610
|
-
export { OdBaseDragger, Options, Viewer, commands };
|
|
5611
|
+
export { CANVAS_EVENTS, OdBaseDragger, Options, Viewer, commands, defaultOptions };
|
|
5611
5612
|
//# sourceMappingURL=viewer-visualize.module.js.map
|