0031682: Visualization - Prs3d_ShadingAspect::SetTransparency() has no effect with...
[occt.git] / src / VrmlData / VrmlData_Box.hxx
1 // Created on: 2006-05-25
2 // Created by: Alexander GRIGORIEV
3 // Copyright (c) 2006-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 #ifndef VrmlData_Box_HeaderFile
17 #define VrmlData_Box_HeaderFile
18
19 #include <VrmlData_Geometry.hxx>
20 #include <gp_XYZ.hxx>
21
22 /**
23  *  Inplementation of the Box node.
24  *  This node is defined by Size vector, assumong that the box center is located
25  *  in (0., 0., 0.) and that each corner is 0.5*|Size| distance from the center.
26  */
27 class VrmlData_Box : public VrmlData_Geometry
28 {
29  public:
30   // ---------- PUBLIC METHODS ----------
31
32   /**
33    * Empty constructor
34    */
35   inline VrmlData_Box           ()
36     : mySize (2., 2., 2.)
37   {}
38
39   /**
40    * Constructor
41    */
42   inline VrmlData_Box           (const VrmlData_Scene&  theScene,
43                                  const char             * theName,
44                                  const Standard_Real    sizeX = 2.,
45                                  const Standard_Real    sizeY = 2.,
46                                  const Standard_Real    sizeZ = 2.)
47     : VrmlData_Geometry (theScene, theName),
48       mySize            (sizeX, sizeY, sizeZ)
49   {}
50
51   /**
52    * Query the Box size
53    */
54   inline const gp_XYZ&  Size    () const                { return mySize; }
55
56   /**
57    * Set the Box Size
58    */
59   inline void           SetSize (const gp_XYZ& theSize)
60   { mySize = theSize; SetModified(); }
61
62   /**
63    * Query the primitive topology. This method returns a Null shape if there
64    * is an internal error during the primitive creation (zero radius, etc.)
65    */
66   Standard_EXPORT virtual const Handle(TopoDS_TShape)&
67                         TShape  () Standard_OVERRIDE;
68
69   /**
70    * Create a copy of this node.
71    * If the parameter is null, a new copied node is created. Otherwise new node
72    * is not created, but rather the given one is modified.
73    */
74   Standard_EXPORT virtual Handle(VrmlData_Node)
75                         Clone   (const Handle(VrmlData_Node)& theOther)const Standard_OVERRIDE;
76
77   /**
78    * Fill the Node internal data from the given input stream.
79    */
80   Standard_EXPORT virtual VrmlData_ErrorStatus
81                         Read    (VrmlData_InBuffer& theBuffer) Standard_OVERRIDE;
82
83   /**
84    * Write the Node to output stream.
85    */
86   Standard_EXPORT virtual VrmlData_ErrorStatus
87                         Write   (const char * thePrefix) const Standard_OVERRIDE;
88
89  private:
90   // ---------- PRIVATE FIELDS ----------
91
92   gp_XYZ        mySize;
93
94  public:
95 // Declaration of CASCADE RTTI
96 DEFINE_STANDARD_RTTI_INLINE(VrmlData_Box,VrmlData_Geometry)
97 };
98
99 // Definition of HANDLE object using Standard_DefineHandle.hxx
100 DEFINE_STANDARD_HANDLE (VrmlData_Box, VrmlData_Geometry)
101
102
103 #endif