Beispiel #1
0
// Builds the parent child relationships.
void CTiglUIDManager::BuildParentChildTree(void)
{
    UIDStoreContainerType::iterator pIter;

    for (pIter = physicalShapes.begin(); pIter != physicalShapes.end(); ++pIter) {
        CTiglAbstractPhysicalComponent* component = pIter->second;
        if (!component->GetParentUID().empty()) {
            CTiglAbstractPhysicalComponent* parent = GetPhysicalComponent(component->GetParentUID());
            parent->AddChild(component);
        }
    }
}
Beispiel #2
0
// Builds the parent child relationships.
void CTiglUIDManager::BuildParentChildTree(void)
{
    // root component must be set manually, error if not
    if (!rootComponent) {
        throw CTiglError("CTiglUIDManager::BuildParentChildTree(); no root component set!");
    }

    UIDStoreContainerType::iterator pIter;

    for (pIter = physicalShapes.begin(); pIter != physicalShapes.end(); ++pIter) {
        CTiglAbstractPhysicalComponent* component = pIter->second;

        // TODO: when this method is called more than once the components will be added 
        //       multiple times as childs
        if (!component->GetParentUID().empty() && component->GetParentUID() != rootComponent->GetUID()) {
            CTiglAbstractPhysicalComponent* parent = GetPhysicalComponent(component->GetParentUID());
            parent->AddChild(component);
        }
        else {
            rootComponent->AddChild(component);
        }
    }
}