File indexing completed on 2025-01-18 10:04:43
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef _RWMesh_MaterialMap_HeaderFile
0015 #define _RWMesh_MaterialMap_HeaderFile
0016
0017 #include <NCollection_DoubleMap.hxx>
0018 #include <NCollection_Map.hxx>
0019 #include <XCAFPrs_Style.hxx>
0020
0021
0022
0023
0024 class RWMesh_MaterialMap : public Standard_Transient
0025 {
0026 DEFINE_STANDARD_RTTIEXT(RWMesh_MaterialMap, Standard_Transient)
0027 public:
0028
0029
0030 Standard_EXPORT RWMesh_MaterialMap (const TCollection_AsciiString& theFile);
0031
0032
0033 Standard_EXPORT virtual ~RWMesh_MaterialMap();
0034
0035
0036 const XCAFPrs_Style& DefaultStyle() const { return myDefaultStyle; }
0037
0038
0039 void SetDefaultStyle (const XCAFPrs_Style& theStyle) { myDefaultStyle = theStyle; }
0040
0041
0042 TCollection_AsciiString FindMaterial (const XCAFPrs_Style& theStyle) const
0043 {
0044 if (myStyles.IsBound1 (theStyle))
0045 {
0046 return myStyles.Find1 (theStyle);
0047 }
0048 return TCollection_AsciiString();
0049 }
0050
0051
0052 Standard_EXPORT virtual TCollection_AsciiString AddMaterial (const XCAFPrs_Style& theStyle);
0053
0054
0055
0056
0057
0058 Standard_EXPORT virtual bool CreateTextureFolder();
0059
0060
0061
0062
0063
0064 Standard_EXPORT virtual bool CopyTexture (TCollection_AsciiString& theResTexture,
0065 const Handle(Image_Texture)& theTexture,
0066 const TCollection_AsciiString& theKey);
0067
0068
0069 virtual void DefineMaterial (const XCAFPrs_Style& theStyle,
0070 const TCollection_AsciiString& theKey,
0071 const TCollection_AsciiString& theName) = 0;
0072
0073
0074 bool IsFailed() const { return myIsFailed; }
0075
0076 protected:
0077
0078
0079 Standard_EXPORT static bool copyFileTo (const TCollection_AsciiString& theFileSrc,
0080 const TCollection_AsciiString& theFileDst);
0081
0082 protected:
0083
0084 TCollection_AsciiString myFolder;
0085 TCollection_AsciiString myTexFolder;
0086 TCollection_AsciiString myTexFolderShort;
0087 TCollection_AsciiString myFileName;
0088 TCollection_AsciiString myShortFileNameBase;
0089 TCollection_AsciiString myKeyPrefix;
0090 NCollection_DoubleMap<XCAFPrs_Style, TCollection_AsciiString>
0091 myStyles;
0092 NCollection_Map<Handle(Image_Texture)>
0093 myImageFailMap;
0094 XCAFPrs_Style myDefaultStyle;
0095 Standard_Integer myNbMaterials;
0096 Standard_Boolean myIsFailed;
0097 Standard_Boolean myMatNameAsKey;
0098
0099 };
0100
0101 #endif