X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_Tools.cpp;h=02e774313557d097188d93aa4c4db0c24571cc50;hb=01a8a031b214d727e075a90ccdba0667a24db853;hp=6cbbe1c80c3361ba65c7009a2b57c7ac62f63f77;hpb=a12201ecb4883c5042b364cc68523c7235b035b8;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_Tools.cpp b/src/ModuleBase/ModuleBase_Tools.cpp index 6cbbe1c80..02e774313 100755 --- a/src/ModuleBase/ModuleBase_Tools.cpp +++ b/src/ModuleBase/ModuleBase_Tools.cpp @@ -8,6 +8,9 @@ #include #include +#include +#include +#include #include #include @@ -18,6 +21,7 @@ #include #include #include +#include #include @@ -382,6 +386,44 @@ TopAbs_ShapeEnum getCompoundSubType(const TopoDS_Shape& theShape) return aShapeType; } +void getParameters(QStringList& theParameters) +{ + theParameters.clear(); + + SessionPtr aSession = ModelAPI_Session::get(); + std::list aDocList; + DocumentPtr anActiveDocument = aSession->activeDocument(); + DocumentPtr aRootDocument = aSession->moduleDocument(); + aDocList.push_back(anActiveDocument); + if (anActiveDocument != aRootDocument) { + aDocList.push_back(aRootDocument); + } + std::string aGroupId = ModelAPI_ResultParameter::group(); + for(std::list::const_iterator it = aDocList.begin(); it != aDocList.end(); ++it) { + DocumentPtr aDocument = *it; + int aSize = aDocument->size(aGroupId); + for (int i = 0; i < aSize; i++) { + ObjectPtr anObject = aDocument->object(aGroupId, i); + std::string aParameterName = anObject->data()->name(); + theParameters.append(aParameterName.c_str()); + } + } +} + +std::string findGreedAttribute(ModuleBase_IWorkshop* theWorkshop, const FeaturePtr& theFeature) +{ + std::string anAttributeId; + + std::string aXmlCfg, aDescription; + theWorkshop->module()->getXMLRepresentation(theFeature->getKind(), aXmlCfg, aDescription); + + ModuleBase_WidgetFactory aFactory(aXmlCfg, theWorkshop); + std::string anAttributeTitle; + aFactory.getGreedAttribute(anAttributeId); + + return anAttributeId; +} + } // namespace ModuleBase_Tools