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


C++ Reference::GetGroup方法代码示例

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


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

示例1: loadSettings

void DlgImportExportStep::loadSettings()
{
    Base::Reference<ParameterGrp> hPartGrp = App::GetApplication().GetUserParameter()
        .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part");

    // General
    Base::Reference<ParameterGrp> hGenGrp = hPartGrp->GetGroup("General");
    int writesurfacecurve = Interface_Static::IVal("write.surfacecurve.mode");
    writesurfacecurve = hGenGrp->GetInt("WriteSurfaceCurveMode", writesurfacecurve);
    ui->checkBoxPcurves->setChecked(writesurfacecurve == 0 ? false : true);

    // STEP
    Base::Reference<ParameterGrp> hStepGrp = hPartGrp->GetGroup("STEP");
    int unit = hStepGrp->GetInt("Unit", 0);
    ui->comboBoxUnits->setCurrentIndex(unit);

    // scheme
    QString ap = QString::fromStdString(hStepGrp->GetASCII("Scheme",
        Interface_Static::CVal("write.step.schema")));
    if (ap.startsWith(QLatin1String("AP203")))
        ui->radioButtonAP203->setChecked(true);
    else
        ui->radioButtonAP214->setChecked(true);

    // header info
    ui->lineEditCompany->setText(QString::fromStdString(hStepGrp->GetASCII("Company")));
    ui->lineEditAuthor->setText(QString::fromStdString(hStepGrp->GetASCII("Author")));
    ui->lineEditProduct->setText(QString::fromLatin1(
        Interface_Static::CVal("write.step.product.name")));

    // (h)STEP of Import module
    ui->checkBoxMergeCompound->onRestore();
}
开发者ID:frankhardy,项目名称:FreeCAD,代码行数:33,代码来源:DlgSettingsGeneral.cpp

示例2: saveSettings

void DlgImportExportStep::saveSettings()
{
    int unit = ui->comboBoxUnits->currentIndex();
    Base::Reference<ParameterGrp> hPartGrp = App::GetApplication().GetUserParameter()
        .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part");

    // General
    Base::Reference<ParameterGrp> hGenGrp = hPartGrp->GetGroup("General");
    int writesurfacecurve = ui->checkBoxPcurves->isChecked() ? 1 : 0;
    hGenGrp->SetInt("WriteSurfaceCurveMode", writesurfacecurve);
    Interface_Static::SetIVal("write.surfacecurve.mode", writesurfacecurve);

    // STEP
    Base::Reference<ParameterGrp> hStepGrp = hPartGrp->GetGroup("STEP");
    hStepGrp->SetInt("Unit", unit);
    switch (unit) {
        case 1:
            Interface_Static::SetCVal("write.step.unit","M");
            break;
        case 2:
            Interface_Static::SetCVal("write.step.unit","IN");
            break;
        default:
            Interface_Static::SetCVal("write.step.unit","MM");
            break;
    }

    // scheme
    if (ui->radioButtonAP203->isChecked()) {
        Interface_Static::SetCVal("write.step.schema","AP203");
        hStepGrp->SetASCII("Scheme", "AP203");
    }
    else {
        // possible values: AP214CD (1996), AP214DIS (1998), AP214IS (2002)
        Interface_Static::SetCVal("write.step.schema","AP214IS");
        hStepGrp->SetASCII("Scheme", "AP214IS");
    }

    // header info
    hStepGrp->SetASCII("Company", ui->lineEditCompany->text().toLatin1());
    hStepGrp->SetASCII("Author", ui->lineEditAuthor->text().toLatin1());
  //hStepGrp->SetASCII("Product", ui->lineEditProduct->text().toLatin1());

    // (h)STEP of Import module
    ui->checkBoxMergeCompound->onSave();
}
开发者ID:frankhardy,项目名称:FreeCAD,代码行数:46,代码来源:DlgSettingsGeneral.cpp

示例3: setupCustomToolbars

void Workbench::setupCustomToolbars(ToolBarItem* root, const Base::Reference<ParameterGrp>& hGrp) const
{
    std::vector<Base::Reference<ParameterGrp> > hGrps = hGrp->GetGroups();
    CommandManager& rMgr = Application::Instance->commandManager();
    std::string separator = "Separator";
    for (std::vector<Base::Reference<ParameterGrp> >::iterator it = hGrps.begin(); it != hGrps.end(); ++it) {
        bool active = (*it)->GetBool("Active", true);
        if (!active) // ignore this toolbar
            continue;
        ToolBarItem* bar = new ToolBarItem(root);
        bar->setCommand("Custom");

        // get the elements of the subgroups
        std::vector<std::pair<std::string,std::string> > items = hGrp->GetGroup((*it)->GetGroupName())->GetASCIIMap();
        for (std::vector<std::pair<std::string,std::string> >::iterator it2 = items.begin(); it2 != items.end(); ++it2) {
            if (it2->first.substr(0, separator.size()) == separator) {
                *bar << "Separator";
            }
            else if (it2->first == "Name") {
                bar->setCommand(it2->second);
            }
            else {
                Command* pCmd = rMgr.getCommandByName(it2->first.c_str());
                if (!pCmd) { // unknown command
                    // first try the module name as is
                    std::string pyMod = it2->second;
                    try {
                        Base::Interpreter().loadModule(pyMod.c_str());
                        // Try again
                        pCmd = rMgr.getCommandByName(it2->first.c_str());
                    }
                    catch(const Base::Exception&) {
                    }
                }

                // still not there?
                if (!pCmd) {
                    // add the 'Gui' suffix
                    std::string pyMod = it2->second + "Gui";
                    try {
                        Base::Interpreter().loadModule(pyMod.c_str());
                        // Try again
                        pCmd = rMgr.getCommandByName(it2->first.c_str());
                    }
                    catch(const Base::Exception&) {
                    }
                }

                if (pCmd) {
                    *bar << it2->first; // command name
                }
            }
        }
    }
}
开发者ID:AjinkyaDahale,项目名称:FreeCAD,代码行数:55,代码来源:Workbench.cpp

示例4: getGroup

Py::Object ParameterGrpPy::getGroup(const Py::Tuple& args)
{
    char *pstr;
    if (!PyArg_ParseTuple(args.ptr(), "s", &pstr))
        throw Py::Exception();

    // get the Handle of the wanted group
    Base::Reference<ParameterGrp> handle = _cParamGrp->GetGroup(pstr);
    if (handle.isValid()) {
        // crate a python wrapper class
        ParameterGrpPy *pcParamGrp = new ParameterGrpPy(handle);
        // increment the reff count
        return Py::asObject(pcParamGrp);
    }
    else {
        throw Py::RuntimeError("GetGroup failed");
    }
}
开发者ID:Bohr27,项目名称:FreeCAD,代码行数:18,代码来源:ParameterPy.cpp

示例5: ParameterGrpPy

PyObject *ParameterGrpPy::PyGetGrp(PyObject *args)
{
    char *pstr;
    if (!PyArg_ParseTuple(args, "s", &pstr))     // convert args: Python->C 
        return NULL;                             // NULL triggers exception 
    PY_TRY {
        // get the Handle of the wanted group
        Base::Reference<ParameterGrp> handle = _cParamGrp->GetGroup(pstr);
        if(handle.isValid()){
            // crate a python wrapper class
            ParameterGrpPy *pcParamGrp = new ParameterGrpPy(handle);
            // increment the reff count
            //pcParamGrp->_INCREF();
            return pcParamGrp;
        }else{
            PyErr_SetString(PyExc_IOError, "GetGroup failed");
            return 0L;
        }
    }PY_CATCH;
} 
开发者ID:Barleyman,项目名称:FreeCAD_sf_master,代码行数:20,代码来源:ParameterPy.cpp

示例6: insertTo

void ParameterGrp::insertTo(Base::Reference<ParameterGrp> Grp)
{
    // copy group
    std::vector<Base::Reference<ParameterGrp> > Grps = GetGroups();
    std::vector<Base::Reference<ParameterGrp> >::iterator It1;
    for (It1 = Grps.begin();It1 != Grps.end();++It1)
        (*It1)->insertTo(Grp->GetGroup((*It1)->GetGroupName()));

    // copy strings
    std::vector<std::pair<std::string,std::string> > StringMap = GetASCIIMap();
    std::vector<std::pair<std::string,std::string> >::iterator It2;
    for (It2 = StringMap.begin();It2 != StringMap.end();++It2)
        Grp->SetASCII(It2->first.c_str(),It2->second.c_str());

    // copy bool
    std::vector<std::pair<std::string,bool> > BoolMap = GetBoolMap();
    std::vector<std::pair<std::string,bool> >::iterator It3;
    for (It3 = BoolMap.begin();It3 != BoolMap.end();++It3)
        Grp->SetBool(It3->first.c_str(),It3->second);

    // copy int
    std::vector<std::pair<std::string,long> > IntMap = GetIntMap();
    std::vector<std::pair<std::string,long> >::iterator It4;
    for (It4 = IntMap.begin();It4 != IntMap.end();++It4)
        Grp->SetInt(It4->first.c_str(),It4->second);

    // copy float
    std::vector<std::pair<std::string,double> > FloatMap = GetFloatMap();
    std::vector<std::pair<std::string,double> >::iterator It5;
    for (It5 = FloatMap.begin();It5 != FloatMap.end();++It5)
        Grp->SetFloat(It5->first.c_str(),It5->second);

    // copy uint
    std::vector<std::pair<std::string,unsigned long> > UIntMap = GetUnsignedMap();
    std::vector<std::pair<std::string,unsigned long> >::iterator It6;
    for (It6 = UIntMap.begin();It6 != UIntMap.end();++It6)
        Grp->SetUnsigned(It6->first.c_str(),It6->second);
}
开发者ID:SparkyCola,项目名称:FreeCAD,代码行数:38,代码来源:Parameter.cpp

示例7: initPart


//.........这里部分代码省略.........
    Part::GeomCurve               ::init();
    Part::GeomBezierCurve         ::init();
    Part::GeomBSplineCurve        ::init();
    Part::GeomCircle              ::init();
    Part::GeomArcOfCircle         ::init();
    Part::GeomArcOfEllipse        ::init();
    Part::GeomArcOfParabola       ::init();
    Part::GeomArcOfHyperbola      ::init();
    Part::GeomEllipse             ::init();
    Part::GeomHyperbola           ::init();
    Part::GeomParabola            ::init();
    Part::GeomLine                ::init();
    Part::GeomLineSegment         ::init();
    Part::GeomOffsetCurve         ::init();
    Part::GeomTrimmedCurve        ::init();
    Part::GeomSurface             ::init();
    Part::GeomBezierSurface       ::init();
    Part::GeomBSplineSurface      ::init();
    Part::GeomCylinder            ::init();
    Part::GeomCone                ::init();
    Part::GeomSphere              ::init();
    Part::GeomToroid              ::init();
    Part::GeomPlane               ::init();
    Part::GeomOffsetSurface       ::init();
    Part::GeomTrimmedSurface      ::init();
    Part::GeomSurfaceOfRevolution ::init();
    Part::GeomSurfaceOfExtrusion  ::init();


    IGESControl_Controller::Init();
    STEPControl_Controller::Init();
    // set the user-defined settings
    Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
        .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part");

    // General
    Base::Reference<ParameterGrp> hGenGrp = hGrp->GetGroup("General");
    // http://www.opencascade.org/org/forum/thread_20801/
    // read.surfacecurve.mode:
    // A preference for the computation of curves in an entity which has both 2D and 3D representation.
    // Each TopoDS_Edge in TopoDS_Face must have a 3D and 2D curve that references the surface.
    // If both 2D and 3D representation of the entity are present, the computation of these curves depends on
    // the following values of parameter:
    // 0: "Default" - no preference, both curves are taken
    // 3: "3DUse_Preferred" - 3D curves are used to rebuild 2D ones
    // Additional modes for IGES
    //  2: "2DUse_Preferred" - the 2D is used to rebuild the 3D in case of their inconsistency
    // -2: "2DUse_Forced" - the 2D is always used to rebuild the 3D (even if 2D is present in the file)
    // -3: "3DUse_Forced" - the 3D is always used to rebuild the 2D (even if 2D is present in the file)
    int readsurfacecurve = hGenGrp->GetInt("ReadSurfaceCurveMode", 0);
    Interface_Static::SetIVal("read.surfacecurve.mode", readsurfacecurve);

    // write.surfacecurve.mode (STEP-only):
    // This parameter indicates whether parametric curves (curves in parametric space of surface) should be
    // written into the STEP file. This parameter can be set to Off in order to minimize the size of the resulting
    // STEP file.
    // Off (0) : writes STEP files without pcurves. This mode decreases the size of the resulting file.
    // On (1) : (default) writes pcurves to STEP file
    int writesurfacecurve = hGenGrp->GetInt("WriteSurfaceCurveMode", 1);
    Interface_Static::SetIVal("write.surfacecurve.mode", writesurfacecurve);

    //IGES handling
    Base::Reference<ParameterGrp> hIgesGrp = hGrp->GetGroup("IGES");
    int value = Interface_Static::IVal("write.iges.brep.mode");
    bool brep = hIgesGrp->GetBool("BrepMode", value > 0);
    Interface_Static::SetIVal("write.iges.brep.mode",brep ? 1 : 0);
开发者ID:PrLayton,项目名称:SeriousFractal,代码行数:67,代码来源:AppPart.cpp

示例8: getCurve

Py::Object TopoShapeEdgePy::getCurve() const
{
    const TopoDS_Edge& e = TopoDS::Edge(getTopoShapePtr()->getShape());
    BRepAdaptor_Curve adapt(e);
    switch(adapt.GetType())
    {
    case GeomAbs_Line:
        {
            static bool LineOld = true;
            static bool init = false;
            if (!init) {
                init = true;
                Base::Reference<ParameterGrp> hPartGrp = App::GetApplication().GetUserParameter()
                    .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part");
                Base::Reference<ParameterGrp> hGenPGrp = hPartGrp->GetGroup("General");
                LineOld = hGenPGrp->GetBool("LineOld", false);
            }

            if (LineOld) {
                GeomLineSegment* line = new GeomLineSegment();
                Handle(Geom_TrimmedCurve) this_curv = Handle(Geom_TrimmedCurve)::DownCast
                    (line->handle());
                Handle(Geom_Line) this_line = Handle(Geom_Line)::DownCast
                    (this_curv->BasisCurve());
                this_line->SetLin(adapt.Line());
                this_curv->SetTrim(adapt.FirstParameter(), adapt.LastParameter());
                PyErr_SetString(PyExc_DeprecationWarning,
                    "For future usage 'Curve' will return 'Line' which is infinite "
                    "instead of the limited 'LineSegment'.\n"
                    "If you need a line segment then use this:\n"
                    "Part.LineSegment(edge.Curve,edge.FirstParameter,edge.LastParameter)\n"
                    "To suppress the warning set BaseApp/Preferences/Mod/Part/General/LineOld to false");
                PyErr_Print();

                return Py::Object(new LineSegmentPy(line),true); // LinePyOld
            }
            else {
                GeomLine* line = new GeomLine();
                Handle(Geom_Line) this_curv = Handle(Geom_Line)::DownCast
                    (line->handle());
                this_curv->SetLin(adapt.Line());
                return Py::Object(new LinePy(line),true);
            }
        }
    case GeomAbs_Circle:
        {
            GeomCircle* circle = new GeomCircle();
            Handle(Geom_Circle) this_curv = Handle(Geom_Circle)::DownCast
                (circle->handle());
            this_curv->SetCirc(adapt.Circle());
            //Standard_Real dd = adapt.FirstParameter();
            //Standard_Real ee = adapt.LastParameter();
            return Py::Object(new CirclePy(circle),true);
        }
    case GeomAbs_Ellipse:
        {
            GeomEllipse* elips = new GeomEllipse();
            Handle(Geom_Ellipse) this_curv = Handle(Geom_Ellipse)::DownCast
                (elips->handle());
            this_curv->SetElips(adapt.Ellipse());
            return Py::Object(new EllipsePy(elips),true);
        }
    case GeomAbs_Hyperbola:
        {
            GeomHyperbola* hypr = new GeomHyperbola();
            Handle(Geom_Hyperbola) this_curv = Handle(Geom_Hyperbola)::DownCast
                (hypr->handle());
            this_curv->SetHypr(adapt.Hyperbola());
            return Py::Object(new HyperbolaPy(hypr),true);
        }
    case GeomAbs_Parabola:
        {
            GeomParabola* parab = new GeomParabola();
            Handle(Geom_Parabola) this_curv = Handle(Geom_Parabola)::DownCast
                (parab->handle());
            this_curv->SetParab(adapt.Parabola());
            return Py::Object(new ParabolaPy(parab),true);
        }
    case GeomAbs_BezierCurve:
        {
            GeomBezierCurve* curve = new GeomBezierCurve(adapt.Bezier());
            return Py::Object(new BezierCurvePy(curve),true);
        }
    case GeomAbs_BSplineCurve:
        {
            GeomBSplineCurve* curve = new GeomBSplineCurve(adapt.BSpline());
            return Py::Object(new BSplineCurvePy(curve),true);
        }
#if OCC_VERSION_HEX >= 0x070000
    case GeomAbs_OffsetCurve:
        {
            Standard_Real first, last;
            Handle(Geom_Curve) c = BRep_Tool::Curve(e, first, last);
            Handle(Geom_OffsetCurve) off = Handle(Geom_OffsetCurve)::DownCast(c);
            if (!off.IsNull()) {
                GeomOffsetCurve* curve = new GeomOffsetCurve(off);
                return Py::Object(new OffsetCurvePy(curve),true);
            }
            else {
                throw Py::RuntimeError("Failed to convert to offset curve");
//.........这里部分代码省略.........
开发者ID:zhangli1049,项目名称:FreeCAD,代码行数:101,代码来源:TopoShapeEdgePyImp.cpp


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