@xeokit/xeokit-sdk 2.5.2-beta-19 → 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.es5.js
CHANGED
|
@@ -13453,6 +13453,123 @@ var positions=K3D.edit.unwrap(m.i_verts,m.c_verts,3);var normals=K3D.edit.unwrap
|
|
|
13453
13453
|
* @param {Number} [cfg.zSize=1.0] Half-size on the Z-axis.
|
|
13454
13454
|
* @returns {Object} Configuration for a {@link Geometry} subtype.
|
|
13455
13455
|
*/function buildBoxLinesGeometry(){var cfg=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var xSize=cfg.xSize||1;if(xSize<0){console.error("negative xSize not allowed - will invert");xSize*=-1;}var ySize=cfg.ySize||1;if(ySize<0){console.error("negative ySize not allowed - will invert");ySize*=-1;}var zSize=cfg.zSize||1;if(zSize<0){console.error("negative zSize not allowed - will invert");zSize*=-1;}var center=cfg.center;var centerX=center?center[0]:0;var centerY=center?center[1]:0;var centerZ=center?center[2]:0;var xmin=-xSize+centerX;var ymin=-ySize+centerY;var zmin=-zSize+centerZ;var xmax=xSize+centerX;var ymax=ySize+centerY;var zmax=zSize+centerZ;return utils.apply(cfg,{primitive:"lines",positions:[xmin,ymin,zmin,xmin,ymin,zmax,xmin,ymax,zmin,xmin,ymax,zmax,xmax,ymin,zmin,xmax,ymin,zmax,xmax,ymax,zmin,xmax,ymax,zmax],indices:[0,1,1,3,3,2,2,0,4,5,5,7,7,6,6,4,0,4,1,5,2,6,3,7]});}/**
|
|
13456
|
+
* @desc Creates a box-shaped lines {@link Geometry} from AABB.
|
|
13457
|
+
*
|
|
13458
|
+
* ## Usage
|
|
13459
|
+
*
|
|
13460
|
+
* In the example below we'll create a {@link Mesh} with a box-shaped {@link ReadableGeometry} that has lines primitives.
|
|
13461
|
+
* This box will be created from AABB of a model.
|
|
13462
|
+
*
|
|
13463
|
+
* [[Run this example](/examples/#geometry_builders_buildBoxLinesGeometryFromAABB)]
|
|
13464
|
+
*
|
|
13465
|
+
* ````javascript
|
|
13466
|
+
* import {Viewer, Mesh, Node, buildBoxGeometry, buildBoxLinesGeometryFromAABB, ReadableGeometry, PhongMaterial} from "../../dist/xeokit-sdk.min.es.js";
|
|
13467
|
+
*
|
|
13468
|
+
* const viewer = new Viewer({
|
|
13469
|
+
* canvasId: "myCanvas"
|
|
13470
|
+
* });
|
|
13471
|
+
*
|
|
13472
|
+
* viewer.scene.camera.eye = [-21.80, 4.01, 6.56];
|
|
13473
|
+
* viewer.scene.camera.look = [0, -5.75, 0];
|
|
13474
|
+
* viewer.scene.camera.up = [0.37, 0.91, -0.11];
|
|
13475
|
+
*
|
|
13476
|
+
* const boxGeometry = new ReadableGeometry(viewer.scene, buildBoxGeometry({
|
|
13477
|
+
* xSize: 1,
|
|
13478
|
+
* ySize: 1,
|
|
13479
|
+
* zSize: 1
|
|
13480
|
+
* }));
|
|
13481
|
+
*
|
|
13482
|
+
* new Node(viewer.scene, {
|
|
13483
|
+
* id: "table",
|
|
13484
|
+
* isModel: true, // <--------------------- Node represents a model
|
|
13485
|
+
* rotation: [0, 50, 0],
|
|
13486
|
+
* position: [0, 0, 0],
|
|
13487
|
+
* scale: [1, 1, 1],
|
|
13488
|
+
*
|
|
13489
|
+
* children: [
|
|
13490
|
+
*
|
|
13491
|
+
* new Mesh(viewer.scene, { // Red table leg
|
|
13492
|
+
* id: "redLeg",
|
|
13493
|
+
* isObject: true, // <---------- Node represents an object
|
|
13494
|
+
* position: [-4, -6, -4],
|
|
13495
|
+
* scale: [1, 3, 1],
|
|
13496
|
+
* rotation: [0, 0, 0],
|
|
13497
|
+
* geometry: boxGeometry,
|
|
13498
|
+
* material: new PhongMaterial(viewer.scene, {
|
|
13499
|
+
* diffuse: [1, 0.3, 0.3]
|
|
13500
|
+
* })
|
|
13501
|
+
* }),
|
|
13502
|
+
*
|
|
13503
|
+
* new Mesh(viewer.scene, { // Green table leg
|
|
13504
|
+
* id: "greenLeg",
|
|
13505
|
+
* isObject: true, // <---------- Node represents an object
|
|
13506
|
+
* position: [4, -6, -4],
|
|
13507
|
+
* scale: [1, 3, 1],
|
|
13508
|
+
* rotation: [0, 0, 0],
|
|
13509
|
+
* geometry: boxGeometry,
|
|
13510
|
+
* material: new PhongMaterial(viewer.scene, {
|
|
13511
|
+
* diffuse: [0.3, 1.0, 0.3]
|
|
13512
|
+
* })
|
|
13513
|
+
* }),
|
|
13514
|
+
*
|
|
13515
|
+
* new Mesh(viewer.scene, {// Blue table leg
|
|
13516
|
+
* id: "blueLeg",
|
|
13517
|
+
* isObject: true, // <---------- Node represents an object
|
|
13518
|
+
* position: [4, -6, 4],
|
|
13519
|
+
* scale: [1, 3, 1],
|
|
13520
|
+
* rotation: [0, 0, 0],
|
|
13521
|
+
* geometry: boxGeometry,
|
|
13522
|
+
* material: new PhongMaterial(viewer.scene, {
|
|
13523
|
+
* diffuse: [0.3, 0.3, 1.0]
|
|
13524
|
+
* })
|
|
13525
|
+
* }),
|
|
13526
|
+
*
|
|
13527
|
+
* new Mesh(viewer.scene, { // Yellow table leg
|
|
13528
|
+
* id: "yellowLeg",
|
|
13529
|
+
* isObject: true, // <---------- Node represents an object
|
|
13530
|
+
* position: [-4, -6, 4],
|
|
13531
|
+
* scale: [1, 3, 1],
|
|
13532
|
+
* rotation: [0, 0, 0],
|
|
13533
|
+
* geometry: boxGeometry,
|
|
13534
|
+
* material: new PhongMaterial(viewer.scene, {
|
|
13535
|
+
* diffuse: [1.0, 1.0, 0.0]
|
|
13536
|
+
* })
|
|
13537
|
+
* }),
|
|
13538
|
+
*
|
|
13539
|
+
* new Mesh(viewer.scene, { // Purple table top
|
|
13540
|
+
* id: "tableTop",
|
|
13541
|
+
* isObject: true, // <---------- Node represents an object
|
|
13542
|
+
* position: [0, -3, 0],
|
|
13543
|
+
* scale: [6, 0.5, 6],
|
|
13544
|
+
* rotation: [0, 0, 0],
|
|
13545
|
+
* geometry: boxGeometry,
|
|
13546
|
+
* material: new PhongMaterial(viewer.scene, {
|
|
13547
|
+
* diffuse: [1.0, 0.3, 1.0]
|
|
13548
|
+
* })
|
|
13549
|
+
* })
|
|
13550
|
+
* ]
|
|
13551
|
+
* });
|
|
13552
|
+
*
|
|
13553
|
+
* let aabb = viewer.scene.aabb;
|
|
13554
|
+
* console.log(aabb);
|
|
13555
|
+
*
|
|
13556
|
+
* new Mesh(viewer.scene, {
|
|
13557
|
+
* geometry: new ReadableGeometry(viewer.scene, buildBoxLinesGeometryFromAABB({
|
|
13558
|
+
* id: "aabb",
|
|
13559
|
+
* aabb: aabb,
|
|
13560
|
+
* })),
|
|
13561
|
+
* material: new PhongMaterial(viewer.scene, {
|
|
13562
|
+
* emissive: [0, 1,]
|
|
13563
|
+
* })
|
|
13564
|
+
* });
|
|
13565
|
+
* ````
|
|
13566
|
+
*
|
|
13567
|
+
* @function buildBoxLinesGeometryFromAABB
|
|
13568
|
+
* @param {*} [cfg] Configs
|
|
13569
|
+
* @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene}, generated automatically when omitted.
|
|
13570
|
+
* @param {Number[]} [cfg.aabb] AABB for which box will be created.
|
|
13571
|
+
* @returns {Object} Configuration for a {@link Geometry} subtype.
|
|
13572
|
+
*/function buildBoxLinesGeometryFromAABB(){var cfg=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return buildBoxLinesGeometry({id:cfg.id,center:[(cfg.aabb[0]+cfg.aabb[3])/2.0,(cfg.aabb[1]+cfg.aabb[4])/2.0,(cfg.aabb[2]+cfg.aabb[5])/2.0],xSize:Math.abs(cfg.aabb[3]-cfg.aabb[0])/2.0,ySize:Math.abs(cfg.aabb[4]-cfg.aabb[1])/2.0,zSize:Math.abs(cfg.aabb[5]-cfg.aabb[2])/2.0});}/**
|
|
13456
13573
|
* @desc Creates a grid-shaped {@link Geometry}.
|
|
13457
13574
|
*
|
|
13458
13575
|
* ## Usage
|
|
@@ -18690,11 +18807,11 @@ origin:eye,direction:look});look=hit?hit.worldPos:math.addVec3(eye,look,tempVec3
|
|
|
18690
18807
|
*/function DistanceMeasurement(plugin){var _this80;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,DistanceMeasurement);_this80=_super115.call(this,plugin.viewer.scene,cfg);/**
|
|
18691
18808
|
* The {@link DistanceMeasurementsPlugin} that owns this DistanceMeasurement.
|
|
18692
18809
|
* @type {DistanceMeasurementsPlugin}
|
|
18693
|
-
*/_this80.plugin=plugin;_this80._container=cfg.container;if(!_this80._container){throw"config missing: container";}_this80._eventSubs={};var scene=_this80.plugin.viewer.scene;_this80._originMarker=new Marker(scene,cfg.origin);_this80._targetMarker=new Marker(scene,cfg.target);_this80._originWorld=math.vec3();_this80._targetWorld=math.vec3();_this80._wp=new Float64Array(24);_this80._vp=new Float64Array(24);_this80._pp=new Float64Array(24);_this80._cp=new Float64Array(8);_this80._xAxisLabelCulled=false;_this80._yAxisLabelCulled=false;_this80._zAxisLabelCulled=false;_this80._color=cfg.color||_this80.plugin.defaultColor;var onMouseOver=cfg.onMouseOver?function(event){cfg.onMouseOver(event,_assertThisInitialized(_this80));_this80.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent('mouseover',event));}:null;var onMouseLeave=cfg.onMouseLeave?function(event){cfg.onMouseLeave(event,_assertThisInitialized(_this80));_this80.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent('mouseleave',event));}:null;var onMouseDown=function onMouseDown(event){_this80.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent('mousedown',event));};var onMouseUp=function onMouseUp(event){_this80.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent('mouseup',event));};var onMouseMove=function onMouseMove(event){_this80.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent('mousemove',event));};var onContextMenu=cfg.onContextMenu?function(event){cfg.onContextMenu(event,_assertThisInitialized(_this80));}:null;var onMouseWheel=function onMouseWheel(event){_this80.plugin.viewer.scene.canvas.canvas.dispatchEvent(new WheelEvent('wheel',event));};_this80._originDot=new Dot(_this80._container,{fillColor:_this80._color,zIndex:plugin.zIndex!==undefined?plugin.zIndex+2:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._targetDot=new Dot(_this80._container,{fillColor:_this80._color,zIndex:plugin.zIndex!==undefined?plugin.zIndex+2:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._lengthWire=new Wire(_this80._container,{color:_this80._color,thickness:2,thicknessClickable:6,zIndex:plugin.zIndex!==undefined?plugin.zIndex+1:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._xAxisWire=new Wire(_this80._container,{color:"#FF0000",thickness:1,thicknessClickable:6,zIndex:plugin.zIndex!==undefined?plugin.zIndex+1:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._yAxisWire=new Wire(_this80._container,{color:"green",thickness:1,thicknessClickable:6,zIndex:plugin.zIndex!==undefined?plugin.zIndex+1:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._zAxisWire=new Wire(_this80._container,{color:"blue",thickness:1,thicknessClickable:6,zIndex:plugin.zIndex!==undefined?plugin.zIndex+1:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._lengthLabel=new Label(_this80._container,{fillColor:_this80._color,prefix:"",text:"",zIndex:plugin.zIndex!==undefined?plugin.zIndex+4:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._xAxisLabel=new Label(_this80._container,{fillColor:"red",prefix:"X",text:"",zIndex:plugin.zIndex!==undefined?plugin.zIndex+3:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._yAxisLabel=new Label(_this80._container,{fillColor:"green",prefix:"Y",text:"",zIndex:plugin.zIndex!==undefined?plugin.zIndex+3:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._zAxisLabel=new Label(_this80._container,{fillColor:"blue",prefix:"Z",text:"",zIndex:plugin.zIndex!==undefined?plugin.zIndex+3:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._wpDirty=false;_this80._vpDirty=false;_this80._cpDirty=false;_this80._sectionPlanesDirty=true;_this80._visible=false;_this80._originVisible=false;_this80._targetVisible=false;_this80._wireVisible=false;_this80._axisVisible=false;_this80._xAxisVisible=false;_this80._yAxisVisible=false;_this80._zAxisVisible=false;_this80._axisEnabled=true;_this80._labelsVisible=false;_this80._clickable=false;_this80._originMarker.on("worldPos",function(value){_this80._originWorld.set(value||[0,0,0]);_this80._wpDirty=true;_this80._needUpdate(0);// No lag
|
|
18810
|
+
*/_this80.plugin=plugin;_this80._container=cfg.container;if(!_this80._container){throw"config missing: container";}_this80._eventSubs={};var scene=_this80.plugin.viewer.scene;_this80._originMarker=new Marker(scene,cfg.origin);_this80._targetMarker=new Marker(scene,cfg.target);_this80._originWorld=math.vec3();_this80._targetWorld=math.vec3();_this80._wp=new Float64Array(24);_this80._vp=new Float64Array(24);_this80._pp=new Float64Array(24);_this80._cp=new Float64Array(8);_this80._xAxisLabelCulled=false;_this80._yAxisLabelCulled=false;_this80._zAxisLabelCulled=false;_this80._color=cfg.color||_this80.plugin.defaultColor;var onMouseOver=cfg.onMouseOver?function(event){cfg.onMouseOver(event,_assertThisInitialized(_this80));_this80.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent('mouseover',event));}:null;var onMouseLeave=cfg.onMouseLeave?function(event){cfg.onMouseLeave(event,_assertThisInitialized(_this80));_this80.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent('mouseleave',event));}:null;var onMouseDown=function onMouseDown(event){_this80.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent('mousedown',event));};var onMouseUp=function onMouseUp(event){_this80.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent('mouseup',event));};var onMouseMove=function onMouseMove(event){_this80.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent('mousemove',event));};var onContextMenu=cfg.onContextMenu?function(event){cfg.onContextMenu(event,_assertThisInitialized(_this80));}:null;var onMouseWheel=function onMouseWheel(event){_this80.plugin.viewer.scene.canvas.canvas.dispatchEvent(new WheelEvent('wheel',event));};_this80._originDot=new Dot(_this80._container,{fillColor:_this80._color,zIndex:plugin.zIndex!==undefined?plugin.zIndex+2:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._targetDot=new Dot(_this80._container,{fillColor:_this80._color,zIndex:plugin.zIndex!==undefined?plugin.zIndex+2:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._lengthWire=new Wire(_this80._container,{color:_this80._color,thickness:2,thicknessClickable:6,zIndex:plugin.zIndex!==undefined?plugin.zIndex+1:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._xAxisWire=new Wire(_this80._container,{color:"#FF0000",thickness:1,thicknessClickable:6,zIndex:plugin.zIndex!==undefined?plugin.zIndex+1:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._yAxisWire=new Wire(_this80._container,{color:"green",thickness:1,thicknessClickable:6,zIndex:plugin.zIndex!==undefined?plugin.zIndex+1:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._zAxisWire=new Wire(_this80._container,{color:"blue",thickness:1,thicknessClickable:6,zIndex:plugin.zIndex!==undefined?plugin.zIndex+1:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._lengthLabel=new Label(_this80._container,{fillColor:_this80._color,prefix:"",text:"",zIndex:plugin.zIndex!==undefined?plugin.zIndex+4:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._xAxisLabel=new Label(_this80._container,{fillColor:"red",prefix:"X",text:"",zIndex:plugin.zIndex!==undefined?plugin.zIndex+3:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._yAxisLabel=new Label(_this80._container,{fillColor:"green",prefix:"Y",text:"",zIndex:plugin.zIndex!==undefined?plugin.zIndex+3:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._zAxisLabel=new Label(_this80._container,{fillColor:"blue",prefix:"Z",text:"",zIndex:plugin.zIndex!==undefined?plugin.zIndex+3:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._wpDirty=false;_this80._vpDirty=false;_this80._cpDirty=false;_this80._sectionPlanesDirty=true;_this80._visible=false;_this80._originVisible=false;_this80._targetVisible=false;_this80._wireVisible=false;_this80._axisVisible=false;_this80._xAxisVisible=false;_this80._yAxisVisible=false;_this80._zAxisVisible=false;_this80._axisEnabled=true;_this80._labelsVisible=false;_this80._labelsOnWires=false;_this80._clickable=false;_this80._originMarker.on("worldPos",function(value){_this80._originWorld.set(value||[0,0,0]);_this80._wpDirty=true;_this80._needUpdate(0);// No lag
|
|
18694
18811
|
});_this80._targetMarker.on("worldPos",function(value){_this80._targetWorld.set(value||[0,0,0]);_this80._wpDirty=true;_this80._needUpdate(0);// No lag
|
|
18695
18812
|
});_this80._onViewMatrix=scene.camera.on("viewMatrix",function(){_this80._vpDirty=true;_this80._needUpdate(0);// No lag
|
|
18696
18813
|
});_this80._onProjMatrix=scene.camera.on("projMatrix",function(){_this80._cpDirty=true;_this80._needUpdate();});_this80._onCanvasBoundary=scene.canvas.on("boundary",function(){_this80._cpDirty=true;_this80._needUpdate(0);// No lag
|
|
18697
|
-
});_this80._onMetricsUnits=scene.metrics.on("units",function(){_this80._cpDirty=true;_this80._needUpdate();});_this80._onMetricsScale=scene.metrics.on("scale",function(){_this80._cpDirty=true;_this80._needUpdate();});_this80._onMetricsOrigin=scene.metrics.on("origin",function(){_this80._cpDirty=true;_this80._needUpdate();});_this80._onSectionPlaneUpdated=scene.on("sectionPlaneUpdated",function(){_this80._sectionPlanesDirty=true;_this80._needUpdate();});_this80.approximate=cfg.approximate;_this80.visible=cfg.visible;_this80.originVisible=cfg.originVisible;_this80.targetVisible=cfg.targetVisible;_this80.wireVisible=cfg.wireVisible;_this80.axisVisible=cfg.axisVisible;_this80.xAxisVisible=cfg.xAxisVisible;_this80.yAxisVisible=cfg.yAxisVisible;_this80.zAxisVisible=cfg.zAxisVisible;_this80.labelsVisible=cfg.labelsVisible;return _this80;}_createClass(DistanceMeasurement,[{key:"_update",value:function _update(){if(!this._visible){return;}var scene=this.plugin.viewer.scene;if(this._wpDirty){this._wp[0]=this._originWorld[0];this._wp[1]=this._originWorld[1];this._wp[2]=this._originWorld[2];this._wp[3]=1.0;this._wp[4]=this._targetWorld[0];this._wp[5]=this._originWorld[1];this._wp[6]=this._originWorld[2];this._wp[7]=1.0;this._wp[8]=this._targetWorld[0];this._wp[9]=this._targetWorld[1];this._wp[10]=this._originWorld[2];this._wp[11]=1.0;this._wp[12]=this._targetWorld[0];this._wp[13]=this._targetWorld[1];this._wp[14]=this._targetWorld[2];this._wp[15]=1.0;this._wpDirty=false;this._vpDirty=true;}if(this._vpDirty){math.transformPositions4(scene.camera.viewMatrix,this._wp,this._vp);this._vp[3]=1.0;this._vp[7]=1.0;this._vp[11]=1.0;this._vp[15]=1.0;this._vpDirty=false;this._cpDirty=true;}if(this._sectionPlanesDirty){if(this._isSliced(this._wp)){this._xAxisLabel.setCulled(true);this._yAxisLabel.setCulled(true);this._zAxisLabel.setCulled(true);this._lengthLabel.setCulled(true);this._xAxisWire.setCulled(true);this._yAxisWire.setCulled(true);this._zAxisWire.setCulled(true);this._lengthWire.setCulled(true);this._originDot.setCulled(true);this._targetDot.setCulled(true);return;}else{this._xAxisLabel.setCulled(false);this._yAxisLabel.setCulled(false);this._zAxisLabel.setCulled(false);this._lengthLabel.setCulled(false);this._xAxisWire.setCulled(false);this._yAxisWire.setCulled(false);this._zAxisWire.setCulled(false);this._lengthWire.setCulled(false);this._originDot.setCulled(false);this._targetDot.setCulled(false);}this._sectionPlanesDirty=true;}var near=-0.3;var vpz1=this._originMarker.viewPos[2];var vpz2=this._targetMarker.viewPos[2];if(vpz1>near||vpz2>near){this._xAxisLabel.setCulled(true);this._yAxisLabel.setCulled(true);this._zAxisLabel.setCulled(true);this._lengthLabel.setCulled(true);this._xAxisWire.setVisible(false);this._yAxisWire.setVisible(false);this._zAxisWire.setVisible(false);this._lengthWire.setVisible(false);this._originDot.setVisible(false);this._targetDot.setVisible(false);return;}if(this._cpDirty){math.transformPositions4(scene.camera.project.matrix,this._vp,this._pp);var pp=this._pp;var cp=this._cp;var canvas=scene.canvas.canvas;var offsets=canvas.getBoundingClientRect();var containerOffsets=this._container.getBoundingClientRect();var top=offsets.top-containerOffsets.top;var left=offsets.left-containerOffsets.left;var aabb=scene.canvas.boundary;var canvasWidth=aabb[2];var canvasHeight=aabb[3];var j=0;var metrics=this.plugin.viewer.scene.metrics;var _scale5=metrics.scale;var units=metrics.units;var unitInfo=metrics.unitsInfo[units];var unitAbbrev=unitInfo.abbrev;for(var i=0,len=pp.length;i<len;i+=4){cp[j]=left+Math.floor((1+pp[i+0]/pp[i+3])*canvasWidth/2);cp[j+1]=top+Math.floor((1-pp[i+1]/pp[i+3])*canvasHeight/2);j+=2;}this._originDot.setPos(cp[0],cp[1]);this._targetDot.setPos(cp[6],cp[7]);this._lengthWire.setStartAndEnd(cp[0],cp[1],cp[6],cp[7]);this._xAxisWire.setStartAndEnd(cp[0],cp[1],cp[2],cp[3]);this._yAxisWire.setStartAndEnd(cp[2],cp[3],cp[4],cp[5]);this._zAxisWire.setStartAndEnd(cp[4],cp[5],cp[6],cp[7]);if(!this.labelsVisible){this._lengthLabel.setCulled(true);this._xAxisLabel.setCulled(true);this._yAxisLabel.setCulled(true);this._zAxisLabel.setCulled(true);}else{this._lengthLabel.setPosOnWire(cp[0],cp[1],cp[6],cp[7]);this._xAxisLabel.setPosOnWire(cp[0],cp[1],cp[2],cp[3]);this._yAxisLabel.setPosOnWire(cp[2],cp[3],cp[4],cp[5]);this._zAxisLabel.setPosOnWire(cp[4],cp[5],cp[6],cp[7]);var tilde=this._approximate?" ~ ":" = ";this._length=Math.abs(math.lenVec3(math.subVec3(this._targetWorld,this._originWorld,distVec3)));this._lengthLabel.setText(tilde+(this._length*_scale5).toFixed(2)+unitAbbrev);var xAxisCanvasLength=Math.abs(lengthWire(cp[0],cp[1],cp[2],cp[3]));var yAxisCanvasLength=Math.abs(lengthWire(cp[2],cp[3],cp[4],cp[5]));var zAxisCanvasLength=Math.abs(lengthWire(cp[4],cp[5],cp[6],cp[7]));var labelMinAxisLength=this.plugin.labelMinAxisLength;this._xAxisLabelCulled=xAxisCanvasLength<labelMinAxisLength;this._yAxisLabelCulled=yAxisCanvasLength<labelMinAxisLength;this._zAxisLabelCulled=zAxisCanvasLength<labelMinAxisLength;if(!this._xAxisLabelCulled){this._xAxisLabel.setText(tilde+Math.abs((this._targetWorld[0]-this._originWorld[0])*_scale5).toFixed(2)+unitAbbrev);this._xAxisLabel.setCulled(!this.axisVisible);}else{this._xAxisLabel.setCulled(true);}if(!this._yAxisLabelCulled){this._yAxisLabel.setText(tilde+Math.abs((this._targetWorld[1]-this._originWorld[1])*_scale5).toFixed(2)+unitAbbrev);this._yAxisLabel.setCulled(!this.axisVisible);}else{this._yAxisLabel.setCulled(true);}if(!this._zAxisLabelCulled){this._zAxisLabel.setText(tilde+Math.abs((this._targetWorld[2]-this._originWorld[2])*_scale5).toFixed(2)+unitAbbrev);this._zAxisLabel.setCulled(!this.axisVisible);}else{this._zAxisLabel.setCulled(true);}}// this._xAxisLabel.setVisible(this.axisVisible && this.xAxisVisible);
|
|
18814
|
+
});_this80._onMetricsUnits=scene.metrics.on("units",function(){_this80._cpDirty=true;_this80._needUpdate();});_this80._onMetricsScale=scene.metrics.on("scale",function(){_this80._cpDirty=true;_this80._needUpdate();});_this80._onMetricsOrigin=scene.metrics.on("origin",function(){_this80._cpDirty=true;_this80._needUpdate();});_this80._onSectionPlaneUpdated=scene.on("sectionPlaneUpdated",function(){_this80._sectionPlanesDirty=true;_this80._needUpdate();});_this80.approximate=cfg.approximate;_this80.visible=cfg.visible;_this80.originVisible=cfg.originVisible;_this80.targetVisible=cfg.targetVisible;_this80.wireVisible=cfg.wireVisible;_this80.axisVisible=cfg.axisVisible;_this80.xAxisVisible=cfg.xAxisVisible;_this80.yAxisVisible=cfg.yAxisVisible;_this80.zAxisVisible=cfg.zAxisVisible;_this80.labelsVisible=cfg.labelsVisible;_this80.labelsOnWires=cfg.labelsOnWires;return _this80;}_createClass(DistanceMeasurement,[{key:"_update",value:function _update(){if(!this._visible){return;}var scene=this.plugin.viewer.scene;if(this._wpDirty){this._wp[0]=this._originWorld[0];this._wp[1]=this._originWorld[1];this._wp[2]=this._originWorld[2];this._wp[3]=1.0;this._wp[4]=this._targetWorld[0];this._wp[5]=this._originWorld[1];this._wp[6]=this._originWorld[2];this._wp[7]=1.0;this._wp[8]=this._targetWorld[0];this._wp[9]=this._targetWorld[1];this._wp[10]=this._originWorld[2];this._wp[11]=1.0;this._wp[12]=this._targetWorld[0];this._wp[13]=this._targetWorld[1];this._wp[14]=this._targetWorld[2];this._wp[15]=1.0;this._wpDirty=false;this._vpDirty=true;}if(this._vpDirty){math.transformPositions4(scene.camera.viewMatrix,this._wp,this._vp);this._vp[3]=1.0;this._vp[7]=1.0;this._vp[11]=1.0;this._vp[15]=1.0;this._vpDirty=false;this._cpDirty=true;}if(this._sectionPlanesDirty){if(this._isSliced(this._wp)){this._xAxisLabel.setCulled(true);this._yAxisLabel.setCulled(true);this._zAxisLabel.setCulled(true);this._lengthLabel.setCulled(true);this._xAxisWire.setCulled(true);this._yAxisWire.setCulled(true);this._zAxisWire.setCulled(true);this._lengthWire.setCulled(true);this._originDot.setCulled(true);this._targetDot.setCulled(true);return;}else{this._xAxisLabel.setCulled(false);this._yAxisLabel.setCulled(false);this._zAxisLabel.setCulled(false);this._lengthLabel.setCulled(false);this._xAxisWire.setCulled(false);this._yAxisWire.setCulled(false);this._zAxisWire.setCulled(false);this._lengthWire.setCulled(false);this._originDot.setCulled(false);this._targetDot.setCulled(false);}this._sectionPlanesDirty=true;}var near=-0.3;var vpz1=this._originMarker.viewPos[2];var vpz2=this._targetMarker.viewPos[2];if(vpz1>near||vpz2>near){this._xAxisLabel.setCulled(true);this._yAxisLabel.setCulled(true);this._zAxisLabel.setCulled(true);this._lengthLabel.setCulled(true);this._xAxisWire.setVisible(false);this._yAxisWire.setVisible(false);this._zAxisWire.setVisible(false);this._lengthWire.setVisible(false);this._originDot.setVisible(false);this._targetDot.setVisible(false);return;}if(this._cpDirty){math.transformPositions4(scene.camera.project.matrix,this._vp,this._pp);var pp=this._pp;var cp=this._cp;var canvas=scene.canvas.canvas;var offsets=canvas.getBoundingClientRect();var containerOffsets=this._container.getBoundingClientRect();var top=offsets.top-containerOffsets.top;var left=offsets.left-containerOffsets.left;var aabb=scene.canvas.boundary;var canvasWidth=aabb[2];var canvasHeight=aabb[3];var j=0;var metrics=this.plugin.viewer.scene.metrics;var _scale5=metrics.scale;var units=metrics.units;var unitInfo=metrics.unitsInfo[units];var unitAbbrev=unitInfo.abbrev;for(var i=0,len=pp.length;i<len;i+=4){cp[j]=left+Math.floor((1+pp[i+0]/pp[i+3])*canvasWidth/2);cp[j+1]=top+Math.floor((1-pp[i+1]/pp[i+3])*canvasHeight/2);j+=2;}this._originDot.setPos(cp[0],cp[1]);this._targetDot.setPos(cp[6],cp[7]);this._lengthWire.setStartAndEnd(cp[0],cp[1],cp[6],cp[7]);this._xAxisWire.setStartAndEnd(cp[0],cp[1],cp[2],cp[3]);this._yAxisWire.setStartAndEnd(cp[2],cp[3],cp[4],cp[5]);this._zAxisWire.setStartAndEnd(cp[4],cp[5],cp[6],cp[7]);if(!this.labelsVisible){this._lengthLabel.setCulled(true);this._xAxisLabel.setCulled(true);this._yAxisLabel.setCulled(true);this._zAxisLabel.setCulled(true);}else{this._lengthLabel.setPosOnWire(cp[0],cp[1],cp[6],cp[7]);if(this.labelsOnWires){this._xAxisLabel.setPosOnWire(cp[0],cp[1],cp[2],cp[3]);this._yAxisLabel.setPosOnWire(cp[2],cp[3],cp[4],cp[5]);this._zAxisLabel.setPosOnWire(cp[4],cp[5],cp[6],cp[7]);}else{var labelOffset=35;var currentLabelOffset=labelOffset;this._xAxisLabel.setPosOnWire(cp[0],cp[1]+currentLabelOffset,cp[6],cp[7]+currentLabelOffset);currentLabelOffset+=labelOffset;this._yAxisLabel.setPosOnWire(cp[0],cp[1]+currentLabelOffset,cp[6],cp[7]+currentLabelOffset);currentLabelOffset+=labelOffset;this._zAxisLabel.setPosOnWire(cp[0],cp[1]+currentLabelOffset,cp[6],cp[7]+currentLabelOffset);}var tilde=this._approximate?" ~ ":" = ";this._length=Math.abs(math.lenVec3(math.subVec3(this._targetWorld,this._originWorld,distVec3)));this._lengthLabel.setText(tilde+(this._length*_scale5).toFixed(2)+unitAbbrev);var xAxisCanvasLength=Math.abs(lengthWire(cp[0],cp[1],cp[2],cp[3]));var yAxisCanvasLength=Math.abs(lengthWire(cp[2],cp[3],cp[4],cp[5]));var zAxisCanvasLength=Math.abs(lengthWire(cp[4],cp[5],cp[6],cp[7]));var labelMinAxisLength=this.plugin.labelMinAxisLength;if(this.labelsOnWires){this._xAxisLabelCulled=xAxisCanvasLength<labelMinAxisLength;this._yAxisLabelCulled=yAxisCanvasLength<labelMinAxisLength;this._zAxisLabelCulled=zAxisCanvasLength<labelMinAxisLength;}else{this._xAxisLabelCulled=false;this._yAxisLabelCulled=false;this._zAxisLabelCulled=false;}if(!this._xAxisLabelCulled){this._xAxisLabel.setText(tilde+Math.abs((this._targetWorld[0]-this._originWorld[0])*_scale5).toFixed(2)+unitAbbrev);this._xAxisLabel.setCulled(!this.axisVisible);}else{this._xAxisLabel.setCulled(true);}if(!this._yAxisLabelCulled){this._yAxisLabel.setText(tilde+Math.abs((this._targetWorld[1]-this._originWorld[1])*_scale5).toFixed(2)+unitAbbrev);this._yAxisLabel.setCulled(!this.axisVisible);}else{this._yAxisLabel.setCulled(true);}if(!this._zAxisLabelCulled){this._zAxisLabel.setText(tilde+Math.abs((this._targetWorld[2]-this._originWorld[2])*_scale5).toFixed(2)+unitAbbrev);this._zAxisLabel.setCulled(!this.axisVisible);}else{this._zAxisLabel.setCulled(true);}}// this._xAxisLabel.setVisible(this.axisVisible && this.xAxisVisible);
|
|
18698
18815
|
// this._yAxisLabel.setVisible(this.axisVisible && this.yAxisVisible);
|
|
18699
18816
|
// this._zAxisLabel.setVisible(this.axisVisible && this.zAxisVisible);
|
|
18700
18817
|
// this._lengthLabel.setVisible(false);
|
|
@@ -18823,9 +18940,17 @@ this._originDot.setVisible(this._visible&&this._originVisible);this._targetDot.s
|
|
|
18823
18940
|
*
|
|
18824
18941
|
* @type {Boolean}
|
|
18825
18942
|
*/function get(){return this._labelsVisible;}/**
|
|
18943
|
+
* Sets if labels should be positioned on the wires.
|
|
18944
|
+
*
|
|
18945
|
+
* @type {Boolean}
|
|
18946
|
+
*/,set:function set(value){value=value!==undefined?Boolean(value):this.plugin.defaultLabelsVisible;this._labelsVisible=value;var labelsVisible=this._visible&&this._labelsVisible;this._xAxisLabel.setVisible(labelsVisible&&!this._xAxisLabelCulled&&this._clickable&&this._axisEnabled);this._yAxisLabel.setVisible(labelsVisible&&!this._yAxisLabelCulled&&this._clickable&&this._axisEnabled);this._zAxisLabel.setVisible(labelsVisible&&!this._zAxisLabelCulled&&this._clickable&&this._axisEnabled);this._lengthLabel.setVisible(labelsVisible);this._cpDirty=true;this._needUpdate();}},{key:"labelsOnWires",get:/**
|
|
18947
|
+
* Gets if labels should be positioned on the wires.
|
|
18948
|
+
*
|
|
18949
|
+
* @type {Boolean}
|
|
18950
|
+
*/function get(){return this._labelsOnWires;}/**
|
|
18826
18951
|
* Sets if this DistanceMeasurement appears highlighted.
|
|
18827
18952
|
* @param highlighted
|
|
18828
|
-
*/,set:function set(value){value=value!==undefined?Boolean(value):this.plugin.
|
|
18953
|
+
*/,set:function set(value){value=value!==undefined?Boolean(value):this.plugin.defaultLabelsOnWires;this._labelsOnWires=value;}},{key:"setHighlighted",value:function setHighlighted(highlighted){this._originDot.setHighlighted(highlighted);this._targetDot.setHighlighted(highlighted);this._xAxisWire.setHighlighted(highlighted);this._yAxisWire.setHighlighted(highlighted);this._zAxisWire.setHighlighted(highlighted);this._xAxisLabel.setHighlighted(highlighted);this._yAxisLabel.setHighlighted(highlighted);this._zAxisLabel.setHighlighted(highlighted);this._lengthWire.setHighlighted(highlighted);this._lengthLabel.setHighlighted(highlighted);}/**
|
|
18829
18954
|
* Sets if the wires, dots ad labels will fire "mouseOver" "mouseLeave" and "contextMenu" events, or ignore mouse events altogether.
|
|
18830
18955
|
*
|
|
18831
18956
|
* @type {Boolean}
|
|
@@ -19206,8 +19331,9 @@ this._originDot.setVisible(this._visible&&this._originVisible);this._targetDot.s
|
|
|
19206
19331
|
* @param {boolean} [cfg.defaultZAxisVisible=true] The default value of the DistanceMeasurements `zAxisVisible` property.
|
|
19207
19332
|
* @param {string} [cfg.defaultColor=#00BBFF] The default color of the length dots, wire and label.
|
|
19208
19333
|
* @param {number} [cfg.zIndex] If set, the wires, dots and labels will have this zIndex (+1 for dots and +2 for labels).
|
|
19334
|
+
* @param {boolean} [cfg.defaultLabelsOnWires=true] The default value of the DistanceMeasurements `labelsOnWires` property.
|
|
19209
19335
|
* @param {PointerCircle} [cfg.pointerLens] A PointerLens to help the user position the pointer. This can be shared with other plugins.
|
|
19210
|
-
*/function DistanceMeasurementsPlugin(viewer){var _this83;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,DistanceMeasurementsPlugin);_this83=_super118.call(this,"DistanceMeasurements",viewer);_this83._pointerLens=cfg.pointerLens;_this83._container=cfg.container||document.body;_this83._defaultControl=null;_this83._measurements={};_this83.labelMinAxisLength=cfg.labelMinAxisLength;_this83.defaultVisible=cfg.defaultVisible!==false;_this83.defaultOriginVisible=cfg.defaultOriginVisible!==false;_this83.defaultTargetVisible=cfg.defaultTargetVisible!==false;_this83.defaultWireVisible=cfg.defaultWireVisible!==false;_this83.defaultLabelsVisible=cfg.defaultLabelsVisible!==false;_this83.defaultAxisVisible=cfg.defaultAxisVisible!==false;_this83.defaultXAxisVisible=cfg.defaultXAxisVisible!==false;_this83.defaultYAxisVisible=cfg.defaultYAxisVisible!==false;_this83.defaultZAxisVisible=cfg.defaultZAxisVisible!==false;_this83.defaultColor=cfg.defaultColor!==undefined?cfg.defaultColor:"#00BBFF";_this83.zIndex=cfg.zIndex||10000;_this83._onMouseOver=function(event,measurement){_this83.fire("mouseOver",{plugin:_assertThisInitialized(_this83),distanceMeasurement:measurement,measurement:measurement,event:event});};_this83._onMouseLeave=function(event,measurement){_this83.fire("mouseLeave",{plugin:_assertThisInitialized(_this83),distanceMeasurement:measurement,measurement:measurement,event:event});};_this83._onContextMenu=function(event,measurement){_this83.fire("contextMenu",{plugin:_assertThisInitialized(_this83),distanceMeasurement:measurement,measurement:measurement,event:event});};return _this83;}/**
|
|
19336
|
+
*/function DistanceMeasurementsPlugin(viewer){var _this83;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,DistanceMeasurementsPlugin);_this83=_super118.call(this,"DistanceMeasurements",viewer);_this83._pointerLens=cfg.pointerLens;_this83._container=cfg.container||document.body;_this83._defaultControl=null;_this83._measurements={};_this83.labelMinAxisLength=cfg.labelMinAxisLength;_this83.defaultVisible=cfg.defaultVisible!==false;_this83.defaultOriginVisible=cfg.defaultOriginVisible!==false;_this83.defaultTargetVisible=cfg.defaultTargetVisible!==false;_this83.defaultWireVisible=cfg.defaultWireVisible!==false;_this83.defaultLabelsVisible=cfg.defaultLabelsVisible!==false;_this83.defaultAxisVisible=cfg.defaultAxisVisible!==false;_this83.defaultXAxisVisible=cfg.defaultXAxisVisible!==false;_this83.defaultYAxisVisible=cfg.defaultYAxisVisible!==false;_this83.defaultZAxisVisible=cfg.defaultZAxisVisible!==false;_this83.defaultColor=cfg.defaultColor!==undefined?cfg.defaultColor:"#00BBFF";_this83.zIndex=cfg.zIndex||10000;_this83.defaultLabelsOnWires=cfg.defaultLabelsOnWires!==false;_this83._onMouseOver=function(event,measurement){_this83.fire("mouseOver",{plugin:_assertThisInitialized(_this83),distanceMeasurement:measurement,measurement:measurement,event:event});};_this83._onMouseLeave=function(event,measurement){_this83.fire("mouseLeave",{plugin:_assertThisInitialized(_this83),distanceMeasurement:measurement,measurement:measurement,event:event});};_this83._onContextMenu=function(event,measurement){_this83.fire("contextMenu",{plugin:_assertThisInitialized(_this83),distanceMeasurement:measurement,measurement:measurement,event:event});};return _this83;}/**
|
|
19211
19337
|
* Gets the plugin's HTML container element, if any.
|
|
19212
19338
|
* @returns {*|HTMLElement|HTMLElement}
|
|
19213
19339
|
*/_createClass(DistanceMeasurementsPlugin,[{key:"getContainerElement",value:function getContainerElement(){return this._container;}/**
|
|
@@ -19258,8 +19384,9 @@ this._originDot.setVisible(this._visible&&this._originVisible);this._targetDot.s
|
|
|
19258
19384
|
* @param {Boolean} [params.zAxisVisible=true] Whether to initially show the Z-axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target}.
|
|
19259
19385
|
* @param {Boolean} [params.labelsVisible=true] Whether to initially show the labels.
|
|
19260
19386
|
* @param {string} [params.color] The color of the length dot, wire and label.
|
|
19387
|
+
* @param {Boolean} [params.labelsOnWires=true] Determines if labels will be set on wires or one below the other.
|
|
19261
19388
|
* @returns {DistanceMeasurement} The new {@link DistanceMeasurement}.
|
|
19262
|
-
*/,set:function set(labelMinAxisLength){if(labelMinAxisLength<1){this.error("labelMinAxisLength must be >= 1; defaulting to 25");labelMinAxisLength=25;}this._labelMinAxisLength=labelMinAxisLength||25;}},{key:"createMeasurement",value:function createMeasurement(){var _this84=this;var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(this.viewer.scene.components[params.id]){this.error("Viewer scene component with this ID already exists: "+params.id);delete params.id;}var origin=params.origin;var target=params.target;var measurement=new DistanceMeasurement(this,{id:params.id,plugin:this,container:this._container,origin:{entity:origin.entity,worldPos:origin.worldPos},target:{entity:target.entity,worldPos:target.worldPos},visible:params.visible,wireVisible:params.wireVisible,axisVisible:params.axisVisible!==false&&this.defaultAxisVisible!==false,xAxisVisible:params.xAxisVisible!==false&&this.defaultXAxisVisible!==false,yAxisVisible:params.yAxisVisible!==false&&this.defaultYAxisVisible!==false,zAxisVisible:params.zAxisVisible!==false&&this.defaultZAxisVisible!==false,labelsVisible:params.labelsVisible!==false&&this.defaultLabelsVisible!==false,originVisible:params.originVisible,targetVisible:params.targetVisible,color:params.color,onMouseOver:this._onMouseOver,onMouseLeave:this._onMouseLeave,onContextMenu:this._onContextMenu});this._measurements[measurement.id]=measurement;measurement.on("destroyed",function(){delete _this84._measurements[measurement.id];});this.fire("measurementCreated",measurement);return measurement;}/**
|
|
19389
|
+
*/,set:function set(labelMinAxisLength){if(labelMinAxisLength<1){this.error("labelMinAxisLength must be >= 1; defaulting to 25");labelMinAxisLength=25;}this._labelMinAxisLength=labelMinAxisLength||25;}},{key:"createMeasurement",value:function createMeasurement(){var _this84=this;var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(this.viewer.scene.components[params.id]){this.error("Viewer scene component with this ID already exists: "+params.id);delete params.id;}var origin=params.origin;var target=params.target;var measurement=new DistanceMeasurement(this,{id:params.id,plugin:this,container:this._container,origin:{entity:origin.entity,worldPos:origin.worldPos},target:{entity:target.entity,worldPos:target.worldPos},visible:params.visible,wireVisible:params.wireVisible,axisVisible:params.axisVisible!==false&&this.defaultAxisVisible!==false,xAxisVisible:params.xAxisVisible!==false&&this.defaultXAxisVisible!==false,yAxisVisible:params.yAxisVisible!==false&&this.defaultYAxisVisible!==false,zAxisVisible:params.zAxisVisible!==false&&this.defaultZAxisVisible!==false,labelsVisible:params.labelsVisible!==false&&this.defaultLabelsVisible!==false,originVisible:params.originVisible,targetVisible:params.targetVisible,color:params.color,labelsOnWires:params.labelsOnWires!==false&&this.defaultLabelsOnWires!==false,onMouseOver:this._onMouseOver,onMouseLeave:this._onMouseLeave,onContextMenu:this._onContextMenu});this._measurements[measurement.id]=measurement;measurement.on("destroyed",function(){delete _this84._measurements[measurement.id];});this.fire("measurementCreated",measurement);return measurement;}/**
|
|
19263
19390
|
* Destroys a {@link DistanceMeasurement}.
|
|
19264
19391
|
*
|
|
19265
19392
|
* @param {String} id ID of DistanceMeasurement to destroy.
|
|
@@ -28807,4 +28934,4 @@ var tr=earcut(pv,holes,2);// Create triangles
|
|
|
28807
28934
|
for(var _k4=0;_k4<tr.length;_k4+=3){geometryCfg.indices.unshift(face[tr[_k4]]);geometryCfg.indices.unshift(face[tr[_k4+1]]);geometryCfg.indices.unshift(face[tr[_k4+2]]);}}var meshId=""+ctx.nextId++;sceneModel.createMesh({id:meshId,primitive:"triangles",positions:geometryCfg.positions,indices:geometryCfg.indices,color:surfaceMaterial&&surfaceMaterial.diffuseColor?surfaceMaterial.diffuseColor:[0.8,0.8,0.8],opacity:surfaceMaterial&&surfaceMaterial.transparency!==undefined?1.0-surfaceMaterial.transparency:1.0});meshIds.push(meshId);ctx.stats.numGeometries++;ctx.stats.numVertices+=geometryCfg.positions.length/3;ctx.stats.numTriangles+=geometryCfg.indices.length/3;}}},{key:"_parseGeometrySurfacesWithSharedMaterial",value:function _parseGeometrySurfacesWithSharedMaterial(ctx,geometry,objectMaterial,meshIds){var sceneModel=ctx.sceneModel;var sharedIndices=[];var geometryCfg={positions:[],indices:[]};var geomType=geometry.type;switch(geomType){case"MultiPoint":break;case"MultiLineString":break;case"MultiSurface":case"CompositeSurface":var surfaces=geometry.boundaries;this._parseSurfacesWithSharedMaterial(ctx,surfaces,sharedIndices,geometryCfg);break;case"Solid":var shells=geometry.boundaries;for(var j=0;j<shells.length;j++){var _surfaces3=shells[j];this._parseSurfacesWithSharedMaterial(ctx,_surfaces3,sharedIndices,geometryCfg);}break;case"MultiSolid":case"CompositeSolid":var solids=geometry.boundaries;for(var _j6=0;_j6<solids.length;_j6++){for(var k=0;k<solids[_j6].length;k++){var _surfaces4=solids[_j6][k];this._parseSurfacesWithSharedMaterial(ctx,_surfaces4,sharedIndices,geometryCfg);}}break;}if(geometryCfg.positions.length>0&&geometryCfg.indices.length>0){var meshId=""+ctx.nextId++;sceneModel.createMesh({id:meshId,primitive:"triangles",positions:geometryCfg.positions,indices:geometryCfg.indices,color:objectMaterial&&objectMaterial.diffuseColor?objectMaterial.diffuseColor:[0.8,0.8,0.8],opacity:1.0//opacity: (objectMaterial && objectMaterial.transparency !== undefined) ? (1.0 - objectMaterial.transparency) : 1.0
|
|
28808
28935
|
});meshIds.push(meshId);ctx.stats.numGeometries++;ctx.stats.numVertices+=geometryCfg.positions.length/3;ctx.stats.numTriangles+=geometryCfg.indices.length/3;}}},{key:"_parseSurfacesWithSharedMaterial",value:function _parseSurfacesWithSharedMaterial(ctx,surfaces,sharedIndices,primitiveCfg){var vertices=ctx.vertices;for(var _i597=0;_i597<surfaces.length;_i597++){var boundary=[];var holes=[];for(var j=0;j<surfaces[_i597].length;j++){if(boundary.length>0){holes.push(boundary.length);}var newBoundary=this._extractLocalIndices(ctx,surfaces[_i597][j],sharedIndices,primitiveCfg);boundary.push.apply(boundary,_toConsumableArray(newBoundary));}if(boundary.length===3){// Triangle
|
|
28809
28936
|
primitiveCfg.indices.push(boundary[0]);primitiveCfg.indices.push(boundary[1]);primitiveCfg.indices.push(boundary[2]);}else if(boundary.length>3){// Polygon
|
|
28810
|
-
var pList=[];for(var k=0;k<boundary.length;k++){pList.push({x:vertices[sharedIndices[boundary[k]]][0],y:vertices[sharedIndices[boundary[k]]][1],z:vertices[sharedIndices[boundary[k]]][2]});}var normal=this._getNormalOfPositions(pList,math.vec3());var pv=[];for(var _k5=0;_k5<pList.length;_k5++){this._to2D(pList[_k5],normal,tempVec2a);pv.unshift(tempVec2a[0]);pv.unshift(tempVec2a[1]);}var tr=earcut(pv,holes,2);for(var _k6=0;_k6<tr.length;_k6+=3){primitiveCfg.indices.unshift(boundary[tr[_k6]]);primitiveCfg.indices.unshift(boundary[tr[_k6+1]]);primitiveCfg.indices.unshift(boundary[tr[_k6+2]]);}}}}},{key:"_extractLocalIndices",value:function _extractLocalIndices(ctx,boundary,sharedIndices,geometryCfg){var vertices=ctx.vertices;var newBoundary=[];for(var _i598=0,len=boundary.length;_i598<len;_i598++){var index=boundary[_i598];if(sharedIndices.includes(index)){var vertexIndex=sharedIndices.indexOf(index);newBoundary.push(vertexIndex);}else{geometryCfg.positions.push(vertices[index][0]);geometryCfg.positions.push(vertices[index][1]);geometryCfg.positions.push(vertices[index][2]);newBoundary.push(sharedIndices.length);sharedIndices.push(index);}}return newBoundary;}},{key:"_getNormalOfPositions",value:function _getNormalOfPositions(positions,normal){for(var _i599=0;_i599<positions.length;_i599++){var nexti=_i599+1;if(nexti===positions.length){nexti=0;}normal[0]+=(positions[_i599].y-positions[nexti].y)*(positions[_i599].z+positions[nexti].z);normal[1]+=(positions[_i599].z-positions[nexti].z)*(positions[_i599].x+positions[nexti].x);normal[2]+=(positions[_i599].x-positions[nexti].x)*(positions[_i599].y+positions[nexti].y);}return math.normalizeVec3(normal);}},{key:"_to2D",value:function _to2D(_p,_n,re){var p=tempVec3a;var n=tempVec3b;var x3=tempVec3c;p[0]=_p.x;p[1]=_p.y;p[2]=_p.z;n[0]=_n.x;n[1]=_n.y;n[2]=_n.z;x3[0]=1.1;x3[1]=1.1;x3[2]=1.1;var dist=math.lenVec3(math.subVec3(x3,n));if(dist<0.01){x3[0]+=1.0;x3[1]+=2.0;x3[2]+=3.0;}var dot=math.dotVec3(x3,n);var tmp2=math.mulVec3Scalar(n,dot,math.vec3());x3[0]-=tmp2[0];x3[1]-=tmp2[1];x3[2]-=tmp2[2];math.normalizeVec3(x3);var y3=math.cross3Vec3(n,x3,math.vec3());var x=math.dotVec3(p,x3);var y=math.dotVec3(p,y3);re[0]=x;re[1]=y;}}]);return CityJSONLoaderPlugin;}(Plugin);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};
|
|
28937
|
+
var pList=[];for(var k=0;k<boundary.length;k++){pList.push({x:vertices[sharedIndices[boundary[k]]][0],y:vertices[sharedIndices[boundary[k]]][1],z:vertices[sharedIndices[boundary[k]]][2]});}var normal=this._getNormalOfPositions(pList,math.vec3());var pv=[];for(var _k5=0;_k5<pList.length;_k5++){this._to2D(pList[_k5],normal,tempVec2a);pv.unshift(tempVec2a[0]);pv.unshift(tempVec2a[1]);}var tr=earcut(pv,holes,2);for(var _k6=0;_k6<tr.length;_k6+=3){primitiveCfg.indices.unshift(boundary[tr[_k6]]);primitiveCfg.indices.unshift(boundary[tr[_k6+1]]);primitiveCfg.indices.unshift(boundary[tr[_k6+2]]);}}}}},{key:"_extractLocalIndices",value:function _extractLocalIndices(ctx,boundary,sharedIndices,geometryCfg){var vertices=ctx.vertices;var newBoundary=[];for(var _i598=0,len=boundary.length;_i598<len;_i598++){var index=boundary[_i598];if(sharedIndices.includes(index)){var vertexIndex=sharedIndices.indexOf(index);newBoundary.push(vertexIndex);}else{geometryCfg.positions.push(vertices[index][0]);geometryCfg.positions.push(vertices[index][1]);geometryCfg.positions.push(vertices[index][2]);newBoundary.push(sharedIndices.length);sharedIndices.push(index);}}return newBoundary;}},{key:"_getNormalOfPositions",value:function _getNormalOfPositions(positions,normal){for(var _i599=0;_i599<positions.length;_i599++){var nexti=_i599+1;if(nexti===positions.length){nexti=0;}normal[0]+=(positions[_i599].y-positions[nexti].y)*(positions[_i599].z+positions[nexti].z);normal[1]+=(positions[_i599].z-positions[nexti].z)*(positions[_i599].x+positions[nexti].x);normal[2]+=(positions[_i599].x-positions[nexti].x)*(positions[_i599].y+positions[nexti].y);}return math.normalizeVec3(normal);}},{key:"_to2D",value:function _to2D(_p,_n,re){var p=tempVec3a;var n=tempVec3b;var x3=tempVec3c;p[0]=_p.x;p[1]=_p.y;p[2]=_p.z;n[0]=_n.x;n[1]=_n.y;n[2]=_n.z;x3[0]=1.1;x3[1]=1.1;x3[2]=1.1;var dist=math.lenVec3(math.subVec3(x3,n));if(dist<0.01){x3[0]+=1.0;x3[1]+=2.0;x3[2]+=3.0;}var dot=math.dotVec3(x3,n);var tmp2=math.mulVec3Scalar(n,dot,math.vec3());x3[0]-=tmp2[0];x3[1]-=tmp2[1];x3[2]-=tmp2[2];math.normalizeVec3(x3);var y3=math.cross3Vec3(n,x3,math.vec3());var x=math.dotVec3(p,x3);var y=math.dotVec3(p,y3);re[0]=x;re[1]=y;}}]);return CityJSONLoaderPlugin;}(Plugin);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};
|