SHAPER  9.12.0
BuildPlugin_Filling.h
1 // Copyright (C) 2014-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 BuildPlugin_Filling_H_
21 #define BuildPlugin_Filling_H_
22 
23 #include "BuildPlugin.h"
24 
25 #include <ModelAPI_Feature.h>
26 
27 #include <memory>
28 #include <string>
29 
31 class GeomAPI_Edge;
32 class GeomAPI_Pnt;
33 class GeomAPI_Shape;
34 
39 {
40 public:
43 
45  inline static const std::string& ID()
46  {
47  static const std::string MY_ID("Filling");
48  return MY_ID;
49  }
50 
52  BUILDPLUGIN_EXPORT virtual const std::string& getKind()
53  {
54  static std::string MY_KIND = BuildPlugin_Filling::ID();
55  return MY_KIND;
56  }
57 
59  inline static const std::string& BASE_OBJECTS_ID()
60  {
61  static const std::string MY_BASE_OBJECTS_ID("base_objects");
62  return MY_BASE_OBJECTS_ID;
63  }
64 
66  inline static const std::string& ADVANCED_OPTIONS_ID()
67  {
68  static const std::string MY_ADVANCED_OPTIONS_ID("advanced_options");
69  return MY_ADVANCED_OPTIONS_ID;
70  }
71 
73  inline static const std::string& METHOD_ID()
74  {
75  static const std::string MY_METHOD_ID("orientation");
76  return MY_METHOD_ID;
77  }
78 
80  struct Method {
81  inline static const std::string& AUTO_CORRECT_ORIENTATION()
82  {
83  static const std::string MY_AUTO_CORRECT_ORIENTATION("auto_correct");
84  return MY_AUTO_CORRECT_ORIENTATION;
85  }
86  inline static const std::string& USE_CURVE_INFORMATION()
87  {
88  static const std::string MY_USE_CURVE_INFORMATION("curve_info");
89  return MY_USE_CURVE_INFORMATION;
90  }
91  inline static const std::string& USE_EDGES_ORIENTATION()
92  {
93  static const std::string MY_USE_EDGES_ORIENTATION("edge_orient");
94  return MY_USE_EDGES_ORIENTATION;
95  }
96  };
97 
99  inline static const std::string& MINIMAL_DEGREE_ID()
100  {
101  static const std::string MY_MINIMAL_DEGREE_ID("min_degree");
102  return MY_MINIMAL_DEGREE_ID;
103  }
104 
106  inline static const std::string& MAXIMAL_DEGREE_ID()
107  {
108  static const std::string MY_MAXIMAL_DEGREE_ID("max_degree");
109  return MY_MAXIMAL_DEGREE_ID;
110  }
111 
113  inline static const std::string& NUMBER_OF_ITERATIONS_ID()
114  {
115  static const std::string MY_NUMBER_OF_ITERATIONS_ID("nb_iter");
116  return MY_NUMBER_OF_ITERATIONS_ID;
117  }
118 
120  inline static const std::string& TOLERANCE_2D_ID()
121  {
122  static const std::string MY_TOLERANCE_2D_ID("tol_2d");
123  return MY_TOLERANCE_2D_ID;
124  }
125 
127  inline static const std::string& TOLERANCE_3D_ID()
128  {
129  static const std::string MY_TOLERANCE_3D_ID("tol_3d");
130  return MY_TOLERANCE_3D_ID;
131  }
132 
134  inline static const std::string& APPROXIMATION_ID()
135  {
136  static const std::string MY_APPROXIMATION_ID("approximation");
137  return MY_APPROXIMATION_ID;
138  }
139 
141  inline static const std::string& METHOD_DEFAULT() { return Method::AUTO_CORRECT_ORIENTATION(); }
143  inline static int MINIMAL_DEGREE_DEFAULT() { return 2; }
145  inline static int MAXIMAL_DEGREE_DEFAULT() { return 5; }
147  inline static int NUMBER_OF_ITERATIONS_DEFAULT() { return 0; }
149  inline static double TOLERANCE_2D_DEFAULT() { return 1.e-4; }
151  inline static double TOLERANCE_3D_DEFAULT() { return 1.e-4; }
153  inline static bool APPROXIMATION_DEFAULT() { return false; }
154 
156  BUILDPLUGIN_EXPORT virtual void initAttributes();
157 
159  BUILDPLUGIN_EXPORT virtual void execute();
160 
163  BUILDPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
164 
165 private:
167  std::shared_ptr<GeomAPI_Edge> toEdge(const std::shared_ptr<GeomAPI_Shape>& theShape,
168  const std::string& theMethod);
169 
171  void restoreDefaultParameters();
172 
173 private:
174  std::shared_ptr<GeomAPI_Edge> myLastEdge;
175 };
176 
177 #endif
Feature for creation of face from list of edges (1D objects).
Definition: BuildPlugin_Filling.h:39
static const std::string & TOLERANCE_3D_ID()
Attribute name of 3D tolerance.
Definition: BuildPlugin_Filling.h:127
static const std::string & ID()
Feature kind.
Definition: BuildPlugin_Filling.h:45
static const std::string & APPROXIMATION_ID()
Attribute name of approximation.
Definition: BuildPlugin_Filling.h:134
static const std::string & MINIMAL_DEGREE_ID()
Attribute name of minimal degree.
Definition: BuildPlugin_Filling.h:99
static double TOLERANCE_3D_DEFAULT()
Default value of 3D tolerance.
Definition: BuildPlugin_Filling.h:151
static const std::string & BASE_OBJECTS_ID()
Attribute name of base objects.
Definition: BuildPlugin_Filling.h:59
static const std::string & ADVANCED_OPTIONS_ID()
Attribute name of advanced options.
Definition: BuildPlugin_Filling.h:66
static const std::string & METHOD_ID()
Attribute name of method of edge orientation.
Definition: BuildPlugin_Filling.h:73
static int MAXIMAL_DEGREE_DEFAULT()
Default value of maximal degree.
Definition: BuildPlugin_Filling.h:145
static int MINIMAL_DEGREE_DEFAULT()
Default value of minimal degree.
Definition: BuildPlugin_Filling.h:143
virtual const std::string & getKind()
Definition: BuildPlugin_Filling.h:52
BuildPlugin_Filling()
Use plugin manager for features creation.
Definition: BuildPlugin_Filling.cpp:65
static bool APPROXIMATION_DEFAULT()
Default value of the approximation attribute.
Definition: BuildPlugin_Filling.h:153
virtual void attributeChanged(const std::string &theID)
Called on change of any argument-attribute of this object.
Definition: BuildPlugin_Filling.cpp:148
static double TOLERANCE_2D_DEFAULT()
Default value of 2D tolerance.
Definition: BuildPlugin_Filling.h:149
static const std::string & TOLERANCE_2D_ID()
Attribute name of 2D tolerance.
Definition: BuildPlugin_Filling.h:120
static int NUMBER_OF_ITERATIONS_DEFAULT()
Default value of number of iterations.
Definition: BuildPlugin_Filling.h:147
static const std::string & MAXIMAL_DEGREE_ID()
Attribute name of maximal degree.
Definition: BuildPlugin_Filling.h:106
virtual void initAttributes()
Request for initialization of data model of the feature: adding all attributes.
Definition: BuildPlugin_Filling.cpp:70
virtual void execute()
Creates a new part document if needed.
Definition: BuildPlugin_Filling.cpp:87
static const std::string & METHOD_DEFAULT()
Default value of the orientation.
Definition: BuildPlugin_Filling.h:141
static const std::string & NUMBER_OF_ITERATIONS_ID()
Attribute name of number of iterations.
Definition: BuildPlugin_Filling.h:113
Interface to the edge object.
Definition: GeomAPI_Edge.h:38
3D point defined by three coordinates
Definition: GeomAPI_Pnt.h:38
Interface to the topological shape object.
Definition: GeomAPI_Shape.h:43
Interface to the root class of all topological shapes constructions.
Definition: GeomAlgoAPI_MakeShape.h:35
Feature function that represents the particular functionality of this operation.
Definition: ModelAPI_Feature.h:39
Supported methods for edge orientation correction.
Definition: BuildPlugin_Filling.h:80