b311480e |
1 | // Created on: 2000-09-08 |
2 | // Created by: data exchange team |
973c2be1 |
3 | // Copyright (c) 2000-2014 OPEN CASCADE SAS |
b311480e |
4 | // |
973c2be1 |
5 | // This file is part of Open CASCADE Technology software library. |
b311480e |
6 | // |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
12 | // |
973c2be1 |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
7fd59977 |
15 | |
bc73b006 |
16 | #include <XCAFDoc_Volume.hxx> |
42cf5bc1 |
17 | |
bc73b006 |
18 | #include <Standard_Dump.hxx> |
42cf5bc1 |
19 | #include <Standard_GUID.hxx> |
20 | #include <Standard_Type.hxx> |
21 | #include <TDF_Attribute.hxx> |
22 | #include <TDF_Label.hxx> |
23 | #include <TDF_RelocationTable.hxx> |
7fd59977 |
24 | |
c99ad5d7 |
25 | IMPLEMENT_DERIVED_ATTRIBUTE_WITH_TYPE(XCAFDoc_Volume,TDataStd_Real,"xcaf","Volume") |
92efcf78 |
26 | |
7fd59977 |
27 | //======================================================================= |
28 | //function : Constructor |
29 | //purpose : |
30 | //======================================================================= |
7fd59977 |
31 | XCAFDoc_Volume::XCAFDoc_Volume() |
32 | { |
33 | } |
34 | |
35 | //======================================================================= |
36 | //function : GetID |
37 | //purpose : |
38 | //======================================================================= |
39 | |
40 | const Standard_GUID& XCAFDoc_Volume::GetID() |
41 | { |
42 | static Standard_GUID VolumeID ("efd212f1-6dfd-11d4-b9c8-0060b0ee281b"); |
43 | return VolumeID; |
44 | } |
45 | |
46 | //======================================================================= |
47 | //function : ID |
48 | //purpose : |
49 | //======================================================================= |
50 | |
51 | const Standard_GUID& XCAFDoc_Volume::ID() const |
52 | { |
53 | return GetID(); |
54 | } |
55 | |
56 | //======================================================================= |
57 | //function : Set |
58 | //purpose : |
59 | //======================================================================= |
60 | |
61 | Handle(XCAFDoc_Volume) XCAFDoc_Volume::Set (const TDF_Label& L,const Standard_Real V) |
62 | { |
63 | Handle(XCAFDoc_Volume) A; |
64 | if (!L.FindAttribute(XCAFDoc_Volume::GetID(), A)) { |
65 | A = new XCAFDoc_Volume; |
66 | L.AddAttribute(A); |
67 | } |
68 | A->Set(V); |
69 | return A; |
70 | } |
71 | |
72 | //======================================================================= |
73 | //function : Set |
74 | //purpose : |
75 | //======================================================================= |
76 | |
77 | void XCAFDoc_Volume::Set (const Standard_Real V) |
78 | { |
c99ad5d7 |
79 | TDataStd_Real::Set(V); |
7fd59977 |
80 | } |
81 | |
82 | //======================================================================= |
83 | //function : Get |
84 | //purpose : |
85 | //======================================================================= |
86 | |
c99ad5d7 |
87 | Standard_Real XCAFDoc_Volume::Get() const |
88 | { |
89 | return TDataStd_Real::Get(); |
90 | } |
7fd59977 |
91 | |
92 | //======================================================================= |
93 | //function : Get |
94 | //purpose : |
95 | //======================================================================= |
96 | |
97 | Standard_Boolean XCAFDoc_Volume::Get(const TDF_Label& label,Standard_Real& vol) |
98 | { |
99 | Handle(XCAFDoc_Volume) aVolume; |
100 | if (!label.FindAttribute(XCAFDoc_Volume::GetID(), aVolume)) |
101 | return Standard_False; |
102 | |
103 | vol = aVolume->Get(); |
104 | return Standard_True; |
105 | } |
106 | |
7fd59977 |
107 | //======================================================================= |
108 | //function : Dump |
109 | //purpose : |
110 | //======================================================================= |
111 | |
112 | Standard_OStream& XCAFDoc_Volume::Dump (Standard_OStream& anOS) const |
113 | { |
114 | anOS << "Volume "; |
115 | anOS << Get(); |
116 | return anOS; |
117 | } |
bc73b006 |
118 | |
119 | //======================================================================= |
120 | //function : DumpJson |
121 | //purpose : |
122 | //======================================================================= |
123 | void XCAFDoc_Volume::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const |
124 | { |
125 | OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream) |
126 | |
127 | OCCT_DUMP_BASE_CLASS (theOStream, theDepth, TDF_Attribute) |
128 | |
129 | OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myValue) |
130 | } |