@xeokit/xeokit-sdk 2.5.2-beta-20 → 2.5.2-beta-21
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/xeokit-sdk.cjs.js +180 -6
- package/dist/xeokit-sdk.es.js +180 -7
- package/dist/xeokit-sdk.es5.js +133 -6
- 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/DistanceMeasurementsPlugin/DistanceMeasurement.js +43 -6
- package/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js +4 -0
- package/src/viewer/scene/geometry/builders/buildBoxLinesGeometry.js +133 -1
- package/types/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.d.ts +14 -0
- package/types/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.d.ts +4 -0
package/dist/xeokit-sdk.cjs.js
CHANGED
|
@@ -47132,6 +47132,138 @@ function buildBoxLinesGeometry(cfg = {}) {
|
|
|
47132
47132
|
});
|
|
47133
47133
|
}
|
|
47134
47134
|
|
|
47135
|
+
/**
|
|
47136
|
+
* @desc Creates a box-shaped lines {@link Geometry} from AABB.
|
|
47137
|
+
*
|
|
47138
|
+
* ## Usage
|
|
47139
|
+
*
|
|
47140
|
+
* In the example below we'll create a {@link Mesh} with a box-shaped {@link ReadableGeometry} that has lines primitives.
|
|
47141
|
+
* This box will be created from AABB of a model.
|
|
47142
|
+
*
|
|
47143
|
+
* [[Run this example](/examples/#geometry_builders_buildBoxLinesGeometryFromAABB)]
|
|
47144
|
+
*
|
|
47145
|
+
* ````javascript
|
|
47146
|
+
* import {Viewer, Mesh, Node, buildBoxGeometry, buildBoxLinesGeometryFromAABB, ReadableGeometry, PhongMaterial} from "../../dist/xeokit-sdk.min.es.js";
|
|
47147
|
+
*
|
|
47148
|
+
* const viewer = new Viewer({
|
|
47149
|
+
* canvasId: "myCanvas"
|
|
47150
|
+
* });
|
|
47151
|
+
*
|
|
47152
|
+
* viewer.scene.camera.eye = [-21.80, 4.01, 6.56];
|
|
47153
|
+
* viewer.scene.camera.look = [0, -5.75, 0];
|
|
47154
|
+
* viewer.scene.camera.up = [0.37, 0.91, -0.11];
|
|
47155
|
+
*
|
|
47156
|
+
* const boxGeometry = new ReadableGeometry(viewer.scene, buildBoxGeometry({
|
|
47157
|
+
* xSize: 1,
|
|
47158
|
+
* ySize: 1,
|
|
47159
|
+
* zSize: 1
|
|
47160
|
+
* }));
|
|
47161
|
+
*
|
|
47162
|
+
* new Node(viewer.scene, {
|
|
47163
|
+
* id: "table",
|
|
47164
|
+
* isModel: true, // <--------------------- Node represents a model
|
|
47165
|
+
* rotation: [0, 50, 0],
|
|
47166
|
+
* position: [0, 0, 0],
|
|
47167
|
+
* scale: [1, 1, 1],
|
|
47168
|
+
*
|
|
47169
|
+
* children: [
|
|
47170
|
+
*
|
|
47171
|
+
* new Mesh(viewer.scene, { // Red table leg
|
|
47172
|
+
* id: "redLeg",
|
|
47173
|
+
* isObject: true, // <---------- Node represents an object
|
|
47174
|
+
* position: [-4, -6, -4],
|
|
47175
|
+
* scale: [1, 3, 1],
|
|
47176
|
+
* rotation: [0, 0, 0],
|
|
47177
|
+
* geometry: boxGeometry,
|
|
47178
|
+
* material: new PhongMaterial(viewer.scene, {
|
|
47179
|
+
* diffuse: [1, 0.3, 0.3]
|
|
47180
|
+
* })
|
|
47181
|
+
* }),
|
|
47182
|
+
*
|
|
47183
|
+
* new Mesh(viewer.scene, { // Green table leg
|
|
47184
|
+
* id: "greenLeg",
|
|
47185
|
+
* isObject: true, // <---------- Node represents an object
|
|
47186
|
+
* position: [4, -6, -4],
|
|
47187
|
+
* scale: [1, 3, 1],
|
|
47188
|
+
* rotation: [0, 0, 0],
|
|
47189
|
+
* geometry: boxGeometry,
|
|
47190
|
+
* material: new PhongMaterial(viewer.scene, {
|
|
47191
|
+
* diffuse: [0.3, 1.0, 0.3]
|
|
47192
|
+
* })
|
|
47193
|
+
* }),
|
|
47194
|
+
*
|
|
47195
|
+
* new Mesh(viewer.scene, {// Blue table leg
|
|
47196
|
+
* id: "blueLeg",
|
|
47197
|
+
* isObject: true, // <---------- Node represents an object
|
|
47198
|
+
* position: [4, -6, 4],
|
|
47199
|
+
* scale: [1, 3, 1],
|
|
47200
|
+
* rotation: [0, 0, 0],
|
|
47201
|
+
* geometry: boxGeometry,
|
|
47202
|
+
* material: new PhongMaterial(viewer.scene, {
|
|
47203
|
+
* diffuse: [0.3, 0.3, 1.0]
|
|
47204
|
+
* })
|
|
47205
|
+
* }),
|
|
47206
|
+
*
|
|
47207
|
+
* new Mesh(viewer.scene, { // Yellow table leg
|
|
47208
|
+
* id: "yellowLeg",
|
|
47209
|
+
* isObject: true, // <---------- Node represents an object
|
|
47210
|
+
* position: [-4, -6, 4],
|
|
47211
|
+
* scale: [1, 3, 1],
|
|
47212
|
+
* rotation: [0, 0, 0],
|
|
47213
|
+
* geometry: boxGeometry,
|
|
47214
|
+
* material: new PhongMaterial(viewer.scene, {
|
|
47215
|
+
* diffuse: [1.0, 1.0, 0.0]
|
|
47216
|
+
* })
|
|
47217
|
+
* }),
|
|
47218
|
+
*
|
|
47219
|
+
* new Mesh(viewer.scene, { // Purple table top
|
|
47220
|
+
* id: "tableTop",
|
|
47221
|
+
* isObject: true, // <---------- Node represents an object
|
|
47222
|
+
* position: [0, -3, 0],
|
|
47223
|
+
* scale: [6, 0.5, 6],
|
|
47224
|
+
* rotation: [0, 0, 0],
|
|
47225
|
+
* geometry: boxGeometry,
|
|
47226
|
+
* material: new PhongMaterial(viewer.scene, {
|
|
47227
|
+
* diffuse: [1.0, 0.3, 1.0]
|
|
47228
|
+
* })
|
|
47229
|
+
* })
|
|
47230
|
+
* ]
|
|
47231
|
+
* });
|
|
47232
|
+
*
|
|
47233
|
+
* let aabb = viewer.scene.aabb;
|
|
47234
|
+
* console.log(aabb);
|
|
47235
|
+
*
|
|
47236
|
+
* new Mesh(viewer.scene, {
|
|
47237
|
+
* geometry: new ReadableGeometry(viewer.scene, buildBoxLinesGeometryFromAABB({
|
|
47238
|
+
* id: "aabb",
|
|
47239
|
+
* aabb: aabb,
|
|
47240
|
+
* })),
|
|
47241
|
+
* material: new PhongMaterial(viewer.scene, {
|
|
47242
|
+
* emissive: [0, 1,]
|
|
47243
|
+
* })
|
|
47244
|
+
* });
|
|
47245
|
+
* ````
|
|
47246
|
+
*
|
|
47247
|
+
* @function buildBoxLinesGeometryFromAABB
|
|
47248
|
+
* @param {*} [cfg] Configs
|
|
47249
|
+
* @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene}, generated automatically when omitted.
|
|
47250
|
+
* @param {Number[]} [cfg.aabb] AABB for which box will be created.
|
|
47251
|
+
* @returns {Object} Configuration for a {@link Geometry} subtype.
|
|
47252
|
+
*/
|
|
47253
|
+
function buildBoxLinesGeometryFromAABB(cfg = {}){
|
|
47254
|
+
return buildBoxLinesGeometry({
|
|
47255
|
+
id: cfg.id,
|
|
47256
|
+
center: [
|
|
47257
|
+
(cfg.aabb[0] + cfg.aabb[3]) / 2.0,
|
|
47258
|
+
(cfg.aabb[1] + cfg.aabb[4]) / 2.0,
|
|
47259
|
+
(cfg.aabb[2] + cfg.aabb[5]) / 2.0,
|
|
47260
|
+
],
|
|
47261
|
+
xSize: (Math.abs(cfg.aabb[3] - cfg.aabb[0])) / 2.0,
|
|
47262
|
+
ySize: (Math.abs(cfg.aabb[4] - cfg.aabb[1])) / 2.0,
|
|
47263
|
+
zSize: (Math.abs(cfg.aabb[5] - cfg.aabb[2])) / 2.0,
|
|
47264
|
+
});
|
|
47265
|
+
}
|
|
47266
|
+
|
|
47135
47267
|
/**
|
|
47136
47268
|
* @desc Creates a grid-shaped {@link Geometry}.
|
|
47137
47269
|
*
|
|
@@ -84591,6 +84723,7 @@ class DistanceMeasurement extends Component {
|
|
|
84591
84723
|
this._zAxisVisible = false;
|
|
84592
84724
|
this._axisEnabled = true;
|
|
84593
84725
|
this._labelsVisible = false;
|
|
84726
|
+
this._labelsOnWires = false;
|
|
84594
84727
|
this._clickable = false;
|
|
84595
84728
|
|
|
84596
84729
|
this._originMarker.on("worldPos", (value) => {
|
|
@@ -84650,6 +84783,7 @@ class DistanceMeasurement extends Component {
|
|
|
84650
84783
|
this.yAxisVisible = cfg.yAxisVisible;
|
|
84651
84784
|
this.zAxisVisible = cfg.zAxisVisible;
|
|
84652
84785
|
this.labelsVisible = cfg.labelsVisible;
|
|
84786
|
+
this.labelsOnWires = cfg.labelsOnWires;
|
|
84653
84787
|
}
|
|
84654
84788
|
|
|
84655
84789
|
_update() {
|
|
@@ -84801,9 +84935,19 @@ class DistanceMeasurement extends Component {
|
|
|
84801
84935
|
|
|
84802
84936
|
this._lengthLabel.setPosOnWire(cp[0], cp[1], cp[6], cp[7]);
|
|
84803
84937
|
|
|
84804
|
-
this.
|
|
84805
|
-
|
|
84806
|
-
|
|
84938
|
+
if (this.labelsOnWires) {
|
|
84939
|
+
this._xAxisLabel.setPosOnWire(cp[0], cp[1], cp[2], cp[3]);
|
|
84940
|
+
this._yAxisLabel.setPosOnWire(cp[2], cp[3], cp[4], cp[5]);
|
|
84941
|
+
this._zAxisLabel.setPosOnWire(cp[4], cp[5], cp[6], cp[7]);
|
|
84942
|
+
} else {
|
|
84943
|
+
const labelOffset = 35;
|
|
84944
|
+
let currentLabelOffset = labelOffset;
|
|
84945
|
+
this._xAxisLabel.setPosOnWire(cp[0], cp[1] + currentLabelOffset, cp[6], cp[7] + currentLabelOffset);
|
|
84946
|
+
currentLabelOffset += labelOffset;
|
|
84947
|
+
this._yAxisLabel.setPosOnWire(cp[0], cp[1] + currentLabelOffset, cp[6], cp[7] + currentLabelOffset);
|
|
84948
|
+
currentLabelOffset += labelOffset;
|
|
84949
|
+
this._zAxisLabel.setPosOnWire(cp[0], cp[1] + currentLabelOffset, cp[6], cp[7] + currentLabelOffset);
|
|
84950
|
+
}
|
|
84807
84951
|
|
|
84808
84952
|
const tilde = this._approximate ? " ~ " : " = ";
|
|
84809
84953
|
|
|
@@ -84816,9 +84960,15 @@ class DistanceMeasurement extends Component {
|
|
|
84816
84960
|
|
|
84817
84961
|
const labelMinAxisLength = this.plugin.labelMinAxisLength;
|
|
84818
84962
|
|
|
84819
|
-
this.
|
|
84820
|
-
|
|
84821
|
-
|
|
84963
|
+
if (this.labelsOnWires){
|
|
84964
|
+
this._xAxisLabelCulled = (xAxisCanvasLength < labelMinAxisLength);
|
|
84965
|
+
this._yAxisLabelCulled = (yAxisCanvasLength < labelMinAxisLength);
|
|
84966
|
+
this._zAxisLabelCulled = (zAxisCanvasLength < labelMinAxisLength);
|
|
84967
|
+
} else {
|
|
84968
|
+
this._xAxisLabelCulled = false;
|
|
84969
|
+
this._yAxisLabelCulled = false;
|
|
84970
|
+
this._zAxisLabelCulled = false;
|
|
84971
|
+
}
|
|
84822
84972
|
|
|
84823
84973
|
if (!this._xAxisLabelCulled) {
|
|
84824
84974
|
this._xAxisLabel.setText(tilde + Math.abs((this._targetWorld[0] - this._originWorld[0]) * scale).toFixed(2) + unitAbbrev);
|
|
@@ -85219,6 +85369,25 @@ class DistanceMeasurement extends Component {
|
|
|
85219
85369
|
return this._labelsVisible;
|
|
85220
85370
|
}
|
|
85221
85371
|
|
|
85372
|
+
/**
|
|
85373
|
+
* Sets if labels should be positioned on the wires.
|
|
85374
|
+
*
|
|
85375
|
+
* @type {Boolean}
|
|
85376
|
+
*/
|
|
85377
|
+
set labelsOnWires(value) {
|
|
85378
|
+
value = value !== undefined ? Boolean(value) : this.plugin.defaultLabelsOnWires;
|
|
85379
|
+
this._labelsOnWires = value;
|
|
85380
|
+
}
|
|
85381
|
+
|
|
85382
|
+
/**
|
|
85383
|
+
* Gets if labels should be positioned on the wires.
|
|
85384
|
+
*
|
|
85385
|
+
* @type {Boolean}
|
|
85386
|
+
*/
|
|
85387
|
+
get labelsOnWires() {
|
|
85388
|
+
return this._labelsOnWires;
|
|
85389
|
+
}
|
|
85390
|
+
|
|
85222
85391
|
/**
|
|
85223
85392
|
* Sets if this DistanceMeasurement appears highlighted.
|
|
85224
85393
|
* @param highlighted
|
|
@@ -86029,6 +86198,7 @@ class DistanceMeasurementsPlugin extends Plugin {
|
|
|
86029
86198
|
* @param {boolean} [cfg.defaultZAxisVisible=true] The default value of the DistanceMeasurements `zAxisVisible` property.
|
|
86030
86199
|
* @param {string} [cfg.defaultColor=#00BBFF] The default color of the length dots, wire and label.
|
|
86031
86200
|
* @param {number} [cfg.zIndex] If set, the wires, dots and labels will have this zIndex (+1 for dots and +2 for labels).
|
|
86201
|
+
* @param {boolean} [cfg.defaultLabelsOnWires=true] The default value of the DistanceMeasurements `labelsOnWires` property.
|
|
86032
86202
|
* @param {PointerCircle} [cfg.pointerLens] A PointerLens to help the user position the pointer. This can be shared with other plugins.
|
|
86033
86203
|
*/
|
|
86034
86204
|
constructor(viewer, cfg = {}) {
|
|
@@ -86056,6 +86226,7 @@ class DistanceMeasurementsPlugin extends Plugin {
|
|
|
86056
86226
|
this.defaultZAxisVisible = cfg.defaultZAxisVisible !== false;
|
|
86057
86227
|
this.defaultColor = cfg.defaultColor !== undefined ? cfg.defaultColor : "#00BBFF";
|
|
86058
86228
|
this.zIndex = cfg.zIndex || 10000;
|
|
86229
|
+
this.defaultLabelsOnWires = cfg.defaultLabelsOnWires !== false;
|
|
86059
86230
|
|
|
86060
86231
|
this._onMouseOver = (event, measurement) => {
|
|
86061
86232
|
this.fire("mouseOver", {
|
|
@@ -86178,6 +86349,7 @@ class DistanceMeasurementsPlugin extends Plugin {
|
|
|
86178
86349
|
* @param {Boolean} [params.zAxisVisible=true] Whether to initially show the Z-axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target}.
|
|
86179
86350
|
* @param {Boolean} [params.labelsVisible=true] Whether to initially show the labels.
|
|
86180
86351
|
* @param {string} [params.color] The color of the length dot, wire and label.
|
|
86352
|
+
* @param {Boolean} [params.labelsOnWires=true] Determines if labels will be set on wires or one below the other.
|
|
86181
86353
|
* @returns {DistanceMeasurement} The new {@link DistanceMeasurement}.
|
|
86182
86354
|
*/
|
|
86183
86355
|
createMeasurement(params = {}) {
|
|
@@ -86209,6 +86381,7 @@ class DistanceMeasurementsPlugin extends Plugin {
|
|
|
86209
86381
|
originVisible: params.originVisible,
|
|
86210
86382
|
targetVisible: params.targetVisible,
|
|
86211
86383
|
color: params.color,
|
|
86384
|
+
labelsOnWires: params.labelsOnWires !== false && this.defaultLabelsOnWires !== false,
|
|
86212
86385
|
onMouseOver: this._onMouseOver,
|
|
86213
86386
|
onMouseLeave: this._onMouseLeave,
|
|
86214
86387
|
onContextMenu: this._onContextMenu
|
|
@@ -195972,6 +196145,7 @@ exports.XKTLoaderPlugin = XKTLoaderPlugin;
|
|
|
195972
196145
|
exports.XML3DLoaderPlugin = XML3DLoaderPlugin;
|
|
195973
196146
|
exports.buildBoxGeometry = buildBoxGeometry;
|
|
195974
196147
|
exports.buildBoxLinesGeometry = buildBoxLinesGeometry;
|
|
196148
|
+
exports.buildBoxLinesGeometryFromAABB = buildBoxLinesGeometryFromAABB;
|
|
195975
196149
|
exports.buildCylinderGeometry = buildCylinderGeometry;
|
|
195976
196150
|
exports.buildGridGeometry = buildGridGeometry;
|
|
195977
196151
|
exports.buildPlaneGeometry = buildPlaneGeometry;
|
package/dist/xeokit-sdk.es.js
CHANGED
|
@@ -47128,6 +47128,138 @@ function buildBoxLinesGeometry(cfg = {}) {
|
|
|
47128
47128
|
});
|
|
47129
47129
|
}
|
|
47130
47130
|
|
|
47131
|
+
/**
|
|
47132
|
+
* @desc Creates a box-shaped lines {@link Geometry} from AABB.
|
|
47133
|
+
*
|
|
47134
|
+
* ## Usage
|
|
47135
|
+
*
|
|
47136
|
+
* In the example below we'll create a {@link Mesh} with a box-shaped {@link ReadableGeometry} that has lines primitives.
|
|
47137
|
+
* This box will be created from AABB of a model.
|
|
47138
|
+
*
|
|
47139
|
+
* [[Run this example](/examples/#geometry_builders_buildBoxLinesGeometryFromAABB)]
|
|
47140
|
+
*
|
|
47141
|
+
* ````javascript
|
|
47142
|
+
* import {Viewer, Mesh, Node, buildBoxGeometry, buildBoxLinesGeometryFromAABB, ReadableGeometry, PhongMaterial} from "../../dist/xeokit-sdk.min.es.js";
|
|
47143
|
+
*
|
|
47144
|
+
* const viewer = new Viewer({
|
|
47145
|
+
* canvasId: "myCanvas"
|
|
47146
|
+
* });
|
|
47147
|
+
*
|
|
47148
|
+
* viewer.scene.camera.eye = [-21.80, 4.01, 6.56];
|
|
47149
|
+
* viewer.scene.camera.look = [0, -5.75, 0];
|
|
47150
|
+
* viewer.scene.camera.up = [0.37, 0.91, -0.11];
|
|
47151
|
+
*
|
|
47152
|
+
* const boxGeometry = new ReadableGeometry(viewer.scene, buildBoxGeometry({
|
|
47153
|
+
* xSize: 1,
|
|
47154
|
+
* ySize: 1,
|
|
47155
|
+
* zSize: 1
|
|
47156
|
+
* }));
|
|
47157
|
+
*
|
|
47158
|
+
* new Node(viewer.scene, {
|
|
47159
|
+
* id: "table",
|
|
47160
|
+
* isModel: true, // <--------------------- Node represents a model
|
|
47161
|
+
* rotation: [0, 50, 0],
|
|
47162
|
+
* position: [0, 0, 0],
|
|
47163
|
+
* scale: [1, 1, 1],
|
|
47164
|
+
*
|
|
47165
|
+
* children: [
|
|
47166
|
+
*
|
|
47167
|
+
* new Mesh(viewer.scene, { // Red table leg
|
|
47168
|
+
* id: "redLeg",
|
|
47169
|
+
* isObject: true, // <---------- Node represents an object
|
|
47170
|
+
* position: [-4, -6, -4],
|
|
47171
|
+
* scale: [1, 3, 1],
|
|
47172
|
+
* rotation: [0, 0, 0],
|
|
47173
|
+
* geometry: boxGeometry,
|
|
47174
|
+
* material: new PhongMaterial(viewer.scene, {
|
|
47175
|
+
* diffuse: [1, 0.3, 0.3]
|
|
47176
|
+
* })
|
|
47177
|
+
* }),
|
|
47178
|
+
*
|
|
47179
|
+
* new Mesh(viewer.scene, { // Green table leg
|
|
47180
|
+
* id: "greenLeg",
|
|
47181
|
+
* isObject: true, // <---------- Node represents an object
|
|
47182
|
+
* position: [4, -6, -4],
|
|
47183
|
+
* scale: [1, 3, 1],
|
|
47184
|
+
* rotation: [0, 0, 0],
|
|
47185
|
+
* geometry: boxGeometry,
|
|
47186
|
+
* material: new PhongMaterial(viewer.scene, {
|
|
47187
|
+
* diffuse: [0.3, 1.0, 0.3]
|
|
47188
|
+
* })
|
|
47189
|
+
* }),
|
|
47190
|
+
*
|
|
47191
|
+
* new Mesh(viewer.scene, {// Blue table leg
|
|
47192
|
+
* id: "blueLeg",
|
|
47193
|
+
* isObject: true, // <---------- Node represents an object
|
|
47194
|
+
* position: [4, -6, 4],
|
|
47195
|
+
* scale: [1, 3, 1],
|
|
47196
|
+
* rotation: [0, 0, 0],
|
|
47197
|
+
* geometry: boxGeometry,
|
|
47198
|
+
* material: new PhongMaterial(viewer.scene, {
|
|
47199
|
+
* diffuse: [0.3, 0.3, 1.0]
|
|
47200
|
+
* })
|
|
47201
|
+
* }),
|
|
47202
|
+
*
|
|
47203
|
+
* new Mesh(viewer.scene, { // Yellow table leg
|
|
47204
|
+
* id: "yellowLeg",
|
|
47205
|
+
* isObject: true, // <---------- Node represents an object
|
|
47206
|
+
* position: [-4, -6, 4],
|
|
47207
|
+
* scale: [1, 3, 1],
|
|
47208
|
+
* rotation: [0, 0, 0],
|
|
47209
|
+
* geometry: boxGeometry,
|
|
47210
|
+
* material: new PhongMaterial(viewer.scene, {
|
|
47211
|
+
* diffuse: [1.0, 1.0, 0.0]
|
|
47212
|
+
* })
|
|
47213
|
+
* }),
|
|
47214
|
+
*
|
|
47215
|
+
* new Mesh(viewer.scene, { // Purple table top
|
|
47216
|
+
* id: "tableTop",
|
|
47217
|
+
* isObject: true, // <---------- Node represents an object
|
|
47218
|
+
* position: [0, -3, 0],
|
|
47219
|
+
* scale: [6, 0.5, 6],
|
|
47220
|
+
* rotation: [0, 0, 0],
|
|
47221
|
+
* geometry: boxGeometry,
|
|
47222
|
+
* material: new PhongMaterial(viewer.scene, {
|
|
47223
|
+
* diffuse: [1.0, 0.3, 1.0]
|
|
47224
|
+
* })
|
|
47225
|
+
* })
|
|
47226
|
+
* ]
|
|
47227
|
+
* });
|
|
47228
|
+
*
|
|
47229
|
+
* let aabb = viewer.scene.aabb;
|
|
47230
|
+
* console.log(aabb);
|
|
47231
|
+
*
|
|
47232
|
+
* new Mesh(viewer.scene, {
|
|
47233
|
+
* geometry: new ReadableGeometry(viewer.scene, buildBoxLinesGeometryFromAABB({
|
|
47234
|
+
* id: "aabb",
|
|
47235
|
+
* aabb: aabb,
|
|
47236
|
+
* })),
|
|
47237
|
+
* material: new PhongMaterial(viewer.scene, {
|
|
47238
|
+
* emissive: [0, 1,]
|
|
47239
|
+
* })
|
|
47240
|
+
* });
|
|
47241
|
+
* ````
|
|
47242
|
+
*
|
|
47243
|
+
* @function buildBoxLinesGeometryFromAABB
|
|
47244
|
+
* @param {*} [cfg] Configs
|
|
47245
|
+
* @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene}, generated automatically when omitted.
|
|
47246
|
+
* @param {Number[]} [cfg.aabb] AABB for which box will be created.
|
|
47247
|
+
* @returns {Object} Configuration for a {@link Geometry} subtype.
|
|
47248
|
+
*/
|
|
47249
|
+
function buildBoxLinesGeometryFromAABB(cfg = {}){
|
|
47250
|
+
return buildBoxLinesGeometry({
|
|
47251
|
+
id: cfg.id,
|
|
47252
|
+
center: [
|
|
47253
|
+
(cfg.aabb[0] + cfg.aabb[3]) / 2.0,
|
|
47254
|
+
(cfg.aabb[1] + cfg.aabb[4]) / 2.0,
|
|
47255
|
+
(cfg.aabb[2] + cfg.aabb[5]) / 2.0,
|
|
47256
|
+
],
|
|
47257
|
+
xSize: (Math.abs(cfg.aabb[3] - cfg.aabb[0])) / 2.0,
|
|
47258
|
+
ySize: (Math.abs(cfg.aabb[4] - cfg.aabb[1])) / 2.0,
|
|
47259
|
+
zSize: (Math.abs(cfg.aabb[5] - cfg.aabb[2])) / 2.0,
|
|
47260
|
+
});
|
|
47261
|
+
}
|
|
47262
|
+
|
|
47131
47263
|
/**
|
|
47132
47264
|
* @desc Creates a grid-shaped {@link Geometry}.
|
|
47133
47265
|
*
|
|
@@ -84587,6 +84719,7 @@ class DistanceMeasurement extends Component {
|
|
|
84587
84719
|
this._zAxisVisible = false;
|
|
84588
84720
|
this._axisEnabled = true;
|
|
84589
84721
|
this._labelsVisible = false;
|
|
84722
|
+
this._labelsOnWires = false;
|
|
84590
84723
|
this._clickable = false;
|
|
84591
84724
|
|
|
84592
84725
|
this._originMarker.on("worldPos", (value) => {
|
|
@@ -84646,6 +84779,7 @@ class DistanceMeasurement extends Component {
|
|
|
84646
84779
|
this.yAxisVisible = cfg.yAxisVisible;
|
|
84647
84780
|
this.zAxisVisible = cfg.zAxisVisible;
|
|
84648
84781
|
this.labelsVisible = cfg.labelsVisible;
|
|
84782
|
+
this.labelsOnWires = cfg.labelsOnWires;
|
|
84649
84783
|
}
|
|
84650
84784
|
|
|
84651
84785
|
_update() {
|
|
@@ -84797,9 +84931,19 @@ class DistanceMeasurement extends Component {
|
|
|
84797
84931
|
|
|
84798
84932
|
this._lengthLabel.setPosOnWire(cp[0], cp[1], cp[6], cp[7]);
|
|
84799
84933
|
|
|
84800
|
-
this.
|
|
84801
|
-
|
|
84802
|
-
|
|
84934
|
+
if (this.labelsOnWires) {
|
|
84935
|
+
this._xAxisLabel.setPosOnWire(cp[0], cp[1], cp[2], cp[3]);
|
|
84936
|
+
this._yAxisLabel.setPosOnWire(cp[2], cp[3], cp[4], cp[5]);
|
|
84937
|
+
this._zAxisLabel.setPosOnWire(cp[4], cp[5], cp[6], cp[7]);
|
|
84938
|
+
} else {
|
|
84939
|
+
const labelOffset = 35;
|
|
84940
|
+
let currentLabelOffset = labelOffset;
|
|
84941
|
+
this._xAxisLabel.setPosOnWire(cp[0], cp[1] + currentLabelOffset, cp[6], cp[7] + currentLabelOffset);
|
|
84942
|
+
currentLabelOffset += labelOffset;
|
|
84943
|
+
this._yAxisLabel.setPosOnWire(cp[0], cp[1] + currentLabelOffset, cp[6], cp[7] + currentLabelOffset);
|
|
84944
|
+
currentLabelOffset += labelOffset;
|
|
84945
|
+
this._zAxisLabel.setPosOnWire(cp[0], cp[1] + currentLabelOffset, cp[6], cp[7] + currentLabelOffset);
|
|
84946
|
+
}
|
|
84803
84947
|
|
|
84804
84948
|
const tilde = this._approximate ? " ~ " : " = ";
|
|
84805
84949
|
|
|
@@ -84812,9 +84956,15 @@ class DistanceMeasurement extends Component {
|
|
|
84812
84956
|
|
|
84813
84957
|
const labelMinAxisLength = this.plugin.labelMinAxisLength;
|
|
84814
84958
|
|
|
84815
|
-
this.
|
|
84816
|
-
|
|
84817
|
-
|
|
84959
|
+
if (this.labelsOnWires){
|
|
84960
|
+
this._xAxisLabelCulled = (xAxisCanvasLength < labelMinAxisLength);
|
|
84961
|
+
this._yAxisLabelCulled = (yAxisCanvasLength < labelMinAxisLength);
|
|
84962
|
+
this._zAxisLabelCulled = (zAxisCanvasLength < labelMinAxisLength);
|
|
84963
|
+
} else {
|
|
84964
|
+
this._xAxisLabelCulled = false;
|
|
84965
|
+
this._yAxisLabelCulled = false;
|
|
84966
|
+
this._zAxisLabelCulled = false;
|
|
84967
|
+
}
|
|
84818
84968
|
|
|
84819
84969
|
if (!this._xAxisLabelCulled) {
|
|
84820
84970
|
this._xAxisLabel.setText(tilde + Math.abs((this._targetWorld[0] - this._originWorld[0]) * scale).toFixed(2) + unitAbbrev);
|
|
@@ -85215,6 +85365,25 @@ class DistanceMeasurement extends Component {
|
|
|
85215
85365
|
return this._labelsVisible;
|
|
85216
85366
|
}
|
|
85217
85367
|
|
|
85368
|
+
/**
|
|
85369
|
+
* Sets if labels should be positioned on the wires.
|
|
85370
|
+
*
|
|
85371
|
+
* @type {Boolean}
|
|
85372
|
+
*/
|
|
85373
|
+
set labelsOnWires(value) {
|
|
85374
|
+
value = value !== undefined ? Boolean(value) : this.plugin.defaultLabelsOnWires;
|
|
85375
|
+
this._labelsOnWires = value;
|
|
85376
|
+
}
|
|
85377
|
+
|
|
85378
|
+
/**
|
|
85379
|
+
* Gets if labels should be positioned on the wires.
|
|
85380
|
+
*
|
|
85381
|
+
* @type {Boolean}
|
|
85382
|
+
*/
|
|
85383
|
+
get labelsOnWires() {
|
|
85384
|
+
return this._labelsOnWires;
|
|
85385
|
+
}
|
|
85386
|
+
|
|
85218
85387
|
/**
|
|
85219
85388
|
* Sets if this DistanceMeasurement appears highlighted.
|
|
85220
85389
|
* @param highlighted
|
|
@@ -86025,6 +86194,7 @@ class DistanceMeasurementsPlugin extends Plugin {
|
|
|
86025
86194
|
* @param {boolean} [cfg.defaultZAxisVisible=true] The default value of the DistanceMeasurements `zAxisVisible` property.
|
|
86026
86195
|
* @param {string} [cfg.defaultColor=#00BBFF] The default color of the length dots, wire and label.
|
|
86027
86196
|
* @param {number} [cfg.zIndex] If set, the wires, dots and labels will have this zIndex (+1 for dots and +2 for labels).
|
|
86197
|
+
* @param {boolean} [cfg.defaultLabelsOnWires=true] The default value of the DistanceMeasurements `labelsOnWires` property.
|
|
86028
86198
|
* @param {PointerCircle} [cfg.pointerLens] A PointerLens to help the user position the pointer. This can be shared with other plugins.
|
|
86029
86199
|
*/
|
|
86030
86200
|
constructor(viewer, cfg = {}) {
|
|
@@ -86052,6 +86222,7 @@ class DistanceMeasurementsPlugin extends Plugin {
|
|
|
86052
86222
|
this.defaultZAxisVisible = cfg.defaultZAxisVisible !== false;
|
|
86053
86223
|
this.defaultColor = cfg.defaultColor !== undefined ? cfg.defaultColor : "#00BBFF";
|
|
86054
86224
|
this.zIndex = cfg.zIndex || 10000;
|
|
86225
|
+
this.defaultLabelsOnWires = cfg.defaultLabelsOnWires !== false;
|
|
86055
86226
|
|
|
86056
86227
|
this._onMouseOver = (event, measurement) => {
|
|
86057
86228
|
this.fire("mouseOver", {
|
|
@@ -86174,6 +86345,7 @@ class DistanceMeasurementsPlugin extends Plugin {
|
|
|
86174
86345
|
* @param {Boolean} [params.zAxisVisible=true] Whether to initially show the Z-axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target}.
|
|
86175
86346
|
* @param {Boolean} [params.labelsVisible=true] Whether to initially show the labels.
|
|
86176
86347
|
* @param {string} [params.color] The color of the length dot, wire and label.
|
|
86348
|
+
* @param {Boolean} [params.labelsOnWires=true] Determines if labels will be set on wires or one below the other.
|
|
86177
86349
|
* @returns {DistanceMeasurement} The new {@link DistanceMeasurement}.
|
|
86178
86350
|
*/
|
|
86179
86351
|
createMeasurement(params = {}) {
|
|
@@ -86205,6 +86377,7 @@ class DistanceMeasurementsPlugin extends Plugin {
|
|
|
86205
86377
|
originVisible: params.originVisible,
|
|
86206
86378
|
targetVisible: params.targetVisible,
|
|
86207
86379
|
color: params.color,
|
|
86380
|
+
labelsOnWires: params.labelsOnWires !== false && this.defaultLabelsOnWires !== false,
|
|
86208
86381
|
onMouseOver: this._onMouseOver,
|
|
86209
86382
|
onMouseLeave: this._onMouseLeave,
|
|
86210
86383
|
onContextMenu: this._onContextMenu
|
|
@@ -195813,4 +195986,4 @@ class CityJSONLoaderPlugin extends Plugin {
|
|
|
195813
195986
|
}
|
|
195814
195987
|
}
|
|
195815
195988
|
|
|
195816
|
-
export { AlphaFormat, AmbientLight, AngleMeasurementsControl, AngleMeasurementsMouseControl, AngleMeasurementsPlugin, AnnotationsPlugin, AxisGizmoPlugin, BCFViewpointsPlugin, Bitmap, ByteType, CameraMemento, CameraPath, CameraPathAnimation, CityJSONLoaderPlugin, ClampToEdgeWrapping, Component, CompressedMediaType, Configs, ContextMenu, CubicBezierCurve, Curve, DefaultLoadingManager, DepthFormat, DepthStencilFormat, DirLight, DistanceMeasurementsControl, DistanceMeasurementsMouseControl, DistanceMeasurementsPlugin, EdgeMaterial, EmphasisMaterial, FaceAlignedSectionPlanesPlugin, FastNavPlugin, FloatType, Fresnel, Frustum$1 as Frustum, FrustumPlane, GIFMediaType, GLTFDefaultDataSource, GLTFLoaderPlugin, HalfFloatType, ImagePlane, IntType, JPEGMediaType, KTX2TextureTranscoder, LASLoaderPlugin, LambertMaterial, LightMap, LineSet, LinearEncoding, LinearFilter, LinearMipMapLinearFilter, LinearMipMapNearestFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, Loader, LoadingManager, LocaleService, LuminanceAlphaFormat, LuminanceFormat, Map$1 as Map, Marker, MarqueePicker, MarqueePickerMouseControl, Mesh, MetallicMaterial, MirroredRepeatWrapping, ModelMemento, NavCubePlugin, NearestFilter, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, Node$2 as Node, OBJLoaderPlugin, ObjectsKdTree3, ObjectsMemento, PNGMediaType, Path, PerformanceModel, PhongMaterial, Plugin, PointLight, PointerLens, QuadraticBezierCurve, Queue, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGBFormat, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGFormat, RGIntegerFormat, ReadableGeometry, RedFormat, RedIntegerFormat, ReflectionMap, RepeatWrapping, STLDefaultDataSource, STLLoaderPlugin, SceneModel, SceneModelMesh, SceneModelTransform, SectionPlane, SectionPlanesPlugin, ShortType, Skybox, SkyboxesPlugin, SpecularMaterial, SplineCurve, SpriteMarker, StoreyViewsPlugin, Texture, TextureTranscoder, TreeViewPlugin, UnsignedByteType, UnsignedInt248Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, VBOGeometry, ViewCullPlugin, Viewer, WebIFCLoaderPlugin, WorkerPool$1 as WorkerPool, XKTDefaultDataSource, XKTLoaderPlugin, XML3DLoaderPlugin, buildBoxGeometry, buildBoxLinesGeometry, buildCylinderGeometry, buildGridGeometry, buildPlaneGeometry, buildSphereGeometry, buildTorusGeometry, buildVectorTextGeometry, createRTCViewMat, frustumIntersectsAABB3, getKTX2TextureTranscoder, getPlaneRTCPos, load3DSGeometry, loadOBJGeometry, math, rtcToWorldPos, sRGBEncoding, setFrustum, stats, utils, worldToRTCPos, worldToRTCPositions };
|
|
195989
|
+
export { AlphaFormat, AmbientLight, AngleMeasurementsControl, AngleMeasurementsMouseControl, AngleMeasurementsPlugin, AnnotationsPlugin, AxisGizmoPlugin, BCFViewpointsPlugin, Bitmap, ByteType, CameraMemento, CameraPath, CameraPathAnimation, CityJSONLoaderPlugin, ClampToEdgeWrapping, Component, CompressedMediaType, Configs, ContextMenu, CubicBezierCurve, Curve, DefaultLoadingManager, DepthFormat, DepthStencilFormat, DirLight, DistanceMeasurementsControl, DistanceMeasurementsMouseControl, DistanceMeasurementsPlugin, EdgeMaterial, EmphasisMaterial, FaceAlignedSectionPlanesPlugin, FastNavPlugin, FloatType, Fresnel, Frustum$1 as Frustum, FrustumPlane, GIFMediaType, GLTFDefaultDataSource, GLTFLoaderPlugin, HalfFloatType, ImagePlane, IntType, JPEGMediaType, KTX2TextureTranscoder, LASLoaderPlugin, LambertMaterial, LightMap, LineSet, LinearEncoding, LinearFilter, LinearMipMapLinearFilter, LinearMipMapNearestFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, Loader, LoadingManager, LocaleService, LuminanceAlphaFormat, LuminanceFormat, Map$1 as Map, Marker, MarqueePicker, MarqueePickerMouseControl, Mesh, MetallicMaterial, MirroredRepeatWrapping, ModelMemento, NavCubePlugin, NearestFilter, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, Node$2 as Node, OBJLoaderPlugin, ObjectsKdTree3, ObjectsMemento, PNGMediaType, Path, PerformanceModel, PhongMaterial, Plugin, PointLight, PointerLens, QuadraticBezierCurve, Queue, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGBFormat, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGFormat, RGIntegerFormat, ReadableGeometry, RedFormat, RedIntegerFormat, ReflectionMap, RepeatWrapping, STLDefaultDataSource, STLLoaderPlugin, SceneModel, SceneModelMesh, SceneModelTransform, SectionPlane, SectionPlanesPlugin, ShortType, Skybox, SkyboxesPlugin, SpecularMaterial, SplineCurve, SpriteMarker, StoreyViewsPlugin, Texture, TextureTranscoder, TreeViewPlugin, UnsignedByteType, UnsignedInt248Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, VBOGeometry, ViewCullPlugin, Viewer, WebIFCLoaderPlugin, WorkerPool$1 as WorkerPool, XKTDefaultDataSource, XKTLoaderPlugin, XML3DLoaderPlugin, buildBoxGeometry, buildBoxLinesGeometry, buildBoxLinesGeometryFromAABB, buildCylinderGeometry, buildGridGeometry, buildPlaneGeometry, buildSphereGeometry, buildTorusGeometry, buildVectorTextGeometry, createRTCViewMat, frustumIntersectsAABB3, getKTX2TextureTranscoder, getPlaneRTCPos, load3DSGeometry, loadOBJGeometry, math, rtcToWorldPos, sRGBEncoding, setFrustum, stats, utils, worldToRTCPos, worldToRTCPositions };
|