@inweb/viewer-visualize 25.7.10 → 25.7.12
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/dist/viewer-visualize.js
CHANGED
|
@@ -12172,6 +12172,29 @@
|
|
|
12172
12172
|
}
|
|
12173
12173
|
}
|
|
12174
12174
|
|
|
12175
|
+
class WorldTransform {
|
|
12176
|
+
screenToWorld(position) {
|
|
12177
|
+
return {
|
|
12178
|
+
x: position.x,
|
|
12179
|
+
y: position.y,
|
|
12180
|
+
z: 0
|
|
12181
|
+
};
|
|
12182
|
+
}
|
|
12183
|
+
worldToScreen(position) {
|
|
12184
|
+
return {
|
|
12185
|
+
x: position.x,
|
|
12186
|
+
y: position.y
|
|
12187
|
+
};
|
|
12188
|
+
}
|
|
12189
|
+
getScale() {
|
|
12190
|
+
return {
|
|
12191
|
+
x: 1,
|
|
12192
|
+
y: 1,
|
|
12193
|
+
z: 1
|
|
12194
|
+
};
|
|
12195
|
+
}
|
|
12196
|
+
}
|
|
12197
|
+
|
|
12175
12198
|
const LineTypeSpecs = new Map([ [ "solid", [] ], [ "dot", [ 30, 30, .001, 30 ] ], [ "dash", [ 30, 30 ] ] ]);
|
|
12176
12199
|
|
|
12177
12200
|
class KonvaLine {
|
|
@@ -13076,7 +13099,7 @@
|
|
|
13076
13099
|
initialize(container, pointerEvents, viewer, worldTransformer) {
|
|
13077
13100
|
if (!Konva) throw new Error('Markup: Error during initialization. Konva is not initialized. Update node_modules or add to your page <script src="https://unpkg.com/konva@9/konva.min.js"><\/script>');
|
|
13078
13101
|
this._viewer = viewer;
|
|
13079
|
-
this._worldTransformer = worldTransformer;
|
|
13102
|
+
this._worldTransformer = worldTransformer !== null && worldTransformer !== void 0 ? worldTransformer : new WorldTransform;
|
|
13080
13103
|
this._container = container;
|
|
13081
13104
|
this._pointerEvents = pointerEvents !== null && pointerEvents !== void 0 ? pointerEvents : [];
|
|
13082
13105
|
this._markupContainer = document.createElement("div");
|
|
@@ -13300,13 +13323,6 @@
|
|
|
13300
13323
|
clearSelected() {
|
|
13301
13324
|
this._konvaTransformer.nodes([]);
|
|
13302
13325
|
}
|
|
13303
|
-
getPoint3dFromArray(array) {
|
|
13304
|
-
return {
|
|
13305
|
-
x: array[0],
|
|
13306
|
-
y: array[1],
|
|
13307
|
-
z: array[2]
|
|
13308
|
-
};
|
|
13309
|
-
}
|
|
13310
13326
|
fillViewpointShapes(viewpoint) {
|
|
13311
13327
|
const markupLines = this.getMarkupLines();
|
|
13312
13328
|
if (markupLines && markupLines.length > 0) {
|
|
@@ -13597,7 +13613,7 @@
|
|
|
13597
13613
|
const konvaLine = new KonvaLine(null, line);
|
|
13598
13614
|
lines.push({
|
|
13599
13615
|
id: konvaLine.id(),
|
|
13600
|
-
points: worldPoints
|
|
13616
|
+
points: worldPoints,
|
|
13601
13617
|
color: konvaLine.getColor() || "#ff0000",
|
|
13602
13618
|
type: konvaLine.getLineType() || this.lineType,
|
|
13603
13619
|
width: konvaLine.getLineWidth() || this.lineWidth
|
|
@@ -13611,14 +13627,15 @@
|
|
|
13611
13627
|
const textScale = this._worldTransformer.getScale();
|
|
13612
13628
|
this.konvaLayerFind("Text").forEach((text => {
|
|
13613
13629
|
if (!text) return;
|
|
13614
|
-
const position =
|
|
13630
|
+
const position = {
|
|
13615
13631
|
x: text.x(),
|
|
13616
13632
|
y: text.y()
|
|
13617
|
-
}
|
|
13633
|
+
};
|
|
13634
|
+
const worldPoint = this._worldTransformer.screenToWorld(position);
|
|
13618
13635
|
const shape = new KonvaText(null, text);
|
|
13619
13636
|
texts.push({
|
|
13620
13637
|
id: shape.id(),
|
|
13621
|
-
position:
|
|
13638
|
+
position: worldPoint,
|
|
13622
13639
|
text: shape.getText(),
|
|
13623
13640
|
text_size: textSize * textScale.y,
|
|
13624
13641
|
angle: shape.getRotation(),
|
|
@@ -13636,7 +13653,7 @@
|
|
|
13636
13653
|
const shape = new KonvaRectangle(null, rect);
|
|
13637
13654
|
rectangles.push({
|
|
13638
13655
|
id: shape.id(),
|
|
13639
|
-
position:
|
|
13656
|
+
position: worldPoint,
|
|
13640
13657
|
width: shape.getWidth(),
|
|
13641
13658
|
height: shape.getHeigth(),
|
|
13642
13659
|
line_width: shape.getLineWidth(),
|
|
@@ -13653,7 +13670,7 @@
|
|
|
13653
13670
|
const shape = new KonvaEllipse(null, ellipse);
|
|
13654
13671
|
ellipses.push({
|
|
13655
13672
|
id: shape.id(),
|
|
13656
|
-
position:
|
|
13673
|
+
position: worldPoint,
|
|
13657
13674
|
radius: {
|
|
13658
13675
|
x: ellipse.getRadiusX(),
|
|
13659
13676
|
y: ellipse.getRadiusY()
|
|
@@ -13681,8 +13698,8 @@
|
|
|
13681
13698
|
const shape = new KonvaArrow(null, arrow);
|
|
13682
13699
|
arrows.push({
|
|
13683
13700
|
id: shape.id(),
|
|
13684
|
-
start:
|
|
13685
|
-
end:
|
|
13701
|
+
start: worldStartPoint,
|
|
13702
|
+
end: worldEndPoint,
|
|
13686
13703
|
color: shape.getColor()
|
|
13687
13704
|
});
|
|
13688
13705
|
}));
|
|
@@ -13696,7 +13713,7 @@
|
|
|
13696
13713
|
const shape = new KonvaImage(null, image);
|
|
13697
13714
|
images.push({
|
|
13698
13715
|
id: shape.id(),
|
|
13699
|
-
position:
|
|
13716
|
+
position: worldPoint,
|
|
13700
13717
|
src: shape.getSrc(),
|
|
13701
13718
|
width: shape.getWidth(),
|
|
13702
13719
|
height: shape.getHeight()
|
|
@@ -13712,7 +13729,7 @@
|
|
|
13712
13729
|
const shape = new KonvaCloud(null, cloud);
|
|
13713
13730
|
clouds.push({
|
|
13714
13731
|
id: shape.id(),
|
|
13715
|
-
position:
|
|
13732
|
+
position: worldPoint,
|
|
13716
13733
|
width: shape.getWidth(),
|
|
13717
13734
|
height: shape.getHeigth(),
|
|
13718
13735
|
line_width: shape.getLineWidth(),
|
|
@@ -16439,7 +16456,6 @@
|
|
|
16439
16456
|
}
|
|
16440
16457
|
}
|
|
16441
16458
|
|
|
16442
|
-
const OVERLAY_VIEW_NAME = "$OVERLAY_VIEW_NAME";
|
|
16443
16459
|
class VisualizeMarkup {
|
|
16444
16460
|
constructor() {
|
|
16445
16461
|
this._markupColor = { r: 255, g: 0, b: 0 };
|
|
@@ -16452,31 +16468,7 @@
|
|
|
16452
16468
|
this._viewer.registerDragger("Text", OdaTextDragger);
|
|
16453
16469
|
}
|
|
16454
16470
|
dispose() { }
|
|
16455
|
-
syncOverlay() {
|
|
16456
|
-
if (!this._viewer.visualizeJs)
|
|
16457
|
-
return;
|
|
16458
|
-
const visViewer = this._viewer.visViewer();
|
|
16459
|
-
const activeView = visViewer.activeView;
|
|
16460
|
-
let overlayView = visViewer.getViewByName(OVERLAY_VIEW_NAME);
|
|
16461
|
-
if (!overlayView) {
|
|
16462
|
-
const overlayModel = visViewer.getMarkupModel();
|
|
16463
|
-
const pDevice = visViewer.getActiveDevice();
|
|
16464
|
-
overlayView = pDevice.createView(OVERLAY_VIEW_NAME, false);
|
|
16465
|
-
overlayView.addModel(overlayModel);
|
|
16466
|
-
activeView.addSibling(overlayView);
|
|
16467
|
-
pDevice.addView(overlayView);
|
|
16468
|
-
}
|
|
16469
|
-
overlayView.viewPosition = activeView.viewPosition;
|
|
16470
|
-
overlayView.viewTarget = activeView.viewTarget;
|
|
16471
|
-
overlayView.upVector = activeView.upVector;
|
|
16472
|
-
overlayView.viewFieldWidth = activeView.viewFieldWidth;
|
|
16473
|
-
overlayView.viewFieldHeight = activeView.viewFieldHeight;
|
|
16474
|
-
const viewPort = overlayView.getViewport();
|
|
16475
|
-
overlayView.setViewport(viewPort.lowerLeft, viewPort.upperRight);
|
|
16476
|
-
overlayView.vportRect = activeView.vportRect;
|
|
16477
|
-
this._viewer.update();
|
|
16478
|
-
return overlayView;
|
|
16479
|
-
}
|
|
16471
|
+
syncOverlay() { }
|
|
16480
16472
|
clearOverlay() {
|
|
16481
16473
|
if (!this._viewer.visualizeJs)
|
|
16482
16474
|
return;
|
|
@@ -16622,23 +16614,19 @@
|
|
|
16622
16614
|
return viewpoint;
|
|
16623
16615
|
}
|
|
16624
16616
|
enableEditMode(mode) {
|
|
16625
|
-
|
|
16617
|
+
return this;
|
|
16626
16618
|
}
|
|
16627
16619
|
createObject(type, params) {
|
|
16628
|
-
|
|
16620
|
+
return undefined;
|
|
16629
16621
|
}
|
|
16630
16622
|
getObjects() {
|
|
16631
|
-
|
|
16623
|
+
return [];
|
|
16632
16624
|
}
|
|
16633
16625
|
getSelectedObjects() {
|
|
16634
|
-
|
|
16635
|
-
}
|
|
16636
|
-
selectObjects(objects) {
|
|
16637
|
-
throw new Error("Not implemented yet");
|
|
16638
|
-
}
|
|
16639
|
-
clearSelected() {
|
|
16640
|
-
throw new Error("Not implemented yet");
|
|
16626
|
+
return [];
|
|
16641
16627
|
}
|
|
16628
|
+
selectObjects(objects) { }
|
|
16629
|
+
clearSelected() { }
|
|
16642
16630
|
}
|
|
16643
16631
|
|
|
16644
16632
|
///////////////////////////////////////////////////////////////////////////////
|
|
@@ -16669,6 +16657,7 @@
|
|
|
16669
16657
|
}
|
|
16670
16658
|
|
|
16671
16659
|
///////////////////////////////////////////////////////////////////////////////
|
|
16660
|
+
const OVERLAY_VIEW_NAME = "$OVERLAY_VIEW_NAME";
|
|
16672
16661
|
const isExist = (value) => value !== undefined && value !== null;
|
|
16673
16662
|
/**
|
|
16674
16663
|
* The `Client.js` library class that provides methods to integrate with the
|
|
@@ -16753,7 +16742,7 @@
|
|
|
16753
16742
|
* library instance or leave it blank to use the default URL defined by `Client.js`.
|
|
16754
16743
|
*/
|
|
16755
16744
|
configure(params) {
|
|
16756
|
-
this._visualizeJsUrl = params.visualizeJsUrl || "https://opencloud.azureedge.net/libs/visualizejs/
|
|
16745
|
+
this._visualizeJsUrl = params.visualizeJsUrl || "https://opencloud.azureedge.net/libs/visualizejs/25.7/Visualize.js";
|
|
16757
16746
|
return this;
|
|
16758
16747
|
}
|
|
16759
16748
|
/**
|
|
@@ -17187,16 +17176,41 @@
|
|
|
17187
17176
|
this.update();
|
|
17188
17177
|
}
|
|
17189
17178
|
/**
|
|
17190
|
-
*
|
|
17179
|
+
* Clear overlay view.
|
|
17191
17180
|
*/
|
|
17192
17181
|
clearOverlay() {
|
|
17182
|
+
if (!this.visualizeJs)
|
|
17183
|
+
return;
|
|
17193
17184
|
this._markup.clearOverlay();
|
|
17185
|
+
this.update();
|
|
17194
17186
|
}
|
|
17195
17187
|
/**
|
|
17196
|
-
*
|
|
17188
|
+
* Create overlay view.
|
|
17197
17189
|
*/
|
|
17198
17190
|
syncOverlay() {
|
|
17199
|
-
|
|
17191
|
+
if (!this.visualizeJs)
|
|
17192
|
+
return;
|
|
17193
|
+
const visViewer = this.visViewer();
|
|
17194
|
+
const activeView = visViewer.activeView;
|
|
17195
|
+
let overlayView = visViewer.getViewByName(OVERLAY_VIEW_NAME);
|
|
17196
|
+
if (!overlayView) {
|
|
17197
|
+
const markupModel = visViewer.getMarkupModel();
|
|
17198
|
+
const pDevice = visViewer.getActiveDevice();
|
|
17199
|
+
overlayView = pDevice.createView(OVERLAY_VIEW_NAME, false);
|
|
17200
|
+
overlayView.addModel(markupModel);
|
|
17201
|
+
activeView.addSibling(overlayView);
|
|
17202
|
+
pDevice.addView(overlayView);
|
|
17203
|
+
}
|
|
17204
|
+
overlayView.viewPosition = activeView.viewPosition;
|
|
17205
|
+
overlayView.viewTarget = activeView.viewTarget;
|
|
17206
|
+
overlayView.upVector = activeView.upVector;
|
|
17207
|
+
overlayView.viewFieldWidth = activeView.viewFieldWidth;
|
|
17208
|
+
overlayView.viewFieldHeight = activeView.viewFieldHeight;
|
|
17209
|
+
const viewPort = overlayView.getViewport();
|
|
17210
|
+
overlayView.setViewport(viewPort.lowerLeft, viewPort.upperRight);
|
|
17211
|
+
overlayView.vportRect = activeView.vportRect;
|
|
17212
|
+
this._markup.syncOverlay();
|
|
17213
|
+
this.update();
|
|
17200
17214
|
}
|
|
17201
17215
|
/**
|
|
17202
17216
|
* Returns `true` if current drawing is 3D drawing.
|
|
@@ -17213,7 +17227,11 @@
|
|
|
17213
17227
|
//return visViewer.activeView.upVector[1] >= 0.95;
|
|
17214
17228
|
}
|
|
17215
17229
|
screenToWorld(position) {
|
|
17216
|
-
|
|
17230
|
+
if (!this.visualizeJs)
|
|
17231
|
+
return { x: position.x, y: position.y, z: 0 };
|
|
17232
|
+
const worldPoint = this.visViewer().screenToWorld(position.x * window.devicePixelRatio, position.y * window.devicePixelRatio);
|
|
17233
|
+
const result = { x: worldPoint[0], y: worldPoint[1], z: worldPoint[2] };
|
|
17234
|
+
return result;
|
|
17217
17235
|
}
|
|
17218
17236
|
worldToScreen(position) {
|
|
17219
17237
|
if (!this.visualizeJs)
|
|
@@ -17233,15 +17251,15 @@
|
|
|
17233
17251
|
const result = { x: 1.0, y: 1.0, z: 1.0 };
|
|
17234
17252
|
const projMatrix = this.visViewer().activeView.projectionMatrix;
|
|
17235
17253
|
const tolerance = 1.0e-6;
|
|
17236
|
-
const x = projMatrix.get(
|
|
17254
|
+
const x = projMatrix.get(0, 0);
|
|
17237
17255
|
if (x > tolerance || x < -tolerance)
|
|
17238
|
-
result.x = 1 /
|
|
17256
|
+
result.x = 1 / x;
|
|
17239
17257
|
const y = projMatrix.get(1, 1);
|
|
17240
17258
|
if (y > tolerance || y < -tolerance)
|
|
17241
|
-
result.y = 1 /
|
|
17259
|
+
result.y = 1 / y;
|
|
17242
17260
|
const z = projMatrix.get(2, 2);
|
|
17243
17261
|
if (z > tolerance || z < -tolerance)
|
|
17244
|
-
result.z = 1 /
|
|
17262
|
+
result.z = 1 / z;
|
|
17245
17263
|
return result;
|
|
17246
17264
|
}
|
|
17247
17265
|
/**
|