SHAPER 9.16.0
ExchangePlugin_Import.h
1// Copyright (C) 2014-2026 CEA, EDF
2//
3// This library is free software; you can redistribute it and/or
4// modify it under the terms of the GNU Lesser General Public
5// License as published by the Free Software Foundation; either
6// version 2.1 of the License, or (at your option) any later version.
7//
8// This library is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11// Lesser General Public License for more details.
12//
13// You should have received a copy of the GNU Lesser General Public
14// License along with this library; if not, write to the Free Software
15// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16//
17// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18//
19
20#ifndef EXCHANGEPLUGIN_IMPORT_H_
21#define EXCHANGEPLUGIN_IMPORT_H_
22
23#include "ExchangePlugin.h"
24
25#include <ModelAPI_CompositeFeature.h>
26#include <ModelAPI_Result.h>
27#include <ModelAPI_AttributeInteger.h>
28#include <ModelAPI_AttributeStringArray.h>
29#include <map>
30
31
40{
41 public:
43 inline static const std::string& FILE_PATH_ID()
44 {
45 static const std::string MY_FILE_PATH_ID("file_path");
46 return MY_FILE_PATH_ID;
47 }
49 inline static const std::string& TARGET_PART_ID()
50 {
51 static const std::string MY_TARGET_PART_ID("target_part");
52 return MY_TARGET_PART_ID;
53 }
55 inline static const std::string& TARGET_PARTS_LIST_ID()
56 {
57 static const std::string MY_TARGET_PARTS_LIST_ID("target_parts_list");
58 return MY_TARGET_PARTS_LIST_ID;
59 }
61 EXCHANGEPLUGIN_EXPORT ExchangePlugin_ImportBase()= default;
63 EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_ImportBase()= default;
64
65
67 EXCHANGEPLUGIN_EXPORT virtual void initAttributes();
68
71 EXCHANGEPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID) = 0;
72
74 EXCHANGEPLUGIN_EXPORT virtual void execute() = 0;
75
77 EXCHANGEPLUGIN_EXPORT virtual bool isMacro() const { return true; }
78
80 EXCHANGEPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; }
81
82 protected:
83
84 EXCHANGEPLUGIN_EXPORT void updatePart(AttributeStringArrayPtr& aPartsAttr,
85 AttributeIntegerPtr& aTargetAttr);
86};
87
89{
90 public:
92 inline static const std::string& ID()
93 {
94 static const std::string MY_IMPORT_ID("ImportMacro");
95 return MY_IMPORT_ID;
96 }
98 inline static const std::string& IMPORT_TYPE_ID()
99 {
100 static const std::string MY_IMPORT_TYPE_ID("ImportType");
101 return MY_IMPORT_TYPE_ID;
102 }
104 inline static const std::string& STEP_FILE_PATH_ID()
105 {
106 static const std::string MY_STEP_FILE_PATH_ID("step_file_path");
107 return MY_STEP_FILE_PATH_ID;
108 }
110 inline static const std::string& STEP_TARGET_PART_ID()
111 {
112 static const std::string MY_STEP_TARGET_PART_ID("step_target_part");
113 return MY_STEP_TARGET_PART_ID;
114 }
116 inline static const std::string& STEP_TARGET_PARTS_LIST_ID()
117 {
118 static const std::string MY_STEP_TARGET_PARTS_LIST_ID("step_target_parts_list");
119 return MY_STEP_TARGET_PARTS_LIST_ID;
120 }
122 inline static const std::string& STEP_SCALE_INTER_UNITS_ID()
123 {
124 static const std::string MY_STEP_SCALE_INTER_UNITS_ID("step_scale_inter_units");
125 return MY_STEP_SCALE_INTER_UNITS_ID;
126 }
128 inline static const std::string& STEP_MATERIALS_ID()
129 {
130 static const std::string MY_STEP_MATERIALS_ID("step_materials");
131 return MY_STEP_MATERIALS_ID;
132 }
134 inline static const std::string& STEP_COLORS_ID()
135 {
136 static const std::string MY_STEP_COLORS_ID("step_colors");
137 return MY_STEP_COLORS_ID;
138 }
140 EXCHANGEPLUGIN_EXPORT ExchangePlugin_Import() = default;
142 EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_Import() = default;
143
145 EXCHANGEPLUGIN_EXPORT virtual const std::string& getKind() override
146 {
148 }
150 EXCHANGEPLUGIN_EXPORT virtual void execute() override;
151
153 EXCHANGEPLUGIN_EXPORT virtual void initAttributes();
154
155 // Called on change of any argument-attribute of this object
157 EXCHANGEPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID) override;
158
159};
160
162{
163 public:
165 inline static const std::string& ID()
166 {
167 static const std::string MY_IMPORT_ID("ImportImageMacro");
168 return MY_IMPORT_ID;
169 }
170
172 EXCHANGEPLUGIN_EXPORT ExchangePlugin_Import_Image() = default;
174 EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_Import_Image() = default;
175
177 EXCHANGEPLUGIN_EXPORT virtual const std::string& getKind() override
178 {
180 }
181
183 EXCHANGEPLUGIN_EXPORT virtual void execute() override;
184
185 // Called on change of any argument-attribute of this object
187 EXCHANGEPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID) override;
188
189};
190
191#endif /* IMPORT_IMPORTFEATURE_H_ */
Definition: ExchangePlugin_Import.h:40
static const std::string & TARGET_PART_ID()
attribute name of target part
Definition: ExchangePlugin_Import.h:49
ExchangePlugin_ImportBase()=default
Default constructor.
static const std::string & TARGET_PARTS_LIST_ID()
attribute name of list of target parts
Definition: ExchangePlugin_Import.h:55
virtual void initAttributes()
Request for initialization of data model of the feature: adding all attributes.
Definition: ExchangePlugin_Import.cpp:74
virtual bool isMacro() const
Returns true if this feature is used as macro: creates other features and then removed.
Definition: ExchangePlugin_Import.h:77
static const std::string & FILE_PATH_ID()
attribute name of file path
Definition: ExchangePlugin_Import.h:43
virtual void attributeChanged(const std::string &theID)=0
Called on change of any argument-attribute of this object.
virtual bool isPreviewNeeded() const
Reimplemented from ModelAPI_Feature::isPreviewNeeded(). Returns false.
Definition: ExchangePlugin_Import.h:80
virtual ~ExchangePlugin_ImportBase()=default
Default destructor.
virtual void execute()=0
Computes or recomputes the results.
Definition: ExchangePlugin_Import.h:162
ExchangePlugin_Import_Image()=default
Default constructor.
virtual void attributeChanged(const std::string &theID) override
Definition: ExchangePlugin_Import.cpp:225
virtual void execute() override
Computes or recomputes the results.
Definition: ExchangePlugin_Import.cpp:175
virtual ~ExchangePlugin_Import_Image()=default
Default destructor.
static const std::string & ID()
Feature kind.
Definition: ExchangePlugin_Import.h:165
virtual const std::string & getKind() override
Returns the unique kind of a feature.
Definition: ExchangePlugin_Import.h:177
Definition: ExchangePlugin_Import.h:89
static const std::string & STEP_COLORS_ID()
attribute name of step colors
Definition: ExchangePlugin_Import.h:134
static const std::string & STEP_TARGET_PARTS_LIST_ID()
attribute name of list ofstep target parts
Definition: ExchangePlugin_Import.h:116
static const std::string & STEP_FILE_PATH_ID()
attribute name of step file path
Definition: ExchangePlugin_Import.h:104
ExchangePlugin_Import()=default
Default constructor.
virtual void execute() override
Computes or recomputes the results.
Definition: ExchangePlugin_Import.cpp:115
static const std::string & STEP_MATERIALS_ID()
attribute name of step materiels
Definition: ExchangePlugin_Import.h:128
static const std::string & STEP_TARGET_PART_ID()
attribute name of step target part
Definition: ExchangePlugin_Import.h:110
virtual const std::string & getKind() override
Returns the unique kind of a feature.
Definition: ExchangePlugin_Import.h:145
static const std::string & ID()
Feature kind.
Definition: ExchangePlugin_Import.h:92
virtual ~ExchangePlugin_Import()=default
Default destructor.
virtual void initAttributes()
Request for initialization of data model of the feature: adding all attributes.
Definition: ExchangePlugin_Import.cpp:81
virtual void attributeChanged(const std::string &theID) override
Definition: ExchangePlugin_Import.cpp:200
static const std::string & STEP_SCALE_INTER_UNITS_ID()
attribute name of step Scale to International System Units
Definition: ExchangePlugin_Import.h:122
static const std::string & IMPORT_TYPE_ID()
Feature kind.
Definition: ExchangePlugin_Import.h:98
Feature function that represents the particular functionality of this operation.
Definition: ModelAPI_Feature.h:41