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

C++ View3DInventor类代码示例

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

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



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

示例1: resetEdit

bool Document::setEdit(Gui::ViewProvider* p, int ModNum)
{
    if (d->_pcInEdit)
        resetEdit();
    // is it really a ViewProvider of this document?
    if (d->_ViewProviderMap.find(dynamic_cast<ViewProviderDocumentObject*>(p)->getObject()) == d->_ViewProviderMap.end())
        return false;

    View3DInventor *activeView = dynamic_cast<View3DInventor *>(getActiveView());
    // if the currently active view is not te 3d view search for it and activate it
    if (!activeView) {
        activeView = dynamic_cast<View3DInventor *>(getViewOfViewProvider(p));
        if (activeView)
            getMainWindow()->setActiveWindow(activeView);
    }

    if (activeView && activeView->getViewer()->setEditingViewProvider(p,ModNum)) {
        d->_pcInEdit = p;
        Gui::TaskView::TaskDialog* dlg = Gui::Control().activeDialog();
        if (dlg)
            dlg->setDocumentName(this->getDocument()->getName());
        if (d->_pcInEdit->isDerivedFrom(ViewProviderDocumentObject::getClassTypeId())) 
            signalInEdit(*(static_cast<ViewProviderDocumentObject*>(d->_pcInEdit)));
    }
    else {
        return false;
    }

    return true;
}
开发者ID:RipCurrent,项目名称:FreeCAD_sf_master,代码行数:30,代码来源:Document.cpp


示例2: setModified

void Document::slotDeletedObject(const App::DocumentObject& Obj)
{
    std::list<Gui::BaseView*>::iterator vIt;
    setModified(true);
    //Base::Console().Log("Document::slotDeleteObject() called\n");
  
    // cycling to all views of the document
    ViewProvider* viewProvider = getViewProvider(&Obj);
#if 0 // With this we can show child objects again if this method was called by undo
    viewProvider->onDelete(std::vector<std::string>());
#endif
    if (viewProvider && viewProvider->getTypeId().isDerivedFrom
        (ViewProviderDocumentObject::getClassTypeId())) {
        // go through the views
        for (vIt = d->baseViews.begin();vIt != d->baseViews.end();++vIt) {
            View3DInventor *activeView = dynamic_cast<View3DInventor *>(*vIt);
            if (activeView) {
                if (d->_pcInEdit == viewProvider)
                    resetEdit();
                activeView->getViewer()->removeViewProvider(viewProvider);
            }
        }

        // removing from tree
        signalDeletedObject(*(static_cast<ViewProviderDocumentObject*>(viewProvider)));

        delete viewProvider;
        d->_ViewProviderMap.erase(&Obj);
    }
}
开发者ID:jaywarrick,项目名称:FreeCAD_sf_master,代码行数:30,代码来源:Document.cpp


示例3: if

PyObject* Application::sCreateViewer(PyObject * /*self*/, PyObject *args)
{
    int num_of_views = 1;
    char* title = nullptr;
    // if one argument (int) is given
    if (PyArg_ParseTuple(args, "|is", &num_of_views, &title))
    {
        if (num_of_views < 0)
            return NULL;
        else if (num_of_views==1)
        {
            View3DInventor* viewer = new View3DInventor(0, 0);
            if (title)
                viewer->setWindowTitle(QString::fromUtf8(title));
            Gui::getMainWindow()->addWindow(viewer);
            return viewer->getPyObject();
        }
        else
        {
            SplitView3DInventor* viewer = new SplitView3DInventor(num_of_views, 0, 0);
            if (title)
                viewer->setWindowTitle(QString::fromUtf8(title));
            Gui::getMainWindow()->addWindow(viewer);
            return viewer->getPyObject();
        }
    }
    return Py_None;
}
开发者ID:pgilfernandez,项目名称:FreeCAD,代码行数:28,代码来源:ApplicationPy.cpp


示例4: getViewProvider

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


示例5: setNodeNames

void DlgInspector::setDocument(Gui::Document* doc)
{
    setNodeNames(doc);

    View3DInventor* view = qobject_cast<View3DInventor*>(doc->getActiveView());
    if (view) {
        View3DInventorViewer* viewer = view->getViewer();
        setNode(viewer->getSceneGraph());
        ui->treeView->expandToDepth(3);
    }
}
开发者ID:WandererFan,项目名称:FreeCAD,代码行数:11,代码来源:SceneInspector.cpp


示例6:

ViewProvider *Document::getInEdit(void) const
{
    if (d->_pcInEdit) {
        // there is only one 3d view which is in edit mode
        View3DInventor *activeView = dynamic_cast<View3DInventor *>(getActiveView());
        if (activeView && activeView->getViewer()->isEditingViewProvider())
            return d->_pcInEdit;
    }

    return 0;
}
开发者ID:jaywarrick,项目名称:FreeCAD_sf_master,代码行数:11,代码来源:Document.cpp


示例7: on_refreshButton_clicked

void DlgInspector::on_refreshButton_clicked()
{
    View3DInventor* child = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
    if (child) {
        View3DInventorViewer* viewer = child->getViewer();
        setNode(viewer->getSceneGraph());
        ui->treeView->expandToDepth(3);
    }
    else {
        SceneModel* model = static_cast<SceneModel*>(ui->treeView->model());
        model->clear();
    }
}
开发者ID:Daedalus12,项目名称:FreeCAD_sf_master,代码行数:13,代码来源:SceneInspector.cpp


示例8: getMDIViews

Gui::MDIView* Document::getViewOfViewProvider(Gui::ViewProvider* vp) const
{
    std::list<MDIView*> mdis = getMDIViews();
    for (std::list<MDIView*>::const_iterator it = mdis.begin(); it != mdis.end(); ++it) {
        if ((*it)->getTypeId().isDerivedFrom(View3DInventor::getClassTypeId())) {
            View3DInventor* view = static_cast<View3DInventor*>(*it);
            if (view->getViewer()->hasViewProvider(vp))
                return *it;
        }
    }

    return 0;
}
开发者ID:microelly2,项目名称:FreeCAD,代码行数:13,代码来源:Document.cpp


示例9: removeAnnotationViewProvider

void Document::removeAnnotationViewProvider(const char* name)
{
    std::map<std::string,ViewProvider*>::iterator it = d->_ViewProviderMapAnnotation.find(name);
    std::list<Gui::BaseView*>::iterator vIt;

    // cycling to all views of the document
    for (vIt = d->baseViews.begin();vIt != d->baseViews.end();++vIt) {
        View3DInventor *activeView = dynamic_cast<View3DInventor *>(*vIt);
        if (activeView)
            activeView->getViewer()->removeViewProvider(it->second);
    }

    delete it->second;
    d->_ViewProviderMapAnnotation.erase(it); 
}
开发者ID:jaywarrick,项目名称:FreeCAD_sf_master,代码行数:15,代码来源:Document.cpp


示例10: resetEdit

void Document::resetEdit(void)
{
    std::list<Gui::BaseView*>::iterator it;
    if (d->_pcInEdit) {
        for (it = d->baseViews.begin();it != d->baseViews.end();++it) {
            View3DInventor *activeView = dynamic_cast<View3DInventor *>(*it);
            if (activeView)
                activeView->getViewer()->resetEditingViewProvider();
        }

        if (d->_pcInEdit->isDerivedFrom(ViewProviderDocumentObject::getClassTypeId())) 
            signalResetEdit(*(static_cast<ViewProviderDocumentObject*>(d->_pcInEdit)));
        d->_pcInEdit = 0;
    }
}
开发者ID:jaywarrick,项目名称:FreeCAD_sf_master,代码行数:15,代码来源:Document.cpp


示例11: resetEdit

bool Document::setEdit(Gui::ViewProvider* p, int ModNum)
{
    if (d->_pcInEdit)
        resetEdit();
    View3DInventor *activeView = dynamic_cast<View3DInventor *>(getActiveView());
    if (activeView && activeView->getViewer()->setEditingViewProvider(p,ModNum)) {
        d->_pcInEdit = p;
        Gui::TaskView::TaskDialog* dlg = Gui::Control().activeDialog();
        if (dlg)
            dlg->setDocumentName(this->getDocument()->getName());
        if (d->_pcInEdit->isDerivedFrom(ViewProviderDocumentObject::getClassTypeId())) 
            signalInEdit(*(static_cast<ViewProviderDocumentObject*>(d->_pcInEdit)));
    }
    else
        return false;
    return true;
}
开发者ID:clementCAM,项目名称:FreeCAD,代码行数:17,代码来源:Document.cpp


示例12: SIGNAL

void StdCmdAlignment::activated(int iMsg)
{
    std::vector<App::DocumentObject*> sel = Gui::Selection().getObjectsOfType
                                            (App::GeoFeature::getClassTypeId());
    ManualAlignment* align = ManualAlignment::instance();
    QObject::connect(align, SIGNAL(emitCanceled()), align, SLOT(deleteLater()));
    QObject::connect(align, SIGNAL(emitFinished()), align, SLOT(deleteLater()));

    // Get the fixed and moving meshes
    FixedGroup fixedGroup;
    std::map<int, MovableGroup> groupMap;
    fixedGroup.addView(sel[0]);
    groupMap[0].addView(sel[1]);

    // add the fixed group
    align->setFixedGroup(fixedGroup);

    // create the model of movable groups
    MovableGroupModel model;
    model.addGroups(groupMap);
    align->setModel(model);
    Base::Type style = Base::Type::fromName("Gui::CADNavigationStyle");
    Base::Vector3d upDir(0,1,0), viewDir(0,0,-1);
    Gui::Document* doc = Application::Instance->activeDocument();
    if (doc) {
        View3DInventor* mdi = qobject_cast<View3DInventor*>(doc->getActiveView());
        if (mdi) {
            View3DInventorViewer* viewer = mdi->getViewer();
            SoCamera* camera = viewer->getCamera();
            if (camera) {
                SbVec3f up(0,1,0), dir(0,0,-1);
                camera->orientation.getValue().multVec(dir, dir);
                viewDir.Set(dir[0],dir[1],dir[2]);
                camera->orientation.getValue().multVec(up, up);
                upDir.Set(up[0],up[1],up[2]);
            }
            style = viewer->navigationStyle()->getTypeId();
        }
    }

    align->setMinPoints(1);
    align->startAlignment(style);
    align->setViewingDirections(viewDir,upDir, viewDir,upDir);
    Gui::Selection().clearSelection();
}
开发者ID:pedrocalderon,项目名称:FreeCAD_sf_master,代码行数:45,代码来源:CommandDoc.cpp


示例13: View3DInventor

void Document::createView(const Base::Type& typeId)
{
    if (!typeId.isDerivedFrom(MDIView::getClassTypeId()))
        return;

    std::list<MDIView*> theViews = this->getMDIViewsOfType(typeId);
    if (typeId == View3DInventor::getClassTypeId()) {
        View3DInventor* firstView = 0;
        QGLWidget* shareWidget = 0;
        if (!theViews.empty()) {
            firstView = dynamic_cast<View3DInventor*>(theViews.front());
            shareWidget = qobject_cast<QGLWidget*>(firstView->getViewer()->getGLWidget());
        }

        View3DInventor* view3D = new View3DInventor(this, getMainWindow(), shareWidget);
        if (firstView) {
            std::string overrideMode = firstView->getViewer()->getOverrideMode();
            view3D->getViewer()->setOverrideMode(overrideMode);
        }

        // attach the viewprovider
        std::map<const App::DocumentObject*,ViewProviderDocumentObject*>::const_iterator It1;
        for (It1=d->_ViewProviderMap.begin();It1!=d->_ViewProviderMap.end();++It1)
            view3D->getViewer()->addViewProvider(It1->second);
        std::map<std::string,ViewProvider*>::const_iterator It2;
        for (It2=d->_ViewProviderMapAnnotation.begin();It2!=d->_ViewProviderMapAnnotation.end();++It2)
            view3D->getViewer()->addViewProvider(It2->second);

        const char* name = getDocument()->Label.getValue();
        QString title = QString::fromAscii("%1 : %2[*]")
            .arg(QString::fromUtf8(name)).arg(d->_iWinCount++);

        view3D->setWindowTitle(title);
        view3D->setWindowModified(this->isModified());
        view3D->setWindowIcon(QApplication::windowIcon());
        view3D->resize(400, 300);
        getMainWindow()->addWindow(view3D);
    }
}
开发者ID:microelly2,项目名称:FreeCAD,代码行数:39,代码来源:Document.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ ViewArray类代码示例发布时间:2022-05-31
下一篇:
C++ View2类代码示例发布时间: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