@inweb/viewer-visualize 27.2.3 → 27.2.4
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 +61 -59
- package/dist/viewer-visualize.js.map +1 -1
- package/dist/viewer-visualize.min.js +1 -1
- package/dist/viewer-visualize.module.js +61 -59
- package/dist/viewer-visualize.module.js.map +1 -1
- package/lib/Viewer/Draggers/OdBaseCuttingPlaneDragger.d.ts +6 -4
- package/package.json +6 -6
- package/src/Viewer/Draggers/OdBaseCuttingPlaneDragger.ts +42 -36
- package/src/Viewer/Draggers/OdCuttingPlaneXAxisDragger.ts +8 -9
- package/src/Viewer/Draggers/OdCuttingPlaneYAxisDragger.ts +8 -9
- package/src/Viewer/Draggers/OdCuttingPlaneZAxisDragger.ts +8 -9
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { Viewer } from "../Viewer";
|
|
2
|
-
import { Point3d } from "./Common/Geometry";
|
|
2
|
+
import { Point2d, Point3d } from "./Common/Geometry";
|
|
3
3
|
import { OdBaseDragger } from "./Common/OdBaseDragger";
|
|
4
4
|
export declare class OdBaseCuttingPlaneDragger extends OdBaseDragger {
|
|
5
|
-
protected
|
|
5
|
+
protected m_size_x: number;
|
|
6
|
+
protected m_size_y: number;
|
|
7
|
+
protected m_size_z: number;
|
|
6
8
|
protected m_center: Point3d;
|
|
7
9
|
protected m_normal: number[];
|
|
8
10
|
protected index: number;
|
|
9
11
|
protected m_model: any;
|
|
10
12
|
protected m_entity: any;
|
|
11
|
-
protected
|
|
13
|
+
protected planePreview: any;
|
|
12
14
|
protected m_last: Point3d;
|
|
15
|
+
protected m_click: Point2d;
|
|
13
16
|
constructor(subject: Viewer);
|
|
14
17
|
dispose(): void;
|
|
15
18
|
createNormal(): number[];
|
|
@@ -18,7 +21,6 @@ export declare class OdBaseCuttingPlaneDragger extends OdBaseDragger {
|
|
|
18
21
|
start(x: number, y: number): void;
|
|
19
22
|
drag(x: number, y: number): void;
|
|
20
23
|
end(x: number, y: number): void;
|
|
21
|
-
dblclick(ev: MouseEvent): void;
|
|
22
24
|
createPreview(): void;
|
|
23
25
|
drawPreview(): void;
|
|
24
26
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inweb/viewer-visualize",
|
|
3
|
-
"version": "27.2.
|
|
3
|
+
"version": "27.2.4",
|
|
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": "~27.2.
|
|
33
|
-
"@inweb/eventemitter2": "~27.2.
|
|
34
|
-
"@inweb/markup": "~27.2.
|
|
35
|
-
"@inweb/viewer-core": "~27.2.
|
|
32
|
+
"@inweb/client": "~27.2.4",
|
|
33
|
+
"@inweb/eventemitter2": "~27.2.4",
|
|
34
|
+
"@inweb/markup": "~27.2.4",
|
|
35
|
+
"@inweb/viewer-core": "~27.2.4"
|
|
36
36
|
},
|
|
37
|
-
"visualizeJS": "https://public-fhemb7e3embacwec.z02.azurefd.net/libs/visualizejs/
|
|
37
|
+
"visualizeJS": "https://public-fhemb7e3embacwec.z02.azurefd.net/libs/visualizejs/27.2/Visualize.js"
|
|
38
38
|
}
|
|
@@ -21,18 +21,21 @@
|
|
|
21
21
|
// acknowledge and accept the above terms.
|
|
22
22
|
///////////////////////////////////////////////////////////////////////////////
|
|
23
23
|
import { Viewer } from "../Viewer";
|
|
24
|
-
import { Point3d } from "./Common/Geometry";
|
|
24
|
+
import { Point2d, Point3d } from "./Common/Geometry";
|
|
25
25
|
import { OdBaseDragger } from "./Common/OdBaseDragger";
|
|
26
26
|
|
|
27
27
|
export class OdBaseCuttingPlaneDragger extends OdBaseDragger {
|
|
28
|
-
protected
|
|
28
|
+
protected m_size_x: number;
|
|
29
|
+
protected m_size_y: number;
|
|
30
|
+
protected m_size_z: number;
|
|
29
31
|
protected m_center: Point3d;
|
|
30
32
|
protected m_normal: number[];
|
|
31
33
|
protected index: number;
|
|
32
34
|
protected m_model: any;
|
|
33
35
|
protected m_entity: any;
|
|
34
|
-
protected
|
|
36
|
+
protected planePreview: any;
|
|
35
37
|
protected m_last: Point3d;
|
|
38
|
+
protected m_click: Point2d;
|
|
36
39
|
|
|
37
40
|
constructor(subject: Viewer) {
|
|
38
41
|
super(subject);
|
|
@@ -44,11 +47,9 @@ export class OdBaseCuttingPlaneDragger extends OdBaseDragger {
|
|
|
44
47
|
const min = ext.min();
|
|
45
48
|
const max = ext.max();
|
|
46
49
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
this.m_size = Math.sqrt(sizeX * sizeX + sizeY * sizeY + sizeZ * sizeZ) || 1;
|
|
50
|
+
this.m_size_x = Math.abs(max[0] - min[0]) / 2;
|
|
51
|
+
this.m_size_y = Math.abs(max[1] - min[1]) / 2;
|
|
52
|
+
this.m_size_z = Math.abs(max[2] - min[2]) / 2;
|
|
52
53
|
|
|
53
54
|
this.m_center = this.toPoint(ext.center());
|
|
54
55
|
this.m_normal = this.createNormal();
|
|
@@ -62,7 +63,7 @@ export class OdBaseCuttingPlaneDragger extends OdBaseDragger {
|
|
|
62
63
|
|
|
63
64
|
const { red, green, blue } = this.subject.options.cuttingPlaneFillColor;
|
|
64
65
|
avp.setEnableCuttingPlaneFill(true, red, green, blue);
|
|
65
|
-
avp.setCuttingPlaneFillPatternEnabled(true, this.m_module.CuttingPlaneFillStyle.
|
|
66
|
+
avp.setCuttingPlaneFillPatternEnabled(true, this.m_module.CuttingPlaneFillStyle.kHorizontalBars, 0x0, 0x0, 0x0);
|
|
66
67
|
|
|
67
68
|
this.m_model = this.getModel();
|
|
68
69
|
this.createPreview();
|
|
@@ -75,9 +76,9 @@ export class OdBaseCuttingPlaneDragger extends OdBaseDragger {
|
|
|
75
76
|
|
|
76
77
|
if (this.m_entity) {
|
|
77
78
|
this.m_model.removeEntity(this.m_entity);
|
|
78
|
-
this.deleteAll([this.m_model, this.m_entity, this.
|
|
79
|
+
this.deleteAll([this.m_model, this.m_entity, this.planePreview, this.m_center]);
|
|
79
80
|
this.m_entity = null;
|
|
80
|
-
this.
|
|
81
|
+
this.planePreview = null;
|
|
81
82
|
this.subject.update();
|
|
82
83
|
}
|
|
83
84
|
}
|
|
@@ -97,6 +98,7 @@ export class OdBaseCuttingPlaneDragger extends OdBaseDragger {
|
|
|
97
98
|
override start(x: number, y: number): void {
|
|
98
99
|
this.press = true;
|
|
99
100
|
this.m_last = this.screenToWorld(x, y);
|
|
101
|
+
this.m_click = { x, y };
|
|
100
102
|
}
|
|
101
103
|
|
|
102
104
|
override drag(x: number, y: number): void {
|
|
@@ -112,12 +114,12 @@ export class OdBaseCuttingPlaneDragger extends OdBaseDragger {
|
|
|
112
114
|
|
|
113
115
|
const avp = this.getViewer().activeView;
|
|
114
116
|
const plane = this.createPlane();
|
|
115
|
-
plane.set(this.toGePoint(this.m_center), this.m_normal);
|
|
116
|
-
avp.updateCuttingPlane(this.index, plane);
|
|
117
|
+
const newPlane = plane.set(this.toGePoint(this.m_center), this.m_normal);
|
|
118
|
+
const newCutting = avp.updateCuttingPlane(this.index, plane);
|
|
117
119
|
|
|
118
120
|
this.drawPreview();
|
|
119
121
|
|
|
120
|
-
this.deleteAll([avp, plane, oldCenter, delta, oldLast]);
|
|
122
|
+
this.deleteAll([avp, plane, oldCenter, delta, oldLast, newPlane, newCutting]);
|
|
121
123
|
|
|
122
124
|
const device = this.getViewer().getActiveDevice();
|
|
123
125
|
device.invalidate(device.getSize());
|
|
@@ -126,20 +128,19 @@ export class OdBaseCuttingPlaneDragger extends OdBaseDragger {
|
|
|
126
128
|
|
|
127
129
|
override end(x: number, y: number): void {
|
|
128
130
|
this.press = false;
|
|
129
|
-
|
|
131
|
+
if (x === this.m_click.x && y === this.m_click.y) {
|
|
132
|
+
this.m_normal = [this.m_normal[0] * -1, this.m_normal[1] * -1, this.m_normal[2] * -1];
|
|
130
133
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
const plane = this.createPlane();
|
|
136
|
-
plane.set(this.toGePoint(this.m_center), this.m_normal);
|
|
137
|
-
avp.updateCuttingPlane(this.index, plane);
|
|
134
|
+
const avp = this.getViewer().activeView;
|
|
135
|
+
const plane = this.createPlane();
|
|
136
|
+
plane.set(this.toGePoint(this.m_center), this.m_normal);
|
|
137
|
+
avp.updateCuttingPlane(this.index, plane);
|
|
138
138
|
|
|
139
|
-
|
|
139
|
+
this.deleteAll([avp, plane, this.m_last]);
|
|
140
140
|
|
|
141
|
-
|
|
142
|
-
|
|
141
|
+
const device = this.getViewer().getActiveDevice();
|
|
142
|
+
device.invalidate(device.getSize());
|
|
143
|
+
}
|
|
143
144
|
}
|
|
144
145
|
|
|
145
146
|
createPreview(): void {
|
|
@@ -147,30 +148,35 @@ export class OdBaseCuttingPlaneDragger extends OdBaseDragger {
|
|
|
147
148
|
|
|
148
149
|
const GeometryTypes = this.m_module.GeometryTypes;
|
|
149
150
|
|
|
150
|
-
const
|
|
151
|
-
const
|
|
151
|
+
const transparencyDef = new this.m_module.OdTvTransparencyDef();
|
|
152
|
+
const colorDef = new this.m_module.OdTvColorDef(112, 112, 112); //0x53, 0x72, 0xAE
|
|
152
153
|
|
|
153
|
-
|
|
154
|
+
transparencyDef.setValue(0.9);
|
|
154
155
|
|
|
155
156
|
const entityPtr = this.m_entity.openObject();
|
|
157
|
+
entityPtr.setColor(colorDef, GeometryTypes.kFaces.value);
|
|
156
158
|
|
|
157
|
-
|
|
158
|
-
entityPtr.
|
|
159
|
+
colorDef.setColor(112, 112, 112); //0xcd, 0xe2, 0xff
|
|
160
|
+
entityPtr.setColor(colorDef, GeometryTypes.kEdges.value);
|
|
159
161
|
|
|
160
|
-
entityPtr.
|
|
162
|
+
entityPtr.setLineWeight(5);
|
|
161
163
|
|
|
162
|
-
entityPtr.
|
|
164
|
+
entityPtr.setTransparency(transparencyDef, GeometryTypes.kFaces);
|
|
165
|
+
transparencyDef.setValue(1.0);
|
|
166
|
+
entityPtr.setTransparency(transparencyDef, GeometryTypes.kEdges);
|
|
163
167
|
|
|
164
|
-
this.
|
|
165
|
-
const polygonPtr = this.
|
|
168
|
+
this.planePreview = entityPtr.appendPolygon(this.getPlanePreviewCoordinate());
|
|
169
|
+
const polygonPtr = this.planePreview.openAsPolygon();
|
|
166
170
|
polygonPtr.setFilled(true);
|
|
167
171
|
|
|
168
|
-
this.deleteAll([
|
|
172
|
+
this.deleteAll([transparencyDef, colorDef, entityPtr, polygonPtr, GeometryTypes]);
|
|
173
|
+
this.subject.syncOverlay();
|
|
169
174
|
}
|
|
170
175
|
|
|
171
176
|
drawPreview(): void {
|
|
172
|
-
const polygonPtr = this.
|
|
177
|
+
const polygonPtr = this.planePreview.openAsPolygon();
|
|
173
178
|
polygonPtr.setPoints(this.getPlanePreviewCoordinate());
|
|
174
179
|
this.deleteAll([polygonPtr]);
|
|
180
|
+
this.subject.syncOverlay();
|
|
175
181
|
}
|
|
176
182
|
}
|
|
@@ -35,20 +35,19 @@ export class OdCuttingPlaneXAxisDragger extends OdBaseCuttingPlaneDragger {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
override getPlanePreviewCoordinate(): number[] {
|
|
38
|
-
const halfSize = this.m_size / 2;
|
|
39
38
|
return [
|
|
40
39
|
this.m_center.x,
|
|
41
|
-
this.m_center.y -
|
|
42
|
-
this.m_center.z -
|
|
40
|
+
this.m_center.y - this.m_size_y,
|
|
41
|
+
this.m_center.z - this.m_size_z,
|
|
43
42
|
this.m_center.x,
|
|
44
|
-
this.m_center.y +
|
|
45
|
-
this.m_center.z -
|
|
43
|
+
this.m_center.y + this.m_size_y,
|
|
44
|
+
this.m_center.z - this.m_size_z,
|
|
46
45
|
this.m_center.x,
|
|
47
|
-
this.m_center.y +
|
|
48
|
-
this.m_center.z +
|
|
46
|
+
this.m_center.y + this.m_size_y,
|
|
47
|
+
this.m_center.z + this.m_size_z,
|
|
49
48
|
this.m_center.x,
|
|
50
|
-
this.m_center.y -
|
|
51
|
-
this.m_center.z +
|
|
49
|
+
this.m_center.y - this.m_size_y,
|
|
50
|
+
this.m_center.z + this.m_size_z,
|
|
52
51
|
];
|
|
53
52
|
}
|
|
54
53
|
}
|
|
@@ -35,20 +35,19 @@ export class OdCuttingPlaneYAxisDragger extends OdBaseCuttingPlaneDragger {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
override getPlanePreviewCoordinate(): number[] {
|
|
38
|
-
const halfSize = this.m_size / 2;
|
|
39
38
|
return [
|
|
40
|
-
this.m_center.x -
|
|
39
|
+
this.m_center.x - this.m_size_x,
|
|
41
40
|
this.m_center.y,
|
|
42
|
-
this.m_center.z -
|
|
43
|
-
this.m_center.x +
|
|
41
|
+
this.m_center.z - this.m_size_z,
|
|
42
|
+
this.m_center.x + this.m_size_x,
|
|
44
43
|
this.m_center.y,
|
|
45
|
-
this.m_center.z -
|
|
46
|
-
this.m_center.x +
|
|
44
|
+
this.m_center.z - this.m_size_z,
|
|
45
|
+
this.m_center.x + this.m_size_x,
|
|
47
46
|
this.m_center.y,
|
|
48
|
-
this.m_center.z +
|
|
49
|
-
this.m_center.x -
|
|
47
|
+
this.m_center.z + this.m_size_z,
|
|
48
|
+
this.m_center.x - this.m_size_x,
|
|
50
49
|
this.m_center.y,
|
|
51
|
-
this.m_center.z +
|
|
50
|
+
this.m_center.z + this.m_size_z,
|
|
52
51
|
];
|
|
53
52
|
}
|
|
54
53
|
}
|
|
@@ -35,19 +35,18 @@ export class OdCuttingPlaneZAxisDragger extends OdBaseCuttingPlaneDragger {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
override getPlanePreviewCoordinate(): number[] {
|
|
38
|
-
const halfSize = this.m_size / 2;
|
|
39
38
|
return [
|
|
40
|
-
this.m_center.x -
|
|
41
|
-
this.m_center.y -
|
|
39
|
+
this.m_center.x - this.m_size_x,
|
|
40
|
+
this.m_center.y - this.m_size_y,
|
|
42
41
|
this.m_center.z,
|
|
43
|
-
this.m_center.x +
|
|
44
|
-
this.m_center.y -
|
|
42
|
+
this.m_center.x + this.m_size_x,
|
|
43
|
+
this.m_center.y - this.m_size_y,
|
|
45
44
|
this.m_center.z,
|
|
46
|
-
this.m_center.x +
|
|
47
|
-
this.m_center.y +
|
|
45
|
+
this.m_center.x + this.m_size_x,
|
|
46
|
+
this.m_center.y + this.m_size_y,
|
|
48
47
|
this.m_center.z,
|
|
49
|
-
this.m_center.x -
|
|
50
|
-
this.m_center.y +
|
|
48
|
+
this.m_center.x - this.m_size_x,
|
|
49
|
+
this.m_center.y + this.m_size_y,
|
|
51
50
|
this.m_center.z,
|
|
52
51
|
];
|
|
53
52
|
}
|