Esempio n. 1
0
void Node::updateVolume(void)
{
    // still valid or static, nothing to do
    if(_sfVolume.getValue().isValid () == true   ||
       _sfVolume.getValue().isStatic() == true   ||
       getTravMask()                   == 0x0000   )
    {
        return;
    }

    // be careful to not change the real volume. If two threads
    // are updating the same aspect this will lead to chaos

    BoxVolume vol = _sfVolume.getValue();

    MFUnrecChildNodePtr::const_iterator cIt  = 
        this->getMFChildren()->begin();
    MFUnrecChildNodePtr::const_iterator cEnd = 
        this->getMFChildren()->end();

    vol.setEmpty();

    for(; cIt != cEnd; ++cIt)
    {
        if(*cIt != NULL && (*cIt)->getTravMask())
        {
            (*cIt)->updateVolume();
            vol.extendBy((*cIt)->getVolume());
        }
    }

    // test for null core. Shouldn't happen, but just in case...
    if(getCore() != NULL)
    {
        getCore()->adjustVolume(vol);
    }

    // don't propagate the static flag from children
    vol.setStatic(false);

    editSField(VolumeFieldMask);

    _sfVolume.setValue(vol);
}