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 _RWPly_CafWriter_HeaderFiler
0015 #define _RWPly_CafWriter_HeaderFiler
0016
0017 #include <TColStd_IndexedDataMapOfStringString.hxx>
0018 #include <TColStd_MapOfAsciiString.hxx>
0019 #include <TDF_LabelSequence.hxx>
0020 #include <TopTools_ShapeMapHasher.hxx>
0021 #include <RWMesh_CoordinateSystemConverter.hxx>
0022 #include <XCAFPrs_Style.hxx>
0023
0024 #include <memory>
0025
0026 class Message_ProgressRange;
0027 class RWMesh_FaceIterator;
0028 class TDocStd_Document;
0029
0030 class Message_LazyProgressScope;
0031 class RWPly_PlyWriterContext;
0032
0033
0034 class RWPly_CafWriter : public Standard_Transient
0035 {
0036 DEFINE_STANDARD_RTTIEXT(RWPly_CafWriter, Standard_Transient)
0037 public:
0038
0039
0040
0041 Standard_EXPORT RWPly_CafWriter (const TCollection_AsciiString& theFile);
0042
0043
0044 Standard_EXPORT virtual ~RWPly_CafWriter();
0045
0046
0047 const RWMesh_CoordinateSystemConverter& CoordinateSystemConverter() const { return myCSTrsf; }
0048
0049
0050 RWMesh_CoordinateSystemConverter& ChangeCoordinateSystemConverter() { return myCSTrsf; }
0051
0052
0053 void SetCoordinateSystemConverter (const RWMesh_CoordinateSystemConverter& theConverter) { myCSTrsf = theConverter; }
0054
0055
0056 const XCAFPrs_Style& DefaultStyle() const { return myDefaultStyle; }
0057
0058
0059 void SetDefaultStyle (const XCAFPrs_Style& theStyle) { myDefaultStyle = theStyle; }
0060
0061 public:
0062
0063
0064 bool IsDoublePrecision() const { return myIsDoublePrec; }
0065
0066
0067 void SetDoublePrecision (bool theDoublePrec) { myIsDoublePrec = theDoublePrec; }
0068
0069
0070 bool HasNormals() const { return myHasNormals; }
0071
0072
0073 void SetNormals (const bool theHasNormals) { myHasNormals = theHasNormals; }
0074
0075
0076 bool HasTexCoords() const { return myHasTexCoords; }
0077
0078
0079 void SetTexCoords (const bool theHasTexCoords) { myHasTexCoords = theHasTexCoords; }
0080
0081
0082 bool HasColors() const { return myHasColors; }
0083
0084
0085 void SetColors (bool theToWrite) { myHasColors = theToWrite; }
0086
0087
0088 bool HasPartId() const { return myHasPartId; }
0089
0090
0091
0092 void SetPartId (bool theSurfId)
0093 {
0094 myHasPartId = theSurfId;
0095 myHasFaceId = myHasFaceId && !myHasPartId;
0096 }
0097
0098
0099 bool HasFaceId() const { return myHasFaceId; }
0100
0101
0102
0103 void SetFaceId (bool theSurfId)
0104 {
0105 myHasFaceId = theSurfId;
0106 myHasPartId = myHasPartId && !myHasFaceId;
0107 }
0108
0109 public:
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122 Standard_EXPORT virtual bool Perform (const Handle(TDocStd_Document)& theDocument,
0123 const TDF_LabelSequence& theRootLabels,
0124 const TColStd_MapOfAsciiString* theLabelFilter,
0125 const TColStd_IndexedDataMapOfStringString& theFileInfo,
0126 const Message_ProgressRange& theProgress);
0127
0128
0129
0130
0131
0132
0133
0134 Standard_EXPORT virtual bool Perform (const Handle(TDocStd_Document)& theDocument,
0135 const TColStd_IndexedDataMapOfStringString& theFileInfo,
0136 const Message_ProgressRange& theProgress);
0137
0138 protected:
0139
0140
0141 Standard_EXPORT virtual Standard_Boolean toSkipFaceMesh (const RWMesh_FaceIterator& theFaceIter);
0142
0143
0144
0145
0146
0147 Standard_EXPORT virtual void addFaceInfo (const RWMesh_FaceIterator& theFace,
0148 Standard_Integer& theNbNodes,
0149 Standard_Integer& theNbElems);
0150
0151
0152
0153
0154
0155
0156
0157
0158 Standard_EXPORT virtual bool writeShape (RWPly_PlyWriterContext& theWriter,
0159 Message_LazyProgressScope& thePSentry,
0160 const Standard_Integer theWriteStep,
0161 const TDF_Label& theLabel,
0162 const TopLoc_Location& theParentTrsf,
0163 const XCAFPrs_Style& theParentStyle);
0164
0165
0166
0167
0168
0169
0170 Standard_EXPORT virtual bool writeNodes (RWPly_PlyWriterContext& theWriter,
0171 Message_LazyProgressScope& thePSentry,
0172 const RWMesh_FaceIterator& theFace);
0173
0174
0175
0176
0177
0178
0179 Standard_EXPORT virtual bool writeIndices (RWPly_PlyWriterContext& theWriter,
0180 Message_LazyProgressScope& thePSentry,
0181 const RWMesh_FaceIterator& theFace);
0182
0183
0184 protected:
0185
0186 TCollection_AsciiString myFile;
0187 RWMesh_CoordinateSystemConverter myCSTrsf;
0188 XCAFPrs_Style myDefaultStyle;
0189 Standard_Boolean myIsDoublePrec;
0190 Standard_Boolean myHasNormals;
0191 Standard_Boolean myHasColors;
0192 Standard_Boolean myHasTexCoords;
0193 Standard_Boolean myHasPartId;
0194 Standard_Boolean myHasFaceId;
0195
0196 };
0197
0198 #endif