@xeokit/xeokit-sdk 2.4.2-beta-9 → 2.4.2-beta-10
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 +36 -5
- package/dist/xeokit-sdk.es.js +36 -5
- package/dist/xeokit-sdk.es5.js +18 -3
- package/dist/xeokit-sdk.min.cjs.js +1 -1
- package/dist/xeokit-sdk.min.es.js +1 -1
- package/dist/xeokit-sdk.min.es5.js +1 -1
- package/package.json +1 -1
- package/src/plugins/BCFViewpointsPlugin/BCFViewpointsPlugin.js +36 -5
package/dist/xeokit-sdk.cjs.js
CHANGED
|
@@ -47356,11 +47356,29 @@ class BCFViewpointsPlugin extends Plugin {
|
|
|
47356
47356
|
* @param {String} [cfg.id="BCFViewpoints"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
|
|
47357
47357
|
* @param {String} [cfg.originatingSystem] Identifies the originating system for BCF records.
|
|
47358
47358
|
* @param {String} [cfg.authoringTool] Identifies the authoring tool for BCF records.
|
|
47359
|
+
* @param {Boolean} [cfg.xrayAsZeroAlpha=false] Specifies how xeokit's X-ray emphasis effect is handled in BCF viewpoints. See {@link BCFViewpointsPlugin#xrayAsZeroAlpha} for details.
|
|
47359
47360
|
*/
|
|
47360
47361
|
constructor(viewer, cfg = {}) {
|
|
47361
47362
|
|
|
47362
47363
|
super("BCFViewpoints", viewer, cfg);
|
|
47363
47364
|
|
|
47365
|
+
/**
|
|
47366
|
+
* Specifies how xeokit's X-ray emphasis effect is handled in BCF viewpoints.
|
|
47367
|
+
*
|
|
47368
|
+
* When `xrayAsZeroAlpha` is `true`:
|
|
47369
|
+
*
|
|
47370
|
+
* * when saving a viewpoint, set the `A` channel of each `coloring` component to `0` for each X-rayed object, and
|
|
47371
|
+
* * when loading a viewpoint saved from a xeokit application (i.e. when the viewpoint's `originating_system == "xeokit.io"`), set an object X-rayed if the `A` channel of its corresponding `coloring` component equals `0`
|
|
47372
|
+
*
|
|
47373
|
+
* When `xrayAsZeroAlpha` is `false`:
|
|
47374
|
+
*
|
|
47375
|
+
* * don't save any X-ray information in viewpoints, and
|
|
47376
|
+
* * reset all objects as not X-rayed whenever loading a viewpoint.
|
|
47377
|
+
*
|
|
47378
|
+
* @type {boolean}
|
|
47379
|
+
*/
|
|
47380
|
+
this.xrayAsZeroAlpha = !!cfg.xrayAsZeroAlpha;
|
|
47381
|
+
|
|
47364
47382
|
/**
|
|
47365
47383
|
* Identifies the originating system to include in BCF viewpoints saved by this plugin.
|
|
47366
47384
|
* @property originatingSystem
|
|
@@ -47549,11 +47567,15 @@ class BCFViewpointsPlugin extends Plugin {
|
|
|
47549
47567
|
let alpha;
|
|
47550
47568
|
|
|
47551
47569
|
if (entity.xrayed) {
|
|
47552
|
-
if (
|
|
47553
|
-
|
|
47554
|
-
alpha = 0.1;
|
|
47570
|
+
if (this.xrayAsZeroAlpha) {
|
|
47571
|
+
alpha = 0;
|
|
47555
47572
|
} else {
|
|
47556
|
-
|
|
47573
|
+
if (scene.xrayMaterial.fillAlpha === 0.0 && scene.xrayMaterial.edgeAlpha !== 0.0) {
|
|
47574
|
+
// BCF can't deal with edges. If xRay is implemented only with edges, set an arbitrary opacity
|
|
47575
|
+
alpha = 0.1;
|
|
47576
|
+
} else {
|
|
47577
|
+
alpha = scene.xrayMaterial.fillAlpha;
|
|
47578
|
+
}
|
|
47557
47579
|
}
|
|
47558
47580
|
alpha = Math.round(alpha * 255).toString(16).padStart(2, "0");
|
|
47559
47581
|
color = alpha + color;
|
|
@@ -47830,7 +47852,16 @@ class BCFViewpointsPlugin extends Plugin {
|
|
|
47830
47852
|
this._withBCFComponent(options, component, entity => {
|
|
47831
47853
|
entity.colorize = colorize;
|
|
47832
47854
|
if (alphaDefined) {
|
|
47833
|
-
|
|
47855
|
+
if (alpha === 0 && this.xrayAsZeroAlpha) {
|
|
47856
|
+
const savedFromXeokit = (component.originating_system === this.originatingSystem);
|
|
47857
|
+
if (savedFromXeokit) {
|
|
47858
|
+
entity.xrayed = true;
|
|
47859
|
+
} else {
|
|
47860
|
+
entity.opacity = alpha;
|
|
47861
|
+
}
|
|
47862
|
+
} else {
|
|
47863
|
+
entity.opacity = alpha;
|
|
47864
|
+
}
|
|
47834
47865
|
}
|
|
47835
47866
|
}));
|
|
47836
47867
|
});
|
package/dist/xeokit-sdk.es.js
CHANGED
|
@@ -47352,11 +47352,29 @@ class BCFViewpointsPlugin extends Plugin {
|
|
|
47352
47352
|
* @param {String} [cfg.id="BCFViewpoints"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
|
|
47353
47353
|
* @param {String} [cfg.originatingSystem] Identifies the originating system for BCF records.
|
|
47354
47354
|
* @param {String} [cfg.authoringTool] Identifies the authoring tool for BCF records.
|
|
47355
|
+
* @param {Boolean} [cfg.xrayAsZeroAlpha=false] Specifies how xeokit's X-ray emphasis effect is handled in BCF viewpoints. See {@link BCFViewpointsPlugin#xrayAsZeroAlpha} for details.
|
|
47355
47356
|
*/
|
|
47356
47357
|
constructor(viewer, cfg = {}) {
|
|
47357
47358
|
|
|
47358
47359
|
super("BCFViewpoints", viewer, cfg);
|
|
47359
47360
|
|
|
47361
|
+
/**
|
|
47362
|
+
* Specifies how xeokit's X-ray emphasis effect is handled in BCF viewpoints.
|
|
47363
|
+
*
|
|
47364
|
+
* When `xrayAsZeroAlpha` is `true`:
|
|
47365
|
+
*
|
|
47366
|
+
* * when saving a viewpoint, set the `A` channel of each `coloring` component to `0` for each X-rayed object, and
|
|
47367
|
+
* * when loading a viewpoint saved from a xeokit application (i.e. when the viewpoint's `originating_system == "xeokit.io"`), set an object X-rayed if the `A` channel of its corresponding `coloring` component equals `0`
|
|
47368
|
+
*
|
|
47369
|
+
* When `xrayAsZeroAlpha` is `false`:
|
|
47370
|
+
*
|
|
47371
|
+
* * don't save any X-ray information in viewpoints, and
|
|
47372
|
+
* * reset all objects as not X-rayed whenever loading a viewpoint.
|
|
47373
|
+
*
|
|
47374
|
+
* @type {boolean}
|
|
47375
|
+
*/
|
|
47376
|
+
this.xrayAsZeroAlpha = !!cfg.xrayAsZeroAlpha;
|
|
47377
|
+
|
|
47360
47378
|
/**
|
|
47361
47379
|
* Identifies the originating system to include in BCF viewpoints saved by this plugin.
|
|
47362
47380
|
* @property originatingSystem
|
|
@@ -47545,11 +47563,15 @@ class BCFViewpointsPlugin extends Plugin {
|
|
|
47545
47563
|
let alpha;
|
|
47546
47564
|
|
|
47547
47565
|
if (entity.xrayed) {
|
|
47548
|
-
if (
|
|
47549
|
-
|
|
47550
|
-
alpha = 0.1;
|
|
47566
|
+
if (this.xrayAsZeroAlpha) {
|
|
47567
|
+
alpha = 0;
|
|
47551
47568
|
} else {
|
|
47552
|
-
|
|
47569
|
+
if (scene.xrayMaterial.fillAlpha === 0.0 && scene.xrayMaterial.edgeAlpha !== 0.0) {
|
|
47570
|
+
// BCF can't deal with edges. If xRay is implemented only with edges, set an arbitrary opacity
|
|
47571
|
+
alpha = 0.1;
|
|
47572
|
+
} else {
|
|
47573
|
+
alpha = scene.xrayMaterial.fillAlpha;
|
|
47574
|
+
}
|
|
47553
47575
|
}
|
|
47554
47576
|
alpha = Math.round(alpha * 255).toString(16).padStart(2, "0");
|
|
47555
47577
|
color = alpha + color;
|
|
@@ -47826,7 +47848,16 @@ class BCFViewpointsPlugin extends Plugin {
|
|
|
47826
47848
|
this._withBCFComponent(options, component, entity => {
|
|
47827
47849
|
entity.colorize = colorize;
|
|
47828
47850
|
if (alphaDefined) {
|
|
47829
|
-
|
|
47851
|
+
if (alpha === 0 && this.xrayAsZeroAlpha) {
|
|
47852
|
+
const savedFromXeokit = (component.originating_system === this.originatingSystem);
|
|
47853
|
+
if (savedFromXeokit) {
|
|
47854
|
+
entity.xrayed = true;
|
|
47855
|
+
} else {
|
|
47856
|
+
entity.opacity = alpha;
|
|
47857
|
+
}
|
|
47858
|
+
} else {
|
|
47859
|
+
entity.opacity = alpha;
|
|
47860
|
+
}
|
|
47830
47861
|
}
|
|
47831
47862
|
}));
|
|
47832
47863
|
});
|
package/dist/xeokit-sdk.es5.js
CHANGED
|
@@ -13903,7 +13903,22 @@ var positions=K3D.edit.unwrap(m.i_verts,m.c_verts,3);var normals=K3D.edit.unwrap
|
|
|
13903
13903
|
* @param {String} [cfg.id="BCFViewpoints"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
|
|
13904
13904
|
* @param {String} [cfg.originatingSystem] Identifies the originating system for BCF records.
|
|
13905
13905
|
* @param {String} [cfg.authoringTool] Identifies the authoring tool for BCF records.
|
|
13906
|
+
* @param {Boolean} [cfg.xrayAsZeroAlpha=false] Specifies how xeokit's X-ray emphasis effect is handled in BCF viewpoints. See {@link BCFViewpointsPlugin#xrayAsZeroAlpha} for details.
|
|
13906
13907
|
*/function BCFViewpointsPlugin(viewer){var _this63;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,BCFViewpointsPlugin);_this63=_super44.call(this,"BCFViewpoints",viewer,cfg);/**
|
|
13908
|
+
* Specifies how xeokit's X-ray emphasis effect is handled in BCF viewpoints.
|
|
13909
|
+
*
|
|
13910
|
+
* When `xrayAsZeroAlpha` is `true`:
|
|
13911
|
+
*
|
|
13912
|
+
* * when saving a viewpoint, set the `A` channel of each `coloring` component to `0` for each X-rayed object, and
|
|
13913
|
+
* * when loading a viewpoint saved from a xeokit application (i.e. when the viewpoint's `originating_system == "xeokit.io"`), set an object X-rayed if the `A` channel of its corresponding `coloring` component equals `0`
|
|
13914
|
+
*
|
|
13915
|
+
* When `xrayAsZeroAlpha` is `false`:
|
|
13916
|
+
*
|
|
13917
|
+
* * don't save any X-ray information in viewpoints, and
|
|
13918
|
+
* * reset all objects as not X-rayed whenever loading a viewpoint.
|
|
13919
|
+
*
|
|
13920
|
+
* @type {boolean}
|
|
13921
|
+
*/_this63.xrayAsZeroAlpha=!!cfg.xrayAsZeroAlpha;/**
|
|
13907
13922
|
* Identifies the originating system to include in BCF viewpoints saved by this plugin.
|
|
13908
13923
|
* @property originatingSystem
|
|
13909
13924
|
* @type {string}
|
|
@@ -13935,8 +13950,8 @@ location=YToZ(location);_direction=YToZ(_direction);}math.addVec3(location,realW
|
|
|
13935
13950
|
var lineSets=scene.lineSets;for(var _id2 in lineSets){if(lineSets.hasOwnProperty(_id2)){var lineSet=lineSets[_id2];if(!bcfViewpoint.lines){bcfViewpoint.lines=[];}var positions=lineSet.positions;var indices=lineSet.indices;for(var _i154=0,len=indices.length/2;_i154<len;_i154++){var _a2=indices[_i154*2];var b=indices[_i154*2+1];bcfViewpoint.lines.push({start_point:{x:positions[_a2*3+0],y:positions[_a2*3+1],z:positions[_a2*3+2]},end_point:{x:positions[b*3+0],y:positions[b*3+1],z:positions[b*3+2]}});}}}// Bitmaps
|
|
13936
13951
|
var bitmaps=scene.bitmaps;for(var _id3 in bitmaps){if(bitmaps.hasOwnProperty(_id3)){var bitmap=bitmaps[_id3];var _location=bitmap.pos;var normal=bitmap.normal;var _up=bitmap.up;if(camera.yUp){// BCF is Z up
|
|
13937
13952
|
_location=YToZ(_location);normal=YToZ(normal);_up=YToZ(_up);}math.addVec3(_location,realWorldOffset);if(!bcfViewpoint.bitmaps){bcfViewpoint.bitmaps=[];}bcfViewpoint.bitmaps.push({bitmap_type:bitmap.type,bitmap_data:bitmap.imageData,location:xyzArrayToObject(_location),normal:xyzArrayToObject(normal),up:xyzArrayToObject(_up),height:bitmap.height});}}// Entity states
|
|
13938
|
-
bcfViewpoint.components={visibility:{view_setup_hints:{spaces_visible:!!options.spacesVisible,space_boundaries_visible:!!options.spaceBoundariesVisible,openings_visible:!!options.openingsVisible}}};var opacityObjectIds=new Set(scene.opacityObjectIds);var xrayedObjectIds=new Set(scene.xrayedObjectIds);var colorizedObjectIds=new Set(scene.colorizedObjectIds);var coloringMap=Object.values(scene.objects).filter(function(entity){return opacityObjectIds.has(entity.id)||colorizedObjectIds.has(entity.id)||xrayedObjectIds.has(entity.id);}).reduce(function(coloringMap,entity){var color=colorizeToRGB(entity.colorize);var alpha;if(entity.xrayed){if(scene.xrayMaterial.fillAlpha===0.0&&scene.xrayMaterial.edgeAlpha!==0.0){// BCF can't deal with edges. If xRay is implemented only with edges, set an arbitrary opacity
|
|
13939
|
-
alpha=0.1;}else{alpha=scene.xrayMaterial.fillAlpha;}alpha=Math.round(alpha*255).toString(16).padStart(2,"0");color=alpha+color;}else if(opacityObjectIds.has(entity.id)){alpha=Math.round(entity.opacity*255).toString(16).padStart(2,"0");color=alpha+color;}if(!coloringMap[color]){coloringMap[color]=[];}var objectId=entity.id;var originalSystemId=entity.originalSystemId;var component={ifc_guid:originalSystemId,originating_system:_this64.originatingSystem};if(originalSystemId!==objectId){component.authoring_tool_id=objectId;}coloringMap[color].push(component);return coloringMap;},{});var coloringArray=Object.entries(coloringMap).map(function(_ref6){var _ref7=_slicedToArray(_ref6,2),color=_ref7[0],components=_ref7[1];return{color:color,components:components};});bcfViewpoint.components.coloring=coloringArray;var objectIds=scene.objectIds;var visibleObjects=scene.visibleObjects;var visibleObjectIds=scene.visibleObjectIds;var invisibleObjectIds=objectIds.filter(function(id){return!visibleObjects[id];});var selectedObjectIds=scene.selectedObjectIds;if(options.defaultInvisible||visibleObjectIds.length<invisibleObjectIds.length){bcfViewpoint.components.visibility.exceptions=this._createBCFComponents(visibleObjectIds);bcfViewpoint.components.visibility.default_visibility=false;}else{bcfViewpoint.components.visibility.exceptions=this._createBCFComponents(invisibleObjectIds);bcfViewpoint.components.visibility.default_visibility=true;}bcfViewpoint.components.selection=this._createBCFComponents(selectedObjectIds);if(options.snapshot!==false){bcfViewpoint.snapshot={snapshot_type:"png",snapshot_data:this.viewer.getSnapshot({format:"png"})};}return bcfViewpoint;}},{key:"_createBCFComponents",value:function _createBCFComponents(objectIds){var scene=this.viewer.scene;var components=[];for(var _i155=0,len=objectIds.length;_i155<len;_i155++){var objectId=objectIds[_i155];var entity=scene.objects[objectId];if(entity){var component={ifc_guid:entity.originalSystemId,originating_system:this.originatingSystem};if(entity.originalSystemId!==objectId){component.authoring_tool_id=objectId;}components.push(component);}}return components;}/**
|
|
13953
|
+
bcfViewpoint.components={visibility:{view_setup_hints:{spaces_visible:!!options.spacesVisible,space_boundaries_visible:!!options.spaceBoundariesVisible,openings_visible:!!options.openingsVisible}}};var opacityObjectIds=new Set(scene.opacityObjectIds);var xrayedObjectIds=new Set(scene.xrayedObjectIds);var colorizedObjectIds=new Set(scene.colorizedObjectIds);var coloringMap=Object.values(scene.objects).filter(function(entity){return opacityObjectIds.has(entity.id)||colorizedObjectIds.has(entity.id)||xrayedObjectIds.has(entity.id);}).reduce(function(coloringMap,entity){var color=colorizeToRGB(entity.colorize);var alpha;if(entity.xrayed){if(_this64.xrayAsZeroAlpha){alpha=0;}else{if(scene.xrayMaterial.fillAlpha===0.0&&scene.xrayMaterial.edgeAlpha!==0.0){// BCF can't deal with edges. If xRay is implemented only with edges, set an arbitrary opacity
|
|
13954
|
+
alpha=0.1;}else{alpha=scene.xrayMaterial.fillAlpha;}}alpha=Math.round(alpha*255).toString(16).padStart(2,"0");color=alpha+color;}else if(opacityObjectIds.has(entity.id)){alpha=Math.round(entity.opacity*255).toString(16).padStart(2,"0");color=alpha+color;}if(!coloringMap[color]){coloringMap[color]=[];}var objectId=entity.id;var originalSystemId=entity.originalSystemId;var component={ifc_guid:originalSystemId,originating_system:_this64.originatingSystem};if(originalSystemId!==objectId){component.authoring_tool_id=objectId;}coloringMap[color].push(component);return coloringMap;},{});var coloringArray=Object.entries(coloringMap).map(function(_ref6){var _ref7=_slicedToArray(_ref6,2),color=_ref7[0],components=_ref7[1];return{color:color,components:components};});bcfViewpoint.components.coloring=coloringArray;var objectIds=scene.objectIds;var visibleObjects=scene.visibleObjects;var visibleObjectIds=scene.visibleObjectIds;var invisibleObjectIds=objectIds.filter(function(id){return!visibleObjects[id];});var selectedObjectIds=scene.selectedObjectIds;if(options.defaultInvisible||visibleObjectIds.length<invisibleObjectIds.length){bcfViewpoint.components.visibility.exceptions=this._createBCFComponents(visibleObjectIds);bcfViewpoint.components.visibility.default_visibility=false;}else{bcfViewpoint.components.visibility.exceptions=this._createBCFComponents(invisibleObjectIds);bcfViewpoint.components.visibility.default_visibility=true;}bcfViewpoint.components.selection=this._createBCFComponents(selectedObjectIds);if(options.snapshot!==false){bcfViewpoint.snapshot={snapshot_type:"png",snapshot_data:this.viewer.getSnapshot({format:"png"})};}return bcfViewpoint;}},{key:"_createBCFComponents",value:function _createBCFComponents(objectIds){var scene=this.viewer.scene;var components=[];for(var _i155=0,len=objectIds.length;_i155<len;_i155++){var objectId=objectIds[_i155];var entity=scene.objects[objectId];if(entity){var component={ifc_guid:entity.originalSystemId,originating_system:this.originatingSystem};if(entity.originalSystemId!==objectId){component.authoring_tool_id=objectId;}components.push(component);}}return components;}/**
|
|
13940
13955
|
* Sets viewer state to the given BCF viewpoint.
|
|
13941
13956
|
*
|
|
13942
13957
|
* Note that xeokit's {@link Camera#look} is the **point-of-interest**, whereas the BCF ````camera_direction```` is a
|
|
@@ -13960,7 +13975,7 @@ alpha=0.1;}else{alpha=scene.xrayMaterial.fillAlpha;}alpha=Math.round(alpha*255).
|
|
|
13960
13975
|
* then this method will apply the updates to objects within those composites.
|
|
13961
13976
|
*/},{key:"setViewpoint",value:function setViewpoint(bcfViewpoint){var _this65=this;var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};if(!bcfViewpoint){return;}var viewer=this.viewer;var scene=viewer.scene;var camera=scene.camera;var rayCast=options.rayCast!==false;var immediate=options.immediate!==false;var reset=options.reset!==false;var realWorldOffset=scene.realWorldOffset;var reverseClippingPlanes=options.reverseClippingPlanes===true;scene.clearSectionPlanes();if(bcfViewpoint.clipping_planes&&bcfViewpoint.clipping_planes.length>0){bcfViewpoint.clipping_planes.forEach(function(e){var pos=xyzObjectToArray(e.location,tempVec3$5);var dir=xyzObjectToArray(e.direction,tempVec3$5);if(reverseClippingPlanes){math.negateVec3(dir);}math.subVec3(pos,realWorldOffset);if(camera.yUp){pos=ZToY(pos);dir=ZToY(dir);}new SectionPlane(scene,{pos:pos,dir:dir});});}scene.clearLines();if(bcfViewpoint.lines&&bcfViewpoint.lines.length>0){var positions=[];var indices=[];var _i156=0;bcfViewpoint.lines.forEach(function(e){if(!e.start_point){return;}if(!e.end_point){return;}positions.push(e.start_point.x);positions.push(e.start_point.y);positions.push(e.start_point.z);positions.push(e.end_point.x);positions.push(e.end_point.y);positions.push(e.end_point.z);indices.push(_i156++);indices.push(_i156++);});new LineSet(scene,{positions:positions,indices:indices,clippable:false,collidable:true});}scene.clearBitmaps();if(bcfViewpoint.bitmaps&&bcfViewpoint.bitmaps.length>0){bcfViewpoint.bitmaps.forEach(function(e){var bitmap_type=e.bitmap_type||"jpg";// "jpg" | "png"
|
|
13962
13977
|
var bitmap_data=e.bitmap_data;// base64
|
|
13963
|
-
var location=xyzObjectToArray(e.location,tempVec3a$u);var normal=xyzObjectToArray(e.normal,tempVec3b$p);var up=xyzObjectToArray(e.up,tempVec3c$m);var height=e.height||1;if(!bitmap_type){return;}if(!bitmap_data){return;}if(!location){return;}if(!normal){return;}if(!up){return;}if(camera.yUp){location=ZToY(location);normal=ZToY(normal);up=ZToY(up);}new Bitmap(scene,{src:bitmap_data,type:bitmap_type,pos:location,normal:normal,up:up,clippable:false,collidable:true,height:height});});}if(reset){scene.setObjectsXRayed(scene.xrayedObjectIds,false);scene.setObjectsHighlighted(scene.highlightedObjectIds,false);scene.setObjectsSelected(scene.selectedObjectIds,false);}if(bcfViewpoint.components){if(bcfViewpoint.components.visibility){if(!bcfViewpoint.components.visibility.default_visibility){scene.setObjectsVisible(scene.objectIds,false);if(bcfViewpoint.components.visibility.exceptions){bcfViewpoint.components.visibility.exceptions.forEach(function(component){return _this65._withBCFComponent(options,component,function(entity){return entity.visible=true;});});}}else{scene.setObjectsVisible(scene.objectIds,true);if(bcfViewpoint.components.visibility.exceptions){bcfViewpoint.components.visibility.exceptions.forEach(function(component){return _this65._withBCFComponent(options,component,function(entity){return entity.visible=false;});});}}var view_setup_hints=bcfViewpoint.components.visibility.view_setup_hints;if(view_setup_hints){if(view_setup_hints.spaces_visible===false){scene.setObjectsVisible(viewer.metaScene.getObjectIDsByType("IfcSpace"),false);}if(view_setup_hints.openings_visible===false){scene.setObjectsVisible(viewer.metaScene.getObjectIDsByType("IfcOpening"),false);}if(view_setup_hints.space_boundaries_visible!==undefined);}}if(bcfViewpoint.components.selection){scene.setObjectsSelected(scene.selectedObjectIds,false);bcfViewpoint.components.selection.forEach(function(component){return _this65._withBCFComponent(options,component,function(entity){return entity.selected=true;});});}if(bcfViewpoint.components.coloring){bcfViewpoint.components.coloring.forEach(function(coloring){var color=coloring.color;var alpha=0;var alphaDefined=false;if(color.length===8){alpha=parseInt(color.substring(0,2),16)/256;if(alpha<=1.0&&alpha>=0.95){alpha=1.0;}color=color.substring(2);alphaDefined=true;}var colorize=[parseInt(color.substring(0,2),16)/256,parseInt(color.substring(2,4),16)/256,parseInt(color.substring(4,6),16)/256];coloring.components.map(function(component){return _this65._withBCFComponent(options,component,function(entity){entity.colorize=colorize;if(alphaDefined){entity.opacity=alpha;}});});});}}if(bcfViewpoint.perspective_camera||bcfViewpoint.orthogonal_camera){var eye;var look;var up;var projection;if(bcfViewpoint.perspective_camera){eye=xyzObjectToArray(bcfViewpoint.perspective_camera.camera_view_point,tempVec3$5);look=xyzObjectToArray(bcfViewpoint.perspective_camera.camera_direction,tempVec3$5);up=xyzObjectToArray(bcfViewpoint.perspective_camera.camera_up_vector,tempVec3$5);camera.perspective.fov=bcfViewpoint.perspective_camera.field_of_view;projection="perspective";}else{eye=xyzObjectToArray(bcfViewpoint.orthogonal_camera.camera_view_point,tempVec3$5);look=xyzObjectToArray(bcfViewpoint.orthogonal_camera.camera_direction,tempVec3$5);up=xyzObjectToArray(bcfViewpoint.orthogonal_camera.camera_up_vector,tempVec3$5);camera.ortho.scale=bcfViewpoint.orthogonal_camera.view_to_world_scale;projection="ortho";}math.subVec3(eye,realWorldOffset);if(camera.yUp){eye=ZToY(eye);look=ZToY(look);up=ZToY(up);}if(rayCast){var hit=scene.pick({pickSurface:true,// <<------ This causes picking to find the intersection point on the entity
|
|
13978
|
+
var location=xyzObjectToArray(e.location,tempVec3a$u);var normal=xyzObjectToArray(e.normal,tempVec3b$p);var up=xyzObjectToArray(e.up,tempVec3c$m);var height=e.height||1;if(!bitmap_type){return;}if(!bitmap_data){return;}if(!location){return;}if(!normal){return;}if(!up){return;}if(camera.yUp){location=ZToY(location);normal=ZToY(normal);up=ZToY(up);}new Bitmap(scene,{src:bitmap_data,type:bitmap_type,pos:location,normal:normal,up:up,clippable:false,collidable:true,height:height});});}if(reset){scene.setObjectsXRayed(scene.xrayedObjectIds,false);scene.setObjectsHighlighted(scene.highlightedObjectIds,false);scene.setObjectsSelected(scene.selectedObjectIds,false);}if(bcfViewpoint.components){if(bcfViewpoint.components.visibility){if(!bcfViewpoint.components.visibility.default_visibility){scene.setObjectsVisible(scene.objectIds,false);if(bcfViewpoint.components.visibility.exceptions){bcfViewpoint.components.visibility.exceptions.forEach(function(component){return _this65._withBCFComponent(options,component,function(entity){return entity.visible=true;});});}}else{scene.setObjectsVisible(scene.objectIds,true);if(bcfViewpoint.components.visibility.exceptions){bcfViewpoint.components.visibility.exceptions.forEach(function(component){return _this65._withBCFComponent(options,component,function(entity){return entity.visible=false;});});}}var view_setup_hints=bcfViewpoint.components.visibility.view_setup_hints;if(view_setup_hints){if(view_setup_hints.spaces_visible===false){scene.setObjectsVisible(viewer.metaScene.getObjectIDsByType("IfcSpace"),false);}if(view_setup_hints.openings_visible===false){scene.setObjectsVisible(viewer.metaScene.getObjectIDsByType("IfcOpening"),false);}if(view_setup_hints.space_boundaries_visible!==undefined);}}if(bcfViewpoint.components.selection){scene.setObjectsSelected(scene.selectedObjectIds,false);bcfViewpoint.components.selection.forEach(function(component){return _this65._withBCFComponent(options,component,function(entity){return entity.selected=true;});});}if(bcfViewpoint.components.coloring){bcfViewpoint.components.coloring.forEach(function(coloring){var color=coloring.color;var alpha=0;var alphaDefined=false;if(color.length===8){alpha=parseInt(color.substring(0,2),16)/256;if(alpha<=1.0&&alpha>=0.95){alpha=1.0;}color=color.substring(2);alphaDefined=true;}var colorize=[parseInt(color.substring(0,2),16)/256,parseInt(color.substring(2,4),16)/256,parseInt(color.substring(4,6),16)/256];coloring.components.map(function(component){return _this65._withBCFComponent(options,component,function(entity){entity.colorize=colorize;if(alphaDefined){if(alpha===0&&_this65.xrayAsZeroAlpha){var savedFromXeokit=component.originating_system===_this65.originatingSystem;if(savedFromXeokit){entity.xrayed=true;}else{entity.opacity=alpha;}}else{entity.opacity=alpha;}}});});});}}if(bcfViewpoint.perspective_camera||bcfViewpoint.orthogonal_camera){var eye;var look;var up;var projection;if(bcfViewpoint.perspective_camera){eye=xyzObjectToArray(bcfViewpoint.perspective_camera.camera_view_point,tempVec3$5);look=xyzObjectToArray(bcfViewpoint.perspective_camera.camera_direction,tempVec3$5);up=xyzObjectToArray(bcfViewpoint.perspective_camera.camera_up_vector,tempVec3$5);camera.perspective.fov=bcfViewpoint.perspective_camera.field_of_view;projection="perspective";}else{eye=xyzObjectToArray(bcfViewpoint.orthogonal_camera.camera_view_point,tempVec3$5);look=xyzObjectToArray(bcfViewpoint.orthogonal_camera.camera_direction,tempVec3$5);up=xyzObjectToArray(bcfViewpoint.orthogonal_camera.camera_up_vector,tempVec3$5);camera.ortho.scale=bcfViewpoint.orthogonal_camera.view_to_world_scale;projection="ortho";}math.subVec3(eye,realWorldOffset);if(camera.yUp){eye=ZToY(eye);look=ZToY(look);up=ZToY(up);}if(rayCast){var hit=scene.pick({pickSurface:true,// <<------ This causes picking to find the intersection point on the entity
|
|
13964
13979
|
origin:eye,direction:look});look=hit?hit.worldPos:math.addVec3(eye,look,tempVec3$5);}else{look=math.addVec3(eye,look,tempVec3$5);}if(immediate){camera.eye=eye;camera.look=look;camera.up=up;camera.projection=projection;}else{viewer.cameraFlight.flyTo({eye:eye,look:look,up:up,duration:options.duration,projection:projection});}}}},{key:"_withBCFComponent",value:function _withBCFComponent(options,component,callback){var viewer=this.viewer;var scene=viewer.scene;if(component.authoring_tool_id&&component.originating_system===this.originatingSystem){var id=component.authoring_tool_id;var entity=scene.objects[id];if(entity){callback(entity);return;}if(options.updateCompositeObjects){var metaObject=viewer.metaScene.metaObjects[id];if(metaObject){scene.withObjects(viewer.metaScene.getObjectIDsInSubtree(id),callback);return;}}}if(component.ifc_guid){var originalSystemId=component.ifc_guid;var _entity=scene.objects[originalSystemId];if(_entity){callback(_entity);return;}if(options.updateCompositeObjects){var _metaObject=viewer.metaScene.metaObjects[originalSystemId];if(_metaObject){scene.withObjects(viewer.metaScene.getObjectIDsInSubtree(originalSystemId),callback);return;}}Object.keys(scene.models).forEach(function(modelId){var id=math.globalizeObjectId(modelId,originalSystemId);var entity=scene.objects[id];if(entity){callback(entity);return;}if(options.updateCompositeObjects){var _metaObject2=viewer.metaScene.metaObjects[id];if(_metaObject2){scene.withObjects(viewer.metaScene.getObjectIDsInSubtree(id),callback);}}});}}/**
|
|
13965
13980
|
* Destroys this BCFViewpointsPlugin.
|
|
13966
13981
|
*/},{key:"destroy",value:function destroy(){_get(_getPrototypeOf(BCFViewpointsPlugin.prototype),"destroy",this).call(this);}}]);return BCFViewpointsPlugin;}(Plugin);function xyzArrayToObject(arr){return{"x":arr[0],"y":arr[1],"z":arr[2]};}function xyzObjectToArray(xyz,arry){arry=new Float64Array(3);arry[0]=xyz.x;arry[1]=xyz.y;arry[2]=xyz.z;return arry;}function YToZ(vec){return new Float64Array([vec[0],-vec[2],vec[1]]);}function ZToY(vec){return new Float64Array([vec[0],vec[2],-vec[1]]);}function colorizeToRGB(color){var rgb="";rgb+=Math.round(color[0]*255).toString(16).padStart(2,"0");rgb+=Math.round(color[1]*255).toString(16).padStart(2,"0");rgb+=Math.round(color[2]*255).toString(16).padStart(2,"0");return rgb;}var distVec3=math.vec3();var lengthWire=function lengthWire(x1,y1,x2,y2){var a=x1-x2;var b=y1-y2;return Math.sqrt(a*a+b*b);};/**
|