File indexing completed on 2026-09-10 09:17:56
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 Standard_EXPORT RWPly_CafWriter(const TCollection_AsciiString& theFile);
0041
0042
0043 Standard_EXPORT virtual ~RWPly_CafWriter();
0044
0045
0046 const RWMesh_CoordinateSystemConverter& CoordinateSystemConverter() const { return myCSTrsf; }
0047
0048
0049 RWMesh_CoordinateSystemConverter& ChangeCoordinateSystemConverter() { return myCSTrsf; }
0050
0051
0052 void SetCoordinateSystemConverter(const RWMesh_CoordinateSystemConverter& theConverter)
0053 {
0054 myCSTrsf = theConverter;
0055 }
0056
0057
0058 const XCAFPrs_Style& DefaultStyle() const { return myDefaultStyle; }
0059
0060
0061 void SetDefaultStyle(const XCAFPrs_Style& theStyle) { myDefaultStyle = theStyle; }
0062
0063 public:
0064
0065
0066 bool IsDoublePrecision() const { return myIsDoublePrec; }
0067
0068
0069 void SetDoublePrecision(bool theDoublePrec) { myIsDoublePrec = theDoublePrec; }
0070
0071
0072 bool HasNormals() const { return myHasNormals; }
0073
0074
0075 void SetNormals(const bool theHasNormals) { myHasNormals = theHasNormals; }
0076
0077
0078 bool HasTexCoords() const { return myHasTexCoords; }
0079
0080
0081 void SetTexCoords(const bool theHasTexCoords) { myHasTexCoords = theHasTexCoords; }
0082
0083
0084 bool HasColors() const { return myHasColors; }
0085
0086
0087 void SetColors(bool theToWrite) { myHasColors = theToWrite; }
0088
0089
0090 bool HasPartId() const { return myHasPartId; }
0091
0092
0093
0094 void SetPartId(bool theSurfId)
0095 {
0096 myHasPartId = theSurfId;
0097 myHasFaceId = myHasFaceId && !myHasPartId;
0098 }
0099
0100
0101 bool HasFaceId() const { return myHasFaceId; }
0102
0103
0104
0105 void SetFaceId(bool theSurfId)
0106 {
0107 myHasFaceId = theSurfId;
0108 myHasPartId = myHasPartId && !myHasFaceId;
0109 }
0110
0111 public:
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123 Standard_EXPORT virtual bool Perform(const Handle(TDocStd_Document)& theDocument,
0124 const TDF_LabelSequence& theRootLabels,
0125 const TColStd_MapOfAsciiString* theLabelFilter,
0126 const TColStd_IndexedDataMapOfStringString& theFileInfo,
0127 const Message_ProgressRange& theProgress);
0128
0129
0130
0131
0132
0133
0134
0135 Standard_EXPORT virtual bool Perform(const Handle(TDocStd_Document)& theDocument,
0136 const TColStd_IndexedDataMapOfStringString& theFileInfo,
0137 const Message_ProgressRange& theProgress);
0138
0139 protected:
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 protected:
0184 TCollection_AsciiString myFile;
0185
0186 RWMesh_CoordinateSystemConverter myCSTrsf;
0187 XCAFPrs_Style myDefaultStyle;
0188
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 #endif