• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ SceneFileType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中SceneFileType的典型用法代码示例。如果您正苦于以下问题:C++ SceneFileType类的具体用法?C++ SceneFileType怎么用?C++ SceneFileType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了SceneFileType类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: print

void SceneFileHandlerBase::print (void )
{
    FileTypeMap::iterator sI;

    for(sI = _suffixTypeMap.begin(); sI != _suffixTypeMap.end(); sI++)
    {
        std::string    rw;
        SceneFileType *type = sI->second->front();

        if((type->getFlags() & SceneFileType::OSG_READ_SUPPORTED) &&
           (type->getFlags() & SceneFileType::OSG_WRITE_SUPPORTED))
        {
            rw = "reader and writer";
        }
        else
        {
            if(type->getFlags() & SceneFileType::OSG_READ_SUPPORTED)
                rw = "reader";

            if(type->getFlags() & SceneFileType::OSG_WRITE_SUPPORTED)
                rw = "writer";
        }

        std::cerr << "suffix: " << sI->first.c_str()
                  << ", type: " << sI->second->front()->getName()
                  << " "        << rw
                  << std::endl;
    }
}
开发者ID:jondo2010,项目名称:OpenSG,代码行数:29,代码来源:OSGSceneFileHandler.cpp


示例2: subSceneFileType

bool SceneFileHandler::subSceneFileType(SceneFileType &fileType)
{
    bool retCode = false;

    std::list<IDString>::iterator sI;
    FileTypeMap   ::iterator smI;

    IDString suffix;

    for(  sI  = fileType.suffixList().begin();
            sI != fileType.suffixList().end();
            ++sI)
    {
        suffix.set(sI->str());
        suffix.toLower();

        smI = the()._suffixTypeMap.find(suffix);
        if (smI != the()._suffixTypeMap.end())
        {
            the()._suffixTypeMap.erase(smI);
            retCode = true;
        }
    }
    return retCode;
}
开发者ID:,项目名称:,代码行数:25,代码来源:


示例3: subSceneFileType

bool SceneFileHandlerBase::subSceneFileType(SceneFileType &fileType)
{
    bool retCode = false;

    std::list<std::string>::iterator sI;
         FileTypeMap      ::iterator smI;

    std::string suffix;

    for(  sI  = fileType.suffixList().begin();
          sI != fileType.suffixList().end();
        ++sI)
    {
        suffix.assign(sI->c_str());
        //suffix.toLower();
        std::transform(suffix.begin(), suffix.end(), suffix.begin(), ::tolower);
        smI = _suffixTypeMap.find(suffix);

        if (smI != _suffixTypeMap.end())
        {
            _suffixTypeMap.erase(smI);
            retCode = true;
        }
    }
    return retCode;
}
开发者ID:jondo2010,项目名称:OpenSG,代码行数:26,代码来源:OSGSceneFileHandler.cpp


示例4: getFileType

void SceneFileHandlerBase::popOptions(const std::string &suffix)
{
    SceneFileType *type   = getFileType(suffix.c_str());

    if(type != NULL)
    {
        type->popOptions();
    }
}
开发者ID:jondo2010,项目名称:OpenSG,代码行数:9,代码来源:OSGSceneFileHandler.cpp


示例5: getFileType

const Char8 *SceneFileHandler::getOptions(const Char8 *suffix)
{
    if(suffix == NULL)
        return NULL;

    SceneFileType *type = getFileType(suffix);

    if(type == NULL)
        return NULL;

    return type->getOptions();
}
开发者ID:,项目名称:,代码行数:12,代码来源:


示例6: getSuffixList

Int32 SceneFileHandler::getSuffixList(std::list<const Char8 *> & suffixList,
                                      UInt32 flags)
{
    Int32                 count = 0;
    FileTypeMap::iterator sI;

    suffixList.clear();

    for ( sI = _suffixTypeMap.begin(); sI != _suffixTypeMap.end(); ++sI)
    {
        SceneFileType *type = sI->second->front();
        if((type->getFlags() & flags) == flags)
        {
            suffixList.push_back(sI->first.str());
            count++;
        }
    }

    return count;
}
开发者ID:,项目名称:,代码行数:20,代码来源:


示例7: returnValue

NodeTransitPtr SceneFileHandlerBase::read(const Char8      *fileName,
                                                GraphOpSeq *graphOpSeq,       
                                                Resolver    resolver,
                                                bool        bWarnNotFound )
{
    NodeTransitPtr returnValue(NULL);

    if(fileName == NULL)
    {
        SWARNING << "cannot read NULL file" << std::endl;
        return NodeTransitPtr(NULL);
    }

    std::string fullFilePath = initPathHandler(fileName);

    if(fullFilePath.empty() == true)
    {
        if(_readFP != NULL)
        {
            // that's a fallback could be a url so the callback
            // can handle this correctly.
            SceneFileType *type = getFileType(fileName);
            if(type != NULL)
            {
                // create a dummy stream with the bad flag set.
                std::ifstream in;
                in.setstate(std::ios::badbit);
                returnValue = _readFP(type, in, fileName);
            }
            else
            {
                if(bWarnNotFound == true)
                    SWARNING << "Couldn't open file " << fileName << std::endl;
            }
        }
        else
        {
            if(bWarnNotFound == true)
                SWARNING << "Couldn't open file " << fileName << std::endl;
        }

        commitChanges();

        return returnValue;
    }


    SceneFileType *type  = getFileType(fullFilePath.c_str());
    NodeUnrecPtr   scene = NULL;

    if(type != NULL)
    {
        triggerReadBegin(fullFilePath.c_str());
        updateReadProgress(0);

        SINFO << "try to read " << fullFilePath
              << " as "         << type->getName() << std::endl;

        std::ifstream in(fullFilePath.c_str(), std::ios::binary);

        if(in)
        {
            scene = read(in, fullFilePath.c_str(), graphOpSeq);

            in.close();

            if(scene != NULL)
            {
                triggerReadEnd(fullFilePath.c_str());

                FileContextAttachmentUnrecPtr pFContext = 
                    dynamic_cast<FileContextAttachment *>(
                        scene->findAttachment(
                            FileContextAttachment::getClassGroupId()));

                if(pFContext == NULL)
                {
                    pFContext = FileContextAttachment::create();

                    pFContext->setResolvedName(fullFilePath);

                    scene->addAttachment(pFContext);
                }
            }
        }
        else
        {
            if(bWarnNotFound == true)
            {
                SWARNING << "Couldn't open input stream for file "
                         << fullFilePath
                         << std::endl;
            }
        }

#ifndef OSG_DISABLE_DEPRECATED

        // Ok stream interface didn't work try via filename
        if(scene == NULL)
            scene = type->readFile(fullFilePath.c_str());
//.........这里部分代码省略.........
开发者ID:jondo2010,项目名称:OpenSG,代码行数:101,代码来源:OSGSceneFileHandler.cpp


示例8: addSceneFileType

bool SceneFileHandlerBase::addSceneFileType(SceneFileType &fileType)
{
    bool retCode = false;

    std::list<std::string>::iterator sI;
         FileTypeMap      ::iterator smI;

    std::string suffix;

    for(  sI  = fileType.suffixList().begin();
          sI != fileType.suffixList().end();
        ++sI)
    {
        suffix.assign (sI->c_str());
//        suffix.toLower();
        std::transform(suffix.begin(), suffix.end(), suffix.begin(), ::tolower);

        smI = _suffixTypeMap.find(suffix);

        if (smI != _suffixTypeMap.end())
        {
            if(fileType.doOverride() == true)
            {
                FindOverride           overrideFinder;
                FileTypeList::iterator lIt;

                overrideFinder.uiRefPriority = fileType.getOverridePriority();

                lIt = std::find_if(_suffixTypeMap[suffix]->begin(),
                                   _suffixTypeMap[suffix]->end  (),
                                   overrideFinder);

                _suffixTypeMap[suffix]->insert(lIt, &fileType);

                SWARNING << "Added an file type with suffix "
                         << suffix
                         << " overriding "
                         << std::endl;
            }
            else
            {
                _suffixTypeMap[suffix]->push_back(&fileType);

                SWARNING << "Added an file type with suffix "
                         << suffix
                         << " non overriding at the end of the list"
                         << std::endl;
            }
        }
        else
        {
            FileTypeList *pTmpList = new FileTypeList;

            pTmpList->push_back(&fileType);

            _suffixTypeMap[suffix] = pTmpList;

            retCode = true;
        }
    }

    return retCode;
}
开发者ID:jondo2010,项目名称:OpenSG,代码行数:63,代码来源:OSGSceneFileHandler.cpp


示例9: initPathHandler

NodePtr SceneFileHandler::read(const  Char8  *fileName,
                               GraphOpSeq *graphOpSeq)
{
    if(!fileName)
    {
        SWARNING << "cannot read NULL file" << std::endl;
        return NullFC;
    }

    std::string fullFilePath = initPathHandler(fileName);
    if(fullFilePath.empty())
    {
        if(_readFP != NULL)
        {
            // that's a fallback could be a url so the callback
            // can handle this correctly.
            SceneFileType *type = getFileType(fileName);
            if(type != NULL)
            {
                // create a dummy stream with the bad flag set.
                std::ifstream in;
                in.setstate(std::ios::badbit);
                return _readFP(type, in, fileName);
            }
            else
            {
                SWARNING << "Couldn't open file " << fileName << std::endl;
                return NullFC;
            }
        }
        else
        {
            SWARNING << "Couldn't open file " << fileName << std::endl;
            return NullFC;
        }
    }

    SceneFileType *type = getFileType(fullFilePath.c_str());
    NodePtr scene = NullFC;

    if (type)
    {
        triggerReadBegin(fullFilePath.c_str());
        updateReadProgress(0);

        SINFO << "try to read " << fullFilePath
              << " as "         << type->getName() << std::endl;

        std::ifstream in(fullFilePath.c_str(), std::ios::binary);

        if(in)
        {
            scene = read(in, fullFilePath.c_str(), graphOpSeq);
            in.close();

            if(scene != NullFC)
            {
                triggerReadEnd(fullFilePath.c_str());
                return scene;
            }
        }
        else
        {
            SWARNING << "Couldn't open input stream for file " << fullFilePath << std::endl;
        }



#ifndef OSG_DISABLE_DEPRECATED
        // Ok stream interface didn't work try via filename
        if(scene == NullFC)
            scene = type->readFile(fullFilePath.c_str());

        if (scene != NullFC)
        {
            if(graphOpSeq != NULL)
                graphOpSeq->run(scene);

            SINFO    << "read ok:"        << std::endl;
        }
        else
        {
            SWARNING << "could not read " << std::endl;
        }
#endif
    }
    else
    {
        SWARNING << "could not read "       << fullFilePath
                 << "; unknown file format" << std::endl;
    }

    return scene;
}
开发者ID:,项目名称:,代码行数:94,代码来源:



注:本文中的SceneFileType类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ SceneGraph类代码示例发布时间:2022-05-31
下一篇:
C++ SceneEditorScreenMain类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap