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