Salome HOME
CEA : Lot1 - Interpolation
[modules/shaper.git] / src / BuildAPI / BuildAPI_Interpolation.h
1 // Copyright (C) 2014-2020  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_Interpolation_H_
21 #define BuildAPI_Interpolation_H_
22
23 #include "BuildAPI.h"
24
25 #include <BuildPlugin_Interpolation.h>
26
27 #include <ModelHighAPI_Double.h>
28 #include <ModelHighAPI_Integer.h>
29 #include <ModelHighAPI_Interface.h>
30 #include <ModelHighAPI_Macro.h>
31 #include <ModelHighAPI_Selection.h>
32
33 class ModelHighAPI_Selection;
34
35 /// \class BuildAPI_Interpolation
36 /// \ingroup CPPHighAPI
37 /// \brief Interface for Interpolation feature.
38 class BuildAPI_Interpolation : public ModelHighAPI_Interface
39 {
40 public:
41   /// Constructor without values.
42   BUILDAPI_EXPORT
43     explicit BuildAPI_Interpolation(const FeaturePtr& theFeature);
44
45   /// Constructor with values.
46   BUILDAPI_EXPORT
47     explicit BuildAPI_Interpolation(const FeaturePtr& theFeature,
48                                     const std::list<ModelHighAPI_Selection>& theBaseObjects,
49                                     const ModelHighAPI_Selection& theStartTangent,
50                                     const ModelHighAPI_Selection& theEndTangent,
51                                     const bool theIsClosed, const bool theIsToReorder);
52
53   /// Constructor with base objects, closed and reorder parameters.
54   BUILDAPI_EXPORT
55     explicit BuildAPI_Interpolation(const FeaturePtr& theFeature,
56                                     const std::list<ModelHighAPI_Selection>& theBaseObjects,
57                                     const bool theIsClosed, const bool theIsToReorder);
58
59   /// Constructor with expression analytical of X,Y andZ
60   BUILDAPI_EXPORT
61     explicit BuildAPI_Interpolation(const FeaturePtr& theFeature,
62                                     const std::string & theXTexpression,
63                                     const std::string & theYTexpression,
64                                     const std::string & theZTexpression,
65                                     const ModelHighAPI_Double& theMinT,
66                                     const ModelHighAPI_Double& theMaxT,
67                                     const ModelHighAPI_Integer& theNbStep);
68
69   /// Destructor.
70   BUILDAPI_EXPORT
71   virtual ~BuildAPI_Interpolation();
72
73   INTERFACE_13(BuildPlugin_Interpolation::ID(),
74               baseObjects, BuildPlugin_Interpolation::BASE_OBJECTS_ID(),
75               ModelAPI_AttributeSelectionList, /** Base objects */,
76               closed, BuildPlugin_Interpolation::CLOSED_ID(),
77               ModelAPI_AttributeBoolean, /** Closed flag */,
78               reorder, BuildPlugin_Interpolation::REORDER_ID(),
79               ModelAPI_AttributeBoolean, /** Reorder flag */,
80               useTangents, BuildPlugin_Interpolation::USE_TANGENTS_ID(),
81               ModelAPI_AttributeString, /** Use tangents flag */,
82               startTangent, BuildPlugin_Interpolation::TANGENT_START_ID(),
83               ModelAPI_AttributeSelection, /** Start point tangent */,
84               endTangent, BuildPlugin_Interpolation::TANGENT_END_ID(),
85               ModelAPI_AttributeSelection, /** End point tangent */,
86               xt, BuildPlugin_Interpolation::XT_ID(),
87               ModelAPI_AttributeString, /** xt expression*/,
88               yt, BuildPlugin_Interpolation::YT_ID(),
89               ModelAPI_AttributeString, /** yt expression*/,
90               zt, BuildPlugin_Interpolation::ZT_ID(),
91               ModelAPI_AttributeString, /** zt expression*/,
92               mint, BuildPlugin_Interpolation::MINT_ID(),
93               ModelAPI_AttributeDouble, /** Min*/,
94               maxt, BuildPlugin_Interpolation::MAXT_ID(),
95               ModelAPI_AttributeDouble, /** Max*/,
96               numstep, BuildPlugin_Interpolation::NUMSTEP_ID(),
97               ModelAPI_AttributeInteger, /** Number of steps*/,
98               creationmethod, BuildPlugin_Interpolation::CREATION_METHOD_ID(),
99               ModelAPI_AttributeString, /** Creation method*/)
100
101   /// Modify base attribute of the feature.
102   BUILDAPI_EXPORT
103   void setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects);
104
105   /// Set closed flag
106   BUILDAPI_EXPORT void setClosed(const bool theIsClosed);
107
108   /// Set reorder flag
109   BUILDAPI_EXPORT void setReorder(const bool theIsToReorder);
110
111   /// Set use tangents flag
112   BUILDAPI_EXPORT void setUseTangents(const bool theIsToUseTangents);
113
114   /// Set start and end tangents
115   BUILDAPI_EXPORT void setTangents(const ModelHighAPI_Selection& theStartTangent,
116                                    const ModelHighAPI_Selection& theEndTangent);
117
118   /// Dump wrapped feature
119   BUILDAPI_EXPORT
120   virtual void dump(ModelHighAPI_Dumper& theDumper) const;
121
122 private:
123   void execIfBaseNotEmpty();
124 };
125
126 /// Pointer on Interpolation object.
127 typedef std::shared_ptr<BuildAPI_Interpolation> InterpolationPtr;
128
129 /// \ingroup CPPHighAPI
130 /// \brief Create Interpolation feature.
131 BUILDAPI_EXPORT
132 InterpolationPtr addInterpolation(const std::shared_ptr<ModelAPI_Document>& thePart,
133                                   const std::list<ModelHighAPI_Selection>& theBaseObjects,
134                                   const bool theIsClosed = false,
135                                   const bool theIsToReorder = false);
136
137 /// \ingroup CPPHighAPI
138 /// \brief Create Interpolation feature using tangents.
139 BUILDAPI_EXPORT
140 InterpolationPtr addInterpolation(const std::shared_ptr<ModelAPI_Document>& thePart,
141                                   const std::list<ModelHighAPI_Selection>& theBaseObjects,
142                                   const ModelHighAPI_Selection& theStartTangent,
143                                   const ModelHighAPI_Selection& theEndTangent,
144                                   const bool theIsClosed = false,
145                                   const bool theIsToReorder = false);
146
147 /// \ingroup CPPHighAPI
148 /// \brief Create Interpolation feature using tangents.
149 BUILDAPI_EXPORT
150 InterpolationPtr addInterpolation(const std::shared_ptr<ModelAPI_Document>& thePart,
151                                   const std::string & theXTexpression,
152                                   const std::string & theYTexpression,
153                                   const std::string & theZTexpression,
154                                   const ModelHighAPI_Double& theMinT,
155                                   const ModelHighAPI_Double& theMaxT,
156                                   const ModelHighAPI_Integer& theNbStep);
157
158 #endif // BuildAPI_Interpolation_H_