当前位置: 首页>>代码示例>>C++>>正文


C++ Graphic::getSelectName方法代码示例

本文整理汇总了C++中basicgl::Graphic::getSelectName方法的典型用法代码示例。如果您正苦于以下问题:C++ Graphic::getSelectName方法的具体用法?C++ Graphic::getSelectName怎么用?C++ Graphic::getSelectName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在basicgl::Graphic的用法示例。


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

示例1: setSymbolType

//------------------------------------------------------------------------------
// setSymbolType() - change an existing symbol type to another type
//------------------------------------------------------------------------------
bool SymbolLoader::setSymbolType(const int idx, const int nType)
{
    bool ok = false;

    // Find the symbol
    if (idx >= 1 && idx <= MAX_SYMBOLS) {
        const int i = (idx - 1);
        if (symbols[i] != 0) {

            // Find the graphic template for this type symbol, and make
            // sure that the template is a BasicGL::Graphic, since it
            // will be use as the symbol's graphical component.
            if (templates != 0) {
                Basic::Pair* tpair = templates->getPosition(nType);
                if (tpair != 0) {
                    BasicGL::Graphic* tg = dynamic_cast<BasicGL::Graphic*>(tpair->object());
                    if (tg != 0) {

                        // Get the symbol's old graphical component
                        Basic::Pair* oldPair = (Basic::Pair*) symbols[i]->getSymbolPair();
                        BasicGL::Graphic* oldG = (BasicGL::Graphic*) (oldPair->object());

                        // Clone the new graphical component from the template
                        Basic::Pair* newPair = tpair->clone();

                        // Set the new graphical component's select name using the old's
                        BasicGL::Graphic* newGraph = (BasicGL::Graphic*) newPair->object();
                        GLuint mySelName = oldG->getSelectName();
                        newGraph->setSelectName(mySelName);

                        // Add the new and remove the old components from our subcomponent list
                        {
                            Basic::PairStream* comp = getComponents();
                            Basic::Component::processComponents(comp, typeid(BasicGL::Graphic), newPair, oldG);
                            if (comp != 0) comp->unref();
                        }

                        // Set the symbol's graphical component pointer
                        symbols[i]->setSymbolPair( newPair );
                        newPair->unref(); // symbol[i] now owns it.

                        // Set new type
                        symbols[i]->setType( nType );

                        ok = true;
                    }

                }
            }
        }

    }
    return ok;
}
开发者ID:azcbuell,项目名称:OpenEaagles,代码行数:57,代码来源:SymbolLoader.cpp


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