@xeokit/xeokit-sdk 2.5.2-beta-20 → 2.5.2-beta-22
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 +184 -8
- package/dist/xeokit-sdk.es.js +184 -9
- package/dist/xeokit-sdk.es5.js +135 -8
- 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/src/viewer/scene/model/SceneModel.js +4 -2
- 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
|
*
|
|
@@ -82018,7 +82150,8 @@ class SceneModel extends Component {
|
|
|
82018
82150
|
|
|
82019
82151
|
const useDTX = (!!this._dtxEnabled && (cfg.primitive === "triangles"
|
|
82020
82152
|
|| cfg.primitive === "solid"
|
|
82021
|
-
|| cfg.primitive === "surface"))
|
|
82153
|
+
|| cfg.primitive === "surface"))
|
|
82154
|
+
&& (!cfg.textureSetId);
|
|
82022
82155
|
|
|
82023
82156
|
cfg.origin = cfg.origin ? math.addVec3(this._origin, cfg.origin, math.vec3()) : this._origin;
|
|
82024
82157
|
|
|
@@ -82236,7 +82369,8 @@ class SceneModel extends Component {
|
|
|
82236
82369
|
const useDTX = (!!this._dtxEnabled
|
|
82237
82370
|
&& (cfg.geometry.primitive === "triangles"
|
|
82238
82371
|
|| cfg.geometry.primitive === "solid"
|
|
82239
|
-
|| cfg.geometry.primitive === "surface"))
|
|
82372
|
+
|| cfg.geometry.primitive === "surface"))
|
|
82373
|
+
&& (!cfg.textureSetId);
|
|
82240
82374
|
|
|
82241
82375
|
if (useDTX) {
|
|
82242
82376
|
|
|
@@ -84591,6 +84725,7 @@ class DistanceMeasurement extends Component {
|
|
|
84591
84725
|
this._zAxisVisible = false;
|
|
84592
84726
|
this._axisEnabled = true;
|
|
84593
84727
|
this._labelsVisible = false;
|
|
84728
|
+
this._labelsOnWires = false;
|
|
84594
84729
|
this._clickable = false;
|
|
84595
84730
|
|
|
84596
84731
|
this._originMarker.on("worldPos", (value) => {
|
|
@@ -84650,6 +84785,7 @@ class DistanceMeasurement extends Component {
|
|
|
84650
84785
|
this.yAxisVisible = cfg.yAxisVisible;
|
|
84651
84786
|
this.zAxisVisible = cfg.zAxisVisible;
|
|
84652
84787
|
this.labelsVisible = cfg.labelsVisible;
|
|
84788
|
+
this.labelsOnWires = cfg.labelsOnWires;
|
|
84653
84789
|
}
|
|
84654
84790
|
|
|
84655
84791
|
_update() {
|
|
@@ -84801,9 +84937,19 @@ class DistanceMeasurement extends Component {
|
|
|
84801
84937
|
|
|
84802
84938
|
this._lengthLabel.setPosOnWire(cp[0], cp[1], cp[6], cp[7]);
|
|
84803
84939
|
|
|
84804
|
-
this.
|
|
84805
|
-
|
|
84806
|
-
|
|
84940
|
+
if (this.labelsOnWires) {
|
|
84941
|
+
this._xAxisLabel.setPosOnWire(cp[0], cp[1], cp[2], cp[3]);
|
|
84942
|
+
this._yAxisLabel.setPosOnWire(cp[2], cp[3], cp[4], cp[5]);
|
|
84943
|
+
this._zAxisLabel.setPosOnWire(cp[4], cp[5], cp[6], cp[7]);
|
|
84944
|
+
} else {
|
|
84945
|
+
const labelOffset = 35;
|
|
84946
|
+
let currentLabelOffset = labelOffset;
|
|
84947
|
+
this._xAxisLabel.setPosOnWire(cp[0], cp[1] + currentLabelOffset, cp[6], cp[7] + currentLabelOffset);
|
|
84948
|
+
currentLabelOffset += labelOffset;
|
|
84949
|
+
this._yAxisLabel.setPosOnWire(cp[0], cp[1] + currentLabelOffset, cp[6], cp[7] + currentLabelOffset);
|
|
84950
|
+
currentLabelOffset += labelOffset;
|
|
84951
|
+
this._zAxisLabel.setPosOnWire(cp[0], cp[1] + currentLabelOffset, cp[6], cp[7] + currentLabelOffset);
|
|
84952
|
+
}
|
|
84807
84953
|
|
|
84808
84954
|
const tilde = this._approximate ? " ~ " : " = ";
|
|
84809
84955
|
|
|
@@ -84816,9 +84962,15 @@ class DistanceMeasurement extends Component {
|
|
|
84816
84962
|
|
|
84817
84963
|
const labelMinAxisLength = this.plugin.labelMinAxisLength;
|
|
84818
84964
|
|
|
84819
|
-
this.
|
|
84820
|
-
|
|
84821
|
-
|
|
84965
|
+
if (this.labelsOnWires){
|
|
84966
|
+
this._xAxisLabelCulled = (xAxisCanvasLength < labelMinAxisLength);
|
|
84967
|
+
this._yAxisLabelCulled = (yAxisCanvasLength < labelMinAxisLength);
|
|
84968
|
+
this._zAxisLabelCulled = (zAxisCanvasLength < labelMinAxisLength);
|
|
84969
|
+
} else {
|
|
84970
|
+
this._xAxisLabelCulled = false;
|
|
84971
|
+
this._yAxisLabelCulled = false;
|
|
84972
|
+
this._zAxisLabelCulled = false;
|
|
84973
|
+
}
|
|
84822
84974
|
|
|
84823
84975
|
if (!this._xAxisLabelCulled) {
|
|
84824
84976
|
this._xAxisLabel.setText(tilde + Math.abs((this._targetWorld[0] - this._originWorld[0]) * scale).toFixed(2) + unitAbbrev);
|
|
@@ -85219,6 +85371,25 @@ class DistanceMeasurement extends Component {
|
|
|
85219
85371
|
return this._labelsVisible;
|
|
85220
85372
|
}
|
|
85221
85373
|
|
|
85374
|
+
/**
|
|
85375
|
+
* Sets if labels should be positioned on the wires.
|
|
85376
|
+
*
|
|
85377
|
+
* @type {Boolean}
|
|
85378
|
+
*/
|
|
85379
|
+
set labelsOnWires(value) {
|
|
85380
|
+
value = value !== undefined ? Boolean(value) : this.plugin.defaultLabelsOnWires;
|
|
85381
|
+
this._labelsOnWires = value;
|
|
85382
|
+
}
|
|
85383
|
+
|
|
85384
|
+
/**
|
|
85385
|
+
* Gets if labels should be positioned on the wires.
|
|
85386
|
+
*
|
|
85387
|
+
* @type {Boolean}
|
|
85388
|
+
*/
|
|
85389
|
+
get labelsOnWires() {
|
|
85390
|
+
return this._labelsOnWires;
|
|
85391
|
+
}
|
|
85392
|
+
|
|
85222
85393
|
/**
|
|
85223
85394
|
* Sets if this DistanceMeasurement appears highlighted.
|
|
85224
85395
|
* @param highlighted
|
|
@@ -86029,6 +86200,7 @@ class DistanceMeasurementsPlugin extends Plugin {
|
|
|
86029
86200
|
* @param {boolean} [cfg.defaultZAxisVisible=true] The default value of the DistanceMeasurements `zAxisVisible` property.
|
|
86030
86201
|
* @param {string} [cfg.defaultColor=#00BBFF] The default color of the length dots, wire and label.
|
|
86031
86202
|
* @param {number} [cfg.zIndex] If set, the wires, dots and labels will have this zIndex (+1 for dots and +2 for labels).
|
|
86203
|
+
* @param {boolean} [cfg.defaultLabelsOnWires=true] The default value of the DistanceMeasurements `labelsOnWires` property.
|
|
86032
86204
|
* @param {PointerCircle} [cfg.pointerLens] A PointerLens to help the user position the pointer. This can be shared with other plugins.
|
|
86033
86205
|
*/
|
|
86034
86206
|
constructor(viewer, cfg = {}) {
|
|
@@ -86056,6 +86228,7 @@ class DistanceMeasurementsPlugin extends Plugin {
|
|
|
86056
86228
|
this.defaultZAxisVisible = cfg.defaultZAxisVisible !== false;
|
|
86057
86229
|
this.defaultColor = cfg.defaultColor !== undefined ? cfg.defaultColor : "#00BBFF";
|
|
86058
86230
|
this.zIndex = cfg.zIndex || 10000;
|
|
86231
|
+
this.defaultLabelsOnWires = cfg.defaultLabelsOnWires !== false;
|
|
86059
86232
|
|
|
86060
86233
|
this._onMouseOver = (event, measurement) => {
|
|
86061
86234
|
this.fire("mouseOver", {
|
|
@@ -86178,6 +86351,7 @@ class DistanceMeasurementsPlugin extends Plugin {
|
|
|
86178
86351
|
* @param {Boolean} [params.zAxisVisible=true] Whether to initially show the Z-axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target}.
|
|
86179
86352
|
* @param {Boolean} [params.labelsVisible=true] Whether to initially show the labels.
|
|
86180
86353
|
* @param {string} [params.color] The color of the length dot, wire and label.
|
|
86354
|
+
* @param {Boolean} [params.labelsOnWires=true] Determines if labels will be set on wires or one below the other.
|
|
86181
86355
|
* @returns {DistanceMeasurement} The new {@link DistanceMeasurement}.
|
|
86182
86356
|
*/
|
|
86183
86357
|
createMeasurement(params = {}) {
|
|
@@ -86209,6 +86383,7 @@ class DistanceMeasurementsPlugin extends Plugin {
|
|
|
86209
86383
|
originVisible: params.originVisible,
|
|
86210
86384
|
targetVisible: params.targetVisible,
|
|
86211
86385
|
color: params.color,
|
|
86386
|
+
labelsOnWires: params.labelsOnWires !== false && this.defaultLabelsOnWires !== false,
|
|
86212
86387
|
onMouseOver: this._onMouseOver,
|
|
86213
86388
|
onMouseLeave: this._onMouseLeave,
|
|
86214
86389
|
onContextMenu: this._onContextMenu
|
|
@@ -195972,6 +196147,7 @@ exports.XKTLoaderPlugin = XKTLoaderPlugin;
|
|
|
195972
196147
|
exports.XML3DLoaderPlugin = XML3DLoaderPlugin;
|
|
195973
196148
|
exports.buildBoxGeometry = buildBoxGeometry;
|
|
195974
196149
|
exports.buildBoxLinesGeometry = buildBoxLinesGeometry;
|
|
196150
|
+
exports.buildBoxLinesGeometryFromAABB = buildBoxLinesGeometryFromAABB;
|
|
195975
196151
|
exports.buildCylinderGeometry = buildCylinderGeometry;
|
|
195976
196152
|
exports.buildGridGeometry = buildGridGeometry;
|
|
195977
196153
|
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
|
*
|
|
@@ -82014,7 +82146,8 @@ class SceneModel extends Component {
|
|
|
82014
82146
|
|
|
82015
82147
|
const useDTX = (!!this._dtxEnabled && (cfg.primitive === "triangles"
|
|
82016
82148
|
|| cfg.primitive === "solid"
|
|
82017
|
-
|| cfg.primitive === "surface"))
|
|
82149
|
+
|| cfg.primitive === "surface"))
|
|
82150
|
+
&& (!cfg.textureSetId);
|
|
82018
82151
|
|
|
82019
82152
|
cfg.origin = cfg.origin ? math.addVec3(this._origin, cfg.origin, math.vec3()) : this._origin;
|
|
82020
82153
|
|
|
@@ -82232,7 +82365,8 @@ class SceneModel extends Component {
|
|
|
82232
82365
|
const useDTX = (!!this._dtxEnabled
|
|
82233
82366
|
&& (cfg.geometry.primitive === "triangles"
|
|
82234
82367
|
|| cfg.geometry.primitive === "solid"
|
|
82235
|
-
|| cfg.geometry.primitive === "surface"))
|
|
82368
|
+
|| cfg.geometry.primitive === "surface"))
|
|
82369
|
+
&& (!cfg.textureSetId);
|
|
82236
82370
|
|
|
82237
82371
|
if (useDTX) {
|
|
82238
82372
|
|
|
@@ -84587,6 +84721,7 @@ class DistanceMeasurement extends Component {
|
|
|
84587
84721
|
this._zAxisVisible = false;
|
|
84588
84722
|
this._axisEnabled = true;
|
|
84589
84723
|
this._labelsVisible = false;
|
|
84724
|
+
this._labelsOnWires = false;
|
|
84590
84725
|
this._clickable = false;
|
|
84591
84726
|
|
|
84592
84727
|
this._originMarker.on("worldPos", (value) => {
|
|
@@ -84646,6 +84781,7 @@ class DistanceMeasurement extends Component {
|
|
|
84646
84781
|
this.yAxisVisible = cfg.yAxisVisible;
|
|
84647
84782
|
this.zAxisVisible = cfg.zAxisVisible;
|
|
84648
84783
|
this.labelsVisible = cfg.labelsVisible;
|
|
84784
|
+
this.labelsOnWires = cfg.labelsOnWires;
|
|
84649
84785
|
}
|
|
84650
84786
|
|
|
84651
84787
|
_update() {
|
|
@@ -84797,9 +84933,19 @@ class DistanceMeasurement extends Component {
|
|
|
84797
84933
|
|
|
84798
84934
|
this._lengthLabel.setPosOnWire(cp[0], cp[1], cp[6], cp[7]);
|
|
84799
84935
|
|
|
84800
|
-
this.
|
|
84801
|
-
|
|
84802
|
-
|
|
84936
|
+
if (this.labelsOnWires) {
|
|
84937
|
+
this._xAxisLabel.setPosOnWire(cp[0], cp[1], cp[2], cp[3]);
|
|
84938
|
+
this._yAxisLabel.setPosOnWire(cp[2], cp[3], cp[4], cp[5]);
|
|
84939
|
+
this._zAxisLabel.setPosOnWire(cp[4], cp[5], cp[6], cp[7]);
|
|
84940
|
+
} else {
|
|
84941
|
+
const labelOffset = 35;
|
|
84942
|
+
let currentLabelOffset = labelOffset;
|
|
84943
|
+
this._xAxisLabel.setPosOnWire(cp[0], cp[1] + currentLabelOffset, cp[6], cp[7] + currentLabelOffset);
|
|
84944
|
+
currentLabelOffset += labelOffset;
|
|
84945
|
+
this._yAxisLabel.setPosOnWire(cp[0], cp[1] + currentLabelOffset, cp[6], cp[7] + currentLabelOffset);
|
|
84946
|
+
currentLabelOffset += labelOffset;
|
|
84947
|
+
this._zAxisLabel.setPosOnWire(cp[0], cp[1] + currentLabelOffset, cp[6], cp[7] + currentLabelOffset);
|
|
84948
|
+
}
|
|
84803
84949
|
|
|
84804
84950
|
const tilde = this._approximate ? " ~ " : " = ";
|
|
84805
84951
|
|
|
@@ -84812,9 +84958,15 @@ class DistanceMeasurement extends Component {
|
|
|
84812
84958
|
|
|
84813
84959
|
const labelMinAxisLength = this.plugin.labelMinAxisLength;
|
|
84814
84960
|
|
|
84815
|
-
this.
|
|
84816
|
-
|
|
84817
|
-
|
|
84961
|
+
if (this.labelsOnWires){
|
|
84962
|
+
this._xAxisLabelCulled = (xAxisCanvasLength < labelMinAxisLength);
|
|
84963
|
+
this._yAxisLabelCulled = (yAxisCanvasLength < labelMinAxisLength);
|
|
84964
|
+
this._zAxisLabelCulled = (zAxisCanvasLength < labelMinAxisLength);
|
|
84965
|
+
} else {
|
|
84966
|
+
this._xAxisLabelCulled = false;
|
|
84967
|
+
this._yAxisLabelCulled = false;
|
|
84968
|
+
this._zAxisLabelCulled = false;
|
|
84969
|
+
}
|
|
84818
84970
|
|
|
84819
84971
|
if (!this._xAxisLabelCulled) {
|
|
84820
84972
|
this._xAxisLabel.setText(tilde + Math.abs((this._targetWorld[0] - this._originWorld[0]) * scale).toFixed(2) + unitAbbrev);
|
|
@@ -85215,6 +85367,25 @@ class DistanceMeasurement extends Component {
|
|
|
85215
85367
|
return this._labelsVisible;
|
|
85216
85368
|
}
|
|
85217
85369
|
|
|
85370
|
+
/**
|
|
85371
|
+
* Sets if labels should be positioned on the wires.
|
|
85372
|
+
*
|
|
85373
|
+
* @type {Boolean}
|
|
85374
|
+
*/
|
|
85375
|
+
set labelsOnWires(value) {
|
|
85376
|
+
value = value !== undefined ? Boolean(value) : this.plugin.defaultLabelsOnWires;
|
|
85377
|
+
this._labelsOnWires = value;
|
|
85378
|
+
}
|
|
85379
|
+
|
|
85380
|
+
/**
|
|
85381
|
+
* Gets if labels should be positioned on the wires.
|
|
85382
|
+
*
|
|
85383
|
+
* @type {Boolean}
|
|
85384
|
+
*/
|
|
85385
|
+
get labelsOnWires() {
|
|
85386
|
+
return this._labelsOnWires;
|
|
85387
|
+
}
|
|
85388
|
+
|
|
85218
85389
|
/**
|
|
85219
85390
|
* Sets if this DistanceMeasurement appears highlighted.
|
|
85220
85391
|
* @param highlighted
|
|
@@ -86025,6 +86196,7 @@ class DistanceMeasurementsPlugin extends Plugin {
|
|
|
86025
86196
|
* @param {boolean} [cfg.defaultZAxisVisible=true] The default value of the DistanceMeasurements `zAxisVisible` property.
|
|
86026
86197
|
* @param {string} [cfg.defaultColor=#00BBFF] The default color of the length dots, wire and label.
|
|
86027
86198
|
* @param {number} [cfg.zIndex] If set, the wires, dots and labels will have this zIndex (+1 for dots and +2 for labels).
|
|
86199
|
+
* @param {boolean} [cfg.defaultLabelsOnWires=true] The default value of the DistanceMeasurements `labelsOnWires` property.
|
|
86028
86200
|
* @param {PointerCircle} [cfg.pointerLens] A PointerLens to help the user position the pointer. This can be shared with other plugins.
|
|
86029
86201
|
*/
|
|
86030
86202
|
constructor(viewer, cfg = {}) {
|
|
@@ -86052,6 +86224,7 @@ class DistanceMeasurementsPlugin extends Plugin {
|
|
|
86052
86224
|
this.defaultZAxisVisible = cfg.defaultZAxisVisible !== false;
|
|
86053
86225
|
this.defaultColor = cfg.defaultColor !== undefined ? cfg.defaultColor : "#00BBFF";
|
|
86054
86226
|
this.zIndex = cfg.zIndex || 10000;
|
|
86227
|
+
this.defaultLabelsOnWires = cfg.defaultLabelsOnWires !== false;
|
|
86055
86228
|
|
|
86056
86229
|
this._onMouseOver = (event, measurement) => {
|
|
86057
86230
|
this.fire("mouseOver", {
|
|
@@ -86174,6 +86347,7 @@ class DistanceMeasurementsPlugin extends Plugin {
|
|
|
86174
86347
|
* @param {Boolean} [params.zAxisVisible=true] Whether to initially show the Z-axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target}.
|
|
86175
86348
|
* @param {Boolean} [params.labelsVisible=true] Whether to initially show the labels.
|
|
86176
86349
|
* @param {string} [params.color] The color of the length dot, wire and label.
|
|
86350
|
+
* @param {Boolean} [params.labelsOnWires=true] Determines if labels will be set on wires or one below the other.
|
|
86177
86351
|
* @returns {DistanceMeasurement} The new {@link DistanceMeasurement}.
|
|
86178
86352
|
*/
|
|
86179
86353
|
createMeasurement(params = {}) {
|
|
@@ -86205,6 +86379,7 @@ class DistanceMeasurementsPlugin extends Plugin {
|
|
|
86205
86379
|
originVisible: params.originVisible,
|
|
86206
86380
|
targetVisible: params.targetVisible,
|
|
86207
86381
|
color: params.color,
|
|
86382
|
+
labelsOnWires: params.labelsOnWires !== false && this.defaultLabelsOnWires !== false,
|
|
86208
86383
|
onMouseOver: this._onMouseOver,
|
|
86209
86384
|
onMouseLeave: this._onMouseLeave,
|
|
86210
86385
|
onContextMenu: this._onContextMenu
|
|
@@ -195813,4 +195988,4 @@ class CityJSONLoaderPlugin extends Plugin {
|
|
|
195813
195988
|
}
|
|
195814
195989
|
}
|
|
195815
195990
|
|
|
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 };
|
|
195991
|
+
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 };
|