@inweb/viewer-visualize 26.10.6 → 26.12.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 +659 -496
- package/dist/viewer-visualize.js.map +1 -1
- package/dist/viewer-visualize.min.js +1 -1
- package/dist/viewer-visualize.module.js +585 -484
- 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 +130 -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 +784 -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,34 @@
|
|
|
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, IInfo, 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
|
+
info: IInfo;
|
|
18
|
+
private canvaseventlistener;
|
|
19
|
+
private _visualizeJsUrl;
|
|
20
|
+
private _visualizeJs;
|
|
21
|
+
private _visualizeTimestamp;
|
|
22
|
+
private _viewer;
|
|
23
|
+
private _crossOrigin;
|
|
11
24
|
private _activeDragger;
|
|
12
25
|
private _components;
|
|
13
|
-
private _enableAutoUpdate;
|
|
14
26
|
private _renderNeeded;
|
|
15
27
|
private _renderTime;
|
|
28
|
+
private _enableAutoUpdate;
|
|
16
29
|
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
30
|
_abortControllerForReferences: AbortController | undefined;
|
|
28
|
-
|
|
29
|
-
loaders: Array<ILoader>;
|
|
31
|
+
private _markup;
|
|
30
32
|
/**
|
|
31
33
|
* @param client - The `Client` instance that is used to load model reference files from the Open Cloud
|
|
32
34
|
* Server. Do not specify `Client` if you need a standalone viewer instance to view `VSFX` files from
|
|
@@ -51,16 +53,27 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
|
|
|
51
53
|
enableAutoUpdate?: boolean;
|
|
52
54
|
markupType?: MarkupType;
|
|
53
55
|
});
|
|
54
|
-
/**
|
|
55
|
-
* Viewer options.
|
|
56
|
-
*/
|
|
57
|
-
get options(): IOptions;
|
|
58
56
|
/**
|
|
59
57
|
* `VisualizeJS` library URL. Use {@link configure | configure()} to change library URL.
|
|
60
58
|
*
|
|
61
59
|
* @readonly
|
|
62
60
|
*/
|
|
63
61
|
get visualizeJsUrl(): string;
|
|
62
|
+
/**
|
|
63
|
+
* Returns `VisualizeJS` {@link https://cloud.opendesign.com/docs/index.html#/visualizejs_api | module}
|
|
64
|
+
* instance.
|
|
65
|
+
*/
|
|
66
|
+
get visualizeJs(): any;
|
|
67
|
+
/**
|
|
68
|
+
* Returns `VisualizeJS` {@link https://cloud.opendesign.com/docs/index.html#/visualizejs_api | module}
|
|
69
|
+
* instance.
|
|
70
|
+
*/
|
|
71
|
+
visLib(): any;
|
|
72
|
+
/**
|
|
73
|
+
* Returns `VisualizeJS` {@link https://cloud.opendesign.com/docs/index.html#/vis/Viewer | Viewer}
|
|
74
|
+
* instance.
|
|
75
|
+
*/
|
|
76
|
+
visViewer(): any;
|
|
64
77
|
/**
|
|
65
78
|
* 2D markup core instance used to create markups.
|
|
66
79
|
*
|
|
@@ -83,6 +96,8 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
|
|
|
83
96
|
visualizeJsUrl?: string;
|
|
84
97
|
crossOrigin?: string;
|
|
85
98
|
}): this;
|
|
99
|
+
get draggers(): string[];
|
|
100
|
+
get components(): string[];
|
|
86
101
|
/**
|
|
87
102
|
* Loads the `VisualizeJS` module and initializes it with the specified canvas. Call
|
|
88
103
|
* {@link dispose | dispose()} to release allocated resources.
|
|
@@ -105,7 +120,6 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
|
|
|
105
120
|
*/
|
|
106
121
|
isInitialized(): boolean;
|
|
107
122
|
setSize(width: number, height: number, updateStyle?: boolean): void;
|
|
108
|
-
render(time?: DOMHighResTimeStamp): void;
|
|
109
123
|
resize(): this;
|
|
110
124
|
/**
|
|
111
125
|
* Updates the viewer.
|
|
@@ -121,83 +135,7 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
|
|
|
121
135
|
* Default is `false`.
|
|
122
136
|
*/
|
|
123
137
|
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;
|
|
138
|
+
render(time?: DOMHighResTimeStamp): void;
|
|
201
139
|
loadReferences(model: Model | File | Assembly): Promise<this>;
|
|
202
140
|
applyModelTransformMatrix(model: Model | Assembly): void;
|
|
203
141
|
applySceneGraphSettings(options?: IOptions): void;
|
|
@@ -216,8 +154,8 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
|
|
|
216
154
|
* thrown.
|
|
217
155
|
*
|
|
218
156
|
* 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
|
-
*
|
|
157
|
+
* URL`, a file format must be specified using `params.format` parameter. If no appropriate loader is
|
|
158
|
+
* found for the specified format, an exception will be thrown.
|
|
221
159
|
*
|
|
222
160
|
* If there was an active dragger before opening the file, it will be deactivated. After opening the
|
|
223
161
|
* file, you must manually activate the required dragger.
|
|
@@ -234,6 +172,8 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
|
|
|
234
172
|
*
|
|
235
173
|
* Fires:
|
|
236
174
|
*
|
|
175
|
+
* - {@link CancelEvent | cancel}
|
|
176
|
+
* - {@link ClearEvent | clear}
|
|
237
177
|
* - {@link OpenEvent | open}
|
|
238
178
|
* - {@link GeometryStartEvent | geometrystart}
|
|
239
179
|
* - {@link GeometryProgressEvent | geometryprogress}
|
|
@@ -242,19 +182,20 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
|
|
|
242
182
|
* - {@link GeometryEndEvent | geometryend}
|
|
243
183
|
* - {@link GeometryErrorEvent | geometryerror}
|
|
244
184
|
*
|
|
245
|
-
* @param file - File to load. Can be
|
|
185
|
+
* @param file - File to load. Can be:
|
|
246
186
|
*
|
|
247
187
|
* - `File`, `Assembly` or `Model` instance from the Open Cloud Server
|
|
248
|
-
* -
|
|
188
|
+
* - `URL` string
|
|
249
189
|
* - {@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
|
|
190
|
+
* - {@link https://developer.mozilla.org/docs/Web/API/File | Web API dFile} object
|
|
251
191
|
* - {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer | ArrayBuffer}
|
|
252
192
|
* object
|
|
253
193
|
*
|
|
254
194
|
* @param params - Loading parameters.
|
|
255
|
-
* @param params.format - File format
|
|
256
|
-
* URL`.
|
|
195
|
+
* @param params.format - File format. Can be one of `vsf` or `vsfx`. Required when loading a file as
|
|
196
|
+
* `ArrayBuffer` or `Data URL`.
|
|
257
197
|
* @param params.mode - Reserved for future use.
|
|
198
|
+
* @param params.modelId - Reserved for future use.
|
|
258
199
|
* @param params.requestHeader - The
|
|
259
200
|
* {@link https://developer.mozilla.org/docs/Glossary/Request_header | request header} used in HTTP
|
|
260
201
|
* request.
|
|
@@ -266,6 +207,7 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
|
|
|
266
207
|
open(file: FileSource, params?: {
|
|
267
208
|
format?: string;
|
|
268
209
|
mode?: string;
|
|
210
|
+
modelId?: string;
|
|
269
211
|
requestHeader?: HeadersInit;
|
|
270
212
|
withCredentials?: boolean;
|
|
271
213
|
}): Promise<this>;
|
|
@@ -283,41 +225,52 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
|
|
|
283
225
|
openVsfxFile(buffer: Uint8Array | ArrayBuffer): this;
|
|
284
226
|
cancel(): this;
|
|
285
227
|
clear(): this;
|
|
228
|
+
is3D(): boolean;
|
|
229
|
+
syncOptions(options?: IOptions): this;
|
|
230
|
+
syncOverlay(): void;
|
|
231
|
+
clearOverlay(): void;
|
|
232
|
+
clearSlices(): void;
|
|
233
|
+
getSelected(): string[];
|
|
234
|
+
setSelected(handles?: string[]): void;
|
|
235
|
+
getSelected2(): string[];
|
|
236
|
+
setSelected2(handles?: string[]): void;
|
|
237
|
+
clearSelected(): void;
|
|
238
|
+
hideSelected(): void;
|
|
239
|
+
isolateSelected(): void;
|
|
240
|
+
showAll(): void;
|
|
241
|
+
explode(index?: number): void;
|
|
242
|
+
collect(): void;
|
|
286
243
|
/**
|
|
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.
|
|
244
|
+
* Deprecated since `25.12`. Use {@link draggers.registerDragger} instead.
|
|
309
245
|
*/
|
|
310
|
-
|
|
246
|
+
registerDragger(name: string, dragger: typeof Dragger): void;
|
|
247
|
+
activeDragger(): IDragger | null;
|
|
248
|
+
setActiveDragger(name?: string): IDragger | null;
|
|
249
|
+
resetActiveDragger(): void;
|
|
250
|
+
getComponent(name: string): IComponent;
|
|
311
251
|
drawViewpoint(viewpoint: IViewpoint): void;
|
|
312
252
|
createViewpoint(): IViewpoint;
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
253
|
+
screenToWorld(position: {
|
|
254
|
+
x: number;
|
|
255
|
+
y: number;
|
|
256
|
+
}): {
|
|
257
|
+
x: number;
|
|
258
|
+
y: number;
|
|
259
|
+
z: number;
|
|
260
|
+
};
|
|
261
|
+
worldToScreen(position: {
|
|
262
|
+
x: number;
|
|
263
|
+
y: number;
|
|
264
|
+
z: number;
|
|
265
|
+
}): {
|
|
266
|
+
x: number;
|
|
267
|
+
y: number;
|
|
268
|
+
};
|
|
269
|
+
getScale(): {
|
|
270
|
+
x: number;
|
|
271
|
+
y: number;
|
|
272
|
+
z: number;
|
|
273
|
+
};
|
|
321
274
|
/**
|
|
322
275
|
* Executes the command denoted by the given command. If the command is not found, tries to set active
|
|
323
276
|
* dragger with the specified name.
|
|
@@ -356,5 +309,46 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
|
|
|
356
309
|
* `undefined` if neither the command nor the dragger exists.
|
|
357
310
|
*/
|
|
358
311
|
executeCommand(id: string, ...args: any[]): any;
|
|
312
|
+
/**
|
|
313
|
+
* Adds an empty `Visualize` markup entity to the VisualizeJS overlay.
|
|
314
|
+
*/
|
|
315
|
+
addMarkupEntity(entityName: string): any;
|
|
316
|
+
/**
|
|
317
|
+
* Deprecated since `25.11`. Use {@link IMarkup.getMarkupColor | markup.getMarkupColor()} instead.
|
|
318
|
+
*/
|
|
319
|
+
getMarkupColor(): {
|
|
320
|
+
r: number;
|
|
321
|
+
g: number;
|
|
322
|
+
b: number;
|
|
323
|
+
};
|
|
324
|
+
/**
|
|
325
|
+
* Deprecated since `25.11`. Use {@link IMarkup.setMarkupColor | markup.setMarkupColor()} instead.
|
|
326
|
+
*/
|
|
327
|
+
setMarkupColor(r?: number, g?: number, b?: number): void;
|
|
328
|
+
/**
|
|
329
|
+
* Deprecated since `25.11`. Use {@link IMarkup.colorizeAllMarkup | markup.colorizeAllMarkup()} instead.
|
|
330
|
+
*/
|
|
331
|
+
colorizeAllMarkup(r?: number, g?: number, b?: number): void;
|
|
332
|
+
/**
|
|
333
|
+
* Deprecated since `25.11`. Use
|
|
334
|
+
* {@link IMarkup.colorizeSelectedMarkups | markup.colorizeSelectedMarkups()} instead.
|
|
335
|
+
*/
|
|
336
|
+
colorizeSelectedMarkups(r?: number, g?: number, b?: number): void;
|
|
337
|
+
private scheduleUpdateAsync;
|
|
338
|
+
/**
|
|
339
|
+
* Updates the viewer asynchronously without locking the user interface. Used to update the viewer
|
|
340
|
+
* after changes that require a long rendering time.
|
|
341
|
+
*
|
|
342
|
+
* Do nothing if the auto-update mode is disabled in the constructor. In this case, register an
|
|
343
|
+
* `update` event handler and update the `VisualizeJS` viewer and active dragger manually.
|
|
344
|
+
*
|
|
345
|
+
* Fires:
|
|
346
|
+
*
|
|
347
|
+
* - {@link UpdateEvent | update}
|
|
348
|
+
*
|
|
349
|
+
* @param maxScheduleUpdateTimeInMs - Maximum time for one update, default 30 ms.
|
|
350
|
+
* @param maxScheduleUpdateCount - Maximum count of scheduled updates.
|
|
351
|
+
*/
|
|
352
|
+
updateAsync(maxScheduleUpdateTimeInMs?: number, maxScheduleUpdateCount?: number): Promise<void>;
|
|
359
353
|
deviceAutoRegeneration(): void;
|
|
360
354
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inweb/viewer-visualize",
|
|
3
|
-
"version": "26.
|
|
3
|
+
"version": "26.12.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.12.0",
|
|
33
|
+
"@inweb/eventemitter2": "~26.12.0",
|
|
34
|
+
"@inweb/markup": "~26.12.0",
|
|
35
|
+
"@inweb/viewer-core": "~26.12.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;
|