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


C++ SoGroup::getNumChildren方法代码示例

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


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

示例1: setNode

void SceneModel::setNode(QModelIndex index, SoNode* node)
{
    this->setData(index, QVariant(QString::fromAscii(node->getTypeId().getName())));
    if (node->getTypeId().isDerivedFrom(SoGroup::getClassTypeId())) {
        SoGroup *group = static_cast<SoGroup*>(node);
        // insert SoGroup icon
        this->insertColumns(0,1,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);
        }
    }
    // insert icon
}
开发者ID:Daedalus12,项目名称:FreeCAD_sf_master,代码行数:15,代码来源:SceneInspector.cpp

示例2: replaceSeparators

SoNode *
replaceSeparators(SoNode *root)
//
//////////////////////////////////////////////////////////////
{
    //
    // if it's a group, make a new group and copy its
    //  children over
    //
    if (root->isOfType(SoGroup::getClassTypeId())) {
	SoGroup *group = (SoGroup *) root;
        SoGroup *newGroup = (SoGroup *) group->getTypeId().createInstance();
        newGroup->SoNode::copyContents(group, FALSE);

	int	i;
	for (i=0; i<group->getNumChildren(); i++) {
	    SoNode *child = replaceSeparators(group->getChild(i));
	    newGroup->addChild(child);
	}
	return newGroup;
    }
    //
    // if not a group, return the node
    //
    else 
	return root;
}
开发者ID:Alexpux,项目名称:IvTools,代码行数:27,代码来源:ivperf.cpp

示例3: slotChangedObject

void Document::slotChangedObject(const App::DocumentObject& Obj, const App::Property& Prop)
{
    //Base::Console().Log("Document::slotChangedObject() called\n");
    ViewProvider* viewProvider = getViewProvider(&Obj);
    if (viewProvider) {
        try {
            viewProvider->update(&Prop);
        }
        catch(const Base::MemoryException& e) {
            Base::Console().Error("Memory exception in '%s' thrown: %s\n",Obj.getNameInDocument(),e.what());
        }
        catch(Base::Exception& e){
            e.ReportException();
        }
        catch(const std::exception& e){
            Base::Console().Error("C++ exception in '%s' thrown: %s\n",Obj.getNameInDocument(),e.what());
        }
        catch (...) {
            Base::Console().Error("Cannot update representation for '%s'.\n", Obj.getNameInDocument());
        }

        // check for children 
        if(viewProvider->getChildRoot()) {
            std::vector<App::DocumentObject*> children = viewProvider->claimChildren3D();
            SoGroup* childGroup =  viewProvider->getChildRoot();

            // size not the same -> build up the list new
            if(childGroup->getNumChildren() != children.size()){

                childGroup->removeAllChildren();
            
                for(std::vector<App::DocumentObject*>::iterator it=children.begin();it!=children.end();++it){
                    ViewProvider* ChildViewProvider = getViewProvider(*it);
                    if(ChildViewProvider) {
                        SoSeparator* childRootNode =  ChildViewProvider->getRoot();
                        childGroup->addChild(childRootNode);

                        // cycling to all views of the document to remove the viewprovider from the viewer itself
                        for (std::list<Gui::BaseView*>::iterator vIt = d->baseViews.begin();vIt != d->baseViews.end();++vIt) {
                            View3DInventor *activeView = dynamic_cast<View3DInventor *>(*vIt);
                            if (activeView && viewProvider) {
                                if (d->_pcInEdit == ChildViewProvider)
                                    resetEdit();
                                activeView->getViewer()->removeViewProvider(ChildViewProvider);
                            }
                        }
                    }
                }
            }
        }

        if (viewProvider->isDerivedFrom(ViewProviderDocumentObject::getClassTypeId()))
            signalChangedObject(static_cast<ViewProviderDocumentObject&>(*viewProvider), Prop);
    }

    // a property of an object has changed
    setModified(true);
}
开发者ID:RipCurrent,项目名称:FreeCAD_sf_master,代码行数:58,代码来源:Document.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: 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

示例6: adjustSelectionNodes

void ViewProviderInventorObject::adjustSelectionNodes(SoNode* child, const char* docname,
                                                      const char* objname)
{
    if (child->getTypeId().isDerivedFrom(SoFCSelection::getClassTypeId())) {
        static_cast<SoFCSelection*>(child)->documentName = docname;
        static_cast<SoFCSelection*>(child)->objectName = objname;
    }
    else if (child->getTypeId().isDerivedFrom(SoGroup::getClassTypeId())) {
        SoGroup* group = static_cast<SoGroup*>(child);
        for (int i=0; i<group->getNumChildren(); i++) {
            SoNode* subchild = group->getChild(i);
            adjustSelectionNodes(subchild, docname, objname);
        }
    }
}
开发者ID:Barleyman,项目名称:FreeCAD_sf_master,代码行数:15,代码来源:ViewProviderInventorObject.cpp

示例7: while

SoMaterial *
SoToVRMLActionP::find_or_create_material(void)
{
  SoMaterial * mat = NULL;
  SoGroup * tail = this->get_current_tail();

  int num = tail->getNumChildren();
  while (--num >= 0 && mat == NULL) {
    SoNode * node = tail->getChild(num);
    if (node->isOfType(SoMaterial::getClassTypeId())) {
      mat = coin_assert_cast<SoMaterial*>(node);
    }
  }
  if (mat == NULL) {
    mat = new SoMaterial;
    tail->addChild(mat);
  }
  return mat;
}
开发者ID:Alexpux,项目名称:Coin3D,代码行数:19,代码来源:SoToVRMLAction.cpp

示例8:

void
SoToVRMLActionP::init_gen(const SbBool color)
{
  SbBool dotex = FALSE;
  SoGroup * tail = this->get_current_tail();
  const int n = tail->getNumChildren();
  for (int i = 0; i < n; i++) {
    if (tail->getChild(i)->isOfType(SoTexture2::getClassTypeId())) {
      dotex = TRUE;
      break;
    }
  }

  this->bsptree = new SbBSPTree;
  if (dotex) this->bsptreetex = new SbBSPTree;
  this->bsptreenormal = new SbBSPTree;

  this->coordidx = new SbList <int32_t>;
  this->normalidx = new SbList <int32_t>;
  if (dotex) this->texidx = new SbList <int32_t>;
  if (color) this->coloridx = new SbList <int32_t>;
}
开发者ID:Alexpux,项目名称:Coin3D,代码行数:22,代码来源:SoToVRMLAction.cpp

示例9: addNodes

void addNodes(Graph& graph, std::map<SoNode*, Vertex>& vertexNodeMap, SoNode* node)
{
    if (node->getTypeId().isDerivedFrom(SoGroup::getClassTypeId())) {
        SoGroup* group = static_cast<SoGroup*>(node);
        Vertex groupV = vertexNodeMap[group];

        for (int i=0; i<group->getNumChildren(); i++) {
            SoNode* child = group->getChild(i);
            auto it = vertexNodeMap.find(child);

            // the child node is not yet added to the map
            if (it == vertexNodeMap.end()) {
                Vertex childV = add_vertex(graph);
                vertexNodeMap[child] = childV;
                add_edge(groupV, childV, graph);
                addNodes(graph, vertexNodeMap, child);
            }
            // the child is already there, only add the edge then
            else {
                add_edge(groupV, it->second, graph);
            }
        }
    }
}
开发者ID:mdjurfeldt,项目名称:FreeCAD,代码行数:24,代码来源:ViewProvider.cpp


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