@inweb/client 25.2.5 → 25.2.8
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/client.js +118 -88
- package/dist/client.js.map +1 -1
- package/dist/client.min.js +1 -1
- package/dist/client.module.js +134 -86
- package/dist/client.module.js.map +1 -1
- package/lib/Viewer/IViewer.d.ts +2 -0
- package/lib/Viewer/Loaders/LoaderFactory.d.ts +3 -2
- package/lib/Viewer/Loaders/VsfXStreamingLoader.d.ts +5 -0
- package/lib/Viewer/Markup/IMarkup.d.ts +3 -3
- package/lib/Viewer/Markup/Impl/Konva/KonvaMarkup.d.ts +2 -2
- package/lib/Viewer/Markup/Impl/Visualize/VisualizeMarkup.d.ts +3 -2
- package/lib/Viewer/Options.d.ts +11 -0
- package/lib/Viewer/Viewer.d.ts +7 -1
- package/package.json +1 -1
- package/src/Viewer/IViewer.ts +3 -0
- package/src/Viewer/Loaders/LoaderFactory.ts +7 -4
- package/src/Viewer/Loaders/VsfXLoader.ts +11 -33
- package/src/Viewer/Loaders/VsfXStreamingLoader.ts +87 -0
- package/src/Viewer/Markup/IMarkup.ts +3 -3
- package/src/Viewer/Markup/Impl/Konva/KonvaMarkup.ts +2 -66
- package/src/Viewer/Markup/Impl/Visualize/VisualizeMarkup.ts +6 -48
- package/src/Viewer/Options.ts +20 -0
- package/src/Viewer/Viewer.ts +85 -3
package/lib/Viewer/IViewer.d.ts
CHANGED
|
@@ -19,6 +19,8 @@ export interface IViewer extends IEventEmitter, ICommandService {
|
|
|
19
19
|
setActiveDragger(name: string): any;
|
|
20
20
|
resetActiveDragger(): void;
|
|
21
21
|
is3D(): boolean;
|
|
22
|
+
drawViewpoint(viewpoint: object): void;
|
|
23
|
+
createViewpoint(): object;
|
|
22
24
|
loadReferences(model: Model | File | Assembly): Promise<this>;
|
|
23
25
|
open(model: Model | File | Assembly): Promise<this>;
|
|
24
26
|
cancel(): this;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { TCSLoader } from "./TCSLoader";
|
|
2
|
-
import {
|
|
2
|
+
import { VsfXStreamingLoader } from "./VsfXStreamingLoader";
|
|
3
3
|
import { VsfXPartialLoader } from "./VsfXPartialLoader";
|
|
4
4
|
import { Viewer } from "../Viewer";
|
|
5
5
|
import { Model } from "../../Api/Model";
|
|
6
6
|
import { OptionsData } from "../Options";
|
|
7
|
+
import { VsfXLoader } from "./VsfXLoader";
|
|
7
8
|
export declare class LoaderFactory {
|
|
8
|
-
create(viewer: Viewer, model: Model, options: OptionsData): TCSLoader |
|
|
9
|
+
create(viewer: Viewer, model: Model, options: OptionsData): TCSLoader | VsfXStreamingLoader | VsfXPartialLoader | VsfXLoader;
|
|
9
10
|
}
|
|
10
11
|
//# sourceMappingURL=LoaderFactory.d.ts.map
|
|
@@ -21,15 +21,15 @@ export interface IMarkup {
|
|
|
21
21
|
dispose(): void;
|
|
22
22
|
getDraggers(): Map<string, typeof OdBaseDragger>;
|
|
23
23
|
clearOverlay(): void;
|
|
24
|
+
setMarkupColor(r: number, g: number, b: number): void;
|
|
24
25
|
getMarkupColor(): {
|
|
25
26
|
r: number;
|
|
26
27
|
g: number;
|
|
27
28
|
b: number;
|
|
28
29
|
};
|
|
29
|
-
setMarkupColor(r: number, g: number, b: number): void;
|
|
30
30
|
colorizeAllMarkup(r: number, g: number, b: number): void;
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
setViewpoint(viewpoint: object): void;
|
|
32
|
+
getViewpoint(): any;
|
|
33
33
|
createObject(type: string, params: any): IMarkupObject;
|
|
34
34
|
getObjects(): IMarkupObject[];
|
|
35
35
|
getSelectedObjects(): IMarkupObject[];
|
|
@@ -37,8 +37,8 @@ export declare class KonvaMarkup implements IMarkup {
|
|
|
37
37
|
};
|
|
38
38
|
setMarkupColor(r: number, g: number, b: number): void;
|
|
39
39
|
colorizeAllMarkup(r?: number, g?: number, b?: number): void;
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
setViewpoint(viewpoint: any): void;
|
|
41
|
+
getViewpoint(): object;
|
|
42
42
|
createObject(type: string, params: any): IMarkupObject;
|
|
43
43
|
getObjects(): IMarkupObject[];
|
|
44
44
|
getSelectedObjects(): IMarkupObject[];
|
|
@@ -21,13 +21,14 @@ export declare class VisualizeMarkup implements IMarkup {
|
|
|
21
21
|
};
|
|
22
22
|
setMarkupColor(r: number, g: number, b: number): void;
|
|
23
23
|
colorizeAllMarkup(r?: number, g?: number, b?: number): void;
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
setViewpoint(viewpoint: any): void;
|
|
25
|
+
getViewpoint(): object;
|
|
26
26
|
getLayer(): any;
|
|
27
27
|
createObject(type: string, params: any): IMarkupObject;
|
|
28
28
|
getObjects(): IMarkupObject[];
|
|
29
29
|
getSelectedObjects(): IMarkupObject[];
|
|
30
30
|
selectObjects(objects: IMarkupObject[]): void;
|
|
31
31
|
clearSelected(): void;
|
|
32
|
+
private getPoint3dFromArray;
|
|
32
33
|
}
|
|
33
34
|
//# sourceMappingURL=VisualizeMarkup.d.ts.map
|
package/lib/Viewer/Options.d.ts
CHANGED
|
@@ -56,6 +56,15 @@ export interface OptionsData {
|
|
|
56
56
|
* @defaultValue false
|
|
57
57
|
*/
|
|
58
58
|
ambientOcclusion?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Enable streaming mode
|
|
61
|
+
*
|
|
62
|
+
* If enableStreamingMode is true then enablePartialMode will be used, otherwise -
|
|
63
|
+
* enablePartialMode will be ignored and file / assembly will be loaded in one go
|
|
64
|
+
*
|
|
65
|
+
* @defaultValue true
|
|
66
|
+
*/
|
|
67
|
+
enableStreamingMode?: boolean;
|
|
59
68
|
/**
|
|
60
69
|
* Enable partial load mode to be able open large drawing If enablePartialMode enabled, then
|
|
61
70
|
* sceneGraph will be switched off
|
|
@@ -176,6 +185,8 @@ export declare class Options {
|
|
|
176
185
|
set cameraAxisYSpeed(value: number);
|
|
177
186
|
get ambientOcclusion(): boolean;
|
|
178
187
|
set ambientOcclusion(value: boolean);
|
|
188
|
+
get enableStreamingMode(): boolean;
|
|
189
|
+
set enableStreamingMode(value: boolean);
|
|
179
190
|
get enablePartialMode(): boolean;
|
|
180
191
|
set enablePartialMode(value: boolean);
|
|
181
192
|
get memoryLimit(): number;
|
package/lib/Viewer/Viewer.d.ts
CHANGED
|
@@ -334,13 +334,19 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & OptionsEventM
|
|
|
334
334
|
*
|
|
335
335
|
* @param viewpoint - Viewpoint.
|
|
336
336
|
*/
|
|
337
|
-
drawViewpoint(viewpoint:
|
|
337
|
+
drawViewpoint(viewpoint: object): void;
|
|
338
338
|
/**
|
|
339
339
|
* Create a viewpoint. To add a viewpoint to the list of model viewpoints, use the
|
|
340
340
|
* {@link Model#saveViewpoint | Model.saveViewpoint()} or
|
|
341
341
|
* {@link File#saveViewpoint | File.saveViewpoint()}.
|
|
342
342
|
*/
|
|
343
343
|
createViewpoint(): object;
|
|
344
|
+
private getPoint3dFromArray;
|
|
345
|
+
private getLogicalPoint3dAsArray;
|
|
346
|
+
private getOrthogonalCameraSettings;
|
|
347
|
+
private setOrthogonalCameraSettings;
|
|
348
|
+
private getClippingPlanes;
|
|
349
|
+
private setClippingPlanes;
|
|
344
350
|
/**
|
|
345
351
|
* Executes the command denoted by the given command identifier.
|
|
346
352
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inweb/client",
|
|
3
|
-
"version": "25.2.
|
|
3
|
+
"version": "25.2.8",
|
|
4
4
|
"description": "Client.js is a library for implementing BIM Project management applications.",
|
|
5
5
|
"homepage": "https://cloud.opendesign.com/docs/index.html",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
package/src/Viewer/IViewer.ts
CHANGED
|
@@ -48,6 +48,9 @@ export interface IViewer extends IEventEmitter, ICommandService {
|
|
|
48
48
|
|
|
49
49
|
is3D(): boolean;
|
|
50
50
|
|
|
51
|
+
drawViewpoint(viewpoint: object): void;
|
|
52
|
+
createViewpoint(): object;
|
|
53
|
+
|
|
51
54
|
loadReferences(model: Model | File | Assembly): Promise<this>;
|
|
52
55
|
open(model: Model | File | Assembly): Promise<this>;
|
|
53
56
|
cancel(): this;
|
|
@@ -22,20 +22,23 @@
|
|
|
22
22
|
///////////////////////////////////////////////////////////////////////////////
|
|
23
23
|
|
|
24
24
|
import { TCSLoader } from "./TCSLoader";
|
|
25
|
-
import {
|
|
25
|
+
import { VsfXStreamingLoader } from "./VsfXStreamingLoader";
|
|
26
26
|
import { VsfXPartialLoader } from "./VsfXPartialLoader";
|
|
27
27
|
import { Viewer } from "../Viewer";
|
|
28
28
|
import { Model } from "../../Api/Model";
|
|
29
29
|
import { OptionsData } from "../Options";
|
|
30
|
+
import { VsfXLoader } from "./VsfXLoader";
|
|
30
31
|
|
|
31
32
|
export class LoaderFactory {
|
|
32
33
|
create(viewer: Viewer, model: Model, options: OptionsData) {
|
|
33
34
|
const geometryType = model.database.split(".").pop();
|
|
35
|
+
|
|
34
36
|
if (model.geometry.length === 0 && geometryType === "vsfx") {
|
|
35
|
-
return options
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
if (!options.enableStreamingMode) return new VsfXLoader(viewer, model, options);
|
|
38
|
+
else if (options.enablePartialMode) return new VsfXPartialLoader(viewer, model, options);
|
|
39
|
+
else return new VsfXStreamingLoader(viewer, model, options);
|
|
38
40
|
}
|
|
41
|
+
|
|
39
42
|
if (geometryType === "data") {
|
|
40
43
|
return new TCSLoader(viewer, model, options);
|
|
41
44
|
}
|
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
///////////////////////////////////////////////////////////////////////////////
|
|
23
23
|
|
|
24
24
|
import { BaseLoader } from "./BaseLoader";
|
|
25
|
-
import { UpdaterController, UpdateType } from "./UpdaterController";
|
|
26
25
|
|
|
27
26
|
export class VsfXLoader extends BaseLoader {
|
|
28
27
|
override async load(): Promise<void> {
|
|
@@ -32,52 +31,31 @@ export class VsfXLoader extends BaseLoader {
|
|
|
32
31
|
const visViewer = visLib.getViewer();
|
|
33
32
|
const abortController = new AbortController();
|
|
34
33
|
|
|
35
|
-
const updaterController = new UpdaterController();
|
|
36
|
-
updaterController.initialize(this.viewer);
|
|
37
|
-
|
|
38
34
|
this.viewer._abortController = abortController;
|
|
39
35
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
if (!this.viewer.visualizeJs) return;
|
|
44
|
-
|
|
45
|
-
const status = visViewer.parseVsfx(data);
|
|
46
|
-
updaterController.update(UpdateType.kDelay);
|
|
36
|
+
console.time("File load time");
|
|
37
|
+
try {
|
|
38
|
+
this.viewer.emitEvent({ type: "geometrystart", model: this.model });
|
|
47
39
|
|
|
48
|
-
|
|
40
|
+
const progressCb = (progress) =>
|
|
41
|
+
this.viewer.emitEvent({ type: "geometryprogress", data: progress, model: this.model });
|
|
42
|
+
const arrayBuffer = await this.model.downloadResource(this.model.database, progressCb, abortController.signal);
|
|
49
43
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
status === visLib.DatabaseStreamStatus.ReadyServiceData ||
|
|
53
|
-
(status === visLib.DatabaseStreamStatus.Complete && !isFireDatabaseChunk)
|
|
54
|
-
) {
|
|
55
|
-
isFireDatabaseChunk = true;
|
|
56
|
-
state = true;
|
|
44
|
+
if (abortController.signal.aborted) {
|
|
45
|
+
await Promise.reject(new Error(`Open model aborted ${this.model.name}`));
|
|
57
46
|
}
|
|
58
47
|
|
|
59
|
-
if (
|
|
60
|
-
|
|
48
|
+
if (this.viewer.visualizeJs) {
|
|
49
|
+
visViewer.parseVsfx(new Uint8Array(arrayBuffer));
|
|
50
|
+
this.viewer.update(true);
|
|
61
51
|
|
|
62
52
|
this.viewer.syncOpenCloudVisualStyle(false);
|
|
63
53
|
this.viewer.syncOptions();
|
|
64
54
|
this.viewer.resize();
|
|
65
|
-
|
|
66
|
-
this.viewer.emitEvent({ type: "databasechunk", data, model: this.model });
|
|
67
|
-
} else {
|
|
68
|
-
this.viewer.emitEvent({ type: "geometrychunk", data, model: this.model });
|
|
69
55
|
}
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
console.time("File load time");
|
|
73
|
-
try {
|
|
74
|
-
this.viewer.emitEvent({ type: "geometrystart", model: this.model });
|
|
75
56
|
|
|
76
|
-
await this.model.partialDownloadResource(this.model.database, chunkLoadHandler, abortController.signal);
|
|
77
57
|
console.timeEnd("File load time");
|
|
78
58
|
|
|
79
|
-
updaterController.update(UpdateType.kNormal);
|
|
80
|
-
|
|
81
59
|
this.viewer.emitEvent({ type: "geometryend", model: this.model });
|
|
82
60
|
} catch (error) {
|
|
83
61
|
this.viewer.emitEvent({ type: "geometryerror", data: error, model: this.model });
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
// Copyright (C) 2002-2021, Open Design Alliance (the "Alliance").
|
|
3
|
+
// All rights reserved.
|
|
4
|
+
//
|
|
5
|
+
// This software and its documentation and related materials are owned by
|
|
6
|
+
// the Alliance. The software may only be incorporated into application
|
|
7
|
+
// programs owned by members of the Alliance, subject to a signed
|
|
8
|
+
// Membership Agreement and Supplemental Software License Agreement with the
|
|
9
|
+
// Alliance. The structure and organization of this software are the valuable
|
|
10
|
+
// trade secrets of the Alliance and its suppliers. The software is also
|
|
11
|
+
// protected by copyright law and international treaty provisions. Application
|
|
12
|
+
// programs incorporating this software must include the following statement
|
|
13
|
+
// with their copyright notices:
|
|
14
|
+
//
|
|
15
|
+
// This application incorporates Open Design Alliance software pursuant to a
|
|
16
|
+
// license agreement with Open Design Alliance.
|
|
17
|
+
// Open Design Alliance Copyright (C) 2002-2021 by Open Design Alliance.
|
|
18
|
+
// All rights reserved.
|
|
19
|
+
//
|
|
20
|
+
// By use of this software, its documentation or related materials, you
|
|
21
|
+
// acknowledge and accept the above terms.
|
|
22
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
23
|
+
|
|
24
|
+
import { BaseLoader } from "./BaseLoader";
|
|
25
|
+
import { UpdaterController, UpdateType } from "./UpdaterController";
|
|
26
|
+
|
|
27
|
+
export class VsfXStreamingLoader extends BaseLoader {
|
|
28
|
+
override async load(): Promise<void> {
|
|
29
|
+
if (!this.viewer.visualizeJs) return;
|
|
30
|
+
|
|
31
|
+
const visLib = this.viewer.visLib();
|
|
32
|
+
const visViewer = visLib.getViewer();
|
|
33
|
+
const abortController = new AbortController();
|
|
34
|
+
|
|
35
|
+
const updaterController = new UpdaterController();
|
|
36
|
+
updaterController.initialize(this.viewer);
|
|
37
|
+
|
|
38
|
+
this.viewer._abortController = abortController;
|
|
39
|
+
|
|
40
|
+
let isFireDatabaseChunk = false;
|
|
41
|
+
|
|
42
|
+
const chunkLoadHandler = (progress, data) => {
|
|
43
|
+
if (!this.viewer.visualizeJs) return;
|
|
44
|
+
|
|
45
|
+
const status = visViewer.parseVsfx(data);
|
|
46
|
+
updaterController.update(UpdateType.kDelay);
|
|
47
|
+
|
|
48
|
+
this.viewer.emitEvent({ type: "geometryprogress", data: progress, model: this.model });
|
|
49
|
+
|
|
50
|
+
let state = false;
|
|
51
|
+
if (
|
|
52
|
+
status === visLib.DatabaseStreamStatus.ReadyServiceData ||
|
|
53
|
+
(status === visLib.DatabaseStreamStatus.Complete && !isFireDatabaseChunk)
|
|
54
|
+
) {
|
|
55
|
+
isFireDatabaseChunk = true;
|
|
56
|
+
state = true;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (state) {
|
|
60
|
+
updaterController.update(UpdateType.kForce);
|
|
61
|
+
|
|
62
|
+
this.viewer.syncOpenCloudVisualStyle(false);
|
|
63
|
+
this.viewer.syncOptions();
|
|
64
|
+
this.viewer.resize();
|
|
65
|
+
|
|
66
|
+
this.viewer.emitEvent({ type: "databasechunk", data, model: this.model });
|
|
67
|
+
} else {
|
|
68
|
+
this.viewer.emitEvent({ type: "geometrychunk", data, model: this.model });
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
console.time("File load time");
|
|
73
|
+
try {
|
|
74
|
+
this.viewer.emitEvent({ type: "geometrystart", model: this.model });
|
|
75
|
+
|
|
76
|
+
await this.model.partialDownloadResource(this.model.database, chunkLoadHandler, abortController.signal);
|
|
77
|
+
console.timeEnd("File load time");
|
|
78
|
+
|
|
79
|
+
updaterController.update(UpdateType.kNormal);
|
|
80
|
+
|
|
81
|
+
this.viewer.emitEvent({ type: "geometryend", model: this.model });
|
|
82
|
+
} catch (error) {
|
|
83
|
+
this.viewer.emitEvent({ type: "geometryerror", data: error, model: this.model });
|
|
84
|
+
throw error;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -26,11 +26,11 @@ export interface IMarkup {
|
|
|
26
26
|
|
|
27
27
|
getDraggers(): Map<string, typeof OdBaseDragger>;
|
|
28
28
|
clearOverlay(): void;
|
|
29
|
-
getMarkupColor(): { r: number; g: number; b: number };
|
|
30
29
|
setMarkupColor(r: number, g: number, b: number): void;
|
|
30
|
+
getMarkupColor(): { r: number; g: number; b: number };
|
|
31
31
|
colorizeAllMarkup(r: number, g: number, b: number): void;
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
setViewpoint(viewpoint: object): void;
|
|
33
|
+
getViewpoint(): any;
|
|
34
34
|
|
|
35
35
|
createObject(type: string, params: any): IMarkupObject;
|
|
36
36
|
getObjects(): IMarkupObject[];
|
|
@@ -236,60 +236,16 @@ export class KonvaMarkup implements IMarkup {
|
|
|
236
236
|
this._konvaLayer.draw();
|
|
237
237
|
}
|
|
238
238
|
|
|
239
|
-
|
|
240
|
-
function getLogicalPoint3dAsArray(point3d) {
|
|
241
|
-
return [point3d.x, point3d.y, point3d.z];
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
if (!this._isInitialized) return;
|
|
245
|
-
if (!this._viewer.visualizeJs) return;
|
|
246
|
-
|
|
247
|
-
const visLib = this._viewer.visLib();
|
|
248
|
-
const visViewer = visLib.getViewer();
|
|
249
|
-
const activeView = visViewer.activeView;
|
|
250
|
-
|
|
251
|
-
this._viewer.resetActiveDragger();
|
|
252
|
-
this._viewer.clearSlices();
|
|
253
|
-
this._viewer.clearOverlay();
|
|
254
|
-
|
|
255
|
-
if (viewpoint.orthogonal_camera) {
|
|
256
|
-
activeView.setView(
|
|
257
|
-
getLogicalPoint3dAsArray(viewpoint.orthogonal_camera.view_point),
|
|
258
|
-
getLogicalPoint3dAsArray(viewpoint.orthogonal_camera.direction),
|
|
259
|
-
getLogicalPoint3dAsArray(viewpoint.orthogonal_camera.up_vector),
|
|
260
|
-
viewpoint.orthogonal_camera.field_width,
|
|
261
|
-
viewpoint.orthogonal_camera.field_height,
|
|
262
|
-
true
|
|
263
|
-
);
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
this._viewer.syncOverlay();
|
|
267
|
-
|
|
239
|
+
setViewpoint(viewpoint: any): void {
|
|
268
240
|
const markupColor = viewpoint.custom_fields.markup_color || { r: 255, g: 0, b: 0 };
|
|
269
241
|
this.setMarkupColor(markupColor.r, markupColor.g, markupColor.b);
|
|
270
242
|
|
|
271
|
-
if (viewpoint.clipping_planes) {
|
|
272
|
-
for (const plane of viewpoint.clipping_planes) {
|
|
273
|
-
const cuttingPlane = new visLib.OdTvPlane();
|
|
274
|
-
cuttingPlane.set(getLogicalPoint3dAsArray(plane.location), getLogicalPoint3dAsArray(plane.direction));
|
|
275
|
-
|
|
276
|
-
activeView.addCuttingPlane(cuttingPlane);
|
|
277
|
-
activeView.setEnableCuttingPlaneFill(true, 0x66, 0x66, 0x66);
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
|
|
281
243
|
this.loadMarkup(viewpoint);
|
|
282
|
-
|
|
283
|
-
this._viewer.update();
|
|
284
244
|
}
|
|
285
245
|
|
|
286
|
-
|
|
246
|
+
getViewpoint(): object {
|
|
287
247
|
if (!this._viewer.visualizeJs) return {};
|
|
288
248
|
|
|
289
|
-
const visLib = this._viewer.visLib();
|
|
290
|
-
const visViewer = visLib.getViewer();
|
|
291
|
-
const activeView = visViewer.activeView;
|
|
292
|
-
|
|
293
249
|
const viewpoint = {
|
|
294
250
|
lines: [],
|
|
295
251
|
texts: [],
|
|
@@ -298,28 +254,8 @@ export class KonvaMarkup implements IMarkup {
|
|
|
298
254
|
ellipses: [],
|
|
299
255
|
images: [],
|
|
300
256
|
rectangles: [],
|
|
301
|
-
clipping_planes: [],
|
|
302
257
|
} as any;
|
|
303
258
|
|
|
304
|
-
viewpoint.orthogonal_camera = {
|
|
305
|
-
view_point: this.getPoint3dFromArray(activeView.viewPosition),
|
|
306
|
-
direction: this.getPoint3dFromArray(activeView.viewTarget),
|
|
307
|
-
up_vector: this.getPoint3dFromArray(activeView.upVector),
|
|
308
|
-
field_width: activeView.viewFieldWidth,
|
|
309
|
-
field_height: activeView.viewFieldHeight,
|
|
310
|
-
};
|
|
311
|
-
|
|
312
|
-
for (let i = 0; i < activeView.numCuttingPlanes(); i++) {
|
|
313
|
-
const cuttingPlane = activeView.getCuttingPlane(i);
|
|
314
|
-
|
|
315
|
-
const plane = {
|
|
316
|
-
location: this.getPoint3dFromArray(cuttingPlane.getOrigin()),
|
|
317
|
-
direction: this.getPoint3dFromArray(cuttingPlane.normal()),
|
|
318
|
-
};
|
|
319
|
-
|
|
320
|
-
viewpoint.clipping_planes.push(plane);
|
|
321
|
-
}
|
|
322
|
-
|
|
323
259
|
viewpoint.snapshot = {
|
|
324
260
|
data: this.combineMarkupWithDrawing(),
|
|
325
261
|
};
|
|
@@ -66,7 +66,7 @@ export class VisualizeMarkup implements IMarkup {
|
|
|
66
66
|
this._viewer.update();
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
setViewpoint(viewpoint: any): void {
|
|
70
70
|
function getLogicalPoint3dAsArray(point3d) {
|
|
71
71
|
return [point3d.x, point3d.y, point3d.z];
|
|
72
72
|
}
|
|
@@ -81,21 +81,6 @@ export class VisualizeMarkup implements IMarkup {
|
|
|
81
81
|
const visViewer = visLib.getViewer();
|
|
82
82
|
const activeView = visViewer.activeView;
|
|
83
83
|
|
|
84
|
-
this._viewer.resetActiveDragger();
|
|
85
|
-
this._viewer.clearSlices();
|
|
86
|
-
this.clearOverlay();
|
|
87
|
-
|
|
88
|
-
if (viewpoint.orthogonal_camera) {
|
|
89
|
-
activeView.setView(
|
|
90
|
-
getLogicalPoint3dAsArray(viewpoint.orthogonal_camera.view_point),
|
|
91
|
-
getLogicalPoint3dAsArray(viewpoint.orthogonal_camera.direction),
|
|
92
|
-
getLogicalPoint3dAsArray(viewpoint.orthogonal_camera.up_vector),
|
|
93
|
-
viewpoint.orthogonal_camera.field_width,
|
|
94
|
-
viewpoint.orthogonal_camera.field_height,
|
|
95
|
-
true
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
84
|
this._viewer.syncOverlay();
|
|
100
85
|
|
|
101
86
|
const markupColor = viewpoint.custom_fields.markup_color || { r: 255, g: 0, b: 0 };
|
|
@@ -139,20 +124,10 @@ export class VisualizeMarkup implements IMarkup {
|
|
|
139
124
|
}
|
|
140
125
|
}
|
|
141
126
|
|
|
142
|
-
if (viewpoint.clipping_planes) {
|
|
143
|
-
for (const plane of viewpoint.clipping_planes) {
|
|
144
|
-
const cuttingPlane = new visLib.OdTvPlane();
|
|
145
|
-
cuttingPlane.set(getLogicalPoint3dAsArray(plane.location), getLogicalPoint3dAsArray(plane.direction));
|
|
146
|
-
|
|
147
|
-
activeView.addCuttingPlane(cuttingPlane);
|
|
148
|
-
activeView.setEnableCuttingPlaneFill(true, 0x66, 0x66, 0x66);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
127
|
this._viewer.update();
|
|
153
128
|
}
|
|
154
129
|
|
|
155
|
-
|
|
130
|
+
getViewpoint(): object {
|
|
156
131
|
function getLogicalPoint3dFromArray(array) {
|
|
157
132
|
return { x: array[0], y: array[1], z: array[2] };
|
|
158
133
|
}
|
|
@@ -161,22 +136,12 @@ export class VisualizeMarkup implements IMarkup {
|
|
|
161
136
|
|
|
162
137
|
const visLib = this._viewer.visLib();
|
|
163
138
|
const visViewer = visLib.getViewer();
|
|
164
|
-
const activeView = visViewer.activeView;
|
|
165
139
|
|
|
166
140
|
const viewpoint = {
|
|
167
141
|
lines: [],
|
|
168
142
|
texts: [],
|
|
169
|
-
clipping_planes: [],
|
|
170
143
|
} as any;
|
|
171
144
|
|
|
172
|
-
viewpoint.orthogonal_camera = {
|
|
173
|
-
view_point: getLogicalPoint3dFromArray(activeView.viewPosition),
|
|
174
|
-
direction: getLogicalPoint3dFromArray(activeView.viewTarget),
|
|
175
|
-
up_vector: getLogicalPoint3dFromArray(activeView.upVector),
|
|
176
|
-
field_width: activeView.viewFieldWidth,
|
|
177
|
-
field_height: activeView.viewFieldHeight,
|
|
178
|
-
};
|
|
179
|
-
|
|
180
145
|
const model = visViewer.getMarkupModel();
|
|
181
146
|
const itr = model.getEntitiesIterator();
|
|
182
147
|
for (; !itr.done(); itr.step()) {
|
|
@@ -224,17 +189,6 @@ export class VisualizeMarkup implements IMarkup {
|
|
|
224
189
|
}
|
|
225
190
|
itr.delete();
|
|
226
191
|
|
|
227
|
-
for (let i = 0; i < activeView.numCuttingPlanes(); i++) {
|
|
228
|
-
const cuttingPlane = activeView.getCuttingPlane(i);
|
|
229
|
-
|
|
230
|
-
const plane = {
|
|
231
|
-
location: getLogicalPoint3dFromArray(cuttingPlane.getOrigin()),
|
|
232
|
-
direction: getLogicalPoint3dFromArray(cuttingPlane.normal()),
|
|
233
|
-
};
|
|
234
|
-
|
|
235
|
-
viewpoint.clipping_planes.push(plane);
|
|
236
|
-
}
|
|
237
|
-
|
|
238
192
|
viewpoint.snapshot = {
|
|
239
193
|
data: visLib.canvas.toDataURL("image/jpeg", 0.25),
|
|
240
194
|
};
|
|
@@ -270,4 +224,8 @@ export class VisualizeMarkup implements IMarkup {
|
|
|
270
224
|
clearSelected(): void {
|
|
271
225
|
throw new Error("Not implemented yet");
|
|
272
226
|
}
|
|
227
|
+
|
|
228
|
+
private getPoint3dFromArray(array) {
|
|
229
|
+
return { x: array[0], y: array[1], z: array[2] };
|
|
230
|
+
}
|
|
273
231
|
}
|
package/src/Viewer/Options.ts
CHANGED
|
@@ -89,6 +89,16 @@ export interface OptionsData {
|
|
|
89
89
|
*/
|
|
90
90
|
ambientOcclusion?: boolean;
|
|
91
91
|
|
|
92
|
+
/**
|
|
93
|
+
* Enable streaming mode
|
|
94
|
+
*
|
|
95
|
+
* If enableStreamingMode is true then enablePartialMode will be used, otherwise -
|
|
96
|
+
* enablePartialMode will be ignored and file / assembly will be loaded in one go
|
|
97
|
+
*
|
|
98
|
+
* @defaultValue true
|
|
99
|
+
*/
|
|
100
|
+
enableStreamingMode?: boolean;
|
|
101
|
+
|
|
92
102
|
/**
|
|
93
103
|
* Enable partial load mode to be able open large drawing If enablePartialMode enabled, then
|
|
94
104
|
* sceneGraph will be switched off
|
|
@@ -205,6 +215,7 @@ export class Options {
|
|
|
205
215
|
cameraAxisXSpeed: 4,
|
|
206
216
|
cameraAxisYSpeed: 1,
|
|
207
217
|
ambientOcclusion: false,
|
|
218
|
+
enableStreamingMode: true,
|
|
208
219
|
enablePartialMode: false,
|
|
209
220
|
memoryLimit: 3294967296,
|
|
210
221
|
cuttingPlaneFillColor: { red: 0xff, green: 0x98, blue: 0x00 },
|
|
@@ -354,6 +365,15 @@ export class Options {
|
|
|
354
365
|
this.notifierChangeEvent();
|
|
355
366
|
}
|
|
356
367
|
|
|
368
|
+
get enableStreamingMode(): boolean {
|
|
369
|
+
return this._data.enableStreamingMode;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
set enableStreamingMode(value: boolean) {
|
|
373
|
+
this._data.enableStreamingMode = value;
|
|
374
|
+
this.notifierChangeEvent();
|
|
375
|
+
}
|
|
376
|
+
|
|
357
377
|
get enablePartialMode(): boolean {
|
|
358
378
|
return this._data.enablePartialMode;
|
|
359
379
|
}
|