Skip to content

Commit

Permalink
Implement BCF coloring in setViewpoint
Browse files Browse the repository at this point in the history
See #328
  • Loading branch information
Amoki authored Jun 8, 2020
1 parent f7b8bbe commit 0dd5efd
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/plugins/BCFViewpointsPlugin/BCFViewpointsPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -494,12 +494,32 @@ class BCFViewpointsPlugin extends Plugin {
}
}


if (bcfViewpoint.components.selection) {
scene.setObjectsSelected(scene.selectedObjectIds, false);
Object.keys(scene.models).forEach(() => {
bcfViewpoint.components.selection.forEach(x => scene.setObjectsSelected(x.ifc_guid, true));
});
}

if (bcfViewpoint.components.coloring) {
bcfViewpoint.components.coloring.forEach(coloring => {
let uuids = coloring.components.map(component => component.ifc_guid);
let color = coloring.color;
if (color.length === 8) {
// There is an alpha color
let alpha = parseInt(color.substring(0, 2), 16) / 256;
color = color.substring(2);
scene.setObjectsOpacity(uuids, alpha);
}
let colorArray = [
parseInt(color.substring(0, 2), 16),
parseInt(color.substring(2, 4), 16),
parseInt(color.substring(4, 6), 16)
]
scene.setObjectsColorized(uuids, colorArray);
})
}
}

if (bcfViewpoint.perspective_camera || bcfViewpoint.orthogonal_camera) {
Expand Down

0 comments on commit 0dd5efd

Please sign in to comment.