@inweb/viewer-visualize 26.10.5 → 26.11.0
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/README.md +6 -4
- package/dist/viewer-visualize.js +591 -475
- package/dist/viewer-visualize.js.map +1 -1
- package/dist/viewer-visualize.min.js +1 -1
- package/dist/viewer-visualize.module.js +583 -483
- package/dist/viewer-visualize.module.js.map +1 -1
- package/lib/Viewer/Commands/GetSelected2.d.ts +2 -0
- package/lib/Viewer/Commands/SetSelected.d.ts +1 -1
- package/lib/Viewer/Commands/SetSelected2.d.ts +2 -0
- package/lib/Viewer/Components/index.d.ts +8 -7
- package/lib/Viewer/Draggers/MeasureLineDragger/MeasureLineItem.d.ts +5 -1
- package/lib/Viewer/Draggers/MeasureLineDragger/index.d.ts +3 -2
- package/lib/Viewer/Loaders/VSFXCloudLoader.d.ts +1 -1
- package/lib/Viewer/Loaders/VSFXCloudPartialLoader.d.ts +1 -1
- package/lib/Viewer/Loaders/index.d.ts +14 -9
- package/lib/Viewer/Models/IModelImpl.d.ts +5 -0
- package/lib/Viewer/Models/ModelImpl.d.ts +5 -0
- package/lib/Viewer/Viewer.d.ts +129 -136
- package/package.json +5 -5
- package/src/Viewer/Commands/ClearSelected.ts +3 -1
- package/src/Viewer/Commands/GetSelected2.ts +33 -0
- package/src/Viewer/Commands/HideSelected.ts +3 -1
- package/src/Viewer/Commands/SelectModel.ts +2 -3
- package/src/Viewer/Commands/SetSelected.ts +5 -2
- package/src/Viewer/Commands/SetSelected2.ts +39 -0
- package/src/Viewer/Commands/index.ts +4 -0
- package/src/Viewer/Components/index.ts +8 -7
- package/src/Viewer/Draggers/Common/OdBaseDragger.ts +3 -2
- package/src/Viewer/Draggers/MeasureLineDragger/MeasureLineItem.ts +44 -13
- package/src/Viewer/Draggers/MeasureLineDragger/index.ts +53 -18
- package/src/Viewer/Draggers/OdJoyStickDragger.ts +2 -2
- package/src/Viewer/Loaders/VSFCloudLoader.ts +6 -0
- package/src/Viewer/Loaders/VSFFileLoader.ts +7 -1
- package/src/Viewer/Loaders/VSFXCloudLoader.ts +7 -1
- package/src/Viewer/Loaders/VSFXCloudPartialLoader.ts +8 -2
- package/src/Viewer/Loaders/VSFXCloudStreamingLoader.ts +7 -1
- package/src/Viewer/Loaders/VSFXFileLoader.ts +7 -1
- package/src/Viewer/Loaders/index.ts +14 -9
- package/src/Viewer/Models/IModelImpl.ts +29 -0
- package/src/Viewer/Models/ModelImpl.ts +32 -0
- package/src/Viewer/Viewer.ts +780 -775
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Viewer } from "../Viewer";
|
|
2
|
-
export declare function setSelected(viewer: Viewer,
|
|
2
|
+
export declare function setSelected(viewer: Viewer, handles2?: string[]): void;
|
|
@@ -6,8 +6,8 @@ import { IComponentsRegistry } from "@inweb/viewer-core";
|
|
|
6
6
|
*
|
|
7
7
|
* 1. Define a component class implements {@link IComponent}.
|
|
8
8
|
* 2. Define a constructor with a `viewer` parameter and add mouse event listeners for the specified viewer.
|
|
9
|
-
* 3. Define the component logic in the event listeners. For example, listen for the `
|
|
10
|
-
*
|
|
9
|
+
* 3. Define the component logic in the event listeners. For example, listen for the `geometryend` event and
|
|
10
|
+
* implement post-processing logic for the model.
|
|
11
11
|
* 4. Override {@link IComponent.dispose} and remove mouse event listeners from the viewer.
|
|
12
12
|
* 5. Register component provider in the components registry by calling the
|
|
13
13
|
* {@link components.registerComponent}.
|
|
@@ -20,18 +20,19 @@ import { IComponentsRegistry } from "@inweb/viewer-core";
|
|
|
20
20
|
* class MyComponent implements IComponent {
|
|
21
21
|
* protected viewer: Viewer;
|
|
22
22
|
*
|
|
23
|
-
*
|
|
23
|
+
* constructor(viewer: Viewer) {
|
|
24
24
|
* this.viewer = viewer;
|
|
25
|
-
* this.viewer.addEventListener("
|
|
25
|
+
* this.viewer.addEventListener("geometryend", this.onGeometryEnd);
|
|
26
26
|
* }
|
|
27
27
|
*
|
|
28
28
|
* override dispose() {
|
|
29
|
-
* this.viewer.removeEventListener("
|
|
29
|
+
* this.viewer.removeEventListener("geometryend", this.onGeometryEnd);
|
|
30
30
|
* }
|
|
31
31
|
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
32
|
+
* onGeometryEnd = (event: MouseEvent) => {
|
|
33
|
+
* this.viewer.executeCommand("zoomToExtents");
|
|
34
34
|
* };
|
|
35
|
+
*
|
|
35
36
|
* }
|
|
36
37
|
*
|
|
37
38
|
* components.registerComponent( "MyComponent", (viewer): IComponent => new MyComponent(viewer));
|
|
@@ -5,8 +5,9 @@ export declare class MeasureLineItem {
|
|
|
5
5
|
protected htmlElemTitle: HTMLElement;
|
|
6
6
|
protected startPoint: number[];
|
|
7
7
|
protected endPoint: number[];
|
|
8
|
-
protected unit: string;
|
|
9
8
|
protected scale: number;
|
|
9
|
+
protected unit: string;
|
|
10
|
+
protected precision: any;
|
|
10
11
|
protected size: number;
|
|
11
12
|
protected style: CSSStyleDeclaration;
|
|
12
13
|
protected viewer: any;
|
|
@@ -17,6 +18,8 @@ export declare class MeasureLineItem {
|
|
|
17
18
|
constructor(targetElement: HTMLElement, viewer: any, moduleInstance: any);
|
|
18
19
|
drawMeasureLine(): void;
|
|
19
20
|
getDistance(): number;
|
|
21
|
+
calculatePrecision(value: number): number;
|
|
22
|
+
formatDistance(distance: number): string;
|
|
20
23
|
setStartPoint(gePoint: number[]): void;
|
|
21
24
|
setEndPoint(gePoint: number[], isFinish: boolean): void;
|
|
22
25
|
update(): void;
|
|
@@ -24,6 +27,7 @@ export declare class MeasureLineItem {
|
|
|
24
27
|
clear(): void;
|
|
25
28
|
setUnit(unit: string): void;
|
|
26
29
|
setConversionFactor(scale: number): void;
|
|
30
|
+
setPrecision(precision: any): void;
|
|
27
31
|
setStyle(style: CSSStyleDeclaration): void;
|
|
28
32
|
setSelectionReactor(reactor: any): void;
|
|
29
33
|
setSelectability(enable: boolean): void;
|
|
@@ -6,12 +6,13 @@ export declare class MeasureLineDragger extends OdBaseDragger {
|
|
|
6
6
|
protected gripingRadius: number;
|
|
7
7
|
protected firstPoint: number[];
|
|
8
8
|
protected secondPoint: number[];
|
|
9
|
-
protected renameUnitTable: any;
|
|
10
9
|
protected items: MeasureLineItem[];
|
|
11
10
|
protected m_overlayElement: HTMLElement;
|
|
12
11
|
protected previewMeasureLine: MeasureLineItem;
|
|
13
12
|
protected conversionFactor: number;
|
|
14
|
-
protected
|
|
13
|
+
protected rulerUnitTable: any;
|
|
14
|
+
protected rulerUnit: string;
|
|
15
|
+
protected rulerPrecision: any;
|
|
15
16
|
constructor(subject: Viewer);
|
|
16
17
|
initialize(): void;
|
|
17
18
|
dispose(): void;
|
|
@@ -5,6 +5,6 @@ export declare class VSFXCloudPartialLoader extends Loader {
|
|
|
5
5
|
abortControllerForRequestMap: Map<number, AbortController>;
|
|
6
6
|
constructor(viewer: Viewer);
|
|
7
7
|
isSupport(file: any): boolean;
|
|
8
|
-
load(model: any
|
|
8
|
+
load(model: any): Promise<this>;
|
|
9
9
|
cancel(): void;
|
|
10
10
|
}
|
|
@@ -6,23 +6,24 @@ import { ILoadersRegistry } from "@inweb/viewer-core";
|
|
|
6
6
|
*
|
|
7
7
|
* 1. Define a loader class implements {@link ILoader}.
|
|
8
8
|
* 2. Define a constructor with a `viewer` parameter.
|
|
9
|
-
* 3. Override {@link ILoader.isSupport} and
|
|
9
|
+
* 3. Override {@link ILoader.isSupport} and check if the loader can load the specified file.
|
|
10
10
|
* 4. Override {@link ILoader.load} and define the logic for loading the model from the file.
|
|
11
11
|
*
|
|
12
12
|
* The loader should do:
|
|
13
13
|
*
|
|
14
14
|
* - Load model data from file into the buffer. The model data must be a `VSFX` format.
|
|
15
15
|
* - Parse data buffer with the `VisualizeJS` viewer instance.
|
|
16
|
+
* - Create `ModelImpl` instance with unique model ID add it to the viewer `models` list.
|
|
16
17
|
* - Synchronize viewer styles, options and overlay.
|
|
17
18
|
* - Update the viewer.
|
|
18
19
|
*
|
|
19
20
|
* The loader must emit events:
|
|
20
21
|
*
|
|
21
|
-
* - `geometryprogress` - during loading
|
|
22
|
-
* after the load is complete.
|
|
22
|
+
* - `geometryprogress` - during loading (or once at 100% when complete).
|
|
23
23
|
* - `databasechunk` - when model is loaded and ready to render.
|
|
24
24
|
* 5. Override {@link ILoader.dispose} and release loader resources, if required.
|
|
25
|
-
* 6.
|
|
25
|
+
* 6. Use `this.abortController` (defined in `Loader` class) to abort loading raw data.
|
|
26
|
+
* 7. Register loader provider in the loaders registry by calling the {@link loaders.registerLoader}.
|
|
26
27
|
*
|
|
27
28
|
* @example Implementing a custom loader.
|
|
28
29
|
*
|
|
@@ -38,21 +39,25 @@ import { ILoadersRegistry } from "@inweb/viewer-core";
|
|
|
38
39
|
* }
|
|
39
40
|
*
|
|
40
41
|
* override isSupport(file, format): Boolean {
|
|
41
|
-
* //
|
|
42
|
-
* return
|
|
42
|
+
* // check if this loader supports the file source and format
|
|
43
|
+
* return type file === "string" && format === "myformat";
|
|
43
44
|
* }
|
|
44
45
|
*
|
|
45
46
|
* override load(file, format, params): Promise<this> {
|
|
47
|
+
* // load VSFX data from file (custom loading logic)
|
|
48
|
+
* const data = await fetch(file).then((result) => result.arrayBuffer());
|
|
46
49
|
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
50
|
+
* const modelImpl = new ModelImpl();
|
|
51
|
+
* modelImpl.id = params.modelId;
|
|
49
52
|
*
|
|
50
|
-
* this.viewer.
|
|
53
|
+
* this.viewer.visViewer().parseVsfx(new Uint8Array(data));
|
|
54
|
+
* this.viewer.models.push(modelImpl);
|
|
51
55
|
*
|
|
52
56
|
* this.viewer.syncOptions();
|
|
53
57
|
* this.viewer.syncOverlay();
|
|
54
58
|
* this.viewer.update();
|
|
55
59
|
*
|
|
60
|
+
* this.viewer.emitEvent({ type: "geometryprogress", data: 1, file });
|
|
56
61
|
* this.viewer.emitEvent({ type: "databasechunk", data, file });
|
|
57
62
|
*
|
|
58
63
|
* return Promise.resove(this);
|
package/lib/Viewer/Viewer.d.ts
CHANGED
|
@@ -1,32 +1,33 @@
|
|
|
1
1
|
import { EventEmitter2 } from "@inweb/eventemitter2";
|
|
2
2
|
import { Assembly, Client, File, Model } from "@inweb/client";
|
|
3
|
-
import { CanvasEventMap, Dragger, FileSource, IComponent, IDragger, ILoader, IOptions, IViewer, IViewpoint,
|
|
3
|
+
import { CanvasEventMap, Dragger, FileSource, IComponent, IDragger, ILoader, IOptions, IViewer, IViewpoint, OptionsEventMap, ViewerEventMap } from "@inweb/viewer-core";
|
|
4
4
|
import { IMarkup, IWorldTransform } from "@inweb/markup";
|
|
5
|
+
import { IModelImpl } from "./Models/IModelImpl";
|
|
5
6
|
import { MarkupType } from "./Markup/MarkupFactory";
|
|
6
7
|
/**
|
|
7
|
-
* 3D viewer powered by {@link https://cloud.opendesign.com/docs/index.html#/visualizejs | VisualizeJS}
|
|
8
|
-
* library.
|
|
8
|
+
* 3D viewer powered by {@link https://cloud.opendesign.com/docs/index.html#/visualizejs | VisualizeJS}.
|
|
9
9
|
*/
|
|
10
10
|
export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMap & OptionsEventMap> implements IViewer, IWorldTransform {
|
|
11
|
+
client: Client | undefined;
|
|
12
|
+
options: IOptions;
|
|
13
|
+
canvas: HTMLCanvasElement | undefined;
|
|
14
|
+
canvasEvents: string[];
|
|
15
|
+
loaders: ILoader[];
|
|
16
|
+
models: IModelImpl[];
|
|
17
|
+
private canvaseventlistener;
|
|
18
|
+
private _visualizeJsUrl;
|
|
19
|
+
private _visualizeJs;
|
|
20
|
+
private _visualizeTimestamp;
|
|
21
|
+
private _viewer;
|
|
22
|
+
private _crossOrigin;
|
|
11
23
|
private _activeDragger;
|
|
12
24
|
private _components;
|
|
13
|
-
private _enableAutoUpdate;
|
|
14
25
|
private _renderNeeded;
|
|
15
26
|
private _renderTime;
|
|
27
|
+
private _enableAutoUpdate;
|
|
16
28
|
private _isRunAsyncUpdate;
|
|
17
|
-
protected _options: Options;
|
|
18
|
-
protected _visualizeJsUrl: string;
|
|
19
|
-
protected _visualizeJs: any;
|
|
20
|
-
protected _visualizeTimestamp: number;
|
|
21
|
-
protected _viewer: any;
|
|
22
|
-
protected _crossOrigin: any;
|
|
23
|
-
private canvaseventlistener;
|
|
24
|
-
canvasEvents: string[];
|
|
25
|
-
private _markup;
|
|
26
|
-
canvas: HTMLCanvasElement | undefined;
|
|
27
29
|
_abortControllerForReferences: AbortController | undefined;
|
|
28
|
-
|
|
29
|
-
loaders: Array<ILoader>;
|
|
30
|
+
private _markup;
|
|
30
31
|
/**
|
|
31
32
|
* @param client - The `Client` instance that is used to load model reference files from the Open Cloud
|
|
32
33
|
* Server. Do not specify `Client` if you need a standalone viewer instance to view `VSFX` files from
|
|
@@ -51,16 +52,27 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
|
|
|
51
52
|
enableAutoUpdate?: boolean;
|
|
52
53
|
markupType?: MarkupType;
|
|
53
54
|
});
|
|
54
|
-
/**
|
|
55
|
-
* Viewer options.
|
|
56
|
-
*/
|
|
57
|
-
get options(): IOptions;
|
|
58
55
|
/**
|
|
59
56
|
* `VisualizeJS` library URL. Use {@link configure | configure()} to change library URL.
|
|
60
57
|
*
|
|
61
58
|
* @readonly
|
|
62
59
|
*/
|
|
63
60
|
get visualizeJsUrl(): string;
|
|
61
|
+
/**
|
|
62
|
+
* Returns `VisualizeJS` {@link https://cloud.opendesign.com/docs/index.html#/visualizejs_api | module}
|
|
63
|
+
* instance.
|
|
64
|
+
*/
|
|
65
|
+
get visualizeJs(): any;
|
|
66
|
+
/**
|
|
67
|
+
* Returns `VisualizeJS` {@link https://cloud.opendesign.com/docs/index.html#/visualizejs_api | module}
|
|
68
|
+
* instance.
|
|
69
|
+
*/
|
|
70
|
+
visLib(): any;
|
|
71
|
+
/**
|
|
72
|
+
* Returns `VisualizeJS` {@link https://cloud.opendesign.com/docs/index.html#/vis/Viewer | Viewer}
|
|
73
|
+
* instance.
|
|
74
|
+
*/
|
|
75
|
+
visViewer(): any;
|
|
64
76
|
/**
|
|
65
77
|
* 2D markup core instance used to create markups.
|
|
66
78
|
*
|
|
@@ -83,6 +95,8 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
|
|
|
83
95
|
visualizeJsUrl?: string;
|
|
84
96
|
crossOrigin?: string;
|
|
85
97
|
}): this;
|
|
98
|
+
get draggers(): string[];
|
|
99
|
+
get components(): string[];
|
|
86
100
|
/**
|
|
87
101
|
* Loads the `VisualizeJS` module and initializes it with the specified canvas. Call
|
|
88
102
|
* {@link dispose | dispose()} to release allocated resources.
|
|
@@ -105,7 +119,6 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
|
|
|
105
119
|
*/
|
|
106
120
|
isInitialized(): boolean;
|
|
107
121
|
setSize(width: number, height: number, updateStyle?: boolean): void;
|
|
108
|
-
render(time?: DOMHighResTimeStamp): void;
|
|
109
122
|
resize(): this;
|
|
110
123
|
/**
|
|
111
124
|
* Updates the viewer.
|
|
@@ -121,83 +134,7 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
|
|
|
121
134
|
* Default is `false`.
|
|
122
135
|
*/
|
|
123
136
|
update(force?: boolean): void;
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Updates the viewer asynchronously without locking the user interface. Used to update the viewer
|
|
127
|
-
* after changes that require a long rendering time.
|
|
128
|
-
*
|
|
129
|
-
* Do nothing if the auto-update mode is disabled in the constructor. In this case, register an
|
|
130
|
-
* `update` event handler and update the `VisualizeJS` viewer and active dragger manually.
|
|
131
|
-
*
|
|
132
|
-
* Fires:
|
|
133
|
-
*
|
|
134
|
-
* - {@link UpdateEvent | update}
|
|
135
|
-
*
|
|
136
|
-
* @param maxScheduleUpdateTimeInMs - Maximum time for one update, default 30 ms.
|
|
137
|
-
* @param maxScheduleUpdateCount - Maximum count of scheduled updates.
|
|
138
|
-
*/
|
|
139
|
-
updateAsync(maxScheduleUpdateTimeInMs?: number, maxScheduleUpdateCount?: number): Promise<void>;
|
|
140
|
-
/**
|
|
141
|
-
* Returns `VisualizeJS` {@link https://cloud.opendesign.com/docs/index.html#/visualizejs_api | module}
|
|
142
|
-
* instance.
|
|
143
|
-
*/
|
|
144
|
-
get visualizeJs(): any;
|
|
145
|
-
/**
|
|
146
|
-
* Returns `VisualizeJS` {@link https://cloud.opendesign.com/docs/index.html#/visualizejs_api | module}
|
|
147
|
-
* instance.
|
|
148
|
-
*/
|
|
149
|
-
visLib(): any;
|
|
150
|
-
/**
|
|
151
|
-
* Returns `VisualizeJS` {@link https://cloud.opendesign.com/docs/index.html#/vis/Viewer | Viewer}
|
|
152
|
-
* instance.
|
|
153
|
-
*/
|
|
154
|
-
visViewer(): any;
|
|
155
|
-
syncOpenCloudVisualStyle(): this;
|
|
156
|
-
syncOptions(options?: IOptions): this;
|
|
157
|
-
syncHighlightingOptions(options?: IOptions): this;
|
|
158
|
-
get draggers(): string[];
|
|
159
|
-
get components(): string[];
|
|
160
|
-
/**
|
|
161
|
-
* Deprecated since `25.12`. Use {@link draggers.registerDragger} instead.
|
|
162
|
-
*/
|
|
163
|
-
registerDragger(name: string, dragger: typeof Dragger): void;
|
|
164
|
-
activeDragger(): IDragger | null;
|
|
165
|
-
setActiveDragger(name?: string): IDragger | null;
|
|
166
|
-
resetActiveDragger(): void;
|
|
167
|
-
getComponent(name: string): IComponent;
|
|
168
|
-
clearSlices(): void;
|
|
169
|
-
clearOverlay(): void;
|
|
170
|
-
syncOverlay(): void;
|
|
171
|
-
is3D(): boolean;
|
|
172
|
-
screenToWorld(position: {
|
|
173
|
-
x: number;
|
|
174
|
-
y: number;
|
|
175
|
-
}): {
|
|
176
|
-
x: number;
|
|
177
|
-
y: number;
|
|
178
|
-
z: number;
|
|
179
|
-
};
|
|
180
|
-
worldToScreen(position: {
|
|
181
|
-
x: number;
|
|
182
|
-
y: number;
|
|
183
|
-
z: number;
|
|
184
|
-
}): {
|
|
185
|
-
x: number;
|
|
186
|
-
y: number;
|
|
187
|
-
};
|
|
188
|
-
getScale(): {
|
|
189
|
-
x: number;
|
|
190
|
-
y: number;
|
|
191
|
-
z: number;
|
|
192
|
-
};
|
|
193
|
-
getSelected(): string[];
|
|
194
|
-
setSelected(handles?: string[]): void;
|
|
195
|
-
clearSelected(): void;
|
|
196
|
-
hideSelected(): void;
|
|
197
|
-
isolateSelected(): void;
|
|
198
|
-
showAll(): void;
|
|
199
|
-
explode(index?: number): void;
|
|
200
|
-
collect(): void;
|
|
137
|
+
render(time?: DOMHighResTimeStamp): void;
|
|
201
138
|
loadReferences(model: Model | File | Assembly): Promise<this>;
|
|
202
139
|
applyModelTransformMatrix(model: Model | Assembly): void;
|
|
203
140
|
applySceneGraphSettings(options?: IOptions): void;
|
|
@@ -216,8 +153,8 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
|
|
|
216
153
|
* thrown.
|
|
217
154
|
*
|
|
218
155
|
* For URLs, the file extension is used to determine the file format. For a `ArrayBuffer` and `Data
|
|
219
|
-
* URL`, a file format must be specified using `params.format` parameter
|
|
220
|
-
*
|
|
156
|
+
* URL`, a file format must be specified using `params.format` parameter. If no appropriate loader is
|
|
157
|
+
* found for the specified format, an exception will be thrown.
|
|
221
158
|
*
|
|
222
159
|
* If there was an active dragger before opening the file, it will be deactivated. After opening the
|
|
223
160
|
* file, you must manually activate the required dragger.
|
|
@@ -234,6 +171,8 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
|
|
|
234
171
|
*
|
|
235
172
|
* Fires:
|
|
236
173
|
*
|
|
174
|
+
* - {@link CancelEvent | cancel}
|
|
175
|
+
* - {@link ClearEvent | clear}
|
|
237
176
|
* - {@link OpenEvent | open}
|
|
238
177
|
* - {@link GeometryStartEvent | geometrystart}
|
|
239
178
|
* - {@link GeometryProgressEvent | geometryprogress}
|
|
@@ -242,19 +181,20 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
|
|
|
242
181
|
* - {@link GeometryEndEvent | geometryend}
|
|
243
182
|
* - {@link GeometryErrorEvent | geometryerror}
|
|
244
183
|
*
|
|
245
|
-
* @param file - File to load. Can be
|
|
184
|
+
* @param file - File to load. Can be:
|
|
246
185
|
*
|
|
247
186
|
* - `File`, `Assembly` or `Model` instance from the Open Cloud Server
|
|
248
|
-
* -
|
|
187
|
+
* - `URL` string
|
|
249
188
|
* - {@link https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/Data_URIs | Data URL} string
|
|
250
|
-
* - {@link https://developer.mozilla.org/docs/Web/API/File | Web API
|
|
189
|
+
* - {@link https://developer.mozilla.org/docs/Web/API/File | Web API dFile} object
|
|
251
190
|
* - {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer | ArrayBuffer}
|
|
252
191
|
* object
|
|
253
192
|
*
|
|
254
193
|
* @param params - Loading parameters.
|
|
255
|
-
* @param params.format - File format
|
|
256
|
-
* URL`.
|
|
194
|
+
* @param params.format - File format. Can be one of `vsf` or `vsfx`. Required when loading a file as
|
|
195
|
+
* `ArrayBuffer` or `Data URL`.
|
|
257
196
|
* @param params.mode - Reserved for future use.
|
|
197
|
+
* @param params.modelId - Reserved for future use.
|
|
258
198
|
* @param params.requestHeader - The
|
|
259
199
|
* {@link https://developer.mozilla.org/docs/Glossary/Request_header | request header} used in HTTP
|
|
260
200
|
* request.
|
|
@@ -266,6 +206,7 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
|
|
|
266
206
|
open(file: FileSource, params?: {
|
|
267
207
|
format?: string;
|
|
268
208
|
mode?: string;
|
|
209
|
+
modelId?: string;
|
|
269
210
|
requestHeader?: HeadersInit;
|
|
270
211
|
withCredentials?: boolean;
|
|
271
212
|
}): Promise<this>;
|
|
@@ -283,41 +224,52 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
|
|
|
283
224
|
openVsfxFile(buffer: Uint8Array | ArrayBuffer): this;
|
|
284
225
|
cancel(): this;
|
|
285
226
|
clear(): this;
|
|
227
|
+
is3D(): boolean;
|
|
228
|
+
syncOptions(options?: IOptions): this;
|
|
229
|
+
syncOverlay(): void;
|
|
230
|
+
clearOverlay(): void;
|
|
231
|
+
clearSlices(): void;
|
|
232
|
+
getSelected(): string[];
|
|
233
|
+
setSelected(handles?: string[]): void;
|
|
234
|
+
getSelected2(): string[];
|
|
235
|
+
setSelected2(handles?: string[]): void;
|
|
236
|
+
clearSelected(): void;
|
|
237
|
+
hideSelected(): void;
|
|
238
|
+
isolateSelected(): void;
|
|
239
|
+
showAll(): void;
|
|
240
|
+
explode(index?: number): void;
|
|
241
|
+
collect(): void;
|
|
286
242
|
/**
|
|
287
|
-
* Deprecated since `25.
|
|
288
|
-
*/
|
|
289
|
-
getMarkupColor(): {
|
|
290
|
-
r: number;
|
|
291
|
-
g: number;
|
|
292
|
-
b: number;
|
|
293
|
-
};
|
|
294
|
-
/**
|
|
295
|
-
* Deprecated since `25.11`. Use {@link IMarkup.setMarkupColor | markup.setMarkupColor()} instead.
|
|
296
|
-
*/
|
|
297
|
-
setMarkupColor(r?: number, g?: number, b?: number): void;
|
|
298
|
-
/**
|
|
299
|
-
* Deprecated since `25.11`. Use {@link IMarkup.colorizeAllMarkup | markup.colorizeAllMarkup()} instead.
|
|
300
|
-
*/
|
|
301
|
-
colorizeAllMarkup(r?: number, g?: number, b?: number): void;
|
|
302
|
-
/**
|
|
303
|
-
* Deprecated since `25.11`. Use
|
|
304
|
-
* {@link IMarkup.colorizeSelectedMarkups | markup.colorizeSelectedMarkups()} instead.
|
|
305
|
-
*/
|
|
306
|
-
colorizeSelectedMarkups(r?: number, g?: number, b?: number): void;
|
|
307
|
-
/**
|
|
308
|
-
* Adds an empty `Visualize` markup entity to the overlay.
|
|
243
|
+
* Deprecated since `25.12`. Use {@link draggers.registerDragger} instead.
|
|
309
244
|
*/
|
|
310
|
-
|
|
245
|
+
registerDragger(name: string, dragger: typeof Dragger): void;
|
|
246
|
+
activeDragger(): IDragger | null;
|
|
247
|
+
setActiveDragger(name?: string): IDragger | null;
|
|
248
|
+
resetActiveDragger(): void;
|
|
249
|
+
getComponent(name: string): IComponent;
|
|
311
250
|
drawViewpoint(viewpoint: IViewpoint): void;
|
|
312
251
|
createViewpoint(): IViewpoint;
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
252
|
+
screenToWorld(position: {
|
|
253
|
+
x: number;
|
|
254
|
+
y: number;
|
|
255
|
+
}): {
|
|
256
|
+
x: number;
|
|
257
|
+
y: number;
|
|
258
|
+
z: number;
|
|
259
|
+
};
|
|
260
|
+
worldToScreen(position: {
|
|
261
|
+
x: number;
|
|
262
|
+
y: number;
|
|
263
|
+
z: number;
|
|
264
|
+
}): {
|
|
265
|
+
x: number;
|
|
266
|
+
y: number;
|
|
267
|
+
};
|
|
268
|
+
getScale(): {
|
|
269
|
+
x: number;
|
|
270
|
+
y: number;
|
|
271
|
+
z: number;
|
|
272
|
+
};
|
|
321
273
|
/**
|
|
322
274
|
* Executes the command denoted by the given command. If the command is not found, tries to set active
|
|
323
275
|
* dragger with the specified name.
|
|
@@ -356,5 +308,46 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
|
|
|
356
308
|
* `undefined` if neither the command nor the dragger exists.
|
|
357
309
|
*/
|
|
358
310
|
executeCommand(id: string, ...args: any[]): any;
|
|
311
|
+
/**
|
|
312
|
+
* Adds an empty `Visualize` markup entity to the VisualizeJS overlay.
|
|
313
|
+
*/
|
|
314
|
+
addMarkupEntity(entityName: string): any;
|
|
315
|
+
/**
|
|
316
|
+
* Deprecated since `25.11`. Use {@link IMarkup.getMarkupColor | markup.getMarkupColor()} instead.
|
|
317
|
+
*/
|
|
318
|
+
getMarkupColor(): {
|
|
319
|
+
r: number;
|
|
320
|
+
g: number;
|
|
321
|
+
b: number;
|
|
322
|
+
};
|
|
323
|
+
/**
|
|
324
|
+
* Deprecated since `25.11`. Use {@link IMarkup.setMarkupColor | markup.setMarkupColor()} instead.
|
|
325
|
+
*/
|
|
326
|
+
setMarkupColor(r?: number, g?: number, b?: number): void;
|
|
327
|
+
/**
|
|
328
|
+
* Deprecated since `25.11`. Use {@link IMarkup.colorizeAllMarkup | markup.colorizeAllMarkup()} instead.
|
|
329
|
+
*/
|
|
330
|
+
colorizeAllMarkup(r?: number, g?: number, b?: number): void;
|
|
331
|
+
/**
|
|
332
|
+
* Deprecated since `25.11`. Use
|
|
333
|
+
* {@link IMarkup.colorizeSelectedMarkups | markup.colorizeSelectedMarkups()} instead.
|
|
334
|
+
*/
|
|
335
|
+
colorizeSelectedMarkups(r?: number, g?: number, b?: number): void;
|
|
336
|
+
private scheduleUpdateAsync;
|
|
337
|
+
/**
|
|
338
|
+
* Updates the viewer asynchronously without locking the user interface. Used to update the viewer
|
|
339
|
+
* after changes that require a long rendering time.
|
|
340
|
+
*
|
|
341
|
+
* Do nothing if the auto-update mode is disabled in the constructor. In this case, register an
|
|
342
|
+
* `update` event handler and update the `VisualizeJS` viewer and active dragger manually.
|
|
343
|
+
*
|
|
344
|
+
* Fires:
|
|
345
|
+
*
|
|
346
|
+
* - {@link UpdateEvent | update}
|
|
347
|
+
*
|
|
348
|
+
* @param maxScheduleUpdateTimeInMs - Maximum time for one update, default 30 ms.
|
|
349
|
+
* @param maxScheduleUpdateCount - Maximum count of scheduled updates.
|
|
350
|
+
*/
|
|
351
|
+
updateAsync(maxScheduleUpdateTimeInMs?: number, maxScheduleUpdateCount?: number): Promise<void>;
|
|
359
352
|
deviceAutoRegeneration(): void;
|
|
360
353
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inweb/viewer-visualize",
|
|
3
|
-
"version": "26.
|
|
3
|
+
"version": "26.11.0",
|
|
4
4
|
"description": "JavaScript library for rendering CAD and BIM files in a browser using VisualizeJS",
|
|
5
5
|
"homepage": "https://cloud.opendesign.com/docs/index.html",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"docs": "typedoc"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@inweb/client": "~26.
|
|
33
|
-
"@inweb/eventemitter2": "~26.
|
|
34
|
-
"@inweb/markup": "~26.
|
|
35
|
-
"@inweb/viewer-core": "~26.
|
|
32
|
+
"@inweb/client": "~26.11.0",
|
|
33
|
+
"@inweb/eventemitter2": "~26.11.0",
|
|
34
|
+
"@inweb/markup": "~26.11.0",
|
|
35
|
+
"@inweb/viewer-core": "~26.11.0"
|
|
36
36
|
},
|
|
37
37
|
"visualizeJS": "https://public-fhemb7e3embacwec.z02.azurefd.net/libs/visualizejs/master/Visualize.js"
|
|
38
38
|
}
|
|
@@ -30,5 +30,7 @@ export function clearSelected(viewer: Viewer): void {
|
|
|
30
30
|
visViewer.unselect();
|
|
31
31
|
|
|
32
32
|
viewer.update();
|
|
33
|
-
|
|
33
|
+
|
|
34
|
+
viewer.emitEvent({ type: "select", handles: [] });
|
|
35
|
+
viewer.emitEvent({ type: "select2", handles: [] });
|
|
34
36
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
// Copyright (C) 2002-2025, 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-2025 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 { Viewer } from "../Viewer";
|
|
25
|
+
|
|
26
|
+
export function getSelected2(viewer: Viewer): string[] {
|
|
27
|
+
const handles = viewer.executeCommand("getSelected");
|
|
28
|
+
|
|
29
|
+
const model = viewer.models[0];
|
|
30
|
+
const handles2 = handles.map((handle) => `${model.id}:${handle}`);
|
|
31
|
+
|
|
32
|
+
return handles2;
|
|
33
|
+
}
|
|
@@ -30,6 +30,8 @@ export function hideSelected(viewer: Viewer): void {
|
|
|
30
30
|
visViewer.hideSelectedObjects(false);
|
|
31
31
|
|
|
32
32
|
viewer.update();
|
|
33
|
+
|
|
33
34
|
viewer.emitEvent({ type: "hide" });
|
|
34
|
-
viewer.emitEvent({ type: "select",
|
|
35
|
+
viewer.emitEvent({ type: "select", handles: [] });
|
|
36
|
+
viewer.emitEvent({ type: "select2", handles: [] });
|
|
35
37
|
}
|
|
@@ -34,12 +34,11 @@ export function selectModel(viewer: Viewer, handle: string): void {
|
|
|
34
34
|
const modelPtr = modelItr.getModel();
|
|
35
35
|
if (modelPtr.getDatabaseHandle() === handle) {
|
|
36
36
|
const selectionSet = activeView.selectCrossing([0, 9999, 9999, 0], modelPtr);
|
|
37
|
-
|
|
38
37
|
visViewer.setSelected(selectionSet);
|
|
39
|
-
const handles = viewer.getSelected();
|
|
40
38
|
|
|
41
39
|
viewer.update();
|
|
42
|
-
viewer.emitEvent({ type: "select",
|
|
40
|
+
viewer.emitEvent({ type: "select", handles: viewer.getSelected() });
|
|
41
|
+
viewer.emitEvent({ type: "select2", handles: viewer.getSelected2() });
|
|
43
42
|
|
|
44
43
|
selectionSet.delete();
|
|
45
44
|
break;
|