Salome HOME
Merge branch 'master' into cgt/devCEA
[modules/shaper.git] / src / PrimitivesAPI / PrimitivesAPI_Box.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 PRIMITIVESAPI_BOX_H_
22 #define PRIMITIVESAPI_BOX_H_
23
24 #include "PrimitivesAPI.h"
25
26 #include <PrimitivesPlugin_Box.h>
27
28 #include <ModelHighAPI_Interface.h>
29 #include <ModelHighAPI_Macro.h>
30
31 class ModelHighAPI_Double;
32 class ModelHighAPI_Selection;
33
34 /// \class PrimitivesAPI_Box
35 /// \ingroup CPPHighAPI
36 /// \brief Interface for primitive Box feature.
37 class PrimitivesAPI_Box: public ModelHighAPI_Interface
38 {
39 public:
40   /// Constructor without values.
41   PRIMITIVESAPI_EXPORT
42   explicit PrimitivesAPI_Box(const std::shared_ptr<ModelAPI_Feature>& theFeature);
43
44   /// Constructor with values.
45   PRIMITIVESAPI_EXPORT
46   explicit PrimitivesAPI_Box(const std::shared_ptr<ModelAPI_Feature>& theFeature,
47                              const ModelHighAPI_Double& theDx,
48                              const ModelHighAPI_Double& theDy,
49                              const ModelHighAPI_Double& theDz);
50
51   /// Constructor with values.
52   PRIMITIVESAPI_EXPORT
53   explicit PrimitivesAPI_Box(const std::shared_ptr<ModelAPI_Feature>& theFeature,
54                              const ModelHighAPI_Selection& theFirstPoint,
55                              const ModelHighAPI_Selection& theSecondPoint);
56
57   /// Destructor.
58   PRIMITIVESAPI_EXPORT
59   virtual ~PrimitivesAPI_Box();
60
61   INTERFACE_6(PrimitivesPlugin_Box::ID(),
62              creationMethod, PrimitivesPlugin_Box::CREATION_METHOD(),
63              ModelAPI_AttributeString, /** Creation method */,
64              dx, PrimitivesPlugin_Box::DX_ID(),
65              ModelAPI_AttributeDouble, /** Dimension in X */,
66              dy, PrimitivesPlugin_Box::DY_ID(),
67              ModelAPI_AttributeDouble, /** Dimension in Y */,
68              dz, PrimitivesPlugin_Box::DZ_ID(),
69              ModelAPI_AttributeDouble, /** Dimension in Z */,
70              firstPoint, PrimitivesPlugin_Box::POINT_FIRST_ID(),
71              ModelAPI_AttributeSelection, /** First point */,
72              secondPoint, PrimitivesPlugin_Box::POINT_SECOND_ID(),
73              ModelAPI_AttributeSelection, /** Second point */)
74
75   /// Set dimensions
76   PRIMITIVESAPI_EXPORT
77   void setDimensions(const ModelHighAPI_Double& theDx,
78                      const ModelHighAPI_Double& theDy,
79                      const ModelHighAPI_Double& theDz);
80
81   /// Set points
82   PRIMITIVESAPI_EXPORT
83   void setPoints(const ModelHighAPI_Selection& theFirstPoint,
84                  const ModelHighAPI_Selection& theSecondPoint);
85
86   /// Dump wrapped feature
87   PRIMITIVESAPI_EXPORT
88   virtual void dump(ModelHighAPI_Dumper& theDumper) const;
89 };
90
91 /// Pointer on primitive Box object
92 typedef std::shared_ptr<PrimitivesAPI_Box> BoxPtr;
93
94 /// \ingroup CPPHighAPI
95 /// \brief Create primitive Box feature.
96 PRIMITIVESAPI_EXPORT
97 BoxPtr addBox(const std::shared_ptr<ModelAPI_Document>& thePart,
98               const ModelHighAPI_Double& theDx,
99               const ModelHighAPI_Double& theDy,
100               const ModelHighAPI_Double& theDz);
101
102 /// \ingroup CPPHighAPI
103 /// \brief Create primitive Box feature.
104 PRIMITIVESAPI_EXPORT
105 BoxPtr addBox(const std::shared_ptr<ModelAPI_Document>& thePart,
106               const ModelHighAPI_Selection& theFirstPoint,
107               const ModelHighAPI_Selection& theSecondPoint);
108
109 #endif // PRIMITIVESAPI_BOX_H_