GoPxL SDK

- Home
- Files
- Namespace

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
12 #include <GoPxLSdk/GoGdpMsg/GoGdpMsg.h>
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;
35 bool hasStartPointArrow;
36 bool hasEndPointArrow;
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 {
47 Profile_Region_2d = 0,
48 Region_3d = 1,
49 Surface_Region_2d = 2, // For future use.
50 };
51
52 struct GoRegion
53 {
54 virtual ~GoRegion()
55 {};
56
57 RegionType type;
58 };
59
60 struct GoProfileRegion2d : GoRegion
61 {
62 k64f x;
63 k64f z;
64 k64f width;
65 k64f height;
66 k64f angleY;
67 };
68
69 struct GoSurfaceRegion2d : GoRegion
70 {
71 k64f x;
72 k64f y;
73 k64f width;
74 k64f length;
75 k64f angleZ;
76 };
77
78 struct GoRegion3d : GoRegion
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
115 class GoPxLSdkClass GoGraphics
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
299 class GoPxLSdkClass GoGdpRendering : public GoGdpMsg
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
GoPxLSdk::GoRegion::type
RegionType type
Definition: GoGdpRendering.h:55
GoPxLSdk::GoProfileRegion2d::x
k64f x
Definition: GoGdpRendering.h:62
GoLineSet::hasEndPointArrow
bool hasEndPointArrow
Definition: GoGdpRendering.h:36
GoPxLSdk::GoLabel
Definition: GoGdpRendering.h:103
GoPxLSdk::GoRegion3d::angleZ
k64f angleZ
Definition: GoGdpRendering.h:86
GoPxLSdkClass
#define GoPxLSdkClass
Definition: Def.h:35
PointSet::points
std::vector< kPoint3d32f > points
Definition: GoGdpRendering.h:23
GoPxLSdk::GoProfileRegion2d::z
k64f z
Definition: GoGdpRendering.h:63
PointSet::shape
k32s shape
Definition: GoGdpRendering.h:22
GoPxLSdk::GoGdpRendering
Definition: GoGdpRendering.h:299
GoLineSet::GoLineSet
GoLineSet(k32f width, k32u color, bool hasStartPointArrow, bool hasEndPointArrow, std::vector< kPoint3d32f > points)
Definition: GoGdpRendering.h:40
GoPxLSdk::GoRay
Definition: GoGdpRendering.h:95
GoLineSet::points
std::vector< kPoint3d32f > points
Definition: GoGdpRendering.h:37
GoPxLSdk::GoRegion3d
Definition: GoGdpRendering.h:78
GoPxLSdk::GoSurfaceRegion2d::width
k64f width
Definition: GoGdpRendering.h:73
GoPxLSdk::GoPlane::distance
k32f distance
Definition: GoGdpRendering.h:91
GoPxLSdk::GoPlane
Definition: GoGdpRendering.h:89
GoPxLSdk::GoSurfaceRegion2d
Definition: GoGdpRendering.h:69
GoPxLSdk::GoRegion::~GoRegion
virtual ~GoRegion()
Definition: GoGdpRendering.h:54
GoLineSet::width
k32f width
Definition: GoGdpRendering.h:33
GoPxLSdk::GoSurfaceRegion2d::x
k64f x
Definition: GoGdpRendering.h:71
GoPxLSdk::GoRegion3d::width
k64f width
Definition: GoGdpRendering.h:83
GoPxLSdk::Surface_Region_2d
Definition: GoGdpRendering.h:49
GoPxLSdk::RegionType
RegionType
Definition: GoGdpRendering.h:45
GoPxLSdk::GoProfileRegion2d::width
k64f width
Definition: GoGdpRendering.h:64
GoPxLSdk::GoLabel::position
kPoint3d64f position
Definition: GoGdpRendering.h:106
GoPxLSdk::GoRegion3d::height
k64f height
Definition: GoGdpRendering.h:85
GoPxLSdk::GoGraphics
Definition: GoGdpRendering.h:115
GoPxLSdk::Profile_Region_2d
Definition: GoGdpRendering.h:47
GoLineSet
Definition: GoGdpRendering.h:31
GoLineSet::color
k32u color
Definition: GoGdpRendering.h:34
GoGdpMsg.h
GoPxLSdk::GoPosition::position
kPoint3d64f position
Definition: GoGdpRendering.h:111
GoPxLSdk::GoRay::direction
kPoint3d32f direction
Definition: GoGdpRendering.h:98
GoPxLSdk::GoPosition::type
k8u type
Definition: GoGdpRendering.h:112
GoPxLSdk::GoRegion3d::length
k64f length
Definition: GoGdpRendering.h:84
GoPxLSdk::GoRegion3d::x
k64f x
Definition: GoGdpRendering.h:80
GoPxLSdk::GoProfileRegion2d::angleY
k64f angleY
Definition: GoGdpRendering.h:66
GoPxLSdk::GoPlane::normal
kPoint3d32f normal
Definition: GoGdpRendering.h:92
GoPxLSdk::GoRay::color
k32u color
Definition: GoGdpRendering.h:100
GoPxLSdk::Region_3d
Definition: GoGdpRendering.h:48
GoPxLSdk::GoRegion3d::z
k64f z
Definition: GoGdpRendering.h:82
GoPxLSdk::GoSurfaceRegion2d::angleZ
k64f angleZ
Definition: GoGdpRendering.h:75
PointSet::size
k32f size
Definition: GoGdpRendering.h:20
GoPxLSdk::GoLabel::text
std::string text
Definition: GoGdpRendering.h:105
PointSet::GoPointSet
GoPointSet(k32f size, k32u color, k32s shape, std::vector< kPoint3d32f > points)
Definition: GoGdpRendering.h:26
GoPxLSdk::GoProfileRegion2d::height
k64f height
Definition: GoGdpRendering.h:65
GoPxLSdk::GoSurfaceRegion2d::length
k64f length
Definition: GoGdpRendering.h:74
GoLineSet::hasStartPointArrow
bool hasStartPointArrow
Definition: GoGdpRendering.h:35
GoPxLSdk::GoRegion
Definition: GoGdpRendering.h:52
GoPxLSdk::GoRegion3d::y
k64f y
Definition: GoGdpRendering.h:81
GoPxLSdk::GoPosition
Definition: GoGdpRendering.h:109
GoPxLSdk::GoSurfaceRegion2d::y
k64f y
Definition: GoGdpRendering.h:72
GoPxLSdk
Definition: Def.h:46
GoPxLSdk::GoRay::width
k32f width
Definition: GoGdpRendering.h:99
PointSet::color
k32u color
Definition: GoGdpRendering.h:21
GoPxLSdk::GoRay::position
kPoint3d32f position
Definition: GoGdpRendering.h:97
GoPxLSdk::GoGdpMsg
Definition: GoGdpMsg.h:37
GoPxLSdk::GoProfileRegion2d
Definition: GoGdpRendering.h:60
PointSet
Definition: GoGdpRendering.h:18