@xeokit/xeokit-sdk 2.6.5 → 2.6.7
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 +20 -14
- package/dist/xeokit-sdk.cjs.js +427 -169
- package/dist/xeokit-sdk.es.js +427 -169
- package/dist/xeokit-sdk.es5.js +896 -746
- package/dist/xeokit-sdk.min.cjs.js +5 -5
- package/dist/xeokit-sdk.min.es.js +5 -5
- package/dist/xeokit-sdk.min.es5.js +4 -4
- package/package.json +1 -1
- package/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js +47 -52
- package/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js +22 -23
- package/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js +40 -47
- package/src/viewer/scene/model/SceneModelTransform.js +1 -1
- package/src/viewer/scene/model/vbo/VBORenderer.js +10 -1
- package/src/viewer/scene/model/vbo/batching/triangles/renderers/EdgesColorRenderer.js +2 -2
- package/src/viewer/scene/model/vbo/batching/triangles/renderers/EdgesEmphasisRenderer.js +3 -3
- package/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesColorRenderer.js +14 -8
- package/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesColorTextureRenderer.js +10 -4
- package/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesFlatColorRenderer.js +10 -4
- package/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSilhouetteRenderer.js +16 -8
- package/src/viewer/scene/model/vbo/instancing/triangles/renderers/EdgesColorRenderer.js +1 -2
- package/src/viewer/scene/model/vbo/instancing/triangles/renderers/EdgesEmphasisRenderer.js +1 -1
- package/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesColorRenderer.js +10 -4
- package/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesColorTextureRenderer.js +12 -6
- package/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesFlatColorRenderer.js +17 -11
- package/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSilhouetteRenderer.js +15 -6
- package/src/viewer/scene/postfx/CrossSections.js +203 -0
- package/src/viewer/scene/scene/Scene.js +10 -1
- package/types/plugins/AngleMeasurementsPlugin/AngleMeasurementsControl.d.ts +9 -0
- package/types/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.d.ts +1 -2
- package/types/plugins/AngleMeasurementsPlugin/AngleMeasurementsPlugin.d.ts +4 -0
- package/types/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.d.ts +92 -0
- package/types/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.d.ts +1 -1
- package/types/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.d.ts +13 -2
- package/types/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.d.ts +70 -0
- package/types/viewer/scene/postfx/CrossSections.d.ts +42 -0
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import {Component} from '../Component.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @desc Configures cross-section slices for a {@link Scene}.
|
|
5
|
+
*
|
|
6
|
+
* ## Overview
|
|
7
|
+
*
|
|
8
|
+
* Cross-sections allow to create an additional colored slice for used clipping planes. It is only a visual effect
|
|
9
|
+
* calculated by shaders. It makes it easier to see the intersection between the model and the clipping plane this way.
|
|
10
|
+
*
|
|
11
|
+
* ## Usage
|
|
12
|
+
*
|
|
13
|
+
* In the example below, we'll configure CrossSections to manipulate the slice representation.
|
|
14
|
+
*
|
|
15
|
+
* ````javascript
|
|
16
|
+
* //------------------------------------------------------------------------------------------------------------------
|
|
17
|
+
* // Import the modules we need for this example
|
|
18
|
+
* //------------------------------------------------------------------------------------------------------------------
|
|
19
|
+
*
|
|
20
|
+
* import {PhongMaterial, Viewer, math, SectionPlanesPlugin, XKTLoaderPlugin, Mesh, ReadableGeometry, buildPolylineGeometryFromCurve, SplineCurve} from "../../dist/xeokit-sdk.es.js";
|
|
21
|
+
*
|
|
22
|
+
* //------------------------------------------------------------------------------------------------------------------
|
|
23
|
+
* // Create a Viewer and arrange the camera
|
|
24
|
+
* //------------------------------------------------------------------------------------------------------------------
|
|
25
|
+
*
|
|
26
|
+
* const viewer = new Viewer({
|
|
27
|
+
* canvasId: "myCanvas",
|
|
28
|
+
* transparent: true
|
|
29
|
+
* });
|
|
30
|
+
*
|
|
31
|
+
* viewer.camera.eye = [-2.341298674548419, 22.43987089731119, 7.236688436028655];
|
|
32
|
+
* viewer.camera.look = [4.399999999999963, 3.7240000000000606, 8.899000000000006];
|
|
33
|
+
* viewer.camera.up = [0.9102954845584759, 0.34781746407929504, 0.22446635042673466];
|
|
34
|
+
*
|
|
35
|
+
* const cameraControl = viewer.cameraControl;
|
|
36
|
+
* cameraControl.navMode = "orbit";
|
|
37
|
+
* cameraControl.followPointer = true;
|
|
38
|
+
*
|
|
39
|
+
* //----------------------------------------------------------------------------------------------------------------------
|
|
40
|
+
* // Create a xeokit loader plugin, load a model, fit to view
|
|
41
|
+
* //----------------------------------------------------------------------------------------------------------------------
|
|
42
|
+
*
|
|
43
|
+
* const xktLoader = new XKTLoaderPlugin(viewer);
|
|
44
|
+
*
|
|
45
|
+
* var t0 = performance.now();
|
|
46
|
+
*
|
|
47
|
+
* document.getElementById("time").innerHTML = "Loading model...";
|
|
48
|
+
*
|
|
49
|
+
* const sceneModel = xktLoader.load({
|
|
50
|
+
* id: "myModel",
|
|
51
|
+
* src: "../../assets/models/xkt/v10/glTF-Embedded/Duplex_A_20110505.glTFEmbedded.xkt",
|
|
52
|
+
* edges: true
|
|
53
|
+
* });
|
|
54
|
+
*
|
|
55
|
+
* sceneModel.on("loaded", () => {
|
|
56
|
+
* var t1 = performance.now();
|
|
57
|
+
* document.getElementById("time").innerHTML = "Model loaded in " + Math.floor(t1 - t0) / 1000.0 + " seconds<br>Objects: " + sceneModel.numEntities;
|
|
58
|
+
*
|
|
59
|
+
* let path = new SplineCurve(viewer.scene, {
|
|
60
|
+
* points: [
|
|
61
|
+
* [0, 0, -10],
|
|
62
|
+
* [0, 0, -3],
|
|
63
|
+
* [10, 0, 10],
|
|
64
|
+
* [10, 0, 30],
|
|
65
|
+
* ],
|
|
66
|
+
* });
|
|
67
|
+
*
|
|
68
|
+
* new Mesh(viewer.scene, {
|
|
69
|
+
* geometry: new ReadableGeometry(viewer.scene, buildPolylineGeometryFromCurve({
|
|
70
|
+
* id: "SplineCurve",
|
|
71
|
+
* curve: path,
|
|
72
|
+
* divisions: 50,
|
|
73
|
+
* })),
|
|
74
|
+
* material: new PhongMaterial(viewer.scene, {
|
|
75
|
+
* emissive: [1, 0, 0]
|
|
76
|
+
* })
|
|
77
|
+
* });
|
|
78
|
+
*
|
|
79
|
+
* //------------------------------------------------------------------------------------------------------------------
|
|
80
|
+
* // Create a moving SectionPlane, that moves through the table models
|
|
81
|
+
* //------------------------------------------------------------------------------------------------------------------
|
|
82
|
+
*
|
|
83
|
+
* const sectionPlanes = new SectionPlanesPlugin(viewer, {
|
|
84
|
+
* overviewCanvasId: "mySectionPlanesOverviewCanvas",
|
|
85
|
+
* overviewVisible: true
|
|
86
|
+
* });
|
|
87
|
+
*
|
|
88
|
+
* let currentPoint = path.getPoint(0);
|
|
89
|
+
* let currentDirection = path.getTangent(0);
|
|
90
|
+
*
|
|
91
|
+
* const sectionPlane = sectionPlanes.createSectionPlane({
|
|
92
|
+
* id: "mySectionPlane",
|
|
93
|
+
* pos: currentPoint,
|
|
94
|
+
* dir: currentDirection
|
|
95
|
+
* });
|
|
96
|
+
*
|
|
97
|
+
* sectionPlanes.showControl(sectionPlane.id);
|
|
98
|
+
*
|
|
99
|
+
* //------------------------------------------------------------------------------------------------------------------
|
|
100
|
+
* // Controlling SectionPlane position and direction
|
|
101
|
+
* //------------------------------------------------------------------------------------------------------------------
|
|
102
|
+
*
|
|
103
|
+
* let currentT = 0.0;
|
|
104
|
+
* document.getElementById("section_path").oninput = function() {
|
|
105
|
+
* currentT = Number(document.getElementById("section_path").value);
|
|
106
|
+
* currentPoint = path.getPoint(currentT);
|
|
107
|
+
* currentDirection = path.getTangent(currentT);
|
|
108
|
+
* sectionPlane.pos = currentPoint;
|
|
109
|
+
* sectionPlane.dir = currentDirection;
|
|
110
|
+
* };
|
|
111
|
+
*
|
|
112
|
+
* window.viewer = viewer;
|
|
113
|
+
*
|
|
114
|
+
* //------------------------------------------------------------------------------------------------------------------
|
|
115
|
+
* // Controlling CrossSections settings
|
|
116
|
+
* //------------------------------------------------------------------------------------------------------------------
|
|
117
|
+
*
|
|
118
|
+
* viewer.scene.crossSections.sliceThickness = 0.05;
|
|
119
|
+
* viewer.scene.crossSections.sliceColor = [0.0, 0.0, 0.0, 1.0];
|
|
120
|
+
* });
|
|
121
|
+
* ````
|
|
122
|
+
*
|
|
123
|
+
* [[Run this example](https://xeokit.github.io/xeokit-sdk/examples/slicing/#SectionPlanesPlugin_Duplex_SectionPath_CrossSections)]
|
|
124
|
+
*
|
|
125
|
+
*/
|
|
126
|
+
class CrossSections extends Component {
|
|
127
|
+
|
|
128
|
+
/** @private */
|
|
129
|
+
constructor(owner, cfg = {}) {
|
|
130
|
+
|
|
131
|
+
super(owner, cfg);
|
|
132
|
+
|
|
133
|
+
this.sliceColor = cfg.sliceColor;
|
|
134
|
+
this.sliceThickness = cfg.sliceThickness;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Sets the thickness of a slice created by a section.
|
|
139
|
+
*
|
|
140
|
+
* Default value is ````0.0````.
|
|
141
|
+
*
|
|
142
|
+
* @type {Number}
|
|
143
|
+
*/
|
|
144
|
+
set sliceThickness(value) {
|
|
145
|
+
if (value === undefined || value === null) {
|
|
146
|
+
value = 0.0;
|
|
147
|
+
}
|
|
148
|
+
if (this._sliceThickness === value) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
this._sliceThickness = value;
|
|
152
|
+
this.glRedraw();
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Gets the thickness of a slice created by a section.
|
|
157
|
+
*
|
|
158
|
+
* Default value is ````0.0````.
|
|
159
|
+
*
|
|
160
|
+
* @type {Number}
|
|
161
|
+
*/
|
|
162
|
+
get sliceThickness() {
|
|
163
|
+
return this._sliceThickness;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Sets the color of a slice created by a section.
|
|
168
|
+
*
|
|
169
|
+
* Default value is ````[0.0, 0.0, 0.0, 1.0]````.
|
|
170
|
+
*
|
|
171
|
+
* @type {Number}
|
|
172
|
+
*/
|
|
173
|
+
set sliceColor(value) {
|
|
174
|
+
if (value === undefined || value === null) {
|
|
175
|
+
value = [0.0, 0.0, 0.0, 1.0];
|
|
176
|
+
}
|
|
177
|
+
if (this._sliceColor === value) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
this._sliceColor = value;
|
|
181
|
+
this.glRedraw();
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Gets the color of a slice created by a section.
|
|
186
|
+
*
|
|
187
|
+
* Default value is ````[0.0, 0.0, 0.0, 1.0]````.
|
|
188
|
+
*
|
|
189
|
+
* @type {Number}
|
|
190
|
+
*/
|
|
191
|
+
get sliceColor() {
|
|
192
|
+
return this._sliceColor;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Destroys this component.
|
|
197
|
+
*/
|
|
198
|
+
destroy() {
|
|
199
|
+
super.destroy();
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export {CrossSections};
|
|
@@ -16,6 +16,7 @@ import {EmphasisMaterial} from '../materials/EmphasisMaterial.js';
|
|
|
16
16
|
import {EdgeMaterial} from '../materials/EdgeMaterial.js';
|
|
17
17
|
import {Metrics} from "../metriqs/Metriqs.js";
|
|
18
18
|
import {SAO} from "../postfx/SAO.js";
|
|
19
|
+
import {CrossSections} from "../postfx/CrossSections.js";
|
|
19
20
|
import {PointsMaterial} from "../materials/PointsMaterial.js";
|
|
20
21
|
import {LinesMaterial} from "../materials/LinesMaterial.js";
|
|
21
22
|
|
|
@@ -840,6 +841,14 @@ class Scene extends Component {
|
|
|
840
841
|
enabled: cfg.saoEnabled
|
|
841
842
|
});
|
|
842
843
|
|
|
844
|
+
/** Configures Cross Sections for this Scene.
|
|
845
|
+
* @type {CrossSections}
|
|
846
|
+
* @final
|
|
847
|
+
*/
|
|
848
|
+
this.crossSections = new CrossSections(this, {
|
|
849
|
+
|
|
850
|
+
});
|
|
851
|
+
|
|
843
852
|
this.ticksPerRender = cfg.ticksPerRender;
|
|
844
853
|
this.ticksPerOcclusionTest = cfg.ticksPerOcclusionTest;
|
|
845
854
|
this.passes = cfg.passes;
|
|
@@ -2799,4 +2808,4 @@ class Scene extends Component {
|
|
|
2799
2808
|
}
|
|
2800
2809
|
}
|
|
2801
2810
|
|
|
2802
|
-
export {Scene};
|
|
2811
|
+
export {Scene};
|
|
@@ -8,6 +8,7 @@ import {AngleMeasurementsPlugin} from "./AngleMeasurementsPlugin";
|
|
|
8
8
|
* Once the AngleMeasurementControl is activated, the first click on any {@link Entity} begins constructing a {@link AngleMeasurement}, fixing its origin to that Entity. The next click on any Entity will complete the AngleMeasurement, fixing its target to that second Entity. The AngleMeasurementControl will then wait for the next click on any Entity, to begin constructing another AngleMeasurement, and so on, until deactivated.
|
|
9
9
|
*/
|
|
10
10
|
export declare class AngleMeasurementsControl extends Component {
|
|
11
|
+
|
|
11
12
|
/**
|
|
12
13
|
* The {@link AngleMeasurementsPlugin} that owns this AngleMeasurementsControl.
|
|
13
14
|
* @type {AngleMeasurementsPlugin}
|
|
@@ -86,4 +87,12 @@ export declare class AngleMeasurementsControl extends Component {
|
|
|
86
87
|
* @param scope Scope for the callback
|
|
87
88
|
*/
|
|
88
89
|
on(event: "measurementStart", callback: (measurement: AngleMeasurement) => void, scope?: any): string
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Fires when the control is (de)activated
|
|
93
|
+
* @param event The activation event
|
|
94
|
+
* @param callback Called fired on the event
|
|
95
|
+
* @param scope Scope for the callback
|
|
96
|
+
*/
|
|
97
|
+
on(event: "activated", callback: (activated: boolean) => void, scope?: any): string
|
|
89
98
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { AngleMeasurementsControl } from "./AngleMeasurementsControl.js";
|
|
2
|
-
import { math } from "../../viewer/scene/math/math.js";
|
|
3
2
|
import {AngleMeasurementsPlugin} from "./AngleMeasurementsPlugin";
|
|
4
|
-
import {PointerLens} from "../../extras/
|
|
3
|
+
import {PointerLens} from "../../extras/";
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
6
|
* Creates {@link AngleMeasurement}s in an {@link AngleMeasurementsPlugin} from mouse input.
|
|
@@ -3,12 +3,16 @@ import { AngleMeasurement } from "./AngleMeasurement";
|
|
|
3
3
|
import { AngleMeasurementsControl } from "./AngleMeasurementsControl";
|
|
4
4
|
|
|
5
5
|
export declare type AngleMeasurementsPluginConfiguration = {
|
|
6
|
+
|
|
6
7
|
/** Optional ID for this plugin, so that we can find it within {@link Viewer.plugins}. */
|
|
7
8
|
id?: string;
|
|
9
|
+
|
|
8
10
|
/** Container DOM element for markers and labels. Defaults to ````document.body````. */
|
|
9
11
|
container?: HTMLElement;
|
|
12
|
+
|
|
10
13
|
/** The default color of the dots, wire and label. */
|
|
11
14
|
defaultColor?: string;
|
|
15
|
+
|
|
12
16
|
/** If set, the wires, dots and labels will have this zIndex (+1 for dots and +2 for labels). */
|
|
13
17
|
zIndex?: number;
|
|
14
18
|
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { AngleMeasurementsControl } from "./AngleMeasurementsControl";
|
|
2
|
+
import {AngleMeasurementsPlugin} from "./AngleMeasurementsPlugin";
|
|
3
|
+
import {PointerLens} from "../../extras/";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Creates {@link AngleMeasurement}s in an {@link AngleMeasurementsPlugin} from touch input.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* import { Viewer, XKTLoaderPlugin, AngleMeasurementsPlugin, AngleMeasurementsTouchControl, PointerLens } from "xeokit-sdk.es.js";
|
|
10
|
+
*
|
|
11
|
+
* const viewer = new Viewer({
|
|
12
|
+
* canvasId: "myCanvas",
|
|
13
|
+
* });
|
|
14
|
+
*
|
|
15
|
+
* viewer.camera.eye = [-3.93, 2.85, 27.01];
|
|
16
|
+
* viewer.camera.look = [4.40, 3.72, 8.89];
|
|
17
|
+
* viewer.camera.up = [-0.01, 0.99, 0.039];
|
|
18
|
+
*
|
|
19
|
+
* const xktLoader = new XKTLoaderPlugin(viewer);
|
|
20
|
+
*
|
|
21
|
+
* const sceneModel = xktLoader.load({
|
|
22
|
+
* id: "myModel",
|
|
23
|
+
* src: "Duplex.xkt"
|
|
24
|
+
* });
|
|
25
|
+
*
|
|
26
|
+
* const angleMeasurements = new AngleMeasurementsPlugin(viewer);
|
|
27
|
+
*
|
|
28
|
+
* const pointerLens = new PointerLens(viewer); // Create a PointerLens instance
|
|
29
|
+
*
|
|
30
|
+
* const angleMeasurementsTouchControl = new AngleMeasurementsTouchControl(angleMeasurements, {
|
|
31
|
+
* pointerLens: pointerLens,
|
|
32
|
+
* snapping: true
|
|
33
|
+
* });
|
|
34
|
+
*
|
|
35
|
+
* angleMeasurementsTouchControl.activate();
|
|
36
|
+
*/
|
|
37
|
+
export class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Creates a new AngleMeasurementsTouchControl.
|
|
41
|
+
*
|
|
42
|
+
* @param {AngleMeasurementsPlugin} angleMeasurementsPlugin The AngleMeasurementsPlugin to control.
|
|
43
|
+
* @param {Object} [cfg] Configuration options.
|
|
44
|
+
* @param {PointerLens} [cfg.pointerLens] A PointerLens to use for providing a magnified view of the cursor when snapping is enabled.
|
|
45
|
+
* @param {boolean} [cfg.snapping=true] Whether to initially enable snap-to-vertex and snap-to-edge for this AngleMeasurementsTouchControl.
|
|
46
|
+
*/
|
|
47
|
+
constructor(angleMeasurementsPlugin: AngleMeasurementsPlugin, cfg?: {
|
|
48
|
+
pointerLens?: PointerLens;
|
|
49
|
+
snapping?: boolean;
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Gets whether this AngleMeasurementsTouchControl is currently active, responding to input.
|
|
54
|
+
*
|
|
55
|
+
* @returns {boolean} True if active, false otherwise.
|
|
56
|
+
*/
|
|
57
|
+
get active(): boolean;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Sets whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsTouchControl.
|
|
61
|
+
*
|
|
62
|
+
* @param {boolean} snapping True to enable snap-to-vertex and snap-to-edge, false to disable.
|
|
63
|
+
*/
|
|
64
|
+
set snapping(snapping: boolean);
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Gets whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsTouchControl.
|
|
68
|
+
*
|
|
69
|
+
* @returns {boolean} True if snap-to-vertex and snap-to-edge are enabled, false otherwise.
|
|
70
|
+
*/
|
|
71
|
+
get snapping(): boolean;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Activates this AngleMeasurementsTouchControl, making it responsive to input.
|
|
75
|
+
*/
|
|
76
|
+
activate(): void;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Deactivates this AngleMeasurementsTouchControl, making it unresponsive to input.
|
|
80
|
+
*/
|
|
81
|
+
deactivate(): void;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Resets this AngleMeasurementsTouchControl, destroying any AngleMeasurement under construction.
|
|
85
|
+
*/
|
|
86
|
+
reset(): void;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Destroys this AngleMeasurementsTouchControl.
|
|
90
|
+
*/
|
|
91
|
+
destroy(): void;
|
|
92
|
+
}
|
|
@@ -88,7 +88,7 @@ export declare class DistanceMeasurementsControl extends Component {
|
|
|
88
88
|
on(event: "measurementStart", callback: (measurement: DistanceMeasurement) => void, scope?: any): string
|
|
89
89
|
|
|
90
90
|
/**
|
|
91
|
-
* Fires when the
|
|
91
|
+
* Fires when the control is (de)activated
|
|
92
92
|
* @param event The activation event
|
|
93
93
|
* @param callback Called fired on the event
|
|
94
94
|
* @param scope Scope for the callback
|
|
@@ -3,26 +3,37 @@ import { DistanceMeasurementsControl } from "./DistanceMeasurementsControl";
|
|
|
3
3
|
import { DistanceMeasurement } from "./DistanceMeasurement";
|
|
4
4
|
|
|
5
5
|
export declare type DistanceMeasurementsPluginConfiguration = {
|
|
6
|
+
|
|
6
7
|
/** Optional ID for this plugin, so that we can find it within {@link Viewer.plugins}. */
|
|
7
8
|
id?: string;
|
|
9
|
+
|
|
8
10
|
/** The minimum length, in pixels, of an axis wire beyond which its label is shown. */
|
|
9
11
|
labelMinAxisLength?: number;
|
|
12
|
+
|
|
10
13
|
/** Container DOM element for markers and labels. Defaults to ````document.body````. */
|
|
11
14
|
container?: HTMLElement;
|
|
15
|
+
|
|
12
16
|
/** The default value of the DistanceMeasurements `visible` property. */
|
|
13
17
|
defaultVisible?: boolean;
|
|
18
|
+
|
|
14
19
|
/** The default value of the DistanceMeasurements `originVisible` property. */
|
|
15
20
|
defaultOriginVisible?: boolean;
|
|
21
|
+
|
|
16
22
|
/** The default value of the DistanceMeasurements `targetVisible` property. */
|
|
17
23
|
defaultTargetVisible?: boolean;
|
|
24
|
+
|
|
18
25
|
/** The default value of the DistanceMeasurements `wireVisible` property. */
|
|
19
26
|
defaultWireVisible?: boolean;
|
|
27
|
+
|
|
20
28
|
/** The default value of the DistanceMeasurements `axisVisible` property. */
|
|
21
29
|
defaultAxisVisible?: boolean;
|
|
30
|
+
|
|
22
31
|
/** The default color of the length dots, wire and label. */
|
|
23
32
|
defaultColor?: string;
|
|
33
|
+
|
|
24
34
|
/** The default value of the DistanceMeasurements `labelsOnWires` property. */
|
|
25
35
|
defaultLabelsOnWires?: boolean;
|
|
36
|
+
|
|
26
37
|
/** If set, the wires, dots and labels will have this zIndex (+1 for dots and +2 for labels). */
|
|
27
38
|
zIndex?: number;
|
|
28
39
|
};
|
|
@@ -31,7 +42,8 @@ export declare type DistanceMeasurementsPluginConfiguration = {
|
|
|
31
42
|
* {@link Viewer} plugin for measuring point-to-point distances.
|
|
32
43
|
*/
|
|
33
44
|
export declare class DistanceMeasurementsPlugin extends Plugin {
|
|
34
|
-
|
|
45
|
+
|
|
46
|
+
/**
|
|
35
47
|
* @constructor
|
|
36
48
|
* @param {Viewer} viewer The Viewer.
|
|
37
49
|
* @param {DistanceMeasurementsPluginConfiguration} [cfg] Plugin configuration.
|
|
@@ -149,5 +161,4 @@ export declare class DistanceMeasurementsPlugin extends Plugin {
|
|
|
149
161
|
* @param {Function} callback Callback fired on the event
|
|
150
162
|
*/
|
|
151
163
|
on(event: "measurementDestroyed", callback: (measurement: DistanceMeasurement)=> void): string;
|
|
152
|
-
|
|
153
164
|
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import {DistanceMeasurementsControl} from "./DistanceMeasurementsControl";
|
|
2
|
+
import {DistanceMeasurementsPlugin} from "./DistanceMeasurementsPlugin";
|
|
3
|
+
import {PointerLens} from "../../extras/";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Creates {@link DistanceMeasurement}s in a {@link DistanceMeasurementsPlugin} from touch input.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* // Usage
|
|
10
|
+
* const distanceMeasurementsControl = new DistanceMeasurementsTouchControl(distanceMeasurementsPlugin, {
|
|
11
|
+
* pointerLens: new PointerLens(viewer),
|
|
12
|
+
* snapping: true
|
|
13
|
+
* });
|
|
14
|
+
*/
|
|
15
|
+
export class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Creates a DistanceMeasurementsTouchControl bound to the given DistanceMeasurementsPlugin.
|
|
19
|
+
*
|
|
20
|
+
* @param {DistanceMeasurementsPlugin} distanceMeasurementsPlugin The DistanceMeasurementsPlugin to control.
|
|
21
|
+
* @param {Object} cfg Configuration options.
|
|
22
|
+
* @param {PointerLens} [cfg.pointerLens] A PointerLens to provide a magnified view of the cursor when snapping is enabled.
|
|
23
|
+
* @param {boolean} [cfg.snapping=true] Whether to enable snap-to-vertex and snap-to-edge for this DistanceMeasurementsTouchControl.
|
|
24
|
+
*/
|
|
25
|
+
constructor(distanceMeasurementsPlugin: DistanceMeasurementsPlugin, cfg?: {
|
|
26
|
+
pointerLens?: PointerLens;
|
|
27
|
+
snapping?: boolean;
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Gets if this DistanceMeasurementsTouchControl is currently active, where it is responding to input.
|
|
32
|
+
*
|
|
33
|
+
* @returns {boolean} True if this DistanceMeasurementsTouchControl is active.
|
|
34
|
+
*/
|
|
35
|
+
get active(): boolean;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Sets whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsTouchControl.
|
|
39
|
+
*
|
|
40
|
+
* @param {boolean} snapping Whether to enable snap-to-vertex and snap-to-edge for this DistanceMeasurementsTouchControl.
|
|
41
|
+
*/
|
|
42
|
+
set snapping(snapping: boolean);
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Gets whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsTouchControl.
|
|
46
|
+
*
|
|
47
|
+
* @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsTouchControl.
|
|
48
|
+
*/
|
|
49
|
+
get snapping(): boolean;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Activates this DistanceMeasurementsTouchControl, ready to respond to input.
|
|
53
|
+
*/
|
|
54
|
+
activate(): void;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Deactivates this DistanceMeasurementsTouchControl, making it unresponsive to input.
|
|
58
|
+
*/
|
|
59
|
+
deactivate(): void;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Resets this DistanceMeasurementsTouchControl.
|
|
63
|
+
*/
|
|
64
|
+
reset(): void;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Destroys this DistanceMeasurementsTouchControl.
|
|
68
|
+
*/
|
|
69
|
+
destroy(): void;
|
|
70
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Component } from "../Component";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @desc Configures cross-section slices for a {@link Scene}.
|
|
5
|
+
*/
|
|
6
|
+
export declare class CrossSections extends Component {
|
|
7
|
+
/**
|
|
8
|
+
* Sets the thickness of a slice created by a section.
|
|
9
|
+
*
|
|
10
|
+
* Default value is ````0.0````.
|
|
11
|
+
*
|
|
12
|
+
* @type {Number}
|
|
13
|
+
*/
|
|
14
|
+
set sliceThickness(arg: number);
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Gets the thickness of a slice created by a section.
|
|
18
|
+
*
|
|
19
|
+
* Default value is ````0.0````.
|
|
20
|
+
*
|
|
21
|
+
* @type {Number}
|
|
22
|
+
*/
|
|
23
|
+
get sliceThickness(): number;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Sets the color of a slice created by a section.
|
|
27
|
+
*
|
|
28
|
+
* Default value is ````[0.0, 0.0, 0.0, 1.0]````.
|
|
29
|
+
*
|
|
30
|
+
* @type {Number}
|
|
31
|
+
*/
|
|
32
|
+
set sliceColor(arg: number[]);
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Gets the color of a slice created by a section.
|
|
36
|
+
*
|
|
37
|
+
* Default value is ````[0.0, 0.0, 0.0, 1.0]````.
|
|
38
|
+
*
|
|
39
|
+
* @type {Number}
|
|
40
|
+
*/
|
|
41
|
+
get sliceColor(): number[];
|
|
42
|
+
}
|