Salome HOME
Issue #2560: Add Interpolation feature to Build plugin for creation a curve by the...
[modules/shaper.git] / src / BuildAPI / BuildAPI_Interpolation.h
1 // Copyright (C) 2014-2017  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_Interpolation_H_
22 #define BuildAPI_Interpolation_H_
23
24 #include "BuildAPI.h"
25
26 #include <BuildPlugin_Interpolation.h>
27
28 #include <ModelHighAPI_Interface.h>
29 #include <ModelHighAPI_Macro.h>
30 #include <ModelHighAPI_Selection.h>
31
32 class ModelHighAPI_Selection;
33
34 /// \class BuildAPI_Interpolation
35 /// \ingroup CPPHighAPI
36 /// \brief Interface for Interpolation feature.
37 class BuildAPI_Interpolation : public ModelHighAPI_Interface
38 {
39 public:
40   /// Constructor without values.
41   BUILDAPI_EXPORT
42     explicit BuildAPI_Interpolation(const FeaturePtr& theFeature);
43
44   /// Constructor with values.
45   BUILDAPI_EXPORT
46     explicit BuildAPI_Interpolation(const FeaturePtr& theFeature,
47                                     const std::list<ModelHighAPI_Selection>& theBaseObjects,
48                                     const ModelHighAPI_Selection& theStartTangent,
49                                     const ModelHighAPI_Selection& theEndTangent,
50                                     const bool theIsClosed, const bool theIsToReorder);
51
52   /// Constructor with base objects, closed and reorder parameters.
53   BUILDAPI_EXPORT
54     explicit BuildAPI_Interpolation(const FeaturePtr& theFeature,
55                                     const std::list<ModelHighAPI_Selection>& theBaseObjects,
56                                     const bool theIsClosed, const bool theIsToReorder);
57
58   /// Destructor.
59   BUILDAPI_EXPORT
60   virtual ~BuildAPI_Interpolation();
61
62   INTERFACE_6(BuildPlugin_Interpolation::ID(),
63               baseObjects, BuildPlugin_Interpolation::BASE_OBJECTS_ID(),
64               ModelAPI_AttributeSelectionList, /** Base objects */,
65               closed, BuildPlugin_Interpolation::CLOSED_ID(),
66               ModelAPI_AttributeBoolean, /** Closed flag */,
67               reorder, BuildPlugin_Interpolation::REORDER_ID(),
68               ModelAPI_AttributeBoolean, /** Reorder flag */,
69               useTangents, BuildPlugin_Interpolation::USE_TANGENTS_ID(),
70               ModelAPI_AttributeString, /** Use tangents flag */,
71               startTangent, BuildPlugin_Interpolation::TANGENT_START_ID(),
72               ModelAPI_AttributeSelection, /** Start point tangent */,
73               endTangent, BuildPlugin_Interpolation::TANGENT_END_ID(),
74               ModelAPI_AttributeSelection, /** End point tangent */)
75
76   /// Modify base attribute of the feature.
77   BUILDAPI_EXPORT
78   void setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects);
79
80   /// Set closed flag
81   BUILDAPI_EXPORT void setClosed(const bool theIsClosed);
82
83   /// Set reorder flag
84   BUILDAPI_EXPORT void setReorder(const bool theIsToReorder);
85
86   /// Set use tangents flag
87   BUILDAPI_EXPORT void setUseTangents(const bool theIsToUseTangents);
88
89   /// Set start and end tangents
90   BUILDAPI_EXPORT void setTangents(const ModelHighAPI_Selection& theStartTangent,
91                                    const ModelHighAPI_Selection& theEndTangent);
92
93   /// Dump wrapped feature
94   BUILDAPI_EXPORT
95   virtual void dump(ModelHighAPI_Dumper& theDumper) const;
96
97 private:
98   void execIfBaseNotEmpty();
99 };
100
101 /// Pointer on Interpolation object.
102 typedef std::shared_ptr<BuildAPI_Interpolation> InterpolationPtr;
103
104 /// \ingroup CPPHighAPI
105 /// \brief Create Interpolation feature.
106 BUILDAPI_EXPORT
107 InterpolationPtr addInterpolation(const std::shared_ptr<ModelAPI_Document>& thePart,
108                                   const std::list<ModelHighAPI_Selection>& theBaseObjects,
109                                   const bool theIsClosed = false,
110                                   const bool theIsToReorder = false);
111
112 /// \ingroup CPPHighAPI
113 /// \brief Create Interpolation feature using tangents.
114 BUILDAPI_EXPORT
115 InterpolationPtr addInterpolation(const std::shared_ptr<ModelAPI_Document>& thePart,
116                                   const std::list<ModelHighAPI_Selection>& theBaseObjects,
117                                   const ModelHighAPI_Selection& theStartTangent,
118                                   const ModelHighAPI_Selection& theEndTangent,
119                                   const bool theIsClosed = false,
120                                   const bool theIsToReorder = false);
121
122 #endif // BuildAPI_Interpolation_H_