MCPcopy Create free account
hub / github.com/ThatOpen/engine_web-ifc / GetInversePropertyForItem

Function GetInversePropertyForItem

src/cpp/wasm/web-ifc-wasm.cpp:358–403  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

356}
357
358std::vector<uint32_t> GetInversePropertyForItem(uint32_t modelID, uint32_t expressID, emscripten::val targetTypes, uint32_t position, bool set)
359{
360 if (!manager.IsModelOpen(modelID))
361 return {};
362 auto loader = manager.GetIfcLoader(modelID);
363 std::vector<uint32_t> inverseIDs;
364 auto expressIDs = GetLineIDsWithType(modelID, targetTypes);
365 for (auto foundExpressID : expressIDs)
366 {
367 loader->MoveToLineArgument(foundExpressID, position);
368
369 webifc::parsing::IfcTokenType t = loader->GetTokenType();
370 if (t == webifc::parsing::IfcTokenType::REF)
371 {
372 loader->StepBack();
373 uint32_t val = loader->GetRefArgument();
374 if (val == expressID)
375 {
376 inverseIDs.push_back(foundExpressID);
377 if (!set)
378 return inverseIDs;
379 }
380 }
381 else if (t == webifc::parsing::IfcTokenType::SET_BEGIN)
382 {
383 while (!loader->IsAtEnd())
384 {
385 webifc::parsing::IfcTokenType setValueType = loader->GetTokenType();
386 if (setValueType == webifc::parsing::IfcTokenType::SET_END)
387 break;
388 if (setValueType == webifc::parsing::IfcTokenType::REF)
389 {
390 loader->StepBack();
391 uint32_t val = loader->GetRefArgument();
392 if (val == expressID)
393 {
394 inverseIDs.push_back(foundExpressID);
395 if (!set)
396 return inverseIDs;
397 }
398 }
399 }
400 }
401 }
402 return inverseIDs;
403}
404
405bool ValidateExpressID(uint32_t modelID, uint32_t expressId)
406{

Callers

nothing calls this directly

Calls 8

GetLineIDsWithTypeFunction · 0.85
GetIfcLoaderMethod · 0.80
MoveToLineArgumentMethod · 0.80
GetTokenTypeMethod · 0.80
StepBackMethod · 0.80
GetRefArgumentMethod · 0.80
IsModelOpenMethod · 0.45
IsAtEndMethod · 0.45

Tested by

no test coverage detected