CFx SDK Documentation  2022 SP0
FMDataSerialize.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2017, Open Design Alliance (the "Alliance").
3 // All rights reserved.
4 //
5 // This software and its documentation and related materials are owned by
6 // the Alliance. The software may only be incorporated into application
7 // programs owned by members of the Alliance, subject to a signed
8 // Membership Agreement and Supplemental Software License Agreement with the
9 // Alliance. The structure and organization of this software are the valuable
10 // trade secrets of the Alliance and its suppliers. The software is also
11 // protected by copyright law and international treaty provisions. Application
12 // programs incorporating this software must include the following statement
13 // with their copyright notices:
14 //
15 // This application incorporates Teigha(R) software pursuant to a license
16 // agreement with Open Design Alliance.
17 // Teigha(R) Copyright (C) 2002-2017 by Open Design Alliance.
18 // All rights reserved.
19 //
20 // By use of this software, its documentation or related materials, you
21 // acknowledge and accept the above terms.
23 #ifndef _FM_DATA_SERIALIZE_
24 #define _FM_DATA_SERIALIZE_
25 
26 #include <OdaCommon.h>
27 #include "OdPlatformSettings.h"
28 #include "Modeler/FMMdlBody.h"
29 #include "Modeler/FMMdlVertex.h"
30 #include <map>
31 
32 namespace FacetModeler
33 {
34 
35  static FacetModeler::BodyImpl* GetBodyImpl(const FacetModeler::Body& val)
36  {
37  FacetModeler::BodyImpl* pBodyImpl = *((FacetModeler::BodyImpl**)(&val));
38  return pBodyImpl;
39  }
40 
41  struct VertexImage
42  {
44  {}
46  void* pKey;
47  void* pPrev;
48  void* pNext;
49  };
50 
51  struct EdgeImage
52  {
55  {}
56 
58  void* pFaceKey;
59  void* pLoopKey;
60  void* pVertexKey;
61  void* pPrevKey;
62  void* pNextKey;
63  void* pPairKey;
64  void* pPartnerKey;
65  };
66 
67  struct LoopImage
68  {
70  {}
71 
72  void* pLoopKey;
73  std::vector<void*> edgeKeys;
74  };
75 
76  typedef std::vector<LoopImage> LoopImages;
77 
78  struct FaceImage
79  {
81  {}
82 
84  void* pFaceKey;
85  void* pPrevKey;
86  void* pNextKey;
87 
89  };
90 
91  typedef std::vector<VertexImage> VertexImages;
92  typedef std::map<void*, EdgeImage> EdgeImages;
93  typedef std::vector<FaceImage> FaceImages;
94 
95  class FMGEOMETRY_API BinaryStream
96  {
97  FILE* m_hFile;
98 
99  public:
101  {
102  ePoint2dMarker = 1,
103  eContour2dMarker = 2,
104  eProfile2dMarker = 3,
105  eBodyMarker = 4,
106  eFaceMarker = 5,
107  ePoint3dMarker = 6
108  };
109 
110  public:
113 
114  bool Create(const OdString& szFile);
115  bool Open(const OdString& szFile);
116 
117  void Write(const void* pData, size_t length);
118  void Read(void* pData, size_t length);
119 
120  template<typename T>
121  void Write(const T val)
122  {
123  Write(&val, sizeof(val));
124  }
125 
126  void Write(const OdGePoint2d& val);
127  void Write(const FacetModeler::Contour2D& val);
128  void Write(const FacetModeler::Profile2D& val);
129 
130  void Write(const OdGePoint3d& val);
131  void Write(const FacetModeler::Face& val);
132  void Write(const FacetModeler::Body& val);
133 
134  void WriteVertexList(FacetModeler::Vertex* pVertexList, OdUInt32 uVtxCount);
138 
139  template<typename T>
140  void Read(T& val)
141  {
142  Read(&val, sizeof(val));
143  }
144 
145  void Read(OdGePoint2d& val);
148 
149  void Read(OdGePoint3d& val);
152 
153  void ReadVertexImages(VertexImages& vertexImages, FacetModeler::Body* pBody);
155 
156  void ReadEdgeImages(EdgeImages& edgeImages);
157  void ReadFaceImages(FaceImages& faceImages);
158  };
159 
160 } // ::
161 #endif //_FM_DATA_SERIALIZE_
#define NULL
Definition: GsProperties.h:177
unsigned int OdUInt32
void SetVertexListForBody(VertexImages &vertexImages, FacetModeler::Body &val)
bool Open(const OdString &szFile)
void Read(void *pData, size_t length)
void Read(FacetModeler::Profile2D &val)
void ReadEdgeImages(EdgeImages &edgeImages)
void Write(const FacetModeler::Face &val)
void Read(OdGePoint3d &val)
void Read(OdGePoint2d &val)
void Write(const FacetModeler::Body &val)
bool Create(const OdString &szFile)
void ReadFaceImages(FaceImages &faceImages)
void ReadVertexImages(VertexImages &vertexImages, FacetModeler::Body *pBody)
void Write(const FacetModeler::Contour2D &val)
void Write(const FacetModeler::Profile2D &val)
void WriteVertex(FacetModeler::Vertex *pVertex)
void Read(FacetModeler::Contour2D &val)
void WriteEdge(FacetModeler::Edge *pEdge)
void Write(const void *pData, size_t length)
void Write(const OdGePoint3d &val)
void Write(const OdGePoint2d &val)
void WriteVertexList(FacetModeler::Vertex *pVertexList, OdUInt32 uVtxCount)
void WriteEdgesList(const FacetModeler::Body &val)
void ReadFaceToBody(FacetModeler::Body &val)
void Read(FacetModeler::Body &val)
GLuint GLsizei GLsizei * length
Definition: gles2_ext.h:274
std::vector< LoopImage > LoopImages
std::vector< VertexImage > VertexImages
std::vector< FaceImage > FaceImages
std::map< void *, EdgeImage > EdgeImages
@ Read
Definition: RxFS.h:61
@ Write
Definition: RxFS.h:62
FacetModeler::Edge * pEdge
FacetModeler::Face * pFace
std::vector< void * > edgeKeys
FacetModeler::Vertex * pVtx