1 // Created on: 2000-09-08
2 // Created by: data exchange team
3 // Copyright (c) 2000-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
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.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #include <XCAFDoc_Volume.hxx>
18 #include <Standard_Dump.hxx>
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>
25 IMPLEMENT_DERIVED_ATTRIBUTE_WITH_TYPE(XCAFDoc_Volume,TDataStd_Real,"xcaf","Volume")
27 //=======================================================================
28 //function : Constructor
30 //=======================================================================
31 XCAFDoc_Volume::XCAFDoc_Volume()
35 //=======================================================================
38 //=======================================================================
40 const Standard_GUID& XCAFDoc_Volume::GetID()
42 static Standard_GUID VolumeID ("efd212f1-6dfd-11d4-b9c8-0060b0ee281b");
46 //=======================================================================
49 //=======================================================================
51 const Standard_GUID& XCAFDoc_Volume::ID() const
56 //=======================================================================
59 //=======================================================================
61 Handle(XCAFDoc_Volume) XCAFDoc_Volume::Set (const TDF_Label& L,const Standard_Real V)
63 Handle(XCAFDoc_Volume) A;
64 if (!L.FindAttribute(XCAFDoc_Volume::GetID(), A)) {
65 A = new XCAFDoc_Volume;
72 //=======================================================================
75 //=======================================================================
77 void XCAFDoc_Volume::Set (const Standard_Real V)
79 TDataStd_Real::Set(V);
82 //=======================================================================
85 //=======================================================================
87 Standard_Real XCAFDoc_Volume::Get() const
89 return TDataStd_Real::Get();
92 //=======================================================================
95 //=======================================================================
97 Standard_Boolean XCAFDoc_Volume::Get(const TDF_Label& label,Standard_Real& vol)
99 Handle(XCAFDoc_Volume) aVolume;
100 if (!label.FindAttribute(XCAFDoc_Volume::GetID(), aVolume))
101 return Standard_False;
103 vol = aVolume->Get();
104 return Standard_True;
107 //=======================================================================
110 //=======================================================================
112 Standard_OStream& XCAFDoc_Volume::Dump (Standard_OStream& anOS) const
119 //=======================================================================
120 //function : DumpJson
122 //=======================================================================
123 void XCAFDoc_Volume::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
125 OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
127 OCCT_DUMP_BASE_CLASS (theOStream, theDepth, TDF_Attribute)
129 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myValue)