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


C++ SoNode::getName方法代码示例

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


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

示例1: evaluate

void SoNodeToName::evaluate()
{   
    // make room as necessary
    SO_ENGINE_OUTPUT(output, SoMFString, setNum(input.getNum()));
    int next = 0;
    for( int i = 0; i < input.getNum(); i++ )
    {
        SoNode * node = input[i];
        if( node == NULL || node->getName() == "" )
        {
            if(  compact.getValue() == FALSE )
            {
                SO_ENGINE_OUTPUT(output, SoMFString, set1Value(next, ""));
                next++;
            }
        }
        else
        {
            SO_ENGINE_OUTPUT(output, SoMFString, set1Value(next, node->getName().getString()));
            next++;
        }        
    }
    // truncate as necessary
    SO_ENGINE_OUTPUT(output, SoMFString, setNum(next));
}
开发者ID:astanin,项目名称:mirror-studierstube,代码行数:25,代码来源:SoNodeToName.cpp

示例2: printPath

void printPath(const SoPath* p)
{
    for (int i = p->getLength() - 1; i >= 0;  --i)
    {
        SoNode * n = p->getNode(i);
        std::string name = n->getName().getString();
        ROS_INFO("Path[%i]: %s, type %s",i,name.c_str(),n->getTypeId().getName().getString());
    }
}
开发者ID:JenniferBuehler,项目名称:urdf-tools-pkgs,代码行数:9,代码来源:InventorViewer.cpp

示例3: setEditorData

/**
 * Takes the name of the selected node and sets to de editor to display it.
 */
void NodeNameDelegate::setEditorData(QWidget *editor,
                                     const QModelIndex &index) const
{
    const SceneModel* model = static_cast< const SceneModel* >( index.model() );

    QString value = model->data(index, Qt::DisplayRole).toString();

    QLineEdit  *textEdit = static_cast<QLineEdit *>(editor);

    SoNode* coinNode = model->NodeFromIndex( index )->GetNode();

    QString nodeName;
    if ( coinNode->getName() == SbName() )
        nodeName = QString( coinNode->getTypeId().getName().getString() );
    else
        nodeName = QString( coinNode->getName().getString() );

    textEdit->setText( nodeName );

}
开发者ID:mblancomuriel,项目名称:tonatiuh,代码行数:23,代码来源:NodeNameDelegate.cpp

示例4: setNode

void SceneModel::setNode(QModelIndex index, SoNode* node)
{
    this->setData(index, QVariant(QString::fromLatin1(node->getTypeId().getName())));
    if (node->getTypeId().isDerivedFrom(SoGroup::getClassTypeId())) {
        SoGroup *group = static_cast<SoGroup*>(node);
        // insert SoGroup icon
        this->insertColumns(0,2,index);
        this->insertRows(0,group->getNumChildren(), index);
        for (int i=0; i<group->getNumChildren();i++) {
            SoNode* child = group->getChild(i);
            setNode(this->index(i, 0, index), child);
            // See ViewProviderDocumentObject::updateData
            QByteArray name(child->getName());
            name = QByteArray::fromPercentEncoding(name);
            this->setData(this->index(i, 1, index), QVariant(QString::fromUtf8(name)));
        }
    }
    // insert icon
}
开发者ID:abdullahtahiriyo,项目名称:FreeCAD_sf_master,代码行数:19,代码来源:SceneInspector.cpp

示例5: sscanf

int
ModList::findToken(const SoPath *path)
{
    SoNode	*node = NULL;
    char	*str = NULL;
    int		id = -1;
    int		i;
    char	c;

    for (i = path->getLength() - 1; i >= 0; --i) {
        node = path->getNode(i);
        str = (char *)(node->getName().getString());
        if (strlen(str) && str[0] == theModListId) {
	    sscanf(str, "%c%d", &c, &id);
	    break;
	}
    }

    return id;
}
开发者ID:DundalkIT,项目名称:pcp,代码行数:20,代码来源:modlist.cpp

示例6:

SoNode * InventorViewer::getIntStr(const std::string& sscanfStr, const SoPath * path, std::string& extStr, int& extNum, int& pathIdx)
{
    if (path->getLength()==0) return NULL;
    for (int i = path->getLength() - 1; i >= 0;  --i)
    {
        SoNode * n = path->getNode(i);
        std::string name = n->getName().getString();
        
        //ROS_INFO("Path[%i]: %s, type %s",i,name.c_str(),n->getTypeId().getName().getString());

        char ln[1000];
        int num;
        if (sscanf(name.c_str(), sscanfStr.c_str(), &num, ln) < 2) continue;
        // ROS_INFO("num: %i rest: %s\n",num,ln);
        extStr = ln; //urdf2inventor::helpers::getFilename(ln); // take only the name after the last '/'
        extNum = num;
        pathIdx = i;
        return n;
    }
    return NULL;
}
开发者ID:JenniferBuehler,项目名称:urdf-tools-pkgs,代码行数:21,代码来源:InventorViewer.cpp

示例7: setNode

void SceneModel::setNode(QModelIndex index, SoNode* node)
{
    this->setData(index, QVariant(QString::fromLatin1(node->getTypeId().getName())));
    if (node->getTypeId().isDerivedFrom(SoGroup::getClassTypeId())) {
        SoGroup *group = static_cast<SoGroup*>(node);
        // insert SoGroup icon
        this->insertColumns(0,2,index);
        this->insertRows(0,group->getNumChildren(), index);
        for (int i=0; i<group->getNumChildren();i++) {
            SoNode* child = group->getChild(i);
            setNode(this->index(i, 0, index), child);

            QHash<SoNode*, QString>::iterator it = nodeNames.find(child);
            if (it != nodeNames.end()) {
                this->setData(this->index(i, 1, index), QVariant(it.value()));
            }
            else {
                this->setData(this->index(i, 1, index), QVariant(QString::fromLatin1(child->getName())));
            }
        }
    }
    // insert icon
}
开发者ID:WandererFan,项目名称:FreeCAD,代码行数:23,代码来源:SceneInspector.cpp

示例8: del

void
InvAnnoManager::selectionCB(void *me, SoPath *selectedObject)
{
    InvAnnoManager *mee = static_cast<InvAnnoManager *>(me);

    mee->initCheck();

    if (!mee->isActive_)
        return;

    int isAnnoFlg = 0;

    int len = selectedObject->getLength();
    int ii;
    char *selObjNm;

    SoNode *obj = NULL;
    int objIndex;

    int mode = mee->mode_;

    // we find out if the selected obj is a InvAnnotationFlag
    // and obtain its index from the name of the (sub)-toplevel
    // separator node
    for (ii = 0; ii < len; ii++)
    {
        obj = selectedObject->getNode(ii);
        char *tmp = (char *)obj->getName().getString();
        selObjNm = new char[1 + strlen(tmp)];
        char *chNum = new char[1 + strlen(tmp)];
        strcpy(selObjNm, tmp);
        if (strncmp(selObjNm, "ANNOTATION", 10) == 0)
        {
            strcpy(chNum, &selObjNm[11]);
            int ret = sscanf(chNum, "%d", &objIndex);
            if (ret != 1)
            {
                fprintf(stderr, "InvAnnoManager::selectionCB: sscanf failed\n");
            }
            isAnnoFlg = 1;
            break;
        }
    }

    // we have got an InvAnnoFlag
    // and remove it from the scene graph
    if (isAnnoFlg == 1)
    {
        if (obj->getTypeId() == SoSeparator::getClassTypeId())
        {
            if (mode == InvAnnoManager::EDIT)
            {
                vector<InvAnnoFlag *>::iterator it, selPos;
                // search flag with instance nr = objIndex;
                for (it = mee->flags_.begin(); it != mee->flags_.end(); ++it)
                {
                    if ((*it)->getInstance() == objIndex)
                    {
                        selPos = it;
                        break;
                    }
                }
                mee->viewer_->createAnnotationEditor(*selPos);
            }

            if (mode == InvAnnoManager::REMOVE)
            {
                // deletion of an InvAnnoFlag leads to a proper removal from the
                // scene graph by calling InvActiveNode::~InvActiveNode()
                bool del(false);
                vector<InvAnnoFlag *>::iterator it, remPos;
                // search flag with instance nr = objIndex;
                for (it = mee->flags_.begin(); it != mee->flags_.end(); ++it)
                {
                    if ((*it)->getInstance() == objIndex)
                    {
                        del = true;
                        remPos = it;
                    }
                }
                // delete flag and remove it from flags_
                if (del)
                {
                    delete *remPos;
                    mee->flags_.erase(remPos);
                    mee->trueNumFlags_--;
                    mee->deactivate();
                    mee->sendParameterData();
                }
            }
        }
    }
    // we create a new flag if anything else is selected
    else
    {
        if (mode != InvAnnoManager::MAKE)
            return;

        InvAnnoManager *mee = static_cast<InvAnnoManager *>(me);

//.........这里部分代码省略.........
开发者ID:nixz,项目名称:covise,代码行数:101,代码来源:InvAnnotationManager.cpp


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