Part: implement class ImportExportSettings for consistent parameter access
This commit is contained in:
@@ -43,6 +43,7 @@
|
||||
#include <StepElement_AnalysisItemWithinRepresentation.hxx>
|
||||
#include <StepVisual_AnnotationCurveOccurrence.hxx>
|
||||
|
||||
#include <App/Application.h>
|
||||
#include <App/Document.h>
|
||||
#include <Base/Console.h>
|
||||
|
||||
@@ -54,6 +55,125 @@
|
||||
|
||||
using namespace Part;
|
||||
|
||||
|
||||
ImportExportSettings::ImportExportSettings()
|
||||
{
|
||||
pGroup = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Import");
|
||||
}
|
||||
|
||||
void ImportExportSettings::setReadShapeCompoundMode(bool on)
|
||||
{
|
||||
auto grp = pGroup->GetGroup("hSTEP");
|
||||
grp->SetBool("ReadShapeCompoundMode", on);
|
||||
}
|
||||
|
||||
bool ImportExportSettings::getReadShapeCompoundMode() const
|
||||
{
|
||||
auto grp = pGroup->GetGroup("hSTEP");
|
||||
return grp->GetBool("ReadShapeCompoundMode", true);
|
||||
}
|
||||
|
||||
void ImportExportSettings::setExportHiddenObject(bool on)
|
||||
{
|
||||
pGroup->SetBool("ExportHiddenObject", on);
|
||||
}
|
||||
|
||||
bool ImportExportSettings::getExportHiddenObject() const
|
||||
{
|
||||
return pGroup->GetBool("ExportHiddenObject", false);
|
||||
}
|
||||
|
||||
void ImportExportSettings::setImportHiddenObject(bool on)
|
||||
{
|
||||
pGroup->SetBool("ImportHiddenObject", on);
|
||||
}
|
||||
|
||||
bool ImportExportSettings::getImportHiddenObject() const
|
||||
{
|
||||
return pGroup->GetBool("ImportHiddenObject", false);
|
||||
}
|
||||
|
||||
void ImportExportSettings::setExportLegacy(bool on)
|
||||
{
|
||||
pGroup->SetBool("ExportLegacy", on);
|
||||
}
|
||||
|
||||
bool ImportExportSettings::getExportLegacy() const
|
||||
{
|
||||
return pGroup->GetBool("ExportLegacy", false);
|
||||
}
|
||||
|
||||
void ImportExportSettings::setExportKeepPlacement(bool on)
|
||||
{
|
||||
pGroup->SetBool("ExportKeepPlacement", on);
|
||||
}
|
||||
|
||||
bool ImportExportSettings::getExportKeepPlacement() const
|
||||
{
|
||||
return pGroup->GetBool("ExportKeepPlacement", false);
|
||||
}
|
||||
|
||||
void ImportExportSettings::setUseLinkGroup(bool on)
|
||||
{
|
||||
pGroup->SetBool("UseLinkGroup", on);
|
||||
}
|
||||
|
||||
bool ImportExportSettings::getUseLinkGroup() const
|
||||
{
|
||||
return pGroup->GetBool("UseLinkGroup", false);
|
||||
}
|
||||
|
||||
void ImportExportSettings::setUseBaseName(bool on)
|
||||
{
|
||||
pGroup->SetBool("UseBaseName", on);
|
||||
}
|
||||
|
||||
bool ImportExportSettings::getUseBaseName() const
|
||||
{
|
||||
return pGroup->GetBool("UseBaseName", false);
|
||||
}
|
||||
|
||||
void ImportExportSettings::setReduceObjects(bool on)
|
||||
{
|
||||
pGroup->SetBool("ReduceObjects", on);
|
||||
}
|
||||
|
||||
bool ImportExportSettings::getReduceObjects() const
|
||||
{
|
||||
return pGroup->GetBool("ReduceObjects", false);
|
||||
}
|
||||
|
||||
void ImportExportSettings::setExpandCompound(bool on)
|
||||
{
|
||||
pGroup->SetBool("ExpandCompound", on);
|
||||
}
|
||||
|
||||
bool ImportExportSettings::getExpandCompound() const
|
||||
{
|
||||
return pGroup->GetBool("ExpandCompound", false);
|
||||
}
|
||||
|
||||
void ImportExportSettings::setShowProgress(bool on)
|
||||
{
|
||||
pGroup->SetBool("ShowProgress", on);
|
||||
}
|
||||
|
||||
bool ImportExportSettings::getShowProgress() const
|
||||
{
|
||||
return pGroup->GetBool("ShowProgress", false);
|
||||
}
|
||||
|
||||
void ImportExportSettings::setImportMode(ImportExportSettings::ImportMode mode)
|
||||
{
|
||||
pGroup->SetInt("ImportMode", static_cast<long>(mode));
|
||||
}
|
||||
|
||||
ImportExportSettings::ImportMode ImportExportSettings::getImportMode() const
|
||||
{
|
||||
return static_cast<ImportExportSettings::ImportMode>(pGroup->GetInt("ImportMode", 0));
|
||||
}
|
||||
|
||||
|
||||
namespace Part {
|
||||
bool ReadColors (const Handle(XSControl_WorkSession) &WS, std::map<int, Quantity_Color>& hash_col);
|
||||
bool ReadNames (const Handle(XSControl_WorkSession) &WS);
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#define _ImportStep_h_
|
||||
|
||||
#include <Mod/Part/PartGlobal.h>
|
||||
#include <Base/Parameter.h>
|
||||
|
||||
|
||||
namespace App {
|
||||
@@ -33,6 +34,43 @@ class Document;
|
||||
namespace Part
|
||||
{
|
||||
|
||||
class PartExport ImportExportSettings
|
||||
{
|
||||
public:
|
||||
enum class ImportMode {
|
||||
SingleDocument = 0,
|
||||
GroupPerDocument = 1,
|
||||
GroupPerDirectory = 2,
|
||||
ObjectPerDocument = 3,
|
||||
ObjectPerDirectory = 4,
|
||||
};
|
||||
ImportExportSettings();
|
||||
void setReadShapeCompoundMode(bool);
|
||||
bool getReadShapeCompoundMode() const;
|
||||
void setExportHiddenObject(bool);
|
||||
bool getExportHiddenObject() const;
|
||||
void setImportHiddenObject(bool);
|
||||
bool getImportHiddenObject() const;
|
||||
void setExportLegacy(bool);
|
||||
bool getExportLegacy() const;
|
||||
void setExportKeepPlacement(bool);
|
||||
bool getExportKeepPlacement() const;
|
||||
void setUseLinkGroup(bool);
|
||||
bool getUseLinkGroup() const;
|
||||
void setUseBaseName(bool);
|
||||
bool getUseBaseName() const;
|
||||
void setReduceObjects(bool);
|
||||
bool getReduceObjects() const;
|
||||
void setExpandCompound(bool);
|
||||
bool getExpandCompound() const;
|
||||
void setShowProgress(bool);
|
||||
bool getShowProgress() const;
|
||||
void setImportMode(ImportMode);
|
||||
ImportMode getImportMode() const;
|
||||
|
||||
private:
|
||||
ParameterGrp::handle pGroup;
|
||||
};
|
||||
|
||||
/** The part shape property
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user