@inweb/viewer-visualize 25.8.16 → 25.8.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/README.md +41 -19
- package/dist/viewer-visualize.js +97 -84
- package/dist/viewer-visualize.js.map +1 -1
- package/dist/viewer-visualize.min.js +1 -1
- package/dist/viewer-visualize.module.js +34 -20
- package/dist/viewer-visualize.module.js.map +1 -1
- package/lib/Viewer/Markup/MarkupFactory.d.ts +2 -6
- package/lib/Viewer/Viewer.d.ts +66 -63
- package/package.json +6 -6
- package/src/Viewer/Draggers/OdZoomDragger.ts +1 -1
- package/src/Viewer/Markup/MarkupFactory.ts +5 -9
- package/src/Viewer/Viewer.ts +75 -70
package/README.md
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
# Viewer.visualize
|
|
2
2
|
|
|
3
|
-
`Viewer.visualize` is JavaScript library powered by [
|
|
3
|
+
`Viewer.visualize` is JavaScript library implementating 3D viewer powered by [VisualizeJS](https://cloud.opendesign.com/docs/index.html#/visualizejs) for in-browser visualization of 3D CAD and BIM data files.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
With `Viewer.visualize` you can:
|
|
6
|
+
|
|
7
|
+
- Visualize files stored on the [Open Cloud Server](https://cloud.opendesign.com/docs/index.html#/opencloud_server), on the web, or on your local computer.
|
|
8
|
+
- Add user interaction with scenes.
|
|
9
|
+
- Create markups.
|
|
10
|
+
- Save and load viewpoints.
|
|
11
|
+
|
|
12
|
+
This library is a part of [CDE SDK](https://www.opendesign.com/products/cde) by [Open Design Alliance](https://opendesign.com).
|
|
6
13
|
|
|
7
14
|
> `Viewer.visualize` uses `VSFX` file format as internal geometry data format. `VSFX` is a [Visualize SDK](https://cloud.opendesign.com/docs/index.html#/visualizejs) file format with support for streaming and partial viewing.
|
|
8
15
|
|
|
@@ -18,6 +25,12 @@ For CDN, you can use [unpkg](https://unpkg.com/) or [jsDelivr](https://www.jsdel
|
|
|
18
25
|
|
|
19
26
|
The global namespace for `Viewer.visualize` is `ODA.Visualize`.
|
|
20
27
|
|
|
28
|
+
```html
|
|
29
|
+
<script>
|
|
30
|
+
const viewer = new ODA.Visualize.Viewer();
|
|
31
|
+
</script>
|
|
32
|
+
```
|
|
33
|
+
|
|
21
34
|
### Install via [npm](https://npmjs.org)
|
|
22
35
|
|
|
23
36
|
Open a terminal in your project folder and run:
|
|
@@ -30,6 +43,7 @@ The `Viewer.visualize` package will be downloaded and installed. Then you're rea
|
|
|
30
43
|
|
|
31
44
|
```javascript
|
|
32
45
|
import { Viewer } from "@inweb/viewer-visualize";
|
|
46
|
+
const viewer = new Viewer();
|
|
33
47
|
```
|
|
34
48
|
|
|
35
49
|
## Example
|
|
@@ -37,23 +51,31 @@ import { Viewer } from "@inweb/viewer-visualize";
|
|
|
37
51
|
Download and render file from the `Open Cloud Server`:
|
|
38
52
|
|
|
39
53
|
```html
|
|
40
|
-
<
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
<
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
<html>
|
|
55
|
+
<body>
|
|
56
|
+
<div>
|
|
57
|
+
<canvas id="canvas" />
|
|
58
|
+
</div>
|
|
59
|
+
|
|
60
|
+
<script src="https://unpkg.com/@inweb/client@25.3/dist/client.js"></script>
|
|
61
|
+
<script src="https://unpkg.com/@inweb/viewer-visualize@25.3/dist/viewer-visualize.js"></script>
|
|
62
|
+
|
|
63
|
+
<script>
|
|
64
|
+
const client = new ODA.Api.Client({ serverUrl: "https://cloud.opendesign.com/api" });
|
|
65
|
+
const viewer = new ODA.Visualize.Viewer(client);
|
|
66
|
+
|
|
67
|
+
init();
|
|
68
|
+
|
|
69
|
+
async function init() {
|
|
70
|
+
await client.signInWithEmail("email", "password");
|
|
71
|
+
const files = await client.getFiles();
|
|
72
|
+
await viewer.initialize(canvas);
|
|
73
|
+
await viewer.open(files.result[0]);
|
|
74
|
+
viewer.setActiveDragger("Orbit");
|
|
75
|
+
}
|
|
76
|
+
</script>
|
|
77
|
+
</body>
|
|
78
|
+
</html>
|
|
57
79
|
```
|
|
58
80
|
|
|
59
81
|
To learn more, see [First application guide](https://cloud.opendesign.com/docs/index.html#/guide).
|
package/dist/viewer-visualize.js
CHANGED
|
@@ -12800,10 +12800,11 @@
|
|
|
12800
12800
|
constructor(params, ref = null) {
|
|
12801
12801
|
var _a, _b;
|
|
12802
12802
|
this._ratio = 1;
|
|
12803
|
+
this.EPSILON = 1e-5;
|
|
12803
12804
|
if (ref) {
|
|
12804
12805
|
this._ref = ref;
|
|
12805
12806
|
this._canvasImage = ref.image();
|
|
12806
|
-
this._ratio = this._ref.height()
|
|
12807
|
+
this._ratio = this._ref.height() <= this.EPSILON || this._ref.width() <= this.EPSILON ? 1 : this._ref.height() / this._ref.width();
|
|
12807
12808
|
return;
|
|
12808
12809
|
}
|
|
12809
12810
|
if (!params || !params.position || !params.src) return;
|
|
@@ -12818,9 +12819,22 @@
|
|
|
12818
12819
|
});
|
|
12819
12820
|
this._canvasImage.onload = () => {
|
|
12820
12821
|
this._ref.image(this._canvasImage);
|
|
12821
|
-
if (this._ref.height()
|
|
12822
|
-
if (this._ref.width()
|
|
12823
|
-
this._ratio = this._ref.height()
|
|
12822
|
+
if (this._ref.height() <= this.EPSILON) this._ref.height(this._canvasImage.height);
|
|
12823
|
+
if (this._ref.width() <= this.EPSILON) this._ref.width(this._canvasImage.width);
|
|
12824
|
+
this._ratio = this._ref.height() <= this.EPSILON || this._ref.width() <= this.EPSILON ? 1 : this._ref.height() / this._ref.width();
|
|
12825
|
+
if ((params.width <= this.EPSILON || params.height <= this.EPSILON) && (params.maxWidth >= this.EPSILON || params.maxWidth >= this.EPSILON)) {
|
|
12826
|
+
const heightOutOfCanvas = params.maxHeight - this._canvasImage.height;
|
|
12827
|
+
const widthOutOfCanvas = params.maxWidth - this._canvasImage.width;
|
|
12828
|
+
if (heightOutOfCanvas <= this.EPSILON || widthOutOfCanvas <= this.EPSILON) {
|
|
12829
|
+
if (widthOutOfCanvas <= this.EPSILON && widthOutOfCanvas < heightOutOfCanvas / this._ratio) {
|
|
12830
|
+
this._ref.height(params.maxWidth * this._ratio);
|
|
12831
|
+
this._ref.width(params.maxWidth);
|
|
12832
|
+
} else {
|
|
12833
|
+
this._ref.width(params.maxHeight / this._ratio);
|
|
12834
|
+
this._ref.height(params.maxHeight);
|
|
12835
|
+
}
|
|
12836
|
+
}
|
|
12837
|
+
}
|
|
12824
12838
|
};
|
|
12825
12839
|
this._canvasImage.src = params.src;
|
|
12826
12840
|
this._ref.on("transform", (e => {
|
|
@@ -13917,6 +13931,8 @@
|
|
|
13917
13931
|
src: src,
|
|
13918
13932
|
width: width,
|
|
13919
13933
|
height: height,
|
|
13934
|
+
maxWidth: this._konvaStage.width() - position.x,
|
|
13935
|
+
maxHeight: this._konvaStage.height() - position.y,
|
|
13920
13936
|
id: id
|
|
13921
13937
|
});
|
|
13922
13938
|
this.addObject(konvaImage);
|
|
@@ -15375,7 +15391,7 @@
|
|
|
15375
15391
|
this.beginInteractivity();
|
|
15376
15392
|
}
|
|
15377
15393
|
drag(x, y, dltX, dltY) {
|
|
15378
|
-
if (this.press) {
|
|
15394
|
+
if (this.press && Math.abs(dltY) <= 10e-6) {
|
|
15379
15395
|
const ZOOM_SPEED = 0.025;
|
|
15380
15396
|
const zoomFactor = dltY > 0 ? 1 + ZOOM_SPEED : 1 - ZOOM_SPEED;
|
|
15381
15397
|
this._zoomAction.action(this.pressX, this.pressY, zoomFactor);
|
|
@@ -16568,23 +16584,14 @@
|
|
|
16568
16584
|
}
|
|
16569
16585
|
|
|
16570
16586
|
///////////////////////////////////////////////////////////////////////////////
|
|
16571
|
-
/**
|
|
16572
|
-
* The markup type: `Visualize` (deprecated) or `Konva`.
|
|
16573
|
-
*/
|
|
16574
|
-
exports.MarkupType = void 0;
|
|
16575
|
-
(function (MarkupType) {
|
|
16576
|
-
MarkupType[MarkupType["Unknown"] = 0] = "Unknown";
|
|
16577
|
-
MarkupType["Konva"] = "Konva";
|
|
16578
|
-
MarkupType["Visualize"] = "Visualize";
|
|
16579
|
-
})(exports.MarkupType || (exports.MarkupType = {}));
|
|
16580
16587
|
class MarkupFactory {
|
|
16581
|
-
static createMarkup(markupType =
|
|
16588
|
+
static createMarkup(markupType = "Konva") {
|
|
16582
16589
|
let markup;
|
|
16583
16590
|
switch (markupType) {
|
|
16584
|
-
case
|
|
16591
|
+
case "Konva":
|
|
16585
16592
|
markup = new KonvaMarkup();
|
|
16586
16593
|
break;
|
|
16587
|
-
case
|
|
16594
|
+
case "Visualize":
|
|
16588
16595
|
markup = new VisualizeMarkup();
|
|
16589
16596
|
break;
|
|
16590
16597
|
default:
|
|
@@ -16598,24 +16605,22 @@
|
|
|
16598
16605
|
const OVERLAY_VIEW_NAME = "$OVERLAY_VIEW_NAME";
|
|
16599
16606
|
const isExist = (value) => value !== undefined && value !== null;
|
|
16600
16607
|
/**
|
|
16601
|
-
*
|
|
16608
|
+
* 3D viewer powered by
|
|
16602
16609
|
* {@link https://cloud.opendesign.com/docs/index.html#/visualizejs | VisualizeJS} library.
|
|
16603
16610
|
*/
|
|
16604
16611
|
class Viewer extends EventEmitter2 {
|
|
16605
16612
|
/**
|
|
16606
|
-
* @param client - The `Client` instance that provides access to a
|
|
16607
|
-
* `Client` if you need a standalone viewer instance
|
|
16613
|
+
* @param client - The `Client` instance that provides access to a Open Cloud Server. Do not
|
|
16614
|
+
* specify `Client` if you need a standalone viewer instance to view `VSFX` files from the
|
|
16615
|
+
* web or from local computer.
|
|
16608
16616
|
* @param params - An object containing viewer configuration parameters.
|
|
16609
16617
|
* @param params.visualizeJsUrl - `VisualizeJS` library URL. Set this URL to use your own
|
|
16610
|
-
* library instance, or
|
|
16611
|
-
* `
|
|
16612
|
-
*
|
|
16613
|
-
* _Note: Your own `VisualizeJS` library version must match the version of the `Client.js`
|
|
16614
|
-
* you are using._
|
|
16618
|
+
* library instance, or specify `undefined` or blank to use the default URL defined by
|
|
16619
|
+
* `Viewer.visualize` library you are using.
|
|
16615
16620
|
* @param params.enableAutoUpdate - Enable auto-update of the viewer after any changes. If
|
|
16616
|
-
* the auto-update is disabled, you need to register
|
|
16617
|
-
* the viewer and
|
|
16618
|
-
* @param params.markupType -
|
|
16621
|
+
* the auto-update is disabled, you need to register an `update` event handler and update
|
|
16622
|
+
* the `VisualizeJS` viewer and active dragger manually. Default is `true`.
|
|
16623
|
+
* @param params.markupType - The type of the markup core: `Visualize` (deprecated) or
|
|
16619
16624
|
* `Konva`. Default is `Konva`.
|
|
16620
16625
|
*/
|
|
16621
16626
|
constructor(client, params = {}) {
|
|
@@ -16665,7 +16670,7 @@
|
|
|
16665
16670
|
return this._visualizeJsUrl;
|
|
16666
16671
|
}
|
|
16667
16672
|
/**
|
|
16668
|
-
* 2D markup core.
|
|
16673
|
+
* 2D markup core instance used to create markups.
|
|
16669
16674
|
*
|
|
16670
16675
|
* @readonly
|
|
16671
16676
|
*/
|
|
@@ -16673,18 +16678,19 @@
|
|
|
16673
16678
|
return this._markup;
|
|
16674
16679
|
}
|
|
16675
16680
|
/**
|
|
16676
|
-
*
|
|
16681
|
+
* Changes the viewer parameters.
|
|
16677
16682
|
*
|
|
16678
|
-
* @param params - An object containing new
|
|
16683
|
+
* @param params - An object containing new parameters.
|
|
16679
16684
|
* @param params.visualizeJsUrl - `VisualizeJS` library URL. Set this URL to use your own
|
|
16680
|
-
* library instance or
|
|
16685
|
+
* library instance or specify `undefined` or blank to use the default URL defined by
|
|
16686
|
+
* `Viewer.visualize` library you are using.
|
|
16681
16687
|
*/
|
|
16682
16688
|
configure(params) {
|
|
16683
16689
|
this._visualizeJsUrl = params.visualizeJsUrl || "https://opencloud.azureedge.net/libs/visualizejs/master/Visualize.js";
|
|
16684
16690
|
return this;
|
|
16685
16691
|
}
|
|
16686
16692
|
/**
|
|
16687
|
-
*
|
|
16693
|
+
* Loads the `VisualizeJS` module and initialize it with the specified canvas. Call
|
|
16688
16694
|
* {@link dispose | dispose()} to release allocated resources.
|
|
16689
16695
|
*
|
|
16690
16696
|
* Fires:
|
|
@@ -16739,8 +16745,8 @@
|
|
|
16739
16745
|
return this;
|
|
16740
16746
|
}
|
|
16741
16747
|
/**
|
|
16742
|
-
* Releases all resources allocated by this
|
|
16743
|
-
*
|
|
16748
|
+
* Releases all resources allocated by this viewer instance. Call this method before release
|
|
16749
|
+
* the `Viewer` instance.
|
|
16744
16750
|
*/
|
|
16745
16751
|
dispose() {
|
|
16746
16752
|
this.cancel();
|
|
@@ -16771,7 +16777,7 @@
|
|
|
16771
16777
|
return this;
|
|
16772
16778
|
}
|
|
16773
16779
|
/**
|
|
16774
|
-
* Returns `true` if `VisualizeJS` module has been loaded
|
|
16780
|
+
* Returns `true` if `VisualizeJS` module has been loaded and initialized.
|
|
16775
16781
|
*/
|
|
16776
16782
|
isInitialized() {
|
|
16777
16783
|
return !!this.visualizeJs;
|
|
@@ -16807,8 +16813,10 @@
|
|
|
16807
16813
|
return this;
|
|
16808
16814
|
}
|
|
16809
16815
|
/**
|
|
16810
|
-
* Updates the viewer.
|
|
16811
|
-
*
|
|
16816
|
+
* Updates the viewer.
|
|
16817
|
+
*
|
|
16818
|
+
* Do nothing if the auto-update mode is disabled in the constructor. In this case, register
|
|
16819
|
+
* an `update` event handler and update the `Visualize` viewer and active dragger manually.
|
|
16812
16820
|
*
|
|
16813
16821
|
* Fires:
|
|
16814
16822
|
*
|
|
@@ -16830,21 +16838,16 @@
|
|
|
16830
16838
|
}
|
|
16831
16839
|
this.emitEvent({ type: "update", data: force });
|
|
16832
16840
|
}
|
|
16833
|
-
/**
|
|
16834
|
-
* Update with internal schedule, need after change operation when have long update for
|
|
16835
|
-
* update without lock UI
|
|
16836
|
-
*
|
|
16837
|
-
* @param maxScheduleUpdateTimeInMs - Maximum time for one update, by default 30 ms
|
|
16838
|
-
* @param maxScheduleUpdateCount - Maximum count of schedule update
|
|
16839
|
-
* @returns return void Promise
|
|
16840
|
-
*/
|
|
16841
16841
|
scheduleUpdateAsync(maxScheduleUpdateTimeInMs = 50) {
|
|
16842
16842
|
return new Promise((resolve, reject) => {
|
|
16843
16843
|
setTimeout(() => {
|
|
16844
16844
|
var _a, _b;
|
|
16845
16845
|
try {
|
|
16846
|
-
(
|
|
16847
|
-
|
|
16846
|
+
if (this._enableAutoUpdate) {
|
|
16847
|
+
(_a = this.visViewer()) === null || _a === void 0 ? void 0 : _a.update(maxScheduleUpdateTimeInMs);
|
|
16848
|
+
(_b = this.activeDragger()) === null || _b === void 0 ? void 0 : _b.updatePreview();
|
|
16849
|
+
}
|
|
16850
|
+
this.emitEvent({ type: "update", data: false });
|
|
16848
16851
|
resolve();
|
|
16849
16852
|
}
|
|
16850
16853
|
catch (e) {
|
|
@@ -16854,6 +16857,20 @@
|
|
|
16854
16857
|
}, 0);
|
|
16855
16858
|
});
|
|
16856
16859
|
}
|
|
16860
|
+
/**
|
|
16861
|
+
* Updates the viewer asynchronously without locking the user interface. Used to update the
|
|
16862
|
+
* viewer after changes that require a long rendering time.
|
|
16863
|
+
*
|
|
16864
|
+
* Do nothing if the auto-update mode is disabled in the constructor. In this case, register
|
|
16865
|
+
* an `update` event handler and update the `VisualizeJS` viewer and active dragger manually.
|
|
16866
|
+
*
|
|
16867
|
+
* Fires:
|
|
16868
|
+
*
|
|
16869
|
+
* - {@link UpdateEvent | update}
|
|
16870
|
+
*
|
|
16871
|
+
* @param maxScheduleUpdateTimeInMs - Maximum time for one update, default 30 ms.
|
|
16872
|
+
* @param maxScheduleUpdateCount - Maximum count of scheduled updates.
|
|
16873
|
+
*/
|
|
16857
16874
|
async updateAsync(maxScheduleUpdateTimeInMs = 50, maxScheduleUpdateCount = 50) {
|
|
16858
16875
|
this._isRunAsyncUpdate = true;
|
|
16859
16876
|
const device = this.visViewer().getActiveDevice();
|
|
@@ -17025,7 +17042,7 @@
|
|
|
17025
17042
|
return this;
|
|
17026
17043
|
}
|
|
17027
17044
|
/**
|
|
17028
|
-
* List of names of
|
|
17045
|
+
* List of names of registered draggers. By default, the following draggers are registered:
|
|
17029
17046
|
*
|
|
17030
17047
|
* - `Line`
|
|
17031
17048
|
* - `Text`
|
|
@@ -17046,7 +17063,8 @@
|
|
|
17046
17063
|
return [...this.draggerFactory.keys()];
|
|
17047
17064
|
}
|
|
17048
17065
|
/**
|
|
17049
|
-
*
|
|
17066
|
+
* Registers a dragger for the viewer. Dragger is an object that received mouse/keyboard
|
|
17067
|
+
* events and does something to the viewer.
|
|
17050
17068
|
*
|
|
17051
17069
|
* @param name - Dragger name.
|
|
17052
17070
|
* @param dragger - Dragger class.
|
|
@@ -17061,7 +17079,7 @@
|
|
|
17061
17079
|
return this._activeDragger;
|
|
17062
17080
|
}
|
|
17063
17081
|
/**
|
|
17064
|
-
*
|
|
17082
|
+
* Changes the active dragger. Viewer must be initialized before enable dragger or exception is thrown.
|
|
17065
17083
|
*
|
|
17066
17084
|
* Fires:
|
|
17067
17085
|
*
|
|
@@ -17099,7 +17117,7 @@
|
|
|
17099
17117
|
return this._activeDragger;
|
|
17100
17118
|
}
|
|
17101
17119
|
/**
|
|
17102
|
-
*
|
|
17120
|
+
* Resets the state of the active dragger.
|
|
17103
17121
|
*/
|
|
17104
17122
|
resetActiveDragger() {
|
|
17105
17123
|
const dragger = this._activeDragger;
|
|
@@ -17109,7 +17127,7 @@
|
|
|
17109
17127
|
}
|
|
17110
17128
|
}
|
|
17111
17129
|
/**
|
|
17112
|
-
*
|
|
17130
|
+
* Removes all cutting planes.
|
|
17113
17131
|
*/
|
|
17114
17132
|
clearSlices() {
|
|
17115
17133
|
if (!this.visualizeJs)
|
|
@@ -17121,7 +17139,7 @@
|
|
|
17121
17139
|
this.update();
|
|
17122
17140
|
}
|
|
17123
17141
|
/**
|
|
17124
|
-
*
|
|
17142
|
+
* Clears the overlay view.
|
|
17125
17143
|
*/
|
|
17126
17144
|
clearOverlay() {
|
|
17127
17145
|
if (!this.visualizeJs)
|
|
@@ -17130,7 +17148,7 @@
|
|
|
17130
17148
|
this.update();
|
|
17131
17149
|
}
|
|
17132
17150
|
/**
|
|
17133
|
-
*
|
|
17151
|
+
* Creates an overlay view. Overlay view is used to draw cutting planes and `Visualize` markups.
|
|
17134
17152
|
*/
|
|
17135
17153
|
syncOverlay() {
|
|
17136
17154
|
if (!this.visualizeJs)
|
|
@@ -17158,7 +17176,7 @@
|
|
|
17158
17176
|
this.update();
|
|
17159
17177
|
}
|
|
17160
17178
|
/**
|
|
17161
|
-
* Returns `true` if current
|
|
17179
|
+
* Returns `true` if current model is 3D model.
|
|
17162
17180
|
*/
|
|
17163
17181
|
is3D() {
|
|
17164
17182
|
if (!this.visualizeJs)
|
|
@@ -17205,15 +17223,13 @@
|
|
|
17205
17223
|
return result;
|
|
17206
17224
|
}
|
|
17207
17225
|
/**
|
|
17208
|
-
* Returns a list of original handles for the selected
|
|
17226
|
+
* Returns a list of original handles for the selected objects.
|
|
17209
17227
|
*/
|
|
17210
17228
|
getSelected() {
|
|
17211
17229
|
return this.executeCommand("getSelected");
|
|
17212
17230
|
}
|
|
17213
17231
|
/**
|
|
17214
|
-
*
|
|
17215
|
-
* {@link File.getProperties | File.getProperties()} or
|
|
17216
|
-
* {@link File.searchProperties | File.searchProperties()} methods.
|
|
17232
|
+
* Selects the model objects by original handles that are obtained using `File.searchProperties()`.
|
|
17217
17233
|
*
|
|
17218
17234
|
* Fires:
|
|
17219
17235
|
*
|
|
@@ -17224,13 +17240,7 @@
|
|
|
17224
17240
|
setSelected(handles) {
|
|
17225
17241
|
this.executeCommand("setSelected", handles);
|
|
17226
17242
|
}
|
|
17227
|
-
|
|
17228
|
-
* Load model references into the viewer. References are images, fonts, or any other files to
|
|
17229
|
-
* correct rendering of the model.
|
|
17230
|
-
*
|
|
17231
|
-
* @param model - Instance of model with references. If a `File` instance is specified
|
|
17232
|
-
* instead of a model, the file references will be loaded.
|
|
17233
|
-
*/
|
|
17243
|
+
// Internal loading routines
|
|
17234
17244
|
async loadReferences(model) {
|
|
17235
17245
|
var _a;
|
|
17236
17246
|
if (!this.visualizeJs)
|
|
@@ -17253,7 +17263,6 @@
|
|
|
17253
17263
|
}
|
|
17254
17264
|
return this;
|
|
17255
17265
|
}
|
|
17256
|
-
// Internal loading routines
|
|
17257
17266
|
applyModelTransformMatrix(model) {
|
|
17258
17267
|
this.executeCommand("applyModelTransform", model);
|
|
17259
17268
|
}
|
|
@@ -17273,7 +17282,7 @@
|
|
|
17273
17282
|
this.update();
|
|
17274
17283
|
}
|
|
17275
17284
|
/**
|
|
17276
|
-
* Loads a model
|
|
17285
|
+
* Loads a model/file/assembly into the viewer.
|
|
17277
17286
|
*
|
|
17278
17287
|
* This method requires a {@link Client} instance to work. For standalone viewer instance use
|
|
17279
17288
|
* {@link openVsfFile | openVsfFile()} or {@link openVsfxFile | openVsfxFile()}.
|
|
@@ -17306,7 +17315,7 @@
|
|
|
17306
17315
|
if (!model)
|
|
17307
17316
|
throw new Error("No default model found");
|
|
17308
17317
|
const overrideOptions = new Options();
|
|
17309
|
-
overrideOptions.data = this.
|
|
17318
|
+
overrideOptions.data = this._options.data;
|
|
17310
17319
|
if (file.type === ".rcs" && !overrideOptions.enablePartialMode) {
|
|
17311
17320
|
console.log("Partial load mode is forced for RCS file");
|
|
17312
17321
|
overrideOptions.enablePartialMode = true;
|
|
@@ -17322,7 +17331,7 @@
|
|
|
17322
17331
|
return this;
|
|
17323
17332
|
}
|
|
17324
17333
|
/**
|
|
17325
|
-
* Loads a VSF file into the viewer.
|
|
17334
|
+
* Loads a `VSF` file into the viewer.
|
|
17326
17335
|
*
|
|
17327
17336
|
* Fires:
|
|
17328
17337
|
*
|
|
@@ -17361,7 +17370,7 @@
|
|
|
17361
17370
|
return this;
|
|
17362
17371
|
}
|
|
17363
17372
|
/**
|
|
17364
|
-
* Loads a VSFX file into the viewer.
|
|
17373
|
+
* Loads a `VSFX` file into the viewer.
|
|
17365
17374
|
*
|
|
17366
17375
|
* Fires:
|
|
17367
17376
|
*
|
|
@@ -17414,7 +17423,7 @@
|
|
|
17414
17423
|
return this;
|
|
17415
17424
|
}
|
|
17416
17425
|
/**
|
|
17417
|
-
* Unloads the model and clears the viewer.
|
|
17426
|
+
* Unloads the model and clears the viewer and markups.
|
|
17418
17427
|
*/
|
|
17419
17428
|
clear() {
|
|
17420
17429
|
if (!this.visualizeJs)
|
|
@@ -17431,15 +17440,17 @@
|
|
|
17431
17440
|
return this;
|
|
17432
17441
|
}
|
|
17433
17442
|
/**
|
|
17434
|
-
*
|
|
17435
|
-
*
|
|
17436
|
-
* @returns Color with `RGB` values.
|
|
17443
|
+
* Returns the color of new markup objects.
|
|
17437
17444
|
*/
|
|
17438
17445
|
getMarkupColor() {
|
|
17439
17446
|
return this._markup.getMarkupColor();
|
|
17440
17447
|
}
|
|
17441
17448
|
/**
|
|
17442
|
-
*
|
|
17449
|
+
* Sets the color of new markup objects.
|
|
17450
|
+
*
|
|
17451
|
+
* Fires:
|
|
17452
|
+
*
|
|
17453
|
+
* - {@link ChangeMarkupColorEvent | changemarkupcolor}
|
|
17443
17454
|
*
|
|
17444
17455
|
* @param r - `Red` part of color.
|
|
17445
17456
|
* @param g - `Green` part of color.
|
|
@@ -17451,7 +17462,7 @@
|
|
|
17451
17462
|
this.emitEvent({ type: "changemarkupcolor", data: color });
|
|
17452
17463
|
}
|
|
17453
17464
|
/**
|
|
17454
|
-
*
|
|
17465
|
+
* Colors all markup objects with the specified color.
|
|
17455
17466
|
*
|
|
17456
17467
|
* @param r - `Red` part of color.
|
|
17457
17468
|
* @param g - `Green` part of color.
|
|
@@ -17461,7 +17472,7 @@
|
|
|
17461
17472
|
this._markup.colorizeAllMarkup(r, g, b);
|
|
17462
17473
|
}
|
|
17463
17474
|
/**
|
|
17464
|
-
*
|
|
17475
|
+
* Colors selected markup objects with the specified color.
|
|
17465
17476
|
*
|
|
17466
17477
|
* @param r - `Red` part of color.
|
|
17467
17478
|
* @param g - `Green` part of color.
|
|
@@ -17471,7 +17482,7 @@
|
|
|
17471
17482
|
this._markup.colorizeSelectedMarkups(r, g, b);
|
|
17472
17483
|
}
|
|
17473
17484
|
/**
|
|
17474
|
-
*
|
|
17485
|
+
* Adds an empty `Visualize` markup entity to the overlay.
|
|
17475
17486
|
*/
|
|
17476
17487
|
addMarkupEntity(entityName) {
|
|
17477
17488
|
if (!this.visualizeJs)
|
|
@@ -17489,8 +17500,9 @@
|
|
|
17489
17500
|
return entityId;
|
|
17490
17501
|
}
|
|
17491
17502
|
/**
|
|
17492
|
-
*
|
|
17493
|
-
*
|
|
17503
|
+
* Sets the viewer state to the specified viewpoint.
|
|
17504
|
+
*
|
|
17505
|
+
* To get a list of available model viewpoints, use the `File.getViewpoints()`.
|
|
17494
17506
|
*
|
|
17495
17507
|
* @param viewpoint - Viewpoint data.
|
|
17496
17508
|
*/
|
|
@@ -17500,8 +17512,9 @@
|
|
|
17500
17512
|
this._markup.setViewpoint(viewpoint);
|
|
17501
17513
|
}
|
|
17502
17514
|
/**
|
|
17503
|
-
*
|
|
17504
|
-
*
|
|
17515
|
+
* Saves the viewer state at the viewpoint.
|
|
17516
|
+
*
|
|
17517
|
+
* To save a viewpoint to a model on the server, use the `File.saveViewpoint()`.
|
|
17505
17518
|
*/
|
|
17506
17519
|
createViewpoint() {
|
|
17507
17520
|
const vp = this._markup.getViewpoint();
|