Skip to content

Commit

Permalink
rebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
xeolabs committed Dec 11, 2024
1 parent 14b7b83 commit ea03874
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 28 deletions.
42 changes: 33 additions & 9 deletions dist/xeokit-sdk.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -90756,7 +90756,7 @@ class FastNavPlugin extends Plugin {
this._hideEdges = cfg.hideEdges !== false;
this._hideTransparentObjects = !!cfg.hideTransparentObjects;
this._scaleCanvasResolution = !!cfg.scaleCanvasResolution;
this._defaultScaleCanvasResolutionFactor = cfg.defaultScaleCanvasResolutionFactor || 1.0;
this._defaultScaleCanvasResolutionFactor = cfg.defaultScaleCanvasResolutionFactor;
this._scaleCanvasResolutionFactor = cfg.scaleCanvasResolutionFactor || 0.6;
this._delayBeforeRestore = (cfg.delayBeforeRestore !== false);
this._delayBeforeRestoreSeconds = cfg.delayBeforeRestoreSeconds || 0.5;
Expand All @@ -90772,6 +90772,7 @@ class FastNavPlugin extends Plugin {
viewer.scene._renderer.setSAOEnabled(!this._hideSAO);
viewer.scene._renderer.setTransparentEnabled(!this._hideTransparentObjects);
viewer.scene._renderer.setEdgesEnabled(!this._hideEdges);
this._originalCanvasResolutionScale = viewer.scene.canvas.resolutionScale;
if (this._scaleCanvasResolution) {
viewer.scene.canvas.resolutionScale = this._scaleCanvasResolutionFactor;
} else {
Expand All @@ -90782,7 +90783,7 @@ class FastNavPlugin extends Plugin {
};

const switchToHighQuality = () => {
viewer.scene.canvas.resolutionScale = this._defaultScaleCanvasResolutionFactor;
viewer.scene.canvas.resolutionScale = this._defaultScaleCanvasResolutionFactor || this._originalCanvasResolutionScale || 1.0;
viewer.scene._renderer.setEdgesEnabled(true);
viewer.scene._renderer.setColorTextureEnabled(true);
viewer.scene._renderer.setPBREnabled(true);
Expand Down Expand Up @@ -90987,7 +90988,7 @@ class FastNavPlugin extends Plugin {
* @param {Number} defaultScaleCanvasResolutionFactor Factor by scale canvas resolution when we stop interacting with the viewer.
*/
set defaultScaleCanvasResolutionFactor(defaultScaleCanvasResolutionFactor) {
this._defaultScaleCanvasResolutionFactor = defaultScaleCanvasResolutionFactor || 1.0;
this._defaultScaleCanvasResolutionFactor = defaultScaleCanvasResolutionFactor;
}

/**
Expand Down Expand Up @@ -126544,6 +126545,7 @@ class TreeViewPlugin extends Plugin {
* @param {Boolean} [cfg.pruneEmptyNodes=true] When true, will not contain nodes that don't have content in the {@link Scene}. These are nodes whose {@link MetaObject}s don't have {@link Entity}s.
* @param {RenderService} [cfg.renderService] Optional {@link RenderService} to use. Defaults to the {@link TreeViewPlugin}'s default {@link RenderService}.
* @param {Boolean} [cfg.showIndeterminate=false] When true, will show indeterminate state for checkboxes when some but not all child nodes are checked
* @param {Boolean} [cfg.showProjectNode=false] When true, will show top level project node when hierarchy is set to "storeys"
*/
constructor(viewer, cfg = {}) {

Expand Down Expand Up @@ -126596,6 +126598,7 @@ class TreeViewPlugin extends Plugin {
this._showListItemElementId = null;
this._renderService = cfg.renderService || new RenderService();
this._showIndeterminate = cfg.showIndeterminate ?? false;
this._showProjectNode = cfg.showProjectNode ?? false;

if (!this._renderService) {
throw new Error('TreeViewPlugin: no render service set');
Expand Down Expand Up @@ -127150,32 +127153,53 @@ class TreeViewPlugin extends Plugin {
_createStoreysNodes() {
const rootMetaObjects = this._viewer.metaScene.rootMetaObjects;
for (let id in rootMetaObjects) {
this._createStoreysNodes2(rootMetaObjects[id], null, null, null);
this._createStoreysNodes2(rootMetaObjects[id], null, null, null, null);
}
}

_createStoreysNodes2(metaObject, buildingNode, storeyNode, typeNodes) {
_createStoreysNodes2(metaObject, projectNode, buildingNode, storeyNode, typeNodes) {
if (this._pruneEmptyNodes && (metaObject._countEntities === 0)) {
return;
}
const metaObjectType = metaObject.type;
const metaObjectName = metaObject.name;
const children = metaObject.children;
const objectId = metaObject.id;
if (metaObjectType === "IfcBuilding") {

if (this._showProjectNode && metaObjectType === 'IfcProject') {
projectNode = {
nodeId: `${this._id}-${objectId}`,
objectId,
title: (metaObject.metaModels.length === 0) ? metaObjectName : this._rootNames[metaObject.metaModels[0].id] || ((metaObjectName && metaObjectName !== "" && metaObjectName !== "Undefined" && metaObjectName !== "Default") ? metaObjectName : metaObjectType),
type: metaObjectType,
parent: null,
numEntities: 0,
numVisibleEntities: 0,
checked: false,
xrayed: false,
children: [],
};
this._rootNodes.push(projectNode);
this._objectNodes[projectNode.objectId] = projectNode;
this._nodeNodes[projectNode.nodeId] = projectNode;
} else if (metaObjectType === "IfcBuilding") {
buildingNode = {
nodeId: `${this._id}-${objectId}`,
objectId: objectId,
title: (metaObject.metaModels.length === 0) ? metaObjectName : this._rootNames[metaObject.metaModels[0].id] || ((metaObjectName && metaObjectName !== "" && metaObjectName !== "Undefined" && metaObjectName !== "Default") ? metaObjectName : metaObjectType),
type: metaObjectType,
parent: null,
parent: projectNode,
numEntities: 0,
numVisibleEntities: 0,
checked: false,
xrayed: false,
children: []
};
this._rootNodes.push(buildingNode);
if (projectNode) {
projectNode.children.push(buildingNode);
} else {
this._rootNodes.push(buildingNode);
}
this._objectNodes[buildingNode.objectId] = buildingNode;
this._nodeNodes[buildingNode.nodeId] = buildingNode;
} else if (metaObjectType === "IfcBuildingStorey") {
Expand Down Expand Up @@ -127245,7 +127269,7 @@ class TreeViewPlugin extends Plugin {
if (children) {
for (let i = 0, len = children.length; i < len; i++) {
const childMetaObject = children[i];
this._createStoreysNodes2(childMetaObject, buildingNode, storeyNode, typeNodes);
this._createStoreysNodes2(childMetaObject, projectNode, buildingNode, storeyNode, typeNodes);
}
}
}
Expand Down
42 changes: 33 additions & 9 deletions dist/xeokit-sdk.es.js
Original file line number Diff line number Diff line change
Expand Up @@ -90752,7 +90752,7 @@ class FastNavPlugin extends Plugin {
this._hideEdges = cfg.hideEdges !== false;
this._hideTransparentObjects = !!cfg.hideTransparentObjects;
this._scaleCanvasResolution = !!cfg.scaleCanvasResolution;
this._defaultScaleCanvasResolutionFactor = cfg.defaultScaleCanvasResolutionFactor || 1.0;
this._defaultScaleCanvasResolutionFactor = cfg.defaultScaleCanvasResolutionFactor;
this._scaleCanvasResolutionFactor = cfg.scaleCanvasResolutionFactor || 0.6;
this._delayBeforeRestore = (cfg.delayBeforeRestore !== false);
this._delayBeforeRestoreSeconds = cfg.delayBeforeRestoreSeconds || 0.5;
Expand All @@ -90768,6 +90768,7 @@ class FastNavPlugin extends Plugin {
viewer.scene._renderer.setSAOEnabled(!this._hideSAO);
viewer.scene._renderer.setTransparentEnabled(!this._hideTransparentObjects);
viewer.scene._renderer.setEdgesEnabled(!this._hideEdges);
this._originalCanvasResolutionScale = viewer.scene.canvas.resolutionScale;
if (this._scaleCanvasResolution) {
viewer.scene.canvas.resolutionScale = this._scaleCanvasResolutionFactor;
} else {
Expand All @@ -90778,7 +90779,7 @@ class FastNavPlugin extends Plugin {
};

const switchToHighQuality = () => {
viewer.scene.canvas.resolutionScale = this._defaultScaleCanvasResolutionFactor;
viewer.scene.canvas.resolutionScale = this._defaultScaleCanvasResolutionFactor || this._originalCanvasResolutionScale || 1.0;
viewer.scene._renderer.setEdgesEnabled(true);
viewer.scene._renderer.setColorTextureEnabled(true);
viewer.scene._renderer.setPBREnabled(true);
Expand Down Expand Up @@ -90983,7 +90984,7 @@ class FastNavPlugin extends Plugin {
* @param {Number} defaultScaleCanvasResolutionFactor Factor by scale canvas resolution when we stop interacting with the viewer.
*/
set defaultScaleCanvasResolutionFactor(defaultScaleCanvasResolutionFactor) {
this._defaultScaleCanvasResolutionFactor = defaultScaleCanvasResolutionFactor || 1.0;
this._defaultScaleCanvasResolutionFactor = defaultScaleCanvasResolutionFactor;
}

/**
Expand Down Expand Up @@ -126540,6 +126541,7 @@ class TreeViewPlugin extends Plugin {
* @param {Boolean} [cfg.pruneEmptyNodes=true] When true, will not contain nodes that don't have content in the {@link Scene}. These are nodes whose {@link MetaObject}s don't have {@link Entity}s.
* @param {RenderService} [cfg.renderService] Optional {@link RenderService} to use. Defaults to the {@link TreeViewPlugin}'s default {@link RenderService}.
* @param {Boolean} [cfg.showIndeterminate=false] When true, will show indeterminate state for checkboxes when some but not all child nodes are checked
* @param {Boolean} [cfg.showProjectNode=false] When true, will show top level project node when hierarchy is set to "storeys"
*/
constructor(viewer, cfg = {}) {

Expand Down Expand Up @@ -126592,6 +126594,7 @@ class TreeViewPlugin extends Plugin {
this._showListItemElementId = null;
this._renderService = cfg.renderService || new RenderService();
this._showIndeterminate = cfg.showIndeterminate ?? false;
this._showProjectNode = cfg.showProjectNode ?? false;

if (!this._renderService) {
throw new Error('TreeViewPlugin: no render service set');
Expand Down Expand Up @@ -127146,32 +127149,53 @@ class TreeViewPlugin extends Plugin {
_createStoreysNodes() {
const rootMetaObjects = this._viewer.metaScene.rootMetaObjects;
for (let id in rootMetaObjects) {
this._createStoreysNodes2(rootMetaObjects[id], null, null, null);
this._createStoreysNodes2(rootMetaObjects[id], null, null, null, null);
}
}

_createStoreysNodes2(metaObject, buildingNode, storeyNode, typeNodes) {
_createStoreysNodes2(metaObject, projectNode, buildingNode, storeyNode, typeNodes) {
if (this._pruneEmptyNodes && (metaObject._countEntities === 0)) {
return;
}
const metaObjectType = metaObject.type;
const metaObjectName = metaObject.name;
const children = metaObject.children;
const objectId = metaObject.id;
if (metaObjectType === "IfcBuilding") {

if (this._showProjectNode && metaObjectType === 'IfcProject') {
projectNode = {
nodeId: `${this._id}-${objectId}`,
objectId,
title: (metaObject.metaModels.length === 0) ? metaObjectName : this._rootNames[metaObject.metaModels[0].id] || ((metaObjectName && metaObjectName !== "" && metaObjectName !== "Undefined" && metaObjectName !== "Default") ? metaObjectName : metaObjectType),
type: metaObjectType,
parent: null,
numEntities: 0,
numVisibleEntities: 0,
checked: false,
xrayed: false,
children: [],
};
this._rootNodes.push(projectNode);
this._objectNodes[projectNode.objectId] = projectNode;
this._nodeNodes[projectNode.nodeId] = projectNode;
} else if (metaObjectType === "IfcBuilding") {
buildingNode = {
nodeId: `${this._id}-${objectId}`,
objectId: objectId,
title: (metaObject.metaModels.length === 0) ? metaObjectName : this._rootNames[metaObject.metaModels[0].id] || ((metaObjectName && metaObjectName !== "" && metaObjectName !== "Undefined" && metaObjectName !== "Default") ? metaObjectName : metaObjectType),
type: metaObjectType,
parent: null,
parent: projectNode,
numEntities: 0,
numVisibleEntities: 0,
checked: false,
xrayed: false,
children: []
};
this._rootNodes.push(buildingNode);
if (projectNode) {
projectNode.children.push(buildingNode);
} else {
this._rootNodes.push(buildingNode);
}
this._objectNodes[buildingNode.objectId] = buildingNode;
this._nodeNodes[buildingNode.nodeId] = buildingNode;
} else if (metaObjectType === "IfcBuildingStorey") {
Expand Down Expand Up @@ -127241,7 +127265,7 @@ class TreeViewPlugin extends Plugin {
if (children) {
for (let i = 0, len = children.length; i < len; i++) {
const childMetaObject = children[i];
this._createStoreysNodes2(childMetaObject, buildingNode, storeyNode, typeNodes);
this._createStoreysNodes2(childMetaObject, projectNode, buildingNode, storeyNode, typeNodes);
}
}
}
Expand Down
Loading

0 comments on commit ea03874

Please sign in to comment.