Salome HOME
bb38dfcbff277c556ae6a7bde706245ddaa48a09
[modules/shaper.git] / src / FeaturesAPI / FeaturesAPI_Defeaturing.h
1 // Copyright (C) 2020-2023  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 FeaturesAPI_Defeaturing_H_
21 #define FeaturesAPI_Defeaturing_H_
22
23 #include "FeaturesAPI.h"
24
25 #include <FeaturesPlugin_Defeaturing.h>
26
27 #include <ModelHighAPI_Interface.h>
28 #include <ModelHighAPI_Macro.h>
29
30 class ModelHighAPI_Selection;
31
32 /// \class FeaturesAPI_Defeaturing
33 /// \ingroup CPPHighAPI
34 /// \brief Interface for the Defeaturing feature.
35 class FeaturesAPI_Defeaturing: public ModelHighAPI_Interface
36 {
37 public:
38   /// Constructor without values.
39   FEATURESAPI_EXPORT
40   explicit FeaturesAPI_Defeaturing(const std::shared_ptr<ModelAPI_Feature>& theFeature);
41
42   /// Constructor with values.
43   FEATURESAPI_EXPORT
44   explicit FeaturesAPI_Defeaturing(const std::shared_ptr<ModelAPI_Feature>& theFeature,
45                                    const std::list<ModelHighAPI_Selection>& theFacesToRemove);
46
47   /// Destructor.
48   FEATURESAPI_EXPORT
49   virtual ~FeaturesAPI_Defeaturing();
50
51   INTERFACE_1(FeaturesPlugin_Defeaturing::ID(),
52               baseObjects, FeaturesPlugin_Defeaturing::OBJECT_LIST_ID(),
53               ModelAPI_AttributeSelectionList, /** Base objects */)
54
55   /// Modify faces to be removed.
56   FEATURESAPI_EXPORT
57   void setFaces(const std::list<ModelHighAPI_Selection>& theFacesToRemove);
58
59   /// Dump wrapped feature
60   FEATURESAPI_EXPORT
61   virtual void dump(ModelHighAPI_Dumper& theDumper) const;
62
63 private:
64   void execIfBaseNotEmpty();
65 };
66
67 /// Pointer on the Defeaturing object.
68 typedef std::shared_ptr<FeaturesAPI_Defeaturing> DefeaturingPtr;
69
70 /// \ingroup CPPHighAPI
71 /// \brief Create Defeaturing feature.
72 FEATURESAPI_EXPORT
73 DefeaturingPtr addDefeaturing(const std::shared_ptr<ModelAPI_Document>& thePart,
74                               const std::list<ModelHighAPI_Selection>& theFaces);
75
76 #endif // FeaturesAPI_Defeaturing_H_