Salome HOME
Merge branch 'csgroup_IS2'
[modules/shaper.git] / src / BuildAPI / BuildAPI_Filling.h
1 // Copyright (C) 2017-2021  CEA/DEN, EDF R&D
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 BuildAPI_Filling_H_
21 #define BuildAPI_Filling_H_
22
23 #include "BuildAPI.h"
24
25 #include <BuildPlugin_Filling.h>
26
27 #include <ModelHighAPI_Interface.h>
28 #include <ModelHighAPI_Macro.h>
29
30 class ModelHighAPI_Selection;
31
32 /// \class BuildAPI_Filling
33 /// \ingroup CPPHighAPI
34 /// \brief Interface for Filling feature.
35 class BuildAPI_Filling : public ModelHighAPI_Interface
36 {
37 public:
38   /// Constructor without values.
39   BUILDAPI_EXPORT explicit BuildAPI_Filling(const std::shared_ptr<ModelAPI_Feature>& theFeature);
40
41   /// Constructor with base objects.
42   BUILDAPI_EXPORT
43   explicit BuildAPI_Filling(const std::shared_ptr<ModelAPI_Feature>& theFeature,
44                             const std::list<ModelHighAPI_Selection>& theBaseObjects);
45
46   /// Constructor with values.
47   BUILDAPI_EXPORT
48   explicit BuildAPI_Filling(const std::shared_ptr<ModelAPI_Feature>& theFeature,
49                             const std::list<ModelHighAPI_Selection>& theBaseObjects,
50                             const std::string& theOrientCorrection,
51                             const int theMinDegree,
52                             const int theMaxDegree,
53                             const int theNbIter,
54                             const double theTolerance2D,
55                             const double theTolerance3D,
56                             const bool theApproximate);
57
58   /// Destructor.
59   BUILDAPI_EXPORT virtual ~BuildAPI_Filling();
60
61   INTERFACE_8(BuildPlugin_Filling::ID(),
62               baseObjects, BuildPlugin_Filling::BASE_OBJECTS_ID(),
63                            ModelAPI_AttributeSelectionList,
64                            /** Base objects */,
65               orientationMethod, BuildPlugin_Filling::METHOD_ID(),
66                                  ModelAPI_AttributeString,
67                                  /** Method to keep edge orientaion */,
68               minDegree, BuildPlugin_Filling::MINIMAL_DEGREE_ID(),
69                          ModelAPI_AttributeInteger,
70                          /** Minimal degree */,
71               maxDegree, BuildPlugin_Filling::MAXIMAL_DEGREE_ID(),
72                          ModelAPI_AttributeInteger,
73                          /** Maximal degree */,
74               nbIterations, BuildPlugin_Filling::NUMBER_OF_ITERATIONS_ID(),
75                             ModelAPI_AttributeInteger,
76                             /** Number of iterations */,
77               tolerance2d, BuildPlugin_Filling::TOLERANCE_2D_ID(),
78                            ModelAPI_AttributeDouble,
79                            /** 2D tolerance */,
80               tolerance3d, BuildPlugin_Filling::TOLERANCE_3D_ID(),
81                            ModelAPI_AttributeDouble,
82                            /** 3D tolerance */,
83               approximate, BuildPlugin_Filling::APPROXIMATION_ID(),
84                            ModelAPI_AttributeBoolean,
85                            /** Approximate original edges */)
86
87   /// Modify base attribute of the feature.
88   BUILDAPI_EXPORT void setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects);
89
90   /// Modify orientation method
91   BUILDAPI_EXPORT void setOrientationMethod(const std::string& theMethod);
92
93   /// Modify minimal degree of result B-spline
94   BUILDAPI_EXPORT void setMinDegree(const int theMinDegree);
95
96   /// Modify maximal degree of result B-spline
97   BUILDAPI_EXPORT void setMaxDegree(const int theMaxDegree);
98
99   /// Modify number of iterations
100   BUILDAPI_EXPORT void setNbIterations(const int theNbIter);
101
102   /// Set 2D tolerance
103   BUILDAPI_EXPORT void setTolerance2d(const double theTol2d);
104
105   /// Set 3D tolerance
106   BUILDAPI_EXPORT void setTolerance3d(const double theTol3d);
107
108   /// Set approximation flag
109   BUILDAPI_EXPORT void setApproximation(const bool theApproximate);
110
111   /// Dump wrapped feature
112   BUILDAPI_EXPORT virtual void dump(ModelHighAPI_Dumper& theDumper) const;
113
114 private:
115   void execIfBaseNotEmpty();
116   void setAdvancedOptions(bool isEnabled = true);
117 };
118
119 /// Pointer on Face object.
120 typedef std::shared_ptr<BuildAPI_Filling> FillingPtr;
121
122 /// \ingroup CPPHighAPI
123 /// \brief Create Filling feature.
124 BUILDAPI_EXPORT FillingPtr addFilling(const std::shared_ptr<ModelAPI_Document>& thePart,
125                                       const std::list<ModelHighAPI_Selection>& theBaseObjects);
126
127 /// \ingroup CPPHighAPI
128 /// \brief Create Filling feature.
129 BUILDAPI_EXPORT FillingPtr addFilling(
130       const std::shared_ptr<ModelAPI_Document>& thePart,
131       const std::list<ModelHighAPI_Selection>& theBaseObjects,
132       const std::string& theOrientCorrection,
133       const int theMinDegree = BuildPlugin_Filling::MINIMAL_DEGREE_DEFAULT(),
134       const int theMaxDegree = BuildPlugin_Filling::MAXIMAL_DEGREE_DEFAULT(),
135       const int theNbIter = BuildPlugin_Filling::NUMBER_OF_ITERATIONS_DEFAULT(),
136       const double theTolerance2D = BuildPlugin_Filling::TOLERANCE_2D_DEFAULT(),
137       const double theTolerance3D = BuildPlugin_Filling::TOLERANCE_3D_DEFAULT(),
138       const bool theApproximate = BuildPlugin_Filling::APPROXIMATION_DEFAULT());
139
140 #endif // BuildAPI_Filling_H_