CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
FMDataSerialize.h
Go to the documentation of this file.
1
2// Copyright (C) 2002-2022, 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 Open Design Alliance software pursuant to a license
16// agreement with Open Design Alliance.
17// Open Design Alliance Copyright (C) 2002-2022 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
32namespace FacetModeler
33{
36
41 {
45 VertexImage() : pVtx(NULL), pPrev(0), pNext(0), pKey(0)
46 {}
47 Vertex* pVtx; // Vertex pointer.
48 KeyType pKey; // Key.
49 KeyType pPrev; // Previous key.
50 KeyType pNext; // Next key.
51 };
52
56 struct EdgeImage
57 {
61 EdgeImage() : pEdge(NULL), pFaceKey(0), pLoopKey(0),
63 {}
64
65 Edge* pEdge; // Edge pointer.
66 KeyType pFaceKey; // Face key.
67 KeyType pLoopKey; // Loop key.
68 KeyType pVertexKey; // Vertex key.
69 KeyType pPrevKey; // Previous key.
70 KeyType pNextKey; // Next key.
71 KeyType pPairKey; // Pair key.
72 KeyType pPartnerKey; // Partner key.
73 };
74
78 struct LoopImage
79 {
84 {}
85
86 KeyType pLoopKey; // Loop key.
87 std::vector<KeyType> edgeKeys; // Edge key array.
88 };
89
91 typedef std::vector<LoopImage> LoopImages;
92
96 struct FaceImage
97 {
102 {}
103
104 Face* pFace; // Face pointer.
105 KeyType pFaceKey; // Face key.
106 KeyType pPrevKey; // Previous key.
107 KeyType pNextKey; // Next key.
108
109 LoopImages loopImages; // Loop images.
110 };
111
113 typedef std::vector<VertexImage> VertexImages;
114
116 typedef std::map<KeyType, EdgeImage> EdgeImages;
117
119 typedef std::vector<FaceImage> FaceImages;
120
125 {
126 public:
127
132 {
134 ePoint2dMarker = 1,
135
137 eContour2dMarker = 2,
138
140 eProfile2dMarker = 3,
141
143 eBodyMarker = 4,
144
146 eFaceMarker = 5,
147
149 ePoint3dMarker = 6
150 };
151
156 {
158 v64bit = -2,
159
161 v32bit = -1,
162
164 vAuto = 0,
165
167 vKeyTypeAdded = 1,
168
170 vSaveColorsAdded = 2,
171
173 vCurrent = 2,
174 };
175
176 static const OdUInt32 iSigLen = 4; // Signature length in bytes
177 static const OdUInt32 iVerLen = 2; // Version length in bytes
178
183
188
195 bool Create(const OdString& szFile);
196
204 bool Open(const OdString& szFile, Version ver = vAuto);
205
206
214 bool Open(OdStreamBuf* pFileBuff, Version ver = vAuto);
215
222 bool Create(OdStreamBuf* pFileBuff);
223
230 bool Reset(Version ver = vAuto);
231
237 inline Version getVersion() const
238 {
239 return m_iVersion;
240 };
241
248 void Write(const void* pData, OdUInt32 length);
249
256 void Read(void* pData, OdUInt32 length);
257
263 template<typename T>
264 void Write(const T val)
265 {
266 Write(&val, sizeof(val));
267 }
268
274 void Write(const OdGePoint2d& val);
275
281 void Write(const Contour2D& val);
282
288 void Write(const Profile2D& val);
289
295 void Write(const OdGePoint3d& val);
296
302 void Write(const Face& val);
303
309 void Write(const Body& val);
310
317 void WriteVertexList(Vertex* pVertexList, OdUInt32 uVtxCount);
318
324 void WriteVertex(Vertex* pVertex);
325
331 void WriteEdgesList(const Body& val);
332
338 void WriteEdge(Edge* pEdge);
339
345 template<typename T>
346 void Read(T& val)
347 {
348 Read(&val, sizeof(val));
349 }
350
356 void Read(OdGePoint2d& val);
357
363 void Read(Contour2D& val);
369 void Read(Profile2D& val);
370
376 void Read(OdGePoint3d& val);
377
384
390 void Read(Body& val);
391
397 void ReadKey(KeyType& val);
398
405 void ReadVertexImages(VertexImages& vertexImages, Body* pBody);
406
413 void SetVertexListForBody(VertexImages& vertexImages, Body& val);
414
420 void ReadEdgeImages(EdgeImages& edgeImages);
421
427 void ReadFaceImages(FaceImages& faceImages);
428 private:
429 OdStreamBufPtr m_pStream; // Pointer to the stream buffer
430 Version m_iVersion; // Current version
431 };
432
433} // ::
434#endif //_FM_DATA_SERIALIZE_
#define FMGEOMETRY_API
unsigned int OdUInt32
void WriteEdge(Edge *pEdge)
bool Create(OdStreamBuf *pFileBuff)
void ReadVertexImages(VertexImages &vertexImages, Body *pBody)
void Read(Profile2D &val)
void Read(Contour2D &val)
void ReadEdgeImages(EdgeImages &edgeImages)
void Read(OdGePoint3d &val)
void Read(OdGePoint2d &val)
bool Open(const OdString &szFile, Version ver=vAuto)
void Read(void *pData, OdUInt32 length)
bool Create(const OdString &szFile)
void ReadFaceImages(FaceImages &faceImages)
void ReadFaceToBody(Body &val)
void Write(const Body &val)
void Write(const Contour2D &val)
void WriteVertexList(Vertex *pVertexList, OdUInt32 uVtxCount)
void Write(const Face &val)
void Write(const Profile2D &val)
void WriteEdgesList(const Body &val)
void ReadKey(KeyType &val)
void Write(const void *pData, OdUInt32 length)
void Write(const OdGePoint3d &val)
void SetVertexListForBody(VertexImages &vertexImages, Body &val)
void Write(const OdGePoint2d &val)
bool Open(OdStreamBuf *pFileBuff, Version ver=vAuto)
bool Reset(Version ver=vAuto)
void WriteVertex(Vertex *pVertex)
GLuint GLsizei GLsizei * length
Definition: gles2_ext.h:274
std::vector< LoopImage > LoopImages
OdUInt64 KeyType
std::vector< VertexImage > VertexImages
std::vector< FaceImage > FaceImages
std::map< KeyType, EdgeImage > EdgeImages
std::vector< KeyType > edgeKeys