7fd59977 |
1 | // File: VrmlData_Box.hxx |
2 | // Created: 25.05.06 16:57:19 |
3 | // Author: Alexander GRIGORIEV |
4 | // Copyright: Open Cascade 2006 |
5 | |
6 | |
7 | #ifndef VrmlData_Box_HeaderFile |
8 | #define VrmlData_Box_HeaderFile |
9 | |
10 | #include <VrmlData_Geometry.hxx> |
11 | #include <gp_XYZ.hxx> |
12 | |
13 | /** |
14 | * Inplementation of the Box node. |
15 | * This node is defined by Size vector, assumong that the box center is located |
16 | * in (0., 0., 0.) and that each corner is 0.5*|Size| distance from the center. |
17 | */ |
18 | class VrmlData_Box : public VrmlData_Geometry |
19 | { |
20 | public: |
21 | // ---------- PUBLIC METHODS ---------- |
22 | |
23 | /** |
24 | * Empty constructor |
25 | */ |
26 | inline VrmlData_Box () |
27 | : mySize (2., 2., 2.) |
28 | {} |
29 | |
30 | /** |
31 | * Constructor |
32 | */ |
33 | inline VrmlData_Box (const VrmlData_Scene& theScene, |
34 | const char * theName, |
35 | const Standard_Real sizeX = 2., |
36 | const Standard_Real sizeY = 2., |
37 | const Standard_Real sizeZ = 2.) |
38 | : VrmlData_Geometry (theScene, theName), |
39 | mySize (sizeX, sizeY, sizeZ) |
40 | {} |
41 | |
42 | /** |
43 | * Query the Box size |
44 | */ |
45 | inline const gp_XYZ& Size () const { return mySize; } |
46 | |
47 | /** |
48 | * Set the Box Size |
49 | */ |
50 | inline void SetSize (const gp_XYZ& theSize) |
51 | { mySize = theSize; SetModified(); } |
52 | |
53 | /** |
54 | * Query the primitive topology. This method returns a Null shape if there |
55 | * is an internal error during the primitive creation (zero radius, etc.) |
56 | */ |
57 | Standard_EXPORT virtual const Handle(TopoDS_TShape)& |
58 | TShape (); |
59 | |
60 | /** |
61 | * Create a copy of this node. |
62 | * If the parameter is null, a new copied node is created. Otherwise new node |
63 | * is not created, but rather the given one is modified. |
64 | */ |
65 | Standard_EXPORT virtual Handle(VrmlData_Node) |
66 | Clone (const Handle(VrmlData_Node)& theOther)const; |
67 | |
68 | /** |
69 | * Fill the Node internal data from the given input stream. |
70 | */ |
71 | Standard_EXPORT virtual VrmlData_ErrorStatus |
72 | Read (VrmlData_InBuffer& theBuffer); |
73 | |
74 | /** |
75 | * Write the Node to output stream. |
76 | */ |
77 | Standard_EXPORT virtual VrmlData_ErrorStatus |
78 | Write (const char * thePrefix) const; |
79 | |
80 | private: |
81 | // ---------- PRIVATE FIELDS ---------- |
82 | |
83 | gp_XYZ mySize; |
84 | |
85 | public: |
86 | // Declaration of CASCADE RTTI |
87 | DEFINE_STANDARD_RTTI (VrmlData_Box) |
88 | }; |
89 | |
90 | // Definition of HANDLE object using Standard_DefineHandle.hxx |
91 | DEFINE_STANDARD_HANDLE (VrmlData_Box, VrmlData_Geometry) |
92 | |
93 | |
94 | #endif |