0031668: Visualization - WebGL sample doesn't work on Emscripten 1.39
[occt.git] / src / BRepPrimAPI / BRepPrimAPI_MakeBox.hxx
1 // Created on: 1993-07-21
2 // Created by: Remi LEQUETTE
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #ifndef _BRepPrimAPI_MakeBox_HeaderFile
18 #define _BRepPrimAPI_MakeBox_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <BRepPrim_Wedge.hxx>
25 #include <BRepBuilderAPI_MakeShape.hxx>
26 #include <Standard_Real.hxx>
27 class Standard_DomainError;
28 class Standard_OutOfRange;
29 class StdFail_NotDone;
30 class gp_Pnt;
31 class gp_Ax2;
32 class BRepPrim_Wedge;
33 class TopoDS_Shell;
34 class TopoDS_Solid;
35 class TopoDS_Face;
36
37
38 //! Describes functions to build parallelepiped boxes.
39 //! A MakeBox object provides a framework for:
40 //! -   defining the construction of a box,
41 //! -   implementing the construction algorithm, and
42 //! -   consulting the result.
43 //! Constructs a box such that its sides are parallel to the axes of
44 //! -   the global coordinate system, or
45 //! -   the local coordinate system Axis. and
46 //! -   with a corner at (0, 0, 0) and of size (dx, dy, dz), or
47 //! -   with a corner at point P and of size (dx, dy, dz), or
48 //! -   with corners at points P1 and P2.
49 //! Exceptions
50 //! Standard_DomainError if: dx, dy, dz are less than or equal to
51 //! Precision::Confusion(), or
52 //! -   the vector joining the points P1 and P2 has a
53 //! component projected onto the global coordinate
54 //! system less than or equal to Precision::Confusion().
55 //! In these cases, the box would be flat.
56
57 class BRepPrimAPI_MakeBox  : public BRepBuilderAPI_MakeShape
58 {
59 public:
60
61   DEFINE_STANDARD_ALLOC
62
63     
64   //! Default constructor
65   BRepPrimAPI_MakeBox() {}
66   
67   //! Make a box with a corner at 0,0,0 and the other dx,dy,dz
68   Standard_EXPORT BRepPrimAPI_MakeBox(const Standard_Real dx, const Standard_Real dy, const Standard_Real dz);
69   
70   //! Make a box with a corner at P and size dx, dy, dz.
71   Standard_EXPORT BRepPrimAPI_MakeBox(const gp_Pnt& P, const Standard_Real dx, const Standard_Real dy, const Standard_Real dz);
72   
73   //! Make a box with corners P1,P2.
74   Standard_EXPORT BRepPrimAPI_MakeBox(const gp_Pnt& P1, const gp_Pnt& P2);
75   
76   //! Make a box with Ax2 (the left corner and the axis) and size dx, dy, dz.
77   Standard_EXPORT BRepPrimAPI_MakeBox(const gp_Ax2& Axes, const Standard_Real dx, const Standard_Real dy, const Standard_Real dz);
78   
79   //! Init a box with a corner at 0,0,0 and the other theDX, theDY, theDZ
80   Standard_EXPORT void Init (const Standard_Real theDX, const Standard_Real theDY, const Standard_Real theDZ);
81   
82   //! Init a box with a corner at thePnt and size theDX, theDY, theDZ.
83   Standard_EXPORT void Init (const gp_Pnt& thePnt,
84                              const Standard_Real theDX,
85                              const Standard_Real theDY,
86                              const Standard_Real theDZ);
87   
88   //! Init a box with corners thePnt1, thePnt2.
89   Standard_EXPORT void Init (const gp_Pnt& thePnt1, const gp_Pnt& thePnt2);
90
91   //! Init a box with Ax2 (the left corner and the theAxes) and size theDX, theDY, theDZ.
92   Standard_EXPORT void Init (const gp_Ax2& theAxes,
93                              const Standard_Real theDX,
94                              const Standard_Real theDY,
95                              const Standard_Real theDZ);
96
97   //! Returns the internal algorithm.
98   Standard_EXPORT BRepPrim_Wedge& Wedge();
99   
100   //! Stores the solid in myShape.
101   Standard_EXPORT virtual void Build() Standard_OVERRIDE;
102   
103   //! Returns the constructed box as a shell.
104   Standard_EXPORT const TopoDS_Shell& Shell();
105 Standard_EXPORT operator TopoDS_Shell();
106   
107   //! Returns the constructed box as a solid.
108   Standard_EXPORT const TopoDS_Solid& Solid();
109 Standard_EXPORT operator TopoDS_Solid();
110   
111   //! Returns ZMin face
112   Standard_EXPORT const TopoDS_Face& BottomFace();
113   
114   //! Returns XMin face
115   Standard_EXPORT const TopoDS_Face& BackFace();
116   
117   //! Returns XMax face
118   Standard_EXPORT const TopoDS_Face& FrontFace();
119   
120   //! Returns YMin face
121   Standard_EXPORT const TopoDS_Face& LeftFace();
122   
123   //! Returns YMax face
124   Standard_EXPORT const TopoDS_Face& RightFace();
125   
126   //! Returns ZMax face
127   Standard_EXPORT const TopoDS_Face& TopFace();
128
129
130
131
132 protected:
133
134
135   BRepPrim_Wedge myWedge;
136
137
138
139 private:
140
141
142
143
144
145 };
146
147
148
149
150
151
152
153 #endif // _BRepPrimAPI_MakeBox_HeaderFile