Esempio n. 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);
        }
    }
}
Esempio n. 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);
        }
    }
}
Esempio n. 3
0
// Returns the parent component for a component or a null pointer
// if there is no parent.
CTiglAbstractPhysicalComponent* CTiglUIDManager::GetParentComponent(const std::string& uid)
{
    CTiglAbstractPhysicalComponent* component = GetPhysicalComponent(uid);
    std::string parentUID = component->GetParentUID();
    return (parentUID.empty() ? 0 : GetPhysicalComponent(parentUID));
}