20 #ifndef EXCHANGEPLUGIN_IMPORTFEATURE_H_
21 #define EXCHANGEPLUGIN_IMPORTFEATURE_H_
23 #include "ExchangePlugin.h"
25 #include <ModelAPI_CompositeFeature.h>
26 #include <ModelAPI_Result.h>
27 #include <GeomAPI_Shape.h>
44 static const std::string MY_FILE_PATH_ID(
"file_path");
45 return MY_FILE_PATH_ID;
50 static const std::string MY_FEATURES_ID(
"Features");
51 return MY_FEATURES_ID;
56 static const std::string MY_TARGET_PART_ID(
"target_part");
57 return MY_TARGET_PART_ID;
65 EXCHANGEPLUGIN_EXPORT
virtual const std::string&
getKind() = 0;
71 EXCHANGEPLUGIN_EXPORT
virtual void execute() = 0;
77 virtual std::shared_ptr<ModelAPI_Feature>
addFeature(std::string theID);
83 virtual std::shared_ptr<ModelAPI_Feature>
subFeature(
const int theIndex,
bool forTree =
false);
89 virtual bool isSub(ObjectPtr theObject)
const;
92 virtual void removeFeature(std::shared_ptr<ModelAPI_Feature> theFeature);
96 EXCHANGEPLUGIN_EXPORT
virtual void importFile(
const std::string& theFileName) = 0;
100 std::shared_ptr<GeomAPI_Shape> aGeomShape);
103 void loadNamingDS(std::shared_ptr<GeomAPI_Shape> theGeomShape,
104 std::shared_ptr<ModelAPI_ResultBody> theResultBody);
111 inline static const std::string&
ID()
113 static const std::string MY_IMPORT_ID(
"Import");
119 static const std::string MY_IMPORT_TYPE_ID(
"ImportType");
120 return MY_IMPORT_TYPE_ID;
125 static const std::string MY_STEP_FILE_PATH_ID(
"step_file_path");
126 return MY_STEP_FILE_PATH_ID;
137 static const std::string MY_STEP_SCALE_INTER_UNITS_ID(
"step_scale_inter_units");
138 return MY_STEP_SCALE_INTER_UNITS_ID;
143 static const std::string MY_STEP_MATERIALS_ID(
"step_materials");
144 return MY_STEP_MATERIALS_ID;
149 static const std::string MY_STEP_COLORS_ID(
"step_colors");
150 return MY_STEP_COLORS_ID;
155 static const std::string MY_MEMORY_BUFFER_ID(
"memory_buffer");
156 return MY_MEMORY_BUFFER_ID;
159 EXCHANGEPLUGIN_EXPORT
virtual const std::string&
getKind()
override
165 EXCHANGEPLUGIN_EXPORT
virtual void execute()
override;
171 EXCHANGEPLUGIN_EXPORT
virtual bool isEditable();
175 EXCHANGEPLUGIN_EXPORT
void importFile(
const std::string& theFileName)
override;
178 EXCHANGEPLUGIN_EXPORT
void importXAO(
const std::string& theFileName,
179 const std::string& theMemoryBuff = std::string(),
180 const bool isMemoryImport =
false);
184 void setColorGroups(std::shared_ptr<ModelAPI_ResultBody> theResultBody);
187 void setColorGroup(std::shared_ptr<ModelAPI_ResultBody> theResultBody,
188 std::vector<int>& theColor,
189 const std::wstring& theName );
192 void setMaterielGroup(std::shared_ptr<ModelAPI_ResultBody> theResultBody,
193 std::map< std::wstring, std::list<std::wstring>>& theMaterialShape);
201 inline static const std::string&
ID()
203 static const std::string MY_IMPORT_ID(
"ImportImage");
213 EXCHANGEPLUGIN_EXPORT
virtual const std::string&
getKind()
override
219 EXCHANGEPLUGIN_EXPORT
virtual void execute()
override;
223 EXCHANGEPLUGIN_EXPORT
void importFile(
const std::string& theFileName)
override;
Definition: ExchangePlugin_ImportFeature.h:39
virtual void removeFeature(std::shared_ptr< ModelAPI_Feature > theFeature)
Reimplemented from ModelAPI_CompositeFeature::removeFeature()
Definition: ExchangePlugin_ImportFeature.cpp:615
virtual std::shared_ptr< ModelAPI_Feature > subFeature(const int theIndex, bool forTree=false)
Reimplemented from ModelAPI_CompositeFeature::subFeature()
Definition: ExchangePlugin_ImportFeature.cpp:630
static const std::string & FILE_PATH_ID()
attribute name of file path
Definition: ExchangePlugin_ImportFeature.h:42
void loadNamingDS(std::shared_ptr< GeomAPI_Shape > theGeomShape, std::shared_ptr< ModelAPI_ResultBody > theResultBody)
Loads Naming data structure to the document.
Definition: ExchangePlugin_ImportFeature.cpp:668
virtual std::shared_ptr< ModelAPI_Feature > addFeature(std::string theID)
Reimplemented from ModelAPI_CompositeFeature::addFeature()
Definition: ExchangePlugin_ImportFeature.cpp:603
virtual int numberOfSubs(bool forTree=false) const
Reimplemented from ModelAPI_CompositeFeature::numberOfSubs()
Definition: ExchangePlugin_ImportFeature.cpp:625
virtual void execute()=0
Computes or recomputes the results.
virtual void initAttributes()
Request for initialization of data model of the feature: adding all attributes.
Definition: ExchangePlugin_ImportFeature.cpp:75
std::shared_ptr< ModelAPI_ResultBody > createResultBody(std::shared_ptr< GeomAPI_Shape > aGeomShape)
Creates and prepares a result body from the shape.
Definition: ExchangePlugin_ImportFeature.cpp:173
virtual int subFeatureId(const int theIndex) const
Reimplemented from ModelAPI_CompositeFeature::subFeatureId()
Definition: ExchangePlugin_ImportFeature.cpp:639
virtual ~ExchangePlugin_ImportFeatureBase()=default
Default destructor.
virtual bool isSub(ObjectPtr theObject) const
Reimplemented from ModelAPI_CompositeFeature::isSub()
Definition: ExchangePlugin_ImportFeature.cpp:658
static const std::string & FEATURES_ID()
All features (list of references)
Definition: ExchangePlugin_ImportFeature.h:48
virtual bool isPreviewNeeded() const
Reimplemented from ModelAPI_Feature::isPreviewNeeded(). Returns false.
Definition: ExchangePlugin_ImportFeature.h:74
virtual void importFile(const std::string &theFileName)=0
Performs the import of the file.
ExchangePlugin_ImportFeatureBase()=default
Default constructor.
virtual const std::string & getKind()=0
Returns the unique kind of a feature.
static const std::string & TARGET_PART_ID()
attribute name of target part
Definition: ExchangePlugin_ImportFeature.h:54
Feature for import shapes from the external files in CAD formats.
Definition: ExchangePlugin_ImportFeature.h:108
static const std::string & STEP_MATERIALS_ID()
attribute name of step materiels
Definition: ExchangePlugin_ImportFeature.h:141
virtual ~ExchangePlugin_ImportFeature()=default
Default destructor.
ExchangePlugin_ImportFeature()=default
Default constructor.
static const std::string & ID()
Feature kind.
Definition: ExchangePlugin_ImportFeature.h:111
virtual const std::string & getKind() override
Returns the unique kind of a feature.
Definition: ExchangePlugin_ImportFeature.h:159
virtual bool isEditable()
Return false in case of XAOMem import.
Definition: ExchangePlugin_ImportFeature.cpp:113
static const std::string & STEP_COLORS_ID()
attribute name of step colors
Definition: ExchangePlugin_ImportFeature.h:147
void importXAO(const std::string &theFileName, const std::string &theMemoryBuff=std::string(), const bool isMemoryImport=false)
Performs the import of XAO file.
Definition: ExchangePlugin_ImportFeature.cpp:390
static const std::string & MEMORY_BUFFER_ID()
attribute memory buffer
Definition: ExchangePlugin_ImportFeature.h:153
static const std::string & STEP_FILE_PATH_ID()
attribute name of file path
Definition: ExchangePlugin_ImportFeature.h:123
static const std::string & STEP_SCALE_INTER_UNITS_ID()
attribute name of step Scale to International System Units
Definition: ExchangePlugin_ImportFeature.h:135
virtual void execute() override
Computes or recomputes the results.
Definition: ExchangePlugin_ImportFeature.cpp:128
static const std::string & IMPORT_TYPE_ID()
Feature kind.
Definition: ExchangePlugin_ImportFeature.h:117
void importFile(const std::string &theFileName) override
Performs the import of the file.
Definition: ExchangePlugin_ImportFeature.cpp:182
virtual void initAttributes()
Request for initialization of data model of the feature: adding all attributes.
Definition: ExchangePlugin_ImportFeature.cpp:88
Definition: ExchangePlugin_ImportFeature.h:198
virtual const std::string & getKind() override
Returns the unique kind of a feature.
Definition: ExchangePlugin_ImportFeature.h:213
static const std::string & ID()
Feature kind.
Definition: ExchangePlugin_ImportFeature.h:201
virtual ~ExchangePlugin_Import_ImageFeature()=default
Default destructor.
virtual void execute() override
Computes or recomputes the results.
Definition: ExchangePlugin_ImportFeature.cpp:162
ExchangePlugin_Import_ImageFeature()=default
Default constructor.
void importFile(const std::string &theFileName) override
Performs the import of the file.
Definition: ExchangePlugin_ImportFeature.cpp:688
Feature that consists of other features: like sketcher with edges inside.
Definition: ModelAPI_CompositeFeature.h:33