Warnings on vc14 were eliminated
[occt.git] / src / XCAFDoc / XCAFDoc_MaterialTool.hxx
1 // Created on: 2003-03-05
2 // Created by: Sergey KUUL
3 // Copyright (c) 2003-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 _XCAFDoc_MaterialTool_HeaderFile
17 #define _XCAFDoc_MaterialTool_HeaderFile
18
19 #include <Standard.hxx>
20 #include <Standard_Type.hxx>
21
22 #include <TDF_Attribute.hxx>
23 #include <Standard_Boolean.hxx>
24 #include <TDF_LabelSequence.hxx>
25 #include <Standard_Real.hxx>
26 class XCAFDoc_ShapeTool;
27 class TDF_Label;
28 class Standard_GUID;
29 class TCollection_HAsciiString;
30 class TDF_Attribute;
31 class TDF_RelocationTable;
32
33
34 class XCAFDoc_MaterialTool;
35 DEFINE_STANDARD_HANDLE(XCAFDoc_MaterialTool, TDF_Attribute)
36
37 //! Provides tools to store and retrieve attributes (materials)
38 //! of TopoDS_Shape in and from TDocStd_Document
39 //! A Document is intended to hold different
40 //! attributes of ONE shape and it's sub-shapes
41 //! Provide tools for management of Materialss section of document.
42 class XCAFDoc_MaterialTool : public TDF_Attribute
43 {
44
45 public:
46
47   
48   Standard_EXPORT XCAFDoc_MaterialTool();
49   
50   //! Creates (if not exist) MaterialTool.
51   Standard_EXPORT static Handle(XCAFDoc_MaterialTool) Set (const TDF_Label& L);
52   
53   Standard_EXPORT static const Standard_GUID& GetID();
54   
55   //! returns the label under which colors are stored
56   Standard_EXPORT TDF_Label BaseLabel() const;
57   
58   //! Returns internal XCAFDoc_ShapeTool tool
59   Standard_EXPORT const Handle(XCAFDoc_ShapeTool)& ShapeTool();
60   
61   //! Returns True if label belongs to a material table and
62   //! is a Material definition
63   Standard_EXPORT Standard_Boolean IsMaterial (const TDF_Label& lab) const;
64   
65   //! Returns a sequence of materials currently stored
66   //! in the material table
67   Standard_EXPORT void GetMaterialLabels (TDF_LabelSequence& Labels) const;
68   
69   //! Adds a Material definition to a table and returns its label
70   Standard_EXPORT TDF_Label AddMaterial (const Handle(TCollection_HAsciiString)& aName, const Handle(TCollection_HAsciiString)& aDescription, const Standard_Real aDensity, const Handle(TCollection_HAsciiString)& aDensName, const Handle(TCollection_HAsciiString)& aDensValType) const;
71   
72   //! Sets a link with GUID
73   Standard_EXPORT void SetMaterial (const TDF_Label& L, const TDF_Label& MatL) const;
74   
75   //! Sets a link with GUID
76   //! Adds a Material as necessary
77   Standard_EXPORT void SetMaterial (const TDF_Label& L, const Handle(TCollection_HAsciiString)& aName, const Handle(TCollection_HAsciiString)& aDescription, const Standard_Real aDensity, const Handle(TCollection_HAsciiString)& aDensName, const Handle(TCollection_HAsciiString)& aDensValType) const;
78   
79   //! Returns Material assigned to <MatL>
80   //! Returns False if no such Material is assigned
81   Standard_EXPORT Standard_Boolean GetMaterial (const TDF_Label& MatL, Handle(TCollection_HAsciiString)& aName, Handle(TCollection_HAsciiString)& aDescription, Standard_Real& aDensity, Handle(TCollection_HAsciiString)& aDensName, Handle(TCollection_HAsciiString)& aDensValType) const;
82   
83   //! Find referred material and return density from it
84   //! if no material --> return 0
85   Standard_EXPORT static Standard_Real GetDensityForShape (const TDF_Label& ShapeL);
86   
87   Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE;
88   
89   Standard_EXPORT void Restore (const Handle(TDF_Attribute)& with) Standard_OVERRIDE;
90   
91   Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
92   
93   Standard_EXPORT void Paste (const Handle(TDF_Attribute)& into, const Handle(TDF_RelocationTable)& RT) const Standard_OVERRIDE;
94
95
96
97
98   DEFINE_STANDARD_RTTIEXT(XCAFDoc_MaterialTool,TDF_Attribute)
99
100 protected:
101
102
103
104
105 private:
106
107
108   Handle(XCAFDoc_ShapeTool) myShapeTool;
109
110
111 };
112
113
114
115
116
117
118
119 #endif // _XCAFDoc_MaterialTool_HeaderFile