Salome HOME
c13fadd0362627ac55d5388853759a9f24742212
[modules/shaper.git] / src / FeaturesAPI / FeaturesAPI_Placement.h
1 // Copyright (C) 2014-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_Placement_H_
21 #define FeaturesAPI_Placement_H_
22
23 #include "FeaturesAPI.h"
24
25 #include <FeaturesPlugin_Placement.h>
26
27 #include <ModelHighAPI_Interface.h>
28 #include <ModelHighAPI_Macro.h>
29
30 class ModelHighAPI_Dumper;
31 class ModelHighAPI_Selection;
32
33 /// \class FeaturesAPI_Placement
34 /// \ingroup CPPHighAPI
35 /// \brief Interface for Placement feature.
36 class FeaturesAPI_Placement: public ModelHighAPI_Interface
37 {
38 public:
39   /// Constructor without values.
40   FEATURESAPI_EXPORT
41   explicit FeaturesAPI_Placement(const std::shared_ptr<ModelAPI_Feature>& theFeature);
42
43   /// Constructor with values.
44   FEATURESAPI_EXPORT
45   FeaturesAPI_Placement(const std::shared_ptr<ModelAPI_Feature>& theFeature,
46                         const std::list<ModelHighAPI_Selection>& theObjects,
47                         const ModelHighAPI_Selection& theStartShape,
48                         const ModelHighAPI_Selection& theEndShape,
49                         const bool theReverseDirection = false,
50                         const bool theCentering = false);
51
52   /// Destructor.
53   FEATURESAPI_EXPORT
54   virtual ~FeaturesAPI_Placement();
55
56   INTERFACE_5(FeaturesPlugin_Placement::ID(),
57               objects, FeaturesPlugin_Placement::OBJECTS_LIST_ID(),
58               ModelAPI_AttributeSelectionList, /** Main objects */,
59               startShape, FeaturesPlugin_Placement::START_SHAPE_ID(),
60               ModelAPI_AttributeSelection, /** Start shape */,
61               endShape, FeaturesPlugin_Placement::END_SHAPE_ID(),
62               ModelAPI_AttributeSelection, /** End shape */,
63               reverseDirection, FeaturesPlugin_Placement::REVERSE_ID(),
64               ModelAPI_AttributeBoolean, /** Reverse direction flag */,
65               centering, FeaturesPlugin_Placement::CENTERING_ID(),
66               ModelAPI_AttributeBoolean, /** Centering flag */)
67
68   /// Set objects.
69   FEATURESAPI_EXPORT
70   void setObjects(const std::list<ModelHighAPI_Selection>& theObjects);
71
72   /// Set start shape.
73   FEATURESAPI_EXPORT
74   void setStartShape(const ModelHighAPI_Selection& theStartShape);
75
76   /// Set end shape.
77   FEATURESAPI_EXPORT
78   void setEndShape(const ModelHighAPI_Selection& theEndShape);
79
80   /// Set reverse direction flag.
81   FEATURESAPI_EXPORT
82   void setReverseDirection(const bool theReverseDirection);
83
84   /// Set centering flag.
85   FEATURESAPI_EXPORT
86   void setCentering(const bool theCentering);
87
88   /// Dump wrapped feature
89   FEATURESAPI_EXPORT
90   virtual void dump(ModelHighAPI_Dumper& theDumper) const;
91 };
92
93 /// Pointer on Placement object.
94 typedef std::shared_ptr<FeaturesAPI_Placement> PlacementPtr;
95
96 /// \ingroup CPPHighAPI
97 /// \brief Create Placement feature.
98 FEATURESAPI_EXPORT
99 PlacementPtr addPlacement(const std::shared_ptr<ModelAPI_Document>& thePart,
100                           const std::list<ModelHighAPI_Selection>& theObjects,
101                           const ModelHighAPI_Selection& theStartShape,
102                           const ModelHighAPI_Selection& theEndShape,
103                           const bool reverse = false,
104                           const bool centering = false,
105                           const bool keepSubResults = false);
106
107 #endif // FeaturesAPI_Placement_H_