GoPxL SDK
GoGdpRendering.h
Go to the documentation of this file.
1 
9 #ifndef GO_PXL_SDK_GOGDPRENDERING_H
10 #define GO_PXL_SDK_GOGDPRENDERING_H
11 
13 
14 class GoGdpMsgTests;
15 
16 namespace GoPxLSdk
17 {
18  typedef struct GoPointSet
19  {
20  k32f size;
21  k32u color;
22  k32s shape;
23  std::vector<kPoint3d32f> points;
24 
25  GoPointSet() = default;
26  GoPointSet(k32f size, k32u color, k32s shape, std::vector<kPoint3d32f> points) :
27  size(size), color(color), shape(shape), points(points) {}
28 
29  } PointSet;
30 
31  typedef struct GoLineSet
32  {
33  k32f width;
34  k32u color;
37  std::vector<kPoint3d32f> points;
38 
39  GoLineSet() = default;
40  GoLineSet(k32f width, k32u color, bool hasStartPointArrow, bool hasEndPointArrow, std::vector<kPoint3d32f> points) :
41  width(width), color(color), hasStartPointArrow(hasStartPointArrow), hasEndPointArrow(hasEndPointArrow), points(points) {}
42 
43  } GoLineSet;
44 
45  enum RegionType : k8u
46  {
48  Region_3d = 1,
49  Surface_Region_2d = 2, // For future use.
50  };
51 
52  struct GoRegion
53  {
54  virtual ~GoRegion()
55  {};
56 
58  };
59 
61  {
62  k64f x;
63  k64f z;
64  k64f width;
65  k64f height;
66  k64f angleY;
67  };
68 
70  {
71  k64f x;
72  k64f y;
73  k64f width;
74  k64f length;
75  k64f angleZ;
76  };
77 
79  {
80  k64f x;
81  k64f y;
82  k64f z;
83  k64f width;
84  k64f length;
85  k64f height;
86  k64f angleZ;
87  };
88 
89  struct GoPlane
90  {
91  k32f distance;
92  kPoint3d32f normal;
93  };
94 
95  struct GoRay
96  {
97  kPoint3d32f position;
98  kPoint3d32f direction;
99  k32f width;
100  k32u color;
101  };
102 
103  struct GoLabel
104  {
105  std::string text;
106  kPoint3d64f position;
107  };
108 
109  struct GoPosition
110  {
111  kPoint3d64f position;
112  k8u type;
113  };
114 
116  {
117  public:
124  GoGraphics() = default;
125  ~GoGraphics() = default;
126 
135  void Deserialize(kSerializer serializer);
136 
144  const size_t PointSetCount() const;
145 
154  const GoPointSet& PointSetAt(k32u index) const;
155 
163  const size_t LineSetCount() const;
164 
173  const GoLineSet& LineSetAt(k32u index) const;
174 
182  const size_t RegionCount() const;
183 
192  const GoRegion& RegionAt(k32u index) const;
193 
201  const size_t PlaneCount() const;
202 
211  const GoPlane& PlaneAt(k32u index) const;
212 
220  const size_t RayCount() const;
221 
230  const GoRay& RayAt(k32u index) const;
231 
239  const size_t LabelCount() const;
240 
249  const GoLabel& LabelAt(k32u index) const;
250 
258  const size_t PositionCount() const;
259 
268  const GoPosition& PositionAt(k32u index) const;
269 
270  private:
271  // Helper functions to deserialize the different bytes of graphics types.
272  void DeserializePointSets(kSerializer serializer, k16s count);
273  void DeserializeLineSets(kSerializer serializer, k16s count);
274  void DeserializeRegions(kSerializer serializer, k16s count);
275  void DeserializePlanes(kSerializer serializer, k16s count);
276  void DeserializeRays(kSerializer serializer, k16s count);
277  void DeserializeLabels(kSerializer serializer, k16s count);
278  void DeserializePositions(kSerializer serializer, k16s count);
279 
280  void ReadOnePointSet(kSerializer serializer, PointSet& pointSetEntry, k16u& pointCount);
281  void ReadOneLineSet(kSerializer serializer, GoLineSet& lineSetEntry, k16u& pointCount);
282 
283  void ReadProfileRegion2d(kSerializer serializer, GoProfileRegion2d& region);
284  void ReadSurfaceRegion2d(kSerializer serializer, GoSurfaceRegion2d& region);
285  void ReadSurfaceRegion3d(kSerializer serializer, GoRegion3d& region);
286 
287  private:
288  std::vector<GoPointSet> pointSet;
289  std::vector<GoLineSet> lineSet;
290  std::vector<std::shared_ptr<GoRegion>> regionSet;
291  std::vector<GoPlane> planeSet;
292  std::vector<GoRay> raySet;
293  std::vector<GoLabel> labelSet;
294  std::vector<GoPosition> positionSet;
295 
296  friend class ::GoGdpMsgTests;
297  };
298 
300  {
301  public:
305  GoGdpRendering();
306  ~GoGdpRendering() = default;
307 
313  void Deserialize(kSerializer serializer) override;
314 
319  const GoGraphics& GetGraphics() const;
320 
321  private:
322  GoGraphics graphics;
323 
324  kStatus DeserializeGraphic(kSerializer serializer);
325  kStatus DeserializePointSets(kSerializer serializer, k16s count);
326  kStatus DeserializeLineSets(kSerializer serializer, k16s count);
327  kStatus DeserializeRegions(kSerializer serializer, k16s count);
328  kStatus DeserializePlanes(kSerializer serializer, k16s count);
329  kStatus DeserializeRays(kSerializer serializer, k16s count);
330  kStatus DeserializeLabels(kSerializer serializer, k16s count);
331  kStatus DeserializePositions(kSerializer serializer, k16s count);
332 
333  friend class ::GoGdpMsgTests;
334  };
335 }
336 
337 #endif
RegionType type
Definition: GoGdpRendering.h:55
k64f x
Definition: GoGdpRendering.h:62
bool hasEndPointArrow
Definition: GoGdpRendering.h:36
Definition: GoGdpRendering.h:103
k64f angleZ
Definition: GoGdpRendering.h:86
#define GoPxLSdkClass
Definition: Def.h:35
std::vector< kPoint3d32f > points
Definition: GoGdpRendering.h:23
k64f z
Definition: GoGdpRendering.h:63
k32s shape
Definition: GoGdpRendering.h:22
Definition: GoGdpRendering.h:299
GoLineSet(k32f width, k32u color, bool hasStartPointArrow, bool hasEndPointArrow, std::vector< kPoint3d32f > points)
Definition: GoGdpRendering.h:40
Definition: GoGdpRendering.h:95
std::vector< kPoint3d32f > points
Definition: GoGdpRendering.h:37
Definition: GoGdpRendering.h:78
k64f width
Definition: GoGdpRendering.h:73
k32f distance
Definition: GoGdpRendering.h:91
Definition: GoGdpRendering.h:89
Definition: GoGdpRendering.h:69
virtual ~GoRegion()
Definition: GoGdpRendering.h:54
k32f width
Definition: GoGdpRendering.h:33
k64f x
Definition: GoGdpRendering.h:71
k64f width
Definition: GoGdpRendering.h:83
Definition: GoGdpRendering.h:49
RegionType
Definition: GoGdpRendering.h:45
k64f width
Definition: GoGdpRendering.h:64
kPoint3d64f position
Definition: GoGdpRendering.h:106
k64f height
Definition: GoGdpRendering.h:85
Definition: GoGdpRendering.h:115
Definition: GoGdpRendering.h:47
Definition: GoGdpRendering.h:31
k32u color
Definition: GoGdpRendering.h:34
kPoint3d64f position
Definition: GoGdpRendering.h:111
kPoint3d32f direction
Definition: GoGdpRendering.h:98
k8u type
Definition: GoGdpRendering.h:112
k64f length
Definition: GoGdpRendering.h:84
k64f x
Definition: GoGdpRendering.h:80
k64f angleY
Definition: GoGdpRendering.h:66
kPoint3d32f normal
Definition: GoGdpRendering.h:92
k32u color
Definition: GoGdpRendering.h:100
Definition: GoGdpRendering.h:48
k64f z
Definition: GoGdpRendering.h:82
k64f angleZ
Definition: GoGdpRendering.h:75
k32f size
Definition: GoGdpRendering.h:20
std::string text
Definition: GoGdpRendering.h:105
GoPointSet(k32f size, k32u color, k32s shape, std::vector< kPoint3d32f > points)
Definition: GoGdpRendering.h:26
k64f height
Definition: GoGdpRendering.h:65
k64f length
Definition: GoGdpRendering.h:74
bool hasStartPointArrow
Definition: GoGdpRendering.h:35
Definition: GoGdpRendering.h:52
k64f y
Definition: GoGdpRendering.h:81
Definition: GoGdpRendering.h:109
k64f y
Definition: GoGdpRendering.h:72
Definition: Def.h:46
k32f width
Definition: GoGdpRendering.h:99
k32u color
Definition: GoGdpRendering.h:21
kPoint3d32f position
Definition: GoGdpRendering.h:97
Definition: GoGdpMsg.h:37
Definition: GoGdpRendering.h:60
Definition: GoGdpRendering.h:18