void OSGSceneFileType::registerEndNodeCallback(const FieldContainerType &type, 
                                               const Functor            &func)
{
    _endNodeFunctors.resize(type.getId() + 1, NULL);

    _endNodeFunctors[type.getId()] = func;
}
void RemoteAspect::registerChanged(const FieldContainerType &type,
                                   const Functor &func)
{
    while(type.getId() >= _changedFunctors.size())
    {
        _changedFunctors.push_back(&_defaultChangedFunction);
    }

    _changedFunctors[type.getId()] = func;
}
void AdapterDrawAction::registerLeaveDefault (const FieldContainerType &type, 
						  const Action::Functor &func )
{
    if ( ! _defaultLeaveFunctors )
        _defaultLeaveFunctors = new vector<Action::Functor>;

    while(type.getId() >= _defaultLeaveFunctors->size())
    {
        _defaultLeaveFunctors->push_back( 
                osgFunctionFunctor2(&Action::_defaultLeaveFunction));
    }
    
    (*_defaultLeaveFunctors)[ type.getId() ] = func;
}
void RemoteAspect::receiveNewType(Connection                &con,
                                  FieldContainerFactoryBase *fcFactory)
{
    UInt32      remoteTypeId = 0;
    UInt32      localTypeId  = 0;
    std::string typeName;

    con.getValue(remoteTypeId);
    con.getValue(typeName);

    FieldContainerType *fcType = fcFactory->findType(typeName.c_str());

    if(fcType != NULL)
    {
        localTypeId = fcType->getId();

        _localType[remoteTypeId] = localTypeId;
    }
    else
    {
        SWARNING << "Unrecognized remote type '" << typeName
                 << "' remote type id '" << remoteTypeId
                 << "'." << std::endl;
    }

#ifndef OSG_REMOTE_ASPECT_SILENT
    SLOG << "Receive NEWTYPE: type name '" << typeName
         << "' type id (r/l) '" << remoteTypeId
         << "/" << localTypeId << "'\n";
#endif
}
void IntersectAction::registerLeaveDefault(const FieldContainerType &type, 
                                           const Action::Functor    &func)
{
    if(! _defaultLeaveFunctors)
    {
        _defaultLeaveFunctors = new FunctorStore;

        addPostFactoryExitFunction(&IntersectAction::terminateLeave);
    }

    while(type.getId() >= _defaultLeaveFunctors->size())
    {
        _defaultLeaveFunctors->push_back(
            &IntersectAction::_defaultLeaveFunction);
    }
    
    (*_defaultLeaveFunctors)[type.getId()] = func;
}
void
AnimBindAction::registerLeaveDefault(const FieldContainerType &type,
                                     const Action::Functor    &func )
{
    if(_defaultLeaveFunctors == NULL)
    {
        _defaultLeaveFunctors = new FunctorStore;

        addPostFactoryExitFunction(&AnimBindAction::terminateLeave);
    }

    if(type.getId() >= _defaultLeaveFunctors->size())
    {
        _defaultLeaveFunctors->resize(type.getId() + 1,
                                      &AnimBindAction::_defaultLeaveFunction);
    }

    (*_defaultLeaveFunctors)[type.getId()] = func;
}
예제 #7
0
void ShadingAction::registerLeaveDefault(const FieldContainerType &type, 
                                         const Action::Functor    &func)
{
    if(_vDefaultLeaveFunctors == NULL)
    {
        _vDefaultLeaveFunctors = new std::vector<Action::Functor>;
    }

    while(type.getId() >= _vDefaultLeaveFunctors->size())
    {
        _vDefaultLeaveFunctors->push_back( 
            osgTypedFunctionFunctor2CPtrRef<
                ResultE, 
                CNodePtr,
                Action *                   >(&Action::_defaultLeaveFunction));
    }
    
    (*_vDefaultLeaveFunctors)[type.getId()] = func;
}
void RenderAction::registerLeaveDefault(
    const FieldContainerType &type,
    const Action::Functor    &func)
{
    if(_vDefaultLeaveFunctors == NULL)
    {
        _vDefaultLeaveFunctors = new Action::FunctorStore;

        addPostFactoryExitFunction(&RenderAction::terminateLeave);
    }

    while(type.getId() >= _vDefaultLeaveFunctors->size())
    {
        _vDefaultLeaveFunctors->push_back(&Action::_defaultLeaveFunction);
    }

    FDEBUG_GV(("Register rendertrav leave for %s\n", type.getCName()));

    (*_vDefaultLeaveFunctors)[type.getId()] = func;
}
예제 #9
0
QOSGWidgetFactory::FieldEditorCF
QOSGWidgetFactory::getFieldEditor(const FieldContainerType &fcType,
                                  const FieldType          &fType,
                                  const Char8              *fName    )
{
    UInt32           fcTypeId = fcType.getId(                 );
    UInt32           fTypeId  = fType .getId(                 );
    UInt64           index    = getIndex    (fcTypeId, fTypeId);

    return getFieldEditor(index, fName, fType.getCardinality());
}
예제 #10
0
void
QOSGWidgetFactory::registerFieldEditor(const FieldContainerType &fcType,
                                       const FieldType          &fType,
                                       const Char8              *fName,
                                             FieldEditorCF       cFunc    )
{
    UInt32           fcTypeId = fcType.getId(                 );
    UInt32           fTypeId  = fType .getId(                 );
    UInt64           index    = getIndex    (fcTypeId, fTypeId);

    registerFieldEditor(index, fName, cFunc);
}
void SharePtrGraphOp::setExcludes(const std::string &excludes)
{
    _excludeSet.clear();

    // parse comma separated names.
    std::string::const_iterator nextComma;
    std::string::const_iterator curPos     = excludes.begin();

    while(curPos < excludes.end())
    {
        nextComma = std::find(curPos, excludes.end(), ',');
        // strip leading spaces
        curPos = std::find_if(curPos, nextComma,
                              std::not1(std::ptr_fun(isspace)));

        std::string typeName(curPos, nextComma);

        FieldContainerType *fcType =
            FieldContainerFactory::the()->findType(typeName.c_str());

        if(fcType != NULL)
        {
            _excludeSet.insert(fcType->getId());
        }
        else
        {
            SWARNING << "SharePtrGraphOp::setExcludes: Unrecognized type ["
                    << typeName << "]." << std::endl;
        }

        if(nextComma != excludes.end())
            ++nextComma;

        curPos = nextComma;
    }
}
예제 #12
0
bool FieldContainerFactory::initializePendingTypes(void)
{
    bool                returnValue = true;
    FieldContainerType *pType       = NULL;

    if(_bInitialized == false)
        return false;

    SINFO << "OSGFieldContainerFactory init pending types" << std::endl;

    if(_pUnitTypesStore != NULL)
    {
        if(_pMapLock != NULL)
            _pMapLock->aquire();

        UninitTypeStoreIt uninitIt = _pUnitTypesStore->begin();

        while(uninitIt != _pUnitTypesStore->end())
        {
            pType = *uninitIt;

            if(pType->isInitialized() == true)
            {
                uninitIt = _pUnitTypesStore->erase(uninitIt);

//                (*_pTypeIdMap  )[pType->getId()                 ] = pType;

                TypeIdMap::value_type val(pType->getId(), pType);

                _pTypeIdMap->insert(val);

                (*_pTypeNameMap)[IDStringLink(pType->getCName())] = pType;
            }
            else
            {
                if(pType->initialize() == true)
                {
                    uninitIt = _pUnitTypesStore->erase(uninitIt);

//                  (*_pTypeIdMap  )[pType->getId()                 ] = pType;

                    TypeIdMap::value_type val(pType->getId(), pType);
                    
                    _pTypeIdMap->insert(val);

                    (*_pTypeNameMap)[IDStringLink(pType->getCName())] = pType;
                }
                else
                {
                    returnValue = false;

                    uninitIt++;
                }
            }
        }

        if(_pMapLock != NULL)
            _pMapLock->release();

        PINFO << "("
                 << returnValue
                 << "|"
                 << _pUnitTypesStore->size()
                 << ")"
                 << std::endl;
    }

    return returnValue;
}