Salome HOME
updated copyright message
[modules/shaper.git] / src / PrimitivesAPI / PrimitivesAPI_Box.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 PRIMITIVESAPI_BOX_H_
21 #define PRIMITIVESAPI_BOX_H_
22
23 #include "PrimitivesAPI.h"
24
25 #include <PrimitivesPlugin_Box.h>
26
27 #include <ModelHighAPI_Interface.h>
28 #include <ModelHighAPI_Macro.h>
29
30 class ModelHighAPI_Double;
31 class ModelHighAPI_Selection;
32
33 /// \class PrimitivesAPI_Box
34 /// \ingroup CPPHighAPI
35 /// \brief Interface for primitive Box feature.
36 class PrimitivesAPI_Box: public ModelHighAPI_Interface
37 {
38 public:
39   /// Constructor without values.
40   PRIMITIVESAPI_EXPORT
41   explicit PrimitivesAPI_Box(const std::shared_ptr<ModelAPI_Feature>& theFeature);
42
43   /// Constructor with values.
44   PRIMITIVESAPI_EXPORT
45   explicit PrimitivesAPI_Box(const std::shared_ptr<ModelAPI_Feature>& theFeature,
46                              const ModelHighAPI_Double& theDx,
47                              const ModelHighAPI_Double& theDy,
48                              const ModelHighAPI_Double& theDz);
49
50   /// Constructor with values.
51   PRIMITIVESAPI_EXPORT
52   explicit PrimitivesAPI_Box(const std::shared_ptr<ModelAPI_Feature>& theFeature,
53                              const ModelHighAPI_Selection& theFirstPoint,
54                              const ModelHighAPI_Selection& theSecondPoint);
55
56   /// Constructor with values.
57   PRIMITIVESAPI_EXPORT
58   explicit PrimitivesAPI_Box(const std::shared_ptr<ModelAPI_Feature>& theFeature,
59                              const ModelHighAPI_Double& theOx,
60                              const ModelHighAPI_Double& theOy,
61                              const ModelHighAPI_Double& theOz,
62                              const ModelHighAPI_Double& theHalfX,
63                              const ModelHighAPI_Double& theHalfY,
64                              const ModelHighAPI_Double& theHalfZ);
65
66   /// Destructor.
67   PRIMITIVESAPI_EXPORT
68   virtual ~PrimitivesAPI_Box();
69
70   INTERFACE_12(PrimitivesPlugin_Box::ID(),
71              creationMethod, PrimitivesPlugin_Box::CREATION_METHOD(),
72              ModelAPI_AttributeString, /** Creation method */,
73              dx, PrimitivesPlugin_Box::DX_ID(),
74              ModelAPI_AttributeDouble, /** Dimension in X */,
75              dy, PrimitivesPlugin_Box::DY_ID(),
76              ModelAPI_AttributeDouble, /** Dimension in Y */,
77              dz, PrimitivesPlugin_Box::DZ_ID(),
78              ModelAPI_AttributeDouble, /** Dimension in Z */,
79              firstPoint, PrimitivesPlugin_Box::POINT_FIRST_ID(),
80              ModelAPI_AttributeSelection, /** First point */,
81              secondPoint, PrimitivesPlugin_Box::POINT_SECOND_ID(),
82              ModelAPI_AttributeSelection, /** Second point */,
83              ox, PrimitivesPlugin_Box::OX_ID(),
84              ModelAPI_AttributeDouble, /** X coordinate for origin*/,
85              oy, PrimitivesPlugin_Box::OY_ID(),
86              ModelAPI_AttributeDouble, /** Y coordinate for origin*/,
87              oz, PrimitivesPlugin_Box::OZ_ID(),
88              ModelAPI_AttributeDouble, /** Z coordinate for origin*/,
89              halfdx, PrimitivesPlugin_Box::HALF_DX_ID(),
90              ModelAPI_AttributeDouble, /** Half length in X*/,
91              halfdy, PrimitivesPlugin_Box::HALF_DY_ID(),
92              ModelAPI_AttributeDouble, /** Half length in Y*/,
93              halfdz, PrimitivesPlugin_Box::HALF_DZ_ID(),
94              ModelAPI_AttributeDouble, /** Half length in Z*/)
95
96   /// Set dimensions
97   PRIMITIVESAPI_EXPORT
98   void setDimensions(const ModelHighAPI_Double& theDx,
99                      const ModelHighAPI_Double& theDy,
100                      const ModelHighAPI_Double& theDz);
101
102   /// Set points
103   PRIMITIVESAPI_EXPORT
104   void setPoints(const ModelHighAPI_Selection& theFirstPoint,
105                  const ModelHighAPI_Selection& theSecondPoint);
106
107   /// Set origin point
108   PRIMITIVESAPI_EXPORT
109   void setOrigin(const ModelHighAPI_Double& theOx,
110                  const ModelHighAPI_Double& theOy,
111                  const ModelHighAPI_Double& theOz);
112
113   /// Set half lengths
114   PRIMITIVESAPI_EXPORT
115   void setHalfLengths(const ModelHighAPI_Double& theHalfLengthX,
116                       const ModelHighAPI_Double& theHalfLengthY,
117                       const ModelHighAPI_Double& theHalfLengthZ);
118
119   /// Dump wrapped feature
120   PRIMITIVESAPI_EXPORT
121   virtual void dump(ModelHighAPI_Dumper& theDumper) const;
122 };
123
124 /// Pointer on primitive Box object
125 typedef std::shared_ptr<PrimitivesAPI_Box> BoxPtr;
126
127 /// \ingroup CPPHighAPI
128 /// \brief Create primitive Box feature.
129 PRIMITIVESAPI_EXPORT
130 BoxPtr addBox(const std::shared_ptr<ModelAPI_Document>& thePart,
131               const ModelHighAPI_Double& theDx,
132               const ModelHighAPI_Double& theDy,
133               const ModelHighAPI_Double& theDz);
134
135 /// \ingroup CPPHighAPI
136 /// \brief Create primitive Box feature.
137 PRIMITIVESAPI_EXPORT
138 BoxPtr addBox(const std::shared_ptr<ModelAPI_Document>& thePart,
139               const ModelHighAPI_Selection& theFirstPoint,
140               const ModelHighAPI_Selection& theSecondPoint);
141
142 /// \ingroup CPPHighAPI
143 /// \brief Create primitive Box feature.
144 PRIMITIVESAPI_EXPORT
145 BoxPtr addBox(const std::shared_ptr<ModelAPI_Document>& thePart,
146               const ModelHighAPI_Double& theOx,
147               const ModelHighAPI_Double& theOy,
148               const ModelHighAPI_Double& theOz,
149               const ModelHighAPI_Double& theHalfLengthX,
150               const ModelHighAPI_Double& theHalfLengthY,
151               const ModelHighAPI_Double& theHalfLengthZ);
152
153 #endif // PRIMITIVESAPI_BOX_H_