1 // Copyright (C) 2014-2020 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef BuildPlugin_Filling_H_
21 #define BuildPlugin_Filling_H_
23 #include "BuildPlugin.h"
25 #include <ModelAPI_Feature.h>
30 class GeomAlgoAPI_MakeShape;
35 /// \class BuildPlugin_Filling
37 /// \brief Feature for creation of face from list of edges (1D objects).
38 class BuildPlugin_Filling: public ModelAPI_Feature
41 /// Use plugin manager for features creation
42 BuildPlugin_Filling();
45 inline static const std::string& ID()
47 static const std::string MY_ID("Filling");
51 /// \return the kind of a feature.
52 BUILDPLUGIN_EXPORT virtual const std::string& getKind()
54 static std::string MY_KIND = BuildPlugin_Filling::ID();
58 /// Attribute name of base objects.
59 inline static const std::string& BASE_OBJECTS_ID()
61 static const std::string MY_BASE_OBJECTS_ID("base_objects");
62 return MY_BASE_OBJECTS_ID;
65 /// Attribute name of advanced options.
66 inline static const std::string& ADVANCED_OPTIONS_ID()
68 static const std::string MY_ADVANCED_OPTIONS_ID("advanced_options");
69 return MY_ADVANCED_OPTIONS_ID;
72 /// Attribute name of method of edge orientation.
73 inline static const std::string& METHOD_ID()
75 static const std::string MY_METHOD_ID("orientation");
79 /// Supported methods for edge orientation correction
81 inline static const std::string& AUTO_CORRECT_ORIENTATION()
83 static const std::string MY_AUTO_CORRECT_ORIENTATION("auto_correct");
84 return MY_AUTO_CORRECT_ORIENTATION;
86 inline static const std::string& USE_CURVE_INFORMATION()
88 static const std::string MY_USE_CURVE_INFORMATION("curve_info");
89 return MY_USE_CURVE_INFORMATION;
91 inline static const std::string& USE_EDGES_ORIENTATION()
93 static const std::string MY_USE_EDGES_ORIENTATION("edge_orient");
94 return MY_USE_EDGES_ORIENTATION;
98 /// Attribute name of minimal degree.
99 inline static const std::string& MINIMAL_DEGREE_ID()
101 static const std::string MY_MINIMAL_DEGREE_ID("min_degree");
102 return MY_MINIMAL_DEGREE_ID;
105 /// Attribute name of maximal degree.
106 inline static const std::string& MAXIMAL_DEGREE_ID()
108 static const std::string MY_MAXIMAL_DEGREE_ID("max_degree");
109 return MY_MAXIMAL_DEGREE_ID;
112 /// Attribute name of number of iterations.
113 inline static const std::string& NUMBER_OF_ITERATIONS_ID()
115 static const std::string MY_NUMBER_OF_ITERATIONS_ID("nb_iter");
116 return MY_NUMBER_OF_ITERATIONS_ID;
119 /// Attribute name of 2D tolerance.
120 inline static const std::string& TOLERANCE_2D_ID()
122 static const std::string MY_TOLERANCE_2D_ID("tol_2d");
123 return MY_TOLERANCE_2D_ID;
126 /// Attribute name of 3D tolerance.
127 inline static const std::string& TOLERANCE_3D_ID()
129 static const std::string MY_TOLERANCE_3D_ID("tol_3d");
130 return MY_TOLERANCE_3D_ID;
133 /// Attribute name of approximation.
134 inline static const std::string& APPROXIMATION_ID()
136 static const std::string MY_APPROXIMATION_ID("approximation");
137 return MY_APPROXIMATION_ID;
140 /// Default value of the orientation
141 inline static const std::string& METHOD_DEFAULT() { return Method::AUTO_CORRECT_ORIENTATION(); }
142 /// Default value of minimal degree
143 inline static int MINIMAL_DEGREE_DEFAULT() { return 2; }
144 /// Default value of maximal degree
145 inline static int MAXIMAL_DEGREE_DEFAULT() { return 5; }
146 /// Default value of number of iterations
147 inline static int NUMBER_OF_ITERATIONS_DEFAULT() { return 0; }
148 /// Default value of 2D tolerance
149 inline static double TOLERANCE_2D_DEFAULT() { return 1.e-4; }
150 /// Default value of 3D tolerance
151 inline static double TOLERANCE_3D_DEFAULT() { return 1.e-4; }
152 /// Default value of the approximation attribute
153 inline static bool APPROXIMATION_DEFAULT() { return false; }
155 /// Request for initialization of data model of the feature: adding all attributes.
156 BUILDPLUGIN_EXPORT virtual void initAttributes();
158 /// Creates a new part document if needed.
159 BUILDPLUGIN_EXPORT virtual void execute();
161 /// Called on change of any argument-attribute of this object.
162 /// \param[in] theID identifier of changed attribute.
163 BUILDPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
166 /// Convert shape to edge according to construction method
167 std::shared_ptr<GeomAPI_Edge> toEdge(const std::shared_ptr<GeomAPI_Shape>& theShape,
168 const std::string& theMethod);
170 /// Update values of attributes by their default values
171 void restoreDefaultParameters();
174 std::shared_ptr<GeomAPI_Edge> myLastEdge;