Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:05:34

0001 // Created on: 2003-03-05
0002 // Created by: Sergey KUUL
0003 // Copyright (c) 2003-2014 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef _XCAFDoc_MaterialTool_HeaderFile
0017 #define _XCAFDoc_MaterialTool_HeaderFile
0018 
0019 #include <Standard.hxx>
0020 #include <Standard_Type.hxx>
0021 
0022 #include <TDataStd_GenericEmpty.hxx>
0023 #include <Standard_Boolean.hxx>
0024 #include <TDF_LabelSequence.hxx>
0025 #include <Standard_Real.hxx>
0026 class XCAFDoc_ShapeTool;
0027 class TDF_Label;
0028 class Standard_GUID;
0029 class TCollection_HAsciiString;
0030 
0031 
0032 class XCAFDoc_MaterialTool;
0033 DEFINE_STANDARD_HANDLE(XCAFDoc_MaterialTool, TDataStd_GenericEmpty)
0034 
0035 //! Provides tools to store and retrieve attributes (materials)
0036 //! of TopoDS_Shape in and from TDocStd_Document
0037 //! A Document is intended to hold different
0038 //! attributes of ONE shape and it's sub-shapes
0039 //! Provide tools for management of Materialss section of document.
0040 class XCAFDoc_MaterialTool : public TDataStd_GenericEmpty
0041 {
0042 
0043 public:
0044 
0045   
0046   Standard_EXPORT XCAFDoc_MaterialTool();
0047   
0048   //! Creates (if not exist) MaterialTool.
0049   Standard_EXPORT static Handle(XCAFDoc_MaterialTool) Set (const TDF_Label& L);
0050   
0051   Standard_EXPORT static const Standard_GUID& GetID();
0052   
0053   //! returns the label under which colors are stored
0054   Standard_EXPORT TDF_Label BaseLabel() const;
0055   
0056   //! Returns internal XCAFDoc_ShapeTool tool
0057   Standard_EXPORT const Handle(XCAFDoc_ShapeTool)& ShapeTool();
0058   
0059   //! Returns True if label belongs to a material table and
0060   //! is a Material definition
0061   Standard_EXPORT Standard_Boolean IsMaterial (const TDF_Label& lab) const;
0062   
0063   //! Returns a sequence of materials currently stored
0064   //! in the material table
0065   Standard_EXPORT void GetMaterialLabels (TDF_LabelSequence& Labels) const;
0066   
0067   //! Adds a Material definition to a table and returns its label
0068   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;
0069   
0070   //! Sets a link with GUID
0071   Standard_EXPORT void SetMaterial (const TDF_Label& L, const TDF_Label& MatL) const;
0072   
0073   //! Sets a link with GUID
0074   //! Adds a Material as necessary
0075   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;
0076   
0077   //! Returns Material assigned to <MatL>
0078   //! Returns False if no such Material is assigned
0079   Standard_EXPORT static 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);
0080   
0081   //! Find referred material and return density from it
0082   //! if no material --> return 0
0083   Standard_EXPORT static Standard_Real GetDensityForShape (const TDF_Label& ShapeL);
0084   
0085   Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE;
0086 
0087   //! Dumps the content of me into the stream
0088   Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
0089 
0090 
0091   DEFINE_DERIVED_ATTRIBUTE(XCAFDoc_MaterialTool,TDataStd_GenericEmpty)
0092 
0093 
0094 private:
0095 
0096 
0097   Handle(XCAFDoc_ShapeTool) myShapeTool;
0098 
0099 
0100 };
0101 
0102 
0103 
0104 
0105 
0106 
0107 
0108 #endif // _XCAFDoc_MaterialTool_HeaderFile