@inweb/viewer-visualize 25.7.11 → 25.7.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/viewer-visualize.js +81 -63
- package/dist/viewer-visualize.js.map +1 -1
- package/dist/viewer-visualize.min.js +1 -1
- package/dist/viewer-visualize.module.js +85 -61
- package/dist/viewer-visualize.module.js.map +1 -1
- package/lib/Viewer/Viewer.d.ts +2 -2
- package/package.json +6 -6
- package/src/Viewer/Markup/Visualize/VisualizeMarkup.ts +7 -44
- package/src/Viewer/Viewer.ts +49 -8
package/lib/Viewer/Viewer.d.ts
CHANGED
|
@@ -192,11 +192,11 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
|
|
|
192
192
|
*/
|
|
193
193
|
clearSlices(): void;
|
|
194
194
|
/**
|
|
195
|
-
*
|
|
195
|
+
* Clear overlay view.
|
|
196
196
|
*/
|
|
197
197
|
clearOverlay(): void;
|
|
198
198
|
/**
|
|
199
|
-
*
|
|
199
|
+
* Create overlay view.
|
|
200
200
|
*/
|
|
201
201
|
syncOverlay(): any;
|
|
202
202
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inweb/viewer-visualize",
|
|
3
|
-
"version": "25.7.
|
|
3
|
+
"version": "25.7.13",
|
|
4
4
|
"description": "3D CAD and BIM data Viewer powered by Visualize",
|
|
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": "~25.7.
|
|
33
|
-
"@inweb/eventemitter2": "~25.7.
|
|
34
|
-
"@inweb/markup": "~25.7.
|
|
35
|
-
"@inweb/viewer-core": "~25.7.
|
|
32
|
+
"@inweb/client": "~25.7.13",
|
|
33
|
+
"@inweb/eventemitter2": "~25.7.13",
|
|
34
|
+
"@inweb/markup": "~25.7.13",
|
|
35
|
+
"@inweb/viewer-core": "~25.7.13"
|
|
36
36
|
},
|
|
37
|
-
"visualizeJS": "https://
|
|
37
|
+
"visualizeJS": "https://public-fhemb7e3embacwec.z02.azurefd.net/libs/visualizejs/25.7/Visualize.js"
|
|
38
38
|
}
|
|
@@ -5,8 +5,6 @@ import { Viewer } from "../../Viewer";
|
|
|
5
5
|
import { MARKUP_ENTITY_LINE, OdaLineDragger } from "../../Draggers/OdaLineDragger";
|
|
6
6
|
import { MARKUP_ENTITY_TEXT, OdaTextDragger } from "../../Draggers/OdaTextDragger";
|
|
7
7
|
|
|
8
|
-
const OVERLAY_VIEW_NAME = "$OVERLAY_VIEW_NAME";
|
|
9
|
-
|
|
10
8
|
export class VisualizeMarkup implements IMarkup {
|
|
11
9
|
private _viewer: Viewer;
|
|
12
10
|
protected _markupColor = { r: 255, g: 0, b: 0 };
|
|
@@ -28,38 +26,7 @@ export class VisualizeMarkup implements IMarkup {
|
|
|
28
26
|
|
|
29
27
|
dispose(): void {}
|
|
30
28
|
|
|
31
|
-
syncOverlay(): void {
|
|
32
|
-
if (!this._viewer.visualizeJs) return;
|
|
33
|
-
|
|
34
|
-
const visViewer = this._viewer.visViewer();
|
|
35
|
-
const activeView = visViewer.activeView;
|
|
36
|
-
|
|
37
|
-
let overlayView = visViewer.getViewByName(OVERLAY_VIEW_NAME);
|
|
38
|
-
if (!overlayView) {
|
|
39
|
-
const overlayModel = visViewer.getMarkupModel();
|
|
40
|
-
const pDevice = visViewer.getActiveDevice();
|
|
41
|
-
|
|
42
|
-
overlayView = pDevice.createView(OVERLAY_VIEW_NAME, false);
|
|
43
|
-
overlayView.addModel(overlayModel);
|
|
44
|
-
|
|
45
|
-
activeView.addSibling(overlayView);
|
|
46
|
-
pDevice.addView(overlayView);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
overlayView.viewPosition = activeView.viewPosition;
|
|
50
|
-
overlayView.viewTarget = activeView.viewTarget;
|
|
51
|
-
overlayView.upVector = activeView.upVector;
|
|
52
|
-
overlayView.viewFieldWidth = activeView.viewFieldWidth;
|
|
53
|
-
overlayView.viewFieldHeight = activeView.viewFieldHeight;
|
|
54
|
-
|
|
55
|
-
const viewPort = overlayView.getViewport();
|
|
56
|
-
overlayView.setViewport(viewPort.lowerLeft, viewPort.upperRight);
|
|
57
|
-
overlayView.vportRect = activeView.vportRect;
|
|
58
|
-
|
|
59
|
-
this._viewer.update();
|
|
60
|
-
|
|
61
|
-
return overlayView;
|
|
62
|
-
}
|
|
29
|
+
syncOverlay(): void {}
|
|
63
30
|
|
|
64
31
|
clearOverlay(): void {
|
|
65
32
|
if (!this._viewer.visualizeJs) return;
|
|
@@ -243,26 +210,22 @@ export class VisualizeMarkup implements IMarkup {
|
|
|
243
210
|
}
|
|
244
211
|
|
|
245
212
|
enableEditMode(mode: MarkupMode | false): this {
|
|
246
|
-
|
|
213
|
+
return this;
|
|
247
214
|
}
|
|
248
215
|
|
|
249
216
|
createObject(type: string, params: any): IMarkupObject {
|
|
250
|
-
|
|
217
|
+
return undefined;
|
|
251
218
|
}
|
|
252
219
|
|
|
253
220
|
getObjects(): IMarkupObject[] {
|
|
254
|
-
|
|
221
|
+
return [];
|
|
255
222
|
}
|
|
256
223
|
|
|
257
224
|
getSelectedObjects(): IMarkupObject[] {
|
|
258
|
-
|
|
225
|
+
return [];
|
|
259
226
|
}
|
|
260
227
|
|
|
261
|
-
selectObjects(objects: IMarkupObject[]): void {
|
|
262
|
-
throw new Error("Not implemented yet");
|
|
263
|
-
}
|
|
228
|
+
selectObjects(objects: IMarkupObject[]): void {}
|
|
264
229
|
|
|
265
|
-
clearSelected(): void {
|
|
266
|
-
throw new Error("Not implemented yet");
|
|
267
|
-
}
|
|
230
|
+
clearSelected(): void {}
|
|
268
231
|
}
|
package/src/Viewer/Viewer.ts
CHANGED
|
@@ -57,6 +57,8 @@ import { loadVisualizeJs } from "./utils";
|
|
|
57
57
|
import { LoaderFactory } from "./Loaders/LoaderFactory";
|
|
58
58
|
import { MarkupFactory, MarkupType } from "./Markup/MarkupFactory";
|
|
59
59
|
|
|
60
|
+
const OVERLAY_VIEW_NAME = "$OVERLAY_VIEW_NAME";
|
|
61
|
+
|
|
60
62
|
const isExist = (value) => value !== undefined && value !== null;
|
|
61
63
|
|
|
62
64
|
/**
|
|
@@ -699,17 +701,48 @@ export class Viewer
|
|
|
699
701
|
}
|
|
700
702
|
|
|
701
703
|
/**
|
|
702
|
-
*
|
|
704
|
+
* Clear overlay view.
|
|
703
705
|
*/
|
|
704
706
|
clearOverlay(): void {
|
|
707
|
+
if (!this.visualizeJs) return;
|
|
708
|
+
|
|
705
709
|
this._markup.clearOverlay();
|
|
710
|
+
this.update();
|
|
706
711
|
}
|
|
707
712
|
|
|
708
713
|
/**
|
|
709
|
-
*
|
|
714
|
+
* Create overlay view.
|
|
710
715
|
*/
|
|
711
716
|
syncOverlay(): any {
|
|
712
|
-
|
|
717
|
+
if (!this.visualizeJs) return;
|
|
718
|
+
|
|
719
|
+
const visViewer = this.visViewer();
|
|
720
|
+
const activeView = visViewer.activeView;
|
|
721
|
+
|
|
722
|
+
let overlayView = visViewer.getViewByName(OVERLAY_VIEW_NAME);
|
|
723
|
+
if (!overlayView) {
|
|
724
|
+
const markupModel = visViewer.getMarkupModel();
|
|
725
|
+
const pDevice = visViewer.getActiveDevice();
|
|
726
|
+
|
|
727
|
+
overlayView = pDevice.createView(OVERLAY_VIEW_NAME, false);
|
|
728
|
+
overlayView.addModel(markupModel);
|
|
729
|
+
|
|
730
|
+
activeView.addSibling(overlayView);
|
|
731
|
+
pDevice.addView(overlayView);
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
overlayView.viewPosition = activeView.viewPosition;
|
|
735
|
+
overlayView.viewTarget = activeView.viewTarget;
|
|
736
|
+
overlayView.upVector = activeView.upVector;
|
|
737
|
+
overlayView.viewFieldWidth = activeView.viewFieldWidth;
|
|
738
|
+
overlayView.viewFieldHeight = activeView.viewFieldHeight;
|
|
739
|
+
|
|
740
|
+
const viewPort = overlayView.getViewport();
|
|
741
|
+
overlayView.setViewport(viewPort.lowerLeft, viewPort.upperRight);
|
|
742
|
+
overlayView.vportRect = activeView.vportRect;
|
|
743
|
+
|
|
744
|
+
this._markup.syncOverlay();
|
|
745
|
+
this.update();
|
|
713
746
|
}
|
|
714
747
|
|
|
715
748
|
/**
|
|
@@ -729,7 +762,15 @@ export class Viewer
|
|
|
729
762
|
}
|
|
730
763
|
|
|
731
764
|
screenToWorld(position: { x: number; y: number }): { x: number; y: number; z: number } {
|
|
732
|
-
|
|
765
|
+
if (!this.visualizeJs) return { x: position.x, y: position.y, z: 0 };
|
|
766
|
+
|
|
767
|
+
const worldPoint = this.visViewer().screenToWorld(
|
|
768
|
+
position.x * window.devicePixelRatio,
|
|
769
|
+
position.y * window.devicePixelRatio
|
|
770
|
+
);
|
|
771
|
+
const result = { x: worldPoint[0], y: worldPoint[1], z: worldPoint[2] };
|
|
772
|
+
|
|
773
|
+
return result;
|
|
733
774
|
}
|
|
734
775
|
|
|
735
776
|
worldToScreen(position: { x: number; y: number; z: number }): { x: number; y: number } {
|
|
@@ -756,14 +797,14 @@ export class Viewer
|
|
|
756
797
|
const projMatrix = this.visViewer().activeView.projectionMatrix;
|
|
757
798
|
const tolerance = 1.0e-6;
|
|
758
799
|
|
|
759
|
-
const x = projMatrix.get(
|
|
760
|
-
if (x > tolerance || x < -tolerance) result.x = 1 /
|
|
800
|
+
const x = projMatrix.get(0, 0);
|
|
801
|
+
if (x > tolerance || x < -tolerance) result.x = 1 / x;
|
|
761
802
|
|
|
762
803
|
const y = projMatrix.get(1, 1);
|
|
763
|
-
if (y > tolerance || y < -tolerance) result.y = 1 /
|
|
804
|
+
if (y > tolerance || y < -tolerance) result.y = 1 / y;
|
|
764
805
|
|
|
765
806
|
const z = projMatrix.get(2, 2);
|
|
766
|
-
if (z > tolerance || z < -tolerance) result.z = 1 /
|
|
807
|
+
if (z > tolerance || z < -tolerance) result.z = 1 / z;
|
|
767
808
|
|
|
768
809
|
return result;
|
|
769
810
|
}
|