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