Salome HOME
5ae3bd1c2ba3d2ccadc28a6c7130eb2c81ad719c
[modules/shaper.git] / src / FeaturesAPI / FeaturesAPI_Chamfer.h
1 // Copyright (C) 2017-2023  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 FeaturesAPI_Chamfer_H_
21 #define FeaturesAPI_Chamfer_H_
22
23 #include "FeaturesAPI.h"
24
25 #include <FeaturesPlugin_Chamfer.h>
26
27 #include <ModelHighAPI_Interface.h>
28 #include <ModelHighAPI_Macro.h>
29
30 class ModelHighAPI_Double;
31 class ModelHighAPI_Selection;
32
33 /// \class FeaturesAPI_Chamfer
34 /// \ingroup CPPHighAPI
35 /// \brief Interface for Chamfer feature.
36 class FeaturesAPI_Chamfer: public ModelHighAPI_Interface
37 {
38 public:
39   /// Constructor without values.
40   FEATURESAPI_EXPORT
41   explicit FeaturesAPI_Chamfer(const std::shared_ptr<ModelAPI_Feature>& theFeature);
42
43   /// Constructor with values.
44   FEATURESAPI_EXPORT
45   explicit FeaturesAPI_Chamfer(const std::shared_ptr<ModelAPI_Feature>& theFeature,
46                                const std::list<ModelHighAPI_Selection>& theBaseObjects,
47                                const bool performDistances,
48                                const ModelHighAPI_Double& aVal1,
49                                const ModelHighAPI_Double& aVal2);
50
51   /// Destructor.
52   FEATURESAPI_EXPORT
53   virtual ~FeaturesAPI_Chamfer();
54
55   INTERFACE_6(FeaturesPlugin_Chamfer::ID(),
56               creationMethod, FeaturesPlugin_Chamfer::CREATION_METHOD(),
57                               ModelAPI_AttributeString,
58                               /** Creation method */,
59               baseObjects, FeaturesPlugin_Chamfer::OBJECT_LIST_ID(),
60                            ModelAPI_AttributeSelectionList,
61                            /** Base objects */,
62               d1, FeaturesPlugin_Chamfer::D1_ID(),
63                   ModelAPI_AttributeDouble,
64                   /** Value of the first distance chamfer */,
65               d2, FeaturesPlugin_Chamfer::D2_ID(),
66                   ModelAPI_AttributeDouble,
67                   /** Value of the second distance chamfer */,
68               d, FeaturesPlugin_Chamfer::D_ID(),
69                  ModelAPI_AttributeDouble,
70                  /** Value of the distance chamfer */,
71               angle, FeaturesPlugin_Chamfer::ANGLE_ID(),
72                      ModelAPI_AttributeDouble,
73                      /** Angle chamfer */)
74
75   /// Modify base objects of the chamfer.
76   FEATURESAPI_EXPORT
77   void setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects);
78
79   /// Modify chamfer to have two distances
80   FEATURESAPI_EXPORT
81   void setDistances(const ModelHighAPI_Double& theD1, const ModelHighAPI_Double& theD2);
82
83   /// Modify chamfer to have distance  and angle
84   FEATURESAPI_EXPORT
85   void setDistAngle(const ModelHighAPI_Double& theDistance, const ModelHighAPI_Double& theAngle);
86
87   /// Dump wrapped feature
88   FEATURESAPI_EXPORT
89   virtual void dump(ModelHighAPI_Dumper& theDumper) const;
90
91 private:
92   void execIfBaseNotEmpty();
93 };
94
95 /// Pointer on Chamfer object.
96 typedef std::shared_ptr<FeaturesAPI_Chamfer> ChamferPtr;
97
98 /// \ingroup CPPHighAPI
99 /// \brief Create Chamfer feature.
100 FEATURESAPI_EXPORT
101 ChamferPtr addChamfer(const std::shared_ptr<ModelAPI_Document>& thePart,
102                       const std::list<ModelHighAPI_Selection>& theBaseObjects,
103                       const bool performDistances,
104                       const ModelHighAPI_Double& theVal1,
105                       const ModelHighAPI_Double& theVal2,
106                       const bool keepSubResults = false);
107
108 #endif // FeaturesAPI_Chamfer_H_