-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmaps_LivicRealObject2BaseType.cpp
More file actions
182 lines (163 loc) · 7.9 KB
/
Copy pathmaps_LivicRealObject2BaseType.cpp
File metadata and controls
182 lines (163 loc) · 7.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
////////////////////////////////
// RTMaps SDK Component
////////////////////////////////
////////////////////////////////
// Purpose of this module :
////////////////////////////////
#include "maps_LivicRealObject2BaseType.h" // Includes the header of this component
// Use the macros to declare the inputs
MAPS_BEGIN_INPUTS_DEFINITION(MAPSLivicRealObject2BaseType)
MAPS_INPUT("iRealObject",MAPS::FilterRealObjects,MAPS::FifoReader)
MAPS_END_INPUTS_DEFINITION
// Use the macros to declare the outputs
MAPS_BEGIN_OUTPUTS_DEFINITION(MAPSLivicRealObject2BaseType)
MAPS_OUTPUT("oIntegerId",MAPS::Integer,NULL,NULL,MAX_CIBLES_IR)
MAPS_OUTPUT("oFloatX",MAPS::Float,NULL,NULL,MAX_CIBLES_IR)
MAPS_OUTPUT("oFloatY",MAPS::Float,NULL,NULL,MAX_CIBLES_IR)
MAPS_OUTPUT("oFloatZ",MAPS::Float,NULL,NULL,MAX_CIBLES_IR)
MAPS_OUTPUT("oIntegerEtatPiste",MAPS::Integer,NULL,NULL,MAX_CIBLES_IR)
MAPS_OUTPUT("oIntegerNumeroPiste",MAPS::Integer,NULL,NULL,MAX_CIBLES_IR)
MAPS_OUTPUT("oFloatVitesse",MAPS::Float,NULL,NULL,MAX_CIBLES_IR)
MAPS_OUTPUT("oFloatHauteur",MAPS::Float,NULL,NULL,MAX_CIBLES_IR)
MAPS_OUTPUT("oFloatLargeur",MAPS::Float,NULL,NULL,MAX_CIBLES_IR)
MAPS_OUTPUT("oFloatProfondeur",MAPS::Float,NULL,NULL,MAX_CIBLES_IR)
MAPS_OUTPUT("oIntegerVoie",MAPS::Integer,NULL,NULL,MAX_CIBLES_IR)
MAPS_OUTPUT("oIntegerSignConfirm",MAPS::Integer,NULL,NULL,MAX_CIBLES_IR)
MAPS_OUTPUT("oVectorSize",MAPS::Integer,NULL,NULL,1)
MAPS_END_OUTPUTS_DEFINITION
// Use the macros to declare the properties
MAPS_BEGIN_PROPERTIES_DEFINITION(MAPSLivicRealObject2BaseType)
//MAPS_PROPERTY("pName",128,false,false)
MAPS_PROPERTY("pMaxPistes",20,false,false)
MAPS_PROPERTY("pFiltrePiste",false,false,false)
MAPS_END_PROPERTIES_DEFINITION
// Use the macros to declare the actions
MAPS_BEGIN_ACTIONS_DEFINITION(MAPSLivicRealObject2BaseType)
//MAPS_ACTION("aName",MAPSLivicRealObject2BaseType::ActionName)
MAPS_END_ACTIONS_DEFINITION
// Use the macros to declare this component (LivicRealObject2BaseType) behaviour
MAPS_COMPONENT_DEFINITION(MAPSLivicRealObject2BaseType,"LivicRealObject2BaseType","1.0",128,
MAPS::Threaded,MAPS::Threaded,
1, // Nb of inputs
13, // Nb of outputs
2, // Nb of properties
0) // Nb of actions
void MAPSLivicRealObject2BaseType::Birth()
{
}
void MAPSLivicRealObject2BaseType::Core()
{
int MaxPistes = GetIntegerProperty("pMaxPistes");
bool FiltrePiste = GetBoolProperty("pFiltrePiste");
//MAPSStreamedString toto("i: ");
MAPSIOElt *iEltRealObject = StartReading(Input("iRealObject"));
MAPSRealObject *iRealObject = &(iEltRealObject->RealObject());
MAPSTimestamp timestamp = iEltRealObject->Timestamp();
if((!FiltrePiste )||(FiltrePiste && (iEltRealObject->VectorSize())) )
{
MAPSIOElt *oEltIntegerId = StartWriting(Output("oIntegerId"));
MAPSIOElt *oEltFloatX = StartWriting(Output("oFloatX"));
MAPSIOElt *oEltFloatY = StartWriting(Output("oFloatY"));
MAPSIOElt *oEltFloatZ = StartWriting(Output("oFloatZ"));
MAPSIOElt *oEltIntegerNumeroPiste = StartWriting(Output("oIntegerNumeroPiste"));
MAPSIOElt *oEltIntegerEtatPiste = StartWriting(Output("oIntegerEtatPiste"));
MAPSIOElt *oEltVectorSize = StartWriting(Output("oVectorSize"));
MAPSIOElt *oEltFloatVitesse = StartWriting(Output("oFloatVitesse"));
MAPSIOElt *oEltFloatHauteur = StartWriting(Output("oFloatHauteur"));
MAPSIOElt *oEltFloatLargeur = StartWriting(Output("oFloatLargeur"));
MAPSIOElt *oEltFloatProfondeur = StartWriting(Output("oFloatProfondeur"));
MAPSIOElt *oEltIntegerVoie = StartWriting(Output("oIntegerVoie"));
MAPSIOElt *oEltIntegerSignConfirm = StartWriting(Output("oIntegerSignConfirm"));
MAPSInteger *oIntegerId = &(oEltIntegerId->Integer());
MAPSFloat *oFloatX = &(oEltFloatX->Float());
MAPSFloat *oFloatY = &(oEltFloatY->Float());
MAPSFloat *oFloatZ = &(oEltFloatZ->Float());
MAPSInteger *oIntegerNumeroPiste = &(oEltIntegerNumeroPiste->Integer());
MAPSInteger *oIntegerEtatPiste = &(oEltIntegerEtatPiste->Integer());
MAPSInteger *oVectorSize = &(oEltVectorSize->Integer());
MAPSFloat *oFloatVitesse = &(oEltFloatVitesse->Float());
MAPSFloat *oFloatHauteur = &(oEltFloatHauteur->Float());
MAPSFloat *oFloatLargeur = &(oEltFloatLargeur->Float());
MAPSFloat *oFloatProfondeur = &(oEltFloatProfondeur->Float());
MAPSInteger *oIntegerVoie = &(oEltIntegerVoie->Integer());
MAPSInteger *oIntegerSignConfirm = &(oEltIntegerSignConfirm->Integer());
int vsize = iEltRealObject->VectorSize();
oEltIntegerId->VectorSize() = MaxPistes;
oEltIntegerId->Timestamp() = timestamp;
oEltFloatX->VectorSize() = MaxPistes;
oEltFloatX->Timestamp() = timestamp;
oEltFloatY->VectorSize() = MaxPistes;
oEltFloatY->Timestamp() = timestamp;
oEltFloatZ->VectorSize() = MaxPistes;
oEltFloatZ->Timestamp() = timestamp;
oEltIntegerNumeroPiste->VectorSize() = MaxPistes;
oEltIntegerNumeroPiste->Timestamp() = timestamp;
oEltIntegerEtatPiste->VectorSize() = MaxPistes;
oEltIntegerEtatPiste->Timestamp() = timestamp;
oEltFloatVitesse->VectorSize() = MaxPistes;
oEltFloatVitesse->Timestamp() = timestamp;
oEltFloatHauteur->VectorSize() = MaxPistes;
oEltFloatHauteur->Timestamp() = timestamp;
oEltFloatProfondeur->VectorSize() = MaxPistes;
oEltFloatProfondeur->Timestamp() = timestamp;
oEltFloatLargeur->VectorSize() = MaxPistes;
oEltFloatLargeur->Timestamp() = timestamp;
oEltIntegerVoie->VectorSize() = MaxPistes;
oEltIntegerVoie->Timestamp() = timestamp;
oEltIntegerSignConfirm->VectorSize() = MaxPistes;
oEltIntegerSignConfirm->Timestamp() = timestamp;
oEltVectorSize->Timestamp() = timestamp;
*oVectorSize = vsize;
for(int i=0; i<MaxPistes; i++)
{
if(i<vsize)
{
oIntegerId[i] = iRealObject[i].id;
oFloatX[i] = iRealObject[i].x;
oFloatY[i] = iRealObject[i].y;
oFloatZ[i] = iRealObject[i].z;
oIntegerNumeroPiste[i] = iRealObject[i].misc1;
oIntegerEtatPiste[i] = iRealObject[i].misc2;
oFloatVitesse[i] = iRealObject[i].vehicle.speed;
oFloatHauteur[i] = iRealObject[i].vehicle.height;
oFloatLargeur[i] = iRealObject[i].vehicle.width;
oFloatProfondeur[i] = iRealObject[i].vehicle.length;
oIntegerVoie[i] = iRealObject[i].misc3;
oIntegerSignConfirm[i] = iRealObject[i].sign.type;
}
else
{
oIntegerId[i] = -1;
oFloatX[i] = -1;
oFloatY[i] = -1;
oFloatZ[i] = -1;
oIntegerNumeroPiste[i] = -1;
oIntegerEtatPiste[i] = -1;
oFloatVitesse[i] = -1;
oFloatHauteur[i] = -1;
oFloatLargeur[i] = -1;
oFloatProfondeur[i] = -1;
oIntegerVoie[i] = -1;
oIntegerSignConfirm[i] = -1;
}
}
//ReportInfo(toto);
StopWriting(oEltIntegerId);
StopWriting(oEltFloatX);
StopWriting(oEltFloatY);
StopWriting(oEltFloatZ);
StopWriting(oEltIntegerNumeroPiste);
StopWriting(oEltIntegerEtatPiste);
StopWriting(oEltVectorSize);
StopWriting(oEltFloatVitesse);
StopWriting(oEltFloatHauteur);
StopWriting(oEltFloatLargeur);
StopWriting(oEltFloatProfondeur);
StopWriting(oEltIntegerVoie);
StopWriting(oEltIntegerSignConfirm);
}
StopReading(Input("iRealObject"));
}
void MAPSLivicRealObject2BaseType::Death()
{
}