From: Sergey POKHODENKO Date: Fri, 15 May 2015 10:32:54 +0000 (+0300) Subject: Issue #529 : 4.07. Import IGES, export to BREP, STEP, IGES - Export IGES with versions X-Git-Tag: V_1.2.0~145^2~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f565325d5c15b590237ae70c1ac6e57b448579ad;p=modules%2Fshaper.git Issue #529 : 4.07. Import IGES, export to BREP, STEP, IGES - Export IGES with versions --- diff --git a/src/ExchangePlugin/CMakeLists.txt b/src/ExchangePlugin/CMakeLists.txt index 2440dd129..c31364d8f 100644 --- a/src/ExchangePlugin/CMakeLists.txt +++ b/src/ExchangePlugin/CMakeLists.txt @@ -16,6 +16,7 @@ SET(PROJECT_HEADERS ExchangePlugin_ImportFeature.h ExchangePlugin_ExportFeature.h ExchangePlugin_Validators.h + ExchangePlugin_Tools.h ) SET(PROJECT_SOURCES @@ -23,6 +24,7 @@ SET(PROJECT_SOURCES ExchangePlugin_ImportFeature.cpp ExchangePlugin_ExportFeature.cpp ExchangePlugin_Validators.cpp + ExchangePlugin_Tools.cpp ) SET(XML_RESOURCES diff --git a/src/ExchangePlugin/ExchangePlugin.h b/src/ExchangePlugin/ExchangePlugin.h index 0c8f80b95..a6152af3e 100644 --- a/src/ExchangePlugin/ExchangePlugin.h +++ b/src/ExchangePlugin/ExchangePlugin.h @@ -4,17 +4,17 @@ #define EXCHANGEPLUGIN_H #if defined EXCHANGEPLUGIN_EXPORTS -#if defined WIN32 -#define EXCHANGEPLUGIN_EXPORT __declspec( dllexport ) +# if defined WIN32 +# define EXCHANGEPLUGIN_EXPORT __declspec( dllexport ) +# else +# define EXCHANGEPLUGIN_EXPORT +# endif #else -#define EXCHANGEPLUGIN_EXPORT -#endif -#else -#if defined WIN32 -#define EXCHANGEPLUGIN_EXPORT __declspec( dllimport ) -#else -#define EXCHANGEPLUGIN_EXPORT -#endif +# if defined WIN32 +# define EXCHANGEPLUGIN_EXPORT __declspec( dllimport ) +# else +# define EXCHANGEPLUGIN_EXPORT +# endif #endif #endif diff --git a/src/ExchangePlugin/ExchangePlugin_ExportFeature.cpp b/src/ExchangePlugin/ExchangePlugin_ExportFeature.cpp index 5120fde5e..166bda9b6 100644 --- a/src/ExchangePlugin/ExchangePlugin_ExportFeature.cpp +++ b/src/ExchangePlugin/ExchangePlugin_ExportFeature.cpp @@ -8,6 +8,9 @@ */ #include + +#include + #include #include #include @@ -19,18 +22,20 @@ #include -#include #include +#include #include #include #include #include + #include #include #include #include #include +#include #include #ifdef _DEBUG #include @@ -59,6 +64,7 @@ const std::string& ExchangePlugin_ExportFeature::getKind() */ void ExchangePlugin_ExportFeature::initAttributes() { + data()->addAttribute(ExchangePlugin_ExportFeature::FILE_FORMAT_ID(), ModelAPI_AttributeString::typeId()); data()->addAttribute(ExchangePlugin_ExportFeature::FILE_PATH_ID(), ModelAPI_AttributeString::typeId()); data()->addAttribute(ExchangePlugin_ExportFeature::SELECTION_LIST_ID(), ModelAPI_AttributeSelectionList::typeId()); } @@ -68,54 +74,65 @@ void ExchangePlugin_ExportFeature::initAttributes() */ void ExchangePlugin_ExportFeature::execute() { - AttributeStringPtr aFilePathAttr = std::dynamic_pointer_cast( - data()->attribute(ExchangePlugin_ExportFeature::FILE_PATH_ID())); + AttributeStringPtr aFormatAttr = + this->string(ExchangePlugin_ExportFeature::FILE_FORMAT_ID()); + std::string aFormat = aFormatAttr->value(); + if (aFormat.empty()) + return; + + AttributeStringPtr aFilePathAttr = + this->string(ExchangePlugin_ExportFeature::FILE_PATH_ID()); std::string aFilePath = aFilePathAttr->value(); if (aFilePath.empty()) return; AttributeSelectionListPtr aSelectionListAttr = - std::dynamic_pointer_cast( - data()->attribute(ExchangePlugin_ExportFeature::SELECTION_LIST_ID())); - + this->selectionList(ExchangePlugin_ExportFeature::SELECTION_LIST_ID()); std::list > aShapes; for ( int i = 0, aSize = aSelectionListAttr->size(); i < aSize; ++i ) { - std::shared_ptr anSelectionAttr = aSelectionListAttr->value(i); - aShapes.push_back(anSelectionAttr->value()); + aShapes.push_back(aSelectionListAttr->value(i)->value()); } std::shared_ptr aShape = GeomAlgoAPI_CompoundBuilder::compound(aShapes); - exportFile(aFilePath, aShape); + exportFile(aFilePath, aFormat, aShape); +} + +std::list ExchangePlugin_ExportFeature::getFormats() const +{ + // This value is a copy of string_list attribute of format_choice in plugin-Exchange.xml + // XPath:plugin-Exchange.xml:string(//*[@id="format_choice"]/@string_list) + std::string aFormats = "BREP STEP IGES-5.1 IGES-5.3"; + return ExchangePlugin_Tools::split(aFormats, ' '); } bool ExchangePlugin_ExportFeature::exportFile(const std::string& theFileName, + const std::string& theFormat, std::shared_ptr theShape) { // retrieve the file and plugin library names TCollection_AsciiString aFileName(theFileName.c_str()); OSD_Path aPath(aFileName); - TCollection_AsciiString aFormatName = aPath.Extension(); - // ".brep" -> "BREP", TCollection_AsciiString are numbered from 1 - aFormatName = aFormatName.SubString(2, aFormatName.Length()); - aFormatName.UpperCase(); + TCollection_AsciiString aFormatName(theFormat.c_str()); // Perform the export TCollection_AsciiString anError; TDF_Label anUnknownLabel = TDF_Label(); TopoDS_Shape aShape(theShape->impl()); - bool aResult = true; + bool aResult = false; if (aFormatName == "BREP") { aResult = BREPExport::Export(aFileName, aFormatName, aShape, anError, anUnknownLabel); - } else if (aFormatName == "STEP" || aFormatName == "STP") { + } else if (aFormatName == "STEP") { aResult = STEPExport::Export(aFileName, aFormatName, aShape, anError, anUnknownLabel); - } else if (aFormatName == "IGES") { + } else if (aFormatName.SubString(1, 4) == "IGES") { aResult = IGESExport::Export(aFileName, aFormatName, aShape, anError, anUnknownLabel); + } else { + anError = TCollection_AsciiString("Unsupported format ") + aFormatName; } - if ( !aResult ) { - const static std::string aShapeError = + if (!aResult) { + std::string aShapeError = "An error occurred while exporting " + theFileName + ": " + anError.ToCString(); setError(aShapeError); return false; diff --git a/src/ExchangePlugin/ExchangePlugin_ExportFeature.h b/src/ExchangePlugin/ExchangePlugin_ExportFeature.h index b308e12fc..fb45a27fc 100644 --- a/src/ExchangePlugin/ExchangePlugin_ExportFeature.h +++ b/src/ExchangePlugin/ExchangePlugin_ExportFeature.h @@ -23,6 +23,12 @@ class ExchangePlugin_ExportFeature : public ModelAPI_Feature static const std::string MY_EXPORT_ID("Export"); return MY_EXPORT_ID; } + /// attribute name of file format + inline static const std::string& FILE_FORMAT_ID() + { + static const std::string MY_FILE_FORMAT_ID("export_file_format"); + return MY_FILE_FORMAT_ID; + } /// attribute name of file path inline static const std::string& FILE_PATH_ID() { @@ -54,9 +60,10 @@ class ExchangePlugin_ExportFeature : public ModelAPI_Feature /// Reimplemented from ModelAPI_Feature::isPreviewNeeded(). Returns false. MODELAPI_EXPORT virtual bool isPreviewNeeded() const { return false; } - protected: +protected: /// Performs the export of the file EXCHANGEPLUGIN_EXPORT bool exportFile(const std::string& theFileName, + const std::string& theFormat, std::shared_ptr theShape); }; diff --git a/src/ExchangePlugin/ExchangePlugin_Tools.cpp b/src/ExchangePlugin/ExchangePlugin_Tools.cpp new file mode 100644 index 000000000..c55689ed4 --- /dev/null +++ b/src/ExchangePlugin/ExchangePlugin_Tools.cpp @@ -0,0 +1,20 @@ +/* + * ExchangePlugin_Tools.cpp + * + * Created on: May 15, 2015 + * Author: spo + */ + +#include + +#include + +std::list ExchangePlugin_Tools::split(const std::string& theString, char theDelimiter) +{ + std::list theResult; + std::istringstream aStream(theString); + std::string aSection; + while (std::getline(aStream, aSection, theDelimiter)) + theResult.push_back(aSection); + return theResult; +} diff --git a/src/ExchangePlugin/ExchangePlugin_Tools.h b/src/ExchangePlugin/ExchangePlugin_Tools.h new file mode 100644 index 000000000..b85520704 --- /dev/null +++ b/src/ExchangePlugin/ExchangePlugin_Tools.h @@ -0,0 +1,28 @@ +/* + * ExchangePlugin_Tools.h + * + * Created on: May 15, 2015 + * Author: spo + */ + +#ifndef EXCHANGEPLUGIN_TOOLS_H_ +#define EXCHANGEPLUGIN_TOOLS_H_ + +#include + +#include +#include + +/**\class ExchangePlugin_Tools + * \ingroup Plugins + * \brief Internal tools for the plugin. + */ +class EXCHANGEPLUGIN_EXPORT ExchangePlugin_Tools { +public: + /// Splits theString using theDelimiter. + static std::list split(const std::string& theString, + char theDelimiter); + +}; + +#endif /* EXCHANGEPLUGIN_TOOLS_H_ */ diff --git a/src/ExchangePlugin/ExchangePlugin_Validators.cpp b/src/ExchangePlugin/ExchangePlugin_Validators.cpp index 5a62fea8f..16df0a1fe 100644 --- a/src/ExchangePlugin/ExchangePlugin_Validators.cpp +++ b/src/ExchangePlugin/ExchangePlugin_Validators.cpp @@ -5,6 +5,9 @@ // Author: Vitaly SMETANNIKOV #include + +#include + #include #include #include @@ -12,7 +15,6 @@ #include #include -#include #include bool ExchangePlugin_FormatValidator::parseFormats(const std::list& theArguments, @@ -27,12 +29,10 @@ bool ExchangePlugin_FormatValidator::parseFormats(const std::list& result = false; continue; } - std::string aFormatList = anArg.substr(0, aSepPos); - std::transform(aFormatList.begin(), aFormatList.end(), aFormatList.begin(), toupper); - std::istringstream aStream(aFormatList); - std::string aFormat; - while (std::getline(aStream, aFormat, '|')) - outFormats.push_back(aFormat); + std::string aFormats = anArg.substr(0, aSepPos); + std::transform(aFormats.begin(), aFormats.end(), aFormats.begin(), toupper); + std::list aFormatList = ExchangePlugin_Tools::split(aFormats, '|'); + outFormats.insert(outFormats.end(), aFormatList.begin(), aFormatList.end()); } return result; } diff --git a/src/ExchangePlugin/plugin-Exchange.xml b/src/ExchangePlugin/plugin-Exchange.xml index 3c5111a6f..f478491fe 100644 --- a/src/ExchangePlugin/plugin-Exchange.xml +++ b/src/ExchangePlugin/plugin-Exchange.xml @@ -5,13 +5,13 @@ - + - - - + + + diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_IGESExport.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_IGESExport.cpp index 4a7b52bf6..425f58102 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_IGESExport.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_IGESExport.cpp @@ -77,15 +77,21 @@ int KindOfBRep (const TopoDS_Shape& theShape) //============================================================================= //extern "C" { + namespace IGESExport { bool Export(const TCollection_AsciiString& theFileName, - const TCollection_AsciiString&, + const TCollection_AsciiString& theFormatName, const TopoDS_Shape& theShape, TCollection_AsciiString& theError, const TDF_Label&) { - //TODO(spo): pass version as argument of the function - TCollection_AsciiString aVersion = "5.3"; + // theFormatName expected "IGES-5.1", "IGES-5.3"... + TCollection_AsciiString aVersion = theFormatName.Token("-", 2); + #ifdef _DEBUG + if (!aVersion.IsEqual("5.1") || !aVersion.IsEqual("5.3")) + std::cout << "Warning: unrecognized version " << aVersion.ToCString() + << ". Default version: 5.1." << std::endl; + #endif // define, whether to write only faces (5.1 IGES format) // or shells and solids also (5.3 IGES format) int aBrepMode = 0; @@ -124,7 +130,7 @@ bool Export(const TCollection_AsciiString& theFileName, // perform shape writing if( ICW.AddShape( theShape ) ) { ICW.ComputeModel(); - return (bool)ICW.Write( theFileName.ToCString() ); + return ICW.Write( theFileName.ToCString() ); } return false; } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_STEPExport.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_STEPExport.cpp index 9454f4a06..5cc71b056 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_STEPExport.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_STEPExport.cpp @@ -9,11 +9,11 @@ namespace STEPExport { -bool Export (const TCollection_AsciiString& theFileName, - const TCollection_AsciiString& theFormatName, - const TopoDS_Shape& theShape, - TCollection_AsciiString& theError, - const TDF_Label& theShapeLabel) +bool Export(const TCollection_AsciiString& theFileName, + const TCollection_AsciiString& theFormatName, + const TopoDS_Shape& theShape, + TCollection_AsciiString& theError, + const TDF_Label& theShapeLabel) { #ifdef _DEBUG std::cout << "Export STEP into file " << theFileName.ToCString() << std::endl; diff --git a/src/ModuleBase/ModuleBase_WidgetFileSelector.cpp b/src/ModuleBase/ModuleBase_WidgetFileSelector.cpp index 139b3849a..5da22f5eb 100644 --- a/src/ModuleBase/ModuleBase_WidgetFileSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetFileSelector.cpp @@ -111,11 +111,13 @@ bool ModuleBase_WidgetFileSelector::isCurrentPathValid() void ModuleBase_WidgetFileSelector::onPathSelectionBtn() { - QString aDefaultPath = myPathField->text().isEmpty() ? myDefaultPath : myPathField->text(); + QString aDefaultPath = myPathField->text().isEmpty() + ? myDefaultPath + : QFileInfo(myPathField->text()).absolutePath(); QString aFilter = filterString(); QString aFileName = (myType == WFS_SAVE) - ? QFileDialog::getSaveFileName(this, myTitle, aDefaultPath, aFilter) - : QFileDialog::getOpenFileName(this, myTitle, aDefaultPath, aFilter); + ? QFileDialog::getSaveFileName(this, myTitle, aDefaultPath, aFilter, &mySelectedFilter) + : QFileDialog::getOpenFileName(this, myTitle, aDefaultPath, aFilter, &mySelectedFilter); if (!aFileName.isEmpty()) { myPathField->setText(aFileName); } @@ -129,18 +131,15 @@ void ModuleBase_WidgetFileSelector::onPathChanged() emit valuesChanged(); } -QString ModuleBase_WidgetFileSelector::filterString() const +QString ModuleBase_WidgetFileSelector::formatToFilter( const QString & theFormat ) { - QStringList aResult; - QStringList aValidatorFormats = getValidatorFormats(); + if (theFormat.isEmpty() && !theFormat.contains(":")) + return QString(); - foreach(QString eachFormat, aValidatorFormats) { - QStringList aFormatList = eachFormat.split("|"); - aResult << QString("%1 files (%2)").arg(aFormatList.value(0)) - .arg(QStringList(aFormatList).replaceInStrings(QRegExp("^(.*)$"), "*.\\1").join(" ")); - } - aResult << QString("All files (*.*)"); - return aResult.join(";;"); + QStringList aExtesionList = theFormat.section(':', 0, 0).split("|"); + QString aFormat = theFormat.section(':', 1, 1); + return QString("%1 files (%2)").arg(aFormat) + .arg(QStringList(aExtesionList).replaceInStrings(QRegExp("^(.*)$"), "*.\\1").join(" ")); } QStringList ModuleBase_WidgetFileSelector::getValidatorFormats() const @@ -154,18 +153,22 @@ QStringList ModuleBase_WidgetFileSelector::getValidatorFormats() const std::list anArgumentList = allArguments.front(); std::list::const_iterator it = anArgumentList.begin(); for (; it != anArgumentList.end(); ++it) { - QString aFormat = getFormat(*it); - if (!aFormat.isNull()) + QString aFormat = QString::fromStdString(*it); + if (!aFormat.isEmpty()) aResult << aFormat; } return aResult; } -QString ModuleBase_WidgetFileSelector::getFormat( const std::string& theArgument ) const +QString ModuleBase_WidgetFileSelector::filterString() const { - QString anArgument = QString::fromStdString(theArgument); - if (!anArgument.contains(":")) - return QString(); - return anArgument.section(":", 0, 0).toUpper(); -} + QStringList aResult; + QStringList aValidatorFormats = getValidatorFormats(); + foreach(const QString & eachFormat, aValidatorFormats) { + aResult << formatToFilter(eachFormat); + } + if (myType == WFS_OPEN) + aResult << QString("All files (*.*)"); + return aResult.join(";;"); +} diff --git a/src/ModuleBase/ModuleBase_WidgetFileSelector.h b/src/ModuleBase/ModuleBase_WidgetFileSelector.h index b89531cde..2ddc684ac 100644 --- a/src/ModuleBase/ModuleBase_WidgetFileSelector.h +++ b/src/ModuleBase/ModuleBase_WidgetFileSelector.h @@ -67,23 +67,26 @@ protected: /// \return True in success virtual bool storeValueCustom() const; - protected: - /// Returns string containing formats - QString filterString() const; +protected: + /// Converts format to filter string + static QString formatToFilter( const QString & theFormat ); /// Returns list of validator formats QStringList getValidatorFormats() const; - /// Returns a format received from theArgument - QString getFormat( const std::string& theArgument ) const; + /// Returns string containing formats + QString filterString() const; - private: +protected: /// A control for path input QLineEdit* myPathField; /// A title of open file dialog box QString myTitle; + /// A current format + QString mySelectedFilter; + /// A title of open file dialog box enum { WFS_OPEN, WFS_SAVE } myType; diff --git a/src/PartSet/CMakeLists.txt b/src/PartSet/CMakeLists.txt index 048fba1e1..8c69ea96b 100644 --- a/src/PartSet/CMakeLists.txt +++ b/src/PartSet/CMakeLists.txt @@ -18,6 +18,7 @@ SET(PROJECT_HEADERS PartSet_WidgetMultiSelector.h PartSet_WidgetPoint2dDistance.h PartSet_WidgetShapeSelector.h + PartSet_WidgetFileSelector.h PartSet_Filters.h PartSet_SketcherMgr.h PartSet_MenuMgr.h @@ -38,6 +39,7 @@ SET(PROJECT_SOURCES PartSet_WidgetPoint2dAngle.cpp PartSet_WidgetPoint2dDistance.cpp PartSet_WidgetShapeSelector.cpp + PartSet_WidgetFileSelector.cpp PartSet_Filters.cpp PartSet_SketcherMgr.cpp PartSet_MenuMgr.cpp diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 6cc3f94e8..4f4dd7fa1 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -10,6 +10,7 @@ #include "PartSet_WidgetPoint2dAngle.h" #include "PartSet_WidgetMultiSelector.h" #include "PartSet_WidgetEditor.h" +#include "PartSet_WidgetFileSelector.h" #include "PartSet_SketcherMgr.h" #include "PartSet_MenuMgr.h" @@ -495,6 +496,8 @@ ModuleBase_ModelWidget* PartSet_Module::createWidgetByType(const std::string& th } if (theType == WDG_DOUBLEVALUE_EDITOR) { aWgt = new PartSet_WidgetEditor(theParent, workshop(), theWidgetApi, theParentId); + } else if (theType == "export_file_selector") { + aWgt = new PartSet_WidgetFileSelector(theParent, workshop(), theWidgetApi, theParentId); } return aWgt; } @@ -735,4 +738,4 @@ void PartSet_Module::processEvent(const std::shared_ptr& theMess } aLabel->setPalette(aPalet); } -} \ No newline at end of file +} diff --git a/src/PartSet/PartSet_WidgetFileSelector.cpp b/src/PartSet/PartSet_WidgetFileSelector.cpp new file mode 100644 index 000000000..0b91dc048 --- /dev/null +++ b/src/PartSet/PartSet_WidgetFileSelector.cpp @@ -0,0 +1,60 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + +/* + * PartSet_WidgetFileSelector.cpp + * + * Created on: May 18, 2015 + * Author: spo + */ + +#include "PartSet_WidgetFileSelector.h" + +#include + +PartSet_WidgetFileSelector::PartSet_WidgetFileSelector(QWidget* theParent, + ModuleBase_IWorkshop* theWorkshop, + const Config_WidgetAPI* theData, + const std::string& theParentId) +: ModuleBase_WidgetFileSelector(theParent, theData, theParentId) +, myWorkshop(theWorkshop) +{ +} + +bool PartSet_WidgetFileSelector::restoreValue() +{ + // A rare case when plugin was not loaded. + if (!myFeature) + return false; + + DataPtr aData = myFeature->data(); + AttributeStringPtr aStringAttr = aData->string("export_file_format"); + mySelectedFilter = formatToFilter(shortFormatToFullFormat(QString::fromStdString(aStringAttr->value()))); + + return ModuleBase_WidgetFileSelector::restoreValue(); +} + +bool PartSet_WidgetFileSelector::storeValueCustom() const +{ + // A rare case when plugin was not loaded. + if (!myFeature) + return false; + + DataPtr aData = myFeature->data(); + AttributeStringPtr aStringAttr = aData->string("export_file_format"); + aStringAttr->setValue(filterToShortFormat(mySelectedFilter).toStdString()); + + return ModuleBase_WidgetFileSelector::storeValueCustom(); +} + +QString PartSet_WidgetFileSelector::filterToShortFormat( const QString & theFilter ) +{ + return theFilter.section(' ', 0, 0); +} + +QString PartSet_WidgetFileSelector::shortFormatToFullFormat( const QString & theFormat ) const +{ + foreach(const QString & eachFormat, getValidatorFormats()) + if (filterToShortFormat(formatToFilter(eachFormat)) == theFormat) + return eachFormat; + return QString(); +} diff --git a/src/PartSet/PartSet_WidgetFileSelector.h b/src/PartSet/PartSet_WidgetFileSelector.h new file mode 100644 index 000000000..8d8c8eeb6 --- /dev/null +++ b/src/PartSet/PartSet_WidgetFileSelector.h @@ -0,0 +1,57 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + +/* + * PartSet_WidgetFileSelector.h + * + * Created on: May 18, 2015 + * Author: spo + */ + +#ifndef PARTSET_WIDGETFILESELECTOR_H_ +#define PARTSET_WIDGETFILESELECTOR_H_ + +#include "PartSet.h" + +#include + +class ModuleBase_IWorkshop; + +/** +* \ingroup Modules +* Customization of ModuleBase_WidgetFileSelector in order to write +* format of exported file. +*/ +class PARTSET_EXPORT PartSet_WidgetFileSelector : public ModuleBase_WidgetFileSelector +{ + Q_OBJECT +public: + /// Constructor + /// \param theParent the parent object + /// \param theWorkshop instance of workshop interface + /// \param theData the widget configuration. The attribute of the model widget is obtained from + /// \param theParentId is Id of a parent of the current attribute + PartSet_WidgetFileSelector(QWidget* theParent, + ModuleBase_IWorkshop* theWorkshop, + const Config_WidgetAPI* theData, + const std::string& theParentId); + + virtual ~PartSet_WidgetFileSelector() {} + + /// Reimplemented from ModuleBase_WidgetFileSelector::restoreValue() + virtual bool restoreValue(); + +protected: + /// Reimplemented from ModuleBase_WidgetFileSelector::storeValueCustom() + virtual bool storeValueCustom() const; + + /// Returns a short format string of theFilter string + static QString filterToShortFormat( const QString & theFilter ); + + /// Returns a full format string for the short format + QString shortFormatToFullFormat( const QString & theShortFormat ) const; + +private: + ModuleBase_IWorkshop* myWorkshop; // the current workshop +}; + +#endif /* PARTSET_WIDGETFILESELECTOR_H_ */