ThatOpen / engine_fragment

https://ifcjs.github.io/fragment/example
MIT License
61 stars 24 forks source link

FragmentMap and FragmentIdMap #19

Closed yamasaki-kenjiro closed 11 months ago

yamasaki-kenjiro commented 1 year ago

Describe the bug 📝

FragmentGroup.getFragmentMap returns "FragmentMap", but APIs such as OBC.Highlighter.highlightByID requests "FragmentIdMap". Therefore, I need to write the following conversion code myself. I think this is a bug because "FragmentMap" and "FragmentIdMap" are the same concept.

const item: any = OBC.IfcPropertiesUtils.findItemByGuid(this.groups[0].properties!, guid);
const expressID = item.expressID as number;
const found = this.groups[0].getFragmentMap([expressID]);
const result: OBC.FragmentIdMap = {};
for (const fragmentId in found) {
    const expressIds = new Set<string>();
    const expressIdsInNumber = found[fragmentId];
    for (const expressIdInNumber of expressIdsInNumber) {
        expressIds.add(expressIdInNumber.toString());
    }
    result[fragmentId] = expressIds;
}

this.highlighter.highlightByID('default', result);

Reproduction ▶️

No response

Steps to reproduce 🔢

No response

System Info 💻

System:
    OS: Windows 10 10.0.19045
    CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz
    Memory: 5.58 GB / 15.75 GB
  Binaries:
    Node: 16.20.1 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 9.7.2 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.19041.1266.0), Chromium (117.0.2045.43)
    Internet Explorer: 11.0.19041.1566
  npmPackages:
    openbim-components: ^1.1.0 => 1.1.0

Used Package Manager 📦

npm

Error Trace/Logs 📃

No response

Validations ✅

HoyosJuan commented 11 months ago

I will do the following with this issue:

  1. As a quick solution, I will better update FragmentMap from bim-fragment to be a set of strings rather than a set of numbers to match the existing type in openbim-components. The reason is because less needs to be changed this way as opposed to updating the type in openbim-components to be a set of numbers.
  2. As a result of the first point, I will transfer this issue to fragment.
  3. Later on, I guess will be better to change everything to be a set of numbers as it can lower the memory needed.
HoyosJuan commented 11 months ago

This was solved in PR https://github.com/IFCjs/fragment/pull/20.