1 // Created on: 1995-03-10
2 // Created by: Remi LEQUETTE
3 // Copyright (c) 1995-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 _Draw_Box_HeaderFile
18 #define _Draw_Box_HeaderFile
19 
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22 
23 #include <Bnd_OBB.hxx>
24 #include <Draw_Color.hxx>
25 #include <Draw_Drawable3D.hxx>
26 class Draw_Display;
27 
28 
29 class Draw_Box;
30 DEFINE_STANDARD_HANDLE(Draw_Box, Draw_Drawable3D)
31 
32 //! a 3d box
33 class Draw_Box : public Draw_Drawable3D
34 {
35 public:
36 
37   //! Constructor
38   Standard_EXPORT Draw_Box(const Bnd_OBB& theOBB,
39                            const Draw_Color& theColor);
40 
41   //! Draws myOBB
42   Standard_EXPORT void DrawOn (Draw_Display& theDis) const Standard_OVERRIDE;
43 
44   DEFINE_STANDARD_RTTIEXT(Draw_Box,Draw_Drawable3D)
45 
46 protected:
47 
48   //! Converts the point (theX, theY, theZ) in local coordinate system to WCS.
49   void ToWCS(const Standard_Real theX,
50              const Standard_Real theY,
51              const Standard_Real theZ,
52              gp_Pnt& theP) const;
53 
54   //! Moves the point thePt along X-direction of myOBB on the distance theShift.
55   void MoveX(const Standard_Real theShift, gp_Pnt& thePt) const;
56 
57   //! Moves the point thePt along Y-direction of myOBB on the distance theShift.
58   void MoveY(const Standard_Real theShift, gp_Pnt& thePt) const;
59 
60   //! Moves the point thePt along Z-direction of myOBB on the distance theShift.
61   void MoveZ(const Standard_Real theShift, gp_Pnt& thePt) const;
62 
63 private:
64 
65   //! Oriented bounding box
66   Bnd_OBB myOBB;
67 
68   //! Color value
69   Draw_Color myColor;
70 };
71 
72 #endif // _Draw_Box_HeaderFile
73